/* Arkitekt Use Case Adviser. Tokens first, light and dark selected separately. */
:root {
  --bg: #f4f3ef;
  --surface: #fcfcfb;
  --surface-2: #f0efea;
  --surface-3: #e7e5de;
  --ink: #0f1b2d;
  --text: #1b1b1a;
  --text-2: #52514e;
  --text-3: #7a7974;
  --line: #e2e0d9;
  --line-strong: #cfccc2;
  --brand: #0f1b2d;
  --brand-ink: #f4f3ef;
  --accent: #2a78d6;
  --accent-strong: #1c5cab;
  --accent-soft: #e6f0fc;
  --accent-ring: rgba(42, 120, 214, .28);
  --good: #0c7a0c;
  --good-soft: #e3f3e3;
  --warn: #8a5a00;
  --warn-soft: #fff3d6;
  --warn-mark: #fab219;
  --critical: #d03b3b;
  --critical-soft: #fbe7e7;
  --comment: #fff8e8;
  --comment-line: #f1dfb4;
  --shadow-1: 0 1px 2px rgba(15, 27, 45, .06), 0 1px 1px rgba(15, 27, 45, .04);
  --shadow-2: 0 8px 24px rgba(15, 27, 45, .08), 0 2px 6px rgba(15, 27, 45, .05);
  --shadow-3: 0 24px 64px rgba(15, 27, 45, .18);
  --seq-0: #f0efec; --seq-1: #cde2fb; --seq-2: #9ec5f4; --seq-3: #6da7ec; --seq-4: #3987e5; --seq-5: #256abf; --seq-6: #184f95; --seq-7: #0d366b;
  --radius: 14px;
  --radius-sm: 10px;
  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --serif: "Fraunces", ui-serif, Georgia, serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121211; --surface: #1a1a19; --surface-2: #222220; --surface-3: #2c2c29;
    --ink: #f0efec; --text: #f0efec; --text-2: #c3c2b7; --text-3: #8f8e86;
    --line: #2f2f2c; --line-strong: #43433f;
    --brand: #0b1524; --brand-ink: #f0efec;
    --accent: #3987e5; --accent-strong: #6da7ec; --accent-soft: #16263b; --accent-ring: rgba(57, 135, 229, .35);
    --good: #4cc44c; --good-soft: #13291a; --warn: #fab219; --warn-soft: #2e2510; --critical: #e66767; --critical-soft: #331c1c;
    --comment: #2a2516; --comment-line: #4a4024;
    --shadow-1: 0 1px 2px rgba(0,0,0,.4); --shadow-2: 0 8px 24px rgba(0,0,0,.45); --shadow-3: 0 24px 64px rgba(0,0,0,.6);
    --seq-0: #383835; --seq-1: #104281; --seq-2: #184f95; --seq-3: #1c5cab; --seq-4: #256abf; --seq-5: #3987e5; --seq-6: #6da7ec; --seq-7: #9ec5f4;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #121211; --surface: #1a1a19; --surface-2: #222220; --surface-3: #2c2c29;
  --ink: #f0efec; --text: #f0efec; --text-2: #c3c2b7; --text-3: #8f8e86;
  --line: #2f2f2c; --line-strong: #43433f;
  --brand: #0b1524; --brand-ink: #f0efec;
  --accent: #3987e5; --accent-strong: #6da7ec; --accent-soft: #16263b; --accent-ring: rgba(57, 135, 229, .35);
  --good: #4cc44c; --good-soft: #13291a; --warn: #fab219; --warn-soft: #2e2510; --critical: #e66767; --critical-soft: #331c1c;
  --comment: #2a2516; --comment-line: #4a4024;
  --shadow-1: 0 1px 2px rgba(0,0,0,.4); --shadow-2: 0 8px 24px rgba(0,0,0,.45); --shadow-3: 0 24px 64px rgba(0,0,0,.6);
  --seq-0: #383835; --seq-1: #104281; --seq-2: #184f95; --seq-3: #1c5cab; --seq-4: #256abf; --seq-5: #3987e5; --seq-6: #6da7ec; --seq-7: #9ec5f4;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--text); font: 14.5px/1.55 var(--font); -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent-strong); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.muted { color: var(--text-3); }
.serif { font-family: var(--serif); letter-spacing: -.01em; }

/* ---------- buttons, inputs, chips ---------- */
.btn { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--line-strong); background: var(--surface);
  padding: 8px 14px; border-radius: 999px; font-weight: 500; transition: background .15s, border-color .15s, transform .05s; white-space: nowrap; }
.btn:hover { background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-strong); border-color: var(--accent-strong); }
.btn.dark { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.sm { padding: 5px 10px; font-size: 13px; }
.btn.icon { padding: 7px; border-radius: 10px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.input, .select { width: 100%; border: 1px solid var(--line-strong); background: var(--surface); border-radius: 12px; padding: 10px 12px; }
.input:focus, .select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-ring); }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 500;
  background: var(--surface-2); color: var(--text-2); border: 1px solid var(--line); white-space: nowrap; }
.chip.accent { background: var(--accent-soft); color: var(--accent-strong); border-color: transparent; }
.chip.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.chip.good { background: var(--good-soft); color: var(--good); border-color: transparent; }
.chip.critical { background: var(--critical-soft); color: var(--critical); border-color: transparent; }
button.chip { cursor: pointer; }
button.chip:hover { border-color: var(--line-strong); }
.avatar { width: 30px; height: 30px; border-radius: 50%; display: inline-grid; place-items: center; font-size: 12px; font-weight: 600;
  color: #fff; flex: none; background: var(--accent); }
.avatar.ai { background: var(--ink); color: var(--bg); }
.avatar.sm { width: 22px; height: 22px; font-size: 10px; }
.toggle { position: relative; width: 38px; height: 22px; border-radius: 999px; background: var(--line-strong); border: 0; flex: none; transition: background .2s; }
.toggle::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; background: #fff; border-radius: 50%; transition: transform .2s; box-shadow: var(--shadow-1); }
.toggle[aria-checked="true"] { background: var(--accent); }
.toggle[aria-checked="true"]::after { transform: translateX(16px); }
.icon-svg { width: 16px; height: 16px; flex: none; }

/* ---------- login ---------- */
.login { min-height: 100%; display: grid; grid-template-columns: 1.1fr 1fr; }
.login-hero { background: radial-gradient(1200px 600px at 10% 10%, #1c3556 0%, #0f1b2d 55%, #0a1220 100%); color: #f4f3ef; padding: 56px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.login-hero h1 { font-family: var(--serif); font-weight: 500; font-size: 46px; line-height: 1.08; margin: 0 0 18px; max-width: 13ch; }
.login-hero p { color: #c9d4e3; max-width: 46ch; font-size: 16px; }
.login-hero .grid-art { position: absolute; inset: auto -80px -80px auto; width: 520px; height: 520px; opacity: .22; }
.login-form { display: grid; place-items: center; padding: 40px 20px; }
.login-card { width: min(380px, 100%); }
.login-card h2 { font-family: var(--serif); font-weight: 500; font-size: 28px; margin: 0 0 6px; }
.login-card label { display: block; font-size: 13px; font-weight: 500; margin: 18px 0 6px; color: var(--text-2); }
.login-card .btn { width: 100%; justify-content: center; margin-top: 24px; padding: 11px; }
.form-error { color: var(--critical); font-size: 13px; margin-top: 12px; min-height: 18px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 600; letter-spacing: .02em; }
.brand-mark { width: 30px; height: 30px; }

/* ---------- shell ---------- */
.shell { height: 100%; display: grid; grid-template-rows: 60px 1fr; }
.topbar { display: flex; align-items: center; gap: 24px; padding: 0 20px; background: var(--brand); color: var(--brand-ink); }
.topbar .brand { color: #f4f3ef; }
.topbar .brand small { font-weight: 400; color: #9fb0c6; margin-left: 4px; }
.nav { display: flex; gap: 4px; margin-left: 12px; }
.nav a { color: #b8c4d4; text-decoration: none; padding: 7px 14px; border-radius: 999px; font-weight: 500; }
.nav a:hover { color: #fff; background: rgba(255,255,255,.06); }
.nav a[aria-current="page"] { color: #0f1b2d; background: #f4f3ef; }
.topbar .spacer { flex: 1; }
.topbar .btn.ghost { color: #c9d4e3; }
.topbar .btn.ghost:hover { background: rgba(255,255,255,.08); }
.user-pill { display: flex; align-items: center; gap: 8px; color: #dfe6ef; font-weight: 500; }
.main { min-height: 0; }

/* ---------- adviser layout ---------- */
.adviser { height: 100%; display: grid; grid-template-columns: 280px 1fr 320px; min-height: 0; }
.adviser.no-side { grid-template-columns: 280px 1fr; }
.threads { border-right: 1px solid var(--line); background: var(--surface); display: flex; flex-direction: column; min-height: 0; }
.threads-head { padding: 16px; display: grid; gap: 10px; }
.threads-list { overflow: auto; padding: 0 10px 16px; }
.threads-group { font-size: 11.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--text-3); font-weight: 600; margin: 16px 8px 6px; }
.thread-item { display: grid; grid-template-columns: 1fr auto; gap: 2px 8px; padding: 9px 10px; border-radius: 10px; color: var(--text); text-decoration: none; border: 1px solid transparent; }
.thread-item:hover { background: var(--surface-2); }
.thread-item[aria-current="true"] { background: var(--accent-soft); border-color: transparent; }
.thread-item .t { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.thread-item .m { grid-column: 1 / -1; font-size: 12px; color: var(--text-3); display: flex; gap: 8px; align-items: center; }
.conversation { display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.conv-head { display: flex; align-items: center; gap: 12px; padding: 14px 24px; border-bottom: 1px solid var(--line); background: var(--surface); }
.conv-head h2 { margin: 0; font-size: 16px; font-weight: 600; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.messages { flex: 1; overflow: auto; padding: 24px; scroll-behavior: smooth; }
.messages-inner { max-width: 880px; margin: 0 auto; display: grid; gap: 22px; }
.msg { display: grid; grid-template-columns: 30px minmax(0, 1fr); gap: 12px; animation: rise .3s ease both; }
.msg > div { min-width: 0; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.msg-meta { font-size: 12.5px; color: var(--text-3); margin-bottom: 4px; display: flex; gap: 8px; align-items: center; }
.msg-meta b { color: var(--text); font-weight: 600; }
.question-text { font-size: 15.5px; white-space: pre-wrap; }
.comment-bubble { background: var(--comment); border: 1px solid var(--comment-line); padding: 10px 14px; border-radius: 4px 14px 14px 14px; white-space: pre-wrap; }
.answer-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-1); overflow: hidden; }
.answer-top { padding: 18px 20px 6px; }
.restated { font-family: var(--serif); font-size: 17px; color: var(--text-2); margin: 0 0 12px; font-style: italic; }
.prose p { margin: 0 0 12px; }
.prose ul, .prose ol { margin: 0 0 12px; padding-left: 20px; }
.prose li { margin: 4px 0; }
.cite { display: inline-flex; align-items: center; padding: 0 6px; margin: 0 1px; border-radius: 6px; background: var(--accent-soft); color: var(--accent-strong);
  font-size: 12px; font-weight: 600; border: 0; vertical-align: 1px; line-height: 1.6; }
.cite:hover { background: var(--accent); color: #fff; }
.tabs { display: flex; gap: 2px; padding: 0 16px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tab { border: 0; background: none; padding: 11px 12px; font-weight: 500; color: var(--text-3); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tab:hover { color: var(--text); }
.tab[aria-selected="true"] { color: var(--text); border-bottom-color: var(--accent); }
.tab .count { font-size: 11px; background: var(--surface-2); padding: 1px 6px; border-radius: 999px; margin-left: 4px; }
.tab-panel { padding: 16px 20px 18px; }
.answer-foot { display: flex; align-items: center; gap: 8px; padding: 10px 16px; border-top: 1px solid var(--line); background: var(--surface-2); flex-wrap: wrap; }
.answer-foot .spacer { flex: 1; }
.rate { display: inline-flex; gap: 2px; align-items: center; }
.rate button[aria-pressed="true"] { color: var(--accent-strong); background: var(--accent-soft); }
.followups { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 20px 16px; }
.followups button { border: 1px dashed var(--line-strong); background: transparent; padding: 6px 12px; border-radius: 999px; font-size: 13px; color: var(--text-2); }
.followups button:hover { border-style: solid; border-color: var(--accent); color: var(--accent-strong); background: var(--accent-soft); }

/* evidence cards */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.uc-card { position: relative; text-align: left; border: 1px solid var(--line); background: var(--surface); border-radius: 12px; padding: 14px 14px 12px; display: flex; flex-direction: column; gap: 8px;
  transition: border-color .15s, box-shadow .15s, transform .15s; cursor: pointer; min-width: 0; }
.uc-card:hover { border-color: var(--line-strong); box-shadow: var(--shadow-2); transform: translateY(-1px); }
.uc-card .id { font-size: 11.5px; color: var(--text-3); font-weight: 600; }
.uc-card h4 { margin: 0; font-size: 14.5px; line-height: 1.35; padding-right: 26px; }
.uc-card .org { font-size: 12.5px; color: var(--text-2); }
.uc-card .why { font-size: 13px; color: var(--text-2); border-left: 2px solid var(--accent); padding-left: 10px; }
.uc-card .desc { font-size: 13px; color: var(--text-2); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.uc-card .outcome { font-size: 12.5px; font-weight: 600; color: var(--good); background: var(--good-soft); border-radius: 8px; padding: 6px 8px; }
.uc-card .tags { display: flex; flex-wrap: wrap; gap: 5px; margin-top: auto; }
.star { position: absolute; top: 10px; right: 10px; border: 0; background: transparent; padding: 4px; border-radius: 8px; color: var(--text-3); }
.star:hover { background: var(--surface-2); color: var(--text); }
.star[aria-pressed="true"] { color: #d99000; }
.approach { list-style: none; padding: 0; margin: 0; counter-reset: step; display: grid; gap: 2px; }
.approach li { counter-increment: step; display: grid; grid-template-columns: 30px 1fr; gap: 12px; padding: 8px 0; position: relative; }
.approach li::before { content: counter(step); width: 26px; height: 26px; border-radius: 50%; background: var(--ink); color: var(--bg); display: grid; place-items: center; font-size: 12px; font-weight: 600; }
.approach li:not(:last-child)::after { content: ""; position: absolute; left: 12.5px; top: 36px; bottom: -6px; width: 1px; background: var(--line-strong); }
.note-line { font-size: 12.5px; color: var(--text-3); margin-top: 10px; display: flex; gap: 6px; align-items: center; }
.pattern { padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; margin-bottom: 10px; }
.pattern h5 { margin: 0 0 4px; font-size: 14px; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.list-plain { margin: 0; padding-left: 18px; }
.list-plain li { margin: 6px 0; }
h6.label { margin: 0 0 8px; font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--text-3); }

/* pending */
.pending { padding: 18px 20px; }
.steps { display: grid; gap: 10px; margin-bottom: 14px; }
.step { display: flex; gap: 10px; align-items: center; color: var(--text-3); font-size: 13.5px; }
.step .dot { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--line-strong); flex: none; display: grid; place-items: center; }
.step.active { color: var(--text); font-weight: 500; }
.step.active .dot { border-color: var(--accent); border-top-color: transparent; animation: spin .8s linear infinite; }
.step.done { color: var(--text-2); }
.step.done .dot { border-color: var(--good); background: var(--good); }
.step.done .dot::after { content: ""; width: 6px; height: 3px; border: solid #fff; border-width: 0 0 2px 2px; transform: rotate(-45deg) translate(1px,-1px); }
@keyframes spin { to { transform: rotate(360deg); } }
.shimmer { height: 12px; border-radius: 6px; background: linear-gradient(90deg, var(--surface-2), var(--surface-3), var(--surface-2)); background-size: 200% 100%; animation: sh 1.4s infinite; margin: 8px 0; }
@keyframes sh { to { background-position: -200% 0; } }
.mini-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; }
.mini-card { border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; font-size: 12.5px; background: var(--surface-2); animation: rise .3s ease both; }
.mini-card b { display: block; font-size: 13px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.error-box { padding: 14px 18px; color: var(--critical); background: var(--critical-soft); border-radius: 12px; }

/* composer */
.composer-wrap { padding: 12px 24px 18px; background: linear-gradient(to top, var(--bg) 70%, transparent); }
.composer { max-width: 880px; margin: 0 auto; background: var(--surface); border: 1px solid var(--line-strong); border-radius: 18px; box-shadow: var(--shadow-2); transition: border-color .15s, box-shadow .15s; }
.composer:focus-within { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-ring), var(--shadow-2); }
.composer.comment-mode { background: var(--comment); border-color: var(--comment-line); }
.composer textarea { width: 100%; border: 0; background: transparent; resize: none; padding: 14px 16px 6px; min-height: 52px; max-height: 220px; outline: none; box-shadow: none !important; }
.composer-bar { display: flex; align-items: center; gap: 8px; padding: 6px 8px 8px 10px; flex-wrap: wrap; }
.composer-bar .spacer { flex: 1; }
.segmented { display: inline-flex; background: var(--surface-2); border-radius: 999px; padding: 3px; border: 1px solid var(--line); }
.segmented button { border: 0; background: transparent; padding: 5px 12px; border-radius: 999px; font-size: 13px; font-weight: 500; color: var(--text-2); }
.segmented button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow-1); }
.scope-select { border: 1px solid var(--line); background: var(--surface-2); border-radius: 999px; padding: 4px 10px; font-size: 12.5px; max-width: 190px; }
.hint { font-size: 12px; color: var(--text-3); text-align: center; margin-top: 8px; }

/* hero */
.hero { flex: 1; overflow: auto; display: flex; flex-direction: column; align-items: center; padding: 56px 24px 32px; }
.hero h1 { font-family: var(--serif); font-weight: 500; font-size: 40px; margin: 0 0 8px; text-align: center; letter-spacing: -.02em; }
.hero p.sub { color: var(--text-2); margin: 0 0 28px; text-align: center; max-width: 60ch; font-size: 15.5px; }
.hero .composer { width: min(820px, 100%); }
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; width: min(820px, 100%); margin: 28px 0 8px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.kpi .v { font-size: 26px; font-weight: 600; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.kpi .l { font-size: 12.5px; color: var(--text-3); }
.examples { width: min(820px, 100%); margin-top: 22px; }
.examples-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.example { text-align: left; border: 1px solid var(--line); background: var(--surface); padding: 14px 16px; border-radius: 14px; transition: border-color .15s, box-shadow .15s, transform .15s; }
.example:hover { border-color: var(--accent); box-shadow: var(--shadow-2); transform: translateY(-1px); }
.example .k { font-size: 11.5px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--accent-strong); }
.example .q { margin-top: 4px; color: var(--text); }

/* side panel */
.side { border-left: 1px solid var(--line); background: var(--surface); overflow: auto; padding: 18px; display: grid; gap: 22px; align-content: start; }
.side section h3 { margin: 0 0 10px; font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--text-3); }
.share-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; }
.share-row .t { font-weight: 500; }
.share-row .s { font-size: 12.5px; color: var(--text-3); }
.people { display: flex; flex-wrap: wrap; gap: 6px; }
.person { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; padding: 3px 10px 3px 3px; border-radius: 999px; background: var(--surface-2); }
.shortlist-item { display: grid; grid-template-columns: 1fr auto; gap: 2px 8px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.shortlist-item:last-child { border-bottom: 0; }
.shortlist-item button.link { border: 0; background: none; padding: 0; text-align: left; font-weight: 500; color: var(--text); }
.shortlist-item button.link:hover { color: var(--accent-strong); }
.shortlist-item .m { grid-column: 1 / -1; font-size: 12px; color: var(--text-3); }
.empty-note { font-size: 13px; color: var(--text-3); border: 1px dashed var(--line-strong); border-radius: 12px; padding: 14px; text-align: center; }

/* drawer */
.scrim { position: fixed; inset: 0; background: rgba(10, 18, 32, .35); backdrop-filter: blur(2px); animation: fade .2s ease both; z-index: 40; }
@keyframes fade { from { opacity: 0; } }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(560px, 100%); background: var(--surface); box-shadow: var(--shadow-3); z-index: 41; display: flex; flex-direction: column; animation: slide .25s cubic-bezier(.2,.8,.2,1) both; }
@keyframes slide { from { transform: translateX(40px); opacity: 0; } }
.drawer-head { padding: 18px 22px; border-bottom: 1px solid var(--line); display: flex; gap: 12px; align-items: flex-start; }
.drawer-head h2 { margin: 2px 0 4px; font-family: var(--serif); font-weight: 500; font-size: 23px; line-height: 1.2; }
.drawer-body { overflow: auto; padding: 18px 22px 28px; display: grid; gap: 18px; align-content: start; }
.drawer-body section h4 { margin: 0 0 6px; font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--text-3); }
.drawer-foot { padding: 12px 22px; border-top: 1px solid var(--line); display: flex; gap: 8px; flex-wrap: wrap; }
.facts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.fact { background: var(--surface-2); border-radius: 10px; padding: 10px 12px; }
.fact .l { font-size: 11.5px; color: var(--text-3); }
.fact .v { font-weight: 500; }
.provenance { display: flex; gap: 10px; padding: 12px 14px; border-radius: 12px; background: var(--warn-soft); color: var(--text); font-size: 13px; }
.provenance svg { color: var(--warn); }
.provenance.ok { background: var(--surface-2); }
.provenance.ok svg { color: var(--text-3); }
.source-text { font-size: 13px; color: var(--text-2); background: var(--surface-2); border-radius: 10px; padding: 12px; }
.similar-list { display: grid; gap: 6px; }
.similar-list button { text-align: left; border: 1px solid var(--line); background: var(--surface); padding: 8px 12px; border-radius: 10px; }
.similar-list button:hover { border-color: var(--accent); }

/* library */
.library { height: 100%; display: grid; grid-template-columns: 290px 1fr; min-height: 0; }
.facets { border-right: 1px solid var(--line); background: var(--surface); overflow: auto; padding: 18px 16px; }
.facet { margin-bottom: 20px; }
.facet h3 { margin: 0 0 8px; font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--text-3); display: flex; justify-content: space-between; }
.facet h3 button { border: 0; background: none; color: var(--accent-strong); font-size: 12px; text-transform: none; letter-spacing: 0; padding: 0; }
.facet-opt { display: grid; grid-template-columns: 18px 1fr auto; gap: 8px; align-items: center; padding: 5px 6px; border-radius: 8px; font-size: 13.5px; cursor: pointer; }
.facet-opt:hover { background: var(--surface-2); }
.facet-opt input { margin: 0; accent-color: var(--accent); }
.facet-opt .c { font-size: 12px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.facet .more { border: 0; background: none; color: var(--accent-strong); font-size: 13px; padding: 4px 6px; }
.lib-main { overflow: auto; padding: 22px 28px 40px; }
.lib-toolbar { display: flex; gap: 12px; align-items: center; margin-bottom: 14px; flex-wrap: wrap; }
.search-box { position: relative; flex: 1; min-width: 260px; }
.search-box svg { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--text-3); }
.search-box .input { padding-left: 38px; border-radius: 999px; }
.check-inline { display: inline-flex; gap: 8px; align-items: center; font-size: 13.5px; color: var(--text-2); }
.active-filters { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.pager { display: flex; justify-content: center; align-items: center; gap: 12px; margin-top: 24px; }

/* insights */
.insights { height: 100%; overflow: auto; padding: 28px; }
.insights-inner { max-width: 1240px; margin: 0 auto; display: grid; gap: 20px; }
.insights h1 { font-family: var(--serif); font-weight: 500; font-size: 32px; margin: 0; letter-spacing: -.02em; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; min-width: 0; }
.panel h2 { margin: 0 0 4px; font-size: 16px; }
.panel .sub { color: var(--text-3); font-size: 13px; margin: 0 0 16px; }
.panel-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.kpis.wide { width: 100%; margin: 0; grid-template-columns: repeat(4, 1fr); }
.bars { display: grid; gap: 6px; }
.bar-row { display: grid; grid-template-columns: minmax(120px, 210px) 1fr 48px; gap: 10px; align-items: center; font-size: 13px; border: 0; background: none; padding: 3px 4px; border-radius: 8px; text-align: left; }
.bar-row:hover { background: var(--surface-2); }
.bar-row .name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text-2); }
.bar-track { height: 14px; position: relative; }
.bar-fill { position: absolute; left: 0; top: 0; bottom: 0; background: var(--accent); border-radius: 0 4px 4px 0; transition: width .6s cubic-bezier(.2,.8,.2,1); min-width: 2px; }
.bar-row .val { text-align: right; font-variant-numeric: tabular-nums; color: var(--text); font-weight: 500; }
.heat-wrap { overflow-x: auto; }
.heat { display: grid; gap: 2px; font-size: 12px; min-width: 900px; }
.heat .hdr { font-size: 11.5px; color: var(--text-3); writing-mode: vertical-rl; transform: rotate(180deg); justify-self: center; padding: 6px 0; max-height: 150px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.heat .rl { color: var(--text-2); padding-right: 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; align-self: center; }
.heat .cell { height: 28px; border-radius: 4px; border: 0; padding: 0; font-size: 11px; font-variant-numeric: tabular-nums; color: transparent; }
.heat .cell:hover { outline: 2px solid var(--ink); outline-offset: 1px; color: inherit; }
.legend-seq { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-3); margin-top: 12px; }
.legend-seq .ramp { display: flex; gap: 2px; }
.legend-seq .ramp span { width: 22px; height: 10px; border-radius: 2px; }
.quality-list { display: grid; grid-template-columns: 1fr auto; gap: 8px 16px; font-size: 13.5px; }
.quality-list .v { font-variant-numeric: tabular-nums; font-weight: 600; text-align: right; }
.callout { border-left: 3px solid var(--warn-mark); background: var(--warn-soft); padding: 12px 14px; border-radius: 0 10px 10px 0; font-size: 13.5px; }
#tooltip { position: fixed; z-index: 60; background: var(--ink); color: var(--bg); padding: 7px 10px; border-radius: 8px; font-size: 12.5px; pointer-events: none; box-shadow: var(--shadow-2); max-width: 280px; }
.table-toggle { font-size: 12.5px; }
table.data { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data th, table.data td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); }
table.data td.n { text-align: right; font-variant-numeric: tabular-nums; }

/* toast */
#toast-root { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); z-index: 70; display: grid; gap: 8px; }
.toast { background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 12px; box-shadow: var(--shadow-3); font-size: 13.5px; animation: rise .25s ease both; }

/* responsive */
@media (max-width: 1200px) { .adviser { grid-template-columns: 250px 1fr; } .adviser .side { display: none; } .adviser.show-side .side { display: grid; position: fixed; right: 0; top: 60px; bottom: 0; width: 320px; z-index: 30; box-shadow: var(--shadow-3); } }
@media (max-width: 860px) {
  .login { grid-template-columns: 1fr; } .login-hero { padding: 32px 20px; } .login-hero h1 { font-size: 32px; }
  .adviser { grid-template-columns: 1fr; } .threads { display: none; } .adviser.show-threads .threads { display: flex; position: fixed; inset: 60px auto 0 0; width: 290px; z-index: 30; box-shadow: var(--shadow-3); }
  .library { grid-template-columns: 1fr; } .facets { display: none; } .library.show-facets .facets { display: block; position: fixed; inset: 60px auto 0 0; width: 300px; z-index: 30; box-shadow: var(--shadow-3); }
  .topbar { gap: 6px; padding: 0 10px; } .topbar .brand span, .user-pill { display: none; } .nav { margin-left: 0; gap: 0; } .nav a { padding: 6px 9px; font-size: 13.5px; }
  .topbar #logout { padding: 5px 8px; font-size: 12.5px; } .topbar #theme { padding: 6px; }
  .kpis, .kpis.wide { grid-template-columns: 1fr 1fr; } .examples-grid, .panel-grid, .two-col, .facts { grid-template-columns: 1fr; }
  .hero { padding: 32px 16px; } .hero h1 { font-size: 30px; } .messages, .lib-main, .insights { padding: 16px; } .composer-wrap { padding: 10px 16px 14px; }
}
.mobile-only { display: none; }
.insights-inner > *, .panel-grid > *, .lib-main > *, .conversation > * { min-width: 0; }
@media (max-width: 860px) {
  .cards { grid-template-columns: minmax(0, 1fr); }
  .topbar #logout .label { display: none; }
  .search-box { min-width: 0; flex-basis: 100%; }
  .bar-row { grid-template-columns: minmax(90px, 130px) 1fr 40px; }
}
@media (max-width: 860px) { .mobile-only { display: inline-flex; } }
@media (max-width: 1200px) { .narrow-only { display: inline-flex !important; } }
.narrow-only { display: none !important; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
.insights .panel:has(table.data) { overflow-x: auto; }
table.data td { vertical-align: middle; }
.nav a { display: inline-flex; align-items: center; gap: 6px; }
.nav .gear { display: none; }
@media (max-width: 860px) { .nav .gear { display: inline-block; } .nav a[href="#/settings"] .label { display: none; } .nav a { padding: 6px 8px; } }
@media (max-width: 480px) { .topbar #theme { display: none; } }
#app { min-height: 100vh; } .login { min-height: 100vh; }

/* case studies and RFP packs */
.ours { color: var(--good); font-weight: 700; text-transform: uppercase; letter-spacing: .06em; font-size: 11px; }
.cs-card { border-left: 3px solid var(--good); }
.cite.cs { background: var(--good-soft); color: var(--good); }
.cite.cs:hover { background: var(--good); color: #fff; }
.pack-btn { right: 40px; }
.uc-card .pack-btn:only-of-type { right: 10px; }
.cs-card .pack-btn { right: 10px; }
.pack-btn[aria-pressed="true"] { color: var(--accent); }
.pack-banner { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 4px 0 12px; padding: 10px 12px; border-radius: 12px; background: var(--accent-soft); color: var(--accent-strong); font-size: 13.5px; }
.pack-banner span { flex: 1; min-width: 180px; }
.pack-list { display: grid; gap: 8px; }
.pack-item { display: grid; grid-template-columns: auto 1fr auto; gap: 4px 8px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }
.pack-item:last-child { border-bottom: 0; }
.pack-item button.link { border: 0; background: none; padding: 0; text-align: left; font-weight: 500; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pack-item button.link:hover { color: var(--accent-strong); }
.pack-item .m { grid-column: 1 / -1; font-size: 12px; color: var(--text-3); }
.pack-actions { display: inline-flex; }
.pack-actions .btn.icon { padding: 3px 6px; }
.drawer.wide { width: min(720px, 100%); }
.slide-preview { aspect-ratio: 16 / 9; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--surface-2); display: grid; place-items: center; position: relative; }
.slide-preview > span { position: absolute; bottom: 10px; left: 0; right: 0; text-align: center; font-size: 12.5px; }
.slide-preview img { width: 100%; height: 100%; object-fit: contain; display: block; background: #fff; }
.bid-insert { font-family: var(--serif); font-size: 16px; line-height: 1.5; padding: 12px 14px; border-left: 3px solid var(--good); background: var(--good-soft); border-radius: 0 10px 10px 0; }
.ratings { display: grid; gap: 6px; }
.rating-row { display: grid; grid-template-columns: 110px 1fr 20px; gap: 10px; align-items: center; font-size: 13px; }
.rating-track { display: grid; grid-template-columns: repeat(4, 1fr); gap: 3px; }
.rating-track i { height: 8px; border-radius: 2px; background: var(--surface-3); }
.rating-track i.on { background: var(--accent); }
.evidence-list { font-size: 12.5px; color: var(--text-2); max-height: 220px; overflow: auto; }
details summary { cursor: pointer; }
.lib-tabs { padding: 0; margin-bottom: 14px; }
.lib-tabs .tab { text-decoration: none; }
.segmented button:disabled { opacity: .6; cursor: default; }

/* PowerPoint in the conversation */
.deck-card { border: 1px solid var(--line); border-left: 4px solid var(--accent); background: var(--surface); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow-1); display: grid; gap: 12px; }
.deck-head { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.deck-icon { width: 42px; height: 42px; border-radius: 12px; background: var(--accent-soft); color: var(--accent-strong); display: grid; place-items: center; }
.deck-icon .icon-svg { width: 22px; height: 22px; }
.deck-title { font-weight: 600; font-size: 15.5px; }
.deck-thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.deck-thumbs img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.deck-items { display: flex; flex-wrap: wrap; gap: 6px; }
.modal { position: fixed; z-index: 41; left: 0; right: 0; top: 32px; margin: 0 auto; width: min(620px, calc(100% - 32px)); max-height: calc(100vh - 64px); display: flex; flex-direction: column; overflow: hidden; background: var(--surface); border-radius: 18px; box-shadow: var(--shadow-3); animation: fade .2s ease both; }
.modal-body { overflow: auto; padding: 22px 24px 8px; }
.modal h2 { margin: 0 0 6px; font-family: var(--serif); font-weight: 500; }
.modal-foot { display: flex; gap: 8px; align-items: center; padding: 12px 24px; border-top: 1px solid var(--line); background: var(--surface); }
.pick { display: flex; gap: 10px; align-items: flex-start; padding: 8px 10px; border-radius: 10px; cursor: pointer; }
.pick:hover { background: var(--surface-2); }
.pick input { margin-top: 3px; accent-color: var(--accent); }
.pick b { font-weight: 500; }
