/* Aurora shell: faint aurora backdrop, flush timeline sidebar, one inset white panel.
   Linear-grade details: hairline rings, 6–12px radii, low layered shadows, 160ms ease-out.
   Spacing, radius and height come ONLY from the scales below. Comfortable density only. */

@import url('https://fonts.googleapis.com/css2?family=Inter:opsz,wght@14..32,400..700&display=swap');

:root {
  color-scheme: light;

  /* colour: cool neutrals + one blue accent */
  --base: #EDF0F5;
  --surface: #FFFFFF;
  --ink: #141926;
  --ink-2: #3D4454;
  --ink-3: #5F6778;
  --ink-4: #8F96A3;
  --brand: #4470DE;
  --brand-ink: #2F58C4;
  --brand-deep: #3A63D2;
  --brand-grad: linear-gradient(180deg, #4A75E0 0%, #3D67D6 100%);
  --brand-tint: rgba(68, 112, 222, 0.10);
  --teal: #2E9E97;
  --ok: #17603F;      --ok-bg: rgba(46, 158, 120, 0.12);
  --warn: #7A4E08;    --warn-bg: rgba(214, 150, 40, 0.14);
  --danger: #A12F45;  --danger-bg: rgba(216, 70, 92, 0.10);
  --info: #2F58C4;    --info-bg: rgba(68, 112, 222, 0.10);
  --neutral: #3D4454; --neutral-bg: rgba(16, 24, 40, 0.06);
  --alert: #D8465C;

  /* neutral fills on white / on the backdrop */
  --fill: rgba(16, 24, 40, 0.04);
  --fill-2: rgba(16, 24, 40, 0.07);
  --side-hover: rgba(16, 24, 40, 0.045);

  /* glass (kept for .glass; the frame itself is solid) */
  --glass-top: rgba(255, 255, 255, 0.72);
  --glass-bottom: rgba(255, 255, 255, 0.58);
  --glass-fill: rgba(255, 255, 255, 0.6);
  --glass-hover: var(--fill);
  --glass-edge: rgba(255, 255, 255, 0.8);
  --blur: blur(20px) saturate(150%);
  --rim: inset 0 0 0 1px var(--glass-edge);

  /* strokes + shadows: a 1px ring carries the edge, blur carries depth */
  --stroke: rgba(16, 24, 40, 0.08);
  --stroke-2: rgba(16, 24, 40, 0.13);
  --track: rgba(16, 24, 40, 0.12);
  --shadow-xs: 0 1px 2px rgba(16, 24, 40, 0.05);
  --shadow-sm: 0 0 0 1px rgba(16, 24, 40, 0.08), 0 1px 2px rgba(16, 24, 40, 0.06);
  --shadow: 0 0 0 1px rgba(16, 24, 40, 0.06), 0 1px 2px rgba(16, 24, 40, 0.04), 0 4px 16px -8px rgba(16, 24, 40, 0.08);
  --shadow-pop: 0 0 0 1px rgba(16, 24, 40, 0.08), 0 4px 8px -2px rgba(16, 24, 40, 0.06), 0 16px 32px -8px rgba(16, 24, 40, 0.14);
  --shadow-float: 0 0 0 1px rgba(16, 24, 40, 0.08), 0 8px 16px -4px rgba(16, 24, 40, 0.08), 0 32px 64px -16px rgba(16, 24, 40, 0.2);
  --shadow-brand: 0 0 0 1px #3159C8, inset 0 1px 0 rgba(255, 255, 255, 0.14), 0 1px 2px rgba(16, 24, 40, 0.16);
  --ring: 0 0 0 3px rgba(68, 112, 222, 0.18);

  /* spacing scale: the only values used for padding / margin / gap */
  --s-1: 4px; --s-2: 8px; --s-3: 12px; --s-4: 16px;
  --s-5: 20px; --s-6: 24px; --s-8: 32px; --s-10: 40px;

  /* radius scale: nested radius < container radius; pill only for dots and avatars */
  --r-1: 6px; --r-2: 8px; --r-3: 10px; --r-4: 12px; --r-pill: 999px;

  /* control heights */
  --h-sm: 32px;     /* small buttons, segmented items, chips, pager */
  --h-md: 36px;     /* default buttons, inputs, search */
  --h-nav: 34px;    /* sidebar rows */
  --h-group: 48px;  /* sidebar module headers, user row */
  --h-row: 44px;    /* table rows (minimum) */
  --h-top: 52px;    /* top bar */

  /* layout */
  --side-w: 248px;
  --rail-w: 64px;
  --gutter: var(--s-2);
  --page-max: none;

  --font: 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --ease: cubic-bezier(.23, 1, .32, 1);
  --ease-drawer: cubic-bezier(.32, .72, 0, 1);
  --dur: .16s;
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scrollbar-width: thin; scrollbar-color: rgba(16, 24, 40, 0.22) transparent; }
html, body { margin: 0; }
body {
  font: 400 14px/1.5 var(--font);
  color: var(--ink);
  background: var(--base);
  caret-color: var(--brand-deep);
  -webkit-font-smoothing: antialiased;
  min-height: 100dvh;
}
::selection { background: rgba(68, 112, 222, 0.2); color: var(--ink); }
h1, h2, h3, p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
button { background: none; border: 0; padding: 0; cursor: pointer; }
a { color: inherit; text-underline-offset: 0.2em; }
svg.lucide { flex: none; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.no-anim *, .no-anim *::before, .no-anim *::after { transition: none !important; }

/* ---------- aurora backdrop: two faint static washes ---------- */
.aurora { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; background: var(--base); }
.aurora .blob { position: absolute; border-radius: 50%; filter: blur(80px); }
.aurora .b1 { width: 64vmax; height: 50vmax; left: -22vmax; top: -26vmax; background: radial-gradient(closest-side, rgba(84, 124, 228, 0.2), rgba(84, 124, 228, 0)); }
.aurora .b2 { width: 58vmax; height: 46vmax; right: -20vmax; bottom: -26vmax; background: radial-gradient(closest-side, rgba(104, 128, 206, 0.14), rgba(104, 128, 206, 0)); }

/* ---------- surfaces ---------- */
.glass {
  background: linear-gradient(180deg, var(--glass-top), var(--glass-bottom));
  -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
  box-shadow: var(--rim), var(--shadow);
}
.panel { background: var(--surface); border-radius: var(--r-4); box-shadow: var(--shadow); overflow: clip; }
.panel-head, .panel-foot { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); flex-wrap: wrap; padding: var(--s-4) var(--s-5); }
.panel-head { border-bottom: 1px solid var(--stroke); }
.panel-foot { border-top: 1px solid var(--stroke); font-size: 13px; font-weight: 500; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.panel-head h2 { font-size: 15px; line-height: 24px; font-weight: 650; letter-spacing: -0.01em; display: flex; align-items: baseline; gap: var(--s-2); }
.panel-head .count { font-size: 13px; font-weight: 500; color: var(--ink-3); font-variant-numeric: tabular-nums; }

/* ---------- app frame: sidebar flush on the backdrop, page in one inset panel ---------- */
.main {
  position: relative; min-width: 0;
  height: calc(100dvh - var(--gutter) * 2);
  margin: var(--gutter) var(--gutter) var(--gutter) var(--side-w);
  overflow: auto; overscroll-behavior: contain; scrollbar-width: thin;
  background: var(--surface); border-radius: var(--r-4); box-shadow: var(--shadow);
}
.page { padding: var(--s-5) var(--s-6) var(--s-6); }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3) var(--s-6); flex-wrap: wrap; margin-bottom: var(--s-4); }
.page-title { flex: 1 1 320px; min-width: 0; }
.page-title h1 { font-size: 22px; line-height: 28px; font-weight: 650; letter-spacing: -0.02em; text-wrap: balance; overflow-wrap: anywhere; }
.page-desc { margin-top: var(--s-1); max-width: 72ch; font-size: 14px; line-height: 22px; color: var(--ink-3); text-wrap: pretty; }
.page-actions { display: flex; gap: var(--s-2); flex-wrap: wrap; }

/* ---------- sidebar ---------- */
.sidebar {
  position: fixed; top: 0; bottom: 0; left: 0; z-index: 40;
  width: var(--side-w);
  display: flex; flex-direction: column;
}
.side-head { flex: none; display: flex; align-items: center; justify-content: space-between; gap: var(--s-2); height: var(--h-top); margin-top: var(--gutter); padding: 0 var(--s-2) 0 var(--s-5); }
.side-head img { display: block; height: 24px; width: auto; }
.side-head .logo-mark { display: none; }
.side-head .close-btn { display: none; }
.side-scroll {
  flex: 1; min-height: 0; overflow: hidden auto; overscroll-behavior: contain; scrollbar-width: none;
  padding: var(--s-2) var(--s-2) var(--s-4) var(--s-3);
  mask-image: linear-gradient(to bottom, transparent 0, #000 var(--s-2), #000 calc(100% - var(--s-4)), transparent 100%);
}
.nav-list, .tl, .sub { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.side-label { margin: var(--s-5) 0 var(--s-1); padding: 0 var(--s-2); font-size: 12px; line-height: 20px; font-weight: 600; color: var(--ink-4); }

/* nav rows */
.pill {
  position: relative;
  display: flex; align-items: center; gap: var(--s-3);
  height: var(--h-nav); padding: 0 var(--s-3);
  border-radius: var(--r-2);
  color: var(--ink-2); text-decoration: none;
  font-size: 13.5px; font-weight: 500;
  transition: background-color var(--dur), color var(--dur);
}
.pill > svg { width: 16px; height: 16px; color: var(--ink-3); transition: color var(--dur); }
.pill .lbl { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pill:hover { background: var(--side-hover); color: var(--ink); }
.pill:active { background: var(--fill-2); }
.pill:focus-visible { outline-offset: -2px; }
.pill[aria-current="page"] { color: var(--brand-ink); font-weight: 600; background: var(--brand-tint); }
.pill[aria-current="page"] > svg { color: var(--brand); }
/* pinned rows share the module grid: same 28px icon box, label on the module label line */
.nav-list.pinned .pill { padding-left: var(--s-2); }
.nav-list.pinned .pill > svg { width: 28px; height: 28px; padding: 6px; border-radius: var(--r-1); color: var(--g); background: color-mix(in srgb, var(--g) 10%, #fff); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--g) 20%, transparent); }
.nav-list.pinned .pill[aria-current="page"] > svg { background: color-mix(in srgb, var(--g) 18%, #fff); }
.badge {
  flex: none; min-width: 20px; height: 20px; padding: 0 var(--s-1); border-radius: var(--r-1);
  display: inline-grid; place-items: center;
  font-size: 12px; line-height: 1; font-weight: 600; font-variant-numeric: tabular-nums;
  color: var(--ink-3); background: var(--fill-2);
}
.badge.hot { color: var(--brand-ink); background: var(--brand-tint); }

/* module cards: flat rows until opened, the open one is a white card */
.groups { display: flex; flex-direction: column; gap: 2px; }
.gcard { border-radius: var(--r-3); transition: background-color var(--dur), box-shadow var(--dur); }
.gcard:not(.open):hover { background: var(--side-hover); }
.gcard.open { background: var(--surface); box-shadow: var(--shadow-sm); }
.gcard-h { display: flex; align-items: center; gap: var(--s-3); width: 100%; height: var(--h-group); padding: 0 var(--s-3) 0 var(--s-2); border-radius: var(--r-3); text-align: left; }
.gcard-h:focus-visible { outline-offset: -2px; }
.gicon {
  flex: none; width: 28px; height: 28px; border-radius: var(--r-1);
  display: grid; place-items: center; color: var(--g);
  background: color-mix(in srgb, var(--g) 10%, #fff); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--g) 20%, transparent);
}
.gicon svg { width: 15px; height: 15px; }
.gcard.has-active .gicon { background: color-mix(in srgb, var(--g) 18%, #fff); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--g) 32%, transparent); }
/* inside a module, the current page, section and timeline take the module colour */
.gcard .pill[aria-current="page"] { color: color-mix(in srgb, var(--g) 78%, #000); background: color-mix(in srgb, var(--g) 11%, transparent); }
.gcard .pill[aria-current="page"] > svg { color: var(--g); }
.gtext { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.glabel { font-size: 13.5px; line-height: 18px; font-weight: 600; color: var(--ink); }
.gmeta { font-size: 12px; line-height: 16px; font-weight: 500; color: var(--ink-4); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gcard.has-active:not(.open) .gmeta { color: var(--ink-3); }
.chev { width: 16px; height: 16px; color: var(--ink-4); transition: transform .24s var(--ease); }
[aria-expanded="true"] > .chev { transform: rotate(180deg); }

/* disclosure body: height snaps, content fades in (opacity + transform only) */
.collapse > * { transition: opacity .2s var(--ease), transform .2s var(--ease); }
@starting-style { .collapse > * { opacity: 0; transform: translateY(-4px); } }
.gbody { padding: 0 var(--s-2) var(--s-2); }

/* timeline: 1px rail under the module icon's centre, a node per section */
.tl { gap: 0; }
.tl > li {
  --node-y: calc(var(--h-nav) / 2);
  position: relative; padding-left: calc(var(--s-8) - var(--s-1));
  background: linear-gradient(var(--track), var(--track)) 14px 0 / 1px 100% no-repeat;
}
.tl > li:not(:last-child) { padding-bottom: 2px; }
.tl > li:first-child { background-position: 14px var(--node-y); background-size: 1px calc(100% - var(--node-y)); }
.tl > li:last-child { background-size: 1px var(--node-y); }
.tl > li:only-child { background: none; }
.tl > li::before, .tl > li::after {
  content: ""; position: absolute; left: 14px; width: 1px;
  background: var(--g, var(--brand));
  transform: scaleY(0); transform-origin: top;
  transition: transform .32s var(--ease) calc(var(--i, 0) * 80ms);
}
.tl > li::before { top: 0; height: var(--node-y); }
.tl > li::after { top: var(--node-y); bottom: 0; transition-delay: calc(var(--i, 0) * 80ms + 40ms); }
.tl > li:first-child::before, .tl > li:last-child::after { display: none; }
.tl > li.passed::before, .tl > li.passed::after, .tl > li.current::before { transform: scaleY(1); }
.tl-node {
  position: absolute; left: 10px; top: calc(var(--node-y) - 4.5px); z-index: 1;
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--surface); box-shadow: inset 0 0 0 1.5px var(--ink-4), 0 0 0 3px var(--surface);
}
.tl > li.open-sec > .tl-node { box-shadow: inset 0 0 0 1.5px var(--ink-3), 0 0 0 3px var(--surface); }
.tl > li.passed > .tl-node { box-shadow: inset 0 0 0 1.5px var(--g, var(--brand)), 0 0 0 3px var(--surface); }
.tl > li.current > .tl-node { background: var(--g, var(--brand)); box-shadow: 0 0 0 3px var(--surface); }
.tl-h {
  display: flex; align-items: center; gap: var(--s-3);
  width: 100%; height: var(--h-nav); padding: 0 var(--s-1) 0 var(--s-3);
  border-radius: var(--r-2); text-align: left;
  font-size: 13.5px; font-weight: 500; color: var(--ink-2);
  transition: background-color var(--dur), color var(--dur);
}
.tl-h > svg:first-child { width: 16px; height: 16px; color: var(--ink-3); }
.tl-h .lbl { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tl-h .cnt { font-size: 12px; font-weight: 500; color: var(--ink-4); font-variant-numeric: tabular-nums; }
.tl-h:hover, .tl-h[aria-expanded="true"] { color: var(--ink); }
.tl-h:hover { background: var(--fill); }
.tl > li.current > .tl-h { color: var(--ink); font-weight: 600; }
.tl > li.current > .tl-h > svg:first-child { color: var(--g, var(--brand)); }
/* nested pages: one 28px step per level; a child's icon sits under its parent's label,
   and every row (and its highlight) starts 12px before its own icon */
.sub { padding: 2px 0 var(--s-1) calc(var(--s-8) - var(--s-1)); }
.sub .pill { padding: 0 var(--s-1) 0 var(--s-3); }
.sub .pill > svg { color: var(--ink-4); }

/* footer user row + menu */
.side-foot { flex: none; padding: var(--s-2) var(--s-2) var(--s-3) var(--s-3); }
.user {
  display: flex; align-items: center; gap: var(--s-3);
  width: 100%; height: var(--h-group); padding: 0 var(--s-2);
  border-radius: var(--r-3); text-align: left;
  transition: background-color var(--dur);
}
.user:hover, .user[aria-expanded="true"] { background: var(--side-hover); }
.user:focus-visible { outline-offset: -2px; }
.user .av { width: 28px; height: 28px; font-size: 11px; font-weight: 600; background: #E4E8EF; color: var(--ink-2); }
.who { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.who .name { font-size: 13.5px; line-height: 18px; font-weight: 600; }
.who .mail { font-size: 12px; line-height: 16px; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu {
  position: fixed; inset: auto; margin: 0; border: 0; padding: var(--s-1); border-radius: var(--r-3);
  color: var(--ink); min-width: 220px; overflow: visible;
  background: var(--surface); box-shadow: var(--shadow-pop); transform-origin: bottom left;
}
.menu:popover-open { animation: au-pop .16s var(--ease); }
@keyframes au-pop { from { opacity: 0; transform: translateY(4px) scale(.98); } }
.menu button { display: flex; align-items: center; gap: var(--s-3); width: 100%; height: var(--h-nav); padding: 0 var(--s-3); border-radius: var(--r-1); font-size: 13.5px; font-weight: 500; color: var(--ink-2); text-align: left; transition: background-color var(--dur), color var(--dur); }
.menu button:hover { background: var(--fill); color: var(--ink); }
.menu button:active { background: var(--fill-2); }
.menu button svg { width: 16px; height: 16px; color: var(--ink-3); }
.menu hr { border: 0; border-top: 1px solid var(--stroke); margin: var(--s-1) calc(var(--s-1) * -1); }

.scrim { display: none; }

/* ---------- top bar: sticky inside the panel ---------- */
.top {
  position: sticky; top: 0; z-index: 10; flex: none;
  display: flex; align-items: center; gap: var(--s-2);
  height: var(--h-top); padding: 0 var(--s-3) 0 var(--s-2);
  background: rgba(255, 255, 255, 0.9);
  -webkit-backdrop-filter: blur(12px) saturate(150%); backdrop-filter: blur(12px) saturate(150%);
  border-bottom: 1px solid var(--stroke);
}
.top .nav-toggle .i-menu { display: none; }
.crumbs { flex: 1; min-width: 0; }
.crumbs ol { list-style: none; margin: 0; padding: 0; display: flex; align-items: center; gap: var(--s-2); min-width: 0; }
.crumbs li { display: flex; align-items: center; gap: var(--s-2); min-width: 0; font-size: 13.5px; font-weight: 500; color: var(--ink-3); white-space: nowrap; }
.crumbs li span { overflow: hidden; text-overflow: ellipsis; }
.crumbs li[aria-current] { flex: none; }
.crumbs li + li::before { content: ""; flex: none; width: 5px; height: 5px; border-top: 1.5px solid currentColor; border-right: 1.5px solid currentColor; transform: rotate(45deg); opacity: .45; }
.crumbs [aria-current] span { color: var(--ink); font-weight: 600; }
.top-actions { flex: none; display: flex; align-items: center; gap: var(--s-1); }
.top-slot { display: contents; }
.dot { position: relative; }
.dot::after { content: ""; position: absolute; top: var(--s-2); right: var(--s-2); width: 7px; height: 7px; border-radius: 50%; background: var(--alert); box-shadow: 0 0 0 2px var(--surface); }

/* ---------- controls ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2);
  height: var(--h-md); padding: 0 var(--s-3);
  border-radius: var(--r-2);
  font-size: 13.5px; font-weight: 550; white-space: nowrap; color: var(--ink-2); text-decoration: none;
  transition: transform .16s var(--ease), background-color var(--dur), color var(--dur), box-shadow var(--dur);
}
.btn svg { width: 16px; height: 16px; }
.btn:hover { background: var(--fill); color: var(--ink); }
.btn:active { transform: scale(.97); }
.btn.ghost { color: var(--ink); background: var(--surface); box-shadow: var(--shadow-sm); }
.btn.ghost:hover { background: #F8F9FB; }
.btn.primary { color: #fff; background: var(--brand-grad); box-shadow: var(--shadow-brand); }
.btn.primary:hover { background: linear-gradient(180deg, #416DDB 0%, #3560CF 100%); color: #fff; }
.btn.primary:focus-visible { outline-color: var(--brand); }
.btn.icon { width: var(--h-md); padding: 0; }
.btn.icon svg { width: 16px; height: 16px; }
.btn.sm { height: var(--h-sm); padding: 0 var(--s-3); font-size: 13px; }
.btn.icon.sm { width: var(--h-sm); padding: 0; }
.btn[aria-current="page"], .btn[aria-pressed="true"] { background: var(--fill-2); color: var(--ink); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .45; cursor: not-allowed; transform: none; }

.seg { display: inline-flex; gap: 2px; padding: 2px; border-radius: var(--r-2); background: var(--fill-2); }
.seg button { height: var(--h-sm); padding: 0 var(--s-3); border-radius: var(--r-1); font-size: 13px; font-weight: 550; color: var(--ink-3); transition: background-color var(--dur), color var(--dur), box-shadow var(--dur); }
.seg button:hover { color: var(--ink); }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); }
.seg button:disabled { opacity: .45; cursor: not-allowed; }

.input, .search {
  height: var(--h-md); border-radius: var(--r-2);
  background: var(--surface); box-shadow: inset 0 0 0 1px var(--stroke-2);
  transition: box-shadow var(--dur), background-color var(--dur);
}
.input { width: 100%; padding: 0 var(--s-3); border: 0; font-size: 13.5px; color: var(--ink); }
.input::placeholder, .search input::placeholder { color: var(--ink-4); opacity: 1; }
.input:hover, .search:hover { box-shadow: inset 0 0 0 1px rgba(16, 24, 40, 0.2); }
.input:focus, .search:focus-within { outline: 0; box-shadow: inset 0 0 0 1px var(--brand), var(--ring); }
.input:disabled { opacity: .5; cursor: not-allowed; }
.input[aria-invalid="true"] { box-shadow: inset 0 0 0 1px var(--danger); }
.search { display: flex; align-items: center; gap: var(--s-2); width: 240px; padding: 0 var(--s-1) 0 var(--s-3); color: var(--ink-3); cursor: text; }
.search svg { width: 16px; height: 16px; }
.search input { flex: 1; min-width: 0; height: 100%; padding: 0; border: 0; background: none; outline: 0; font-size: 13.5px; color: var(--ink); }
.search input::-webkit-search-cancel-button { display: none; }

kbd {
  display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 var(--s-1);
  border-radius: 5px;
  font: 500 12px/1 var(--font); color: var(--ink-3);
  background: var(--surface); box-shadow: inset 0 0 0 1px var(--stroke-2), inset 0 -1px 0 var(--stroke-2);
}

.chip {
  display: inline-flex; align-items: center; gap: var(--s-2);
  height: var(--h-sm); padding: 0 var(--s-3); border-radius: var(--r-2);
  font-size: 13px; font-weight: 500; color: var(--ink-2); white-space: nowrap;
  background: var(--surface); box-shadow: inset 0 0 0 1px var(--stroke-2);
  transition: background-color var(--dur), color var(--dur);
}
.chip svg { width: 14px; height: 14px; }
button.chip:hover { background: #F8F9FB; color: var(--ink); }
.chip[aria-pressed="true"] { color: var(--ink); background: var(--fill-2); }

/* status: coloured dot + plain text (colour never fills the chip) */
.status {
  display: inline-flex; align-items: center; gap: var(--s-2);
  font-size: 13px; line-height: 18px; font-weight: 500; white-space: nowrap;
  color: var(--ink-2);
}
.status::before { content: ""; flex: none; width: 7px; height: 7px; border-radius: 50%; background: var(--dot, var(--ink-4)); }
.status.ok { --dot: #3AA37E; }
.status.warn { --dot: #D9A441; }
.status.danger { --dot: var(--alert); }
.status.info { --dot: var(--brand); }
.status.neutral { --dot: var(--ink-4); }

.av {
  flex: none; width: 28px; height: 28px; border-radius: 50%;
  display: grid; place-items: center;
  font-size: 11px; font-weight: 600; letter-spacing: .02em; color: var(--ink-2);
  background: #E4E8EF;
}
.av.sm { width: 24px; height: 24px; font-size: 10px; }
/* people colours: soft tint + deep ink, picked by a stable hash */
.av.h0 { background: #E3ECFF; color: #2F55C8; } .av.h1 { background: #DCF3EA; color: #137A5A; }
.av.h2 { background: #FFEBD9; color: #B45A12; } .av.h3 { background: #EFE6FF; color: #6D3FC0; }
.av.h4 { background: #FFE3EC; color: #B3325D; } .av.h5 { background: #DDF0F8; color: #146C94; }
.av.h6 { background: #FFF1C7; color: #8A6A05; } .av.h7 { background: #E7EAF0; color: #3D4454; }

/* ---------- table ---------- */
.table-wrap { overflow: auto; scrollbar-width: thin; }
.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; font-variant-numeric: tabular-nums; }
.table th {
  position: sticky; top: 0; z-index: 1;
  height: var(--h-md); padding: 0 var(--s-5); text-align: left; white-space: nowrap;
  font-size: 12px; line-height: 16px; font-weight: 550; color: var(--ink-3);
  background: var(--surface); border-bottom: 1px solid var(--stroke);
}
.table td { height: var(--h-row); padding: var(--s-2) var(--s-5); vertical-align: middle; border-bottom: 1px solid var(--stroke); }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background-color var(--dur); }
.table tbody tr:hover { background: #FAFBFC; }
.table .num { text-align: right; }

/* ---------- ≤ 1180: search collapses to an icon, expands over the bar while focused ---------- */
@media (max-width: 1180px) {
  .search { width: var(--h-md); padding: 0; gap: 0; justify-content: center; cursor: pointer; color: var(--ink-2); background: none; box-shadow: none; }
  .search:hover { background: var(--fill); box-shadow: none; }
  .search input { flex: 0 0 0; width: 0; opacity: 0; }
  .search kbd { display: none; }
  .search:focus-within {
    position: absolute; z-index: 2; right: var(--s-3); left: calc(var(--s-3) * 2 + var(--h-md));
    width: auto; padding: 0 var(--s-3); gap: var(--s-2); justify-content: flex-start; cursor: text;
    background: var(--surface);
  }
  .search:focus-within input { flex: 1; width: auto; opacity: 1; }
}

/* ---------- desktop rail (toggle in the top bar) ---------- */
@media (min-width: 901px) {
  .app.rail .sidebar { width: var(--rail-w); }
  .app.rail .main { margin-left: var(--rail-w); }
  .app.rail .side-head { justify-content: center; padding: 0; }
  .app.rail .side-head .logo-full { display: none; }
  .app.rail .side-head .logo-mark { display: block; }
  .app.rail .side-scroll { padding-left: var(--s-2); }
  .app.rail .pill, .app.rail .gcard-h, .app.rail .user { justify-content: center; padding: 0; }
  .app.rail .pill .lbl, .app.rail .gtext, .app.rail .gcard-h .chev, .app.rail .who, .app.rail .user .chev {
    position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap;
  }
  .app.rail .badge { position: absolute; top: var(--s-1); right: var(--s-2); min-width: 0; width: 8px; height: 8px; padding: 0; border-radius: 50%; font-size: 0; background: var(--brand); box-shadow: 0 0 0 2px var(--base); }
  .app.rail .side-label { height: 1px; margin: var(--s-3) var(--s-3); padding: 0; overflow: hidden; color: transparent; background: var(--stroke-2); }
  .app.rail .collapse { display: none; }
  .app.rail .gcard.open { background: none; box-shadow: none; }
}

/* ---------- ≤ 900: sidebar becomes a slide-in drawer ---------- */
@media (max-width: 900px) {
  .sidebar {
    top: var(--gutter); bottom: var(--gutter); left: var(--gutter);
    width: min(300px, calc(100vw - var(--gutter) * 2));
    border-radius: var(--r-4); background: #F6F7F9;
    transform: translateX(calc(-100% - var(--gutter) * 2));
    transition: transform .4s var(--ease-drawer);
  }
  .side-head { margin-top: 0; }
  .app.drawer-open .sidebar { transform: none; box-shadow: var(--shadow-float); }
  .scrim {
    display: block; position: fixed; inset: 0; z-index: 30;
    background: rgba(16, 24, 40, 0.24);
    opacity: 0; pointer-events: none; transition: opacity .3s var(--ease);
  }
  .app.drawer-open .scrim { opacity: 1; pointer-events: auto; }
  .side-head .close-btn { display: inline-flex; }
  .top .nav-toggle .i-rail { display: none; }
  .top .nav-toggle .i-menu { display: block; }
  .main { margin: var(--gutter); }
}

/* ---------- ≤ 640: phone, the panel fills the screen ---------- */
@media (max-width: 640px) {
  .main { margin: 0; height: 100dvh; border-radius: 0; box-shadow: none; }
  .top { gap: var(--s-1); }
  .crumbs li:not(:last-child) { display: none; }
  .crumbs li:last-child::before { display: none; }
  .top .btn:has(.lbl) { width: var(--h-md); padding: 0; }
  .top .btn .lbl { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .top .btn .lbl ~ svg { display: none; }
  .page { padding: var(--s-4); }
  .page-title h1 { font-size: 20px; line-height: 28px; }
  .page-actions { width: 100%; }
  .page-actions .btn { flex: 1; }
  .panel-head, .panel-foot { padding: var(--s-4); }
  .table th, .table td { padding: var(--s-3) var(--s-4); }
  .hide-sm { display: none; }
}

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

/* ---------- AI: one violet, only for machine suggestions; people always confirm ----------
   .ai-mark  ✦ label ("✦ Suggested", "✦ Pre-review")      .ai-card  suggestion panel
   .ai-chip  inline suggestion/interpretation token          .ai-shimmer  thinking state (opacity only) */
:root { --ai: #6E56CF; --ai-ink: #5B45B8; --ai-bg: #F6F3FF; --ai-line: rgba(110, 86, 207, 0.22); }
.ai-mark { display: inline-flex; align-items: center; gap: var(--s-1); font-size: 12px; font-weight: 600; color: var(--ai-ink); white-space: nowrap; }
.ai-mark svg { width: 14px; height: 14px; color: var(--ai); }
.ai-card { border-radius: var(--r-3); background: var(--ai-bg); box-shadow: inset 0 0 0 1px var(--ai-line); padding: var(--s-3) var(--s-4); }
.ai-chip { display: inline-flex; align-items: center; gap: var(--s-1); height: 24px; padding: 0 var(--s-2); border-radius: var(--r-1); font-size: 12.5px; font-weight: 500; color: var(--ink); background: var(--surface); box-shadow: inset 0 0 0 1px var(--ai-line); white-space: nowrap; }
.ai-chip .k { color: var(--ink-3); font-weight: 500; }
.btn.ai { color: var(--ai-ink); background: var(--ai-bg); box-shadow: inset 0 0 0 1px var(--ai-line); }
.btn.ai:hover { background: #EFEAFF; color: var(--ai-ink); }
.ai-shimmer { animation: ai-think 1.1s ease-in-out infinite alternate; }
@keyframes ai-think { from { opacity: 1; } to { opacity: .45; } }
@media (prefers-reduced-motion: reduce) { .ai-shimmer { animation: none; } }
