/* ============================================================
   ClariNote — Clinical Note Simplifier UI
   ============================================================ */
:root {
  --bg: #f4f6fb;
  --bg-2: #eef1f8;
  --ink: #1a1f2e;
  --ink-soft: #515a6e;
  --ink-faint: #8a93a6;
  --line: #e4e8f1;
  --line-2: #d7dcea;
  --card: #ffffff;
  --indigo: #5b5bef;
  --indigo-2: #7a6cf0;
  --violet: #8b5cf6;
  --teal: #0fb6a3;
  --teal-ink: #0a7d70;
  --amber: #e8902b;
  --amber-soft: #fff3e0;
  --rose: #e5484d;
  --green: #18a558;
  --slate: #64748b;
  --shadow: 0 10px 30px -12px rgba(28, 38, 74, .22);
  --shadow-lg: 0 24px 60px -20px rgba(28, 38, 74, .35);
  --radius: 18px;
  --radius-sm: 12px;
  --mono: "JetBrains Mono", ui-monospace, monospace;
  --serif: "Newsreader", Georgia, serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: "Inter", system-ui, sans-serif;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* aurora background */
.aurora {
  position: fixed; inset: 0; z-index: -1; overflow: hidden;
  background:
    radial-gradient(60% 50% at 12% 8%, rgba(123,108,240,.22), transparent 60%),
    radial-gradient(45% 45% at 92% 6%, rgba(15,182,163,.18), transparent 60%),
    radial-gradient(55% 50% at 78% 96%, rgba(139,92,246,.14), transparent 60%),
    linear-gradient(180deg, var(--bg), var(--bg-2));
}

/* ---------- topbar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 26px;
  background: rgba(255,255,255,.72);
  backdrop-filter: saturate(140%) blur(14px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 13px; }
.logo {
  width: 40px; height: 40px; border-radius: 12px; color: #fff;
  display: grid; place-items: center;
  background: linear-gradient(145deg, var(--indigo), var(--violet));
  box-shadow: 0 8px 20px -8px rgba(91,91,239,.7);
}
.logo svg { width: 22px; height: 22px; }
.brand-logo { width: 40px; height: 40px; object-fit: contain; border-radius: 11px; }
.brand-text h1 { margin: 0; font-size: 19px; font-weight: 800; letter-spacing: -.02em; }
.brand-text span { font-size: 12px; color: var(--ink-faint); font-weight: 500; }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.status-pill {
  display: flex; align-items: center; gap: 8px;
  font-size: 12.5px; font-weight: 600; color: var(--ink-soft);
  background: #fff; border: 1px solid var(--line); border-radius: 999px;
  padding: 7px 13px;
}
.status-pill .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--amber); box-shadow: 0 0 0 3px rgba(232,144,43,.18); }
.status-pill.ok .dot { background: var(--green); box-shadow: 0 0 0 3px rgba(24,165,88,.18); }
.status-pill.busy .dot { background: var(--indigo); animation: pulse 1s infinite; }
.status-pill.err .dot { background: var(--rose); }
@keyframes pulse { 50% { opacity: .35; } }
.ghost-btn {
  display: grid; place-items: center; width: 38px; height: 38px;
  border: 1px solid var(--line); background: #fff; border-radius: 11px;
  color: var(--ink-soft); cursor: pointer; transition: .15s;
}
.ghost-btn:hover { color: var(--indigo); border-color: var(--line-2); transform: translateY(-1px); }
.ghost-btn svg { width: 19px; height: 19px; }

/* ---------- layout ---------- */
#main { max-width: 1180px; margin: 0 auto; padding: 0 22px 200px; }

/* hero */
.hero { padding: 46px 0 8px; }
.hero-inner { max-width: 820px; }
.hero-badge {
  display: inline-block; font-size: 12px; font-weight: 600; letter-spacing: .01em;
  color: var(--indigo); background: rgba(91,91,239,.09);
  border: 1px solid rgba(91,91,239,.16); padding: 6px 13px; border-radius: 999px;
}
.hero-title { font-size: 40px; line-height: 1.1; letter-spacing: -.03em; margin: 18px 0 14px; font-weight: 800; }
.hero-title em { font-style: normal; background: linear-gradient(120deg, var(--indigo), var(--teal)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero-sub { font-size: 16.5px; line-height: 1.6; color: var(--ink-soft); max-width: 700px; }
.hero-sub b { color: var(--ink); font-weight: 600; }
.hero.collapsed { display: none; }

/* ---------- thread / messages ---------- */
.thread { display: flex; flex-direction: column; gap: 22px; margin-top: 26px; }
.msg { display: flex; animation: rise .4s cubic-bezier(.2,.7,.3,1) both; }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } }
.msg-user { justify-content: flex-end; }
.bubble-user {
  max-width: 76%; background: linear-gradient(135deg, var(--indigo), var(--indigo-2));
  color: #fff; padding: 14px 18px; border-radius: 18px 18px 4px 18px;
  font-size: 15px; line-height: 1.55; box-shadow: var(--shadow); white-space: pre-wrap;
}
.msg-system { width: 100%; }

.card {
  width: 100%; background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
}

/* progress card */
.progress-card { padding: 20px 22px; }
.progress-head { display: flex; align-items: center; gap: 13px; margin-bottom: 14px; }
.progress-title { font-weight: 700; font-size: 15px; flex: 1; }
.progress-timer { font-family: var(--mono); font-size: 13px; color: var(--ink-faint); }
.spinner {
  width: 22px; height: 22px; border-radius: 50%;
  border: 2.5px solid rgba(91,91,239,.2); border-top-color: var(--indigo);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.stage-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.stage {
  display: flex; align-items: center; gap: 12px; padding: 8px 6px;
  font-size: 14px; color: var(--ink-faint); border-radius: 8px; transition: .2s;
}
.stage .ico { width: 22px; height: 22px; flex: none; display: grid; place-items: center; border-radius: 50%; border: 2px solid var(--line-2); font-size: 12px; }
.stage .label { font-weight: 500; }
.stage .detail { color: var(--ink-faint); font-size: 12.5px; margin-left: auto; font-family: var(--mono); }
.stage.active { color: var(--ink); background: rgba(91,91,239,.05); }
.stage.active .ico { border-color: var(--indigo); color: var(--indigo); animation: pulse 1s infinite; }
.stage.done { color: var(--ink-soft); }
.stage.done .ico { border-color: var(--green); background: var(--green); color: #fff; }

/* ---------- result card ---------- */
.result { padding: 0; overflow: hidden; }
.result-head {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 16px 22px; border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(91,91,239,.04), transparent);
}
.result-head h3 { margin: 0; font-size: 15px; font-weight: 700; display: flex; align-items: center; gap: 9px; }
.result-head .meta { font-size: 12px; color: var(--ink-faint); font-family: var(--mono); display: flex; gap: 14px; flex-wrap: wrap; }
.result-body { padding: 8px 22px 22px; }

.block { padding: 18px 0; border-bottom: 1px solid var(--line); }
.block:last-child { border-bottom: none; }
.block-label {
  display: flex; align-items: center; gap: 9px; font-size: 12px; font-weight: 700;
  letter-spacing: .06em; text-transform: uppercase; color: var(--ink-faint); margin-bottom: 12px;
}
.block-label .chip { font-family: var(--mono); font-size: 11px; padding: 2px 8px; border-radius: 6px; letter-spacing: 0; text-transform: none; }
.chip-in { background: var(--amber-soft); color: var(--amber); border: 1px solid rgba(232,144,43,.25); }
.chip-rag { background: rgba(15,182,163,.1); color: var(--teal-ink); border: 1px solid rgba(15,182,163,.28); }
.chip-base { background: #eef1f6; color: var(--slate); border: 1px solid var(--line-2); }

.sentence { font-family: var(--serif); font-size: 20px; line-height: 1.72; letter-spacing: -.005em; }
.sentence.input-sentence { color: var(--ink-soft); }

/* highlight tokens */
.hl { border-radius: 5px; padding: .06em .12em; cursor: help; transition: background .15s, box-shadow .15s; white-space: pre-wrap; }
.hl-hard {
  background: linear-gradient(180deg, transparent 62%, rgba(232,144,43,.32) 62%);
  color: var(--ink); font-weight: 500;
}
.hl-hard:hover { background: rgba(232,144,43,.2); box-shadow: 0 0 0 2px rgba(232,144,43,.25); }
.hl-edit {
  background: linear-gradient(180deg, transparent 60%, rgba(15,182,163,.34) 60%);
  color: var(--teal-ink); font-weight: 600; cursor: pointer; position: relative;
}
.hl-edit:hover { background: rgba(15,182,163,.16); box-shadow: 0 0 0 2px rgba(15,182,163,.3); }
.hl-edit.active { background: rgba(15,182,163,.2); box-shadow: 0 0 0 2px var(--teal); }
.hl-base {
  background: linear-gradient(180deg, transparent 62%, rgba(100,116,139,.26) 62%);
  color: #44506a; font-weight: 500;
}

/* arrow stat between input and output */
.flow-divider { display: flex; align-items: center; gap: 14px; padding: 4px 0; color: var(--ink-faint); }
.flow-divider .ln { flex: 1; height: 1px; background: var(--line); }
.flow-divider svg { width: 20px; height: 20px; color: var(--teal); }

/* ---------- metrics ---------- */
.metrics-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 20px; }
.stat {
  border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 14px;
  background: linear-gradient(180deg, #fff, #fbfcff); position: relative; overflow: hidden;
}
.stat .stat-label { font-size: 11.5px; font-weight: 600; color: var(--ink-faint); text-transform: uppercase; letter-spacing: .04em; }
.stat .stat-val { font-family: var(--mono); font-size: 26px; font-weight: 600; margin-top: 6px; letter-spacing: -.02em; }
.stat .stat-sub { font-size: 12px; color: var(--ink-soft); margin-top: 3px; }
.stat .stat-delta { position: absolute; top: 12px; right: 12px; font-size: 11.5px; font-weight: 700; font-family: var(--mono); padding: 2px 7px; border-radius: 6px; }
.delta-good { color: var(--green); background: rgba(24,165,88,.1); }
.delta-bad { color: var(--rose); background: rgba(229,72,77,.1); }
.delta-eq { color: var(--ink-faint); background: #eef1f6; }
.stat.win { border-color: rgba(15,182,163,.4); box-shadow: 0 0 0 1px rgba(15,182,163,.2); }

.cmp-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.cmp-table th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-faint); padding: 8px 10px; border-bottom: 1px solid var(--line); font-weight: 700; }
.cmp-table th.num, .cmp-table td.num { text-align: right; font-family: var(--mono); }
.cmp-table td { padding: 9px 10px; border-bottom: 1px solid var(--line); }
.cmp-table tr:hover td { background: #fafbff; }
.cmp-table .metric-name { font-weight: 600; color: var(--ink); }
.cmp-table .metric-desc { font-size: 11.5px; color: var(--ink-faint); font-weight: 400; }
.cell-win { position: relative; }
.cell-win .barwrap { height: 5px; background: #eef1f6; border-radius: 3px; margin-top: 5px; overflow: hidden; }
.cell-win .bar { height: 100%; border-radius: 3px; }
.bar-pipe { background: linear-gradient(90deg, var(--teal), #38d6c4); }
.bar-base { background: linear-gradient(90deg, var(--slate), #94a3b8); }
.win-tag { font-size: 10px; font-weight: 700; padding: 1px 6px; border-radius: 5px; margin-left: 7px; vertical-align: middle; }
.win-pipe { background: rgba(15,182,163,.14); color: var(--teal-ink); }
.win-base { background: #eef1f6; color: var(--slate); }
.win-tie { background: #f1f3f8; color: var(--ink-faint); }
.na { color: var(--ink-faint); font-style: italic; }

.verdict {
  display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-radius: var(--radius-sm);
  background: linear-gradient(135deg, rgba(15,182,163,.08), rgba(91,91,239,.06));
  border: 1px solid rgba(15,182,163,.2); margin-bottom: 18px;
}
.verdict .vico { width: 40px; height: 40px; border-radius: 12px; flex: none; display: grid; place-items: center; background: #fff; box-shadow: var(--shadow); color: var(--teal); }
.verdict .vico svg { width: 22px; height: 22px; }
.verdict-text b { font-weight: 700; }
.verdict-text { font-size: 14px; line-height: 1.5; color: var(--ink-soft); }

/* sources used / collapsibles */
.collapse { border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; margin-top: 10px; }
.collapse-head { display: flex; align-items: center; gap: 10px; padding: 12px 15px; cursor: pointer; font-weight: 600; font-size: 13.5px; background: #fbfcff; user-select: none; }
.collapse-head .count { margin-left: auto; font-family: var(--mono); font-size: 12px; color: var(--ink-faint); }
.collapse-head .caret { transition: .2s; color: var(--ink-faint); }
.collapse.open .caret { transform: rotate(90deg); }
.collapse-body { display: none; padding: 6px 15px 14px; }
.collapse.open .collapse-body { display: block; }
.src-item { display: flex; gap: 10px; padding: 9px 0; border-top: 1px solid var(--line); font-size: 13px; }
.src-item:first-child { border-top: none; }
.src-badge { flex: none; font-size: 10.5px; font-weight: 700; padding: 3px 8px; border-radius: 6px; height: fit-content; font-family: var(--mono); }
.src-term { font-weight: 600; }
.src-def { color: var(--ink-soft); font-size: 12.5px; line-height: 1.45; }

/* source color coding */
.s-readme { background: rgba(91,91,239,.12); color: var(--indigo); }
.s-nih { background: rgba(15,182,163,.14); color: var(--teal-ink); }
.s-iowa { background: rgba(139,92,246,.14); color: var(--violet); }
.s-michigan { background: rgba(232,144,43,.16); color: var(--amber); }
.s-justplainclear { background: rgba(24,165,88,.14); color: var(--green); }
.s-medlane { background: rgba(229,72,77,.12); color: var(--rose); }
.s-dictionary { background: #e9edf6; color: var(--slate); }
.s-thesaurus { background: #efe9fb; color: #7c5cd6; }
.s-umls { background: #e0f2fe; color: #0369a1; }

/* ---------- popover ---------- */
.popover {
  position: fixed; z-index: 80; max-width: 440px; min-width: 320px;
  background: #fff; border: 1px solid var(--line-2); border-radius: 14px;
  box-shadow: var(--shadow-lg); padding: 0; opacity: 0; transform: translateY(6px) scale(.98);
  pointer-events: none; transition: opacity .14s, transform .14s; visibility: hidden;
}
.popover.show { opacity: 1; transform: translateY(0) scale(1); pointer-events: auto; visibility: visible; }
.pop-head { padding: 13px 15px 11px; border-bottom: 1px solid var(--line); }
.pop-swap { font-size: 15px; font-weight: 600; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pop-swap .from { color: var(--ink-faint); text-decoration: line-through; }
.pop-swap .arr { color: var(--teal); }
.pop-swap .to { color: var(--teal-ink); }
.pop-body { padding: 12px 15px; max-height: 460px; overflow-y: auto; }
.pop-section { margin-bottom: 13px; }
.pop-section:last-child { margin-bottom: 0; }
.pop-section .ttl { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-faint); margin-bottom: 5px; display: flex; align-items: center; gap: 7px; }
.pop-rationale { font-size: 13px; line-height: 1.55; color: var(--ink); }
.pop-passage { font-family: var(--serif); font-size: 13.5px; line-height: 1.5; color: var(--ink-soft); border-left: 3px solid var(--line-2); padding-left: 11px; font-style: italic; }
.pop-feats { display: flex; gap: 8px; flex-wrap: wrap; }
.feat { font-family: var(--mono); font-size: 11.5px; padding: 4px 8px; border-radius: 7px; background: #f4f6fb; border: 1px solid var(--line); }
.feat b { color: var(--ink); }
.feat .up { color: var(--green); }
.feat .dn { color: var(--rose); }
.cc-line { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--ink-soft); font-family: var(--mono); }
.cc-meter { flex: 1; height: 6px; background: #eef1f6; border-radius: 3px; overflow: hidden; }
.cc-meter span { display: block; height: 100%; background: linear-gradient(90deg, var(--indigo), var(--teal)); }
.ranked { display: flex; flex-direction: column; gap: 4px; }
.ranked .r { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.ranked .w { font-family: var(--mono); font-size: 11px; color: var(--ink-faint); min-width: 46px; }

/* ---------- composer ---------- */
.composer-wrap {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 30;
  padding: 16px 22px 18px;
  background: linear-gradient(180deg, transparent, var(--bg-2) 32%);
}
.composer {
  max-width: 1180px; margin: 0 auto; background: #fff; border: 1px solid var(--line-2);
  border-radius: 20px; box-shadow: var(--shadow-lg); padding: 12px 12px 12px 18px;
  transition: border-color .15s, box-shadow .15s;
}
.composer:focus-within { border-color: rgba(91,91,239,.5); box-shadow: 0 24px 60px -20px rgba(91,91,239,.4); }
#noteInput {
  width: 100%; border: none; outline: none; resize: none; font-family: inherit;
  font-size: 15.5px; line-height: 1.55; color: var(--ink); background: transparent;
  max-height: 200px; padding: 6px 0;
}
#noteInput::placeholder { color: var(--ink-faint); }
.composer-actions { display: flex; align-items: center; gap: 12px; margin-top: 8px; }
.examples { display: flex; gap: 8px; flex: 1; overflow-x: auto; scrollbar-width: none; }
.examples::-webkit-scrollbar { display: none; }
.ex-chip {
  flex: none; font-size: 12px; color: var(--ink-soft); background: var(--bg);
  border: 1px solid var(--line); border-radius: 999px; padding: 6px 12px; cursor: pointer;
  white-space: nowrap; transition: .15s; max-width: 260px; overflow: hidden; text-overflow: ellipsis;
}
.ex-chip:hover { color: var(--indigo); border-color: rgba(91,91,239,.3); background: rgba(91,91,239,.05); }
.send-btn {
  flex: none; display: flex; align-items: center; gap: 8px;
  background: linear-gradient(135deg, var(--indigo), var(--violet)); color: #fff;
  border: none; border-radius: 13px; padding: 11px 18px; font-size: 14.5px; font-weight: 600;
  cursor: pointer; box-shadow: 0 10px 24px -10px rgba(91,91,239,.7); transition: .15s;
}
.send-btn:hover { transform: translateY(-1px); box-shadow: 0 16px 30px -12px rgba(91,91,239,.8); }
.send-btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.send-btn svg { width: 18px; height: 18px; }
.composer-hint { max-width: 1180px; margin: 8px auto 0; font-size: 11.5px; color: var(--ink-faint); text-align: center; }

/* ---------- drawer ---------- */
.drawer-scrim { position: fixed; inset: 0; background: rgba(20,26,44,.36); backdrop-filter: blur(2px); opacity: 0; visibility: hidden; transition: .2s; z-index: 50; }
.drawer-scrim.show { opacity: 1; visibility: visible; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: 380px; max-width: 90vw; z-index: 60;
  background: #fff; border-left: 1px solid var(--line); box-shadow: var(--shadow-lg);
  transform: translateX(100%); transition: transform .25s cubic-bezier(.2,.7,.3,1); display: flex; flex-direction: column;
}
.drawer.show { transform: translateX(0); }
.drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.drawer-head h3 { margin: 0; font-size: 16px; }
.drawer-body { padding: 20px; overflow-y: auto; }
.field { display: flex; flex-direction: column; gap: 8px; margin-bottom: 24px; }
.field-label { font-size: 13px; font-weight: 600; display: flex; justify-content: space-between; }
.field-label em { font-style: normal; font-family: var(--mono); color: var(--indigo); }
.field-help { font-size: 12px; color: var(--ink-faint); line-height: 1.4; }
input[type=range] { accent-color: var(--indigo); }
.provider-row { font-size: 12.5px; color: var(--ink-soft); display: flex; align-items: center; gap: 9px; margin-bottom: 7px; }
.prov-badge { font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 6px; font-family: var(--mono); }
.prov-badge.fw { background: rgba(232,144,43,.14); color: var(--amber); }
.prov-badge.nv { background: rgba(91,91,239,.12); color: var(--indigo); }
.src-legend { display: flex; flex-wrap: wrap; gap: 7px; }

/* error */
.err-card { padding: 18px 22px; border-color: rgba(229,72,77,.4); }
.err-card .et { font-weight: 700; color: var(--rose); display: flex; align-items: center; gap: 9px; margin-bottom: 6px; }
.err-card .em { font-size: 13.5px; color: var(--ink-soft); font-family: var(--mono); }

@media (max-width: 760px) {
  .hero-title { font-size: 30px; }
  .metrics-grid { grid-template-columns: repeat(2, 1fr); }
  .result-head { flex-direction: column; align-items: flex-start; }
  .bubble-user { max-width: 88%; }
  .mode-toggle { display: none; }
}

/* ---------- mode toggle (Simplify | Benchmark) ---------- */
.mode-toggle { display: flex; gap: 3px; background: #eef1f7; border: 1px solid var(--line); border-radius: 999px; padding: 3px; }
.mode-tab { border: none; background: transparent; font: inherit; font-size: 13.5px; font-weight: 600; color: var(--ink-soft); padding: 7px 18px; border-radius: 999px; cursor: pointer; transition: .15s; }
.mode-tab:hover { color: var(--ink); }
.mode-tab.active { background: #fff; color: var(--indigo); box-shadow: 0 4px 12px -6px rgba(28,38,74,.3); }

/* ---------- benchmark inputs ---------- */
.io-row { display: flex; gap: 16px; align-items: stretch; }
.io-box { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.io-box.bench-field { border-left: 1px dashed var(--line-2); padding-left: 16px; }
.io-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-faint); margin-bottom: 4px; }
.bench-field[hidden] { display: none; }
.bench-or { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-faint); }
#noteInput, #refInput { width: 100%; border: none; outline: none; resize: none; font-family: inherit; font-size: 15.5px; line-height: 1.55; color: var(--ink); background: transparent; max-height: 200px; padding: 6px 0; }
#noteInput::placeholder, #refInput::placeholder { color: var(--ink-faint); }
.dataset-pick, .ctl select { font: inherit; font-size: 12.5px; color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 9px; padding: 6px 9px; cursor: pointer; }
.dataset-pick { max-width: 100%; margin-top: 8px; }
.dataset-pick[hidden] { display: none; }

/* ---------- composer controls ---------- */
.composer-controls { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 10px; }
.ctl { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--ink-faint); font-weight: 600; }
.ctl select { max-width: 180px; }
.toggle-chip { display: inline-flex; align-items: center; gap: 7px; font: inherit; font-size: 12.5px; font-weight: 600; color: var(--ink-soft); background: var(--bg); border: 1px solid var(--line); border-radius: 999px; padding: 5px 11px; cursor: pointer; }
.toggle-chip .sw { width: 26px; height: 15px; border-radius: 999px; background: var(--line-2); position: relative; transition: .15s; }
.toggle-chip .sw::after { content: ""; position: absolute; top: 2px; left: 2px; width: 11px; height: 11px; border-radius: 50%; background: #fff; transition: .15s; }
.toggle-chip.on { color: var(--indigo); border-color: rgba(91,91,239,.35); background: rgba(91,91,239,.07); }
.toggle-chip.on .sw { background: var(--indigo); }
.toggle-chip.on .sw::after { left: 13px; }
.info { width: 16px; height: 16px; border-radius: 50%; background: var(--line); color: var(--ink-soft); font-size: 11px; font-weight: 800; display: grid; place-items: center; cursor: help; }
.info:hover { background: var(--indigo); color: #fff; }

.bench-pill { font-size: 11px; font-weight: 700; font-family: var(--mono); padding: 2px 8px; border-radius: 6px; background: rgba(139,92,246,.14); color: var(--violet); }
.chip-gold { background: rgba(232,144,43,.12); color: var(--amber); border: 1px solid rgba(232,144,43,.25); }

/* ---------- left model/run sidebar ---------- */
.sidebar-scrim { position: fixed; inset: 0; background: rgba(20,26,44,.36); backdrop-filter: blur(2px); opacity: 0; visibility: hidden; transition: .2s; z-index: 50; }
.sidebar-scrim.show { opacity: 1; visibility: visible; }
.sidebar { position: fixed; top: 0; left: 0; bottom: 0; width: 340px; max-width: 90vw; z-index: 60; background: #fff; border-right: 1px solid var(--line); box-shadow: var(--shadow-lg); transform: translateX(-100%); transition: transform .25s cubic-bezier(.2,.7,.3,1); display: flex; flex-direction: column; }
.sidebar.show { transform: translateX(0); }
.sidebar select, .drawer select {
  -webkit-appearance: none; -moz-appearance: none; appearance: none;
  width: 100%; font: inherit; font-size: 13.5px; font-weight: 600; color: var(--ink);
  background-color: #fff;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238a93a6' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M6 9l6 6 6-6'/></svg>");
  background-repeat: no-repeat; background-position: right 12px center;
  border: 1px solid var(--line-2); border-radius: 12px;
  padding: 12px 38px 12px 14px; cursor: pointer; transition: border-color .15s, box-shadow .15s;
  box-shadow: 0 1px 2px rgba(28,38,74,.05);
}
.sidebar select:hover, .drawer select:hover { border-color: rgba(91,91,239,.4); }
.sidebar select:focus, .drawer select:focus { outline: none; border-color: var(--indigo); box-shadow: 0 0 0 3px rgba(91,91,239,.16); }
.sidebar .field { gap: 9px; }
.sidebar .field-label { align-items: center; }
.tune-btn { display: inline-flex; align-items: center; gap: 8px; font: inherit; font-size: 12.5px; font-weight: 600; color: var(--ink-soft); background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 7px 12px; cursor: pointer; transition: .15s; }
.tune-btn:hover { color: var(--indigo); border-color: rgba(91,91,239,.35); background: rgba(91,91,239,.05); }
.tune-btn svg { width: 18px; height: 18px; }
#modelLabel { font-weight: 700; color: var(--ink); }
