/* ==========================================================================
   BrandForge design system — "Ledger"

   The visual language of a professional record rather than a dashboard. Warm
   paper, ink, and two accents that carry meaning rather than decoration:

     --accent  navy   the product's own voice: actions, links, focus
     --brass   brass  reserved exclusively for evidence and authority strength

   Nothing else is allowed to use brass. When a reader sees it they are looking
   at something the evidence graph can vouch for, which is the one thing this
   product can say that its competitors cannot.

   No webfonts and no CDN: an external stylesheet is a request that can hang,
   be blocked, or leak who is reading. The stacks below resolve to a good face
   on every platform we serve.
   ========================================================================== */

/* ── Tokens: light is the base, and every colour is defined here ─────────── */
:root {
  --paper:        #FBFAF8;
  --surface:      #FFFFFF;
  --raised:       #F5F3EF;
  --sunken:       #F0EDE7;
  --ink:          #17171A;
  --ink-soft:     #3D3C40;
  --muted:        #6E6C68;
  --faint:        #94918B;
  --line:         #E4E1DA;
  --line-strong:  #D3CFC5;

  --accent:       #2B3A67;
  --accent-hover: #1F2B4F;
  --accent-soft:  #EDEFF6;
  --accent-line:  #C3CADE;
  --on-accent:    #FFFFFF;

  --brass:        #8A6D33;
  --brass-soft:   #F5EFE1;
  --brass-line:   #DFD0AC;

  --good:         #2F6B4F;
  --good-soft:    #E9F2ED;
  --warn:         #8A6100;
  --warn-soft:    #F8F0DC;
  --bad:          #9B2C2C;
  --bad-soft:     #F8EAEA;

  --shadow-sm: 0 1px 2px rgba(23,23,26,.05), 0 1px 3px rgba(23,23,26,.04);
  --shadow-md: 0 2px 4px rgba(23,23,26,.04), 0 8px 24px rgba(23,23,26,.07);
  --shadow-lg: 0 4px 8px rgba(23,23,26,.05), 0 20px 48px rgba(23,23,26,.12);

  /* Typography. The serif appears only where the product speaks about the
     person; the UI face carries everything operational. */
  --font-display: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia,
                  ui-serif, serif;
  --font-ui: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, system-ui,
             "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas,
               "Liberation Mono", monospace;

  --t-xs:   0.6875rem;
  --t-sm:   0.8125rem;
  --t-base: 0.9375rem;
  --t-md:   1.0625rem;
  --t-lg:   1.375rem;
  --t-xl:   1.875rem;
  --t-2xl:  2.5rem;
  --t-3xl:  3.25rem;

  /* 4px base. Every gap in the product is one of these. */
  --s-1: 4px;  --s-2: 8px;  --s-3: 12px; --s-4: 16px; --s-5: 20px;
  --s-6: 24px; --s-8: 32px; --s-10: 40px; --s-12: 48px; --s-16: 64px;
  --s-20: 80px;

  --r-sm: 6px; --r-md: 10px; --r-lg: 14px; --r-xl: 20px; --r-full: 999px;

  --sidebar-w: 244px;
  --measure: 68ch;
  --ease: cubic-bezier(.22,.61,.36,1);
  --fast: 120ms; --mid: 200ms;
}

/* Dark, for viewers who chose it and for the un-stamped system default. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper:#0F0F12; --surface:#17171B; --raised:#1E1E23; --sunken:#131317;
    --ink:#ECEAE5; --ink-soft:#C9C6C0; --muted:#97948D; --faint:#726F69;
    --line:#2A2A31; --line-strong:#3A3A43;
    --accent:#8D9BE0; --accent-hover:#A5B0E8; --accent-soft:#1C2033;
    --accent-line:#2E3552; --on-accent:#0F0F12;
    --brass:#C9A961; --brass-soft:#241F14; --brass-line:#4A3F26;
    --good:#6FBE96; --good-soft:#16241D; --warn:#D6A85C; --warn-soft:#261E10;
    --bad:#E08585; --bad-soft:#2A1717;
    --shadow-sm: 0 1px 2px rgba(0,0,0,.4);
    --shadow-md: 0 2px 4px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.4);
    --shadow-lg: 0 4px 8px rgba(0,0,0,.3), 0 20px 48px rgba(0,0,0,.5);
  }
}
:root[data-theme="dark"] {
  --paper:#0F0F12; --surface:#17171B; --raised:#1E1E23; --sunken:#131317;
  --ink:#ECEAE5; --ink-soft:#C9C6C0; --muted:#97948D; --faint:#726F69;
  --line:#2A2A31; --line-strong:#3A3A43;
  --accent:#8D9BE0; --accent-hover:#A5B0E8; --accent-soft:#1C2033;
  --accent-line:#2E3552; --on-accent:#0F0F12;
  --brass:#C9A961; --brass-soft:#241F14; --brass-line:#4A3F26;
  --good:#6FBE96; --good-soft:#16241D; --warn:#D6A85C; --warn-soft:#261E10;
  --bad:#E08585; --bad-soft:#2A1717;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.4);
  --shadow-md: 0 2px 4px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.4);
  --shadow-lg: 0 4px 8px rgba(0,0,0,.3), 0 20px 48px rgba(0,0,0,.5);
}

/* ── Base ────────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: var(--t-base);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -0.018em;
                 text-wrap: balance; }
h1 { font-size: var(--t-xl); line-height: 1.2; }
h2 { font-size: var(--t-md); }
h3 { font-size: var(--t-base); }
p  { margin: 0; }
a  { color: var(--accent); text-decoration-color: var(--accent-line);
     text-underline-offset: 2px; }
a:hover { color: var(--accent-hover); }
img, svg { max-width: 100%; }
hr { border: 0; border-top: 1px solid var(--line); margin: var(--s-6) 0; }

:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: var(--s-4); top: -60px; z-index: 100;
  background: var(--surface); color: var(--ink); padding: var(--s-3) var(--s-4);
  border: 1px solid var(--line); border-radius: var(--r-md);
  box-shadow: var(--shadow-md); transition: top var(--fast) var(--ease);
}
.skip-link:focus { top: var(--s-4); }

/* ── Typographic roles ───────────────────────────────────────────────────── */
.display { font-family: var(--font-display); font-weight: 400;
           letter-spacing: -0.02em; line-height: 1.14; }
.eyebrow {
  font-size: var(--t-xs); text-transform: uppercase; letter-spacing: .12em;
  color: var(--muted); font-weight: 600;
}
.lede { color: var(--muted); font-size: var(--t-md); max-width: var(--measure);
        line-height: 1.55; }
.meta { color: var(--muted); font-size: var(--t-sm); }
.num  { font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.mono { font-family: var(--font-mono); font-size: 0.9em; }
.prose { max-width: var(--measure); line-height: 1.7; }
.prose p + p { margin-top: 1em; }

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

.sidebar {
  background: var(--sunken);
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.sidebar__brand {
  padding: var(--s-6) var(--s-5) var(--s-5);
  display: flex; align-items: center; gap: var(--s-3);
}
.sidebar__mark {
  width: 26px; height: 26px; border-radius: var(--r-sm); flex: none;
  background: var(--accent); color: var(--on-accent);
  display: grid; place-items: center;
  font-family: var(--font-display); font-size: 15px; line-height: 1;
}
.sidebar__name { font-family: var(--font-display); font-size: var(--t-md);
                 letter-spacing: -0.01em; }
.sidebar__nav { padding: 0 var(--s-3) var(--s-6); display: flex;
                flex-direction: column; gap: var(--s-1); }
.nav-group { margin-top: var(--s-5); }
.nav-group:first-child { margin-top: 0; }
.nav-group__label {
  font-size: var(--t-xs); text-transform: uppercase; letter-spacing: .12em;
  color: var(--faint); font-weight: 600;
  padding: 0 var(--s-3) var(--s-2);
}
.nav-item {
  display: flex; align-items: center; gap: var(--s-3);
  padding: var(--s-2) var(--s-3); border-radius: var(--r-md);
  color: var(--ink-soft); text-decoration: none; font-size: var(--t-sm);
  transition: background var(--fast) var(--ease), color var(--fast) var(--ease);
}
.nav-item:hover { background: var(--raised); color: var(--ink); }
.nav-item[aria-current="page"] {
  background: var(--surface); color: var(--ink); font-weight: 600;
  box-shadow: var(--shadow-sm);
}
.nav-item__icon { width: 16px; height: 16px; flex: none; opacity: .75; }
.nav-item[aria-current="page"] .nav-item__icon { opacity: 1;
  color: var(--accent); }
.nav-item--soon { color: var(--faint); pointer-events: none; }
.nav-item--soon .tag { margin-left: auto; }

/* ── TopBar and profile context ──────────────────────────────────────────── */
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: var(--s-4);
  padding: var(--s-3) var(--s-6);
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar__spacer { flex: 1; }
.menu { position: relative; }
.profile-chip {
  display: flex; align-items: center; gap: var(--s-3);
  padding: var(--s-2) var(--s-3); border-radius: var(--r-md);
  border: 1px solid transparent; background: transparent; cursor: pointer;
  font: inherit; color: inherit; text-align: left;
  transition: background var(--fast) var(--ease),
              border-color var(--fast) var(--ease);
}
.profile-chip:hover { background: var(--raised); border-color: var(--line); }
.profile-chip__text { display: flex; flex-direction: column; line-height: 1.25; }
.profile-chip__name { font-size: var(--t-sm); font-weight: 600; }
.profile-chip__role { font-size: var(--t-xs); color: var(--muted);
  max-width: 26ch; overflow: hidden; text-overflow: ellipsis;
  white-space: nowrap; }
.profile-chip__caret { color: var(--faint); transition: transform var(--fast); }
.profile-chip[aria-expanded="true"] .profile-chip__caret { transform: rotate(180deg); }

.avatar {
  width: 30px; height: 30px; border-radius: var(--r-full); flex: none;
  display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent);
  border: 1px solid var(--accent-line);
  font-size: var(--t-xs); font-weight: 700; letter-spacing: .02em;
}
.avatar--lg { width: 38px; height: 38px; font-size: var(--t-sm); }

.menu__panel {
  position: absolute; right: 0; top: calc(100% + var(--s-2));
  min-width: 302px; z-index: 40;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); box-shadow: var(--shadow-lg);
  padding: var(--s-2); display: none;
}
.menu__panel[data-open="true"] { display: block; }
.menu__label { padding: var(--s-2) var(--s-3) var(--s-1); }
.menu__item {
  display: flex; gap: var(--s-3); align-items: flex-start; width: 100%;
  padding: var(--s-3); border-radius: var(--r-md); border: 0;
  background: transparent; cursor: pointer; font: inherit; color: inherit;
  text-align: left; text-decoration: none;
  transition: background var(--fast) var(--ease);
}
.menu__item:hover { background: var(--raised); }
.menu__item[aria-current="true"] { background: var(--accent-soft); }
.menu__sep { height: 1px; background: var(--line); margin: var(--s-2) 0; }

.content { padding: var(--s-8) var(--s-6) var(--s-20); }
.container { max-width: 1080px; margin: 0 auto; }
.container--narrow { max-width: 760px; margin: 0 auto; }

/* ── PageHeader / SectionHeader ──────────────────────────────────────────── */
.page-head { margin-bottom: var(--s-8); }
.page-head__top { display: flex; align-items: flex-start; gap: var(--s-4);
                  flex-wrap: wrap; }
.page-head__title { flex: 1; min-width: min(100%, 320px); }
.page-head h1 { margin-bottom: var(--s-2); }
.page-head .lede { margin-top: var(--s-2); }
.page-head__actions { display: flex; gap: var(--s-2); flex-wrap: wrap; }

.section-head {
  display: flex; align-items: baseline; gap: var(--s-3);
  margin-bottom: var(--s-4); flex-wrap: wrap;
}
.section-head h2 { letter-spacing: -0.012em; }
.section-head__note { color: var(--muted); font-size: var(--t-sm); }
.section-head__actions { margin-left: auto; display: flex; gap: var(--s-2); }

/* ── Surfaces ────────────────────────────────────────────────────────────── */
.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); padding: var(--s-6);
}
.card--flush { padding: 0; overflow: hidden; }
.card--quiet { background: var(--raised); border-color: transparent; }
.card + .card { margin-top: var(--s-4); }
.stack   { display: flex; flex-direction: column; gap: var(--s-4); }
.stack-2 { display: flex; flex-direction: column; gap: var(--s-2); }
.stack-6 { display: flex; flex-direction: column; gap: var(--s-6); }
.row { display: flex; gap: var(--s-3); align-items: center; flex-wrap: wrap; }
.row--between { justify-content: space-between; }
.grid { display: grid; gap: var(--s-4); }
.grid--2 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.grid--3 { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.grid--4 { grid-template-columns: repeat(auto-fit, minmax(168px, 1fr)); }

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: var(--s-2); font: inherit; font-size: var(--t-sm); font-weight: 500;
  padding: var(--s-2) var(--s-4); min-height: 36px;
  border-radius: var(--r-md); border: 1px solid var(--line-strong);
  background: var(--surface); color: var(--ink);
  cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background var(--fast) var(--ease),
              border-color var(--fast) var(--ease),
              transform var(--fast) var(--ease), box-shadow var(--fast) var(--ease);
}
.btn:hover { background: var(--raised); border-color: var(--faint); }
.btn:active { transform: translateY(1px); }
.btn[disabled], .btn[aria-disabled="true"] {
  opacity: .5; pointer-events: none;
}
.btn--primary {
  background: var(--accent); border-color: var(--accent);
  color: var(--on-accent); font-weight: 600; box-shadow: var(--shadow-sm);
}
.btn--primary:hover { background: var(--accent-hover);
  border-color: var(--accent-hover); }
.btn--ghost { background: transparent; border-color: transparent;
  color: var(--muted); }
.btn--ghost:hover { background: var(--raised); color: var(--ink); }
.btn--danger { color: var(--bad); border-color: var(--bad-soft); }
.btn--danger:hover { background: var(--bad-soft); border-color: var(--bad); }
.btn--sm { min-height: 30px; padding: var(--s-1) var(--s-3);
  font-size: var(--t-xs); }
.btn--lg { min-height: 44px; padding: var(--s-3) var(--s-6);
  font-size: var(--t-base); }
.btn--block { width: 100%; }

/* An AI action reads as a suggestion, never as the system taking over. */
.btn--ai {
  border-style: dashed; border-color: var(--accent-line);
  color: var(--accent); background: var(--accent-soft);
}
.btn--ai:hover { background: var(--accent-soft); border-style: solid; }

/* ── Badges ──────────────────────────────────────────────────────────────── */
.tag {
  display: inline-flex; align-items: center; gap: var(--s-1);
  font-size: var(--t-xs); font-weight: 600; letter-spacing: .04em;
  text-transform: uppercase; padding: 2px var(--s-2);
  border-radius: var(--r-sm); border: 1px solid var(--line);
  color: var(--muted); background: var(--surface); white-space: nowrap;
}
.tag--good { color: var(--good); border-color: transparent;
             background: var(--good-soft); }
.tag--warn { color: var(--warn); border-color: transparent;
             background: var(--warn-soft); }
.tag--bad  { color: var(--bad);  border-color: transparent;
             background: var(--bad-soft); }
.tag--accent { color: var(--accent); border-color: transparent;
               background: var(--accent-soft); }
/* Brass is evidence. Nothing else may claim it. */
.tag--evidence { color: var(--brass); border-color: var(--brass-line);
                 background: var(--brass-soft); }
.tag--quiet { color: var(--faint); }

.dot { width: 7px; height: 7px; border-radius: var(--r-full);
       background: currentColor; flex: none; }

/* Origin badges: where a thing came from, said quietly. */
.origin {
  display: inline-flex; align-items: center; gap: var(--s-1);
  font-size: var(--t-xs); color: var(--faint);
  border-bottom: 1px dotted var(--line-strong); cursor: help;
}
.origin--user { color: var(--good); }
.origin--ai { color: var(--accent); }
.origin--withdrawn { color: var(--faint); text-decoration: line-through; }

/* ── Evidence / authority meter ──────────────────────────────────────────── */
.meter { display: flex; flex-direction: column; gap: var(--s-2); }
.meter__head { display: flex; align-items: baseline; gap: var(--s-3); }
.meter__name { font-weight: 600; font-size: var(--t-base); }
.meter__level { margin-left: auto; font-size: var(--t-xs); font-weight: 600;
  text-transform: uppercase; letter-spacing: .08em; color: var(--brass); }
.meter__track {
  display: flex; gap: 3px; height: 8px;
}
.meter__seg {
  flex: 1; border-radius: 2px; background: var(--sunken);
  border: 1px solid var(--line);
}
.meter__seg[data-on="true"] { background: var(--brass);
  border-color: var(--brass); }
.meter__note { font-size: var(--t-sm); color: var(--muted); }
.meter--unproven .meter__seg[data-on="true"] {
  background: repeating-linear-gradient(135deg, var(--brass-line) 0 3px,
              transparent 3px 6px);
  border-color: var(--brass-line);
}

/* ── Metric ──────────────────────────────────────────────────────────────── */
.metric { display: flex; flex-direction: column; gap: 2px; }
.metric__value { font-size: var(--t-lg); font-weight: 600; }
.metric__label { font-size: var(--t-xs); text-transform: uppercase;
  letter-spacing: .1em; color: var(--muted); font-weight: 600; }
.metric__note { font-size: var(--t-sm); color: var(--faint); }
.metric__value--absent { color: var(--faint); font-size: var(--t-base);
  font-weight: 400; font-style: italic; }

/* ── Content card ────────────────────────────────────────────────────────── */
.content-card {
  display: block; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); padding: var(--s-5); text-decoration: none;
  color: inherit;
  transition: border-color var(--mid) var(--ease),
              box-shadow var(--mid) var(--ease),
              transform var(--mid) var(--ease);
}
.content-card:hover { border-color: var(--line-strong);
  box-shadow: var(--shadow-md); transform: translateY(-1px); }
.content-card__top { display: flex; gap: var(--s-2); align-items: center;
  margin-bottom: var(--s-3); flex-wrap: wrap; }
.content-card__body { font-size: var(--t-sm); color: var(--ink-soft);
  line-height: 1.6; display: -webkit-box; -webkit-line-clamp: 3;
  -webkit-box-orient: vertical; overflow: hidden; }
.content-card__foot { display: flex; gap: var(--s-3); align-items: center;
  margin-top: var(--s-4); padding-top: var(--s-3);
  border-top: 1px solid var(--line); font-size: var(--t-xs);
  color: var(--muted); flex-wrap: wrap; }

/* ── Forms ───────────────────────────────────────────────────────────────── */
.field { display: flex; flex-direction: column; gap: var(--s-2); }
.field + .field { margin-top: var(--s-4); }
.field__label { font-size: var(--t-xs); font-weight: 600;
  text-transform: uppercase; letter-spacing: .09em; color: var(--muted); }
.field__hint { font-size: var(--t-sm); color: var(--faint); }
.input, .select, .textarea {
  width: 100%; font: inherit; font-size: var(--t-base);
  padding: var(--s-3) var(--s-3); color: var(--ink);
  background: var(--surface); border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  transition: border-color var(--fast) var(--ease),
              box-shadow var(--fast) var(--ease);
}
.input:hover, .select:hover, .textarea:hover { border-color: var(--faint); }
.input:focus, .select:focus, .textarea:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.textarea { min-height: 160px; line-height: 1.65; resize: vertical; }
.textarea--post { min-height: 340px; font-size: var(--t-md); line-height: 1.7; }
.select { appearance: none; padding-right: var(--s-8);
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%),
                    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: right 18px center, right 13px center;
  background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; }
.field-row { display: grid; gap: var(--s-3);
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }

/* ── Banner / Toast ──────────────────────────────────────────────────────── */
.banner {
  display: flex; gap: var(--s-3); align-items: flex-start;
  padding: var(--s-4); border-radius: var(--r-md);
  border: 1px solid var(--line); background: var(--raised);
  font-size: var(--t-sm); margin-bottom: var(--s-4);
}
.banner__body { flex: 1; min-width: 0; }
.banner--good { border-color: transparent; background: var(--good-soft);
                color: var(--good); }
.banner--warn { border-color: transparent; background: var(--warn-soft);
                color: var(--warn); }
.banner--bad  { border-color: transparent; background: var(--bad-soft);
                color: var(--bad); }
.banner--good .btn, .banner--warn .btn, .banner--bad .btn { color: var(--ink); }

.toast-region {
  position: fixed; right: var(--s-5); bottom: var(--s-5); z-index: 60;
  display: flex; flex-direction: column; gap: var(--s-2);
  pointer-events: none;
}
.toast {
  pointer-events: auto; display: flex; gap: var(--s-3); align-items: flex-start;
  background: var(--surface); border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: var(--r-md); box-shadow: var(--shadow-lg);
  padding: var(--s-3) var(--s-4); max-width: 400px; font-size: var(--t-sm);
  animation: toast-in var(--mid) var(--ease);
}
.toast--good { border-left-color: var(--good); }
.toast--bad  { border-left-color: var(--bad); }
@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}

/* ── Empty and loading states ────────────────────────────────────────────── */
.empty {
  text-align: center; padding: var(--s-12) var(--s-6);
  border: 1px dashed var(--line-strong); border-radius: var(--r-lg);
  background: var(--raised);
}
.empty__title { font-family: var(--font-display); font-size: var(--t-lg);
  margin-bottom: var(--s-2); }
.empty__body { color: var(--muted); max-width: 46ch; margin: 0 auto var(--s-5);
  font-size: var(--t-sm); line-height: 1.6; }

.steps { display: flex; flex-direction: column; gap: var(--s-3); }
.step { display: flex; gap: var(--s-3); align-items: flex-start;
        font-size: var(--t-sm); }
.step__mark { width: 18px; height: 18px; flex: none; margin-top: 2px;
  border-radius: var(--r-full); display: grid; place-items: center;
  font-size: 10px; border: 1px solid var(--line-strong); color: var(--faint); }
.step[data-state="done"] .step__mark { background: var(--good);
  border-color: var(--good); color: #fff; }
.step[data-state="done"] { color: var(--muted); }
.step[data-state="active"] .step__mark { border-color: var(--accent);
  color: var(--accent); }
.step[data-state="active"] { color: var(--ink); font-weight: 600; }
.step[data-state="active"] .step__mark::after {
  content: ""; width: 7px; height: 7px; border-radius: var(--r-full);
  background: var(--accent); animation: pulse 1.4s var(--ease) infinite;
}
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .35; } }

.skeleton {
  background: linear-gradient(90deg, var(--raised) 25%, var(--sunken) 37%,
              var(--raised) 63%);
  background-size: 400% 100%; border-radius: var(--r-sm);
  animation: shimmer 1.4s ease-in-out infinite; height: 1em;
}
@keyframes shimmer { from { background-position: 100% 0; }
                     to   { background-position: 0 0; } }

/* ── Tables, only where a table is genuinely the right shape ─────────────── */
.table { width: 100%; border-collapse: collapse; font-size: var(--t-sm); }
.table th {
  text-align: left; font-size: var(--t-xs); text-transform: uppercase;
  letter-spacing: .09em; color: var(--muted); font-weight: 600;
  padding: var(--s-3) var(--s-4); border-bottom: 1px solid var(--line);
}
.table td { padding: var(--s-4); border-bottom: 1px solid var(--line);
  vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.scroll-x { overflow-x: auto; }

/* ── Drawer + modal ──────────────────────────────────────────────────────── */
.overlay {
  position: fixed; inset: 0; z-index: 50; background: rgba(15,15,18,.42);
  backdrop-filter: blur(2px); display: grid;
}
dialog.modal {
  border: 1px solid var(--line); border-radius: var(--r-lg); padding: 0;
  background: var(--surface); color: var(--ink); box-shadow: var(--shadow-lg);
  max-width: 460px; width: calc(100% - var(--s-8));
}
dialog.modal::backdrop { background: rgba(15,15,18,.42); }
.modal__body { padding: var(--s-6); }
.modal__foot { display: flex; gap: var(--s-2); justify-content: flex-end;
  padding: var(--s-4) var(--s-6); border-top: 1px solid var(--line);
  background: var(--raised); border-radius: 0 0 var(--r-lg) var(--r-lg); }

/* ── Split layout for the editor ─────────────────────────────────────────── */
.split { display: grid; gap: var(--s-5); align-items: start;
         grid-template-columns: 1fr; }
@media (min-width: 1040px) {
  .split { grid-template-columns: minmax(0,1fr) 320px; }
  .split__aside { position: sticky; top: 84px; }
}

/* ── Responsive ──────────────────────────────────────────────────────────── */
.nav-toggle { display: none; }
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; inset: 0 auto 0 0; width: min(84vw, var(--sidebar-w));
    z-index: 45; transform: translateX(-100%);
    transition: transform var(--mid) var(--ease); box-shadow: var(--shadow-lg);
  }
  .app[data-nav="open"] .sidebar { transform: none; }
  .app[data-nav="open"] .scrim { display: block; }
  .scrim { display: none; position: fixed; inset: 0; z-index: 44;
    background: rgba(15,15,18,.4); }
  .nav-toggle { display: inline-flex; }
  .content { padding: var(--s-6) var(--s-4) var(--s-16); }
  .topbar { padding: var(--s-3) var(--s-4); }
  .profile-chip__role { display: none; }
  h1 { font-size: var(--t-lg); }
  .card { padding: var(--s-5) var(--s-4); }
  .menu__panel { position: fixed; left: var(--s-4); right: var(--s-4);
    top: 62px; min-width: 0; }
}
@media (max-width: 560px) {
  .page-head__actions { width: 100%; }
  .page-head__actions .btn { flex: 1; }
  .grid--4, .grid--3 { grid-template-columns: repeat(2, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important; animation-iteration-count: 1 !important;
    transition-duration: .01ms !important; scroll-behavior: auto !important;
  }
}
@media print {
  .sidebar, .topbar, .page-head__actions, .toast-region { display: none; }
  .app { grid-template-columns: 1fr; }
}
