/* ═══════════════════════════════════════════
   abcTitles — Stylesheet v1.1
   ═══════════════════════════════════════════ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --bg: #f3f4f6;
    --surface: #ffffff;
    --surface-2: #f9fafb;
    --surface-3: #f0f1f3;
    --border: #e2e4e9;
    --border-hover: #cdd0d5;
    --text: #111827;
    --text-secondary: #4b5563;
    --text-muted: #9ca3af;
    --text-faint: #d1d5db;
    --blue: #2563eb;
    --blue-hover: #1d4ed8;
    --blue-soft: rgba(37, 99, 235, 0.07);
    --blue-softer: rgba(37, 99, 235, 0.04);
    --blue-border: rgba(37, 99, 235, 0.25);
    --green: #16a34a;
    --green-hover: #15803d;
    --green-soft: rgba(22, 163, 74, 0.07);
    --green-border: rgba(22, 163, 74, 0.3);
    --green-text: #15803d;
    --yellow: #ca8a04;
    --yellow-soft: rgba(202, 138, 4, 0.07);
    --orange: #ea580c;
    --orange-soft: rgba(234, 88, 12, 0.07);
    --red: #dc2626;
    --red-soft: rgba(220, 38, 38, 0.06);
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md: 0 2px 8px rgba(0,0,0,0.06);
    --surface-hover: #f3f4f6;
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: 'Outfit', -apple-system, sans-serif;
    line-height: 1.55;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

/* ── Login ── */

.login-screen {
    position: fixed; inset: 0; background: var(--bg);
    display: flex; align-items: center; justify-content: center;
    z-index: 100; transition: opacity 0.35s ease;
}
.login-screen.out { opacity: 0; pointer-events: none; }

.login-card {
    width: 360px; background: var(--surface);
    border: 1px solid var(--border); border-radius: 14px;
    padding: 40px 36px; text-align: center;
    box-shadow: 0 4px 16px rgba(0,0,0,0.06);
}

.login-brand { display: flex; align-items: center; justify-content: center; gap: 10px; margin-bottom: 28px; }
.login-brand-icon {
    width: 34px; height: 34px; background: var(--blue);
    border-radius: 8px; display: flex; align-items: center; justify-content: center;
}
.login-brand-icon svg { width: 18px; height: 18px; }
.login-brand-name { font-size: 18px; font-weight: 600; }
.login-brand-name span { color: var(--text-muted); font-weight: 400; font-size: 14px; margin-left: 4px; }

.login-input {
    width: 100%; padding: 12px 16px; background: var(--surface-2);
    border: 1px solid var(--border); border-radius: 8px;
    font-size: 15px; font-family: inherit; color: var(--text);
    outline: none; text-align: center; letter-spacing: 2px; margin-bottom: 12px;
    transition: border-color 0.2s;
}
.login-input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-softer); }
.login-input::placeholder { letter-spacing: 0; color: var(--text-muted); }

.login-btn {
    width: 100%; padding: 12px; background: var(--blue); border: none;
    border-radius: 8px; color: #fff; font-size: 14px; font-weight: 600;
    font-family: inherit; cursor: pointer; transition: background 0.2s;
}
.login-btn:hover { background: var(--blue-hover); }
.login-error { color: var(--red); font-size: 13px; margin-bottom: 10px; display: none; }
.login-hint { margin-top: 14px; font-size: 12px; color: var(--text-muted); }

/* ── Topbar ── */

.topbar {
    background: var(--surface); border-bottom: 1px solid var(--border);
    padding: 0 24px; height: 50px;
    display: flex; align-items: center; justify-content: space-between;
}
.topbar-left { display: flex; align-items: center; gap: 10px; }
.topbar-icon {
    width: 28px; height: 28px; background: var(--blue);
    border-radius: 6px; display: flex; align-items: center; justify-content: center;
}
.topbar-icon svg { width: 14px; height: 14px; }
.topbar-title { font-size: 14px; font-weight: 600; }
.topbar-sep { color: var(--text-faint); margin: 0 2px; }
.topbar-sub { font-size: 13px; color: var(--text-muted); }
.topbar-right { display: flex; gap: 6px; align-items: center; }
.topbar-btn {
    padding: 6px 12px; background: none; border: 1px solid var(--border);
    border-radius: 6px; color: var(--text-secondary); font-size: 12px;
    font-family: inherit; cursor: pointer; display: flex; align-items: center; gap: 5px; white-space: nowrap;
    transition: all 0.15s;
}
.topbar-btn:hover { border-color: var(--border-hover); color: var(--text); background: var(--surface-2); }
.topbar-btn svg { width: 14px; height: 14px; opacity: 0.5; }

/* ── Container ── */

.container { max-width: 680px; margin: 0 auto; padding: 28px 24px 60px; }
.app { display: none; }
.app.visible { display: block; }

/* ── Form ── */

.form-card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: 12px; padding: 24px; box-shadow: var(--shadow-sm); margin-bottom: 24px;
}
.field { margin-bottom: 18px; }
.field:last-child { margin-bottom: 0; }
.field-label {
    font-size: 13px; font-weight: 600; color: var(--text-secondary);
    margin-bottom: 7px; display: flex; align-items: center; justify-content: space-between;
}

.chips { display: flex; flex-wrap: wrap; gap: 5px; }
.chip {
    padding: 6px 14px; border-radius: 7px; border: 1px solid var(--border);
    background: var(--surface); color: var(--text-secondary);
    font-size: 13px; font-weight: 500; font-family: inherit; cursor: pointer;
    transition: all 0.15s; position: relative;
}
.chip:hover { border-color: var(--border-hover); color: var(--text); background: var(--surface-2); }
.chip.active { border-color: var(--blue-border); background: var(--blue-soft); color: var(--blue); font-weight: 600; }
.chip-tip {
    display: none; position: absolute; bottom: calc(100% + 8px); left: 50%;
    transform: translateX(-50%); background: var(--text); color: #fff;
    font-size: 11px; font-weight: 400; padding: 5px 10px; border-radius: 6px;
    white-space: nowrap; z-index: 10; pointer-events: none;
}
.chip-tip::after {
    content: ''; position: absolute; top: 100%; left: 50%;
    transform: translateX(-50%); border: 5px solid transparent; border-top-color: var(--text);
}
.chip:hover .chip-tip { display: block; }

.input, .textarea {
    width: 100%; padding: 10px 14px; background: var(--surface);
    border: 1px solid var(--border); border-radius: 8px; color: var(--text);
    font-size: 14px; font-family: inherit; outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.input:focus, .textarea:focus { border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-softer); }
.input::placeholder, .textarea::placeholder { color: var(--text-faint); }
.textarea { resize: vertical; line-height: 1.6; font-size: 13px; }

.char-ind { font-family: 'Geist Mono', monospace; font-size: 11px; font-weight: 500; }
.char-ind.empty { color: var(--text-faint); }
.char-ind.ok { color: var(--green); }
.char-ind.warn { color: var(--orange); }
.ideal-hint { font-size: 11px; color: var(--text-muted); margin-top: 5px; }

.collapse-btn {
    background: none; border: none; color: var(--text-muted);
    font-size: 12px; font-family: inherit; cursor: pointer;
    display: flex; align-items: center; gap: 5px; white-space: nowrap; padding: 0; transition: color 0.15s;
}
.collapse-btn:hover { color: var(--text-secondary); }
.collapse-btn svg { width: 12px; height: 12px; transition: transform 0.2s; }
.collapse-btn.open svg { transform: rotate(90deg); }
.collapse-body { display: none; margin-top: 8px; }
.collapse-body.open { display: block; }

.adv-row { display: flex; gap: 10px; align-items: flex-end; }
.adv-row .field { flex: 1; margin-bottom: 0; }
.small-select {
    width: 100%; padding: 10px 36px 10px 14px; background: var(--surface);
    border: 1px solid var(--border); border-radius: 8px;
    font-size: 14px; font-family: inherit; color: var(--text);
    outline: none; -webkit-appearance: none; -moz-appearance: none; appearance: none;
    cursor: pointer; transition: border-color 0.2s, box-shadow 0.2s;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%239ca3af' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
    line-height: 1.4;
}
.small-select:hover { border-color: var(--border-hover); }
.small-select:focus { border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-softer); }
.small-num {
    width: 60px; padding: 8px 10px; background: var(--surface);
    border: 1px solid var(--border); border-radius: 8px;
    font-size: 13px; font-family: 'Geist Mono', monospace;
    text-align: center; color: var(--text); outline: none;
}

.gen-btn {
    width: 100%; padding: 12px; background: var(--blue); border: none;
    border-radius: 8px; color: #fff; font-size: 14px; font-weight: 600;
    font-family: inherit; cursor: pointer; transition: background 0.2s;
    display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 20px;
}
.gen-btn:hover { background: var(--blue-hover); }
.gen-btn:disabled { opacity: 0.45; cursor: not-allowed; }
.gen-btn .kbd {
    font-family: 'Geist Mono', monospace; font-size: 10px;
    padding: 2px 6px; background: rgba(255,255,255,0.2); border-radius: 3px;
}

/* ── Original strip ── */

.orig-strip {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: 10px; padding: 14px 20px; margin-bottom: 16px;
    display: none; box-shadow: var(--shadow-sm);
}
.orig-strip.visible { display: block; }
.orig-strip-label {
    font-size: 10px; text-transform: uppercase; letter-spacing: 1.5px;
    color: var(--text-muted); font-weight: 600; margin-bottom: 3px;
}
.orig-strip-title {
    font-family: 'Newsreader', Georgia, serif;
    font-size: 15px; color: var(--text-secondary); font-style: italic; line-height: 1.4;
}

/* ── Loading / Streaming progress ── */

.load-bar { display: none; margin-bottom: 20px; }
.load-bar.visible { display: block; }

.load-status {
    display: flex; align-items: center; gap: 8px; margin-bottom: 10px; font-size: 13px;
}
.load-spinner svg { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.load-phase { color: var(--text-secondary); font-weight: 500; }
.load-estimate { color: var(--text-muted); font-size: 12px; font-style: italic; }
.load-timer { color: var(--text-muted); font-size: 12px; font-variant-numeric: tabular-nums; margin-left: auto; }
.load-cancel {
    display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; margin-left: 8px;
    border: 1px solid var(--border); border-radius: 5px; background: var(--surface);
    color: var(--text-muted); font-size: 11px; font-family: inherit; cursor: pointer; transition: all 0.15s;
}
.load-cancel:hover { border-color: var(--red); color: var(--red); background: var(--red-soft); }

.load-progress-track {
    height: 3px; background: var(--surface-3); border-radius: 3px; overflow: hidden; margin-bottom: 8px;
}
.load-progress-fill {
    height: 100%; width: 0%; background: var(--blue); border-radius: 3px;
    transition: width 0.4s ease;
}
.load-progress-fill.indeterminate {
    width: 30%; animation: progress-slide 1.5s ease-in-out infinite;
}
@keyframes progress-slide {
    0% { margin-left: 0%; }
    50% { margin-left: 70%; }
    100% { margin-left: 0%; }
}
.load-variant-count { font-size: 12px; color: var(--text-muted); min-height: 18px; }

/* Streaming variant arrive animation */
.variant-card.stream-in {
    animation: stream-in 0.35s ease-out;
}
@keyframes stream-in {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ── Results ── */

.results-header {
    display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px;
}
.results-header-left { font-size: 13px; font-weight: 600; color: var(--text-secondary); }
.results-header-right { font-family: 'Geist Mono', monospace; font-size: 11px; color: var(--text-muted); }

.variant-card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: 10px; padding: 20px; margin-bottom: 10px;
    transition: border-color 0.2s, box-shadow 0.2s;
    animation: card-in 0.3s ease both; box-shadow: var(--shadow-sm);
}
.variant-card:nth-child(2){animation-delay:.04s}
.variant-card:nth-child(3){animation-delay:.08s}
.variant-card:nth-child(4){animation-delay:.12s}
.variant-card:nth-child(5){animation-delay:.16s}
.variant-card:nth-child(6){animation-delay:.20s}
@keyframes card-in { from{opacity:0;transform:translateY(8px)} to{opacity:1;transform:translateY(0)} }
.variant-card:hover { border-color: var(--border-hover); box-shadow: var(--shadow-md); }
.variant-card.chosen { border-color: var(--green-border); background: linear-gradient(135deg, #fff, rgba(22,163,74,0.02)); }

.variant-top { display: flex; align-items: flex-start; gap: 14px; margin-bottom: 10px; }
.variant-number {
    font-family: 'Geist Mono', monospace; font-size: 11px; font-weight: 600;
    color: var(--text-muted); background: var(--surface-3);
    padding: 3px 8px; border-radius: 5px; flex-shrink: 0; margin-top: 3px;
}
.variant-card.chosen .variant-number { color: var(--green-text); background: var(--green-soft); }
.variant-headline {
    font-family: 'Newsreader', Georgia, serif;
    font-size: 20px; font-weight: 500; line-height: 1.35; color: var(--text); flex: 1;
}

.variant-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.meta-tag {
    font-family: 'Geist Mono', monospace; font-size: 10px; font-weight: 500;
    text-transform: uppercase; letter-spacing: 0.3px; padding: 3px 8px; border-radius: 4px;
}
.meta-tag.frame { background: var(--blue-soft); color: var(--blue); }
.meta-tag.chars-ok { background: var(--green-soft); color: var(--green-text); }
.meta-tag.chars-warn { background: var(--yellow-soft); color: var(--yellow); }
.meta-tag.cb-low { background: var(--green-soft); color: var(--green-text); }
.meta-tag.cb-mid { background: var(--yellow-soft); color: var(--yellow); }
.meta-tag.cb-high { background: var(--orange-soft); color: var(--orange); }

.why-btn {
    background: none; border: none; color: var(--text-muted);
    font-size: 11px; font-family: inherit; cursor: pointer;
    margin-left: auto; display: flex; align-items: center; gap: 3px;
    transition: color 0.15s;
}
.why-btn:hover { color: var(--text-secondary); }
.why-btn svg { width: 12px; height: 12px; transition: transform 0.2s; }
.why-btn.open svg { transform: rotate(180deg); }

.variant-reasoning {
    display: none; font-size: 13px; color: var(--text-muted);
    line-height: 1.6; padding-top: 12px; margin-top: 12px;
    border-top: 1px solid var(--border);
}
.variant-reasoning.open { display: block; color: var(--text); }

.variant-actions {
    display: flex; align-items: center; gap: 4px; white-space: nowrap;
    margin-top: 14px; padding-top: 12px;
    border-top: 1px solid var(--surface-3);
}

.action-btn {
    padding: 5px 12px; border-radius: 6px; border: 1px solid var(--border);
    background: var(--surface); color: var(--text-secondary);
    font-size: 12px; font-weight: 500; font-family: inherit; cursor: pointer;
    display: flex; align-items: center; gap: 5px; white-space: nowrap; transition: all 0.15s;
}
.action-btn:hover { border-color: var(--border-hover); color: var(--text); background: var(--surface-2); }
.action-btn svg { width: 13px; height: 13px; }

.action-btn.use-btn { background: var(--green); border-color: var(--green); color: #fff; font-weight: 600; }
.action-btn.use-btn:hover { background: var(--green-hover); border-color: var(--green-hover); color: #fff; }
.action-btn.used-btn { background: var(--green-soft); border-color: var(--green-border); color: var(--green-text); font-weight: 600; }
.action-btn.used-btn:hover { background: var(--green-soft); border-color: var(--green-border); color: var(--green-text); }


.action-spacer { flex: 1; }

.icon-btn {
    padding: 4px 5px; border-radius: 5px; border: 1px solid transparent;
    background: transparent; color: var(--text-faint); cursor: pointer;
    transition: all 0.15s; display: flex; align-items: center;
}
.icon-btn:hover { background: var(--surface-2); border-color: var(--border); transform: scale(1.2); }
.icon-btn svg { width: 16px; height: 16px; }
.icon-btn[title="Upravit"]:hover { color: var(--blue); }
.icon-btn[title="Záložka"]:hover { color: var(--yellow); }
.icon-btn[title="Regenerovat"]:hover { color: var(--green); }
.icon-btn.bookmark-active { color: var(--yellow); }

/* Star rating */
.star-rating { display: flex; align-items: center; gap: 2px; }
.star-btn {
    background: none; border: none; cursor: pointer;
    padding: 3px; display: flex; align-items: center; transition: transform 0.1s;
    border-radius: 3px;
}
.star-btn:hover { transform: scale(1.25); }
.star-btn svg { width: 18px; height: 18px; stroke: var(--border); fill: none; stroke-width: 1.5; transition: all 0.15s; }
.star-btn.active svg { fill: var(--yellow); stroke: var(--yellow); }
.star-btn:hover svg { stroke: var(--yellow); }

.star-label {
    font-family: 'Geist Mono', monospace; font-size: 10px;
    color: var(--text-muted); margin-left: 4px; min-width: 1px;
}
.star-label.s1 { color: var(--red); }
.star-label.s2 { color: var(--orange); }
.star-label.s3 { color: var(--green); }
.star-label.s4 { color: var(--blue); }

.action-sep {
    width: 1px; height: 18px; background: var(--border); margin: 0 1px; flex-shrink: 0;
}

/* ── Inline edit ── */

.variant-card.editing .variant-headline { display: none; }
.variant-card.editing .variant-meta { display: none; }
.variant-card.editing .variant-reasoning { display: none; }
.variant-card.editing .variant-actions { display: none; }

.edit-area { display: none; }
.variant-card.editing .edit-area { display: block; }

.edit-textarea {
    width: 100%; padding: 12px 14px;
    font-family: 'Newsreader', Georgia, serif;
    font-size: 20px; font-weight: 500; line-height: 1.35;
    color: var(--text); background: var(--surface-2);
    border: 2px solid var(--blue); border-radius: 8px;
    outline: none; resize: none; overflow: hidden;
    box-shadow: 0 0 0 3px var(--blue-softer);
}

.edit-footer {
    display: flex; align-items: center; gap: 10px;
    margin-top: 10px;
}

.edit-char-count {
    font-family: 'Geist Mono', monospace;
    font-size: 12px; font-weight: 500;
}
.edit-char-count.ok { color: var(--green); }
.edit-char-count.warn { color: var(--orange); }

.edit-hint {
    font-size: 11px; color: var(--text-muted); margin-left: 4px;
}

.edit-spacer { flex: 1; }

.edit-cancel {
    padding: 5px 14px; border-radius: 6px;
    border: 1px solid var(--border); background: var(--surface);
    color: var(--text-secondary); font-size: 12px; font-weight: 500;
    font-family: inherit; cursor: pointer; transition: all 0.15s;
}
.edit-cancel:hover { border-color: var(--border-hover); color: var(--text); }

.edit-save {
    padding: 5px 14px; border-radius: 6px; border: none;
    background: var(--blue); color: #fff;
    font-size: 12px; font-weight: 600;
    font-family: inherit; cursor: pointer; transition: background 0.15s;
}
.edit-save:hover { background: var(--blue-hover); }

.edit-save .kbd {
    font-family: 'Geist Mono', monospace; font-size: 9px;
    padding: 1px 4px; background: rgba(255,255,255,0.25); border-radius: 2px;
    margin-left: 4px;
}

.edited-badge {
    font-family: 'Geist Mono', monospace; font-size: 10px; font-weight: 500;
    text-transform: uppercase; letter-spacing: 0.3px;
    padding: 3px 8px; border-radius: 4px;
    background: rgba(139, 92, 246, 0.08); color: #7c3aed;
}

/* ── Archive panel ── */

.panel-bg { position: fixed; inset: 0; background: rgba(0,0,0,0.12); z-index: 50; display: none; }
.panel-bg.open { display: block; }

.side-panel {
    position: fixed; right: 0; top: 0; bottom: 0; width: 400px;
    background: var(--surface); border-left: 1px solid var(--border);
    z-index: 51; transform: translateX(100%); transition: transform 0.3s ease;
    display: flex; flex-direction: column; box-shadow: -4px 0 24px rgba(0,0,0,0.06);
}
.side-panel.open { transform: translateX(0); }

.panel-header { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.panel-header h3 { font-size: 15px; font-weight: 600; }
.panel-close { background: none; border: none; color: var(--text-muted); cursor: pointer; padding: 4px; }
.panel-close:hover { color: var(--text); }
.panel-close svg { width: 16px; height: 16px; }

.panel-filters { padding: 10px 20px; display: flex; gap: 5px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.filter-btn {
    padding: 5px 11px; border-radius: 6px; border: 1px solid var(--border);
    background: none; color: var(--text-muted); font-size: 12px;
    font-family: inherit; cursor: pointer; transition: all 0.15s;
}
.filter-btn.active { border-color: var(--blue-border); color: var(--blue); background: var(--blue-soft); }
.filter-btn:hover:not(.active) { border-color: var(--border-hover); color: var(--text-secondary); }

.panel-body { flex: 1; overflow-y: auto; padding: 14px 20px; }

.archive-item { padding: 12px 0; border-bottom: 1px solid var(--border); }
.archive-original { font-size: 12px; color: var(--text-muted); margin-bottom: 3px; }
.archive-title { font-family: 'Newsreader', Georgia, serif; font-size: 14px; color: var(--text); line-height: 1.4; margin-bottom: 4px; }
.archive-meta { font-family: 'Geist Mono', monospace; font-size: 10px; color: var(--text-muted); display: flex; gap: 8px; }

/* ── Toast ── */

.toast {
    position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
    background: var(--red); color: #fff; padding: 10px 20px; border-radius: 8px;
    font-size: 13px; font-weight: 500; z-index: 80; display: none;
    box-shadow: 0 4px 16px rgba(220,38,38,0.25);
}

/* ── Prompt editor ── */

.prompt-section {
    background: var(--surface-2); border: 1px solid var(--border);
    border-radius: 8px; margin-bottom: 10px; overflow: hidden;
}
.prompt-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 12px 16px; cursor: pointer; user-select: none; transition: background 0.1s;
}
.prompt-header:hover { background: var(--surface-3); }
.prompt-label { font-size: 13px; font-weight: 600; color: var(--text); display: flex; align-items: center; gap: 8px; }
.prompt-slug {
    font-family: 'Geist Mono', monospace; font-size: 10px;
    color: var(--text-muted); font-weight: 400;
    background: var(--surface-3); padding: 2px 6px; border-radius: 3px;
}
.prompt-arrow {
    font-size: 10px; color: var(--text-muted);
    transition: transform 0.2s; display: inline-block;
}
.prompt-arrow.open { transform: rotate(90deg); }
.prompt-body { display: none; padding: 0 16px 16px; }
.prompt-body.open { display: block; }
.prompt-textarea {
    width: 100%; min-height: 140px; padding: 12px 14px;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: 6px; color: var(--text);
    font-size: 12px; font-family: 'Geist Mono', monospace;
    line-height: 1.7; resize: vertical; outline: none;
}
.prompt-textarea:focus { border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-softer); }
.prompt-actions {
    display: flex; justify-content: flex-end; align-items: center;
    gap: 8px; margin-top: 10px;
}
.prompt-save {
    padding: 6px 16px; border-radius: 5px; border: none;
    background: var(--blue); color: #fff; font-size: 12px;
    font-weight: 600; font-family: inherit; cursor: pointer; transition: background 0.15s;
}
.prompt-save:hover { background: var(--blue-hover); }
.prompt-save:disabled { opacity: 0.5; cursor: not-allowed; }
.prompt-reset {
    padding: 6px 16px; border-radius: 5px;
    border: 1px solid var(--border); background: var(--surface);
    color: var(--text-muted); font-size: 12px;
    font-family: inherit; cursor: pointer; transition: all 0.15s;
}
.prompt-reset:hover { border-color: var(--border-hover); color: var(--text-secondary); }
.prompt-status {
    font-size: 12px; color: var(--green); opacity: 0;
    transition: opacity 0.3s; margin-right: auto;
}
.prompt-status.visible { opacity: 1; }

/* ── Compare mode ── */

.compare-row {
    display: flex; align-items: center; gap: 12px; margin-top: 10px;
    padding-top: 12px; border-top: 1px dashed var(--border);
}
.compare-models { display: flex; gap: 10px; flex: 1; flex-wrap: wrap; }
.compare-check {
    display: flex; align-items: center; gap: 5px; white-space: nowrap;
    font-size: 12px; color: var(--text-secondary); cursor: pointer;
}
.compare-check input { accent-color: var(--blue); cursor: pointer; }
.compare-btn {
    padding: 8px 16px; background: var(--surface);
    border: 1px solid var(--blue-border); border-radius: 8px;
    color: var(--blue); font-size: 13px; font-weight: 600;
    font-family: inherit; cursor: pointer; white-space: nowrap;
    display: flex; align-items: center; gap: 6px; transition: all 0.15s;
}
.compare-btn:hover { background: var(--blue); color: #fff; }
.compare-btn:disabled { opacity: 0.45; cursor: not-allowed; }
.compare-btn svg { width: 14px; height: 14px; }

.compare-grid { display: grid; gap: 16px; margin-bottom: 24px; }
.compare-grid.cols-2 { grid-template-columns: 1fr 1fr; }
.compare-grid.cols-3 { grid-template-columns: 1fr 1fr 1fr; }

.compare-column {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: 12px; padding: 16px; box-shadow: var(--shadow-sm);
    display: flex; flex-direction: column;
}
.compare-column-error {
    opacity: 0.85;
}
.compare-column-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 14px; padding-bottom: 10px; border-bottom: 1px solid var(--border);
}
.compare-model-name {
    font-size: 14px; font-weight: 600; color: var(--text);
    display: flex; align-items: center; gap: 6px;
}
.compare-model-badge {
    font-family: 'Geist Mono', monospace; font-size: 9px;
    padding: 2px 6px; border-radius: 4px; text-transform: uppercase;
    letter-spacing: 0.5px; font-weight: 600;
}
.compare-model-badge.anthropic { background: #f0e6d3; color: #8b5e3c; }
.compare-model-badge.openai { background: #d3f0e6; color: #2d7a5e; }
.compare-model-badge.gemini { background: #d3e0f0; color: #3c5e8b; }

.compare-error {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 8px; padding: 32px 20px; text-align: center; flex: 1;
}
.compare-error-icon { color: var(--red); opacity: 0.5; }
.compare-error-icon svg { width: 32px; height: 32px; }
.compare-error-title { font-size: 14px; font-weight: 600; color: var(--red); }
.compare-error-msg {
    font-size: 12px; color: var(--text-muted); line-height: 1.5;
    max-width: 220px; word-break: break-word;
    background: var(--red-soft); border-radius: 6px; padding: 8px 12px;
}

.compare-variant {
    margin-bottom: 12px; padding-bottom: 12px;
    border-bottom: 1px solid var(--surface-3);
    animation: fadeUp 0.25s both;
}
.compare-variant:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }

.compare-variant-top {
    display: flex; align-items: flex-start; gap: 10px; margin-bottom: 8px;
}
.compare-variant-top .variant-number {
    flex-shrink: 0;
}
.compare-variant-title {
    font-family: 'Newsreader', Georgia, serif;
    font-size: 16px; font-weight: 500; line-height: 1.35;
    color: var(--text); flex: 1;
}
.compare-variant-meta {
    display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-bottom: 6px;
}
.compare-variant .dna-row {
    margin-bottom: 6px;
}
.compare-variant-actions {
    display: flex; align-items: center; gap: 4px;
}

/* ── Stats panel ── */

.stats-section { margin-bottom: 24px; }
.stats-title {
    font-size: 14px; font-weight: 600; color: var(--text);
    margin-bottom: 12px; padding-bottom: 6px; border-bottom: 1px solid var(--border);
}

.stats-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.stats-table th {
    text-align: left; padding: 6px 8px; font-weight: 600;
    color: var(--text-secondary); border-bottom: 1px solid var(--border);
    font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px;
}
.stats-table td { padding: 8px; border-bottom: 1px solid var(--surface-3); color: var(--text); }
.stats-table tr:last-child td { border-bottom: none; }

.stats-bar {
    display: flex; height: 8px; border-radius: 4px; overflow: hidden;
    background: var(--surface-3); margin-top: 2px;
}
.stats-bar-seg { height: 100%; transition: width 0.3s; }
.stats-bar-seg.s4 { background: var(--blue); }
.stats-bar-seg.s3 { background: var(--green); }
.stats-bar-seg.s2 { background: var(--yellow); }
.stats-bar-seg.s1 { background: var(--red); }

.stats-avg {
    font-family: 'Geist Mono', monospace; font-weight: 600; font-size: 14px;
}
.stats-avg.high { color: var(--blue); }
.stats-avg.good { color: var(--green); }
.stats-avg.mid  { color: var(--yellow); }
.stats-avg.low  { color: var(--red); }

.stats-empty {
    color: var(--text-muted); font-size: 13px; text-align: center;
    padding: 30px 0;
}

.dist-legend {
    display: flex; gap: 12px; flex-wrap: wrap;
    margin-top: 8px; padding-top: 8px;
    border-top: 1px dashed var(--border);
    font-size: 11px; color: var(--text-muted);
}
.dist-legend-item { display: flex; align-items: center; gap: 4px; }
.dist-dot {
    width: 8px; height: 8px; border-radius: 2px; flex-shrink: 0;
}
.dist-dot.s4 { background: var(--blue); }
.dist-dot.s3 { background: var(--green); }
.dist-dot.s2 { background: var(--yellow); }
.dist-dot.s1 { background: var(--red); }

@media (max-width: 900px) {
    .compare-grid.cols-3 { grid-template-columns: 1fr; }
    .compare-grid.cols-2 { grid-template-columns: 1fr; }
    .compare-column-header { flex-wrap: wrap; gap: 8px; }
}

/* ── Win rate cards ── */

.win-rate-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; }
.win-card {
    display: flex; flex-direction: column; align-items: center; gap: 4px;
    padding: 14px 12px; background: var(--surface-2);
    border: 1px solid var(--border); border-radius: 10px;
    text-align: center;
}
.win-card-top { display: flex; align-items: center; gap: 6px; }
.win-medal { font-size: 20px; line-height: 1; }
.win-pct { font-family: 'Geist Mono', monospace; font-size: 22px; font-weight: 700; color: var(--text); }
.win-detail { font-size: 11px; color: var(--text-muted); white-space: nowrap; }

/* ── Regen micro-instruction ── */

.regen-input-area {
    display: none; padding: 8px 0 0;
    border-top: 1px solid var(--surface-3); margin-top: 8px;
    gap: 6px; align-items: center;
}
.regen-input-area.open { display: flex; }
.regen-input {
    flex: 1; padding: 6px 10px; border: 1px solid var(--border);
    border-radius: 6px; background: var(--surface-2); color: var(--text);
    font-size: 12px; font-family: inherit; outline: none; transition: border-color 0.15s;
}
.regen-input:focus { border-color: var(--blue); }
.regen-input::placeholder { color: var(--text-faint); }
.regen-go {
    padding: 6px 10px; background: var(--surface-2); border: 1px solid var(--border);
    border-radius: 6px; cursor: pointer; color: var(--text-secondary);
    display: flex; align-items: center; transition: all 0.15s;
}
.regen-go:hover { background: var(--blue); color: #fff; border-color: var(--blue); }
.regen-go svg { width: 14px; height: 14px; }

/* ── Serious variants ── */
.serious-btn {
    background: var(--blue-soft); border-color: var(--blue-border); color: var(--blue); font-weight: 600;
}
.serious-btn:hover { background: var(--blue); border-color: var(--blue); color: #fff; }
.serious-results { display: none; }
.serious-results.open {
    display: block; margin-top: 10px; padding: 12px;
    background: var(--surface-2); border: 1px solid var(--border);
    border-radius: 8px; border-left: 3px solid #1e3a5f;
}
.serious-header {
    display: flex; align-items: center; gap: 8px; margin-bottom: 10px;
    padding-bottom: 8px; border-bottom: 1px solid var(--border);
}
.serious-label { font-weight: 600; font-size: 12px; color: #1e3a5f; text-transform: uppercase; letter-spacing: 0.5px; }
.serious-frame { font-size: 11px; color: var(--text-muted); font-style: italic; }
.serious-close {
    margin-left: auto; background: none; border: none; cursor: pointer;
    color: var(--text-faint); font-size: 14px; padding: 2px 6px; border-radius: 4px;
}
.serious-close:hover { background: var(--surface-3); color: var(--text); }
.serious-variant {
    padding: 8px 10px; margin-bottom: 6px;
    background: var(--bg); border: 1px solid var(--border); border-radius: 6px;
}
.serious-variant:last-child { margin-bottom: 0; }
.serious-variant-title { font-size: 14px; font-weight: 500; color: var(--text); line-height: 1.4; }
.serious-variant-meta { display: flex; align-items: center; gap: 6px; margin-top: 6px; }
.serious-loading { text-align: center; padding: 16px; color: var(--text-muted); font-size: 13px; }
.serious-error { text-align: center; padding: 12px; color: var(--red, #e53e3e); font-size: 13px; }

/* ── Site switcher bar ── */

:root { --site-color: #3b82f6; }

.site-bar {
    display: flex; gap: 6px; padding: 8px 20px;
    background: var(--surface-2); border-bottom: 1px solid var(--border);
    flex-wrap: wrap; align-items: center;
}
.site-chip {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 5px 12px; border-radius: 20px;
    font-size: 12px; font-weight: 500; font-family: inherit;
    border: 1.5px solid var(--border); background: transparent;
    cursor: pointer; transition: all 0.15s; white-space: nowrap;
}
.site-chip:hover { transform: scale(1.05); box-shadow: 0 2px 8px rgba(0,0,0,0.1); }
.site-chip.active { font-weight: 600; }
.site-chip.site-add {
    border-style: dashed; color: var(--text-muted); border-color: var(--border);
}
.site-chip.site-add:hover { color: var(--text); border-color: var(--text-muted); }
.site-dot {
    width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
}

/* ── Modal ── */

.modal-backdrop {
    display: none; position: fixed; inset: 0; z-index: 1000;
    background: rgba(0,0,0,0.5); backdrop-filter: blur(3px);
    justify-content: center; align-items: flex-start;
    padding: 40px 20px; overflow-y: auto;
}
.modal-backdrop.open { display: flex; }
.modal {
    background: var(--surface); border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    width: 100%; max-width: 900px; max-height: calc(100vh - 80px);
    display: flex; flex-direction: column; overflow: hidden;
}
.modal-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 16px 24px; border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}
.modal-title { font-weight: 600; font-size: 16px; }
.modal-close {
    background: none; border: none; font-size: 22px; cursor: pointer;
    color: var(--text-muted); padding: 2px 8px; border-radius: 4px;
}
.modal-close:hover { background: var(--surface-2); color: var(--text); }
.modal-body {
    padding: 20px 24px; overflow-y: auto; flex: 1;
}
.modal-body .form-group { margin-bottom: 16px; }
.modal-body .form-group label {
    display: block; font-size: 12px; font-weight: 500;
    color: var(--text-secondary); margin-bottom: 5px; text-transform: uppercase;
    letter-spacing: 0.5px;
}
.modal-body .form-row {
    display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
}
.modal-footer {
    padding: 16px 24px; border-top: 1px solid var(--border);
    display: flex; gap: 8px; justify-content: flex-end; flex-shrink: 0;
}

/* ── Playbook import table ── */

.import-area {
    border: 2px dashed var(--border); border-radius: 8px;
    padding: 24px; text-align: center; cursor: pointer;
    transition: all 0.15s; background: var(--surface-2);
}
.import-area:hover { border-color: var(--blue); background: var(--surface-3); }
.import-area.has-data { border-style: solid; border-color: var(--green); cursor: default; }
.import-hint { font-size: 12px; color: var(--text-muted); margin-top: 6px; }

.import-preview {
    width: 100%; border-collapse: collapse; font-size: 12px; margin-top: 12px;
}
.import-preview th {
    text-align: left; padding: 6px 8px; background: var(--surface-2);
    border-bottom: 2px solid var(--border); font-weight: 600;
    white-space: nowrap; position: sticky; top: 0;
}
.import-preview td {
    padding: 5px 8px; border-bottom: 1px solid var(--border);
    vertical-align: middle;
}
.import-preview tr:hover { background: var(--surface-2); }
.import-preview .title-cell { max-width: 300px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.import-preview .num { text-align: center; font-family: 'Geist Mono', monospace; font-size: 11px; }
.import-preview .score-bar {
    display: inline-block; height: 6px; border-radius: 3px;
    background: var(--blue); min-width: 2px; vertical-align: middle;
}

.tag-btn {
    padding: 2px 8px; border-radius: 4px; font-size: 11px;
    border: 1px solid var(--border); background: transparent;
    cursor: pointer; transition: all 0.12s; font-family: inherit;
}
.tag-btn:hover { transform: scale(1.1); }
.tag-btn.positive { background: var(--green); color: #fff; border-color: var(--green); }
.tag-btn.negative { background: var(--red); color: #fff; border-color: var(--red); }
.tag-btn.skip { background: var(--surface-3); color: var(--text-muted); }

.import-stats {
    display: flex; gap: 16px; padding: 10px 0; font-size: 13px;
    border-bottom: 1px solid var(--border); margin-bottom: 12px;
}
.import-stat { display: flex; align-items: center; gap: 4px; }
.import-stat .dot { width: 8px; height: 8px; border-radius: 50%; }

.import-scroll { max-height: 400px; overflow-y: auto; border: 1px solid var(--border); border-radius: 6px; }

/* ── Edit tabs ── */

.edit-tabs {
    display: flex; gap: 0; border-bottom: 2px solid var(--border); margin-bottom: 16px;
}
.edit-tab {
    padding: 8px 16px; font-size: 13px; font-family: inherit; font-weight: 500;
    background: none; border: none; border-bottom: 2px solid transparent;
    margin-bottom: -2px; cursor: pointer; color: var(--text-muted);
    transition: all 0.15s; white-space: nowrap;
}
.edit-tab:hover { color: var(--text); }
.edit-tab.active { color: var(--text); border-bottom-color: var(--site-color, var(--blue)); }

.edit-cat-row {
    display: flex; gap: 8px; align-items: flex-start; margin-bottom: 10px;
    padding: 8px; border-radius: 6px; background: var(--surface-2);
}
.edit-cat-order {
    font-size: 12px; color: var(--text-muted); width: 20px; text-align: right; flex-shrink: 0;
    padding-top: 8px;
}
.edit-cat-main { flex: 1; min-width: 0; }
.edit-cat-inputs { display: flex; gap: 6px; align-items: center; }
.edit-cat-name { flex: 1; }
.edit-cat-hint { flex: 1.5; }
.edit-cat-stats {
    display: flex; gap: 10px; flex-wrap: wrap; align-items: center;
    margin-top: 5px; padding-left: 2px;
}
.cat-stat {
    font-size: 11px; color: var(--text-muted);
    font-family: 'Geist Mono', monospace;
}
.cat-stat.cat-warn { color: var(--orange); font-weight: 600; }
.cat-alert {
    font-size: 11px; color: var(--red); font-weight: 500;
}
.cat-hint-warn {
    font-size: 11px; color: var(--orange);
}

.site-edit {
    padding: 4px 8px !important; font-size: 12px; border-color: var(--border) !important;
    color: var(--text-muted) !important;
}
.site-edit:hover { color: var(--text) !important; background: var(--surface-3) !important; }

/* ── Prompt preview ── */

.prompt-preview-section { margin-bottom: 8px; }
.prompt-breakdown {
    display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px;
}
.pb-pill {
    font-size: 11px; padding: 3px 8px; border-radius: 10px;
    font-family: 'Geist Mono', monospace; white-space: nowrap;
}
.pb-green { background: rgba(34,197,94,0.12); color: var(--green); }
.pb-red   { background: rgba(239,68,68,0.12);  color: var(--red); }
.pb-blue  { background: rgba(59,130,246,0.12);  color: var(--blue); }
.pb-orange { background: rgba(249,115,22,0.12); color: var(--orange); }
.pb-warn  { background: rgba(239,68,68,0.15); color: var(--red); font-weight: 600; }

.prompt-preview-box {
    font-family: 'Geist Mono', monospace; font-size: 11px; line-height: 1.6;
    background: var(--surface-2); border: 1px solid var(--border);
    border-radius: 6px; padding: 14px; max-height: 350px; overflow-y: auto;
    white-space: pre-wrap; word-break: break-word; color: var(--text-secondary);
}
.pp-section {
    display: block; font-weight: 700; color: var(--blue);
    margin-top: 6px; border-top: 1px dashed var(--border); padding-top: 4px;
}
.pp-placeholder {
    background: rgba(249,115,22,0.2); color: var(--orange);
    padding: 1px 4px; border-radius: 3px; font-weight: 600;
}
.pp-example { color: var(--text); }
.pp-score { color: var(--text-muted); font-size: 10px; }

/* ── Playbook table toolbar ── */

.pb-toolbar {
    display: flex; justify-content: space-between; align-items: center;
    flex-wrap: wrap; gap: 8px; margin-bottom: 8px;
}
.pb-filters {
    display: flex; gap: 6px; align-items: center;
}
.pb-filter-select {
    padding: 4px 8px; font-size: 11px; max-width: 150px;
}
.pb-count {
    font-size: 11px; color: var(--text-muted); font-family: 'Geist Mono', monospace;
    white-space: nowrap;
}

.pb-bulk-bar {
    display: flex; gap: 6px; align-items: center; padding: 8px 10px;
    background: var(--surface-2); border: 1px solid var(--blue);
    border-radius: 6px; margin-bottom: 8px;
}
.pb-bulk-count {
    font-size: 12px; font-weight: 600; color: var(--blue); margin-right: 4px;
    white-space: nowrap;
}
.pb-row-selected { background: rgba(59,130,246,0.08) !important; }

.import-preview th.sortable {
    cursor: pointer; user-select: none; transition: color 0.1s;
}
.import-preview th.sortable:hover { color: var(--blue); }

/* ── Performance dashboard ── */

.perf-empty {
    padding: 32px; text-align: center; color: var(--text-muted); font-size: 14px;
    background: var(--surface-2); border-radius: 8px;
}
.perf-cards {
    display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 16px;
}
.perf-card {
    background: var(--surface-2); border-radius: 8px; padding: 14px 12px;
    text-align: center; border: 1px solid var(--border);
}
.perf-card-num {
    font-size: 22px; font-weight: 700; font-family: 'Geist Mono', monospace;
    color: var(--text);
}
.perf-card-label {
    font-size: 11px; color: var(--text-muted); margin-top: 2px;
}
.perf-section {
    margin-bottom: 18px; padding-bottom: 14px; border-bottom: 1px solid var(--border);
}
.perf-section:last-child { border-bottom: none; }
.perf-section-title {
    font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 4px;
}
.perf-section-sub {
    font-size: 11px; color: var(--text-muted); margin-bottom: 10px;
}

@media (max-width: 600px) {
    .perf-cards { grid-template-columns: repeat(2, 1fr); }
}

/* ── Headline DNA tags (variant cards) ── */

.dna-row {
    display: flex; gap: 4px; flex-wrap: wrap; padding: 4px 0 2px;
}
.dna-tag {
    font-size: 10px; padding: 1px 6px; border-radius: 8px;
    font-family: 'Geist Mono', monospace; white-space: nowrap;
    border: 1px solid var(--border); color: var(--text-muted);
    background: var(--surface-2); cursor: default; transition: all 0.1s;
}
.dna-tag:hover { transform: scale(1.08); }
.dna-number   { color: var(--blue); border-color: rgba(59,130,246,0.3); background: rgba(59,130,246,0.06); }
.dna-question { color: var(--orange); border-color: rgba(249,115,22,0.3); background: rgba(249,115,22,0.06); }
.dna-list     { color: var(--blue); border-color: rgba(59,130,246,0.3); background: rgba(59,130,246,0.06); }
.dna-colon    { color: var(--text-muted); }
.dna-emotion  { color: var(--red); border-color: rgba(239,68,68,0.3); background: rgba(239,68,68,0.06); }
.dna-power    { color: var(--orange); border-color: rgba(249,115,22,0.3); background: rgba(249,115,22,0.06); }
.dna-direct   { color: var(--green); border-color: rgba(34,197,94,0.3); background: rgba(34,197,94,0.06); }
.dna-negative { color: var(--red); border-color: rgba(239,68,68,0.3); background: rgba(239,68,68,0.06); }
.dna-ideal    { color: var(--green); border-color: rgba(34,197,94,0.3); background: rgba(34,197,94,0.06); }

/* ── DNA insights (performance dashboard) ── */

.dna-insights { display: flex; flex-direction: column; gap: 6px; }
.dna-insight-row {
    display: grid; grid-template-columns: 28px 1fr 90px 100px 90px;
    align-items: center; gap: 6px; padding: 4px 0;
    font-size: 12px; border-bottom: 1px solid var(--surface-3);
}
.dna-insight-icon { text-align: center; font-size: 14px; }
.dna-insight-label { font-weight: 500; color: var(--text); }
.dna-insight-usage { font-family: 'Geist Mono', monospace; font-size: 10px; color: var(--text-muted); text-align: right; }
.dna-insight-bar { display: flex; align-items: center; }
.dna-bar-track { width: 100%; height: 6px; background: var(--surface-3); border-radius: 3px; overflow: hidden; }
.dna-bar-fill { height: 100%; border-radius: 3px; transition: width 0.3s; }
.dna-insight-delta {
    font-family: 'Geist Mono', monospace; font-size: 11px; font-weight: 600;
    text-align: right; white-space: nowrap;
}

.dna-recommendation {
    margin-top: 14px; display: flex; flex-direction: column; gap: 6px;
}
.dna-rec-item {
    font-size: 12px; padding: 8px 12px; border-radius: 6px; line-height: 1.5;
}
.dna-rec-good { background: rgba(34,197,94,0.08); color: var(--text); border-left: 3px solid var(--green); }
.dna-rec-bad  { background: rgba(249,115,22,0.08); color: var(--text); border-left: 3px solid var(--orange); }

@media (max-width: 640px) {
    .dna-insight-row { grid-template-columns: 24px 1fr 60px 70px; }
    .dna-insight-usage { display: none; }
}

/* ── Benchmark ── */

.bench-fields {
    display: flex; gap: 8px; align-items: center; margin-bottom: 8px;
}
.scrape-btn {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 7px 14px; font-size: 13px; font-weight: 500;
    background: var(--surface-2); color: var(--text-secondary);
    border: 1px solid var(--border); border-radius: 8px;
    cursor: pointer; transition: all 0.15s; white-space: nowrap;
    flex-shrink: 0;
}
.scrape-btn:hover { background: var(--blue); color: #fff; border-color: var(--blue); }
.scrape-btn:disabled { opacity: 0.45; cursor: not-allowed; }
.scrape-btn.loading { pointer-events: none; opacity: 0.7; }

/* Scrape modal — split view */
.scrape-modal {
    max-width: 1200px !important;
    height: calc(100vh - 80px);
    max-height: 800px;
}
.scrape-split {
    display: flex;
    flex: 1;
    overflow: hidden;
    min-height: 0;
}
.scrape-preview {
    flex: 1;
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    min-width: 0;
}
.scrape-iframe-wrap {
    flex: 1;
    position: relative;
    background: #f5f5f5;
    display: flex;
    align-items: center;
    justify-content: center;
}
.scrape-iframe-wrap iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: none;
    background: #fff;
}
.scrape-iframe-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    color: var(--text-muted);
    font-size: 13px;
}
.scrape-iframe-blocked {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    color: var(--text-muted);
    font-size: 13px;
    text-align: center;
    padding: 30px;
}
.scrape-open-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: var(--blue);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    transition: opacity 0.15s;
    margin-top: 4px;
}
.scrape-open-btn:hover { opacity: 0.85; }
.scrape-open-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: var(--text-muted);
    text-decoration: none;
    padding: 4px 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    transition: all 0.15s;
}
.scrape-open-link:hover { color: var(--text); border-color: var(--border-hover); }
.scrape-fields {
    width: 360px;
    flex-shrink: 0;
    padding: 16px 20px;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}
.scrape-fields-info {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 12px;
    padding: 8px 10px;
    background: var(--surface-2);
    border-radius: 6px;
    line-height: 1.5;
}
@media (max-width: 800px) {
    .scrape-modal { max-width: 100% !important; height: 100vh; max-height: none; }
    .scrape-split { flex-direction: column; }
    .scrape-preview { min-height: 300px; border-right: none; border-bottom: 1px solid var(--border); }
    .scrape-fields { width: 100%; }
}
.bench-perex {
    font-size: 12px; margin-bottom: 6px;
}
.bench-live-preview {
    padding: 6px 0;
}
.bench-card {
    background: var(--surface-2); border: 1px solid var(--border);
    border-radius: 8px; padding: 12px; margin-top: 8px;
}
.bench-card-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 6px;
}
.bench-domain {
    font-size: 11px; font-weight: 600; color: var(--text-muted);
    text-transform: uppercase; letter-spacing: 0.5px;
}
.bench-title {
    font-size: 15px; font-weight: 600; color: var(--text);
    line-height: 1.4; margin-bottom: 4px;
}
.bench-desc {
    font-size: 12px; color: var(--text-secondary); line-height: 1.4;
    margin-bottom: 8px;
}
.bench-analysis {
    display: flex; gap: 6px; align-items: center; flex-wrap: wrap;
}
.bench-chars {
    font-size: 10px; padding: 1px 6px; border-radius: 8px;
    font-family: 'Geist Mono', monospace; border: 1px solid var(--border);
    color: var(--text-muted); background: var(--surface);
}
.bench-badge {
    display: inline-block; font-size: 10px; padding: 2px 8px; border-radius: 8px;
    background: rgba(249,115,22,0.1); color: var(--orange); border: 1px solid rgba(249,115,22,0.3);
    font-weight: 500; margin-left: 6px; vertical-align: middle;
}

/* ═══ USER MANAGEMENT ═══ */
.topbar-user {
    font-size: 12px; color: rgba(255,255,255,0.7); padding: 0 8px;
    white-space: nowrap; line-height: 1;
}
.topbar-btn-secondary {
    opacity: 0.7; padding: 4px 8px !important; min-width: 0 !important;
}
.topbar-btn-secondary:hover { opacity: 1; }

.modal-backdrop.visible { display: flex; }

/* Login input spacing */
.login-input + .login-input { margin-top: 8px; }

/* Prompt editor code tags */
.prompt-group-label code { background:var(--surface-hover); padding:1px 4px; border-radius:3px; font-size:11px; }

/* ═══ MAIN TABS ═══ */
.main-tabs {
    display: flex;
    gap: 0;
    margin-bottom: -1px;
    position: relative;
    z-index: 1;
    padding: 0;
}
.main-tab {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 22px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-muted);
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    border-radius: 10px 10px 0 0;
    cursor: pointer;
    transition: all 0.15s;
}
.main-tab + .main-tab { border-left: none; }
.main-tab:hover { color: var(--text); background: var(--surface); }
.main-tab.active {
    color: var(--text);
    background: var(--surface);
    border-bottom-color: var(--surface);
    font-weight: 600;
}
.main-tab svg { opacity: 0.5; }
.main-tab.active svg { opacity: 1; }
.tab-badge {
    font-size: 10px;
    color: #f59e0b;
    margin-left: 2px;
}
.tab-content { display: none; }
.tab-content.active { display: block; }
.tab-content.form-card { border-top-left-radius: 0; }

/* ═══ PLANNING TAB ═══ */
.planning-intro {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    padding: 14px 16px;
    background: rgba(245, 158, 11, 0.06);
    border: 1px solid rgba(245, 158, 11, 0.15);
    border-radius: 8px;
    margin-bottom: 18px;
}
.planning-intro-icon { font-size: 22px; line-height: 1; }
.planning-intro-text { font-size: 13px; color: var(--text-muted); line-height: 1.5; }
.field-hint { font-size: 11px; color: var(--text-muted); font-weight: 400; }
.planning-actions {
    display: flex;
    gap: 10px;
    align-items: stretch;
    margin-top: 20px;
}
.planning-actions .gen-btn { margin-top: 0; flex: 1; }
.clear-btn {
    padding: 12px 20px;
    font-size: 14px;
    font-family: inherit;
    font-weight: 500;
    color: var(--text-muted);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
    display: flex;
    align-items: center;
    justify-content: center;
}
.clear-btn:hover { background: var(--red-soft); border-color: var(--red); color: var(--red); }

/* ═══ PLANNING SUMMARY (in generate tab) ═══ */
.planning-summary {
    padding: 12px 16px;
    background: rgba(245, 158, 11, 0.06);
    border: 1px solid rgba(245, 158, 11, 0.15);
    border-radius: 8px;
    margin-bottom: 14px;
}
.planning-summary-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    font-weight: 600;
    color: #f59e0b;
    margin-bottom: 6px;
}
.planning-summary-edit {
    font-size: 12px;
    color: var(--accent);
    background: none;
    border: none;
    cursor: pointer;
    text-decoration: underline;
    padding: 0;
}
.planning-summary-body {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.6;
}
.planning-summary-body .ps-tag {
    display: inline-block;
    background: var(--surface-hover);
    padding: 1px 6px;
    border-radius: 3px;
    font-size: 11px;
    margin: 1px 3px 1px 0;
}

@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }

/* ═══════════════════════════════════════════════════
   ARTICLE GENERATION
   ═══════════════════════════════════════════════════ */

.article-result-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    margin-top: 12px;
    overflow: hidden;
}
.article-result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 16px;
    border-bottom: 1px solid var(--border);
    gap: 8px;
    flex-wrap: wrap;
}
.article-result-meta {
    font-size: 12px;
    color: var(--text-muted);
    display: flex;
    gap: 6px;
    align-items: center;
}
.article-result-actions {
    display: flex;
    gap: 4px;
}

/* Article toolbar (two-row layout) */
.article-toolbar-row {
    display: flex;
    align-items: center;
    padding: 8px 16px;
    gap: 8px;
    flex-wrap: wrap;
}
.article-toolbar-top {
    justify-content: space-between;
    border-bottom: 1px solid var(--border);
    padding: 10px 16px;
}
.article-toolbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
}
.article-toolbar-actions {
    border-bottom: 1px solid var(--border);
    padding: 6px 16px;
    gap: 4px;
}
.article-toolbar-group {
    display: flex;
    gap: 3px;
}
.article-toolbar-group + .article-toolbar-group {
    margin-left: 4px;
    padding-left: 8px;
    border-left: 1px solid var(--border);
}

/* Toolbar buttons (compact, icon-first) */
.toolbar-btn {
    padding: 5px 10px;
    background: none;
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-secondary);
    font-size: 11px;
    font-family: inherit;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
    transition: all 0.15s;
}
.toolbar-btn svg { width: 13px; height: 13px; opacity: 0.5; flex-shrink: 0; }
.toolbar-btn:hover { border-color: var(--border-hover); color: var(--text); background: var(--surface-2); }
.toolbar-btn:hover svg { opacity: 0.8; }

/* Accent button — Obohatit */
.toolbar-btn-accent {
    background: var(--blue-soft, rgba(59,130,246,0.06));
    border-color: var(--blue-border, rgba(59,130,246,0.25));
    color: var(--blue);
    font-weight: 500;
}
.toolbar-btn-accent svg { opacity: 0.7; }
.toolbar-btn-accent:hover {
    background: var(--blue-soft, rgba(59,130,246,0.12));
    border-color: var(--blue);
    color: var(--blue);
}
.article-result-body {
    padding: 20px 24px;
    font-size: 15px;
    line-height: 1.75;
    color: var(--text);
    max-height: 70vh;
    overflow-y: auto;
}
.article-result-body h2 {
    font-size: 20px;
    font-weight: 600;
    margin: 24px 0 8px;
    color: var(--text);
}
.article-result-body h3 {
    font-size: 17px;
    font-weight: 600;
    margin: 20px 0 6px;
    color: var(--text);
}
.article-result-body h4 {
    font-size: 15px;
    font-weight: 600;
    margin: 16px 0 4px;
    color: var(--text);
}
.article-result-body p {
    margin: 0 0 12px;
}
.article-result-body blockquote {
    border-left: 3px solid var(--accent);
    padding-left: 14px;
    margin: 12px 0;
    color: var(--text-muted);
    font-style: italic;
}
.article-result-body ul {
    margin: 8px 0 12px;
    padding-left: 20px;
}
.article-result-body li {
    margin-bottom: 4px;
}
.article-result-body strong {
    font-weight: 600;
}
.article-result-footer {
    padding: 8px 16px;
    border-top: 1px solid var(--border);
    text-align: right;
}
.article-edit-textarea {
    width: 100%;
    min-height: 300px;
    padding: 20px 24px;
    font-family: 'Geist Mono', monospace;
    font-size: 13px;
    line-height: 1.7;
    border: none;
    resize: vertical;
    background: var(--surface);
    color: var(--text);
    box-sizing: border-box;
}
.article-edit-textarea:focus {
    outline: none;
    background: var(--bg);
}
.article-cursor {
    color: var(--accent);
    animation: blink 1s infinite;
}
@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

/* Article button in variant cards */
.article-btn {
    background: rgba(124, 58, 237, 0.07); border-color: rgba(124, 58, 237, 0.25); color: #7c3aed; font-weight: 600;
}
.article-btn:hover {
    background: #7c3aed; border-color: #7c3aed; color: #fff;
}

/* Article archive items */
.article-archive-item:hover {
    background: var(--surface-hover);
}
.article-archive-item .archive-title {
    font-weight: 500;
}

/* Article regenerate input */
.article-regen-area {
    display: none;
    padding: 10px 16px;
    border-top: 1px solid var(--border);
    gap: 6px;
}
.article-regen-area.open {
    display: flex;
}
.article-regen-area .regen-input {
    flex: 1;
}
.article-regen-area .regen-go {
    flex-shrink: 0;
}

/* Article word counter */
.article-word-counter {
    font-family: 'Geist Mono', monospace;
    font-size: 11px;
    color: var(--text-muted);
}

/* Perex separator */
.article-result-body hr {
    border: none;
    border-top: 2px solid var(--border);
    margin: 16px 0;
}

/* Ordered lists in article */
.article-result-body ol {
    margin: 8px 0 12px;
    padding-left: 24px;
}
.article-result-body ol li {
    margin-bottom: 4px;
}

/* Links in article */
.article-result-body a {
    color: var(--blue);
    text-decoration: underline;
}
