/* ==========================================================================
   Submission Control -- one stylesheet, no build step, no remote fonts.
   
   The scales come first and nothing below invents a value outside them: one
   type ramp, one spacing ramp, one radius ramp, one set of colour roles.  That
   is what keeps a hand-written interface from drifting a pixel at a time.
   
   Colour is never the only carrier of meaning.  Every status is a dot AND a
   word, every destructive control says what it will do, and both schemes are
   checked against AA rather than assumed.
   ========================================================================== */

/* -- scales ---------------------------------------------------------------- */
:root {
  --f-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, "Cascadia Mono",
            "Roboto Mono", monospace;
  --f-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue",
            Arial, sans-serif;

  --t-xs: 11.5px; --t-sm: 12.5px; --t-md: 13.5px; --t-base: 14.5px;
  --t-lg: 17px;   --t-xl: 21px;   --t-2xl: 27px;  --t-3xl: 34px;

  --s-1: 4px;  --s-2: 8px;  --s-3: 12px; --s-4: 16px; --s-5: 20px;
  --s-6: 24px; --s-8: 32px; --s-10: 40px; --s-12: 48px; --s-16: 64px;

  --r-sm: 6px; --r-md: 9px; --r-lg: 13px; --r-xl: 18px; --r-full: 999px;

  --rail-w: 244px;
  --top-h: 60px;
  --wide: 1240px;

  --ease: cubic-bezier(.32, .72, 0, 1);
  --fast: 120ms var(--ease);
  --slow: 240ms var(--ease);
}

/* -- colour roles, light --------------------------------------------------- */
:root {
  --bg:        #f6f7f8;
  --bg-sunken: #eceef0;
  --surface:   #ffffff;
  --surface-2: #f9fafb;
  --raised:    #ffffff;

  --ink:       #14181c;
  --ink-2:     #3d474f;
  --ink-3:     #667581;
  --ink-4:     #8d9aa5;

  --line:      #e0e4e8;
  --line-2:    #cbd2d9;

  --accent:      #0d7a70;
  --accent-ink:  #075c55;
  --accent-soft: #e3f4f2;
  --on-accent:   #ffffff;

  --ok:       #17803d;  --ok-soft:   #e4f5e9;
  --warn:     #9a6206;  --warn-soft: #fdf0dc;
  --bad:      #b02a20;  --bad-soft:  #fdeae8;
  --info:     #2d5bb9;  --info-soft: #e7eefb;
  --idle:     #667581;  --idle-soft: #edf0f2;

  --shadow-1: 0 1px 2px rgba(16, 24, 32, .06), 0 1px 1px rgba(16, 24, 32, .04);
  --shadow-2: 0 4px 14px rgba(16, 24, 32, .08), 0 1px 3px rgba(16, 24, 32, .05);
  --shadow-3: 0 18px 46px rgba(16, 24, 32, .18), 0 2px 8px rgba(16, 24, 32, .08);
  --ring: 0 0 0 3px rgba(13, 122, 112, .28);
}

/* -- colour roles, dark ---------------------------------------------------- */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { color-scheme: dark; }
  :root:not([data-theme="light"]) {
    --bg:        #0b0f12;
    --bg-sunken: #070a0c;
    --surface:   #12181c;
    --surface-2: #171e23;
    --raised:    #1a2229;

    --ink:       #e8eef1;
    --ink-2:     #b9c5cc;
    --ink-3:     #8b9aa4;
    --ink-4:     #6a7982;

    --line:      #222c33;
    --line-2:    #31404a;

    --accent:      #45bfb1;
    --accent-ink:  #7fd8cc;
    --accent-soft: #10302e;
    --on-accent:   #04211e;

    --ok:       #55d98a;  --ok-soft:   #0e2a1a;
    --warn:     #e2b061;  --warn-soft: #2e2311;
    --bad:      #f08a80;  --bad-soft:  #331715;
    --info:     #8ab0f4;  --info-soft: #141f36;
    --idle:     #8b9aa4;  --idle-soft: #1a2329;

    --shadow-1: 0 1px 2px rgba(0, 0, 0, .5);
    --shadow-2: 0 4px 16px rgba(0, 0, 0, .55);
    --shadow-3: 0 20px 50px rgba(0, 0, 0, .7);
    --ring: 0 0 0 3px rgba(69, 191, 177, .32);
  }
}
:root[data-theme="dark"] { color-scheme: dark; }
:root[data-theme="dark"] {
  --bg:#0b0f12; --bg-sunken:#070a0c; --surface:#12181c; --surface-2:#171e23;
  --raised:#1a2229; --ink:#e8eef1; --ink-2:#b9c5cc; --ink-3:#8b9aa4;
  --ink-4:#6a7982; --line:#222c33; --line-2:#31404a;
  --accent:#45bfb1; --accent-ink:#7fd8cc; --accent-soft:#10302e;
  --on-accent:#04211e;
  --ok:#55d98a; --ok-soft:#0e2a1a; --warn:#e2b061; --warn-soft:#2e2311;
  --bad:#f08a80; --bad-soft:#331715; --info:#8ab0f4; --info-soft:#141f36;
  --idle:#8b9aa4; --idle-soft:#1a2329;
  --shadow-1:0 1px 2px rgba(0,0,0,.5);
  --shadow-2:0 4px 16px rgba(0,0,0,.55);
  --shadow-3:0 20px 50px rgba(0,0,0,.7);
  --ring:0 0 0 3px rgba(69,191,177,.32);
}

/* -- reset ----------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
/* The `hidden` attribute is only a UA rule, `[hidden] { display: none }`, and
   any class selector outranks it.  `.boot` and `.app` are both `display: grid`
   from a class, so `<div class="boot" hidden>` stayed on screen -- a fixed,
   full-viewport panel at z-index 90 sitting over a sign-in page that had
   rendered perfectly well underneath it.  Nothing in the markup says a thing
   about that, which is why this needs to be stated once, globally, rather than
   fixed on the two elements that happened to show it. */
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  background: var(--bg);
  color: var(--ink);
  font: var(--t-base)/1.55 var(--f-sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img, svg { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { background: none; border: 0; cursor: pointer; }
a { color: var(--accent-ink); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { font-weight: 640; letter-spacing: -.015em; line-height: 1.25; }
h1 { font-size: var(--t-2xl); }
h2 { font-size: var(--t-xl); }
h3 { font-size: var(--t-lg); }
h4 { font-size: var(--t-base); }
code, kbd, pre, .mono { font-family: var(--f-mono); }
:focus-visible { outline: none; box-shadow: var(--ring); border-radius: var(--r-sm); }
::selection { background: var(--accent-soft); color: var(--accent-ink); }

/* Scrollbars, so a dark interface does not get a light gutter. */
* { scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; }
*::-webkit-scrollbar { width: 11px; height: 11px; }
*::-webkit-scrollbar-thumb {
  background: var(--line-2); border-radius: var(--r-full);
  border: 3px solid transparent; background-clip: content-box;
}
*::-webkit-scrollbar-track { background: transparent; }

/* -- helpers --------------------------------------------------------------- */
.muted  { color: var(--ink-3); }
.dim    { color: var(--ink-4); }
.small  { font-size: var(--t-sm); }
.tiny   { font-size: var(--t-xs); }
.num    { text-align: right; font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }
.mono   { font-size: .92em; }
.grow   { flex: 1; min-width: 0; }
.row    { display: flex; align-items: center; gap: var(--s-2); }
.row.wrap { flex-wrap: wrap; }
.col    { display: flex; flex-direction: column; gap: var(--s-2); }
.right  { margin-left: auto; }
.trunc  { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sr-only {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}
.stack > * + * { margin-top: var(--s-4); }
.eyebrow {
  font-size: var(--t-xs); font-weight: 650; letter-spacing: .085em;
  text-transform: uppercase; color: var(--ink-3);
}

/* -- boot ------------------------------------------------------------------ */
.boot {
  position: fixed; inset: 0; display: grid; place-content: center;
  justify-items: center; gap: var(--s-4); background: var(--bg); z-index: 90;
}
.boot-mark {
  width: 34px; height: 34px; border-radius: var(--r-md);
  background: var(--accent); opacity: .9;
  animation: breathe 1.4s var(--ease) infinite;
}
.boot-text { color: var(--ink-3); font-size: var(--t-md); }
@keyframes breathe {
  0%, 100% { transform: scale(.82); opacity: .45; }
  50%      { transform: scale(1);   opacity: 1; }
}

/* ==========================================================================
   shell
   ========================================================================== */
.app { display: grid; grid-template-columns: var(--rail-w) 1fr; min-height: 100%; }

.rail {
  position: sticky; top: 0; align-self: start; height: 100vh;
  display: flex; flex-direction: column; gap: var(--s-2);
  padding: var(--s-4) var(--s-3);
  background: var(--surface); border-right: 1px solid var(--line);
}
.brand {
  display: flex; align-items: center; gap: var(--s-3);
  padding: var(--s-2) var(--s-2) var(--s-4);
  color: var(--ink); text-decoration: none;
}
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 30px; height: 30px; flex: none; border-radius: var(--r-md);
  background: linear-gradient(145deg, var(--accent), var(--accent-ink));
  box-shadow: var(--shadow-1);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.brand-text strong { font-size: var(--t-md); font-weight: 650; letter-spacing: -.01em; }
.brand-text small { font-size: var(--t-xs); color: var(--ink-4); }

.nav { display: flex; flex-direction: column; gap: 2px; overflow-y: auto; }
.nav-group { margin-top: var(--s-4); padding: 0 var(--s-2) var(--s-1); }
.nav-item {
  display: flex; align-items: center; gap: var(--s-3);
  padding: 7px var(--s-3); border-radius: var(--r-md);
  color: var(--ink-2); font-size: var(--t-md); font-weight: 500;
  text-decoration: none; transition: background var(--fast), color var(--fast);
}
.nav-item:hover { background: var(--surface-2); color: var(--ink); text-decoration: none; }
.nav-item[aria-current="page"] {
  background: var(--accent-soft); color: var(--accent-ink); font-weight: 600;
}
.nav-item .i { color: currentColor; opacity: .85; }
.nav-item .count {
  margin-left: auto; font-size: var(--t-xs); font-weight: 650;
  padding: 1px 7px; border-radius: var(--r-full);
  background: var(--bad); color: #fff;
}
.nav-item .count.quiet { background: var(--bg-sunken); color: var(--ink-3); }

.rail-foot {
  margin-top: auto; padding-top: var(--s-3); border-top: 1px solid var(--line);
  display: flex; flex-direction: column; gap: var(--s-2);
}
.health {
  display: flex; align-items: center; gap: var(--s-2);
  font-size: var(--t-xs); color: var(--ink-3); padding: 0 var(--s-2);
}
.ghost-btn {
  display: flex; align-items: center; gap: var(--s-2);
  padding: 6px var(--s-3); border-radius: var(--r-md);
  font-size: var(--t-sm); color: var(--ink-2);
}
.ghost-btn:hover { background: var(--surface-2); color: var(--ink); }

.main { display: flex; flex-direction: column; min-width: 0; }

.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: var(--s-3);
  height: var(--top-h); padding: 0 var(--s-6);
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line);
}
.crumbs {
  display: flex; align-items: center; gap: var(--s-2);
  font-size: var(--t-md); color: var(--ink-3); min-width: 0;
}
.crumbs a { color: var(--ink-3); }
.crumbs a:hover { color: var(--ink); }
.crumbs .sep { color: var(--ink-4); }
.crumbs strong { color: var(--ink); font-weight: 600; }
.topbar-tools { margin-left: auto; display: flex; align-items: center; gap: var(--s-3); }
.rail-toggle { display: none; }

.content {
  padding: var(--s-8) var(--s-6) var(--s-16);
  width: 100%; max-width: var(--wide); margin: 0 auto;
}
.content:focus { outline: none; }

/* ==========================================================================
   controls
   ========================================================================== */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: var(--s-2); padding: 7px 14px; border-radius: var(--r-md);
  border: 1px solid var(--line-2); background: var(--surface);
  color: var(--ink); font-size: var(--t-md); font-weight: 550;
  white-space: nowrap; box-shadow: var(--shadow-1);
  transition: background var(--fast), border-color var(--fast),
              transform var(--fast), color var(--fast);
}
.btn:hover { background: var(--surface-2); border-color: var(--ink-4); }
.btn:active { transform: translateY(1px); }
.btn[disabled], .btn[aria-disabled="true"] {
  opacity: .5; pointer-events: none; box-shadow: none;
}
.btn.primary {
  background: var(--accent); border-color: var(--accent); color: var(--on-accent);
}
.btn.primary:hover { background: var(--accent-ink); border-color: var(--accent-ink); }
.btn.danger { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 40%, var(--line)); }
.btn.danger:hover { background: var(--bad-soft); border-color: var(--bad); }
.btn.quiet { border-color: transparent; background: transparent; box-shadow: none; }
.btn.quiet:hover { background: var(--surface-2); border-color: var(--line); }
.btn.sm { padding: 4px 10px; font-size: var(--t-sm); }
.btn.block { width: 100%; }

.icon-btn {
  display: inline-grid; place-items: center; width: 34px; height: 34px;
  border-radius: var(--r-md); color: var(--ink-2);
  transition: background var(--fast), color var(--fast);
}
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }

/* -- fields ---------------------------------------------------------------- */
.field {
  display: flex; align-items: center; gap: var(--s-2);
  padding: 0 10px; height: 36px; border-radius: var(--r-md);
  border: 1px solid var(--line-2); background: var(--surface);
  transition: border-color var(--fast), box-shadow var(--fast);
}
.field:focus-within { border-color: var(--accent); box-shadow: var(--ring); }
.field input, .field select, .field textarea {
  flex: 1; min-width: 0; border: 0; background: none; outline: none;
  font-size: var(--t-md);
}
.field .i { color: var(--ink-4); flex: none; }
.field kbd {
  font-size: 10.5px; color: var(--ink-4); border: 1px solid var(--line-2);
  border-radius: 4px; padding: 0 4px; line-height: 15px;
}
.search { width: 210px; }
textarea.field-area {
  width: 100%; min-height: 96px; padding: 9px 11px; resize: vertical;
  border-radius: var(--r-md); border: 1px solid var(--line-2);
  background: var(--surface); font-family: var(--f-mono); font-size: var(--t-sm);
  line-height: 1.6;
}
textarea.field-area:focus { outline: none; border-color: var(--accent); box-shadow: var(--ring); }
select.field-select {
  height: 36px; padding: 0 30px 0 10px; border-radius: var(--r-md);
  border: 1px solid var(--line-2); background: var(--surface);
  font-size: var(--t-md); appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--ink-4) 50%),
                    linear-gradient(135deg, var(--ink-4) 50%, transparent 50%);
  background-position: calc(100% - 15px) 15px, calc(100% - 10px) 15px;
  background-size: 5px 5px, 5px 5px; background-repeat: no-repeat;
}
select.field-select:focus { outline: none; border-color: var(--accent); box-shadow: var(--ring); }

.form-row { display: flex; flex-direction: column; gap: 5px; }
.form-row > label { font-size: var(--t-sm); font-weight: 600; color: var(--ink-2); }
.form-row .hint { font-size: var(--t-xs); color: var(--ink-3); }
.form-row .err { font-size: var(--t-xs); color: var(--bad); font-weight: 550; }
.form-grid { display: grid; gap: var(--s-4); grid-template-columns: 1fr 1fr; }
.form-grid .full { grid-column: 1 / -1; }
@media (max-width: 720px) { .form-grid { grid-template-columns: 1fr; } }

.switch { display: flex; align-items: center; gap: var(--s-3); cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch .track {
  width: 38px; height: 22px; border-radius: var(--r-full); flex: none;
  background: var(--line-2); position: relative; transition: background var(--fast);
}
.switch .track::after {
  content: ""; position: absolute; top: 3px; left: 3px;
  width: 16px; height: 16px; border-radius: 50%; background: #fff;
  box-shadow: var(--shadow-1); transition: transform var(--fast);
}
.switch input:checked + .track { background: var(--accent); }
.switch input:checked + .track::after { transform: translateX(16px); }
.switch input:focus-visible + .track { box-shadow: var(--ring); }
.switch .switch-text { font-size: var(--t-md); }

/* ==========================================================================
   surfaces
   ========================================================================== */
.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); box-shadow: var(--shadow-1);
}
.card-head {
  display: flex; align-items: center; gap: var(--s-3);
  padding: var(--s-4) var(--s-5); border-bottom: 1px solid var(--line);
}
.card-head h3 { font-size: var(--t-base); font-weight: 640; }
.card-head .right { margin-left: auto; display: flex; gap: var(--s-2); }
.card-body { padding: var(--s-5); }
.card-body.flush { padding: 0; }
.card-foot {
  padding: var(--s-3) var(--s-5); border-top: 1px solid var(--line);
  background: var(--surface-2); border-radius: 0 0 var(--r-lg) var(--r-lg);
  font-size: var(--t-sm); color: var(--ink-3);
}

.page-head {
  display: flex; align-items: flex-end; gap: var(--s-4);
  margin-bottom: var(--s-6); flex-wrap: wrap;
}
.page-head .titles { min-width: 0; }
.page-head h1 { margin-bottom: 2px; }
.page-head .sub { color: var(--ink-3); font-size: var(--t-md); }
.page-head .actions { margin-left: auto; display: flex; gap: var(--s-2); flex-wrap: wrap; }

.section-head {
  display: flex; align-items: baseline; gap: var(--s-3);
  margin: var(--s-8) 0 var(--s-3);
}
.section-head h2 { font-size: var(--t-lg); }
.section-head .right { margin-left: auto; }

/* -- stat tiles ------------------------------------------------------------ */
.tiles {
  display: grid; gap: var(--s-3);
  grid-template-columns: repeat(auto-fit, minmax(148px, 1fr));
}
.tile {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); padding: var(--s-4) var(--s-5);
  display: flex; flex-direction: column; gap: 2px;
  transition: border-color var(--fast), transform var(--fast);
}
a.tile:hover { border-color: var(--line-2); transform: translateY(-1px); text-decoration: none; }
.tile .k { font-size: var(--t-xs); font-weight: 620; letter-spacing: .06em;
           text-transform: uppercase; color: var(--ink-3); }
.tile .v { font-size: var(--t-2xl); font-weight: 660; letter-spacing: -.025em;
           font-variant-numeric: tabular-nums; line-height: 1.15; }
.tile .n { font-size: var(--t-xs); color: var(--ink-4); }
.tile.alert .v { color: var(--bad); }
.tile.good  .v { color: var(--ok); }
.tile.busy  .v { color: var(--warn); }

/* -- tables ---------------------------------------------------------------- */
.table-wrap { overflow-x: auto; border-radius: 0 0 var(--r-lg) var(--r-lg); }
table.data { width: 100%; border-collapse: collapse; font-size: var(--t-md); }
table.data th {
  position: sticky; top: 0; z-index: 1;
  padding: 9px var(--s-4); text-align: left; white-space: nowrap;
  font-size: var(--t-xs); font-weight: 650; letter-spacing: .06em;
  text-transform: uppercase; color: var(--ink-3);
  background: var(--surface-2); border-bottom: 1px solid var(--line);
}
table.data td {
  padding: 11px var(--s-4); border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
table.data tbody tr:last-child td { border-bottom: 0; }
table.data tbody tr.clickable { cursor: pointer; }
table.data tbody tr.clickable:hover { background: var(--surface-2); }
table.data tbody tr.clickable:focus-visible { background: var(--surface-2); }
table.data .actions-cell { text-align: right; white-space: nowrap; }
table.data .actions-cell .btn { opacity: 0; transition: opacity var(--fast); }
table.data tr:hover .actions-cell .btn,
table.data .actions-cell .btn:focus-visible { opacity: 1; }
@media (hover: none) { table.data .actions-cell .btn { opacity: 1; } }

/* -- pills, chips, dots ---------------------------------------------------- */
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 2px 9px 2px 7px; border-radius: var(--r-full);
  font-size: var(--t-xs); font-weight: 600; white-space: nowrap;
  background: var(--idle-soft); color: var(--idle);
}
.pill::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%;
  background: currentColor; flex: none;
}
.pill.uploaded   { background: var(--info-soft); color: var(--info); }
.pill.claimed,
.pill.validating { background: var(--warn-soft); color: var(--warn); }
.pill.failed,
.pill.revoked    { background: var(--bad-soft);  color: var(--bad); }
.pill.successful,
.pill.live,
.pill.active     { background: var(--ok-soft);   color: var(--ok); }
.pill.admin      { background: var(--accent-soft); color: var(--accent-ink); }
.pill.suspended,
.pill.expired,
.pill.archived   { background: var(--idle-soft); color: var(--idle); }
.pill.plain::before { display: none; }
.pill.plain { padding: 2px 9px; }

.dot {
  width: 8px; height: 8px; border-radius: 50%; flex: none;
  background: var(--idle);
}
.dot.live { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft); }
.dot.stale { background: var(--warn); box-shadow: 0 0 0 3px var(--warn-soft); }
.dot.off  { background: var(--bad); box-shadow: 0 0 0 3px var(--bad-soft); }

.chips { display: flex; flex-wrap: wrap; gap: 4px; }
.chip {
  font-size: var(--t-xs); padding: 2px 8px; border-radius: var(--r-sm);
  background: var(--bg-sunken); color: var(--ink-3); white-space: nowrap;
  font-weight: 550;
}
.chip.passed  { background: var(--ok-soft);   color: var(--ok); }
.chip.failed  { background: var(--bad-soft);  color: var(--bad); }
.chip.running { background: var(--warn-soft); color: var(--warn); }
.chip.dead    { background: var(--info-soft); color: var(--info); }

/* -- empty states ---------------------------------------------------------- */
.empty {
  display: grid; justify-items: center; gap: var(--s-2);
  padding: var(--s-12) var(--s-6); text-align: center; color: var(--ink-3);
}
.empty .i { color: var(--ink-4); }
.empty h3 { color: var(--ink-2); font-size: var(--t-base); }
.empty p { font-size: var(--t-md); max-width: 44ch; }

/* -- skeletons ------------------------------------------------------------- */
.skel {
  background: linear-gradient(90deg, var(--bg-sunken) 25%,
              var(--surface-2) 50%, var(--bg-sunken) 75%);
  background-size: 200% 100%; animation: shimmer 1.4s linear infinite;
  border-radius: var(--r-sm); height: 12px;
}
.skel.row { height: 42px; border-radius: var(--r-md); margin-bottom: 6px; }
@keyframes shimmer { to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) {
  .skel { animation: none; } .boot-mark { animation: none; }
}

/* -- pager ----------------------------------------------------------------- */
.pager {
  display: flex; align-items: center; gap: var(--s-3);
  padding: var(--s-3) var(--s-5); border-top: 1px solid var(--line);
  font-size: var(--t-sm); color: var(--ink-3);
}
.pager .right { margin-left: auto; display: flex; gap: var(--s-2); }

/* -- timeline -------------------------------------------------------------- */
.timeline { list-style: none; padding: 0; }
.timeline li {
  display: grid; grid-template-columns: 74px 66px 1fr; gap: var(--s-3);
  padding: 8px var(--s-5); border-bottom: 1px solid var(--line);
  font-size: var(--t-md); align-items: baseline;
}
.timeline li:last-child { border-bottom: 0; }
.timeline time { font-family: var(--f-mono); font-size: var(--t-xs); color: var(--ink-4); }
.timeline .who {
  font-size: 10px; font-weight: 650; letter-spacing: .07em; text-transform: uppercase;
  color: var(--ink-4);
}
.timeline .what { min-width: 0; overflow-wrap: anywhere; }
.timeline .kind { font-weight: 600; color: var(--ink-2); }
@media (max-width: 680px) {
  .timeline li { grid-template-columns: 1fr; gap: 2px; }
}

/* -- verdicts and code ----------------------------------------------------- */
.verdict {
  border: 1px solid var(--line); border-left: 3px solid var(--bad);
  border-radius: var(--r-md); background: var(--surface);
  padding: var(--s-4) var(--s-5); margin-bottom: var(--s-3);
}
.verdict .fmt {
  display: flex; align-items: center; gap: var(--s-2);
  font-size: var(--t-xs); color: var(--ink-3); margin-bottom: var(--s-2);
}
.verdict .fmt .mono { color: var(--ink-2); }
.verdict .text {
  white-space: pre-wrap; overflow-wrap: anywhere; font-size: var(--t-md);
  line-height: 1.6;
}
pre.code {
  margin: 0; padding: var(--s-4); border-radius: var(--r-md);
  background: var(--bg-sunken); border: 1px solid var(--line);
  font-size: var(--t-sm); line-height: 1.6; overflow-x: auto;
  white-space: pre; color: var(--ink-2);
}
.copy-box { position: relative; }
.copy-box .btn { position: absolute; top: 8px; right: 8px; }

/* -- key reveal ------------------------------------------------------------ */
.reveal {
  border: 1px solid color-mix(in srgb, var(--warn) 45%, var(--line));
  background: var(--warn-soft); border-radius: var(--r-md);
  padding: var(--s-4); display: flex; flex-direction: column; gap: var(--s-3);
}
.reveal .warn-text { font-size: var(--t-md); color: var(--ink-2); }
.reveal .secret {
  font-family: var(--f-mono); font-size: var(--t-md); word-break: break-all;
  background: var(--surface); border: 1px solid var(--line-2);
  border-radius: var(--r-sm); padding: 10px 12px;
}

/* ==========================================================================
   overlays
   ========================================================================== */
.menu { position: relative; }
.avatar-btn {
  display: flex; align-items: center; gap: var(--s-2);
  padding: 4px 8px 4px 4px; border-radius: var(--r-full);
  transition: background var(--fast);
}
.avatar-btn:hover { background: var(--surface-2); }
.avatar {
  display: grid; place-items: center; width: 28px; height: 28px; flex: none;
  border-radius: 50%; background: var(--accent); color: var(--on-accent);
  font-size: var(--t-sm); font-weight: 680; text-transform: uppercase;
}
.avatar-name { font-size: var(--t-md); font-weight: 550; }
.chev { transition: transform var(--fast); }
.avatar-btn[aria-expanded="true"] .chev { transform: rotate(180deg); }

.menu-panel {
  position: absolute; top: calc(100% + 8px); right: 0; z-index: 40;
  min-width: 232px; padding: 6px;
  background: var(--raised); border: 1px solid var(--line);
  border-radius: var(--r-lg); box-shadow: var(--shadow-3);
}
.menu-panel .menu-head {
  padding: var(--s-3); border-bottom: 1px solid var(--line); margin-bottom: 6px;
}
.menu-panel .menu-head strong { display: block; font-size: var(--t-md); }
.menu-panel .menu-head span { font-size: var(--t-xs); color: var(--ink-3); }
.menu-item {
  display: flex; align-items: center; gap: var(--s-3); width: 100%;
  padding: 7px var(--s-3); border-radius: var(--r-md);
  font-size: var(--t-md); color: var(--ink-2); text-align: left;
}
.menu-item:hover { background: var(--surface-2); color: var(--ink); text-decoration: none; }
.menu-item.danger { color: var(--bad); }
.menu-item.danger:hover { background: var(--bad-soft); }

.modal-root {
  position: fixed; inset: 0; z-index: 70; display: grid; place-items: center;
  padding: var(--s-4); background: rgba(10, 14, 18, .5);
  backdrop-filter: blur(3px);
  animation: fade var(--fast);
}
.modal {
  width: min(560px, 100%); max-height: min(84vh, 780px); overflow: auto;
  background: var(--raised); border: 1px solid var(--line);
  border-radius: var(--r-xl); box-shadow: var(--shadow-3);
  animation: rise var(--slow);
}
.modal.wide { width: min(760px, 100%); }
.modal-head {
  display: flex; align-items: flex-start; gap: var(--s-3);
  padding: var(--s-5) var(--s-5) var(--s-3);
}
.modal-head h3 { font-size: var(--t-lg); }
.modal-head p { font-size: var(--t-md); color: var(--ink-3); margin-top: 3px; }
.modal-body { padding: 0 var(--s-5) var(--s-5); display: flex;
              flex-direction: column; gap: var(--s-4); }
.modal-foot {
  display: flex; gap: var(--s-2); justify-content: flex-end;
  padding: var(--s-4) var(--s-5); border-top: 1px solid var(--line);
  background: var(--surface-2); border-radius: 0 0 var(--r-xl) var(--r-xl);
  position: sticky; bottom: 0;
}
.modal-foot .left { margin-right: auto; }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(10px) scale(.99); } }

.toasts {
  position: fixed; bottom: var(--s-5); right: var(--s-5); z-index: 80;
  display: flex; flex-direction: column; gap: var(--s-2); max-width: 400px;
}
.toast {
  display: flex; align-items: flex-start; gap: var(--s-3);
  padding: var(--s-3) var(--s-4); border-radius: var(--r-md);
  background: var(--raised); border: 1px solid var(--line);
  box-shadow: var(--shadow-3); font-size: var(--t-md);
  animation: slide var(--slow);
}
.toast.bad  { border-left: 3px solid var(--bad); }
.toast.ok   { border-left: 3px solid var(--ok); }
.toast .i   { flex: none; margin-top: 2px; }
@keyframes slide { from { opacity: 0; transform: translateX(16px); } }

/* -- inline error ---------------------------------------------------------- */
.inline-error {
  display: flex; align-items: flex-start; gap: var(--s-2);
  padding: 9px 12px; border-radius: var(--r-md);
  background: var(--bad-soft); color: var(--bad);
  font-size: var(--t-md); font-weight: 550;
}
.inline-note {
  display: flex; align-items: flex-start; gap: var(--s-2);
  padding: 9px 12px; border-radius: var(--r-md);
  background: var(--info-soft); color: var(--info);
  font-size: var(--t-md);
}

/* ==========================================================================
   sign in
   ========================================================================== */
.gate {
  min-height: 100vh; display: grid; place-items: center; padding: var(--s-6);
  background:
    radial-gradient(1000px 520px at 12% -8%,
                    color-mix(in srgb, var(--accent) 12%, transparent), transparent),
    radial-gradient(760px 420px at 100% 100%,
                    color-mix(in srgb, var(--info) 10%, transparent), transparent),
    var(--bg);
}
.gate-card {
  width: min(400px, 100%); padding: var(--s-8);
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-xl); box-shadow: var(--shadow-2);
  display: flex; flex-direction: column; gap: var(--s-5);
}
.gate-brand { display: flex; align-items: center; gap: var(--s-3); }
.gate-brand .brand-mark { width: 36px; height: 36px; }
.gate-brand h1 { font-size: var(--t-xl); }
.gate-card .form-row input { height: 100%; }
.gate-card .field { height: 40px; }
.gate-foot { font-size: var(--t-sm); color: var(--ink-3); text-align: center; }

/* ==========================================================================
   detail layout
   ========================================================================== */
.split { display: grid; gap: var(--s-5); grid-template-columns: 1fr 320px; align-items: start; }
@media (max-width: 1040px) { .split { grid-template-columns: 1fr; } }

.facts { display: flex; flex-direction: column; }
.facts .fact {
  display: flex; gap: var(--s-3); padding: 9px var(--s-5);
  border-bottom: 1px solid var(--line); font-size: var(--t-md);
}
.facts .fact:last-child { border-bottom: 0; }
.facts .fact .k { color: var(--ink-3); width: 122px; flex: none; }
.facts .fact .v { min-width: 0; overflow-wrap: anywhere; }

.tabs {
  display: flex; gap: 2px; border-bottom: 1px solid var(--line);
  margin-bottom: var(--s-5); overflow-x: auto;
}
.tab {
  padding: 9px var(--s-4); font-size: var(--t-md); font-weight: 550;
  color: var(--ink-3); border-bottom: 2px solid transparent;
  white-space: nowrap; margin-bottom: -1px;
}
.tab:hover { color: var(--ink); }
.tab[aria-selected="true"] { color: var(--accent-ink); border-bottom-color: var(--accent); }
.tab .n { font-size: var(--t-xs); color: var(--ink-4); margin-left: 5px; }

/* -- icons ----------------------------------------------------------------- */
.i { display: inline-grid; place-items: center; width: 18px; height: 18px; flex: none; }
.i svg { width: 100%; height: 100%; stroke: currentColor; fill: none;
         stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.i.lg { width: 30px; height: 30px; }

/* ==========================================================================
   narrow
   ========================================================================== */
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .rail {
    position: fixed; inset: 0 auto 0 0; z-index: 60; width: var(--rail-w);
    transform: translateX(-100%); transition: transform var(--slow);
    box-shadow: var(--shadow-3);
  }
  .app.rail-open .rail { transform: none; }
  .app.rail-open::after {
    content: ""; position: fixed; inset: 0; z-index: 50;
    background: rgba(10, 14, 18, .45);
  }
  .rail-toggle { display: inline-grid; }
  .topbar { padding: 0 var(--s-4); }
  .content { padding: var(--s-5) var(--s-4) var(--s-12); }
  .search { width: 150px; }
  .avatar-name, .crumbs .hide-sm { display: none; }
}
@media (max-width: 520px) {
  .search { display: none; }
  .page-head .actions { width: 100%; }
  .toasts { left: var(--s-4); right: var(--s-4); max-width: none; }
}
