/* TokenOps team — design system and app styles.
   Served from /static/app.css under a strict CSP: no inline styles,
   no web fonts, no external resources. Light and dark follow
   prefers-color-scheme. */

/* ---------------------------------------------------------------
   1. Tokens
   The values come from tokens.css, a copy of the public repo's
   assets/brand/tokens.css (generated from assets/brand/tokens.json),
   which pages link before this file; `scripts/sync-tokens.sh` refreshes
   it. These are this app's names for them. Light and dark (and a
   data-theme pin) switch inside tokens.css, so nothing here changes for
   dark mode.
   --------------------------------------------------------------- */
:root {

  /* Brand palette */
  --ink: var(--tok-ink);
  --lime: var(--tok-lime);
  --lime-deep: var(--tok-lime-dark);
  --amber: var(--tok-amber);
  --red: var(--tok-red);

  /* Surfaces: plain white, plain ink */
  --bg: var(--tok-bg);
  --surface: var(--tok-surface);
  --surface-2: var(--tok-surface-2);
  --surface-3: var(--tok-surface-3);
  --sidebar: var(--tok-sidebar);
  --border: var(--tok-border);
  --border-strong: var(--tok-border-strong);
  --overlay: var(--tok-overlay);

  /* Text */
  --text: var(--tok-text);
  --text-2: var(--tok-text-2);
  --muted: var(--tok-muted);
  --faint: var(--tok-faint);

  /* Accent: lime fills carry ink; lime as text or a stroke on white is the dark lime */
  --primary: var(--tok-accent);
  --primary-hover: var(--tok-accent-hover);
  --primary-press: var(--tok-accent-press);
  --on-primary: var(--tok-on-accent);
  --primary-soft: var(--tok-accent-soft);
  --primary-text: var(--tok-accent-text);
  --primary-line: var(--tok-accent-text);
  --focus: var(--tok-accent-text);

  /* Status */
  --success: var(--tok-success);
  --success-soft: var(--tok-success-soft);
  --success-border: var(--tok-success-border);
  --warn: var(--tok-warn);
  --warn-soft: var(--tok-warn-soft);
  --warn-border: var(--tok-warn-border);
  --warn-accent: var(--tok-warn-accent);
  --danger: var(--tok-danger);
  --danger-soft: var(--tok-danger-soft);
  --danger-border: var(--tok-danger-border);
  --danger-solid: var(--tok-danger-solid);
  --on-danger: var(--tok-on-danger);
  --info: var(--tok-accent-text);
  --info-soft: var(--tok-accent-soft);
  --info-border: var(--tok-accent-border);

  /* Charts */
  --chart-bar: var(--tok-chart-bar);
  --chart-bar-hover: var(--tok-chart-bar-hover);
  --chart-line: var(--tok-chart-line);
  --chart-grid: var(--tok-chart-grid);
  --chart-text: var(--tok-chart-text);
  --chart-muted: var(--tok-chart-muted);

  /* Brand panel (always ink) */
  --brand-bg: var(--tok-brand-bg);
  --brand-text: var(--tok-brand-text);
  --brand-muted: var(--tok-brand-muted);
  --brand-accent: var(--tok-brand-accent);

  /* Spacing scale (4px base) */
  --s-0: var(--tok-s-0);
  --s-1: var(--tok-s-1);
  --s-2: var(--tok-s-2);
  --s-3: var(--tok-s-3);
  --s-4: var(--tok-s-4);
  --s-5: var(--tok-s-5);
  --s-6: var(--tok-s-6);
  --s-8: var(--tok-s-8);
  --s-10: var(--tok-s-10);
  --s-12: var(--tok-s-12);
  --s-16: var(--tok-s-16);

  /* Radii */
  --r-xs: var(--tok-r-xs);
  --r-sm: var(--tok-r-sm);
  --r-md: var(--tok-r-md);
  --r-lg: var(--tok-r-lg);
  --r-xl: var(--tok-r-xl);
  --r-full: var(--tok-r-full);

  /* Shadows */
  --shadow-xs: var(--tok-shadow-xs);
  --shadow-sm: var(--tok-shadow-sm);
  --shadow-md: var(--tok-shadow-md);
  --shadow-lg: var(--tok-shadow-lg);
  --ring: var(--tok-ring);

  /* Type */
  --font: var(--tok-font-sans);
  --mono: var(--tok-font-mono);
  --fs-2xs: var(--tok-fs-2xs);
  --fs-xs: var(--tok-fs-xs);
  --fs-sm: var(--tok-fs-sm);
  --fs-md: var(--tok-fs-md);
  --fs-lg: var(--tok-fs-lg);
  --fs-xl: var(--tok-fs-xl);
  --fs-2xl: var(--tok-fs-2xl);
  --fs-3xl: var(--tok-fs-3xl);
  --fs-4xl: var(--tok-fs-4xl);
  --lh-tight: var(--tok-lh-tight);
  --lh: var(--tok-lh);

  /* Layout (this app's own) */
  --sidebar-w: 248px;
  --topbar-h: 56px;
  --content-w: 1180px;
  --control-h: 36px;
  --control-h-sm: 28px;
  --ease: var(--tok-ease);
}

/* ---------------------------------------------------------------
   2. Base
   --------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: var(--fs-md);
  line-height: var(--lh);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
h1, h2, h3, h4 { margin: 0; line-height: var(--lh-tight); font-weight: 600; letter-spacing: -0.01em; color: var(--text); }
h1 { font-size: var(--fs-2xl); letter-spacing: -0.02em; }
h2 { font-size: var(--fs-lg); }
h3 { font-size: var(--fs-md); }
p { margin: 0; }
p + p { margin-top: var(--s-2); }
ul, ol { margin: 0; padding: 0; }
a { color: var(--primary-text); text-decoration: none; text-underline-offset: 2px; }
a:hover { text-decoration: underline; }
strong { font-weight: 600; }
code, pre, kbd { font-family: var(--mono); font-size: 0.92em; }
code {
  padding: 1px 5px;
  border-radius: var(--r-xs);
  background: var(--surface-3);
  color: var(--text-2);
  overflow-wrap: anywhere;
}
pre {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-all;
}
.code {
  display: block;
  padding: var(--s-3) var(--s-4);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface-2);
  color: var(--text);
  font-size: var(--fs-sm);
  line-height: 1.6;
  overflow-x: auto;
}
.code-key { font-size: var(--fs-lg); letter-spacing: 0.08em; }
code.break { word-break: break-all; }
hr { border: 0; border-top: 1px solid var(--border); margin: var(--s-6) 0; }
img, svg { flex-shrink: 0; }
.icon { display: inline-block; vertical-align: middle; }
:focus { outline: none; }
:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
  border-radius: var(--r-xs);
}
::selection { background: var(--tok-selection); }

.muted { color: var(--muted); }
.hint { color: var(--muted); font-size: var(--fs-sm); line-height: 1.45; }
.center { text-align: center; }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%);
  white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute;
  left: var(--s-4);
  top: -100px;
  z-index: 100;
  padding: var(--s-2) var(--s-4);
  border-radius: var(--r-md);
  background: var(--primary);
  color: var(--on-primary);
  font-weight: 600;
  box-shadow: var(--shadow-lg);
}
.skip-link:focus { top: var(--s-3); text-decoration: none; }

/* ---------------------------------------------------------------
   3. Brand
   --------------------------------------------------------------- */
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-weight: 650;
  font-size: var(--fs-lg);
  letter-spacing: -0.01em;
  text-decoration: none;
}
.brand:hover { text-decoration: none; }
.brand-sub { color: var(--muted); font-weight: 500; }
/* The logo is the outlined tokenops wordmark (its o is the headroom
   ring), so "team" sits beside it on the wordmark's baseline. */
.logo, .logo img { display: block; height: 22px; width: auto; }
.brand { align-items: baseline; gap: 6px; }
.brand .logo { align-self: center; }

/* ---------------------------------------------------------------
   4. App shell: sidebar, top bar, main
   --------------------------------------------------------------- */
.shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  min-height: 100vh;
}
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: var(--s-4);
  padding: var(--s-4) var(--s-3);
  border-right: 1px solid var(--border);
  background: var(--sidebar);
  overflow-y: auto;
}
.sidebar > .brand { padding: var(--s-1) var(--s-2); }
.orgcard {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-2) var(--s-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
}
.org-avatar {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: var(--r-sm);
  font-size: var(--fs-xs);
  font-weight: 700;
}
.org-text { display: flex; flex-direction: column; min-width: 0; }
.org-name { font-weight: 600; font-size: var(--fs-sm); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.org-role { color: var(--muted); font-size: var(--fs-xs); text-transform: capitalize; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-section {
  margin: var(--s-4) var(--s-2) var(--s-1);
  color: var(--faint);
  font-size: var(--fs-2xs);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 34px;
  padding: 0 var(--s-2);
  border-radius: var(--r-sm);
  color: var(--text-2);
  font-weight: 500;
  font-size: var(--fs-md);
  text-decoration: none;
  transition: background-color 120ms var(--ease), color 120ms var(--ease);
}
.nav-link .icon { color: var(--muted); }
.nav-link:hover { background: var(--surface-3); color: var(--text); text-decoration: none; }
.nav-link[aria-current="page"] {
  background: var(--primary-soft);
  color: var(--primary-text);
  font-weight: 600;
}
.nav-link[aria-current="page"] .icon { color: var(--primary-text); }
.sidebar-note {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: var(--s-2);
  padding: var(--s-2);
  color: var(--muted);
  font-size: var(--fs-xs);
}

.frame { display: flex; flex-direction: column; min-width: 0; min-height: 100vh; }
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: var(--s-3);
  height: var(--topbar-h);
  padding: 0 var(--s-6);
  border-bottom: 1px solid var(--border);
  background: var(--overlay);
  -webkit-backdrop-filter: saturate(160%) blur(10px);
  backdrop-filter: saturate(160%) blur(10px);
}
.crumbs {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  min-width: 0;
  font-size: var(--fs-md);
  white-space: nowrap;
}
.crumb-org { color: var(--muted); overflow: hidden; text-overflow: ellipsis; }
.crumb-sep { color: var(--border-strong); }
.crumb-page { font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: var(--s-3); }
.brand-compact, .mobile-nav { display: none; }

.main {
  width: 100%;
  max-width: var(--content-w);
  margin: 0 auto;
  padding: var(--s-8) var(--s-6) var(--s-12);
  flex: 1;
}
.main:focus { outline: none; }
.app-footer {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  max-width: var(--content-w);
  width: 100%;
  margin: 0 auto;
  padding: var(--s-4) var(--s-6) var(--s-8);
  color: var(--muted);
  font-size: var(--fs-xs);
}

/* Menus built on <details> (no script) */
details > summary { list-style: none; cursor: pointer; }
details > summary::-webkit-details-marker { display: none; }
.user-menu, .mobile-nav, .confirm-pop { position: relative; }
.user-menu > summary {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  height: 34px;
  padding: 0 var(--s-2) 0 3px;
  border: 1px solid transparent;
  border-radius: var(--r-full);
  color: var(--text-2);
  font-weight: 500;
  font-size: var(--fs-sm);
}
.user-menu > summary:hover, .user-menu[open] > summary { background: var(--surface); border-color: var(--border); }
.user-name { max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chevron { color: var(--muted); transition: transform 150ms var(--ease); }
.user-menu[open] .chevron { transform: rotate(180deg); }
.menu {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  z-index: 30;
  min-width: 240px;
  padding: var(--s-1);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
}
.menu-head {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: var(--s-2) var(--s-3) var(--s-3);
  margin-bottom: var(--s-1);
  border-bottom: 1px solid var(--border);
  font-size: var(--fs-sm);
}
.menu-head .muted { font-size: var(--fs-xs); }
.menu form { margin: 0; }
.menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 34px;
  padding: 0 var(--s-3);
  border: 0;
  border-radius: var(--r-sm);
  background: none;
  color: var(--text-2);
  font: inherit;
  font-size: var(--fs-sm);
  text-align: left;
  text-decoration: none;
  justify-content: flex-start;
  box-shadow: none;
  cursor: pointer;
}
.menu-item:hover { background: var(--surface-3); color: var(--text); text-decoration: none; }
.menu-item .icon { color: var(--muted); }

/* ---------------------------------------------------------------
   5. Page structure
   --------------------------------------------------------------- */
.page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--s-4);
  margin-bottom: var(--s-6);
}
.page-head .lead { margin-top: var(--s-2); max-width: 70ch; }
.lead { color: var(--muted); font-size: var(--fs-md); }
.section, .period, .dash { margin-top: var(--s-8); }
.section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--s-1) var(--s-4);
  margin-bottom: var(--s-3);
}
.section-head h2 { font-size: var(--fs-lg); }
.section-head .muted { font-size: var(--fs-sm); }
.narrow { max-width: 560px; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: var(--s-4); }
.row-between { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s-3); }
.eyebrow {
  color: var(--muted);
  font-size: var(--fs-xs);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* Persons and avatars */
.person { display: inline-flex; align-items: center; gap: 10px; font-weight: 500; }
.person-lg { display: flex; align-items: center; gap: var(--s-4); }
.avatar {
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: var(--r-full);
  font-size: var(--fs-2xs);
  font-weight: 700;
  letter-spacing: 0.02em;
  flex-shrink: 0;
}
.avatar-lg { width: 48px; height: 48px; font-size: var(--fs-lg); }
.av-0 { background: #ecf8c6; color: #3f6b0b; }
.av-1 { background: #fdeccc; color: #8a3f06; }
.av-2 { background: #dcf3e4; color: #166534; }
.av-3 { background: #fbe1e1; color: #a51d1d; }
.av-4 { background: #ece4fb; color: #5b2bb5; }
.av-5 { background: #dcf0f5; color: #0e5c70; }
@media (prefers-color-scheme: dark) {
  .av-0 { background: rgba(198, 244, 50, 0.18); color: #ddf98c; }
  .av-1 { background: rgba(245, 158, 11, 0.2); color: #fcd38a; }
  .av-2 { background: rgba(34, 197, 94, 0.18); color: #9ee6b8; }
  .av-3 { background: rgba(239, 68, 68, 0.2); color: #ffb4b4; }
  .av-4 { background: rgba(147, 103, 235, 0.22); color: #d6c4ff; }
  .av-5 { background: rgba(14, 165, 200, 0.2); color: #a3e3f2; }
}

/* ---------------------------------------------------------------
   6. Cards
   --------------------------------------------------------------- */
.card {
  position: relative;
  padding: var(--s-5);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.card + .card { margin-top: var(--s-4); }
.card-flush { padding: 0; overflow: hidden; }
.card-section { padding: var(--s-4) var(--s-5); border-top: 1px solid var(--border); }
.card-flush > .table-wrap + .card-section, .card-flush > .card-section:first-child { border-top: 0; }
.card-flush > .table-wrap + .card-section { border-top: 1px solid var(--border); }
.card-title {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  margin-bottom: var(--s-3);
  font-size: var(--fs-md);
  font-weight: 600;
}
.card-title .icon { color: var(--muted); }
.card-foot {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--s-2);
  margin-top: var(--s-5);
  padding-top: var(--s-4);
  border-top: 1px solid var(--border);
}
.card-highlight { border-color: var(--info-border); box-shadow: var(--shadow-sm), 0 0 0 3px var(--info-soft); margin-bottom: var(--s-6); }
.card-highlight .code { margin-top: var(--s-3); }
.empty-small { color: var(--muted); }
.callout {
  margin-top: var(--s-4);
  padding: var(--s-4);
  border: 1px dashed var(--border-strong);
  border-radius: var(--r-md);
  background: var(--surface-2);
}
.callout form { margin-top: var(--s-3); }

/* ---------------------------------------------------------------
   7. Buttons
   --------------------------------------------------------------- */
.btn, button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
  height: var(--control-h);
  padding: 0 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-md);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: var(--fs-md);
  font-weight: 550;
  line-height: 1;
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
  box-shadow: var(--shadow-xs);
  transition: background-color 120ms var(--ease), border-color 120ms var(--ease), box-shadow 120ms var(--ease), color 120ms var(--ease);
}
.btn:hover, button:hover { background: var(--surface-2); border-color: var(--faint); text-decoration: none; }
.btn:active, button:active { background: var(--surface-3); }
.btn:focus-visible, button:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.btn-primary, button.primary {
  border-color: var(--primary);
  background: var(--primary);
  color: var(--on-primary);
  box-shadow: 0 1px 2px rgba(14, 18, 32, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.25);
}
.btn-primary:hover, button.primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn-primary:active, button.primary:active { background: var(--primary-press); }
.btn-danger {
  border-color: var(--danger-solid);
  background: var(--danger-solid);
  color: var(--on-danger);
}
.btn-danger:hover { background: #b91c1c; border-color: #b91c1c; }
.btn-danger-quiet { color: var(--danger); border-color: var(--danger-border); background: var(--surface); }
.btn-danger-quiet:hover { background: var(--danger-soft); border-color: var(--danger); }
.btn-github {
  border-color: #16181d;
  background: #16181d;
  color: #ffffff;
}
.btn-github:hover { background: #2b2f37; border-color: #2b2f37; }
@media (prefers-color-scheme: dark) {
  .btn-github { border-color: #e9ecf3; background: #e9ecf3; color: #16181d; }
  .btn-github:hover { background: #ffffff; border-color: #ffffff; }
}
.btn-sm { height: var(--control-h-sm); padding: 0 10px; font-size: var(--fs-sm); border-radius: var(--r-sm); }
.btn-block { width: 100%; }
.actions { display: flex; flex-wrap: wrap; gap: var(--s-2); align-items: center; }
.actions form { margin: 0; }
.link-arrow { display: inline-flex; align-items: center; gap: var(--s-1); font-weight: 500; white-space: nowrap; }

/* ---------------------------------------------------------------
   8. Forms
   --------------------------------------------------------------- */
.form { display: flex; flex-direction: column; gap: var(--s-4); }
.form-inline { flex-direction: row; flex-wrap: wrap; align-items: flex-end; gap: var(--s-3); }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: var(--s-4); }
.form-grid .span-2 { grid-column: 1 / -1; }
.form-actions { display: flex; flex-wrap: wrap; gap: var(--s-2); justify-content: flex-end; padding-top: var(--s-1); }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field.grow { flex: 1 1 220px; }
.field label, .field-label { color: var(--text-2); font-size: var(--fs-sm); font-weight: 550; }
.field-row { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s-2); }
.field-link { font-size: var(--fs-sm); }
.optional { color: var(--faint); font-weight: 400; margin-left: var(--s-1); }
input[type="text"], input[type="email"], input[type="password"], input[type="url"], input[type="number"], input[type="date"], select {
  width: 100%;
  height: var(--control-h);
  padding: 0 var(--s-3);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-md);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: var(--fs-md);
  box-shadow: var(--shadow-xs);
  transition: border-color 120ms var(--ease), box-shadow 120ms var(--ease);
}
input[type="date"] { font-variant-numeric: tabular-nums; }
select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 32px;
  background-image: linear-gradient(45deg, transparent 50%, var(--faint) 50%), linear-gradient(135deg, var(--faint) 50%, transparent 50%);
  background-position: calc(100% - 16px) 52%, calc(100% - 11px) 52%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}
.select-sm { width: auto; height: var(--control-h-sm); font-size: var(--fs-sm); padding-left: var(--s-2); border-radius: var(--r-sm); }
input::placeholder { color: var(--faint); }
input:hover, select:hover { border-color: var(--faint); }
input:focus-visible, select:focus-visible, input:focus, select:focus {
  outline: none;
  border-color: var(--primary-line);
  box-shadow: var(--ring);
}
input.otp { font-family: var(--mono); font-size: var(--fs-xl); letter-spacing: 0.2em; text-align: center; height: 44px; }
.check {
  display: inline-flex;
  align-items: flex-start;
  gap: var(--s-2);
  color: var(--text-2);
  font-size: var(--fs-sm);
  cursor: pointer;
}
input[type="checkbox"], input[type="radio"] {
  width: 16px;
  height: 16px;
  margin: 2px 0 0;
  accent-color: var(--primary-line);
  flex-shrink: 0;
}
form.inline { display: inline-flex; align-items: center; gap: 6px; margin: 0; }
fieldset { margin: 0; padding: 0; border: 0; min-width: 0; }
.choice-list { display: flex; flex-direction: column; gap: var(--s-2); }
.choice {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-3) var(--s-4);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  cursor: pointer;
  transition: border-color 120ms var(--ease), background-color 120ms var(--ease);
}
.choice:hover { background: var(--surface-2); }
.choice:has(input:checked) { border-color: var(--primary-line); background: var(--primary-soft); }
.choice input { margin: 0; }
.choice-text { display: flex; flex-direction: column; }
.choice-text .muted { font-size: var(--fs-xs); text-transform: capitalize; }

/* ---------------------------------------------------------------
   9. Alerts, banners, badges, chips
   --------------------------------------------------------------- */
.alert, .banner {
  display: flex;
  align-items: flex-start;
  gap: var(--s-3);
  margin-bottom: var(--s-4);
  padding: var(--s-3) var(--s-4);
  border: 1px solid;
  border-radius: var(--r-md);
  font-size: var(--fs-md);
}
.alert > .icon, .banner > .icon { margin-top: 3px; }
.alert p, .banner p { flex: 1; }
.alert a, .banner a { font-weight: 600; text-decoration: underline; }
.alert-info { background: var(--info-soft); border-color: var(--info-border); color: var(--text); }
.alert-info > .icon { color: var(--info); }
.alert-success { background: var(--success-soft); border-color: var(--success-border); color: var(--text); }
.alert-success > .icon { color: var(--success); }
.alert-warn { background: var(--warn-soft); border-color: var(--warn-border); color: var(--text); }
.alert-warn > .icon { color: var(--warn); }
.alert-error { background: var(--danger-soft); border-color: var(--danger-border); color: var(--text); }
.alert-error > .icon { color: var(--danger); }
.banner { background: var(--surface); border-color: var(--border); color: var(--text-2); box-shadow: var(--shadow-xs); }
.banner > .icon { color: var(--primary-text); }
/* Legacy message classes */
p.error { color: var(--danger); }
p.notice { padding: var(--s-3) var(--s-4); border-radius: var(--r-md); background: var(--warn-soft); }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 22px;
  padding: 0 var(--s-2);
  border: 1px solid transparent;
  border-radius: var(--r-full);
  font-size: var(--fs-xs);
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
}
.badge .dot { width: 6px; height: 6px; border-radius: var(--r-full); background: currentColor; }
.badge-neutral { background: var(--surface-3); color: var(--text-2); border-color: var(--border); }
.badge-role { background: var(--surface-3); color: var(--text-2); border-color: var(--border); text-transform: capitalize; font-weight: 550; }
.badge-info { background: var(--info-soft); color: var(--info); border-color: var(--info-border); }
.badge-success { background: var(--success-soft); color: var(--success); border-color: var(--success-border); }
.badge-warn { background: var(--warn-soft); color: var(--warn); border-color: var(--warn-border); }
.badge-danger { background: var(--danger-soft); color: var(--danger); border-color: var(--danger-border); }
.badge-mono { font-family: var(--mono); font-weight: 500; font-size: var(--fs-2xs); letter-spacing: 0; }
.plan-badge { height: 26px; padding: 0 10px; }

.chip {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 var(--s-2);
  border: 1px dashed var(--border-strong);
  border-radius: var(--r-full);
  background: var(--surface-2);
  color: var(--muted);
  font-size: var(--fs-xs);
  cursor: help;
}
.code-chip { font-family: var(--mono); letter-spacing: 0.06em; padding: 2px 8px; border-radius: var(--r-sm); background: var(--surface-3); }

/* ---------------------------------------------------------------
   10. Tables
   --------------------------------------------------------------- */
.table-wrap {
  overflow: auto;
  max-height: 72vh;
  border-radius: inherit;
}
.disclosure .table-wrap, .table-wrap.card-flush { border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--surface); box-shadow: var(--shadow-sm); }
.table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-variant-numeric: tabular-nums;
  font-size: var(--fs-md);
}
.table th, .table td {
  padding: 10px var(--s-4);
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: middle;
  white-space: nowrap;
}
.table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  height: 38px;
  padding-top: 0;
  padding-bottom: 0;
  background: var(--surface-2);
  color: var(--muted);
  font-size: var(--fs-xs);
  font-weight: 600;
  letter-spacing: 0.01em;
}
.table tbody th { font-weight: 500; color: var(--text); }
.table tbody tr:last-child > * { border-bottom: 0; }
.table tbody tr { transition: background-color 80ms var(--ease); }
.table tbody tr:hover > * { background: var(--surface-2); }
.table .n { text-align: right; font-variant-numeric: tabular-nums; }
.table td.wrap { white-space: normal; min-width: 200px; max-width: 420px; }
.table th.group { font-weight: 600; }
.table .muted { color: var(--muted); }
caption { text-align: left; }

/* Audit log as a timeline */
.audit td.when { position: relative; padding-left: 36px; color: var(--text-2); }
.audit td.when::before {
  content: "";
  position: absolute;
  left: 19px;
  top: 0;
  bottom: 0;
  width: 1px;
  background: var(--border);
}
.audit tbody tr:first-child td.when::before { top: 50%; }
.audit tbody tr:last-child td.when::before { bottom: 50%; }
.tl-dot {
  position: absolute;
  left: 15px;
  top: 50%;
  width: 9px;
  height: 9px;
  margin-top: -4.5px;
  border-radius: var(--r-full);
  border: 2px solid var(--surface);
  background: var(--faint);
  box-shadow: 0 0 0 1px var(--border-strong);
}
.tl-dot.tone-success { background: var(--success); }
.tl-dot.tone-danger { background: var(--danger); }
.tl-dot.tone-warn { background: var(--warn-accent); }
.tl-dot.tone-info { background: var(--primary-line); }
.audit td.detail { color: var(--text-2); font-size: var(--fs-sm); }

/* ---------------------------------------------------------------
   11. Overview dashboard
   --------------------------------------------------------------- */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: var(--s-3);
  margin: var(--s-6) 0 var(--s-2);
  padding: var(--s-3);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
}
.toolbar .field { flex: 1 1 140px; max-width: 200px; }
.field-compact label { font-size: var(--fs-xs); color: var(--muted); font-weight: 550; }
.toolbar .btn { margin-left: auto; }

.kpis {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: var(--s-3);
}
.stats-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: var(--s-3); margin-bottom: var(--s-4); }
.kpi {
  display: flex;
  flex-direction: column;
  gap: var(--s-1);
  padding: var(--s-4);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
}
.kpi-label { color: var(--muted); font-size: var(--fs-xs); font-weight: 550; }
.kpi-value {
  font-size: var(--fs-3xl);
  font-weight: 650;
  letter-spacing: -0.02em;
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
}
.kpi-value .unit { font-size: var(--fs-md); font-weight: 500; color: var(--muted); letter-spacing: 0; }
.kpi-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-height: 20px; font-size: var(--fs-xs); }
.kpi-hint { color: var(--muted); }
.delta {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  height: 20px;
  padding: 0 6px;
  border-radius: var(--r-full);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  background: var(--surface-3);
  color: var(--text-2);
}
.delta-up::before { content: "\2191"; }
.delta-down::before { content: "\2193"; }
.delta-flat::before { content: "\2192"; }
.delta.tone-good { background: var(--success-soft); color: var(--success); }
.delta.tone-bad { background: var(--danger-soft); color: var(--danger); }

.charts { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: var(--s-3); margin-top: var(--s-3); }
.chart-card { margin: 0; padding: var(--s-4) var(--s-4) var(--s-3); }
.card.chart-card + .card.chart-card { margin-top: 0; }
.chart-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: var(--s-1) var(--s-3); margin-bottom: var(--s-2); }
.chart-head h3 { font-size: var(--fs-md); }
.chart-head .muted { font-size: var(--fs-xs); }
.chart { display: block; width: 100%; height: auto; overflow: visible; }
.chart .grid { stroke: var(--chart-grid); stroke-width: 1; shape-rendering: crispEdges; }
.chart .tick, .chart .axis { fill: var(--chart-text); font-size: 11.5px; font-family: var(--font); font-variant-numeric: tabular-nums; }
.chart .bar { fill: var(--chart-bar); transition: fill 120ms var(--ease); }
.chart .bar:hover { fill: var(--chart-bar-hover); }
.chart .bar-withheld { fill: var(--chart-muted); }
.chart .line { fill: none; stroke: var(--chart-line); stroke-width: 2.25; stroke-linejoin: round; stroke-linecap: round; }
.chart .point { fill: var(--surface); stroke: var(--chart-line); stroke-width: 2; }
.chart .point:hover { fill: var(--chart-line); }

.disclosure { margin-top: var(--s-3); }
.disclosure > summary {
  display: inline-flex;
  align-items: center;
  gap: var(--s-1);
  color: var(--primary-text);
  font-size: var(--fs-sm);
  font-weight: 550;
}
.disclosure > summary::before { content: "\25B8"; transition: transform 150ms var(--ease); }
.disclosure[open] > summary::before { transform: rotate(90deg); }
.disclosure > .table-wrap { margin-top: var(--s-2); }

.help {
  display: flex;
  align-items: flex-start;
  gap: var(--s-2);
  margin-top: var(--s-6);
  color: var(--muted);
  font-size: var(--fs-sm);
  line-height: 1.5;
}
.help > .icon { margin-top: 2px; color: var(--faint); }
.withheld {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: var(--s-3);
  font-size: var(--fs-sm);
}
.withheld-label { color: var(--muted); font-weight: 600; font-size: var(--fs-xs); }
.withheld .hint { margin-left: var(--s-1); font-size: var(--fs-xs); }

/* Empty state */
.empty-state {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s-6);
  padding: var(--s-8);
  margin-bottom: var(--s-4);
  background: var(--surface);
}
.empty-body { flex: 1 1 360px; display: flex; flex-direction: column; gap: var(--s-3); }
.empty-body h2 { font-size: var(--fs-xl); }
.empty-body > p { color: var(--text-2); max-width: 68ch; }
.illustration { width: 160px; height: auto; }
.il-card { fill: var(--surface-2); stroke: var(--border-strong); }
.il-soft { fill: var(--surface-3); }
.il-bar { fill: var(--chart-bar); }
.il-bar-ghost { fill: none; stroke: var(--chart-muted); stroke-width: 1.5; stroke-dasharray: 3 3; }
.il-accent { fill: var(--amber); }
.il-accent-mark { fill: none; stroke: #16181d; stroke-width: 1.8; stroke-linecap: round; }
.next-steps { list-style: none; display: grid; gap: var(--s-3); margin-top: var(--s-2); }
.next-steps li { display: flex; align-items: flex-start; gap: var(--s-3); }
.next-steps li > div { display: flex; flex-direction: column; gap: var(--s-1); min-width: 0; font-size: var(--fs-sm); color: var(--text-2); }
.next-steps strong { color: var(--text); font-size: var(--fs-md); }
.next-steps code { align-self: flex-start; }
.step-num {
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: var(--r-full);
  background: var(--primary-soft);
  color: var(--primary-text);
  font-size: var(--fs-xs);
  font-weight: 700;
  flex-shrink: 0;
}

/* ---------------------------------------------------------------
   12. Settings layout (Manage, Account)
   --------------------------------------------------------------- */
.settings { display: flex; flex-direction: column; }
.settings-section {
  display: grid;
  grid-template-columns: minmax(0, 280px) minmax(0, 1fr);
  gap: var(--s-4) var(--s-8);
  padding: var(--s-8) 0;
  border-top: 1px solid var(--border);
}
.settings-section:first-child { border-top: 0; padding-top: 0; }
.settings-section > :not(.settings-intro) { grid-column: 2; }
.settings-section > .card + .card { margin-top: 0; }
.settings-intro { grid-column: 1; grid-row: 1 / span 3; }
.settings-intro h2 { font-size: var(--fs-lg); margin-bottom: var(--s-2); }
.settings-intro p { color: var(--muted); font-size: var(--fs-sm); line-height: 1.5; }
.danger-zone { border-color: var(--danger-border); }
.danger-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s-3); }
.danger-row h3 { margin-bottom: 2px; }
.status-line { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2); color: var(--text-2); }
.connected { display: flex; align-items: center; gap: var(--s-2); }

/* Confirm popovers on <details>: the second step of a destructive action */
.confirm-pop { display: inline-block; text-align: left; }
.confirm-pop > summary.btn { box-shadow: none; }
.confirm-pop[open] > summary { background: var(--danger-soft); border-color: var(--danger); }
.pop {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  z-index: 15;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--s-3);
  width: 280px;
  padding: var(--s-4);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  white-space: normal;
  font-size: var(--fs-sm);
  color: var(--text-2);
}

/* ---------------------------------------------------------------
   13. Billing
   --------------------------------------------------------------- */
.billing-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(260px, 1fr); gap: var(--s-4); align-items: start; }
.billing-grid > .card + .card { margin-top: 0; }
.plan-card { display: flex; flex-direction: column; gap: var(--s-4); padding: var(--s-6); }
.plan-top { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--s-3); }
.plan-name { font-size: var(--fs-xl); margin-top: 2px; }
.plan-card .card-foot { margin-top: var(--s-1); }
.plan-fact { display: flex; flex-direction: column; gap: var(--s-1); padding: var(--s-4); border-radius: var(--r-md); background: var(--surface-2); border: 1px solid var(--border); }
.seats { color: var(--muted); font-size: var(--fs-sm); font-weight: 550; }
.seats strong { display: block; margin-top: 2px; color: var(--text); font-size: var(--fs-3xl); font-weight: 650; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; line-height: 1.15; }
.progress-block { display: flex; flex-direction: column; gap: 6px; }
.progress-labels { display: flex; justify-content: space-between; color: var(--muted); font-size: var(--fs-xs); font-variant-numeric: tabular-nums; }
progress.progress {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 8px;
  border: 0;
  border-radius: var(--r-full);
  background: var(--surface-3);
  color: var(--primary-line);
  overflow: hidden;
}
progress.progress::-webkit-progress-bar { background: var(--surface-3); border-radius: var(--r-full); }
progress.progress::-webkit-progress-value { background: var(--primary-line); border-radius: var(--r-full); }
progress.progress::-moz-progress-bar { background: var(--primary-line); border-radius: var(--r-full); }
.side-card .checklist { margin-top: 0; }

.checklist { list-style: none; display: flex; flex-direction: column; gap: var(--s-3); margin: var(--s-3) 0; }
.checklist li { display: flex; align-items: flex-start; gap: var(--s-2); color: var(--text-2); font-size: var(--fs-sm); }
.checklist .icon { color: var(--success); margin-top: 1px; }
.field-list { margin: var(--s-2) 0 var(--s-3) var(--s-5); display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 2px var(--s-4); color: var(--text-2); font-size: var(--fs-sm); }

/* ---------------------------------------------------------------
   14. Auth layout (split: brand panel + card)
   --------------------------------------------------------------- */
.auth-layout {
  display: grid;
  grid-template-columns: minmax(360px, 5fr) 7fr;
  min-height: 100vh;
}
.auth-brand {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: var(--s-10);
  padding: var(--s-10) var(--s-12);
  background: var(--brand-bg);
  color: var(--brand-text);
  overflow: hidden;
}
.auth-brand::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
  background-size: 32px 32px;
  mask-image: radial-gradient(ellipse at 30% 30%, #000 0%, transparent 70%);
  -webkit-mask-image: radial-gradient(ellipse at 30% 30%, #000 0%, transparent 70%);
  pointer-events: none;
}
.auth-brand > * { position: relative; z-index: 1; }
.brand-on-ink { color: #ffffff; }
.brand-on-ink .brand-sub { color: var(--brand-muted); }
.auth-pitch { margin: auto 0; display: flex; flex-direction: column; gap: var(--s-6); max-width: 440px; }
.auth-pitch .eyebrow { color: var(--brand-accent); }
.promise { font-size: var(--fs-3xl); line-height: 1.25; font-weight: 600; letter-spacing: -0.02em; color: #ffffff; }
.benefits { list-style: none; display: flex; flex-direction: column; gap: var(--s-4); }
.benefits li { display: flex; align-items: flex-start; gap: var(--s-3); color: var(--brand-muted); font-size: var(--fs-md); line-height: 1.5; }
.benefits strong { color: var(--brand-text); }
.benefits .icon-check { color: var(--brand-accent); margin-top: 1px; }
.auth-foot { color: var(--brand-muted); font-size: var(--fs-xs); }

.auth-main {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--s-4);
  padding: var(--s-12) var(--s-6);
}
.auth-main:focus { outline: none; }
.auth-card {
  width: 100%;
  max-width: 420px;
  display: flex;
  flex-direction: column;
  gap: var(--s-4);
  padding: var(--s-8);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  background: var(--surface);
  box-shadow: var(--shadow-md);
}
.main .auth-card { margin: var(--s-8) auto; }
.auth-card-wide { max-width: 640px; }
.auth-card-quiet { background: var(--surface-2); box-shadow: none; padding: var(--s-6) var(--s-8); gap: var(--s-3); }
.auth-card-quiet .card-title { margin: var(--s-2) 0 0; }
.auth-card-quiet .card-title:first-child { margin-top: 0; }
.auth-head { display: flex; flex-direction: column; gap: var(--s-2); }
.auth-head h1 { font-size: var(--fs-2xl); }
.auth-alt { color: var(--muted); font-size: var(--fs-sm); text-align: center; }
.auth-alt a { font-weight: 550; }
.auth-icon {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: var(--r-lg);
  background: var(--primary-soft);
  color: var(--primary-text);
}
.auth-icon .icon { width: 22px; height: 22px; }
.auth-icon-ok { background: var(--success-soft); color: var(--success); }
.auth-icon-warn { background: var(--warn-soft); color: var(--warn); }
.divider {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  color: var(--faint);
  font-size: var(--fs-xs);
}
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.steps { list-style: none; counter-reset: step; display: flex; flex-direction: column; gap: var(--s-5); }
.step { counter-increment: step; position: relative; padding-left: 40px; display: flex; flex-direction: column; gap: var(--s-2); }
.step::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: -2px;
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: var(--r-full);
  background: var(--primary-soft);
  color: var(--primary-text);
  font-size: var(--fs-xs);
  font-weight: 700;
}
.step h2 { font-size: var(--fs-md); }

/* ---------------------------------------------------------------
   15. Responsive
   --------------------------------------------------------------- */
@media (max-width: 1000px) {
  .settings-section { grid-template-columns: minmax(0, 1fr); gap: var(--s-4); padding: var(--s-6) 0; }
  .settings-section > :not(.settings-intro), .settings-intro { grid-column: 1; grid-row: auto; }
  .billing-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 900px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar { display: none; }
  .topbar { padding: 0 var(--s-4); gap: var(--s-2); }
  .brand-compact { display: inline-flex; font-size: var(--fs-md); }
  .brand-compact .logo, .brand-compact .logo img { height: 18px; }
  .crumbs { display: none; }
  .mobile-nav { display: block; }
  .mobile-nav > summary {
    display: inline-grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border-radius: var(--r-md);
    color: var(--text-2);
  }
  .mobile-nav > summary:hover, .mobile-nav[open] > summary { background: var(--surface-3); }
  .mobile-nav-panel {
    position: fixed;
    left: var(--s-3);
    right: var(--s-3);
    top: calc(var(--topbar-h) + 6px);
    z-index: 40;
    display: flex;
    flex-direction: column;
    gap: var(--s-3);
    max-height: calc(100vh - var(--topbar-h) - 24px);
    overflow-y: auto;
    padding: var(--s-3);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    background: var(--surface);
    box-shadow: var(--shadow-lg);
  }
  .user-name, .user-menu .chevron { display: none; }
  .user-menu > summary { padding: 0 3px; }
  .main { padding: var(--s-6) var(--s-4) var(--s-10); }
  .app-footer { padding: var(--s-4) var(--s-4) var(--s-6); }
  .auth-layout { grid-template-columns: minmax(0, 1fr); }
  .auth-brand { padding: var(--s-6) var(--s-4); gap: var(--s-4); }
  .auth-pitch { margin: 0; gap: var(--s-3); }
  .promise { font-size: var(--fs-lg); }
  .benefits, .auth-foot, .auth-pitch .eyebrow { display: none; }
  .auth-main { justify-content: flex-start; padding: var(--s-6) var(--s-4) var(--s-10); }
  .auth-card { padding: var(--s-6) var(--s-5); }
}
@media (max-width: 560px) {
  .plan-badge { max-width: 150px; overflow: hidden; text-overflow: ellipsis; }
  .page-head { align-items: flex-start; }
  .toolbar .field { max-width: none; flex-basis: calc(50% - var(--s-3)); }
  .toolbar .btn { width: 100%; margin-left: 0; }
  .empty-state { padding: var(--s-5); }
  .illustration { width: 120px; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi-value { font-size: var(--fs-2xl); }
  .pop { width: min(280px, calc(100vw - 32px)); }
}

/* ---------------------------------------------------------------
   16. Motion and print
   --------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
  }
}
@media print {
  .sidebar, .topbar, .toolbar, .app-footer, .skip-link, .confirm-pop { display: none !important; }
  .shell { display: block; }
  body, body.is-app { background: #fff; color: #000; }
  .card, .kpi, .table-wrap { box-shadow: none; }
}

/* Boundaries and approvals (ADR 0014). */
textarea.rules {
  width: 100%;
  min-height: 260px;
  padding: var(--s-3);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-md);
  background: var(--surface);
  color: var(--text);
  font-family: var(--mono);
  font-size: var(--fs-sm);
  line-height: 1.5;
  box-shadow: var(--shadow-xs);
  resize: vertical;
}
textarea.rules:focus, textarea.rules:focus-visible { outline: none; border-color: var(--primary-line); box-shadow: var(--ring); }
.rule-when { font-family: var(--mono); font-size: var(--fs-sm); }
.approval { display: grid; gap: var(--s-2); padding: var(--s-4) 0; }
.approval + .approval { border-top: 1px solid var(--border); }
.approval-head { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2); }
.approval-figures { margin: 0; padding-left: var(--s-5); color: var(--muted); font-size: var(--fs-sm); }
.approval-actions { display: flex; flex-wrap: wrap; gap: var(--s-2); }
.approval-actions form { margin: 0; }
