/* Sanctum Control Plane - one stylesheet, one set of tokens.

   It looks like Sanctum because it is Sanctum's design system: the tokens,
   the typeface and the component rules below are the appliance's own
   (apps/web/src/styles.css in sanctum-poc), carried over value for value. Change
   one there and change it here, or the two stop looking like one product.

   The palette is the logo's two colours - navy #0B1638 and cyan #34B5C8 -
   and tints, shades and neutrals derived from them. Cyan on white is about
   2.3:1, so on light ground it is used for accents, rings and rules and never
   for text; on dark ground it is legible and carries text and buttons.

   Layout: a navy icon rail beside one working column, with a header that says
   where you are; at 48rem and under the rail is gone and the same
   destinations open in a drawer. Nothing is loaded from outside this origin
   (CSP), so it works on a network with no way out. */

/* The typeface: Plus Jakarta Sans, bundled rather than fetched (OFL 1.1,
   fonts/OFL.txt). Variable, 200 to 800, so the four weight tokens are four
   real weights. */
@font-face {
  font-family: "Plus Jakarta Sans";
  font-style: normal;
  font-display: swap;
  font-weight: 200 800;
  src: url("fonts/plus-jakarta-sans-latin-ext-wght-normal.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308,
    U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113,
    U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Plus Jakarta Sans";
  font-style: normal;
  font-display: swap;
  font-weight: 200 800;
  src: url("fonts/plus-jakarta-sans-latin-wght-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304,
    U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  /* brand constants: identical in both themes */
  --brand-navy: #0b1638;
  --brand-cyan: #34b5c8;

  /* light theme */
  --bg: #f5f6f9;
  --surface: #ffffff;
  --surface-raised: #ffffff;
  --surface-sunken: #f0f2f6;
  --surface-hover: #f2f4f8;
  --border: #e3e7ee;
  --border-strong: #cdd4e0;
  --text: #0b1638;
  --muted: #5b6579;

  --accent: #34b5c8;
  --accent-ink: #0b1638;
  /* The accent AS TEXT: same hue, darker, 4.93:1 on --surface. */
  --accent-text: #237b88;

  --primary: #0b1638;
  --primary-ink: #ffffff;
  --primary-hover: #1a2a5c;
  --danger: #8b2331;

  --tone-ok-bg: #e7f6ec;   --tone-ok-ink: #10692f;
  --tone-warn-bg: #fdf3e0; --tone-warn-ink: #8a5a00;
  --tone-bad-bg: #fdecea;  --tone-bad-ink: #b3261e;
  --tone-info-bg: #e6f4f7; --tone-info-ink: #0d5c69;
  --tone-bad-border: #f0c6c2;

  /* Solid status colours, for a dot or a 3px rule with no room for a tint. */
  --status-ok: #1a9c46;
  --status-warn: #b07a00;
  --status-bad: #b3261e;

  /* The rail, the drawer, the page banner and the sign-in ground are navy in
     BOTH themes, so their colours are relationships to navy, not to the page. */
  --on-navy: #dbe6f5;
  --on-navy-muted: #9fb3d1;
  --on-navy-hover: rgba(255, 255, 255, .07);
  --on-navy-active: rgba(52, 181, 200, .16);
  --on-navy-strong: #ffffff;
  --hero-gradient: linear-gradient(100deg, #0b1638 0%, #101f4a 55%, #0b1638 100%);
  --hero-glow: radial-gradient(120% 180% at 88% 50%, rgba(52, 181, 200, .28) 0%, rgba(52, 181, 200, 0) 55%);
  --hero-btn-border: rgba(255, 255, 255, .28);
  --hero-btn-bg: rgba(255, 255, 255, .1);
  --on-cyan: #04263b;

  --elevation-1: 0 1px 2px rgba(11, 22, 56, .06), 0 8px 24px -4px rgba(11, 22, 56, .14);
  --elevation-2: 0 2px 6px rgba(11, 22, 56, .06), 0 28px 56px -12px rgba(11, 22, 56, .30);
  --elevation-on-navy: 0 28px 70px rgba(0, 0, 0, .32);
  --scrim: rgba(11, 22, 56, .38);
  --shadow-card: 0 1px 2px rgba(16, 24, 40, .04), 0 1px 3px rgba(16, 24, 40, .06);

  --accent-wash: rgba(52, 181, 200, .10);
  --accent-wash-strong: rgba(52, 181, 200, .18);
  --accent-edge: rgba(52, 181, 200, .40);
  --accent-ring: 0 0 0 3px rgba(52, 181, 200, .28);

  /* The scale. A closed set, as in the appliance: picking from six sizes
     forces a decision about hierarchy; picking from forty-one is typing. */
  --space-05: 0.125rem;
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;

  --text-display: 1.75rem;
  --text-title: 1.375rem;
  --text-section: 1rem;
  --text-body: 0.9375rem;
  --text-small: 0.875rem;
  --text-label: 0.8125rem;
  --text-meta: 0.75rem;
  --text-micro: 0.6875rem;

  --weight-regular: 400;
  --weight-medium: 500;
  --weight-semibold: 600;
  --weight-bold: 700;

  --leading-tight: 1.25;
  --leading-snug: 1.4;
  --leading-normal: 1.55;

  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-pill: 999px;
  --radius-circle: 50%;
  --radius-hairline: 3px;

  /* Applied only at 48rem and under: a mouse is precise, a finger is not. */
  --tap-min: 44px;
  --rail: 5.75rem;

  --motion-instant: 80ms;
  --motion-fast: 140ms;
  --motion-base: 200ms;
  --ease-standard: cubic-bezier(.2, 0, 0, 1);

  --page-max: 84rem;
  --page-pad-x: var(--space-5);
  --page-pad-y: var(--space-5);
  --scroll-thumb: #d3d9e4;

  --mono: ui-monospace, "SFMono-Regular", "Cascadia Code", Consolas, monospace;
  font-family: "Plus Jakarta Sans", Inter, system-ui, sans-serif;
  color-scheme: light dark;
}

/* The dark palette, reachable two ways: the operating system's preference,
   standing down when somebody has chosen explicitly, and the explicit
   choice. Written twice because CSS cannot name a block and apply it under
   two conditions; this is the only place in the sheet that repeats. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --scroll-thumb: #2b3760;
    --bg: #070b1c;
    --surface: #0e1531;
    --surface-raised: #131c3b;
    --surface-sunken: #0a1027;
    --surface-hover: #16203f;
    --border: #1f2a4d;
    --border-strong: #2c3a63;
    --text: #e8edf7;
    --muted: #94a1bd;
    --accent: #34b5c8;
    --accent-text: #34b5c8;
    --accent-ink: #04263b;
    --primary: #34b5c8;
    --primary-hover: #5cc6d6;
    --primary-ink: #05192c;
    --danger: #ff9aa5;
    --tone-ok-bg: #10321c;   --tone-ok-ink: #7ee2a0;
    --tone-warn-bg: #38290c; --tone-warn-ink: #f3ce80;
    --tone-bad-bg: #3a1a17;  --tone-bad-ink: #ffb4a9;
    --tone-info-bg: #0e2e33; --tone-info-ink: #7fd6e3;
    --tone-bad-border: #6b2b25;
    --status-ok: #35c46b;
    --status-warn: #d9a441;
    --status-bad: #e5675a;
    --elevation-1: 0 0 0 1px rgba(255, 255, 255, .06), 0 12px 28px -4px rgba(0, 0, 0, .55);
    --elevation-2: 0 0 0 1px rgba(255, 255, 255, .06), 0 32px 64px -12px rgba(0, 0, 0, .7);
    --scrim: rgba(2, 5, 16, .62);
    --accent-wash: rgba(52, 181, 200, .14);
    --accent-wash-strong: rgba(52, 181, 200, .24);
    --accent-edge: rgba(52, 181, 200, .48);
    --accent-ring: 0 0 0 3px rgba(52, 181, 200, .34);
    --shadow-card: 0 1px 2px rgba(0, 0, 0, .5), 0 1px 3px rgba(0, 0, 0, .4);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --scroll-thumb: #2b3760;
  --bg: #070b1c;
  --surface: #0e1531;
  --surface-raised: #131c3b;
  --surface-sunken: #0a1027;
  --surface-hover: #16203f;
  --border: #1f2a4d;
  --border-strong: #2c3a63;
  --text: #e8edf7;
  --muted: #94a1bd;
  --accent: #34b5c8;
  --accent-text: #34b5c8;
  --accent-ink: #04263b;
  --primary: #34b5c8;
  --primary-hover: #5cc6d6;
  --primary-ink: #05192c;
  --danger: #ff9aa5;
  --tone-ok-bg: #10321c;   --tone-ok-ink: #7ee2a0;
  --tone-warn-bg: #38290c; --tone-warn-ink: #f3ce80;
  --tone-bad-bg: #3a1a17;  --tone-bad-ink: #ffb4a9;
  --tone-info-bg: #0e2e33; --tone-info-ink: #7fd6e3;
  --tone-bad-border: #6b2b25;
  --status-ok: #35c46b;
  --status-warn: #d9a441;
  --status-bad: #e5675a;
  --elevation-1: 0 0 0 1px rgba(255, 255, 255, .06), 0 12px 28px -4px rgba(0, 0, 0, .55);
  --elevation-2: 0 0 0 1px rgba(255, 255, 255, .06), 0 32px 64px -12px rgba(0, 0, 0, .7);
  --scrim: rgba(2, 5, 16, .62);
  --accent-wash: rgba(52, 181, 200, .14);
  --accent-wash-strong: rgba(52, 181, 200, .24);
  --accent-edge: rgba(52, 181, 200, .48);
  --accent-ring: 0 0 0 3px rgba(52, 181, 200, .34);
  --shadow-card: 0 1px 2px rgba(0, 0, 0, .5), 0 1px 3px rgba(0, 0, 0, .4);
}
:root[data-theme="light"] { color-scheme: light; }

/* --- base ------------------------------------------------------------------ */
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--text);
  font-size: var(--text-body); line-height: var(--leading-normal);
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
a { color: var(--accent-text); text-underline-offset: 2px; }
a:hover { color: var(--text); }
:focus-visible { outline: 2px solid var(--brand-cyan); outline-offset: 2px; }
code, .mono { font-family: var(--mono); font-size: 0.86em; overflow-wrap: anywhere; }
h2 { font-size: var(--text-section); font-weight: var(--weight-semibold); line-height: var(--leading-tight); margin: 0 0 var(--space-3); }
h3 { font-size: var(--text-small); font-weight: var(--weight-semibold); margin: var(--space-4) 0 var(--space-2); }
p { margin: 0 0 var(--space-3); max-width: 72ch; }
.muted { color: var(--muted); }
.small { font-size: var(--text-small); }
strong { font-weight: var(--weight-semibold); }
.skip {
  position: absolute; inset-inline-start: .5rem; top: -3rem; z-index: 100;
  padding: var(--space-2) var(--space-3); border-radius: var(--radius-sm);
  background: var(--primary); color: var(--primary-ink); text-decoration: none;
  font-size: var(--text-small); transition: top var(--motion-fast) var(--ease-standard);
}
.skip:focus { top: .5rem; color: var(--primary-ink); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

/* --- the shell ------------------------------------------------------------- */
.shell {
  display: grid; grid-template-columns: var(--rail) minmax(0, 1fr); min-height: 100vh;
  /* The rail is sticky and one screen tall; the column behind it is navy the
     whole length of the page, so a long page never shows the ground under it. */
  background: linear-gradient(to right, var(--brand-navy) var(--rail), transparent var(--rail));
}
.shell__main { display: flex; flex-direction: column; min-width: 0; background: var(--bg); }
/* The document scrolls, not an inner pane (as it does in the appliance's
   single-page app): a server-rendered page should print, find-in-page and
   screenshot whole. The rail and the header stay put by being sticky. */
.rail {
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; align-items: center; gap: var(--space-05);
  padding: var(--space-4) var(--space-2) var(--space-3);
  background: var(--brand-navy); color: var(--on-navy);
  overflow-x: hidden; overflow-y: auto; scrollbar-width: thin; scrollbar-color: var(--scroll-thumb) transparent;
}
.rail__brand { display: block; margin-bottom: var(--space-4); line-height: 0; }
.rail__brand img { width: 34px; height: 34px; display: block; }
.rail__nav, .rail__group { display: flex; flex-direction: column; align-items: center; gap: var(--space-05); align-self: stretch; }
.rail__group + .rail__group { margin-top: var(--space-2); padding-top: var(--space-2); border-top: 1px solid var(--on-navy-hover); }
.rail__item {
  position: relative;
  display: flex; flex-direction: column; align-items: center; gap: var(--space-1);
  width: 100%; padding: var(--space-2) var(--space-05);
  border-radius: var(--radius-md); text-align: center;
  color: var(--on-navy-muted); text-decoration: none;
}
.rail__label { font-size: var(--text-micro); line-height: 1.2; letter-spacing: .01em; max-width: 100%; overflow-wrap: anywhere; }
.rail__item:hover { background: var(--on-navy-hover); color: var(--on-navy-strong); }
.rail__item:focus-visible { outline: 2px solid var(--brand-cyan); outline-offset: 2px; }
.rail__item.is-active { background: var(--on-navy-active); color: var(--on-navy-strong); }
.rail__item.is-active svg { color: var(--brand-cyan); }
.rail__item.is-active::before {
  content: ""; position: absolute; inset-inline-start: -.45rem; top: 50%; transform: translateY(-50%);
  width: 3px; height: 1.9rem; border-radius: 0 var(--radius-hairline) var(--radius-hairline) 0; background: var(--brand-cyan);
}
.rail__foot { margin-top: auto; padding-top: var(--space-2); align-self: stretch; display: flex; flex-direction: column; align-items: center; }
.rail__theme { border: 0; background: none; cursor: pointer; font: inherit; }
/* One button, three marks: the one shown is the setting, not the result. */
.theme-mark { display: none; line-height: 0; }
.rail__theme:not([data-mode]) .theme-mark--system,
.rail__theme[data-mode="system"] .theme-mark--system,
.rail__theme[data-mode="light"] .theme-mark--light,
.rail__theme[data-mode="dark"] .theme-mark--dark { display: block; }

.shell__head {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: var(--space-4);
  padding: var(--space-3) var(--space-5); border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.shell__logo { display: flex; align-items: center; line-height: 0; flex: none; }
.shell__logo img { height: 1.75rem; width: auto; display: block; aspect-ratio: 1600 / 386; }
/* The wordmark is navy on light and white on dark; the page shows whichever
   matches the theme actually on screen. */
.wordmark--dark { display: none !important; }
:root[data-theme="dark"] .wordmark--light { display: none !important; }
:root[data-theme="dark"] .wordmark--dark { display: block !important; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .wordmark--light { display: none !important; }
  :root:not([data-theme="light"]) .wordmark--dark { display: block !important; }
}
.crumbs {
  flex: 1; display: flex; align-items: center; gap: var(--space-2);
  padding-inline-start: var(--space-4); margin-inline-start: var(--space-1);
  border-inline-start: 1px solid var(--border);
  font-size: var(--text-small); min-width: 0;
}
.crumbs__section, .crumbs__sep { color: var(--muted); white-space: nowrap; flex: none; }
.crumbs__link { color: var(--muted); text-decoration: none; white-space: nowrap; max-width: 16rem; overflow: hidden; text-overflow: ellipsis; }
a.crumbs__link:hover { color: var(--text); text-decoration: underline; }
.crumbs__here { font-weight: var(--weight-semibold); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.shell__aside { margin-inline-start: auto; flex: none; display: flex; align-items: center; gap: var(--space-3); }
.badge {
  display: inline-flex; align-items: center; gap: var(--space-2);
  padding: var(--space-2) var(--space-3); border-radius: var(--radius-pill);
  border: 1px solid var(--border); background: var(--surface);
  font-size: var(--text-meta); color: var(--muted); white-space: nowrap;
}
.shell__user { position: relative; }
.usermenu__trigger {
  display: flex; align-items: center; gap: var(--space-1);
  padding: var(--space-1); border-radius: var(--radius-pill);
  cursor: pointer; list-style: none; color: inherit;
}
.usermenu__trigger::-webkit-details-marker { display: none; }
.usermenu__trigger:hover { background: var(--bg); }
.usermenu__trigger:focus-visible { outline: 2px solid var(--brand-cyan); outline-offset: 2px; }
.avatar {
  width: var(--space-8); height: var(--space-8); border-radius: var(--radius-circle); flex: none;
  display: grid; place-items: center; font-size: var(--text-meta); font-weight: var(--weight-semibold);
  background: var(--primary); color: var(--primary-ink);
}
.usermenu {
  position: absolute; inset-inline-end: 0; top: calc(100% + .4rem); z-index: 20;
  min-width: 13rem; padding: var(--space-2);
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-md); box-shadow: var(--elevation-1);
}
/* Closed means gone: a closed disclosure's contents still had a layout box
   in Chromium, so the layout journey counted "Sign out" as a visible button
   with no name on every page. */
.shell__user:not([open]) .usermenu, .navmenu:not([open]) > :not(summary) { display: none; }
.usermenu__meta { margin: var(--space-1) var(--space-2) var(--space-2); font-size: var(--text-meta); color: var(--muted); }
.usermenu__meta strong { color: var(--text); }
.usermenu__meta span { display: block; color: var(--muted); font-size: var(--text-meta); }
.usermenu form { margin: 0; }
.usermenu__item {
  display: block; width: 100%; text-align: start; padding: var(--space-2); border: 0; border-radius: var(--radius-sm);
  background: none; cursor: pointer; font: inherit; font-size: var(--text-small); color: inherit; text-decoration: none;
}
.usermenu__item:hover { background: var(--bg); color: inherit; }
.usermenu__item:focus-visible { outline: 2px solid var(--brand-cyan); outline-offset: -2px; }

/* The phone's navigation: a drawer from the inline start, navy as the rail is. */
.navmenu { display: none; }
.shell__menu {
  display: flex; flex: none; align-items: center; justify-content: center;
  width: 2.5rem; height: 2.5rem; padding: 0; list-style: none;
  border: 1px solid var(--border); border-radius: var(--radius-md);
  background: var(--surface); color: var(--text); cursor: pointer;
}
.shell__menu::-webkit-details-marker { display: none; }
.shell__menu:hover { background: var(--bg); }
.shell__menu:focus-visible { outline: 2px solid var(--brand-cyan); outline-offset: 2px; }
.navdrawer__scrim { position: fixed; inset: 0; z-index: 60; background: var(--scrim); }
.navdrawer {
  position: fixed; inset: 0 auto 0 0; z-index: 61;
  width: min(17rem, 82vw);
  display: flex; flex-direction: column; gap: var(--space-2);
  padding: var(--space-4) var(--space-3);
  background: var(--brand-navy); color: var(--on-navy);
  overflow-y: auto; overscroll-behavior: contain;
  box-shadow: var(--elevation-2);
}
.navdrawer__head { display: flex; align-items: center; justify-content: space-between; padding-bottom: var(--space-3); border-bottom: 1px solid var(--on-navy-hover); }
.navdrawer__close {
  display: grid; place-items: center; width: 2.5rem; height: 2.5rem; padding: 0;
  border: 0; border-radius: var(--radius-md); background: none; color: var(--on-navy-muted); cursor: pointer;
}
.navdrawer__close:hover { background: var(--on-navy-hover); color: var(--on-navy-strong); }
.navdrawer__nav, .navdrawer__group { display: flex; flex-direction: column; gap: var(--space-05); }
.navdrawer__grouplabel {
  margin: var(--space-2) 0 var(--space-1) var(--space-3);
  font-size: var(--text-micro); font-weight: var(--weight-semibold);
  letter-spacing: .1em; text-transform: uppercase; color: var(--on-navy-muted);
}
.navdrawer__item {
  display: flex; align-items: center; gap: var(--space-3); min-height: 2.75rem;
  padding: var(--space-2) var(--space-3); border-radius: var(--radius-md);
  color: var(--on-navy-muted); text-decoration: none;
  font-size: var(--text-small); font-weight: var(--weight-medium);
}
.navdrawer__item:hover { background: var(--on-navy-hover); color: var(--on-navy-strong); }
.navdrawer__item.is-active { background: var(--on-navy-active); color: var(--on-navy-strong); }
.navdrawer__item.is-active svg { color: var(--brand-cyan); }
.navdrawer__item .rail__label { font-size: var(--text-small); letter-spacing: normal; }
.navdrawer__foot { margin-top: auto; padding-top: var(--space-3); border-top: 1px solid var(--on-navy-hover); }
.navdrawer__foot .rail__theme { flex-direction: row; gap: var(--space-3); justify-content: flex-start; min-height: 2.75rem; padding: var(--space-2) var(--space-3); }
.navdrawer__foot .rail__label { font-size: var(--text-small); }
body.is-locked { overflow: hidden; }

/* Not production: said on every page, in the warning tone. */
.envbar {
  padding: var(--space-2) var(--space-4); text-align: center;
  background: var(--tone-warn-bg); color: var(--tone-warn-ink);
  border-bottom: 1px solid var(--border); font-size: var(--text-label);
}
.envbar strong { letter-spacing: .05em; }

/* --- the page -------------------------------------------------------------- */
.shell__content {
  width: 100%; max-width: var(--page-max); margin-inline: auto;
  padding: var(--page-pad-y) var(--page-pad-x) var(--space-16);
}
.shell__content:focus { outline: none; }

/* The page banner: the appliance's <Page> header. Navy in both themes, the
   section's mark on the left, its eyebrow in cyan, the actions on the right. */
.head {
  position: relative; overflow: hidden;
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-5);
  min-height: 6.5rem; margin-bottom: var(--space-6);
  padding: var(--space-6);
  border-radius: var(--radius-lg);
  background: var(--hero-glow), var(--hero-gradient);
  color: var(--on-navy-strong);
}
.head > div:first-child { min-width: 0; flex: 1 1 20rem; }
.head h1 { margin: 0; font-size: var(--text-title); font-weight: var(--weight-semibold); line-height: 1.15; text-wrap: balance; overflow-wrap: anywhere; }
.head h1 code { font-size: .9em; }
.head .eyebrow, .head p.eyebrow {
  margin: 0 0 var(--space-1); font-size: var(--text-micro); font-weight: var(--weight-bold);
  text-transform: uppercase; letter-spacing: .09em; color: var(--brand-cyan);
}
.head p { color: var(--on-navy); font-size: var(--text-small); }
.head p:last-child { margin-bottom: 0; }
.head a:not(.btn) { color: var(--on-navy-strong); }
.head .actions { display: flex; gap: var(--space-2); align-items: center; flex: none; flex-wrap: wrap; min-height: 2.25rem; }
.head .btn { border-color: var(--hero-btn-border); background: var(--hero-btn-bg); color: var(--on-navy-strong); }
.head .btn:hover:not(:disabled) { background: var(--on-navy-hover); border-color: var(--hero-btn-border); color: var(--on-navy-strong); }
.head .btn-primary { background: var(--brand-cyan); border-color: var(--brand-cyan); color: var(--on-cyan); }
.head .btn-primary:hover:not(:disabled) { background: var(--brand-cyan); border-color: var(--brand-cyan); color: var(--on-cyan); filter: brightness(1.06); }
/* The section's mark, drawn from the destination the page belongs to (base.html
   sets data-mark). Decorative, so a background rather than an element. */
main[data-mark] .head::before {
  content: ""; flex: none; width: var(--space-12); height: var(--space-12);
  border-radius: var(--radius-md);
  background: var(--accent-wash-strong) center / var(--space-6) no-repeat;
}
/* MARKS: generated from templates/icons.html, white stroke on the banner. */
main[data-mark="grid"] .head::before { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='3' width='7' height='7' rx='1.5'/%3E%3Crect x='14' y='3' width='7' height='7' rx='1.5'/%3E%3Crect x='3' y='14' width='7' height='7' rx='1.5'/%3E%3Crect x='14' y='14' width='7' height='7' rx='1.5'/%3E%3C/svg%3E"); }
main[data-mark="org"] .head::before { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='9' y='3' width='6' height='5' rx='1.2'/%3E%3Crect x='3' y='16' width='6' height='5' rx='1.2'/%3E%3Crect x='15' y='16' width='6' height='5' rx='1.2'/%3E%3Cpath d='M12 8v4M6 16v-4h12v4'/%3E%3C/svg%3E"); }
main[data-mark="model"] .head::before { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='4' y='4' width='16' height='16' rx='3'/%3E%3Ccircle cx='12' cy='12' r='3'/%3E%3Cpath d='M12 4v2M12 18v2M4 12h2M18 12h2'/%3E%3C/svg%3E"); }
main[data-mark="document"] .head::before { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 3h8l4 4v14H6Z'/%3E%3Cpath d='M14 3v4h4'/%3E%3Cpath d='M9 12h6M9 15h6M9 18h4'/%3E%3C/svg%3E"); }
main[data-mark="download"] .head::before { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 4v11M7.5 10.5 12 15l4.5-4.5'/%3E%3Cpath d='M4 15v3a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-3'/%3E%3C/svg%3E"); }
main[data-mark="box"] .head::before { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 3 4 7v10l8 4 8-4V7Z'/%3E%3Cpath d='m4 7 8 4 8-4M12 11v10'/%3E%3C/svg%3E"); }
main[data-mark="key"] .head::before { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='8' cy='15' r='4'/%3E%3Cpath d='M10.85 12.15 21 2M18 5l2 2M15 8l2 2'/%3E%3C/svg%3E"); }
main[data-mark="check"] .head::before { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='m8.5 12.2 2.4 2.4 4.6-4.9'/%3E%3C/svg%3E"); }
main[data-mark="ledger"] .head::before { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 3h10a2 2 0 0 1 2 2v16H6a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2Z'/%3E%3Cpath d='M9 8h6M9 12h6M9 16h3'/%3E%3C/svg%3E"); }
main[data-mark="users"] .head::before { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='9' cy='8' r='3.2'/%3E%3Cpath d='M3.5 20a5.5 5.5 0 0 1 11 0'/%3E%3Cpath d='M16 5.5a3.2 3.2 0 0 1 0 6'/%3E%3Cpath d='M17.5 14.6A5.5 5.5 0 0 1 20.5 20'/%3E%3C/svg%3E"); }
main[data-mark="chip"] .head::before { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='7' y='7' width='10' height='10' rx='2'/%3E%3Cpath d='M10 3v4M14 3v4M10 17v4M14 17v4M3 10h4M3 14h4M17 10h4M17 14h4'/%3E%3C/svg%3E"); }
main[data-mark="gear"] .head::before { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='3'/%3E%3Cpath d='M12 2.5v3M12 18.5v3M2.5 12h3M18.5 12h3M5.3 5.3l2.1 2.1M16.6 16.6l2.1 2.1M18.7 5.3l-2.1 2.1M7.4 16.6l-2.1 2.1'/%3E%3C/svg%3E"); }

.eyebrow { margin: 0 0 var(--space-1); color: var(--muted); font-size: var(--text-micro); text-transform: uppercase; letter-spacing: .09em; font-weight: var(--weight-bold); }

/* --- surfaces -------------------------------------------------------------- */
/* A panel is the appliance's Card. Its first heading becomes the card head:
   a rule beneath, the body padded below it. */
.panel {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: var(--space-5); margin-bottom: var(--space-6); min-width: 0;
}
.panel > h2:first-child {
  margin: calc(var(--space-5) * -1) calc(var(--space-5) * -1) var(--space-5);
  padding: var(--space-4) var(--space-5); border-bottom: 1px solid var(--border);
  font-size: var(--text-section); font-weight: var(--weight-semibold); line-height: var(--leading-tight);
}
.panel > p, .panel li { font-size: var(--text-small); }
.panel > :last-child { margin-bottom: 0; }
.panel .table-wrap { box-shadow: none; }
.grid { display: grid; gap: var(--space-4); grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); margin-bottom: var(--space-6); }
.grid .panel { margin: 0; }
.cols { display: grid; gap: var(--space-6); grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); align-items: start; }

/* The appliance's Stat tile: the measure's name above, the number below. */
.stat {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: var(--space-3); align-content: start;
  padding: var(--space-4); border-radius: var(--radius-lg);
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-card);
  text-decoration: none; color: inherit;
  transition: border-color var(--motion-fast) var(--ease-standard), box-shadow var(--motion-fast) var(--ease-standard);
}
.stat > :not(.stat__mark) { grid-column: 1; }
.stat--link:hover { border-color: var(--border-strong); box-shadow: var(--elevation-1); color: inherit; }
.stat--link:focus-visible { outline: none; box-shadow: var(--accent-ring); }
.stat__mark {
  grid-column: 2; grid-row: 1 / span 3;
  display: grid; place-items: center; width: var(--space-8); height: var(--space-8);
  border-radius: var(--radius-md); background: var(--accent-wash); color: var(--accent-text);
}
.stat__label { margin: 0; font-size: var(--text-micro); font-weight: var(--weight-semibold); color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.stat__value { margin: var(--space-2) 0 0; font-size: var(--text-display); font-weight: var(--weight-semibold); line-height: 1; font-variant-numeric: tabular-nums; }
.stat__hint { margin: var(--space-1) 0 0; font-size: var(--text-meta); color: var(--muted); }

dl.facts { display: grid; grid-template-columns: minmax(9rem, max-content) 1fr; gap: var(--space-1) var(--space-4); margin: 0; font-size: var(--text-small); }
dl.facts dt { color: var(--muted); }
dl.facts dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }

/* A notice is the appliance's alert strip: a tint, its ink, and a 3px rule
   in the solid status colour. */
.notice {
  margin: 0 0 var(--space-4); padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md); border-inline-start: 3px solid var(--border-strong);
  background: var(--surface-sunken); color: var(--text); font-size: var(--text-small);
}
.notice.ok { background: var(--tone-ok-bg); color: var(--tone-ok-ink); border-inline-start-color: var(--status-ok); }
.notice.warn { background: var(--tone-warn-bg); color: var(--tone-warn-ink); border-inline-start-color: var(--status-warn); }
.notice.bad { background: var(--tone-bad-bg); color: var(--tone-bad-ink); border-inline-start-color: var(--status-bad); }
.notice.info { background: var(--tone-info-bg); color: var(--tone-info-ink); border-inline-start-color: var(--brand-cyan); }
.notice p { max-width: none; }
.notice p:last-child { margin: 0; }
.notice a { color: inherit; }

/* The appliance's Pill. */
.pill {
  display: inline-flex; align-items: center; gap: var(--space-1); vertical-align: middle;
  padding: var(--space-05) var(--space-2); border-radius: var(--radius-pill);
  font-size: var(--text-meta); font-weight: var(--weight-semibold); line-height: var(--leading-snug);
  border: 1px solid transparent; white-space: nowrap;
}
.pill--ok { background: var(--tone-ok-bg); color: var(--tone-ok-ink); }
.pill--warn { background: var(--tone-warn-bg); color: var(--tone-warn-ink); }
.pill--bad { background: var(--tone-bad-bg); color: var(--tone-bad-ink); }
.pill--info { background: var(--tone-info-bg); color: var(--tone-info-ink); }
.pill--idle { background: var(--surface-sunken); color: var(--muted); border-color: var(--border); }
.head .pill--idle { background: var(--hero-btn-bg); color: var(--on-navy); border-color: var(--hero-btn-border); }

/* --- tables ---------------------------------------------------------------- */
.table-wrap {
  overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius-lg);
  background: var(--surface); box-shadow: var(--shadow-card); margin-bottom: var(--space-4);
}
table { width: 100%; border-collapse: collapse; font-size: var(--text-small); }
th, td { text-align: start; padding: var(--space-3) var(--space-4); border-bottom: 1px solid var(--border); vertical-align: middle; }
th {
  font-size: var(--text-micro); font-weight: var(--weight-semibold); text-transform: uppercase; letter-spacing: .04em;
  color: var(--muted); background: var(--surface-sunken); white-space: nowrap;
}
tbody tr:last-child td { border-bottom: 0; }
/* A table wider than its box scrolls inside it, and a scrolling box must be
   reachable from the keyboard (axe: scrollable-region-focusable); app.js
   makes such a box focusable and names it. */
.table-wrap:focus-visible { outline: 2px solid var(--brand-cyan); outline-offset: 2px; }
td.num, th.num { text-align: end; font-variant-numeric: tabular-nums; }

/* --- forms and buttons ----------------------------------------------------- */
form.stack { display: grid; gap: var(--space-4); max-width: 44rem; }
.field { display: flex; flex-direction: column; gap: var(--space-1); }
.field label { font-size: var(--text-label); font-weight: var(--weight-semibold); }
.hint { color: var(--muted); font-size: var(--text-meta); }
.error-text { color: var(--danger); font-size: var(--text-label); font-weight: var(--weight-semibold); }
input[type=text], input[type=email], input[type=password], input[type=date], input[type=number], input[type=search], input[type=file], select, textarea {
  min-height: 2.25rem; padding: var(--space-2) var(--space-3);
  border: 1px solid var(--border-strong); border-radius: var(--radius-md);
  background: var(--surface); color: inherit; font: inherit; font-size: var(--text-small);
  width: 100%; min-width: 0;
  transition: border-color var(--motion-fast) var(--ease-standard), box-shadow var(--motion-fast) var(--ease-standard);
}
input:hover:not(:disabled):not(:focus), select:hover:not(:disabled):not(:focus), textarea:hover:not(:disabled):not(:focus) { border-color: var(--muted); }
input::placeholder, textarea::placeholder { color: var(--muted); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand-cyan); box-shadow: var(--accent-ring); }
input[type=checkbox], input[type=radio] { accent-color: var(--brand-cyan); width: 1rem; height: 1rem; margin-top: .2rem; }
input[type=checkbox]:focus-visible, input[type=radio]:focus-visible { outline: 2px solid var(--brand-cyan); outline-offset: 2px; }
textarea { min-height: 5.5rem; resize: vertical; }
input[aria-invalid=true], select[aria-invalid=true], textarea[aria-invalid=true] { border-color: var(--status-bad); box-shadow: 0 0 0 1px var(--status-bad); }
.row { display: grid; gap: var(--space-4); grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr)); }
.check { display: flex; gap: var(--space-2); align-items: flex-start; font-size: var(--text-small); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  min-height: 2.25rem; padding: 0 var(--space-4);
  border-radius: var(--radius-md); border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text); cursor: pointer;
  font: inherit; font-size: var(--text-label); font-weight: var(--weight-semibold);
  line-height: 1; white-space: nowrap; text-decoration: none;
  transition: background-color var(--motion-fast) var(--ease-standard), border-color var(--motion-fast) var(--ease-standard),
    color var(--motion-fast) var(--ease-standard), box-shadow var(--motion-fast) var(--ease-standard),
    transform var(--motion-instant) var(--ease-standard);
}
.btn:hover:not(:disabled) { background: var(--surface-hover); border-color: var(--border-strong); color: var(--text); }
.btn:active:not(:disabled) { transform: scale(.98); }
.btn:focus-visible { outline: none; box-shadow: var(--accent-ring); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.btn-primary:hover:not(:disabled) { background: var(--primary-hover); border-color: var(--primary-hover); color: var(--primary-ink); }
.btn-danger { color: var(--tone-bad-ink); border-color: var(--tone-bad-border); background: var(--tone-bad-bg); }
.btn-danger:hover:not(:disabled) { color: var(--tone-bad-ink); background: var(--tone-bad-bg); border-color: var(--status-bad); }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn[aria-busy=true] { opacity: .6; cursor: progress; }
.btn-link { background: none; border: 0; padding: 0; color: var(--accent-text); font: inherit; cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.btn-link:focus-visible { outline: 2px solid var(--brand-cyan); outline-offset: 2px; border-radius: var(--radius-sm); }
/* A destructive action is never styled as a navigation link. */
.btn-link.danger { color: var(--danger); }
.toolbar { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: flex-end; margin-bottom: var(--space-4); }
.toolbar .field { min-width: 12rem; }
details.action {
  border: 1px solid var(--border); border-radius: var(--radius-lg); padding: var(--space-3) var(--space-4);
  margin-bottom: var(--space-4); background: var(--surface); box-shadow: var(--shadow-card);
}
details.action > summary { cursor: pointer; font-size: var(--text-small); font-weight: var(--weight-semibold); }
details.action > summary:focus-visible { outline: 2px solid var(--brand-cyan); outline-offset: 2px; border-radius: var(--radius-sm); }
details.action[open] > summary { margin-bottom: var(--space-3); padding-bottom: var(--space-3); border-bottom: 1px solid var(--border); }

/* --- states, paging, steps ------------------------------------------------- */
/* The appliance's Empty: a mark, what is empty, why, and what to do. */
.empty { display: flex; flex-direction: column; align-items: center; gap: var(--space-2); padding: var(--space-12) var(--space-4); text-align: center; }
.empty__mark {
  display: grid; place-items: center; width: var(--space-12); height: var(--space-12);
  margin-bottom: var(--space-2); border-radius: var(--radius-lg);
  background: var(--surface-sunken); color: var(--muted);
}
.empty strong { font-size: var(--text-section); font-weight: var(--weight-semibold); color: var(--text); }
.empty-text { margin: 0 auto var(--space-2); color: var(--muted); font-size: var(--text-small); max-width: 34rem; }
.pager { display: flex; gap: var(--space-3); align-items: center; justify-content: flex-end; font-size: var(--text-small); }
ol.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-2); font-size: var(--text-small); }
ol.steps li { display: grid; grid-template-columns: 1.4rem 1fr; gap: var(--space-2); }
ol.steps .mark { font-weight: var(--weight-bold); }
.met { color: var(--tone-ok-ink); } .unmet { color: var(--tone-bad-ink); }
pre.code {
  background: var(--surface-sunken); border: 1px solid var(--border); border-radius: var(--radius-md);
  padding: var(--space-3); overflow-x: auto; font-family: var(--mono); font-size: var(--text-meta); max-height: 28rem;
}
.secret {
  font-family: var(--mono); font-size: var(--text-section); background: var(--tone-warn-bg); color: var(--tone-warn-ink);
  padding: var(--space-2) var(--space-3); border-radius: var(--radius-md); display: inline-block; user-select: all;
}
.timeline { list-style: none; padding: 0; margin: 0; display: grid; gap: var(--space-3); font-size: var(--text-small); }
.timeline li { border-inline-start: 3px solid var(--border-strong); padding-inline-start: var(--space-3); }

/* --- sign-in --------------------------------------------------------------- */
/* Navy in both themes, as the appliance's is: a card on the brand's ground,
   and on a wide screen what this place is, beside it. */
.login {
  min-height: 100vh; display: grid; place-items: center; align-content: center;
  padding: var(--space-6); background: var(--brand-navy);
}
.login .card {
  width: min(24rem, 100%); display: flex; flex-direction: column; gap: var(--space-4);
  padding: var(--space-6); border-radius: var(--radius-lg); background: var(--surface);
  box-shadow: var(--elevation-on-navy);
}
.login .card > * { margin: 0; }
.login__brand { display: flex; justify-content: center; }
.login__logo { width: min(15rem, 80%); height: auto; display: block; aspect-ratio: 1600 / 386; }
.login h1 { font-size: var(--text-section); font-weight: var(--weight-semibold); text-align: center; }
.login .eyebrow { text-align: center; color: var(--accent-text); }
.login .card p { font-size: var(--text-small); }
.login form.stack { gap: var(--space-4); }
.login .btn { width: 100%; }
.login .notice { margin: 0; }
.login__aside { display: none; }
@media (min-width: 64rem) {
  .login:has(> .login__aside) { grid-template-columns: minmax(0, 28rem) minmax(0, 24rem); justify-content: center; column-gap: var(--space-16); }
  .login__aside { display: flex; flex-direction: column; gap: var(--space-8); color: var(--on-navy); }
}
.login__aside-title {
  margin: 0; font-size: var(--text-display); font-weight: var(--weight-bold);
  line-height: var(--leading-tight); letter-spacing: -.02em; color: var(--on-navy-strong);
}
.login__points { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--space-5); }
.login__points li { display: flex; align-items: flex-start; gap: var(--space-3); font-size: var(--text-body); line-height: var(--leading-normal); }
.login__points svg { flex: none; width: 1.25rem; height: 1.25rem; margin-top: var(--space-05); color: var(--brand-cyan); }
.login__footnote { font-size: var(--text-meta) !important; color: var(--muted); text-align: center; }

/* --- the container across devices ----------------------------------------- */
@media (min-width: 48rem) {
  :root { --page-pad-x: 1.5rem; --page-pad-y: 1.5rem; }
}
@media (min-width: 64rem) {
  :root { --page-pad-x: 2rem; --page-pad-y: 1.75rem; }
}
@media (min-width: 100rem) {
  :root { --page-pad-x: 2.5rem; }
}
@media (max-width: 64rem) {
  .cols { grid-template-columns: minmax(0, 1fr); }
  .crumbs__section, .crumbs__sep, .crumbs__link { display: none; }
  .crumbs { border-inline-start: 0; padding-inline-start: var(--space-2); }
  .badge { display: none; }
  .head { padding: var(--space-4) var(--space-5); }
  .head h1 { font-size: var(--text-section); }
}

/* Phone and portrait tablet: the rail is gone and navigation is the drawer.
   A 92px navy column on a 390px screen took a quarter of it, permanently. */
@media (max-width: 48rem) {
  :root { --page-pad-x: .875rem; --page-pad-y: 1rem; }
  .shell { grid-template-columns: minmax(0, 1fr); background: none; }
  .rail { display: none; }
  .navmenu { display: block; }
  .shell__logo { display: none; }
  .shell__head { gap: var(--space-3); padding: var(--space-2) var(--space-3); }
  /* The appliance's phone banner: the mark beside the title, the actions
     below both. As a wrapping flex row the mark took a line of its own. */
  .head {
    display: grid; grid-template-columns: minmax(0, 1fr); align-items: start;
    min-height: 0; padding: var(--space-4); border-radius: var(--radius-md); gap: var(--space-3);
  }
  main[data-mark] .head { grid-template-columns: auto minmax(0, 1fr); }
  main[data-mark] .head::before { width: var(--space-10); height: var(--space-10); }
  .head .actions { grid-column: 1 / -1; width: 100%; }
  .grid:has(> .stat) { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-2); }
  .grid > .stat { padding: var(--space-3); }
  .grid > .stat .stat__mark { display: none; }
  .stat__value { font-size: var(--text-title); }
  .btn, .shell__menu, .usermenu__trigger, .usermenu__item, .skip,
  input[type=text], input[type=email], input[type=password], input[type=date], input[type=number], input[type=search], select {
    min-height: var(--tap-min);
  }
  .shell__menu { width: var(--tap-min); }
  .navdrawer__close { min-width: var(--tap-min); min-height: var(--tap-min); }
  dl.facts { grid-template-columns: 1fr; gap: var(--space-05); }
  dl.facts dd { margin-bottom: var(--space-2); }
}

/* Phone: data tables become one labelled block per row. Scrolling sideways
   inside a 390px box hid whole columns - the users table's Status, the audit
   trail's event text - and cut status labels at the edge, with nothing to say
   there was more (screenshot review, hardening sprint). app.js marks every
   table in a .table-wrap with .stack and copies each column's heading into its
   cells' data-label, and sets explicit ARIA roles so the table keeps its
   meaning once display changes; templates may set them themselves (users).
   Without the script a table keeps its own sideways scroll. At 48rem and
   under, the appliance's narrow width - its tables stack there too. */
@media (max-width: 48rem) {
  table.stack thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  table.stack, table.stack tbody, table.stack tr, table.stack td { display: block; width: 100%; }
  table.stack tr { padding: var(--space-3) var(--space-4); border-bottom: 1px solid var(--border); }
  table.stack tbody tr:last-child { border-bottom: 0; }
  /* The label is IN the flow (a grid column), so a long one - "Requester may
     approve" - wraps and the row grows; positioned absolutely it overlapped
     the next row's label (screenshot re-review, N1). app.js wraps each cell's
     content in one .cell-value so the grid has exactly two items. */
  table.stack td { display: grid; grid-template-columns: 7.5rem minmax(0, 1fr); gap: var(--space-2); align-items: baseline; border: 0; padding: var(--space-1) 0; text-align: start; overflow-wrap: anywhere; }
  table.stack td::before { content: attr(data-label); color: var(--muted); font-size: var(--text-micro); text-transform: uppercase; letter-spacing: .04em; overflow-wrap: break-word; }
  table.stack td[data-label=""] { grid-template-columns: minmax(0, 1fr); }
  table.stack td[data-label=""]::before { display: none; }
  table.stack .cell-value > .pill { display: inline-flex; }
  table.stack .pill { white-space: normal; }
  pre.code { white-space: pre-wrap; overflow-wrap: anywhere; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
  .btn:active:not(:disabled) { transform: none; }
}

/* Layout helpers, instead of inline styles (which the CSP refuses). */
.actions-row { display: flex; gap: var(--space-2); flex-wrap: wrap; }
.pre { white-space: pre-wrap; }
.mt-2 { margin-top: var(--space-2); } .mt-3 { margin-top: var(--space-3); } .mt-4 { margin-top: var(--space-4); }
.mb-3 { margin-bottom: var(--space-3); }
.self-center { align-self: center; }

/* Codes such as auth.second_factor.failure break at their dots, not mid-word. */
code.token { overflow-wrap: normal; word-break: normal; }
