/* Kitsune Foundry design system (HANDOFF.md §4).
   Palette: charcoal #24232B / charcoal-deep #18171D / purple #7851A9 /
   purple-soft #A98BDA / floral #FFF9EF. Glass panels over soft purple light
   blobs + faint grain; purple glow only on focus/primary/active.

   R3 rhythm: one 6-step spacing scale (--sp-1..--sp-6) drives every gap,
   padding and margin; one content width (--w-page) drives every page, so the
   top bar is exactly as wide as the content under it. UI text is 1.45, dense
   data 1.35. */

:root {
  --charcoal: #24232B;
  --charcoal-deep: #18171D;
  --purple: #7851A9;
  --purple-hover: #855FBB;
  --purple-soft: #A98BDA;
  --purple-link: #CDB8EC;
  --floral: #FFF9EF;
  --floral-dim: rgba(255, 249, 239, .68);
  --line: rgba(255, 249, 239, .10);
  --line-strong: rgba(255, 249, 239, .22);
  --ok: #5FBF8F;
  --warn: #E3B341;
  --bad: #E5677A;
  /* Text tints: the raw status hues fail 4.5:1 on the aurora-lit glass. */
  --ok-text: #7FD3A9;
  --warn-text: #EFCB78;
  --bad-text: #F2A9B4;
  /* Diff lines: one green for added, one red for removed. */
  --add: #6EE7A0;
  --add-text: #B8F5CF;
  --del: #F28B9A;
  --del-text: #FFC7CF;
  /* Six type sizes replace 27; four radii replace 13. */
  --fs-xs: .6875rem;
  --fs-sm: .8125rem;
  --fs-base: .875rem;
  --fs-md: .9375rem;
  --fs-lg: 1.375rem;
  --fs-xl: 1.75rem;
  --r-xs: 4px;
  --r-sm: 6px;
  --r-md: 8px;
  --r-lg: 10px;
  --r-xl: 14px;
  /* The spacing scale. Every gap/padding/margin below uses one of these. */
  --sp-1: .25rem;
  --sp-2: .5rem;
  --sp-3: .75rem;
  --sp-4: 1rem;
  --sp-5: 1.5rem;
  --sp-6: 2rem;
  /* One content width for every page: the top bar spans exactly this. */
  --w-page: 84rem;
  /* UI text vs dense data. */
  --lh-ui: 1.45;
  --lh-data: 1.35;
  --font-head: "Jost", sans-serif;
  --font-ui: "IBM Plex Sans", sans-serif;
  --font-mono: "JetBrains Mono", monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}
/* No scrollbar-gutter reservation: the reserved lane was not covered by the
   fixed backdrop and showed as a dark band down the right edge. The glow lives
   on the root canvas so the whole viewport is painted. */
html {
  /* Glow on the root canvas: it propagates to the whole viewport, so the
     reserved scrollbar lane is painted too. */
  background:
    radial-gradient(38rem 38rem at 18% 12%, rgba(120, 81, 169, .22) 0%, rgba(120, 81, 169, 0) 70%),
    radial-gradient(42rem 42rem at 85% 88%, rgba(120, 81, 169, .18) 0%, rgba(120, 81, 169, 0) 72%),
    var(--charcoal-deep);
  background-attachment: fixed;
}

body {
  /* Transparent on purpose: the canvas (html) paints the glow across the whole
     viewport, gutter included. An opaque body would cover it inside the
     scrollbar lane's width. */
  background: transparent;
  color: var(--floral);
  font-family: var(--font-ui);
  font-size: 15px;
  line-height: var(--lh-ui);
  -webkit-font-smoothing: antialiased;
}

/* Soft purple light fields behind the glass + faint grain (U3).
   The glow lives on the root canvas (see `html` above) so it also paints the
   scrollbar gutter; this box only carries the grain. */
.backdrop {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
}
.backdrop::before, .backdrop::after {
  content: "";
  position: absolute;
  width: 36rem;
  height: 36rem;
  border-radius: 50%;
  filter: blur(100px);
  background: rgba(120, 81, 169, .25);
}
.backdrop::before { top: -12rem; left: -10rem; }
.backdrop::after { bottom: -14rem; right: -12rem; opacity: .8; }
.backdrop .grain {
  position: absolute;
  inset: 0;
  opacity: .05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

h1, h2, h3 { font-family: var(--font-head); font-weight: 500; letter-spacing: .01em; }
h1 { font-size: var(--fs-xl); line-height: 1.25; margin: 0 0 var(--sp-1); }
h2 { font-size: 1.1rem; line-height: 1.3; margin: 0 0 var(--sp-2); }
h3 { line-height: 1.3; }
.muted { color: var(--floral-dim); }
.mono { font-family: var(--font-mono); font-size: .92em; }
/* A timestamp or id never wraps mid-value in a data cell. */
.data-table td.mono, .info-table td.mono { white-space: nowrap; }

a { color: var(--purple-link); text-decoration: none; }
a:hover { text-decoration: underline; }
/* Links inside prose are underlined, never colour-only (WCAG 1.4.1). Prose
   and real content links only: paragraphs, notes, table cells and definition
   lists. A blanket `td a, li a` also underlined every row of the approval rail
   and the device picker, so the containers named below are excluded outright. */
p a, td a, li a, dd a, summary a,
.ap-note a, .ap-p a, .fine-print a, .mini-text a, .muted a {
  text-decoration: underline;
  text-decoration-color: rgba(169, 139, 218, .45);
  text-underline-offset: 2px;
}
a.btn, a.btn-primary, a.linkish,
.ap-item a, .ap-items a, nav a, .topbar a, .dcard a, .crf-dev-list a,
.view-tabs a, .seg a, .crumbs a {
  text-decoration: none;
}

/* Skip link: first tab stop on every page, jumps past the top bar. */
.skip {
  position: fixed;
  left: -9999px;
  top: var(--sp-4);
  z-index: 60;
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--r-md);
  background: var(--charcoal);
  color: var(--floral);
  border: 1px solid var(--line-strong);
}
.skip:focus,
.skip:focus-visible { left: var(--sp-4); text-decoration: none; }
#main-content:focus { outline: none; }

/* Glass panel (U3): frosted glass over the glow, restrained.
   The floor is near-opaque so panel contrast never swings with the light
   fields, and there is no backdrop-filter: a blur under every panel was the
   main paint cost on low-end laptops. One padding for every panel; the dense
   surfaces (approval list, device picker) opt down to --sp-3 internally. */
.glass {
  background-color: rgba(30, 28, 37, .86);
  background-image: linear-gradient(rgba(255, 249, 239, .035), rgba(255, 249, 239, .035));
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  box-shadow: inset 0 1px 0 rgba(255, 249, 239, .07), 0 14px 34px rgba(0, 0, 0, .35);
  padding: var(--sp-4);
}

/* One page box, one width. The top bar is its first child, so the bar and
   every panel below it share the exact same left/right edges. */
.page {
  max-width: var(--w-page);
  margin: 0 auto;
  padding: var(--sp-4) var(--sp-5);
}

/* App shell top bar (U1): brand lockup, nav, user area. Sticky, so the nav and
   Sign out stay reachable on /reports and /devices. It floats: a rounded
   translucent card inset --sp-2 from the viewport top, not a full-bleed slab. */
.topbar {
  position: sticky;
  top: var(--sp-2);
  z-index: 20;
  background: rgba(30, 28, 37, .94);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: 0 8px 24px rgba(0, 0, 0, .28);
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-2) var(--sp-3);
  margin-bottom: var(--sp-4);
}
/* The brand never wraps and never shrinks: "Kitsune Foundry" stays one line. */
.topbar .brand {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  flex: none;
  white-space: nowrap;
  color: var(--floral);
}
.topbar .brand:hover { text-decoration: none; }
.topbar .logo { height: 28px; width: auto; display: block; flex: none; }
.topbar .brand-name {
  font-family: var(--font-head);
  font-size: 1.05rem;
  font-weight: 500;
  letter-spacing: .04em;
  white-space: nowrap;
}
/* The nav gives up space before the brand does. */
.topnav {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: var(--sp-1);
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}
.topnav::-webkit-scrollbar { display: none; }
.topnav a {
  padding: var(--sp-1) var(--sp-3);
  border-radius: var(--r-md);
  color: var(--floral-dim);
  font-size: var(--fs-base);
  white-space: nowrap;
}
.topnav a:hover { color: var(--floral); text-decoration: none; background: rgba(255, 249, 239, .06); }
.topnav a.active {
  color: var(--floral);
  background: rgba(120, 81, 169, .30);
  box-shadow: 0 0 0 1px rgba(120, 81, 169, .45), 0 0 12px rgba(120, 81, 169, .25);
}
.topbar .spacer { flex: 1 1 auto; min-width: var(--sp-2); }
.topbar .who {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  flex: 0 1 auto;
  min-width: 0;
  text-align: left;
  line-height: 1.2;
  font-size: var(--fs-md);
}
.nav-toggle {
  display: none;
  margin-top: 0;
  padding: var(--sp-1) var(--sp-2);
  border: 1px solid var(--line);
  background: none;
  color: var(--floral);
  flex: none;
}
.nav-toggle .icon { width: 20px; height: 20px; }

/* Mid widths: the avatar stays (the operator is still identifiable), the name
   and role text drop out before the brand could ever wrap. */
@media (max-width: 1240px) {
  .topbar .who .who-text { display: none; }
}
@media (max-width: 940px) {
  button.signout span { display: none; }
  button.signout { padding: var(--sp-2) var(--sp-2); }
}

/* Mobile nav (U1): collapse into a menu button. */
@media (max-width: 760px) {
  .nav-toggle { display: inline-block; }
  .topnav {
    display: none;
    position: absolute;
    top: calc(100% + var(--sp-1));
    left: 0;
    right: 0;
    z-index: 10;
    flex-direction: column;
    align-items: stretch;
    overflow: visible;
    padding: var(--sp-2);
    border-radius: var(--r-lg);
    border: 1px solid var(--line);
    background: rgba(24, 23, 29, .97);
    box-shadow: 0 14px 34px rgba(0, 0, 0, .5);
  }
  .topnav.open { display: flex; }
  .topnav a { padding: var(--sp-2) var(--sp-3); }
  /* One row on phones: brand, spacer, avatar, Sign out, menu. The name and role
     hide, the avatar stays so the operator is still identifiable. */
  .topbar { flex-wrap: nowrap; gap: var(--sp-2); padding: var(--sp-2) var(--sp-2); }
  .topbar .who { display: flex; }
  .topbar .who .who-text { display: none; }
  .topbar .who .avatar { width: 26px; height: 26px; }
  .topbar .brand { min-width: 0; }
  .topbar .brand-name { overflow: hidden; text-overflow: ellipsis; }
  .nav-toggle { order: 5; }
}

/* Forms. One base rule for every text-ish control: type=search, email, number
   and untyped inputs used to fall through into per-page patches. */
label { display: block; font-size: var(--fs-sm); color: var(--floral-dim); margin: var(--sp-3) 0 var(--sp-1); }
input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]),
select,
textarea {
  width: var(--input-w, 100%);
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--r-md);
  border: 1px solid var(--line);
  background: rgba(24, 23, 29, .55);
  color: var(--floral);
  font: inherit;
  line-height: var(--lh-data);
}
input[type="checkbox"], input[type="radio"] { width: auto; }
::placeholder { color: rgba(255, 249, 239, .50); opacity: 1; }
input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--purple-soft);
  outline-offset: 1px;
  border-color: var(--purple-soft);
}
/* Dense surfaces keep their tighter metrics: the approval rail, the change
   request form, the device and CR filters. */
.ap-search input, .ap-page input:not([type]), .ap-page textarea, .ap-page select,
.ap-resolve select, .crf-filter, .device-search {
  padding: var(--sp-1) var(--sp-2);
  font-size: var(--fs-base);  /* 14 px, as before */
  /* Dense, but never under the 32 px control floor. */
  min-height: 2rem;
  height: 2rem;
  padding-block: 0;
  box-sizing: border-box;
}
/* The base control rule out-specifies a bare class, so the exception travels
   through the variable instead: dense fields opt out of the 100% width. */
.device-search { --input-w: auto; width: auto; }
button, .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  min-height: 2.25rem;
  margin-top: var(--sp-3);
  padding: var(--sp-2) var(--sp-4);
  border-radius: var(--r-md);
  border: 1px solid var(--line);
  background: rgba(255, 249, 239, .06);
  color: var(--floral);
  font: inherit;
  line-height: var(--lh-data);
  cursor: pointer;
}
button:hover, .btn:hover { background: rgba(255, 249, 239, .10); text-decoration: none; }
/* One primary vocabulary: .primary on buttons, .btn-primary on buttons and on
   links, unscoped. The inbox emits btn-primary, the CR page emits primary. */
button.primary, button.btn-primary, a.btn-primary {
  background: var(--purple);
  border-color: var(--purple);
  color: var(--floral);
}
/* Link-shaped primary: a bare <a> has no radius, height or centring of its
   own, so the un-scoped colour rule alone left it square. Padding stays with
   the size class (.btn-sm) so it keeps its dense metrics. */
a.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.25rem;
  border-radius: var(--r-md);
}
button.primary:hover, button.btn-primary:hover, a.btn-primary:hover {
  background: var(--purple-hover);
  text-decoration: none;
}
button.primary:focus-visible, button:focus-visible, a:focus-visible {
  outline: 2px solid var(--purple-soft);
  outline-offset: 2px;
  box-shadow: 0 0 0 4px rgba(120, 81, 169, .35);
}
/* Inline link-style control, for <button> and <a>. The padding grows the hit
   area past 32 px; the negative margin cancels it, so the text sits exactly
   where it used to. */
button.linkish, a.linkish {
  display: inline-flex;
  align-items: center;
  min-height: 2rem;
  background: none;
  border: none;
  padding: var(--sp-2) var(--sp-1);
  margin: calc(var(--sp-2) * -1) calc(var(--sp-1) * -1);
  color: var(--purple-link);
  cursor: pointer;
  font: inherit;
}
button.linkish:hover, a.linkish:hover { text-decoration: underline; background: none; }
.check-label {
  display: flex;
  gap: var(--sp-2);
  align-items: center;
  margin-top: var(--sp-2);
}
.btn-sm { padding: var(--sp-1) var(--sp-3); min-height: 2rem; font-size: var(--fs-base); }

/* ===================== Neon HUD panels (T10: /account, /admin/users) ===================== */
/* Scoped to .hud-panel so /login, /base and /ledger keep their existing look.
   Static decoration: no motion. */
.hud-panel { position: relative; overflow-x: auto; }  /* same glass as /base: no neon edge, no texture */
/* One eyebrow: mono, uppercase, purple. Every card loses a duplicated eyebrow
   line, so this now only labels a page head. */
.eyebrow-head, .hub-eyebrow, .mini-block h3 {
  font: 500 var(--fs-sm)/1.35 var(--font-mono);
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--purple-soft);
}
.eyebrow-head { display: block; }
/* Page head: eyebrow, title and subtitle sit on the tight half of the scale. */
.hud-page-head { margin: 0; padding: var(--sp-3) 0 var(--sp-4); }
.hud-page-head h1 { margin: var(--sp-1) 0 0; font-size: var(--fs-xl); line-height: 1.25; letter-spacing: .01em; }
.hud-page-head .muted { margin: var(--sp-1) 0 0; font-size: var(--fs-md); }
/* Same right-side alignment for the Ledger head: its links row shares the
   h1 baseline like .mon-head (the lift lives with that rule). */
.hud-page-head.ap-head, .ap-head { align-items: flex-end; }
.hud-page-head.ap-head > .ap-head-links,
.ap-head > .ap-head-links { padding-bottom: calc(0.25 * var(--fs-xl) + var(--sp-1)); }

/* Neon status chips. Purple dominates; one extra neon accent (cyan) marks
   active/ok states. Status colours only — never decoration. */
.chip-row { display: flex; flex-wrap: wrap; gap: var(--sp-2); margin: var(--sp-2) 0 var(--sp-3); }
.chip {
  display: inline-flex;
  align-items: center;
  font: 500 .75rem/1.35 var(--font-mono);
  letter-spacing: .04em;
  text-transform: uppercase;
  border: 1px solid rgba(169, 139, 218, .38);
  border-radius: var(--r-xs);
  padding: var(--sp-1) var(--sp-2);
  background: rgba(120, 81, 169, .12);
  color: var(--purple-soft);
  white-space: nowrap;
  vertical-align: middle;
}
.chip-ok {
  color: var(--ok-text);
  border-color: rgba(95, 191, 143, .38);
  background: rgba(95, 191, 143, .08);
  box-shadow: none;
}
.chip-off { color: rgba(255, 249, 239, .82); border-color: var(--line-strong); background: rgba(255, 249, 239, .04); box-shadow: none; }
.chip-warn { color: var(--warn-text); border-color: rgba(245, 190, 90, .45); background: rgba(245, 190, 90, .10); box-shadow: none; }
.chip-bad {
  color: var(--bad-text);
  border-color: rgba(229, 103, 122, .45);
  background: rgba(229, 103, 122, .10);
  box-shadow: none;
}
/* Role chip: identity, not status — same family as .chip, purple tint. */
.chip-role { color: var(--purple-link); border-color: rgba(169, 139, 218, .38); }

/* Buttons: grouped rows, primary vs secondary vs danger (red neon edge). */
.btn-row { display: flex; flex-wrap: wrap; gap: var(--sp-2); margin-top: var(--sp-3); }
.btn-row button { margin-top: 0; }
button.btn-danger, .btn.btn-danger {
  background: rgba(229, 103, 122, .08);
  border-color: rgba(229, 103, 122, .55);
  color: var(--bad-text);
  box-shadow: 0 0 12px rgba(229, 103, 122, .16), inset 0 0 10px rgba(229, 103, 122, .06);
}
button.btn-danger:hover {
  background: rgba(229, 103, 122, .16);
  box-shadow: 0 0 18px rgba(229, 103, 122, .30), inset 0 0 10px rgba(229, 103, 122, .08);
}

/* /account: a symmetric 2x2. Cards are as tall as their own content and stay
   top-aligned: an equal-height row would leave a large hole under the short
   card, so the pairs are not stretched. */
.kv-table { width: 100%; margin-top: var(--sp-1); }
.kv-table th, .kv-table td { font-size: var(--fs-base); line-height: var(--lh-data); padding: var(--sp-1) 0; border-bottom: 1px solid var(--line); }
.kv-table th { width: 1%; white-space: nowrap; padding-right: var(--sp-4); font-weight: 400; color: var(--floral-dim); }
.kv-table td { text-align: right; color: var(--floral); overflow-wrap: anywhere; }
.kv-table td.mono { font-size: var(--fs-sm); letter-spacing: .01em; } /* mono runs wider: optically match the UI text */
.kv-table tr:last-child th, .kv-table tr:last-child td { border-bottom: none; }
.account-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--sp-4);
  align-items: stretch;
}
.account-col { display: flex; flex-direction: column; gap: var(--sp-4); min-width: 0; }
.account-col > .glass { display: flex; flex-direction: column; margin: 0; }
.account-col > .glass:last-child { flex: 1 1 auto; }
.account-col > .glass > :last-child { margin-bottom: 0; }
/* A card that is only a status line keeps it as plain paragraph text at the
   top of the card: no stretched inner box, no vertically centred sentence. */
.card-note { margin: var(--sp-2) 0 0; font-size: var(--fs-base); }
.account-col > .glass > .chip-row + .kv-table { margin-top: var(--sp-2); }
@media (max-width: 900px) {
  .account-grid { grid-template-columns: minmax(0, 1fr); }
}

/* Alerts / flash messages */
.flash { border-radius: var(--r-md); padding: var(--sp-2) var(--sp-3); margin: var(--sp-3) 0; border: 1px solid var(--line); font-size: var(--fs-base); }
.flash.error {
  color: var(--bad-text);
  border-color: rgba(229, 103, 122, .4);
  background: rgba(229, 103, 122, .08);
}
.flash.error:focus-visible { outline: 2px solid var(--bad-text); outline-offset: 2px; }
.flash.ok { color: var(--ok-text); border-color: rgba(95, 191, 143, .4); background: rgba(95, 191, 143, .06); }

code, .code {
  font-family: var(--font-mono);
  background: rgba(24, 23, 29, .6);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 2px var(--sp-1);
}

table { border-collapse: collapse; width: 100%; }
th, td { text-align: left; padding: var(--sp-1) var(--sp-3); border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-weight: 500; color: var(--floral-dim); font-size: var(--fs-sm); line-height: var(--lh-data); }
td { line-height: var(--lh-data); }

/* Vertical spacing between stacked panels (replaces inline styles, S10). */
.stacked { margin-top: var(--sp-4); }

/* QR: the SVG has a viewBox and no fixed size, so it scales instead of being cropped.
   The quiet zone comes from the QR border (4 modules), not CSS padding. */
.qr svg { background: #fff; border-radius: var(--r-md); display: block; box-sizing: border-box;
  width: min(15rem, 100%); height: auto; aspect-ratio: 1 / 1; }
/* Centered QR (U4). */
.qr-center { display: flex; justify-content: center; margin: var(--sp-3) 0; }

/* Key + copy row (U4/U5). */
.key-row {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  justify-content: center;
  flex-wrap: wrap;
  margin: var(--sp-2) 0;
}
.totp-key { letter-spacing: .04em; }
.temp-password { font-size: 1.05rem; letter-spacing: .04em; }
.warn-note { color: var(--warn-text); }

.icon { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.5;
        stroke-linecap: round; stroke-linejoin: round; vertical-align: -.2em; }

/* Login / TOTP / forced password / error cards: one width, one padding, one
   centred title block. */
.login-wrap {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--sp-4);
}
.login-card { width: 100%; max-width: 21rem; text-align: center; padding: var(--sp-5) var(--sp-5) var(--sp-4); }
.login-card .logo { height: 48px; margin: 0 auto var(--sp-3); display: block; }
.login-card h1 { font-size: var(--fs-lg); line-height: 1.3; letter-spacing: .03em; margin: 0 0 var(--sp-3); }
.login-card .muted { font-size: var(--fs-base); margin: 0 0 var(--sp-3); }
.login-card form { text-align: left; }
.login-card form label:first-child { margin-top: 0; }
.login-card button { width: 100%; }
.login-foot {
  color: var(--floral-dim);
  font-size: var(--fs-sm);
  margin-top: var(--sp-4);
}

footer.page-foot { color: var(--floral-dim); font-size: var(--fs-sm); padding: var(--sp-4) 0 var(--sp-6); }

/* Admin users (T10 neon restyle): real table on desktop, stacked HUD cards on
   narrow screens. Mono digits keep the timestamp column aligned. */
.user-table-wrap { overflow-x: auto; }
.user-table th {
  font: 500 var(--fs-sm)/var(--lh-data) var(--font-mono);
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--purple-soft);
  border-bottom: 1px solid rgba(169, 139, 218, .30);
  padding: var(--sp-1) var(--sp-2);
  white-space: nowrap;
}
.user-table td {
  padding: var(--sp-1) var(--sp-2);
  font-size: var(--fs-base);
  line-height: var(--lh-data);
  vertical-align: middle;
}
/* Long usernames get a real floor so they wrap to 2 tidy lines instead of
   3-4 fragments; the display-name column flexes with the natural layout
   (break-ui worst-case finding). 7.5rem keeps the nine columns inside the
   shared content width without sideways scrolling. */
.user-table td:nth-child(1) { min-width: 7.5rem; }
.user-table tbody tr:hover td { background: rgba(120, 81, 169, .08); }
.td-time { font-size: var(--fs-base); white-space: nowrap; font-variant-numeric: tabular-nums; }
.user-table td.mono, .user-card .v.mono { overflow-wrap: anywhere; }
.role-form {
  display: flex;
  gap: var(--sp-1);
  align-items: center;
}
.role-form select { width: auto; min-height: 2rem; padding: var(--sp-1) var(--sp-2); font-size: var(--fs-base); }
.role-form button { margin-top: 0; padding: var(--sp-1) var(--sp-2); font-size: var(--fs-base); min-height: 2rem; }
td.actions { white-space: nowrap; text-align: right; }
/* stacked so the column stays narrow and never scrolls out of the panel */
td.actions form { display: block; margin: 0; }
td.actions form + form { margin-top: var(--sp-1); }
td.actions button.linkish { font-size: var(--fs-base); }
td.actions button.linkish.danger, .user-card button.linkish.danger { color: var(--bad-text); }
td.actions button.linkish.danger:hover, .user-card button.linkish.danger:hover { text-decoration: underline; }
.user-table td.td-time { white-space: normal; min-width: 6.5rem; max-width: 7.5rem; }
.user-card .actions form { display: inline-block; margin-right: var(--sp-2); }
.user-cards { display: none; }
.user-table th:last-child { text-align: right; }
/* Row chips are one step smaller, like .data-table td .chip elsewhere. */
.user-table td .chip { font-size: var(--fs-xs); padding: 1px var(--sp-2); }

/* Create-user form: its own panel, two-column field grid on desktop. */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
  gap: 0 var(--sp-4);
  align-items: end;
}
.form-grid label { margin-top: var(--sp-2); }
/* One control height inside the field grid: a native <select> rounds its line
   box up 1px, which left the Role cell 0.7px taller than its neighbours. */
.form-grid input:not([type="checkbox"]):not([type="hidden"]),
.form-grid select { height: 2.4375rem; padding-block: 0; }
.form-field-check { display: flex; align-items: end; padding-bottom: var(--sp-1); }
.form-field-check .check-label { margin-top: 0; }

@media (max-width: 760px) {
  .user-table-wrap { display: none; }
  .user-cards { display: grid; gap: var(--sp-3); margin-top: var(--sp-4); }
  .user-card .user-card-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--sp-3);
    padding-bottom: var(--sp-2);
    border-bottom: 1px solid rgba(169, 139, 218, .25);
  }
  .user-card .user-card-head .mono { overflow-wrap: anywhere; }
  .user-card .kv {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--sp-3);
    padding: var(--sp-2) 0;
    border-bottom: 1px solid var(--line);
  }
  .user-card .kv:last-of-type { border-bottom: none; }
  .user-card .k { color: var(--floral-dim); font-size: var(--fs-sm); flex-shrink: 0; }
  .user-card .v { text-align: right; min-width: 0; }
  .user-card .role-form { justify-content: flex-end; }
  .user-card .user-card-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: var(--sp-1) var(--sp-3);
    padding-top: var(--sp-2);
  }
  .user-card .user-card-actions form { margin: 0; }
}

/* Phones: the device type filter scrolls sideways instead of wrapping to 3 rows. */
@media (max-width: 760px) {
  .seg { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .seg::-webkit-scrollbar { display: none; }
}

@media (max-width: 480px) {
  .page { padding: var(--sp-3); }
  .glass { padding: var(--sp-3); }
  .login-card { padding: var(--sp-4); }
}

/* Phone keyboards zoom pages with inputs under 16px (mobile-native). Coarse
   pointers also get 44 px top-bar controls. */
@media (pointer: coarse) {
  input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]),
  select,
  textarea { font-size: 16px; }
  .nav-toggle, button.signout { min-width: 44px; min-height: 44px; justify-content: center; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* htmx indicator (replaces the style tag htmx would inject) */
.htmx-indicator { opacity: 0; transition: opacity 200ms ease-in; }
.htmx-request .htmx-indicator, .htmx-request.htmx-indicator { opacity: 1; }

/* 6-digit authentication code: centered digits, room on both sides so a
   password-manager icon on the right cannot push the text off-center. */
.otp-label { display: block; text-align: center; }
input.otp-input {
  text-align: center;
  font-size: 1.5rem;
  letter-spacing: .45em;
  text-indent: .45em;          /* balances the trailing letter-spacing */
  padding-inline: 2.75rem;
  font-variant-numeric: tabular-nums;
}
input.otp-input::placeholder { letter-spacing: .45em; }

/* ===================== Backdrop light fields ===================== */
/* Static on purpose (performance): painted once and cached. The old version
   drifted three 90px-blurred fields and three breathing glows forever, under
   panels that each re-blurred the backdrop (backdrop-filter) every frame, which
   pinned the GPU on low-end laptops. */
.backdrop::before, .backdrop::after { display: none; }
.aurora { position: absolute; inset: 0; }
.aurora-field { position: absolute; border-radius: 50%; }
.af1 { width: 48rem; height: 48rem; left: -14rem; top: -18rem;
  background: radial-gradient(closest-side, rgba(120, 81, 169, .30), rgba(120, 81, 169, 0)); }
.af2 { width: 44rem; height: 44rem; right: -14rem; bottom: -18rem;
  background: radial-gradient(closest-side, rgba(120, 81, 169, .24), rgba(120, 81, 169, 0)); }
.af3 { width: 34rem; height: 34rem; left: 40%; top: 30%;
  background: radial-gradient(closest-side, rgba(169, 139, 218, .07), rgba(169, 139, 218, 0)); }

/* The hub shares the one content width; only the card grid is capped so two
   portals stay card-sized instead of stretching across 84rem. */
.hub-hello { display: grid; justify-items: center; gap: var(--sp-2); text-align: center; padding: var(--sp-6) 0 var(--sp-5); }
.hub-clock { font-variant-numeric: tabular-nums; }
.hub-hello h1 { margin: 0; font-size: clamp(1.9rem, 4.4vw, 2.8rem); line-height: 1.2;
  text-wrap: balance; overflow-wrap: anywhere; max-width: 100%; }
.hub-sub { margin: 0; color: var(--floral-dim); }

/* Two rows, each always full: Tools (3, or 4 with Beacon) and Settings (1 for
   most people, 3 for admins). auto-fit collapses empty tracks, so a row never
   ends with an orphan card or a hole. */
.hub-group { max-width: 72rem; margin: 0 auto var(--sp-2); font: 500 var(--fs-xs)/1.35 var(--font-mono);
  letter-spacing: .1em; text-transform: uppercase; color: var(--purple-soft); }
.portals { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 13rem), 1fr)); gap: var(--sp-4);
  max-width: 72rem; margin: 0 auto var(--sp-5); perspective: 1100px; }
.portals-compact .portal { padding: var(--sp-4); gap: var(--sp-2); }
.portals-compact .tile-icon { width: 36px; height: 36px; }
.portals-compact .tile-icon .icon { width: 18px; height: 18px; }
.portal {
  position: relative; overflow: hidden; display: grid; gap: var(--sp-3); align-content: start;
  padding: var(--sp-5) var(--sp-5) var(--sp-4); border-radius: var(--r-xl); color: var(--floral);
  transition: border-color 200ms ease, box-shadow 200ms ease;
  --mx: 50%; --my: 0%;
}
.portal > * { position: relative; }
.portal h2 { margin: 0; font-size: 1.25rem; }
.portal-top { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); }
.portal-stat { font: 500 var(--fs-sm)/1.35 var(--font-mono); color: var(--floral-dim);
  border: 1px solid var(--line); border-radius: 999px; padding: 2px var(--sp-2); white-space: nowrap; }
.portal-stat-hot { color: var(--warn-text); border-color: rgba(227, 179, 65, .4); background: rgba(227, 179, 65, .08); }
.portal p { margin: 0; color: var(--floral-dim); }
/* Pointer spotlight (fill) + a lit border that follows the pointer. hub.js sets --mx/--my. */
.portal-glow, .portal::before {
  position: absolute; inset: 0; pointer-events: none; opacity: 0; transition: opacity 260ms ease;
}
.portal-glow { background: radial-gradient(22rem circle at var(--mx) var(--my), rgba(120, 81, 169, .36), transparent 60%); }
.portal::before {
  content: ""; border-radius: inherit; padding: 1px;
  background: radial-gradient(14rem circle at var(--mx) var(--my), rgba(201, 178, 240, .9), transparent 70%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
          mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
}
/* Light sheen that crosses the card on hover. */
.portal::after {
  content: ""; position: absolute; top: -50%; bottom: -50%; left: -60%; width: 40%;
  background: linear-gradient(100deg, transparent, rgba(255, 249, 239, .10), transparent);
  transform: skewX(-18deg); transition: left 700ms cubic-bezier(.2, .8, .2, 1); pointer-events: none;
}
a.portal:hover { text-decoration: none; border-color: rgba(169, 139, 218, .35);
  box-shadow: inset 0 1px 0 rgba(255, 249, 239, .07), 0 0 32px rgba(120, 81, 169, .30), 0 22px 44px rgba(0, 0, 0, .40); }
a.portal:hover .portal-glow, a.portal:hover::before { opacity: 1; }
a.portal:hover::after { left: 130%; }
a.portal:focus-visible { outline: 2px solid var(--purple-soft); outline-offset: 3px; }
.tile-icon { width: 44px; height: 44px; border-radius: var(--r-lg); display: grid; place-items: center;
  background: rgba(120, 81, 169, .28); box-shadow: 0 0 0 1px rgba(169, 139, 218, .35), 0 0 18px rgba(120, 81, 169, .35); }
.tile-icon .icon { width: 22px; height: 22px; }
.portal-go { display: inline-flex; align-items: center; gap: var(--sp-1); font-size: var(--fs-md); color: var(--purple-soft); }
.portal-go .icon { width: 16px; height: 16px; vertical-align: 0; transition: transform 200ms cubic-bezier(.2, .8, .2, 1); }
a.portal:hover .portal-go .icon { transform: translateX(3px); }
/* Dim the contents, not the card: hub.js animates the card's own opacity to 1. */
.portal.soon > * { opacity: .6; }
.portal.soon .tile-icon { background: rgba(255, 249, 239, .06); box-shadow: 0 0 0 1px var(--line); }
.soon-badge { font: 500 var(--fs-xs)/1.35 var(--font-ui); letter-spacing: .08em; text-transform: uppercase;
  color: var(--floral-dim); border: 1px solid var(--line); border-radius: 999px; padding: 1px var(--sp-2); }

@media (max-width: 480px) {
  .hub-hello { padding: var(--sp-5) 0 var(--sp-4); }
  .portal { padding: var(--sp-4) var(--sp-4) var(--sp-3); }
}

/* ---------- Topbar user area: avatar, name over role, ghost sign-out ---------- */
.avatar {
  width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; flex: none;
  font: 500 var(--fs-sm) var(--font-head); color: var(--floral);
  background: linear-gradient(140deg, rgba(120, 81, 169, .85), rgba(80, 52, 120, .85));
  box-shadow: 0 0 0 1px rgba(169, 139, 218, .45), 0 0 12px rgba(120, 81, 169, .35);
}
.who-text { display: grid; line-height: 1.2; min-width: 0; }
.who-name { font-size: var(--fs-base); color: var(--floral); max-width: 16rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who-role { font: 500 var(--fs-xs)/1.35 var(--font-mono); letter-spacing: .08em; text-transform: uppercase; color: var(--purple-soft); }
.signout-form { margin: 0; flex: none; }
button.signout {
  margin: 0; display: inline-flex; align-items: center; gap: var(--sp-1);
  padding: var(--sp-1) var(--sp-3); border-radius: var(--r-md); font-size: var(--fs-sm); line-height: 1.2;
  color: var(--floral-dim); background: transparent; border: 1px solid var(--line);
  transition: color 160ms ease, border-color 160ms ease, background 160ms ease;
}
button.signout .icon { width: 15px; height: 15px; vertical-align: 0; }
button.signout:hover { color: var(--floral); background: rgba(255, 249, 239, .06); border-color: rgba(169, 139, 218, .4); }

/* ---------- Page entrance on every app page (CSS only) ---------- */
/* Opacity + rise only: a filter on glass (backdrop-filter) panels flickers.
   The /base hub has its own Motion-driven entrance, so it is excluded. */
@keyframes page-rise { from { opacity: 0; transform: translateY(14px); } }
body:not(.hub-page) .page > :not(.topbar),
.login-card, .login-foot {
  animation: page-rise 620ms cubic-bezier(.23, 1, .32, 1) backwards;
}
body:not(.hub-page) .page > :nth-child(2) { animation-delay: 40ms; }
body:not(.hub-page) .page > :nth-child(3) { animation-delay: 110ms; }
body:not(.hub-page) .page > :nth-child(4) { animation-delay: 180ms; }
body:not(.hub-page) .page > :nth-child(5) { animation-delay: 250ms; }
body:not(.hub-page) .page > :nth-child(n+6) { animation-delay: 320ms; }
.account-col > * { animation: page-rise 620ms cubic-bezier(.23, 1, .32, 1) backwards; }
.account-col + .account-col > :nth-child(1) { animation-delay: 80ms; }
.account-col > :nth-child(2) { animation-delay: 150ms; }
.account-col + .account-col > :nth-child(2) { animation-delay: 220ms; }
.login-foot { animation-delay: 200ms; }

/* Users table: same type scale as the /account profile list. */
.user-table td.mono { font-size: var(--fs-sm); }
.plain-list { margin: var(--sp-3) 0 0; padding: 0; list-style: none; display: grid; gap: var(--sp-2); }
.plain-list li { display: flex; gap: var(--sp-3); align-items: baseline; color: var(--floral-dim); }
.plain-list li::before { content: ""; flex: none; width: 6px; height: 6px; border-radius: 50%; background: var(--purple-soft);
  box-shadow: 0 0 8px rgba(169, 139, 218, .6); transform: translateY(-1px); }

/* Reports page: headline numbers + section spacing. */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr)); gap: var(--sp-3); margin: var(--sp-3) 0 var(--sp-4); }
.stat { display: flex; flex-direction: column; gap: var(--sp-1); padding: var(--sp-3) var(--sp-4); border: 1px solid var(--line); border-radius: var(--r-lg); background: rgba(255, 249, 239, .03); }
.stat-num { font: 500 var(--fs-xl) var(--font-mono); color: var(--floral); line-height: 1.1; }
.stat-label { font-size: var(--fs-sm); color: var(--floral-dim); }
.stat-warn { border-color: rgba(245, 190, 90, .45); }
.stat-warn .stat-num { color: var(--warn-text); }
.stat-bad { border-color: rgba(229, 103, 122, .45); }
.stat-bad .stat-num { color: var(--bad-text); }
.hud-panel h3 { margin: var(--sp-4) 0 var(--sp-2); font-size: 1rem; }
.hud-panel .data-table { display: table; width: 100%; }
.diff-links { display: flex; flex-wrap: wrap; gap: var(--sp-1) var(--sp-3); font-size: var(--fs-sm); }

/* Config diff view (Unimus-style): one row per line, red = removed, green = added. */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.change-summary { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2) var(--sp-4); margin-bottom: var(--sp-3); }
.sum-add { font: 500 1rem var(--font-mono); color: var(--add); }
.sum-del { font: 500 1rem var(--font-mono); color: var(--del); }
.changed-by { margin: var(--sp-1) 0 var(--sp-3); font-size: var(--fs-base); }
.view-tabs { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-1); margin: var(--sp-2) 0 var(--sp-3); }
.view-tabs a { padding: var(--sp-1) var(--sp-3); border: 1px solid var(--line); border-radius: var(--r-md); color: var(--floral-dim); font-size: var(--fs-base); display: inline-flex; align-items: center; min-height: 2rem; box-sizing: border-box; }
.view-tabs a:hover { text-decoration: none; color: var(--floral); border-color: rgba(169, 139, 218, .55); }
.view-tabs a.active { color: var(--floral); background: rgba(120, 81, 169, .28); border-color: rgba(169, 139, 218, .6); }
.view-note { font-size: var(--fs-sm); }
.legend { margin-left: auto; display: flex; gap: var(--sp-2); font-size: var(--fs-sm); }
.lg { padding: 1px var(--sp-2); border-radius: var(--r-xs); }
.lg-add { background: rgba(46, 160, 67, .22); color: var(--add); }
.lg-del { background: rgba(229, 103, 122, .20); color: var(--del); }
.code-wrap { position: relative; display: flex; flex-direction: column; min-width: 0; }
/* Copy affordance: a chip in the block's top-right corner; on phones a slim
   strip above the block, so it never covers a scrolled config line. */
.code-head { position: absolute; top: .3rem; right: .3rem; z-index: 1; }
.copy-btn {
  margin: 0; padding: 0 var(--sp-2); gap: 0; min-height: 1.5rem;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid transparent; border-radius: var(--r-xs);
  background: var(--charcoal); border-color: var(--line-strong); color: var(--floral-dim); font: 500 var(--fs-xs)/1 var(--font-ui);
  letter-spacing: .02em; cursor: pointer;
}
.copy-btn:focus-visible { outline: 2px solid var(--purple-soft); outline-offset: 2px; }
@media (hover: hover) and (pointer: fine) {
  .copy-btn:hover { color: var(--floral); background: #33313c; }
}
@media (prefers-reduced-motion: no-preference) {
  .copy-btn { transition: color 120ms ease, background-color 120ms ease, border-color 120ms ease; }
}
/* Phones: a full 32 px touch target. */
@media (max-width: 640px) {
  .copy-btn { min-height: 2rem; padding: 0 var(--sp-3); }
  .code-head { position: static; display: flex; justify-content: flex-end; padding: 0 0 var(--sp-1); }
}
.code-view { font: var(--fs-sm)/1.4 var(--font-mono); border: 1px solid var(--line); border-radius: var(--r-lg); overflow-x: auto; background: rgba(10, 6, 18, .45); padding: var(--sp-1) 0; }
.cl { display: flex; min-width: max-content; padding: 0 var(--sp-3) 0 var(--sp-1); }
.cl-sign { width: 1.2rem; flex: none; text-align: center; user-select: none; }
.cl-no { width: 3.2rem; flex: none; text-align: right; padding-right: var(--sp-2); color: rgba(255, 249, 239, .52); user-select: none; }
.cl-text { white-space: pre; }
.cl-add { background: rgba(46, 160, 67, .18); color: var(--add-text); }
.cl-add .cl-sign { color: var(--add); }
.cl-del { background: rgba(229, 103, 122, .16); color: var(--del-text); }
.cl-del .cl-sign { color: var(--del); }
.cl-head { color: var(--purple-link); font-weight: 500; }
.cl-ctx { color: var(--floral-dim); }
.cl-gap { color: rgba(255, 249, 239, .55); font-style: italic; padding: 1px var(--sp-5); }
/* Numbered variant (full / current config): align the two gutter numbers. */
.code-numbered .cl { padding-left: var(--sp-1); }
.code-numbered .cl-no { font-variant-numeric: tabular-nums; }
.fine-print { font-size: var(--fs-sm); margin-top: var(--sp-3); }
.change-list { margin: var(--sp-2) 0 0; }
.change-list > summary { cursor: pointer; color: var(--floral-dim); font-size: var(--fs-base); }
.change-item { margin: var(--sp-3) 0 0; }
.change-item-head { display: flex; flex-wrap: wrap; gap: var(--sp-1) var(--sp-3); align-items: baseline; font-size: var(--fs-base); margin-bottom: var(--sp-1); }

.text-bad { color: var(--bad-text); }
.crumbs { margin: var(--sp-2) 0 0; font-size: var(--fs-base); color: var(--floral-dim); }

/* Devices: toolbar — one row of 2rem controls, evenly gapped. */
.device-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2) var(--sp-4); margin: var(--sp-4) 0 var(--sp-2); }
.seg { display: inline-flex; flex-wrap: wrap; gap: var(--sp-1); padding: var(--sp-1); border: 1px solid var(--line); border-radius: var(--r-lg); background: rgba(255, 249, 239, .03); }
.seg .seg-btn { margin: 0; padding: var(--sp-1) var(--sp-3); border: 0; border-radius: var(--r-md); background: transparent; color: var(--floral-dim); font-size: var(--fs-base); min-height: 2rem; display: inline-flex; align-items: center; }
.seg .seg-btn:hover { background: rgba(255, 249, 239, .07); color: var(--floral); }
.seg .seg-btn.active { background: rgba(120, 81, 169, .45); color: var(--floral); }
.seg-n { font: 500 var(--fs-sm) var(--font-mono); opacity: .8; margin-left: var(--sp-1); }
.attn-toggle { display: inline-flex; align-items: center; gap: var(--sp-2); font-size: var(--fs-base); color: var(--floral-dim); margin: 0; }
.device-search { margin-left: auto; min-width: min(22rem, 100%); }
.device-toolbar input[type="search"] { min-height: 2rem; height: 2rem; padding: 0 var(--sp-2); font-size: var(--fs-base); }
.device-toolbar .btn-primary, .device-toolbar .btn-sm, .device-toolbar a.btn-sm { margin: 0; min-height: 2rem; height: 2rem; padding: var(--sp-1) var(--sp-3); }
.device-toolbar .btn-row button { margin: 0; }

/* Devices: groups + cards — one calm line of status per device */
.device-group { margin-top: var(--sp-5); }
.group-title { font-size: 1rem; font-weight: 600; margin: 0 0 var(--sp-2); padding-bottom: var(--sp-2); border-bottom: 1px solid var(--line); }
.group-title .muted { font-size: var(--fs-base); font-weight: 400; margin-left: var(--sp-1); }
.device-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr)); gap: var(--sp-3); }
.dcard { display: flex; align-items: center; gap: var(--sp-3); padding: var(--sp-3); border-radius: var(--r-lg); border: 1px solid var(--line); background: rgba(22, 16, 34, .55); color: var(--floral); transition: border-color 140ms ease, background-color 140ms ease; min-width: 0; }
.dcard:hover { text-decoration: none; border-color: rgba(169, 139, 218, .55); background: rgba(34, 25, 52, .7); }
.dcard-problem { border-left: 3px solid var(--bad); }
.dcard-body { display: flex; flex-direction: column; gap: 0; min-width: 0; flex: 1; }
.dcard-name { font-weight: 600; font-size: var(--fs-md); line-height: 1.35; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dcard-sub { font-size: var(--fs-xs); line-height: var(--lh-data); color: var(--floral-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dcard-status { display: flex; align-items: center; gap: var(--sp-1); margin-top: var(--sp-1); font-size: var(--fs-sm); line-height: var(--lh-data); color: var(--floral-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tone-bad { color: var(--bad-text); }
.tone-warn { color: var(--warn-text); }
.dot { width: .45rem; height: .45rem; border-radius: 50%; flex: none; background: rgba(255, 249, 239, .3); }
.dot-ok { background: var(--ok); }
.dot-warn { background: var(--warn); }
.dot-bad { background: var(--bad); }
.empty-note { margin-top: var(--sp-5); }

/* Vendor logos: monochrome Simple Icons, tinted per vendor via CSS mask */
.vlogo { display: inline-grid; place-items: center; flex: none; width: 2.5rem; height: 2.5rem; border-radius: var(--r-md); background: rgba(255, 249, 239, .05); border: 1px solid var(--line); }
.vlogo-lg { width: 3.4rem; height: 3.4rem; border-radius: var(--r-lg); }
.vlogo-mark { width: 58%; height: 58%; background: var(--floral-dim); -webkit-mask-position: center; mask-position: center; -webkit-mask-size: contain; mask-size: contain; -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat; }
.vlogo-text { font: 700 var(--fs-xs) var(--font-ui); letter-spacing: .02em; color: var(--floral-dim); }
.vlogo-lg .vlogo-text { font-size: .95rem; }
.vm-mikrotik { -webkit-mask-image: url("logos/mikrotik.svg"); mask-image: url("logos/mikrotik.svg"); background: #D5DDE3; }
.vm-juniper { width: 90%; height: 90%; -webkit-mask-image: url("logos/juniper.svg"); mask-image: url("logos/juniper.svg"); background: #9CCB4E; }
.vm-dell { -webkit-mask-image: url("logos/dell.svg"); mask-image: url("logos/dell.svg"); background: #4FAEE6; }
.vm-huawei { -webkit-mask-image: url("logos/huawei.svg"); mask-image: url("logos/huawei.svg"); background: #FF5B5B; }
.vm-linux { -webkit-mask-image: url("logos/linux.svg"); mask-image: url("logos/linux.svg"); background: #F5C93A; }
.vm-cisco { -webkit-mask-image: url("logos/cisco.svg"); mask-image: url("logos/cisco.svg"); background: #4FBDEB; }
.vm-generic { -webkit-mask-image: url("logos/generic.svg"); mask-image: url("logos/generic.svg"); }
.vt-h3c { color: #F06A7C; }

/* Device detail: header, side details, main history */
.device-head { display: flex; align-items: center; gap: var(--sp-4); margin: var(--sp-3) 0 var(--sp-4); }
.device-head-text { min-width: 0; }
.device-head h1 { margin: 0; overflow-wrap: anywhere; }
.device-head p { margin: var(--sp-1) 0 0; font-size: var(--fs-base); }
.head-pills { display: flex; flex-wrap: wrap; gap: var(--sp-2); margin-left: auto; }
.head-status { margin: 0; font-size: var(--fs-base); padding: var(--sp-1) var(--sp-3); border: 1px solid var(--line); border-radius: 999px; color: var(--floral); }
.head-status.tone-bad { color: var(--bad-text); border-color: rgba(229, 103, 122, .45); }
.dot-off { background: rgba(255, 249, 239, .3); }

/* Device detail: overview (LibreNMS-style) + graphs side by side. Two columns
   that each size to their content; the shorter panel keeps its content at the
   top instead of stretching a hole. */
.device-top { display: grid; grid-template-columns: minmax(20rem, 34rem) minmax(0, 1fr); gap: var(--sp-4); align-items: start; margin-bottom: var(--sp-4); }
.device-top .hud-panel { margin: 0; }
.overview-panel h2, .graphs-panel h2 { font-size: 1rem; margin: 0 0 var(--sp-3); }
.graphs-panel { display: flex; flex-direction: column; }
.graphs-panel .fine-print { margin-top: var(--sp-3); }
.info-table { width: 100%; border-collapse: collapse; font-size: var(--fs-base); }
.info-table th { text-align: left; font-weight: 400; color: var(--floral-dim); padding: var(--sp-1) var(--sp-4) var(--sp-1) 0; white-space: nowrap; vertical-align: middle; width: 1%; }
.info-table td { padding: var(--sp-1) 0; overflow-wrap: anywhere; line-height: var(--lh-data); }
.info-table tr + tr th, .info-table tr + tr td { border-top: 1px solid var(--line); }
.mini-block { margin-top: var(--sp-4); }
.hud-panel .mini-block h3 { margin: 0 0 var(--sp-2); font-size: var(--fs-xs); letter-spacing: .1em; }
.mini-text { margin: 0; font-size: var(--fs-base); }
.port-pills { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); }
.port-pills .ppill { margin: 0; }
.ppill { font-size: var(--fs-sm); padding: var(--sp-1) var(--sp-2); border-radius: var(--r-md); border: 1px solid var(--line); background: rgba(255, 249, 239, .04); color: var(--floral-dim); }
.ppill b { color: var(--floral); font-weight: 600; margin-left: var(--sp-1); }
.ppill-ok { border-color: rgba(95, 191, 143, .4); }
.ppill-ok b { color: var(--ok-text); }
.ppill-bad { border-color: rgba(229, 103, 122, .5); }
.ppill-bad b { color: var(--bad-text); }
.ppill-off b { color: var(--floral-dim); }
.avail-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--sp-2); }
.avail { display: flex; flex-direction: column; padding: var(--sp-2); border-radius: var(--r-md); border: 1px solid var(--line); background: rgba(255, 249, 239, .03); }
.avail-num { font: 500 var(--fs-md) var(--font-mono); }
.avail-label { font-size: var(--fs-xs); line-height: var(--lh-data); color: var(--floral-dim); }
.avail-ok .avail-num { color: var(--ok-text); }
.avail-warn .avail-num { color: var(--warn-text); }
.avail-bad .avail-num { color: var(--bad-text); }
.panel-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--sp-2); margin-bottom: var(--sp-2); }
.panel-head h2 { margin: 0; }
.view-tabs-sm { margin: 0; }
.graph-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-3); }
/* Phones: two columns would leave a 48px graph, so the cards stack. */
@media (max-width: 520px) {
  .graph-grid { grid-template-columns: minmax(0, 1fr); }
}
.graph { margin: 0; padding: var(--sp-2); border-radius: var(--r-lg); background: #FBFAF7; }
.graph figcaption { font-size: var(--fs-sm); font-weight: 600; color: #2B2733; margin: 0 0 var(--sp-1) var(--sp-1); }
.graph img { display: block; width: 100%; height: auto; }
.history-item { padding: var(--sp-4) 0; border-bottom: 1px solid var(--line); }
.history-item:first-of-type { padding-top: 0; }
.history-item:last-child { border-bottom: 0; padding-bottom: 0; }
.history-head { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-1) var(--sp-3); margin-bottom: var(--sp-2); font-size: var(--fs-base); }
.history-head .who { color: var(--floral); font-weight: 600; }
.history-open { margin-left: auto; }
.kind-form { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2) var(--sp-3); margin-top: var(--sp-4); padding-top: var(--sp-3); border-top: 1px solid var(--line); font-size: var(--fs-base); }
.kind-form label { flex-basis: 100%; margin: 0; }
.kind-form select { flex: 1; width: auto; min-width: 0; padding: var(--sp-1) var(--sp-2); border-radius: var(--r-md); background: rgba(10, 6, 18, .6); color: var(--floral); border: 1px solid var(--line); }
.kind-form button { margin-top: 0; }
@media (max-width: 1100px) {
  .device-top { grid-template-columns: minmax(0, 1fr); }
  .head-pills { margin-left: 0; }
  .device-head { flex-wrap: wrap; }
}
[hidden] { display: none !important; }  /* cards use display:flex; keep the hidden attribute working */

/* ===================== Change approval inbox (/ledger) ===================== */
/* Calm by default: colour only where it carries meaning (risk, +/- lines, one status pill). */
.ap-head { display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--sp-2) var(--sp-5); margin: var(--sp-3) 0 var(--sp-4); }
.ap-head h1 { margin: var(--sp-1) 0 0; }
.ap-tabs { display: flex; gap: var(--sp-1); padding: var(--sp-1); border: 1px solid var(--line); border-radius: var(--r-md); align-items: center; }
.ap-tabs a { padding: var(--sp-1) var(--sp-3); border-radius: var(--r-md); color: var(--floral-dim); font-size: var(--fs-base); display: inline-flex; align-items: center; min-height: 2rem; box-sizing: border-box; }
.ap-tabs a:hover { text-decoration: none; color: var(--floral); }
.ap-tabs a.active { color: var(--floral); background: rgba(255, 249, 239, .08); }
.ap-count { margin-left: var(--sp-1); font: 500 var(--fs-sm) var(--font-mono); color: var(--floral-dim); }
.ap-count-hot { color: var(--warn-text); }
.ap-head-links { display: flex; align-items: center; gap: var(--sp-4); margin-left: auto; font-size: var(--fs-base); min-height: 2rem; }
.ap-flash { margin: 0 0 var(--sp-3); padding: var(--sp-2) var(--sp-3); border-radius: var(--r-md); font-size: var(--fs-base); border: 1px solid; }
.ap-flash-ok { color: var(--add-text); border-color: rgba(95, 191, 143, .35); background: rgba(95, 191, 143, .06); }
.ap-flash-bad { color: var(--del-text); border-color: rgba(229, 103, 122, .4); background: rgba(229, 103, 122, .06); }

/* Two panels, one row: the list stretches to the detail, so both bottom edges
   land on the same line. The item list is the only scroll region. */
.ap-split { display: grid; grid-template-columns: minmax(18rem, 23rem) minmax(0, 1fr); gap: var(--sp-4); align-items: stretch; }
.ap-list { padding: var(--sp-3) var(--sp-2); margin: 0; display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.ap-search input:focus-visible { outline: 2px solid var(--purple-soft); border-color: var(--purple-soft); }
.ap-chips { display: flex; flex-wrap: wrap; gap: var(--sp-1); margin: var(--sp-2) 0; }
.ap-chip { font-size: var(--fs-sm); line-height: var(--lh-data); padding: var(--sp-1) var(--sp-2); border-radius: var(--r-sm); color: var(--floral-dim); border: 1px solid transparent; }
.ap-chip span { margin-left: var(--sp-1); font-family: var(--font-mono); font-size: var(--fs-sm); opacity: .8; }
.ap-chip:hover { text-decoration: none; color: var(--floral); background: rgba(255, 249, 239, .04); }
.ap-chip.active { color: var(--floral); background: rgba(255, 249, 239, .08); border-color: var(--line); }
.ap-chip-bad { color: var(--bad-text); }
.ap-chip-bad:hover { color: var(--bad-text); }
.ap-items { list-style: none; margin: 0; padding: 0; overflow-y: auto; flex: 1; min-height: 0; }
.ap-item { position: relative; display: flex; align-items: flex-start; gap: var(--sp-1); border-radius: var(--r-md); border-bottom: 1px solid rgba(255, 249, 239, .05); }
.ap-item > a { flex: 1; min-width: 0; display: block; padding: var(--sp-2); color: var(--floral); border-radius: var(--r-md); }
.ap-item > a:hover { text-decoration: none; background: rgba(255, 249, 239, .035); }
.ap-item.is-sel > a { background: rgba(120, 81, 169, .2); box-shadow: inset 2px 0 0 var(--purple-soft); }
.ap-check { margin: var(--sp-2) 0 0 var(--sp-1); accent-color: var(--purple); }
.ap-item-top { display: flex; gap: var(--sp-2); align-items: center; }
.ap-dot { flex: none; width: .45rem; height: .45rem; border-radius: 50%; background: var(--floral-dim); opacity: .5; }
.ap-dot-bad { background: var(--bad); opacity: 1; }
.ap-dot-warn { background: var(--warn); opacity: 1; }
.ap-dot-info { background: var(--purple-soft); opacity: 1; }
.ap-dot-ok { background: var(--ok); opacity: 1; }
.ap-item-title { flex: 1; min-width: 0; font-size: var(--fs-base); font-weight: 500; line-height: var(--lh-data); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ap-age { flex: none; font-size: var(--fs-xs); line-height: var(--lh-data); color: var(--floral-dim); white-space: nowrap; }
.ap-item-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 0 var(--sp-3); margin: var(--sp-1) 0 0 var(--sp-4); font-size: var(--fs-xs); line-height: var(--lh-data); color: var(--floral-dim); }
.ap-item-meta .mono { opacity: .8; }
.ap-item-dev { overflow-wrap: anywhere; }
.ap-lines { font-family: var(--font-mono); }
.ap-risk-txt { font-weight: 500; }
.ap-risk-high { color: var(--bad-text); }
.ap-risk-med { color: var(--warn-text); }
.ap-risk-low { color: var(--floral-dim); }
.risk { padding: 0 var(--sp-1); border-radius: var(--r-sm); font: 600 .75rem/1.5 var(--font-mono); letter-spacing: .04em; border: 1px solid; }
.risk-high { color: var(--bad-text); border-color: rgba(229, 103, 122, .6); }
.risk-med { color: var(--warn-text); border-color: rgba(227, 179, 65, .55); }
.risk-low { color: var(--floral-dim); border-color: var(--line); }
.t-add { color: var(--add); font-family: var(--font-mono); }
.t-del { color: var(--del); font-family: var(--font-mono); }
.tone-ok { color: var(--ok-text); }
.ap-empty { padding: var(--sp-5) var(--sp-4); text-align: center; font-size: var(--fs-md); }
.ap-empty-detail { padding: var(--sp-5) var(--sp-4); }
.ap-empty p { margin: var(--sp-1) 0; }
.ap-bulk { margin-top: var(--sp-2); padding-top: var(--sp-2); border-top: 1px solid var(--line); }
.ap-bulk-row { display: flex; gap: var(--sp-1); }
.ap-bulk-row input { flex: 1; min-width: 0; }
.ap-bulk-row button { margin: 0; }

/* Detail */
.ap-detail { padding: var(--sp-4); min-width: 0; }
.ap-back { display: none; font-size: var(--fs-base); margin-bottom: var(--sp-2); }
.ap-d-head { padding-bottom: var(--sp-4); margin-bottom: var(--sp-4); border-bottom: 1px solid var(--line); }
.ap-crumb { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); font-size: var(--fs-sm); line-height: var(--lh-data); color: var(--floral-dim); }
.ap-pill { display: inline-block; padding: 0 var(--sp-2); border-radius: 999px; font-size: var(--fs-xs); line-height: 1.6; font-weight: 500; color: var(--floral-dim); background: rgba(255, 249, 239, .07); }
.ap-pill-bad { color: var(--bad-text); background: rgba(229, 103, 122, .14); }
.ap-pill-warn { color: var(--warn-text); background: rgba(227, 179, 65, .13); }
.ap-pill-info { color: var(--purple-link); background: rgba(120, 81, 169, .22); }
.ap-pill-ok { color: var(--ok-text); background: rgba(95, 191, 143, .13); }
.ap-title { font-size: var(--fs-lg); font-weight: 600; margin: var(--sp-2) 0 0; line-height: 1.25; overflow-wrap: anywhere; }
.ap-title a { color: inherit; }
.ap-sub { margin: 0; color: var(--floral-dim); font-size: var(--fs-md); }
.ap-meta { list-style: none; display: flex; flex-wrap: wrap; gap: 0; margin: var(--sp-3) 0 0; padding: 0; font-size: var(--fs-base); line-height: var(--lh-data); }
.ap-meta li { overflow-wrap: anywhere; }
.ap-meta li + li::before { content: "·"; margin: 0 var(--sp-2); color: var(--floral-dim); opacity: .6; }

.ap-body { display: grid; grid-template-columns: minmax(0, 1fr) minmax(17rem, 21rem); grid-template-areas: "main rail"; gap: var(--sp-4); align-items: start; }
.ap-main { grid-area: main; min-width: 0; }
.ap-main > section + section { margin-top: var(--sp-5); }
.ap-rail { grid-area: rail; min-width: 0; }
.ap-rail-h { margin: 0 0 var(--sp-2); font-size: var(--fs-md); font-weight: 600; }
.ap-resolve, .ap-resolved { padding: var(--sp-3); border-radius: var(--r-lg); border: 1px solid var(--line); background: rgba(255, 249, 239, .025); font-size: var(--fs-base); }
.ap-resolved p { margin: var(--sp-1) 0; }
.ap-label { display: block; margin: 0 0 var(--sp-1); font-size: var(--fs-sm); color: var(--floral-dim); }
.ap-page textarea { width: 100%; resize: vertical; min-height: 3.4rem; }
.ap-page textarea:focus-visible, .ap-page input:not([type]):focus-visible, .ap-page select:focus-visible, .ap-resolve select:focus-visible { outline: 2px solid var(--purple-soft); border-color: var(--purple-soft); }
.ap-also { display: flex; align-items: center; gap: var(--sp-2); margin: var(--sp-2) 0 0; font-size: var(--fs-sm); cursor: pointer; }
.ap-also input { accent-color: var(--purple); margin: 0; }
.ap-step { margin-top: var(--sp-3); padding-top: var(--sp-3); border-top: 1px solid var(--line); }
.ap-step-label { margin-bottom: var(--sp-1); font-size: var(--fs-sm); font-weight: 500; color: var(--floral-dim); }
.ap-step-row { display: flex; gap: var(--sp-1); align-items: center; }
.ap-step-row select { flex: 1 1 0; width: 0; min-width: 0; }
.ap-page select, .ap-step-row select { min-height: 2rem; }
.ap-step-hint { margin: var(--sp-1) 0 0; font-size: var(--fs-xs); line-height: var(--lh-data); color: var(--floral-dim); }
.ap-step-pair { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-1); }
.ap-page .ap-step button, .ap-page .ap-actions button, .ap-inline button { margin: 0; white-space: nowrap; }
.ap-ask { margin-top: var(--sp-3); padding-top: var(--sp-3); border-top: 1px dashed var(--line); }
.ap-actions { display: flex; flex-wrap: wrap; gap: var(--sp-2); margin-top: var(--sp-2); }
.ap-people { margin: 0 0 var(--sp-3); display: grid; gap: var(--sp-2); font-size: var(--fs-base); }
.ap-people dt { font-size: var(--fs-xs); line-height: var(--lh-data); color: var(--floral-dim); }
.ap-people dd { margin: var(--sp-1) 0 0; overflow-wrap: anywhere; }
.ap-inline { display: flex; align-items: center; gap: var(--sp-1); margin-top: var(--sp-2); }
.ap-inline input { flex: 1; min-width: 0; }
/* In a table cell the inline action sits on the row's centre line. Alignment
   follows the column header (left), never its own end. */
td .ap-inline { margin-top: 0; }
.ap-note { margin: var(--sp-1) 0; white-space: pre-wrap; overflow-wrap: anywhere; font-size: var(--fs-base); }
.ap-h { margin: 0 0 var(--sp-2); font-size: var(--fs-md); font-weight: 600; font-family: var(--font-ui); }
.ap-p { margin: 0; font-size: var(--fs-base); }
.ap-who { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--sp-2); font-size: var(--fs-base); }
.ap-cmds { margin: var(--sp-1) 0 0; padding: var(--sp-2) var(--sp-3); border-radius: var(--r-md); background: rgba(10, 6, 18, .4); border: 1px solid var(--line); font: var(--fs-sm)/1.4 var(--font-mono); white-space: pre-wrap; overflow-wrap: anywhere; max-height: 14rem; overflow: auto; color: var(--floral-dim); }
.ap-diff-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--sp-2); margin-bottom: var(--sp-2); }
.ap-diff-head .ap-h { margin: 0; }
.ap-linked { margin-bottom: var(--sp-3); }
.ap-linked-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--sp-1) var(--sp-3); margin-bottom: var(--sp-1); font-size: var(--fs-base); }
.ap-linked-open { margin-left: auto; }
.ap-timeline { list-style: none; margin: 0; padding: 0 0 0 var(--sp-3); border-left: 1px solid var(--line); font-size: var(--fs-base); }
/* Three columns per entry: time | text | actor. The text column is the only
   one that wraps; the actor stays on the first line, right-aligned. */
.ap-timeline li { position: relative; display: grid; grid-template-columns: max-content minmax(0, 1fr) auto; gap: 0 var(--sp-3); align-items: baseline; padding: var(--sp-1) 0; }
.ap-timeline li::before { content: ""; position: absolute; left: -1.19rem; top: .74rem; width: .44rem; height: .44rem; border-radius: 50%; background: var(--purple-soft); }
.ap-timeline li > span:nth-child(1) { white-space: nowrap; }
.ap-timeline li > span:nth-child(2) { min-width: 0; overflow-wrap: anywhere; }
.ap-timeline li > span:nth-child(3) { white-space: nowrap; text-align: right; }
/* Phones: a strict 3-column grid leaves the text ~100px, so time and actor share
   the first line and the text takes the full width underneath. The actor still
   sits on the top line, right-aligned — it never drops under the entry. */
@media (max-width: 640px) {
  .ap-timeline li { grid-template-columns: minmax(0, 1fr) auto; gap: 0 var(--sp-2); }
  .ap-timeline li > span:nth-child(1) { grid-column: 1; grid-row: 1; }
  .ap-timeline li > span:nth-child(3) { grid-column: 2; grid-row: 1; }
  .ap-timeline li > span:nth-child(2) { grid-column: 1 / -1; grid-row: 2; }
}
.ap-page button:disabled { opacity: .4; cursor: not-allowed; }

@media (max-width: 1250px) {
  .ap-body { grid-template-columns: 1fr; grid-template-areas: "rail" "main"; }
  .ap-rail { max-width: 40rem; }
}
@media (max-width: 900px) {
  .ap-split { grid-template-columns: minmax(0, 1fr); }
  .ap-list { max-height: none; }
  .ap-split.has-sel .ap-list { display: none; }
  .ap-split:not(.has-sel) .ap-detail { display: none; }
  .ap-back { display: inline-block; }
  .ap-head-links { margin-left: 0; padding-bottom: 0; }
  .ap-detail { padding: var(--sp-3); }
  .ap-rail { max-width: none; }
  .ap-meta { flex-direction: column; gap: var(--sp-1); }
  .ap-meta li + li::before { content: none; }
}

/* Table actions: one right-aligned column on every data table. */
th.actions, td.actions { text-align: right; }

/* ===================== New change request ===================== */
/* Device picker, sized by the form beside it: the picker is a scroll window
   (see .crf-devices), so the form's own content sets the row height and the
   device list scrolls inside it. */
.crf { display: grid; grid-template-columns: minmax(0, 1fr) minmax(18rem, 24rem); gap: var(--sp-4); align-items: stretch; }
.crf-main { padding: var(--sp-4); }
.crf-field + .crf-field { margin-top: var(--sp-4); }
.crf-field label { display: block; margin: 0 0 var(--sp-1); font-size: var(--fs-base); font-weight: 500; }
.crf-opt { margin-left: var(--sp-1); font-size: var(--fs-xs); font-weight: 400; color: var(--floral-dim); }
.crf-help { margin: var(--sp-1) 0 0; font-size: var(--fs-sm); line-height: var(--lh-data); color: var(--floral-dim); }
.crf-field input, .crf-field textarea { width: 100%; margin: 0; }
.crf-pills { display: flex; flex-wrap: wrap; gap: var(--sp-1); margin-top: var(--sp-2); }
.crf-pill { margin: 0; min-height: 2rem; padding: var(--sp-1) var(--sp-3); border-radius: 999px; border: 1px solid var(--line); background: transparent; color: var(--floral-dim); font-size: var(--fs-sm); cursor: pointer; }
.crf-pill:hover { color: var(--floral); border-color: rgba(169, 139, 218, .5); background: transparent; }
.crf-pill.is-on { color: var(--floral); background: rgba(120, 81, 169, .35); border-color: rgba(169, 139, 218, .6); }
.crf-submit { display: flex; align-items: center; gap: var(--sp-2); margin-top: var(--sp-5); padding-top: var(--sp-4); border-top: 1px solid var(--line); }
.crf-submit button, .crf-submit .btn { margin: 0; }
.crf-devices { padding: var(--sp-3); display: flex; flex-direction: column; margin: 0; min-height: 0; }
/* Desktop: the picker is a scroll window, never the height source. `contain:
   size` keeps its 156 rows out of the row's intrinsic height, so the form (the
   only item with content height) decides it; the list scrolls inside. */
@media (min-width: 901px) {
  .crf-devices { contain: size; }
}
.crf-dev-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: var(--sp-2); }
.crf-dev-head label { margin: 0; font-size: var(--fs-base); font-weight: 500; }
.crf-count { font: 500 var(--fs-sm) var(--font-mono); color: var(--floral-dim); }
.crf-count.is-on { color: var(--purple-soft); }
.crf-filter { margin: 0 0 var(--sp-2); }
.crf-dev-list { list-style: none; margin: 0; padding: 0; overflow-y: auto; flex: 1; min-height: 12rem; }
.crf-dev { display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-rows: auto auto; column-gap: var(--sp-2); align-items: center; margin: 0; padding: var(--sp-1) var(--sp-2); border-radius: var(--r-md); cursor: pointer; }
.crf-dev:hover { background: rgba(255, 249, 239, .04); }
.crf-dev input { grid-row: 1 / span 2; margin: 0; accent-color: var(--purple); }
.crf-dev:has(input:checked) { background: rgba(120, 81, 169, .18); }
.crf-dev-name { font-size: var(--fs-base); line-height: var(--lh-data); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.crf-dev-sub { font-size: var(--fs-xs); line-height: var(--lh-data); color: var(--floral-dim); font-family: var(--font-mono); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.crf-empty { margin: var(--sp-2) 0 0; font-size: var(--fs-base); text-align: center; }
@media (max-width: 900px) {
  .crf { grid-template-columns: minmax(0, 1fr); }
  .crf-devices { order: -1; }
  .crf-dev-list { max-height: 18rem; }
}
.ap-standalone { margin-top: var(--sp-3); }
.ap-standalone h1.ap-title { font-size: var(--fs-xl); }
.ap-standalone .inline-form { display: inline; margin: 0; }

/* Device activity: one line per event */
.act-table td:nth-child(2), .act-table td:nth-child(3), .act-table td:nth-child(1) { white-space: nowrap; }
.act-table td:nth-child(4) { white-space: nowrap; }
.act-table td:last-child { width: 100%; }
.act-table td .mono { font-size: var(--fs-sm); }
.review-note { margin: var(--sp-1) 0 0; font: var(--fs-sm)/var(--lh-data) var(--font-mono); color: var(--floral-dim);
  white-space: pre-wrap; overflow-wrap: anywhere; }
.act-src { margin-left: var(--sp-1); font-size: var(--fs-xs); color: var(--floral-dim); }
.act-src-bad { color: var(--bad-text); }

/* Users: room for the Telegram name, but 7rem keeps the nine-column table
   inside the shared content width. */
.role-form input[name=telegram_username] { min-width: 7rem; }
.crf-field textarea { padding: var(--sp-2) var(--sp-3); font-size: var(--fs-base); font-family: var(--font-ui);
  line-height: var(--lh-ui); resize: vertical; }
.crf-field textarea.mono { font-family: var(--font-mono); font-size: var(--fs-sm); line-height: 1.45; }
.crf-field textarea:focus-visible { outline: 2px solid var(--purple-soft); border-color: var(--purple-soft); }


/* ===================== Viewport-fit pages ===================== */
/* Long content scrolls inside its own box, the page itself stays put: the
   config views (changes / ± context / full config) never push the page down
   a thousand lines. On wide screens the Ledger, a change page and Reports fill
   exactly one viewport; the list, the detail and each report pane scroll on
   their own. Narrow screens keep normal page scrolling. */
.code-view { max-height: min(68vh, 44rem); overflow: auto; overscroll-behavior: contain; }
.report-pane[hidden] { display: none; }
.report-tabs { margin: 0 0 var(--sp-3); }
.tab-n { margin-left: var(--sp-1); font: 500 var(--fs-sm) var(--font-mono); color: var(--floral-dim); }
.tab-n-bad { color: var(--bad-text); }
.report-panes.js-tabs > .report-pane { margin-top: 0; }

@media (min-width: 901px) and (min-height: 620px) {
  .page.ap-page, .page.fit-page {
    height: 100vh; height: 100dvh;
    display: flex; flex-direction: column;
    padding-bottom: var(--sp-4);
  }
  .page.ap-page > *, .page.fit-page > * { flex: none; }
  .page.ap-page > .ap-split { flex: 1 1 auto; min-height: 0; }
  .ap-split > .ap-list { overflow: hidden; }          /* .ap-items scrolls */
  .ap-split > .ap-detail { overflow-y: auto; overscroll-behavior: contain; }

  .page.fit-page > .fit-main { flex: 0 1 auto; min-height: 0; }
  .diff-panel { display: flex; flex-direction: column; overflow: hidden; }
  .diff-panel > * { flex: none; }
  .diff-panel > .code-wrap { flex: 0 1 auto; min-height: 8rem; }
  .diff-panel > .code-wrap > .code-view { flex: 1 1 auto; min-height: 0; max-height: none; }
  .diff-panel > .code-wrap > .code-head { flex: none; }

  .report-panes { overflow-y: auto; overscroll-behavior: contain; }
  .report-panes.js-tabs { overflow: hidden; display: flex; flex-direction: column; }
  .report-panes.js-tabs > .report-pane { flex: 0 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
}

/* Users: Telegram link state is a fixed-width badge in front of the field, so
   every row's input starts at the same x and the row height never changes. */
.tg-form { flex-wrap: nowrap; }
.tg-state { flex: none; width: 1.25rem; height: 1.25rem; border-radius: 50%; display: grid; place-items: center;
  border: 1px dashed var(--line-strong); }
.tg-state.tg-on { border: 1px solid rgba(95, 191, 143, .55); background: rgba(95, 191, 143, .14); color: var(--ok-text); }
.tg-state .icon { width: .8rem; height: .8rem; stroke-width: 2.25; }
.role-form input[name=telegram_username] { min-height: 2rem; padding: var(--sp-1) var(--sp-2); font-size: var(--fs-base); }
/* One control height per table row: field, select and Save line up. */
.role-form input:not([type=hidden]), .role-form select, .role-form button { height: 2rem; min-height: 2rem; box-sizing: border-box; }
/* Phones: the four report tabs sit in an even 2x2 grid instead of wrapping 3+1. */
@media (max-width: 560px) {
  .report-tabs { display: grid; grid-template-columns: 1fr 1fr; }
  .report-tabs a { text-align: center; }
}

/* Ledger Resolve panel: step 1 the note, step 2 one row per answer. Each row
   names the situation, says what happens, and has its own named button. All
   buttons share one style, so none looks like "the" answer. */
.rs-num { display: inline-grid; place-items: center; width: 1.1rem; height: 1.1rem; margin-right: var(--sp-1);
  border-radius: 50%; font: 500 var(--fs-xs)/1 var(--font-mono); color: var(--floral);
  background: rgba(120, 81, 169, .45); vertical-align: 1px; }
.rs-step { margin-top: var(--sp-3); }
.rs-options { display: grid; border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; }
.rs-opt { padding: var(--sp-2) var(--sp-3) var(--sp-3); }
.rs-opt + .rs-opt { border-top: 1px solid var(--line); }
.rs-opt-h { font-size: var(--fs-base); font-weight: 500; color: var(--floral); }
.rs-opt-p { margin: 2px 0 var(--sp-2); font-size: var(--fs-sm); line-height: var(--lh-data); color: var(--floral-dim); }
.rs-off { color: rgba(255, 249, 239, .5); font-style: italic; }
.rs-wide { width: 100%; }
.rs-ask { margin-top: var(--sp-3); padding: var(--sp-2) var(--sp-3) var(--sp-3); border: 1px dashed var(--line-strong); border-radius: var(--r-md); }
.ap-step-row button { flex: none; }

/* Thin scrollbars that sit in their own lane instead of over the content
   (the approval list's ages were hidden under a wide default bar). */
.ap-items, .ap-detail, .code-view, .report-pane, .report-panes, .crf-dev-list {
  scrollbar-width: thin;
  scrollbar-color: rgba(169, 139, 218, .35) transparent;
}
.ap-items { scrollbar-gutter: stable; padding-right: var(--sp-1); }
.ap-items::-webkit-scrollbar, .ap-detail::-webkit-scrollbar, .code-view::-webkit-scrollbar,
.report-pane::-webkit-scrollbar, .crf-dev-list::-webkit-scrollbar { width: 8px; height: 8px; }
.ap-items::-webkit-scrollbar-thumb, .ap-detail::-webkit-scrollbar-thumb, .code-view::-webkit-scrollbar-thumb,
.report-pane::-webkit-scrollbar-thumb, .crf-dev-list::-webkit-scrollbar-thumb {
  background: rgba(169, 139, 218, .35); border-radius: 999px; border: 2px solid transparent; background-clip: padding-box; }
.ap-items::-webkit-scrollbar-track, .ap-detail::-webkit-scrollbar-track, .code-view::-webkit-scrollbar-track,
.report-pane::-webkit-scrollbar-track, .crf-dev-list::-webkit-scrollbar-track { background: transparent; }
.rs-opt button, .rs-ask button { margin: 0; }
.rs-opt .ap-step-row > *, .rs-ask .ap-step-row > * { height: 2rem; min-height: 2rem; }
.rs-wide { height: 2rem; }

/* EN / ID language switch (top bar and sign-in page). */
.lang-switch { display: inline-flex; flex: none; gap: 2px; padding: 2px; border: 1px solid var(--line); border-radius: var(--r-md); }
.lang-switch a { padding: 2px var(--sp-2); border-radius: var(--r-sm); font: 500 var(--fs-xs)/1.6 var(--font-mono);
  letter-spacing: .06em; color: var(--floral-dim); }
.lang-switch a:hover { color: var(--floral); text-decoration: none; }
.lang-switch a.active { color: var(--floral); background: rgba(120, 81, 169, .35); }
.login-lang { display: flex; justify-content: center; margin-top: var(--sp-3); }

/* Resolve panel, compact: a small label over each control row, no paragraphs. */
.rs-rows { display: grid; gap: var(--sp-3); margin-top: var(--sp-3); padding-top: var(--sp-3); border-top: 1px solid var(--line); }
.rs-row { display: grid; gap: var(--sp-1); }
.rs-k { font-size: var(--fs-xs); line-height: var(--lh-data); color: var(--floral-dim); text-transform: uppercase; letter-spacing: .06em; }
.rs-pair { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: var(--sp-1); }
.rs-pair button { margin: 0; height: 2rem; }
.rs-row .ap-step-row > * { height: 2rem; min-height: 2rem; }
.rs-row button { margin: 0; }
.rs-ask { margin-top: var(--sp-3); padding-top: var(--sp-3); border-top: 1px dashed var(--line-strong); border-left: 0; border-right: 0; border-bottom: 0; border-radius: 0; padding-left: 0; padding-right: 0; padding-bottom: 0; }
p.rs-off { margin: 0; font-size: var(--fs-sm); }

/* Base: the tool cards sit 3 per row (6 cards = two full rows). */
@media (min-width: 900px) {
  .portals:not(.portals-compact) { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* ── 2026-11-20 round: one table size everywhere, fit-to-screen lists ─────── */
/* Table cells inherited the 15 px body; data reads at the 14 px of the device
   overview table (the reference size). Chips inside rows are one step smaller. */
.data-table, .user-table, .kv-table, .info-table { font-size: var(--fs-base); }
.data-table th, .user-table th, .kv-table th, .info-table th { font-size: var(--fs-sm); }
.data-table td .chip, .data-table th .chip,
.user-table td .chip, .kv-table td .chip, .info-table td .chip { font-size: var(--fs-xs); padding: 1px var(--sp-2); }
.data-table td.mono, .data-table td .mono,
.user-table td.mono, .kv-table td.mono, .info-table td.mono { font-size: var(--fs-sm); }

/* API token allowlist (0021/2c): entries wrap, so 32 CIDRs or a long IPv6
   list never widen the table or a phone card. */
.data-table td.ip-cell { font-family: var(--font-mono); font-size: var(--fs-sm); white-space: normal; overflow-wrap: anywhere; }
.data-table td.ip-cell { min-width: 12rem; }
.tok-denied { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-1) var(--sp-2); margin-top: var(--sp-3); overflow-wrap: anywhere; }

/* Long lists: the page stays still, only the list box scrolls (wide screens). */
@media (min-width: 901px) and (min-height: 620px) {
  .page.fit-page > .fit-scroll { flex: 0 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; margin-bottom: 0; }
  .page.fit-page > .fit-scroll.fit-bare { padding: 0 var(--sp-1) var(--sp-2); margin: 0 calc(-1 * var(--sp-1)); }
  .fit-scroll > table > thead th { position: sticky; top: calc(-1 * var(--sp-4)); z-index: 1; background: #221d2b; }
  .fit-scroll.pr-panel > table > thead th { top: calc(-1 * var(--sp-2)); }
}

/* Page head with actions on the right (Monitor, Peering). */
.mon-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: var(--sp-2) var(--sp-4); }
.mon-chips { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); }
/* The h1 baseline lands a quarter of its line box above the descender edge;
   lifting the chip row that much lines every chip up with the title. */
.mon-head > .mon-chips { padding-bottom: calc(0.25 * var(--fs-xl) + var(--sp-1)); }

/* Telegram alerts switch (admin) */
.tg-switch-form { display: inline-flex; margin: 0; }
.tg-switch { margin: 0; display: inline-flex; align-items: center; gap: var(--sp-2); min-height: 1.9rem; padding: 0 var(--sp-3) 0 var(--sp-1);
  border: 1px solid var(--line-strong); border-radius: 999px; background: rgba(255, 249, 239, .04);
  font: 500 var(--fs-xs) var(--font-mono); letter-spacing: .04em; text-transform: uppercase; color: var(--floral-dim); cursor: pointer; }
.tg-knob { width: 1.3rem; height: 1.3rem; border-radius: 50%; background: rgba(255, 249, 239, .3); transition: background-color .15s; }
.tg-switch.is-on { color: var(--ok-text); border-color: rgba(95, 191, 143, .45); background: rgba(95, 191, 143, .10); }
.tg-switch.is-on .tg-knob { background: var(--ok); }
.tg-switch:hover { border-color: var(--purple-soft); }

/* Device page: Overview and Graphs share one row of equal height; the stat
   blocks sit below as four even cards instead of hanging under Overview.
   Every card: title on one line, content starting at the same y, so the row
   reads as one band. */
.device-top { align-items: stretch; }
.graphs-panel .graph-grid { flex: 1 1 auto; grid-auto-rows: 1fr; }
.graphs-panel .graph { display: flex; flex-direction: column; }
.graphs-panel .graph img { flex: 1 1 auto; min-height: 0; object-fit: contain; }
.device-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); gap: var(--sp-4); margin: 0 0 var(--sp-4); }
.device-stats > .mini-block { margin: 0; display: flex; flex-direction: column; }
.device-stats .mini-block > :last-child { margin-bottom: 0; }
.device-stats .avail-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.overview-panel .kind-form { margin-top: var(--sp-3); padding-top: var(--sp-3); border-top: 1px solid var(--line); }
.device-stats .mini-block h3 { margin: 0 0 var(--sp-2); font-size: var(--fs-xs); letter-spacing: .1em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* Monitor card: chip, link and button on one 2rem line, centred. */
.device-stats .btn-row { margin: 0; align-items: center; }
.device-stats .btn-row .mini-text { margin: 0; display: inline-flex; align-items: center; }
.device-stats .btn-row form { margin: 0; display: contents; }
.device-stats .btn-row .btn-sm, .device-stats .btn-row button { margin: 0; height: 2rem; min-height: 2rem; display: inline-flex; align-items: center; box-sizing: border-box; }

/* Reports → Export: period, sheet picks, two download buttons. */
.rx-form { display: flex; flex-direction: column; gap: var(--sp-4); max-width: 62rem; }
.rx-row { display: flex; flex-wrap: wrap; gap: var(--sp-3); align-items: flex-end; }
.rx-field { display: flex; flex-direction: column; gap: var(--sp-1); margin: 0; font-size: var(--fs-sm); color: var(--floral-dim); }
.rx-field[hidden] { display: none; }
.rx-field select, .rx-field input { min-width: 11rem; height: 2rem; min-height: 2rem; padding: 0 var(--sp-2); box-sizing: border-box; font-size: var(--fs-base); }
.rx-sheets { display: flex; flex-wrap: wrap; gap: var(--sp-2); margin: 0; padding: 0; border: 0; }
.rx-sheets legend { width: 100%; margin-bottom: var(--sp-2); padding: 0; font-size: var(--fs-sm); color: var(--floral-dim); }
.rx-check { position: relative; margin: 0; cursor: pointer; }
.rx-check input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.rx-check span { display: inline-flex; align-items: center; height: 2rem; padding: 0 var(--sp-3); border-radius: 999px; border: 1px solid var(--line); background: rgba(255, 249, 239, .04); color: var(--floral-dim); font-size: var(--fs-sm); }
.rx-check span::before { content: ""; width: .5rem; height: .5rem; margin-right: var(--sp-2); border-radius: 50%; background: rgba(255, 249, 239, .2); }
.rx-check input:checked + span { color: var(--floral); border-color: rgba(171, 133, 230, .55); background: rgba(171, 133, 230, .14); }
.rx-check input:checked + span::before { background: var(--purple-link); }
.rx-check input:focus-visible + span { outline: 2px solid var(--purple-link); outline-offset: 2px; }
.rx-actions { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.rx-actions button { margin: 0; height: 2.25rem; min-height: 2.25rem; padding: 0 var(--sp-4); }

/* Grouped nav (Network / Changes / Audit / Settings): sub-tabs under the top bar. */
.subnav {
  display: flex; gap: 4px; margin: calc(var(--sp-4) * -0.5) 0 var(--sp-4); padding: 4px;
  background: rgba(30, 28, 37, .6); border: 1px solid var(--line); border-radius: var(--r-lg);
  box-shadow: 0 6px 18px rgba(0, 0, 0, .22), inset 0 1px 0 rgba(255, 249, 239, .04);
  overflow-x: auto; scrollbar-width: none;
}
.subnav::-webkit-scrollbar { display: none; }
.subnav a {
  flex: 1 1 0; display: inline-flex; align-items: center; justify-content: center;
  height: 2.1rem; padding: 0 var(--sp-3); border-radius: calc(var(--r-lg) - 4px);
  color: var(--floral-dim); font-size: var(--fs-sm); white-space: nowrap;
  transition: color 160ms ease, background 160ms ease;
}
.subnav a:hover { color: var(--floral); background: rgba(255, 249, 239, .06); text-decoration: none; }
.subnav a.active {
  color: var(--floral);
  background: linear-gradient(140deg, rgba(120, 81, 169, .85), rgba(80, 52, 120, .85));
  box-shadow: 0 0 0 1px rgba(169, 139, 218, .45), 0 0 14px rgba(120, 81, 169, .35);
}
.page.fit-page > .subnav { flex: none; }
a.who { color: inherit; text-decoration: none; padding: 2px var(--sp-2) 2px 2px; border-radius: 999px; border: 1px solid transparent; }
a.who:hover { text-decoration: none; background: rgba(255, 249, 239, .06); border-color: var(--line); }
a.who.is-active { border-color: rgba(120, 81, 169, .55); background: rgba(120, 81, 169, .18); }

/* Audit log */
.al-filter { display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--sp-2) var(--sp-3); margin-bottom: var(--sp-3); }
.al-filter .btn-sm { margin: 0; height: 2rem; min-height: 2rem; display: inline-flex; align-items: center; }
.al-pager { margin-left: auto; display: inline-flex; align-items: center; gap: var(--sp-2); }
.al-action { font-size: var(--fs-sm); color: var(--purple-link); }
.al-details { max-width: 32rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: var(--fs-sm); }
.al-table td { vertical-align: middle; }
@media (max-width: 480px) {
  a.who { padding: 0; border: 0; background: none; }
  a.who.is-active .avatar { box-shadow: 0 0 0 2px var(--purple-link), 0 0 12px rgba(120, 81, 169, .5); }
}
/* Phones: EN/ID moves into the ☰ menu so the top bar keeps one row. */
.topnav .nav-lang { display: none; }
@media (max-width: 480px) {
  .topbar > .lang-switch { display: none; }
  .topnav .nav-lang { display: block; padding: var(--sp-2) var(--sp-3) var(--sp-1); }
}

/* Monitor external (Globalping) card */
.mon-ext-chips { display: inline-flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); }
.mon-ext-mtr { margin-top: var(--sp-3); }
.mon-ext-mtr summary { cursor: pointer; color: var(--floral-dim); }
.mon-ext-mtr h3 { margin: var(--sp-3) 0 var(--sp-1); font-size: var(--fs-xs); letter-spacing: .1em; }
.mon-ext-mtr pre { margin: 0; padding: var(--sp-2) var(--sp-3); border: 1px solid var(--line); border-radius: var(--r-md); overflow-x: auto; font-size: var(--fs-xs); }

/* ─── API tokens (2c): list table + phone cards, detail head, access log ─── */
.crumb { margin: 0 0 var(--sp-2); font-size: var(--fs-sm); }
.crumb a { display: inline-flex; align-items: center; min-height: 2rem; }
.tok-unknown { margin: 0 0 var(--sp-2); font-size: var(--fs-sm); }
.tok-table { table-layout: fixed; width: 100%; }
.tok-table .tok-name { width: 22%; }
.tok-table .tok-name a { display: inline-block; max-width: 100%; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }
.tok-table .tok-status { width: 9.5rem; }
.tok-table .tok-status .chip + .chip { margin-left: var(--sp-1); }
.tok-table td.tok-used .mono { overflow-wrap: anywhere; white-space: normal; }
.tok-cards { display: none; }
.tok-cards .user-card-head .tok-card-link { display: flex; align-items: center;
  min-height: 2.5rem; overflow-wrap: anywhere; }
.tok-cards .tok-meta { margin: 0; }
.tok-title { overflow-wrap: anywhere; }
.tok-meta { margin: var(--sp-2) 0 0; }
.tok-meta th { width: 1%; white-space: nowrap; text-align: left; font-weight: 400;
  color: var(--floral-dim); padding-right: var(--sp-4); }
.tok-meta td { text-align: left; font-size: var(--fs-base); }
.tok-denied { margin-top: var(--sp-3); }

/* Access log: fixed columns, the request truncates, the page never widens. */
.log-table { table-layout: fixed; width: 100%; }
.log-table .log-time { width: 10.5rem; }
.log-table .log-ip { width: 21.5rem; }
.data-table.log-table td.log-ip { overflow-wrap: anywhere; white-space: normal; }
.log-table .log-req .log-ip-sub { display: none; }
.tok-prefix { align-self: center; font-size: var(--fs-sm); }
#tok_ips { max-width: 28rem; }
.log-table .log-status { width: 5rem; }
.log-table .log-ms { width: 4rem; text-align: right; }
.log-table td.td-time { white-space: nowrap; }
.log-table .log-req { overflow: hidden; }
.log-table .log-req span { display: block; overflow: hidden; text-overflow: ellipsis;
  white-space: nowrap; font-family: var(--font-mono); font-size: var(--fs-sm); }
.log-pager { display: flex; gap: var(--sp-4); margin-top: var(--sp-3); font-size: var(--fs-base); }
.log-pager a { display: inline-flex; align-items: center; min-height: 2.5rem; }

@media (max-width: 640px) {
  .tok-table-wrap { display: none; }
  .tok-cards { display: grid; gap: var(--sp-3); }
  .tok-create .form-grid { grid-template-columns: 1fr; }
  .tok-cards .ip-cell { display: block; text-align: right; }
  .log-table .log-ms { display: none; }
  .log-table .log-time { width: 5.75rem; }
  .data-table.log-table td.td-time { white-space: normal; }
  .log-table .log-ip { display: none; }
  .log-table .log-req span.log-ip-sub { display: block; white-space: normal; overflow-wrap: anywhere; }
  .log-table .log-status { width: 4.5rem; }
  /* 40 px targets: every control on the page stays thumb-sized. */
  .tok-cards .tok-card-link, .log-pager a, .crumb a,
  .tok-create button, .tok-denied button, .tok-denied a, .log-filters .chip {
    min-height: 2.5rem;
  }
  .tok-denied { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-1) var(--sp-2); }
}
