/* Mobile-first styling for the nurse-roster interface.
 *
 * Designed for a phone held in one hand by a reader who may not read much English:
 * large tap targets, high-contrast colour-coded shift cells, an icon in every cell,
 * and a key. Cell colours are keyed by .cell-<css_class>, where css_class comes from
 * web/display.py — the one source of truth for how a shift looks. */

/* ===========================================================================
   Design tokens (UI elevation). Three layers: primitives → semantic roles →
   legacy aliases. Components read SEMANTIC tokens (or the aliases); raw hex
   never appears below this block. System font stack and no webfont import are
   deliberate: pages must stay light on weak networks and work offline.
   =========================================================================== */
:root {
  /* --- Primitives ------------------------------------------------------- */
  --blue-800: #0f4c87;
  --blue-700: #11589d;
  --blue-600: #1668b8; /* the brand blue (PWA theme colour) */
  --blue-100: #d9e8f7;
  --blue-50: #eef4fb;
  --grey-900: #1f2933;
  --grey-600: #5b6470; /* 4.9:1 on white — muted text stays readable */
  --grey-300: #d7dbe0;
  --grey-100: #e7eaee;
  --grey-50: #f7f8fa;
  --red-700: #b3261e;
  --amber-100: #ffe6c9;
  --sky-100: #d9ecff;

  /* --- Semantic roles ---------------------------------------------------- */
  --color-bg: var(--grey-50);
  --color-surface: #ffffff;
  --color-ink: var(--grey-900);
  --color-ink-muted: var(--grey-600);
  --color-border: var(--grey-300);
  --color-primary: var(--blue-600);
  --color-primary-press: var(--blue-700);
  --color-on-primary: #ffffff;
  --color-primary-tint: var(--blue-50);
  --color-danger: var(--red-700);
  --color-warn-bg: var(--amber-100);
  --color-info-bg: var(--sky-100);

  /* --- Rhythm (4px scale), shape, depth, motion, focus ------------------- */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 14px;
  --shadow-1: 0 1px 3px rgba(31, 41, 51, 0.12);
  --shadow-2: 0 2px 6px rgba(22, 104, 184, 0.35);
  --dur-fast: 150ms;
  --ease-out: cubic-bezier(0.2, 0, 0, 1);
  --focus-ring: 0 0 0 3px rgba(22, 104, 184, 0.45);
  --tap-min: 44px; /* WCAG/HIG minimum touch target */

  /* --- Legacy aliases (older rules below read these names) --------------- */
  --bg: var(--color-bg);
  --ink: var(--color-ink);
  --muted: var(--color-ink-muted);
  --line: var(--color-border);
  --accent: var(--color-primary);

  /* Shift cell colours — the vocabulary the nurse-in-charge validated.
     Values unchanged; only referenced through these tokens. */
  --am: #fff3c4; /* morning  — warm yellow */
  --pm: #cfe6ff; /* afternoon — cool blue */
  --full: #c4e7c4; /* full day — green */
  --office: #e4d6f5; /* SRN 4–7 — violet */
  --rest: #e7eaee; /* rest day — grey */
  --leave: #ffd9b0; /* on leave — peach */
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 17px;
  line-height: 1.55; /* readable measure on a phone (was a tight 1.4) */
  color: var(--ink);
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
}

/* Mobile interaction baseline: no 300ms tap delay, no grey flash on tap — feedback
 * comes from each control's own :active/:focus state instead. */
a,
button,
input,
select,
.tile,
.cell.io,
.day-toggle {
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

/* Visible keyboard-focus ring on every interactive element. The app defined a
 * --focus-ring token but used it in only one place; without this, keyboard and
 * screen-reader users can't see where they are (accessibility, CRITICAL). */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
[tabindex]:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
  border-radius: var(--radius-sm);
}

/* --- Top bar ------------------------------------------------------------- */

.topbar {
  background: var(--accent);
  padding: 0.9rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.home-link {
  color: #fff;
  font-size: 1.2rem;
  font-weight: 700;
  text-decoration: none;
}

/* Language toggle: the language's own name, current one highlighted. */
.lang-switch {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  font-size: 0.85rem;
  font-weight: 600;
}

.lang-switch a,
.lang-switch .lang-current {
  display: inline-flex;
  align-items: center;
  min-height: var(--tap-min);
  padding-inline: var(--space-2);
}

.lang-switch a {
  color: #cfe0f3;
  text-decoration: none;
}

.lang-switch .lang-current {
  color: #fff;
  text-decoration: underline;
}

main {
  padding: 1rem;
  max-width: 900px;
  margin: 0 auto;
}

h1 {
  font-size: 1.5rem;
  margin: 0.3rem 0 1rem;
}

h2 {
  font-size: 1.15rem;
  margin: 1.4rem 0 0.6rem;
}

.subtitle {
  margin-top: -0.6rem;
  color: var(--muted);
}

.empty {
  color: var(--muted);
  font-style: italic;
}

/* --- Card / list links (facilities, saved weeks) ------------------------- */

.cards {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 0.6rem;
}

.card a {
  display: block;
  padding: 1rem;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  text-decoration: none;
  color: var(--ink);
  font-weight: 600;
}

.card a:active {
  background: #eef4fb;
}

/* --- Team list ----------------------------------------------------------- */

.team {
  list-style: none;
  padding: 0;
  margin: 0;
}

.team li {
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--line);
}

.rank {
  display: inline-block;
  min-width: 2.6rem;
  font-weight: 700;
  color: var(--accent);
}

/* Rank heading above each team block (SRN / RN / EN, highest first). The roster
 * is read grouped by rank, so the team list is too. */
.team-group-label {
  margin: var(--space-4) 0 var(--space-1);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--accent);
}

.team-group-label:first-child {
  margin-top: 0;
}

/* --- Roster grid --------------------------------------------------------- */

/* The grid can be wider than a phone, so it scrolls sideways inside this box
 * while the rest of the page stays put. */
.grid-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

table.roster {
  border-collapse: collapse;
  width: 100%;
  /* Fixed layout makes the 7 days share the width and fit a phone with no
   * sideways scroll: day columns shrink, names wrap, tags stay readable. */
  table-layout: fixed;
}

table.roster th,
table.roster td {
  border: 1px solid var(--line);
  text-align: center;
  padding: 0.25rem 0.15rem;
  white-space: nowrap;
}

table.roster thead th {
  background: #eef1f5;
  font-size: 0.85rem;
  position: sticky;
  top: 0;
}

/* Rank separator row inside the grid: a slim labelled band between rank blocks
 * (SRN / RN / EN). Left-aligned and quiet — it groups, it doesn't shout. */
table.roster tr.rank-sep td {
  text-align: left;
  background: #eef1f5;
  color: var(--accent);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 0.15rem 0.4rem;
  position: sticky;
  left: 0;
}

/* Nurse name stays visible while the days scroll under the finger. */
.name-col {
  position: sticky;
  left: 0;
  background: #fff;
  text-align: left;
  font-weight: 600;
  width: 4.7rem;
  font-size: 0.82rem;
  line-height: 1.15;
  box-shadow: 1px 0 0 var(--line);
}

/* Higher specificity than the table-wide `white-space: nowrap`, so long names
 * wrap inside the narrow name column instead of forcing the grid wider. */
table.roster .name-col {
  white-space: normal;
  word-break: break-word;
}

thead .name-col {
  background: #eef1f5;
}

.hrs-col {
  width: 2.6rem;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--muted);
}

/* Shift cells are plain white; the shift shows as a small tinted "tag" on the
 * label, so colour is an accent rather than a full-block flood. Off recedes to
 * quiet text. (This look was designed and approved in the mockups.) */
.cell {
  min-width: 0;
  padding: 0.35rem 0.12rem;
  background: #fff;
}

.cell .lab {
  display: inline-block;
  min-width: 0;
  padding: 0.28rem 0.3rem;
  border-radius: 7px;
  font-size: 0.72rem;
  font-weight: 800;
}

.cell-full .lab {
  background: #d9f0e2;
  color: #1c8a4c;
}
.cell-am .lab {
  background: #ffedbf;
  color: #946400;
}
.cell-pm .lab {
  background: #dbe7ff;
  color: #2b5fc4;
}
.cell-office .lab {
  background: #e6eaf0;
  color: #4a5a6b;
}
.cell-leave .lab {
  background: #efe1fb;
  color: #7b3fc4;
}

/* Rest recedes to quiet text; a nurse-requested rest is the same, faintly
 * outlined so it still reads as "she asked for this one". */
.cell-rest .lab,
.cell-rest-req .lab {
  background: none;
  color: #9aa1a9;
  font-weight: 600;
}
.cell-rest-req .lab {
  outline: 1.5px dashed #cfd4da;
  outline-offset: -2px;
}

/* Day headers show the date number under the day name (calendar style). */
.roster thead th .dow {
  display: block;
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--muted);
  line-height: 1.15;
}
.roster thead th .dnum {
  display: block;
  font-size: 0.95rem;
  font-weight: 800;
  line-height: 1.2;
}

/* --- Legend -------------------------------------------------------------- */

.legend ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 0.4rem;
}

.legend li {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.swatch {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.2rem;
  height: 2.2rem;
  border: 1px solid var(--line);
  border-radius: 8px;
}

/* The legend swatch shows each shift's tag colour. */
.legend .swatch.cell-full {
  background: #d9f0e2;
}
.legend .swatch.cell-am {
  background: #ffedbf;
}
.legend .swatch.cell-pm {
  background: #dbe7ff;
}
.legend .swatch.cell-office {
  background: #e6eaf0;
}
.legend .swatch.cell-leave {
  background: #efe1fb;
}
.legend .swatch.cell-rest,
.legend .swatch.cell-rest-req {
  background: #edeff2;
}

/* ---------------------------------------------------------------------------
 * W2: generate flow — buttons, the week stepper, the infeasible banner.
 * Promoted from the approved mockups now that the generate pages are real.
 * ------------------------------------------------------------------------- */

.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  min-height: 56px;
  padding: 0.9rem 1rem;
  border: none;
  border-radius: 14px;
  font: inherit;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 2px 6px rgba(22, 104, 184, 0.35);
}

.btn-secondary {
  background: #fff;
  color: var(--accent);
  border: 1.5px solid var(--accent);
}

.action-bar {
  margin-top: 1.2rem;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

/* Success/info confirmation after an action (Flask flash). role="status" so a
 * screen reader announces it. Sits at the top of <main>, above the page. */
.flash {
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-4);
  font-weight: 600;
}

.flash-success {
  background: #e7f4ea;
  color: #1f6b3a; /* ~7:1 on the green tint — comfortably AA */
}

.flash-info {
  background: var(--color-info-bg);
  color: var(--blue-800);
}

.section-head {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin: 1.2rem 0 0.5rem;
}

.muted {
  color: var(--muted);
}

/* Week chooser:  −  [ week range ]  + */
.stepper {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 1rem 0;
}

.stepper .step {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 1.5px solid var(--accent);
  background: #fff;
  color: var(--accent);
  font-size: 1.6rem;
  font-weight: 700;
  text-decoration: none;
}

.stepper .week {
  flex: 1;
  text-align: center;
}

.stepper .week .range {
  font-size: 1.2rem;
  font-weight: 800;
}

.stepper .week .note {
  font-size: 0.85rem;
  color: var(--muted);
}

/* Honest "can't be staffed" banner. */
.banner-warn {
  display: flex;
  gap: 0.6rem;
  background: #ffe6c9;
  border-radius: 12px;
  padding: 0.9rem 1rem;
  font-weight: 700;
  margin: 1rem 0;
}

.banner-warn .ico {
  font-size: 1.3rem;
}

.banner-warn a {
  color: var(--accent);
}

/* ---------------------------------------------------------------------------
 * W2b: the "who's off" input grid + leave-type bottom sheet.
 * Tap once = requested off, twice = leave (a sheet picks the kind).
 * ------------------------------------------------------------------------- */

.tap-help {
  font-weight: 600;
}

/* Input cells: empty = a faint dot (left to the roster); marks are visible tags. */
.io {
  cursor: pointer;
  color: #c2c7cd;
}

.is-off .lab {
  background: #e6e9ed;
  color: #5a6470;
}

.is-leave .lab {
  background: #efe1fb;
  color: #7b3fc4;
}

/* Carry-over day toggles (carry_over.html): each cell is a tap target whose chip
 * fills with the accent when the nurse worked that day. */
.io-check {
  padding: 0.2rem 0.1rem;
}

.day-toggle {
  display: block;
  cursor: pointer;
}

.day-toggle input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}

.day-toggle-box {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 44px; /* WCAG/HIG minimum touch target */
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--muted);
  background: #fff;
}

.day-toggle input:checked + .day-toggle-box {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--color-on-primary);
}

.day-toggle input:focus-visible + .day-toggle-box {
  box-shadow: var(--focus-ring);
}

.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;
}

.sheet-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 32, 0.4);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 50;
}

.sheet-backdrop[hidden] {
  display: none;
}

/* "Generating…" cover shown during the synchronous solve (generate.html). */
.gen-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 32, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: var(--space-4);
}

.gen-overlay[hidden] {
  display: none;
}

.gen-overlay__box {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  padding: var(--space-8) var(--space-6);
  max-width: 320px;
  width: 100%;
  text-align: center;
  box-shadow: 0 10px 40px rgba(15, 23, 32, 0.25);
}

.gen-overlay__title {
  margin: var(--space-4) 0 var(--space-2);
  font-weight: 600;
}

.gen-overlay__hint {
  margin: 0;
  font-size: 0.9rem;
}

.spinner {
  width: 36px;
  height: 36px;
  margin: 0 auto;
  border: 3px solid var(--color-primary-tint);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.sheet {
  width: 100%;
  max-width: 480px;
  background: var(--bg);
  border-radius: 20px 20px 0 0;
  padding: 1rem 1rem 1.4rem;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.25);
}

.sheet-title {
  font-weight: 800;
  font-size: 1.05rem;
  margin: 0.2rem 0 0.9rem;
}

.sheet-opt {
  display: block;
  width: 100%;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.9rem;
  margin-bottom: 0.5rem;
  font: inherit;
  font-size: 1rem;
  font-weight: 600;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.sheet-opt.clear {
  color: var(--muted);
  border-style: dashed;
  margin-top: 0.3rem;
}

/* --- Forms & team management (W3) ---------------------------------------- */

/* "+ Add facility / nurse" — a low-key full-width entry point under a list. */
.add-link {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  min-height: 52px;
  margin-top: 0.9rem;
  border: 1.5px dashed var(--accent);
  border-radius: 14px;
  color: var(--accent);
  font-weight: 700;
  text-decoration: none;
}

.add-link:active {
  background: #eef4fb;
}

.form {
  margin-top: 0.5rem;
}

.field {
  display: block;
  margin-bottom: 1rem;
}

.field-label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.35rem;
}

.field-hint {
  display: block;
  margin-top: 0.35rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.form input[type="text"],
.form input[type="number"],
.form input[type="email"],
.form input[type="password"],
.form select {
  display: block;
  width: 100%;
  min-height: 52px;
  padding: 0.7rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  font: inherit;
  background: #fff;
  color: var(--ink);
}

.form input:focus,
.form select:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

/* A big, easy checkbox row for the midwife flag. */
.check {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  min-height: 52px;
  font-weight: 600;
}

.check input[type="checkbox"] {
  width: 1.5rem;
  height: 1.5rem;
}

/* A nurse row that taps through to its edit page. */
.team li.person-row {
  padding: 0;
}

.person-link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.7rem 0;
  text-decoration: none;
  color: var(--ink);
}

.person-link:active {
  background: var(--color-primary-tint);
}

.person-link .person-name {
  flex: 1;
  font-weight: 600;
}

.person-link .chev {
  color: var(--muted);
  font-size: 1.3rem;
}

/* Destructive action (remove from team) — outlined in a warning red. */
.btn.danger {
  color: #b42318;
  border-color: #b42318;
}

.danger-form {
  margin-top: 0.8rem;
}

/* --- Auth (P3): sign in / sign up / sign out ------------------------------ */

/* Informational banner (e.g. "confirm your email") — calmer than banner-warn. */
.banner-info {
  display: flex;
  gap: 0.6rem;
  background: #d9ecff;
  border-radius: 12px;
  padding: 0.9rem 1rem;
  font-weight: 700;
  margin: 1rem 0;
}

.banner-info .ico {
  font-size: 1.3rem;
}

/* The sign-out control sits in the coloured topbar, styled as a quiet link. */
.logout-form {
  margin: 0;
}

.btn-link {
  background: none;
  border: none;
  padding: 0.25rem 0;
  color: #fff;
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: underline;
  cursor: pointer;
}

/* ===========================================================================
   UI elevation layer: interaction quality, the facility hub, coverage strip,
   empty states, icons, and print. Sits after the base rules so refinements
   override without rewriting the validated grid styles above.
   =========================================================================== */

/* --- Interaction quality --------------------------------------------------- */

/* One visible focus style everywhere — keyboard and switch-access users. */
:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
  border-radius: var(--radius-sm);
}

/* Press feedback within ~100ms; transform-only so layout never shifts. */
.btn,
.card a,
.person-link,
.add-link {
  transition:
    transform var(--dur-fast) var(--ease-out),
    background-color var(--dur-fast) var(--ease-out),
    box-shadow var(--dur-fast) var(--ease-out);
}

.btn:active,
.card a:active {
  transform: scale(0.98);
}

.btn-primary:active {
  background: var(--color-primary-press);
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* Inline SVG icons: align to text, inherit colour, never shrink. */
.icon {
  flex-shrink: 0;
  vertical-align: -0.18em;
}

/* --- Cards and list rows as tappable rows with icon + chevron ------------- */

.card a {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-height: var(--tap-min);
}

.card a .icon {
  color: var(--color-primary);
}

.chev {
  margin-left: auto;
  color: var(--color-ink-muted);
  display: inline-flex;
}

.add-link .icon {
  color: currentColor;
}

/* --- Facility hub (design brief 4.2) --------------------------------------- */

.section-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-3);
}

.quiet-link {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  color: var(--color-primary);
  font-weight: 600;
  font-size: 0.95rem;
  text-decoration: none;
  min-height: var(--tap-min);
}

/* The one big primary action: full-width, two-line (verb + the actual week). */
.btn-hero {
  margin: var(--space-6) 0;
  min-height: 64px;
  text-align: left;
  justify-content: flex-start;
  gap: var(--space-3);
  padding-inline: var(--space-4);
}

.btn-hero-text {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
}

.btn-hero-sub {
  font-weight: 500;
  font-size: 0.85rem;
  opacity: 0.9;
}

/* The hub "this week" card: a calm surface holding the coverage strip. */
.card-lg {
  background: var(--color-surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  margin-bottom: var(--space-4);
}

.eyebrow {
  margin: 0 0 var(--space-1);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.hub-week-range {
  margin: 0 0 var(--space-3);
  font-weight: 600;
  font-size: 1.05rem;
}

/* First-run onboarding guide: a 3-step checklist on a facility with no roster. */
.onboard-lead {
  margin: 0 0 var(--space-4);
}

.steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.step {
  display: flex;
  gap: var(--space-3);
  align-items: flex-start;
}

.step-num {
  flex-shrink: 0;
  width: 1.6rem;
  height: 1.6rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 700;
  background: var(--color-primary-tint);
  color: var(--color-primary);
}

.step.is-done .step-num {
  background: var(--color-primary);
  color: var(--color-on-primary);
}

.step-text {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  padding-top: 0.1rem;
}

.step-label {
  font-weight: 600;
}

.step-meta {
  font-size: 0.9rem;
  color: var(--muted);
}

.step-cta {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  color: var(--color-primary);
  font-weight: 600;
  text-decoration: none;
  min-height: var(--tap-min);
}

/* Hub navigation tiles: Team / Past weeks (and Settings) each lead to their own
 * page, keeping the hub focused on generating the week. */
.tiles {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-3);
  margin-top: var(--space-6);
}

.tile {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  background: var(--color-surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  text-decoration: none;
  color: var(--ink);
  min-height: var(--tap-min);
}

.tile:active {
  background: var(--color-primary-tint);
}

.tile-ico {
  color: var(--color-primary);
}

.tile-label {
  font-weight: 600;
}

.tile-meta {
  font-size: 0.85rem;
  color: var(--muted);
}

/* Back link on subpages (Team, Past weeks, …). The shared chevron icon points
 * right, so flip it to point back. */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  color: var(--color-primary);
  font-weight: 600;
  text-decoration: none;
  min-height: var(--tap-min);
}

.back-link .icon {
  transform: rotate(180deg);
}

/* Compact preview grid on the hub: smaller, denser, hours column hidden. */
.roster-compact {
  font-size: 0.78rem;
}

.roster-compact .cell .lab {
  font-size: 0.62rem;
  padding: 0.1rem 0.2rem;
}

.roster-compact .name-col {
  font-size: 0.72rem;
}

/* --- Empty states: intentional, never a bare sentence --------------------- */

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  text-align: center;
  background: var(--color-surface);
  border: 1px dashed var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-8) var(--space-4);
  margin: var(--space-4) 0;
  color: var(--color-ink-muted);
}

.empty-state .icon {
  color: var(--color-primary);
}

.empty-state-title {
  margin: 0;
  font-weight: 700;
  color: var(--color-ink);
}

.empty-state-small {
  padding: var(--space-4);
  flex-direction: row;
  justify-content: center;
}

/* --- Coverage at a glance (roster page) ------------------------------------ */

.coverage-strip {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: var(--space-1);
}

.coverage-day {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-1);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: var(--space-2) 0;
}

.coverage-dow {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--color-ink-muted);
  text-transform: uppercase;
}

.coverage-block {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-size: 0.85rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.coverage-block .icon {
  color: var(--color-ink-muted);
}

/* At the configured floor: highlighted with colour AND a heavier weight —
   never colour alone. */
.coverage-block.at-floor {
  color: var(--color-danger);
  font-weight: 800;
}

.coverage-note {
  font-size: 0.85rem;
  margin-top: var(--space-2);
}

/* --- Print / share: the grid becomes the posted off-duty sheet ------------- */

@media print {
  .topbar,
  .no-print,
  .add-link,
  .logout-form,
  .subtitle ~ .action-bar {
    display: none !important;
  }

  body {
    background: #fff;
  }

  main {
    max-width: none;
    padding: 0;
  }

  /* Keep the colour tags on paper — they ARE the vocabulary. */
  .cell .lab,
  .swatch {
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
  }

  .grid-scroll {
    overflow: visible;
  }
}
