/* ==========================================================================
   Moniic Relay — components & layout (v2 · "liquid glass")
   Requires tokens.css. No inline styles anywhere; state via classes / [hidden]
   / aria-* attributes only. Glass = translucent fill + backdrop blur/saturate
   + 1px rim + top highlight + sheen + layered shadow. Dense text sits on the
   more opaque --glass-strong. Solid fallbacks live in tokens.css.
   ========================================================================== */

/* ---- Base --------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; background: linear-gradient(160deg, var(--bg-a), var(--bg-b)) fixed, var(--bg-b); }   /* p3a1 r2: covers long pages */
body {
  position: relative; min-height: 100vh;
  font-family: var(--font-sans);
  font-size: var(--text-md);
  line-height: var(--lh-md);
  font-weight: var(--weight-regular);
  color: var(--ink);
  background: transparent;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  letter-spacing: -0.003em;
}
/* Ambient: deep base + soft colour blobs. Pure CSS gradients, fixed, no images. */
body::before {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(46vmax 40vmax at 8% 6%, var(--blob-blue), transparent 62%),
    radial-gradient(40vmax 36vmax at 92% 12%, var(--blob-violet), transparent 64%),
    radial-gradient(48vmax 38vmax at 74% 104%, var(--blob-cyan), transparent 62%),
    radial-gradient(34vmax 30vmax at 22% 92%, var(--blob-teal), transparent 64%),
    radial-gradient(30vmax 26vmax at 52% 46%, var(--blob-violet), transparent 70%),
    linear-gradient(160deg, var(--bg-a) 0%, var(--bg-b) 100%);
}
h1, h2, h3, h4, p { margin: 0; }
h1, h2, h3, h4 { font-weight: var(--weight-semibold); letter-spacing: var(--tracking-tight); }
a { color: var(--ink-link); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }
button, input, select, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
button { cursor: pointer; }
svg { display: block; flex: none; }
[hidden] { display: none !important; }
:focus { outline: none; }
:focus-visible { box-shadow: var(--focus-ring); border-radius: var(--radius-sm); }
::selection { background: rgba(124, 77, 255, 0.35); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; }
.phone-num { white-space: nowrap; }   /* p3b5 r3 (UI/UX P3-2): a phone number never breaks across lines */
.mono { font-family: var(--font-mono); font-size: 0.92em; }
.muted { color: var(--ink-3); }
.ink-2 { color: var(--ink-2); }
.nowrap { white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
/* p2c8r3/r4 (UI/UX P2-a, P3-e): the hard 2-line height cap is for list cells only; the case header keeps its 3-line clamp with an ellipsis */
.cell-title.clamp-2, .kcard-link.clamp-2 { line-height: 22px; max-height: calc(2 * 22px); }
.cell-reason { font-size: 0.92em; margin-top: 2px; }

.ico { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.ico-sm { width: 14px; height: 14px; }
.ico-lg { width: 20px; height: 20px; }

/* ---- Skip link ---------------------------------------------------------- */
.skip { position: absolute; left: 12px; top: -40px; z-index: var(--z-toast); background: var(--glass-modal); color: var(--ink); padding: 8px 12px; border-radius: var(--radius-pill); box-shadow: var(--glass-shadow); }
.skip:focus { top: 12px; }

/* ==========================================================================
   Glass recipe (shared)
   ========================================================================== */
.card, .statusline, .col, .stage, .auth-form {
  background: var(--sheen), var(--glass);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(var(--saturate));
  backdrop-filter: blur(var(--blur)) saturate(var(--saturate));
  border: 1px solid var(--glass-edge);
  box-shadow: inset 0 1px 0 var(--glass-hi), 0 0 0 1px var(--glass-edge-2), var(--glass-shadow);
}
/* Dense text gets a more opaque fill (tables, conversation, side panel) */
.card.dense, .panel {
  background: var(--sheen), var(--glass-strong);
}

/* ==========================================================================
   App shell
   ========================================================================== */
.app { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100vh; }

/* ---- Rail (sidebar): deep navy glass ----------------------------------- */
.rail {
  position: sticky; top: 0; height: 100vh; z-index: calc(var(--z-sticky) + 1);
  display: flex; flex-direction: column;
  background: linear-gradient(180deg, rgba(255,255,255,0.06), rgba(255,255,255,0) 160px), var(--rail-glass);
  -webkit-backdrop-filter: blur(var(--blur-strong)) saturate(180%);
  backdrop-filter: blur(var(--blur-strong)) saturate(180%);
  color: var(--rail-ink);
  padding: var(--space-5) var(--space-3) var(--space-4);
  border-right: 1px solid var(--rail-border);
  box-shadow: inset -1px 0 0 rgba(255,255,255,0.04), 12px 0 40px -24px rgba(5, 10, 40, 0.5);
}
.brand { display: flex; flex-direction: column; align-items: flex-start; gap: 14px; padding: 4px 8px 18px; color: var(--rail-ink); }
.brand-logo { display: block; width: 151px; height: auto; } /* live: .sidebar .wordmark 151px */
.brand-product { display: flex; align-items: baseline; gap: 8px; padding: 6px 12px; border-radius: var(--radius-pill); background: linear-gradient(180deg, rgba(255,255,255,0.12), rgba(255,255,255,0.04)); box-shadow: inset 0 1px 0 rgba(255,255,255,0.16), inset 0 0 0 1px rgba(255,255,255,0.08); }
.brand:hover { text-decoration: none; }
.brand-word { font-family: var(--font-display); font-weight: var(--weight-display); font-size: 18px; line-height: 1; letter-spacing: -0.03em; color: #fff; }
.brand-word .dot { color: #8FB0FF; }
.brand-sub { display: inline; font-family: var(--font-sans); font-size: var(--text-2xs); line-height: 14px; letter-spacing: var(--tracking-overline); text-transform: uppercase; color: var(--rail-ink-2); }

.nav { display: flex; flex-direction: column; gap: 3px; }
.nav-label { font-size: var(--text-2xs); letter-spacing: var(--tracking-overline); text-transform: uppercase; color: var(--rail-ink-2); padding: 16px 12px 6px; font-weight: var(--weight-semibold); }
.nav a {
  position: relative; display: flex; align-items: center; gap: 10px;
  height: 36px; padding: 0 12px; border-radius: var(--radius-pill);
  color: var(--rail-ink-2); font-size: var(--text-sm); font-weight: var(--weight-medium);
  transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease), box-shadow var(--dur) var(--ease), transform var(--dur-fast) var(--ease);
}
.nav a:hover { background: var(--rail-hover); color: var(--rail-ink); text-decoration: none; }
.nav a:active { transform: var(--press); }
.nav a[aria-current="page"] {
  background: var(--gloss-btn), var(--grad-primary); color: #fff;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.28), inset 0 0 0 1px rgba(255,255,255,0.10), var(--glow-primary);
}
.nav a[aria-current="page"] .ico { color: #fff; }
.nav .count { margin-left: auto; font-size: var(--text-2xs); font-weight: var(--weight-bold); min-width: 20px; height: 19px; padding: 0 6px; border-radius: var(--radius-pill); display: inline-grid; place-items: center; background: rgba(255,255,255,0.14); color: var(--rail-ink); box-shadow: inset 0 1px 0 rgba(255,255,255,0.14); }
.nav a[aria-current="page"] .count:not(.hot) { background: rgba(8, 10, 50, 0.40); color: #fff; box-shadow: inset 0 0 0 1px rgba(255,255,255,0.18); }
.nav .count.hot { background: linear-gradient(180deg, #FFB088 0%, #FF7A45 100%); color: #2A0E02; box-shadow: inset 0 1px 0 rgba(255,255,255,0.55), 0 0 0 1px rgba(255,140,90,0.35), 0 0 16px 1px rgba(255,122,69,0.65); }
.nav .soon { margin-left: auto; font-size: 10px; letter-spacing: 0.04em; text-transform: uppercase; color: var(--rail-ink-2); border: 1px solid var(--rail-border); border-radius: var(--radius-pill); padding: 0 7px; line-height: 16px; }
.nav a:focus-visible { box-shadow: 0 0 0 2px #8FB0FF, 0 0 18px rgba(143,176,255,0.5); }

.rail-foot { margin-top: auto; padding-top: var(--space-3); border-top: 1px solid var(--rail-border); display: flex; flex-direction: column; gap: 10px; }
.env { display: flex; align-items: center; gap: 8px; font-size: var(--text-xs); color: var(--rail-ink-2); padding: 0 12px; }
.env .ldot { width: 7px; height: 7px; border-radius: 50%; background: #5AD39E; box-shadow: 0 0 0 3px rgba(90,211,158,0.20), 0 0 10px rgba(90,211,158,0.7); }
.me { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: var(--radius-md); background: rgba(255,255,255,0.05); box-shadow: inset 0 0 0 1px rgba(255,255,255,0.06); }
.me .who { display: flex; flex-direction: column; line-height: 16px; min-width: 0; flex: 1; }
.me .who b { font-size: var(--text-sm); font-weight: var(--weight-semibold); color: #fff; }
.me .who span { font-size: var(--text-xs); color: var(--rail-ink-2); }
.me .btn-ghost { color: var(--rail-ink-2); }
.me .btn-ghost:hover { background: rgba(255,255,255,0.10); color: #fff; }

/* ---- Main column -------------------------------------------------------- */
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: var(--z-sticky);
  height: var(--topbar-h); display: flex; align-items: center; gap: var(--space-3);
  padding: 0 var(--space-7);
  background: var(--glass-bar);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(var(--saturate));
  backdrop-filter: blur(var(--blur)) saturate(var(--saturate));
  border-bottom: 1px solid var(--border);
  box-shadow: inset 0 -1px 0 var(--glass-hi);
}
.search-trigger {
  min-width: 0; flex: 0 1 auto;
  display: flex; align-items: center; gap: 10px; width: min(480px, 100%); height: 38px; padding: 0 8px 0 14px;
  border: 1px solid var(--glass-edge); border-radius: var(--radius-pill); background: var(--sheen), var(--surface);
  color: var(--ink-3); font-size: var(--text-sm); text-align: left;
  box-shadow: inset 0 1px 0 var(--glass-hi), 0 0 0 1px var(--border), 0 6px 18px -10px rgba(16,24,64,0.25);
  transition: box-shadow var(--dur) var(--ease), transform var(--dur-fast) var(--ease);
}
.search-trigger:hover { box-shadow: inset 0 1px 0 var(--glass-hi), 0 0 0 1px var(--border-strong), 0 10px 26px -12px rgba(84,76,255,0.45); }
.search-trigger .grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }   /* p3a1 r5: one line at any width / zoom */
.topbar .spacer { flex: 1; }
.kbd { display: inline-flex; align-items: center; gap: 2px; font-family: var(--font-sans); font-size: var(--text-2xs); font-weight: var(--weight-semibold); color: var(--ink-3); border: 1px solid var(--border); border-bottom-width: 2px; border-radius: var(--radius-xs); padding: 0 6px; line-height: 16px; background: var(--surface-2); }

.conn-chip { display: inline-flex; align-items: center; gap: 8px; height: 34px; padding: 0 14px; border-radius: var(--radius-pill); border: 1px solid var(--glass-edge); background: var(--sheen), var(--surface); font-size: var(--text-xs); color: var(--ink-2); box-shadow: inset 0 1px 0 var(--glass-hi), 0 0 0 1px var(--border); }
.conn-chip:hover { text-decoration: none; box-shadow: inset 0 1px 0 var(--glass-hi), 0 0 0 1px var(--success-line), 0 0 18px -4px rgba(90,211,158,0.45); }
.conn-chip b { color: var(--ink); font-weight: var(--weight-semibold); }

.content { width: 100%; max-width: var(--content-max); margin: 0 auto; padding: var(--space-7) var(--space-7) var(--space-10); }
.content.wide { max-width: none; }

/* ---- Page header -------------------------------------------------------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--space-6); margin-bottom: var(--space-6); }
.overline { font-size: var(--text-2xs); line-height: var(--lh-2xs); letter-spacing: var(--tracking-overline); text-transform: uppercase; font-weight: var(--weight-semibold); color: var(--ink-3); }
.page-title { font-family: var(--font-display); font-weight: var(--weight-display); font-size: var(--text-2xl); line-height: var(--lh-2xl); letter-spacing: var(--tracking-display); margin-top: 4px; }
.page-title.xl { font-size: 40px; line-height: 46px; }
.page-title em { font-style: normal; background: var(--grad-text); -webkit-background-clip: text; background-clip: text; color: transparent; }
.page-sub { color: var(--ink-2); margin-top: 6px; max-width: 680px; }
.crumbs { display: flex; align-items: center; gap: 6px; font-size: var(--text-xs); color: var(--ink-3); }
.crumbs a { color: var(--ink-3); }
.crumbs a:hover { color: var(--ink); }
.crumbs .crumb-copy { width: 24px; height: 24px; margin-left: 2px; color: var(--ink-3); }
.actions { display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; }

/* ==========================================================================
   Primitives
   ========================================================================== */
.row { display: flex; align-items: center; gap: var(--space-2); }
.row.gap-3 { gap: var(--space-3); } .row.gap-4 { gap: var(--space-4); }
.row.between { justify-content: space-between; }
.row.top { align-items: flex-start; }
.row.wrap { flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: var(--space-4); }
.stack.s-1 { gap: var(--space-1); } .stack.s-2 { gap: var(--space-2); } .stack.s-3 { gap: var(--space-3); } .stack.s-6 { gap: var(--space-6); }
.grow { flex: 1; min-width: 0; }
.grid { display: grid; gap: var(--space-4); }
.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-main-side { grid-template-columns: minmax(0, 1fr) 360px; gap: var(--space-5); align-items: start; }
.grid-side-main { grid-template-columns: 200px minmax(0, 1fr); gap: var(--space-5); align-items: start; }
.mt-1 { margin-top: var(--space-1); } .mt-2 { margin-top: var(--space-2); } .mt-3 { margin-top: var(--space-3); } .mt-4 { margin-top: var(--space-4); } .mt-5 { margin-top: var(--space-5); } .mt-6 { margin-top: var(--space-6); }
.mb-4 { margin-bottom: var(--space-4); }

/* ---- Buttons (pills) ---------------------------------------------------- */
.btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 36px; padding: 0 16px; border-radius: var(--radius-pill);
  font-size: var(--text-sm); font-weight: var(--weight-semibold); line-height: 1; white-space: nowrap;
  border: 1px solid transparent; background: none; color: var(--ink);
  transition: background var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease), box-shadow var(--dur) var(--ease), color var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease), filter var(--dur-fast) var(--ease);
}
.btn:hover { text-decoration: none; }
.btn:active:not([disabled]) { transform: var(--press); }
.btn-primary {
  background: var(--gloss-btn), var(--grad-primary); color: #fff;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.30), inset 0 -1px 0 rgba(0,0,0,0.12), 0 0 0 1px rgba(60,50,200,0.25), 0 6px 18px -8px rgba(84,76,255,0.6);
}
.btn-primary:hover { background: var(--gloss-btn), var(--grad-primary-hover); box-shadow: inset 0 1px 0 rgba(255,255,255,0.34), 0 0 0 1px rgba(60,50,200,0.25), var(--glow-primary); transform: var(--lift); }
.btn-primary:focus-visible { box-shadow: var(--focus-ring), var(--glow-primary); }
.btn-secondary { background: var(--sheen), var(--surface); border-color: var(--glass-edge); box-shadow: inset 0 1px 0 var(--glass-hi), 0 0 0 1px var(--border), 0 4px 12px -8px rgba(16,24,64,0.30); }
.btn-secondary:hover { box-shadow: inset 0 1px 0 var(--glass-hi), 0 0 0 1px var(--border-strong), var(--glass-shadow-lift); transform: var(--lift); }
.btn-ghost { color: var(--ink-2); }
.btn-ghost:hover { background: var(--surface-3); color: var(--ink); }
/* Danger stays solid, red and unmistakable in both themes */
.btn-danger { background: var(--gloss-btn), var(--grad-danger); color: #fff; box-shadow: inset 0 1px 0 rgba(255,255,255,0.28), 0 0 0 1px rgba(140,20,12,0.45), 0 6px 18px -8px rgba(210,56,46,0.7); }
.btn-danger:hover { filter: brightness(1.06); box-shadow: inset 0 1px 0 rgba(255,255,255,0.3), 0 0 0 1px rgba(140,20,12,0.45), var(--glow-danger); }
.btn-danger-ghost { color: var(--danger); }
.btn-danger-ghost:hover { background: var(--danger-soft); }
.btn-sm { height: 30px; padding: 0 12px; font-size: var(--text-xs); gap: 6px; }
.btn-lg { height: 44px; padding: 0 22px; font-size: var(--text-md); }
.btn-icon { width: 36px; padding: 0; }
.btn-icon.btn-sm { width: 30px; }
.btn[disabled], .btn[aria-disabled="true"] { cursor: not-allowed; background: var(--surface-3); color: var(--ink-disabled); border-color: transparent; box-shadow: inset 0 0 0 1px var(--border); filter: none; transform: none; }
.btn-block { width: 100%; }

/* ---- Pills: glossy, semantic ------------------------------------------- */
.pill {
  display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 9px;
  border-radius: var(--radius-pill); font-size: var(--text-xs); font-weight: var(--weight-semibold); line-height: 1; white-space: nowrap;
  background: var(--gloss), var(--neutral-soft); color: var(--neutral); border: 1px solid var(--neutral-line);
  box-shadow: var(--gloss-hi), 0 1px 2px rgba(16,24,64,0.06);
}
.pill .d { width: 6px; height: 6px; border-radius: 50%; background: currentColor; box-shadow: 0 0 6px currentColor; }
.pill-success { background: var(--gloss), var(--success-soft); color: var(--success); border-color: var(--success-line); }
.pill-warning, .pill-warn { background: var(--gloss), var(--warning-soft); color: var(--warning); border-color: var(--warning-line); }
.pill-danger { background: var(--gloss), var(--danger-soft); color: var(--danger); border-color: var(--danger-line); }
.pill-info { background: var(--gloss), var(--info-soft); color: var(--info); border-color: var(--info-line); }
.pill-attention { background: var(--gloss), var(--attention-soft); color: var(--attention); border-color: var(--attention-line); }
.pill-test { background: var(--gloss), var(--test-soft); color: var(--test); border-color: var(--test-line); font-size: 10px; letter-spacing: 0.06em; height: 18px; padding: 0 7px; }
.pill-outline { background: transparent; box-shadow: none; }
.pill-sm { height: 19px; font-size: 11px; padding: 0 7px; }
.tag { display: inline-flex; align-items: center; gap: 4px; font-size: var(--text-2xs); font-weight: var(--weight-semibold); letter-spacing: 0.02em; color: var(--ink-3); background: var(--surface-3); border-radius: var(--radius-pill); padding: 1px 8px; line-height: 16px; }
.tag-claim { color: var(--warning); background: var(--gloss), var(--warning-soft); box-shadow: inset 0 0 0 1px var(--warning-line); }
.quiet { display: inline-flex; align-items: center; gap: 4px; font-size: var(--text-xs); color: var(--ink-3); }

/* ---- Avatars ------------------------------------------------------------ */
.avatar { width: 28px; height: 28px; border-radius: 50%; display: inline-grid; place-items: center; font-size: 11px; font-weight: var(--weight-bold); letter-spacing: 0.02em; flex: none; background: var(--surface-3); color: var(--ink-2); box-shadow: inset 0 1px 0 rgba(255,255,255,0.45), 0 0 0 1px rgba(16,24,64,0.06); }
.avatar.lg { width: 56px; height: 56px; font-size: 18px; }
.avatar.md { width: 40px; height: 40px; font-size: 14px; }
.avatar.sm { width: 22px; height: 22px; font-size: 9px; }
.avatar.sq { border-radius: 12px; }
.av-1 { background: linear-gradient(180deg, #E6EDFF, #D3DFFF); color: #1C3FA8; }
.av-2 { background: linear-gradient(180deg, #E8F7EF, #D3F0E1); color: #0B6440; }
.av-3 { background: linear-gradient(180deg, #FFF0DF, #FFE1C2); color: #854600; }
.av-4 { background: linear-gradient(180deg, #F1EAFF, #E3D6FF); color: #5A2FB8; }
.av-5 { background: linear-gradient(180deg, #FFE9EC, #FFD6DC); color: #9E2238; }
.av-6 { background: linear-gradient(180deg, #E1F6F9, #CBEEF3); color: #0B6170; }
.av-none { background: transparent; color: var(--ink-3); box-shadow: inset 0 0 0 1.5px var(--border-strong); }
.av-rail { background: var(--gloss-btn), var(--grad-primary); color: #fff; box-shadow: inset 0 1px 0 rgba(255,255,255,0.35), 0 0 12px -2px rgba(124,77,255,0.6); }
[data-theme="dark"] .avatar { box-shadow: inset 0 1px 0 rgba(255,255,255,0.12), 0 0 0 1px rgba(255,255,255,0.06); }
[data-theme="dark"] .av-1 { background: linear-gradient(180deg, #27397A, #1C2B5E); color: #C4D4FF; }
[data-theme="dark"] .av-2 { background: linear-gradient(180deg, #1A4A38, #123829); color: #9BEBC6; }
[data-theme="dark"] .av-3 { background: linear-gradient(180deg, #4A3416, #3A2810); color: #F8D194; }
[data-theme="dark"] .av-4 { background: linear-gradient(180deg, #3A2A66, #2C1F50); color: #DCCBFF; }
[data-theme="dark"] .av-5 { background: linear-gradient(180deg, #4E2029, #3E1820); color: #FFBEC8; }
[data-theme="dark"] .av-6 { background: linear-gradient(180deg, #16434B, #10343B); color: #9BE4EF; }
[data-theme="dark"] .av-none { background: transparent; box-shadow: inset 0 0 0 1.5px var(--border-strong); }

/* ---- Cards -------------------------------------------------------------- */
.card { border-radius: var(--radius-lg); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); padding: var(--space-4) var(--space-5); border-bottom: 1px solid var(--divider); min-height: 58px; }
.card-head.flat { border-bottom: 0; padding-bottom: 0; min-height: 0; padding-top: var(--space-5); }
.card-title { font-size: var(--text-md); font-weight: var(--weight-semibold); }
.card-sub { font-size: var(--text-xs); color: var(--ink-3); margin-top: 2px; }
.card-body { padding: var(--space-5); }
.card-body.tight { padding: var(--space-2) var(--space-5); }
.card-body.flush { padding: 0; }
.card-foot { padding: var(--space-3) var(--space-5); border-top: 1px solid var(--divider); display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); font-size: var(--text-xs); color: var(--ink-3); }
.card.sunken { background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--border); -webkit-backdrop-filter: none; backdrop-filter: none; }
a.card { transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease); }
a.card:hover { text-decoration: none; transform: var(--lift); box-shadow: inset 0 1px 0 var(--glass-hi), var(--glass-shadow-lift); }

/* Attention cards (Overview) */
.attn { display: flex; flex-direction: column; gap: var(--space-3); padding: var(--space-5); position: relative; overflow: hidden; }
.attn::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--neutral-line); }
.attn.is-attention::before { background: var(--attention); }
.attn.is-warning::before { background: var(--warning); }
.attn.is-info::before { background: var(--info); }
.attn-top { display: flex; align-items: center; justify-content: space-between; }
.attn-label { font-size: var(--text-sm); font-weight: var(--weight-semibold); color: var(--ink-2); display: flex; align-items: center; gap: 8px; }
.attn-label .ico { color: var(--ink-3); }
.is-attention .attn-label .ico { color: var(--attention); }
.is-warning .attn-label .ico { color: var(--warning); }
.big { font-family: var(--font-display); font-weight: var(--weight-display); font-size: 40px; line-height: 44px; letter-spacing: var(--tracking-display); font-variant-numeric: lining-nums tabular-nums; }
.big small { font-family: var(--font-sans); font-size: var(--text-sm); color: var(--ink-3); letter-spacing: 0; margin-left: 6px; }
.attn-list { display: flex; flex-direction: column; border-top: 1px solid var(--divider); margin: 0 calc(var(--space-5) * -1) calc(var(--space-5) * -1); }
.attn-list a { display: flex; align-items: center; gap: 10px; padding: 10px var(--space-5); color: var(--ink); font-size: var(--text-sm); border-bottom: 1px solid var(--divider); }
.attn-list a:last-child { border-bottom: 0; }
.attn-list a:hover { background: var(--surface-3); text-decoration: none; }
.attn-list .meta { margin-left: auto; color: var(--ink-3); font-size: var(--text-xs); white-space: nowrap; }

/* ---- Status line (single honest line) ----------------------------------- */
.statusline { display: flex; align-items: center; gap: 0; flex-wrap: wrap; border-radius: var(--radius-pill); padding: 8px 8px 8px 6px; font-size: var(--text-sm); }
.statusline .item { display: flex; align-items: center; gap: 8px; padding: 2px 16px; border-right: 1px solid var(--divider); color: var(--ink-2); }
.statusline .item:last-of-type { border-right: 0; }
.statusline .item b { color: var(--ink); font-weight: var(--weight-semibold); }
.statusline .end { margin-left: auto; }
.sdot { width: 8px; height: 8px; border-radius: 50%; background: var(--neutral); flex: none; }
.sdot.ok { background: var(--success); box-shadow: 0 0 0 3px var(--success-soft), 0 0 10px var(--success); }
.sdot.warn { background: var(--warning); box-shadow: 0 0 0 3px var(--warning-soft), 0 0 10px var(--warning); }
.sdot.bad { background: var(--danger); box-shadow: 0 0 0 3px var(--danger-soft), 0 0 10px var(--danger); }
.sdot.test { background: var(--test); box-shadow: 0 0 0 3px var(--test-soft), 0 0 10px var(--test); }
.sdot.off { background: var(--ink-disabled); }

/* ---- Banners & callouts ------------------------------------------------- */
.banner { display: flex; gap: 12px; align-items: flex-start; padding: 12px 16px; border-radius: var(--radius-md); border: 1px solid var(--info-line); background: var(--gloss), var(--info-soft); color: var(--ink); font-size: var(--text-sm); box-shadow: var(--gloss-hi); }
.banner .ico { margin-top: 2px; color: var(--info); }
.banner b { font-weight: var(--weight-semibold); }
.banner p + p { margin-top: 2px; }
.banner .sub { color: var(--ink-2); }
.banner-warning { border-color: var(--warning-line); background: var(--gloss), var(--warning-soft); }
.banner-warning .ico { color: var(--warning); }
.banner-danger { border-color: var(--danger-line); background: var(--gloss), var(--danger-soft); }
.banner-danger .ico { color: var(--danger); }
.banner-success { border-color: var(--success-line); background: var(--gloss), var(--success-soft); }
.banner-success .ico { color: var(--success); }
.banner-neutral { border-color: var(--border); background: var(--gloss), var(--surface); }
.banner-neutral .ico { color: var(--ink-3); }
[data-theme="dark"] .banner-neutral { background: var(--gloss), rgba(255,255,255,0.05); }

/* Scope banner — the one thing you must not miss before a real write.
   The TEST stripe is drawn on an opaque base so glass never washes it out. */
.scope {
  display: grid; grid-template-columns: auto 1fr auto; gap: 14px; align-items: center;
  padding: 14px 16px; border-radius: var(--radius-md);
  background: repeating-linear-gradient(135deg, var(--test-soft) 0 12px, transparent 12px 24px), var(--glass-solid);
  border: 1px solid var(--test-line); color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--test-line);
}
[data-theme="dark"] .scope { background: repeating-linear-gradient(135deg, rgba(176,140,255,0.22) 0 12px, rgba(176,140,255,0.07) 12px 24px), #120F2E; }
.scope-ico { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; background: var(--gloss-btn), var(--test); color: #fff; box-shadow: inset 0 1px 0 rgba(255,255,255,0.3), 0 0 16px -4px var(--test); }
[data-theme="dark"] .scope-ico { color: #1B0D3A; }
.scope-title { font-weight: var(--weight-semibold); font-size: var(--text-md); }
.scope-sub { font-size: var(--text-xs); color: var(--ink-2); margin-top: 2px; }

/* ---- Definition lists --------------------------------------------------- */
.dl { display: grid; grid-template-columns: 132px 1fr; gap: 10px 16px; font-size: var(--text-sm); }
.dl dt { color: var(--ink-3); }
.dl dd { margin: 0; color: var(--ink); font-weight: var(--weight-medium); min-width: 0; }
.dl.compact { grid-template-columns: 110px 1fr; gap: 8px 12px; }
.kv { display: flex; flex-direction: column; gap: 2px; }
.kv .k { font-size: var(--text-xs); color: var(--ink-3); }
.kv .v { font-size: var(--text-sm); font-weight: var(--weight-semibold); }
/* p2b3: <dl class="kv"> (dt/dd) as a label/value grid; stacks on narrow screens */
dl.kv { display: grid; grid-template-columns: minmax(120px, max-content) 1fr; gap: 8px 16px; margin: 0; }
dl.kv dt { font-size: var(--text-xs); color: var(--ink-3); align-self: center; }
dl.kv dd { margin: 0; font-size: var(--text-sm); font-weight: var(--weight-semibold); color: var(--ink); min-width: 0; overflow-wrap: anywhere; }
@media (max-width: 520px) { dl.kv { grid-template-columns: 1fr; gap: 2px; } dl.kv dd { margin-bottom: 8px; } }
/* p2b3: wide tables scroll inside their card instead of the page (390 px) */
.table-wrap { position: relative; width: 100%; max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table-wrap > .table { min-width: 560px; }

/* ---- Tables (on --glass-strong) ----------------------------------------- */
.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: var(--text-sm); }
.table th { text-align: left; font-size: var(--text-xs); font-weight: var(--weight-semibold); color: var(--ink-3); background: var(--surface-2); padding: 10px 16px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table th:first-child { border-top-left-radius: var(--radius-lg); padding-left: 20px; }
.table th:last-child { border-top-right-radius: var(--radius-lg); padding-right: 20px; }
.table td { padding: 12px 16px; border-bottom: 1px solid var(--divider); vertical-align: middle; }
.table td:first-child { padding-left: 20px; }
.table td:last-child { padding-right: 20px; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background var(--dur-fast) var(--ease); }
.table tbody tr.clickable { cursor: pointer; }
.table tbody tr.clickable:hover { background: var(--surface-3); }
.table tbody tr.is-attention td:first-child { box-shadow: inset 3px 0 0 var(--attention); }
.table .r { text-align: right; }
.cell-title { font-weight: var(--weight-semibold); color: var(--ink); }
.cell-sub { font-size: var(--text-xs); color: var(--ink-3); margin-top: 2px; }
.table a.cell-title { color: var(--ink); }

/* ---- Tabs (glass pill track) -------------------------------------------- */
.tabs { display: flex; gap: 4px; margin-bottom: var(--space-5); overflow-x: auto; padding: 4px; border-radius: var(--radius-pill); background: var(--sheen), var(--glass); -webkit-backdrop-filter: blur(var(--blur)) saturate(var(--saturate)); backdrop-filter: blur(var(--blur)) saturate(var(--saturate)); border: 1px solid var(--glass-edge); box-shadow: inset 0 1px 0 var(--glass-hi), 0 0 0 1px var(--glass-edge-2); width: max-content; max-width: 100%; }
.tabs a { display: inline-flex; align-items: center; gap: 8px; height: 34px; padding: 0 14px; color: var(--ink-2); font-size: var(--text-sm); font-weight: var(--weight-medium); border-radius: var(--radius-pill); white-space: nowrap; transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease), box-shadow var(--dur) var(--ease); }
.tabs a:hover { color: var(--ink); text-decoration: none; background: var(--surface-2); }
.tabs a[aria-selected="true"] { color: var(--ink); font-weight: var(--weight-semibold); background: var(--sheen), var(--glass-strong); box-shadow: inset 0 1px 0 var(--glass-hi), 0 0 0 1px var(--glass-edge), 0 4px 14px -6px rgba(16,24,64,0.30); }
.tabs .tcount { font-size: var(--text-2xs); background: var(--surface-3); color: var(--ink-2); border-radius: var(--radius-pill); padding: 0 7px; line-height: 16px; }
.tabs .tcount.warn { background: var(--warning-soft); color: var(--warning); }
.tabs .soon { font-size: 10px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--ink-3); border: 1px solid var(--border); border-radius: var(--radius-pill); padding: 0 6px; line-height: 14px; }

/* ---- Segmented control -------------------------------------------------- */
.seg { display: inline-flex; align-items: center; padding: 3px; gap: 2px; background: var(--surface-3); border-radius: var(--radius-pill); box-shadow: inset 0 1px 2px rgba(16,24,64,0.06); }
.seg button { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 12px; border: 0; background: none; border-radius: var(--radius-pill); font-size: var(--text-xs); font-weight: var(--weight-semibold); color: var(--ink-2); transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease), box-shadow var(--dur) var(--ease); }
.seg button[aria-pressed="true"] { background: var(--sheen), var(--glass-strong); color: var(--ink); box-shadow: inset 0 1px 0 var(--glass-hi), 0 0 0 1px var(--glass-edge), 0 3px 10px -4px rgba(16,24,64,0.30); }
.seg button:hover { color: var(--ink); }
.seg-label { font-size: var(--text-2xs); font-weight: var(--weight-semibold); letter-spacing: var(--tracking-overline); text-transform: uppercase; color: var(--ink-3); padding: 0 6px 0 10px; }

/* ---- Filters / chips ---------------------------------------------------- */
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 14px; border-radius: var(--radius-pill); border: 1px solid var(--glass-edge); background: var(--sheen), var(--surface); font-size: var(--text-xs); font-weight: var(--weight-semibold); color: var(--ink-2); box-shadow: inset 0 1px 0 var(--glass-hi), 0 0 0 1px var(--border); transition: box-shadow var(--dur) var(--ease), color var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease); }
.chip:hover { color: var(--ink); box-shadow: inset 0 1px 0 var(--glass-hi), 0 0 0 1px var(--border-strong); }
.chip:active { transform: var(--press); }
.chip[aria-pressed="true"] { background: var(--gloss), var(--accent-soft); color: var(--accent-soft-ink); border-color: var(--accent-line); box-shadow: inset 0 1px 0 var(--glass-hi), 0 0 0 1px var(--accent-line), 0 4px 16px -8px rgba(84,76,255,0.6); }
.chip .n { font-variant-numeric: tabular-nums; color: inherit; font-weight: var(--weight-medium); }
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); margin-bottom: var(--space-4); flex-wrap: wrap; }

/* ---- Forms -------------------------------------------------------------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.label { font-size: var(--text-sm); font-weight: var(--weight-semibold); color: var(--ink); }
.label .opt { font-weight: var(--weight-regular); color: var(--ink-3); }
.help { font-size: var(--text-xs); color: var(--ink-3); }
.err { font-size: var(--text-xs); color: var(--danger); display: flex; gap: 6px; align-items: center; }
.input, .select {
  height: 40px; padding: 0 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--ink);
  font-size: var(--text-md); width: 100%;
  box-shadow: inset 0 1px 2px rgba(16,24,64,0.06);
  transition: border-color var(--dur-fast) var(--ease), box-shadow var(--dur) var(--ease);
}
[data-theme="dark"] .input, [data-theme="dark"] .select { background: rgba(5,9,26,0.45); }
[data-theme="dark"] .select option { background: #0E1530; }
.input::placeholder { color: var(--ink-disabled); }
.input:hover { border-color: var(--ink-3); }
.input:focus-visible, .select:focus-visible { border-color: var(--focus); box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 28%, transparent), 0 0 18px -2px color-mix(in srgb, var(--focus) 45%, transparent); border-radius: var(--radius-sm); }
.input[aria-invalid="true"] { border-color: var(--danger); box-shadow: 0 0 0 3px var(--danger-soft); }
.input[readonly] { background: var(--surface-2); color: var(--ink-2); }
.input-group { position: relative; display: flex; align-items: center; }
.input-group .ico { position: absolute; left: 14px; color: var(--ink-3); pointer-events: none; }
.input-group .input { padding-left: 40px; }
.input-lg { height: 48px; font-size: var(--text-lg); border-radius: var(--radius-md); }
.secret { display: flex; align-items: center; gap: 10px; height: 40px; padding: 0 14px; border-radius: var(--radius-sm); border: 1px dashed var(--border-strong); background: var(--surface-2); color: var(--ink-2); font-size: var(--text-sm); }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: var(--text-sm); }
.check input { width: 16px; height: 16px; margin: 3px 0 0; accent-color: #5B4BF0; }
.switch { position: relative; width: 38px; height: 22px; border-radius: 999px; background: var(--border-strong); border: 0; padding: 0; flex: none; box-shadow: inset 0 1px 2px rgba(0,0,0,0.15); }
.switch::after { content: ""; position: absolute; left: 2px; top: 2px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,0.25); transition: transform var(--dur) var(--ease-spring); }
.switch[aria-checked="true"] { background: linear-gradient(180deg, #34C77F, #0E8F57); }
.switch[aria-checked="true"]::after { transform: translateX(16px); }

/* ---- Lists -------------------------------------------------------------- */
.list { display: flex; flex-direction: column; }
.list-item { display: flex; align-items: center; gap: 12px; padding: 12px var(--space-5); border-bottom: 1px solid var(--divider); color: var(--ink); transition: background var(--dur-fast) var(--ease); }
.list-item:last-child { border-bottom: 0; }
.list-item:hover { background: var(--surface-3); }
a.list-item:hover { text-decoration: none; }
.list-item .meta { margin-left: auto; font-size: var(--text-xs); color: var(--ink-3); white-space: nowrap; }
.li-ico { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; background: var(--gloss), var(--neutral-soft); color: var(--ink-2); flex: none; box-shadow: var(--gloss-hi), inset 0 0 0 1px var(--neutral-line); }
.li-ico.success { background: var(--gloss), var(--success-soft); color: var(--success); box-shadow: var(--gloss-hi), inset 0 0 0 1px var(--success-line); }
.li-ico.warning { background: var(--gloss), var(--warning-soft); color: var(--warning); box-shadow: var(--gloss-hi), inset 0 0 0 1px var(--warning-line); }
.li-ico.danger { background: var(--gloss), var(--danger-soft); color: var(--danger); box-shadow: var(--gloss-hi), inset 0 0 0 1px var(--danger-line); }
.li-ico.info { background: var(--gloss), var(--info-soft); color: var(--info); box-shadow: var(--gloss-hi), inset 0 0 0 1px var(--info-line); }
.li-ico.test { background: var(--gloss), var(--test-soft); color: var(--test); box-shadow: var(--gloss-hi), inset 0 0 0 1px var(--test-line); }
.li-ico.attention { background: var(--gloss), var(--attention-soft); color: var(--attention); box-shadow: var(--gloss-hi), inset 0 0 0 1px var(--attention-line), 0 0 14px -4px var(--attention); }

/* ---- Stacked bar (counts that add up) ----------------------------------- */
.bar { display: flex; height: 12px; border-radius: 999px; overflow: hidden; gap: 3px; background: var(--surface-3); box-shadow: inset 0 1px 2px rgba(16,24,64,0.10); }
.bar span { display: block; height: 100%; border-radius: 999px; box-shadow: inset 0 1px 0 rgba(255,255,255,0.4); }
.bar .b-attention { background: linear-gradient(90deg, #FF9A6B, var(--attention)); }
.bar .b-info { background: linear-gradient(90deg, #6E8DFF, #5B4BF0); }
.bar .b-neutral { background: var(--ink-disabled); }
.bar .b-success { background: var(--success); }
[data-theme="dark"] .bar .b-attention { background: linear-gradient(90deg, #FF7E4F, #FFA27F); }
[data-theme="dark"] .bar .b-info { background: linear-gradient(90deg, #5B7CFF, #9C7BFF); }
.g1 { flex: 1; } .g2 { flex: 2; } .g3 { flex: 3; } .g4 { flex: 4; } .g5 { flex: 5; } .g6 { flex: 6; } .g8 { flex: 8; } .g12 { flex: 12; }
.legend { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 12px; margin-top: 16px; }
.legend .lg { display: flex; flex-direction: column; gap: 2px; padding: 6px 8px 6px 20px; margin: -6px -8px; border-radius: var(--radius-sm); position: relative; color: var(--ink); transition: background var(--dur-fast) var(--ease); }
.legend a.lg:hover { background: var(--surface-3); text-decoration: none; }
.legend .lg::before { content: ""; position: absolute; left: 6px; top: 15px; width: 8px; height: 8px; border-radius: 50%; background: var(--ink-disabled); }
.legend .lg.attention::before { background: var(--attention); box-shadow: 0 0 8px var(--attention); }
.legend .lg.info::before { background: #6E6BFF; box-shadow: 0 0 8px #6E6BFF; }
.legend .lg.success::before { background: var(--success); box-shadow: 0 0 8px var(--success); }
.legend .lg b { font-size: var(--text-xl); line-height: 26px; font-weight: var(--weight-semibold); font-variant-numeric: tabular-nums; }
.legend .lg span { font-size: var(--text-xs); color: var(--ink-3); }
.meter { height: 6px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.meter > span { display: block; height: 100%; background: var(--warning); border-radius: inherit; }
.w-5 { width: 5%; } .w-10 { width: 10%; } .w-20 { width: 20%; } .w-30 { width: 30%; } .w-40 { width: 40%; } .w-50 { width: 50%; } .w-60 { width: 60%; } .w-70 { width: 70%; } .w-80 { width: 80%; } .w-90 { width: 90%; } .w-100 { width: 100%; }
.meter.success > span { background: linear-gradient(90deg, #34C77F, var(--success)); }
.meter.info > span { background: var(--info); }

/* ==========================================================================
   Inbox
   ========================================================================== */
.case-row .title { display: flex; align-items: center; gap: 8px; }
.case-id { font-family: var(--font-mono); font-size: 11.5px; color: var(--ink-3); }
.src { display: inline-flex; align-items: center; gap: 5px; font-size: var(--text-xs); color: var(--ink-2); }
.owner { display: inline-flex; align-items: center; gap: 8px; font-size: var(--text-sm); }
.owner.unassigned { color: var(--ink-3); }

.board { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--space-4); align-items: start; }
.col { border-radius: var(--radius-lg); padding: var(--space-2); min-height: 360px; }
.col-head { display: flex; align-items: center; gap: 8px; padding: 8px 8px 12px; font-size: var(--text-sm); font-weight: var(--weight-semibold); }
.col-head .n { color: var(--ink-3); font-weight: var(--weight-medium); }
.col-head .hint { margin-left: auto; white-space: nowrap; font-size: var(--text-2xs); color: var(--ink-2); font-weight: var(--weight-regular); }
.col.is-attention { background: linear-gradient(180deg, color-mix(in srgb, var(--attention) 9%, transparent), transparent 220px), var(--sheen), var(--glass); border-color: var(--attention-line); }
.kcard {
  position: relative; display: block; background: var(--sheen), var(--glass-strong); border: 1px solid var(--glass-edge); border-radius: var(--radius-md); padding: 12px; color: var(--ink); margin-bottom: 8px;
  box-shadow: inset 0 1px 0 var(--glass-hi), 0 0 0 1px var(--glass-edge-2), 0 4px 14px -8px rgba(16,24,64,0.30);
  transition: box-shadow var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.kcard:hover { transform: var(--lift); box-shadow: inset 0 1px 0 var(--glass-hi), 0 0 0 1px var(--border-strong), var(--glass-shadow-lift); }
.kcard .kt { display: -webkit-box; font-size: var(--text-sm); font-weight: var(--weight-semibold); line-height: 19px; margin: 6px 0 10px; color: var(--ink); }
.kcard-link::after { content: ""; position: absolute; inset: 0; border-radius: inherit; }
.kcard-link:hover { text-decoration: none; }
.kcard-link:focus-visible { box-shadow: none; }
/* rd2: the ring follows the card link only (rule in relay-rd1.css); :focus-within is only the fallback for older browsers */
@supports not selector(:has(*)) { .kcard:focus-within { box-shadow: var(--focus-ring); } }
.kcard .kf { display: flex; align-items: center; gap: 8px; font-size: var(--text-xs); color: var(--ink-3); }
.kcard .kf .grow { min-width: 0; }
.kcard .owner-pick { position: relative; z-index: 2; }
.col-note { font-size: var(--text-2xs); color: var(--ink-3); padding: 6px 8px 2px; text-align: center; }

/* ---- Owner control + menu (Relay-only change) --------------------------- */
.owner-pick { position: relative; display: inline-flex; vertical-align: middle; }
.owner-btn {
  display: inline-flex; align-items: center; gap: 7px; height: 30px; padding: 0 10px 0 4px;
  border-radius: var(--radius-pill); border: 1px solid var(--glass-edge); background: var(--sheen), var(--surface);
  color: var(--ink); font-size: var(--text-sm); font-weight: var(--weight-semibold);
  box-shadow: inset 0 1px 0 var(--glass-hi), 0 0 0 1px var(--border);
  transition: box-shadow var(--dur) var(--ease), transform var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease);
}
.owner-btn:hover { box-shadow: inset 0 1px 0 var(--glass-hi), 0 0 0 1px var(--accent-line), 0 6px 18px -8px rgba(84,76,255,0.55); }
.owner-btn:active { transform: var(--press); }
.owner-btn:focus-visible { box-shadow: var(--focus-ring); border-radius: var(--radius-pill); }
.owner-btn.is-empty { color: var(--ink-2); font-weight: var(--weight-medium); border-style: dashed; border-color: var(--border-strong); }
.owner-btn .chev { color: var(--ink-3); transition: transform var(--dur) var(--ease); }
.owner-btn[aria-expanded="true"] { box-shadow: inset 0 1px 0 var(--glass-hi), 0 0 0 1px var(--accent-line), 0 0 0 4px var(--accent-soft); }
.owner-btn[aria-expanded="true"] .chev { transform: rotate(180deg); }
.owner-pick.row .owner-btn { height: 28px; font-size: var(--text-xs); }
.owner-pick.mini .owner-btn { width: 28px; height: 28px; padding: 0; justify-content: center; }
.owner-pick.mini .owner-btn.is-empty { border-style: dashed; }
.meta-row .owner-meta { display: inline-flex; align-items: center; gap: 8px; }

.menu {
  position: absolute; z-index: var(--z-pop); top: calc(100% + 8px); left: 0; width: 304px;
  background: var(--sheen), var(--glass-modal);
  -webkit-backdrop-filter: blur(var(--blur-strong)) saturate(var(--saturate));
  backdrop-filter: blur(var(--blur-strong)) saturate(var(--saturate));
  border: 1px solid var(--glass-edge); border-radius: var(--radius-md);
  box-shadow: inset 0 1px 0 var(--glass-hi), 0 0 0 1px var(--border), var(--shadow-lg);
  overflow: hidden; transform-origin: top left;
  animation: pop var(--dur) var(--ease-spring);
  color: var(--ink); font-size: var(--text-sm); font-weight: var(--weight-regular); text-align: left;
}
.owner-pick.mini .menu { left: auto; right: -6px; transform-origin: top right; }
.menu-search { display: flex; align-items: center; gap: 8px; height: 44px; padding: 0 14px; border-bottom: 1px solid var(--divider); color: var(--ink-3); }
.menu-search input { flex: 1; min-width: 0; height: 100%; border: 0; background: none; color: var(--ink); font-size: var(--text-sm); }
.menu-search input::placeholder { color: var(--ink-3); }
.menu-search input:focus-visible { box-shadow: none; }
.menu-list { list-style: none; margin: 0; padding: 6px; max-height: 280px; overflow: auto; }
.menu-opt { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: var(--radius-sm); cursor: pointer; transition: background var(--dur-fast) var(--ease); }
.menu-opt[aria-selected="true"] { background: var(--gloss), var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent-line); }
.menu-opt .grow { display: flex; flex-direction: column; line-height: 17px; }
.mo-name { font-weight: var(--weight-semibold); color: var(--ink); }
.mo-you { font-weight: var(--weight-regular); color: var(--ink-2); }
.mo-role { font-size: var(--text-xs); color: var(--ink-3); }
.mo-check { color: var(--accent); display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--accent-soft); }
.menu-opt.unassign { margin-top: 6px; position: relative; }
.menu-opt.unassign::before { content: ""; position: absolute; left: 6px; right: 6px; top: -4px; height: 1px; background: var(--divider); }
.menu-opt.unassign .mo-name { color: var(--ink-2); }
.menu-empty { padding: 14px 10px; color: var(--ink-3); text-align: center; font-size: var(--text-xs); }
.menu-foot { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-top: 1px solid var(--divider); font-size: var(--text-xs); color: var(--ink-3); background: var(--surface-2); }
.pop-lift { position: relative; z-index: 40; }

/* ==========================================================================
   Case detail
   ========================================================================== */
.case-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-6); margin-bottom: var(--space-5); }
.case-title { font-size: 24px; line-height: 32px; font-weight: var(--weight-display); letter-spacing: -0.025em; margin-top: 8px; }
.meta-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; font-size: var(--text-xs); color: var(--ink-3); margin-top: 10px; }
.meta-row .sep { width: 3px; height: 3px; border-radius: 50%; background: var(--border-strong); }

.thread { display: flex; flex-direction: column; gap: 14px; padding: var(--space-5); background:
  radial-gradient(circle at 1px 1px, color-mix(in srgb, var(--ink) 6%, transparent) 1px, transparent 0) 0 0 / 18px 18px, var(--surface-2); }
.day { align-self: center; font-size: var(--text-2xs); font-weight: var(--weight-semibold); letter-spacing: 0.04em; text-transform: uppercase; color: var(--ink-3); background: var(--sheen), var(--glass-modal); border: 1px solid var(--glass-edge); border-radius: var(--radius-pill); padding: 2px 12px; box-shadow: 0 0 0 1px var(--border); }
.msg { max-width: 72%; display: flex; flex-direction: column; gap: 4px; }
.msg.in { align-self: flex-start; }
.msg.out { align-self: flex-end; align-items: flex-end; }
.msg .who { font-size: var(--text-2xs); color: var(--ink-3); display: flex; align-items: center; gap: 6px; padding: 0 4px; }
.bubble { padding: 10px 14px; border-radius: 18px; font-size: var(--text-sm); line-height: 20px; box-shadow: 0 4px 14px -8px rgba(16,24,64,0.35); }
.msg.in .bubble { background: var(--sheen), var(--glass-modal); border: 1px solid var(--glass-edge); border-top-left-radius: 6px; box-shadow: inset 0 1px 0 var(--glass-hi), 0 0 0 1px var(--border), 0 4px 14px -8px rgba(16,24,64,0.35); }
.msg.out .bubble { background: var(--gloss), linear-gradient(135deg, #E2EAFF, #ECE4FF); color: #0E1A33; border-top-right-radius: 6px; box-shadow: inset 0 1px 0 rgba(255,255,255,0.8), 0 0 0 1px rgba(91,75,240,0.16), 0 6px 18px -10px rgba(91,75,240,0.5); }
[data-theme="dark"] .msg.out .bubble { background: var(--gloss), linear-gradient(135deg, rgba(59,107,240,0.42), rgba(124,77,255,0.36)), #141A3E; color: #F2F4FB; box-shadow: inset 0 1px 0 rgba(255,255,255,0.14), 0 0 0 1px rgba(143,174,255,0.22), 0 8px 22px -12px rgba(110,90,255,0.7); }
.bubble .claimbar { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; }
.attach { display: flex; align-items: center; gap: 10px; margin-top: 8px; padding: 8px 10px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); }
.attach .li-ico { width: 28px; height: 28px; }
.sysevent { align-self: center; display: flex; align-items: center; gap: 10px; max-width: 86%; padding: 10px 14px; border-radius: var(--radius-md); background: var(--sheen), var(--glass-modal); border: 1px solid var(--glass-edge); font-size: var(--text-xs); color: var(--ink-2); box-shadow: inset 0 1px 0 var(--glass-hi), 0 0 0 1px var(--border), 0 6px 18px -10px rgba(16,24,64,0.35); }
.sysevent .grow b { color: var(--ink); }
.sysevent.relay-ev { animation: rise var(--dur-slow) var(--ease); }
.sysevent.relay-ev .li-ico { width: 26px; height: 26px; border-radius: 50%; }
.composer-note { display: flex; align-items: center; gap: 10px; padding: 12px var(--space-5); border-top: 1px solid var(--divider); font-size: var(--text-xs); color: var(--ink-3); }

.panel { position: sticky; top: calc(var(--topbar-h) + var(--space-5)); }
.panel-sec { padding: var(--space-4) var(--space-5); border-bottom: 1px solid var(--divider); }
.panel-sec:last-child { border-bottom: 0; }
.panel-sec h4 { font-size: var(--text-xs); color: var(--ink-3); font-weight: var(--weight-semibold); text-transform: uppercase; letter-spacing: var(--tracking-overline); margin-bottom: 10px; }
.linked { display: flex; gap: 12px; align-items: center; }
.link-proof { display: flex; align-items: center; gap: 6px; font-size: var(--text-xs); color: var(--success); margin-top: 10px; }
.mini-docs { display: flex; flex-direction: column; gap: 8px; }
.mini-docs .md { display: flex; align-items: center; gap: 8px; font-size: var(--text-sm); }
.mini-docs .md .grow { color: var(--ink); }

/* ==========================================================================
   Entity hubs (chauffeur / partner)
   ========================================================================== */
.hub-head { display: flex; align-items: center; gap: var(--space-5); padding: var(--space-6); }
.hub-name { font-family: var(--font-display); font-weight: var(--weight-display); font-size: 28px; line-height: 34px; letter-spacing: var(--tracking-display); display: flex; align-items: center; gap: 10px; }
.hub-meta { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-top: 8px; font-size: var(--text-sm); color: var(--ink-2); }
.hub-meta span { display: inline-flex; align-items: center; gap: 6px; }
.hub-stats { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); border-top: 1px solid var(--divider); }
.hub-stats .hs { padding: 14px var(--space-6); border-right: 1px solid var(--divider); }
.hub-stats .hs:last-child { border-right: 0; }
.hub-stats .k { font-size: var(--text-xs); color: var(--ink-3); display: flex; align-items: center; gap: 6px; }
.hub-stats .v { margin-top: 4px; display: flex; align-items: center; gap: 8px; font-weight: var(--weight-semibold); }
.hub-stats .note { font-size: var(--text-2xs); color: var(--ink-3); margin-top: 2px; }
.hub-head .avatar.lg { box-shadow: inset 0 1px 0 rgba(255,255,255,0.6), 0 0 0 4px var(--surface-2), 0 10px 24px -10px rgba(59,107,240,0.6); }

.doc-row td:first-child { width: 36%; }
.expiry-bad { color: var(--danger); font-weight: var(--weight-semibold); }
.expiry-warn { color: var(--warning); font-weight: var(--weight-semibold); }
.expiry-missing { color: var(--ink-3); font-style: italic; }

.timeline { position: relative; padding-left: 28px; }
.timeline::before { content: ""; position: absolute; left: 9px; top: 6px; bottom: 6px; width: 2px; border-radius: 2px; background: linear-gradient(180deg, var(--accent-line), var(--divider)); }
.tl { position: relative; padding-bottom: 22px; }
.tl:last-child { padding-bottom: 0; }
.tl .node { position: absolute; left: -28px; top: 1px; width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; background: var(--glass-solid); border: 2px solid var(--border-strong); }
.tl .node.success { border-color: var(--success); color: var(--success); box-shadow: 0 0 10px -2px var(--success); }
.tl .node.warning { border-color: var(--warning); color: var(--warning); }
.tl .node.danger { border-color: var(--danger); color: var(--danger); }
.tl .node.info { border-color: var(--info); color: var(--info); }
.tl .node .ico { width: 10px; height: 10px; stroke-width: 3; }
.tl .tl-title { font-size: var(--text-sm); font-weight: var(--weight-semibold); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tl .tl-sub { font-size: var(--text-xs); color: var(--ink-3); margin-top: 2px; }

.car-visual { height: 132px; border-radius: var(--radius-md); background: radial-gradient(120% 120% at 20% 0%, color-mix(in srgb, var(--blue-500) 18%, transparent), transparent 60%), radial-gradient(100% 100% at 100% 100%, color-mix(in srgb, var(--violet-500) 16%, transparent), transparent 60%), var(--surface-2); display: grid; place-items: center; color: var(--ink-3); border: 1px solid var(--border); }
.car-visual svg { width: 76px; height: 76px; stroke-width: 1.2; }
.plate { display: inline-flex; align-items: center; gap: 8px; font-family: var(--font-mono); font-weight: 600; font-size: var(--text-sm); border: 1.5px solid var(--ink); border-radius: 8px; padding: 2px 8px; letter-spacing: 0.06em; background: var(--surface); }
.plate small { font-family: var(--font-sans); font-size: 9px; letter-spacing: 0.08em; color: var(--ink-3); }

.stars { display: inline-flex; gap: 2px; color: #E0A100; }
.stars .ico { width: 14px; height: 14px; fill: currentColor; stroke: none; }
.dist { display: grid; grid-template-columns: 26px 1fr 34px; gap: 8px 10px; align-items: center; font-size: var(--text-xs); color: var(--ink-3); }

/* Lookup */
.lookup { padding: var(--space-6); }
.lookup .row .input-group { flex: 1; }
.state-demo { display: inline-flex; gap: 6px; align-items: center; font-size: var(--text-xs); color: var(--ink-3); }
.result-card { border: 1px solid var(--glass-edge); border-radius: var(--radius-md); padding: var(--space-4); background: var(--sheen), var(--glass-strong); display: flex; gap: 14px; align-items: center; color: var(--ink); box-shadow: inset 0 1px 0 var(--glass-hi), 0 0 0 1px var(--border); transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease); }
.result-card + .result-card { margin-top: 8px; }
.result-card:hover { text-decoration: none; transform: var(--lift); box-shadow: inset 0 1px 0 var(--glass-hi), 0 0 0 1px var(--border-strong), var(--glass-shadow-lift); }

/* ==========================================================================
   Onboarding pipeline
   ========================================================================== */
.pipeline { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(208px, 1fr); gap: var(--space-3); overflow-x: auto; padding-bottom: var(--space-3); }
.stage { border-radius: var(--radius-lg); padding: var(--space-2); min-height: 520px; }
.stage-head { padding: 8px 8px 4px; }
.stage-head .t { display: flex; align-items: center; gap: 8px; font-size: var(--text-sm); font-weight: var(--weight-semibold); }
.stage-head .t .n { margin-left: auto; font-size: var(--text-xs); color: var(--ink-3); font-weight: var(--weight-medium); }
.stage-head .d { font-size: var(--text-2xs); color: var(--ink-3); margin-top: 2px; line-height: 15px; }
.stage-bar { height: 4px; border-radius: 999px; margin: 10px 8px 10px; background: var(--border-strong); }
.stage-bar.s-1 { background: var(--ink-disabled); } .stage-bar.s-2 { background: linear-gradient(90deg, #FFC46B, var(--warning)); } .stage-bar.s-3 { background: linear-gradient(90deg, #6E8DFF, var(--info)); } .stage-bar.s-4 { background: linear-gradient(90deg, #B79BFF, var(--test)); } .stage-bar.s-5 { background: linear-gradient(90deg, #5AD39E, var(--success)); }
.pcard { display: block; background: var(--sheen), var(--glass-strong); border: 1px solid var(--glass-edge); border-radius: var(--radius-md); padding: 12px; color: var(--ink); margin-bottom: 8px; box-shadow: inset 0 1px 0 var(--glass-hi), 0 0 0 1px var(--glass-edge-2), 0 4px 14px -8px rgba(16,24,64,0.3); transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease); }
.pcard:hover { text-decoration: none; transform: var(--lift); box-shadow: inset 0 1px 0 var(--glass-hi), 0 0 0 1px var(--border-strong), var(--glass-shadow-lift); }
.pcard .pn { display: flex; align-items: flex-start; gap: 8px; font-weight: var(--weight-semibold); font-size: var(--text-sm); }
.pcard .waiting { margin-top: 10px; display: flex; align-items: flex-start; gap: 8px; font-size: var(--text-xs); color: var(--ink-2); background: var(--surface-3); border-radius: 10px; padding: 7px 9px; }
.pcard .waiting b { color: var(--ink); }
.pcard .pf { margin-top: 10px; display: flex; align-items: center; justify-content: space-between; gap: 8px; white-space: nowrap; font-size: var(--text-2xs); color: var(--ink-3); }
.pcard .age-bad { color: var(--danger); font-weight: var(--weight-semibold); }
.pcard .age-warn { color: var(--warning); font-weight: var(--weight-semibold); }

/* ==========================================================================
   Settings
   ========================================================================== */
.settings-nav { display: flex; flex-direction: column; gap: 4px; position: sticky; top: calc(var(--topbar-h) + var(--space-5)); }
.settings-nav a { display: flex; align-items: center; gap: 10px; height: 38px; padding: 0 14px; border-radius: var(--radius-pill); color: var(--ink-2); font-size: var(--text-sm); font-weight: var(--weight-medium); border: 1px solid transparent; transition: background var(--dur-fast) var(--ease); }
.settings-nav a:hover { background: var(--surface-3); text-decoration: none; color: var(--ink); }
.settings-nav a[aria-current="page"] { background: var(--sheen), var(--glass-strong); color: var(--ink); font-weight: var(--weight-semibold); border-color: var(--glass-edge); box-shadow: inset 0 1px 0 var(--glass-hi), 0 0 0 1px var(--border), 0 6px 16px -8px rgba(16,24,64,0.3); }
.settings-nav a[aria-current="page"] .ico { color: var(--accent); }
.conn-hero { display: flex; gap: var(--space-5); align-items: flex-start; padding: var(--space-6); }
.conn-ico { width: 50px; height: 50px; border-radius: 16px; display: grid; place-items: center; background: var(--gloss), var(--success-soft); color: var(--success); flex: none; box-shadow: var(--gloss-hi), inset 0 0 0 1px var(--success-line), 0 0 24px -6px var(--success); }
.conn-ico .ico { width: 24px; height: 24px; }
.conn-title { font-size: var(--text-xl); line-height: var(--lh-xl); font-weight: var(--weight-semibold); }
.states { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.st { border: 1px solid var(--border); border-radius: var(--radius-md); padding: 12px; background: var(--surface); font-size: var(--text-xs); color: var(--ink-2); }
.st.current { border-color: var(--success-line); background: var(--gloss), var(--success-soft); }
.st .sh { display: flex; align-items: center; gap: 8px; font-size: var(--text-sm); font-weight: var(--weight-semibold); color: var(--ink); margin-bottom: 4px; }
.radio-card { display: flex; gap: 12px; align-items: flex-start; padding: 14px; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--surface); }
.radio-card[aria-checked="true"] { border-color: var(--test); box-shadow: 0 0 0 1px var(--test), 0 0 22px -8px var(--test); background: var(--gloss), var(--test-soft); }
.radio-card[aria-disabled="true"] { opacity: 0.6; }
.radio-dot { width: 16px; height: 16px; border-radius: 50%; border: 1.5px solid var(--border-strong); margin-top: 2px; flex: none; display: grid; place-items: center; }
.radio-card[aria-checked="true"] .radio-dot { border-color: var(--test); }
.radio-card[aria-checked="true"] .radio-dot::after { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--test); }
details.tech { border-top: 1px solid var(--divider); }
details.tech summary { cursor: pointer; padding: 12px var(--space-6); font-size: var(--text-xs); color: var(--ink-3); font-weight: var(--weight-semibold); list-style: none; display: flex; align-items: center; gap: 6px; }
details.tech summary::-webkit-details-marker { display: none; }
details.tech[open] summary .ico { transform: rotate(90deg); }
details.tech .dl { padding: 0 var(--space-6) var(--space-5); }
.steps-v { display: flex; flex-direction: column; }
.step-v { display: grid; grid-template-columns: 32px 1fr; gap: 14px; padding: var(--space-5) var(--space-6); border-bottom: 1px solid var(--divider); }
.step-v:last-child { border-bottom: 0; }
.step-n { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-size: var(--text-xs); font-weight: var(--weight-bold); background: var(--surface-3); color: var(--ink-2); }
.step-n.done { background: var(--gloss-btn), linear-gradient(180deg, #2FB676, #0B6E46); color: #fff; box-shadow: 0 0 12px -2px rgba(47,182,118,0.6); }
.step-n.now { background: var(--gloss-btn), var(--grad-primary); color: #fff; box-shadow: var(--glow-primary); }

/* ==========================================================================
   Modal + stepper (Direct action). Near-opaque glass: serious, readable.
   ========================================================================== */
.overlay { position: fixed; inset: 0; background: var(--overlay); z-index: var(--z-overlay); display: grid; place-items: center; padding: var(--space-6); animation: fade var(--dur) var(--ease); -webkit-backdrop-filter: blur(8px) saturate(120%); backdrop-filter: blur(8px) saturate(120%); }
.modal {
  width: min(640px, 100%); max-height: calc(100vh - 48px); overflow: auto;
  background: var(--sheen), var(--glass-modal);
  -webkit-backdrop-filter: blur(var(--blur-strong)) saturate(var(--saturate));
  backdrop-filter: blur(var(--blur-strong)) saturate(var(--saturate));
  border-radius: var(--radius-xl); border: 1px solid var(--glass-edge);
  box-shadow: inset 0 1px 0 var(--glass-hi), 0 0 0 1px var(--border), var(--shadow-lg);
  animation: modal-in var(--dur-slow) var(--ease-spring);
}
/* Danger writes (e.g. Block) get an unmistakable red edge on top of the red button */
.modal.is-danger { box-shadow: inset 0 3px 0 var(--danger), inset 0 1px 0 var(--glass-hi), 0 0 0 1px var(--danger-line), var(--shadow-lg), 0 0 60px -20px rgba(210,56,46,0.55); }
.modal.is-danger .modal-title { color: var(--danger); }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: var(--space-6) var(--space-6) 0; }
.modal-title { font-size: var(--text-xl); line-height: var(--lh-xl); font-weight: var(--weight-display); letter-spacing: -0.02em; }
.modal-body { padding: var(--space-5) var(--space-6); }
.modal-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: var(--space-4) var(--space-6); border-top: 1px solid var(--divider); background: var(--surface-2); border-radius: 0 0 var(--radius-xl) var(--radius-xl); }
.stepper { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; padding: var(--space-4) var(--space-6) 0; list-style: none; margin: 0; }
.stp { display: flex; flex-direction: column; gap: 6px; font-size: var(--text-xs); color: var(--ink-3); font-weight: var(--weight-medium); }
.stp::before { content: ""; height: 4px; border-radius: 999px; background: var(--surface-3); }
.stp.done::before { background: linear-gradient(90deg, #34C77F, var(--success)); }
.stp.now::before { background: var(--grad-primary); box-shadow: 0 0 10px -1px rgba(91,75,240,0.7); }
.stp.now { color: var(--ink); font-weight: var(--weight-semibold); }
.stp.done { color: var(--ink-2); }
.diff { width: 100%; border-collapse: separate; border-spacing: 0; font-size: var(--text-sm); border: 1px solid var(--border); border-radius: var(--radius-md); overflow: hidden; background: var(--surface); }
.diff th { text-align: left; font-size: var(--text-xs); color: var(--ink-3); font-weight: var(--weight-semibold); background: var(--surface-2); padding: 9px 14px; border-bottom: 1px solid var(--border); }
.diff td { padding: 11px 14px; border-bottom: 1px solid var(--divider); }
.diff tr:last-child td { border-bottom: 0; }
.diff .from { color: var(--ink-3); text-decoration: line-through; text-decoration-color: var(--border-strong); }
.diff .to { color: var(--ink); font-weight: var(--weight-semibold); }
.diff tr.changed td { background: var(--info-soft); }
.checks { display: flex; flex-direction: column; gap: 8px; }
.ck { display: flex; align-items: center; gap: 10px; font-size: var(--text-sm); }
.ck .ok { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: var(--gloss), var(--success-soft); color: var(--success); box-shadow: inset 0 0 0 1px var(--success-line); }
.ck .ok .ico { width: 12px; height: 12px; stroke-width: 2.6; }
.confirm-box { border: 1px solid var(--border); border-radius: var(--radius-md); padding: var(--space-4); background: var(--surface); }
.typed { font-family: var(--font-mono); font-weight: 700; background: var(--surface-3); border: 1px solid var(--border); padding: 1px 7px; border-radius: 6px; }
.outcome { display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: var(--radius-md); overflow: hidden; background: var(--surface); }
.oc { display: grid; grid-template-columns: 32px 1fr auto; gap: 12px; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--divider); }
.oc:last-child { border-bottom: 0; }
.oc .oi { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-3); color: var(--ink-3); }
.oc .oi.success { background: var(--gloss), var(--success-soft); color: var(--success); box-shadow: inset 0 0 0 1px var(--success-line), 0 0 14px -4px var(--success); }
.oc .oi.warning { background: var(--gloss), var(--warning-soft); color: var(--warning); box-shadow: inset 0 0 0 1px var(--warning-line); }
.oc .oi.danger { background: var(--gloss), var(--danger-soft); color: var(--danger); box-shadow: inset 0 0 0 1px var(--danger-line); }
.oc .ot { font-weight: var(--weight-semibold); font-size: var(--text-sm); }
.oc .os { font-size: var(--text-xs); color: var(--ink-3); margin-top: 1px; }
.spin { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--border-strong); border-top-color: var(--accent); animation: spin 0.8s linear infinite; }
.demo-ctl { display: flex; align-items: center; gap: 8px; font-size: var(--text-2xs); color: var(--ink-3); }
.demo-ctl .seg button { height: 24px; font-size: 11px; }

/* ==========================================================================
   Command palette
   ========================================================================== */
.palette { width: min(660px, 100%); align-self: start; margin-top: 12vh; background: var(--sheen), var(--glass-modal); -webkit-backdrop-filter: blur(var(--blur-strong)) saturate(var(--saturate)); backdrop-filter: blur(var(--blur-strong)) saturate(var(--saturate)); border-radius: var(--radius-xl); border: 1px solid var(--glass-edge); box-shadow: inset 0 1px 0 var(--glass-hi), 0 0 0 1px var(--border), var(--shadow-lg), 0 0 80px -30px rgba(91,75,240,0.6); overflow: hidden; animation: modal-in var(--dur-slow) var(--ease-spring); }
.pal-input { display: flex; align-items: center; gap: 12px; padding: 0 20px; height: 60px; border-bottom: 1px solid var(--divider); }
.pal-input .ico { color: var(--accent); width: 18px; height: 18px; }
.pal-input input { flex: 1; border: 0; background: none; font-size: var(--text-lg); height: 100%; }
.pal-input input::placeholder { color: var(--ink-3); }
.pal-input input:focus-visible { box-shadow: none; }
.pal-results { max-height: 420px; overflow: auto; padding: 8px; }
.pal-group { font-size: var(--text-2xs); letter-spacing: var(--tracking-overline); text-transform: uppercase; font-weight: var(--weight-semibold); color: var(--ink-3); padding: 10px 12px 6px; }
.pal-item { display: flex; align-items: center; gap: 12px; padding: 8px 12px; border-radius: var(--radius-sm); color: var(--ink); font-size: var(--text-sm); cursor: pointer; transition: background var(--dur-fast) var(--ease); }
.pal-item .sub { font-size: var(--text-xs); color: var(--ink-3); }
.pal-item .end { margin-left: auto; display: flex; align-items: center; gap: 8px; color: var(--ink-3); font-size: var(--text-xs); }
.pal-item[aria-selected="true"] { background: var(--gloss), var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent-line); }
.pal-item[aria-selected="true"] .end .ret { opacity: 1; }
.pal-item .ret { opacity: 0; }
.pal-item[aria-selected="true"] .kbd { color: var(--ink-2); }
.pal-foot { display: flex; align-items: center; gap: 16px; padding: 10px 18px; border-top: 1px solid var(--divider); font-size: var(--text-xs); color: var(--ink-3); background: var(--surface-2); }
.pal-empty { padding: 28px 16px; text-align: center; color: var(--ink-3); font-size: var(--text-sm); }

/* ==========================================================================
   Toasts, empty / loading / error states
   ========================================================================== */
.toasts { position: fixed; right: 24px; bottom: 24px; z-index: var(--z-toast); display: flex; flex-direction: column; gap: 8px; }
.toast {
  display: flex; gap: 12px; align-items: flex-start; min-width: 320px; max-width: 420px; padding: 14px 16px; border-radius: var(--radius-md);
  background: linear-gradient(180deg, rgba(255,255,255,0.10), rgba(255,255,255,0.02)), rgba(12, 18, 42, 0.86); color: #F2F4FB;
  -webkit-backdrop-filter: blur(var(--blur)) saturate(var(--saturate)); backdrop-filter: blur(var(--blur)) saturate(var(--saturate));
  border: 1px solid rgba(255,255,255,0.12);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.16), var(--shadow-lg);
  font-size: var(--text-sm); animation: toast-in var(--dur-slow) var(--ease-spring);
}
.toast .ico { margin-top: 2px; color: #6EE0A8; filter: drop-shadow(0 0 6px rgba(110,224,168,0.6)); }
.toast .ts { color: rgba(242,244,251,0.78); font-size: var(--text-xs); margin-top: 2px; }
.empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; padding: var(--space-9) var(--space-6); color: var(--ink-2); }
.empty .ei { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; background: var(--gloss), var(--surface-3); color: var(--ink-3); margin-bottom: 6px; box-shadow: var(--gloss-hi); }
.empty h3 { font-size: var(--text-md); color: var(--ink); }
.empty p { font-size: var(--text-sm); max-width: 420px; }
.skel { display: block; height: 12px; border-radius: 6px; background: linear-gradient(90deg, var(--surface-3), var(--surface-2), var(--surface-3)); background-size: 200% 100%; animation: shimmer 1.4s infinite; }
.skel.w-60 { width: 60%; } .skel.w-40 { width: 40%; }

/* 404 */
.nf { min-height: calc(100vh - var(--topbar-h) - 120px); display: grid; place-items: center; text-align: center; }
.nf .code { font-family: var(--font-display); font-weight: var(--weight-display); letter-spacing: -0.06em; font-size: 120px; line-height: 1; background: var(--grad-text); -webkit-background-clip: text; background-clip: text; color: transparent; filter: drop-shadow(0 10px 30px rgba(91,75,240,0.35)); }
.nf .row { justify-content: center; }
.nf .nf-logo { display: flex; justify-content: center; margin-bottom: 28px; }
.nf .nf-logo img { width: 150px; }

/* ==========================================================================
   Sign-in page — glass card over the ambient navy (navy in both themes)
   ========================================================================== */
body[data-page="signin"] {
  --bg-a: #050B26; --bg-b: #0A0F3A;
  --blob-blue: rgba(36, 83, 214, 0.70); --blob-violet: rgba(124, 77, 255, 0.50);
  --blob-cyan: rgba(34, 211, 238, 0.30); --blob-teal: rgba(45, 212, 191, 0.24);
}
html.page-signin { background: #050B26; }
.auth { min-height: 100vh; display: grid; grid-template-columns: 1.05fr 1fr; padding: 24px; gap: 24px; }
.auth-art { position: relative; overflow: hidden; border-radius: 28px; padding: 48px; display: flex; flex-direction: column; color: #fff;
  background: linear-gradient(180deg, rgba(255,255,255,0.08), rgba(255,255,255,0.01) 40%), rgba(8, 14, 44, 0.28);
  border: 1px solid rgba(255,255,255,0.10);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.14), 0 30px 80px -30px rgba(0,0,0,0.6); }
.auth-art .brand-art { position: absolute; right: -54px; bottom: 48px; width: clamp(260px, 32vw, 480px); height: auto; opacity: 0.07; pointer-events: none; } /* live: .login-brand-art */
.auth-word { font-family: var(--font-display); font-weight: var(--weight-display); font-size: 104px; line-height: 0.95; letter-spacing: -0.065em; margin-top: auto; text-shadow: 0 10px 40px rgba(59,107,240,0.45); }
.auth-word .dot { color: #8FB0FF; }
.auth-tag { font-family: var(--font-sans); font-size: 26px; line-height: 34px; letter-spacing: -0.02em; color: rgba(255,255,255,0.86); margin-top: 18px; max-width: 420px; }
.auth-foot { margin-top: 48px; padding-top: 18px; border-top: 1px solid rgba(255,255,255,0.14); display: flex; justify-content: space-between; font-size: var(--text-xs); color: rgba(255,255,255,0.72); letter-spacing: 0.04em; }
.auth-form { border-radius: 28px; display: grid; place-items: center; padding: 48px; background: var(--sheen), var(--glass-strong); }
:root:not([data-theme="dark"]) .auth-form { background: linear-gradient(180deg, rgba(255,255,255,0.7), rgba(255,255,255,0) 160px), rgba(248, 250, 255, 0.90); }
.auth-form .inner { width: min(380px, 100%); }
.auth-brand { display: flex; align-items: center; gap: 10px; color: #fff; }
.auth-brand img { display: block; width: 190px; height: auto; } /* live: login .wordmark 190px */

/* ---- Theme toggle icon swap --------------------------------------------- */
.theme-toggle .i-moon { display: none; }
[data-theme="dark"] .theme-toggle .i-sun { display: none; }
[data-theme="dark"] .theme-toggle .i-moon { display: block; }

/* ---- Animations --------------------------------------------------------- */
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes rise { from { opacity: 0; transform: translateY(8px) scale(0.99); } to { opacity: 1; transform: none; } }
@keyframes pop { from { opacity: 0; transform: scale(0.94) translateY(-4px); } to { opacity: 1; transform: none; } }
@keyframes modal-in { from { opacity: 0; transform: scale(0.95) translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes toast-in { from { opacity: 0; transform: translateY(14px) scale(0.96); } to { opacity: 1; transform: none; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes shimmer { to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
  .spin { animation: none; border-top-color: var(--accent); }
}

/* ---- Responsive (console is desktop-first; degrade gracefully) ---------- */
@media (max-width: 1200px) {
  .grid-main-side { grid-template-columns: minmax(0, 1fr) 320px; }
  .board { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 960px) {
  .app { grid-template-columns: 1fr; }
  .rail { position: static; height: auto; }
  .grid-2, .grid-3, .grid-4, .grid-main-side, .grid-side-main { grid-template-columns: 1fr; }
  .auth { grid-template-columns: 1fr; }
  .auth-art { min-height: 320px; }
}

.panel-sec a.row { color: var(--ink); }
.panel-sec a.row:hover { color: var(--ink-link); text-decoration: none; }
.pcard .pf .truncate { min-width: 0; }
.pcard .pn .grow { display: flex; flex-direction: column; line-height: 18px; }
.pcard .pn .cell-sub { font-weight: var(--weight-regular); margin-top: 0; }
.pcard .pn .avatar { margin-top: 2px; }

/* p2b3 r2: the top bar fits a 390 px phone (it was 523 px wide) */
.topbar { min-width: 0; max-width: 100%; }
@media (max-width: 600px) {
  .topbar { padding: 0 var(--space-4); gap: var(--space-2); }
  .topbar .spacer { display: none; }
  .search-trigger { flex: 1 1 auto; width: auto; }
  .search-trigger .kbd { display: none; }
  .search-trigger .grow { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
  .conn-chip { padding: 0 10px; flex: 0 0 auto; }
  .conn-chip #conn-sub { display: none; }
  .content { padding-left: var(--space-4); padding-right: var(--space-4); }
  /* p2b3 r3: Settings fits 390 px (grid columns could not shrink below their content) */
  .grid-side-main, .grid-main-side { grid-template-columns: minmax(0, 1fr); }
  .grid-side-main > *, .grid-main-side > * { min-width: 0; }
  .settings-nav { position: static; }
  .member-row { flex-wrap: wrap; min-width: 0; }
  .card-head { flex-wrap: wrap; min-width: 0; }
  .conn-hero { padding: var(--space-4); gap: var(--space-3); }
  .conn-hero > * { min-width: 0; overflow-wrap: anywhere; }
  /* p2b4: Inbox filter row wraps; search takes the full width, the two selects share the next line */
  .toolbar-2 { flex-wrap: wrap; justify-content: flex-start; }
  .toolbar-2 > .input-group { flex: 1 1 100%; width: 100%; min-width: 0; }
  /* p2b4 r2: relay-rd1.css loads after this file and caps .toolbar-2 .input-group at 520 px (553-600 px); this selector is more specific */
  .toolbar.toolbar-2 > .input-group { max-width: none; }
  .toolbar-2 > .input-group .input { width: 100%; }
  .toolbar-2 > .select { flex: 1 1 0; min-width: 0; width: auto; }
  /* p2b4 r2: touch-sized Inbox filter controls (>= 44 px) */
  .toolbar-2 > .input-group .input, .toolbar-2 > .select { min-height: 44px; }
  #inbox-root .seg button, #inbox-root .chips .chip, #inbox-root .chips .btn, #inbox-root .chip-x { min-height: 44px; }
}
/* p2b4 r2: 601-860 px (tablet): an older desktop rule left the Inbox search 113 px wide next to two 160 px selects;
   give search its own full line there. 861 px and up (incl. 1024/1440) are unchanged. */
@media (min-width: 601px) and (max-width: 860px) { .toolbar.toolbar-2 > .input-group { flex: 1 1 100%; max-width: none; } }

/* ---- Moniic logo (live assets: brand/logo-blue.svg, logo-white.svg) ------ */
.logo-theme { display: block; height: auto; }
.logo-theme.on-dark { display: none; }
[data-theme="dark"] .logo-theme.on-light { display: none; }
[data-theme="dark"] .logo-theme.on-dark { display: block; }

/* p2c7r2 (UI/UX p2c7 P3-1): related-case id links in the case timeline never wrap (390 px). The timeline rows are .sysevent.relay-ev (there is no .tl). */
.relay-ev a[href^="#/inbox/RLY-"] { white-space: nowrap; }
