:root {
  --canvas: #edf1ee;
  --surface: #f9fbf9;
  --surface-muted: #f0f4f1;
  --ink: #14211f;
  --muted: #60706a;
  --rail: #c8d2cc;
  --signal: #1d735f;
  --signal-soft: #d9eee7;
  --warning: #9a452e;
  --warning-soft: #f8e6df;
  --history: #4a5b7a;
  --history-soft: #e4e9f2;
  --shadow: 0 16px 40px rgb(21 36 31 / 8%);
  font-family: "Avenir Next", Avenir, "Segoe UI", ui-sans-serif, system-ui, sans-serif;
  color: var(--ink);
  background: var(--canvas);
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; }
button, textarea, select { font: inherit; }
button { cursor: pointer; }
h1, h2, h3, p { margin-top: 0; }

button:focus-visible, textarea:focus-visible, select:focus-visible, summary:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--signal) 55%, white);
  outline-offset: 2px;
}

.shell { max-width: 1080px; margin: 0 auto; padding: 42px 34px 72px; }

.shell-header { display: flex; flex-wrap: wrap; gap: 28px 36px; justify-content: space-between; align-items: end; padding-bottom: 26px; border-bottom: 1px solid var(--rail); }
.eyebrow { margin: 0 0 6px; font-size: .74rem; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); }
h1 { margin-bottom: 6px; letter-spacing: -.04em; font-size: clamp(2rem, 4vw, 3.2rem); line-height: 1; }
.tagline { margin: 0; color: var(--muted); }

.reader-slot { min-width: 240px; }
.reader-slot select { width: 100%; padding: 9px 11px; border: 1px solid var(--rail); border-radius: 9px; background: var(--surface); }
.reader-status { margin: 8px 0 0; font-size: .84rem; color: var(--muted); }

.tabs { display: flex; gap: 6px; margin: 26px 0 20px; }
.tab { padding: 9px 16px; border: 1px solid transparent; border-radius: 999px; background: transparent; color: var(--muted); }
.tab.is-active { background: var(--surface); border-color: var(--rail); color: var(--ink); box-shadow: var(--shadow); }

.banner { padding: 12px 16px; margin-bottom: 18px; border-radius: 10px; background: var(--signal-soft); color: var(--signal); font-size: .92rem; }
.banner[data-tone="warning"] { background: var(--warning-soft); color: var(--warning); }

.panel h2 { font-size: 1.16rem; letter-spacing: -.01em; margin-bottom: 14px; }

.health { display: flex; flex-wrap: wrap; align-items: baseline; gap: 26px; padding: 20px 24px; margin-bottom: 30px; border-radius: 14px; background: var(--surface); box-shadow: var(--shadow); }
.health-item { display: flex; flex-direction: column; }
.health-count { font-size: 1.9rem; line-height: 1; letter-spacing: -.03em; }
.health-label { font-size: .8rem; color: var(--muted); }
.health-space { margin: 0 0 0 auto; font-size: .84rem; color: var(--muted); }

.cards { list-style: none; margin: 0 0 22px; padding: 0; display: grid; gap: 12px; }
.card { padding: 16px 18px; border: 1px solid var(--rail); border-radius: 12px; background: var(--surface); }
.card-top { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; margin-bottom: 8px; }
.card-path { font-weight: 600; }
.card-summary { margin: 0 0 10px; }
.card-meta { margin: 0; font-size: .8rem; color: var(--muted); }
.card-actions { margin-top: 12px; }

/* status is never colour alone:each badge carries a shape marker and a word */
.status { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: .76rem; font-weight: 600; }
.status-current { background: var(--signal-soft); color: var(--signal); }
.status-replaced { background: var(--history-soft); color: var(--history); }
.status-review { background: var(--warning-soft); color: var(--warning); }
.marker { display: inline-grid; place-items: center; width: 16px; height: 16px; border-radius: 50%; font-size: .68rem; font-weight: 700; }
.marker-current { background: var(--signal); color: #fff; }
.marker-replaced { background: var(--history); color: #fff; }
.marker-review { background: var(--warning); color: #fff; }

.reason { margin: 10px 0 0; padding: 9px 12px; border-radius: 9px; background: var(--warning-soft); color: var(--warning); font-size: .85rem; }

details { margin-bottom: 18px; padding: 14px 18px; border: 1px solid var(--rail); border-radius: 12px; background: var(--surface-muted); }
summary { cursor: pointer; font-weight: 600; display: flex; align-items: center; gap: 9px; }
.pill { margin-left: auto; padding: 2px 9px; border-radius: 999px; background: var(--surface); border: 1px solid var(--rail); font-size: .76rem; font-weight: 600; }

.scope-body { margin-top: 14px; display: grid; gap: 14px; }
.scope-group h3 { font-size: .84rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; }
.scope-group ul { margin: 0; padding-left: 18px; }

.timeline { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.timeline li { display: grid; grid-template-columns: 150px 1fr; gap: 16px; padding: 12px 4px; border-bottom: 1px solid var(--rail); }
.timeline time { font-size: .8rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.timeline .event-kind { display: block; font-size: .74rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin-bottom: 3px; }

.task-name { font-size: 1.1rem; font-weight: 600; margin-bottom: 4px; }
.task-status { margin-bottom: 18px; color: var(--muted); }
.gates { list-style: none; margin: 0 0 20px; padding: 0; display: grid; gap: 9px; }
.gates li { display: flex; align-items: center; gap: 10px; padding: 11px 14px; border-radius: 10px; background: var(--surface); border: 1px solid var(--rail); }
.gate-mark { font-weight: 700; }
.gate-done .gate-mark { color: var(--signal); }
.gate-open .gate-mark { color: var(--muted); }

.receipt { display: grid; grid-template-columns: max-content 1fr; gap: 8px 18px; margin: 14px 0 0; font-size: .84rem; }
.receipt dt { color: var(--muted); }
.receipt dd { margin: 0; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; overflow-wrap: anywhere; }

.empty { padding: 18px; border-radius: 10px; background: var(--surface-muted); color: var(--muted); font-size: .9rem; }

.quiet-button { padding: 7px 14px; border: 1px solid var(--rail); border-radius: 999px; background: var(--surface); }
.primary-button { padding: 7px 16px; border: 1px solid var(--signal); border-radius: 999px; background: var(--signal); color: #fff; }

dialog { border: none; border-radius: 14px; padding: 26px; max-width: 460px; box-shadow: var(--shadow); }
dialog::backdrop { background: rgb(20 33 31 / 38%); }
dialog h3 { margin-bottom: 6px; }
.dialog-note { color: var(--muted); font-size: .86rem; }
dialog label { display: block; margin: 14px 0 6px; font-size: .84rem; color: var(--muted); }
dialog textarea { width: 100%; padding: 10px; border: 1px solid var(--rail); border-radius: 9px; }
dialog menu { display: flex; justify-content: flex-end; gap: 9px; margin: 18px 0 0; padding: 0; }

@media (max-width: 720px) {
  .shell { padding: 28px 18px 48px; }
  .timeline li { grid-template-columns: 1fr; gap: 4px; }
}

/* ------------------------------------------------------- private alpha gate */

/* an explicit display beats the UA stylesheet's [hidden] { display: none },
   so hiding the gate needs saying out loud or a valid key never dismisses it */
.access-gate[hidden] { display: none; }

.access-gate {
  position: fixed;
  inset: 0;
  display: grid;
  justify-items: center;
  /* centred when it fits, scrollable when it does not: a short window or a
     phone in landscape would otherwise clip the Continue button */
  align-content: safe center;
  overflow-y: auto;
  padding: 1rem;
  background: var(--bg, #faf9f7);
  z-index: 50;
}

.access-card {
  display: grid;
  gap: 0.75rem;
  max-width: 24rem;
  padding: 2rem;
  border: 1px solid var(--line, #e4e1db);
  border-radius: 10px;
  background: var(--surface, #fff);
}

.access-card h2 { margin: 0; font-size: 1.15rem; }
.access-help { margin: 0; font-size: 0.85rem; color: var(--muted, #6b6660); }
.access-card input {
  padding: 0.6rem 0.7rem;
  border: 1px solid var(--line, #e4e1db);
  border-radius: 6px;
  font: inherit;
}
.access-card button {
  padding: 0.6rem 0.9rem;
  border: 0;
  border-radius: 6px;
  background: var(--ink, #23201c);
  color: #fff;
  font: inherit;
  cursor: pointer;
}
.access-error { margin: 0; font-size: 0.85rem; color: var(--danger, #a3352b); }

/* while locked, no state chrome is even laid out */
body.locked .shell { visibility: hidden; }
