:root {
    --bg-main: #0f1117;
    --bg-card: rgba(255, 255, 255, 0.05);
    --bg-hover: rgba(255, 255, 255, 0.1);
    --accent: #5865f2;
    --accent-hover: #4752c4;
    --text-main: #ffffff;
    --text-dim: #b0b0b0;
    --border: rgba(255, 255, 255, 0.1);
    --glass: blur(10px);
}

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

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background-color: var(--bg-main);
    color: var(--text-main);
    line-height: 1.6;
    margin: 0;
    min-height: 100vh;
}

/* Layout */
.app-container {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* Sidebar / Nav */
.sidebar {
    width: 240px;
    background: #000;
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 20px 0;
}

.logo {
    padding: 0 30px 20px;
    font-size: 1.2rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.nav-item {
    padding: 12px 30px;
    cursor: pointer;
    color: var(--text-dim);
    transition: all 0.2s;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 12px;
}

.nav-item:hover {
    color: var(--text-main);
    background: var(--bg-hover);
}

.nav-item.active {
    color: var(--text-main);
    background: var(--bg-card);
    border-left: 3px solid var(--accent);
}

/* Main Area */
.main-stage {
    flex: 1;
    overflow-y: auto;
    padding: 40px;
    background: radial-gradient(circle at top left, #1a1a2e, #0a0a0c);
}

.tab-content {
    display: none;
    max-width: 1000px;
    margin: 0 auto;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Forms & UI Elements */
.card {
    background: var(--bg-card);
    backdrop-filter: var(--glass);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 24px;
}

h1 {
    font-size: 2rem;
    margin-bottom: 24px;
}

h2 {
    font-size: 1.2rem;
    margin-bottom: 16px;
    color: var(--accent);
}

button {
    background: var(--accent);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: 0.2s;
}

button:hover {
    background: var(--accent-hover);
}

input,
textarea,
select {
    width: 100%;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border);
    color: white;
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 16px;
    outline: none;
}

/* Configuration Cluster */
.config-section {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 25px;
    position: relative;
    margin-bottom: 30px;
}

.config-section h3 {
    position: absolute;
    top: -12px;
    left: 20px;
    background: #0a0a0c;
    padding: 0 10px;
    font-size: 0.85rem;
    color: var(--accent);
    font-weight: 800;
}

.scroll-pane {
    overflow-y: auto;
    padding-right: 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 15px;
    background: rgba(0, 0, 0, 0.1);
}

.scroll-pane::-webkit-scrollbar {
    width: 5px;
}

.scroll-pane::-webkit-scrollbar-track {
    background: transparent;
}

.scroll-pane::-webkit-scrollbar-thumb {
    background: var(--bg-hover);
    border-radius: 10px;
}

.mi-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
}

.mi-item:last-child {
    border-bottom: none;
}

.mi-tag {
    font-family: monospace;
    font-weight: bold;
    color: var(--accent);
    min-width: 80px;
}

/* Turn Card Styling */
.turn-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 16px;
    transition: transform 0.2s, border-color 0.2s;
}

.turn-card:hover {
    border-color: var(--accent);
    background: rgba(255, 255, 255, 0.05);
}

.turn-header {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-bottom: 12px;
}

.turn-id {
    font-family: monospace;
    font-weight: 800;
    color: var(--accent);
    background: rgba(88, 101, 242, 0.1);
    padding: 4px 8px;
    border-radius: 4px;
}

.intent-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.intent-badge {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 12px;
    background: var(--bg-hover);
    color: var(--text-dim);
    border: 1px solid var(--border);
}

.intent-badge.xfer {
    color: #f26522;
    background: rgba(242, 101, 34, 0.1);
    border-color: rgba(242, 101, 34, 0.2);
}

.intent-badge.bridge {
    color: #22f2a5;
    background: rgba(34, 242, 165, 0.1);
    border-color: rgba(34, 242, 165, 0.2);
}

.mb-3 {
    margin-bottom: 16px;
}

/* Benefit chips */
.benefit-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: .78rem;
    font-weight: 500;
    padding: 4px 12px;
    border-radius: 16px;
    background: rgba(88, 101, 242, 0.15);
    color: #c0c8ff;
    border: 1px solid rgba(88, 101, 242, 0.3);
    white-space: nowrap;
    transition: all 0.15s ease;
}

.benefit-chip:hover {
    background: rgba(88, 101, 242, 0.25);
    border-color: rgba(88, 101, 242, 0.5);
}

.chip-remove {
    cursor: pointer;
    opacity: .4;
    font-size: .68rem;
    margin-left: 1px;
    transition: all 0.15s ease;
}

.chip-remove:hover {
    opacity: 1;
    color: #ff6b6b;
}

/* Benefits section layout */
#benefits-section label {
    margin-bottom: 8px;
}

#benefit-add-input {
    margin-bottom: 0;
    padding: 6px 12px;
    font-size: .8rem;
}

.intent-extra-row {
    transition: border-color 0.15s ease;
}

.intent-extra-row:hover {
    border-color: rgba(88, 101, 242, 0.3) !important;
}

/* ─── Veteran Judge ──────────────────────────────────────────── */

.judge-cell {
    text-align: center;
    vertical-align: middle;
}

.judge-badge {
    cursor: pointer;
    font-size: 1.05rem;
    padding: 4px 8px;
    border-radius: 8px;
    transition: transform 0.15s, background 0.15s, box-shadow 0.15s;
    user-select: none;
}

.judge-badge:hover {
    transform: scale(1.25);
    box-shadow: 0 0 12px rgba(88, 101, 242, 0.3);
}

.judge-pass {
    background: rgba(34, 197, 94, 0.1);
}

.judge-regen {
    background: rgba(245, 158, 11, 0.15);
}

.judge-review {
    background: rgba(245, 158, 11, 0.2);
}

.judge-fail {
    background: rgba(239, 68, 68, 0.15);
}

/* ─── Judge Popup Card ───────────────────────────────────────── */

.judge-popup {
    position: fixed;
    z-index: 9999;
    width: 380px;
    max-height: 420px;
    overflow-y: auto;
    background: rgba(18, 18, 30, 0.97);
    backdrop-filter: blur(16px);
    border: 1px solid rgba(88, 101, 242, 0.25);
    border-radius: 14px;
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.5),
        0 0 0 1px rgba(255, 255, 255, 0.04) inset;
    padding: 0;
    animation: judgePopupIn 0.2s ease-out;
}

@keyframes judgePopupIn {
    from {
        opacity: 0;
        transform: translateY(6px) scale(0.97);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.judge-popup-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.judge-popup-tag {
    font-family: 'SF Mono', 'Cascadia Code', monospace;
    font-size: .78rem;
    font-weight: 700;
    color: var(--accent);
    background: rgba(88, 101, 242, 0.1);
    padding: 3px 8px;
    border-radius: 5px;
}

.judge-popup-verdict {
    font-size: .8rem;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 5px;
}

.judge-popup-verdict.judge-pass {
    color: #4ade80;
    background: rgba(34, 197, 94, 0.1);
}

.judge-popup-verdict.judge-review {
    color: #fbbf24;
    background: rgba(245, 158, 11, 0.12);
}

.judge-popup-verdict.judge-regen {
    color: #fb923c;
    background: rgba(245, 158, 11, 0.12);
}

.judge-popup-verdict.judge-fail {
    color: #f87171;
    background: rgba(239, 68, 68, 0.1);
}

.judge-popup-close {
    margin-left: auto;
    background: none;
    border: none;
    color: var(--text-dim);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
    border-radius: 4px;
    transition: color 0.15s, background 0.15s;
}

.judge-popup-close:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
}

.judge-popup-note {
    padding: 14px 16px;
    font-size: .82rem;
    line-height: 1.55;
    color: var(--text-dim);
}

.judge-popup-suggestion {
    padding: 0 16px 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    margin-top: 0;
    padding-top: 12px;
}

.judge-popup-suggest-label {
    font-size: .7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #86efac;
    margin-bottom: 6px;
}

.judge-popup-suggest-text {
    font-size: .82rem;
    line-height: 1.55;
    color: #d1fae5;
    font-style: italic;
    padding: 8px 10px;
    background: rgba(34, 197, 94, 0.06);
    border: 1px solid rgba(34, 197, 94, 0.12);
    border-radius: 6px;
}

.judge-popup-suggestion .btn {
    background: rgba(34, 197, 94, 0.15);
    color: #86efac;
    border: 1px solid rgba(34, 197, 94, 0.25);
    font-size: .75rem;
    padding: 5px 14px;
}

.judge-popup-suggestion .btn:hover {
    background: rgba(34, 197, 94, 0.25);
}

/* ─── Validation Column ─────────────────────────────────────── */

.flags-cell {
    vertical-align: middle;
    line-height: 1.8;
}

.flag-badge {
    display: inline-block;
    font-size: 0.65rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 12px;
    background: rgba(239, 68, 68, 0.1);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.2);
    white-space: nowrap;
    margin: 1px 2px;
    letter-spacing: 0.02em;
}

/* ─── Expert Panel ──────────────────────────────────────────── */

.expert-panel-overlay {
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease-out;
}

.expert-panel-modal {
    background: rgba(18, 18, 30, 0.98);
    backdrop-filter: blur(16px);
    border: 1px solid rgba(88, 101, 242, 0.25);
    border-radius: 16px;
    width: 90vw;
    max-width: 1100px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.6);
}

.expert-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.expert-panel-header h3 {
    font-size: 1.1rem;
    font-weight: 700;
    margin: 0;
}

.expert-panel-close {
    background: none;
    border: none;
    color: var(--text-dim);
    font-size: 1.4rem;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    transition: all 0.15s;
}

.expert-panel-close:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
}

.expert-panel-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

.expert-step-label {
    font-size: 0.85rem;
    color: var(--text-dim);
    margin-bottom: 16px;
}

/* Expert cards (available list) */
.expert-available-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 20px;
}

.expert-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.15s;
    user-select: none;
}

.expert-card:hover {
    border-color: var(--accent);
    background: rgba(88, 101, 242, 0.08);
}

.expert-card.selected {
    border-color: var(--accent);
    background: rgba(88, 101, 242, 0.15);
    box-shadow: 0 0 0 1px var(--accent);
}

.expert-card-icon {
    font-size: 1.3rem;
}

.expert-card-info {
    display: flex;
    flex-direction: column;
}

.expert-card-name {
    font-weight: 600;
    font-size: 0.85rem;
}

.expert-card-desc {
    font-size: 0.72rem;
    color: var(--text-dim);
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Pipeline */
.expert-pipeline {
    margin-bottom: 20px;
}

.expert-pipeline-header {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-dim);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.expert-pipeline-items {
    min-height: 44px;
    background: rgba(0, 0, 0, 0.2);
    border: 1px dashed var(--border);
    border-radius: 8px;
    padding: 8px;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.expert-pipeline-chip {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: rgba(88, 101, 242, 0.15);
    border: 1px solid rgba(88, 101, 242, 0.3);
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: grab;
    user-select: none;
    transition: all 0.15s;
}

.expert-pipeline-chip:active {
    cursor: grabbing;
    opacity: 0.7;
}

.expert-pipeline-chip .chip-remove {
    cursor: pointer;
    opacity: 0.5;
    font-size: 0.7rem;
    margin-left: 4px;
}

.expert-pipeline-chip .chip-remove:hover {
    opacity: 1;
    color: #ff6b6b;
}

.expert-pipeline-chip.completed {
    background: rgba(34, 197, 94, 0.15);
    border-color: rgba(34, 197, 94, 0.3);
}

.expert-pipeline-chip.active {
    background: rgba(245, 158, 11, 0.15);
    border-color: rgba(245, 158, 11, 0.3);
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* Running step */
.expert-running-status {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}

.expert-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border);
    border-top: 2px solid var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.expert-pipeline-progress {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* Review step */
.expert-review-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.expert-review-header h4 {
    margin: 0;
    font-size: 0.95rem;
}

.expert-review-summary {
    font-size: 0.8rem;
    color: var(--text-dim);
}

.expert-review-controls {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.expert-review-table-container {
    max-height: 50vh;
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: 8px;
    margin-bottom: 16px;
}

.expert-review-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.82rem;
}

.expert-review-table th {
    position: sticky;
    top: 0;
    background: rgba(18, 18, 30, 0.98);
    padding: 8px 10px;
    text-align: left;
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--text-dim);
    border-bottom: 1px solid var(--border);
}

.expert-review-table td {
    padding: 8px 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    vertical-align: top;
}

.expert-review-table tr.changed {
    background: rgba(245, 158, 11, 0.04);
}

.expert-review-table tr.changed td:nth-child(4) {
    color: #86efac;
}

.expert-review-table tr.unchanged td {
    opacity: 0.5;
}

.expert-review-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.expert-diff-del {
    background: rgba(239, 68, 68, 0.15);
    text-decoration: line-through;
    color: #f87171;
    padding: 1px 3px;
    border-radius: 3px;
}

.expert-diff-add {
    background: rgba(34, 197, 94, 0.15);
    color: #86efac;
    padding: 1px 3px;
    border-radius: 3px;
}

.expert-edit-area {
    width: 100%;
    min-height: 40px;
    background: transparent;
    border: 1px solid transparent;
    color: #86efac;
    font-size: 0.8rem;
    line-height: 1.6;
    padding: 4px 6px;
    border-radius: 4px;
    resize: none;
    overflow: hidden;
    font-family: inherit;
    margin: 0;
    transition: border-color 0.15s;
    field-sizing: content;
}

.expert-edit-area:hover {
    border-color: rgba(88, 101, 242, 0.2);
}

.expert-edit-area:focus {
    outline: none;
    border-color: rgba(88, 101, 242, 0.5);
    background: rgba(0, 0, 0, 0.15);
}

/* ─── Prompt Tuning Drawer ──────────────────────────────────── */

.expert-prompt-drawer {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(88, 101, 242, 0.2);
    border-radius: 10px;
    padding: 16px;
    margin-bottom: 12px;
    animation: slideDown 0.2s ease-out;
}

@keyframes slideDown {
    from { opacity: 0; max-height: 0; transform: translateY(-10px); }
    to { opacity: 1; max-height: 600px; transform: translateY(0); }
}

.prompt-drawer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.prompt-drawer-header h5 {
    margin: 0;
    font-size: 0.9rem;
    color: var(--text-bright);
}

.expert-prompt-textarea {
    width: 100%;
    min-height: 400px;
    max-height: 55vh;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(88, 101, 242, 0.15);
    color: var(--text);
    font-size: 0.78rem;
    line-height: 1.6;
    padding: 12px 14px;
    border-radius: 8px;
    resize: vertical;
    font-family: 'Fira Code', 'Consolas', monospace;
}

.expert-prompt-textarea:focus {
    outline: none;
    border-color: rgba(88, 101, 242, 0.5);
}

.prompt-drawer-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-top: 10px;
    flex-wrap: wrap;
}

/* ─── Feature Toggle Pills (User Management) ───────────────── */

.feature-toggle {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.75rem;
    padding: 4px 10px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.15s;
    user-select: none;
}

.feature-toggle.on {
    background: rgba(34, 197, 94, 0.15);
    color: var(--success);
    border: 1px solid rgba(34, 197, 94, 0.3);
}

.feature-toggle.off {
    background: var(--surface2);
    color: var(--text-muted);
    border: 1px solid transparent;
    opacity: 0.6;
}

.feature-toggle:hover {
    opacity: 1;
    filter: brightness(1.2);
}

/* ─── Expert Management ─────────────────────────────────────── */

.experts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
    gap: 20px;
}

.expert-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 22px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.expert-card:hover {
    border-color: var(--accent);
    box-shadow: 0 0 16px rgba(99, 102, 241, 0.08);
}

.expert-card-header {
    display: flex;
    align-items: center;
    gap: 14px;
}

.expert-card-icon {
    font-size: 2rem;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--surface2);
    border-radius: 10px;
    flex-shrink: 0;
}

.expert-card-meta {
    flex: 1;
    min-width: 0;
}

.expert-card-title {
    font-weight: 600;
    font-size: 1.05rem;
    line-height: 1.3;
}

.expert-card-slug {
    display: none;
}

.expert-badge {
    font-size: 0.7rem;
    padding: 4px 10px;
    border-radius: 10px;
    white-space: nowrap;
    flex-shrink: 0;
    align-self: flex-start;
}

.expert-badge.system {
    background: rgba(99, 102, 241, 0.15);
    color: var(--accent-hover);
}

.expert-badge.user {
    background: var(--surface2);
    color: var(--text-muted);
}

.expert-card-desc {
    font-size: 0.82rem;
    color: var(--text-muted);
    line-height: 1.55;
}

.expert-card-vars-row {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.expert-card-var-pill {
    font-size: 0.68rem;
    font-family: monospace;
    padding: 2px 8px;
    border-radius: 8px;
    background: rgba(99, 102, 241, 0.1);
    color: var(--accent-hover);
    border: 1px solid rgba(99, 102, 241, 0.18);
}

.expert-card-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-top: 10px;
    border-top: 1px solid var(--border);
    margin-top: auto;
}

.expert-card-actions {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

/* Variable Chips */
.variable-chips {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.var-chip {
    display: inline-flex;
    align-items: center;
    font-size: 0.75rem;
    font-family: monospace;
    padding: 4px 12px;
    border-radius: 14px;
    background: rgba(99, 102, 241, 0.12);
    color: var(--accent-hover);
    border: 1px solid rgba(99, 102, 241, 0.25);
    cursor: pointer;
    transition: all 0.15s;
    user-select: none;
}

.var-chip:hover {
    background: rgba(99, 102, 241, 0.25);
    border-color: var(--accent);
}

/* Prompt Editor (Expert Manager) */
.expert-prompt-editor {
    width: 100%;
    min-height: 350px;
    max-height: 60vh;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(88, 101, 242, 0.15);
    color: var(--text);
    font-size: 0.78rem;
    line-height: 1.6;
    padding: 14px 16px;
    border-radius: 8px;
    resize: vertical;
    font-family: 'Fira Code', 'Consolas', monospace;
}

/* Icon Picker */
.icon-picker-btn {
    width: 48px;
    height: 48px;
    font-size: 1.6rem;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: border-color 0.15s;
}

.icon-picker-btn:hover {
    border-color: var(--accent);
}

.icon-picker-dropdown {
    position: absolute;
    top: 54px;
    right: 0;
    z-index: 100;
    grid-template-columns: repeat(6, 1fr);
    gap: 4px;
    padding: 10px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 8px 24px rgba(0,0,0,0.4);
    min-width: 240px;
}

.icon-picker-item {
    font-size: 1.4rem;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.1s;
}

.icon-picker-item:hover {
    background: var(--surface2);
}

/* Upload Zone */
.test-upload-zone {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 18px 20px;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
}

.test-upload-zone:hover {
    border-color: var(--accent);
    background: rgba(99, 102, 241, 0.04);
}

.test-upload-zone #expert-test-upload-label {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.84rem;
    color: var(--text-muted);
}

.test-upload-zone.has-file {
    border-color: var(--success);
    border-style: solid;
    background: rgba(34, 197, 94, 0.04);
}

.test-upload-zone.has-file #expert-test-upload-label {
    color: var(--text);
}

/* ─── Product Generator Modal ────────────────────────────────── */

.product-gen-overlay {
    position: fixed;
    inset: 0;
    z-index: 10001;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease-out;
}

.product-gen-modal {
    background: rgba(18, 18, 30, 0.98);
    backdrop-filter: blur(16px);
    border: 1px solid rgba(88, 101, 242, 0.3);
    border-radius: 16px;
    width: 90vw;
    max-width: 680px;
    max-height: 88vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.04) inset;
    animation: judgePopupIn 0.25s ease-out;
}

.product-gen-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.product-gen-header h3 {
    font-size: 1.05rem;
    font-weight: 700;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.product-gen-close {
    background: none;
    border: none;
    color: var(--text-dim);
    font-size: 1.4rem;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    transition: all 0.15s;
}

.product-gen-close:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
}

.product-gen-body {
    padding: 20px 24px;
    overflow-y: auto;
    flex: 1;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.15) transparent;
}

.product-gen-body::-webkit-scrollbar {
    width: 5px;
}

.product-gen-body::-webkit-scrollbar-track {
    background: transparent;
}

.product-gen-body::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 10px;
}

.product-gen-body::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.25);
}

.product-gen-context-label {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-dim);
    margin-bottom: 6px;
}

.product-gen-context {
    width: 100%;
    resize: vertical;
    min-height: 60px;
    font-size: 0.82rem;
    margin-bottom: 12px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border);
    color: white;
    padding: 10px 12px;
    border-radius: 8px;
}

.product-gen-actions {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.product-gen-btn {
    padding: 8px 18px;
    font-size: 0.82rem;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s;
}

.product-gen-btn.primary {
    background: var(--accent);
    color: white;
    border: none;
}

.product-gen-btn.primary:hover {
    background: var(--accent-hover);
}

.product-gen-btn.primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.product-gen-btn.secondary {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-dim);
    border: 1px solid var(--border);
}

.product-gen-btn.secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

/* Option cards */
.product-gen-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.product-gen-option {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 14px 16px;
    transition: all 0.2s ease;
    cursor: default;
}

.product-gen-option:hover {
    border-color: rgba(88, 101, 242, 0.4);
    background: rgba(255, 255, 255, 0.05);
}

.product-gen-option-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.product-gen-angle-badge {
    display: inline-flex;
    align-items: center;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 99px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.product-gen-angle-badge.urgency {
    color: #f87171;
    background: rgba(248, 113, 113, 0.12);
    border: 1px solid rgba(248, 113, 113, 0.25);
}

.product-gen-angle-badge.value {
    color: #4ade80;
    background: rgba(74, 222, 128, 0.12);
    border: 1px solid rgba(74, 222, 128, 0.25);
}

.product-gen-angle-badge.problem {
    color: #fbbf24;
    background: rgba(251, 191, 36, 0.12);
    border: 1px solid rgba(251, 191, 36, 0.25);
}

.product-gen-angle-badge.aggressive {
    color: #f472b6;
    background: rgba(244, 114, 182, 0.12);
    border: 1px solid rgba(244, 114, 182, 0.25);
}

.product-gen-angle-badge.bait {
    color: #818cf8;
    background: rgba(129, 140, 248, 0.12);
    border: 1px solid rgba(129, 140, 248, 0.25);
}

.product-gen-angle-badge.wildcard {
    color: #fb923c;
    background: rgba(251, 146, 60, 0.12);
    border: 1px solid rgba(251, 146, 60, 0.25);
}

.product-gen-angle-badge.gray {
    color: #94a3b8;
    background: rgba(148, 163, 184, 0.12);
    border: 1px solid rgba(148, 163, 184, 0.25);
}

.product-gen-use-btn {
    background: rgba(88, 101, 242, 0.12);
    color: var(--accent);
    border: 1px solid rgba(88, 101, 242, 0.3);
    font-size: 0.72rem;
    font-weight: 600;
    padding: 4px 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s;
}

.product-gen-use-btn:hover {
    background: var(--accent);
    color: white;
}

.product-gen-summary {
    font-size: 0.82rem;
    line-height: 1.55;
    color: var(--text-dim);
    margin-bottom: 8px;
}

.product-gen-benefits {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.product-gen-benefit-chip {
    display: inline-flex;
    align-items: center;
    font-size: 0.68rem;
    font-weight: 500;
    padding: 2px 8px;
    border-radius: 12px;
    background: rgba(88, 101, 242, 0.1);
    color: #c0c8ff;
    border: 1px solid rgba(88, 101, 242, 0.2);
    white-space: nowrap;
}

/* Shimmer loading */
.product-gen-shimmer {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.product-gen-shimmer-card {
    height: 80px;
    border-radius: 10px;
    background: linear-gradient(
        90deg,
        rgba(255, 255, 255, 0.03) 25%,
        rgba(255, 255, 255, 0.06) 50%,
        rgba(255, 255, 255, 0.03) 75%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s ease-in-out infinite;
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.product-gen-footer {
    padding: 14px 24px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.product-gen-status {
    font-size: 0.75rem;
    color: var(--text-dim);
}

/* ─── Pitch Browser Modal ────────────────────────────────────── */

.pitch-browser-overlay {
    position: fixed;
    inset: 0;
    z-index: 10001;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease-out;
}

.pitch-browser-modal {
    background: rgba(18, 18, 30, 0.98);
    backdrop-filter: blur(16px);
    border: 1px solid rgba(88, 101, 242, 0.3);
    border-radius: 16px;
    width: 92vw;
    max-width: 740px;
    max-height: 88vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.04) inset;
    animation: judgePopupIn 0.25s ease-out;
}

.pitch-browser-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.pitch-browser-header h3 {
    font-size: 1.05rem;
    font-weight: 700;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.pitch-browser-close {
    background: none;
    border: none;
    color: var(--text-dim);
    font-size: 1.4rem;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    transition: all 0.15s;
}

.pitch-browser-close:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
}

.pitch-browser-filters {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    padding: 12px 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    align-items: center;
}

.pitch-browser-filters select,
.pitch-browser-filters input {
    font-size: 0.78rem;
    padding: 6px 10px;
    height: 34px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border);
    color: white;
    border-radius: 6px;
    margin-bottom: 0;
}

.pitch-browser-filters select:focus,
.pitch-browser-filters input:focus {
    outline: none;
    border-color: var(--accent);
}

.pitch-browser-body {
    padding: 16px 24px;
    overflow-y: auto;
    flex: 1;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.15) transparent;
}

.pitch-browser-body::-webkit-scrollbar {
    width: 5px;
}

.pitch-browser-body::-webkit-scrollbar-track {
    background: transparent;
}

.pitch-browser-body::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 10px;
}

.pitch-browser-footer {
    padding: 14px 24px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.pitch-browser-status {
    font-size: 0.75rem;
    color: var(--text-dim);
}

/* Pitch Cards */
.pitch-cards {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.pitch-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 14px 16px;
    transition: all 0.2s ease;
    cursor: default;
}

.pitch-card:hover {
    border-color: rgba(88, 101, 242, 0.4);
    background: rgba(255, 255, 255, 0.05);
}

.pitch-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
    gap: 8px;
}

.pitch-card-badges {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    flex: 1;
    min-width: 0;
}

.pitch-keyword-badge {
    display: inline-flex;
    align-items: center;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 99px;
    color: #22d3ee;
    background: rgba(34, 211, 238, 0.12);
    border: 1px solid rgba(34, 211, 238, 0.25);
    white-space: nowrap;
    max-width: 240px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pitch-trigger-pill {
    display: inline-flex;
    align-items: center;
    font-size: 0.62rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 99px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #a78bfa;
    background: rgba(167, 139, 250, 0.1);
    border: 1px solid rgba(167, 139, 250, 0.2);
    white-space: nowrap;
}

.pitch-use-btn {
    background: rgba(88, 101, 242, 0.12);
    color: var(--accent);
    border: 1px solid rgba(88, 101, 242, 0.3);
    font-size: 0.72rem;
    font-weight: 600;
    padding: 4px 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
    flex-shrink: 0;
}

.pitch-use-btn:hover {
    background: var(--accent);
    color: white;
}

.pitch-text {
    font-size: 0.82rem;
    line-height: 1.55;
    color: var(--text);
    margin-bottom: 6px;
    font-style: italic;
}

.pitch-concept {
    font-size: 0.74rem;
    color: var(--text-muted);
    margin-bottom: 6px;
    line-height: 1.4;
}

.pitch-meta {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    font-size: 0.68rem;
    color: var(--text-dim);
}

.pitch-meta span {
    display: inline-flex;
    align-items: center;
    gap: 3px;
}

/* ─── Pitch Source Indicator (Step 3) ────────────────────────── */

.pitch-source-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 99px;
    color: #22d3ee;
    background: rgba(34, 211, 238, 0.1);
    border: 1px solid rgba(34, 211, 238, 0.2);
    white-space: nowrap;
}

.pitch-source-clear {
    background: none;
    border: none;
    color: var(--text-dim);
    font-size: 0.7rem;
    cursor: pointer;
    padding: 2px 4px;
    border-radius: 4px;
    transition: all 0.15s;
    line-height: 1;
}

.pitch-source-clear:hover {
    color: #f87171;
    background: rgba(248, 113, 113, 0.1);
}