/* ==========================================================================
   PUBG ORACLE — UI
   Light, product-first interface for an Arabic market-intelligence tool.
   One accent (teal), one highlight (gold), calm surfaces, real hierarchy.
   ========================================================================== */

:root {
    /* Surfaces */
    --bg: #f4f6f8;
    --surface: #ffffff;
    --surface-2: #f9fafb;
    --surface-3: #f2f4f7;
    --border: #e4e7ec;
    --border-2: #d0d5dd;

    /* Text */
    --ink: #101828;
    --ink-2: #344054;
    --ink-3: #667085;
    --ink-4: #98a2b3;

    /* Brand + semantics */
    --brand: #0d7a63;
    --brand-dark: #0a6150;
    --brand-soft: #e7f4f0;
    --brand-line: #b3ded2;

    --gold: #a15c07;
    --gold-soft: #fdf6e7;
    --gold-line: #f0d9a8;

    --green: #067647;
    --green-soft: #ecfdf3;
    --green-line: #abefc6;

    --red: #b42318;
    --red-soft: #fef3f2;
    --red-line: #fecdca;

    --blue: #175cd3;
    --blue-soft: #eff8ff;
    --blue-line: #b2ddff;

    /* Shape */
    --radius: 12px;
    --radius-sm: 8px;
    --radius-xs: 6px;
    --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.05);
    --shadow-md: 0 4px 12px rgba(16, 24, 40, 0.06), 0 1px 3px rgba(16, 24, 40, 0.04);

    /* Type */
    --sans: 'IBM Plex Sans Arabic', system-ui, -apple-system, 'Segoe UI', Tahoma, sans-serif;
    --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

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

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
    font-family: var(--sans);
    font-size: 14px;
    line-height: 1.65;
    color: var(--ink);
    background: var(--bg);
    direction: rtl;
    text-align: right;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }

.tab-content { display: none; }
.tab-content.active { display: block; }

::selection { background: var(--brand-soft); color: var(--brand-dark); }

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }

:focus-visible {
    outline: 2px solid var(--brand);
    outline-offset: 2px;
}

/* ── Icons ─────────────────────────────────────────────────────────────── */
.ico {
    width: 1em;
    height: 1em;
    stroke-width: 1.85;
    flex: none;
    vertical-align: -0.125em;
}

.is-spinning .ico { animation: spin 0.9s linear infinite; }

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

/* ── Layout ────────────────────────────────────────────────────────────── */
.app {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.main { flex: 1; padding: 22px 0 48px; }

/* ── Top bar ───────────────────────────────────────────────────────────── */
.topbar {
    position: sticky;
    top: 0;
    z-index: 40;
    margin: 0 -20px;
    padding: 0 20px;
    background: rgba(255, 255, 255, 0.94);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
}

.topbar-inner {
    display: flex;
    align-items: center;
    gap: 20px;
    height: 62px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: none;
    color: var(--ink);
}
.brand:hover { text-decoration: none; }

.brand-mark {
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    border-radius: 9px;
    background: var(--brand);
    color: #fff;
    font-size: 17px;
    box-shadow: 0 2px 6px rgba(13, 122, 99, 0.25);
}

.brand-text { display: flex; flex-direction: column; line-height: 1.15; }

.brand-name { font-size: 15.5px; font-weight: 500; letter-spacing: 0.01em; }
.brand-name b { font-weight: 700; color: var(--brand); }

.brand-sub { font-size: 10.5px; color: var(--ink-4); margin-top: 3px; }

.nav {
    display: flex;
    align-items: center;
    gap: 2px;
    flex: 1;
    min-width: 0;
    overflow-x: auto;
    scrollbar-width: none;
}
.nav::-webkit-scrollbar { display: none; }

.nav-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 11px;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    background: none;
    color: var(--ink-3);
    font-size: 12.5px;
    font-weight: 500;
    white-space: nowrap;
    cursor: pointer;
    transition: background-color 0.14s ease, color 0.14s ease;
}
.nav-btn .ico { font-size: 14px; }
.nav-btn:hover { color: var(--ink); background: var(--surface-3); }

.nav-btn.active {
    color: var(--brand-dark);
    background: var(--brand-soft);
    border-color: var(--brand-line);
    font-weight: 600;
}

.topbar-side { flex: none; }

.data-chip {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 5px 10px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface-2);
    color: var(--ink-3);
    font-size: 11.5px;
    font-weight: 500;
    white-space: nowrap;
}

.pulse-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--green);
    box-shadow: 0 0 0 3px rgba(6, 118, 71, 0.12);
    flex: none;
}
.pulse-dot.is-stale {
    background: var(--gold);
    box-shadow: 0 0 0 3px rgba(161, 92, 7, 0.12);
}

/* ── Stale banner ──────────────────────────────────────────────────────── */
.stale-banner {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-top: 14px;
    padding: 11px 14px;
    border: 1px solid var(--gold-line);
    border-radius: var(--radius-sm);
    background: var(--gold-soft);
    color: #7a4a08;
    font-size: 12.5px;
    line-height: 1.7;
}
.stale-banner .ico { font-size: 16px; margin-top: 2px; color: var(--gold); }
.stale-banner b { color: #6b3f05; }

/* ── Hero ──────────────────────────────────────────────────────────────── */
.hero {
    padding: 10px 2px 22px;
    max-width: 780px;
}

.eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 11.5px;
    font-weight: 600;
    color: var(--brand);
    background: var(--brand-soft);
    border: 1px solid var(--brand-line);
    border-radius: 999px;
    padding: 3px 10px;
    margin-bottom: 14px;
}
.eyebrow .ico { font-size: 13px; }

.hero h1 {
    font-size: clamp(25px, 3.6vw, 36px);
    font-weight: 700;
    line-height: 1.3;
    letter-spacing: -0.01em;
    color: var(--ink);
}

.hero p {
    margin-top: 10px;
    font-size: 14.5px;
    color: var(--ink-3);
    max-width: 62ch;
}

.hero-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 18px;
    font-size: 12px;
    color: var(--ink-3);
}

.meta-item { display: inline-flex; align-items: center; gap: 6px; }
.meta-item .ico { font-size: 13px; color: var(--ink-4); }
.meta-item b {
    font-family: var(--mono);
    font-size: 12px;
    font-weight: 600;
    color: var(--ink);
    direction: ltr;
}
.meta-sep { width: 1px; height: 12px; background: var(--border-2); }

/* ── Panels ────────────────────────────────────────────────────────────── */
.panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 20px;
}

.panel-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

.panel-head h2 {
    font-size: 17px;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.panel-sub {
    font-size: 12.5px;
    color: var(--ink-3);
    margin-top: 4px;
    line-height: 1.65;
}

.section { margin-top: 26px; }

.section-head { margin-bottom: 12px; }
.section-head h3 {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 14px;
    font-weight: 600;
    color: var(--ink);
}
.section-head h3 .ico { font-size: 15px; color: var(--ink-4); }
.section-head .panel-sub { margin-top: 3px; }

/* ── Badges ────────────────────────────────────────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 9px;
    border: 1px solid var(--border-2);
    border-radius: 999px;
    background: var(--surface-2);
    color: var(--ink-3);
    font-size: 11px;
    font-weight: 500;
    white-space: nowrap;
}
.badge .ico { font-size: 12px; }

.badge-brand { background: var(--brand-soft); border-color: var(--brand-line); color: var(--brand-dark); }
.badge-green { background: var(--green-soft); border-color: var(--green-line); color: var(--green); }
.badge-red { background: var(--red-soft); border-color: var(--red-line); color: var(--red); }
.badge-gold { background: var(--gold-soft); border-color: var(--gold-line); color: var(--gold); }
.badge-blue { background: var(--blue-soft); border-color: var(--blue-line); color: var(--blue); }
.badge-muted { color: var(--ink-4); }

/* ── Buttons ───────────────────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--ink-2);
    font-size: 13px;
    font-weight: 600;
    padding: 9px 14px;
    cursor: pointer;
    transition: background-color 0.14s ease, border-color 0.14s ease, color 0.14s ease, box-shadow 0.14s ease;
}
.btn .ico { font-size: 15px; }

.btn-primary {
    background: var(--brand);
    border-color: var(--brand);
    color: #fff;
    box-shadow: 0 1px 2px rgba(13, 122, 99, 0.2);
}
.btn-primary:hover:not(:disabled) { background: var(--brand-dark); border-color: var(--brand-dark); }
.btn-primary:disabled { opacity: 0.7; cursor: progress; }

.btn-ghost {
    background: var(--surface);
    border-color: var(--border-2);
    color: var(--ink-2);
}
.btn-ghost:hover:not(:disabled) { border-color: var(--brand-line); color: var(--brand-dark); background: var(--brand-soft); }

.btn-sm { padding: 7px 11px; font-size: 12px; }
.btn-xs { padding: 4px 8px; font-size: 11.5px; border-radius: var(--radius-xs); }
.btn-lg { padding: 12px 22px; font-size: 14px; min-height: 46px; }

.btn-loader { display: inline-flex; align-items: center; gap: 8px; }
.btn-text { display: inline-flex; align-items: center; gap: 7px; }

.spinner {
    width: 13px;
    height: 13px;
    border: 2px solid rgba(255, 255, 255, 0.35);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    flex: none;
}

/* ── Evaluator ─────────────────────────────────────────────────────────── */
.preset-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    padding: 14px 0 4px;
}

.preset-label {
    font-size: 11.5px;
    font-weight: 600;
    color: var(--ink-4);
    margin-inline-end: 2px;
}

.chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 10px;
    border: 1px solid var(--border-2);
    border-radius: 999px;
    background: var(--surface);
    color: var(--ink-2);
    font-size: 12px;
    cursor: pointer;
    transition: border-color 0.14s ease, background-color 0.14s ease, color 0.14s ease;
}
.chip .ico { font-size: 13px; color: var(--ink-4); }
.chip:hover { border-color: var(--brand-line); background: var(--brand-soft); color: var(--brand-dark); }
.chip:hover .ico { color: var(--brand); }

.field { margin-top: 16px; }

.field-label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--ink-2);
    margin-bottom: 6px;
}

.textarea-wrap { position: relative; }

.textarea-wrap textarea {
    width: 100%;
    min-height: 168px;
    padding: 13px 14px 44px;
    border: 1px solid var(--border-2);
    border-radius: var(--radius-sm);
    background: var(--surface-2);
    color: var(--ink);
    font-size: 13.5px;
    line-height: 1.9;
    resize: vertical;
    transition: border-color 0.14s ease, background-color 0.14s ease, box-shadow 0.14s ease;
}
.textarea-wrap textarea::placeholder { color: var(--ink-4); }
.textarea-wrap textarea:focus {
    outline: none;
    border-color: var(--brand);
    background: var(--surface);
    box-shadow: 0 0 0 3px rgba(13, 122, 99, 0.1);
}
.textarea-wrap.highlight-preset textarea {
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(13, 122, 99, 0.12);
}

.textarea-tools {
    position: absolute;
    bottom: 9px;
    left: 9px;
    display: flex;
    gap: 6px;
}

.field-hint {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-top: 7px;
    font-size: 11.5px;
    color: var(--ink-4);
}
.field-hint .ico { font-size: 12px; }

.eval-actions {
    display: grid;
    grid-template-columns: minmax(0, 320px) max-content;
    justify-content: start;
    align-items: end;
    gap: 14px;
    margin-top: 16px;
}

.price-field { min-width: 0; }

.input-affix {
    display: flex;
    align-items: stretch;
    border: 1px solid var(--border-2);
    border-radius: var(--radius-sm);
    background: var(--surface-2);
    overflow: hidden;
    transition: border-color 0.14s ease, box-shadow 0.14s ease;
}
.input-affix:focus-within {
    border-color: var(--brand);
    background: var(--surface);
    box-shadow: 0 0 0 3px rgba(13, 122, 99, 0.1);
}

.input-affix input {
    flex: 1;
    min-width: 0;
    border: none;
    background: none;
    padding: 11px 12px;
    font-family: var(--mono);
    font-size: 14px;
    font-weight: 500;
    direction: ltr;
    text-align: left;
}
.input-affix input:focus { outline: none; }
.input-affix input::-webkit-outer-spin-button,
.input-affix input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

.affix {
    display: inline-flex;
    align-items: center;
    padding: 0 12px;
    border-inline-start: 1px solid var(--border);
    background: var(--surface-3);
    color: var(--ink-3);
    font-size: 11.5px;
    font-weight: 600;
    white-space: nowrap;
}

/* ── Pipeline progress ─────────────────────────────────────────────────── */
.progress {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 16px;
    margin-top: 16px;
    padding: 11px 13px;
    border: 1px dashed var(--border-2);
    border-radius: var(--radius-sm);
    background: var(--surface-2);
}

.progress-step {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 11.5px;
    color: var(--ink-4);
}
.progress-step .ico { font-size: 13px; }
.progress-step.is-done { color: var(--green); }
.progress-step.is-active { color: var(--brand); }
.progress-step.is-active .ico { animation: spin 1s linear infinite; }

/* ── Placeholder (pre-evaluation) ──────────────────────────────────────── */
.placeholder { margin-top: 20px; }

.placeholder-head {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 12px;
    font-weight: 600;
    color: var(--ink-4);
    margin-bottom: 9px;
}
.placeholder-head .ico { font-size: 14px; }

.placeholder-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.placeholder-card {
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 13px 14px;
    border: 1px dashed var(--border-2);
    border-radius: var(--radius-sm);
    background: var(--surface-2);
}

.ph-k { font-size: 11px; color: var(--ink-4); font-weight: 600; }
.ph-v {
    font-family: var(--mono);
    font-size: 22px;
    font-weight: 600;
    color: var(--ink-4);
    line-height: 1.3;
    direction: ltr;
    text-align: right;
}
.ph-s { font-size: 10.5px; color: var(--ink-4); }

/* ── Results ───────────────────────────────────────────────────────────── */
.results {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-top: 20px;
}

.verdict {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-inline-start: 3px solid var(--border-2);
    border-radius: var(--radius-sm);
    background: var(--surface-2);
}
.verdict-icon {
    width: 32px;
    height: 32px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: var(--surface);
    border: 1px solid var(--border);
    font-size: 15px;
    flex: none;
}
.verdict-body { min-width: 0; }
.verdict-title { font-size: 14px; font-weight: 700; }
.verdict-desc { font-size: 12.5px; color: var(--ink-3); margin-top: 3px; line-height: 1.7; }

.verdict--great { border-inline-start-color: var(--green); background: var(--green-soft); border-color: var(--green-line); }
.verdict--great .verdict-title { color: var(--green); }
.verdict--great .verdict-icon { color: var(--green); border-color: var(--green-line); }

.verdict--fair { border-inline-start-color: var(--brand); background: var(--brand-soft); border-color: var(--brand-line); }
.verdict--fair .verdict-title { color: var(--brand-dark); }
.verdict--fair .verdict-icon { color: var(--brand); border-color: var(--brand-line); }

.verdict--over { border-inline-start-color: var(--red); background: var(--red-soft); border-color: var(--red-line); }
.verdict--over .verdict-title { color: var(--red); }
.verdict--over .verdict-icon { color: var(--red); border-color: var(--red-line); }

/* Valuation block */
.valuation {
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
    gap: 20px;
    padding: 18px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}

.k {
    display: block;
    font-size: 11.5px;
    font-weight: 600;
    color: var(--ink-4);
    margin-bottom: 4px;
}

.value {
    display: inline-flex;
    align-items: baseline;
    gap: 7px;
    font-family: var(--mono);
    font-size: clamp(30px, 4vw, 42px);
    font-weight: 600;
    letter-spacing: -0.02em;
    line-height: 1.15;
    color: var(--brand-dark);
    direction: ltr;
}
.value small { font-size: 14px; font-weight: 500; color: var(--ink-3); letter-spacing: 0; }

.value-note {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 7px;
    margin-top: 8px;
    font-size: 12.5px;
    color: var(--ink-3);
}
.value-note b { font-family: var(--mono); color: var(--ink); font-weight: 600; direction: ltr; }

.delta {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 1px 7px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    font-family: var(--mono);
    direction: ltr;
}
.delta--bad { background: var(--red-soft); color: var(--red); border: 1px solid var(--red-line); }
.delta--good { background: var(--green-soft); color: var(--green); border: 1px solid var(--green-line); }
.delta--neutral { background: var(--surface-3); color: var(--ink-3); border: 1px solid var(--border); }

.value-note .badge { white-space: normal; line-height: 1.5; }

.valuation-side { min-width: 0; }

.range { margin-top: 4px; }

.range-track {
    position: relative;
    height: 8px;
    border-radius: 999px;
    background: var(--surface-3);
    margin: 14px 0 8px;
}

.range-fill {
    position: absolute;
    inset: 0;
    border-radius: 999px;
    background: var(--brand-soft);
    border: 1px solid var(--brand-line);
}

.range-marker {
    position: absolute;
    top: 50%;
    width: 12px;
    height: 12px;
    margin-top: -6px;
    margin-inline-start: -6px;
    border-radius: 50%;
    border: 2px solid #fff;
    box-shadow: 0 0 0 1px var(--border-2);
    background: var(--ink-3);
}
.range-marker.is-fair { background: var(--brand); box-shadow: 0 0 0 1px var(--brand); }
.range-marker.is-ask { background: var(--red); box-shadow: 0 0 0 1px var(--red); }

.range-labels {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    font-family: var(--mono);
    font-size: 11px;
    color: var(--ink-3);
    direction: ltr;
}

.range-legend {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-top: 10px;
    font-size: 11px;
    color: var(--ink-3);
}
.range-legend span { display: inline-flex; align-items: center; gap: 5px; }
.legend-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.legend-dot.is-fair { background: var(--brand); }
.legend-dot.is-ask { background: var(--red); }

/* Result cards */
.cards {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.card {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    padding: 16px;
    box-shadow: var(--shadow-sm);
    min-width: 0;
}

.card-wide { margin-top: 14px; }

.cards-split { grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); }

.card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}
.card-head h3 {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 13px;
    font-weight: 600;
    color: var(--ink);
}
.card-head h3 .ico { font-size: 14px; color: var(--ink-4); }

/* Trust */
.trust { display: flex; align-items: center; gap: 14px; }

.trust-ring { position: relative; width: 76px; height: 76px; flex: none; }
.trust-ring svg { transform: rotate(-90deg); display: block; }
.trust-ring .ring-bg { fill: none; stroke: var(--surface-3); stroke-width: 7; }
.trust-ring .ring-fg { fill: none; stroke: var(--brand); stroke-width: 7; stroke-linecap: round; transition: stroke-dashoffset 0.5s ease; }
.trust-ring.is-warn .ring-fg { stroke: var(--gold); }
.trust-ring.is-bad .ring-fg { stroke: var(--red); }

.trust-score {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    font-family: var(--mono);
    font-size: 19px;
    font-weight: 600;
    direction: ltr;
}

.trust-copy { min-width: 0; }
.trust-title { font-size: 13px; font-weight: 600; line-height: 1.4; }
.trust-sub { font-size: 11.5px; color: var(--ink-3); margin-top: 2px; }

/* Anchors */
.anchor-list { display: flex; flex-wrap: wrap; gap: 6px; }

.anchor {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    border: 1px solid var(--gold-line);
    border-radius: var(--radius-xs);
    background: var(--gold-soft);
    color: #7a4a08;
    font-size: 11.5px;
    line-height: 1.5;
}

.anchor-tier {
    font-family: var(--mono);
    font-size: 9.5px;
    font-weight: 600;
    letter-spacing: 0.04em;
    padding: 0 4px;
    border-radius: 3px;
    background: #fff;
    border: 1px solid var(--gold-line);
    color: var(--gold);
    direction: ltr;
}

.muted-note { font-size: 12px; color: var(--ink-4); }

/* Specs */
.spec-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(104px, 1fr));
    gap: 8px;
}

.spec {
    padding: 9px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface-2);
}

.spec-k {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 10.5px;
    color: var(--ink-4);
    line-height: 1.4;
}
.spec-k .ico { font-size: 12px; }

.spec-v {
    margin-top: 4px;
    font-family: var(--mono);
    font-size: 15px;
    font-weight: 600;
    color: var(--ink);
    line-height: 1.35;
}
.spec-v.is-unknown { color: var(--ink-4); font-weight: 500; }

/* Audit */
.audit-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
}

.audit-col { min-width: 0; }

.audit-title {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11.5px;
    font-weight: 700;
    margin-bottom: 7px;
}
.audit-title .ico { font-size: 13px; }
.audit-title.is-green { color: var(--green); }
.audit-title.is-red { color: var(--red); }
.audit-title.is-gold { color: var(--gold); }

.audit-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 12px;
    color: var(--ink-2);
    line-height: 1.65;
}
.audit-list li { display: flex; align-items: flex-start; gap: 6px; }
.audit-list li .ico { font-size: 13px; margin-top: 2px; color: var(--ink-4); }
.audit-list li.is-green .ico { color: var(--green); }
.audit-list li.is-red .ico { color: var(--red); }
.audit-list li.is-gold .ico { color: var(--gold); }

.tag-list { display: flex; flex-wrap: wrap; gap: 5px; }

.tag {
    display: inline-block;
    padding: 2px 7px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface-2);
    color: var(--ink-3);
    font-size: 11px;
    line-height: 1.6;
}
.tag.is-link { border-color: var(--green-line); background: var(--green-soft); color: var(--green); }

/* Model breakdown */
.models {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.model {
    flex: 1 1 140px;
    padding: 9px 11px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface-2);
}
.model-k { font-size: 10.5px; color: var(--ink-4); }
.model-v { font-family: var(--mono); font-size: 15px; font-weight: 600; margin-top: 2px; direction: ltr; text-align: right; }

/* ── Stat cards ────────────────────────────────────────────────────────── */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 10px;
    margin-top: 16px;
}
.stat-grid-3 { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }

.stat-card {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 13px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface-2);
}

.stat-k { font-size: 11px; font-weight: 600; color: var(--ink-4); }

.stat-v {
    font-family: var(--mono);
    font-size: 23px;
    font-weight: 600;
    letter-spacing: -0.02em;
    color: var(--ink);
    line-height: 1.3;
    direction: ltr;
    text-align: right;
}

.stat-s { font-size: 10.5px; color: var(--ink-4); }

/* ── Charts ────────────────────────────────────────────────────────────── */
.chart-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin-top: 18px;
}

.chart-box { position: relative; height: 260px; width: 100%; }
.chart-box-tall { height: 300px; }

/* ── Tables ────────────────────────────────────────────────────────────── */
.table-wrap {
    margin-top: 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12.5px;
    min-width: 620px;
}

.data-table thead th {
    text-align: right;
    font-size: 11px;
    font-weight: 600;
    color: var(--ink-3);
    background: var(--surface-2);
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

.data-table tbody td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    color: var(--ink-2);
    vertical-align: middle;
}

.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover { background: var(--surface-2); }
.data-table tbody td b, .data-table tbody td strong { color: var(--ink); font-weight: 600; }
.data-table code { font-family: var(--mono); font-size: 11px; color: var(--ink-3); }

/* ── Select / pills ────────────────────────────────────────────────────── */
.select {
    border: 1px solid var(--border-2);
    border-radius: var(--radius-sm);
    background: var(--surface);
    padding: 6px 10px;
    font-size: 12px;
    max-width: 300px;
    cursor: pointer;
}
.select:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(13, 122, 99, 0.1); }

.pills { display: flex; flex-wrap: wrap; gap: 5px; }

.pill {
    padding: 4px 10px;
    border: 1px solid var(--border-2);
    border-radius: 999px;
    background: var(--surface);
    color: var(--ink-3);
    font-size: 11.5px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.14s ease;
}
.pill:hover { border-color: var(--brand-line); color: var(--brand-dark); }
.pill.active { background: var(--brand-soft); border-color: var(--brand-line); color: var(--brand-dark); font-weight: 600; }

/* ── Heatmap ───────────────────────────────────────────────────────────── */
.heatmap-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(232px, 1fr));
    gap: 10px;
    margin-top: 16px;
}

.heat-card {
    padding: 13px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
}

.heat-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 10px;
}

.heat-title { font-size: 12.5px; font-weight: 600; line-height: 1.5; }

.signal {
    padding: 1px 7px;
    border-radius: 999px;
    font-size: 9.5px;
    font-weight: 700;
    letter-spacing: 0.04em;
    border: 1px solid var(--border-2);
    color: var(--ink-3);
    background: var(--surface-2);
    white-space: nowrap;
}
.signal-HOT { background: var(--red-soft); border-color: var(--red-line); color: var(--red); }
.signal-WARM { background: var(--gold-soft); border-color: var(--gold-line); color: var(--gold); }
.signal-COOL { background: var(--blue-soft); border-color: var(--blue-line); color: var(--blue); }

.bar-group { margin-top: 8px; }

.bar-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    font-size: 10.5px;
    color: var(--ink-3);
    margin-bottom: 4px;
}
.bar-label b { font-family: var(--mono); font-size: 10.5px; color: var(--ink); direction: ltr; }

.bar-track { height: 6px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.bar-fill { height: 100%; border-radius: 999px; background: var(--brand); }
.bar-fill.is-gold { background: var(--gold); }
.bar-fill.is-red { background: var(--red); }
.bar-fill.is-blue { background: var(--blue); }

.heat-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-top: 10px;
    padding-top: 9px;
    border-top: 1px solid var(--border);
    font-size: 11px;
    color: var(--ink-3);
}
.heat-foot b { font-family: var(--mono); color: var(--ink); }

/* ── Live feed ─────────────────────────────────────────────────────────── */
.feed {
    margin-top: 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    max-height: 380px;
    overflow-y: auto;
}

.feed-empty {
    padding: 32px 16px;
    text-align: center;
    color: var(--ink-4);
    font-size: 12px;
}

.deal-card { border-bottom: 1px solid var(--border); }
.deal-card:last-child { border-bottom: none; }

.deal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 8px 12px;
    background: var(--surface-2);
    font-size: 11px;
    color: var(--ink-3);
}

.deal-title { font-weight: 600; color: var(--ink-2); font-size: 12px; }
.deal-time { font-family: var(--mono); font-size: 10.5px; color: var(--ink-4); direction: ltr; }

.deal-body {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 18px;
    padding: 10px 12px;
    font-size: 12px;
    color: var(--ink-3);
}
.deal-body b { font-family: var(--mono); color: var(--ink); }

/* ── Architecture ──────────────────────────────────────────────────────── */
.arch-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.arch-card {
    padding: 13px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface-2);
}

.arch-icon {
    display: grid;
    place-items: center;
    width: 28px;
    height: 28px;
    border-radius: 7px;
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--brand);
    font-size: 14px;
    margin-bottom: 8px;
}

.arch-card h4 { font-size: 12.5px; font-weight: 700; font-family: var(--mono); }
.arch-weight { display: inline-block; font-size: 10.5px; color: var(--brand); font-weight: 600; margin: 1px 0 5px; }
.arch-card p { font-size: 11.5px; color: var(--ink-3); line-height: 1.65; }

/* ── Info strip ────────────────────────────────────────────────────────── */
.info-strip {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    margin-top: 14px;
}

.info-item {
    padding: 13px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
}

.info-k {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 10.5px;
    font-weight: 700;
    color: var(--ink-4);
    margin-bottom: 5px;
}
.info-k .ico { font-size: 12px; }
.info-item p { font-size: 11.5px; color: var(--ink-3); line-height: 1.7; }

/* ── Meta line ─────────────────────────────────────────────────────────── */
.meta-line { margin-top: 10px; font-size: 11.5px; color: var(--ink-4); }
.meta-line b { font-family: var(--mono); color: var(--ink-2); }

/* ── Toast ─────────────────────────────────────────────────────────────── */
.toast {
    position: fixed;
    bottom: 22px;
    left: 50%;
    transform: translate(-50%, 12px);
    z-index: 90;
    max-width: min(90vw, 420px);
    padding: 10px 16px;
    border-radius: var(--radius-sm);
    background: var(--ink);
    color: #fff;
    font-size: 12.5px;
    box-shadow: var(--shadow-md);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.18s ease, transform 0.18s ease;
}
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }
.toast.is-error { background: var(--red); }

/* ── Footer ────────────────────────────────────────────────────────────── */
.footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    padding: 16px 0 20px;
    border-top: 1px solid var(--border);
    font-size: 11px;
    color: var(--ink-4);
}

/* ── Utilities ─────────────────────────────────────────────────────────── */
.num { font-family: var(--mono); direction: ltr; unicode-bidi: isolate; }
.color-emerald, .color-green { color: var(--green) !important; }
.color-red, .color-rose { color: var(--red) !important; }
.color-amber, .color-gold { color: var(--gold) !important; }
.color-cyan, .color-blue { color: var(--blue) !important; }
.color-purple { color: var(--brand) !important; }
.color-muted { color: var(--ink-4) !important; }

/* ── Responsive ────────────────────────────────────────────────────────── */
@media (max-width: 1000px) {
    .topbar-inner { flex-wrap: wrap; height: auto; padding: 10px 0; gap: 10px; }
    .nav { order: 3; width: 100%; flex: 1 0 100%; }
    .topbar-side { margin-inline-start: auto; }
    .chart-grid { grid-template-columns: 1fr; }
    .cards, .audit-grid { grid-template-columns: 1fr 1fr; }
    .valuation { grid-template-columns: 1fr; gap: 16px; }
    .eval-actions { grid-template-columns: 1fr; }
    .btn-primary.btn-lg { width: 100%; }
}

@media (max-width: 720px) {
    .app { padding: 0 14px; }
    .topbar { margin: 0 -14px; padding: 0 14px; }
    .panel { padding: 16px 14px; }
    .hero h1 { font-size: 24px; }
    .hero p { font-size: 13.5px; }
    .hero-meta { gap: 8px; }
    .meta-sep { display: none; }
    .cards, .audit-grid, .info-strip, .arch-grid, .placeholder-grid { grid-template-columns: 1fr; }
    .stat-grid { grid-template-columns: 1fr 1fr; }
    .stat-v { font-size: 20px; }
    .spec-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .chart-box { height: 220px; }
    .chart-box-tall { height: 250px; }
    .brand-sub { display: none; }
    .footer { flex-direction: column; align-items: flex-start; gap: 4px; }
    .value { font-size: 32px; }
}

@media (prefers-reduced-motion: reduce) {
    * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
