/* DAASS design system v3 — pure white canvas, indigo, cool grays (brief "Design bar v2", docs/DESIGN_SPECS.md §0–§3).
   Tokens, base and every shared component. The app shell, sign-in and error pages live in app.css; full-screen
   editors and focus flows in their layouts (layouts/editor.html, layouts/focus.html); the website in site.css.
   /styleguide (staff) renders every component and state and is the reference for the wave.

   Class names, data attributes and CSS variables here are a public API used by every portal: refine and add,
   never rename or remove. There is no dark theme. 8 px grid (4 px half-steps); 13–14 px interface text; tabular
   numbers; one control height (32 px). */

:root {
  /* brand — the logo and the website; in portals gold appears only in the logo (AG-18) */
  --navy-950: #061426;
  --navy-900: #0A2540;
  --navy-800: #13345A;
  --navy-700: #1F4A7A;
  --navy-50: #EEF3F9;
  --gold-600: #B08D3C;
  --gold-700: #8C6B2A;
  --gold-100: #FBF6EA;
  --gold-200: #F4E9CF;
  --gold-300: #E9D7AC;
  --gold-400: #D4B878;
  --ink: #0A2540;
  --cream-50: #FAF8F3;
  --cream-100: #F6F2E8;
  --cream-200: #ECE6D8;

  /* neutrals — cool, calibrated to sit next to indigo */
  --white: #FFFFFF;
  --gray-25: #FBFBFC;
  --gray-50: #F8F9FA;
  --gray-75: #F4F5F7;
  --gray-100: #EEF0F3;
  --gray-150: #E9EBEE;
  --gray-200: #E3E5E9;
  --gray-300: #D1D5DB;
  --gray-400: #9BA1AC;
  --gray-500: #6B7180;
  --gray-600: #4E5462;
  --gray-700: #383D49;
  --gray-800: #22262F;
  --gray-900: #111318;

  /* indigo — the portals' colour (owner's choice, 2026-09-24) */
  --indigo-25: #F7F7FF;
  --indigo-50: #EEF2FF;
  --indigo-100: #E0E7FF;
  --indigo-200: #C7D2FE;
  --indigo-300: #A5B4FC;
  --indigo-400: #818CF8;
  --indigo-500: #6366F1;
  --indigo-600: #4F46E5;
  --indigo-700: #4338CA;
  --indigo-800: #3730A3;
  --indigo-900: #312E81;

  --font-sans: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: "Cormorant Garamond", Georgia, "Times New Roman", serif;
  --font-hebrew: "Frank Ruhl Libre", "David Libre", "Times New Roman", serif;
  --font-mono: ui-monospace, "SFMono-Regular", "Cascadia Code", Menlo, Consolas, monospace;

  /* purpose */
  --bg: #FFFFFF;
  --surface: #FFFFFF;
  --surface-2: var(--gray-50);
  --surface-3: var(--gray-75);
  --hover: var(--gray-75);
  --pressed: var(--gray-100);
  --selected: var(--indigo-50);
  --border: var(--gray-200);
  --border-subtle: var(--gray-150);
  --border-strong: var(--gray-300);
  --text: var(--gray-900);
  --text-2: var(--gray-700);
  --text-3: var(--gray-500);
  --text-4: var(--gray-400);
  --primary: var(--indigo-600);
  --primary-hover: var(--indigo-700);
  --primary-active: var(--indigo-800);
  --primary-soft: var(--indigo-50);
  --primary-text: var(--indigo-700);
  --primary-contrast: #FFFFFF;
  --accent: var(--indigo-600);
  --accent-hover: var(--indigo-700);
  --accent-text: var(--indigo-700);
  --accent-soft: rgba(79, 70, 229, .07);
  --accent-soft-2: rgba(79, 70, 229, .13);
  --link: var(--indigo-600);
  /* focus: fields show an indigo border + a soft halo (--focus-ring); everything else a solid 2 px indigo ring with
     a 2 px white gap (--focus-ring-strong, 3:1 against white and grey surfaces) */
  --focus: var(--indigo-500);
  --focus-ring: 0 0 0 3px rgba(79, 70, 229, .2);
  --focus-ring-strong: 0 0 0 2px var(--surface), 0 0 0 4px var(--indigo-500);
  --focus-ring-danger: 0 0 0 3px rgba(217, 45, 32, .16);
  --focus-ring-danger-strong: 0 0 0 2px var(--surface), 0 0 0 4px var(--danger-fill);
  --backdrop: rgba(17, 19, 24, .38);

  /* status — for status only */
  --success: #067647;
  --success-text: #05603A;
  --success-fill: #12B76A;
  --success-bg: #ECFDF3;
  --success-border: #ABEFC6;
  --warning: #93370D;
  --warning-text: #7A2E0E;
  --warning-fill: #F79009;
  --warning-bg: #FFFAEB;
  --warning-border: #FEDF89;
  --danger: #B42318;
  --danger-text: #912018;
  --danger-fill: #D92D20;
  --danger-bg: #FEF3F2;
  --danger-border: #FECDCA;
  --info: #175CD3;
  --info-text: #1849A9;
  --info-fill: #2E90FA;
  --info-bg: #EFF8FF;
  --info-border: #B2DDFF;

  /* depth: hairlines first; shadow-xs on resting cards, md on hover of clickable cards, lg on overlays (AG-29) */
  --shadow-xs: 0 1px 2px rgba(17, 19, 24, .05);
  --shadow-sm: 0 1px 2px rgba(17, 19, 24, .06), 0 1px 3px rgba(17, 19, 24, .05);
  --shadow-md: 0 4px 12px -2px rgba(17, 19, 24, .08), 0 2px 4px -2px rgba(17, 19, 24, .05);
  --shadow-lg: 0 16px 40px -10px rgba(17, 19, 24, .18), 0 4px 10px -4px rgba(17, 19, 24, .07), 0 0 0 1px rgba(17, 19, 24, .06);
  --shadow-pop: var(--shadow-lg);
  --shadow-xl: 0 24px 64px -12px rgba(17, 19, 24, .28), 0 8px 16px -8px rgba(17, 19, 24, .1), 0 0 0 1px rgba(17, 19, 24, .06);
  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius: 8px;
  --radius-lg: 10px;
  --radius-xl: 12px;
  --radius-2xl: 16px;
  --radius-pill: 999px;

  /* the 8 px grid and one control height (F-1) */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;
  --space-16: 64px;
  --h-xs: 24px;
  --h-sm: 28px;
  --h-md: 32px;
  --h-lg: 40px;

  --ease: cubic-bezier(.2, .7, .2, 1);
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --t-fast: 120ms;
  --t: 200ms;
  --t-slow: 240ms;

  /* stacking: page < sticky heads < sidebar < menus < drawers < modals < command palette < toasts < tooltips */
  --z-sticky: 20;
  --z-topbar: 30;
  --z-sidebar: 40;
  --z-menu: 60;
  --z-drawer: 90;
  --z-palette: 150;
  --z-toast: 200;
  --z-tooltip: 400;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "cv11", "ss01", "ss03";
  text-rendering: optimizeLegibility;
}
img, svg, video { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
a.link, .prose a { color: var(--link); text-decoration: none; }
a.link:hover, .prose a:hover { color: var(--accent-hover); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
/* A solid ring on everything focused from the keyboard (components declared later keep their own radius). */
:focus-visible { outline: none; box-shadow: var(--focus-ring-strong); border-radius: 6px; }
a.link:focus-visible, .prose a:focus-visible, .btn-link:focus-visible { border-radius: 3px; }
::selection { background: rgba(79, 70, 229, .16); }
/* quiet scrollbars inside panels (the page itself keeps the system scrollbar) */
.menu, .popover, .modal-body, .drawer-body, .table-wrap, .table-scroll, .code-view pre, .split-rail, .split-list, .split-detail, .split-context, .combobox > .menu { scrollbar-width: thin; scrollbar-color: var(--gray-300) transparent; }
hr { border: 0; border-top: 1px solid var(--border); margin: 24px 0; }
[hidden] { display: none !important; }
[dir="rtl"], .rtl { font-family: var(--font-hebrew); direction: rtl; }
.sr-only { position: absolute !important; width: 1px !important; height: 1px !important; min-height: 0 !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip: rect(0, 0, 0, 0) !important; white-space: nowrap !important; border: 0 !important; }

/* ------------------------------------------------------------------ typography (§2.1) */
h1, h2, h3, h4 { margin: 0; line-height: 1.3; color: var(--text); font-weight: 650; letter-spacing: -.011em; }
h1 { font-size: 20px; line-height: 28px; letter-spacing: -.015em; } h2 { font-size: 15px; line-height: 22px; font-weight: 600; } h3 { font-size: 14px; font-weight: 600; } h4 { font-size: 13.5px; font-weight: 600; }
.display, h1.display { font-family: var(--font-display); font-weight: 600; letter-spacing: -.01em; }
.serif { font-family: var(--font-display); }
.eyebrow { display: inline-flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 550; color: var(--text-3); }
.eyebrow-rule::before { content: ""; width: 14px; height: 2px; border-radius: 2px; background: var(--gold-600); }
.muted { color: var(--text-3); }
.text-2 { color: var(--text-2); }
.text-3 { color: var(--text-3); }
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-primary { color: var(--primary-text); }
.small { font-size: 13px; }
.tiny { font-size: 12px; }
.tnum { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--font-mono); font-size: .9em; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nowrap { white-space: nowrap; }
.center { text-align: center; }
.right { text-align: right; }
.fw-400 { font-weight: 400; }
.fw-500 { font-weight: 500; }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }
.lede { font-size: 15px; color: var(--text-2); }
.prose { font-size: 14.5px; line-height: 1.7; color: var(--text-2); max-width: 68ch; }
.prose h2, .prose h3 { color: var(--text); margin: 1.4em 0 .5em; }
.prose p { margin: 0 0 1em; }
.prose ul, .prose ol { padding-left: 1.3em; margin: 0 0 1em; }
.prose img { border-radius: 10px; margin: 1em 0; }
.prose blockquote { margin: 1.2em 0; padding: 2px 0 2px 16px; border-left: 3px solid var(--border-strong); color: var(--text-2); }

.icon { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon-xs { width: 12px; height: 12px; }
.icon-sm { width: 14px; height: 14px; }
.icon-lg { width: 20px; height: 20px; }
.icon-xl { width: 26px; height: 26px; }

/* ------------------------------------------------------------------ layout helpers */
.stack { display: flex; flex-direction: column; gap: 16px; }
.stack-xs { display: flex; flex-direction: column; gap: 4px; }
.stack-sm { display: flex; flex-direction: column; gap: 8px; }
.stack-lg { display: flex; flex-direction: column; gap: 24px; }
.stack-xl { display: flex; flex-direction: column; gap: 32px; }
.row { display: flex; align-items: center; gap: 12px; }
.row-xs { display: flex; align-items: center; gap: 4px; }
.row-sm { display: flex; align-items: center; gap: 8px; }
.row-wrap { flex-wrap: wrap; }
.between { justify-content: space-between; }
.end { justify-content: flex-end; }
.grow { flex: 1 1 auto; min-width: 0; }
.inline { display: inline; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-12 { grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 16px; }
.span-4 { grid-column: span 4; } .span-6 { grid-column: span 6; } .span-8 { grid-column: span 8; } .span-12 { grid-column: 1 / -1; }
.grid-main-side { grid-template-columns: minmax(0, 1fr) 320px; align-items: start; }
.grid-side-main { grid-template-columns: 300px minmax(0, 1fr); align-items: start; }
.grid > *, .stack > *, .stack-lg > *, .stack-sm > *, .stack-xl > * { min-width: 0; }
.mt-0 { margin-top: 0; } .mt-1 { margin-top: 4px; } .mt-2 { margin-top: 8px; } .mt-3 { margin-top: 12px; } .mt-4 { margin-top: 16px; } .mt-6 { margin-top: 24px; } .mt-8 { margin-top: 32px; } .mt-12 { margin-top: 48px; }
.mb-0 { margin-bottom: 0; } .mb-1 { margin-bottom: 4px; } .mb-2 { margin-bottom: 8px; } .mb-3 { margin-bottom: 12px; } .mb-4 { margin-bottom: 16px; } .mb-6 { margin-bottom: 24px; } .mb-8 { margin-bottom: 32px; }
.ml-auto { margin-left: auto; }
.w-full { width: 100%; }
.divider { height: 1px; background: var(--border); border: 0; margin: 16px 0; }
.divider-v { width: 1px; align-self: stretch; background: var(--border); flex: none; }
@media (max-width: 1100px) { .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid-main-side, .grid-side-main { grid-template-columns: 1fr; } .span-4, .span-6, .span-8 { grid-column: 1 / -1; } }
@media (max-width: 760px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; } }

/* ------------------------------------------------------------------ C-button (F-1: 32 / 28 / 40 px)
   .btn (secondary) · .btn-primary (one per view, P-2) · .btn-ghost · .btn-danger (the primary of a destructive
   confirm only) · .btn-danger-ghost · .btn-link · sizes .btn-xs .btn-sm .btn-lg · .btn-icon · .btn-block ·
   .is-loading / aria-busy · .btn-group (split button) · a <kbd> inside names the shortcut.
   .btn-gold, .btn-outline-gold, .btn-accent, .btn-pill are website-only. */
.btn {
  --btn-bg: var(--surface); --btn-fg: var(--text); --btn-border: var(--border-strong); --btn-hover: var(--gray-50);
  --btn-hover-border: var(--gray-400); --btn-icon: var(--text-3); --btn-shadow: 0 1px 2px rgba(17, 19, 24, .05);
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: var(--h-md); padding: 0 12px; border-radius: var(--radius); border: 1px solid var(--btn-border);
  background: var(--btn-bg); color: var(--btn-fg); font-size: 13.5px; font-weight: 600; line-height: 1;
  letter-spacing: -.005em; white-space: nowrap; box-shadow: var(--btn-shadow); text-decoration: none; user-select: none;
  transition: background-color var(--t-fast), border-color var(--t-fast), color var(--t-fast), box-shadow var(--t-fast);
}
.btn:hover { background: var(--btn-hover); border-color: var(--btn-hover-border); color: var(--btn-fg); text-decoration: none; }
.btn:active { transform: translateY(.5px); }
.btn:focus-visible { box-shadow: var(--btn-shadow), var(--focus-ring-strong); border-radius: var(--radius); }
.btn-sm:focus-visible { border-radius: 7px; } .btn-xs:focus-visible { border-radius: 6px; } .btn-pill:focus-visible { border-radius: var(--radius-pill); }
.btn .badge-count, .btn .count { height: 18px; min-width: 18px; padding: 0 5px; margin-right: -4px; border-radius: 999px; display: inline-grid; place-items: center; font-size: 11px; font-weight: 600; font-variant-numeric: tabular-nums; background: var(--gray-100); color: var(--text-2); }
.btn-primary .badge-count, .btn-primary .count { background: rgba(255, 255, 255, .22); color: #fff; }
.btn[disabled], .btn.is-disabled, .btn[aria-disabled="true"] { opacity: .5; pointer-events: none; box-shadow: none; }
.btn .icon { width: 16px; height: 16px; color: var(--btn-icon); transition: color var(--t-fast); }
.btn:hover .icon { color: var(--btn-fg); }
.btn kbd { margin-left: 2px; margin-right: -4px; height: 18px; min-width: 18px; background: transparent; box-shadow: none; }
.btn-primary {
  --btn-bg: var(--primary); --btn-fg: #fff; --btn-border: var(--primary); --btn-hover: var(--primary-hover);
  --btn-hover-border: var(--primary-hover); --btn-icon: rgba(255, 255, 255, .9);
  --btn-shadow: 0 1px 2px rgba(49, 46, 129, .24), inset 0 1px 0 rgba(255, 255, 255, .1);
}
.btn-primary:active { --btn-bg: var(--primary-active); }
.btn-primary kbd { color: rgba(255, 255, 255, .85); border-color: rgba(255, 255, 255, .3); }
.btn-secondary { --btn-bg: var(--surface); }
.btn-accent { --btn-bg: var(--accent); --btn-fg: #fff; --btn-border: var(--accent); --btn-hover: var(--accent-hover); --btn-hover-border: var(--accent-hover); --btn-icon: #fff; }
.btn-gold { --btn-bg: var(--gold-100); --btn-fg: var(--gold-700); --btn-border: var(--gold-300); --btn-hover: var(--gold-200); --btn-hover-border: var(--gold-400); --btn-icon: var(--gold-700); }
.btn-outline-gold { --btn-bg: transparent; --btn-fg: var(--gold-700); --btn-border: var(--gold-400); --btn-hover: var(--gold-100); --btn-icon: var(--gold-700); --btn-shadow: none; }
.btn-ghost { --btn-bg: transparent; --btn-border: transparent; --btn-hover: var(--hover); --btn-hover-border: transparent; --btn-fg: var(--text-2); --btn-shadow: none; }
.btn-ghost:hover { color: var(--text); }
.btn-danger { --btn-bg: var(--danger-fill); --btn-fg: #fff; --btn-border: var(--danger-fill); --btn-hover: var(--danger); --btn-hover-border: var(--danger); --btn-icon: #fff; --btn-shadow: 0 1px 2px rgba(145, 32, 24, .22), inset 0 1px 0 rgba(255, 255, 255, .1); }
.btn-danger:focus-visible, .btn-danger-ghost:focus-visible { box-shadow: var(--focus-ring-danger-strong); }
.btn-danger-ghost { --btn-bg: transparent; --btn-fg: var(--danger); --btn-border: transparent; --btn-hover: var(--danger-bg); --btn-hover-border: transparent; --btn-icon: var(--danger); --btn-shadow: none; }
.btn-link { --btn-bg: transparent; --btn-border: transparent; --btn-hover: transparent; --btn-hover-border: transparent; --btn-fg: var(--link); --btn-icon: var(--link); --btn-shadow: none; height: auto; padding: 0; font-weight: 550; }
.btn-link:hover { color: var(--accent-hover); text-decoration: underline; text-underline-offset: 3px; }
.btn-pill { border-radius: var(--radius-pill); }
.btn-xs { height: var(--h-xs); padding: 0 8px; font-size: 12px; border-radius: 6px; gap: 4px; }
.btn-xs .icon { width: 14px; height: 14px; }
.btn-sm { height: var(--h-sm); padding: 0 10px; font-size: 13px; border-radius: 7px; gap: 6px; }
.btn-sm .icon { width: 14px; height: 14px; }
.btn-lg { height: var(--h-lg); padding: 0 16px; font-size: 14px; border-radius: 8px; }
.btn-block { width: 100%; }
.btn-icon { width: var(--h-md); padding: 0; }
.btn-icon.btn-sm { width: var(--h-sm); }
.btn-icon.btn-xs { width: var(--h-xs); }
.btn-icon.btn-lg { width: var(--h-lg); }
.btn.is-loading, .btn[aria-busy="true"] { color: transparent !important; pointer-events: none; }
.btn.is-loading .icon, .btn[aria-busy="true"] .icon, .btn.is-loading kbd, .btn[aria-busy="true"] kbd { visibility: hidden; }
.btn.is-loading::after, .btn[aria-busy="true"]::after { content: ""; position: absolute; left: calc(50% - 7px); top: calc(50% - 7px); width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--btn-fg); border-right-color: transparent; animation: spin .6s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.spinner { display: inline-block; width: 14px; height: 14px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin .6s linear infinite; vertical-align: -2px; opacity: .7; }
.btn-group { display: inline-flex; isolation: isolate; border-radius: var(--radius); box-shadow: 0 1px 2px rgba(17, 19, 24, .05); }
.btn-group > .btn { border-radius: 0; margin-left: -1px; box-shadow: none; }
.btn-group > .btn:hover, .btn-group > .btn:focus-visible { z-index: 1; }
.btn-group > .btn:first-child { border-radius: var(--radius) 0 0 var(--radius); margin-left: 0; }
.btn-group > .btn:last-child { border-radius: 0 var(--radius) var(--radius) 0; }
.btn-group > .btn-primary + .btn-primary { border-left-color: rgba(255, 255, 255, .28); }
.btn-group > .btn.active, .btn-group > .btn[aria-pressed="true"] { background: var(--gray-75); color: var(--text); }
.btn-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* ------------------------------------------------------------------ C-field (F-1: 32 px, 14 px text, 10 px padding)
   .field > .label + control + .help | .field-error · .input-group (leading .icon, trailing .input-suffix or
   .input-action) · .input-affix (.affix: $, daass.me/, %) · .form-grid (pairs only) · .form-section (240 px intro)
   · native checkboxes and radios are styled everywhere · .check · .check-card · .switch · .segmented */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.fields { display: flex; flex-direction: column; gap: 20px; }
.label { font-size: 13px; font-weight: 600; color: var(--text); line-height: 18px; }
.label .opt, .opt { font-weight: 400; color: var(--text-3); }
.label-row { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.help { font-size: 12.5px; color: var(--text-3); line-height: 18px; }
.field-error { display: flex; align-items: flex-start; gap: 6px; font-size: 12.5px; color: var(--danger); font-weight: 500; line-height: 18px; }
.field-error .icon { width: 14px; height: 14px; margin-top: 2px; }
.field.has-error .help { display: none; }
.input, .select, .textarea {
  width: 100%; min-height: var(--h-md); padding: 5px 10px; border-radius: var(--radius); border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text); font-size: 14px; line-height: 20px; box-shadow: var(--shadow-xs);
  transition: border-color var(--t-fast), box-shadow var(--t-fast), background-color var(--t-fast);
}
.input::placeholder, .textarea::placeholder { color: var(--text-4); opacity: 1; }
.input:hover, .select:hover, .textarea:hover { border-color: var(--gray-400); }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--indigo-500); box-shadow: var(--focus-ring); }
.input.is-invalid, .select.is-invalid, .textarea.is-invalid, .field.has-error .input, .field.has-error .select, .field.has-error .textarea, .input[aria-invalid="true"] { border-color: var(--danger-fill); }
.input.is-invalid:focus, .field.has-error .input:focus, .input[aria-invalid="true"]:focus { box-shadow: var(--focus-ring-danger); }
.input[readonly] { background: var(--gray-50); }
.input:disabled, .select:disabled, .textarea:disabled { background: var(--gray-50); color: var(--text-3); border-color: var(--border); box-shadow: none; cursor: not-allowed; }
.input-sm { min-height: var(--h-sm); padding: 3px 8px; font-size: 13px; }
.input-lg { min-height: var(--h-lg); padding: 9px 12px; font-size: 14px; }
.textarea { min-height: 96px; resize: vertical; line-height: 1.55; padding: 7px 10px; }
.select { appearance: none; -webkit-appearance: none; padding-right: 32px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236B7180' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m7 10 5 5 5-5'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 8px center; cursor: pointer; }
.select[multiple] { background-image: none; padding-right: 10px; }
.input-group { position: relative; display: flex; align-items: center; }
.input-group > .icon { position: absolute; left: 10px; color: var(--text-4); pointer-events: none; z-index: 1; }
.input-group > .input { padding-left: 32px; }
.input-group > .input:first-child { padding-left: 10px; }
.input-group > .input-lg { padding-left: 34px; }
.input-group > .input-lg:first-child { padding-left: 12px; }
.input-group > .input-action { position: absolute; right: 3px; }
.input-group > .input-suffix { position: absolute; right: 10px; color: var(--text-4); font-size: 13px; pointer-events: none; display: inline-flex; align-items: center; gap: 4px; }
.input-group:has(> .input-suffix) > .input, .input-group:has(> .input-action) > .input, .input-group:has(> .reveal-btn) > .input, .input-group:has(> kbd) > .input { padding-right: 38px; }
.input-group:focus-within > .icon { color: var(--text-3); }
.input-group > kbd { position: absolute; right: 8px; pointer-events: none; }
.input-affix { display: flex; align-items: stretch; }
.input-affix > .affix { display: inline-flex; align-items: center; padding: 0 10px; border: 1px solid var(--border-strong); background: var(--gray-50); color: var(--text-3); font-size: 13.5px; white-space: nowrap; }
.input-affix > .affix:first-child { border-right: 0; border-radius: var(--radius) 0 0 var(--radius); }
.input-affix > .affix:last-child { border-left: 0; border-radius: 0 var(--radius) var(--radius) 0; }
.input-affix > .input:not(:first-child) { border-top-left-radius: 0; border-bottom-left-radius: 0; }
.input-affix > .input:not(:last-child) { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.w-code { max-width: 160px; } .w-name { max-width: 320px; } .w-email { max-width: 400px; } .w-num { max-width: 120px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px 16px; }
.form-grid .span-2 { grid-column: 1 / -1; }
.form-section { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 16px 40px; padding: 32px 0; border-top: 1px solid var(--border); }
.form-section:first-child, .form-section.is-first { border-top: 0; padding-top: 0; }
.form-section > .intro h2, .form-section > .intro h3 { font-size: 14px; font-weight: 600; line-height: 20px; }
.form-section > .intro p { margin: 4px 0 0; font-size: 13px; color: var(--text-3); line-height: 18px; }
.form-section > .body, .form-section > .fields { min-width: 0; display: flex; flex-direction: column; gap: 20px; }
.form-actions { display: flex; justify-content: flex-end; align-items: center; gap: 8px; padding-top: 20px; border-top: 1px solid var(--border); }
@media (max-width: 900px) { .form-section { grid-template-columns: 1fr; gap: 12px; padding: 24px 0; } }
@media (max-width: 700px) { .form-grid { grid-template-columns: 1fr; } }

input[type="checkbox"], input[type="radio"] {
  appearance: none; -webkit-appearance: none; margin: 0; flex: none; width: 16px; height: 16px; display: inline-grid;
  place-content: center; vertical-align: -3px; border: 1px solid var(--gray-300); background: var(--surface) no-repeat center / 12px;
  border-radius: 4px; box-shadow: var(--shadow-xs); cursor: pointer;
  transition: background-color var(--t-fast), border-color var(--t-fast), box-shadow var(--t-fast);
}
input[type="radio"] { border-radius: 50%; }
input[type="checkbox"]:hover, input[type="radio"]:hover { border-color: var(--gray-400); }
input[type="checkbox"]:checked, input[type="checkbox"]:indeterminate { background-color: var(--primary); border-color: var(--primary); }
input[type="checkbox"]:checked { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='white' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3.8 8.4 6.6 11.2 12.2 5.2'/%3E%3C/svg%3E"); }
input[type="checkbox"]:indeterminate { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='white' stroke-width='2.2' stroke-linecap='round'%3E%3Cpath d='M4.5 8h7'/%3E%3C/svg%3E"); }
input[type="radio"]:checked { border-color: var(--primary); background: radial-gradient(circle, #fff 0 3px, var(--primary) 3.5px); }
input[type="checkbox"]:focus-visible, input[type="radio"]:focus-visible { box-shadow: var(--focus-ring-strong); border-radius: 4px; }
input[type="radio"]:focus-visible { border-radius: 50%; }
input[type="checkbox"]:disabled, input[type="radio"]:disabled { opacity: .45; cursor: not-allowed; }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; cursor: pointer; line-height: 20px; }
.check input { width: 16px; height: 16px; }
.check .desc { display: block; font-size: 12.5px; color: var(--text-3); line-height: 18px; }
.check:has(.desc) { align-items: flex-start; }
.check:has(.desc) input { margin-top: 2px; }
.check-card { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); cursor: pointer; transition: border-color var(--t-fast), background var(--t-fast), box-shadow var(--t-fast); }
.check-card:hover { border-color: var(--border-strong); }
.check-card:has(input:checked) { border-color: var(--indigo-500); box-shadow: 0 0 0 1px var(--indigo-500); background: var(--indigo-50); }
.check-card input { margin-top: 2px; width: 16px; height: 16px; }
.check-card .title { font-weight: 600; font-size: 14px; line-height: 20px; }
.check-card .desc { font-size: 12.5px; color: var(--text-3); line-height: 18px; }
.check-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; }
.switch { position: relative; display: inline-flex; width: 32px; height: 18px; flex: none; cursor: pointer; vertical-align: middle; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch .track { position: absolute; inset: 0; background: var(--gray-300); border-radius: 999px; transition: background var(--t) var(--ease); }
.switch .track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(17, 19, 24, .22), 0 0 0 .5px rgba(17, 19, 24, .06); transition: transform var(--t) var(--ease-out); }
.switch:hover .track { background: var(--gray-400); }
.switch input:checked + .track { background: var(--primary); }
.switch:hover input:checked + .track { background: var(--primary-hover); }
.switch input:checked + .track::after { transform: translateX(14px); }
.switch input:focus-visible + .track { box-shadow: var(--focus-ring-strong); }
.switch input:disabled + .track { opacity: .45; cursor: not-allowed; }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.segmented { display: inline-flex; padding: 2px; border-radius: var(--radius); background: var(--gray-100); gap: 2px; max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.segmented > a, .segmented > button, .segmented > label { position: relative; display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 12px; border-radius: 6px; font-size: 13px; font-weight: 500; color: var(--text-3); border: 0; background: none; white-space: nowrap; cursor: pointer; transition: color var(--t-fast), background var(--t-fast); }
.segmented > a:hover, .segmented > button:hover, .segmented > label:hover { color: var(--text); }
.segmented > .active, .segmented > [aria-current], .segmented > [aria-pressed="true"], .segmented > [aria-selected="true"], .segmented > label:has(input:checked) { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(17, 19, 24, .08), 0 0 0 1px rgba(17, 19, 24, .05); font-weight: 550; }
.segmented .icon { width: 15px; height: 15px; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.field > .segmented, .fields > .segmented { align-self: flex-start; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.filters .input, .filters .select { width: auto; min-width: 150px; }
.filters .input-group { flex: 1; min-width: 220px; }

/* C-combobox: an input with a filtered menu (people, programs, templates …); keyboard ↑ ↓ Enter, "No matches" */
.combobox { position: relative; }
.combobox > .menu { left: 0; right: 0; top: calc(100% + 4px); max-height: 280px; overflow-y: auto; }
.combobox .menu-item .sub { display: block; font-size: 12px; color: var(--text-3); line-height: 16px; }
.combobox .menu-item[aria-selected="true"] { background: var(--hover); }
.combobox .combobox-empty { padding: 8px 10px; font-size: 13px; color: var(--text-3); }

/* ------------------------------------------------------------------ C-card (header 16 × 20, no icons: AG-3, F-11) */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-xs); min-width: 0; }
.card-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 52px; padding: 14px 20px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.card-title { font-size: 14px; font-weight: 600; line-height: 20px; margin: 0; display: flex; align-items: center; gap: 8px; color: var(--text); letter-spacing: -.006em; }
.card-title > .icon { display: none; }
.card-subtitle { font-size: 13px; color: var(--text-3); margin-top: 2px; }
.card-body { padding: 20px; }
.card-body.tight { padding: 12px 16px; }
.card-body.flush { padding: 0; }
.card-footer { padding: 12px 20px; border-top: 1px solid var(--border); background: var(--surface); border-radius: 0 0 var(--radius-lg) var(--radius-lg); display: flex; gap: 8px; justify-content: flex-end; align-items: center; }
.card-link { display: block; transition: box-shadow var(--t), border-color var(--t); }
.card-link:hover { box-shadow: var(--shadow-md); border-color: var(--border-strong); }
.section-title { font-size: 15px; font-weight: 600; line-height: 22px; margin: 0 0 12px; letter-spacing: -.01em; }
/* C-section-head: a heading for a page section without a card */
/* scoped to the app shells: the website (site.css) and the course builder (admin.css) have their own .section-head */
:where(.app, .editor, .focus-layout, .drawer, dialog) .section-head:not(.section-card > *) { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px 12px; margin: 0 0 12px; min-height: 28px; }
:where(.app, .editor, .focus-layout, .drawer, dialog) .section-head:not(.section-card > *) h2, .section-head .section-title { font-size: 15px; font-weight: 600; line-height: 22px; margin: 0; }
:where(.app, .editor, .focus-layout, .drawer, dialog) .section-head .actions { display: flex; gap: 8px; align-items: center; }
:where(.app, .editor, .focus-layout, .drawer, dialog) .section-head .meta { font-size: 13px; color: var(--text-3); font-weight: 400; margin-left: 8px; white-space: nowrap; }
.page-section + .page-section { margin-top: 32px; }
.page-section > p { margin: 0; }
.page-head + .form-section, .tabs + .form-section { border-top: 0; padding-top: 8px; }

/* ------------------------------------------------------------------ C-badge (20 px, 12 px / 550, dot for statuses) */
.badge { display: inline-flex; align-items: center; gap: 5px; height: 20px; padding: 0 7px; border-radius: 6px; font-size: 12px; font-weight: 550; line-height: 1; white-space: nowrap; background: var(--gray-100); color: var(--gray-700); border: 1px solid transparent; vertical-align: 1px; }
.badge .icon { width: 12px; height: 12px; }
.badge-dot::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }
.badge.badge-dot:not(.badge-gold):not(.badge-navy):not(.badge-indigo):not(.badge-green):not(.badge-amber):not(.badge-red):not(.badge-blue)::before { background: var(--gray-400); }
.badge-gold { background: var(--gold-100); color: var(--gold-700); }
.badge-navy, .badge-indigo { background: var(--indigo-50); color: var(--indigo-700); }
.badge-green { background: var(--success-bg); color: var(--success); }
.badge-amber { background: var(--warning-bg); color: var(--warning); }
.badge-red { background: var(--danger-bg); color: var(--danger); }
.badge-blue { background: var(--info-bg); color: var(--info); }
.badge-gray, .badge-grey { background: var(--gray-100); color: var(--gray-700); }
.badge-outline { background: transparent; border-color: var(--border-strong); }
.badge-lg { height: 24px; padding: 0 9px; font-size: 12.5px; }
.badge-pill { border-radius: 999px; }
.badge-count { min-width: 20px; justify-content: center; padding: 0 6px; border-radius: 999px; font-variant-numeric: tabular-nums; font-weight: 600; }
/* C-status-dot: 8 px dot + label for health and presence */
.status-dot { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-2); white-space: nowrap; }
.status-dot::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--gray-400); flex: none; }
.status-dot.is-live::before, .status-dot.is-good::before { background: var(--success-fill); box-shadow: 0 0 0 3px var(--success-bg); }
.status-dot.is-degraded::before, .status-dot.is-warn::before { background: var(--warning-fill); box-shadow: 0 0 0 3px var(--warning-bg); }
.status-dot.is-down::before, .status-dot.is-bad::before { background: var(--danger-fill); box-shadow: 0 0 0 3px var(--danger-bg); }
.status-dot.is-pulse::before { animation: pulse-dot 1.6s var(--ease) infinite; }
@keyframes pulse-dot { 50% { box-shadow: 0 0 0 5px transparent; } }

/* ------------------------------------------------------------------ C-table (F-5)
   .table-wrap > table.table · .table-plain (on the page, no card) · .table-compact (32 px rows) · th.col-num /
   .col-actions / .col-check · th[aria-sort] > button.th-sort · tr[data-href] (whole row opens the record) ·
   tr.is-selected · [data-p="2"] hidden < 640 px, [data-p="3"] hidden < 1024 px · td.bar-cell · tfoot totals */
.table-wrap { position: relative; width: 100%; overflow-x: auto; }
.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; line-height: 20px; }
.table th { height: 36px; padding: 0 12px; text-align: left; font-size: 12px; font-weight: 500; color: var(--text-3); background: transparent; border-bottom: 1px solid var(--border); white-space: nowrap; vertical-align: middle; }
.table td { padding: 10px 12px; border-bottom: 1px solid var(--border-subtle); vertical-align: middle; color: var(--text); }
.table th:first-child, .table td:first-child { padding-left: 20px; }
.table th:last-child, .table td:last-child { padding-right: 20px; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background var(--t-fast); }
.table tbody tr:hover { background: var(--hover); }
.table tbody tr[data-href], .table tbody tr[data-peek], .table tbody tr.row-link { cursor: pointer; }
.table tbody tr.is-focused { background: var(--hover); box-shadow: inset 2px 0 0 var(--primary); }
.table .cell-title { font-weight: 550; color: var(--text); }
.table .cell-sub { font-size: 12.5px; line-height: 18px; color: var(--text-3); }
.table th.col-num, .table .col-num, .table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.table .col-actions { width: 1%; white-space: nowrap; text-align: right; }
.table .col-actions .menu { right: 0; left: auto; top: calc(100% + 4px); }
.table .row-menu { opacity: 0; transition: opacity var(--t-fast); }
.table tr:hover .row-menu, .table tr.is-focused .row-menu, .table .row-menu[aria-expanded="true"], .table .row-menu:focus-visible { opacity: 1; }
@media (hover: none) { .table .row-menu { opacity: 1; } }
.table .col-check { width: 44px; padding-right: 0; }
.table .col-check input { vertical-align: middle; }
.table tr.is-selected td { background: var(--indigo-50); }
.table tfoot td { font-weight: 600; border-top: 1px solid var(--border); border-bottom: 0; }
.table-compact td { padding-top: 6px; padding-bottom: 6px; }
.table-compact th { height: 32px; }
.table-plain th:first-child, .table-plain td:first-child { padding-left: 0; }
.table-plain th:last-child, .table-plain td:last-child { padding-right: 0; }
.table-plain thead th { border-top: 1px solid var(--border); }
.table-plain.table-sticky thead th, .table-plain thead.sticky th { position: sticky; top: var(--topbar-h, 56px); z-index: 3; background: var(--surface); }
.table-empty td, td.table-empty { padding: 48px 20px !important; text-align: center; color: var(--text-3); }
.card > .table-wrap:first-child .table th:first-child { border-top-left-radius: var(--radius-lg); }
.card > .table-wrap:first-child .table th:last-child { border-top-right-radius: var(--radius-lg); }
.row-link { cursor: pointer; }
.th-sort { display: inline-flex; align-items: center; gap: 4px; margin: 0 -4px; padding: 2px 4px; border: 0; border-radius: 4px; background: none; font: inherit; color: inherit; cursor: pointer; white-space: nowrap; }
.th-sort:hover { color: var(--text); background: var(--hover); }
.th-sort::after { content: ""; width: 12px; height: 12px; background: currentColor; opacity: 0; transition: opacity var(--t-fast); -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M8 12.5v-9M4.5 7 8 3.5 11.5 7'/%3E%3C/svg%3E") center / contain no-repeat; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M8 12.5v-9M4.5 7 8 3.5 11.5 7'/%3E%3C/svg%3E") center / contain no-repeat; }
.th-sort:hover::after { opacity: .5; }
th[aria-sort="ascending"], th[aria-sort="descending"] { color: var(--text); }
th[aria-sort="ascending"] .th-sort::after, th[aria-sort="descending"] .th-sort::after { opacity: 1; color: var(--primary); }
th[aria-sort="descending"] .th-sort::after { transform: rotate(180deg); }
.col-num .th-sort { flex-direction: row-reverse; }
.table-scroll { max-height: var(--table-max-height, 70vh); overflow: auto; }
.table-sticky thead th { position: sticky; top: 0; z-index: 2; background: var(--surface); }
/* a sticky header under the topbar needs the page to be the scroller: on desktop the wrap stops being one */
@media (min-width: 1024px) { .table-wrap:has(> .table-plain.table-sticky), .table-wrap:has(> .table-plain > thead.sticky) { overflow: visible; } }
.table-sticky thead th::after, .table-plain thead.sticky th::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 1px; background: var(--border); }
/* density: .table-compact (32 px rows), default 40 px, .table-relaxed (48 px rows, for two-line cells); a
   [data-density] on the wrap or the table applies the same, and data-module="table-density" remembers the choice */
.table-relaxed td, [data-density="relaxed"] .table td, .table[data-density="relaxed"] td { padding-top: 14px; padding-bottom: 14px; }
[data-density="compact"] .table td, .table[data-density="compact"] td { padding-top: 6px; padding-bottom: 6px; }
[data-density="compact"] .table th, .table[data-density="compact"] th { height: 32px; }
.table tbody tr[data-href]:focus-visible, .table tbody tr[data-peek]:focus-visible { outline: none; box-shadow: inset 2px 0 0 var(--primary); background: var(--hover); }
.bar-cell .bar { display: block; height: 4px; margin-top: 4px; border-radius: 2px; background: var(--indigo-200); width: var(--w, 0%); max-width: 100%; }
@media (max-width: 1023px) { .table [data-p="3"] { display: none; } }
@media (max-width: 639px) { .table [data-p="2"], .table [data-p="3"] { display: none; } .table th:first-child, .table td:first-child { padding-left: 16px; } .table th:last-child, .table td:last-child { padding-right: 16px; } .table-plain th:first-child, .table-plain td:first-child { padding-left: 0; } .table-plain th:last-child, .table-plain td:last-child { padding-right: 0; } }

/* ------------------------------------------------------------------ C-kpi (F-6): label · value · delta "vs previous period" · sparkline */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; }
.stats:has(> .stat:nth-child(5)) { grid-template-columns: repeat(5, minmax(0, 1fr)); }
@media (max-width: 1100px) { .stats, .stats:has(> .stat:nth-child(5)) { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 639px) { .stats, .stats:has(> .stat:nth-child(5)) { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scroll-padding-inline: var(--gutter, 16px); gap: 12px; margin-left: calc(var(--gutter, 16px) * -1); margin-right: calc(var(--gutter, 16px) * -1); padding: 0 var(--gutter, 16px) 4px; scrollbar-width: none; } .stats > .stat { flex: 0 0 160px; scroll-snap-align: start; } }
.stat { position: relative; display: block; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 16px 20px; box-shadow: var(--shadow-xs); min-width: 0; color: inherit; }
a.stat { transition: box-shadow var(--t), border-color var(--t); }
a.stat:hover { box-shadow: var(--shadow-md); border-color: var(--border-strong); }
.stat-label { font-size: 13px; font-weight: 500; color: var(--text-3); display: flex; align-items: center; gap: 6px; line-height: 18px; }
.stat-label .icon { display: none; }
.stat-label .tip .icon { display: block; }
.stat-value { font-weight: 600; font-size: 24px; line-height: 30px; margin-top: 6px; letter-spacing: -.02em; font-variant-numeric: tabular-nums; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat-value small { font-size: 14px; font-weight: 500; color: var(--text-3); letter-spacing: 0; margin-left: 2px; }
.stat-hero .stat-value { font-size: 32px; line-height: 38px; }
.stat-foot { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 12px; line-height: 16px; color: var(--text-3); margin-top: 6px; }
.stat-foot .up { color: var(--success); font-weight: 600; }
.stat-foot .down { color: var(--danger); font-weight: 600; }
.stat-delta { display: inline-flex; align-items: center; gap: 3px; font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--text-2); }
.stat-delta.up, .stat-delta.good { color: var(--success); }
.stat-delta.down, .stat-delta.bad { color: var(--danger); }
.stat-delta.dir-up::before, .stat-delta.dir-down::before { content: ""; width: 0; height: 0; border-left: 4px solid transparent; border-right: 4px solid transparent; }
.stat-delta.dir-up::before { border-bottom: 5px solid currentColor; }
.stat-delta.dir-down::before { border-top: 5px solid currentColor; }
.stat-spark { display: block; height: 32px; margin-top: 12px; color: var(--primary); }
.stat-spark svg { width: 100%; height: 100%; overflow: visible; }
.spark-line { fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.spark-area { fill: currentColor; opacity: .08; stroke: none; }
.stats-joined { gap: 0; border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-xs); overflow: hidden; background: var(--surface); }
.stats-joined > .stat { border: 0; border-radius: 0; box-shadow: none; border-left: 1px solid var(--border); }
.stats-joined > .stat:first-child { border-left: 0; }

/* ------------------------------------------------------------------ page head (§2.3, F-2) */
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px 24px; margin-bottom: 24px; flex-wrap: wrap; }
.page-head > div:first-child { min-width: 0; flex: 1 1 320px; }
.page-head .eyebrow { display: none; }
.page-head .sub { margin: 4px 0 0; max-width: 72ch; font-size: 13px; line-height: 18px; color: var(--text-3); }
.page-head h1 { font-size: 20px; font-weight: 650; letter-spacing: -.015em; line-height: 28px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; overflow-wrap: anywhere; }
.page-head h1 .badge { vertical-align: 0; }
.page-head .page-meta, .page-meta { display: flex; align-items: center; gap: 6px 12px; flex-wrap: wrap; margin-top: 4px; font-size: 13px; line-height: 18px; color: var(--text-3); }
.page-meta .sep { color: var(--gray-300); }
.page-head .actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; min-width: 0; min-height: 28px; }
.page-head:has(+ .tabs) { margin-bottom: 16px; }
.page-back { display: inline-flex; align-items: center; gap: 4px; margin: -4px 0 8px -2px; font-size: 13px; font-weight: 500; color: var(--text-3); line-height: 18px; }
.page-back:hover { color: var(--text); }
.page-back .icon { width: 14px; height: 14px; }

/* ------------------------------------------------------------------ C-tabs (40 px; active = indigo text + 2 px underline) */
.tabs { display: flex; gap: 24px; border-bottom: 1px solid var(--border); margin-bottom: 16px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { position: relative; display: inline-flex; align-items: center; gap: 6px; height: 40px; padding: 0 1px; font-size: 13.5px; font-weight: 500; color: var(--text-3); white-space: nowrap; border: 0; background: none; transition: color var(--t-fast); }
.tab:hover { color: var(--text); }
.tab .icon { width: 15px; height: 15px; color: var(--text-4); }
.tab.active, .tab[aria-current="page"], .tab[aria-selected="true"] { color: var(--primary-text); font-weight: 600; }
.tab.active .icon, .tab[aria-current="page"] .icon, .tab[aria-selected="true"] .icon { color: var(--primary); }
.tab.active::after, .tab[aria-current="page"]::after, .tab[aria-selected="true"]::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: var(--primary); border-radius: 2px 2px 0 0; }
.tab .count { min-width: 18px; height: 18px; display: inline-grid; place-items: center; font-size: 11px; padding: 0 5px; border-radius: 999px; background: var(--gray-100); color: var(--text-3); font-weight: 600; font-variant-numeric: tabular-nums; }
.tab.active .count, .tab[aria-current="page"] .count { background: var(--indigo-50); color: var(--indigo-700); }
.tabs-sm .tab { height: 34px; font-size: 13px; }
[data-panel][hidden] { display: none !important; }

/* ------------------------------------------------------------------ key–value lists, C-props, C-list */
.kv { display: grid; grid-template-columns: 160px minmax(0, 1fr); gap: 10px 16px; font-size: 13.5px; margin: 0; }
.kv dt { color: var(--text-3); }
.kv dd { margin: 0; word-break: break-word; color: var(--text); }
.kv-rows { gap: 0 16px; }
.kv-rows > dt, .kv-rows > dd { padding: 10px 0; border-bottom: 1px solid var(--border-subtle); }
.kv-rows > dt:last-of-type, .kv-rows > dd:last-of-type { border-bottom: 0; }
.props { margin: 0; display: flex; flex-direction: column; }
.props-label { font-size: 12px; font-weight: 600; color: var(--text-3); line-height: 16px; margin: 0 0 4px; }
.prop + .props-label { margin-top: 16px; }
.prop { display: grid; grid-template-columns: 120px minmax(0, 1fr); align-items: start; gap: 8px; min-height: 32px; }
.prop > dt, .prop > .prop-key { font-size: 12.5px; color: var(--text-3); padding: 7px 0; line-height: 18px; }
.prop > dd, .prop > .prop-val { margin: 0; min-width: 0; font-size: 13.5px; line-height: 20px; }
.prop-value { display: block; padding: 6px 8px; margin: 0 -8px; border-radius: 6px; min-height: 32px; word-break: break-word; }
.prop-value[data-edit] { cursor: text; transition: background var(--t-fast); }
.prop-value[data-edit]:hover { background: var(--hover); }
.prop-value.is-empty { color: var(--text-4); }
.prop-value.is-saved::after { content: "Saved"; margin-left: 8px; font-size: 12px; color: var(--success); }
.prop .input, .prop .select { min-height: 32px; margin: 0 -8px; width: calc(100% + 16px); }
.prop .field-error { margin-top: 4px; }
.prop.is-empty-prop { display: none; }
.props.show-all .prop.is-empty-prop { display: grid; }
.props-more { align-self: flex-start; margin-top: 8px; }
.list { display: flex; flex-direction: column; }
.list-item { display: flex; align-items: center; gap: 12px; padding: 12px 20px; border-bottom: 1px solid var(--border-subtle); min-width: 0; flex-wrap: wrap; }
.list-item:last-child { border-bottom: 0; }
a.list-item { transition: background var(--t-fast); }
a.list-item:hover { background: var(--hover); }
.list-item .main { flex: 1; min-width: 0; }
.list-item .title { font-weight: 600; font-size: 13.5px; line-height: 20px; }
.list-item .sub { font-size: 12.5px; color: var(--text-3); line-height: 18px; }
.list-item .aside { font-size: 12.5px; color: var(--text-3); white-space: nowrap; margin-left: auto; }
.list-icon { width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center; background: var(--gray-50); border: 1px solid var(--border); color: var(--text-3); flex: none; }
.list-icon.is-good { background: var(--success-bg); border-color: var(--success-border); color: var(--success); }
.list-icon.is-primary { background: var(--indigo-50); border-color: var(--indigo-100); color: var(--indigo-600); }

/* ------------------------------------------------------------------ C-empty, C-callout */
.empty { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 48px 24px; gap: 4px; }
.empty-mark { position: relative; width: 44px; height: 44px; border-radius: 11px; display: grid; place-items: center; color: var(--text-3); background: var(--gray-50); border: 1px solid var(--border); margin-bottom: 12px; flex: none; }
.empty-mark .icon { width: 20px; height: 20px; }
.empty h3 { font-size: 14.5px; font-weight: 600; line-height: 22px; letter-spacing: -.01em; }
.empty p { color: var(--text-3); max-width: 46ch; margin: 0; font-size: 13.5px; line-height: 20px; }
.empty > .row, .empty > .btn-row { margin-top: 12px !important; justify-content: center; }
.empty-sm { padding: 24px 20px; }
.empty-sm .empty-mark { width: 36px; height: 36px; border-radius: 9px; margin-bottom: 8px; }
.empty-sm .empty-mark .icon { width: 16px; height: 16px; }
.empty-dashed { border: 1px dashed var(--border-strong); border-radius: var(--radius-lg); }
.empty-line { padding: 16px 20px; font-size: 13.5px; color: var(--text-3); }
.callout { display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; border-radius: var(--radius); background: var(--gray-50); border: 1px solid var(--border); font-size: 13.5px; color: var(--text-2); line-height: 20px; }
.callout > .icon { margin-top: 2px; flex: none; color: var(--text-3); }
.callout .callout-title, .callout strong { color: var(--text); font-weight: 600; }
.callout .callout-body, .callout > div:not(.callout-actions) { color: inherit; min-width: 0; flex: 1; }
.callout .callout-actions { display: flex; gap: 8px; align-items: center; margin-left: auto; flex: none; }
.callout-info { background: var(--info-bg); border-color: var(--info-border); color: var(--info-text); }
.callout-info > .icon, .callout-info strong, .callout-info .callout-title { color: var(--info); }
.callout-success { background: var(--success-bg); border-color: var(--success-border); color: var(--success-text); }
.callout-success > .icon, .callout-success strong, .callout-success .callout-title { color: var(--success); }
.callout-warn { background: var(--warning-bg); border-color: var(--warning-border); color: var(--warning-text); }
.callout-warn > .icon, .callout-warn strong, .callout-warn .callout-title { color: var(--warning); }
.callout-danger { background: var(--danger-bg); border-color: var(--danger-border); color: var(--danger-text); }
.callout-danger > .icon, .callout-danger strong, .callout-danger .callout-title { color: var(--danger); }
.callout-gold { background: var(--gold-100); border-color: var(--gold-200); color: var(--gold-700); }
.callout-gold > .icon { color: var(--gold-700); }
.callout a.link { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.callout ul { margin: 4px 0 0; padding-left: 18px; }

/* ------------------------------------------------------------------ C-avatar (24 lists · 32 headers · 48 records · 96 profiles) */
.avatar { width: 32px; height: 32px; border-radius: 50%; display: inline-grid; place-items: center; background: var(--indigo-50); color: var(--indigo-700); font-size: 12px; font-weight: 600; letter-spacing: .01em; flex: none; overflow: hidden; box-shadow: inset 0 0 0 1px rgba(17, 19, 24, .06); line-height: 1; user-select: none; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-xs { width: 20px; height: 20px; font-size: 8.5px; }
.avatar-sm { width: 24px; height: 24px; font-size: 10px; }
.avatar-md { width: 28px; height: 28px; font-size: 11px; }
.avatar-lg { width: 48px; height: 48px; font-size: 16px; }
.avatar-xl { width: 72px; height: 72px; font-size: 24px; }
.avatar-2xl { width: 96px; height: 96px; font-size: 32px; }
.avatar-stack { display: inline-flex; align-items: center; }
.avatar-stack > .avatar, .avatar-stack > [data-tip] > .avatar { box-shadow: 0 0 0 2px var(--surface); }
.avatar-stack > * + * { margin-left: -6px; }
.avatar-stack .avatar-more { background: var(--gray-100); color: var(--text-2); font-weight: 600; }
.person { display: flex; align-items: center; gap: 10px; min-width: 0; }
.person .name { font-weight: 550; }
.person .meta { font-size: 12.5px; color: var(--text-3); }

/* ------------------------------------------------------------------ health, C-progress, stepper */
.health { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.health-item { display: flex; gap: 10px; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.health-dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 6px; flex: none; background: var(--success-fill); box-shadow: 0 0 0 3px var(--success-bg); }
.health-item.bad .health-dot { background: var(--danger-fill); box-shadow: 0 0 0 3px var(--danger-bg); }
.health-item .name { font-weight: 600; font-size: 13.5px; }
.health-item .detail { font-size: 12.5px; color: var(--text-3); word-break: break-word; }
.progress { position: relative; height: 6px; background: var(--gray-100); border-radius: 999px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--primary); border-radius: inherit; transition: width var(--t-slow) var(--ease-out); }
.progress.is-complete > span, .progress.green > span { background: var(--success-fill); }
.progress.gold > span { background: var(--gold-600); }
.progress.red > span { background: var(--danger-fill); }
.progress-sm { height: 4px; }
.progress-lg { height: 8px; }
.progress.is-indeterminate > span { width: 30%; position: absolute; animation: indeterminate 1.3s var(--ease) infinite; }
@keyframes indeterminate { from { left: -30%; } to { left: 100%; } }
.progress-meta { display: flex; justify-content: space-between; gap: 12px; font-size: 12.5px; color: var(--text-3); margin-bottom: 6px; font-variant-numeric: tabular-nums; }
.progress-meta strong { color: var(--text); font-weight: 550; }
/* stepper (§3.3): 20 px numbered circles + labels joined by 24 px lines; done = check, current = ring, future = grey */
.stepper { list-style: none; margin: 0; padding: 0; display: flex; align-items: center; gap: 8px; counter-reset: step; min-width: 0; }
.stepper > li { display: flex; align-items: center; gap: 8px; counter-increment: step; font-size: 13px; font-weight: 500; color: var(--text-3); white-space: nowrap; }
.stepper > li + li::before { content: ""; width: 24px; height: 1px; background: var(--border-strong); flex: none; }
.stepper > li.is-done + li::before { background: var(--primary); }
.stepper .step-mark { width: 20px; height: 20px; border-radius: 50%; flex: none; display: grid; place-items: center; font-size: 11px; font-weight: 600; font-variant-numeric: tabular-nums; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text-3); }
.stepper .step-mark:empty::before { content: counter(step); }
.stepper .step-label { overflow: hidden; text-overflow: ellipsis; }
.stepper a.step-label:hover { color: var(--text); text-decoration: underline; text-underline-offset: 3px; }
.stepper > li.is-current { color: var(--text); font-weight: 600; }
.stepper > li.is-current .step-mark { border-color: var(--primary); color: var(--primary); box-shadow: 0 0 0 3px var(--indigo-100); }
.stepper > li.is-done { color: var(--text-2); }
.stepper > li.is-done .step-mark { background: var(--primary) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='white' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3.8 8.4 6.6 11.2 12.2 5.2'/%3E%3C/svg%3E") center / 12px no-repeat; border-color: var(--primary); color: transparent; }
.stepper > li.is-done .step-mark:empty::before { content: ""; }
.stepper-compact { display: none; font-size: 13px; color: var(--text-3); white-space: nowrap; }
.stepper-compact strong { color: var(--text); font-weight: 600; }
.stepper-vertical { flex-direction: column; align-items: stretch; gap: 0; }
.stepper-vertical > li { position: relative; align-items: flex-start; padding-bottom: 20px; white-space: normal; }
.stepper-vertical > li + li::before { display: none; }
.stepper-vertical > li:not(:last-child)::after { content: ""; position: absolute; left: 10px; top: 24px; bottom: 4px; width: 1px; background: var(--border-strong); }
.stepper-vertical > li.is-done:not(:last-child)::after { background: var(--primary); }
.stepper-vertical .step-body { display: flex; flex-direction: column; gap: 2px; }
.stepper-vertical .step-desc { font-size: 12.5px; font-weight: 400; color: var(--text-3); }
@media (max-width: 760px) { .stepper:not(.stepper-vertical) { display: none; } .stepper-compact { display: block; } }

/* ------------------------------------------------------------------ C-menu, C-popover */
.menu-wrap { position: relative; }
/* Closed menus are display: none, so they never widen the page or take focus; opening animates in. */
.menu, .popover {
  position: absolute; z-index: 60; min-width: 208px; padding: 4px; border-radius: 10px; background: var(--surface);
  box-shadow: var(--shadow-lg); display: none; transform-origin: top center;
}
.menu.open, .popover.open { display: block; animation: menu-in var(--t-fast) var(--ease); }
@keyframes menu-in { from { opacity: 0; transform: translateY(-4px) scale(.985); } }
@keyframes menu-in-up { from { opacity: 0; transform: translateY(4px) scale(.985); } }
.menu-up.open, .popover-up.open { animation-name: menu-in-up; }
.popover { width: 320px; min-width: 240px; max-width: min(360px, calc(100vw - 24px)); padding: 16px; }
.popover-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: -4px 0 12px; font-size: 13.5px; font-weight: 600; }
.popover-foot { display: flex; justify-content: flex-end; gap: 8px; margin: 16px -16px -16px; padding: 12px 16px; border-top: 1px solid var(--border); }
.menu-right, .popover-right { right: 0; left: auto; }
.menu-up, .popover-up { top: auto; bottom: calc(100% + 6px); transform-origin: bottom center; }
.menu-item { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 32px; padding: 6px 10px; border-radius: 6px; border: 0; background: none; font-size: 13.5px; line-height: 20px; color: var(--text); text-align: left; cursor: pointer; white-space: nowrap; font-weight: 400; }
.menu-item:hover, .menu-item:focus-visible, .menu-item.is-active { background: var(--hover); box-shadow: none; outline: none; }
.menu-item .icon { color: var(--text-4); }
.menu-item:hover .icon { color: var(--text-2); }
.menu-item .shortcut, .menu-item > kbd, .menu-item .trail { margin-left: auto; color: var(--text-4); font-size: 12px; }
.menu-item.danger { color: var(--danger); }
.menu-item.danger .icon { color: var(--danger); }
.menu-item.danger:hover { background: var(--danger-bg); }
.menu-item.muted { color: var(--text-3); cursor: default; }
.menu-item.muted:hover { background: none; }
.menu-item[aria-disabled="true"] { opacity: .45; pointer-events: none; }
.menu-item[aria-checked="true"] { font-weight: 550; }
.menu-sep { height: 1px; background: var(--border); margin: 4px -4px; }
.menu-label { padding: 8px 10px 4px; font-size: 12px; font-weight: 500; color: var(--text-3); }
.menu-head { padding: 8px 10px; border-bottom: 1px solid var(--border); margin: -4px -4px 4px; }
.menu-item .menu-text { display: flex; flex-direction: column; min-width: 0; line-height: 18px; }
.menu-item .menu-text .sub, .menu-item > .sub { font-size: 12px; color: var(--text-3); line-height: 16px; white-space: normal; }
.menu-item:has(.menu-text .sub) { align-items: flex-start; padding-top: 7px; padding-bottom: 7px; }
.menu-item:has(.menu-text .sub) > .icon { margin-top: 1px; }
.menu-item[aria-current="true"], .menu-item[aria-current="page"] { font-weight: 550; }

/* ------------------------------------------------------------------ C-tooltip ([data-tip], placed by app.js): white, 12.5 px, 400 ms */
.tooltip { position: fixed; z-index: 400; max-width: 240px; padding: 6px 10px; border-radius: 8px; background: var(--surface); color: var(--text); font-size: 12.5px; font-weight: 500; line-height: 18px; pointer-events: none; opacity: 0; transform: translateY(2px); transition: opacity var(--t-fast), transform var(--t-fast); box-shadow: var(--shadow-lg); overflow-wrap: anywhere; display: flex; align-items: center; gap: 8px; }
.tooltip[data-side="right"] { transform: translateX(-2px); }
.tooltip[data-side="bottom"] { transform: translateY(-2px); }
.tooltip[data-side="left"] { transform: translateX(2px); }
.tooltip.show { opacity: 1; transform: none; }
.tooltip.is-instant { transition: none; }
.tooltip kbd { margin-left: 0; height: 18px; min-width: 18px; font-size: 10.5px; }
.tooltip .tip-keys { display: inline-flex; gap: 3px; margin-left: auto; }
.tooltip .tip-count { margin-left: auto; color: var(--text-3); font-variant-numeric: tabular-nums; }
.tip { display: inline-grid; place-items: center; width: 16px; height: 16px; border-radius: 50%; color: var(--text-4); cursor: help; vertical-align: -3px; }
.tip:hover { color: var(--text-2); }

/* ------------------------------------------------------------------ C-toast (bottom right; noun + past tense; action 8 s) */
.toast-stack { position: fixed; bottom: 20px; right: 20px; z-index: 200; display: flex; flex-direction: column; align-items: flex-end; gap: 8px; width: min(380px, calc(100vw - 32px)); pointer-events: none; }
.toast { pointer-events: auto; width: 100%; display: flex; gap: 10px; align-items: flex-start; padding: 12px 12px 12px 14px; border-radius: 10px; background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg); font-size: 13.5px; line-height: 20px; animation: toast-in var(--t-slow) var(--ease-out); transition: opacity var(--t), transform var(--t) var(--ease); }
.toast > .icon { color: var(--info-fill); margin-top: 2px; }
.toast.success > .icon { color: var(--success-fill); }
.toast.error > .icon { color: var(--danger-fill); }
.toast.warning > .icon { color: var(--warning-fill); }
.toast .toast-desc { display: block; color: var(--text-3); font-size: 13px; margin-top: 2px; }
.toast .toast-action { margin-left: 4px; border: 0; background: none; padding: 0 2px; height: 20px; font-size: 13px; font-weight: 600; color: var(--primary); white-space: nowrap; border-radius: 4px; }
.toast .toast-action:hover { color: var(--primary-hover); text-decoration: underline; text-underline-offset: 3px; }
.toast .close { margin-left: auto; background: none; border: 0; color: var(--text-4); padding: 2px; border-radius: 4px; display: grid; place-items: center; }
.toast .close:hover { color: var(--text); background: var(--hover); }
.toast.is-leaving { opacity: 0; transform: translateY(6px) scale(.98); }
@keyframes toast-in { from { opacity: 0; transform: translateY(12px) scale(.98); } }
@media (max-width: 560px) { .toast-stack { right: 16px; left: 16px; bottom: 16px; width: auto; } }

/* ------------------------------------------------------------------ dialog.modal (F-7: 400 / 560 / 720; 24 px padding; white footer) */
dialog.modal { border: 0; padding: 0; margin: auto; border-radius: var(--radius-xl); background: var(--surface); color: var(--text); width: min(560px, calc(100vw - 32px)); max-height: calc(100dvh - 48px); box-shadow: var(--shadow-lg); overflow: hidden; }
dialog.modal[open] { display: flex; flex-direction: column; animation: modal-in 200ms var(--ease-out); }
dialog.modal > form:not([class]):has(> .modal-body) { display: contents; }
dialog.modal::backdrop { background: rgba(17, 19, 24, .4); animation: fade-in var(--t) var(--ease); }
dialog.modal.modal-sm { width: min(400px, calc(100vw - 32px)); }
dialog.modal.modal-md { width: min(560px, calc(100vw - 32px)); }
dialog.modal.modal-lg { width: min(720px, calc(100vw - 32px)); }
dialog.modal.modal-xl { width: min(960px, calc(100vw - 32px)); }
@keyframes modal-in { from { opacity: 0; transform: translateY(8px) scale(.97); } }
@keyframes fade-in { from { opacity: 0; } }
.modal-head { flex: none; display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 20px 20px 0 24px; }
.modal-head h2, .modal-title { font-size: 18px; font-weight: 600; line-height: 26px; letter-spacing: -.012em; }
.modal-head .modal-sub { font-size: 13px; color: var(--text-3); margin-top: 2px; }
.modal-close { width: 28px; height: 28px; display: grid; place-items: center; border: 0; border-radius: 6px; background: none; color: var(--text-3); flex: none; }
.modal-close:hover { background: var(--hover); color: var(--text); }
.modal-body { padding: 20px 24px 24px; overflow-y: auto; min-height: 0; flex: 1 1 auto; font-size: 14px; line-height: 20px; }
.modal-body > p { margin: 0 0 16px; color: var(--text-2); }
.modal-body > p:last-child { margin-bottom: 0; }
.modal-body > .field + .field, .modal-body > .field + .check, .modal-body > .fields + .field { margin-top: 16px; }
.modal-body .fields { gap: 16px; }
.modal-foot { flex: none; padding: 16px 24px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; align-items: center; gap: 8px; background: var(--surface); }
.modal-foot .left { margin-right: auto; }
.modal-confirm .modal-body { padding-top: 8px; color: var(--text-2); }
.modal-confirm .modal-foot { border-top: 0; padding-top: 0; }
.modal-close:focus-visible { box-shadow: var(--focus-ring-strong); }
dialog.modal::backdrop { background: var(--backdrop); }
/* phones: every modal is a bottom sheet (thumb reach, the keyboard pushes it up), buttons 44 px */
@media (max-width: 639px) {
  dialog.modal, dialog.modal.modal-sm, dialog.modal.modal-md, dialog.modal.modal-lg, dialog.modal.modal-xl { width: 100vw; max-width: 100vw; margin: auto 0 0; border-radius: 16px 16px 0 0; max-height: calc(100dvh - 24px); }
  dialog.modal[open] { animation: sheet-in 260ms var(--ease-out); }
  dialog.modal::before { content: ""; flex: none; align-self: center; width: 36px; height: 4px; margin-top: 8px; border-radius: 2px; background: var(--gray-200); }
  .modal-head { padding: 12px 12px 0 20px; }
  .modal-body { padding: 16px 20px 20px; }
  .modal-foot { padding: 12px 20px calc(12px + env(safe-area-inset-bottom)); }
  .modal-foot .btn, .modal-confirm .modal-foot .btn { height: 44px; flex: 1; }
  .modal-close { width: 40px; height: 40px; }
}
@keyframes sheet-in { from { transform: translateY(24px); opacity: 0; } }

/* ------------------------------------------------------------------ .drawer (F-8: 560 / 720 / 960; full screen under 640) */
.drawer-backdrop { position: fixed; inset: 0; background: rgba(17, 19, 24, .32); z-index: 80; opacity: 0; pointer-events: none; transition: opacity var(--t) var(--ease); }
.drawer-backdrop.open { opacity: 1; pointer-events: auto; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(560px, 100vw); z-index: 90; background: var(--surface); box-shadow: var(--shadow-lg); border-left: 1px solid var(--border); display: flex; flex-direction: column; transform: translateX(100%); visibility: hidden; transition: transform var(--t) var(--ease-out), visibility 0s linear var(--t); }
.drawer.open { transform: none; visibility: visible; transition: transform var(--t) var(--ease-out); }
.drawer.drawer-sm { width: min(480px, 100vw); }
.drawer.drawer-md { width: min(560px, 100vw); }
.drawer.drawer-lg { width: min(720px, 100vw); }
.drawer.drawer-xl { width: min(960px, 100vw); }
@media (max-width: 639px) { .drawer, .drawer.drawer-sm, .drawer.drawer-md, .drawer.drawer-lg, .drawer.drawer-xl { width: 100vw; border-left: 0; } }
.drawer-head { flex: none; display: flex; align-items: center; gap: 12px; min-height: 60px; padding: 14px 20px 14px 24px; border-bottom: 1px solid var(--border); }
.drawer-head .drawer-title { flex: 1; min-width: 0; font-size: 18px; font-weight: 600; line-height: 26px; letter-spacing: -.012em; }
.drawer-head .kind { width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center; background: var(--surface-3); color: var(--text-2); flex: none; }
.drawer-head .title-input { flex: 1; font-size: 18px; font-weight: 600; border: 1px solid transparent; background: none; color: var(--text); padding: 2px 8px; margin-left: -8px; border-radius: 6px; min-width: 0; }
.drawer-head .title-input:hover { border-color: var(--border); }
.drawer-head .title-input:focus { outline: none; border-color: var(--indigo-500); box-shadow: var(--focus-ring); }
.drawer-body { flex: 1; overflow-y: auto; padding: 24px; display: flex; flex-direction: column; gap: 24px; }
.drawer-foot { flex: none; display: flex; align-items: center; justify-content: flex-end; gap: 8px; padding: 16px 24px; border-top: 1px solid var(--border); background: var(--surface); }
.drawer-foot .saved { font-size: 12.5px; color: var(--text-3); margin-right: auto; }
.drawer-foot .spacer, .drawer-foot .left { margin-right: auto; }
.drawer-section { display: flex; flex-direction: column; gap: 12px; }
.drawer-section > h3 { font-size: 12px; font-weight: 600; color: var(--text-3); letter-spacing: 0; text-transform: none; line-height: 16px; }
.drawer-backdrop { background: var(--backdrop); }
.drawer-head .icon-button, .drawer-head .modal-close { flex: none; }
@media (max-width: 639px) {
  .drawer-head { min-height: 56px; padding: 8px 8px 8px 16px; }
  .drawer-head .drawer-title { font-size: 16px; line-height: 22px; }
  .drawer-head .modal-close, .drawer-head .icon-button { width: 40px; height: 40px; }
  .drawer-body { padding: 20px 16px; }
  .drawer-foot { padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); }
  .drawer-foot .btn { height: 44px; }
}
body.has-overlay { overflow: hidden; }

/* ------------------------------------------------------------------ skeletons, code, kbd, uploads */
.skeleton { display: block; background: linear-gradient(90deg, var(--gray-100) 25%, var(--gray-75) 45%, var(--gray-100) 65%); background-size: 300% 100%; animation: shimmer 1.4s ease-in-out infinite; border-radius: 6px; }
.skeleton-text { height: 10px; border-radius: 4px; margin: 5px 0; }
.skeleton-title { height: 14px; border-radius: 5px; width: 40%; }
.skeleton-circle { border-radius: 50%; }
.skeleton-row td { padding-top: 15px; padding-bottom: 15px; }
.is-loading-delayed { animation: delay-show 0s linear 300ms both; }
@keyframes delay-show { from { visibility: hidden; } to { visibility: visible; } }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: 0 0; } }
.code-block { font-family: var(--font-mono); font-size: 12.5px; line-height: 18px; background: var(--gray-25); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; overflow-x: auto; white-space: pre-wrap; word-break: break-all; color: var(--text-2); }
:not(pre) > code { font-family: var(--font-mono); font-size: .88em; padding: 1px 5px; border-radius: 4px; background: var(--gray-75); color: var(--text-2); }
kbd { display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px; padding: 0 5px; font-family: var(--font-sans); font-size: 11px; font-weight: 550; line-height: 1; border-radius: 5px; border: 1px solid var(--border); background: var(--surface); color: var(--text-3); box-shadow: inset 0 -1px 0 var(--border); }
.dropzone { display: flex; flex-direction: column; align-items: center; gap: 4px; border: 1px dashed var(--border-strong); border-radius: var(--radius-lg); padding: 28px 20px; text-align: center; background: var(--gray-25); transition: border-color var(--t-fast), background var(--t-fast), box-shadow var(--t-fast); cursor: pointer; color: var(--text-3); font-size: 13.5px; }
.dropzone:hover, .dropzone.drag { border-color: var(--indigo-400); background: var(--indigo-25); }
.dropzone.drag { box-shadow: 0 0 0 3px var(--indigo-100); }
.dropzone > .icon, .dropzone .dz-icon { width: 40px; height: 40px; padding: 10px; margin: 0 auto 8px; display: grid; place-items: center; color: var(--text-3); border-radius: 10px; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-xs); }
.dropzone .dz-title { color: var(--text); font-weight: 550; }
.dropzone .dz-title b, .dropzone .dz-title strong { color: var(--primary); font-weight: 600; }
.dropzone .dz-hint { font-size: 12.5px; color: var(--text-3); }
.dropzone input[type="file"] { display: none; }
.upload-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border-subtle); }
.upload-row:last-child { border-bottom: 0; }
.upload-row > .icon { color: var(--text-3); }
/* C-code-view: logs, JSON, MJML, env files. Never dark. */
.code-view { position: relative; border: 1px solid var(--border); border-radius: var(--radius); background: var(--gray-25); overflow: hidden; }
.code-view-bar { display: flex; align-items: center; gap: 4px; justify-content: flex-end; padding: 6px 8px; border-bottom: 1px solid var(--border); background: var(--surface); }
.code-view-bar .title { margin-right: auto; font-size: 12.5px; font-weight: 550; color: var(--text-2); padding-left: 4px; }
.code-view-bar .input { width: 180px; min-height: 26px; padding: 2px 8px; font-size: 12.5px; }
.code-view-bar .count { font-size: 12px; color: var(--text-3); min-width: 36px; text-align: right; font-variant-numeric: tabular-nums; }
.code-view pre { margin: 0; padding: 12px 0; overflow: auto; max-height: var(--code-max-height, 480px); font-family: var(--font-mono); font-size: 12.5px; line-height: 18px; color: var(--text-2); counter-reset: line; tab-size: 2; }
.code-view pre code { display: block; background: none; padding: 0; font-size: inherit; }
.code-view .ln { display: block; padding: 0 14px 0 0; white-space: pre; }
.code-view .ln::before { counter-increment: line; content: counter(line); display: inline-block; width: 44px; padding-right: 14px; text-align: right; color: var(--text-4); user-select: none; }
.code-view.is-wrapped .ln { white-space: pre-wrap; word-break: break-all; padding-left: 58px; text-indent: -58px; }
.code-view mark { background: var(--warning-bg); color: inherit; box-shadow: 0 0 0 1px var(--warning-border); border-radius: 2px; }
.code-view mark.is-current { background: #FDE68A; }
/* C-secret: a masked value with copy and (non-secret values only) reveal */
.secret { display: inline-flex; align-items: center; gap: 2px; font-family: var(--font-mono); font-size: 12.5px; color: var(--text-2); background: var(--gray-25); border: 1px solid var(--border); border-radius: 6px; padding: 0 2px 0 8px; height: 28px; max-width: 100%; vertical-align: middle; }
.secret .secret-value { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; letter-spacing: .02em; margin-right: 4px; }
.secret .btn { height: 22px; width: 22px; }

/* ------------------------------------------------------------------ timelines and C-activity (feed v2) */
.timeline { list-style: none; margin: 0; padding: 4px 20px 16px; }
.timeline li { position: relative; padding: 10px 0 10px 22px; border-left: 1px solid var(--border); margin-left: 5px; }
.timeline li::before { content: ""; position: absolute; left: -5px; top: 15px; width: 9px; height: 9px; border-radius: 50%; background: var(--surface); border: 2px solid var(--gray-400); }
.timeline li.bad::before { border-color: var(--danger-fill); }
.timeline li.good::before { border-color: var(--success-fill); background: var(--success-fill); }
.timeline .when { font-size: 12px; color: var(--text-3); }
.activity { list-style: none; margin: 0; padding: 0; }
.activity-month { position: sticky; top: var(--topbar-h, 56px); z-index: 2; padding: 12px 0 8px; font-size: 12px; font-weight: 600; line-height: 16px; color: var(--text-3); background: var(--surface); }
.activity-item { position: relative; display: grid; grid-template-columns: 24px minmax(0, 1fr) auto; column-gap: 12px; padding: 8px 0; }
.activity-item:not(:last-child)::before { content: ""; position: absolute; left: 11.5px; top: 34px; bottom: -6px; width: 1px; background: var(--border); }
.activity-marker { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: var(--gray-50); border: 1px solid var(--border); color: var(--text-3); position: relative; z-index: 1; }
.activity-marker .icon { width: 12px; height: 12px; }
.activity-marker.is-primary { background: var(--indigo-50); border-color: var(--indigo-100); color: var(--indigo-600); }
.activity-marker.is-good { background: var(--success-bg); border-color: var(--success-border); color: var(--success); }
.activity-marker.is-warn { background: var(--warning-bg); border-color: var(--warning-border); color: var(--warning); }
.activity-marker.is-bad { background: var(--danger-bg); border-color: var(--danger-border); color: var(--danger); }
.activity-item > .avatar { width: 24px; height: 24px; font-size: 10px; position: relative; z-index: 1; }
.activity-summary { font-size: 13.5px; line-height: 20px; color: var(--text-2); padding-top: 2px; min-width: 0; }
.activity-summary strong, .activity-summary b, .activity-summary a { color: var(--text); font-weight: 600; }
.activity-summary a:hover { text-decoration: underline; text-underline-offset: 3px; }
.activity-summary .meta { color: var(--text-3); font-size: 12.5px; margin-left: 6px; }
.activity-time { font-size: 12px; color: var(--text-3); white-space: nowrap; padding-top: 3px; font-variant-numeric: tabular-nums; }
.activity-body { grid-column: 2 / -1; margin-top: 8px; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); font-size: 13.5px; line-height: 20px; color: var(--text-2); }
.activity-item details { grid-column: 2 / -1; }
.activity-item details > summary { list-style: none; cursor: pointer; font-size: 12.5px; color: var(--text-3); margin-top: 2px; }
.activity-item details > summary::-webkit-details-marker { display: none; }
.activity-item details > summary:hover { color: var(--text); }
.installments { display: flex; gap: 5px; flex-wrap: wrap; }
.installments span { width: 26px; height: 26px; border-radius: 6px; display: grid; place-items: center; font-size: 11.5px; font-weight: 600; background: var(--surface-3); color: var(--text-3); font-variant-numeric: tabular-nums; }
.installments span.paid { background: var(--success-bg); color: var(--success); }
.installments span.due { background: var(--accent-soft); color: var(--accent-text); box-shadow: inset 0 0 0 1px var(--accent); }
.installments span.failed { background: var(--danger-bg); color: var(--danger); }

/* ------------------------------------------------------------------ list pages (L-1): filter bar, pills, bulk bar, pagination */
.filter-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 0 0 12px; min-height: 32px; }
.filter-bar > .input-group { width: 280px; flex: 0 1 280px; }
.filter-bar .filter-end { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.filter-bar .filter-clear { font-size: 13px; font-weight: 500; color: var(--text-3); padding: 0 4px; border: 0; background: none; }
.filter-bar .filter-clear:hover { color: var(--text); text-decoration: underline; text-underline-offset: 3px; }
.filter-bar .select { width: auto; min-width: 140px; }
.filter-pill { position: relative; display: inline-flex; align-items: center; gap: 4px; height: 28px; padding: 0 4px 0 10px; border-radius: 999px; background: var(--surface-3); border: 1px solid transparent; font-size: 13px; color: var(--text-3); white-space: nowrap; cursor: pointer; transition: background var(--t-fast), border-color var(--t-fast); }
.filter-pill:hover { background: var(--gray-100); }
.filter-pill .k { color: var(--text-2); }
.filter-pill .op { color: var(--text-3); }
.filter-pill .v { color: var(--text); font-weight: 600; }
.filter-pill .x { display: grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; color: var(--text-3); border: 0; background: none; }
.filter-pill .x:hover { background: var(--gray-200); color: var(--text); }
.filter-pill .x .icon { width: 12px; height: 12px; }
.filter-pill.is-add { background: none; border: 1px dashed var(--border-strong); color: var(--text-3); padding: 0 10px; gap: 6px; }
.filter-pill.is-add .icon { width: 14px; height: 14px; }
.filter-pill.is-add:hover { color: var(--text); border-color: var(--gray-400); }
.filter-pill.is-suggested { padding-right: 10px; }
.filter-pill.is-suggested .v { color: var(--text-3); font-weight: 500; }
.bulk-bar { position: sticky; top: calc(var(--topbar-h, 56px) + 8px); z-index: 5; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 0 0 12px; min-height: 36px; padding: 2px 3px 2px 12px; border-radius: var(--radius); background: var(--indigo-50); color: var(--indigo-800); font-size: 13.5px; box-shadow: 0 0 0 1px var(--indigo-100), 0 4px 12px -6px rgba(49, 46, 129, .18); animation: fade-in var(--t-fast) var(--ease); }
.bulk-bar .bulk-count { font-weight: 600; font-variant-numeric: tabular-nums; }
.bulk-bar .bulk-all { font-size: 13px; font-weight: 550; color: var(--primary); border: 0; background: none; padding: 0 4px; }
.bulk-bar .bulk-all:hover { text-decoration: underline; text-underline-offset: 3px; }
.bulk-bar .bulk-actions { display: flex; gap: 6px; align-items: center; margin-left: auto; }
.bulk-bar .btn { height: 26px; font-size: 13px; padding: 0 10px; }
.bulk-bar .btn-icon { width: 26px; padding: 0; }
.bulk-bar form { display: contents; }
.pagination { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; font-size: 13px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.card .pagination { padding: 10px 12px 10px 20px; border-top: 1px solid var(--border); }
.pagination .pages { display: flex; align-items: center; gap: 4px; }
.page-btn { min-width: 28px; height: 28px; padding: 0 6px; display: inline-grid; place-items: center; border-radius: 6px; border: 1px solid var(--border-strong); background: var(--surface); font-size: 13px; font-weight: 500; color: var(--text-2); box-shadow: var(--shadow-xs); }
.page-btn:hover { background: var(--gray-50); color: var(--text); }
.page-btn.is-current, .page-btn[aria-current="page"] { border-color: var(--primary); color: var(--primary-text); font-weight: 600; }
.page-btn[aria-disabled="true"], .page-btn:disabled { opacity: .45; pointer-events: none; box-shadow: none; }
.page-btn .icon { width: 15px; height: 15px; }

/* ------------------------------------------------------------------ C-savebar (unsaved changes; covers the header, no layout shift) */
.save-bar { position: fixed; z-index: 45; top: 0; left: var(--sidebar-w, 0px); right: 0; height: var(--topbar-h, 56px); display: flex; align-items: center; gap: 8px; padding: 0 var(--gutter, 32px); background: var(--surface); border-bottom: 1px solid var(--border); box-shadow: var(--shadow-md); font-size: 13.5px; font-weight: 600; color: var(--text); transform: translateY(-100%); visibility: hidden; transition: transform var(--t) var(--ease-out), visibility 0s linear var(--t); }
.save-bar.is-visible { transform: none; visibility: visible; transition: transform var(--t) var(--ease-out); }
.save-bar > .icon { color: var(--warning-fill); }
.save-bar .save-bar-actions { margin-left: auto; display: flex; gap: 8px; }
@media (max-width: 1023px) { .save-bar { left: 0; } }

/* ------------------------------------------------------------------ C-checklist (one-page setup: broadcasts) */
.checklist { border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); box-shadow: var(--shadow-xs); }
.checklist-row { border-bottom: 1px solid var(--border); }
.checklist-row:last-child { border-bottom: 0; }
.checklist-head { display: grid; grid-template-columns: 24px minmax(0, 1fr) auto; align-items: flex-start; gap: 16px; padding: 20px; }
.checklist-state { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; border: 1.5px dashed var(--gray-300); color: transparent; }
.checklist-state .icon { width: 14px; height: 14px; }
.checklist-row.is-done .checklist-state { border: 0; background: var(--success-fill); color: #fff; }
.checklist-row.is-warn .checklist-state { border: 0; background: var(--warning-bg); color: var(--warning); }
.checklist-title { font-size: 15px; font-weight: 600; line-height: 22px; }
.checklist-summary { font-size: 13px; line-height: 18px; color: var(--text-3); margin-top: 2px; }
.checklist-body { display: none; padding: 0 20px 20px 60px; }
.checklist-row.is-open .checklist-body { display: block; }
.checklist-row.is-open .checklist-head [data-checklist-toggle] { visibility: hidden; }
.checklist-body-foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }
@media (max-width: 640px) { .checklist-body { padding-left: 20px; } }

/* ------------------------------------------------------------------ C-split-view (L-2) and .record (L-3 / L-4) */
.split-view { display: grid; grid-template-columns: minmax(300px, 400px) minmax(0, 1fr); height: calc(100dvh - var(--topbar-h, 56px)); min-height: 0; }
.split-view:has(> .split-rail) { grid-template-columns: 200px minmax(300px, 400px) minmax(0, 1fr); }
.split-view:has(> .split-context) { grid-template-columns: minmax(300px, 400px) minmax(0, 1fr) 320px; }
.split-view:has(> .split-rail):has(> .split-context) { grid-template-columns: 200px minmax(300px, 400px) minmax(0, 1fr) 320px; }
.split-rail, .split-list, .split-detail, .split-context { min-width: 0; min-height: 0; overflow-y: auto; }
.split-rail, .split-list { border-right: 1px solid var(--border); }
.split-context { border-left: 1px solid var(--border); padding: 20px; }
.split-rail { padding: 12px; }
.split-detail { padding: 24px 32px; }
.split-list-head { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; gap: 8px; padding: 12px 16px; background: var(--surface); border-bottom: 1px solid var(--border); }
.split-row { position: relative; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 2px 12px; align-items: start; min-height: 64px; padding: 12px 16px 12px 20px; border-bottom: 1px solid var(--border-subtle); color: inherit; transition: background var(--t-fast); }
.split-row:hover { background: var(--hover); }
.split-row.is-selected, .split-row[aria-current="true"] { background: var(--indigo-50); box-shadow: inset 2px 0 0 var(--primary); }
.split-row.is-unread::before { content: ""; position: absolute; left: 7px; top: 22px; width: 6px; height: 6px; border-radius: 50%; background: var(--primary); }
.split-row > .avatar, .split-row > .list-icon { grid-row: span 2; }
.split-row .t { font-weight: 600; font-size: 13.5px; line-height: 20px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.split-row .p { grid-column: 2 / -1; font-size: 13px; line-height: 18px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.split-row .w { font-size: 12px; color: var(--text-3); white-space: nowrap; }
@media (max-width: 1023px) { .split-view, .split-view:has(> .split-rail), .split-view:has(> .split-context) { grid-template-columns: minmax(0, 1fr); } .split-rail, .split-context { display: none; } .split-view .split-detail { display: none; } .split-view.is-detail .split-list { display: none; } .split-view.is-detail .split-detail { display: block; padding: 16px; } }
.record { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 24px; align-items: start; }
.record:has(> .record-side-left) { grid-template-columns: 340px minmax(0, 1fr); }
.record-main { min-width: 0; display: flex; flex-direction: column; gap: 24px; }
.record-side, .record-side-left { min-width: 0; position: sticky; top: calc(var(--topbar-h, 56px) + 24px); display: flex; flex-direction: column; gap: 24px; }
@media (max-width: 1023px) { .record, .record:has(> .record-side-left) { grid-template-columns: minmax(0, 1fr); } .record-side, .record-side-left { position: static; order: -1; } }

/* ------------------------------------------------------------------ C-composer (notes, email, call, task on records) */
.composer { border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); box-shadow: var(--shadow-xs); transition: box-shadow var(--t-fast), border-color var(--t-fast); }
.composer:focus-within { border-color: var(--indigo-300); box-shadow: var(--focus-ring); }
.composer-tabs { display: flex; gap: 2px; padding: 6px 8px 0; }
.composer-tabs button { height: 28px; padding: 0 10px; border: 0; border-radius: 6px; background: none; font-size: 13px; font-weight: 500; color: var(--text-3); display: inline-flex; align-items: center; gap: 6px; }
.composer-tabs button:hover { color: var(--text); background: var(--hover); }
.composer-tabs button[aria-selected="true"] { color: var(--primary-text); background: var(--indigo-50); font-weight: 600; }
.composer-tabs .icon { width: 14px; height: 14px; }
.composer-collapsed { display: flex; align-items: center; width: 100%; height: 40px; padding: 0 14px; border: 0; background: none; font-size: 14px; color: var(--text-4); text-align: left; cursor: text; }
.composer-body { display: none; padding: 12px 14px; flex-direction: column; gap: 12px; }
.composer-body .textarea, .composer-body .input { box-shadow: none; }
.composer-body textarea.textarea { border: 0; padding: 0; min-height: 80px; resize: none; }
.composer-body textarea.textarea:focus { box-shadow: none; }
.composer-foot { display: none; align-items: center; gap: 8px; padding: 8px 8px 8px 14px; border-top: 1px solid var(--border); }
.composer-foot .hint { font-size: 12px; color: var(--text-3); margin-right: auto; }
.composer.is-open .composer-collapsed { display: none; }
.composer.is-open .composer-body { display: flex; }
.composer.is-open .composer-foot { display: flex; }

/* ------------------------------------------------------------------ C-gallery (template and section libraries) */
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 24px 16px; }
.gallery-card { position: relative; display: flex; flex-direction: column; gap: 8px; min-width: 0; color: inherit; cursor: pointer; }
.gallery-thumb { position: relative; aspect-ratio: 3 / 4; border: 1px solid var(--border); border-radius: 8px; background: var(--gray-50) center top / cover no-repeat; overflow: hidden; transition: box-shadow var(--t), border-color var(--t); }
.gallery-thumb img { width: 100%; height: 100%; object-fit: cover; object-position: top; }
.gallery.is-sections .gallery-thumb, .gallery-thumb.is-wide { aspect-ratio: 16 / 9; }
.gallery-card:hover .gallery-thumb { box-shadow: var(--shadow-md); border-color: var(--border-strong); }
.gallery-actions { position: absolute; inset: auto 8px 8px 8px; display: flex; gap: 6px; justify-content: center; opacity: 0; transform: translateY(4px); transition: opacity var(--t-fast), transform var(--t-fast); }
.gallery-card:hover .gallery-actions, .gallery-card:focus-within .gallery-actions { opacity: 1; transform: none; }
.gallery-name { font-size: 13.5px; font-weight: 600; line-height: 20px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gallery-meta { font-size: 12px; color: var(--text-3); margin-top: -6px; }
.gallery-card.is-selected .gallery-thumb, .gallery-card:has(input:checked) .gallery-thumb { box-shadow: 0 0 0 2px var(--primary); border-color: var(--primary); }
.gallery-card input[type="radio"], .gallery-card input[type="checkbox"] { position: absolute; opacity: 0; pointer-events: none; }
@media (hover: none) { .gallery-actions { opacity: 1; transform: none; } }

/* ------------------------------------------------------------------ C-daterange (presets, two calendars, compare; stored in the URL) */
.daterange, .date-range { position: relative; display: inline-flex; }
.daterange-trigger .range-dates { color: var(--text-3); font-weight: 500; }
.daterange .popover { width: auto; max-width: calc(100vw - 24px); padding: 0; top: calc(100% + 6px); }
.page-head .daterange .popover, .page-actions .daterange .popover { left: auto; right: 0; }  /* a head control sits at the right edge */
.daterange-body { display: grid; grid-template-columns: 168px auto; }
.daterange-presets { padding: 4px; border-right: 1px solid var(--border); display: flex; flex-direction: column; }
.daterange-presets .menu-item[aria-checked="true"] { background: var(--indigo-50); color: var(--indigo-700); font-weight: 600; }
.daterange-cal { padding: 12px 16px; display: flex; flex-direction: column; gap: 12px; }
.daterange-months { display: flex; gap: 24px; }
.cal { width: 224px; }
.cal-head { display: flex; align-items: center; justify-content: space-between; height: 28px; margin-bottom: 4px; font-size: 13.5px; font-weight: 600; }
.cal-head button { width: 28px; height: 28px; border: 0; border-radius: 6px; background: none; color: var(--text-3); display: grid; place-items: center; }
.cal-head button:hover { background: var(--hover); color: var(--text); }
.cal-head .spacer { width: 28px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 32px); }
.cal-dow { height: 28px; display: grid; place-items: center; font-size: 11.5px; font-weight: 500; color: var(--text-3); }
.cal-day { height: 32px; width: 32px; display: grid; place-items: center; border: 0; background: none; font-size: 13px; color: var(--text); font-variant-numeric: tabular-nums; border-radius: 6px; }
.cal-day:hover { background: var(--hover); }
.cal-day.is-out { visibility: hidden; }
.cal-day.is-today { font-weight: 700; color: var(--primary-text); }
.cal-day.in-range { background: var(--indigo-50); border-radius: 0; }
.cal-day.is-start, .cal-day.is-end { background: var(--primary); color: #fff; border-radius: 6px; font-weight: 600; }
.cal-day:disabled { color: var(--text-4); pointer-events: none; }
.daterange-foot { display: flex; align-items: center; gap: 8px; justify-content: space-between; padding: 12px 16px; border-top: 1px solid var(--border); font-size: 13px; }
.daterange-foot .compare { display: flex; align-items: center; gap: 8px; color: var(--text-3); }
.daterange-foot .compare .select { width: auto; min-height: 28px; padding-top: 3px; padding-bottom: 3px; font-size: 13px; }
@media (max-width: 720px) { .daterange-body { grid-template-columns: 1fr; } .daterange-presets { border-right: 0; border-bottom: 1px solid var(--border); flex-direction: row; flex-wrap: wrap; } .daterange-presets .menu-item { width: auto; } .daterange-months .cal + .cal { display: none; } .daterange-foot { flex-wrap: wrap; } }

/* ------------------------------------------------------------------ C-inline-edit (titles in headers) */
.inline-edit { display: inline-block; max-width: 100%; border-radius: 6px; margin: 0 -6px; padding: 0 6px; cursor: text; transition: background var(--t-fast); }
.inline-edit:hover { background: var(--hover); }
.inline-edit-input { font: inherit; letter-spacing: inherit; color: inherit; line-height: inherit; border: 0; margin: 0 -6px; padding: 0 6px; border-radius: 6px; background: var(--surface); box-shadow: 0 0 0 1px var(--indigo-500), var(--focus-ring); outline: none; min-width: 120px; max-width: 100%; }
.inline-edit.is-saving { opacity: .6; }

/* ------------------------------------------------------------------ one-time code, password strength, reveal */
.otp { display: flex; align-items: center; gap: 8px; justify-content: center; }
.otp-box { flex: 1 1 0; min-width: 0; max-width: 48px; width: 48px; height: 56px; padding: 0; text-align: center; font-size: 22px; font-weight: 600; font-variant-numeric: tabular-nums; border-radius: 10px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); box-shadow: var(--shadow-xs); caret-color: var(--primary); transition: border-color var(--t-fast), box-shadow var(--t-fast); }
.otp-box:hover { border-color: var(--gray-400); }
.otp-box:focus { outline: none; border-color: var(--indigo-500); box-shadow: var(--focus-ring); }
.otp-box.is-filled { border-color: var(--gray-400); }
.otp.is-invalid .otp-box { border-color: var(--danger-fill); }
.otp .otp-sep { width: 8px; height: 2px; border-radius: 2px; background: var(--border-strong); flex: none; }
@media (max-width: 400px) { .otp { gap: 6px; } .otp-box { width: 40px; height: 50px; font-size: 20px; } .otp .otp-sep { width: 6px; } }
.pw-strength { display: flex; flex-direction: column; gap: 8px; }
.pw-strength .bars { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; }
.pw-strength .bars span { height: 4px; border-radius: 4px; background: var(--gray-150); transition: background var(--t); }
.pw-strength[data-score="1"] .bars span:nth-child(-n + 1) { background: var(--danger-fill); }
.pw-strength[data-score="2"] .bars span:nth-child(-n + 2) { background: var(--warning-fill); }
.pw-strength[data-score="3"] .bars span:nth-child(-n + 3) { background: var(--success-fill); }
.pw-strength[data-score="4"] .bars span { background: var(--success-fill); }
.pw-strength .pw-label { font-size: 12.5px; color: var(--text-3); min-height: 18px; }
.pw-rules { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 12.5px; color: var(--text-3); }
.pw-rules li { display: inline-flex; align-items: center; gap: 6px; }
.pw-rules li::before { content: ""; width: 14px; height: 14px; border-radius: 50%; border: 1.5px solid var(--gray-300); box-sizing: border-box; flex: none; }
.pw-rules li.is-met { color: var(--success); }
.pw-rules li.is-met::before { border: 0; background: var(--success-fill) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='white' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4.2 8.4 6.8 11 11.8 5.6'/%3E%3C/svg%3E") center / 10px no-repeat; }
.reveal-btn { position: absolute; right: 3px; width: 32px; height: calc(100% - 6px); display: grid; place-items: center; border: 0; border-radius: 6px; background: none; color: var(--text-4); }
.reveal-btn:hover { color: var(--text-2); background: var(--hover); }

/* ------------------------------------------------------------------ conversations (tickets, threads) */
.convo { display: flex; flex-direction: column; gap: 12px; padding: 16px 20px; }
.msg { border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; background: var(--surface); }
.msg.outbound { background: var(--indigo-25); border-color: var(--indigo-100); margin-left: 40px; }
.msg.inbound { margin-right: 40px; }
.msg.internal { background: var(--warning-bg); border-style: dashed; border-color: var(--warning-border); }
.msg-head { display: flex; gap: 8px; align-items: center; font-size: 13px; margin-bottom: 6px; }
.msg-head .when { margin-left: auto; color: var(--text-3); font-size: 12px; }
.msg-body { font-size: 14px; line-height: 1.6; word-break: break-word; }
.msg-body p { margin: 0 0 .6em; }
.sla-late { color: var(--danger); font-weight: 600; }

/* ------------------------------------------------------------------ charts (static/js/charts.js, §5.7) */
.chart { position: relative; min-width: 0; }
.chart-canvas { width: 100%; min-width: 0; }
.chart .chart-tools { position: absolute; top: -4px; right: -4px; z-index: 2; opacity: 0; transition: opacity var(--t-fast); }
.chart:hover .chart-tools, .chart .chart-tools:focus-visible { opacity: 1; }
@media (hover: none) { .chart .chart-tools { opacity: 1; } }
.chart-empty { height: 100%; min-height: 120px; display: grid; place-items: center; font-size: 13px; color: var(--text-3); }
.chart-meter-bar { display: flex; height: 10px; border-radius: 5px; overflow: hidden; gap: 2px; background: var(--gray-100); }
.chart-meter-bar span { display: block; height: 100%; min-width: 2px; }
.chart-legend { list-style: none; margin: 12px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.chart-legend li { display: grid; grid-template-columns: 10px minmax(0, 1fr) auto 52px; align-items: center; gap: 8px; }
.chart-legend .sw { width: 10px; height: 10px; border-radius: 3px; }
.chart-legend .nm { color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chart-legend .vl { font-variant-numeric: tabular-nums; font-weight: 550; }
.chart-legend .pc { font-variant-numeric: tabular-nums; color: var(--text-3); text-align: right; }

/* ------------------------------------------------------------------ keyboard sheet (?) */
.keys-list { display: grid; grid-template-columns: 1fr auto; gap: 8px 24px; margin: 0; font-size: 13.5px; }
.keys-list dt { color: var(--text-2); }
.keys-list dd { margin: 0; display: flex; gap: 4px; justify-content: flex-end; }
.keys-group { font-size: 12px; font-weight: 600; color: var(--text-3); margin: 16px 0 8px; }
.keys-group:first-child { margin-top: 0; }

/* ------------------------------------------------------------------ phones: never scroll sideways (AG-30) */
@media (max-width: 760px) {
  .page-head { gap: 12px; }
  .page-head .actions { width: 100%; }
  .page-head .actions:has(> .btn-primary:only-child) .btn-primary { flex: 1; }
  .page-head .actions .btn { max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
  .card-header { padding: 12px 16px; }
  .card-body { padding: 16px; }
  .card-header form, .card-header .row-sm { flex-wrap: wrap; }
  .form-grid { grid-template-columns: 1fr !important; }
  .filters > * { flex: 1 1 100%; }
  .filter-bar > .input-group { width: 100%; flex: 1 1 100%; }
  .kv { grid-template-columns: 1fr; gap: 2px 0; }
  .kv dd { margin-bottom: 8px; }
  .kv-rows > dt { padding-bottom: 0; border-bottom: 0; }
  .list-item { padding: 12px 16px; }
  .stat { padding: 14px 16px; }
  .stat-value { font-size: 22px; }
  .tabs { gap: 20px; -webkit-mask-image: linear-gradient(90deg, #000 85%, transparent); mask-image: linear-gradient(90deg, #000 85%, transparent); }
  .prop { grid-template-columns: 110px minmax(0, 1fr); }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; } }
/* touch: every small control gets an invisible 44 px hit area (no visual change) */
@media (pointer: coarse) {
  .btn::before, .icon-button::before, .page-btn::before, .modal-close::before, .filter-pill .x::before, .tab::before, .reveal-btn::before { content: ""; position: absolute; left: 50%; top: 50%; width: max(100%, 44px); height: max(100%, 44px); transform: translate(-50%, -50%); }
  .page-btn, .modal-close, .filter-pill .x { position: relative; }
  .check, .check-card { min-height: 44px; }
  input[type="checkbox"], input[type="radio"] { width: 20px; height: 20px; background-size: 14px; }
}

/* Turbo progress bar */
.turbo-progress-bar { height: 2px; background: var(--primary); }

/* a menu opened from script (app.js closes every .menu.open on click) */
.dz-float-menu { display: block; }

/* an input after the group's icon always leaves room for it (sizes like .input-sm set their own padding) */
.input-group > .icon ~ .input { padding-left: 32px; }

/* ------------------------------------------------------------------ peek drawer (DAASS.peek, [data-peek])
   Head: [‹ back] title (the page's <title>) · [open full page ⤢] [×]; a 2 px indigo bar runs under the head while the
   next page loads; the body fades between pages; the first load shows a skeleton shaped like a record page. */
.peek .drawer-head { position: relative; gap: 4px; min-height: 56px; padding: 10px 12px 10px 20px; }
.peek .drawer-head:has(.peek-back:not([hidden])) { padding-left: 12px; }
.peek .drawer-head .drawer-title { margin-left: 4px; font-size: 16px; line-height: 24px; font-weight: 600; letter-spacing: -.01em; }
.peek .peek-full { color: var(--text-3); }
.peek .peek-full kbd { display: none; }
.peek .drawer-head::after { content: ""; position: absolute; left: 0; bottom: -1px; height: 2px; width: 0; background: var(--primary); opacity: 0; }
.peek.is-busy .drawer-head::after { opacity: 1; animation: peek-progress 1.4s var(--ease-out) forwards; }
@keyframes peek-progress { 0% { width: 0; } 40% { width: 55%; } 100% { width: 88%; } }
.peek .peek-body { padding: 20px 24px 32px; gap: 20px; transition: opacity var(--t) var(--ease); }
.peek .peek-body.is-loading { opacity: .5; pointer-events: none; }
.peek .peek-body.is-entering { animation: peek-in 220ms var(--ease-out); }
@keyframes peek-in { from { opacity: 0; transform: translateY(4px); } }
.peek .peek-body .page-head { padding: 0; margin: 0; border: 0; min-height: 0; }
.peek .peek-body .page-head h1, .peek .peek-body .page-head .page-back { display: none; }
.peek .peek-body .page-head:not(:has(.page-meta, .actions)) { display: none; }
.peek .peek-body .page-head:not(:has(.page-meta)) { justify-content: flex-end; }
.peek .peek-body .page-head .actions .btn { height: var(--h-sm); padding: 0 10px; font-size: 13px; }
.peek .peek-body > .page-head + .tabs { margin-top: -4px; }
.peek .peek-body .page { padding: 0; }
.peek-error { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 4px; padding: 48px 16px; color: var(--text-3); font-size: 13.5px; }
.peek-error h3 { color: var(--text); font-size: 14.5px; }
.peek-error .row { margin-top: 12px; justify-content: center; }
.peek-skeleton { display: flex; flex-direction: column; gap: 14px; }
.peek-skeleton .sk-title { height: 20px; width: 40%; }
.peek-skeleton .sk-line { height: 12px; width: 70%; }
.peek-skeleton .sk-row { display: flex; gap: 12px; align-items: center; }
.peek-skeleton .sk-avatar { width: 40px; height: 40px; border-radius: 50%; flex: none; }
.peek-skeleton .sk-block { height: 140px; border-radius: var(--radius-lg); }
@media (min-width: 640px) { .peek .peek-full kbd { display: inline-flex; } }

/* ------------------------------------------------------------------ L-6 settings sub-navigation (promoted, Wave 3)
   <div class="subnav-layout"><nav class="subnav" aria-label="Settings"><a class="active" aria-current="page">…</a>…</nav>
   <div class="subnav-body">…</div></div> — a sticky 200 px list left of a ≤ 880 px column; a select on phones. */
.subnav-layout { display: grid; grid-template-columns: 200px minmax(0, 880px); gap: 32px; align-items: start; }
.subnav { position: sticky; top: calc(var(--topbar-h, 56px) + 24px); display: flex; flex-direction: column; gap: 2px; }
.subnav-label { padding: 12px 10px 4px; font-size: 12px; font-weight: 500; color: var(--text-3); }
.subnav-label:first-child { padding-top: 0; }
.subnav a { display: flex; align-items: center; gap: 8px; height: 32px; padding: 0 10px; border-radius: 6px; font-size: 13.5px; font-weight: 500; color: var(--text-2); transition: background var(--t-fast), color var(--t-fast); }
.subnav a .icon { color: var(--text-4); }
.subnav a:hover { background: var(--hover); color: var(--text); }
.subnav a.active, .subnav a[aria-current="page"] { background: var(--indigo-50); color: var(--indigo-700); font-weight: 600; }
.subnav a.active .icon, .subnav a[aria-current="page"] .icon { color: var(--indigo-600); }
.subnav-select { display: none; }
@media (max-width: 900px) { .subnav-layout { grid-template-columns: minmax(0, 1fr); gap: 16px; } .subnav { display: none; } .subnav-select { display: block; max-width: 320px; } }

/* ------------------------------------------------------------------ kbd combos and the shortcuts sheet */
.keys { display: inline-flex; align-items: center; gap: 3px; white-space: nowrap; }
.keys .then { font-size: 11px; color: var(--text-4); margin: 0 1px; }
#keys-sheet .modal-body { columns: 2 240px; column-gap: 40px; }
#keys-sheet .keys-block { break-inside: avoid; margin-bottom: 16px; }
#keys-sheet .keys-group { margin-top: 0; }

/* ------------------------------------------------------------------ world map (static/js/worldmap.js, data-module="world-map") */
.world-map { position: relative; min-width: 0; min-height: 240px; background: var(--surface); overflow: hidden; }
.world-map-canvas { position: absolute; inset: 0; }
.world-map.is-loading::before { content: ""; position: absolute; inset: 16px; border-radius: var(--radius); background: linear-gradient(90deg, var(--gray-75) 25%, var(--gray-50) 45%, var(--gray-75) 65%); background-size: 300% 100%; animation: wm-shimmer 1.4s ease-in-out infinite; animation-delay: .3s; opacity: .7; }
@keyframes wm-shimmer { from { background-position: 100% 0; } to { background-position: 0 0; } }
.world-map-empty { position: absolute; left: 50%; bottom: 16px; transform: translateX(-50%); padding: 4px 10px; border-radius: 999px; background: rgba(255, 255, 255, .92); box-shadow: 0 0 0 1px var(--border); font-size: 12.5px; color: var(--text-3); white-space: nowrap; pointer-events: none; }
.world-map-controls { position: absolute; top: 12px; right: 12px; display: flex; flex-direction: column; gap: 0; border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-sm), 0 0 0 1px var(--border); overflow: hidden; z-index: 2; }
.world-map-btn { display: grid; place-items: center; width: 28px; height: 28px; border: 0; background: none; color: var(--text-2); cursor: pointer; transition: background var(--t-fast), color var(--t-fast); }
.world-map-btn + .world-map-btn { border-top: 1px solid var(--border); }
.world-map-btn:hover { background: var(--hover); color: var(--text); }
.world-map-btn:focus-visible { outline: none; box-shadow: inset var(--focus-ring); }
.world-map-btn[hidden] { display: none; }
.wm-tip { min-width: 120px; max-width: 240px; white-space: normal; }
.wm-tip-t { font-weight: 600; font-size: 13px; line-height: 18px; color: var(--text); }
.wm-tip-v { margin-top: 2px; font-size: 12.5px; line-height: 18px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.wm-tip-d { margin-top: 2px; font-size: 12px; line-height: 16px; color: var(--text-3); }
@media (prefers-reduced-motion: reduce) { .world-map.is-loading::before { animation: none; } }
