/* ==========================================================================
   Roster Service — app.css
   Light/dark theming via CSS custom properties:
   * default follows the OS preference (prefers-color-scheme),
   * an explicit user choice sets <html data-theme="light|dark"> (persisted in
     localStorage by theme.js/app.js), which always wins.
   ========================================================================== */

:root {
  --bg: #f4f6fb;
  --panel: #ffffff;
  --panel-2: #eef1f8;
  --text: #1b2233;
  --muted: #5c6580;
  --line: #d9deec;
  --accent: #2749c8;
  --accent-contrast: #ffffff;
  --ok: #157a45;
  --ok-bg: #e2f4ea;
  --warn: #9a6700;
  --warn-bg: #fff3d6;
  --err: #b3261e;
  --err-bg: #fde8e7;
  --info: #1f4e9c;
  --info-bg: #e5edfb;
  --chip-working: #157a45;
  --chip-working-bg: #e2f4ea;
  --chip-oncall: #9a6700;
  --chip-oncall-bg: #fff3d6;
  --chip-off: #5c6580;
  --chip-off-bg: #e9ecf4;
  --chip-vacation: #1f4e9c;
  --chip-vacation-bg: #e5edfb;
  --chip-sick: #b3261e;
  --chip-sick-bg: #fde8e7;
  --chip-ot: #c2410c;
  --chip-ot-bg: #fde8d8;
  --shadow: 0 1px 3px rgba(20, 28, 50, 0.08), 0 4px 14px rgba(20, 28, 50, 0.06);
  /* Station location palette (light theme). */
  --loc-c0: #e5484d;  --loc-c1: #f5a623;
  --loc-c2: #2749c8;  --loc-c3: #12a15a;
  --loc-c4: #8e44ad;  --loc-c5: #0e9aa7;
  --loc-c6: #d63384;  --loc-c7: #6b7280;
}

/* Explicit dark choice */
:root[data-theme="dark"] {
  --bg: #0e1320;
  --panel: #161d2e;
  --panel-2: #1d2539;
  --text: #e8ecf7;
  --muted: #97a0b8;
  --line: #2a3350;
  --accent: #8ea2ff;
  --accent-contrast: #10162a;
  --ok: #4ecb8d;
  --ok-bg: #143527;
  --warn: #e5b34c;
  --warn-bg: #3a2d10;
  --err: #ff8a80;
  --err-bg: #3d1a17;
  --info: #8fb3ff;
  --info-bg: #1a2a4a;
  --chip-working: #4ecb8d;
  --chip-working-bg: #143527;
  --chip-oncall: #e5b34c;
  --chip-oncall-bg: #3a2d10;
  --chip-off: #97a0b8;
  --chip-off-bg: #232c46;
  --chip-vacation: #8fb3ff;
  --chip-vacation-bg: #1a2a4a;
  --chip-sick: #ff8a80;
  --chip-sick-bg: #3d1a17;
  --chip-ot: #ffa94d;
  --chip-ot-bg: #3a2410;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.5), 0 6px 18px rgba(0, 0, 0, 0.35);
  /* Station location palette (dark theme): brighter for contrast. */
  --loc-c0: #ff8a80;  --loc-c1: #ffc24d;
  --loc-c2: #93a8ff;  --loc-c3: #3fd08a;
  --loc-c4: #c084fc;  --loc-c5: #2dd4e0;
  --loc-c6: #f472b6;  --loc-c7: #9aa4bd;
}

/* OS dark preference (only when the user has not chosen explicitly) */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e1320;
    --panel: #161d2e;
    --panel-2: #1d2539;
    --text: #e8ecf7;
    --muted: #97a0b8;
    --line: #2a3350;
    --accent: #8ea2ff;
    --accent-contrast: #10162a;
    --ok: #4ecb8d;
    --ok-bg: #143527;
    --warn: #e5b34c;
    --warn-bg: #3a2d10;
    --err: #ff8a80;
    --err-bg: #3d1a17;
    --info: #8fb3ff;
    --info-bg: #1a2a4a;
    --chip-working: #4ecb8d;
    --chip-working-bg: #143527;
    --chip-oncall: #e5b34c;
    --chip-oncall-bg: #3a2d10;
    --chip-off: #97a0b8;
    --chip-off-bg: #232c46;
    --chip-vacation: #8fb3ff;
    --chip-vacation-bg: #1a2a4a;
    --chip-sick: #ff8a80;
    --chip-sick-bg: #3d1a17;
    --chip-ot: #ffa94d;
    --chip-ot-bg: #3a2410;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.5), 0 6px 18px rgba(0, 0, 0, 0.35);
    /* Station location palette (dark theme): brighter for contrast. */
    --loc-c0: #ff8a80;  --loc-c1: #ffc24d;
    --loc-c2: #93a8ff;  --loc-c3: #3fd08a;
    --loc-c4: #c084fc;  --loc-c5: #2dd4e0;
    --loc-c6: #f472b6;  --loc-c7: #9aa4bd;
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.45rem; margin: 0 0 0.5rem; }
h2 { font-size: 1.05rem; margin: 0 0 0.6rem; }
.muted { color: var(--muted); font-weight: 400; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.9em; }
code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0.05em 0.4em;
  font-size: 0.9em;
}

/* ---------------- top bar ---------------- */

.topbar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  padding: 0.6rem 1rem;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand { font-weight: 700; font-size: 1.02rem; color: var(--text); }
.brand:hover { text-decoration: none; }

.mainnav { display: flex; gap: 0.15rem; flex-wrap: wrap; flex: 1; }
.mainnav a {
  padding: 0.35rem 0.7rem;
  border-radius: 8px;
  color: var(--text);
  font-weight: 500;
}
.mainnav a:hover { background: var(--panel-2); text-decoration: none; }
.mainnav a.active { background: var(--accent); color: var(--accent-contrast); }

.topbar-actions { display: flex; align-items: center; gap: 0.4rem; }

main { flex: 1; width: 100%; max-width: 1080px; margin: 0 auto; padding: 1rem; }
/* Wide pages (the Calendar matrix) use the full viewport width so the
   table isn't squeezed into a narrow centered box with empty margins. */
main.main--wide { max-width: none; }

.foot {
  padding: 0.75rem 1rem;
  color: var(--muted);
  font-size: 0.8rem;
  border-top: 1px solid var(--line);
  text-align: center;
}

/* ---------------- cards & layout ---------------- */

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 1rem 1.1rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow);
}

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 760px) { .grid-2 { grid-template-columns: 1fr; } }

.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 0.9rem;
}
.page-head h1 { margin: 0; }
/* Calendar only (main--wide): pin the page-head under the sticky topbar
   while scrolling the matrix. --page-head-top is set by app.js to the
   topbar's current height; the 56px fallback covers a single-row topbar.
   z-index 5 sits under the topbar (z:10) but above the matrix cells. */
main.main--wide .page-head {
  position: sticky;
  top: calc(var(--page-head-top, 56px) - 1px);
  z-index: 5;
  background: var(--bg);
  padding: 0.5rem 0 0.6rem;
}

/* ---------------- forms & buttons ---------------- */

button {
  font: inherit;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
  border-radius: 8px;
  padding: 0.4rem 0.85rem;
  cursor: pointer;
}
button:hover { border-color: var(--accent); }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

button.primary, .btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-contrast);
  font-weight: 600;
}
button.ghost, .btn.ghost { background: transparent; }

.btn {
  display: inline-block;
  font: inherit;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
  border-radius: 8px;
  padding: 0.4rem 0.85rem;
}
.btn.small { padding: 0.2rem 0.6rem; font-size: 0.85rem; }
.btn-row { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.btn-row form { margin: 0; }

label { display: block; margin-bottom: 0.7rem; font-weight: 500; }
input[type="text"], input[type="password"], input:not([type]), select {
  width: 100%;
  margin-top: 0.3rem;
  padding: 0.5rem 0.65rem;
  font: inherit;
  color: var(--text);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}
input::placeholder { color: var(--muted); }

.inline-form { display: inline; margin: 0; }
.inline-form button { padding: 0.35rem 0.6rem; }

.date-nav, .month-nav { display: flex; align-items: center; gap: 0.4rem; }
.date-nav a, .month-nav a { padding: 0 0.3rem; }
.date-nav button, .month-nav button { padding: 0.3rem 0.7rem; }
.month-nav select { width: auto; margin: 0; }

/* ---------------- auth ---------------- */

.auth-wrap { display: grid; place-items: start center; min-height: 55vh; }
.auth-card { width: 100%; max-width: 360px; margin-top: 4vh; }

/* ---------------- banners ---------------- */

.banner {
  border-radius: 10px;
  padding: 0.7rem 0.95rem;
  margin-bottom: 1rem;
  border: 1px solid;
  font-size: 0.95rem;
}
.banner-ok { color: var(--ok); background: var(--ok-bg); border-color: var(--ok); }
.banner-error { color: var(--err); background: var(--err-bg); border-color: var(--err); }
.banner-reauth { color: var(--warn); background: var(--warn-bg); border-color: var(--warn); }
.banner-disabled { color: var(--muted); background: var(--panel-2); border-color: var(--line); }
.banner-info { color: var(--info); background: var(--info-bg); border-color: var(--info); }

/* ---------------- chips ---------------- */

.chip {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 0.12rem 0.55rem;
  border-radius: 999px;
  border: 1px solid transparent;
  vertical-align: middle;
  white-space: nowrap;
}
.chip-working { color: var(--chip-working); background: var(--chip-working-bg); border-color: var(--chip-working); }
.chip-oncall { color: var(--chip-oncall); background: var(--chip-oncall-bg); border-color: var(--chip-oncall); }
.chip-ot { color: var(--chip-ot); background: var(--chip-ot-bg); border-color: var(--chip-ot); }
.chip-off_oncall { color: var(--chip-oncall); background: transparent; border-color: var(--chip-oncall); }
.chip-off { color: var(--chip-off); background: var(--chip-off-bg); border-color: var(--chip-off); }
.chip-vacation { color: var(--chip-vacation); background: var(--chip-vacation-bg); border-color: var(--chip-vacation); }
.chip-sick { color: var(--chip-sick); background: var(--chip-sick-bg); border-color: var(--chip-sick); }
.chip-na { color: var(--muted); background: transparent; border-color: var(--line); }
.chip-other { color: var(--info); background: var(--info-bg); border-color: var(--info); }
.chip-run-ok { color: var(--ok); background: var(--ok-bg); border-color: var(--ok); }
.chip-run-error { color: var(--err); background: var(--err-bg); border-color: var(--err); }
.chip-run-reauth-required { color: var(--warn); background: var(--warn-bg); border-color: var(--warn); }

/* ---------------- lists (today / oncall) ---------------- */

.shift-list, .oncall-list { list-style: none; margin: 0; padding: 0; }
.shift-list li, .oncall-list li {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  flex-wrap: wrap;
  padding: 0.5rem 0;
  border-bottom: 1px dashed var(--line);
}
.shift-list li:last-child, .oncall-list li:last-child { border-bottom: 0; }

.who { font-weight: 600; min-width: 7.5em; }
.time { color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }

.people { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 0.4rem 1.2rem; }
.person {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  padding: 0.35rem 0;
  border-bottom: 1px dashed var(--line);
}

.oncall-hero { border-left: 4px solid var(--chip-oncall); }
.oncall-list.big li { font-size: 1.15rem; padding: 0.55rem 0; }
.oncall-none { font-size: 1.1rem; }

.person-pill {
  display: inline-block;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.15rem 0.6rem;
  margin: 0.1rem 0.25rem 0.1rem 0;
  font-size: 0.88rem;
}

/* ---------------- calendar ---------------- */

.matrix-wrap {
  overflow-x: auto;
  overflow-y: auto;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
  margin-bottom: 1rem;
  /* Pin the matrix as a bounded scroll box under the sticky topbar +
     page-head, so the date header row (and the first column) stay frozen
     while scrolling. --matrix-top is set by app.js to the page-head's
     bottom edge. */
  position: sticky;
  top: var(--matrix-top, 120px);
  max-height: calc(100vh - var(--matrix-top, 120px) - 12px);
}
table.matrix { border-collapse: collapse; table-layout: fixed; }
/* Uniform columns: the employee column is fixed-width and every day column is
   a fixed width, so all cells are the same size. The table is wider than the
   viewport, so it scrolls horizontally (the page auto-scrolls to today). */
.matrix-col-emp { width: 140px; min-width: 140px; max-width: 140px; }
.matrix-col-day { width: 112px; min-width: 112px; max-width: 112px; }
.matrix th, .matrix td {
  border: 1px solid var(--line);
  padding: 0.3rem 0.35rem;
  vertical-align: top;
  text-align: left;
}
.matrix thead th {
  background: var(--panel-2);
  font-size: 0.72rem;
  font-weight: 600;
  text-align: center;
  position: sticky;
  top: 0;
  z-index: 2;
}
.matrix .dow { display: block; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
.matrix .dnum { display: block; font-size: 0.95rem; font-weight: 700; }
.matrix thead th.today .dnum { color: var(--accent); }
.matrix-emphead {
  position: sticky;
  left: 0;
  z-index: 2;
  background: var(--panel-2);
  min-width: 130px;
  text-align: left !important;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}
.matrix-emp {
  position: sticky;
  left: 0;
  z-index: 1;
  background: var(--panel);
  font-weight: 600;
  white-space: nowrap;
  min-width: 130px;
  border-right: 2px solid var(--line);
}
.matrix-cell {
  font-size: 0.74rem;
  line-height: 1.3;
}
/* Fixed-size cells: a <td>'s height is only a minimum, so content can stretch
   a row. The inner div is a fixed height that clips any overflow, so every
   cell is exactly the same size regardless of how much it holds. */
.matrix-cell-inner {
  height: 86px;
  overflow: hidden;
}
/* Today: an accent band down the column (left + right edges only), so it
   reads as a column rather than a box around every cell. */
.matrix-cell.today { border-left: 2px solid var(--accent); border-right: 2px solid var(--accent); }
.matrix thead th.today { border-left: 2px solid var(--accent); border-right: 2px solid var(--accent); }
.mc-label {
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* Station location: an accent chip so it reads at a glance, consistent
   with the coverage board. The tinted background + border keep it legible
   over every cell colour. */
/* Station location colours: one class per palette slot points --loc at a
   theme-aware --loc-cN variable, so each station keeps a distinctive,
   consistent colour that stays readable in both light and dark themes
   (the variables are defined on :root and re-tuned in the dark blocks). */
.loc-c0 { --loc: var(--loc-c0); } .loc-c1 { --loc: var(--loc-c1); }
.loc-c2 { --loc: var(--loc-c2); } .loc-c3 { --loc: var(--loc-c3); }
.loc-c4 { --loc: var(--loc-c4); } .loc-c5 { --loc: var(--loc-c5); }
.loc-c6 { --loc: var(--loc-c6); } .loc-c7 { --loc: var(--loc-c7); }
.mc-loc {
  display: inline-block;
  margin-top: 0.15rem;
  padding: 0.02rem 0.4rem;
  border-radius: 999px;
  font-size: 0.66rem;
  font-weight: 700;
  color: var(--loc, var(--accent));
  background: color-mix(in srgb, var(--loc, var(--accent)) 30%, transparent);
  border: 1px solid color-mix(in srgb, var(--loc, var(--accent)) 45%, transparent);
}
/* Dark themes: a slightly stronger pill fill keeps the station colour
   readable over the darker cells. */
:root[data-theme="dark"] .mc-loc,
:root[data-theme="dark"] .chip-loc {
  background: color-mix(in srgb, var(--loc, var(--accent)) 40%, transparent);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .mc-loc,
  :root:not([data-theme="light"]) .chip-loc {
    background: color-mix(in srgb, var(--loc, var(--accent)) 40%, transparent);
  }
}
.mc-time { font-size: 0.68rem; opacity: 0.8; font-variant-numeric: tabular-nums; }
.mc-oncall {
  display: inline-block;
  margin-top: 0.15rem;
  font-size: 0.62rem;
  font-weight: 700;
  padding: 0.05rem 0.3rem;
  border-radius: 999px;
  border: 1px solid currentColor;
}
/* Overtime: a bold, filled badge so it stands out at a glance over any cell
   colour (the tinted fill + strong border keep it legible). */
.mc-ot {
  display: inline-block;
  margin-top: 0.15rem;
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  padding: 0.05rem 0.35rem;
  border-radius: 999px;
  color: var(--chip-ot);
  background: var(--chip-ot-bg);
  border: 1px solid var(--chip-ot);
}
/* Training: a subtle outline badge (mirrors the on-call badge style). */
.mc-training {
  display: inline-block;
  margin-top: 0.15rem;
  font-size: 0.62rem;
  font-weight: 700;
  padding: 0.05rem 0.3rem;
  border-radius: 999px;
  border: 1px solid currentColor;
}

/* Roster cell colours (mirror the Excel sheet). */
.cell-morning { background: #f6d5a8; }
.cell-afternoon { background: #bfe3a0; }
.cell-night { background: #2f4a6b; color: #fff; }
.cell-working { background: var(--info-bg); }
.cell-off { background: #f3a6f3; }
.cell-sick { background: #f0a868; }
.cell-vacation { background: var(--chip-vacation-bg); }
.cell-oncall { background: var(--chip-oncall-bg); }
.cell-other { background: var(--panel-2); }
.cell-na { background: var(--panel-2); }
.cell-blank { background: transparent; }

/* Dark mode: soften the fixed Excel colours so they stay readable. */
:root[data-theme="dark"] .cell-morning,
:root:not([data-theme="light"]) .cell-morning { background: #5a4327; color: #ffe6c2; }
:root[data-theme="dark"] .cell-afternoon,
:root:not([data-theme="light"]) .cell-afternoon { background: #2f4a24; color: #d6f0b8; }
:root[data-theme="dark"] .cell-off,
:root:not([data-theme="light"]) .cell-off { background: #5a2a5a; color: #f6d6f6; }
:root[data-theme="dark"] .cell-sick,
:root:not([data-theme="light"]) .cell-sick { background: #5a3a1a; color: #ffd9b0; }
:root[data-theme="dark"] .cell-vacation,
:root:not([data-theme="light"]) .cell-vacation { background: #1a2a4a; color: #cdd9f5; }
:root[data-theme="dark"] .cell-oncall,
:root:not([data-theme="light"]) .cell-oncall { background: #3a2d10; color: #f0d9a0; }
:root[data-theme="dark"] .cell-working,
:root:not([data-theme="light"]) .cell-working { background: #1a2a4a; color: #cdd9f5; }
:root[data-theme="dark"] .cell-other,
:root:not([data-theme="light"]) .cell-other { background: #1d2539; }

/* Legend chips reuse the cell colours. */
.legend .cell-morning, .legend .cell-afternoon, .legend .cell-night,
.legend .cell-off, .legend .cell-sick, .legend .cell-vacation,
.legend .cell-oncall { border: 1px solid transparent; }

.legend { margin: 0 0 1rem; font-size: 0.85rem; display: flex; gap: 0.4rem; flex-wrap: wrap; align-items: center; }

/* ---------------- tables (history / status) ---------------- */

.table-wrap { overflow-x: auto; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); margin-bottom: 1rem; }
table.data { width: 100%; border-collapse: collapse; min-width: 560px; }
.data th {
  text-align: left;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  padding: 0.55rem 0.7rem;
  border-bottom: 1px solid var(--line);
  background: var(--panel-2);
}
.data td { padding: 0.5rem 0.7rem; border-top: 1px solid var(--line); vertical-align: middle; }
.data tbody tr:first-child td { border-top: 0; }
.data .detail { color: var(--muted); font-size: 0.9em; }

/* Activity log: a compact, scrollable window of the significant background
   events on the Status page. Each row is time + level badge + message. */
.activity-log {
  max-height: 260px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
  padding: 0.4rem 0.6rem;
  font-size: 0.85rem;
}
.activity-row {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  padding: 0.3rem 0;
  border-top: 1px solid var(--line);
}
.activity-row:first-child { border-top: 0; }
.activity-time {
  flex: none;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  font-size: 0.78rem;
  white-space: nowrap;
}
.activity-badge {
  flex: none;
  min-width: 3.2rem;
  text-align: center;
  border-radius: 999px;
  padding: 0.02rem 0.4rem;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: var(--muted);
  background: var(--panel);
  border: 1px solid var(--line);
}
.activity-text { color: var(--text); overflow-wrap: anywhere; }
.activity-ok .activity-badge { color: var(--ok); background: var(--ok-bg); border-color: var(--ok); }
.activity-warn .activity-badge { color: var(--warn); background: var(--warn-bg); border-color: var(--warn); }
.activity-error .activity-badge { color: var(--err); background: var(--err-bg); border-color: var(--err); }
.activity-info .activity-badge { color: var(--info); background: var(--info-bg); border-color: var(--info); }

/* Verbose toggle: a small switch next to the Activity log heading. */
.activity-head { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; }
.activity-head h2 { margin: 0; }
#verbose-toggle[aria-pressed="true"] {
  color: var(--accent);
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
}

/* Verbose rows are hidden by default; the log container gets .is-verbose when
   the user turns the toggle on. They are visually distinct from the "big"
   events: dimmer, smaller, and a dashed left rule instead of a badge fill. */
.activity-row.activity-verbose { display: none; }
.activity-log.is-verbose .activity-row.activity-verbose { display: flex; }
.activity-row.activity-verbose {
  border-left: 2px dashed var(--line);
  margin-left: -0.6rem;
  padding-left: calc(0.6rem - 2px);
  opacity: 0.85;
}
.activity-row.activity-verbose .activity-badge {
  color: var(--muted);
  background: transparent;
  border: 1px dashed var(--line);
  text-transform: none;
  font-weight: 600;
}
.activity-row.activity-verbose .activity-text { color: var(--muted); font-size: 0.82rem; }
.week-table { width: 100%; border-collapse: collapse; }
.week-table td { padding: 0.45rem 0.5rem; border-top: 1px solid var(--line); }
.week-table tr:first-child td { border-top: 0; }
.week-table tr.is-today td { background: var(--panel-2); font-weight: 600; }

/* ---------------- key/value lists ---------------- */

dl.kv { margin: 0; display: grid; grid-template-columns: 11em 1fr; gap: 0.3rem 0.8rem; }
dl.kv dt { color: var(--muted); }
dl.kv dd { margin: 0; }

/* ---------------- misc ---------------- */

@media (max-width: 560px) {
  body { font-size: 14.5px; }
  .mainnav { order: 3; width: 100%; justify-content: space-between; }
  .mainnav a { padding: 0.3rem 0.5rem; font-size: 0.9rem; }
  .who { min-width: auto; }
}

/* ---------------- re-auth panel ---------------- */

.reauth-panel {
  margin-top: 1rem;
  padding: 1rem;
  background: var(--panel-2);
  border-radius: 12px;
  border: 1px solid var(--line);
}

.reauth-msg {
  margin: 0 0 1rem 0;
  font-size: 1.05rem;
  line-height: 1.5;
}

.reauth-panel a {
  display: inline-block;
  margin-top: 0.5rem;
  padding: 0.5rem 1rem;
  background: var(--accent);
  color: var(--accent-contrast);
  border-radius: 8px;
  text-decoration: none;
  font-weight: 600;
}

.reauth-panel a:hover {
  background: color-mix(in srgb, var(--accent) 90%, black);
}

/* ---------------- toast notifications ---------------- */

.toast {
  position: fixed;
  top: 1rem;
  right: 1rem;
  padding: 1rem 1.5rem;
  border-radius: 12px;
  font-weight: 500;
  box-shadow: var(--shadow);
  z-index: 1000;
  opacity: 1;
  transition: opacity 0.4s ease;
  max-width: 400px;
}

.toast.toast-hide {
  opacity: 0;
}

.toast-info {
  background: var(--info-bg);
  color: var(--info);
}

.toast-ok {
  background: var(--ok-bg);
  color: var(--ok);
}

.toast-err {
  background: var(--err-bg);
  color: var(--err);
}

/* ---------------- end re-auth and toast styles ---------------- */
/* ---------------- Current view (status board) ---------------- */

.current-head { align-items: flex-start; }
.current-sub { margin: 0; font-size: 0.9rem; }

/* Live clock: top-right of the Current page head. */
.current-clock {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  line-height: 1.1;
  padding: 0.35rem 0.7rem;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  min-width: 7.5rem;
}
.clock-time {
  font-size: 1.5rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}
.clock-date { font-size: 0.78rem; }

/* Shift-status hero card. */
.shift-hero { border-left: 4px solid var(--line); }
.shift-hero.hero-in-progress { border-left-color: var(--ok); }
.shift-hero.hero-starting-soon { border-left-color: var(--warn); }
.shift-hero.hero-ended { border-left-color: var(--chip-off); }
.shift-hero.hero-none { border-left-color: var(--line); }
.hero-top { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; flex-wrap: wrap; }
.hero-kicker {
  display: block;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 0.15rem;
}
.hero-type { font-size: 1.5rem; font-weight: 700; }
.hero-time { display: block; font-size: 0.95rem; margin-top: 0.1rem; }
.hero-chip { font-size: 0.85rem; padding: 0.25rem 0.8rem; }

/* Countdown. */
.countdown-card { text-align: center; }
.countdown-label { font-size: 0.85rem; margin-bottom: 0.25rem; }
.countdown {
  font-size: 2.6rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
  color: var(--accent);
}
.countdown-detail { margin-top: 0.35rem; font-size: 0.85rem; }

/* Progress bar: full at page load, drains to empty as the target nears. */
.countdown-bar {
  height: 8px;
  border-radius: 999px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  overflow: hidden;
  margin: 0.6rem 0 0.2rem;
}
.countdown-bar-fill {
  height: 100%;
  width: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), color-mix(in srgb, var(--accent) 55%, var(--ok)));
  transition: width 1s linear;
}

/* "Next shift" sub-panel under the countdown. */
.countdown-next {
  margin-top: 0.9rem;
  padding-top: 0.8rem;
  border-top: 1px solid var(--line);
  text-align: left;
}
.countdown-next-kicker {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 0.3rem;
}
.countdown-next-line {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.countdown-next-type { font-weight: 700; font-size: 1rem; }
.countdown-next-time { font-size: 0.9rem; font-variant-numeric: tabular-nums; }
/* "Time between shifts" bar: fills from the previous shift's end to the
   next shift's start, so it grows across off days. */
.countdown-next-bar-cap { margin-top: 0.55rem; font-weight: 600; }
.countdown-next-bar {
  height: 22px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 20%, var(--panel-2));
  border: 1px solid color-mix(in srgb, var(--accent) 45%, var(--line));
  overflow: hidden;
  margin-top: 0.3rem;
}
.countdown-next-bar-fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: var(--accent);
  transition: width 1s linear;
}

/* Hero location line. */
.hero-loc { font-size: 0.95rem; margin-top: 0.4rem; color: var(--loc, var(--muted)); font-weight: 600; }

/* Location chip (stationing desk). */
.chip-loc {
  color: var(--loc, var(--info));
  background: color-mix(in srgb, var(--loc, var(--info)) 30%, transparent);
  border-color: color-mix(in srgb, var(--loc, var(--info)) 45%, transparent);
  font-weight: 500;
}

/* Station coverage board. */
.coverage-card { }
.coverage-note { margin-bottom: 0.75rem; }
.coverage-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.6rem;
}
.coverage-station {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.6rem 0.7rem;
}
.coverage-station.cov-empty { opacity: 0.7; border-style: dashed; }
/* Station name: a prominent header so you can tell at a glance which
   station each card is. Each station gets its own colour (via --loc) and
   an underline in that colour, separating it from the people below. */
.cov-loc {
  padding-bottom: 0.4rem;
  margin-bottom: 0.5rem;
  border-bottom: 2px solid var(--loc, var(--accent));
}
.cov-loc-name {
  font-weight: 700;
  font-size: 1.02rem;
  color: var(--loc, var(--accent));
  overflow-wrap: anywhere;
}
.cov-people { display: flex; flex-wrap: wrap; gap: 0.2rem; }
.cov-none { font-size: 0.85rem; }

/* Empty / no-data states. */
.current-empty { text-align: center; padding: 2rem; }

/* Calendar: subtly highlight the current user's ("me") row with a faint
   accent tint laid over each cell, so it's easy to spot your own shifts.
   The cells keep their own colours; this just tints them. Adapts to the
   active theme via --accent. */
.matrix tbody tr.row-me .matrix-emp,
.matrix tbody tr.row-me .matrix-cell {
  background-image: linear-gradient(
    color-mix(in srgb, var(--accent) 8%, transparent),
    color-mix(in srgb, var(--accent) 8%, transparent));
  /* Top/bottom edges: the row band that crosses the today column at the
     current user's current-date cell. */
  border-top: 2px solid var(--accent);
  border-bottom: 2px solid var(--accent);
}

/* Employee switcher (single-user tool: no login, just whose roster to view) */
.who-form { display: inline-flex; }
.who-select {
  font: inherit;
  color: inherit;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.3rem 0.45rem;
  max-width: 11rem;
  cursor: pointer;
}
