/* =====================================================================
   Console Kit — components

   The stylesheet of the Strathbreede HR console, lifted out so other
   projects can wear it. Load tokens.css first; every colour here is a
   token from it.

   What makes it look the way it does:
     · a dark frame (app bar + sidebar) around light content
     · FLAT cards: 1px hairline, 5px radius, no shadow. Only things that
       float over the page get a shadow
     · small radii everywhere: 3px controls, 5px surfaces
     · uppercase, letter-spaced eyebrows above headings and table heads
     · compact controls, 40px nav rows, a 64px app bar
     · fast, small motion: 150–220ms, one ease curve

   Markup contract (see index.html for a complete page):
     body.signed-in > #root > header.appbar + aside.nav + main#pane
     then, OUTSIDE #root and in this order:
       #drawer-host, #modal, #dialog, #toasts.toasts, .progress
   ===================================================================== */

:root {
  --appbar:  64px;
  --sidebar: 264px;
  --t-fast: .15s;
  --t-base: .18s;
  --ease-out: cubic-bezier(.2, .7, .3, 1);
}

* { box-sizing: border-box; }

/* `hidden` is only display:none at user-agent strength, so any rule that
   sets a display quietly beats it. This makes hidden mean hidden. */
[hidden] { display: none !important; }

html, body {
  margin: 0; min-height: 100%;
  background: var(--page); color: var(--ink);
  font: 400 15px/1.6 var(--font-sans);
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}

#root { min-height: 100vh; }
body.signed-in #root {
  display: grid;
  grid-template-columns: var(--sidebar) minmax(0, 1fr);
  grid-template-rows: var(--appbar) 1fr;
}
/* The rail. One variable moves the grid column, the sticky sidebar and
   everything inside it, so there is no second layout to keep in step. */
body.nav-rail { --sidebar: 64px; }
/* Placed explicitly: when the nav leaves the flow (the overlay on a
   tablet or phone), auto-placement would pull <main> into the 64px
   column and the page would vanish behind the scrim. */
body.signed-in #root > .nav { grid-column: 1; grid-row: 2; }
body.signed-in #root > main { grid-column: 2; grid-row: 2; }

h1 { font: 600 1.55rem/1.25 var(--font-sans); letter-spacing: -.01em; margin: 0; text-wrap: balance; }
h2 { font: 600 1.02rem/1.35 var(--font-sans); margin: 0 0 .15rem; }
h3 { font: 600 .92rem/1.35 var(--font-sans); margin: 0; }
p  { margin: 0; }
.muted { color: var(--muted); }
.small { font-size: .82rem; }
.right { text-align: right; }
.num   { font-variant-numeric: tabular-nums; }
code { font-family: var(--font-mono); font-size: .84em; color: var(--muted); }

/* The label above a heading. Does most of the work of making a dense
   page feel organised. */
.eyebrow {
  display: block; margin-bottom: .5rem;
  font-size: .68rem; font-weight: 700;
  letter-spacing: .16em; text-transform: uppercase;
  color: var(--chrome-mid);
}

@keyframes fade       { from { opacity: 0; transform: translateY(6px) } to { opacity: 1; transform: none } }
@keyframes pop        { from { opacity: 0; transform: scale(.96) }      to { opacity: 1; transform: none } }
@keyframes fade-plain { from { opacity: 0 } to { opacity: 1 } }
@keyframes slide-in   { from { transform: translateX(100%) } to { transform: none } }
@keyframes slide-left { from { transform: translateX(-100%) } to { transform: none } }

/* =====================================================================
   App bar
   ================================================================== */
.appbar {
  grid-column: 1 / -1;
  position: sticky; top: 0; z-index: 60;
  height: var(--appbar);
  background: var(--chrome-deep);
  display: flex; align-items: center; gap: 1.2rem;
  /* Tighter on the left: the menu button leads, and its own padding
     supplies the edge gap. */
  padding: 0 1.3rem 0 .7rem;
}
.appbar .brand { display: flex; align-items: center; gap: .7rem; min-width: 0; }
.appbar .brand .mark {
  width: 32px; height: 32px; flex: 0 0 32px;
  display: grid; place-items: center;
  background: rgba(255,255,255,.07);
  border: 1px solid rgba(255,255,255,.16);
  border-radius: var(--r-ctl);
  color: #fff; font: 700 .8rem/1 var(--font-sans);
}
.appbar .brand .mark img, .appbar .brand .mark svg { width: 24px; height: 24px; }
.appbar .brand .wordmark {
  color: #fff; font: 600 1.02rem/1 var(--font-sans); letter-spacing: .04em;
  white-space: nowrap;
}
.appbar .brand .wordmark span { font-weight: 400; color: var(--chrome-pale); }
.appbar .tag {
  font-size: .62rem; font-weight: 700; letter-spacing: .16em;
  text-transform: uppercase; color: var(--chrome-pale);
  border: 1px solid rgba(255,255,255,.22);
  border-radius: var(--r-ctl); padding: .22rem .5rem;
  white-space: nowrap;
}
.appbar .spacer { flex: 1; }
.appbar .who-mini { text-align: right; line-height: 1.25; }
.appbar .who-mini strong { display: block; color: #fff; font-size: .82rem; font-weight: 500; }
.appbar .who-mini small {
  color: var(--chrome-pale); font-size: .66rem;
  letter-spacing: .12em; text-transform: uppercase;
}

/* The menu button: first thing on the bar, ahead of the brand, a bare
   glyph that only picks up a disc on hover. */
.railtoggle {
  display: grid; place-items: center;
  width: 40px; height: 40px; flex: 0 0 40px; padding: 0;
  margin-right: -.45rem;
  border: 0; border-radius: 50%;
  background: transparent; color: var(--chrome-pale);
  cursor: pointer;
  transition: background var(--t-fast), color var(--t-fast);
}
.railtoggle svg { width: 19px; height: 19px; fill: currentColor; }
.railtoggle:hover { background: rgba(255,255,255,.1); color: #fff; border: 0; }
.railtoggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* =====================================================================
   Sidebar
   ================================================================== */
.nav {
  background: var(--chrome);
  position: sticky; top: var(--appbar);
  height: calc(100vh - var(--appbar));
  overflow-y: auto;
  padding: 1.2rem 0;
  display: flex; flex-direction: column;
}

/* A group heading. A button, because each group folds — but styled to
   stay a caption: a nav full of things that look clickable is a nav
   nobody reads. */
.side-label {
  display: flex; align-items: center; justify-content: space-between; gap: .5rem;
  width: 100%; border: 0; border-radius: 0; background: none;
  font: 700 .64rem/1 var(--font-sans);
  letter-spacing: .16em; text-transform: uppercase;
  color: var(--chrome-pale); opacity: .6;
  padding: .5rem 1.5rem; margin: 0 0 .35rem;
  text-align: left; cursor: pointer;
  transition: opacity var(--t-fast);
}
.side-label:hover { opacity: 1; background: none; color: var(--chrome-pale); border: 0; }
.side-label .caret {
  width: 14px; height: 14px; flex: 0 0 14px; fill: currentColor;
  transition: transform var(--t-base) var(--ease-out);
}
.side-label[aria-expanded="false"] .caret { transform: rotate(-90deg); }

/* The page you are on, when its group is folded shut. Without it the
   only marker of where you are is inside the thing you just hid. */
.fold-here {
  height: 2px; margin: -.2rem 1.5rem .6rem;
  background: var(--accent); border-radius: 2px;
}
.nav nav { display: flex; flex-direction: column; }
.nav nav + .side-label { margin-top: 1.5rem; }

/* 40px rows, flat, full bleed. The active marker is a 2px left rule and
   a tinted fill — not a pill. */
.navlink {
  display: flex; align-items: center; justify-content: flex-start; gap: .8rem;
  width: 100%; padding: .62rem 1.5rem;
  border: 0; border-left: 2px solid transparent; border-radius: 0;
  background: none; color: rgba(215, 222, 235, .82);
  font: 400 .9rem/1.4 var(--font-sans); text-align: left; cursor: pointer;
  transition: background var(--t-fast), color var(--t-fast);
}
.navlink .ic { width: 17px; height: 17px; flex: 0 0 17px; opacity: .8; fill: currentColor; }
.navlink:hover { background: rgba(255,255,255,.05); color: #fff; border-color: transparent; }
.navlink.on {
  background: rgba(255,255,255,.09);
  color: #fff; border-left-color: var(--accent);
}
.navlink.on .ic { opacity: 1; }
.navlink .count {
  margin-left: auto; font-size: .7rem; font-weight: 600;
  color: var(--chrome-pale); font-variant-numeric: tabular-nums;
}

.side-foot {
  margin-top: auto; padding: 1.2rem 1.5rem 0;
  border-top: 1px solid rgba(215, 222, 235, .12);
}
.side-foot .tagline { color: rgba(240, 244, 252, .72); font-size: .82rem; line-height: 1.4; }
.side-foot button.link { margin-left: -.6rem; color: var(--accent); }
.side-foot button.link:hover { background: rgba(255,255,255,.06); color: #fff; }

/* ---- Collapsed to a rail -------------------------------------------
   Labels out, icons centred, the title attribute carrying the name. */
body.nav-rail .navlink { justify-content: center; padding: .62rem 0; gap: 0; }
body.nav-rail .navlink > span,
body.nav-rail .side-label > span,
body.nav-rail .side-label .caret,
body.nav-rail .side-foot .tagline { display: none; }
/* The group heading becomes a hairline: grouping still legible without
   the word, and a column of unlabelled carets would be noise. */
body.nav-rail .side-label {
  pointer-events: none; padding: 0; margin: .7rem 1rem .5rem;
  height: 1px; background: rgba(215, 222, 235, .16); opacity: 1;
}
body.nav-rail .nav nav + .side-label { margin-top: .7rem; }
body.nav-rail .nav nav[hidden] { display: flex !important; }
body.nav-rail .fold-here { display: none; }
body.nav-rail .side-foot { padding: 1.2rem .5rem 0; text-align: center; }
body.nav-rail .side-foot button.link { margin-left: 0; font-size: .72rem; }

/* =====================================================================
   Content
   ================================================================== */
main { padding: 2rem 2.4rem 4rem; max-width: 1180px; min-width: 0; }

.pane-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 1.5rem; flex-wrap: wrap; margin-bottom: 1.5rem;
}
.pane-head > div:first-child p { margin-top: .35rem; color: var(--muted); font-size: .92rem; }
.head-actions { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.pane-in { animation: fade .28s var(--ease-out) both; }

/* =====================================================================
   Buttons — compact, 3px, flat
   ================================================================== */
button, .btn {
  position: relative; overflow: hidden;
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  padding: .62rem 1.1rem;
  border: 1px solid var(--line); border-radius: var(--r-ctl);
  background: var(--panel); color: var(--ink);
  font: 500 .86rem/1 var(--font-sans);
  cursor: pointer; white-space: nowrap; text-decoration: none;
  transition: background var(--t-base), border-color var(--t-base),
              color var(--t-base), box-shadow var(--t-base);
}
button:hover, .btn:hover { border-color: var(--brand-300); color: var(--chrome-mid); }
button:focus-visible, .btn:focus-visible { outline: 2px solid var(--brand-600); outline-offset: 2px; }
button:disabled { opacity: .45; pointer-events: none; }

button.primary, .btn.primary {
  background: var(--brand-600); border-color: var(--brand-600); color: var(--on-brand);
}
button.primary:hover, .btn.primary:hover {
  background: var(--brand-700); border-color: var(--brand-700); color: var(--on-brand);
}

button.danger-btn { background: var(--danger); border-color: var(--danger); color: #fff; }
button.danger-btn:hover { background: var(--danger-deep); border-color: var(--danger-deep); color: #fff; }

button.link {
  border-color: transparent; background: none; color: var(--chrome-mid);
  padding: .35rem .5rem; font-size: .82rem;
}
button.link:hover { background: var(--shade); color: var(--brand-700); border-color: transparent; }
button.link.danger { color: var(--danger); }
button.link.danger:hover { background: var(--danger-bg); color: var(--danger); }

/* "Add another" at the foot of a list: dashed, full width, quiet. */
button.add {
  width: 100%; margin-top: .6rem; padding: .8rem;
  border-style: dashed; background: none; color: var(--muted);
}
button.add:hover { border-color: var(--brand-400); color: var(--chrome-mid); background: none; }

button.sm { padding: .4rem .7rem; font-size: .8rem; }

/* Press feedback: a small ripple grown from the pointer. Scaled right
   down — at this button size a big one reads as a flash. */
.ripple-ink {
  position: absolute; border-radius: 50%;
  background: currentColor; opacity: .14;
  transform: scale(0); pointer-events: none;
  animation: ripple .45s var(--ease-out) forwards;
}
@keyframes ripple { to { transform: scale(1); opacity: 0 } }

/* A slow button says what it is doing, where the person is looking. */
.spin {
  display: inline-block; width: .85em; height: .85em;
  vertical-align: -.08em;
  border: 2px solid currentColor; border-right-color: transparent;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
[data-save][disabled], [data-close][disabled] { opacity: .7; cursor: default; }

/* =====================================================================
   Panels — flat, bordered, no shadow
   ================================================================== */
.card {
  background: var(--panel);
  border: 1px solid var(--line); border-radius: var(--r-surf);
  padding: 1.4rem; margin-bottom: 1.2rem;
  transition: border-color var(--t-base);
}
.card.hover:hover { border-color: var(--brand-200); }
.card > h2 + p { margin-top: .2rem; }
.empty { text-align: center; padding: 3.5rem 1.4rem; color: var(--muted); }
.empty h2 { color: var(--ink); margin-bottom: .4rem; }

/* A banner says something about the whole page. One sentence, and never
   a substitute for putting the marker on the thing itself. */
.banner {
  display: block;
  padding: 1.05rem 1.3rem; margin-bottom: 1.5rem;
  border: 1px solid var(--brand-200); border-radius: var(--r-surf);
  background: var(--brand-50); color: var(--brand-900);
  font-size: .9rem; line-height: 1.5;
}
.banner strong { display: block; margin-bottom: .15rem; }
.banner.warn { background: var(--warn-bg); border-color: #e7d3a8; color: #6b4e06; }
.banner.bad  { background: var(--danger-bg); border-color: #efc4c0; color: #7a1c16; }
.banner.ok   { background: var(--ok-bg); border-color: #bcdcc9; color: #174f33; }

/* =====================================================================
   Fields — caption above control
   ================================================================== */
label {
  display: block; margin-bottom: 1rem;
  font-size: .8rem; font-weight: 600; color: var(--brand-900);
}
input, select, textarea {
  width: 100%; padding: .6rem .75rem;
  border: 1px solid var(--line); border-radius: var(--r-ctl);
  background: var(--panel); color: var(--ink);
  font: 400 .9rem/1.4 var(--font-sans);
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
label > input, label > select, label > textarea { margin-top: .4rem; }
input:hover, select:hover, textarea:hover { border-color: var(--brand-300); }
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--brand-500);
  box-shadow: 0 0 0 3px rgba(60, 120, 192, .14);
}
textarea { resize: vertical; }
.hint { display: block; margin-top: .35rem; font-size: .76rem; font-weight: 400; color: var(--muted); }
.hint.bad { color: var(--danger); }
.hint.ok  { color: var(--ok); }

fieldset {
  border: 1px solid var(--line); border-radius: var(--r-surf);
  padding: 1.1rem; margin: 0 0 1.1rem; min-width: 0;
}
legend {
  font-size: .68rem; font-weight: 700; letter-spacing: .16em;
  text-transform: uppercase; color: var(--chrome-mid); padding: 0 .4rem;
}

/* Two and three across. They stack on a narrow screen, because two date
   fields side by side on a phone are unusable. */
.pair  { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
.pair3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: .75rem; }

/* A radio or checkbox BESIDE its words. The plain label is a stacked
   field, which puts a radio on its own line above what it labels. */
.check {
  display: flex; align-items: flex-start; gap: .6rem;
  margin: 0 0 .35rem; padding: .1rem 0;
  font-weight: 400; font-size: .92rem; color: var(--ink); cursor: pointer;
}
.check input[type="radio"], .check input[type="checkbox"] {
  width: 18px; height: 18px; flex: 0 0 18px; margin: .18rem 0 0;
  accent-color: var(--brand-600); box-shadow: none;
}
.check > span { flex: 1; min-width: 0; }

/* A choice between kinds of thing: bold name, one line of consequence. */
.kinds { display: grid; gap: .3rem; }
.kinds .check > span { display: flex; flex-direction: column; }
.kinds small { font-size: .76rem; margin-top: .1rem; color: var(--muted); }

/* An input with a button or two on its right. */
.inputrow { display: flex; gap: .4rem; align-items: stretch; }
.inputrow input { flex: 1; min-width: 0; margin: 0; }
.inputrow button { flex: 0 0 auto; padding: .55rem .8rem; }

/* =====================================================================
   Chips — state, at a glance
   ================================================================== */
.chip {
  display: inline-flex; align-items: center; gap: .35rem;
  padding: .2rem .55rem; border-radius: var(--r-pill);
  background: var(--shade); color: var(--brand-800);
  font-size: .7rem; font-weight: 600; line-height: 1.4; white-space: nowrap;
}
/* `wait` is neutral on purpose: "not started" is the normal state of a
   new record, and colouring it amber makes a whole list look on fire. */
.chip.ok   { background: var(--ok-bg);     color: var(--ok); }
.chip.warn { background: var(--warn-bg);   color: var(--warn); }
.chip.bad  { background: var(--danger-bg); color: var(--danger); }
.chip.info { background: var(--brand-100); color: var(--brand-800); }
.chip.wait { background: var(--shade);     color: var(--muted); }

/* =====================================================================
   List toolbar — search, status filter, dropdown filters
   ================================================================== */
.toolbar {
  display: flex; align-items: center; gap: 1rem; flex-wrap: wrap;
  padding: .85rem 1rem; margin-bottom: .75rem;
}
.toolbar .search { flex: 1 1 260px; min-width: 200px; margin: 0; }
.chips { display: flex; gap: .35rem; flex-wrap: wrap; }
.chip-btn {
  padding: .38rem .8rem; border-radius: var(--r-pill);
  border: 1px solid var(--line); background: var(--panel);
  font-size: .78rem; font-weight: 600; color: var(--muted);
}
.chip-btn:hover { border-color: var(--brand-300); color: var(--brand-700); }
.chip-btn.on { background: var(--brand-600); border-color: var(--brand-600); color: var(--on-brand); }
.chip-btn .n { font-variant-numeric: tabular-nums; opacity: .75; font-weight: 500; }
/* Dropdowns that belong together get a row of their own: sharing a line
   with the search box stranded one above the others. */
.filterset {
  flex: 1 1 100%;
  display: flex; align-items: center; gap: .5rem; flex-wrap: wrap;
}
.filterset select { flex: 0 1 200px; width: auto; max-width: 200px; margin: 0; }
.count-line { margin: 0 0 .75rem .1rem; font-size: .82rem; color: var(--muted); }

/* =====================================================================
   Tables
   ================================================================== */
.tablewrap { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; font-size: .88rem; }
.tbl th {
  text-align: left; padding: .7rem .9rem;
  font-size: .64rem; font-weight: 700;
  letter-spacing: .16em; text-transform: uppercase; color: var(--muted);
  border-bottom: 1px solid var(--line); white-space: nowrap;
}
.tbl td {
  padding: .85rem .9rem; vertical-align: middle;
  border-bottom: 1px solid var(--line);
}
.tbl td small { display: block; color: var(--muted); font-size: .76rem; }
.tbl td.num, .tbl td .num { white-space: nowrap; }
.tbl th.right, .tbl td.right { text-align: right; }
.tbl tbody tr { transition: background var(--t-fast); }
.tbl tbody tr:hover { background: var(--panel-2); }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl tbody tr[data-open] { cursor: pointer; }
.card.tablecard { padding: .6rem .5rem; }

/* Label / value pairs down a record. */
.answers {
  display: grid; grid-template-columns: minmax(140px, 38%) 1fr;
  gap: .45rem 1rem; margin: .5rem 0 0;
}
.answers dt { font-size: .82rem; color: var(--muted); }
.answers dd { margin: 0; font-size: .9rem; }
.detail-sec { padding: 1.1rem 0; border-bottom: 1px solid var(--line); }
.detail-sec:first-child { padding-top: 0; }
.detail-sec:last-child { border-bottom: 0; }
.detail-sec > h3 { margin-bottom: .2rem; }

/* =====================================================================
   Tabs — underline, not boxes
   ================================================================== */
.tabs {
  display: flex; gap: .25rem; margin-bottom: 1.25rem;
  border-bottom: 1px solid var(--line); overflow-x: auto;
}
.tab {
  border: 0; border-bottom: 2px solid transparent; border-radius: 0;
  background: none; color: var(--muted);
  padding: .6rem .9rem; margin-bottom: -1px;
  font: 500 .95rem/1.3 var(--font-sans);
}
.tab:hover { color: var(--brand-700); background: none; border-color: transparent; }
.tab.on { color: var(--brand-800); border-bottom-color: var(--brand-600); font-weight: 600; }

/* =====================================================================
   Drawer — a record or a form, from the right
   ================================================================== */
/* Its own host, below #modal, so a sheet opened from inside a drawer
   lands on top of it rather than wiping it. */
#drawer-host { position: fixed; inset: 0; z-index: 40; display: none; }
#drawer-host.open { display: block; }
.drawer-scrim {
  position: absolute; inset: 0; background: var(--scrim);
  animation: fade-plain .18s var(--ease-out) both;
}
#drawer-host.closing .drawer-scrim { animation: fade-plain .18s var(--ease-out) reverse both; }

/* Below the app bar, not over it: the chrome stays put and the drawer
   reads as a panel of the app rather than a takeover. */
.drawer {
  position: absolute; top: var(--appbar); right: 0; bottom: 0;
  width: min(580px, 100%);
  display: flex; flex-direction: column;
  background: var(--panel);
  border-left: 1px solid var(--line);
  box-shadow: var(--shadow-side);
  animation: slide-in .22s var(--ease-out) both;
}
.drawer.out { animation: slide-in .18s var(--ease-out) reverse both; }
.drawer > header {
  display: flex; justify-content: space-between; align-items: center;
  gap: 1rem; padding: 1.1rem 1.4rem;
  border-bottom: 1px solid var(--line); flex: 0 0 auto;
}
/* Only the body scrolls, so the header stays and Save never scrolls
   out of reach. */
.drawer-body { flex: 1 1 auto; overflow-y: auto; padding: 1.4rem; }
.drawer-foot {
  flex: 0 0 auto;
  display: flex; justify-content: flex-end; align-items: center; gap: .5rem;
  flex-wrap: wrap; padding: 1rem 1.4rem;
  border-top: 1px solid var(--line); background: var(--panel-2);
}
.drawer-foot .grow { margin-right: auto; }

/* =====================================================================
   Sheet — a short form in the middle
   ================================================================== */
#modal {
  position: fixed; inset: 0; display: none; z-index: 50;
  background: var(--scrim); padding: 1.5rem; overflow: auto;
}
#modal.open { display: grid; place-items: start center; animation: fade .16s var(--ease-out) both; }
.sheet {
  width: min(640px, 100%); margin: 2.5rem 0; padding: 0;
  background: var(--panel);
  border: 1px solid var(--line); border-radius: var(--r-surf);
  box-shadow: var(--shadow-float);
  animation: pop .22s var(--ease-out) both;
}
.sheet > header, .sheet > footer {
  display: flex; justify-content: space-between; align-items: center;
  gap: 1rem; padding: 1.1rem 1.4rem;
}
.sheet > header { border-bottom: 1px solid var(--line); }
.sheet > footer { border-top: 1px solid var(--line); background: var(--panel-2); flex-wrap: wrap; }
.sheet > footer .grow { margin-right: auto; }
.sheet-body { padding: 1.4rem; }
.sheet.wide { width: min(880px, 100%); }

/* The busy line: its own row above the Save it belongs to. */
.busy-note {
  flex: 1 1 100%; order: -1;
  margin: 0 0 .6rem; color: var(--muted); font-size: .85rem;
}

/* =====================================================================
   Dialog — a question with two answers
   ================================================================== */
#dialog { position: fixed; inset: 0; z-index: 100; display: none; }
#dialog.open { display: block; }
.dialog-backdrop {
  position: absolute; inset: 0; background: var(--scrim);
  display: grid; place-items: center; padding: 1.5rem;
  animation: fade .16s var(--ease-out) both;
}
.dialog {
  width: min(440px, 100%); margin: 0; padding: 1.5rem;
  background: var(--panel);
  border: 1px solid var(--line); border-radius: var(--r-surf);
  box-shadow: var(--shadow-float);
  animation: pop .22s var(--ease-out) both;
}
.dialog h2 { font-size: 1.08rem; margin: 0 0 .6rem; }
.dialog p { margin: 0 0 1.4rem; color: var(--muted); font-size: .9rem; line-height: 1.55; }
.dialog textarea { margin-bottom: 1.2rem; }
.dialog-actions { display: flex; justify-content: flex-end; gap: .5rem; }

/* =====================================================================
   Toasts — bottom right, newest at the bottom
   ================================================================== */
.toasts {
  position: fixed; right: 1.5rem; bottom: 1.5rem; z-index: 110;
  display: flex; flex-direction: column; align-items: flex-end;
  width: min(420px, calc(100vw - 3rem));
  pointer-events: none;
  transition: bottom var(--t-base) var(--ease-out);
}
/* An open drawer's Cancel and Save are also bottom right. Lift the stack
   above them, or the error sits on the very button it tells you to use. */
/* --foot-h is the open drawer's footer height, kept current by console.js
   (it grows when a busy note appears). */
#drawer-host.open ~ .toasts { bottom: calc(1.5rem + var(--foot-h, 68px) + .25rem); }
.toast-slot {
  align-self: flex-end; max-height: 0; overflow: hidden;
  transition: max-height .26s var(--ease-out);
}
.toast-slot.in { max-height: 240px; }
.toast {
  pointer-events: auto; max-width: 100%;
  display: flex; align-items: center; gap: .8rem;
  margin-top: .5rem; padding: .75rem .6rem .75rem 1rem;
  border-radius: var(--r-ctl);
  background: var(--chrome-deep); color: #eef2fa;
  box-shadow: var(--shadow-toast);
  font-size: .86rem; line-height: 1.45;
  opacity: 0; transform: translateY(8px) scale(.97);
  transition: opacity .24s var(--ease-out), transform .24s var(--ease-out);
}
.toast-slot.in .toast { opacity: 1; transform: none; }
.toast.bad { background: var(--danger); color: #fff; }
.toast.ok  { background: var(--ok);     color: #fff; }
.toast-msg { flex: 1 1 auto; }
.toast-x {
  flex: 0 0 auto; width: 26px; height: 26px; padding: 0;
  border: 0; border-radius: var(--r-ctl);
  background: none; color: inherit; opacity: .75;
  font-size: 16px; line-height: 1;
}
.toast-x:hover { opacity: 1; background: rgba(255,255,255,.12); color: inherit; border: 0; }

/* =====================================================================
   The loading line

   A line across the very top of the window while anything is in flight.
   No track: it reads as a line being drawn, not a gauge — the width is
   an honest guess. `.booting` is pure CSS and starts at first paint,
   before any script has loaded; console.js takes it over.
   ================================================================== */
.progress {
  position: fixed; inset: 0 0 auto 0; height: 3px; z-index: 200;
  pointer-events: none; opacity: 0;
  transition: opacity .3s;
}
.progress.on, .progress.booting { opacity: 1; }
.progress::before {
  content: ""; display: block; height: 100%;
  width: var(--at, 0%);
  background: var(--accent);
  box-shadow: 0 0 10px var(--accent);
  transition: width .25s var(--ease-out);
}
.progress.booting::before { width: 0; animation: boot 9s linear forwards; }
/* Quick off the mark, then slowing, and never arriving by itself. The
   shape lives in the stops, not an easing curve. */
@keyframes boot {
  0% { width: 0; } 10% { width: 28%; } 30% { width: 55%; }
  60% { width: 75%; } 100% { width: 90%; }
}

/* =====================================================================
   Sign in — the one page without the frame
   ================================================================== */
.signin-wrap {
  min-height: 100vh; display: grid; place-items: center; padding: 1.5rem;
  background: var(--chrome-deep);
}
.signin {
  width: min(400px, 100%);
  padding: 2rem; margin: 0;
  box-shadow: 0 30px 70px rgba(6, 12, 34, .45);
  animation: pop .3s var(--ease-out) both;
}
.signin .brand { display: flex; align-items: center; gap: .7rem; margin-bottom: 1.5rem; }
.signin .brand strong { font: 600 1rem/1.3 var(--font-sans); display: block; }
.signin .brand small {
  display: block; font-size: .62rem; font-weight: 700;
  letter-spacing: .16em; text-transform: uppercase; color: var(--muted);
}
.signin h1 { font-size: 1.3rem; margin-bottom: 1.2rem; }
.signin button.primary { width: 100%; padding: .75rem; margin-top: .4rem; }

/* =====================================================================
   Odds and ends
   ================================================================== */
.code {
  background: var(--chrome-deep); color: #dce6f6;
  padding: 1rem; border-radius: var(--r-ctl);
  overflow: auto; max-height: 52vh;
  font: 400 .76rem/1.55 var(--font-mono); margin: 0;
}
.code.wrap { white-space: pre-wrap; word-break: break-all; max-height: none; }

/* Something to hand over: a label, a value in mono, a Copy button. */
.creds {
  display: grid; grid-template-columns: auto 1fr; gap: .55rem 1rem;
  align-items: center; margin: .8rem 0 1rem;
  padding: .9rem 1rem; border: 1px solid var(--line);
  border-radius: var(--r-ctl); background: var(--shade);
}
.creds dt {
  font-size: .68rem; font-weight: 700; letter-spacing: .14em;
  text-transform: uppercase; color: var(--chrome-mid);
}
.creds dd { margin: 0; display: flex; align-items: center; gap: .6rem; min-width: 0; }
.creds code {
  flex: 1; min-width: 0; overflow-wrap: anywhere;
  font: 500 .95rem/1.35 var(--font-mono); color: var(--ink);
}

/* =====================================================================
   Narrow
   ================================================================== */
/* Tablet: the full sidebar is the wrong shape, so the rail is the only
   option — but the menu button stays, and opens the full list over the
   page when someone needs the words. */
@media (max-width: 860px) {
  body.signed-in { --sidebar: 64px; }
  body.signed-in:not(.nav-open) .navlink { justify-content: center; padding: .62rem 0; gap: 0; }
  body.signed-in:not(.nav-open) .navlink > span,
  body.signed-in:not(.nav-open) .side-label > span,
  body.signed-in:not(.nav-open) .side-label .caret,
  body.signed-in:not(.nav-open) .side-foot .tagline { display: none; }
  body.signed-in:not(.nav-open) .side-label {
    pointer-events: none; padding: 0; margin: .7rem 1rem .5rem;
    height: 1px; background: rgba(215, 222, 235, .16); opacity: 1;
  }
  body.signed-in:not(.nav-open) .nav nav[hidden] { display: flex !important; }
  body.signed-in:not(.nav-open) .fold-here { display: none; }
  body.signed-in:not(.nav-open) .side-foot { padding: 1.2rem .5rem 0; text-align: center; }
  body.signed-in.nav-open .nav {
    position: fixed; z-index: 55; left: 0; top: var(--appbar); bottom: 0;
    width: 264px; height: auto;
    box-shadow: 18px 0 50px rgba(0, 0, 0, .3);
    animation: slide-left .22s var(--ease-out) both;
  }
  body.nav-open::after {
    content: ""; position: fixed; inset: var(--appbar) 0 0 0; z-index: 54;
    background: var(--scrim); animation: fade-plain .18s both;
  }
  main { padding: 1.5rem 1.2rem 3rem; }
  .appbar .tag { display: none; }
}

/* Phone: no sidebar column at all. The menu button slides the nav in
   over the page, the way every phone app does it. */
@media (max-width: 600px) {
  body.signed-in #root { grid-template-columns: minmax(0, 1fr); }
  body.signed-in #root > main { grid-column: 1; }
  .hide-sm { display: none; }
  .appbar { gap: .9rem; padding-right: 1rem; }
  .appbar .who-mini { display: none; }
  .nav {
    position: fixed; z-index: 55; left: 0; top: var(--appbar); bottom: 0;
    width: min(290px, 84vw); height: auto;
    box-shadow: 18px 0 50px rgba(0, 0, 0, .3);
    transform: translateX(-100%); visibility: hidden;
    transition: transform .22s var(--ease-out), visibility 0s .22s;
  }
  body.signed-in.nav-open .nav {
    width: min(290px, 84vw);
    transform: none; visibility: visible; animation: none;
    transition: transform .22s var(--ease-out);
  }
  main { padding: 1.25rem 1rem 4rem; }
  .pair, .pair3 { grid-template-columns: 1fr; }
  .answers { grid-template-columns: 1fr; gap: .1rem; }
  .answers dd { margin-bottom: .6rem; }
  .drawer { width: 100%; }
  .toasts { right: 1rem; bottom: 1rem; width: calc(100vw - 2rem); }
  #drawer-host.open ~ .toasts { bottom: calc(1rem + var(--foot-h, 68px) + .25rem); }
}

/* Less motion still needs to show arrival — just without the shove.
   Exempt: the loading line, whose movement IS the information. */
@media (prefers-reduced-motion: reduce) {
  .drawer, .drawer.out { animation: fade-plain .12s both; }
  .sheet, .dialog, .pane-in, .signin { animation: fade-plain .12s both; }
  .spin { animation-duration: 2.4s; }
  .ripple-ink { display: none; }
}
