/* Soren — base.css: variables, layout, rail, panels */


  :root {
    --primary: #1A5238;
    --primary-light: #E8EDEC;
    --primary-mid: rgba(26,82,56,0.12);
    --accent: #DDE54C;        /* citron — the Draft/Review trust state */
    --accent-ink: #7D821B;    /* citron-family ink where the fill fails contrast (text, thin marks) */
    --accent-light: #F7F8DC;
    --bg: #F6F4EF;
    --surface: #FBFAF7;
    --border: #E4DFD4;
    --divider: #ECE8DF;
    --stone: #9A958A;
    --muted: #A39E92;
    --mid: #2D3440;
    --dark: #1B1F24;
    --green: #2A7A56;
    --green-light: #E6F4EE;
    --green-border: #A5D4BC;
    --rose: #B84040;
    --rose-light: #FAF0F0;
    --font-display: 'Newsreader', serif;
    --font-body: 'Hanken Grotesk', sans-serif;
    --radius: 16px;
    --radius-sm: 12px;
    --transition: 0.7s cubic-bezier(0.4, 0, 0.2, 1);
    --rail: 180px;
  }

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

  body {
    font-family: var(--font-body);
    background: var(--bg);
    color: var(--dark);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: background var(--transition), color var(--transition);
  }

  /* ── BRAND OVERLAY ── */
  .brand-overlay {
    position: fixed; inset: 0; background: var(--primary);
    z-index: 2000; display: flex; align-items: center; justify-content: center;
    flex-direction: column; gap: 16px; opacity: 0; pointer-events: none;
    transition: opacity 0.4s ease;
  }
  .brand-overlay.active { opacity: 1; pointer-events: all; }
  .brand-overlay-text { color: white; font-family: var(--font-display); font-size: 22px; font-style: italic; }
  .brand-overlay-sub { color: rgba(255,255,255,0.6); font-size: 13px; }

  /* ── TYPE SYSTEM TOKENS ─────────────────────────────────────────────────────
     Color = type, everywhere. Field ice / Concept green / Metric bronze.
     Never conflate with status (terracotta = draft, green dot = governed).      */

  /* Field — ice blue */
  --field-ink:   #3A6076;
  --field-bg:    #DCE6EE;
  --field-border:#C6D4DF;
  --field-sigil: '▦';

  /* Concept — Racing Green */
  --concept-ink:   #1A5238;
  --concept-bg:    rgba(26,82,56,.09);
  --concept-border:rgba(26,82,56,.22);
  --concept-sigil: '◆';

  /* Metric — Ledger Bronze */
  --metric-ink:   #6E5325;
  --metric-bg:    #F3ECDD;
  --metric-border:#DCCBA6;
  --metric-sigil: 'Σ';

  /* Diff colors */
  --diff-removed-text:#C08A7E;
  --diff-added-bg:    #C6E2CE;
  --diff-added-text:  #16402E;
  .topnav { display: none; }

  /* ── APP BODY ── */
  .app-body {
    flex: 1; display: flex; overflow: hidden; height: 100vh;
  }

  /* ── TYPE CHIPS (field · concept · metric) ── */
  .type-chip {
    display: inline-flex; align-items: center; gap: 5px;
    font-family: var(--font-body); font-size: 11px; font-weight: 600;
    letter-spacing: .06em; padding: 2px 8px; border-radius: 6px;
    border: 1px solid; white-space: nowrap; vertical-align: middle;
  }
  .type-chip.field   { color: var(--field-ink);   background: var(--field-bg);   border-color: var(--field-border); }
  .type-chip.concept { color: var(--concept-ink); background: var(--concept-bg); border-color: var(--concept-border); }
  .type-chip.metric  { color: var(--metric-ink);  background: var(--metric-bg);  border-color: var(--metric-border); }
  .type-chip.draft   { color: #9A4F2E; background: rgba(201,119,82,.1); border-color: rgba(201,119,82,.3); }

  /* Modal top-accent by type */
  .modal-accent-field   { border-top: 4px solid var(--field-ink) !important; }
  .modal-accent-concept { border-top: 4px solid var(--concept-ink) !important; }
  .modal-accent-metric  { border-top: 4px solid var(--metric-ink) !important; }

  /* Inline type references */
  .ref-field   { color: var(--field-ink); font-weight: 600; }
  .ref-concept { font-family: var(--font-display); font-style: italic; color: var(--concept-ink); }
  .ref-metric  { color: var(--metric-ink); font-weight: 600; font-family: var(--font-body); }

  /* ── LEFT RAIL — editorial index ── */
  .rail {
    width: 256px; flex-shrink: 0;
    background: var(--bg);
    border-right: 1px solid #E4DFD4;
    display: flex; flex-direction: column;
    overflow: hidden;
    height: 100%;
  }

  /* Rail zones */
  .rail-head {
    flex-shrink: 0;
    padding: 26px 22px 0;
  }
  .rail-scroll {
    flex: 1; overflow-y: auto; overflow-x: hidden;
    padding: 0 22px;
    min-height: 0; /* critical for flex overflow */
  }
  .rail-foot {
    flex-shrink: 0;
    padding: 0 22px 20px;
    border-top: 1px solid #E4DFD4;
    margin-top: 8px;
  }

  /* Wordmark */
  .rail-wordmark {
    display: flex; align-items: center; gap: 8px;
    font-family: var(--font-display); font-size: 21px; font-weight: 400;
    color: #1A5238; margin-bottom: 18px; cursor: pointer;
  }
  .rail-wordmark:hover { opacity: .8; }
  .rail-wordmark-dot {
    width: 8px; height: 8px; border-radius: 50%; background: #1A5238; flex-shrink: 0;
  }

  /* New chat link */
  .rail-new-chat {
    font-family: var(--font-display); font-style: italic; font-size: 15px;
    color: #1A5238; text-decoration: underline; text-decoration-color: #1A5238;
    text-underline-offset: 3px; cursor: pointer; align-self: flex-start;
    margin-bottom: 20px; background: none; border: none; padding: 0;
    display: block;
  }

  /* Action Items row */
  .rail-action-row {
    display: flex; align-items: center; margin-bottom: 18px; cursor: pointer;
  }
  .rail-action-label {
    font-family: var(--font-display); font-size: 15.5px; color: #1C2521;
  }
  .rail-action-chip {
    margin-left: auto;
    background: #DDE54C; color: #1A5238;
    font-size: 11px; font-weight: 700;
    border-radius: 20px; padding: 1px 9px;
    font-family: var(--font-body);
    display: none;
  }
  .rail-action-chip.visible { display: inline-block; }

  /* Section label */
  .rail-section-label {
    font-family: var(--font-body);
    font-size: 10px; font-weight: 600; letter-spacing: .18em;
    text-transform: uppercase; color: #A39E92;
    border-bottom: 1px solid #E4DFD4; padding-bottom: 6px;
    margin-bottom: 10px; margin-top: 20px;
  }

  /* Leader row */
  .rail-leader-row {
    display: flex; align-items: baseline; margin-bottom: 9px; cursor: pointer;
  }
  .rail-leader-row:hover .rail-leader-label { color: #1A5238; }
  .rail-leader-label {
    font-family: var(--font-display); font-size: 15.5px; color: #1C2521;
    white-space: nowrap; transition: color .15s;
  }
  .rail-leader-dots {
    flex: 1; border-bottom: 1px dotted #C9C3B6;
    margin: 0 9px 4px;
  }
  .rail-leader-count {
    font-family: var(--font-body); font-size: 12.5px; color: #7C8A92;
    font-variant-numeric: tabular-nums; white-space: nowrap; flex-shrink: 0;
  }
  .rail-leader-count.view-link { font-size: 11px; color: #A39E92; }

  /* Recent items */
  .rail-recent-item {
    font-family: var(--font-display); font-style: italic;
    font-size: 14px; color: #39434B; line-height: 1.5;
    margin-bottom: 7px; cursor: pointer;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    display: block; transition: color .15s;
  }
  .rail-recent-item:hover { color: #1A5238; }

  /* Add data */
  .rail-add-data {
    font-family: var(--font-body); font-size: 13px; color: #9A958A;
    cursor: pointer; margin-top: 6px; background: none; border: none; padding: 0;
    text-align: left;
  }
  .rail-add-data:hover { color: #1A5238; }

  /* Desk rail row — always visible in footer */
  .desk-rail-row {
    display: flex; align-items: center; gap: 8px;
    padding: 10px 0 0; cursor: pointer;
    font-family: var(--font-body); font-size: 13px; color: #9A958A;
    border-top: 1px solid #E4DFD4; margin-top: 10px;
  }
  .desk-rail-row:hover { color: #1A5238; }
  .desk-rail-label { flex: 1; }
  .desk-rail-indicator {
    display: none; align-items: center; gap: 4px;
    font-size: 10.5px; font-weight: 600; color: #1A5238;
    background: #EFEDE6; border-radius: 5px; padding: 2px 6px;
  }
  .desk-rail-indicator.visible { display: flex; }
  .desk-rail-dot {
    width: 5px; height: 5px; border-radius: 50%; background: #1A5238;
    animation: sorenPulse 1.4s ease-in-out infinite;
  }

  /* Settings */
  .rail-settings {
    font-family: var(--font-body); font-size: 13px;
    color: #9A958A; cursor: pointer;
    padding: 8px 0 0; text-align: right;
  }
  .rail-settings:hover { color: #1A5238; }

  /* Legacy items hidden */
  .rail-section, .rail-divider, .rail-subsection,
  .rail-subsection-header, .rail-subsection-body,
  .rail-item, .rail-add-btn { display: none !important; }

  /* ── HOME CANVAS ── */
  .home-canvas {
    flex: 1; min-width: 0; padding: 64px 72px;
    display: flex; flex-direction: column;
    background: var(--bg); overflow-y: auto;
  }

  /* Masthead */
  .home-eyebrow {
    font-family: var(--font-body); font-size: 11px; font-weight: 600;
    letter-spacing: .22em; text-transform: uppercase; color: #A39E92;
    margin-bottom: 18px;
  }
  .home-headline {
    font-family: var(--font-display); font-size: 46px; font-weight: 500;
    line-height: 1.12; letter-spacing: -.015em; max-width: 620px;
    color: #1C2521; margin-bottom: 0;
  }
  .home-headline-green { color: #1A5238; }

  /* Metrics band */
  .metrics-divider { height: 1px; background: #DCD6CA; margin: 38px 0 26px; }
  .metrics-band { max-width: 780px; }
  .metrics-band-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 20px;
  }
  .metrics-band-label {
    font-family: var(--font-body); font-size: 11px; font-weight: 600;
    letter-spacing: .2em; text-transform: uppercase; color: #A39E92;
  }
  .metrics-band-edit {
    font-family: var(--font-body); font-size: 12px; color: #9A958A;
    cursor: pointer; background: none; border: none;
  }
  .metrics-band-edit:hover { color: #1A5238; }
  .metrics-row { display: flex; gap: 30px; }
  .metric-card {
    flex: 1; border-left: 2px solid #1A5238; padding-left: 16px;
    cursor: pointer;
  }
  .metric-card:hover .metric-figure { color: #1A5238; }
  .metric-figure {
    font-family: var(--font-display); font-size: 38px; color: #1C2521;
    line-height: 1; font-weight: 400; transition: color .15s;
  }
  .metric-name {
    font-family: var(--font-body); font-size: 13px; font-weight: 600;
    color: #1C2521; margin-top: 9px;
  }
  .metric-provenance {
    font-family: var(--font-body); font-size: 11.5px; color: #9A958A; margin-top: 3px;
  }
  .metric-pin-btn {
    flex: none; width: 138px; border: 1px dashed #C9C3B6; border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-family: var(--font-body); font-size: 13px; color: #9A958A;
    cursor: pointer; background: none; min-height: 80px;
    transition: border-color .15s, color .15s;
  }
  .metric-pin-btn:hover { border-color: #1A5238; color: #1A5238; }
  .metrics-footer {
    font-family: var(--font-body); font-size: 12.5px; color: #9A958A;
    margin-top: 22px;
  }
  .metrics-footer-review { color: #9A4F2E; }

  /* Command input */
  .home-input-wrap {
    margin-top: auto; padding-top: 48px;
    display: flex; align-items: center; gap: 14px;
    border: 1px solid #C9C3B6; border-radius: 12px;
    padding: 16px 20px; background: #FBFAF7;
  }
  .home-input {
    flex: 1; background: none; border: none; outline: none;
    font-family: var(--font-display); font-style: italic;
    font-size: 19px; color: #1C2521;
    font-weight: 400;
  }
  .home-input::placeholder { color: #9A958A; }
  .home-send-btn {
    width: 38px; height: 38px; border-radius: 9px;
    background: #1A5238; color: #F6F4EF; border: none;
    font-size: 17px; cursor: pointer; display: flex;
    align-items: center; justify-content: center; flex-shrink: 0;
    transition: opacity .15s;
  }
  .home-send-btn:hover { opacity: .85; }

  /* Getting started (empty layer) */
  .home-getting-started { max-width: 480px; }
  .home-gs-item {
    display: flex; align-items: flex-start; gap: 20px;
    padding: 18px 0; border-bottom: 1px solid #E4DFD4;
  }
  .home-gs-num {
    font-family: var(--font-display); font-size: 22px; color: #C9C3B6;
    font-weight: 400; flex-shrink: 0; width: 24px; line-height: 1.2;
  }
  .home-gs-body { flex: 1; }
  .home-gs-title {
    font-family: var(--font-body); font-size: 14px; font-weight: 600;
    color: #1C2521; margin-bottom: 3px; cursor: pointer;
  }
  .home-gs-title:hover { color: #1A5238; }
  .home-gs-sub { font-family: var(--font-body); font-size: 12px; color: #9A958A; }
  /* ── QUERY READINESS ── */
  .qr-card {
    border: 1px solid var(--border); border-radius: 8px; background: white;
    margin-bottom: 10px; overflow: hidden;
  }
  .qr-card-header {
    padding: 10px 14px 8px; border-bottom: 1px solid var(--border);
    background: var(--bg-soft);
  }
  .qr-eyebrow {
    font-size: 9px; font-weight: 700; letter-spacing: .6px; text-transform: uppercase;
    margin-bottom: 3px;
  }
  .qr-eyebrow.metric { color: #633806; }
  .qr-eyebrow.classification { color: #0C447C; }
  .qr-eyebrow.web { color: #27500A; }
  .qr-card-title { font-size: 14px; font-weight: 600; color: var(--primary); }
  .qr-card-body { padding: 10px 14px; }
  .qr-card-footer {
    padding: 8px 14px; border-top: 1px solid var(--border);
    display: flex; gap: 8px; align-items: center; background: var(--bg-soft);
  }
  .qr-btn-primary {
    padding: 5px 14px; background: var(--primary); color: white;
    border: none; border-radius: 6px; font-size: 12px; font-weight: 600;
    cursor: pointer;
  }
  .qr-btn-primary:disabled { opacity: .5; cursor: default; }
  .qr-btn-secondary {
    padding: 5px 12px; background: none; color: var(--stone);
    border: 1px solid var(--border); border-radius: 6px; font-size: 12px;
    cursor: pointer;
  }
  .qr-btn-secondary:hover { color: var(--text); border-color: var(--text); }
  .qr-approved {
    padding: 8px 14px; display: flex; align-items: center; gap: 6px;
    font-size: 12px; color: #1A5238; font-weight: 500;
    border-top: 1px solid var(--border); background: #F0FDF4;
  }
  .qr-dismissed {
    padding: 8px 14px; font-size: 11px; color: var(--stone);
    border-top: 1px solid var(--border); background: var(--bg-soft);
  }
  .qr-field-chip {
    display: inline-flex; align-items: center; gap: 3px;
    padding: 2px 7px; background: var(--primary-light); color: var(--primary);
    border-radius: 8px; font-size: 10px; font-weight: 600; margin: 2px;
  }
  .qr-mapping-table {
    width: 100%; border-collapse: collapse; font-size: 11px; margin-top: 6px;
  }
  .qr-mapping-table td { padding: 4px 8px; border-bottom: 1px solid var(--border); }
  .qr-mapping-table td:first-child { color: var(--text); font-weight: 500; }
  .qr-mapping-table td:last-child { color: var(--stone); }
  .qr-loading { display: flex; align-items: center; gap: 8px; padding: 10px 14px; font-size: 12px; color: var(--stone); }
  .qr-spinner { width: 14px; height: 14px; border: 2px solid var(--border); border-top-color: var(--primary); border-radius: 50%; animation: spin .8s linear infinite; }
  @keyframes spin { to { transform: rotate(360deg); } }
  .qr-wrapper { margin-bottom: 12px; }
  .qr-context { font-size: 12px; color: var(--stone); margin-bottom: 6px; font-style: italic; }

  .ont-tab {
    padding: 5px 12px; font-size: 11px; font-weight: 600; border: none;
    background: none; cursor: pointer; color: var(--stone); border-radius: 6px 6px 0 0;
    border-bottom: 2px solid transparent; transition: all .15s;
  }
  .ont-tab.active { color: var(--primary); border-bottom-color: var(--primary); background: var(--primary-light); }
  .ont-tab:hover:not(.active) { color: var(--text); background: var(--bg-soft); }
  .concept-card {
    margin: 8px 16px; padding: 12px 14px; background: white;
    border: 1px solid var(--border); border-radius: 8px; cursor: pointer;
    transition: border-color .15s;
  }
  .concept-card:hover { border-color: var(--primary); }
  .concept-card.is-default { border-left: 3px solid var(--primary); }
  .field-pill {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 2px 8px; background: var(--primary-light); color: var(--primary);
    border-radius: 10px; font-size: 10px; font-weight: 600; margin: 2px;
  }

  .rail-bottom { margin-top: auto; }

  .rail-scroll { flex: 1; overflow-y: auto; }
  .rail-scroll::-webkit-scrollbar { width: 3px; }
  .rail-scroll::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

  /* ── MAIN CONTENT ── */
  .main-content {
    flex: 1; display: flex; flex-direction: column; overflow: hidden;
  }

  /* ── ONBOARDING (shown until setup complete) ── */
  .onboard-wrap {
    flex: 1; overflow-y: auto; padding: 32px 24px 100px;
    display: flex; flex-direction: column; align-items: center;
  }

  .onboard-inner { width: 100%; max-width: 520px; }

  /* ── CHAT VIEW ── */
  .chat-wrap {
    flex: 1; overflow-y: auto; padding: 24px;
    display: none; flex-direction: column; gap: 16px;
  }
  .chat-wrap.active { display: flex; }
  .chat-wrap::-webkit-scrollbar { width: 4px; }
  .chat-wrap::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

  /* ── PANEL VIEW (definitions / settings) ── */
  .panel-wrap {
    flex: 1; overflow-y: auto; padding: 24px;
    display: none;
  }
  .panel-wrap.active { display: block; }

  /* ── ASK BAR (bottom) ── */
  .ask-footer {
    background: var(--surface); border-top: 1px solid var(--border);
    padding: 12px 16px; display: none;
    transition: background var(--transition), border-color var(--transition);
  }
  .ask-footer.active { display: block; }

  .context-chips {
    display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 8px;
  }

  .context-chip {
    font-size: 10px; font-weight: 500; padding: 3px 8px; border-radius: 20px;
    background: var(--primary-light); color: var(--primary);
    border: 1px solid var(--primary-mid); display: flex; align-items: center; gap: 4px;
  }

  .ask-bar {
    background: var(--bg); border: 1.5px solid var(--border);
    border-radius: var(--radius); padding: 4px 6px 4px 16px;
    display: flex; align-items: flex-end; gap: 8px;
    transition: border-color 0.15s;
  }
  .ask-bar:focus-within { border-color: var(--primary); }

  .ask-input {
    flex: 1; background: none; border: none; outline: none;
    font-size: 14px; font-family: var(--font-body); color: var(--dark);
    padding: 10px 0; resize: none; min-height: 40px; max-height: 120px; line-height: 1.5;
  }
  .ask-input::placeholder { color: var(--stone); }

  .ask-send {
    width: 36px; height: 36px; border-radius: 8px; margin-bottom: 3px;
    background: var(--primary); color: white; border: none; cursor: pointer;
    font-size: 15px; display: flex; align-items: center; justify-content: center;
    flex-shrink: 0; transition: opacity 0.15s;
  }
  .ask-send:hover { opacity: 0.88; }

  /* ══ ASK BAR — one input, two on-ramps, ten governed modes ══ */
  .askbar {
    background: var(--bg, #FBFAF7); border: 1.5px solid var(--border);
    border-radius: var(--radius, 16px); padding: 6px 8px 8px 8px;
    transition: border-color .15s;
  }
  .askbar:focus-within { border-color: var(--primary); }
  .askbar-line { display: flex; align-items: flex-end; gap: 8px; padding-left: 8px; }
  .askbar-home { box-shadow: 0 1px 2px rgba(26,33,33,.04); }

  /* A · the governed mad-lib (replaces the free text when a pill is tapped) */
  .askbar-madlib { flex: 1; padding: 6px 0 2px; }
  .madlib-head {
    display: flex; align-items: center; gap: 10px; margin-bottom: 6px;
  }
  .madlib-mode {
    font-size: 11px; font-weight: 700; letter-spacing: .3px; color: var(--primary);
    text-transform: uppercase;
  }
  .madlib-clear {
    background: none; border: none; cursor: pointer; padding: 0;
    font-size: 11px; color: var(--stone); text-decoration: underline; font-family: var(--font-body);
  }
  .madlib-clear:hover { color: var(--text); }
  .madlib-sentence {
    font-size: 15px; line-height: 1.9; color: var(--dark);
    font-family: var(--font-body); display: inline;
  }
  .madlib-txt { color: var(--text); }

  /* governed + open slots */
  .slot {
    display: inline-flex; align-items: center; gap: 3px;
    font-size: 13.5px; font-weight: 600; font-family: var(--font-body);
    border-radius: 7px; padding: 2px 8px; margin: 0 1px; cursor: pointer;
    border: 1px solid transparent; vertical-align: baseline; line-height: 1.4;
  }
  .slot-caret { font-size: 9px; opacity: .65; }
  .slot-metric { background: rgba(26,82,56,.07); color: var(--primary); border-bottom: 1px dotted var(--primary); border-radius: 7px 7px 0 0; }
  .slot-metric:hover { background: rgba(26,82,56,.12); }
  .slot-field  { background: rgba(62,107,138,.07); color: #3E6B8A; border-bottom: 1px dotted #3E6B8A; border-radius: 7px 7px 0 0; }
  .slot-field:hover { background: rgba(62,107,138,.12); }
  .slot-free, .slot-time { background: rgba(110,105,95,.08); color: #6E695F; }
  .slot-time {
    background: none; color: #6A6256; border: 1px dashed #B7AE9C;
    cursor: text; outline: none; font-weight: 600;
  }
  .slot-time:focus { border-color: var(--primary); border-style: solid; }
  .slot-free {
    border: none; border-bottom: 1.5px solid var(--stone); border-radius: 0;
    color: var(--dark); cursor: text; outline: none; padding: 1px 3px; min-width: 40px;
  }
  .slot-free:focus { border-bottom-color: var(--primary); }
  .slot-free:empty::before { content: attr(data-ph); color: var(--stone); font-weight: 400; }

  /* slot + scope dropdowns */
  .madlib-dd, .scope-dd {
    position: absolute; z-index: 200; margin-top: 6px;
    background: #fff; border: 1px solid var(--border); border-radius: 10px;
    box-shadow: 0 8px 28px rgba(26,33,33,.14); min-width: 240px; max-height: 300px;
    overflow-y: auto; padding: 4px;
  }
  .scope-dd { min-width: 200px; bottom: auto; }
  .madlib-dd-head {
    font-size: 10.5px; font-weight: 600; letter-spacing: .4px; text-transform: uppercase;
    color: var(--stone); padding: 8px 10px 4px;
  }
  .madlib-dd-item, .scope-dd-item {
    display: flex; align-items: center; gap: 9px; padding: 8px 10px; border-radius: 7px;
    cursor: pointer; font-size: 13px; color: var(--text);
  }
  .madlib-dd-item:hover, .scope-dd-item:hover { background: var(--bg-soft, #F4F2EC); }
  .scope-dd-item.active { background: var(--primary-light); }
  .madlib-dd-item .dd-name, .scope-dd-item .dd-name { flex: 1; font-weight: 500; }
  .dd-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
  .dd-dot.metric { background: var(--primary); }
  .dd-dot.field  { background: #2C5F86; }
  .dd-sub { font-size: 10.5px; color: var(--stone); }
  .dd-sub.cert { color: var(--green); font-weight: 600; }
  .scope-dd-tick { color: var(--primary); font-size: 11px; }
  .madlib-dd-empty { padding: 12px 10px; font-size: 12px; color: var(--stone); }
  .scope-dd-foot {
    border-top: 1px solid var(--border); margin-top: 4px; padding: 8px 10px;
    font-size: 11px; color: var(--stone); cursor: pointer;
  }
  .scope-dd-foot:hover { color: var(--text); }

  .scope-note { color: var(--stone); font-style: italic; opacity: .8; margin-left: 2px; }

  /* C · starter pills */
  .askbar-pills {
    display: flex; gap: 6px; overflow-x: auto; padding: 6px 4px 2px;
    scrollbar-width: thin;
  }
  .askbar-pills::-webkit-scrollbar { height: 0; }
  .ask-pill {
    flex-shrink: 0; display: inline-flex; align-items: center; gap: 5px;
    padding: 5px 12px; background: var(--surface); border: 1px solid var(--border);
    border-radius: 18px; font-size: 11.5px; font-weight: 600; color: var(--text);
    font-family: var(--font-body); cursor: pointer; white-space: nowrap; transition: all .12s;
  }
  .ask-pill:hover { border-color: var(--primary); color: var(--primary); }
  .ask-pill.active { background: var(--primary); border-color: var(--primary); color: #fff; }
  .ask-pill-glyph { font-size: 10px; opacity: .9; }

  /* ── SCREEN HEADERS ── */
  .screen-eyebrow {
    font-size: 11px; font-weight: 500; letter-spacing: 1.2px;
    text-transform: uppercase; color: var(--stone); margin-bottom: 6px;
  }

  .screen-title {
    font-family: var(--font-display); font-size: 24px; font-weight: 400;
    line-height: 1.3; color: var(--dark); margin-bottom: 6px;
    transition: color var(--transition);
  }
  .screen-title em { font-style: italic; color: var(--primary); transition: color var(--transition); }
  .screen-sub { font-size: 13px; color: var(--muted); line-height: 1.6; margin-bottom: 24px; }

  /* ── UPLOAD ── */
  .upload-zone {
    border: 2px dashed var(--border); border-radius: var(--radius);
    padding: 40px 20px; text-align: center; cursor: pointer;
    transition: all 0.2s; background: var(--surface); position: relative;
  }
  .upload-zone:hover, .upload-zone.dragover { border-color: var(--primary); background: var(--primary-light); }
  .upload-zone input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; }
  .upload-icon { font-size: 30px; margin-bottom: 10px; }
  .upload-title { font-family: var(--font-display); font-size: 15px; font-weight: 500; color: var(--dark); margin-bottom: 4px; }
  .upload-sub { font-size: 12px; color: var(--muted); }
  .upload-sub span { color: var(--primary); font-weight: 500; }

  /* ── PROCESSING ── */
  .processing-card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 20px; display: none; margin-top: 12px;
  }
  .processing-card.visible { display: block; }
  .processing-header { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
  .processing-spinner {
    width: 28px; height: 28px; border-radius: 50%;
    border: 2px solid var(--primary-light); border-top-color: var(--primary);
    animation: spin 0.8s linear infinite; flex-shrink: 0;
  }
  @keyframes spin { to { transform: rotate(360deg); } }
  .processing-title { font-size: 13px; font-weight: 500; color: var(--dark); }
  .processing-sub { font-size: 11px; color: var(--muted); margin-top: 2px; }
  .processing-steps { display: flex; flex-direction: column; gap: 6px; }
  .proc-step {
    display: flex; align-items: center; gap: 8px;
    font-size: 12px; color: var(--muted); padding: 7px 10px;
    border-radius: 7px; background: var(--bg); transition: all 0.3s;
  }
  .proc-step.active { color: var(--primary); background: var(--primary-light); }
  .proc-step.done { color: var(--green); background: var(--green-light); }
  .proc-step-icon { font-size: 12px; flex-shrink: 0; width: 18px; text-align: center; }

  /* ── BRAND RESULT ── */
  .brand-result {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); overflow: hidden; display: none; margin-top: 12px;
  }
  .brand-result.visible { display: block; }
  .brand-result-header {
    padding: 14px 16px; border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between;
  }
  .brand-result-title { font-size: 13px; font-weight: 600; color: var(--dark); }
  .brand-result-sub { font-size: 11px; color: var(--muted); margin-top: 1px; }
  .brand-check { color: var(--green); font-size: 16px; }
  .brand-items { padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; }
  .brand-item { display: flex; align-items: flex-start; gap: 10px; }
  .brand-item-label {
    font-size: 10px; font-weight: 600; letter-spacing: 0.8px; text-transform: uppercase;
    color: var(--stone); width: 72px; flex-shrink: 0; padding-top: 2px;
  }
  .brand-item-value { font-size: 12px; color: var(--dark); flex: 1; line-height: 1.5; }
  .color-swatches { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
  .color-swatch {
    width: 24px; height: 24px; border-radius: 5px;
    border: 1px solid rgba(0,0,0,0.08); cursor: pointer; transition: transform 0.15s;
  }
  .color-swatch:hover { transform: scale(1.15); }
  .color-hex { font-size: 10px; color: var(--muted); font-family: monospace; }
  .brand-apply-btn {
    margin: 0 16px 16px; width: calc(100% - 32px);
    padding: 11px; border-radius: var(--radius-sm);
    background: var(--primary); color: white; border: none; cursor: pointer;
    font-family: var(--font-body); font-size: 13px; font-weight: 500; transition: opacity 0.15s;
  }
  .brand-apply-btn:hover { opacity: 0.88; }

  /* ── LLM ── */
  .llm-options { display: flex; flex-direction: column; gap: 8px; }
  .llm-option {
    display: flex; align-items: center; gap: 12px; padding: 13px 14px;
    border: 1.5px solid var(--border); border-radius: var(--radius-sm);
    cursor: pointer; transition: all 0.15s; background: var(--surface);
  }
  .llm-option:hover { border-color: var(--primary); background: var(--primary-light); }
  .llm-option.selected { border-color: var(--primary); background: var(--primary-light); }
  .llm-logo { width: 32px; height: 32px; border-radius: 7px; display: flex; align-items: center; justify-content: center; font-size: 17px; flex-shrink: 0; }
  .llm-name { font-size: 13px; font-weight: 500; color: var(--dark); }
  .llm-detail { font-size: 11px; color: var(--muted); margin-top: 1px; }
  .llm-check {
    margin-left: auto; width: 20px; height: 20px; border-radius: 50%;
    border: 1.5px solid var(--border); display: flex; align-items: center; justify-content: center;
    font-size: 10px; color: transparent; transition: all 0.15s; flex-shrink: 0;
  }
  .llm-option.selected .llm-check { background: var(--primary); border-color: var(--primary); color: white; }

  /* ── API KEY ── */
  .api-key-wrap { margin-top: 12px; display: none; }
  .api-key-wrap.visible { display: block; }
  .api-key-label { font-size: 11px; font-weight: 500; color: var(--mid); margin-bottom: 5px; display: block; }
  .api-key-input {
    width: 100%; padding: 9px 12px; background: var(--surface); border: 1.5px solid var(--border);
    border-radius: var(--radius-sm); font-size: 13px; font-family: var(--font-body);
    color: var(--dark); outline: none; transition: border-color 0.15s;
  }
  .api-key-input:focus { border-color: var(--primary); }
  .api-key-input::placeholder { color: var(--stone); }
  .api-key-note { font-size: 10px; color: var(--muted); margin-top: 5px; line-height: 1.5; }

  /* ── URL INPUT ── */
  .url-input-wrap {
    background: var(--surface); border: 1.5px solid var(--border); border-radius: var(--radius-sm);
    padding: 3px 5px 3px 14px; display: flex; align-items: center; gap: 7px;
    transition: border-color 0.15s; margin-bottom: 10px;
  }
  .url-input-wrap:focus-within { border-color: var(--primary); }
  .url-prefix { font-size: 12px; color: var(--muted); flex-shrink: 0; }
  .url-input {
    flex: 1; background: none; border: none; outline: none;
    font-size: 13px; font-family: var(--font-body); color: var(--dark); padding: 9px 0;
  }
  .url-input::placeholder { color: var(--stone); }
  .url-fetch-btn {
    padding: 7px 14px; border-radius: 7px; background: var(--primary); color: white;
    border: none; cursor: pointer; font-size: 12px; font-weight: 500;
    font-family: var(--font-body); flex-shrink: 0; transition: opacity 0.15s;
  }
  .url-fetch-btn:hover { opacity: 0.88; }
  .url-fetch-btn:disabled { opacity: 0.4; cursor: not-allowed; }

  /* ── WEBSITE FETCHED ── */
  .website-fetched {
    background: var(--green-light); border: 1px solid var(--green-border);
    border-radius: var(--radius-sm); padding: 10px 14px; display: none;
    align-items: center; gap: 8px; margin-bottom: 12px; font-size: 12px;
    color: var(--green); font-weight: 500;
  }
  .website-fetched.visible { display: flex; }

  /* ── BUTTONS ── */
  .btn-primary {
    width: 100%; padding: 12px; border-radius: var(--radius-sm); background: var(--primary);
    color: white; border: none; cursor: pointer; font-family: var(--font-body);
    font-size: 13px; font-weight: 500; transition: opacity 0.15s; margin-top: 16px;
  }
  .btn-primary:hover { opacity: 0.88; }
  .btn-primary:disabled { opacity: 0.4; cursor: not-allowed; }

  .btn-ghost {
    width: 100%; padding: 10px; border-radius: var(--radius-sm); background: none;
    border: 1.5px solid var(--border); color: var(--mid); font-family: var(--font-body);
    font-size: 12px; font-weight: 500; cursor: pointer; transition: all 0.15s; margin-top: 8px;
  }
  .btn-ghost:hover { border-color: var(--primary); color: var(--primary); }

  /* ── ERROR ── */
  .error-banner {
    background: var(--rose-light); border: 1px solid #DDA0A0; border-radius: var(--radius-sm);
    padding: 10px 14px; font-size: 12px; color: var(--rose); margin-top: 8px; display: none;
  }
  .error-banner.visible { display: block; }


  /* ══ HOME DATE + MEDIA MONITOR ══ */
  .home-date { font-family:'Hanken Grotesk',sans-serif; font-size:14px; color:#A39E92; margin-top:4px; margin-bottom:22px; }

  /* Media Monitor — home preview */
  .mm-home { background:#FBFAF7; border:1px solid #E1DBCF; border-radius:14px; padding:18px 20px; margin-bottom:22px; }
  .mm-home-head { display:flex; align-items:center; justify-content:space-between; margin-bottom:6px; }
  .mm-home-kicker { font-size:11px; font-weight:700; letter-spacing:.13em; text-transform:uppercase; color:#1A5238; }
  .mm-home-manage, .mm-home-foot button { background:none; border:none; cursor:pointer; font-size:12px; color:#7C766A; font-family:'Hanken Grotesk',sans-serif; }
  .mm-home-manage:hover, .mm-home-foot button:hover { color:#1A5238; }
  .mm-home-lede { font-family:'Newsreader',serif; font-size:17px; color:#1C2521; margin-bottom:14px; }
  .mm-home-items { display:flex; flex-direction:column; gap:12px; }
  .mm-item { border-left:2px solid #E1DBCF; padding-left:13px; }
  .mm-item-tag { font-size:10px; font-weight:700; letter-spacing:.06em; text-transform:uppercase; color:#9A958A; margin-bottom:3px; }
  .mm-item-tag.competitor { color:#7B2D26; }
  .mm-item-head { font-size:14.5px; color:#1C2521; line-height:1.4; margin-bottom:3px; }
  .mm-item-src { font-size:11.5px; color:#A39E92; font-family:'JetBrains Mono',monospace; }
  .mm-home-foot { display:flex; align-items:center; justify-content:space-between; margin-top:14px; padding-top:12px; border-top:1px solid #ECE8DF; font-size:11px; color:#A39E92; }

  /* Media Monitor — setup page */
  .mm-wrap { max-width:760px; margin:0 auto; padding:24px 28px 80px; }
  .mm-top { display:flex; align-items:center; justify-content:space-between; padding:8px 0 24px; }
  .mm-back { background:none; border:none; cursor:pointer; font-size:14px; color:#7C766A; font-family:'Hanken Grotesk',sans-serif; }
  .mm-top-acts { display:flex; gap:10px; }
  .mm-cancel { background:none; border:none; cursor:pointer; font-size:13px; color:#7C766A; font-family:'Hanken Grotesk',sans-serif; padding:7px 14px; }
  .mm-save { background:#1A5238; color:#F6F4EF; border:none; border-radius:8px; cursor:pointer; font-size:13px; font-weight:600; padding:8px 18px; font-family:'Hanken Grotesk',sans-serif; }
  .mm-save:hover { background:#16352C; }
  .mm-head { margin-bottom:30px; }
  .mm-kicker { font-size:11px; font-weight:700; letter-spacing:.13em; text-transform:uppercase; color:#1A5238; margin-bottom:8px; }
  .mm-title { font-family:'Newsreader',serif; font-size:30px; color:#1C2521; margin-bottom:8px; }
  .mm-lede { font-size:14px; color:#4A544E; line-height:1.55; max-width:560px; }
  .mm-sec { background:#FBFAF7; border:1px solid #E1DBCF; border-radius:14px; padding:22px 24px; margin-bottom:18px; }
  .mm-sec-h { font-size:13px; font-weight:700; letter-spacing:.04em; text-transform:uppercase; color:#1C2521; }
  .mm-sec-num { color:#1A5238; margin-right:6px; }
  .mm-sec-sub { font-size:13px; color:#9A958A; margin:4px 0 18px; }
  .mm-block { padding:14px 0; border-top:1px solid #ECE8DF; }
  .mm-block:first-of-type { border-top:none; }
  .mm-label { font-size:12px; font-weight:600; color:#1C2521; margin-bottom:10px; }
  .mm-label-sub { font-weight:400; color:#A39E92; font-size:11px; margin-left:4px; }
  .mm-company { display:inline-flex; align-items:center; gap:8px; }
  .mm-company-name { font-size:14px; font-weight:600; color:#1C2521; }
  .mm-badge { font-size:10px; font-weight:700; letter-spacing:.04em; text-transform:uppercase; color:#1A5238; background:#E6F0EB; border-radius:5px; padding:2px 8px; }
  .mm-chips { display:flex; flex-wrap:wrap; gap:8px; align-items:center; }
  .mm-chip { display:inline-flex; align-items:center; gap:6px; font-size:13px; color:#1C2521; background:#fff; border:1px solid #D8D2C6; border-radius:8px; padding:5px 10px; }
  .mm-chip button { background:none; border:none; cursor:pointer; font-size:14px; color:#A39E92; padding:0; line-height:1; }
  .mm-chip button:hover { color:#7B2D26; }
  .mm-add { background:none; border:1px dashed #C9C3B6; border-radius:8px; cursor:pointer; font-size:13px; color:#7C766A; padding:5px 12px; font-family:'Hanken Grotesk',sans-serif; }
  .mm-add:hover { border-color:#1A5238; color:#1A5238; }
  .mm-src { display:flex; align-items:center; justify-content:space-between; padding:10px 0; }
  .mm-src-txt { display:flex; flex-direction:column; gap:2px; }
  .mm-src-title { font-size:14px; color:#1C2521; }
  .mm-src-sub { font-size:12px; color:#A39E92; }
  .mm-switch { width:38px; height:22px; border-radius:11px; background:#D8D2C6; position:relative; cursor:pointer; transition:background .15s; flex-shrink:0; }
  .mm-switch::after { content:''; position:absolute; top:2px; left:2px; width:18px; height:18px; border-radius:50%; background:#fff; transition:left .15s; box-shadow:0 1px 2px rgba(0,0,0,.2); }
  .mm-switch.on { background:#1A5238; }
  .mm-switch.on::after { left:18px; }

  /* media monitor — live brief states */
  .mm-loading, .mm-empty { font-size:13px; color:#A39E92; font-family:'Hanken Grotesk',sans-serif; padding:8px 0; }
  .mm-empty button, .mm-home-foot button { background:none; border:none; cursor:pointer; color:#1A5238; font-size:13px; font-family:'Hanken Grotesk',sans-serif; }
  .mm-item-head a { color:#1C2521; text-decoration:none; }
  .mm-item-head a:hover { color:#1A5238; text-decoration:underline; }
  .mm-item-tag.social { color:#7C766A; }

  /* data table — editable descriptions */
  .dt-desc { margin-top:10px; display:flex; flex-direction:column; gap:6px; max-width:640px; }
  .dt-desc-row { display:flex; gap:10px; align-items:baseline; }
  .dt-desc-label { font-size:10px; font-weight:600; text-transform:uppercase; letter-spacing:.5px; color:var(--stone); white-space:nowrap; min-width:120px; }
  .dt-desc-val { font-size:12.5px; color:var(--text); cursor:pointer; flex:1; line-height:1.45; border-radius:5px; padding:2px 5px; margin:-2px -5px; transition:background .12s; }
  .dt-desc-val:hover { background:rgba(26,82,56,.05); }

  /* ══ ASK BAR v2 — one bar, two lines: input + model + send / shape starters ══ */
  .askv2 {
    background: #FBFAF7; border: 1px solid #D9D3C7; border-radius: 18px;
    box-shadow: 0 2px 10px rgba(20,30,25,.06); margin-bottom: 28px;
  }
  .askv2:focus-within { border-color: var(--primary); }
  .askv2-line1 { display: flex; align-items: flex-start; gap: 12px; padding: 14px 14px 10px 26px; }
  .askv2-inputwrap { flex: 1; min-width: 0; min-height: 42px; padding-top: 5px; position: relative; }
  .askv2-input {
    width: 100%; border: none; outline: none; background: transparent; resize: none;
    font-family: var(--font-display); font-style: italic; font-size: 23px; color: var(--dark);
    caret-color: var(--primary); line-height: 1.4; padding: 0;
  }
  .askv2-input::placeholder { color: var(--muted); font-style: italic; }
  .askv2-footer .askv2-input { font-size: 19px; }
  .askv2-model {
    flex: none; display: inline-flex; align-items: center; gap: 7px; position: relative;
    background: #F1EEE7; border: 1px solid #D9D3C7; border-radius: 10px;
    padding: 0 12px; height: 46px; cursor: pointer; font-family: var(--font-body);
  }
  .askv2-model:hover { border-color: #BDB6A8; }
  .askv2-model-name { font-size: 12.5px; color: var(--dark); font-weight: 600; white-space: nowrap; }
  .askv2-model-caret { font-size: 10px; color: var(--stone); }
  .askv2-model .scope-dd { right: 0; top: 50px; left: auto; text-align: left; }
  .askv2-send {
    flex: none; width: 46px; height: 46px; border-radius: 12px; border: none;
    background: var(--primary); color: var(--bg); font-size: 18px; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
  }
  .askv2-send:hover { opacity: .9; }
  .askv2-pills {
    display: flex; align-items: center; flex-wrap: wrap; gap: 7px;
    padding: 8px 18px 12px 26px; border-top: 1px solid #EFEBE2;
  }
  .askv2 .ask-pill {
    display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--dark);
    background: #FBFAF7; border: 1px solid #D9D3C7; border-radius: 20px; padding: 5px 13px;
    cursor: pointer; font-family: var(--font-body);
  }
  .askv2 .ask-pill:hover { background: #F1EEE7; border-color: #BDB6A8; }
  .askv2 .ask-pill.active { color: var(--primary); background: #E9EFE9; border-color: var(--primary); font-weight: 600; }
  .askv2 .ask-pill .ask-pill-glyph { font-size: 11px; color: #8A857A; }
  .askv2 .ask-pill.active .ask-pill-glyph { color: var(--primary); }
  .askv2 .ask-pill-more { background: transparent; border-style: dashed; color: #5A6A74; }
  .askv2 .askbar-madlib { padding: 0; }
  .askv2 .madlib-sentence { font-family: var(--font-display); font-size: 21px; line-height: 1.65; color: #39434B; display: block; }
  .askv2 .madlib-mode { letter-spacing: .16em; font-size: 10px; }
