/* ═══════════════════════════════════════════════════════════════════════════
   Vora Market admin console — ink & bone.

   The same world as the customer app (see DESIGN.md and the BRAND LAYER at the
   end of /app/styles.css): the Vora Market badge, bone ink on pitch black, inside
   a ring drawn by hand.

     Colour     Pitch (#000 → #24221e) and bone (#f1ede4). Warm, like ink on
                stock. Discord, Steam and Rockstar keep their own tint wherever
                a service is named; red means an error or a destructive action,
                nothing else.
     Type       Archivo. Titles heavy and a touch wide; small labels condensed
                and capped. JetBrains Mono for anything you copy.
     Signature  The badge's ring circles the page you are on in the rail.
     Motion     Press, arrive. Nothing idles.

   The /admin CSP blocks inline style attributes, so nothing in the markup or
   the JS templates may carry style="…". Widths set from data go through the
   CSSOM (see applyWidths in admin.js).
   ═══════════════════════════════════════════════════════════════════════════ */

:root {
  --pitch-0: #000000;
  --pitch-1: #0b0a09;
  --pitch-2: #12110f;
  --pitch-3: #1a1916;
  --pitch-4: #24221e;
  --bone: #f1ede4;
  --bone-hi: #fbf8f1;
  --bone-dim: #d9d4c9;
  --ash: #a39e94;
  --smoke: #736e66;
  --hair: rgba(241, 237, 228, 0.085);
  --hair-mid: rgba(241, 237, 228, 0.13);
  --hair-strong: rgba(241, 237, 228, 0.2);

  --red: #e5483f;
  --red-ink: #ff9489;

  --discord: #5865f2;
  --steam: #1b9fff;
  --rockstar: #fcaf17;

  --font-sans: "Archivo", ui-sans-serif, system-ui, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;

  --rail-w: 248px;
  --ledger-h: 48px;
  --ring: 0 0 0 3px rgba(241, 237, 228, 0.14);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --press: cubic-bezier(0.3, 0, 0.2, 1);

  /* Motion. Enter and exit on a strong ease-out; things that travel across
     the screen (the drawer, the glides) on the iOS drawer curve. Press
     feedback is 120–160ms, arrivals stay under 400ms. */
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
  --ease-drawer: cubic-bezier(0.32, 0.72, 0, 1);
  --rise: 10px;
  --lift:
    inset 0 1px 0 rgba(241, 237, 228, 0.045),
    0 1px 0 rgba(0, 0, 0, 0.5),
    0 18px 40px -22px rgba(0, 0, 0, 0.75);
  --hatch: repeating-linear-gradient(135deg, rgba(241, 237, 228, 0.6) 0 1.5px, transparent 1.5px 5px);
  --tnum: "tnum" 1, "lnum" 1;
}

[data-service="discord"] { --svc: var(--discord); }
[data-service="steam"] { --svc: var(--steam); }
[data-service="rockstar"] { --svc: var(--rockstar); }

/* ── Base ────────────────────────────────────────────────────────────────── */

*,
*::before,
*::after { box-sizing: border-box; }

[hidden] { display: none !important; }

html {
  color-scheme: dark;
  -webkit-text-size-adjust: 100%;
  scrollbar-color: var(--pitch-4) transparent;
  scrollbar-width: thin;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--pitch-0);
  color: var(--bone);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body.boot { opacity: 0; }
body.boot-ready { opacity: 1; transition: opacity 0.3s var(--ease); }
html.rs-authing #gate { display: none !important; }
body.drawer-open { overflow: hidden; }

::selection { background: var(--bone); color: var(--pitch-1); }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--pitch-4);
  border: 3px solid transparent;
  border-radius: 10px;
  background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover { background-color: #34312b; }

h1, h2, h3, h4, p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
img { display: block; }

svg { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

:focus-visible { outline: 2px solid var(--bone); outline-offset: 2px; }

.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;
}

.rs-hp {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.mono { font-family: var(--font-mono); font-feature-settings: var(--tnum); }
.muted { color: var(--ash); }
.strong { color: var(--bone); font-weight: 600; }
.cap { text-transform: capitalize; }

code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  padding: 1px 6px;
  border-radius: 5px;
  background: var(--pitch-0);
  border: 1px solid var(--hair);
  color: var(--bone-dim);
}

kbd {
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 5px;
  border: 1px solid var(--hair-strong);
  border-bottom-width: 2px;
  background: var(--pitch-2);
  color: var(--bone);
}

mark {
  background: var(--bone);
  color: var(--pitch-1);
  border-radius: 3px;
  padding: 0 2px;
}

/* Small labels are set like the print on a tag: condensed, capped, spaced. */
.label,
.field-lbl,
.rail-section,
.tbl th,
.fact-k,
.ledger-title,
.outcome-stat-lbl {
  font-family: var(--font-sans);
  font-stretch: 78%;
  font-weight: 700;
  font-size: 10.5px;
  line-height: 1.3;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--smoke);
}

/* "optional", "testing only" — a lowercase aside inside a capped label. */
.label i,
.field-lbl i {
  font-style: normal;
  font-stretch: 100%;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
  font-size: 11.5px;
  color: var(--smoke);
  margin-left: 6px;
}

.hint {
  margin-top: 8px;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--ash);
  max-width: 72ch;
}
.hint[data-tone="bad"] { color: var(--red-ink); }

.report {
  margin: 14px 0 0;
  padding: 10px 14px;
  border-radius: 10px;
  background: var(--pitch-1);
  border: 1px solid var(--hair);
  font-size: 12.5px;
  color: var(--bone-dim);
}
.report:empty { display: none; }
.report[data-tone="bad"] { color: var(--red-ink); border-color: rgba(229, 72, 63, 0.35); }
.panel.flush > .report { margin: 14px 16px 0; }

.svc-dot {
  display: inline-block;
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--svc, var(--smoke));
}

.gap-top { margin-top: 16px; }
.gap-top-lg { margin-top: 28px; }
.push { margin-left: auto; }

/* ── Buttons ─────────────────────────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 38px;
  padding: 0 16px;
  border-radius: 10px;
  border: 1px solid transparent;
  background: none;
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: -0.005em;
  white-space: nowrap;
  text-decoration: none;
  user-select: none;
  transition:
    background-color 140ms var(--press),
    border-color 140ms var(--press),
    color 140ms var(--press),
    transform 120ms var(--press);
}
.btn:active:not(:disabled) { transform: scale(0.97); }
.btn:disabled { opacity: 0.42; cursor: not-allowed; }
.btn svg { width: 15px; height: 15px; }

.btn.primary {
  background: var(--bone);
  color: var(--pitch-1);
  border-color: var(--bone);
}
.btn.primary:hover:not(:disabled) { background: var(--bone-hi); border-color: var(--bone-hi); }

.btn.ghost {
  background: var(--pitch-3);
  border-color: var(--hair-mid);
  color: var(--bone-dim);
}
.btn.ghost:hover:not(:disabled) {
  background: var(--pitch-4);
  border-color: var(--hair-strong);
  color: var(--bone);
}

.btn.danger {
  background: rgba(229, 72, 63, 0.12);
  border-color: rgba(229, 72, 63, 0.45);
  color: var(--red-ink);
}
.btn.danger:hover:not(:disabled) { background: var(--red); border-color: var(--red); color: #fff; }

.btn.ghost.danger { background: var(--pitch-3); border-color: var(--hair-mid); color: var(--red-ink); }
.btn.ghost.danger:hover:not(:disabled) {
  background: rgba(229, 72, 63, 0.1);
  border-color: rgba(229, 72, 63, 0.5);
  color: #ffb3aa;
}

.btn.small { height: 32px; padding: 0 12px; font-size: 12.5px; border-radius: 9px; gap: 7px; }
.btn.small svg { width: 14px; height: 14px; }
.btn.block { width: 100%; }

/* Sign in is set like Generate in the app: condensed caps. */
.btn.lg {
  height: 46px;
  font-size: 14px;
  font-weight: 700;
  font-stretch: 88%;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  border-radius: 12px;
}

/* Arm-then-confirm: the button names what it is about to destroy. */
.btn[data-armed="1"],
.btn[data-armed="1"]:hover {
  background: var(--red);
  border-color: var(--red);
  color: #fff;
}

/* Busy: the label dims and a thin line sweeps under it. */
.btn[aria-busy="true"] { position: relative; pointer-events: none; color: var(--ash); }
.btn.primary[aria-busy="true"] { color: rgba(11, 10, 9, 0.55); }
.btn[aria-busy="true"]::after {
  content: "";
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 5px;
  height: 1.5px;
  border-radius: 2px;
  background: linear-gradient(90deg, transparent, currentColor, transparent) no-repeat;
  background-size: 50% 100%;
  animation: busySweep 0.9s linear infinite;
}
@keyframes busySweep {
  from { background-position: -60% 0; }
  to { background-position: 160% 0; }
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex: none;
  border-radius: 50%;
  border: 1px solid var(--hair-mid);
  background: var(--pitch-2);
  color: var(--ash);
  transition: color 140ms var(--press), background-color 140ms var(--press), transform 120ms var(--press);
}
.icon-btn:hover { color: var(--bone); background: var(--pitch-3); }
.icon-btn:active { transform: scale(0.94); }

.btn-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 8px;
}

.btn-sep {
  width: 1px;
  height: 22px;
  margin: 0 4px 5px;
  background: var(--hair-mid);
  align-self: flex-end;
}

/* ── Fields ──────────────────────────────────────────────────────────────── */

.field {
  display: flex;
  flex-direction: column;
  gap: 7px;
  min-width: 0;
}

.field-lbl-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.field-count {
  font-family: var(--font-mono);
  font-stretch: 100%;
  font-weight: 500;
  font-size: 11px;
  letter-spacing: 0;
  text-transform: none;
  color: var(--smoke);
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="search"],
input[type="datetime-local"],
select,
textarea {
  width: 100%;
  height: 40px;
  padding: 0 13px;
  border-radius: 11px;
  border: 1px solid var(--hair-mid);
  background: var(--pitch-0);
  color: var(--bone);
  font-size: 14px;
  outline: none;
  transition: border-color 140ms var(--press), box-shadow 140ms var(--press);
}

input:hover,
select:hover,
textarea:hover { border-color: var(--hair-strong); }

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(241, 237, 228, 0.5);
  box-shadow: var(--ring);
}

input::placeholder,
textarea::placeholder { color: var(--smoke); opacity: 1; }

input:disabled { opacity: 0.5; }

input[type="number"] { font-family: var(--font-mono); font-feature-settings: var(--tnum); font-size: 13.5px; }
input.num { width: 96px; }
input.num.wide { width: 160px; }
input.fit { width: auto; max-width: 280px; }
input.mono { font-family: var(--font-mono); font-size: 13px; }

select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 36px;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23a39e94' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 14px;
}
select option { background: var(--pitch-2); color: var(--bone); }

textarea {
  height: auto;
  padding: 12px 14px;
  line-height: 1.6;
  resize: vertical;
}
textarea.lines { min-height: 88px; }
textarea.mono { font-family: var(--font-mono); font-size: 12.5px; }

input[type="search"]::-webkit-search-cancel-button { display: none; }
input[type="number"]::-webkit-inner-spin-button { opacity: 0.4; }

.field-inline input { height: 32px; border-radius: 9px; }
.field-inline .field-lbl { font-size: 10px; }

/* ── Chips: choices. Tabs: filters. ──────────────────────────────────────── */

.chips { display: flex; flex-wrap: wrap; gap: 6px; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 32px;
  padding: 0 13px;
  border-radius: 9px;
  border: 1px solid var(--hair-mid);
  background: transparent;
  color: var(--ash);
  font-size: 13px;
  font-weight: 600;
  transition: background-color 140ms var(--press), border-color 140ms var(--press), color 140ms var(--press), transform 120ms var(--press);
}
.chip:hover { color: var(--bone); background: rgba(241, 237, 228, 0.045); }
.chip:active { transform: scale(0.96); }
.chip.active { background: var(--bone); border-color: var(--bone); color: var(--pitch-1); }

/* A service chip wears its service: a dot always, the tint when chosen. */
.chip[data-service]::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--svc);
  opacity: 0.45;
  transition: opacity 140ms var(--press);
}
.chip[data-service].active {
  background: color-mix(in srgb, var(--svc) 16%, var(--pitch-2));
  border-color: color-mix(in srgb, var(--svc) 62%, transparent);
  color: var(--bone);
}
.chip[data-service].active::before { opacity: 1; }

.tabs {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 2px;
  padding: 3px;
  border-radius: 11px;
  background: var(--pitch-0);
  border: 1px solid var(--hair);
}
.tabs .chip {
  height: 28px;
  padding: 0 11px;
  border: 0;
  border-radius: 8px;
  font-size: 12.5px;
}
.tabs .chip.active {
  background: var(--pitch-4);
  color: var(--bone);
  box-shadow: inset 0 0 0 1px var(--hair-mid);
}

/* ── Sign-in ─────────────────────────────────────────────────────────────── */

.gate {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 48px 20px;
  background:
    radial-gradient(90% 60% at 50% -10%, rgba(241, 237, 228, 0.06), transparent 62%),
    var(--pitch-0);
}

.gate-card {
  width: min(400px, 100%);
  animation: arrive 0.4s var(--ease) both;
}

.gate-brand { text-align: center; }

.gate-badge {
  width: 112px;
  height: 112px;
  margin: 0 auto;
  user-select: none;
}

.gate-tag {
  margin-top: 18px;
  font-stretch: 78%;
  font-weight: 700;
  font-size: 10.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--smoke);
}

.login-title {
  margin-top: 6px;
  font-size: 38px;
  line-height: 1.02;
  font-weight: 800;
  font-stretch: 108%;
  letter-spacing: -0.035em;
  color: var(--bone);
}

.gate-sub {
  margin: 10px auto 0;
  max-width: 34ch;
  font-size: 14px;
  color: var(--ash);
}

.gate-fields {
  margin-top: 28px;
  padding: 22px;
  display: grid;
  gap: 16px;
  border-radius: 18px;
  background: var(--pitch-2);
  border: 1px solid var(--hair);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
}

.gate-fields input { height: 44px; }

.gate-error {
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(229, 72, 63, 0.1);
  border: 1px solid rgba(229, 72, 63, 0.35);
  color: #ffb3aa;
  font-size: 13px;
  line-height: 1.45;
}

/* Show / hide password, inside the field's right edge. */
.pass-wrap { position: relative; display: block; }
.pass-wrap input { width: 100%; padding-right: 64px; }
.pass-toggle {
  position: absolute;
  top: 50%;
  right: 6px;
  transform: translateY(-50%);
  height: 30px;
  padding: 0 10px;
  border: 1px solid var(--hair-mid);
  border-radius: 8px;
  background: transparent;
  color: var(--ash);
  font: 600 12px var(--font-sans);
  cursor: pointer;
  transition: color 140ms var(--press), border-color 140ms var(--press);
}
.pass-toggle:hover,
.pass-toggle[aria-pressed="true"] { color: var(--bone); border-color: var(--hair-strong); }
.pass-toggle:focus-visible { outline: none; box-shadow: var(--ring); }

.caps-hint { font-size: 12px; color: var(--bone-dim); }

.remember {
  display: grid;
  grid-template-columns: auto 1fr;
  column-gap: 10px;
  row-gap: 2px;
  align-items: center;
  font-size: 13px;
  color: var(--bone-dim);
  cursor: pointer;
}
.remember input { width: 16px; height: 16px; margin: 0; accent-color: var(--bone); }
.remember small { grid-column: 2; font-size: 12px; color: var(--smoke); line-height: 1.4; }

.gate-switch { text-align: center; font-size: 13px; }
.gate-switch a {
  color: var(--ash);
  text-decoration: underline;
  text-decoration-color: var(--hair-strong);
  text-underline-offset: 3px;
  transition: color 140ms var(--press);
}
.gate-switch a:hover { color: var(--bone); text-decoration-color: var(--bone); }

/* ── Console shell ───────────────────────────────────────────────────────── */

.console {
  display: grid;
  grid-template-columns: var(--rail-w) minmax(0, 1fr);
  min-height: 100vh;
}

.rail {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 20px 14px 16px;
  background: var(--pitch-0);
  border-right: 1px solid var(--hair);
  overflow-y: auto;
}

.rail-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 8px 18px;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--hair);
}
.rail-brand img { width: 38px; height: 38px; border-radius: 50%; }
.rail-brand-text { display: flex; flex-direction: column; min-width: 0; }
.rail-brand-text strong {
  font-size: 17px;
  line-height: 1.1;
  font-weight: 800;
  font-stretch: 108%;
  letter-spacing: -0.03em;
}
.rail-brand-text span {
  margin-top: 3px;
  font-stretch: 78%;
  font-weight: 700;
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--smoke);
}

.rail-nav { display: flex; flex-direction: column; gap: 2px; }

.rail-section { padding: 0 10px; margin: 18px 0 6px; font-size: 10px; }
.rail-nav .rail-section:first-of-type { margin-top: 12px; }

.top-nav-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  height: 42px;
  padding: 0 10px 0 6px;
  border: 0;
  border-radius: 11px;
  background: none;
  color: var(--ash);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.005em;
  text-align: left;
  transition: background-color 140ms var(--press), color 140ms var(--press);
}
.top-nav-btn:hover { background: rgba(241, 237, 228, 0.045); color: var(--bone); }
.top-nav-btn.active { color: var(--bone); background: rgba(241, 237, 228, 0.035); }
.top-nav-btn:focus-visible { outline-offset: -2px; }

.nav-ico {
  position: relative;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  flex: none;
}
.nav-ico svg { width: 17px; height: 17px; }

/* The signature: the badge's hand-inked ring circles the page you are on,
   turned differently for each page so it reads as drawn, not tiled. */
.nav-ico::before {
  content: "";
  position: absolute;
  inset: -2px;
  pointer-events: none;
  background: currentColor;
  -webkit-mask: url("/app/assets/ink-ring.svg") center / 100% 100% no-repeat;
  mask: url("/app/assets/ink-ring.svg") center / 100% 100% no-repeat;
  opacity: 0;
  transform: scale(1.3) rotate(var(--ring-turn, 0deg));
  transition: opacity 140ms var(--press), transform 300ms var(--ease);
}
.top-nav-btn.active .nav-ico::before {
  opacity: 1;
  transform: scale(1) rotate(var(--ring-turn, 0deg));
}

.top-nav-btn[data-view="overview"]    { --ring-turn: 18deg; }
.top-nav-btn[data-view="keys"]        { --ring-turn: 96deg; }
.top-nav-btn[data-view="stock"]       { --ring-turn: 167deg; }
.top-nav-btn[data-view="users"]       { --ring-turn: 238deg; }
.top-nav-btn[data-view="logs"]        { --ring-turn: 301deg; }
.top-nav-btn[data-view="maintenance"] { --ring-turn: 52deg; }

.rail-foot {
  margin-top: auto;
  padding: 16px 0 0;
  border-top: 1px solid var(--hair);
}
.rail-foot .rail-section { margin: 0 0 4px; }
.whoami {
  padding: 0 10px 12px;
  font-size: 11.5px;
  color: var(--bone-dim);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stage {
  min-width: 0;
  background:
    radial-gradient(70% 40% at 50% -8%, rgba(241, 237, 228, 0.04), transparent 60%),
    var(--pitch-1);
}

.main {
  max-width: 1180px;
  margin: 0 auto;
  padding: 40px 44px calc(var(--ledger-h) + 56px);
}

/* ── Views ───────────────────────────────────────────────────────────────── */

.view { display: none; }
.view.active { display: block; }
.view.active + .view.active { margin-top: 40px; }

@keyframes arrive {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

/* A view arrives as a short cascade: the heading, then each block under it.
   Fill is backwards-only, so nothing is left holding a transform. */
@keyframes rise {
  from { opacity: 0; transform: translateY(var(--rise)); }
}
.view.active > * { animation: rise 420ms var(--ease-out) backwards; }
.view.active > :nth-child(2) { animation-delay: 40ms; }
.view.active > :nth-child(3) { animation-delay: 80ms; }
.view.active > :nth-child(4) { animation-delay: 120ms; }
.view.active > :nth-child(5) { animation-delay: 160ms; }
.view.active > :nth-child(n + 6) { animation-delay: 200ms; }

.view-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 26px;
}

.view-head h2 {
  font-size: 34px;
  line-height: 1.05;
  font-weight: 800;
  font-stretch: 108%;
  letter-spacing: -0.035em;
}

.view-sub {
  margin-top: 8px;
  max-width: 66ch;
  font-size: 14px;
  color: var(--ash);
}

.view-head-actions { display: flex; gap: 8px; flex: none; }

/* ── Panels ──────────────────────────────────────────────────────────────── */

.panel {
  margin-bottom: 20px;
  padding: 22px 24px 24px;
  border-radius: 16px;
  background: var(--pitch-2);
  border: 1px solid var(--hair);
}
.panel.flush { padding: 0; overflow: hidden; }

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px 24px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.panel-title {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 15.5px;
  line-height: 1.3;
  font-weight: 700;
  letter-spacing: -0.012em;
  color: var(--bone);
}
.panel-title svg { width: 16px; height: 16px; color: var(--ash); }

.panel-note {
  margin-top: 5px;
  max-width: 70ch;
  font-size: 13px;
  color: var(--ash);
}
.panel-note b { color: var(--bone); font-weight: 600; }

.panel-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
  margin-bottom: 20px;
}
.panel-grid > .panel { margin-bottom: 0; }

.subpanels {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 24px;
  padding-top: 22px;
  border-top: 1px solid var(--hair);
}

.subpanel {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 16px 18px 18px;
  border-radius: 12px;
  background: var(--pitch-1);
  border: 1px solid var(--hair);
}
.subpanel .hint { margin: 2px 0 12px; }
.subpanel .btn-row { margin-top: auto; }

/* ── Overview: the stock sheet ───────────────────────────────────────────── */

.sheet {
  margin-bottom: 20px;
  padding: 26px 28px 10px;
  border-radius: 18px;
  background: var(--pitch-2);
  border: 1px solid var(--hair);
}

.sheet-total {
  display: flex;
  align-items: flex-end;
  gap: 16px;
  margin-top: 10px;
}

.sheet-n {
  font-size: clamp(64px, 8.2vw, 108px);
  line-height: 0.84;
  font-weight: 800;
  font-stretch: 112%;
  letter-spacing: -0.05em;
  font-feature-settings: var(--tnum);
  color: var(--bone);
}

.sheet-unit {
  padding-bottom: 4px;
  font-size: 15px;
  line-height: 1.25;
  font-weight: 600;
  color: var(--ash);
}

.split {
  display: flex;
  gap: 3px;
  height: 12px;
  margin-top: 28px;
  border-radius: 6px;
  overflow: hidden;
}
.split.is-empty { background: var(--pitch-4); }

.split-seg {
  flex: 0 1 0%;
  min-width: 0;
  background: var(--svc);
  transition: flex-basis 0.6s var(--ease);
}

.split-legend {
  list-style: none;
  margin: 18px 0 0;
  padding: 0;
}

.split-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto 84px 52px;
  align-items: center;
  gap: 12px;
  padding: 13px 0;
  border-top: 1px solid var(--hair);
  font-size: 14px;
}

.split-name { font-weight: 600; color: var(--bone); }
.split-n { text-align: right; font-size: 14px; font-weight: 600; color: var(--bone); }
.split-pct { text-align: right; font-size: 12px; color: var(--smoke); }

.flag {
  justify-self: end;
  padding: 2px 8px;
  border-radius: 6px;
  border: 1px solid var(--hair-strong);
  font-size: 11.5px;
  font-weight: 600;
  color: var(--bone-dim);
  white-space: nowrap;
}
.flag.bad {
  border-color: rgba(229, 72, 63, 0.45);
  background: rgba(229, 72, 63, 0.1);
  color: var(--red-ink);
}

/* The tally: six numbers in the three groups they belong to. */
.tally {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border-radius: 18px;
  background: var(--pitch-2);
  border: 1px solid var(--hair);
  overflow: hidden;
}

.tally-group { padding: 20px 24px 22px; }
.tally-group + .tally-group { border-left: 1px solid var(--hair); }
.tally-group .label { margin-bottom: 4px; }

.tally-row {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-top: 12px;
}

.tally-n {
  min-width: 2ch;
  font-size: 30px;
  line-height: 1;
  font-weight: 800;
  font-stretch: 108%;
  letter-spacing: -0.035em;
  font-feature-settings: var(--tnum);
  color: var(--bone);
}

.tally-l { font-size: 13px; color: var(--ash); }

/* ── Keys ────────────────────────────────────────────────────────────────── */

.keygen {
  display: grid;
  grid-template-columns: minmax(180px, 240px) 110px minmax(0, 1fr);
  gap: 18px 16px;
  align-items: start;
}
.keygen .field-full,
.keygen-go { grid-column: 1 / -1; }
.keygen .num { width: 100%; }
.keygen .chips { margin-top: 1px; }

.results {
  margin-top: 22px;
  border-radius: 12px;
  background: var(--pitch-0);
  border: 1px solid var(--hair-strong);
  overflow: hidden;
  animation: arrive 0.26s var(--ease) both;
}

.results-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px 10px 16px;
  border-bottom: 1px solid var(--hair);
}
.results-head .label { color: var(--bone-dim); }

#newKeysText {
  margin: 0;
  padding: 14px 16px;
  max-height: 280px;
  overflow: auto;
  font-size: 13px;
  line-height: 1.75;
  color: var(--bone);
  user-select: all;
  white-space: pre;
}

/* ── Toolbar ─────────────────────────────────────────────────────────────── */

.toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--hair);
}
.toolbar .panel-title { font-size: 14.5px; }
.toolbar .panel-note { margin-top: 2px; font-size: 12.5px; }
.toolbar .btn-row { align-items: center; }
.toolbar .btn-sep { align-self: center; margin: 0 4px; }

.search {
  position: relative;
  flex: 0 1 280px;
  min-width: 200px;
}
.search > svg {
  position: absolute;
  left: 12px;
  top: 50%;
  width: 15px;
  height: 15px;
  transform: translateY(-50%);
  color: var(--smoke);
  pointer-events: none;
}
.search input { height: 36px; padding-left: 36px; padding-right: 36px; border-radius: 10px; font-size: 13.5px; }

.clear-btn {
  position: absolute;
  right: 5px;
  top: 50%;
  transform: translateY(-50%);
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border: 0;
  border-radius: 7px;
  background: none;
  color: var(--smoke);
}
.clear-btn:hover { color: var(--bone); background: var(--pitch-3); }
.clear-btn svg { width: 13px; height: 13px; }

.count {
  font-family: var(--font-mono);
  font-feature-settings: var(--tnum);
  font-size: 11.5px;
  color: var(--smoke);
  white-space: nowrap;
}

.sort-pick { display: flex; align-items: center; gap: 8px; }
.sort-pick select { height: 34px; width: auto; font-size: 13px; border-radius: 9px; }

/* ── Tables ──────────────────────────────────────────────────────────────── */

.tbl-wrap { overflow-x: auto; }

.tbl {
  width: 100%;
  min-width: 720px;
  border-collapse: separate;
  border-spacing: 0;
}

.tbl th {
  padding: 12px 16px 10px;
  text-align: left;
  white-space: nowrap;
  background: var(--pitch-1);
  border-bottom: 1px solid var(--hair);
}

.tbl td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--hair);
  font-size: 13.5px;
  color: var(--bone-dim);
  vertical-align: middle;
}
.tbl td.mono { font-size: 12.5px; }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl tbody tr { transition: background-color 120ms var(--press); }
.tbl tbody tr:hover { background: rgba(241, 237, 228, 0.022); }
.tbl .cell-right { text-align: right; }
.tbl td.clip { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tbl tr[data-bad="1"] td { color: var(--red-ink); }

.user-row { cursor: pointer; }
.user-row:focus-visible { outline: 2px solid var(--bone); outline-offset: -2px; }

.cell-stack { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.cell-main {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--bone);
  font-weight: 600;
}
.cell-main.mono { font-weight: 500; }
.cell-sub {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--smoke);
}

.copy-btn {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border: 0;
  border-radius: 6px;
  background: none;
  color: var(--smoke);
}
.copy-btn:hover { color: var(--bone); background: var(--pitch-3); }
.copy-btn svg { width: 12px; height: 12px; }

.row-actions { display: inline-flex; gap: 6px; justify-content: flex-end; }

.empty-cell {
  padding: 48px 24px !important;
  text-align: center;
  color: var(--ash);
  font-size: 13.5px;
}
.empty-cell b { display: block; margin-bottom: 4px; font-size: 14.5px; font-weight: 600; color: var(--bone); }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 22px;
  padding: 0 8px;
  border-radius: 6px;
  border: 1px solid var(--hair-strong);
  font-size: 11.5px;
  font-weight: 600;
  color: var(--bone-dim);
  white-space: nowrap;
}
.pill.ok { border-color: rgba(241, 237, 228, 0.34); color: var(--bone); }
.pill.ok::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--bone); }
.pill.quiet { border-color: var(--hair); color: var(--smoke); }
.pill.bad { border-color: rgba(229, 72, 63, 0.45); background: rgba(229, 72, 63, 0.08); color: var(--red-ink); }
.pill.warn { border-color: var(--hair-strong); color: var(--bone-dim); }
.pill.svc::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--svc); }

.preview {
  margin-top: 16px;
  border-radius: 12px;
  border: 1px solid var(--hair);
  overflow: hidden;
}
.preview td { font-size: 12px; }
.preview td.mono { word-break: break-all; }

/* ── Stock pools ─────────────────────────────────────────────────────────── */

.pools {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.pool {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 18px 20px 18px;
  border-radius: 16px;
  border: 1px solid var(--hair);
  background: var(--pitch-2);
  text-align: left;
  transition: border-color 160ms var(--press), background-color 160ms var(--press), transform 120ms var(--press);
}
.pool:hover { border-color: var(--hair-strong); }
.pool:active { transform: scale(0.985); }
.pool.target {
  border-color: color-mix(in srgb, var(--svc) 58%, transparent);
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--svc) 10%, transparent), transparent 70%),
    var(--pitch-2);
}

.pool-head {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--bone);
}

.pool-n {
  font-size: 40px;
  line-height: 1;
  font-weight: 800;
  font-stretch: 108%;
  letter-spacing: -0.04em;
  font-feature-settings: var(--tnum);
}
.pool.empty .pool-n { color: var(--smoke); }

.pool-track {
  display: block;
  height: 4px;
  border-radius: 4px;
  background: rgba(241, 237, 228, 0.07);
  overflow: hidden;
}
.pool-fill {
  display: block;
  width: 0;
  height: 100%;
  border-radius: 4px;
  background: var(--svc);
}

.pool-sub { font-size: 12.5px; color: var(--ash); }
.pool.low .pool-sub { color: var(--bone-dim); }
.pool.empty .pool-sub { color: var(--red-ink); }

/* ── Audit log ───────────────────────────────────────────────────────────── */

.log-list { max-height: calc(100vh - 290px); min-height: 240px; overflow-y: auto; }

.log-line {
  display: grid;
  grid-template-columns: 104px 190px minmax(0, 1fr);
  align-items: baseline;
  gap: 16px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--hair);
  font-size: 13px;
}
.log-line:last-child { border-bottom: 0; }
.log-line:hover { background: rgba(241, 237, 228, 0.022); }

.log-ts { display: flex; flex-direction: column; font-size: 12px; color: var(--ash); }
.log-ts b { font-weight: 500; }
.log-ts i { font-style: normal; font-size: 11px; color: var(--smoke); }

.log-act {
  font-weight: 600;
  color: var(--bone);
  overflow-wrap: anywhere;
}
.log-line[data-cat="auth"] .log-act { color: var(--bone-dim); }

.log-detail { font-size: 12px; color: var(--ash); overflow-wrap: anywhere; }

/* ── Switches ────────────────────────────────────────────────────────────── */

.switches { display: grid; margin-top: 8px; }
.switches.cols { grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 28px; }

.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 13px 0;
  border-bottom: 1px solid var(--hair);
  cursor: pointer;
}
.switches:not(.cols) .switch-row:last-child { border-bottom: 0; }

.switch-text { min-width: 0; }
.switch-text b {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 14px;
  font-weight: 600;
  color: var(--bone);
}
.switch-text small { display: block; margin-top: 3px; font-size: 12.5px; line-height: 1.45; color: var(--ash); }

/* A real switch, drawn with one gradient layer so it renders the same in every
   engine. The knob is a sized background that slides by background-position;
   its colour is a registered property, so it fades rather than snapping. */
@property --knob {
  syntax: "<color>";
  inherits: false;
  initial-value: #a39e94;
}

input.switch {
  --knob: var(--ash);
  appearance: none;
  -webkit-appearance: none;
  flex: none;
  width: 42px;
  height: 24px;
  margin: 0;
  border-radius: 999px;
  border: 1px solid var(--hair-strong);
  background-color: var(--pitch-4);
  background-image: radial-gradient(closest-side, var(--knob) calc(100% - 1px), transparent);
  background-repeat: no-repeat;
  background-size: 18px 18px;
  background-position: 2px 50%;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.45);
  cursor: pointer;
  transition:
    background-position 320ms var(--ease-drawer),
    background-color 220ms var(--ease-out),
    border-color 220ms var(--ease-out),
    --knob 220ms var(--ease-out),
    transform 140ms var(--ease-out);
}
input.switch:checked {
  --knob: var(--pitch-1);
  border-color: var(--bone);
  background-color: var(--bone);
  background-position: calc(100% - 2px) 50%;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5), 0 0 0 3px rgba(241, 237, 228, 0.08);
}
input.switch:active { transform: scale(0.94); }
input.switch:focus-visible { outline: 2px solid var(--bone); outline-offset: 2px; }

#maintCompValueRow[data-idle="1"] { opacity: 0.6; }
/* Custom time: amount and unit share one field. */
.time-pair { display: flex; gap: 6px; }
.time-pair select { width: 112px; height: 32px; border-radius: 9px; font-size: 13px; }

/* ── Maintenance layouts ─────────────────────────────────────────────────── */

.adjust {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 14px 28px;
}
.adjust-group { display: flex; align-items: flex-end; gap: 8px; }

.release {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr) 200px;
  gap: 16px;
}

/* ── User drawer ─────────────────────────────────────────────────────────── */

.drawer-scrim {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0, 0, 0, 0.62);
  -webkit-backdrop-filter: blur(6px) saturate(0.8);
  backdrop-filter: blur(6px) saturate(0.8);
  opacity: 0;
  transition: opacity 360ms var(--ease-out);
}
.drawer-scrim[data-open="1"] { opacity: 1; }
.drawer-scrim:not([data-open="1"]) { pointer-events: none; transition-duration: 240ms; }

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 1001;
  width: min(500px, 100vw);
  display: flex;
  flex-direction: column;
  background:
    linear-gradient(180deg, rgba(241, 237, 228, 0.025), transparent 220px),
    var(--pitch-1);
  border-left: 1px solid var(--hair-mid);
  box-shadow:
    inset 1px 0 0 rgba(241, 237, 228, 0.04),
    -32px 0 80px rgba(0, 0, 0, 0.6);
  transform: translateX(100%);
  transition: transform 460ms var(--ease-drawer);
}
.drawer[data-open="1"] { transform: translateX(0); }
/* Leaving is quicker than arriving: the system answers, it doesn't perform. */
.drawer:not([data-open="1"]) { pointer-events: none; transition-duration: 280ms; }

@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

/* The drawer's contents follow it in, a beat behind. */
.drawer[data-open="1"] .drawer-head,
.drawer[data-open="1"] .drawer-body > * { animation: rise 460ms var(--ease-out) backwards; }
.drawer[data-open="1"] .drawer-head { animation-delay: 60ms; }
.drawer[data-open="1"] .drawer-body > :nth-child(1) { animation-delay: 100ms; }
.drawer[data-open="1"] .drawer-body > :nth-child(2) { animation-delay: 140ms; }
.drawer[data-open="1"] .drawer-body > :nth-child(3) { animation-delay: 180ms; }
.drawer[data-open="1"] .drawer-body > :nth-child(4) { animation-delay: 220ms; }
.drawer[data-open="1"] .drawer-body > :nth-child(n + 5) { animation-delay: 260ms; }

.drawer-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 24px 20px;
  border-bottom: 1px solid var(--hair);
}
.drawer-title { min-width: 0; }
.drawer-title h3 {
  margin-top: 4px;
  font-size: 22px;
  line-height: 1.15;
  font-weight: 800;
  font-stretch: 108%;
  letter-spacing: -0.03em;
  overflow-wrap: anywhere;
}
.drawer-refs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
}
.drawer-refs code {
  font-size: 11px;
  padding: 4px 8px;
  color: var(--ash);
  overflow-wrap: anywhere;
}

.drawer-body { flex: 1; overflow-y: auto; padding: 4px 24px 32px; }

.facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 20px 0 6px;
  border-radius: 12px;
  border: 1px solid var(--hair);
  overflow: hidden;
}
.fact {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 11px 14px;
  border-bottom: 1px solid var(--hair);
  min-width: 0;
}
.fact:nth-child(odd) { border-right: 1px solid var(--hair); }
.fact:nth-last-child(-n + 2):nth-child(odd),
.fact:last-child { border-bottom: 0; }
.fact:last-child:nth-child(odd) { grid-column: 1 / -1; border-right: 0; }
.fact-k { font-size: 10px; }
.fact-v { font-size: 13.5px; color: var(--bone); overflow-wrap: anywhere; }

.drawer-sect { padding: 22px 0 4px; border-top: 1px solid var(--hair); margin-top: 18px; }
.drawer-sect:first-of-type { border-top: 0; margin-top: 4px; }
.drawer-sect .panel-title { margin-bottom: 14px; font-size: 14.5px; }
.drawer-sect .hint { margin: 10px 0 12px; }
.drawer-sect.is-danger .panel-title,
.drawer-sect.is-danger .panel-title svg { color: var(--red-ink); }

.svc-picks { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.svc-pick {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 34px;
  padding: 0 12px 0 10px;
  border-radius: 9px;
  border: 1px solid var(--hair-mid);
  font-size: 13px;
  font-weight: 600;
  color: var(--ash);
  cursor: pointer;
  transition: border-color 140ms var(--press), background-color 140ms var(--press), color 140ms var(--press);
}
.svc-pick input { width: 15px; height: 15px; margin: 0; accent-color: var(--bone); cursor: pointer; }
.svc-pick:has(input:checked) {
  color: var(--bone);
  border-color: color-mix(in srgb, var(--svc) 60%, transparent);
  background: color-mix(in srgb, var(--svc) 14%, var(--pitch-2));
}

/* ── Results ledger ──────────────────────────────────────────────────────── */

.ledger {
  position: fixed;
  left: var(--rail-w);
  right: 0;
  bottom: 0;
  z-index: 900;
  display: grid;
  grid-template-rows: auto 0fr;
  background: rgba(11, 10, 9, 0.82);
  -webkit-backdrop-filter: blur(14px) saturate(1.1);
  backdrop-filter: blur(14px) saturate(1.1);
  border-top: 1px solid var(--hair-mid);
  box-shadow: 0 -18px 50px rgba(0, 0, 0, 0.5);
  transition: grid-template-rows 420ms var(--ease-drawer);
}
.ledger[data-open="1"] { grid-template-rows: auto 1fr; }

.ledger-bar {
  flex: none;
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  height: var(--ledger-h);
  padding: 0 20px;
  border: 0;
  background: none;
  text-align: left;
}
.ledger-bar:hover { background: rgba(241, 237, 228, 0.025); }
.ledger-bar:focus-visible { outline-offset: -2px; }

.ledger-title { flex: none; }

/* Collapsed, the bar still answers "what just happened". */
.ledger-last {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  color: var(--bone-dim);
}
.ledger[data-open="1"] .ledger-last { color: var(--smoke); }

.ledger-count {
  flex: none;
  min-width: 26px;
  height: 22px;
  padding: 0 8px;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  border: 1px solid var(--hair-strong);
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ash);
}
.ledger-count[data-attention="1"] { background: var(--bone); border-color: var(--bone); color: var(--pitch-1); }

.ledger-chev {
  flex: none;
  width: 9px;
  height: 9px;
  margin: 0 4px 0 2px;
  border-right: 1.5px solid var(--ash);
  border-bottom: 1.5px solid var(--ash);
  transform: translateY(2px) rotate(-135deg);
  transition: transform 200ms var(--ease);
}
.ledger[data-open="1"] .ledger-chev { transform: translateY(-2px) rotate(45deg); }

/* Opens by growing its row from 0fr to 1fr; closed, it is hidden from the
   keyboard once the collapse has finished. */
.ledger-body {
  min-height: 0;
  max-height: calc(min(60vh, 540px) - var(--ledger-h));
  overflow-y: auto;
  box-shadow: inset 0 1px 0 var(--hair);
  visibility: visible;
  transition: visibility 0s linear 0s;
}
.ledger:not([data-open="1"]) .ledger-body {
  visibility: hidden;
  transition: visibility 0s linear 420ms;
}

.led {
  position: relative;
  padding: 16px 24px 18px 26px;
  border-bottom: 1px solid var(--hair);
}
.led.is-new { animation: rise 380ms var(--ease-out) backwards; }
.led:last-child { border-bottom: 0; }

/* The severity gutter: form, not colour. Solid, hatched, or red. */
.led::before {
  content: "";
  position: absolute;
  left: 0;
  top: 16px;
  bottom: 16px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--bone);
}
.led[data-kind="attention"]::before { background: var(--hatch); }
.led[data-kind="failed"]::before { background: var(--red); }

.led-head { display: flex; align-items: baseline; gap: 12px; }
.led-name { font-size: 14px; font-weight: 700; letter-spacing: -0.01em; color: var(--bone); }
.led[data-kind="failed"] .led-name { color: var(--red-ink); }
.led-time { margin-left: auto; flex: none; font-size: 11px; color: var(--smoke); }

.led-note { margin-top: 6px; max-width: 80ch; font-size: 13px; line-height: 1.55; color: var(--ash); }
.led-note b { color: var(--bone); font-weight: 600; }

.led-bar { margin-top: 14px; max-width: 640px; }
.led-legend { margin-top: 12px; }
.led-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }

.led-empty { padding: 26px 24px; font-size: 13px; color: var(--smoke); }

.outcome {
  display: flex;
  width: 100%;
  height: 8px;
  border-radius: 4px;
  overflow: hidden;
  background: rgba(241, 237, 228, 0.06);
}
.outcome-seg { flex: 0 0 0%; min-width: 0; height: 100%; }
.outcome-seg[data-tone="done"] { background: var(--bone); }
.outcome-seg[data-tone="refused"] { background: var(--hatch); }
.outcome-seg[data-tone="skipped"] { box-shadow: inset 0 0 0 1px var(--hair-strong); }
.outcome-seg[data-tone="damage"] { background: var(--red); }

.outcome-legend { display: flex; flex-wrap: wrap; gap: 6px 28px; }
.outcome-stat { display: flex; flex-direction: column; gap: 4px; min-width: 72px; }
.outcome-stat-lbl { display: inline-flex; align-items: center; gap: 7px; font-size: 10px; white-space: nowrap; }
.outcome-stat-lbl::before {
  content: "";
  flex: none;
  width: 9px;
  height: 9px;
  border-radius: 2px;
  box-shadow: inset 0 0 0 1px var(--hair-strong);
}
.outcome-stat[data-tone="done"] .outcome-stat-lbl::before { background: var(--bone); box-shadow: none; }
.outcome-stat[data-tone="refused"] .outcome-stat-lbl::before { background: var(--hatch); }
.outcome-stat[data-tone="damage"] .outcome-stat-lbl::before { background: var(--red); box-shadow: none; }

.outcome-stat-val {
  font-size: 24px;
  line-height: 1;
  font-weight: 800;
  font-stretch: 108%;
  letter-spacing: -0.03em;
  font-feature-settings: var(--tnum);
  color: var(--bone);
}
.outcome-stat[data-zero="1"] .outcome-stat-val { color: var(--pitch-4); }
.outcome-stat[data-tone="damage"]:not([data-zero="1"]) .outcome-stat-val { color: var(--red-ink); }

/* ── Toasts ──────────────────────────────────────────────────────────────── */

.toasts {
  position: fixed;
  right: 20px;
  bottom: calc(var(--ledger-h) + 16px);
  z-index: 1100;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  pointer-events: none;
}

/* Toasts rise from the edge they leave by. Transitions, not keyframes, so a
   burst of them retargets smoothly instead of restarting. */
.toast {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  max-width: min(400px, calc(100vw - 40px));
  padding: 11px 16px 11px 12px;
  border-radius: 14px;
  background: rgba(26, 25, 22, 0.88);
  -webkit-backdrop-filter: blur(16px) saturate(1.2);
  backdrop-filter: blur(16px) saturate(1.2);
  border: 1px solid var(--hair-strong);
  box-shadow:
    inset 0 1px 0 rgba(241, 237, 228, 0.07),
    0 1px 2px rgba(0, 0, 0, 0.4),
    0 18px 44px -8px rgba(0, 0, 0, 0.65);
  font-size: 13.5px;
  line-height: 1.45;
  color: var(--bone);
  pointer-events: auto;
  cursor: default;
  opacity: 0;
  transform: translateY(14px) scale(0.96);
  filter: blur(3px);
  transform-origin: 100% 100%;
  transition:
    opacity 280ms var(--ease-out),
    transform 420ms var(--ease-out),
    filter 280ms var(--ease-out);
}
.toast[data-state="in"] { opacity: 1; transform: translateY(0) scale(1); filter: blur(0); }
.toast[data-state="out"] {
  opacity: 0;
  transform: translateY(8px) scale(0.97);
  filter: blur(2px);
  transition-duration: 200ms;
}
.toast-ico { width: 17px; height: 17px; margin-top: 1px; color: var(--ash); }
.toast-msg { min-width: 0; }
.toast.err {
  border-color: rgba(229, 72, 63, 0.5);
  background: color-mix(in srgb, var(--red) 14%, rgba(26, 25, 22, 0.92));
  color: #ffc4bd;
}
.toast.err .toast-ico { color: var(--red-ink); }

/* ── Narrower screens ────────────────────────────────────────────────────── */

@media (max-width: 1180px) {
  .main { padding-left: 32px; padding-right: 32px; }
  .keygen { grid-template-columns: minmax(0, 1fr) 110px; }
  .keygen .field-grow { grid-column: 1 / -1; }
}

@media (max-width: 960px) {
  .console { display: block; }

  .rail {
    position: sticky;
    top: 0;
    z-index: 800;
    height: auto;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 12px;
    padding: 10px 16px 0;
    border-right: 0;
    border-bottom: 1px solid var(--hair);
    overflow: visible;
  }
  .rail-brand { padding: 0; margin: 0; border: 0; }
  .rail-brand img { width: 32px; height: 32px; }
  .rail-brand-text span { display: none; }
  .rail-nav {
    order: 3;
    flex-direction: row;
    width: calc(100% + 32px);
    margin: 0 -16px;
    padding: 4px 12px 8px;
    overflow-x: auto;
    scrollbar-width: none;
  }
  .rail-nav::-webkit-scrollbar { display: none; }
  .rail-section { display: none; }
  .top-nav-btn { width: auto; flex: none; height: 40px; padding-right: 12px; }
  .rail-foot { margin: 0 0 0 auto; padding: 0; border: 0; }
  .rail-foot .rail-section,
  .whoami { display: none; }
  .rail-foot .btn.block { width: auto; }

  .main { padding: 28px 20px calc(var(--ledger-h) + 40px); }
  .ledger { left: 0; }
  .panel-grid,
  .subpanels { grid-template-columns: 1fr; }
  .tally { grid-template-columns: 1fr; }
  .tally-group + .tally-group { border-left: 0; border-top: 1px solid var(--hair); }
  .log-line { grid-template-columns: 88px minmax(0, 1fr); }
  .log-detail { grid-column: 2; }
}

@media (max-width: 640px) {
  .view-head { flex-direction: column; align-items: flex-start; }
  .view-head h2 { font-size: 28px; }
  .sheet { padding: 22px 20px 6px; }
  .sheet-total { flex-direction: column; align-items: flex-start; gap: 10px; }
  .sheet-unit br { display: none; }
  .split-row { grid-template-columns: auto minmax(0, 1fr) auto 44px; }
  .split-row .flag { grid-column: 2 / -1; grid-row: 2; justify-self: start; }
  .pools { grid-template-columns: 1fr; }
  .panel { padding: 18px 18px 20px; }
  .keygen,
  .release { grid-template-columns: 1fr; }
  .switches.cols { grid-template-columns: 1fr; }
  .search { flex: 1 1 100%; }
  .toolbar .push { margin-left: 0; }
  .facts { grid-template-columns: 1fr; }
  .fact:nth-child(odd) { border-right: 0; }
  .fact:nth-last-child(-n + 2):nth-child(odd) { border-bottom: 1px solid var(--hair); }
  .ledger-last { display: none; }
  .toasts { left: 16px; right: 16px; align-items: stretch; }
}

/* ═══════════════════════════════════════════════════════════════════════════
   MATERIAL & MOTION LAYER

   Later than everything above, so it wins on equal specificity. Surfaces get
   grain, a lit top edge and a real drop; indicators glide instead of
   blinking; lists arrive in a short cascade; every press answers.
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Surfaces ────────────────────────────────────────────────────────────── */

/* The star field: fixed behind everything, faded in once it starts drawing.
   The sign-in page and the console sit above it, and the stage and rail are
   left transparent so the sky shows between the panels. */
.stars {
  position: fixed;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  display: block;
  pointer-events: none;
  opacity: 0;
  transition: opacity 1600ms var(--ease-out);
}
.stars[data-on="1"] { opacity: 1; }

body { background: #000; }
.gate,
.console { position: relative; z-index: 1; }

/* A soft vignette keeps the edges deep and the working area calm. */
.stage {
  background: radial-gradient(140% 100% at 50% 0%, transparent 55%, rgba(0, 0, 0, 0.55));
}

.rail {
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.72));
}
@media (max-width: 960px) {
  .rail {
    background: rgba(0, 0, 0, 0.82);
    -webkit-backdrop-filter: blur(14px);
    backdrop-filter: blur(14px);
  }
}

.panel,
.sheet {
  background:
    linear-gradient(180deg, rgba(241, 237, 228, 0.024), transparent 180px),
    var(--pitch-2);
  box-shadow: var(--lift);
}
.tally { box-shadow: var(--lift); }
.subpanel { box-shadow: inset 0 1px 0 rgba(241, 237, 228, 0.03); }

.view-head { position: relative; padding-bottom: 22px; }
.view-head::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1px;
  background: linear-gradient(90deg, var(--hair-strong), var(--hair) 40%, transparent 85%);
}

/* ── Console arrival ─────────────────────────────────────────────────────── */

@keyframes railIn { from { opacity: 0; transform: translateX(-14px); } }
@keyframes ledgerIn { from { transform: translateY(100%); } }

.console:not([hidden]) .rail { animation: railIn 560ms var(--ease-out) backwards; }
.console:not([hidden]) .ledger { animation: ledgerIn 560ms var(--ease-drawer) 180ms backwards; }

/* ── Rail: the glide ─────────────────────────────────────────────────────── */

.rail-nav { position: relative; isolation: isolate; }

.rail-glide {
  position: absolute;
  top: 0;
  left: 0;
  z-index: -1;
  border-radius: 11px;
  background: linear-gradient(180deg, rgba(241, 237, 228, 0.08), rgba(241, 237, 228, 0.04));
  box-shadow:
    inset 0 0 0 1px var(--hair),
    inset 0 1px 0 rgba(241, 237, 228, 0.07),
    0 8px 18px -10px rgba(0, 0, 0, 0.9);
  pointer-events: none;
  transition:
    transform 380ms var(--ease-drawer),
    width 380ms var(--ease-drawer),
    height 380ms var(--ease-drawer),
    opacity 200ms var(--ease-out);
}
.rail-glide:not([data-ready]),
.tabs-glide:not([data-ready]) { transition: none; }
.rail-glide[data-off="1"],
.tabs-glide[data-off="1"] { opacity: 0; }

.top-nav-btn { transition: background-color 160ms var(--ease-out), color 160ms var(--ease-out), transform 140ms var(--ease-out); }
.top-nav-btn.active,
.top-nav-btn.active:hover { background: transparent; }
.top-nav-btn:active { transform: scale(0.98); }
.top-nav-btn .nav-ico svg { transition: transform 220ms var(--ease-out); }
.top-nav-btn.active .nav-ico svg { transform: scale(1.04); }

.rail-brand img { box-shadow: 0 0 0 1px var(--hair-mid), 0 6px 18px -6px rgba(0, 0, 0, 0.9); }

.whoami[data-initial]::before {
  content: attr(data-initial);
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  margin-right: 9px;
  vertical-align: middle;
  border-radius: 50%;
  background: linear-gradient(180deg, var(--pitch-4), var(--pitch-2));
  box-shadow: inset 0 0 0 1px var(--hair-mid), inset 0 1px 0 rgba(241, 237, 228, 0.06);
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 800;
  color: var(--bone);
}

/* ── Tabs: the same glide, smaller ───────────────────────────────────────── */

.tabs { position: relative; isolation: isolate; }

.tabs-glide {
  position: absolute;
  top: 0;
  left: 0;
  z-index: -1;
  border-radius: 8px;
  background: linear-gradient(180deg, #2b2924, var(--pitch-4));
  box-shadow:
    inset 0 0 0 1px var(--hair-mid),
    inset 0 1px 0 rgba(241, 237, 228, 0.06),
    0 1px 2px rgba(0, 0, 0, 0.6);
  pointer-events: none;
  transition:
    transform 320ms var(--ease-drawer),
    width 320ms var(--ease-drawer),
    height 320ms var(--ease-drawer),
    opacity 200ms var(--ease-out);
}
.tabs .chip.active,
.tabs .chip.active:hover { background: transparent; box-shadow: none; }

/* ── Buttons ─────────────────────────────────────────────────────────────── */

.btn {
  position: relative;
  isolation: isolate;
  transition:
    background-color 160ms var(--ease-out),
    border-color 160ms var(--ease-out),
    color 160ms var(--ease-out),
    box-shadow 200ms var(--ease-out),
    filter 160ms var(--ease-out),
    transform 140ms var(--ease-out);
}

.btn.primary {
  background: linear-gradient(180deg, var(--bone-hi), var(--bone) 55%, #e2ddd2);
  border-color: transparent;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.75),
    inset 0 -1px 0 rgba(0, 0, 0, 0.1),
    0 1px 2px rgba(0, 0, 0, 0.55),
    0 10px 24px -12px rgba(241, 237, 228, 0.3);
}
.btn.primary:hover:not(:disabled) {
  background: linear-gradient(180deg, #fffdf8, var(--bone-hi) 55%, #ebe6db);
  border-color: transparent;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.8),
    inset 0 -1px 0 rgba(0, 0, 0, 0.1),
    0 1px 2px rgba(0, 0, 0, 0.55),
    0 14px 30px -12px rgba(241, 237, 228, 0.42);
}

.btn.ghost { box-shadow: inset 0 1px 0 rgba(241, 237, 228, 0.045), 0 1px 1px rgba(0, 0, 0, 0.35); }

/* Armed: a shade creeps across the button over the four seconds it stays
   armed, so you can see how long you have to confirm. */
@keyframes armIn { from { transform: scale(0.95); } }
@keyframes armDrain { from { transform: scaleX(0); } to { transform: scaleX(1); } }
/* Armed must out-rank .btn.ghost.danger, or the button never turns red. */
.btn[data-armed="1"]:is(.ghost, .danger, .primary),
.btn[data-armed="1"]:is(.ghost, .danger, .primary):hover:not(:disabled) {
  background: var(--red);
  border-color: var(--red);
  color: #fff;
}
.btn[data-armed="1"] {
  overflow: hidden;
  animation: armIn 280ms var(--ease-out);
  box-shadow: 0 0 0 3px rgba(229, 72, 63, 0.18), 0 10px 26px -12px rgba(229, 72, 63, 0.7);
}
.btn[data-armed="1"]::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: rgba(0, 0, 0, 0.26);
  transform-origin: left center;
  animation: armDrain 4s linear forwards;
}

.icon-btn svg { transition: transform 260ms var(--ease-out); }
.icon-btn:hover svg { transform: rotate(90deg); }

.copy-btn { transition: color 140ms var(--ease-out), background-color 140ms var(--ease-out), transform 120ms var(--ease-out); }
.copy-btn:active { transform: scale(0.88); }

/* ── Fields ──────────────────────────────────────────────────────────────── */

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="search"],
input[type="datetime-local"],
select,
textarea {
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.35);
  transition:
    border-color 160ms var(--ease-out),
    box-shadow 200ms var(--ease-out),
    background-color 160ms var(--ease-out);
}
input:focus,
select:focus,
textarea:focus {
  background-color: var(--pitch-1);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.35), var(--ring);
}

.search > svg { transition: color 160ms var(--ease-out); }
.search:focus-within > svg { color: var(--bone); }

@keyframes popIn { from { opacity: 0; transform: translateY(-50%) scale(0.8); } }
.clear-btn:not([hidden]) { animation: popIn 200ms var(--ease-out); }

.chip {
  transition:
    background-color 160ms var(--ease-out),
    border-color 160ms var(--ease-out),
    color 160ms var(--ease-out),
    box-shadow 160ms var(--ease-out),
    transform 120ms var(--ease-out);
}
.chips .chip.active:not([data-service]) { box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6), 0 1px 2px rgba(0, 0, 0, 0.5); }
.chip[data-service]::before { transition: opacity 160ms var(--ease-out), transform 220ms var(--ease-out), box-shadow 220ms var(--ease-out); }
.chip[data-service].active::before {
  transform: scale(1.15);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--svc) 22%, transparent);
}

/* ── Tables and lists ────────────────────────────────────────────────────── */

.tbl th { background: rgba(11, 10, 9, 0.7); }
.tbl tbody tr { transition: background-color 160ms var(--ease-out); }

.user-row td:first-child { box-shadow: inset 2px 0 0 transparent; transition: box-shadow 200ms var(--ease-out); }
.user-row:hover td:first-child,
.user-row:focus-visible td:first-child { box-shadow: inset 2px 0 0 var(--bone); }
.user-row [data-manage] { opacity: 0.6; }
.user-row:hover [data-manage],
.user-row:focus-visible [data-manage] { opacity: 1; }
.user-row [data-manage] {
  transition:
    opacity 160ms var(--ease-out),
    background-color 160ms var(--ease-out),
    border-color 160ms var(--ease-out),
    color 160ms var(--ease-out),
    transform 140ms var(--ease-out);
}

/* A freshly loaded list arrives top-down; the 5-second polls repaint still. */
@keyframes rowIn { from { opacity: 0; transform: translateY(6px); } }
[data-reveal="1"] > tr,
[data-reveal="1"] > .log-line { animation: rowIn 360ms var(--ease-out) backwards; }
[data-reveal="1"] > :nth-child(2) { animation-delay: 20ms; }
[data-reveal="1"] > :nth-child(3) { animation-delay: 40ms; }
[data-reveal="1"] > :nth-child(4) { animation-delay: 60ms; }
[data-reveal="1"] > :nth-child(5) { animation-delay: 80ms; }
[data-reveal="1"] > :nth-child(6) { animation-delay: 100ms; }
[data-reveal="1"] > :nth-child(7) { animation-delay: 120ms; }
[data-reveal="1"] > :nth-child(8) { animation-delay: 140ms; }
[data-reveal="1"] > :nth-child(9) { animation-delay: 160ms; }
[data-reveal="1"] > :nth-child(10) { animation-delay: 180ms; }
[data-reveal="1"] > :nth-child(n + 11) { animation-delay: 200ms; }

/* Skeletons: a table waiting for its first load shows its shape, not a hole. */
@keyframes shimmer {
  from { background-position: 150% 0; }
  to { background-position: -50% 0; }
}
.skel {
  display: block;
  width: 72%;
  height: 10px;
  border-radius: 6px;
  background: linear-gradient(90deg, rgba(241, 237, 228, 0.05) 0%, rgba(241, 237, 228, 0.12) 50%, rgba(241, 237, 228, 0.05) 100%);
  background-size: 200% 100%;
  animation: shimmer 1.3s linear infinite;
}
.skel-row td { padding-top: 19px; padding-bottom: 19px; }
.skel-row td:nth-child(3n + 2) .skel { width: 48%; }
.skel-row td:nth-child(3n) .skel { width: 60%; }
.skel-row td:first-child .skel { width: 84%; }
.skel-row:nth-child(4) { opacity: 0.8; }
.skel-row:nth-child(5) { opacity: 0.6; }
.skel-row:nth-child(6) { opacity: 0.4; }
.skel-line { padding: 16px; }
.skel-line .skel:nth-child(2) { width: 60%; }
.skel-line .skel:nth-child(3) { width: 88%; }
.skel-line:nth-child(n + 6) { opacity: 0.55; }

/* Empty states carry the badge's ring, turned, instead of a bare sentence. */
.empty-cell::before {
  content: "";
  display: block;
  width: 44px;
  height: 44px;
  margin: 0 auto 14px;
  background: var(--smoke);
  -webkit-mask: url("/app/assets/ink-ring.svg") center / 100% 100% no-repeat;
  mask: url("/app/assets/ink-ring.svg") center / 100% 100% no-repeat;
  opacity: 0.55;
  transform: rotate(-24deg);
}

.pill.ok::before { box-shadow: 0 0 0 3px rgba(241, 237, 228, 0.12); }

/* ── Overview and pools ──────────────────────────────────────────────────── */

.split { box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.4); }
.split-seg {
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.28);
  transition: flex-basis 900ms var(--ease-out);
}
.split-row { transition: background-color 160ms var(--ease-out); }

.pool {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(241, 237, 228, 0.024), transparent 120px),
    var(--pitch-2);
  box-shadow: var(--lift);
  transition:
    border-color 200ms var(--ease-out),
    box-shadow 260ms var(--ease-out),
    transform 140ms var(--ease-out);
}
.pool.target {
  box-shadow:
    var(--lift),
    0 18px 44px -24px color-mix(in srgb, var(--svc) 70%, transparent);
}
/* The light under the pointer, tinted by the service. */
.pool::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: radial-gradient(280px circle at var(--mx, 50%) var(--my, -40%), color-mix(in srgb, var(--svc) 15%, transparent), transparent 70%);
  opacity: 0;
  transition: opacity 260ms var(--ease-out);
  pointer-events: none;
}
@media (hover: hover) and (pointer: fine) {
  .pool:hover::before { opacity: 1; }
}

.pool-fill {
  width: 100%;
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 900ms var(--ease-out);
}

/* ── Things that appear ──────────────────────────────────────────────────── */

.preview:not([hidden]),
.report:not([hidden]),
.results:not([hidden]) { animation: rise 340ms var(--ease-out) backwards; }

/* ── Sign-in ─────────────────────────────────────────────────────────────── */

.gate {
  background: radial-gradient(120% 90% at 50% 40%, transparent 45%, rgba(0, 0, 0, 0.6));
}

@keyframes badgeIn {
  from { opacity: 0; transform: scale(0.88); filter: blur(10px) drop-shadow(0 18px 36px rgba(0, 0, 0, 0.7)); }
}

.gate-card { animation: none; }
.gate-badge {
  filter: blur(0) drop-shadow(0 18px 36px rgba(0, 0, 0, 0.7));
  animation: badgeIn 760ms var(--ease-out) backwards;
}
.gate-brand > :not(.gate-badge),
.gate-fields { animation: rise 560ms var(--ease-out) backwards; }
.gate-brand > .gate-tag { animation-delay: 120ms; }
.gate-brand > .login-title { animation-delay: 170ms; }
.gate-brand > .gate-sub { animation-delay: 220ms; }
.gate-fields { animation-delay: 280ms; }

.gate-fields {
  position: relative;
  background: rgba(18, 17, 15, 0.72);
  -webkit-backdrop-filter: blur(20px) saturate(1.1);
  backdrop-filter: blur(20px) saturate(1.1);
  box-shadow:
    var(--lift),
    0 40px 90px -20px rgba(0, 0, 0, 0.8);
}
/* A single lit edge across the top of the card. */
.gate-fields::before {
  content: "";
  position: absolute;
  top: -1px;
  left: 18%;
  right: 18%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(241, 237, 228, 0.4), transparent);
  pointer-events: none;
}

@keyframes shake {
  0% { opacity: 0; transform: translateX(0); }
  20% { opacity: 1; transform: translateX(-6px); }
  40% { transform: translateX(5px); }
  60% { transform: translateX(-3px); }
  80% { transform: translateX(2px); }
  100% { transform: translateX(0); }
}
.gate-error:not([hidden]) { animation: shake 420ms var(--ease-out); }

/* ── Reduced motion ──────────────────────────────────────────────────────── */

/* Reduced motion means gentler, not none. Windows reports it whenever
   Settings › Accessibility › Visual effects › Animation effects is off, so
   switching every transition off here made the console feel dead. Fades,
   colour, the glides and the counters stay; travel, shakes, spins, drift
   and shimmer go. */
@media (prefers-reduced-motion: reduce) {
  :root { --rise: 0px; }

  @keyframes railIn { from { opacity: 0; } }
  @keyframes ledgerIn { from { opacity: 0; } }
  @keyframes badgeIn { from { opacity: 0; } }
  @keyframes shake { from { opacity: 0; } }
  @keyframes armIn { from { opacity: 0.6; } }
  @keyframes popIn { from { opacity: 0; } }
  @keyframes rowIn { from { opacity: 0; } }

  .drawer,
  .drawer[data-open="1"] { transform: none; }
  .drawer {
    opacity: 0;
    transition: opacity 260ms var(--ease-out);
  }
  .drawer[data-open="1"] { opacity: 1; }

  .toast,
  .toast[data-state="out"] { transform: none; filter: none; }

  .icon-btn:hover svg { transform: none; }
  .btn[aria-busy="true"]::after { animation: none; background-position: 50% 0; }
  .skel { animation: none; }
}


/* ═══════════════════════════════════════════════════════════════════════════
   WEBSITE MOTION — the shop's feel, same as POLISH LAYER XXX in the app.

   Panels catch a soft aura at the top edge and lift under the pointer, the
   primary button catches the light every few seconds, the sign-in card has a
   beam orbiting its rim, and status has colour: green done, amber warning,
   red failed, each with a pop, ping or shake. The star field is untouched.
   ═══════════════════════════════════════════════════════════════════════════ */
@property --rs-beam { syntax: "<angle>"; inherits: false; initial-value: 0deg; }
@property --rs-shine { syntax: "<percentage>"; inherits: false; initial-value: -60%; }

:root {
  --ok: #45c08b;
  --warn: #e3c04b;
  --rs-spring: cubic-bezier(0.16, 1, 0.3, 1);
  --rs-aura: radial-gradient(120% 70% at 50% 0%, rgba(241, 237, 228, 0.06), transparent 60%);
  --rs-aura-hi: radial-gradient(120% 70% at 50% 0%, rgba(241, 237, 228, 0.1), transparent 62%);
  --rs-shine-band: linear-gradient(100deg, transparent 30%, rgba(255, 255, 255, 0.7) 50%, transparent 70%);
}

/* ── Panels: top-lit, lift under the pointer ── */
.panel:not(.flush),
.tally {
  background-image: var(--rs-aura);
  transition: translate 280ms var(--rs-spring), box-shadow 280ms var(--rs-spring), border-color 200ms var(--ease-out);
}
.pool { transition: border-color 200ms var(--ease-out), box-shadow 260ms var(--ease-out), translate 280ms var(--rs-spring), transform 140ms var(--ease-out); }
@media (hover: hover) and (pointer: fine) {
  .panel:not(.flush):hover,
  .pool:hover {
    translate: 0 -2px;
    border-color: var(--hair-mid);
    box-shadow: var(--lift), 0 24px 48px -26px rgba(0, 0, 0, 0.9);
  }
  .panel:not(.flush):hover { background-image: var(--rs-aura-hi); }
}

/* ── Primary button: lift, glow, and a shine that sweeps on its own ── */
.btn.primary:not(:disabled) {
  background:
    var(--rs-shine-band) var(--rs-shine) 0 / 60% 100% no-repeat,
    linear-gradient(180deg, var(--bone-hi), var(--bone) 55%, #e2ddd2);
  animation: rs-shine-idle 6s ease-in-out infinite;
}
.btn.primary:hover:not(:disabled) {
  background:
    var(--rs-shine-band) var(--rs-shine) 0 / 60% 100% no-repeat,
    linear-gradient(180deg, #fffdf8, var(--bone-hi) 55%, #ebe6db);
  translate: 0 -2px;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.8),
    0 1px 2px rgba(0, 0, 0, 0.55),
    0 18px 36px -12px rgba(241, 237, 228, 0.5);
}
.btn { transition-property: background-color, border-color, color, box-shadow, filter, transform, translate; }
.btn.primary:active:not(:disabled) { translate: 0 0; }
@media (hover: hover) and (pointer: fine) {
  .btn.ghost:hover:not(:disabled) {
    translate: 0 -1px;
    box-shadow: inset 0 1px 0 rgba(241, 237, 228, 0.07), 0 10px 20px -12px rgba(0, 0, 0, 0.9);
  }
}
@keyframes rs-shine-idle {
  0%, 72% { --rs-shine: -60%; }
  100% { --rs-shine: 160%; }
}

/* Chips: the chosen one settles in on a spring. */
.chip { transition: background-color 160ms var(--ease-out), border-color 160ms var(--ease-out), color 160ms var(--ease-out), scale 160ms var(--ease-out); }
.chip:active { scale: 0.95; }
.chip.active { animation: rs-pop 360ms var(--rs-spring); }

/* ── Sign-in: a beam orbits the card ── */
.gate-fields {
  border-color: transparent;
  background:
    linear-gradient(rgba(18, 17, 15, 0.92), rgba(18, 17, 15, 0.92)) padding-box,
    conic-gradient(from var(--rs-beam), var(--hair-mid) 0deg 290deg, rgba(241, 237, 228, 0.85) 330deg, var(--hair-mid) 360deg) border-box;
  animation: rise 560ms var(--ease-out) 280ms backwards, rs-beam-spin 6s linear infinite;
}
@keyframes rs-beam-spin { to { --rs-beam: 360deg; } }

/* ── Status colour ── */
.pill { transition: background-color 200ms var(--ease-out), border-color 200ms var(--ease-out), color 200ms var(--ease-out); }
.pill.ok {
  border-color: color-mix(in srgb, var(--ok) 45%, transparent);
  background: color-mix(in srgb, var(--ok) 10%, transparent);
  color: color-mix(in srgb, var(--ok) 70%, #fff);
}
.pill.ok::before { background: var(--ok); animation: rs-ping-ok 2.4s ease-out infinite; }
.pill.warn {
  border-color: color-mix(in srgb, var(--warn) 45%, transparent);
  background: color-mix(in srgb, var(--warn) 10%, transparent);
  color: color-mix(in srgb, var(--warn) 75%, #fff);
}
.pill.bad::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--red); }

/* Toasts: green for done, red for failed; the icon pops, a failure shakes. */
.toast:not(.err) {
  border-color: color-mix(in srgb, var(--ok) 45%, transparent);
  background: color-mix(in srgb, var(--ok) 12%, rgba(26, 25, 22, 0.92));
}
.toast:not(.err) .toast-ico { color: var(--ok); }
.toast[data-state="in"] .toast-ico { animation: rs-pop 480ms var(--rs-spring) 80ms backwards; }
.toast.err[data-state="in"] { animation: rs-shake 380ms var(--ease-out) 260ms; }

/* Ledger: done is green, attention amber, failed red; a new entry pops. */
.led[data-kind="done"]::before { background: var(--ok); box-shadow: 0 0 10px color-mix(in srgb, var(--ok) 50%, transparent); }
.led[data-kind="attention"]::before { background: var(--warn); }
.led[data-kind="failed"]::before { box-shadow: 0 0 10px color-mix(in srgb, var(--red) 55%, transparent); }
.led[data-kind="attention"] .led-name { color: color-mix(in srgb, var(--warn) 80%, #fff); }
.led.is-new { animation: rs-led-in 520ms var(--rs-spring); }
.led.is-new[data-kind="failed"] { animation: rs-led-in 520ms var(--rs-spring), rs-shake 380ms var(--ease-out) 300ms; }
@keyframes rs-led-in {
  from { opacity: 0; translate: 0 10px; scale: 0.98; }
  to { opacity: 1; translate: 0 0; scale: 1; }
}

/* Armed buttons pulse red while they wait for the second press. */
.btn[data-armed="1"] { animation: rs-ping-err 1.2s ease-out infinite; }

/* Busy buttons breathe. */
.btn[aria-busy="true"] { animation: rs-busy 1.4s ease-in-out infinite; }
@keyframes rs-busy { 50% { filter: brightness(0.82); } }

/* Shared keyframes. */
@keyframes rs-pop {
  0% { scale: 0.6; opacity: 0; }
  60% { scale: 1.12; opacity: 1; }
  100% { scale: 1; }
}
@keyframes rs-shake {
  0%, 100% { translate: 0 0; }
  20% { translate: -5px 0; }
  40% { translate: 4px 0; }
  60% { translate: -3px 0; }
  80% { translate: 2px 0; }
}
@keyframes rs-ping-ok {
  0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--ok) 60%, transparent); }
  80%, 100% { box-shadow: 0 0 0 6px transparent; }
}
@keyframes rs-ping-err {
  0% { box-shadow: 0 0 0 0 rgba(229, 72, 63, 0.55); }
  80%, 100% { box-shadow: 0 0 0 7px transparent; }
}

/* Reduced motion: colour stays, loops, lifts and shakes go. */
@media (prefers-reduced-motion: reduce) {
  .btn.primary:not(:disabled),
  .btn[data-armed="1"],
  .btn[aria-busy="true"],
  .pill.ok::before,
  .chip.active,
  .toast,
  .toast-ico,
  .led.is-new { animation: none !important; }
  .gate-fields { animation: rise 560ms var(--ease-out) 280ms backwards; }
  .panel:hover,
  .pool:hover,
  .btn:hover { translate: none !important; }
}


/* ── Every tab moves like the shop ───────────────────────────────────────
   Overview, Keys, Users, Stock, Logs and Settings arrive on the shop's
   spring with a soft blur, blocks inside a panel follow in a cascade, the
   page title catches a slow sheen, and rows answer the pointer. */
@keyframes rs-rise-blur {
  from { opacity: 0; transform: translateY(12px); filter: blur(5px); }
  to { opacity: 1; transform: none; filter: none; }
}
.view.active > * { animation: rs-rise-blur 560ms var(--rs-spring) backwards; }
.view.active > :nth-child(2) { animation-delay: 60ms; }
.view.active > :nth-child(3) { animation-delay: 120ms; }
.view.active > :nth-child(4) { animation-delay: 180ms; }
.view.active > :nth-child(5) { animation-delay: 240ms; }
.view.active > :nth-child(n + 6) { animation-delay: 300ms; }

/* Blocks inside a panel (grids, subpanels, pools, tally groups) follow. */
.view.active :is(.panel-grid, .subpanels, .pools, .tally) > * { animation: rs-rise-blur 520ms var(--rs-spring) backwards; }
.view.active :is(.panel-grid, .subpanels, .pools, .tally) > :nth-child(1) { animation-delay: 160ms; }
.view.active :is(.panel-grid, .subpanels, .pools, .tally) > :nth-child(2) { animation-delay: 220ms; }
.view.active :is(.panel-grid, .subpanels, .pools, .tally) > :nth-child(3) { animation-delay: 280ms; }
.view.active :is(.panel-grid, .subpanels, .pools, .tally) > :nth-child(n + 4) { animation-delay: 340ms; }

/* Page title: the shop hero's sheen. */
.view-head h2 {
  background: linear-gradient(100deg, var(--bone) 0 40%, #fff 50%, var(--bone) 60% 100%) 120% 0 / 250% 100% no-repeat;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: rs-title-sheen 7s ease-in-out infinite;
}
@keyframes rs-title-sheen {
  0%, 52% { background-position: 120% 0; }
  88%, 100% { background-position: -20% 0; }
}

/* The page you are on: its rail icon pops when you arrive. */
.top-nav-btn.active .nav-ico svg { animation: rs-pop 420ms var(--rs-spring); }

/* Rows answer the pointer with a faint wash; log lines too. */
.log-line { transition: background-color 160ms var(--ease-out); }
@media (hover: hover) and (pointer: fine) {
  .tbl tbody tr:hover { background-color: rgba(241, 237, 228, 0.03); }
  .log-line:hover { background-color: rgba(241, 237, 228, 0.03); }
}

/* Tally numbers settle in. */
.view.active .tally-n { animation: rs-pop 520ms var(--rs-spring) 260ms backwards; }

@media (prefers-reduced-motion: reduce) {
  .view.active > *,
  .view.active :is(.panel-grid, .subpanels, .pools, .tally) > * { animation: fade 260ms var(--ease-out) backwards; }
  .view-head h2,
  .top-nav-btn.active .nav-ico svg,
  .view.active .tally-n { animation: none; }
}


/* ═══════════════════════════════════════════════════════════════════════════
   PRO CONSOLE — the shop admin's layout.

   One top bar instead of a side rail: brand left, the pages in a capsule
   (the chosen one a lit platinum pill), Live + who you are + sign out right.
   Each page opens with an icon tile, title and line, then cards with a
   header strip. Same layout as the shop's own admin console.
   ═══════════════════════════════════════════════════════════════════════════ */
:root { --rail-w: 0px; --page-w: 1180px; }

.console { display: block; }

.rail {
  position: sticky;
  top: 0;
  z-index: 800;
  height: auto;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  gap: 16px;
  padding: 12px max(24px, calc((100% - var(--page-w)) / 2 + 44px));
  background: rgba(0, 0, 0, 0.72);
  -webkit-backdrop-filter: blur(16px) saturate(1.2);
  backdrop-filter: blur(16px) saturate(1.2);
  border-right: 0;
  border-bottom: 1px solid var(--hair);
  overflow: visible;
}
.rail-brand { padding: 0; margin: 0; border: 0; flex: none; }
.rail-brand img { width: 36px; height: 36px; }
.rail-section { display: none; }

.rail-nav {
  flex-direction: row;
  gap: 2px;
  padding: 4px;
  border: 1px solid var(--hair-mid);
  border-radius: 14px;
  background: rgba(241, 237, 228, 0.025);
  box-shadow: inset 0 1px 0 rgba(241, 237, 228, 0.04);
  overflow-x: auto;
  scrollbar-width: none;
}
.rail-nav::-webkit-scrollbar { display: none; }
.top-nav-btn {
  width: auto;
  flex: none;
  height: 34px;
  gap: 7px;
  padding: 0 13px 0 9px;
  border-radius: 10px;
  font-size: 13.5px;
  color: var(--ash);
  transition: color 220ms var(--ease-out), background-color 160ms var(--ease-out), transform 140ms var(--ease-out);
}
.top-nav-btn .nav-ico { width: 18px; height: 18px; }
.top-nav-btn .nav-ico svg { width: 15px; height: 15px; }
.top-nav-btn .nav-ico::before { display: none; }
.top-nav-btn.active,
.top-nav-btn.active:hover { color: var(--pitch-1); background: transparent; }
/* The chosen page: a lit platinum pill that glides between pages. */
.rail-glide {
  border-radius: 10px;
  background: linear-gradient(180deg, #fbf8f1, #d9d4c9);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8), 0 1px 2px rgba(0, 0, 0, 0.6), 0 8px 20px -10px rgba(241, 237, 228, 0.45);
}

.rail-foot {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 0 auto;
  padding: 0;
  border: 0;
  flex: none;
}
.live-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--ok) 40%, transparent);
  background: color-mix(in srgb, var(--ok) 10%, transparent);
  color: color-mix(in srgb, var(--ok) 75%, #fff);
  font-size: 12.5px;
  font-weight: 700;
}
.live-pill i { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); animation: rs-ping-ok 2s ease-out infinite; }
.whoami {
  display: flex;
  align-items: center;
  max-width: 240px;
  height: 36px;
  padding: 0 14px 0 4px;
  border: 1px solid var(--hair-mid);
  border-radius: 999px;
  background: rgba(241, 237, 228, 0.025);
  font-family: var(--font-sans);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--bone);
}
.whoami[data-initial]::before { width: 28px; height: 28px; flex: none; }
.rail-foot .btn.block {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 999px;
  font-size: 0;
  gap: 0;
}
.rail-foot .btn.block svg { width: 16px; height: 16px; }

.main { max-width: var(--page-w); padding-top: 30px; }
.ledger { left: 0; }

/* ── Page head: icon tile, title, line, actions on the right ── */
.view-head { justify-content: flex-start; align-items: center; gap: 14px; }
.view-head > div:first-of-type { margin-right: auto; min-width: 0; }
.view-ico {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  flex: none;
  border-radius: 13px;
  border: 1px solid var(--hair-mid);
  background: radial-gradient(120% 90% at 50% 0%, rgba(241, 237, 228, 0.1), transparent 65%), var(--pitch-3);
  box-shadow: inset 0 1px 0 rgba(241, 237, 228, 0.06), 0 10px 22px -14px rgba(0, 0, 0, 0.9);
  color: var(--bone);
}
.view-ico svg { width: 20px; height: 20px; }
.view.active .view-ico { animation: rs-pop 480ms var(--rs-spring) backwards; }
.view-head h2 { font-size: 26px; font-weight: 800; letter-spacing: -0.03em; }
.view-sub { margin-top: 4px; font-size: 13.5px; }

/* ── Cards: top-lit, with a header strip ── */
.panel { border-radius: 18px; border-color: var(--hair-mid); }
.panel:not(.flush) > .panel-head {
  margin: -22px -24px 20px;
  padding: 16px 24px;
  border-bottom: 1px solid var(--hair);
  background: rgba(241, 237, 228, 0.015);
  border-radius: 18px 18px 0 0;
}
.panel-title { font-size: 15px; }
.panel-title svg { color: var(--ash); }

/* Stat tiles: the tally reads as a row of cards. */
.tally { gap: 12px; background: none; border: 0; box-shadow: none; overflow: visible; background-image: none; }
.tally-group,
.tally-group + .tally-group {
  border: 1px solid var(--hair-mid);
  border-radius: 16px;
  background: var(--rs-aura), linear-gradient(180deg, var(--pitch-3), var(--pitch-2));
  box-shadow: var(--lift);
  transition: translate 280ms var(--rs-spring), border-color 200ms var(--ease-out);
}
@media (hover: hover) and (pointer: fine) {
  .tally-group:hover { translate: 0 -2px; border-color: var(--hair-strong); }
}

/* Pills: capped, bold, capsule — like the shop's status tags. */
.pill {
  height: 22px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* Tables: a quiet header strip, rows that light up. */
.tbl th { background: rgba(241, 237, 228, 0.025); color: var(--smoke); }
.tbl-wrap { border-radius: 16px; }

/* Fields and search: rounder, with an accent halo on focus. */
.field input,
.field select,
.field textarea,
.search input { border-radius: 12px; transition: border-color 160ms var(--ease-out), box-shadow 240ms var(--rs-spring); }
.field input:focus,
.field select:focus,
.field textarea:focus,
.search input:focus { box-shadow: 0 0 0 4px rgba(241, 237, 228, 0.08); }

/* Undo: a capsule inside the toast, and a green hint on lift buttons. */
.toast-undo {
  margin-left: auto;
  align-self: center;
  height: 28px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--hair-strong);
  background: rgba(241, 237, 228, 0.08);
  color: var(--bone);
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  transition: background-color 160ms var(--ease-out), scale 120ms var(--ease-out);
}
.toast-undo:hover { background: rgba(241, 237, 228, 0.16); }
.toast-undo:active { scale: 0.95; }
.btn.is-undo {
  border-color: color-mix(in srgb, var(--ok) 45%, transparent);
  color: color-mix(in srgb, var(--ok) 70%, #fff);
}
.btn.is-undo:hover:not(:disabled) {
  background: color-mix(in srgb, var(--ok) 14%, transparent);
  border-color: var(--ok);
  color: #fff;
}

@media (max-width: 960px) {
  .rail { flex-wrap: wrap; padding: 10px 16px; }
  .rail-nav { order: 3; width: 100%; }
  .whoami, .live-pill { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .live-pill i, .view.active .view-ico { animation: none; }
  .tally-group:hover { translate: none; }
}
.rail-nav { flex: 0 1 auto; min-width: 0; }
.whoami { max-width: 190px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; line-height: 34px; }
.whoami[data-initial]::before { margin-top: -2px; }
@media (max-width: 1600px) {
  .whoami { width: 36px; padding: 0; font-size: 0; }
  .whoami[data-initial]::before { margin: 3px; font-size: 11px; }
}
.rail { padding-inline: max(20px, calc((100% - var(--page-w)) / 2 + 24px)); }


/* ═══════════════════════════════════════════════════════════════════════════
   SHOP ADMIN SKIN — the last word. Same colours, type, surfaces and motion as
   the shop's admin console (the shop update worker admin page), mapped
   onto this console's classes. See DESIGN.md.
   ═══════════════════════════════════════════════════════════════════════════ */
:root {
  /* Cool platinum on near-black, exactly the shop's. */
  --pitch-0: #050507;
  --pitch-1: #08080b;
  --pitch-2: #111116;
  --pitch-3: #16161c;
  --pitch-4: #1f1f26;
  --bone: #f4f4f5;
  --bone-hi: #ffffff;
  --bone-dim: #d4d4d8;
  --ash: #9e9ea9;
  --smoke: #6b6b75;
  --hair: rgba(255, 255, 255, 0.08);
  --hair-mid: rgba(255, 255, 255, 0.12);
  --hair-strong: rgba(255, 255, 255, 0.16);
  --red: #da373c;
  --red-ink: #f87171;
  --ok: #23a55a;
  --warn: #f0b232;
  --aura: 228, 228, 231;
  --panel2: rgba(255, 255, 255, 0.05);
  --font-sans: "Inter", ui-sans-serif, system-ui, "Segoe UI", sans-serif;
  --font-head: "Chakra Petch", "Inter", system-ui, sans-serif;
  --metal: linear-gradient(90deg, #a6a6aa 0%, #b9b9be 12%, #e4e4e7 32%, #fff 50%, #e4e4e7 68%, #b9b9be 88%, #a6a6aa 100%);
  --metal-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.85), inset 0 -1px 0 rgba(0, 0, 0, 0.12), 0 0 0 1px rgba(255, 255, 255, 0.18), 0 0 20px -4px rgba(255, 255, 255, 0.28), 0 8px 22px -10px rgba(0, 0, 0, 0.7);
  --box: radial-gradient(120% 70% at 50% 0%, rgba(var(--aura), 0.08), transparent 60%), linear-gradient(180deg, #111116, #08080b);
  --card-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04), 0 24px 48px -28px rgba(0, 0, 0, 0.8);
  --ease-shop: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-snap: cubic-bezier(0.23, 1, 0.32, 1);
  --ring: 0 0 0 3px rgba(var(--aura), 0.07);
}

@keyframes shop-rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes shop-sheen { to { background-position: 200% 0; } }
@keyframes shop-tile-sheen { to { background-position: -250% 0, 0 0, 0 0; } }
@keyframes shop-ping { 0% { transform: scale(1); opacity: 0.7; } 80%, 100% { transform: scale(2.6); opacity: 0; } }
@keyframes shop-pop { 0% { transform: scale(0.6); opacity: 0; } 60% { transform: scale(1.08); } 100% { transform: none; opacity: 1; } }
@keyframes shop-slidein { from { opacity: 0; transform: translateX(16px) scale(0.98); } }
@keyframes shop-rowin { from { opacity: 0; transform: translateY(-6px); filter: blur(2px); } to { opacity: 1; transform: none; filter: none; } }
@keyframes shop-timer { from { transform: scaleX(1); } to { transform: scaleX(0); } }
@keyframes shop-halo { 0%, 100% { opacity: 0.45; transform: scale(0.92); } 50% { opacity: 0.9; transform: scale(1.06); } }
@keyframes shop-float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
@keyframes shop-drift { 0% { transform: translate3d(0, 0, 0); } 50% { transform: translate3d(30px, -20px, 0); } 100% { transform: translate3d(0, 0, 0); } }

/* ── Page ── */
html { background: var(--pitch-0); }
body {
  background:
    radial-gradient(900px 520px at 50% -12%, rgba(var(--aura), 0.07), transparent 62%),
    radial-gradient(600px 400px at 100% 100%, rgba(var(--aura), 0.03), transparent 60%),
    var(--pitch-0);
  color: var(--bone);
  font-family: var(--font-sans);
  caret-color: #fff;
  accent-color: #e4e4e7;
}
body::after {
  content: "";
  position: fixed;
  inset: -20%;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(400px 300px at 20% 30%, rgba(88, 101, 242, 0.05), transparent 70%),
    radial-gradient(500px 360px at 80% 70%, rgba(var(--aura), 0.04), transparent 70%);
  animation: shop-drift 24s ease-in-out infinite;
}
.stage { background: transparent; }
::selection { background: rgba(var(--aura), 0.28); color: #fff; }
* { scrollbar-width: thin; scrollbar-color: rgba(var(--aura), 0.22) transparent; }

/* ── Type: Chakra Petch heads, Inter for everything else ── */
:is(.view-head h2, .panel-title, .rail-brand-text strong, .login-title, .tally-n, .sheet-n, .pool-n, .drawer h3, .led-name) {
  font-family: var(--font-head);
  font-stretch: 100%;
  letter-spacing: 0.01em;
}
.view-head h2 {
  /* Plain ink, no sheen: a title never fades into the page. */
  background: none;
  -webkit-text-fill-color: currentColor;
  color: var(--bone);
  animation: none;
  font-size: 22.5px;
  font-weight: 700;
  line-height: 1.1;
}
.view-sub { margin-top: 3px; font-size: 13.5px; color: var(--ash); }
.panel-title { font-size: 15.5px; font-weight: 700; }
.rail-brand-text strong { font-size: 17px; font-weight: 700; letter-spacing: 0.02em; }
.rail-brand-text span { font-stretch: 100%; font-weight: 600; font-size: 9.5px; letter-spacing: 0.24em; color: var(--ash); }
.tally-n, .sheet-n, .pool-n { font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: 0; }

/* ── Top bar ── */
.rail {
  background: rgba(5, 5, 7, 0.72);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
  backdrop-filter: blur(16px) saturate(140%);
  border-bottom: 0;
}
.rail::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.14) 25%, rgba(255, 255, 255, 0.14) 75%, transparent);
}
.rail-brand img {
  border-radius: 10px;
  filter: drop-shadow(0 0 12px rgba(var(--aura), 0.22));
  box-shadow: none;
  transition: transform 450ms var(--ease-shop), filter 450ms var(--ease-shop);
}
.rail-brand:hover img { transform: translateY(-1px) scale(1.04); filter: drop-shadow(0 0 18px rgba(var(--aura), 0.45)); }

/* Pages: the shop's metal segmented control. */
.rail-nav {
  padding: 4px;
  border-radius: 12px;
  border: 1px solid var(--hair);
  background: rgba(0, 0, 0, 0.4);
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.6);
}
.top-nav-btn {
  height: 32px;
  border-radius: 9px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ash);
  transition: color 350ms var(--ease-shop);
}
.top-nav-btn:hover { color: var(--bone); background: transparent; }
.top-nav-btn.active,
.top-nav-btn.active:hover { color: #09090b; }
.top-nav-btn .nav-ico svg { opacity: 0.75; transition: opacity 300ms var(--ease-shop); }
.top-nav-btn.active .nav-ico svg { opacity: 1; animation: none; }
.rail-glide {
  border-radius: 9px;
  background: var(--metal);
  background-size: 200% 100%;
  box-shadow: var(--metal-shadow);
  animation: shop-sheen 8s linear infinite;
  transition: transform 500ms var(--ease-shop), width 500ms var(--ease-shop), height 500ms var(--ease-shop), opacity 200ms var(--ease-out);
}

.live-pill {
  height: auto;
  padding: 0.32rem 0.7rem;
  gap: 8px;
  border-color: rgba(35, 165, 90, 0.28);
  background: rgba(35, 165, 90, 0.07);
  color: #86efac;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.live-pill i { position: relative; background: var(--ok); animation: none; box-shadow: none; }
.live-pill i::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: var(--ok);
  animation: shop-ping 1.8s cubic-bezier(0, 0, 0.2, 1) infinite;
}
.whoami { border-color: var(--hair); background: rgba(255, 255, 255, 0.03); }
.whoami[data-initial]::before { background: #2b2d31; box-shadow: 0 0 0 1px var(--hair-strong); color: #fff; }

/* ── Page head ── */
.view-head::after { display: none; }
.view-head { padding-bottom: 6px; }
.view-ico {
  width: 44px;
  height: 44px;
  border-radius: 13px;
  border-color: var(--hair-strong);
  background: linear-gradient(180deg, #1f1f26, #0d0d11);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1), 0 10px 24px -12px rgba(0, 0, 0, 0.9);
}
.view.active .view-ico { animation: none; }

/* Every page and every block on it rises in, the shop's way. */
.view.active > *,
.view.active :is(.panel-grid, .subpanels, .pools, .tally) > * { animation: shop-rise 550ms var(--ease-shop) backwards; filter: none; }
.view.active .tally-n { animation: none; }

/* ── Cards ── */
:is(.panel, .sheet, .subpanel, .pool) {
  background: var(--box);
  border: 1px solid var(--hair);
  border-radius: 16px;
  box-shadow: var(--card-shadow);
}
.panel:not(.flush):hover,
.pool:hover { translate: none; }
@media (hover: hover) and (pointer: fine) {
  .panel:not(.flush):hover,
  .pool:hover {
    border-color: var(--hair-strong);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 0 24px -10px rgba(var(--aura), 0.35);
    background-image: var(--box);
  }
}
.panel:not(.flush) > .panel-head {
  border-radius: 16px 16px 0 0;
  border-bottom: 1px solid var(--hair);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.025), transparent);
}

/* Stat tiles: the shop's sheen drifts across each one. */
.tally-group,
.tally-group + .tally-group {
  border: 1px solid var(--hair);
  border-radius: 16px;
  background:
    linear-gradient(110deg, transparent 30%, rgba(255, 255, 255, 0.04) 50%, transparent 70%) 0 0 / 250% 100%,
    radial-gradient(120% 70% at 50% 0%, rgba(var(--aura), 0.08), transparent 60%),
    linear-gradient(180deg, #111116, #08080b);
  box-shadow: var(--card-shadow);
  animation: shop-rise 550ms var(--ease-shop) backwards, shop-tile-sheen 7s linear infinite;
}
.tally-group:hover { translate: none; border-color: var(--hair-strong); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 0 24px -10px rgba(var(--aura), 0.35); }
.tally-group .label { color: var(--ash); font-size: 11px; letter-spacing: 0.08em; }

/* ── Buttons ── */
.btn {
  border-radius: 10px;
  font-family: var(--font-sans);
  transition: transform 160ms var(--ease-snap), border-color 300ms var(--ease-shop), background 300ms var(--ease-shop), box-shadow 300ms var(--ease-shop), color 300ms var(--ease-shop), background-position 600ms var(--ease-shop);
}
.btn:hover:not(:disabled) { translate: none; }
.btn:active:not(:disabled) { transform: scale(0.97); }
.btn.ghost { background: var(--panel2); border-color: var(--hair); color: var(--bone); box-shadow: none; }
.btn.ghost:hover:not(:disabled) { background: rgba(255, 255, 255, 0.09); border-color: var(--hair-strong); color: var(--bone); box-shadow: none; }
.btn.primary,
.btn.primary:not(:disabled) {
  background: var(--metal);
  background-size: 200% 100%;
  background-position: 0 0;
  border-color: transparent;
  color: #09090b;
  box-shadow: var(--metal-shadow);
  animation: none;
}
.btn.primary:hover:not(:disabled) {
  background: var(--metal);
  background-size: 200% 100%;
  background-position: 100% 0;
  border-color: transparent;
  box-shadow: var(--metal-shadow);
}
.btn.danger,
.btn.ghost.danger { background: rgba(218, 55, 60, 0.14); border-color: rgba(218, 55, 60, 0.45); color: #fca5a5; }
.btn.danger:hover:not(:disabled),
.btn.ghost.danger:hover:not(:disabled) { background: rgba(218, 55, 60, 0.26); border-color: rgba(218, 55, 60, 0.75); color: #fecaca; }
.btn.is-undo { background: rgba(35, 165, 90, 0.14); border-color: rgba(35, 165, 90, 0.4); color: #86efac; }
.btn.is-undo:hover:not(:disabled) { background: rgba(35, 165, 90, 0.24); border-color: rgba(35, 165, 90, 0.7); color: #bbf7d0; }
.btn[data-armed="1"],
.btn[data-armed="1"]:hover { background: var(--red); border-color: var(--red); color: #fff; }

/* ── Chips and tabs: the shop's segmented control ── */
.tabs {
  padding: 4px;
  gap: 2px;
  border-radius: 12px;
  border: 1px solid var(--hair);
  background: rgba(0, 0, 0, 0.4);
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.6);
}
.tabs .chip { border: 0; color: var(--ash); font-weight: 600; transition: color 350ms var(--ease-shop); }
.tabs .chip:hover { color: var(--bone); }
.tabs .chip.active { color: var(--bone); animation: none; }
.tabs-glide {
  border-radius: 9px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.05));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.12), 0 8px 18px -10px rgba(0, 0, 0, 0.9);
  transition: transform 500ms var(--ease-shop), width 500ms var(--ease-shop), height 500ms var(--ease-shop), opacity 200ms var(--ease-out);
}
.chip { border-radius: 10px; border-color: var(--hair); background: var(--panel2); color: var(--ash); }
.chip:hover { color: var(--bone); border-color: var(--hair-strong); }
.chip.active:not(.tabs .chip) { background: var(--metal); background-size: 200% 100%; color: #09090b; border-color: transparent; box-shadow: var(--metal-shadow); animation: none; }

/* ── Status chips ── */
.pill {
  height: auto;
  padding: 0.14rem 0.5rem;
  gap: 4px;
  border-radius: 99px;
  border: 1px solid var(--hair);
  background: var(--panel2);
  color: var(--ash);
  font-family: var(--font-sans);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.pill.ok { background: rgba(35, 165, 90, 0.12); border-color: rgba(35, 165, 90, 0.3); color: #4ade80; }
.pill.ok::before { background: #4ade80; box-shadow: 0 0 8px rgba(35, 165, 90, 0.6); animation: none; }
.pill.bad { background: rgba(218, 55, 60, 0.12); border-color: rgba(218, 55, 60, 0.3); color: #f87171; }
.pill.bad::before { background: #f87171; }
.pill.warn { background: rgba(240, 178, 50, 0.12); border-color: rgba(240, 178, 50, 0.3); color: var(--warn); }
.pill.quiet { color: var(--ash); }

/* ── Fields ── */
input[type="text"], input[type="email"], input[type="password"], input[type="number"],
input[type="search"], input[type="datetime-local"], select, textarea {
  border-radius: 10px;
  border-color: var(--hair);
  background: rgba(0, 0, 0, 0.3);
  transition: border-color 300ms var(--ease-shop), box-shadow 300ms var(--ease-shop);
}
input:hover, select:hover, textarea:hover { border-color: var(--hair-mid); }
input:focus, select:focus, textarea:focus { border-color: var(--hair-strong); box-shadow: 0 0 0 3px rgba(var(--aura), 0.07); }
select option { background: #15151b; }
::placeholder { color: var(--smoke); }

/* ── Tables and log ── */
.tbl th { background: rgba(255, 255, 255, 0.025); color: var(--ash); }
.tbl tbody tr { transition: background-color 300ms var(--ease-shop), box-shadow 300ms var(--ease-shop); }
@media (hover: hover) and (pointer: fine) {
  .tbl tbody tr:hover, .log-line:hover { background-color: var(--panel2); }
}
.user-row:hover td:first-child, .user-row:focus-visible td:first-child { box-shadow: inset 2px 0 0 #e4e4e7; }
[data-reveal="1"] > tr,
[data-reveal="1"] > .log-line { animation: shop-rowin 450ms var(--ease-shop) backwards; }
.skel { background: linear-gradient(90deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.03)); background-size: 200% 100%; }

/* Empty states: the shop's floating tile with a breathing halo. */
.empty-cell::before {
  width: 56px;
  height: 56px;
  border-radius: 18px;
  background: linear-gradient(180deg, #1d1d24, #0e0e12);
  border: 1px solid var(--hair-strong);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 0 0 10px rgba(var(--aura), 0.04), 0 12px 24px -12px rgba(0, 0, 0, 0.8);
  -webkit-mask: none;
  mask: none;
  opacity: 1;
  transform: none;
  animation: shop-float 5s ease-in-out infinite;
}

/* ── Toasts: bottom right, slide in, a timer bar drains under each ── */
.toast {
  position: relative;
  overflow: hidden;
  border-radius: 12px;
  border: 1px solid var(--hair-strong);
  background: rgba(18, 18, 23, 0.96);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  box-shadow: 0 18px 36px -16px rgba(0, 0, 0, 0.9);
  color: var(--bone);
  font-size: 13.5px;
}
.toast:not(.err) { border-color: var(--hair-strong); background: rgba(18, 18, 23, 0.96); }
.toast.err { border-color: rgba(218, 55, 60, 0.45); background: rgba(18, 18, 23, 0.96); color: #fecaca; }
.toast[data-state="in"] { animation: shop-slidein 400ms var(--ease-shop) both; }
.toast.err[data-state="in"] { animation: shop-slidein 400ms var(--ease-shop) both; }
.toast:not(.err) .toast-ico { color: #4ade80; }
.toast.err .toast-ico { color: #f87171; }
.toast[data-state="in"] .toast-ico { animation: shop-pop 400ms var(--ease-shop) both; }
.toast::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  background: var(--ok);
  opacity: 0.6;
  transform-origin: left;
  animation: shop-timer 3.8s linear both;
}
.toast.err::after { background: var(--red); animation-duration: 5.6s; }
.toast:has(.toast-undo)::after { animation-duration: 9s; }
.toast:hover::after { animation-play-state: paused; }
.toast-undo { border-radius: 9px; border-color: var(--hair-strong); background: var(--panel2); }

/* ── Ledger and drawer: the shop's glass sheets ── */
.ledger { background: rgba(5, 5, 7, 0.85); border-top-color: var(--hair); }
.led[data-kind="done"]::before { background: var(--ok); box-shadow: 0 0 8px rgba(35, 165, 90, 0.6); }
.led[data-kind="failed"]::before { background: var(--red); }
.led.is-new { animation: shop-rowin 450ms var(--ease-shop); }
.drawer {
  background: rgba(10, 10, 13, 0.92);
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
  border-left: 1px solid var(--hair-strong);
}

/* ── Sign-in: the shop's framed sheet over a fading grid ── */
.gate { position: relative; isolation: isolate; background: transparent; }
.gate::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background-image: linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
  background-size: 44px 44px;
  -webkit-mask: radial-gradient(ellipse 70% 60% at 50% 45%, #000 30%, transparent 75%);
  mask: radial-gradient(ellipse 70% 60% at 50% 45%, #000 30%, transparent 75%);
}
.gate::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 42%;
  width: 720px;
  height: 720px;
  transform: translate(-50%, -50%);
  z-index: -1;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(88, 101, 242, 0.13), transparent 70%);
  pointer-events: none;
}
.login-title {
  font-weight: 700;
  font-size: 34px;
  background: var(--metal);
  background-size: 200% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: shop-sheen 9s linear infinite;
}
.gate-fields {
  border: 1px solid var(--hair-strong);
  border-radius: 24px;
  background: rgba(10, 10, 13, 0.82);
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
  box-shadow: 0 50px 100px -40px rgba(0, 0, 0, 0.95), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  animation: shop-rise 700ms var(--ease-shop) 280ms backwards;
}
.gate-fields::before { display: none; }
.gate-error:not([hidden]) {
  border-radius: 10px;
  border: 1px solid rgba(218, 55, 60, 0.35);
  background: rgba(218, 55, 60, 0.08);
  color: #fca5a5;
}

/* Reduced motion: the shop turns motion off entirely. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ── Top bar, right side: command box, Live, bell, sound, account pill ──
   Same pieces and order as the shop console. */
.rail-foot { gap: 10px; }
.rail-foot > .whoami { display: none; }
.cmd { position: relative; }
.cmd-box {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 250px;
  height: 36px;
  padding: 0 6px 0 11px;
  border-radius: 10px;
  border: 1px solid var(--hair);
  background: rgba(0, 0, 0, 0.3);
  color: var(--ash);
  cursor: text;
  transition: border-color 300ms var(--ease-shop), box-shadow 300ms var(--ease-shop), width 400ms var(--ease-shop);
}
.cmd-box:focus-within { width: 300px; border-color: var(--hair-strong); box-shadow: 0 0 0 3px rgba(var(--aura), 0.07); }
.cmd-box svg { width: 14px; height: 14px; flex: none; stroke: currentColor; fill: none; stroke-width: 2; }
.cmd-box input,
.cmd-box input:hover,
.cmd-box input:focus { flex: 1; min-width: 0; height: 34px; padding: 0; border: 0; background: none; box-shadow: none; font-size: 13px; }
.cmd-box kbd {
  flex: none;
  padding: 2px 6px;
  border-radius: 6px;
  border: 1px solid var(--hair-strong);
  background: rgba(255, 255, 255, 0.05);
  color: var(--bone-dim);
  font: 600 10.5px/1.2 var(--font-sans);
}
.cmd-pop {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  min-width: 300px;
  z-index: 900;
  padding: 6px;
  border-radius: 12px;
  border: 1px solid var(--hair-strong);
  background: rgba(16, 16, 21, 0.97);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.5);
  animation: shop-popin 260ms var(--ease-shop) both;
}
.cmd-o {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 0.5rem 0.6rem;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--bone);
  font-size: 13px;
  text-align: left;
  cursor: pointer;
  transition: background-color 160ms var(--ease-out);
}
.cmd-o svg { width: 15px; height: 15px; flex: none; stroke: currentColor; fill: none; stroke-width: 2; color: var(--ash); }
.cmd-o.hi, .cmd-o:hover { background: rgba(255, 255, 255, 0.07); }
.cmd-o.hi svg { color: var(--bone); }
@keyframes shop-popin { from { opacity: 0; transform: scale(0.96) translateY(-4px); } }

.top-ico {
  position: relative;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  flex: none;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--ash);
  cursor: pointer;
  transition: color 300ms var(--ease-shop), background-color 300ms var(--ease-shop), border-color 300ms var(--ease-shop), transform 160ms var(--ease-snap);
}
.top-ico:hover { color: var(--bone); background: rgba(255, 255, 255, 0.06); border-color: var(--hair); }
.top-ico:active { transform: scale(0.94); }
.top-ico svg { width: 17px; height: 17px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.top-ico[aria-pressed="false"] { color: var(--smoke); }
.top-ico.is-ring svg { animation: shop-ring 700ms var(--ease-shop); transform-origin: 50% 10%; }
@keyframes shop-ring { 20% { rotate: 14deg; } 40% { rotate: -12deg; } 60% { rotate: 8deg; } 80% { rotate: -4deg; } }
.bell-count {
  position: absolute;
  top: 3px;
  right: 2px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 99px;
  background: var(--ok);
  color: #fff;
  font: 700 10px/16px var(--font-sans);
  text-align: center;
  box-shadow: 0 0 12px rgba(35, 165, 90, 0.6);
}
.bell-count[data-kind="bad"] { background: var(--red); box-shadow: 0 0 12px rgba(218, 55, 60, 0.6); }
.bell-count.is-bump { animation: shop-pop 400ms var(--ease-shop) both; }

.me {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 3px;
  border-radius: 99px;
  border: 1px solid var(--hair);
  background: rgba(255, 255, 255, 0.03);
}
.me-av {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  flex: none;
  border-radius: 50%;
  background: linear-gradient(180deg, #2b2d31, #1b1c20);
  box-shadow: 0 0 0 1px var(--hair-strong);
  color: #fff;
  font: 700 12.5px/1 var(--font-head);
}
.me-txt { display: flex; flex-direction: column; line-height: 1.15; padding-right: 2px; min-width: 0; }
.me-txt b { max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12.5px; font-weight: 600; }
.me-txt small { font-size: 10.5px; color: var(--ash); }
.me-out {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 99px;
  background: transparent;
  color: var(--ash);
  cursor: pointer;
  transition: color 300ms var(--ease-shop), background-color 300ms var(--ease-shop), transform 160ms var(--ease-snap);
}
.me-out:hover { color: #fca5a5; background: rgba(218, 55, 60, 0.12); }
.me-out:active { transform: scale(0.92); }
.me-out svg { width: 15px; height: 15px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

@media (max-width: 1440px) { .cmd-box { width: 200px; } .cmd-box:focus-within { width: 260px; } .cmd-box kbd { display: none; } }
@media (max-width: 1240px) { .cmd { display: none; } .me-txt { display: none; } }

/* ── Chips: every choice wears its own coloured icon (the shop's seg) ── */
[data-c="green"] { --c: 74, 222, 128; }
[data-c="red"] { --c: 248, 113, 113; }
[data-c="blue"] { --c: 129, 140, 248; }
[data-c="gold"] { --c: 240, 178, 50; }
[data-c="white"] { --c: 228, 228, 231; }
[data-c="grey"] { --c: 158, 158, 169; }
[data-c="violet"] { --c: 192, 132, 252; }
.chip { gap: 7px; }
.chip .ci {
  width: 14px;
  height: 14px;
  flex: none;
  stroke: rgb(var(--c, 158, 158, 169));
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0.75;
  transition: opacity 300ms var(--ease-shop), filter 300ms var(--ease-shop);
}
.chip:hover .ci { opacity: 1; }
.chip.active .ci { opacity: 1; filter: drop-shadow(0 0 6px rgba(var(--c, 228, 228, 231), 0.65)); }
/* Outside a sliding seg, the chosen chip is lit glass in its own colour. */
.chips .chip.active[data-c],
.chip.active[data-c]:not(.tabs .chip) {
  background: rgba(var(--c), 0.12);
  border-color: rgba(var(--c), 0.42);
  color: var(--bone);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

/* The sliding thumb takes the chosen chip's colour. */
.tabs:has(.chip.active[data-c="green"]) { --tc: 74, 222, 128; }
.tabs:has(.chip.active[data-c="red"]) { --tc: 248, 113, 113; }
.tabs:has(.chip.active[data-c="blue"]) { --tc: 129, 140, 248; }
.tabs:has(.chip.active[data-c="gold"]) { --tc: 240, 178, 50; }
.tabs:has(.chip.active[data-c="white"]) { --tc: 228, 228, 231; }
.tabs:has(.chip.active[data-c="grey"]) { --tc: 158, 158, 169; }
.tabs:has(.chip.active[data-c="violet"]) { --tc: 192, 132, 252; }
.tabs .tabs-glide {
  background: linear-gradient(180deg, rgba(var(--tc, 255, 255, 255), 0.16), rgba(var(--tc, 255, 255, 255), 0.06));
  box-shadow: inset 0 0 0 1px rgba(var(--tc, 255, 255, 255), 0.38), inset 0 1px 0 rgba(255, 255, 255, 0.12), 0 8px 18px -10px rgba(0, 0, 0, 0.9);
  transition: transform 500ms var(--ease-shop), width 500ms var(--ease-shop), height 500ms var(--ease-shop), background 400ms var(--ease-shop), box-shadow 400ms var(--ease-shop), opacity 200ms var(--ease-out);
}

/* The shop's 1400px bar; the pages never shrink, the right side compacts. */
:root { --page-w: 1400px; }
.rail-nav { flex: none; }
.rail-foot { min-width: 0; }
@media (max-width: 1440px) { .cmd { display: block; } .me-txt { display: flex; } }
@media (max-width: 1760px) { .cmd-box { width: 170px; } .cmd-box:focus-within { width: 240px; } .cmd-box kbd { display: none; } }
@media (max-width: 1560px) { .me-txt { display: none; } .live-pill { padding: 0.32rem 0.6rem; } }
@media (max-width: 1360px) { .cmd { display: none; } }
@media (max-width: 1180px) { .top-nav-btn .nav-txt { display: none; } .top-nav-btn { padding: 0 9px; } }


/* Empty states: the floating tile holds an icon that says what is missing. */
.empty-cell { --empty-ico: url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%20fill='none'%20stroke='%23e4e4e7'%20stroke-width='1.8'%20stroke-linecap='round'%20stroke-linejoin='round'%3E%3Cpath%20d='M22%2012h-6l-2%203h-4l-2-3H2'/%3E%3Cpath%20d='M5.5%205.1%202%2012v6a2%202%200%200%200%202%202h16a2%202%200%200%200%202-2v-6l-3.5-6.9A2%202%200%200%200%2016.8%204H7.2a2%202%200%200%200-1.7%201.1z'/%3E%3C/svg%3E"); }
#keysTable .empty-cell { --empty-ico: url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%20fill='none'%20stroke='%23e4e4e7'%20stroke-width='1.8'%20stroke-linecap='round'%20stroke-linejoin='round'%3E%3Ccircle%20cx='7.5'%20cy='15.5'%20r='4.5'/%3E%3Cpath%20d='m10.7%2012.3%209.8-9.8M17%206l3%203M14%209l2%202'/%3E%3C/svg%3E"); }
#usersTable .empty-cell { --empty-ico: url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%20fill='none'%20stroke='%23e4e4e7'%20stroke-width='1.8'%20stroke-linecap='round'%20stroke-linejoin='round'%3E%3Ccircle%20cx='9'%20cy='8'%20r='3.5'/%3E%3Cpath%20d='M2.5%2020c1.3-3.3%203.6-5%206.5-5s5.2%201.7%206.5%205'/%3E%3Cpath%20d='M16%204.5a3.5%203.5%200%200%201%200%207M18.5%2015c1.6.8%202.6%202.4%203%205'/%3E%3C/svg%3E"); }
#stockTable .empty-cell { --empty-ico: url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%20fill='none'%20stroke='%23e4e4e7'%20stroke-width='1.8'%20stroke-linecap='round'%20stroke-linejoin='round'%3E%3Cpath%20d='m21%208-9-5-9%205%209%205%209-5z'/%3E%3Cpath%20d='M3%208v8l9%205%209-5V8M12%2013v8'/%3E%3C/svg%3E"); }
#logsList .empty-cell { --empty-ico: url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%20fill='none'%20stroke='%23e4e4e7'%20stroke-width='1.8'%20stroke-linecap='round'%20stroke-linejoin='round'%3E%3Cpath%20d='M14%203H7a2%202%200%200%200-2%202v14a2%202%200%200%200%202%202h10a2%202%200%200%200%202-2V8z'/%3E%3Cpath%20d='M14%203v5h5M9%2013h6M9%2017h4'/%3E%3C/svg%3E"); }
.empty-cell::before {
  background:
    var(--empty-ico) center / 24px 24px no-repeat,
    radial-gradient(closest-side, rgba(var(--aura), 0.12), transparent),
    linear-gradient(180deg, #1d1d24, #0e0e12);
}



/* ═══════════════════════════════════════════════════════════════════════════
   SIGN-INS — a card per service with its logo and brand edge, a split bar of
   signed in / out / unknown, and the auto sign-in hit rate. Tone follows the
   worst news: red when failures lead, amber when any failed, green otherwise.
   ═══════════════════════════════════════════════════════════════════════════ */
.panel.flush > .panel-head {
  margin: 0;
  padding: 16px 20px;
  border-bottom: 1px solid var(--hair);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.025), transparent);
}

.sv-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.sv-card {
  --tone: var(--smoke);
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 20px 20px 18px;
  border: 1px solid var(--hair);
  border-radius: 16px;
  background:
    radial-gradient(120% 80% at 0% 0%, color-mix(in srgb, var(--svc) 14%, transparent), transparent 55%),
    linear-gradient(180deg, #111116, #08080b);
  box-shadow: var(--card-shadow, var(--lift));
  overflow: hidden;
  isolation: isolate;
  transition: translate 280ms var(--rs-spring), border-color 220ms var(--ease-out), box-shadow 280ms var(--ease-out);
}
/* Brand edge along the top. */
.sv-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 2px;
  background: linear-gradient(90deg, var(--svc), color-mix(in srgb, var(--svc) 30%, transparent) 60%, transparent);
}
/* Status glow in the corner. */
.sv-card::after {
  content: "";
  position: absolute;
  inset: auto -30% -60% auto;
  width: 70%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(closest-side, color-mix(in srgb, var(--tone) 18%, transparent), transparent);
  opacity: 0.7;
  z-index: -1;
  transition: opacity 400ms var(--ease-out);
}
.sv-card[data-tone="ok"] { --tone: var(--ok); }
.sv-card[data-tone="warn"] { --tone: var(--warn); }
.sv-card[data-tone="bad"] { --tone: var(--red); border-color: color-mix(in srgb, var(--red) 35%, transparent); }
.sv-card[data-tone="idle"]::after { opacity: 0; }
@media (hover: hover) and (pointer: fine) {
  .sv-card:hover {
    translate: 0 -3px;
    border-color: color-mix(in srgb, var(--svc) 45%, transparent);
    box-shadow: 0 22px 44px -26px color-mix(in srgb, var(--svc) 70%, transparent);
  }
  .sv-card:hover .sv-logo { scale: 1.06; rotate: -4deg; }
}

.sv-head { display: flex; align-items: center; gap: 12px; }
.sv-logo {
  flex: none;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: color-mix(in srgb, var(--svc) 16%, #0c0c10);
  border: 1px solid color-mix(in srgb, var(--svc) 40%, transparent);
  box-shadow: 0 8px 20px -10px color-mix(in srgb, var(--svc) 80%, transparent), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  transition: scale 320ms var(--rs-spring), rotate 320ms var(--rs-spring);
}
.sv-logo img { width: 24px; height: 24px; object-fit: contain; }
.sv-name { min-width: 0; flex: 1; }
.sv-name h3 { font-size: 15px; font-weight: 700; color: var(--bone); line-height: 1.2; }
.sv-name span { font-size: 12px; color: var(--ash); }
.sv-name b { color: var(--bone-dim); font-weight: 600; font-variant-numeric: tabular-nums; }

.sv-share {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  font-size: 13px;
  font-weight: 700;
  color: var(--tone);
  line-height: 1;
  transition: color 300ms var(--ease-out);
}
.sv-share b { font-size: 28px; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.sv-share i { margin-top: 4px; font-style: normal; font-size: 10.5px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--smoke); }

/* Split bar; segments grow by their counts. Empty reads as a quiet track. */
.sv-bar {
  display: flex;
  gap: 3px;
  height: 8px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.05);
  overflow: hidden;
}
.sv-bar i { flex: 0 1 0; min-width: 0; border-radius: 99px; transition: flex-grow 700ms var(--rs-spring); }
.sv-bar [data-k="in"] { background: linear-gradient(90deg, color-mix(in srgb, var(--ok) 70%, #000), var(--ok)); }
.sv-bar [data-k="out"] { background: var(--warn); }
.sv-bar [data-k="unknown"] { background: rgba(255, 255, 255, 0.16); }

.sv-legend { display: grid; gap: 7px; margin: 0; padding: 0; list-style: none; font-size: 13px; color: var(--ash); }
.sv-legend li { display: flex; align-items: center; gap: 9px; }
.sv-legend b { margin-left: auto; font-weight: 700; color: var(--bone); font-variant-numeric: tabular-nums; }
.sv-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--c); }
.sv-legend [data-tone="ok"] { --c: var(--ok); }
.sv-legend [data-tone="warn"] { --c: var(--warn); }
.sv-legend [data-tone="quiet"] { --c: rgba(255, 255, 255, 0.22); }

.sv-auto {
  display: grid;
  gap: 10px;
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid var(--hair);
}
.sv-auto .label { font-size: 11px; letter-spacing: 0.08em; color: var(--smoke); }
.sv-auto-row { display: flex; gap: 8px; }
.sv-stat {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 8px 10px;
  border-radius: 10px;
  font-size: 12.5px;
  color: var(--ash);
  border: 1px solid var(--hair);
  background: rgba(255, 255, 255, 0.02);
  transition: border-color 260ms var(--ease-out), background-color 260ms var(--ease-out);
}
.sv-stat svg { width: 14px; height: 14px; color: var(--c); }
.sv-stat b { font-size: 16px; font-weight: 700; color: var(--bone); font-variant-numeric: tabular-nums; }
.sv-stat[data-tone="ok"] { --c: var(--ok); }
.sv-stat[data-tone="bad"] { --c: var(--red-ink); }
.sv-card:is([data-tone="ok"], [data-tone="warn"]) .sv-stat[data-tone="ok"] {
  border-color: color-mix(in srgb, var(--ok) 30%, transparent);
  background: color-mix(in srgb, var(--ok) 7%, transparent);
}
.sv-card:is([data-tone="warn"], [data-tone="bad"]) .sv-stat[data-tone="bad"] {
  border-color: color-mix(in srgb, var(--red) 40%, transparent);
  background: color-mix(in srgb, var(--red) 9%, transparent);
}
.sv-card[data-tone="bad"] .sv-stat[data-tone="bad"] svg { animation: sv-pulse 1.8s ease-in-out infinite; }

/* Hit rate: green fill over a red track, so any red showing is failures. */
.sv-meter {
  height: 4px;
  border-radius: 99px;
  background: color-mix(in srgb, var(--red) 55%, transparent);
  overflow: hidden;
  transition: background-color 300ms var(--ease-out);
}
.sv-meter[data-empty="1"] { background: rgba(255, 255, 255, 0.05); }
.sv-meter i { display: block; height: 100%; width: 0; background: var(--ok); border-radius: inherit; transition: width 800ms var(--rs-spring); }

/* Table: logos in the head, rows light on hover. */
.sv-th { display: inline-flex; align-items: center; gap: 7px; }
.sv-th img { width: 14px; height: 14px; object-fit: contain; opacity: 0.85; }
.sv-tbl tbody tr { transition: background-color 160ms var(--ease-out); }
.sv-tbl tbody tr:hover { background: rgba(255, 255, 255, 0.025); }
.pill.quiet::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: rgba(255, 255, 255, 0.25); }
.pill.warn::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--warn); }

/* Recent attempts: logo, outcome pill, and a coloured edge per outcome. */
.sv-line { position: relative; align-items: center; }
.sv-line::before {
  content: "";
  position: absolute;
  inset: 8px auto 8px 0;
  width: 2px;
  border-radius: 2px;
  background: var(--ok);
  opacity: 0.7;
}
.sv-line[data-ok="0"]::before { background: var(--red); }
.sv-line[data-ok="0"] { background: linear-gradient(90deg, color-mix(in srgb, var(--red) 6%, transparent), transparent 40%); }
.sv-line .log-act { display: flex; align-items: center; gap: 8px; color: var(--bone); }
.sv-line .pill { margin-left: 2px; }
.sv-mini {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 7px;
  background: color-mix(in srgb, var(--svc, var(--smoke)) 16%, #0c0c10);
  border: 1px solid color-mix(in srgb, var(--svc, var(--smoke)) 35%, transparent);
}
.sv-mini img { width: 14px; height: 14px; object-fit: contain; }
.sv-mini:empty { display: none; }

/* Cards rise in one after another when the view opens. */
.view.active .sv-grid > * { animation: shop-rise 550ms var(--ease-shop, var(--ease-out)) backwards; }
.view.active .sv-grid > :nth-child(2) { animation-delay: 70ms; }
.view.active .sv-grid > :nth-child(3) { animation-delay: 140ms; }

@keyframes sv-pulse { 50% { opacity: 0.45; scale: 0.88; } }

@media (max-width: 1100px) { .sv-grid { grid-template-columns: 1fr; } }

@media (prefers-reduced-motion: reduce) {
  .sv-card, .sv-logo, .sv-bar i, .sv-meter i { transition: none; }
  .sv-card:hover { translate: none; }
  .sv-card:hover .sv-logo { scale: none; rotate: none; }
  .view.active .sv-grid > * { animation: fade 260ms var(--ease-out) backwards; }
  .sv-card[data-tone="bad"] .sv-stat[data-tone="bad"] svg { animation: none; }
}

/* Notifications (Maintenance tab): what customers see in the app's bell. */
.notif-list { list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 8px; }
.notif-item {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 10px 12px; border: 1px solid var(--line, rgba(255,255,255,.08)); border-radius: 12px;
  background: rgba(255,255,255,.03);
}
.notif-item > div { flex: 1; min-width: 0; }
.notif-item b { display: block; font-size: 13.5px; }
.notif-item p { margin: 4px 0 0; white-space: pre-wrap; color: var(--muted, #9e9ea9); font-size: 13px; }
.notif-item small { color: #6b6b75; font-size: 11px; }
.notif-empty { color: #6b6b75; font-size: 13px; margin-top: 12px; }


/* ═══════════════════════════════════════════════════════════════════════════
   AUDIT LOG, redesigned.

   Every event has a tone and wears it: green done, gold change, red alert,
   blue info, grey routine. Tone colours the edge, the icon tile and the chip;
   alerts lean red. Rows arrive with the shop's rowin, a new event flashes in its
   own colour, hover glows (nothing moves sideways), and a poll repaints
   numbers and bars in place. See DESIGN.md, Audit log.
   ═══════════════════════════════════════════════════════════════════════════ */

.lg-tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }

.lg-tile {
  --t: 158, 158, 169;
  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 16px 18px 16px;
  border: 1px solid var(--hair);
  border-radius: 16px;
  background:
    linear-gradient(110deg, transparent 30%, rgba(255, 255, 255, 0.04) 50%, transparent 70%) 0 0 / 250% 100%,
    radial-gradient(120% 70% at 50% 0%, rgba(var(--aura), 0.08), transparent 60%),
    linear-gradient(180deg, #111116, #08080b);
  box-shadow: var(--card-shadow);
  animation: shop-tile-sheen 7s linear infinite;
  transition: border-color 400ms var(--ease-shop), box-shadow 400ms var(--ease-shop);
}
.lg-tile::after {
  content: "";
  position: absolute;
  inset: auto -30% -70% auto;
  width: 80%;
  aspect-ratio: 1;
  border-radius: 50%;
  z-index: -1;
  background: radial-gradient(closest-side, rgba(var(--t), 0.2), transparent);
  opacity: 0.8;
  transition: opacity 400ms var(--ease-shop);
}
.lg-tile[data-tone="ok"] { --t: 74, 222, 128; }
.lg-tile[data-tone="info"] { --t: 129, 140, 248; }
.lg-tile[data-tone="warn"] { --t: 240, 178, 50; border-color: rgba(240, 178, 50, 0.3); }
.lg-tile[data-tone="bad"] { --t: 248, 113, 113; border-color: rgba(248, 113, 113, 0.4); }
.lg-tile[data-tone="quiet"]::after { opacity: 0; }
@media (hover: hover) and (pointer: fine) {
  .lg-tile:hover { border-color: var(--hair-strong); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 0 24px -10px rgba(var(--aura), 0.35); }
}
.lg-tile-top { display: flex; align-items: center; gap: 10px; }
.lg-tile-ico {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: rgba(var(--t), 0.13);
  border: 1px solid rgba(var(--t), 0.36);
  color: rgb(var(--t));
  transition: background-color 400ms var(--ease-shop), border-color 400ms var(--ease-shop), color 400ms var(--ease-shop);
}
.lg-tile-ico svg { width: 15px; height: 15px; }
.lg-tile[data-tone="bad"] .lg-tile-ico svg { animation: sv-pulse 1.8s ease-in-out infinite; }
.lg-tile-n { display: block; margin-top: 6px; font: 700 30px / 1.1 var(--font-head); font-variant-numeric: tabular-nums; color: var(--bone); transition: color 400ms var(--ease-shop); }
.lg-tile[data-tone="bad"] .lg-tile-n { color: #fca5a5; }
.lg-tile[data-tone="warn"] .lg-tile-n { color: #fde68a; }
.lg-tile-sub { font-size: 12.5px; color: var(--ash); min-height: 18px; }

/* Filter chips carry their counts. */
.chip-n { min-width: 18px; height: 16px; padding: 0 6px; border-radius: 99px; background: rgba(255, 255, 255, 0.08); color: var(--bone-dim); font: 700 10.5px / 16px var(--font-sans); text-align: center; font-variant-numeric: tabular-nums; }
.chip-n:empty { display: none; }
.tabs .chip.active .chip-n { background: rgba(var(--c, 228, 228, 231), 0.22); color: var(--bone); }
.tabs .chip.has-alerts .ci { opacity: 1; filter: drop-shadow(0 0 5px rgba(248, 113, 113, 0.6)); }
.tabs .chip.has-alerts:not(.active) .chip-n { background: rgba(218, 55, 60, 0.2); color: #fca5a5; }

.lg-live {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 0.28rem 0.65rem;
  border-radius: 99px;
  border: 1px solid rgba(35, 165, 90, 0.28);
  background: rgba(35, 165, 90, 0.07);
  color: #86efac;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
  transition: color 400ms var(--ease-shop), background-color 400ms var(--ease-shop), border-color 400ms var(--ease-shop);
}
.lg-live i { position: relative; width: 6px; height: 6px; border-radius: 50%; background: var(--ok); }
.lg-live i::before { content: ""; position: absolute; inset: 0; border-radius: 50%; background: inherit; animation: shop-ping 1.8s cubic-bezier(0, 0, 0.2, 1) infinite; }
.lg-live[data-state="bad"] { border-color: rgba(218, 55, 60, 0.35); background: rgba(218, 55, 60, 0.08); color: #fca5a5; }
.lg-live[data-state="bad"] i { background: var(--red); }
.lg-live[data-state="idle"] { border-color: var(--hair); background: var(--panel2); color: var(--ash); }
.lg-live[data-state="idle"] i { background: var(--smoke); }
.lg-live[data-state="idle"] i::before { display: none; }

/* The last 24 hours, one bar per hour. */
.lg-pulse {
  position: relative;
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 58px;
  padding: 20px 18px 0;
  border-bottom: 1px solid var(--hair);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.015), transparent);
}
.lg-pulse::before, .lg-pulse::after { position: absolute; top: 6px; font-size: 9.5px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--smoke); }
.lg-pulse::before { content: "24 hours ago"; left: 18px; }
.lg-pulse::after { content: "Now"; right: 18px; }
.lg-pulse i {
  flex: 1;
  min-width: 3px;
  height: 4px;
  border-radius: 3px 3px 0 0;
  background: rgba(255, 255, 255, 0.1);
  transition: height 700ms var(--ease-shop), background-color 400ms var(--ease-shop);
}
.lg-pulse i[data-tone="ok"] { background: linear-gradient(180deg, rgba(129, 140, 248, 0.95), rgba(129, 140, 248, 0.35)); }
.lg-pulse i[data-tone="warn"] { background: linear-gradient(180deg, rgba(240, 178, 50, 0.95), rgba(240, 178, 50, 0.35)); }
.lg-pulse i[data-tone="bad"] { background: linear-gradient(180deg, rgba(248, 113, 113, 1), rgba(248, 113, 113, 0.4)); box-shadow: 0 0 10px rgba(248, 113, 113, 0.45); }
@media (hover: hover) { .lg-pulse i:hover { filter: brightness(1.35); } }

.lg-wrap { position: relative; }
.lg-list { max-height: calc(100vh - 380px); min-height: 300px; overflow-y: auto; overscroll-behavior: contain; }
.lg-new {
  position: absolute;
  top: 12px;
  left: 50%;
  z-index: 6;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 30px;
  padding: 0 14px;
  translate: -50% 0;
  border-radius: 99px;
  border: 1px solid rgba(74, 222, 128, 0.45);
  background: rgba(8, 26, 16, 0.94);
  color: #bbf7d0;
  font: 600 12px var(--font-sans);
  box-shadow: 0 10px 24px -8px rgba(0, 0, 0, 0.8), 0 0 18px -4px rgba(74, 222, 128, 0.4);
  animation: shop-pop 400ms var(--ease-shop) both;
  transition: transform 160ms var(--ease-snap), background-color 300ms var(--ease-shop);
}
.lg-new:hover { background: rgba(14, 40, 25, 0.96); }
.lg-new:active { transform: scale(0.96); }
.lg-new svg { width: 13px; height: 13px; rotate: 180deg; }

.lg-day {
  position: sticky;
  top: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 18px 7px;
  background: rgba(8, 8, 11, 0.9);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--hair);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ash);
}
.lg-day::after { content: ""; flex: 1; height: 1px; background: linear-gradient(90deg, var(--hair-strong), transparent); }

.lg-item { --t: 158, 158, 169; position: relative; border-bottom: 1px solid var(--hair); transition: background-color 300ms var(--ease-shop); }
.lg-item[data-tone="ok"] { --t: 74, 222, 128; }
.lg-item[data-tone="info"] { --t: 129, 140, 248; }
.lg-item[data-tone="warn"] { --t: 240, 178, 50; }
.lg-item[data-tone="bad"] { --t: 248, 113, 113; background: linear-gradient(90deg, rgba(248, 113, 113, 0.07), transparent 45%); }
.lg-item::before { content: ""; position: absolute; left: 0; top: 10px; bottom: 10px; width: 2px; border-radius: 2px; background: rgb(var(--t)); opacity: 0.5; transition: opacity 300ms var(--ease-shop), box-shadow 300ms var(--ease-shop); }
@media (hover: hover) and (pointer: fine) {
  .lg-item:hover { background-color: var(--panel2); }
  .lg-item:hover::before { opacity: 1; box-shadow: 0 0 12px rgba(var(--t), 0.7); }
  .lg-item:hover .lg-ico { transform: scale(1.07); box-shadow: 0 0 20px -4px rgba(var(--t), 0.65); }
}
.lg-item[data-open="1"] { background-color: rgba(255, 255, 255, 0.035); }
.lg-item[data-open="1"]::before { opacity: 1; }

.lg-line { display: grid; grid-template-columns: 38px minmax(0, 1fr) auto 18px; align-items: center; gap: 14px; padding: 13px 18px 13px 20px; cursor: pointer; }
.lg-line:focus-visible { outline: 2px solid rgba(var(--aura), 0.7); outline-offset: -2px; }
.lg-ico { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 11px; background: rgba(var(--t), 0.12); border: 1px solid rgba(var(--t), 0.35); color: rgb(var(--t)); transition: transform 300ms cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 300ms var(--ease-shop); }
.lg-ico svg { width: 17px; height: 17px; stroke-width: 1.9; }
.lg-main { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.lg-head { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.lg-title { font-size: 14px; font-weight: 600; color: var(--bone); }
.lg-tone { display: inline-flex; align-items: center; height: 18px; padding: 0 7px; border-radius: 99px; border: 1px solid rgba(var(--t), 0.35); background: rgba(var(--t), 0.1); color: rgb(var(--t)); font-size: 9.5px; font-weight: 700; letter-spacing: 0.07em; text-transform: uppercase; }
.lg-item[data-tone="quiet"] .lg-tone { color: var(--ash); }
.lg-say { font-size: 12.5px; color: var(--ash); overflow-wrap: anywhere; }
.lg-say em { font-style: normal; font-weight: 600; color: var(--bone-dim); }
.lg-chips { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 2px; }
.lg-chip { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; height: 22px; padding: 0 8px; border-radius: 7px; border: 1px solid var(--hair); background: rgba(0, 0, 0, 0.28); color: var(--bone-dim); font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lg-chip small { font-size: 9.5px; font-weight: 700; letter-spacing: 0.07em; text-transform: uppercase; color: var(--smoke); }
.lg-chip i { font-style: normal; color: var(--smoke); }
.lg-chip b { font-weight: 600; color: var(--bone); }
.lg-chip[data-on="1"] { border-color: rgba(74, 222, 128, 0.35); background: rgba(35, 165, 90, 0.08); color: #86efac; }
.lg-chip[data-on="0"] { border-color: var(--hair-mid); color: var(--ash); }
.lg-more { color: var(--smoke); }
.lg-time { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; font-size: 12px; color: var(--bone-dim); white-space: nowrap; }
.lg-time b { font-weight: 600; }
.lg-time i { font-style: normal; font-size: 11px; color: var(--smoke); }
.lg-chev { width: 15px; height: 15px; color: var(--smoke); transition: transform 450ms var(--ease-shop), color 300ms var(--ease-shop); }
.lg-item[data-open="1"] .lg-chev { transform: rotate(180deg); color: var(--bone); }

.lg-body { display: grid; grid-template-rows: 0fr; transition: grid-template-rows 450ms var(--ease-shop); }
.lg-item[data-open="1"] .lg-body { grid-template-rows: 1fr; }
.lg-in { min-height: 0; overflow: hidden; }
.lg-in > * { margin-left: 72px; margin-right: 20px; }
.lg-facts { margin-top: 0; margin-bottom: 12px; }
.lg-actions { margin-bottom: 16px; }

/* Arrivals: rows ease in, and a new event flashes in its own colour. */
[data-reveal="1"] > .lg-item,
[data-reveal="1"] > .lg-day { animation: shop-rowin 450ms var(--ease-shop) backwards; }
[data-reveal="1"] > :nth-child(2) { animation-delay: 40ms; }
[data-reveal="1"] > :nth-child(3) { animation-delay: 80ms; }
[data-reveal="1"] > :nth-child(4) { animation-delay: 120ms; }
[data-reveal="1"] > :nth-child(n + 5) { animation-delay: 160ms; }
.lg-item.is-new { animation: shop-rowin 450ms var(--ease-shop) backwards, lg-flash 2.8s var(--ease-shop) 450ms backwards; }
@keyframes lg-flash { 0% { background-color: rgba(var(--t), 0.2); } 100% { background-color: transparent; } }

@media (max-width: 1100px) { .lg-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 760px) {
  .lg-line { grid-template-columns: 38px minmax(0, 1fr) 18px; }
  .lg-time { grid-column: 2; grid-row: 2; flex-direction: row; align-items: baseline; gap: 8px; }
  .lg-chev { grid-column: 3; grid-row: 1; }
  .lg-in > * { margin-left: 20px; }
  .lg-live { display: none; }
}
@media (max-width: 560px) { .lg-tiles { grid-template-columns: 1fr; } }

@media (prefers-reduced-motion: reduce) {
  .lg-tile, .lg-new, .lg-item.is-new { animation: none !important; }
  .lg-tile[data-tone="bad"] .lg-tile-ico svg { animation: none; }
}
