/* ════════════════════════════════════════════════════════════════════════
   RELAY CLOUD — web app mock (onboarding + workspace shell)
   Brand: relay graphite + indigo-violet glass. Mono for telemetry.
   ════════════════════════════════════════════════════════════════════════ */
:root {
  --page: #131216; --page-2: #0e0d11; --card: #1c1a20; --card-2: #211f26;
  --chrome: #0f0e12; --hair: rgba(255,255,255,0.08); --hair-2: rgba(255,255,255,0.13);
  /* Muted inks re-toned to WCAG-AA on the dark surfaces (PERCH-0057, mirroring the light re-tone in
     PERCH-0054): same warm-ink hue, alpha raised so composited text clears 4.5:1 over the darkest
     backdrop it lands on (a .badge.dim white-0.06 tint over --card-2). --ink3 0.42→0.58 lifts the worst
     de-emphasised text 3.38→4.89:1; --ink2 0.64→0.75 already cleared AA but rises in step to preserve
     the muted-level separation (final gap 0.17, matching 0054's light gap). Do NOT lower these back —
     the contrast guard (e2e/contrast.e2e.ts) now fails if either drops below its tier in dark too. */
  --ink: #ece9e3; --ink2: rgba(236,233,227,0.75); --ink3: rgba(236,233,227,0.58);
  --brand: #8f88ff; --brand-fill: #5f57e8; --brand-deep: #5952e4;
  --brand-bright: #c3b2ff; --brand-weak: rgba(126,124,255,0.14);
  --ok: #3ad06a; --ok-weak: rgba(58,208,106,0.14);
  --warn: #f5a623; --warn-weak: rgba(245,166,35,0.15);
  --danger: #ff5b52; --danger-weak: rgba(255,91,82,0.14);
  --info: #5aa9ff;
  --sw-a: #5aa9ff; --sw-b: #c98bff; --sw-c: #f5a35a; --sw-d: #56d4a3; --sw-e: #ff8fa5;
  --tandem: #ffb020;
  --ui: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, monospace;
  --r-sm: 7px; --r: 10px; --r-lg: 14px; --r-pill: 999px;
  --shadow: 0 1px 2px rgba(0,0,0,0.3), 0 10px 32px -12px rgba(0,0,0,0.5);
  color-scheme: dark;
}

/* ── LIGHT THEME ──────────────────────────────────────────────────────────
   Authored warm-paper palette mirroring design/relay-marketing.html — NOT an
   inversion of the dark tokens (spec-PERCH-0040 AC-4). Applied when the head
   boot script sets [data-theme="light"]; the toggle flips + persists it.
   Muted inks + semantic hues were re-toned to WCAG-AA on warm paper (PERCH-0054):
   same hue family, nudged darker so composited text clears 4.5:1 over the darkest
   surface it lands on (--chrome sidebar). Do NOT lighten these back — the contrast
   guard (e2e/contrast.e2e.ts) fails if any drops below its tier. */
:root[data-theme="light"] {
  --page: #f5f2ec; --page-2: #edeae2; --card: #fdfcfa; --card-2: #f4f1ea;
  --chrome: #eae7df; --hair: rgba(29,25,45,0.09); --hair-2: rgba(29,25,45,0.15);
  --ink: #201d28; --ink2: rgba(32,29,40,0.82); --ink3: rgba(32,29,40,0.65);
  --brand: #5a52e0; --brand-fill: #5f57e8; --brand-deep: #4b44c9;
  --brand-bright: #7e76ff; --brand-weak: rgba(95,87,232,0.10);
  --ok: #0f7a3e; --ok-weak: rgba(23,138,72,0.11);
  --warn: #8d5e00; --warn-weak: rgba(163,108,5,0.12);
  --danger: #c0332b; --danger-weak: rgba(204,58,49,0.10);
  --info: #2f6bd6;
  --sw-a: #2f6bd6; --sw-b: #7a4fd6; --sw-c: #c26a1f; --sw-d: #1f9e73; --sw-e: #d05873;
  --tandem: #b9791a;
  --shadow: 0 1px 2px rgba(29,25,45,0.08), 0 12px 32px -14px rgba(29,25,45,0.22);
  color-scheme: light;
}
/* Light-mode overrides for the surfaces the dark theme paints with white overlays: on paper those
   would vanish, so each becomes a matching dark-ink wash (kept scoped so the dark rules are untouched). */
:root[data-theme="light"] .btn-secondary { background: rgba(32,29,40,0.05); }
:root[data-theme="light"] .btn-secondary:hover { background: rgba(32,29,40,0.09); }
:root[data-theme="light"] .btn-ghost:hover { background: rgba(32,29,40,0.05); }
:root[data-theme="light"] .badge.dim { background: rgba(32,29,40,0.07); }
:root[data-theme="light"] .meter { background: rgba(32,29,40,0.10); }
:root[data-theme="light"] .ob-progress .seg { background: rgba(32,29,40,0.10); }
:root[data-theme="light"] .ws-switch:hover,
:root[data-theme="light"] .snav button:hover { background: rgba(32,29,40,0.05); }
:root[data-theme="light"] .rowi:hover,
:root[data-theme="light"] .ttable tr:hover td { background: rgba(32,29,40,0.03); }
:root[data-theme="light"] .bar .track { background: rgba(32,29,40,0.09); }
:root[data-theme="light"] .bar .seg2 { background: rgba(95,87,232,0.28); }
:root[data-theme="light"] .switch { background: rgba(32,29,40,0.18); }
:root[data-theme="light"] .switch::after { background: #ffffff; }
:root[data-theme="light"] .stepper button:hover { background: rgba(32,29,40,0.06); }
:root[data-theme="light"] .popup2:hover { border-color: rgba(32,29,40,0.28); }
:root[data-theme="light"] .acct-chip { background: rgba(32,29,40,0.05); }
:root[data-theme="light"] .comp-ring {
  background: conic-gradient(var(--brand-fill) 0 34%, rgba(32,29,40,0.10) 34% 100%);
}
:root[data-theme="light"] ::selection { background: rgba(95,87,232,0.22); color: #201d28; }
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  background: var(--page); color: var(--ink); font: 400 14px/1.55 var(--ui);
  -webkit-font-smoothing: antialiased; min-height: 100dvh;
}
::selection { background: rgba(124,124,255,0.28); color: #f4f2ff; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
input, select { font: inherit; color: var(--ink); }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: var(--r-sm); }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
[hidden] { display: none !important; }

/* ── shared controls ────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-size: 14px; font-weight: 600; border-radius: var(--r); padding: 10px 18px;
  transition: background 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease, color 0.18s ease, border-color 0.18s ease;
}
.btn-primary { background: var(--brand-fill); color: #f4f2ff;
  box-shadow: 0 1px 0 rgba(255,255,255,0.18) inset; }
.btn-primary:hover { background: #6b63f2; }
.btn-primary:active { transform: scale(0.985); }
.btn-primary:disabled { background: rgba(95,87,232,0.35); color: rgba(244,242,255,0.5); cursor: not-allowed; }
.btn-secondary { background: rgba(255,255,255,0.05); border: 1px solid var(--hair-2); color: var(--ink); }
.btn-secondary:hover { background: rgba(255,255,255,0.08); }
.btn-ghost { color: var(--ink2); padding: 10px 14px; }
.btn-ghost:hover { color: var(--ink); background: rgba(255,255,255,0.04); border-radius: var(--r); }
.btn-sm { font-size: 13px; padding: 7px 14px; }
.btn .spin { width: 14px; height: 14px; border: 2px solid rgba(244,242,255,0.35);
  border-top-color: #f4f2ff; border-radius: 50%; animation: spin 0.7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.field { display: grid; gap: 6px; }
.field label { font-size: 13px; font-weight: 600; color: var(--ink); }
.field .hint { font-size: 12px; color: var(--ink3); }
.field input, .field select {
  background: var(--card-2); border: 1px solid var(--hair-2); border-radius: var(--r);
  padding: 10px 12px; font-size: 14px; width: 100%;
  transition: border-color 0.18s ease, background 0.18s ease;
}
.field input::placeholder { color: var(--ink3); }
.field input:hover { border-color: rgba(255,255,255,0.18); }
.field input:focus { outline: none; border-color: var(--brand); background: var(--card); }
.field.invalid input { border-color: var(--danger); }
.field .err { font-size: 12.5px; color: var(--danger); display: none; }
.field.invalid .err { display: block; }

.badge { display: inline-flex; align-items: center; gap: 6px; font-family: var(--mono);
  font-size: 10.5px; font-weight: 700; letter-spacing: 0.07em; text-transform: uppercase;
  border-radius: var(--r-pill); padding: 3px 10px; }
.badge.ok { color: var(--ok); background: var(--ok-weak); }
.badge.warn { color: var(--warn); background: var(--warn-weak); }
.badge.danger { color: var(--danger); background: var(--danger-weak); }
.badge.brand { color: var(--brand); background: var(--brand-weak); }
.badge.dim { color: var(--ink3); background: rgba(255,255,255,0.06); }
.badge.tandem { color: var(--tandem); background: rgba(255,176,32,0.13); }

.meter { height: 7px; border-radius: var(--r-pill); background: rgba(255,255,255,0.09); overflow: hidden; }
.meter > i { display: block; height: 100%; border-radius: var(--r-pill); background: var(--ok);
  transition: width 0.5s ease; }

/* ══ ONBOARDING ═══════════════════════════════════════════════════════════ */
#onboarding { min-height: 100dvh; display: grid; grid-template-rows: auto 1fr;
  background:
    radial-gradient(900px 520px at 80% -10%, rgba(124,124,255,0.12), transparent 60%),
    var(--page); }
.ob-top { display: flex; align-items: center; justify-content: space-between;
  padding: 20px 28px; }
.logo { display: inline-flex; align-items: center; gap: 9px; font-weight: 700; font-size: 15px; color: var(--ink); }
.ob-top .skip { font-size: 13px; color: var(--ink3); }
.ob-top .skip:hover { color: var(--ink2); text-decoration: none; }
.ob-shell { width: 100%; max-width: 620px; margin: 0 auto; padding: 12px 24px 80px; }
.ob-progress { display: flex; align-items: center; gap: 8px; margin-bottom: 28px; }
.ob-progress .seg { height: 3px; flex: 1; border-radius: 2px; background: rgba(255,255,255,0.1); overflow: hidden; }
.ob-progress .seg i { display: block; height: 100%; width: 0%; background: var(--brand); transition: width 0.4s ease; }
.ob-progress .lbl { font-family: var(--mono); font-size: 11.5px; color: var(--ink3); white-space: nowrap; }
.ob-step h1 { font-size: 27px; font-weight: 680; letter-spacing: -0.02em; line-height: 1.15; margin-bottom: 8px; text-wrap: balance; }
.ob-step > p { color: var(--ink2); margin-bottom: 24px; max-width: 480px; text-wrap: pretty; }
.ob-card { background: var(--card); border: 1px solid var(--hair); border-radius: var(--r-lg);
  padding: 22px; box-shadow: var(--shadow); }
.ob-nav { display: flex; align-items: center; gap: 12px; margin-top: 24px; }
.ob-nav .spacer { flex: 1; }
.ob-note { margin-top: 16px; font-size: 12.5px; color: var(--ink3); display: flex; gap: 8px; align-items: baseline; }
.ob-note .k { color: var(--brand); font-family: var(--mono); }

.sso { display: grid; gap: 10px; margin-bottom: 18px; }
.sso .btn { justify-content: center; }
.or { display: flex; align-items: center; gap: 12px; color: var(--ink3);
  font-family: var(--mono); font-size: 11px; margin: 16px 0; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--hair); }
.form-grid { display: grid; gap: 16px; }
.form-row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 560px) { .form-row2 { grid-template-columns: 1fr; } }

.slugline { display: flex; align-items: center; gap: 2px; font-family: var(--mono);
  font-size: 13px; color: var(--ink3); margin-top: 6px; }
.slugline b { color: var(--ink2); font-weight: 500; }

/* agent install + enrolment (onboarding step 3) — PERCH-0110.
   Replaces the provider-connect cards: the web app cannot hold a subscription seat, so it no longer
   renders an affordance to connect one. Ported from design/relay-cloud-webapp.html. */
.dl-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.dl-row .btn { justify-content: center; }
@media (max-width: 560px) { .dl-row { grid-template-columns: 1fr; } }
.dl-note { font-size: 12px; color: var(--ink3); margin-top: 10px; text-align: center; }
.enrol-block { margin-top: 20px; padding-top: 20px; border-top: 1px solid var(--hair); }
.enrol-state { display: flex; gap: 10px; align-items: baseline; font-size: 13px; color: var(--ink2); }
.enrol-state .k { color: var(--brand); font-family: var(--mono); flex: none; }
.enrol-state[data-state="failed"] .k { color: var(--danger); }

/* the three identities, labelled — never collapsed into one another */
.ident { display: inline-flex; align-items: center; gap: 6px; font-family: var(--mono);
  font-size: 10.5px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink3);
  background: rgba(255,255,255,0.05); border: 1px solid var(--hair); border-radius: var(--r-pill);
  padding: 3px 9px; margin-bottom: 10px; }
:root[data-theme="light"] .ident { background: rgba(32,29,40,0.05); }
.ident .dot { width: 6px; height: 6px; border-radius: 50%; flex: none; background: var(--ink3); }
.ident[data-identity="relay"] .dot { background: var(--brand); }
.ident[data-identity="device"] .dot { background: var(--info, #5aa9ff); }
.ident[data-identity="provider_seat"] .dot { background: var(--ok); }

/* machine-plane-incomplete notice — one honest banner, never a modal */
.agent-banner { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 20px;
  background: var(--card); border: 1px solid var(--hair); border-radius: var(--r-lg);
  padding: 14px 16px; }
.agent-banner .k { color: var(--brand); font-family: var(--mono); flex: none; line-height: 1.5; }
.agent-banner .msg { flex: 1; min-width: 0; font-size: 13px; color: var(--ink2); text-wrap: pretty; }
.agent-banner .msg b { color: var(--ink); font-weight: 600; display: block; margin-bottom: 2px; }


/* keys + card */
.keygrid { display: grid; gap: 12px; }
.keyrow { display: grid; grid-template-columns: 150px 1fr auto; gap: 10px; align-items: center; }
@media (max-width: 560px) { .keyrow { grid-template-columns: 1fr; } }
.keyrow .kname { font-family: var(--mono); font-size: 13px; color: var(--ink2); }
.keyrow input { background: var(--card-2); border: 1px solid var(--hair-2); border-radius: var(--r);
  padding: 9px 12px; font-family: var(--mono); font-size: 13px; width: 100%; }
.keyrow input:focus { outline: none; border-color: var(--brand); }
.keyrow .saved { font-family: var(--mono); font-size: 12px; color: var(--ok); }
.cardform { margin-top: 8px; }
.tabs { display: inline-flex; background: var(--card-2); border: 1px solid var(--hair-2);
  border-radius: var(--r); padding: 3px; gap: 3px; margin-bottom: 18px; }
.tabs button { font-size: 13px; font-weight: 500; color: var(--ink2); border-radius: var(--r-sm);
  padding: 6px 14px; transition: background 0.18s ease, color 0.18s ease; }
.tabs button:hover { color: var(--ink); }
.tabs button[aria-selected="true"] { background: var(--brand-fill); color: #f4f2ff; font-weight: 600; }

/* invites */
.invite-add { display: flex; gap: 10px; }
.invite-add input { flex: 1; }
.invite-list { display: grid; gap: 8px; margin-top: 16px; }
.invite-row { display: flex; align-items: center; gap: 12px; background: var(--card-2);
  border: 1px solid var(--hair); border-radius: var(--r); padding: 9px 12px; }
.invite-row .em { flex: 1; font-family: var(--mono); font-size: 13px; }
.invite-row select { background: var(--card); border: 1px solid var(--hair-2);
  border-radius: var(--r-sm); padding: 5px 8px; font-size: 12.5px; }
.invite-row .rm { color: var(--ink3); }
.invite-row .rm:hover { color: var(--danger); }

/* done step */
.done-summary { display: grid; gap: 1px; background: var(--hair); border: 1px solid var(--hair);
  border-radius: var(--r-lg); overflow: hidden; }
.done-summary .row { background: var(--card); padding: 13px 16px; display: flex; gap: 12px; align-items: baseline; }
.done-summary .k { font-family: var(--mono); font-size: 12px; color: var(--ink3); width: 130px; flex: none; }
.done-summary .v { font-size: 14px; }
.done-check { width: 52px; height: 52px; border-radius: 50%; background: var(--ok-weak);
  display: grid; place-items: center; color: var(--ok); margin-bottom: 18px; }

/* ══ APP SHELL ════════════════════════════════════════════════════════════ */
#app { min-height: 100dvh; display: grid; grid-template-columns: 232px 1fr; }
/* All grid children (incl. <main> and <aside>, not just <div>) must be min-width:0 so a wide child —
   e.g. the Team table's min-content — is contained by its own `.panel { overflow-x:auto }` scroller
   instead of expanding the grid track and scrolling the whole document (mobile single-column). */
#app > * { min-width: 0; }
@media (max-width: 860px) {
  /* Rows pack to the top: stretched rows would share the spare height with the mobilebar. */
  #app { grid-template-columns: 1fr; align-content: start; }
  .sidebar { display: none !important; }
  .mobilebar { display: flex !important; }
  /* `#app` outranks the base `.panel`, `.rowi .desc` and `.bar` rules below, which are declared
     later at equal specificity and would otherwise win by order. */
  #app .panel { overflow-x: auto; }
  #app .rowi { flex-wrap: wrap; }
  #app .rowi .desc { flex-basis: 100%; order: 9; }
  #app .bar { grid-template-columns: 86px 1fr 62px; }
}
.mobilebar { display: none; position: sticky; top: 0; z-index: 20; align-items: center; gap: 12px;
  padding: 12px 16px; background: var(--chrome); border-bottom: 1px solid var(--hair); overflow-x: auto; }
.mobilebar button { font-size: 13px; color: var(--ink2); padding: 6px 10px; border-radius: var(--r-sm); white-space: nowrap; }
.mobilebar button[aria-current="page"] { color: var(--ink); background: var(--brand-weak); }

.sidebar { background: var(--chrome); border-right: 1px solid var(--hair);
  display: flex; flex-direction: column; padding: 18px 12px; position: sticky; top: 0; height: 100dvh; }
.ws-switch { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--r);
  margin-bottom: 18px; transition: background 0.18s ease; width: 100%; text-align: left; }
.ws-switch:hover { background: rgba(255,255,255,0.04); }
.ws-avatar { width: 30px; height: 30px; border-radius: 8px; background: linear-gradient(135deg, #7e7cff, var(--brand-deep));
  display: grid; place-items: center; font-weight: 700; font-size: 13px; color: #f4f2ff; flex: none; }
.ws-meta { min-width: 0; }
/* Block, so the plan line always sits under the name and the name's ellipsis can apply. */
.ws-meta .n { display: block; font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ws-meta .p { display: block; font-family: var(--mono); font-size: 10.5px; color: var(--ink3); }
.snav { display: grid; gap: 2px; }
.snav button { display: flex; align-items: center; gap: 11px; padding: 8px 10px; border-radius: var(--r);
  font-size: 13.5px; font-weight: 500; color: var(--ink2); text-align: left; width: 100%;
  transition: background 0.18s ease, color 0.18s ease; }
.snav button:hover { color: var(--ink); background: rgba(255,255,255,0.04); }
.snav button[aria-current="page"] { color: var(--ink); background: var(--brand-weak); }
.snav button[aria-current="page"] svg { color: var(--brand); }
.snav svg { width: 16px; height: 16px; color: var(--ink3); flex: none; }
.snav .sep { font-family: var(--mono); font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--ink3); padding: 14px 10px 6px; }
.sidebar .foot { margin-top: auto; padding: 10px; font-family: var(--mono); font-size: 11px; color: var(--ink3);
  display: grid; gap: 4px; }
.sidebar .foot .u { display: flex; align-items: center; gap: 8px; color: var(--ink2); font-family: var(--ui); font-size: 13px; }
.sidebar .foot .u i { width: 24px; height: 24px; border-radius: 50%; background: var(--sw-b);
  display: grid; place-items: center; font-size: 11px; font-weight: 700; color: var(--page); font-style: normal; }

main { padding: 28px 32px 72px; max-width: 1060px; }
.view-head { display: flex; align-items: flex-start; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.view-head h1 { font-size: 23px; font-weight: 680; letter-spacing: -0.015em; }
.view-head p { color: var(--ink3); font-size: 13.5px; margin-top: 2px; }
.view-head .actions { margin-left: auto; display: flex; gap: 10px; }

.cardgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.stat { background: var(--card); border: 1px solid var(--hair); border-radius: var(--r-lg); padding: 16px 18px;
  display: grid; align-content: start; }
.stat .k { font-size: 12px; color: var(--ink3); font-weight: 500; }
.stat .v { font-family: var(--mono); font-size: 24px; font-weight: 700; letter-spacing: -0.02em; margin-top: 4px; }
.stat .d { font-family: var(--mono); font-size: 11.5px; color: var(--ink3); margin-top: 4px; }
.stat .d.up { color: var(--ok); }
.stat .d.warn { color: var(--warn); }

.panel { background: var(--card); border: 1px solid var(--hair); border-radius: var(--r-lg);
  margin-top: 18px; overflow: hidden; }
.panel-head { display: flex; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--hair); }
.panel-head h2 { font-size: 14.5px; font-weight: 600; }
.panel-head .sub { font-family: var(--mono); font-size: 11.5px; color: var(--ink3); }
.panel-head .actions { margin-left: auto; display: flex; gap: 8px; }
.rows { display: grid; }
.rowi { display: flex; align-items: center; gap: 14px; padding: 12px 18px; transition: background 0.15s ease; }
.rowi + .rowi { border-top: 1px solid var(--hair); }
.rowi:hover { background: rgba(255,255,255,0.02); }
.rowi .sw { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.rowi .nm { font-family: var(--mono); font-size: 13.5px; font-weight: 600; min-width: 110px; }
.rowi .desc { font-size: 12.5px; color: var(--ink3); flex: 1; min-width: 0; overflow-wrap: anywhere; }
.rowi .meter { width: 130px; flex: none; }
.rowi .pct { font-family: var(--mono); font-size: 12.5px; color: var(--ink2); width: 40px; text-align: right; flex: none; }
.empty { padding: 40px 24px; text-align: center; color: var(--ink3); font-size: 13.5px; }
.empty .btn { margin-top: 14px; }

/* usage bars */
.bars { padding: 18px; display: grid; gap: 12px; }
.bar { display: grid; grid-template-columns: 130px 1fr 76px; gap: 12px; align-items: center; }
.bar .lbl { font-family: var(--mono); font-size: 12.5px; color: var(--ink2); }
.bar .track { height: 12px; border-radius: var(--r-pill); background: rgba(255,255,255,0.07); overflow: hidden; display: flex; }
.bar .seg1 { height: 100%; background: var(--brand-fill); }
.bar .seg2 { height: 100%; background: rgba(143,136,255,0.3); }
.bar .amt { font-family: var(--mono); font-size: 12.5px; color: var(--ink2); text-align: right; }
.legend { display: flex; gap: 16px; padding: 0 18px 16px; font-size: 12px; color: var(--ink3); }
.legend i { display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-right: 6px; }

/* team table */
.ttable { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.ttable th { text-align: left; font-family: var(--mono); font-size: 10.5px; font-weight: 700;
  letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink3); padding: 12px 18px;
  border-bottom: 1px solid var(--hair); }
.ttable td { padding: 12px 18px; border-bottom: 1px solid var(--hair); }
.ttable tr:last-child td { border-bottom: 0; }
.ttable tr:hover td { background: rgba(255,255,255,0.02); }
.person { display: flex; align-items: center; gap: 10px; }
.person i { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center;
  font-size: 11.5px; font-weight: 700; color: var(--page); font-style: normal; flex: none; }
.person .pm .n { font-weight: 600; }
.person .pm .e { font-family: var(--mono); font-size: 11.5px; color: var(--ink3); }
.ttable select { background: var(--card-2); border: 1px solid var(--hair-2); border-radius: var(--r-sm);
  padding: 4px 8px; font-size: 12.5px; }
.cap-input { display: inline-flex; align-items: center; gap: 4px; font-family: var(--mono); font-size: 12.5px; color: var(--ink2); }

/* runners */
.runner { display: flex; align-items: center; gap: 14px; padding: 14px 18px; }
.runner + .runner { border-top: 1px solid var(--hair); }
.runner .ric { width: 34px; height: 34px; border-radius: 9px; background: rgba(255,176,32,0.12);
  display: grid; place-items: center; flex: none; }
.runner .rmeta { flex: 1; min-width: 0; }
.runner .rmeta .t { display: block; font-size: 14px; font-weight: 600; }
.runner .rmeta .s { display: block; font-family: var(--mono); font-size: 11.5px; color: var(--ink3); margin-top: 1px; }
.runner .who { display: flex; }
.runner .who i { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--card);
  display: grid; place-items: center; font-size: 9.5px; font-weight: 700; color: var(--page); font-style: normal; }
.runner .who i + i { margin-left: -6px; }

/* routing profiles */
.profiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; margin-top: 18px; }
.profile { background: var(--card); border: 1px solid var(--hair); border-radius: var(--r-lg); padding: 18px;
  display: grid; gap: 10px; transition: border-color 0.2s ease; }
.profile:hover { border-color: var(--hair-2); }
.profile.active { border-color: rgba(143,136,255,0.45);
  background: linear-gradient(180deg, rgba(124,124,255,0.06), transparent 50%), var(--card); }
.profile h3 { font-size: 15px; display: flex; align-items: center; gap: 10px; }
.profile .route { font-family: var(--mono); font-size: 12.5px; color: var(--ink2); }
.profile .ev { font-size: 12.5px; color: var(--ink3); }
.profile .btn { justify-self: start; }

/* controls: segmented / switch / stepper / popup */
.seg2 { display: inline-flex; background: var(--card-2); border: 1px solid var(--hair-2); border-radius: var(--r); padding: 3px; gap: 3px; }
.seg2 button { font-size: 12.5px; font-weight: 500; color: var(--ink2); border-radius: var(--r-sm); padding: 5px 12px; transition: background 0.15s ease, color 0.15s ease; }
.seg2 button:hover { color: var(--ink); }
.seg2 button.on { background: var(--brand-fill); color: #f4f2ff; font-weight: 600; }
.switch { width: 36px; height: 21px; border-radius: 999px; background: rgba(255,255,255,0.14); position: relative; flex: none; transition: background 0.2s ease; cursor: pointer; border: 0; padding: 0; }
.switch::after { content: ""; position: absolute; top: 2.5px; left: 2.5px; width: 16px; height: 16px; border-radius: 50%; background: #f4f2ff; transition: left 0.2s ease; }
.switch.on { background: var(--brand-fill); }
.switch.on::after { left: 17.5px; }
.stepper { display: inline-flex; align-items: center; border: 1px solid var(--hair-2); border-radius: var(--r-sm); overflow: hidden; }
.stepper button { padding: 4px 10px; color: var(--ink2); }
.stepper button:hover { background: rgba(255,255,255,0.06); color: var(--ink); }
.stepper .val { font-family: var(--mono); font-size: 12.5px; padding: 0 10px; min-width: 46px; text-align: center; border-left: 1px solid var(--hair); border-right: 1px solid var(--hair); }
.popup2 { display: inline-flex; align-items: center; gap: 6px; background: var(--card-2); border: 1px solid var(--hair-2); border-radius: var(--r-sm); padding: 5px 10px; font-family: var(--mono); font-size: 12px; color: var(--ink); cursor: pointer; }
.popup2:hover { border-color: rgba(255,255,255,0.22); }
.popup2 .cv { color: var(--ink3); font-size: 10px; }

/* settings-style rows */
.frow2 { display: flex; align-items: center; gap: 14px; padding: 12px 18px; }
.frow2 + .frow2 { border-top: 1px solid var(--hair); }
.frow2 .fm { flex: 1; min-width: 0; }
.frow2 .fm .t { display: block; font-size: 13.5px; font-weight: 600; }
.frow2 .fm .d { display: block; font-size: 12px; color: var(--ink3); margin-top: 1px; overflow-wrap: anywhere; }
.frow2 .fc { display: flex; align-items: center; gap: 10px; flex: none; }
@media (max-width: 640px) { .frow2 { flex-wrap: wrap; } }

/* flow stage */
.flowgrid { display: grid; grid-template-columns: 1fr 44px auto 44px 1fr; gap: 0 6px; align-items: center; padding: 24px 18px; }
@media (max-width: 860px) { .flowgrid { grid-template-columns: 1fr; gap: 14px; } .flow-lane { display: none; } .comp-col { justify-self: center; } }
.fnode { background: var(--card-2); border: 1px solid var(--hair); border-radius: var(--r); padding: 9px 12px; display: flex; align-items: center; gap: 10px; margin: 6px 0; }
.fnode .sw { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.fnode .fnm { font-family: var(--mono); font-size: 12.5px; font-weight: 600; display: block; }
.fnode .fsub { font-size: 10.5px; color: var(--ink3); display: block; }
.fnode .fmeta { min-width: 0; flex: 1; }
.fnode.sending { border-color: rgba(143,136,255,0.4); }
.fnode .pct { font-family: var(--mono); font-size: 11.5px; color: var(--ink2); }
.flow-lane { position: relative; height: 1px; background: var(--hair-2); }
.packet { position: absolute; top: -2px; width: 5px; height: 5px; border-radius: 50%; background: var(--brand); animation: pk 2.2s linear infinite; }
.packet:nth-child(2) { animation-delay: 0.8s; }
.packet:nth-child(3) { animation-delay: 1.5s; }
@keyframes pk { from { left: 0; opacity: 0 } 12% { opacity: 1 } 88% { opacity: 1 } to { left: calc(100% - 5px); opacity: 0 } }
.comp-col { text-align: center; padding: 0 8px; }
.comp-ring { width: 122px; height: 122px; border-radius: 50%; margin: 0 auto; display: grid; place-items: center; position: relative;
  background: conic-gradient(var(--brand-fill) 0 34%, rgba(255,255,255,0.08) 34% 100%); }
.comp-ring::before { content: ""; position: absolute; inset: 9px; border-radius: 50%; background: var(--card); }
.comp-ring b { position: relative; font-family: var(--mono); font-size: 21px; letter-spacing: -0.02em; }
.comp-col .cl { margin-top: 10px; font-size: 12.5px; font-weight: 600; }
.comp-col .cs { font-family: var(--mono); font-size: 11px; color: var(--ink3); }

/* activity timeline */
.daylbl { font-family: var(--mono); font-size: 10.5px; font-weight: 700; letter-spacing: 0.09em; text-transform: uppercase; color: var(--ink3); padding: 16px 18px 6px; }
.tlrow { display: flex; gap: 12px; padding: 10px 18px; align-items: flex-start; }
.tlrow .tld { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; flex: none; font-size: 12px; }
.tlrow .tlt { flex: 1; font-size: 13px; color: var(--ink2); min-width: 0; }
.tlrow .tlt b { color: var(--ink); font-weight: 600; }
.tlrow .tlw { font-family: var(--mono); font-size: 11px; color: var(--ink3); flex: none; }

/* chains + notes */
.chain { display: inline-flex; align-items: center; gap: 6px; font-family: var(--mono); font-size: 11.5px; color: var(--ink3); flex-wrap: wrap; }
.chain .sw { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.note2 { display: flex; gap: 10px; align-items: baseline; margin-top: 14px; font-size: 12.5px; color: var(--ink3);
  background: var(--card); border: 1px solid var(--hair); border-radius: var(--r); padding: 11px 14px; }
.note2 .k { color: var(--brand); font-family: var(--mono); flex: none; }
.note2 b { color: var(--ink2); }
/* A note2 used INSIDE a panel (the usage-alerts preview banner) — the panel supplies no padding of
   its own, so inset it from the panel border rather than letting it sit edge-to-edge. */
.panel > .note2 { margin: 12px 14px; }
/* Preview marker: this control moves its own DOM and stores nothing (INERT-01). Sits beside the
   control it describes and is wired to it with aria-describedby, so the warning reaches a screen
   reader on focus and not only a sighted reader at a glance. */
.prevtag { font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.04em; color: var(--ink3);
  border: 1px dashed var(--hair-2); border-radius: var(--r-sm); padding: 2px 7px; white-space: nowrap; flex: none;
  align-self: center; }

/* toast */
#toast { position: fixed; bottom: 24px; left: 50%; transform: translate(-50%, 16px);
  background: var(--card-2); border: 1px solid var(--hair-2); border-radius: var(--r);
  padding: 11px 18px; font-size: 13.5px; box-shadow: var(--shadow); opacity: 0;
  transition: opacity 0.25s ease, transform 0.25s ease; pointer-events: none; z-index: 100;
  display: flex; gap: 12px; align-items: center; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast .undo { color: var(--brand); font-weight: 600; pointer-events: auto; }

/* ══ JOY & DETAIL (PERCH-0040) ════════════════════════════════════════════ */

/* theme toggle — sun in dark, moon in light (swapped by :root[data-theme]) */
.icon-btn { width: 30px; height: 30px; border-radius: var(--r-pill); display: grid; place-items: center;
  color: var(--ink2); border: 1px solid var(--hair); background: var(--card); flex: none;
  transition: color 0.18s ease, border-color 0.18s ease, background 0.18s ease; }
.icon-btn:hover { color: var(--ink); border-color: var(--hair-2); }
.icon-btn svg { width: 16px; height: 16px; }
.icon-btn .ic-moon { display: none; }
.icon-btn .ic-sun { display: block; }
:root[data-theme="light"] .icon-btn .ic-sun { display: none; }
:root[data-theme="light"] .icon-btn .ic-moon { display: block; }
.sidebar .foot .sysline { display: flex; align-items: center; gap: 8px; }
.sidebar .foot .sysline > span { flex: 1; min-width: 0; }
.mobilebar .icon-btn { margin-left: auto; }

/* loading skeletons — shimmer blocks that sit inside the real chrome so layout doesn't jump */
.skel { display: block; border-radius: var(--r-sm);
  background: linear-gradient(90deg, var(--card-2) 0%, var(--hair) 42%, var(--card-2) 80%);
  background-size: 200% 100%; animation: shimmer 1.3s ease-in-out infinite; }
.skel-title { width: 200px; max-width: 60vw; height: 24px; }
.skel-sub { width: 320px; max-width: 74vw; height: 13px; margin-top: 8px; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -40% 0; } }

/* ⌘K command palette */
.cmdk-backdrop { position: fixed; inset: 0; z-index: 200; background: rgba(8,7,10,0.55);
  backdrop-filter: blur(2px); display: flex; align-items: flex-start; justify-content: center;
  padding: 12vh 16px 16px; }
.cmdk { width: min(560px, 100%); background: var(--card); border: 1px solid var(--hair-2);
  border-radius: var(--r-lg); box-shadow: var(--shadow); overflow: hidden; }
.cmdk-input { width: 100%; background: transparent; border: 0; border-bottom: 1px solid var(--hair);
  padding: 15px 18px; font-size: 15px; color: var(--ink); }
.cmdk-input::placeholder { color: var(--ink3); }
.cmdk-input:focus { outline: none; }
.cmdk-list { list-style: none; max-height: 340px; overflow-y: auto; padding: 6px; }
.cmdk-item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: var(--r);
  cursor: pointer; }
.cmdk-item .cmdk-label { font-size: 14px; font-weight: 500; color: var(--ink); }
.cmdk-item .cmdk-hint { margin-left: auto; font-family: var(--mono); font-size: 11px; color: var(--ink3);
  letter-spacing: 0.04em; }
.cmdk-item.active { background: var(--brand-weak); }
.cmdk-item.active .cmdk-label { color: var(--brand); }
.cmdk-empty { padding: 18px; text-align: center; color: var(--ink3); font-size: 13px; }

/* team: invite composer + cap editor */
.invite-compose { display: flex; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--hair); }
@media (max-width: 560px) { .invite-compose { flex-wrap: wrap; } }
.invite-compose .inv-email { flex: 1; min-width: 160px; background: var(--card-2);
  border: 1px solid var(--hair-2); border-radius: var(--r); padding: 9px 12px; font-size: 13.5px; }
.invite-compose .inv-email:hover { border-color: var(--hair-2); }
.invite-compose .inv-email:focus { outline: none; border-color: var(--brand); background: var(--card); }
.invite-compose .inv-role { background: var(--card-2); border: 1px solid var(--hair-2);
  border-radius: var(--r); padding: 9px 12px; font-size: 13px; }
.cap-input input { width: 76px; background: var(--card-2); border: 1px solid var(--hair-2);
  border-radius: var(--r-sm); padding: 4px 8px; font-family: var(--mono); font-size: 12.5px; color: var(--ink); }
.cap-input input:focus { outline: none; border-color: var(--brand); }
.cap-input .cap-cur { color: var(--ink3); }
.cap-input .btn-sm { padding: 4px 10px; }
/* honest failure note for a cap that couldn't load (PERCH-0057) — muted, sits under the editor cell */
.cap-problem { display: block; margin-top: 4px; font-size: 12px; color: var(--ink3); max-width: 240px; }

/* ══ REDUCED MOTION (QA-PLAN §2.8, PERCH-0057) ════════════════════════════════
   PRODUCT behaviour for users who ask the OS for reduced motion: neutralise all
   app motion to a near-instant static end-state — decorative control transitions
   (buttons, nav, switches, cards), the data-width meter/progress fills, the toast
   slide-in, the shimmer skeletons, the flow packet-flow, and the button spinner
   rotation. This is DISTINCT from the QA harness's capture-freeze
   (#__qa_freeze_motion in e2e/inventory.ts), which is injected only to de-flake
   screenshots and is not a media query. Guarded by e2e/reduced-motion.e2e.ts.
   (Supersedes 0040's slow-spin: under reduced motion the spinner freezes to a
   static ring — busy-ness is still conveyed by aria-busy + the disabled control.) */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  /* The packet keyframe ends at opacity:0 (off-lane); pin one visible + centred instead of letting
     it snap to its invisible end-frame, and drop the two delayed followers. */
  .packet { left: 50%; opacity: 1; }
  .packet:nth-child(2), .packet:nth-child(3) { display: none; }
}

/* in-brand error / 404 page */
#errpage { min-height: 100dvh; display: grid; place-items: center; padding: 40px 24px;
  background: radial-gradient(900px 520px at 80% -10%, rgba(124,124,255,0.12), transparent 60%), var(--page); }
.errcard { max-width: 460px; text-align: center; }
.errcard .code { font-family: var(--mono); font-size: 12px; font-weight: 700; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--brand); }
.errcard h1 { font-size: 27px; font-weight: 680; letter-spacing: -0.02em; margin: 12px 0 8px; text-wrap: balance; }
.errcard p { color: var(--ink2); margin-bottom: 24px; text-wrap: pretty; }
.errcard .btn { display: inline-flex; }
/* Sign in by emailed code (docs/plans/relay-email-code-auth.md): the field rules reuse .field's input
   look; the error is text in the danger ink with role=alert, never colour alone. */
.signin-form { display: grid; gap: 10px; text-align: left; }
.signin-form h1, .signin-form > p { text-align: center; }
.signin-form label { font-size: 13px; font-weight: 600; color: var(--ink2); }
.signin-form input:not([type=hidden]) { width: 100%; padding: 12px 14px; border-radius: 12px;
  border: 1px solid var(--hair-2, rgba(255,255,255,0.13)); background: var(--card); font-size: 17px; }
.signin-form input#code { font-family: var(--mono); font-size: 24px; letter-spacing: 0.3em; text-align: center; }
.signin-form input:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.signin-form .btn { justify-content: center; }
.form-error { color: var(--danger); font-size: 14px; margin: 0; }

/* ── device enrolment approval (PERCH-0109) ──────────────────────────────
   The code input is the screen's whole job, so it gets the Data mono role at a
   size you can read across a desk. Accent appears in exactly TWO placements —
   the focused input ring and the primary Approve button; Deny is secondary.
   Uppercase here is a deliberate, recorded exception to the "UPPERCASE only on
   the Overline role" rule: the canonical code IS uppercase DATA, not a label. */
.devicepage { min-height: 100dvh; display: grid; place-items: center; padding: 40px 24px; }
.devicecard { max-width: 520px; width: 100%; }
.devicecard .eyebrow { font-family: var(--mono); font-size: 12px; font-weight: 700;
  letter-spacing: 0.14em; text-transform: uppercase; color: var(--brand); }
.devicecard h1 { font-size: 27px; font-weight: 680; letter-spacing: -0.02em; margin: 12px 0 8px; }
.devicecard .lede { color: var(--ink2); margin-bottom: 24px; text-wrap: pretty; }

.dg-enter { display: grid; gap: 8px; }
.dg-label { font-size: 12px; font-weight: 500; color: var(--ink2); }
.dg-code {
  min-width: 0; /* the input's intrinsic width otherwise overflows a 390px viewport */
  font-family: var(--mono); font-size: 22px; font-weight: 600; letter-spacing: 0.18em;
  text-transform: uppercase; padding: 14px 16px; border-radius: var(--r);
  background: var(--card-2); border: 1px solid var(--hair-2); color: var(--ink);
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}
.dg-code::placeholder { color: var(--ink3); letter-spacing: 0.18em; }
.dg-code:focus-visible { outline: none; border-color: var(--brand);
  box-shadow: 0 0 0 2px var(--brand-weak); }
.dg-hint { font-size: 12px; color: var(--ink3); }
.dg-enter .btn { justify-self: start; margin-top: 8px; }

.dg-review { display: grid; gap: 16px; }
.dg-legend { color: var(--ink2); }
.dg-facts { display: grid; gap: 1px; background: var(--hair); border: 1px solid var(--hair);
  border-radius: var(--r); overflow: hidden; }
.dg-fact { display: grid; grid-template-columns: 160px 1fr; gap: 12px; align-items: baseline;
  background: var(--card); padding: 12px 14px; }
.dg-fact dt { font-size: 12px; font-weight: 500; color: var(--ink2); }
.dg-fact dd { display: grid; gap: 2px; }
.dg-value { font-family: var(--mono); font-size: 13px; font-weight: 500; color: var(--ink); }
/* An absent field says so in words. Never a dash — a dash reads as data. */
.dg-absent { font-size: 13px; font-style: italic; color: var(--ink3); }
.dg-provenance { font-family: var(--mono); font-size: 11px; color: var(--ink3); }
.dg-caveat { font-size: 12px; color: var(--ink3); text-wrap: pretty; }

.dg-confirm { display: flex; gap: 10px; align-items: flex-start; cursor: pointer;
  padding: 12px 14px; border: 1px solid var(--hair-2); border-radius: var(--r);
  background: var(--card-2); font-size: 13px; color: var(--ink); }
.dg-confirm input { margin-top: 2px; accent-color: var(--brand-fill); cursor: pointer; }
.dg-confirm:focus-within { border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand-weak); }

.dg-actions { display: flex; gap: 10px; }
.dg-error { font-size: 13px; color: var(--danger); }
.dg-terminal { display: grid; gap: 10px; justify-items: start; }
/* Status is colour PLUS the word, never colour alone. */
.dg-status { font-size: 19px; font-weight: 640; }
.dg-status.dg-ok { color: var(--ok); }
.dg-status.dg-danger { color: var(--danger); }
.dg-terminal-detail { color: var(--ink2); text-wrap: pretty; }

@media (prefers-reduced-motion: reduce) {
  .dg-code, .dg-confirm { transition: none; }
}

/* ── routing policy chooser + editor (PERCH-0583) ─────────────────────────
   Accent in at most two places: focused field ring (shared `.field input:focus`)
   and the primary Save button. Hostname is text, not mono; opaque ids are mono.
   Status colour is never used alone. */
.policypage { min-height: 100dvh; display: grid; grid-template-rows: auto 1fr; }
.policy-head {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 16px 24px; background: var(--chrome); border-bottom: 1px solid var(--hair);
}
.policy-head .ws { font-size: 14px; font-weight: 600; min-width: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.policy-body { display: grid; grid-template-columns: minmax(220px, 280px) 1fr; min-height: 0; }
@media (max-width: 860px) {
  .policy-body { grid-template-columns: 1fr; }
}
.policy-chooser { border-right: 1px solid var(--hair); overflow: auto; padding: 12px; }
.policy-editor { overflow: auto; padding: 24px; min-width: 0; }
.policy-note { font-size: 13px; color: var(--ink2); margin: 8px 12px 12px; text-wrap: pretty; }
.policy-flash { margin: 0 24px 0; padding: 10px 14px; border-radius: var(--r);
  background: var(--warn-weak); color: var(--ink); font-size: 13px; }
.policy-empty, .policy-fail { padding: 48px 24px; max-width: 520px; }
.policy-empty p, .policy-fail p { color: var(--ink2); margin-bottom: 16px; text-wrap: pretty; }
.policy-machine {
  display: grid; gap: 4px; width: 100%; text-align: left; padding: 12px 12px;
  border-radius: var(--r); border: 1px solid transparent;
}
.policy-machine:hover { background: rgba(255,255,255,0.04); }
.policy-machine[aria-current="true"] {
  background: var(--card); border-color: var(--hair-2);
}
.policy-host { font-size: 14px; font-weight: 600; color: var(--ink); }
.policy-absent { font-size: 14px; font-style: italic; color: var(--ink3); font-weight: 500; }
.policy-prov { font-size: 11px; color: var(--ink3); }
.policy-machine .sub { font-size: 12px; color: var(--ink2); }
.policy-strip { display: grid; gap: 4px; margin-bottom: 18px; padding: 12px 14px;
  background: var(--card); border: 1px solid var(--hair); border-radius: var(--r); }
.policy-strip p { font-size: 13px; color: var(--ink2); }
.policy-strip .word { font-weight: 600; color: var(--ink); }
.policy-actions { display: flex; gap: 10px; flex-wrap: wrap; margin: 16px 0 24px; }
.policy-kind { margin-bottom: 22px; }
.policy-kind h2 { font-size: 15px; font-weight: 650; margin-bottom: 10px; }
.policy-obj { border: 1px solid var(--hair); border-radius: var(--r); padding: 12px 14px;
  margin-bottom: 10px; background: var(--card); display: grid; gap: 10px; }
.policy-objhead { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.policy-unavail { font-size: 12.5px; color: var(--ink2); text-wrap: pretty; }
.policy-skel { display: grid; gap: 10px; }
.policy-skel .block { height: 72px; border-radius: var(--r); background: var(--card-2); }
.policy-overlay {
  position: fixed; inset: 0; background: rgba(8,7,12,0.55); display: grid; place-items: center;
  padding: 24px; z-index: 40;
}
.policy-dialog {
  background: var(--card); border: 1px solid var(--hair); border-radius: var(--r-lg);
  padding: 22px; max-width: 720px; width: 100%; box-shadow: var(--shadow); display: grid; gap: 14px;
}
.policy-dialog h2 { font-size: 18px; font-weight: 650; }
.policy-versions { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 640px) { .policy-versions { grid-template-columns: 1fr; } }
.policy-ver { background: var(--card-2); border: 1px solid var(--hair); border-radius: var(--r);
  padding: 12px; font-size: 13px; }
.policy-ver ul { margin: 8px 0 0; padding-left: 16px; color: var(--ink2); }
.policy-chain { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.policy-rules { display: grid; gap: 8px; }

/* ══ VOICE SESSION STRIP (PERCH-0661) — design/relay-cloud-webapp.html #vstrip ═══════════════════ */
.ws-col { min-width: 0; }
.vstrip { margin: 20px 32px 0; max-width: 996px; background: var(--card); border: 1px solid var(--hair);
  border-radius: var(--r-lg); overflow: hidden; }
.vs-head { display: flex; align-items: center; gap: 10px; padding: 10px 18px; border-bottom: 1px solid var(--hair); }
.vs-head h2 { font-size: 13.5px; font-weight: 600; }
.vs-head .sub { font-family: var(--mono); font-size: 11.5px; color: var(--ink2); margin-left: auto; }
.vs-row { display: flex; align-items: center; gap: 14px; padding: 11px 18px; }
.vstrip > div + div .vs-row { border-top: 1px solid var(--hair); }
.vs-dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.vs-dot.running { background: var(--danger); box-shadow: 0 0 0 4px var(--danger-weak); }
.vs-dot.ending { background: var(--warn); }
.vs-dot.ended { background: var(--ink3); }
.vs-dot.lost { box-shadow: inset 0 0 0 1.6px var(--warn); }
.vs-dot.unknown { box-shadow: inset 0 0 0 1.6px var(--ink3); }
.vs-state { font-family: var(--mono); font-size: 10.5px; font-weight: 700; letter-spacing: 0.08em;
  text-transform: uppercase; width: 96px; flex: none; }
.vs-state.running { color: var(--danger); } .vs-state.ending, .vs-state.lost { color: var(--warn); }
.vs-state.ended, .vs-state.unknown { color: var(--ink2); }
.vs-nm { font-family: var(--mono); font-size: 13px; font-weight: 600; width: 86px; flex: none; }
.vs-desc { flex: 1; min-width: 0; font-size: 12.5px; color: var(--ink2); overflow-wrap: anywhere; }
.vs-end, .vs-end-gap { flex: none; min-width: 72px; min-height: 32px; }
.vs-end { font-size: 13px; font-weight: 600; padding: 6px 14px; border-radius: var(--r-sm);
  background: var(--danger-weak); color: var(--danger); border: 1px solid transparent;
  transition: background 0.16s ease, color 0.16s ease; cursor: pointer; }
.vs-end:hover:not(:disabled) { background: var(--danger); color: #fff5f3; }
.vs-end:active:not(:disabled) { transform: scale(0.98); }
.vs-end:disabled { background: rgba(255,255,255,0.04); color: var(--ink2); cursor: not-allowed; }
html[data-appearance="light"] .vs-end:disabled { background: rgba(0,0,0,0.04); }
/* Light: --danger on its own weak fill is 3.9:1 and --warn as small text is 3.6:1; these are 5.6:1. */
html[data-appearance="light"] .vs-end:not(:disabled) { color: #ad2c24; }
html[data-appearance="light"] .vs-state.ending, html[data-appearance="light"] .vs-state.lost { color: #8a5a0a; }
.vs-msg { display: flex; gap: 9px; padding: 0 18px 11px 41px; font-size: 12.5px; line-height: 1.45; color: var(--ink2); }
.vs-msg b { color: var(--ink); font-weight: 600; }
.vs-banner { display: flex; gap: 10px; align-items: center; padding: 10px 18px; background: var(--warn-weak);
  border-bottom: 1px solid var(--hair); font-size: 12.5px; color: var(--ink2); }
.vs-banner b { color: var(--ink); font-weight: 600; }
.vs-banner .btn { margin-left: auto; }
.vstrip.offline .vs-row { opacity: 0.74; }
/* Announcements live outside the strip: a live region holding buttons re-reads them on every refresh. */
.vs-live { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
@media (max-width: 860px) {
  .vstrip { margin: 12px 16px 0; }
  .vs-row { flex-wrap: wrap; row-gap: 4px; gap: 10px; padding: 10px 14px; }
  .vs-nm { width: auto; }
  .vs-state { width: auto; }
  .vs-head { flex-wrap: wrap; row-gap: 2px; }
  .vs-head .sub { margin-left: 0; flex-basis: 100%; }
  .vs-desc { flex-basis: 100%; order: 9; padding-left: 23px; }
  .vs-end, .vs-end-gap { margin-left: auto; min-height: 44px; }
}

/* Machines (docs/plans/relay-duo-companion.md): the member's machines and their recent turns. */
.machinespage { max-width: 760px; margin: 0 auto; padding: 32px 20px 64px; }
.machinespage h1 { font-size: 28px; font-weight: 680; letter-spacing: -0.02em; margin: 8px 0 20px; }
.machinespage h2 { font-size: 17px; font-weight: 650; margin: 28px 0 10px; }
.machinespage .back { color: var(--brand); text-decoration: none; font-weight: 500; }
.machine-list { list-style: none; margin: 0; padding: 0; border: 1px solid var(--hair-2); border-radius: 14px;
  background: var(--card); }
.machine-list li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; }
.machine-list li + li { border-top: 1px solid var(--hair-2); }
.machine-list .sub { display: block; color: var(--ink2); font-size: 13px; margin-top: 2px; }
.turns { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.turns th { text-align: left; font-size: 11px; letter-spacing: 0.07em; text-transform: uppercase; color: var(--ink2);
  padding: 6px 8px; border-bottom: 1px solid var(--hair-2); }
.turns td { padding: 8px; border-bottom: 1px solid var(--hair-2); vertical-align: top; }
.turns .mono { font-family: var(--mono); color: var(--ink2); white-space: nowrap; }
@media (max-width: 560px) { .turns th:nth-child(4), .turns td:nth-child(4) { display: none; } }
