/* ============================================================
   ClaudePlex — design system
   A warm editorial-technical aesthetic: paper light theme,
   deep-slate dark theme, terracotta accent. Fraunces display
   serif + Hanken Grotesk body + JetBrains Mono code.
   ============================================================ */

:root {
  /* palette — light (paper) */
  --paper:      #FBFAF7;
  --surface:    #FFFFFF;
  --surface-2:  #F4F1EA;
  --surface-3:  #ECE7DB;
  --ink:        #1F1B17;
  --ink-2:      #4A443C;
  --ink-3:      #847C6E;
  --line:       #E2DCCF;
  --line-2:     #D3CABA;

  --accent:     #C2410C;   /* terracotta */
  --accent-2:   #9A3412;
  --accent-soft:#FBEAE0;
  --teal:       #0F766E;
  --teal-soft:  #DCF1EE;

  --good:       #15803D;
  --good-soft:  #DEF1E3;
  --warn:       #B45309;
  --warn-soft:  #FBEEDB;
  --bad:        #B91C1C;
  --bad-soft:   #F8E2E0;

  --code-bg:    #2B2722;
  --code-ink:   #EDE7DC;

  /* type */
  --font-display: "Fraunces", Georgia, "Times New Roman", serif;
  --font-body: "Hanken Grotesk", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  /* metrics */
  --sidebar-w: 312px;
  --radius: 4px;
  --radius-lg: 8px;
  --shadow-sm: 0 1px 2px rgba(31,27,23,.06), 0 1px 1px rgba(31,27,23,.04);
  --shadow-md: 0 6px 24px rgba(31,27,23,.10), 0 2px 6px rgba(31,27,23,.06);
  --shadow-lg: 0 20px 60px rgba(31,27,23,.22);

  --maxw: 980px;
}

[data-theme="dark"] {
  --paper:      #16130F;
  --surface:    #1E1A15;
  --surface-2:  #251F19;
  --surface-3:  #2E261D;
  --ink:        #F2ECE0;
  --ink-2:      #C8BFB0;
  --ink-3:      #908676;
  --line:       #322A20;
  --line-2:     #423829;

  --accent:     #F07A3C;
  --accent-2:   #E8632A;
  --accent-soft:#3A2418;
  --teal:       #4FD1C5;
  --teal-soft:  #16302D;

  --good:       #4ADE80;
  --good-soft:  #14301E;
  --warn:       #FBBF55;
  --warn-soft:  #33260F;
  --bad:        #F87171;
  --bad-soft:   #341817;

  --code-bg:    #100D0A;
  --code-ink:   #E6DFD2;

  --shadow-sm: 0 1px 2px rgba(0,0,0,.4);
  --shadow-md: 0 6px 24px rgba(0,0,0,.5);
  --shadow-lg: 0 20px 60px rgba(0,0,0,.6);
}

/* ---------- reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font-body);
  background: var(--paper);
  color: var(--ink);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 600; line-height: 1.15; color: var(--ink); margin: 0; }
button { font-family: inherit; cursor: pointer; }
::selection { background: var(--accent-soft); color: var(--accent-2); }

.skip-link {
  position: absolute; left: -999px; top: 0; z-index: 200;
  background: var(--accent); color: #fff; padding: 10px 16px; border-radius: var(--radius);
}
.skip-link:focus { left: 12px; top: 12px; }

/* ---------- layout ---------- */
.app { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }

/* ---------- sidebar ---------- */
.sidebar {
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column;
  background: var(--surface-2);
  border-right: 1px solid var(--line);
  overflow: hidden;
}
.sidebar__brand {
  display: flex; align-items: center; gap: 10px;
  padding: 18px 18px 12px;
}
.brand { display: flex; align-items: center; gap: 11px; color: var(--ink); flex: 1; }
.brand:hover { text-decoration: none; }
.brand__mark {
  width: 34px; height: 34px; flex: none; border-radius: 8px;
  background: var(--accent); color: #fff;
  display: grid; place-items: center;
  font-family: var(--font-display); font-weight: 700; font-size: 20px;
  box-shadow: var(--shadow-sm);
}
.brand__text { display: flex; flex-direction: column; line-height: 1.1; }
.brand__name { font-family: var(--font-display); font-weight: 600; font-size: 20px; letter-spacing: -.01em; }
.brand__tag { font-size: 11.5px; color: var(--ink-3); letter-spacing: .02em; }

.sidebar__search { position: relative; padding: 4px 16px 12px; }
.sidebar__search input {
  width: 100%; padding: 9px 30px 9px 12px;
  background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--radius);
  color: var(--ink); font-size: 14px; font-family: inherit;
}
.sidebar__search input:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
.sidebar__search kbd {
  position: absolute; right: 26px; top: 12px;
  font-family: var(--font-mono); font-size: 11px; color: var(--ink-3);
  background: var(--surface-3); border: 1px solid var(--line-2); border-radius: 3px;
  padding: 1px 6px; pointer-events: none;
}

.nav { flex: 1; overflow-y: auto; padding: 4px 8px 24px; scrollbar-width: thin; }
.nav__group { margin-bottom: 4px; }
.nav__grouphead {
  display: flex; align-items: center; gap: 8px; width: 100%;
  background: none; border: 0; text-align: left;
  padding: 9px 10px; border-radius: var(--radius);
  color: var(--ink-2); font-weight: 600; font-size: 12.5px;
  text-transform: uppercase; letter-spacing: .06em;
}
.nav__grouphead:hover { background: var(--surface-3); color: var(--ink); }
.nav__grouphead .chev { margin-left: auto; transition: transform .18s ease; color: var(--ink-3); font-size: 11px; }
.nav__group[data-collapsed="true"] .chev { transform: rotate(-90deg); }
.nav__group[data-collapsed="true"] .nav__items { display: none; }
.nav__count { font-size: 11px; color: var(--ink-3); font-weight: 500; }

.nav__items { display: flex; flex-direction: column; gap: 1px; padding: 2px 0 8px 6px; }
.nav__item {
  display: block; padding: 7px 10px; border-radius: var(--radius);
  color: var(--ink-2); font-size: 13.5px; line-height: 1.35;
  border-left: 2px solid transparent;
}
.nav__item:hover { background: var(--surface-3); color: var(--ink); text-decoration: none; }
.nav__item.active {
  background: var(--accent-soft); color: var(--accent-2);
  border-left-color: var(--accent); font-weight: 600;
}
[data-theme="dark"] .nav__item.active { color: var(--accent); }

.sidebar__footer {
  display: flex; flex-direction: column; gap: 10px;
  padding: 13px 16px; border-top: 1px solid var(--line);
}

/* segmented theme control (light / dark / system) */
.theme-seg {
  display: inline-flex; align-self: flex-start;
  border: 1px solid var(--line-2); border-radius: 999px;
  overflow: hidden; background: var(--surface);
}
.theme-opt {
  width: 38px; height: 28px; border: 0; background: none;
  color: var(--ink-3); display: grid; place-items: center;
  font-size: 14px; cursor: pointer;
}
.theme-opt + .theme-opt { border-left: 1px solid var(--line-2); }
.theme-opt:hover { background: var(--surface-3); color: var(--ink); }
.theme-opt.active { background: var(--accent-soft); color: var(--accent-2); }
[data-theme="dark"] .theme-opt.active { color: var(--accent); }

/* footer text lines */
.cp-built { font-size: 12px; color: var(--ink-2); margin: 0; }
.cp-built a { font-weight: 600; }
.cp-disclaimer { font-size: 10.5px; color: var(--ink-3); line-height: 1.4; margin: 0; }
.cp-version {
  font-family: var(--font-mono); font-size: 10.5px; color: var(--ink-3);
  letter-spacing: .01em; margin: 0; word-break: break-word;
}

/* ghost button — used by the runner drawer "Test connection" action */
.ghost-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 8px 12px; border: 1px solid var(--line-2); border-radius: var(--radius);
  background: var(--surface); color: var(--ink-2); font-size: 13px; font-weight: 500;
}
.ghost-btn:hover { background: var(--surface-3); color: var(--ink); text-decoration: none; }

/* ---------- topbar ---------- */
.main { display: flex; flex-direction: column; min-width: 0; }
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 12px;
  padding: 12px 28px; min-height: 56px;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: saturate(1.2) blur(8px);
  border-bottom: 1px solid var(--line);
}
.topbar__menu { display: none; }
.topbar__crumbs { flex: 1; font-size: 13px; color: var(--ink-3); min-width: 0; }
.topbar__crumbs .sep { margin: 0 8px; opacity: .5; }
.topbar__crumbs b { color: var(--ink-2); font-weight: 600; }

.icon-btn {
  width: 36px; height: 36px; flex: none; border-radius: var(--radius);
  border: 1px solid transparent; background: none; color: var(--ink-2); font-size: 17px;
  display: grid; place-items: center;
}
.icon-btn:hover { background: var(--surface-3); color: var(--ink); }

.pill-btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 7px 13px; border-radius: 999px;
  border: 1px solid var(--line-2); background: var(--surface); color: var(--ink-2);
  font-size: 13px; font-weight: 600;
}
.pill-btn:hover { border-color: var(--accent); color: var(--accent-2); }
.pill-btn .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ink-3); }
.pill-btn .dot.on { background: var(--good); box-shadow: 0 0 0 3px var(--good-soft); }

/* ---------- content ---------- */
.content { flex: 1; padding: 36px 28px 96px; }
.view { max-width: var(--maxw); margin: 0 auto; animation: fade .25s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* badges */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 600;
  letter-spacing: .01em; border: 1px solid transparent; white-space: nowrap;
}
.badge--model { background: var(--teal-soft); color: var(--teal); border-color: color-mix(in srgb, var(--teal) 28%, transparent); }
.badge--tag { background: var(--surface-2); color: var(--ink-2); border-color: var(--line-2); }
.badge--section { background: var(--accent-soft); color: var(--accent-2); border-color: color-mix(in srgb, var(--accent) 26%, transparent); }
[data-theme="dark"] .badge--section { color: var(--accent); }

/* ---------- case view ---------- */
.case__top { margin-bottom: 26px; }
.case__eyebrow { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 14px; }
.case__title { font-size: clamp(28px, 4vw, 40px); letter-spacing: -.02em; margin-bottom: 12px; }
.case__title em { font-style: italic; color: var(--accent); }
.case__summary { font-size: 18.5px; line-height: 1.55; color: var(--ink-2); max-width: 70ch; }
.case__meta { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 16px; }

.section {
  margin: 30px 0; padding-top: 26px; border-top: 1px solid var(--line);
}
.section:first-child { border-top: 0; padding-top: 0; }
.section__label {
  display: flex; align-items: center; gap: 9px;
  font-family: var(--font-mono); font-size: 12px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .12em; color: var(--ink-3);
  margin-bottom: 16px;
}
.section__label::before { content: ""; width: 18px; height: 2px; background: var(--accent); border-radius: 2px; }
.tag-note { font-family: var(--font-body); text-transform: none; letter-spacing: 0; font-weight: 500; font-size: 11.5px; color: var(--ink-3); }

.prose p { margin: 0 0 14px; color: var(--ink-2); }
.prose p:last-child { margin-bottom: 0; }
.prose strong { color: var(--ink); font-weight: 600; }
.prose ul { margin: 0 0 14px; padding-left: 20px; color: var(--ink-2); }
.prose li { margin-bottom: 6px; }

/* doc quote */
.docquote {
  border-left: 3px solid var(--line-2); padding: 4px 0 4px 18px; margin: 0 0 18px;
  color: var(--ink-2); font-family: var(--font-display); font-style: italic; font-size: 17px;
}

/* comparison */
.compare {
  display: grid; gap: 18px;
  grid-template-columns: repeat(auto-fit, minmax(330px, 1fr));
}
.variant {
  display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg);
  overflow: hidden; box-shadow: var(--shadow-sm);
}
.variant__head {
  display: flex; align-items: center; gap: 9px;
  padding: 12px 16px; border-bottom: 1px solid var(--line);
  font-weight: 600; font-size: 14px;
}
.variant--weak .variant__head { background: var(--bad-soft); color: var(--bad); }
.variant--strong .variant__head { background: var(--good-soft); color: var(--good); }
.variant--neutral .variant__head { background: var(--surface-2); color: var(--ink-2); }
.variant__tone {
  font-family: var(--font-mono); font-size: 10.5px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .08em;
  margin-left: auto; padding: 2px 7px; border-radius: 999px;
  background: color-mix(in srgb, currentColor 14%, transparent);
}
.variant__body { padding: 0; display: flex; flex-direction: column; flex: 1; }

.field { border-bottom: 1px solid var(--line); }
.field:last-child { border-bottom: 0; }
.field__label {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 16px 0; font-family: var(--font-mono);
  font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .1em; color: var(--ink-3);
}
.variant__note {
  padding: 12px 16px; font-size: 13.5px; color: var(--ink-2);
  background: var(--surface-2); border-top: 1px solid var(--line); margin-top: auto;
}
.variant__note b { color: var(--ink); }

/* code blocks */
.code {
  position: relative; background: var(--code-bg); color: var(--code-ink);
  font-family: var(--font-mono); font-size: 13px; line-height: 1.55;
  overflow: auto; margin: 0;
}
.code pre { margin: 0; padding: 14px 16px; white-space: pre-wrap; word-break: break-word; }
.code--inline-field pre { padding: 10px 16px 14px; }
.copy-btn {
  position: absolute; top: 8px; right: 8px;
  background: rgba(255,255,255,.08); color: var(--code-ink);
  border: 1px solid rgba(255,255,255,.16); border-radius: var(--radius);
  font-size: 11px; font-weight: 600; padding: 4px 9px; opacity: 0; transition: opacity .15s;
  font-family: var(--font-mono);
}
.code:hover .copy-btn, .copy-btn:focus { opacity: 1; }
.copy-btn:hover { background: rgba(255,255,255,.18); }
.copy-btn.copied { background: var(--good); color: #fff; border-color: transparent; }

/* token-ish syntax colors */
.tok-str { color: #B7C77C; }
.tok-key { color: #E0A85A; }
.tok-com { color: #8C8576; font-style: italic; }
.tok-tag { color: #E58A6B; }
.tok-attr { color: #87B6C9; }
.tok-num { color: #C99ED3; }
.tok-punct { color: #B8AE9E; }
.tok-bool { color: #C99ED3; }

/* sample data */
.sample {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg);
  overflow: hidden; box-shadow: var(--shadow-sm);
}
.sample__head {
  display: flex; align-items: center; gap: 9px; padding: 11px 16px;
  border-bottom: 1px solid var(--line); background: var(--surface-2);
  font-size: 13px; font-weight: 600; color: var(--ink-2);
}
.sample__lang {
  margin-left: auto; font-family: var(--font-mono); font-size: 10.5px; text-transform: uppercase;
  letter-spacing: .08em; color: var(--ink-3);
}

/* runner inline */
.runbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 18px; }
.run-btn {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--accent); color: #fff; border: 0; border-radius: var(--radius);
  padding: 10px 18px; font-size: 14px; font-weight: 600; box-shadow: var(--shadow-sm);
}
.run-btn:hover { background: var(--accent-2); }
.run-btn:disabled { opacity: .55; cursor: not-allowed; }
.run-hint { font-size: 12.5px; color: var(--ink-3); }
.run-hint a { font-weight: 600; }

.run-out { margin-top: 8px; }
.run-out .variant__head { cursor: default; }
.run-result {
  padding: 14px 16px; font-size: 13.5px; line-height: 1.6; white-space: pre-wrap;
  word-break: break-word; min-height: 48px;
}
.run-result.err { color: var(--bad); font-family: var(--font-mono); font-size: 12.5px; }
.run-trunc {
  margin-top: 12px; padding: 8px 11px; border-radius: var(--radius);
  background: var(--warn-soft); color: var(--warn);
  border: 1px solid color-mix(in srgb, var(--warn) 30%, transparent);
  font-size: 12px; line-height: 1.45; white-space: normal;
}
.run-stats.trunc { color: var(--warn); }

/* native-version tag on a result card */
.ver-tag {
  margin-left: auto; font-family: var(--font-mono); font-size: 10.5px; font-weight: 700;
  letter-spacing: .04em; padding: 2px 7px; border-radius: 999px;
  background: color-mix(in srgb, currentColor 14%, transparent);
}

/* per-variant version sweep */
.sweep { border-top: 1px solid var(--line); }
.sweep-toggle {
  width: 100%; text-align: left; background: var(--surface-2); border: 0;
  padding: 9px 16px; font-size: 12.5px; font-weight: 600; color: var(--accent-2);
}
[data-theme="dark"] .sweep-toggle { color: var(--accent); }
.sweep-toggle:hover { background: var(--surface-3); }
.sweep__panel { padding: 12px 16px; background: var(--surface-2); border-top: 1px solid var(--line); }
.sweep__panel[hidden] { display: none; }
.sweep__presets { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 10px; }
.sweep__lbl { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-3); margin-right: 4px; }
.ver-preset {
  font-size: 11.5px; font-weight: 600; padding: 4px 9px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--line-2); color: var(--ink-2);
}
.ver-preset:hover { border-color: var(--accent); color: var(--accent-2); }
.sweep__chips { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 12px; }
.ver-chip {
  display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--ink-2);
  background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--radius);
  padding: 5px 9px; cursor: pointer;
}
.ver-chip input { accent-color: var(--accent); }
.ver-chip--native { border-color: var(--accent); color: var(--ink); }
.ver-native {
  font-family: var(--font-mono); font-size: 9.5px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .06em; color: var(--accent-2); background: var(--accent-soft);
  padding: 1px 5px; border-radius: 999px;
}
[data-theme="dark"] .ver-native { color: var(--accent); }
.sweep-run { font-size: 13px; padding: 8px 14px; }

.sweep__out { margin-top: 12px; }
.ver-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.ver-col {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden;
}
.ver-col--native { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.ver-col__head {
  display: flex; align-items: center; gap: 8px; padding: 9px 13px;
  background: var(--surface-2); border-bottom: 1px solid var(--line);
  font-family: var(--font-mono); font-size: 12px; font-weight: 600; color: var(--ink);
}
.ver-col__body { padding: 12px 13px; }
.ver-col__stats { border-top: 1px solid var(--line); }
.run-stats {
  display: flex; gap: 14px; padding: 8px 16px; border-top: 1px solid var(--line);
  background: var(--surface-2); font-family: var(--font-mono); font-size: 11px; color: var(--ink-3);
}
.spinner {
  width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent;
  border-radius: 50%; display: inline-block; animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- home / overview ---------- */
.hero { margin-bottom: 38px; }
.hero__kicker {
  font-family: var(--font-mono); font-size: 12.5px; font-weight: 600; letter-spacing: .14em;
  text-transform: uppercase; color: var(--accent); margin-bottom: 14px;
}
.hero__title { font-size: clamp(34px, 6vw, 60px); letter-spacing: -.025em; line-height: 1.04; margin-bottom: 18px; }
.hero__title em { font-style: italic; color: var(--accent); }
.hero__lede { font-size: 19px; color: var(--ink-2); max-width: 64ch; line-height: 1.55; }
.hero__stats { display: flex; flex-wrap: wrap; gap: 26px; margin-top: 26px; }
.stat { }
.stat__n { font-family: var(--font-display); font-size: 30px; font-weight: 600; color: var(--ink); line-height: 1; }
.stat__l { font-size: 12.5px; color: var(--ink-3); margin-top: 4px; letter-spacing: .02em; }

.home-section { margin-top: 34px; }
.home-section__head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 4px; }
.home-section__head h2 { font-size: 23px; letter-spacing: -.01em; }
.home-section__head .num {
  font-family: var(--font-mono); font-size: 13px; color: var(--accent); font-weight: 600;
}
.home-section__blurb { color: var(--ink-3); font-size: 14.5px; margin: 0 0 14px; max-width: 70ch; }
.card-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.card {
  display: block; padding: 15px 16px; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm);
  transition: transform .12s ease, border-color .12s ease, box-shadow .12s;
}
.card:hover { text-decoration: none; transform: translateY(-2px); border-color: var(--accent); box-shadow: var(--shadow-md); }
.card__title { font-family: var(--font-body); font-weight: 600; font-size: 15px; color: var(--ink); margin-bottom: 5px; }
.card__sum { font-size: 13px; color: var(--ink-3); line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card__foot { display: flex; gap: 6px; margin-top: 11px; flex-wrap: wrap; }

/* prev/next */
.pager { display: flex; justify-content: space-between; gap: 14px; margin-top: 48px; padding-top: 24px; border-top: 1px solid var(--line); }
.pager a { flex: 1; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); }
.pager a:hover { border-color: var(--accent); text-decoration: none; }
.pager .dir { font-size: 11.5px; color: var(--ink-3); text-transform: uppercase; letter-spacing: .08em; }
.pager .ttl { display: block; color: var(--ink); font-weight: 600; margin-top: 3px; }
.pager .next { text-align: right; }
.pager .empty { visibility: hidden; }

/* methodology / how-to (home) */
.howto { margin-top: 36px; }
.howto__grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.howto__item {
  display: flex; flex-direction: column; gap: 8px; padding: 14px 16px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg);
}
.howto__item p { margin: 0; font-size: 13.5px; color: var(--ink-2); line-height: 1.45; }
.howto__chip {
  align-self: flex-start; font-family: var(--font-mono); font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .06em; padding: 3px 9px; border-radius: 999px;
}
.howto__chip--weak { background: var(--bad-soft); color: var(--bad); }
.howto__chip--strong { background: var(--good-soft); color: var(--good); }
.howto__chip--neutral { background: var(--surface-3); color: var(--ink-2); }
.howto__chip--run { background: var(--accent-soft); color: var(--accent-2); }
[data-theme="dark"] .howto__chip--run { color: var(--accent); }

/* drawer action row */
.drawer__actions { display: flex; gap: 10px; align-items: center; margin-bottom: 4px; }
.drawer__actions .run-btn { flex: 1; }

/* search results */
.searchempty { padding: 40px 0; color: var(--ink-3); text-align: center; }

/* ---------- drawer ----------
   Flex layout (panel + scrim are side-by-side, never overlapping) so a tap
   on the panel can never land on the dismiss scrim. row-reverse keeps the
   panel on the right and the clickable scrim filling the space to its left,
   without depending on DOM order or z-index stacking. */
.drawer { position: fixed; inset: 0; z-index: 100; display: flex; flex-direction: row-reverse; }
.drawer[hidden] { display: none; } /* attribute selector must beat .drawer's display:flex */
.drawer__scrim { flex: 1 1 auto; min-width: 0; background: rgba(15,12,9,.42); animation: fade .2s; border: 0; }
.drawer__panel {
  position: relative; flex: 0 0 auto; height: 100%; width: min(440px, 92vw);
  background: var(--surface); border-left: 1px solid var(--line);
  display: flex; flex-direction: column; box-shadow: var(--shadow-lg);
  animation: slidein .22s ease;
}
@keyframes slidein { from { transform: translateX(20px); opacity: .6; } to { transform: none; opacity: 1; } }
.drawer__head { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.drawer__head h2 { font-size: 20px; }
.drawer__body { padding: 20px; overflow-y: auto; }

.form-row { margin-bottom: 18px; }
.form-row label { display: block; font-size: 13px; font-weight: 600; color: var(--ink); margin-bottom: 6px; }
.form-row .hint { font-size: 12px; color: var(--ink-3); margin: 4px 0 0; line-height: 1.45; }
.form-row input, .form-row select {
  width: 100%; padding: 9px 11px; font-family: inherit; font-size: 14px;
  background: var(--surface-2); border: 1px solid var(--line-2); border-radius: var(--radius); color: var(--ink);
}
.form-row input:focus, .form-row select:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.form-row input[type="password"] { font-family: var(--font-mono); }
.callout {
  padding: 12px 14px; border-radius: var(--radius); font-size: 12.5px; line-height: 1.5;
  background: var(--warn-soft); color: var(--warn); border: 1px solid color-mix(in srgb, var(--warn) 30%, transparent);
  margin-bottom: 18px;
}
.callout b { color: inherit; }
.status-line { font-size: 12.5px; color: var(--ink-3); margin-top: 6px; }
.status-line.ok { color: var(--good); }
.status-line.bad { color: var(--bad); }

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; z-index: 90; width: min(320px, 86vw); transform: translateX(-102%);
    transition: transform .24s ease; box-shadow: var(--shadow-lg);
  }
  body.nav-open .sidebar { transform: none; }
  .sidebar__close { display: grid; }
  .topbar__menu { display: grid; }
  .scrim { position: fixed; inset: 0; z-index: 80; background: rgba(15,12,9,.42); }
  .content { padding: 28px 20px 80px; }
  .topbar { padding: 10px 16px; }
}
@media (min-width: 901px) { .sidebar__close { display: none; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}
