/* ===========================================================================
   aiprojectpatcher — admin UI
   ---------------------------------------------------------------------------
   An operations dashboard. Somebody sits in front of this for an hour trying to
   work out which of four hundred crash groups matters, so: dark, quiet, dense,
   and nothing moves unless it was asked to.

   Two rules the rest of the file follows:

   1. Colour is never the only cue. Every severity and every status carries a
      glyph or a word and a distinct border treatment, so the table survives
      greyscale printing and colour blindness.
   2. Wide things scroll inside their own box. A stack trace or a forty-column
      table must never be able to widen the page and put the whole layout on a
      horizontal scrollbar.
   =========================================================================== */

:root {
  /* Ground */
  --bg:        #0d1015;
  --bg-2:      #11151c;
  --panel:     #151a22;
  --panel-2:   #1a212b;
  --panel-3:   #202836;
  --line:      #242c39;
  --line-soft: #1c232e;

  /* Ink */
  --ink:       #e2e8f1;
  --ink-2:     #aab7c8;
  --ink-dim:   #7e8da0;
  --ink-faint: #5c697d;

  /* Accents */
  --accent:      #58a6ff;
  --accent-ink:  #08111d;
  --accent-soft: rgba(88, 166, 255, 0.14);
  --focus:       #79c0ff;

  /* Severity */
  --sev-critical: #ff6b7a;
  --sev-high:     #ff9f43;
  --sev-medium:   #ffd45e;
  --sev-low:      #5fd6a4;

  /* Status */
  --st-new:       #58a6ff;
  --st-triaged:   #a78bfa;
  --st-confirmed: #ff9f43;
  --st-fixed:     #5fd6a4;
  --st-wontfix:   #8b98a9;
  --st-duplicate: #c98bd8;

  --danger:  #ff6b7a;
  --warn:    #ffd45e;
  --ok:      #5fd6a4;

  --radius:  10px;
  --radius-s: 6px;
  --shadow:  0 1px 0 rgba(255, 255, 255, 0.02), 0 8px 24px rgba(0, 0, 0, 0.35);

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
          Arial, "Noto Sans", sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
          "Liberation Mono", "Courier New", monospace;

  color-scheme: dark;
}

/* --------------------------------------------------------------------- base */

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background:
    radial-gradient(1100px 460px at 50% -220px, #16202c 0%, rgba(22, 32, 44, 0) 70%),
    var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  /* The page itself never scrolls sideways; wide children handle their own. */
  overflow-x: hidden;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
  border-radius: 3px;
}

h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -0.01em; }

pre, code, .mono { font-family: var(--mono); }

.muted    { color: var(--ink-dim); }
.small    { font-size: 12.5px; }
.tiny     { font-size: 11.5px; }
.nothing  { color: var(--ink-dim); margin: 0; }
.hint     { color: var(--ink-faint); display: block; line-height: 1.45; }
.quiet    { color: var(--ink-2); }
.quiet:hover { color: var(--ink); }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.skip {
  position: absolute; left: -9999px; top: 0; z-index: 50;
  background: var(--accent); color: var(--accent-ink);
  padding: 8px 14px; border-radius: 0 0 var(--radius-s) 0; font-weight: 600;
}
.skip:focus { left: 0; }

/* ------------------------------------------------------------------- topbar */

.topbar {
  position: sticky; top: 0; z-index: 20;
  background: rgba(13, 16, 21, 0.88);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(8px);
}

.topbar-in {
  max-width: 1440px; margin: 0 auto;
  padding: 10px 20px;
  display: flex; align-items: center; gap: 22px; flex-wrap: wrap;
}

.brand {
  display: inline-flex; align-items: center; gap: 9px;
  color: var(--ink); font-weight: 650; letter-spacing: -0.015em;
  white-space: nowrap;
}
.brand:hover { text-decoration: none; color: #fff; }

.brand-mark {
  width: 11px; height: 11px; border-radius: 3px;
  background: linear-gradient(140deg, var(--accent), #a78bfa);
  box-shadow: 0 0 0 3px rgba(88, 166, 255, 0.13);
}

.nav { display: flex; gap: 4px; flex: 1 1 auto; }

.nav a {
  padding: 6px 12px; border-radius: var(--radius-s);
  color: var(--ink-2); font-weight: 500;
  border: 1px solid transparent;
}
.nav a:hover { background: var(--panel-2); color: var(--ink); text-decoration: none; }
.nav a.active {
  background: var(--accent-soft);
  border-color: rgba(88, 166, 255, 0.28);
  color: #cfe6ff;
}

.who { display: flex; align-items: center; gap: 12px; }

/* An <a> to account.php, not a <span>. The dot before it still means "signed
   in"; the underline on hover is what says the name is also the way to your own
   settings, which is otherwise unreachable from the chrome. */
.who-name {
  color: var(--ink-2); font-size: 12.5px;
  padding-left: 14px; position: relative;
  text-decoration: none;
}
.who-name:hover { color: var(--ink); text-decoration: underline; }
.who-name:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; border-radius: 3px; }
.who-name::before {
  content: ""; position: absolute; left: 0; top: 50%;
  width: 7px; height: 7px; margin-top: -3px; border-radius: 50%;
  background: var(--ok); box-shadow: 0 0 0 2px rgba(95, 214, 164, 0.18);
}

.inline { display: inline; margin: 0; }

/* ----------------------------------------------------------------- shell */

.wrap {
  max-width: 1440px;
  margin: 0 auto;
  padding: 22px 20px 60px;
}

body.bare .wrap { max-width: 460px; padding-top: 8vh; }

.foot {
  max-width: 1440px; margin: 0 auto;
  padding: 18px 20px 34px;
  color: var(--ink-faint); font-size: 12px;
  display: flex; gap: 8px;
}
.foot .dot { opacity: 0.5; }

/* ----------------------------------------------------------------- alerts */

.alert {
  margin: 0 0 18px;
  padding: 10px 14px;
  border-radius: var(--radius-s);
  border: 1px solid var(--line);
  border-left-width: 3px;
  background: var(--panel);
  color: var(--ink-2);
}
.alert-ok   { border-left-color: var(--ok);     color: #c8f0de; }
.alert-warn { border-left-color: var(--warn);   color: #f6e7b6; }
.alert-err  { border-left-color: var(--danger); color: #ffd0d5; }

/* ------------------------------------------------------------------ tiles */

.tiles {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.tile {
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px 13px;
  box-shadow: var(--shadow);
}

.tile-k {
  color: var(--ink-dim); font-size: 11.5px;
  text-transform: uppercase; letter-spacing: 0.07em; font-weight: 600;
}
.tile-v {
  font-size: 30px; font-weight: 650; line-height: 1.15;
  letter-spacing: -0.02em; margin: 4px 0 2px;
  font-variant-numeric: tabular-nums;
}
.tile-sub { color: var(--ink-faint); font-size: 11.5px; }

/* ---------------------------------------------------------------- filters */

.filters {
  display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 13px 14px;
  margin-bottom: 18px;
}

.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field.grow { flex: 1 1 200px; }

.field > label,
.stack label {
  color: var(--ink-dim); font-size: 11.5px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.06em;
}

input[type="text"], input[type="search"], input[type="password"],
input[type="number"], select, textarea {
  background: var(--bg-2);
  border: 1px solid var(--line);
  color: var(--ink);
  border-radius: var(--radius-s);
  padding: 7px 10px;
  font: inherit;
  min-width: 0;
  max-width: 100%;
}
textarea { resize: vertical; line-height: 1.5; }

input::placeholder, textarea::placeholder { color: var(--ink-faint); }

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

select {
  appearance: none; -webkit-appearance: none;
  padding-right: 28px;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--ink-dim) 50%),
    linear-gradient(135deg, var(--ink-dim) 50%, transparent 50%);
  background-position: calc(100% - 15px) 51%, calc(100% - 10px) 51%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}

.filter-actions { display: flex; gap: 8px; align-items: center; }
.filter-inline { display: flex; gap: 6px; align-items: center; }

/* ---------------------------------------------------------------- buttons */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 7px 14px;
  border-radius: var(--radius-s);
  border: 1px solid var(--line);
  background: var(--panel-3);
  color: var(--ink);
  font: inherit; font-weight: 550;
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none;
}
.btn:hover { background: #27303f; text-decoration: none; }
.btn:active { transform: translateY(1px); }

.btn-primary {
  background: var(--accent); border-color: var(--accent); color: var(--accent-ink);
}
.btn-primary:hover { background: #74b6ff; border-color: #74b6ff; }

.btn-ghost { background: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: var(--panel-2); color: var(--ink); }

.btn-danger { background: transparent; border-color: rgba(255, 107, 122, 0.4); color: #ff9aa5; }
.btn-danger:hover { background: rgba(255, 107, 122, 0.12); color: #ffc2c8; }

.btn-sm { padding: 4px 10px; font-size: 12.5px; }
.btn-block { width: 100%; }

.copybtn { float: right; margin: 0 0 6px 8px; }

/* ------------------------------------------------------------------ cards */

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 18px;
  overflow: hidden;
}
.card.narrow { max-width: 520px; margin: 40px auto; }

.card-h {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 14px; flex-wrap: wrap;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line-soft);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.02), transparent);
}

.panel-title { font-size: 14.5px; font-weight: 650; }
.panel-title .muted { font-weight: 400; margin-left: 6px; }

.card-b { padding: 16px; }

.stack { display: flex; flex-direction: column; gap: 12px; margin: 0; }
.stack > .field { gap: 5px; }
.inline-form { margin: 0; display: flex; flex-direction: column; gap: 10px; }

/* ------------------------------------------------------------------ table */

/* The only element allowed to scroll sideways. */
.tablewrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

table.grid {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}

table.grid thead th {
  position: sticky; top: 0; z-index: 1;
  background: var(--panel-2);
  border-bottom: 1px solid var(--line);
  padding: 8px 12px;
  text-align: left;
  font-size: 11.5px; font-weight: 650;
  text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--ink-dim);
  white-space: nowrap;
}

table.grid tbody td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line-soft);
  vertical-align: top;
}

table.grid tbody tr:hover { background: rgba(255, 255, 255, 0.022); }
table.grid tbody tr:last-child td { border-bottom: 0; }

.row-off { opacity: 0.55; }

.c-num  { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.c-when { white-space: nowrap; color: var(--ink-2); }
.c-sev, .c-status, .c-act { white-space: nowrap; }
.c-title { min-width: 260px; }
.c-act   { text-align: right; }

.t-link {
  color: var(--ink); font-weight: 550;
  display: block;
  /* Long exception names must wrap rather than push the table wider. */
  overflow-wrap: anywhere;
}
a.t-link:hover { color: var(--accent); text-decoration: none; }

.culprit {
  color: var(--ink-faint);
  font-size: 11.5px;
  margin-top: 2px;
  overflow-wrap: anywhere;
}

.sortlink { color: inherit; display: inline-flex; align-items: center; gap: 4px; }
.sortlink:hover { color: var(--ink); text-decoration: none; }
.sortlink.on { color: var(--accent); }
.sortmark { font-size: 10px; }

/* ----------------------------------------------------------------- pager */

.pager {
  display: flex; gap: 4px; align-items: center; flex-wrap: wrap;
  padding: 12px 14px;
  border-top: 1px solid var(--line-soft);
}
.pager a, .pager .cur, .pager .off, .pager .gap {
  padding: 5px 10px; border-radius: var(--radius-s); font-size: 12.5px;
  font-variant-numeric: tabular-nums;
}
.pager a { color: var(--ink-2); border: 1px solid var(--line); }
.pager a:hover { background: var(--panel-2); color: var(--ink); text-decoration: none; }
.pager .cur {
  background: var(--accent-soft); border: 1px solid rgba(88, 166, 255, 0.3);
  color: #cfe6ff; font-weight: 600;
}
.pager .off { color: var(--ink-faint); border: 1px solid transparent; }
.pager .gap { color: var(--ink-faint); padding-left: 2px; padding-right: 2px; }

/* ------------------------------------------------------------------ pills */

.pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 9px;
  font-size: 11.5px; font-weight: 650;
  letter-spacing: 0.02em;
  border: 1px solid;
  white-space: nowrap;
  vertical-align: middle;
}
.pill-mark { font-size: 9px; line-height: 1; }

/* Severity: glyph + word + a distinct silhouette per level. */
.pill-sev { text-transform: uppercase; letter-spacing: 0.05em; }

.sev-critical {
  border-radius: 2px;                                   /* hard corners */
  border-color: var(--sev-critical);
  background: rgba(255, 107, 122, 0.14);
  color: #ffb3bb;
  border-left-width: 4px;
}
.sev-high {
  border-radius: 4px;
  border-color: rgba(255, 159, 67, 0.55);
  background: rgba(255, 159, 67, 0.11);
  color: #ffc78c;
}
.sev-medium {
  border-radius: 999px;                                 /* fully round */
  border-color: rgba(255, 212, 94, 0.45);
  background: rgba(255, 212, 94, 0.09);
  color: #f4dc9a;
}
.sev-low {
  border-radius: 999px;
  border-style: dashed;                                 /* dashed outline */
  border-color: rgba(95, 214, 164, 0.45);
  background: transparent;
  color: #9fe0c4;
}

/* Status: the word is the signal; fill and border style separate them again. */
.pill-status { border-radius: var(--radius-s); }

.st-new       { border-color: var(--st-new);       background: rgba(88, 166, 255, 0.16);  color: #bcdcff; }
.st-triaged   { border-color: rgba(167, 139, 250, 0.5); background: transparent;          color: #cdbdfd; border-style: solid; }
.st-confirmed { border-color: var(--st-confirmed); background: rgba(255, 159, 67, 0.18);  color: #ffcc99; }
.st-fixed     { border-color: rgba(95, 214, 164, 0.5);  background: transparent;          color: #9fe0c4; border-style: double; border-width: 3px; padding: 1px 8px; }
.st-wontfix   { border-color: rgba(139, 152, 169, 0.45); background: transparent;         color: var(--ink-dim); border-style: dotted; }
.st-duplicate { border-color: rgba(201, 139, 216, 0.5);  background: transparent;         color: #e0b6ea; border-style: dashed; }

.pill-kind {
  border-radius: var(--radius-s);
  border-color: var(--line); background: var(--panel-2); color: var(--ink-dim);
  text-transform: lowercase;
}
.pill-ref {
  border-radius: var(--radius-s);
  border-color: rgba(88, 166, 255, 0.35); background: var(--accent-soft); color: #bcdcff;
  font-family: var(--mono); font-size: 11px;
}
.pill-off {
  border-radius: var(--radius-s);
  border-color: var(--line); background: transparent; color: var(--ink-faint);
  border-style: dotted; font-weight: 500;
  margin-left: 6px;
}

/* ------------------------------------------------------------ empty state */

.empty {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 30px 28px;
  max-width: 900px;
  box-shadow: var(--shadow);
}
.empty h1 { font-size: 20px; margin-bottom: 8px; }
.empty p { color: var(--ink-2); margin: 0 0 14px; max-width: 68ch; }

.steps { color: var(--ink-2); margin: 0 0 16px; padding-left: 20px; }
.steps li { margin-bottom: 6px; }

.code {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-s);
  padding: 13px 14px;
  margin: 0 0 14px;
  color: #cfe0f2;
  font-size: 12.5px;
  line-height: 1.6;
  /* Long command, own scrollbar, layout untouched. */
  white-space: pre;
  overflow-x: auto;
}
.code.small { font-size: 11.5px; }

/* ------------------------------------------------------------------ login */

.login { display: flex; justify-content: center; }

.login-card {
  width: 100%;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 28px 26px 22px;
  box-shadow: var(--shadow);
  text-align: left;
}

.login-mark {
  width: 30px; height: 30px; border-radius: 9px;
  background: linear-gradient(140deg, var(--accent), #a78bfa);
  box-shadow: 0 0 0 5px rgba(88, 166, 255, 0.1);
  margin-bottom: 16px;
}
.login-title { font-size: 19px; }
.login-sub { color: var(--ink-dim); margin: 2px 0 20px; font-size: 13px; }
.login-note {
  color: var(--ink-faint); font-size: 11.5px;
  margin: 18px 0 0; padding-top: 14px;
  border-top: 1px solid var(--line-soft);
}
.login-card .btn-block { margin-top: 4px; padding: 9px 14px; }

/* -------------------------------------------------------------- report page */

.crumbs { color: var(--ink-faint); font-size: 12.5px; margin: 0 0 12px; }
.crumbs .sep { margin: 0 7px; opacity: 0.6; }
.crumbs .here { color: var(--ink-2); font-family: var(--mono); }

.rpt-head { margin-bottom: 16px; }
.rpt-pills { display: flex; gap: 7px; flex-wrap: wrap; margin-bottom: 9px; }
.rpt-title {
  font-size: 21px; line-height: 1.3; letter-spacing: -0.015em;
  overflow-wrap: anywhere; max-width: 90ch;
}
.rpt-culprit {
  margin: 6px 0 0; color: var(--ink-dim);
  font-family: var(--mono); font-size: 12.5px;
  overflow-wrap: anywhere;
}

.facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1px;
  background: var(--line-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 18px;
}
.fact {
  background: var(--panel);
  padding: 11px 14px;
  display: flex; flex-direction: column; gap: 2px;
  min-width: 0;
}
.fact-k {
  color: var(--ink-faint); font-size: 11px;
  text-transform: uppercase; letter-spacing: 0.06em; font-weight: 600;
}
.fact-v {
  font-size: 15px; font-weight: 600;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}
.fact-v.tiny { font-size: 12px; font-weight: 500; }

/* two-column working area */
.cols {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 18px;
  align-items: start;
}
.cols-wide { grid-template-columns: minmax(0, 1fr) 340px; }
.col-main, .col-side { min-width: 0; }

/* ----------------------------------------------------------------- events */

.events { display: block; }

details.ev { border-bottom: 1px solid var(--line-soft); }
details.ev:last-child { border-bottom: 0; }

details.ev > summary {
  list-style: none;
  cursor: pointer;
  padding: 10px 16px;
  display: flex; gap: 12px; align-items: center; flex-wrap: wrap;
  color: var(--ink-2);
  font-size: 12.5px;
}
details.ev > summary::-webkit-details-marker { display: none; }
details.ev > summary::before {
  content: "\25B8";                      /* ▸ */
  color: var(--ink-faint);
  font-size: 10px;
  width: 10px;
  transition: none;
}
details.ev[open] > summary::before { content: "\25BE"; }   /* ▾ */
details.ev > summary:hover { background: rgba(255, 255, 255, 0.025); color: var(--ink); }
details.ev[open] > summary { background: var(--panel-2); color: var(--ink); }

.ev-when { font-weight: 600; color: var(--ink); min-width: 74px; }
.ev-bit {
  color: var(--ink-dim);
  padding: 1px 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 11.5px;
}

.ev-body { padding: 4px 16px 16px; }
.ev-label {
  display: block;
  color: var(--ink-faint); font-size: 11px; font-weight: 650;
  text-transform: uppercase; letter-spacing: 0.06em;
  margin: 12px 0 5px;
}
.ev-note p {
  margin: 0; padding: 9px 12px;
  background: var(--bg-2); border-left: 3px solid var(--accent);
  border-radius: 0 var(--radius-s) var(--radius-s) 0;
  color: var(--ink-2);
}
.ev-foot { margin: 12px 0 0; }

/* Context as a table of facts, not a blob of JSON. */
.kvtable { width: 100%; border-collapse: collapse; }
.kvtable th {
  text-align: left; vertical-align: top;
  width: 190px; padding: 5px 12px 5px 0;
  color: var(--ink-dim); font-weight: 550; font-size: 12.5px;
  font-family: var(--mono);
  border-bottom: 1px solid var(--line-soft);
  overflow-wrap: anywhere;
}
.kvtable td {
  padding: 5px 0;
  border-bottom: 1px solid var(--line-soft);
  font-family: var(--mono); font-size: 12.5px;
  color: var(--ink);
  overflow-wrap: anywhere;
}
.kvtable tr:last-child th, .kvtable tr:last-child td { border-bottom: 0; }

/* A stack trace scrolls in both directions inside its own box. Wrapping one is
   how a forty-frame trace turns into a two-screen page nobody reads. */
pre.trace {
  margin: 0;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-s);
  padding: 12px 14px;
  font-size: 12px;
  line-height: 1.55;
  color: #c9d6e5;
  white-space: pre;
  overflow: auto;
  max-height: 440px;
  tab-size: 4;
}
pre.trace.short { max-height: 200px; }

/* ------------------------------------------------------------- token box */

.tokenbox {
  border: 1px solid rgba(255, 212, 94, 0.4);
  border-left-width: 4px;
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(255, 212, 94, 0.07), rgba(255, 212, 94, 0.02));
  padding: 18px 20px;
  margin-bottom: 20px;
}
.tokenbox h2 { font-size: 15px; color: #f6e7b6; margin-bottom: 8px; }
.tokenbox p { margin: 0 0 12px; color: var(--ink-2); max-width: 74ch; }

.tokenval {
  margin: 0 0 10px;
  background: var(--bg);
  border: 1px dashed rgba(255, 212, 94, 0.45);
  border-radius: var(--radius-s);
  padding: 14px;
  font-family: var(--mono);
  font-size: 14px;
  letter-spacing: 0.02em;
  color: #ffe9a8;
  user-select: all;
  white-space: pre;
  overflow-x: auto;
}
.tokenhow summary { cursor: pointer; color: var(--ink-2); font-size: 12.5px; margin-bottom: 8px; }
.tokenhow summary:hover { color: var(--ink); }
.tokenhow code {
  background: var(--bg-2); border: 1px solid var(--line);
  border-radius: 4px; padding: 1px 5px; font-size: 11px;
}

/* ------------------------------------------------------------- responsive */

@media (max-width: 1080px) {
  .cols, .cols-wide { grid-template-columns: minmax(0, 1fr); }
  .col-side { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 18px; }
  .col-side .card { margin-bottom: 0; }
}

@media (max-width: 860px) {
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tile-v { font-size: 26px; }
}

@media (max-width: 720px) {
  body { font-size: 13.5px; }
  .wrap { padding: 16px 12px 48px; }
  .topbar-in { padding: 9px 12px; gap: 12px; }
  .brand-name { display: none; }
  .nav { order: 3; width: 100%; overflow-x: auto; }
  .nav a { padding: 6px 10px; }
  .who { margin-left: auto; }
  .filters { padding: 11px; gap: 9px; }
  .field, .field.grow { flex: 1 1 100%; }
  .filter-actions { width: 100%; }
  .filter-actions .btn { flex: 1 1 auto; }
  .rpt-title { font-size: 18px; }
  .empty { padding: 20px 16px; }
  .card.narrow { margin: 16px auto; }
  .kvtable th { width: 120px; }
  details.ev > summary { gap: 8px; }
}

@media (max-width: 460px) {
  .tiles { grid-template-columns: minmax(0, 1fr); }
  .tile { padding: 12px 14px; }
  .tile-v { font-size: 24px; }
}

/* ========================================================================== */
/*  Store browser                                                             */
/*                                                                            */
/*  The coordination store has seven record types and forty-odd states between*/
/*  them, which is far too many for a colour each. So states are grouped into  */
/*  eight MEANINGS, and every state maps to one:                              */
/*                                                                            */
/*      waiting     nobody has picked it up                                   */
/*      working     somebody is on it now                                     */
/*      blocked     stopped, waiting on something else                        */
/*      review      needs a second pair of eyes                               */
/*      settled     finished, and the outcome was good                        */
/*      dropped     deliberately not being done                               */
/*      duplicate   the same thing as something else                          */
/*      stale       still here, no longer trustworthy                         */
/*                                                                            */
/*  Every rule below is keyed on TYPE AND STATE, never on the state word       */
/*  alone. `done`, `building`, `duplicate`, `wontfix`, `open` and `new` each   */
/*  occur in two or three types, and a shared colour would quietly teach that  */
/*  a shipped feature and a declined request are the same kind of thing.       */
/*  Verbose, and the verbosity is the safety.                                  */
/* ========================================================================== */

.pill-state { border-radius: var(--radius-s); text-transform: lowercase; }

/* waiting — blue, filled. The default state of anything nobody has taken. */
.ss-task-open, .ss-issue-open, .ss-bug-open, .ss-request-new, .ss-feature-idea {
  border-color: var(--st-new); background: rgba(88, 166, 255, 0.16); color: #bcdcff;
}

/* working — amber, filled. Somebody is in this record right now. */
.ss-task-active, .ss-issue-investigating, .ss-bug-confirmed, .ss-bug-fixing,
.ss-feature-planned, .ss-feature-building, .ss-request-accepted, .ss-request-building,
.ss-doc-draft {
  border-color: var(--st-confirmed); background: rgba(255, 159, 67, 0.18); color: #ffcc99;
}

/* blocked — red, hard-cornered and heavy on the left, like sev-critical. It is
   the one state that means "this is not moving and will not without help". */
.ss-task-blocked, .ss-issue-blocked {
  border-radius: 2px; border-left-width: 4px;
  border-color: var(--sev-critical); background: rgba(255, 107, 122, 0.14); color: #ffb3bb;
}

/* review — violet outline. Waiting on a person, not on work. */
.ss-task-review, .ss-doc-needs-review {
  border-color: rgba(167, 139, 250, 0.5); background: transparent; color: #cdbdfd;
}

/* settled — green, double border. Deliberately the same treatment as st-fixed
   on the reports side, because it means the same thing there. */
.ss-task-done, .ss-issue-resolved, .ss-bug-fixed, .ss-feature-shipped,
.ss-request-done, .ss-doc-current, .ss-knowledge-verified {
  border-color: rgba(95, 214, 164, 0.5); background: transparent; color: #9fe0c4;
  border-style: double; border-width: 3px; padding: 1px 8px;
}

/* likely — settled's quieter sibling. Believed, not proven. */
.ss-knowledge-likely {
  border-color: rgba(95, 214, 164, 0.4); background: transparent; color: #9fe0c4;
  border-style: dashed;
}

/* dropped — grey, dotted. Chosen against, not forgotten; the record stays. */
.ss-task-dropped, .ss-issue-wontfix, .ss-bug-wontfix, .ss-feature-rejected,
.ss-feature-parked, .ss-request-declined, .ss-doc-archived, .ss-knowledge-unverified {
  border-color: rgba(139, 152, 169, 0.45); background: transparent;
  color: var(--ink-dim); border-style: dotted;
}

/* duplicate — dashed violet, matching st-duplicate on the reports side. */
.ss-bug-duplicate, .ss-request-duplicate {
  border-color: rgba(201, 139, 216, 0.5); background: transparent;
  color: #e0b6ea; border-style: dashed;
}

/* stale — a doc that is still served and can no longer be believed. Amber and
   dashed: present, but do not lean on it. */
.ss-doc-outdated {
  border-color: rgba(255, 159, 67, 0.6); background: transparent;
  color: #ffcc99; border-style: dashed;
}

/* --------------------------------------------------------------- the lock -- */
/* A lease, not a claim. `held` is somebody's now; `stale` expired and is free
   again — rendered dimmer precisely so it does not read as an obstacle. */
.pill-lock { border-radius: 999px; font-weight: 600; text-transform: lowercase; }
.lock-held {
  border-color: rgba(255, 212, 94, 0.5); background: rgba(255, 212, 94, 0.10); color: #f4dc9a;
}
.lock-stale {
  border-color: rgba(139, 152, 169, 0.4); background: transparent;
  color: var(--ink-faint); border-style: dashed;
}

/* --------------------------------------------------------------- prose ---- */
/* Stored text is plain: hard newlines, no markdown, no HTML. pre-wrap keeps the
   author's line breaks — a repro with numbered steps is unreadable reflowed —
   while still wrapping long lines instead of forcing a horizontal scrollbar. */
.prose-block + .prose-block { margin-top: 20px; }
.prose-h {
  font-size: 11.5px; font-weight: 700; letter-spacing: 0.07em;
  text-transform: uppercase; color: var(--ink-faint);
  margin: 0 0 6px;
}
.prose {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 13.5px; line-height: 1.62;
  color: var(--ink-2);
  max-width: 88ch;
}
.ev-note.prose { margin-top: 6px; }

/* ---------------------------------------------------------------- misc ---- */
/* A paragraph that introduces a page. Wider measure than body text would be
   comfortable at, because it is one or two sentences and never a wall. */
.lede { max-width: 92ch; margin: 0 0 16px; font-size: 13px; line-height: 1.6; }

/* Tiles that are links. The whole tile is the target, not just the number. */
.tile-link { text-decoration: none; transition: border-color 120ms, background 120ms; }
.tile-link:hover { border-color: rgba(88, 166, 255, 0.4); background: var(--panel-2); }
.tile-link:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

/* ------------------------------------------------------------ key scopes -- */
/* The three-way scope chooser on keys.php. Each radio owns the block beneath
   it; indenting that block is what makes "this input belongs to that choice"
   legible without JavaScript, which the CSP would not run anyway. */
.scope-body {
  margin: 4px 0 14px 24px;
  padding-left: 12px;
  border-left: 2px solid var(--line-soft);
  display: flex; flex-direction: column; gap: 6px;
}
.scope-body:last-child { margin-bottom: 0; }
.field > label.check { display: block; margin-bottom: 2px; font-weight: 500; }
.field > label.check strong { font-weight: 650; }

/* Somebody printing a triage list wants ink on paper, not a dark rectangle. */
@media print {
  body { background: #fff; color: #000; }
  .topbar, .filters, .pager, .col-side, .foot, .copybtn { display: none; }
  .card, .tile, .empty { border-color: #bbb; box-shadow: none; background: #fff; }
  .pill { color: #000 !important; border-color: #666 !important; background: transparent !important; }
  pre.trace { max-height: none; white-space: pre-wrap; color: #000; background: #f5f5f5; }
}

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