/* ================================================================
   MODERN TECH THEME — Dark / Terminal / AI Product
   Inspired by Linear, Vercel, Raycast, Warp
   ================================================================
   Section accent colors are driven per-section by CSS variables set
   inline from each section's color in app.py (see SECTIONS).
   ================================================================ */

:root {
    --bg:           #0D1117;
    --bg-deep:      #090C11;
    --surface:      #161B22;
    --surface-2:    #1C2230;
    --surface-3:    #21283A;
    --border:       #2A3040;
    --border-lt:    #1E2535;
    --border-glow:  rgba(124, 58, 237, 0.3);

    --violet:       #7C3AED;
    --violet-lt:    rgba(124, 58, 237, 0.12);
    --violet-glow:  rgba(124, 58, 237, 0.22);
    --cyan:         #06B6D4;
    --cyan-lt:      rgba(6, 182, 212, 0.1);
    --cyan-glow:    rgba(6, 182, 212, 0.2);
    --emerald:      #10B981;
    --emerald-lt:   rgba(16, 185, 129, 0.1);
    --emerald-glow: rgba(16, 185, 129, 0.2);
    --rose:         #F43F5E;
    --amber:        #F59E0B;

    --text:         #E6EDF3;
    --text-muted:   #7D8590;
    /* Dimmest readable text. Keep this legible on dark surfaces — do NOT use a
       near-background gray (e.g. #3D4555) for text or control borders. */
    --text-dim:     #6B7686;
    --text-soft:    #AEB8C2;

    --mono: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;
    --sans: 'Inter', system-ui, -apple-system, sans-serif;
    --content-max: 1100px;

    --gold:      #D4AF37;
    --gold-lt:   rgba(212, 175, 55, 0.12);
    --gold-glow: rgba(212, 175, 55, 0.28);

    --orange:      #F97316;
    --orange-lt:   rgba(249, 115, 22, 0.1);
    --orange-glow: rgba(249, 115, 22, 0.25);
}

/* ── Base ─────────────────────────────────────────────────────── */
* { box-sizing: border-box; }

body {
    font-family: var(--sans);
    background: var(--bg);
    color: var(--text);
    font-size: 13.5px;
    line-height: 1.55;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Custom scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--surface-3); }

/* ── Bootstrap overrides ─────────────────────────────────────── */
.bg-white        { background-color: var(--surface) !important; }
.bg-light        { background-color: var(--bg)      !important; }
.text-muted      { color: var(--text-muted) !important; }
.text-dark       { color: var(--text) !important; }
.text-success    { color: var(--emerald) !important; }
.text-danger     { color: var(--rose) !important; }
.border          { border-color: var(--border) !important; }
.border-bottom   { border-color: var(--border) !important; }
.border-top      { border-color: var(--border) !important; }
.bg-primary-subtle { background: var(--violet-lt) !important; }
.text-primary    { color: var(--violet) !important; }
.vr              { background-color: var(--border); opacity: 1; }

/* Form controls */
.form-control {
    font-family: var(--sans);
    background: var(--surface-2);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 13.5px;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.form-control:focus {
    background: var(--surface-2);
    color: var(--text);
    border-color: var(--violet);
    box-shadow: 0 0 0 3px var(--violet-lt), 0 0 12px var(--violet-glow);
}
.form-control::placeholder { color: var(--text-dim); }
#input-message::placeholder { color: var(--gold); }

/* Radios */
.form-check-input {
    background-color: var(--surface-2);
    border-color: var(--text-muted);
}
.form-check-input:checked {
    background-color: var(--violet);
    border-color: var(--violet);
}
.form-check-label { color: var(--text-muted); font-size: 0.82rem; }

/* ── Buttons ─────────────────────────────────────────────────── */
.btn-primary {
    background: linear-gradient(135deg, #7C3AED 0%, #6D28D9 100%);
    border: none;
    color: #fff;
    font-weight: 600;
    font-size: 13px;
    border-radius: 8px;
    padding: 7px 14px;
    box-shadow: 0 0 16px var(--violet-glow);
    transition: opacity 0.15s, transform 0.1s, box-shadow 0.15s;
}
.btn-primary:hover {
    background: linear-gradient(135deg, #8B4CF7 0%, #7C3AED 100%);
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 4px 20px var(--violet-glow);
}
.btn-primary:active, .btn-primary:focus {
    background: #5B21B6 !important;
    color: #fff !important;
    border: none !important;
    transform: translateY(0);
    box-shadow: 0 0 8px var(--violet-glow) !important;
}

/* Send button — gold */
#btn-send {
    background: linear-gradient(135deg, #D4AF37 0%, #B8960C 100%);
    box-shadow: 0 0 16px var(--gold-glow);
    color: #1A1000;
}
#btn-send:hover {
    background: linear-gradient(135deg, #E6C040 0%, #C9A227 100%);
    box-shadow: 0 4px 20px rgba(212,175,55,0.45);
    color: #1A1000;
}
#btn-send:active, #btn-send:focus {
    background: #A07C08 !important;
    box-shadow: 0 0 8px var(--gold-glow) !important;
    color: #1A1000 !important;
}

.btn-light, .btn-outline-secondary {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-muted);
    border-radius: 7px;
    font-size: 12.5px;
    font-weight: 500;
    transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.btn-light:hover, .btn-outline-secondary:hover,
.btn-light:focus, .btn-outline-secondary:focus {
    background: var(--surface-2);
    border-color: var(--surface-3);
    color: var(--text);
}
.btn-light:active, .btn-outline-secondary:active {
    background: var(--violet-lt) !important;
    border-color: var(--violet) !important;
    color: var(--violet) !important;
}
.btn-outline-secondary:disabled {
    border-color: var(--border-lt);
    color: var(--text-dim);
    opacity: 1;
}

.btn-danger {
    background: var(--rose);
    border: none;
    color: #fff;
    border-radius: 7px;
    font-size: 12.5px;
    font-weight: 600;
}
.btn-danger:hover { background: #E11D48; color: #fff; }
.btn-danger:active { background: #BE123C !important; color: #fff !important; }

/* Dropdown */
.dropdown-menu {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.5), 0 0 0 1px var(--border-lt);
    padding: 4px;
}
.dropdown-item {
    color: var(--text-muted);
    font-size: 12.5px;
    border-radius: 6px;
    padding: 6px 10px;
}
.dropdown-item:hover, .dropdown-item:focus {
    background: var(--surface-2);
    color: var(--text);
}
.dropdown-item:active { background: var(--violet-lt); color: var(--violet); }

/* ── Header & Input bar ──────────────────────────────────────── */
#top-panel > header, #input-area {
    background: var(--surface) !important;
    border-color: var(--border) !important;
}

#top-panel > header {
    box-shadow: 0 1px 0 var(--border-lt);
}

/* ── Section blocks ──────────────────────────────────────────── */
.section-block {
    min-height: 0;
    padding: 2px 0 2px 10px;
    border-left: 2px solid var(--accent, transparent);
    border-radius: 3px;
}

/* ── Section labels ──────────────────────────────────────────── */
.section-label {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: none;
    letter-spacing: 0.02em;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: var(--accent);
}

.btn-section-toggle {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: none;
    border: none;
    padding: 0 3px;
    cursor: pointer;
    transition: color 0.15s;
    color: var(--accent);
}
.btn-section-toggle:hover { filter: brightness(1.25); }

.section-chevron {
    font-size: 0.9rem;
    -webkit-text-stroke: 0.6px currentColor;
    transition: transform 0.2s;
}

/* ── Page header band (matches marketing pages) ──────────────── */
.page-header {
    flex: 0 0 auto;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}
.page-header-inner {
    max-width: var(--content-max);
    margin: 0 auto;
    padding: 10px 24px;
    display: flex;
    align-items: center;
    gap: 16px;
}

/* ── Header nav (brand bar links) ────────────────────────────── */
.header-nav {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}
.header-nav-link {
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--text-soft);
    text-decoration: none;
    white-space: nowrap;
    transition: color 0.15s;
    padding: 2px 0;
}
.header-nav-link:hover { color: var(--gold); text-decoration: none; }
.header-nav-link.active {
    color: var(--gold);
    border-bottom: 1px solid var(--gold);
}

/* ── Site footer ─────────────────────────────────────────────── */
.site-footer {
    text-align: center;
    padding: 28px 16px;
    font-size: 0.78rem;
    color: var(--text-muted);
    border-top: 1px solid var(--border);
}
.site-footer a { color: var(--gold); text-decoration: none; }
.site-footer a:hover { text-decoration: underline; }
.site-footer--app {
    padding: 8px 16px;
    font-size: 0.72rem;
}

/* Analytics consent is a site-wide blocking modal injected by
   static/consent.js (loaded on every page); its styles live there. */

/* ── Master model selector accordion ────────────────────────── */
.btn-master-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: none;
    border: none;
    padding: 4px 2px;
    cursor: pointer;
    transition: filter 0.15s;
}
.btn-master-toggle:hover { filter: brightness(1.2); }

.master-toggle-label {
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: var(--gold);
}

.master-chevron {
    font-size: 0.9rem;
    color: var(--gold);
    -webkit-text-stroke: 0.6px currentColor;
    transition: transform 0.2s;
}

#btn-master-toggle[aria-expanded="true"] .master-chevron {
    transform: rotate(90deg);
}

/* ── Select / Deselect buttons ───────────────────────────────── */
.btn-section {
    font-size: 0.67rem;
    font-weight: 600;
    border-width: 1px;
    border-style: solid;
    border-radius: 5px;
    padding: 1px 9px;
    cursor: pointer;
    letter-spacing: 0.03em;
    transition: background 0.12s, color 0.12s;
}
.btn-section { border-color: var(--accent-30); color: var(--accent); background: transparent; }
.btn-section:hover, .btn-section:active { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-edit-models { font-weight: 700; line-height: 1; }

/* ── Model toggle pills ──────────────────────────────────────── */
.model-checkbox-label {
    display: inline-flex;
    align-items: center;
    font-size: 0.75rem;
    font-weight: 700;
    font-family: var(--mono);
    cursor: pointer;
    user-select: none;
    padding: 3px 10px;
    border-radius: 5px;
    border: 1px solid var(--border);
    background: var(--surface-2);
    color: var(--text-muted);
    transition: border-color 0.12s, color 0.12s, background 0.12s, box-shadow 0.12s;
    letter-spacing: -0.01em;
}
.model-checkbox-label:active { transform: scale(0.97); }
.model-checkbox-label input[type="checkbox"] { display: none; }

/* Accent-driven pills — color inherited from the parent .section-block */
.model-checkbox-label { border-color: var(--accent-30); color: var(--accent); }
.model-checkbox-label:hover { border-color: var(--accent); background: var(--accent-15); box-shadow: 0 0 10px var(--accent-25); }
.model-checkbox-label.is-selected {
    background: var(--accent-25);
    border: 2px solid var(--accent);
    color: #fff;
    box-shadow: 0 0 18px var(--accent-45), inset 0 0 0 1px var(--accent-30);
    font-weight: 700;
}

/* ── Disabled model pills (e.g. local models without WebGPU) ──── */
.model-checkbox-label.model-disabled {
    opacity: 0.45;
    cursor: not-allowed;
    pointer-events: none;
}

/* ── WebGPU capability warning (Local LLMs section) ──────────── */
.webgpu-warning {
    font-size: 0.75rem;
    color: var(--amber);
    background: rgba(245, 158, 11, 0.08);
    border: 1px solid rgba(245, 158, 11, 0.25);
    border-radius: 6px;
    padding: 5px 10px;
    margin-bottom: 6px;
    width: 100%;
}

/* ── Waiting progress (WebLLM download / generation status) ──── */
.waiting-progress {
    font-family: var(--mono);
    font-size: 0.72rem;
    color: var(--text-soft);
}

/* ── Prompt box ──────────────────────────────────────────────── */
.prompt-box {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-left: 3px solid var(--gold);
    border-radius: 0 8px 8px 0;
    padding: 8px 14px;
    margin-bottom: 0;
}
.prompt-box .prompt-box-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 2px;
}
.prompt-box .prompt-label {
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--gold);
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-family: var(--mono);
}
.prompt-box .result-actions {
    display: flex;
    gap: 6px;
    align-items: center;
    flex-shrink: 0;
}
.prompt-box .btn-copy {
    font-size: 0.7rem;
    font-weight: 500;
    color: var(--text-soft);
    padding: 2px 7px;
    border-radius: 5px;
    border: 1px solid transparent;
    background: transparent;
    cursor: pointer;
    transition: border-color 0.12s, color 0.12s, background 0.12s;
    white-space: nowrap;
    flex-shrink: 0;
}
.prompt-box .btn-copy:hover {
    border-color: var(--border);
    background: var(--surface-3);
    color: var(--text);
}
.prompt-box p {
    font-size: 0.88rem;
    color: var(--text);
    margin: 0;
}

/* ── Gold — radio controls & option buttons ──────────────────── */
.form-check-inline .form-check-label {
    color: #C9A227;
}
.form-check-input:checked {
    background-color: var(--gold);
    border-color: var(--gold);
    box-shadow: 0 0 6px var(--gold-glow);
}
.form-check-input:focus {
    border-color: var(--gold);
    box-shadow: 0 0 0 3px var(--gold-lt);
}
small.text-muted.fw-semibold {
    color: #C9A227 !important;
}
/* Standard gold button. Use `.btn-gold` (alongside Bootstrap's `.btn`) for any
   new toolbar/action button instead of leaving it the default gray. */
.btn-gold {
    border-color: var(--gold);
    color: var(--gold);
}
.btn-gold:hover {
    border-color: var(--gold);
    color: var(--gold);
    background: var(--gold-lt);
    box-shadow: 0 0 10px var(--gold-glow);
}
.btn-gold:active {
    border-color: var(--gold) !important;
    color: var(--gold) !important;
    background: rgba(212,175,55,0.18) !important;
}
/* Keep gold styling when the button retains focus after a click
   (Bootstrap's outline-secondary focus style turns text white otherwise). */
.btn-gold:focus,
.btn-gold:focus-visible {
    border-color: var(--gold);
    color: var(--gold);
    background: transparent;
    box-shadow: 0 0 10px var(--gold-glow);
}
.btn-gold:disabled {
    border-color: rgba(212,175,55,0.4);
    color: rgba(212,175,55,0.4);
    background: transparent;
    opacity: 1;
}

/* API Code modal — Python snippet */
.api-code-pre {
    background: var(--bg-deep);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 14px;
    margin: 0;
    max-height: 60vh;
    overflow: auto;
    font-family: var(--mono);
    font-size: 0.78rem;
    line-height: 1.55;
    color: var(--text-soft);
    white-space: pre;
}
.api-code-pre code {
    font-family: inherit;
    color: inherit;
    white-space: pre;
}

/* Toggle-option buttons (Compare Results, Combine Results) */
.btn-toggle-option {
    transition: background 0.15s, box-shadow 0.15s, color 0.15s;
}
.btn-toggle-option.btn-toggle-on {
    background: var(--gold);
    color: #1a1a2e;
    border-color: var(--gold);
    box-shadow: 0 0 10px var(--gold-glow);
}
.btn-toggle-option.btn-toggle-on:hover {
    background: var(--gold);
    color: #1a1a2e;
    filter: brightness(1.1);
}
.btn-toggle-option.btn-toggle-on:focus,
.btn-toggle-option.btn-toggle-on:focus-visible {
    background: var(--gold);
    color: #1a1a2e;
    border-color: var(--gold);
}

/* ── Brand header ─────────────────────────────────────────────── */
.site-logo {
    font-family: var(--sans);
    font-weight: 700;
    font-size: 1.4rem;
    letter-spacing: -0.03em;
    color: var(--gold);
    line-height: 1;
    text-decoration: none;
    flex-shrink: 0;
}
.site-logo:hover { text-decoration: none; filter: brightness(1.15); }

/* ── Separator ───────────────────────────────────────────────── */
.separator-line {
    border: 0;
    border-top: 1px solid var(--border-lt);
    margin: 2px 0;
}

/* ── App container — centered at the shared site content width ── */
#app-container {
    width: 100%;
    max-width: var(--content-max);
    margin-left: auto;
    margin-right: auto;
    flex: 1 1 auto;
    min-height: 0;
}

/* ── Top panel (header + input, resizable) ───────────────────── */
/* Top panel: sections + options + input box — sized to content, anchored at top */
#top-panel {
    flex: 0 0 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
}
#top-panel > header { flex-shrink: 0; }
#input-area {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
}
#input-area > form {
    flex: 0 0 auto;
    width: 100%;
}
/* ── Results area — anchored below the input box, fills remaining space ── */
#results-area {
    flex: 1 1 0;
    min-height: 0;
}

/* ── Fresh state: stretch the typing box down to the footer ──────
   When no run has happened (#app-container.input-expanded), the input
   box is the only visible content surface, so let it grow to fill the
   viewport instead of leaving an empty gap. As soon as a run starts the
   class is removed (JS) and #results-area resumes growing. */
#app-container.input-expanded #top-panel { flex: 1 1 auto; }
#app-container.input-expanded #results-area { flex: 0 0 auto; padding: 0 !important; }
/* Header may shrink and let its section list scroll, so expanded sections
   never collide with / bleed over the stretched input box below. */
#app-container.input-expanded #top-panel > header {
    flex: 0 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
}
#app-container.input-expanded #top-panel > header > #master-model-selector,
#app-container.input-expanded #top-panel > header > #options-row { flex-shrink: 0; }
#app-container.input-expanded #all-sections-wrapper.show {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
}
/* Input box grows to fill leftover space but never shrinks, so the section
   list above scrolls instead of overlapping the textarea. */
#app-container.input-expanded #input-area { flex: 1 0 auto; min-height: 0; }
#app-container.input-expanded #input-area > form {
    flex: 1 1 auto;
    min-height: 0;
    align-items: stretch;
}
#app-container.input-expanded #input-area > form > #btn-send { align-self: flex-end; }
#app-container.input-expanded #input-message {
    height: 100%;
    max-height: none;
}

/* ── Follow-up bar ───────────────────────────────────────────── */
#followup-bar {
    flex-shrink: 0;
    padding: 0.5rem 0.75rem 0.6rem;
    border-top: 1px solid var(--border);
    background: var(--surface);
}
#followup-bar .form-control {
    min-width: 0;
    background: var(--surface-2);
    border-color: var(--border);
    color: var(--text);
    font-size: 0.875rem;
    line-height: 1.5;
    max-height: 160px;
    transition: border-color 0.15s, box-shadow 0.15s;
}
#followup-bar .form-control:focus {
    background: var(--surface-2);
    border-color: var(--gold);
    box-shadow: 0 0 0 2px rgba(212,175,55,0.18);
    color: var(--text);
    outline: none;
}
#followup-bar .form-control::placeholder { color: rgba(212,175,55,0.45); }
#btn-followup-send {
    background: var(--gold);
    border-color: var(--gold);
    color: #0D1117;
    min-width: 38px;
}
#btn-followup-send:hover {
    background: #c9a42a;
    border-color: #c9a42a;
    color: #0D1117;
}
#btn-followup-send:disabled {
    background: rgba(212,175,55,0.35);
    border-color: transparent;
    color: rgba(13,17,23,0.5);
}

/* ── Results container ───────────────────────────────────────── */
#results-container {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

/* ── Result cards ────────────────────────────────────────────── */
.result-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    transition: box-shadow 0.15s;
}
.result-card:hover {
    box-shadow: 0 4px 16px rgba(0,0,0,0.4);
}
.result-card.error-card { border-color: rgba(244, 63, 94, 0.35); }

.result-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px;
    background: var(--surface-2);
    border-bottom: 1px solid var(--border-lt);
}
.result-header .model-name {
    font-family: var(--mono);
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--text-muted);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}
.result-header .elapsed-time {
    font-family: var(--mono);
    font-size: 0.72rem;
    font-weight: 400;
    color: var(--text-soft);
    margin-left: 4px;
}
.result-header .token-stats {
    font-family: var(--mono);
    font-size: 0.72rem;
    font-weight: 400;
    color: var(--text-soft);
    margin-left: 4px;
}

/* ── Run Summary: tighter padding, lighter title, contrasting table ─────────── */
[data-testid="summary-table"] .result-body {
    padding: 6px;
}
[data-testid="summary-table"] .model-name {
    color: #AEB8C2;
}
.run-trial-note {
    color: #e74c3c;
    font-size: 0.82rem;
    font-weight: 600;
    margin: 2px 2px 8px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.run-trial-note .btn-add-key-trial {
    font-size: 0.78rem;
}
.run-summary-table {
    --bs-table-bg: transparent;
    --bs-table-color: var(--text);
    color: var(--text);
    margin-bottom: 0;
}
.run-summary-table th {
    background: var(--surface-3);
    color: #AEB8C2;
    border-color: var(--border);
}
.run-summary-table td {
    background: var(--surface-2);
    color: var(--text);
    border-color: var(--border);
}
/* Result-card accents (border / header / model name) are applied inline by
   app.js using each section's color. */

.result-header .btn-copy,
.llm-options-modal-header .btn-copy {
    font-size: 0.7rem;
    font-weight: 500;
    color: var(--text-soft);
    padding: 2px 7px;
    border-radius: 5px;
    border: 1px solid transparent;
    background: transparent;
    cursor: pointer;
    transition: border-color 0.12s, color 0.12s, background 0.12s;
    white-space: nowrap;
    flex-shrink: 0;
}
.result-header .btn-copy:hover,
.llm-options-modal-header .btn-copy:hover {
    border-color: var(--border);
    background: var(--surface-3);
    color: var(--text);
}
.result-header .result-actions,
.llm-options-modal-header .result-actions {
    display: flex;
    gap: 6px;
    align-items: center;
    flex-shrink: 0;
}

.result-body {
    padding: 14px;
    color: var(--text);
    font-size: 0.88rem;
    line-height: 1.65;
}
.result-body pre {
    background: var(--bg-deep);
    border: 1px solid var(--border-lt);
    border-radius: 7px;
    padding: 10px 14px;
    overflow-x: auto;
    color: var(--text);
    font-family: var(--mono);
    font-size: 0.82rem;
}
.result-body code { font-family: var(--mono); font-size: 0.83em; color: #A78BFA; }
.result-body p:last-child { margin-bottom: 0; }

.result-body table { width: 100%; border-collapse: collapse; margin-bottom: 1rem; font-size: 0.85rem; }
.result-body table th,
.result-body table td { padding: 6px 12px; border: 1px solid var(--border); text-align: left; }
.result-body table th { background: var(--surface-2); font-weight: 600; color: var(--text-muted); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em; }

/* ── Waiting / pulsing dots ──────────────────────────────────── */
/* Run queue panel (multitasking): lists every model in the run with a live
   status — Queued / Running / Done / Error / Skipped. */
.run-queue-box {
    padding: 12px 14px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    font-size: 0.85rem;
}
.run-queue-title {
    color: var(--gold);
    font-weight: 600;
    font-size: 0.82rem;
    margin-bottom: 8px;
}
.run-queue-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    padding: 3px 0;
}
.run-queue-name {
    font-weight: 600;
    overflow-wrap: anywhere;
}
.run-queue-status {
    flex-shrink: 0;
    font-size: 0.78rem;
    max-width: 55%;
    text-align: right;
    overflow-wrap: anywhere;
}
.run-queue-status.status-queued { color: var(--text-muted); }
.run-queue-status.status-running { color: var(--gold); }
.run-queue-status.status-done { color: #7CDAA6; }
.run-queue-status.status-error { color: #F57171; }
.run-queue-status.status-skipped { color: var(--text-muted); font-style: italic; }

.waiting-box {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    color: var(--text-soft);
    font-size: 0.85rem;
}
.spinner-dot {
    display: flex;
    gap: 4px;
    align-items: center;
    flex-shrink: 0;
}
.spinner-dot::before,
.spinner-dot::after,
.spinner-dot span {
    content: "";
    display: block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--dot-color, var(--violet));
    animation: pulse-dot 1.2s ease-in-out infinite;
}
.spinner-dot::before { animation-delay: 0s; }
.spinner-dot span { animation-delay: 0.2s; display: block; }
.spinner-dot::after { animation-delay: 0.4s; }

@keyframes pulse-dot {
    0%, 80%, 100% { opacity: 0.2; transform: scale(0.8); }
    40% { opacity: 1; transform: scale(1); }
}

/* ── Input area ──────────────────────────────────────────────── */
#input-message {
    min-width: 0;
    min-height: 120px;
    max-height: 200px;
    overflow-y: auto;
    line-height: 1.5;
    font-family: var(--sans);
    background: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: 8px;
    transition: border-color 0.15s, box-shadow 0.15s;
}
#input-message:focus {
    border-color: var(--gold);
    box-shadow: 0 0 0 3px var(--gold-lt), 0 0 14px var(--gold-glow);
}

/* ── No-model alert ──────────────────────────────────────────── */
.no-model-alert {
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--rose);
    padding: 3px 0 1px;
    opacity: 1;
    transition: opacity 0.4s;
}
.no-model-alert.fade-out { opacity: 0; }

/* ── History ─────────────────────────────────────────────────── */
.history-btn {
    font-size: 0.75rem;
    max-width: 280px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-align: left;
}

/* ── Section row ─────────────────────────────────────────────── */
.section-row {
    display: flex;
    align-items: center;
    gap: 5px;
    flex-wrap: wrap;
}

/* ── Icon sizes ──────────────────────────────────────────────── */
.icon-box    { width: 40px; height: 40px; }
.icon-box-lg { width: 80px; height: 80px; }

/* ── LLM Options Editor Modal ────────────────────────────────── */
.llm-options-modal-content {
    background: var(--surface);
    border: 1px solid #2A3140;
    border-radius: 10px;
}
.llm-options-modal-header {
    background: var(--surface-2);
    border-bottom: 1px solid #2A3140;
    padding: 0.75rem 1rem;
}
.llm-options-modal-header .modal-title {
    font-family: var(--mono);
    font-size: 0.82rem;
    color: var(--text-dim);
    letter-spacing: 0.04em;
    text-transform: uppercase;
}
.llm-options-modal-footer {
    border-top: 1px solid #2A3140;
    padding: 0.6rem 1rem;
}
.llm-options-textarea {
    font-family: var(--mono);
    font-size: 0.8rem;
    background: #0D1117;
    color: #E6EDF3;
    border: 1px solid #2A3140;
    border-radius: 6px;
    resize: vertical;
    line-height: 1.7;
}
.llm-options-textarea:focus {
    background: #0D1117;
    color: #E6EDF3;
    border-color: var(--gold);
    box-shadow: 0 0 0 2px rgba(212,175,55,0.15);
    outline: none;
}
/* Save button — accent-colored from the active section */
#llm-options-save {
    background: var(--accent-soft, rgba(212,175,55,0.15));
    color: #fff;
    border: 1px solid var(--accent, var(--gold));
}
#llm-options-save:hover { filter: brightness(1.18); }

/* Save buttons (API Parameters + API-key-required modals) — solid gold, high-contrast */
#api-params-save,
#key-required-save {
    background: var(--gold);
    color: #1a1a1a;
    border: 1px solid var(--gold);
    font-weight: 600;
}
#api-params-save:hover,
#key-required-save:hover { filter: brightness(1.12); }
#api-params-save:disabled,
#key-required-save:disabled { opacity: 0.6; }

/* Make the + edit button slightly more compact */
.btn-edit-models {
    padding: 0.1rem 0.45rem;
    font-size: 1rem;
    line-height: 1.2;
    font-weight: 400;
    opacity: 0.7;
}
.btn-edit-models:hover { opacity: 1; }

/* ── Settings modal sections ─────────────────────────────────── */
.settings-section {
    border: 1px solid #2A3140;
    border-radius: 8px;
    padding: 0.7rem 0.85rem;
    margin-bottom: 0.75rem;
    background: rgba(255,255,255,0.015);
}
.settings-section-title {
    font-family: var(--mono);
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--accent, var(--gold));
    margin-bottom: 0.4rem;
}

/* Info tooltip icon */
.info-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 15px;
    height: 15px;
    font-size: 0.72rem;
    color: var(--text-dim);
    cursor: help;
    margin-left: 4px;
    border-radius: 50%;
    transition: color 0.12s;
}
.info-icon:hover, .info-icon:focus { color: var(--accent, var(--gold)); outline: none; }

/* Parameter rows */
.param-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.35rem 0;
}
.param-label {
    flex: 0 0 150px;
    font-size: 0.82rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    margin: 0;
}
.param-control {
    flex: 1 1 auto;
    display: flex;
    align-items: center;
    gap: 0.6rem;
}
.param-slider { flex: 1 1 auto; }
.param-readout {
    font-family: var(--mono);
    font-size: 0.82rem;
    color: var(--text);
    min-width: 2.4rem;
    text-align: right;
}
.param-number {
    max-width: 150px;
    background: #0D1117;
    color: #E6EDF3;
    border: 1px solid #2A3140;
    font-family: var(--mono);
    font-size: 0.8rem;
}
.param-number:focus {
    background: #0D1117;
    color: #E6EDF3;
    border-color: var(--accent, var(--gold));
    box-shadow: none;
}

/* Segmented control */
.segmented {
    display: inline-flex;
    border: 1px solid #2A3140;
    border-radius: 6px;
    overflow: hidden;
}
.seg-btn {
    background: #0D1117;
    color: var(--text-muted);
    border: none;
    padding: 0.25rem 0.85rem;
    font-size: 0.78rem;
    cursor: pointer;
    transition: background 0.12s, color 0.12s;
    border-right: 1px solid #2A3140;
}
.seg-btn:last-child { border-right: none; }
.seg-btn.active {
    background: var(--accent, var(--gold));
    color: #fff;
    font-weight: 600;
}

/* API key field + status */
.llm-key-input {
    background: #0D1117;
    color: #E6EDF3;
    border: 1px solid #2A3140;
    font-family: var(--mono);
    font-size: 0.78rem;
}
.llm-key-input:focus {
    background: #0D1117;
    color: #E6EDF3;
    border-color: var(--accent, var(--gold));
    box-shadow: none;
}
.current-key-line { font-size: 0.78rem; font-family: var(--mono); }

/* Wider, left-aligned info tooltips */
.tooltip-inner { max-width: 320px; text-align: left; font-size: 0.78rem; line-height: 1.45; }
.key-status-set  { color: #6EE7B7; }
.key-status-none { color: var(--text-dim); }
.key-status-warn { color: #FCA768; }

/* Cached local-model cleanup list */
.cache-total {
    font-size: 0.74rem;
    font-family: var(--mono);
    color: var(--text-dim);
}
.cache-list {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    max-height: 220px;
    overflow-y: auto;
}
.cache-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.3rem 0.4rem;
    border: 1px solid #2A3140;
    border-radius: 6px;
    background: #0D1117;
    cursor: pointer;
    margin: 0;
}
.cache-row:hover { border-color: var(--accent, var(--gold)); }
.cache-name {
    flex: 1 1 auto;
    font-family: var(--mono);
    font-size: 0.74rem;
    color: #E6EDF3;
    word-break: break-all;
}
.cache-size {
    flex: 0 0 auto;
    font-family: var(--mono);
    font-size: 0.72rem;
    color: var(--text-dim);
    white-space: nowrap;
}

/* Master "Select All" checkbox row at the top of list modals */
.select-all-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.3rem 0.25rem 0.5rem;
    margin-bottom: 0.4rem;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    font-size: 0.8rem;
    color: var(--text-dim);
    user-select: none;
}
.select-all-row input { flex: 0 0 auto; cursor: pointer; }

/* Recent prompts / chats rows (reuse .cache-list container) */
.recent-row .cache-check { flex: 0 0 auto; }
.recent-text {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    cursor: pointer;
}
.recent-prompt-line {
    font-size: 0.78rem;
    color: #E6EDF3;
    word-break: break-word;
}
.recent-response-line {
    font-size: 0.72rem;
    color: var(--text-dim);
    word-break: break-word;
}
.recent-time-line {
    font-size: 0.68rem;
    color: var(--text-muted);
    margin-top: 0.1rem;
}
.recent-empty {
    font-size: 0.78rem;
    font-style: italic;
    color: var(--text-muted);
}

/* Run Summary model-name links → jump to that model's result card */
.summary-model-link {
    color: var(--gold);
    text-decoration: none;
    white-space: nowrap;
    font-size: 0.85em;
}
.summary-model-link:hover {
    color: #EBD388; /* light gold */
    text-decoration: none;
}
@keyframes cardFlash {
    0%   { box-shadow: 0 0 0 2px var(--gold-glow); background-color: var(--gold-lt); }
    100% { box-shadow: none; background-color: transparent; }
}
.card-flash {
    animation: cardFlash 1.6s ease-out;
}

/* Actual serving host/model (from OpenRouter response) */
.served-by {
    color: var(--text-muted);
    font-size: 0.78em;
    margin-left: 8px;
    white-space: nowrap;
}
.served-mismatch {
    color: #E8A33D;
    font-size: 0.78em;
    margin-left: 8px;
    white-space: nowrap;
}
.run-summary-table .served-mismatch {
    margin-left: 0;
    white-space: normal;
}
