/* ==========================================================================
   Hours App UI — colour tokens and shared components (redesign, stage 1)
   Only pages that set {% set dark_ready = true %} follow the theme choice;
   every other page renders with data-theme="light" until it is converted.
   ========================================================================== */

/* --- Tokens: light --- */
/* Midnight (owner 2026-10-19): plain greys, white cards, one main colour #22406E.
   Plan: docs/superpowers/plans/2026-10-19-midnight-theme.md */
:root,
[data-theme="light"] {
  --ui-page: #F2F2F2;
  --ui-card: #FFFFFF;
  --ui-raised: #FFFFFF;
  --ui-line: #E4E4E4;
  --ui-text: #1F1F1F;
  --ui-scrim: #0A101C;
  --ui-muted: #636363;
  --ui-brand: #22406E;
  --ui-on-brand: #FFFFFF;
  --ui-red-text: #22406E;
  --ui-brand-soft: #E5EFFF;
  --ui-gold: #22406E;
  --ui-track: #DCDCDC;
  --ui-knob: #FFFFFF;
  --ui-hover: #EBEBEB;
  --ui-waiting-bg: #FEF3C7;
  --ui-waiting-text: #92400E;
  --ui-problem-bg: #FEE2E2;
  --ui-problem-text: #991B1B;
  --ui-checked-bg: #DBEAFE;
  --ui-checked-text: #1E40AF;
  --ui-done-bg: #DCFCE7;
  --ui-done-text: #166534;
  --ui-finished-bg: #EBEBEB;
  --ui-finished-text: #4A4A4A;
  --ui-select-bg: #22406E;
  --ui-select-text: #FFFFFF;
  --ui-hero-text: #FFFFFF;
  --ui-shadow: 0 12px 40px rgba(0, 0, 0, 0.16);
  --ui-card-shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 6px 20px rgba(0, 0, 0, 0.05);
  --ui-float-shadow: 0 10px 30px rgba(0, 0, 0, 0.12);
  --ui-sheet-shadow: 0 12px 48px rgba(0, 0, 0, 0.45);
  --ui-fill: rgba(0, 0, 0, 0.06);
  --ui-pill: rgba(0, 0, 0, 0.07);
  --ui-glass-top: rgba(242, 242, 242, 0.72);
  --ui-glass-tab: rgba(255, 255, 255, 0.72);
  --ui-bar-edge: rgba(0, 0, 0, 0.12);
  --ui-brand-grad: linear-gradient(180deg, #2A4877 0%, #1A3865 100%);
  --ui-button-glow: 0 6px 18px rgba(34, 64, 110, 0.32);
  --ui-hero-bg: linear-gradient(135deg, #384F81 0%, #22406E 55%, #042F59 100%);
  --ui-hero-muted: rgba(255, 255, 255, 0.78);
  --ui-hero-line: rgba(255, 255, 255, 0.18);
  --ui-hero-warn: #F2C879;
  --ui-hero-warn-text: #3A2800;
  --ui-hero-warn-ink: #8A5A00;
  color-scheme: light;
}

/* --- Tokens: dark --- */
/* Near-black, cards lift by tone; Midnight lightened so it shows on black. */
[data-theme="dark"] {
  --ui-page: #111111;
  --ui-card: #1E1E1E;
  --ui-raised: #2A2A2A;
  --ui-line: #2E2E2E;
  --ui-text: #EEEEEE;
  --ui-scrim: #000000;
  --ui-muted: #B4B4B4;
  --ui-brand: #365585;
  --ui-on-brand: #FFFFFF;
  --ui-red-text: #83A6DB;
  --ui-brand-soft: #1A2E4C;
  --ui-gold: #6687BB;
  --ui-track: #3A3A3A;
  --ui-knob: #EEEEEE;
  --ui-hover: #2A2A2A;
  --ui-waiting-bg: #3A2A0C;
  --ui-waiting-text: #FCD34D;
  --ui-problem-bg: #3B1215;
  --ui-problem-text: #FCA5A5;
  --ui-checked-bg: #172554;
  --ui-checked-text: #93C5FD;
  --ui-done-bg: #0F2E1D;
  --ui-done-text: #86EFAC;
  --ui-finished-bg: #2A2A2A;
  --ui-finished-text: #D4D4D4;
  --ui-select-bg: #6687BB;
  --ui-select-text: #1A1A1A;
  --ui-hero-text: #FFFFFF;
  --ui-shadow: 0 12px 40px rgba(0, 0, 0, 0.6);
  --ui-card-shadow: none;
  --ui-float-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  --ui-sheet-shadow: 0 12px 48px rgba(0, 0, 0, 0.6);
  --ui-fill: rgba(255, 255, 255, 0.08);
  --ui-pill: rgba(255, 255, 255, 0.12);
  --ui-glass-top: rgba(17, 17, 17, 0.72);
  --ui-glass-tab: rgba(42, 42, 42, 0.72);
  --ui-bar-edge: rgba(255, 255, 255, 0.08);
  --ui-brand-grad: linear-gradient(180deg, #3E5E8E 0%, #2E4D7C 100%);
  --ui-button-glow: 0 6px 18px rgba(54, 85, 133, 0.28);
  --ui-hero-bg: linear-gradient(135deg, #4D6598 0%, #365585 55%, #1C446F 100%);
  --ui-hero-muted: rgba(255, 255, 255, 0.78);
  --ui-hero-line: rgba(255, 255, 255, 0.18);
  --ui-hero-warn: #F2C879;
  --ui-hero-warn-text: #3A2800;
  --ui-hero-warn-ink: #8A5A00;
  color-scheme: dark;
}

/* --- Tokens: follow the device (same values as dark) --- */
@media (prefers-color-scheme: dark) {
  [data-theme="auto"] {
    --ui-page: #111111;
    --ui-card: #1E1E1E;
    --ui-raised: #2A2A2A;
    --ui-line: #2E2E2E;
    --ui-text: #EEEEEE;
    --ui-scrim: #000000;
    --ui-muted: #B4B4B4;
    --ui-brand: #365585;
    --ui-on-brand: #FFFFFF;
    --ui-red-text: #83A6DB;
    --ui-brand-soft: #1A2E4C;
    --ui-gold: #6687BB;
    --ui-track: #3A3A3A;
    --ui-knob: #EEEEEE;
    --ui-hover: #2A2A2A;
    --ui-waiting-bg: #3A2A0C;
    --ui-waiting-text: #FCD34D;
    --ui-problem-bg: #3B1215;
    --ui-problem-text: #FCA5A5;
    --ui-checked-bg: #172554;
    --ui-checked-text: #93C5FD;
    --ui-done-bg: #0F2E1D;
    --ui-done-text: #86EFAC;
    --ui-finished-bg: #2A2A2A;
    --ui-finished-text: #D4D4D4;
    --ui-select-bg: #6687BB;
    --ui-select-text: #1A1A1A;
    --ui-hero-text: #FFFFFF;
    --ui-shadow: 0 12px 40px rgba(0, 0, 0, 0.6);
    --ui-card-shadow: none;
    --ui-float-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    --ui-sheet-shadow: 0 12px 48px rgba(0, 0, 0, 0.6);
    --ui-fill: rgba(255, 255, 255, 0.08);
    --ui-pill: rgba(255, 255, 255, 0.12);
    --ui-glass-top: rgba(17, 17, 17, 0.72);
    --ui-glass-tab: rgba(42, 42, 42, 0.72);
    --ui-bar-edge: rgba(255, 255, 255, 0.08);
    --ui-brand-grad: linear-gradient(180deg, #3E5E8E 0%, #2E4D7C 100%);
    --ui-button-glow: 0 6px 18px rgba(54, 85, 133, 0.28);
    --ui-hero-bg: linear-gradient(135deg, #4D6598 0%, #365585 55%, #1C446F 100%);
    --ui-hero-muted: rgba(255, 255, 255, 0.78);
    --ui-hero-line: rgba(255, 255, 255, 0.18);
    --ui-hero-warn: #F2C879;
    --ui-hero-warn-text: #3A2800;
    --ui-hero-warn-ink: #8A5A00;
    color-scheme: dark;
  }
}

/* --- Page canvas --- */
[hidden] { display: none !important; }
body { margin: 0; line-height: 1.5; -webkit-text-size-adjust: 100%; }
h1, h2, h3, h4, h5, h6 { margin-top: 0; line-height: 1.2; }
p, ul, ol, dl { margin-top: 0; margin-bottom: 1rem; }
ul, ol { padding-left: 2rem; }
@media (prefers-reduced-motion: no-preference) { :root { scroll-behavior: smooth; } }
button, input, select, textarea { font: inherit; }
input[type="checkbox"], input[type="radio"] { margin: 0; }
table { border-collapse: collapse; }
img, svg { vertical-align: middle; }
html[data-theme] body {
  background: var(--ui-page);
  color: var(--ui-text);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* --- Top bar (keeps the class app-header, which style.css also styles) --- */
.app-header.app-topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 20px;
  min-height: 56px;
  padding: 0 max(16px, env(safe-area-inset-right)) 0 max(16px, env(safe-area-inset-left));
  background: var(--ui-glass-top);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  color: var(--ui-text);
  border-bottom: 1px solid transparent;
  box-shadow: none;
  transition: border-color 0.2s;
}
/* static/frame.js sets data-scrolled once the page moves under the bar. */
html[data-scrolled] .app-header.app-topbar { border-bottom-color: var(--ui-bar-edge); }
.app-brand { display: inline-flex; align-items: center; gap: 8px; flex: 0 0 auto; text-decoration: none; }
.app-brand img { display: block; height: 28px; width: auto; }
.app-brand .app-mark { height: 24px; }
.app-wordmark { font-size: 19px; font-weight: 600; letter-spacing: -0.01em; color: var(--ui-text); }
.app-tabs { display: flex; align-self: stretch; gap: 4px; }
.app-tab {
  display: inline-flex; align-items: center; padding: 0 12px;
  font-size: 14px; font-weight: 500; color: var(--ui-muted); text-decoration: none;
  border-bottom: 2px solid transparent;
}
@media (hover: hover) { .app-tab:hover { color: var(--ui-text); } }
.app-tab[aria-current="page"] { color: var(--ui-red-text); font-weight: 600; border-bottom-color: var(--ui-red-text); }
@media (hover: hover) { .app-tab[aria-current="page"]:hover { color: var(--ui-red-text); } }

/* --- Account menu --- */
.app-account { position: relative; margin-left: auto; }
.app-account > summary { list-style: none; cursor: pointer; }
.app-account > summary::-webkit-details-marker { display: none; }
.app-avatar {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--ui-fill); color: var(--ui-text);
  font-size: 14px; font-weight: 600;
}
.app-avatar:focus-visible { outline: 2px solid var(--ui-red-text); outline-offset: 2px; }
.app-account-panel {
  position: absolute; top: calc(100% + 8px); right: 0; z-index: 60;
  width: min(300px, calc(100vw - 32px));
  padding: 8px;
  background: var(--ui-raised); color: var(--ui-text);
  border: 1px solid transparent; border-radius: 14px;
  box-shadow: var(--ui-shadow);
}
.app-account-who { padding: 8px 10px 10px; border-bottom: 1px solid var(--ui-line); margin-bottom: 6px; }
.app-account-who strong { display: block; font-size: 15px; font-weight: 600; }
.app-account-who span { font-size: 13px; color: var(--ui-muted); }
.app-account-link,
.app-account-button {
  display: flex; align-items: center; gap: 10px; width: 100%;
  min-height: 44px; padding: 0 10px; border: 0; border-radius: 10px;
  background: none; color: var(--ui-text); text-align: left; text-decoration: none;
  font: inherit; font-size: 14px; cursor: pointer;
}
@media (hover: hover) {
  .app-account-link:hover,
  .app-account-button:hover { background: var(--ui-hover); color: var(--ui-text); }
}
.app-account-group { margin: 0; padding: 8px 10px; border-top: 1px solid var(--ui-line); }
.app-account-label { display: block; margin-bottom: 6px; font-size: 12px; color: var(--ui-muted); }
.ui-segmented { display: flex; gap: 4px; padding: 3px; border-radius: 10px; background: var(--ui-hover); }
body .ui-segmented button {
  flex: 1 1 0; min-height: 36px; padding: 0 6px; border: 0; border-radius: 8px;
  background: transparent; color: var(--ui-muted);
  font: inherit; font-size: 13px; cursor: pointer;
}
body .ui-segmented button[aria-pressed="true"] {
  background: var(--ui-select-bg); color: var(--ui-select-text); font-weight: 600;
}

.skip-link {
  position: absolute; top: -48px; left: 0; z-index: 100;
  padding: 10px 16px; border-radius: 0 0 10px 0;
  background: var(--ui-brand); color: var(--ui-on-brand);
  font-weight: 600; text-decoration: none;
}
.skip-link:focus { top: 0; color: var(--ui-on-brand); }

/* --- Bottom tab bar (phones) --- */
.app-bottom-tabs { display: none; }
@media (max-width: 767.98px) {
  .app-tabs { display: none; }
  /* A floating glass bar, 14px from the sides and 10px above the home bar; its top edge is 75px
     up (10 + 6 + 52 + 6 + the 1px edge), so anything fixed above it sits at 76px or more. */
  .app-bottom-tabs {
    position: fixed; right: 14px; bottom: calc(10px + env(safe-area-inset-bottom)); left: 14px; z-index: 45;
    display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr);
    padding: 6px;
    background: var(--ui-glass-tab);
    -webkit-backdrop-filter: saturate(180%) blur(24px);
    backdrop-filter: saturate(180%) blur(24px);
    border: 0.5px solid var(--ui-bar-edge); border-radius: 30px;
    box-shadow: var(--ui-float-shadow);
    transform-origin: 50% 100%;
  }
  .app-bottom-tab {
    position: relative; z-index: 0;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
    min-height: 52px; border-radius: 24px;
    font-size: 12px; font-weight: 500; line-height: 1.2; text-align: center;
    color: var(--ui-muted); text-decoration: none;
  }
  @media (hover: hover) { .app-bottom-tab:hover { color: var(--ui-muted); } }
  .app-bottom-tab .ui-icon { width: 22px; height: 22px; }
  /* The current tab: its icon and word in the accent, on a grey pill. */
  .app-bottom-tab[aria-current="page"] { color: var(--ui-red-text); font-weight: 600; }
  .app-bottom-tab[aria-current="page"]::before {
    content: ""; position: absolute; inset: 0; z-index: -1; border-radius: 24px; background: var(--ui-pill);
  }
  @media (hover: hover) { .app-bottom-tab[aria-current="page"]:hover { color: var(--ui-red-text); } }
  body.has-app-nav .main-container { padding-bottom: calc(104px + env(safe-area-inset-bottom)); }
  /* Scrolling down shrinks the bar to its icons (static/frame.js sets data-tabs-min); only transform
     and opacity move, so the page is never laid out again while it scrolls. */
  html[data-tabs-min] .app-bottom-tabs { transform: translateY(4px) scale(0.9); }
  html[data-tabs-min] .app-bottom-tab .ui-icon { transform: translateY(8px); }
  html[data-tabs-min] .app-bottom-tab span { opacity: 0; }
  @media (prefers-reduced-motion: no-preference) {
    .app-bottom-tabs { transition: transform 0.35s cubic-bezier(0.2, 0.9, 0.3, 1.15); }
    .app-bottom-tab .ui-icon { transition: transform 0.3s cubic-bezier(0.2, 0.9, 0.3, 1.15); }
    .app-bottom-tab span { transition: opacity 0.2s; }
  }
}

/* --- Section bar: sub-tabs and page actions --- */
.section-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.sub-tabs {
  display: flex; gap: 4px; max-width: 100%; padding: 4px;
  overflow-x: auto; scrollbar-width: none;
  border-radius: 12px; background: var(--ui-hover);
}
.sub-tabs::-webkit-scrollbar { display: none; }
.sub-tab {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 36px; padding: 0 14px; border-radius: 9px;
  font-size: 14px; font-weight: 500; white-space: nowrap;
  color: var(--ui-muted); text-decoration: none;
}
@media (hover: hover) { .sub-tab:hover { color: var(--ui-text); } }
.sub-tab[aria-current="page"] { background: var(--ui-select-bg); color: var(--ui-select-text); font-weight: 600; }
@media (hover: hover) { .sub-tab[aria-current="page"]:hover { color: var(--ui-select-text); } }
.sub-tab-badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px;
  background: var(--ui-waiting-bg); color: var(--ui-waiting-text);
  font-size: 12px; font-weight: 600;
}
.section-actions { display: flex; gap: 8px; }
/* The Rota page on a laptop is wider than the page: its switch lines up with the rota under it. */
.main-container:has(.r2-page[data-wide]) > .section-bar { margin-inline: min(0px, calc((100% - min(1440px, 100vw - 48px)) / 2)); padding-inline: 16px; }

/* --- Icons --- */
.ui-icon {
  flex: 0 0 auto; width: 18px; height: 18px; vertical-align: middle;
  fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}

/* --- Buttons --- */
.btn-ui {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 18px; border: 1px solid transparent; border-radius: 999px;
  font-family: inherit; font-size: 14px; font-weight: 600; line-height: 1.2;
  text-decoration: none; cursor: pointer;
}
.btn-ui:focus-visible { outline: 2px solid var(--ui-red-text); outline-offset: 2px; }
.btn-ui-primary, .btn-ui-primary:hover { background: var(--ui-brand-grad); color: var(--ui-on-brand); box-shadow: var(--ui-button-glow); }
@media (hover: hover) { .btn-ui-primary:hover { filter: brightness(0.94); } }
.btn-ui-secondary { background: var(--ui-card); color: var(--ui-text); border-color: var(--ui-line); }
@media (hover: hover) { .btn-ui-secondary:hover { background: var(--ui-hover); color: var(--ui-text); } }
.btn-ui-secondary[data-tone="problem"] { color: var(--ui-red-text); }
.btn-ui-ghost { min-height: 36px; padding: 0 10px; background: transparent; color: var(--ui-red-text); }
@media (hover: hover) { .btn-ui-ghost:hover { background: var(--ui-hover); color: var(--ui-red-text); } }
.btn-ui-block { width: 100%; }
/* Pressed: buttons and tabs give a little. Only transform moves, so nothing is laid out again. */
@media (prefers-reduced-motion: no-preference) {
  .btn-ui, .app-bottom-tab { transition: transform 0.18s cubic-bezier(0.2, 0.9, 0.3, 1.2); }
  .btn-ui:active, .app-bottom-tab:active { transform: scale(0.96); }
}

/* --- Touch: no grey tap flash, no stuck hover ---
   iOS paints a grey box over whatever is tapped, and a touch screen keeps :hover on the last thing
   tapped. Every :hover rule in this file sits inside @media (hover: hover), so only a mouse sees it;
   on a touch screen a row shows a pressed colour (:active, in each page's block) while the finger
   is down, and nothing stays behind. Text in boxes and paragraphs stays selectable. */
a, button, summary, label, [role="button"], [tabindex] { -webkit-tap-highlight-color: transparent; }

/* --- Page header and cards --- */
.page { max-width: 1120px; margin: 0 auto; }
.page-head-ui { margin-bottom: 20px; }
body .page-title-ui { margin: 0; font-family: inherit; font-size: 22px; font-weight: 600; letter-spacing: -0.01em; color: var(--ui-text); }
.page-sub-ui { margin: 4px 0 0; font-size: 14px; color: var(--ui-muted); }
.ui-card {
  margin-bottom: 16px; padding: 16px 18px;
  background: var(--ui-card); color: var(--ui-text);
  border: 1px solid transparent; box-shadow: var(--ui-card-shadow); border-radius: 16px;
}
.ui-card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
body .ui-card-title { margin: 0; font-family: inherit; font-size: 16px; font-weight: 600; letter-spacing: 0; color: var(--ui-text); }
.ui-meta { font-size: 13px; color: var(--ui-muted); }
.ui-card-link { display: inline-flex; align-items: center; gap: 4px; margin-top: 10px; font-size: 14px; font-weight: 500; color: var(--ui-red-text); text-decoration: none; }
@media (hover: hover) { .ui-card-link:hover { color: var(--ui-red-text); text-decoration: underline; } }

/* --- Lists and rows --- */
.ui-list { margin: 0; padding: 0; list-style: none; }
.ui-list > li + li { border-top: 1px solid var(--ui-line); }
.ui-row { display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 8px 0; color: var(--ui-text); text-decoration: none; }
.ui-row-link { margin: 0 -8px; padding-right: 8px; padding-left: 8px; border-radius: 10px; }
@media (hover: hover) { .ui-row-link:hover { background: var(--ui-hover); color: var(--ui-text); } }
@media (hover: none) { .ui-row-link:active { background: var(--ui-hover); } }
.ui-row-main { flex: 1 1 auto; min-width: 0; font-size: 14px; }
.ui-row-sub { display: block; font-size: 13px; color: var(--ui-muted); }
.ui-row-action { display: inline-flex; align-items: center; gap: 2px; font-size: 13px; color: var(--ui-muted); white-space: nowrap; }
.ui-row-icon { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; width: 32px; height: 32px; border-radius: 10px; }
.ui-row-icon-problem { background: var(--ui-problem-bg); color: var(--ui-problem-text); }
.ui-row-icon-waiting { background: var(--ui-waiting-bg); color: var(--ui-waiting-text); }

/* --- Status tags: one colour per meaning --- */
.ui-tag {
  display: inline-flex; align-items: center; min-height: 24px; padding: 2px 10px;
  border-radius: 999px; font-size: 12px; font-weight: 600; line-height: 1.3; white-space: nowrap;
}
.ui-tag-waiting { background: var(--ui-waiting-bg); color: var(--ui-waiting-text); }
.ui-tag-problem { background: var(--ui-problem-bg); color: var(--ui-problem-text); }
.ui-tag-checked { background: var(--ui-checked-bg); color: var(--ui-checked-text); }
.ui-tag-done { background: var(--ui-done-bg); color: var(--ui-done-text); }
.ui-tag-finished { background: var(--ui-finished-bg); color: var(--ui-finished-text); }
.ui-tag-neutral { background: var(--ui-hover); color: var(--ui-muted); border: 1px solid var(--ui-line); }

/* --- Empty states, figures --- */
.ui-empty { display: flex; align-items: flex-start; gap: 12px; padding: 12px 0; font-size: 14px; color: var(--ui-muted); }
.ui-empty strong { display: block; font-weight: 600; color: var(--ui-text); }
.ui-empty p { margin: 2px 0 0; }
.ui-empty-good .ui-icon { width: 22px; height: 22px; color: var(--ui-done-text); }
.ui-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 12px 0; }
.ui-stats dt { font-size: 13px; font-weight: 400; color: var(--ui-muted); }
.ui-stats dd { margin: 0; font-size: 18px; font-weight: 600; font-variant-numeric: tabular-nums; }

/* --- Forms --- */
.ui-form { display: grid; gap: 14px; }
.ui-form-grid { display: grid; gap: 14px; }
@media (min-width: 640px) {
  .ui-form-grid { grid-template-columns: 1fr 1fr; }
  .ui-field-wide { grid-column: 1 / -1; }
}
.ui-field { display: grid; gap: 6px; min-width: 0; margin: 0; }
body .ui-field label { margin: 0; font-size: 14px; font-weight: 500; color: var(--ui-text); }
body .ui-field input,
body .ui-field select,
body .ui-field textarea {
  width: 100%; min-height: 44px; padding: 10px 12px;
  border: 1px solid var(--ui-line); border-radius: 10px;
  background: var(--ui-card); color: var(--ui-text);
  font: inherit; font-size: 16px;
}
body .ui-field input:focus,
body .ui-field select:focus,
body .ui-field textarea:focus { outline: none; border-color: var(--ui-red-text); box-shadow: 0 0 0 3px var(--ui-brand-soft); }
.ui-help { margin: 0; font-size: 13px; color: var(--ui-muted); }

/* --- Flash messages, in the theme's colours --- */
body .flash { border-radius: 12px; border-left-width: 4px; }
body .flash-info { background: var(--ui-checked-bg); color: var(--ui-checked-text); border-left-color: var(--ui-checked-text); }
body .flash-error,
body .flash-danger { background: var(--ui-problem-bg); color: var(--ui-problem-text); border-left-color: var(--ui-problem-text); }
body .flash-success { background: var(--ui-done-bg); color: var(--ui-done-text); border-left-color: var(--ui-done-text); }
body .flash-warning { background: var(--ui-waiting-bg); color: var(--ui-waiting-text); border-left-color: var(--ui-waiting-text); }

/* --- Home pages --- */
.home-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.home-date { margin: 0 0 2px; font-size: 14px; color: var(--ui-muted); }
.home-next-shift { display: flex; align-items: center; gap: 6px; margin: 6px 0 0; font-size: 14px; color: var(--ui-muted); }
.home-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.home-grid { display: grid; gap: 0 16px; }
@media (min-width: 900px) {
  .home-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
}
.home-pay { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 12px; margin: 4px 0 0; font-size: 14px; color: var(--ui-muted); }
.home-pay a { display: inline-flex; align-items: center; gap: 2px; color: var(--ui-red-text); font-weight: 500; text-decoration: none; }
.home-pay a .ui-icon { width: 16px; height: 16px; }
@media (max-width: 767.98px) {
  .home-actions { width: 100%; }
  .home-actions .btn-ui-primary { width: 100%; }
}
.home-today-sites { display: grid; gap: 4px 16px; }
@media (min-width: 640px) { .home-today-sites { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.home-today-site > summary {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  min-height: 40px; list-style: none; cursor: pointer;
  font-size: 14px; font-weight: 600;
}
.home-today-site > summary::-webkit-details-marker { display: none; }
.home-today-people { margin: 0; padding: 0; list-style: none; }
.home-today-people li { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 4px 0; font-size: 14px; }
.home-today-off { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--ui-line); }
.pay-hours { margin: 4px 0 0; font-size: 26px; font-weight: 600; font-variant-numeric: tabular-nums; }
.home-shift-day { display: inline-flex; flex-direction: column; align-items: center; width: 40px; line-height: 1.15; }
.home-shift-day strong { font-size: 17px; }
/* Staff Home: the next-shift card is the page's eye-catcher, like a member card, with the star
   faint in the corner (owner 2026-10-19). The mark image is turned white whatever its colour. */
.home-next-card {
  position: relative; overflow: hidden; isolation: isolate;
  background: var(--ui-hero-bg); color: var(--ui-hero-text); box-shadow: var(--ui-float-shadow);
}
.home-next-card .ui-card-title,
.home-next-card .ui-row,
.home-next-card .ui-empty strong { color: var(--ui-hero-text); }
.home-next-card .ui-row-main strong { font-size: 17px; }
.home-next-card .ui-meta,
.home-next-card .ui-row-sub,
.home-next-card .ui-empty { color: var(--ui-hero-muted); }
.home-next-card .ui-list > li + li { border-top-color: var(--ui-hero-line); }
.home-next-mark {
  position: absolute; z-index: -1; right: -28px; bottom: -36px; width: 150px; height: 150px;
  opacity: 0.22; filter: brightness(0) invert(1); pointer-events: none;
}
/* The weather beside a next shift (static/home_weather.js fills it; owner 2026-10-23): the icon
   and the temperature, and under them the chance of rain when rain is likely. */
.home-weather {
  display: grid; flex: 0 0 auto; grid-template-columns: auto auto; align-items: center; justify-items: end;
  column-gap: 4px; min-width: 52px; line-height: 1.2;
}
.home-weather > .ui-icon { width: 22px; height: 22px; }
.home-weather-temp { font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; }
.home-weather-rain {
  display: inline-flex; grid-column: 1 / -1; align-items: center; gap: 2px;
  font-size: 12px; font-variant-numeric: tabular-nums; color: var(--ui-hero-muted);
}
.home-weather-rain .ui-icon { width: 12px; height: 12px; }
/* Staff Home's Time off card: the holiday left as a big figure like the hours card's, then the
   coming days under a line (owner 2026-10-23). */
.home-off-left .ui-meta { margin: 2px 0 0; }
/* Holiday booked beyond what is earned reads as the big figure too, not as a small tag. */
.home-off-left .pay-hours .ui-tag { min-height: 0; padding: 0; border: 0; background: none; color: inherit; font-size: 20px; font-weight: inherit; white-space: normal; }
.home-off-left + .home-off-list,
.home-off-left + .home-off-none { margin-top: 12px; padding-top: 4px; border-top: 1px solid var(--ui-line); }
.home-off-none { margin: 0; padding: 4px 0; }
.home-off-list .ui-tag { flex: 0 0 auto; }

/* --- Sign-in pages --- */
.auth-wrap { width: 100%; max-width: 26rem; margin: 0 auto; padding-top: 16px; }
.auth-brand { margin: 8px 0 20px; text-align: center; }
.auth-mark { display: block; width: 44px; height: 44px; margin: 0 auto; }
.auth-logo { max-width: 220px; height: auto; }
.auth-wordmark { margin-top: 6px; font-size: 28px; font-weight: 600; letter-spacing: -0.02em; color: var(--ui-red-text); }
.auth-sub { margin-top: 2px; font-size: 13px; color: var(--ui-muted); }
body .auth-title { margin: 0 0 4px; font-family: inherit; font-size: 20px; font-weight: 600; color: var(--ui-text); }
.auth-lead { margin: 0 0 14px; font-size: 14px; color: var(--ui-muted); }
.auth-links { margin: 14px 0 0; font-size: 14px; text-align: center; }
.auth-foot { margin: 8px 0 16px; font-size: 14px; text-align: center; color: var(--ui-muted); }
.auth-links a, .auth-foot a { color: var(--ui-red-text); }
.auth-error { margin: 0 0 12px; padding: 10px 12px; border-radius: 12px; background: var(--ui-problem-bg); color: var(--ui-problem-text); font-size: 14px; font-weight: 500; }
.auth-card-quiet { display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; }
.ui-lang-switch { /* English / Українська above the card (staff pages review #10) */ display: flex; gap: 2px; width: fit-content; margin: 0 auto 16px; padding: 3px; border: 1px solid transparent; border-radius: 12px; background: var(--ui-fill); font-size: 14px; }
body .ui-lang-switch button { min-height: 44px; padding: 6px 16px; border: 0; border-radius: 9px; background: none; color: var(--ui-muted); font: inherit; cursor: pointer; }
body .ui-lang-switch button[aria-pressed="true"] { background: var(--ui-card); color: var(--ui-text); font-weight: 600; box-shadow: 0 0 0 1px var(--ui-line); }

/* --- Sheets: a floating card on phones, a centred dialog from 768px (ui.sheet in _ui.html) --- */
/* A sheet is a <dialog data-sheet> that static/time_off.js opens with showModal(). Its body holds
   the grab handle (phones only), the title, the line under it, then facts, fields and the button
   row. The time-off pages share it (Holidays and Availability plan, Task 4). Tokens only. The
   fact labels and values undo the browser's bold <dt> and indented <dd>. The owner's look C
   (findings F6, 2026-10-19): the page behind goes darker, the sheet floats as a card with a
   gap all round on phones, and a ✕ at the top right closes it. */
.ui-sheet {
  width: min(480px, calc(100vw - 32px)); max-height: calc(100vh - 32px); max-height: calc(100dvh - 32px);
  padding: 0; overflow: hidden; overscroll-behavior: contain;
  border: 1px solid transparent; border-radius: 18px; background: var(--ui-raised); color: var(--ui-text);
  cursor: pointer; /* iOS Safari sends a tap on the bare backdrop to the page's click handler only for a pointer cursor */
}
/* The sheet is a fixed-height column: its body is the part that scrolls (on iOS the <dialog>
   itself does not scroll reliably) and the button row sticks to the bottom of the body. */
.ui-sheet[open] { display: flex; flex-direction: column; }
.ui-sheet::backdrop { background: var(--ui-scrim); opacity: 0.6; }
/* The page behind an open sheet stays where it is (no scrolling, no jump when a phone's keyboard
   comes up). The title takes the focus on open (tabindex -1), so it needs no ring. */
body:has(dialog[data-sheet][open]) { overflow: hidden; }
.ui-sheet-title:focus { outline: none; }
.ui-sheet [hidden] { display: none !important; }
.ui-sheet-body {
  display: grid; gap: 14px; align-content: start; flex: 1 1 auto; min-height: 0; padding: 16px 18px 18px; position: relative;
  overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; cursor: auto;
}
/* The grab handle (phones only) is the small bar at the top of the body, exactly as it always
   looked. A tap on it closes the sheet; it is a span that never takes the focus, so no ring or
   tap flash shows on it. Its 44px hit area is an invisible ::before around the bar (no layout
   height). Dragging the sheet down (static/time_off.js) moves the whole sheet; it springs back
   with the transition below, which reduced motion turns off. */
.ui-sheet-grab { display: none; }
.ui-sheet { transition: transform 0.2s ease-out; }
.ui-sheet[data-dragging] { transition: none; }
@media (prefers-reduced-motion: reduce) {
  .ui-sheet { transition: none; }
}
body .ui-sheet-title { margin: 0; padding-right: 44px; font-family: inherit; font-size: 18px; font-weight: 600; letter-spacing: 0; color: var(--ui-text); overflow-wrap: anywhere; }
.ui-sheet-sub { margin: -10px 0 0; font-size: 14px; color: var(--ui-muted); overflow-wrap: anywhere; }
.ui-sheet form,
.ui-sheet-decision { display: grid; gap: 14px; margin: 0; }
.ui-sheet-actions {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px;
  position: sticky; bottom: 0; padding: 10px 0 2px; background: var(--ui-raised); /* the sheet's own colour */
}
.ui-sheet-facts { display: grid; gap: 10px; margin: 0; }
.ui-sheet-fact { margin: 0; padding: 10px 12px; border: 1px solid var(--ui-line); border-radius: 14px; }
.ui-sheet-fact-warn { border-color: var(--ui-problem-text); background: var(--ui-problem-bg); }
.ui-sheet-fact-label { margin: 0 0 4px; font-size: 12px; font-weight: 600; color: var(--ui-muted); }
.ui-sheet-fact-warn .ui-sheet-fact-label { color: var(--ui-problem-text); }
.ui-sheet-fact-value { margin: 0; font-size: 14px; line-height: 1.45; overflow-wrap: anywhere; }
.ui-sheet-lines { display: grid; gap: 4px; margin: 0; padding: 0; list-style: none; }
.ui-sheet-lines .ui-tag { min-height: 20px; padding: 1px 8px; }
.ui-sheet-note { margin: 6px 0 0; font-size: 12px; color: var(--ui-muted); }
/* The ✕ (after the title, so the title still takes the focus on open): a 34px circle with an
   invisible 44px hit area; [data-close-sheet] closes the sheet (time_off.js). */
.ui-sheet-x {
  display: grid; place-items: center; position: absolute; top: 12px; right: 12px; z-index: 2;
  width: 34px; height: 34px; padding: 0; border: 0; border-radius: 50%;
  background: var(--ui-fill); color: var(--ui-text); cursor: pointer; -webkit-tap-highlight-color: transparent;
}
.ui-sheet-x::before { content: ""; position: absolute; inset: -5px; }
.ui-sheet-x:focus-visible { outline: 2px solid var(--ui-red-text); outline-offset: 2px; }
@media (max-width: 767.98px) {
  .ui-sheet {
    width: calc(100% - 16px); max-width: 100%; max-height: 85vh; max-height: min(85dvh, var(--ui-vv-height, 85dvh));
    margin: auto 8px 0; margin-bottom: calc(max(8px, env(safe-area-inset-bottom)) + var(--ui-kb-inset, 0px));
    border-width: 0; border-radius: 26px; box-shadow: var(--ui-sheet-shadow);
  }
  .ui-sheet-grab {
    display: block; position: relative; width: 40px; height: 4px; margin: 0 auto -6px; border-radius: 2px;
    background: var(--ui-line); cursor: pointer; outline: none; -webkit-tap-highlight-color: transparent;
    touch-action: none;
  }
  .ui-sheet-grab::before { content: ""; position: absolute; inset: -16px -40px -24px; }
  .ui-sheet-actions > .btn-ui { flex: 1 1 0; }
}

/* --- Phones: every control at least 44px tall --- */
@media (max-width: 767.98px) {
  .sub-tab,
  body .ui-segmented button,
  .btn-ui-ghost,
  .home-today-site > summary,
  body .ui-lang-switch button { min-height: 44px; }
  .app-avatar { width: 44px; height: 44px; }
  /* At 375px the default min(300px, ...) leaves each appearance/language option
     about 83px wide, so "Match device" and "Як на пристрої" wrap onto two lines. */
  .app-account-panel { width: min(360px, calc(100vw - 24px)); }
}

/* --- View as employee bar (base.html): shown on every page while a manager views as someone --- */
.va-bar {
  display: flex; align-items: center; gap: 10px;
  margin: 0;
  padding: 8px max(16px, env(safe-area-inset-right)) 8px max(16px, env(safe-area-inset-left));
  background: var(--ui-select-bg); color: var(--ui-select-text);
  font-size: 13px;
}
.va-bar > .ui-icon { flex: 0 0 auto; }
.va-bar-text { flex: 1 1 auto; min-width: 0; }
.va-bar-text strong { font-weight: 600; }
.va-bar-exit {
  flex: 0 0 auto; min-height: 44px; padding: 0 16px;
  border: 1px solid var(--ui-select-text); border-radius: 10px;
  background: transparent; color: var(--ui-select-text);
  font: inherit; font-weight: 600;
}

/* --- Person hours page (templates/person_hours.html) ---
   "My hours" and a manager's view of one person. Phones get a card per week; from
   900px up the same markup is one table. Tokens only, so Cream and Dark both work. */
.ph-back {
  display: inline-flex; align-items: center; gap: 2px; min-height: 44px;
  font-size: 14px; font-weight: 500; color: var(--ui-red-text); text-decoration: none;
}
@media (hover: hover) { .ph-back:hover { color: var(--ui-red-text); text-decoration: underline; } }
.ph-back .ui-icon,
.ph-arrow-prev .ui-icon { transform: scaleX(-1); }
/* One header line: back arrow, name, department. The back link's text is for screen readers. */
.ph-head { display: flex; flex-wrap: wrap; align-items: center; gap: 0 8px; margin: 0 0 4px; }
.ph-back-name {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip-path: inset(50%); white-space: nowrap;
}
.ph-name { margin: 0; color: var(--ui-text); font-size: 20px; font-weight: 600; line-height: 1.2; letter-spacing: normal; }
.ph-who { margin: 0; min-width: 0; font-size: 13px; color: var(--ui-muted); }
.ph-summary { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; margin: 0 0 12px; font-size: 14px; }
.ph-sum { display: inline-flex; align-items: center; gap: 4px; min-width: 0; }
.ph-sum strong { font-weight: 600; font-variant-numeric: tabular-nums; }
.ph-sum-label { color: var(--ui-muted); }
.ph-period { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 8px; }
.ph-arrow {
  display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto;
  width: 44px; height: 44px; border: 1px solid var(--ui-line); border-radius: 50%;
  background: var(--ui-card); color: var(--ui-muted); text-decoration: none;
}
@media (hover: hover) { .ph-arrow:hover { background: var(--ui-hover); color: var(--ui-text); } }
.ph-arrow:focus-visible { outline: 2px solid var(--ui-red-text); outline-offset: 2px; }
.ph-arrow-off { visibility: hidden; }
.ph-period-dates {
  flex: 1 1 auto; min-width: 0; text-align: center;
  font-size: 16px; font-weight: 600; font-variant-numeric: tabular-nums;
}
.ph-boxes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; padding: 12px; }
.ph-box { min-width: 0; padding: 10px 12px; border-radius: 12px; background: var(--ui-hover); }
.ph-box:only-child { grid-column: 1 / -1; }
.ph-box-label { margin: 0; font-size: 12px; font-weight: 600; color: var(--ui-muted); }
.ph-box-value { margin: 4px 0 0; font-size: 22px; font-weight: 600; line-height: 1.15; font-variant-numeric: tabular-nums; }
.ph-box-value-day { font-size: 16px; }
.ph-box-sub { margin: 4px 0 0; font-size: 12px; color: var(--ui-muted); }
.ph-bars-title { margin-bottom: 10px; } .ph-bars-note { margin: 10px 0 0; }
.ph-bars { display: grid; grid-template-columns: max-content minmax(48px, 1fr) max-content; gap: 8px 10px; margin: 0; padding: 0; list-style: none; }
.ph-bar { display: grid; grid-column: 1 / -1; grid-template-columns: subgrid; align-items: center; font-size: 13px; } /* rows share the columns: whole labels */
.ph-bar-label { overflow: hidden; color: var(--ui-muted); white-space: nowrap; text-overflow: ellipsis; }
.ph-bar-track { height: 12px; overflow: hidden; border-radius: 999px; background: var(--ui-track); }
.ph-bar-fill { display: block; height: 100%; border-radius: inherit; background: var(--ui-gold); opacity: .5; }
.ph-bar-current .ph-bar-fill { opacity: 1; }
.ph-bar-current .ph-bar-label, .ph-bar-current .ph-bar-value { color: var(--ui-text); font-weight: 600; }
.ph-bar-value { font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; }
.ph-bar-future .ph-bar-value { font-weight: 400; color: var(--ui-muted); }
.ph-muted, .ph-note { color: var(--ui-muted); }
.ph-diff {
  display: inline-block; padding: 0 6px; border-radius: 6px;
  background: var(--ui-waiting-bg); color: var(--ui-waiting-text);
  font-size: 12px; font-weight: 600;
}
.ph-page .ui-tag .ui-icon { width: 14px; height: 14px; margin-right: 2px; }
.ph-line .ui-tag { margin: 2px 4px 2px 0; }
/* Undo the browser's <strong> { font-weight: bolder }, which computes to 700; Inter is
   only loaded at 400/500/600. */
.ph-line strong { font-weight: 600; }

/* Phones and narrow windows: each week is a card, each day is two lines: the day, a waiting tag
   and the hours; then the worked times (the plan, only when nothing was worked). */
.ph-table { width: 100%; border-collapse: collapse; font-size: 14px; }
/* Undo style.css's global th/td look: uppercase, shaded, padded, bordered. */
.ph-table th,
.ph-table td {
  padding: 0; border: 0; background: none; color: inherit;
  font-size: inherit; font-weight: inherit; letter-spacing: normal; text-transform: none;
  text-align: left; vertical-align: top;
}
/* style.css's global `tr:hover td` (specificity 0,1,2) adds a background colour, and nothing
   else: take off that colour only (0,2,2), so hovering a row changes nothing. This table used
   to fold that hover into the reset above, which also cleared padding, borders, colour and
   weight and outranked the row rules below: a hovered day row collapsed from 49px to 29px and
   every row under it jumped. */
.ph-table tr:hover > td { background: none; }
.ph-table thead { display: none; }
.ph-table tbody,
.ph-table tr,
.ph-table th,
.ph-table td { display: block; }
.ph-table .ph-week {
  margin-bottom: 12px; padding: 2px 14px;
  border: 1px solid transparent; box-shadow: var(--ui-card-shadow); border-radius: 16px; background: var(--ui-card);
}
.ph-table .ph-week-row {
  display: flex; justify-content: space-between; gap: 12px; padding: 8px 0 4px;
  font-size: 13px; font-weight: 600; color: var(--ui-muted);
}
.ph-table .ph-week-row td { color: var(--ui-text); }
.ph-table .ph-day {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 2px 8px;
  padding: 8px 0; border-top: 1px solid var(--ui-line);
}
.ph-table .ph-c-day { grid-column: 1; grid-row: 1; font-weight: 600; }
.ph-table .ph-c-status { display: flex; flex-wrap: wrap; grid-column: 2; grid-row: 1; min-width: 0; }
.ph-table .ph-c-hours { grid-column: 3; grid-row: 1; font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; }
.ph-table .ph-c-planned,
.ph-table .ph-c-worked { display: flex; gap: 6px; grid-column: 1 / -1; grid-row: 2; }
.ph-table .ph-c-planned::before { content: attr(data-label); flex: 0 0 auto; color: var(--ui-muted); }
.ph-table .ph-c-break,
.ph-table .ph-c-site,
.ph-table .ph-none { display: none; }
@media (max-width: 899.98px) {
  .ph-table .ph-day[data-has-worked] .ph-c-planned { display: none; }
  /* A tag only for shifts still waiting, and one is enough for the day. */
  .ph-table .ph-c-status .ph-line:empty,
  .ph-table .ph-c-status .ph-line:not(:empty) ~ .ph-line { display: none; }
}
.ph-lines { flex: 1 1 auto; min-width: 0; }
.ph-line { display: block; }
.ph-c-status .ph-line { display: inline; }
.ph-num { text-align: right; font-variant-numeric: tabular-nums; }

/* Laptops: the same markup as one table. */
@media (min-width: 900px) {
  .ph-top { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 0 16px; align-items: start; }
  .ph-period { max-width: 480px; }
  .ph-days { padding: 6px 12px; border: 1px solid transparent; box-shadow: var(--ui-card-shadow); border-radius: 16px; background: var(--ui-card); }
  .ph-table { display: table; }
  .ph-table thead { display: table-header-group; }
  .ph-table tbody,
  .ph-table .ph-week { display: table-row-group; margin: 0; padding: 0; border: 0; background: none; }
  .ph-table tr,
  .ph-table .ph-day { display: table-row; }
  .ph-table .ph-week-row { display: table-row; background: var(--ui-hover); }
  .ph-table th,
  .ph-table td,
  .ph-table .ph-c-planned,
  .ph-table .ph-c-worked,
  .ph-table .ph-c-status,
  .ph-table .ph-c-status:empty,
  .ph-table .ph-c-break,
  .ph-table .ph-c-site,
  .ph-table .ph-none { display: table-cell; padding: 10px 8px; }
  .ph-table thead th { font-size: 12px; font-weight: 600; color: var(--ui-muted); }
  .ph-table .ph-day > td { border-top: 1px solid var(--ui-line); }
  .ph-table .ph-c-planned::before,
  .ph-table .ph-c-worked::before { content: none; }
  .ph-table .ph-none { color: var(--ui-muted); }
  .ph-table .ph-num { text-align: right; }
  .ph-phone { display: none; }
  .ph-line,
  .ph-c-status .ph-line { display: block; min-height: 28px; }
}

/* --- Hours page (templates/timesheet.html) ---
   The manager's timesheet: one form, the people of the week in the paper sheet's order.
   Laptops (768px and wider): a compact table, one ~44px line per person, Monday to Sunday,
   only Start and End in every day (hours belong on Payroll, so the table shows none).
   Phones: one fixed-height row each (name, week total); tapping a row moves that person's week
   into a sheet from the bottom that ends above the keyboard: seven lines, Start and End.
   Nothing in the list moves when a week is saved. Tokens only, so Cream and Dark both work. Scripts and tests hook onto
   data-* attributes, never onto these classes. */
.hs-page { max-width: 720px; }
.hs-page [hidden] { display: none !important; }
@media (max-width: 767.98px) {
  .hs-lg-only { display: none !important; }
  [data-hs-week] { scroll-margin-top: 64px; } /* a #week- jump clears the sticky 56px top bar */
}
@media (min-width: 768px) {
  .hs-sm-only { display: none !important; }
}
.hs-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 0 8px; }
.hs-head .page-title-ui { margin: 0; }
.hs-menubtn {
  display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto;
  width: 44px; height: 44px; padding: 0; border: 1px solid var(--ui-line); border-radius: 50%;
  background: var(--ui-card); color: var(--ui-text); font: inherit; cursor: pointer;
}
@media (hover: hover) { .hs-menubtn:hover { background: var(--ui-hover); } }
.hs-menubtn:active { background: var(--ui-hover); }
.hs-menubtn:focus-visible { outline: 2px solid var(--ui-red-text); outline-offset: 2px; }
.hs-menubtn .ui-icon { width: 22px; height: 22px; }
/* The menu sheet: one column of full-width rows, then the Show-by switch and the period's weeks and actions. */
.hs-menu { display: grid; gap: 8px; }
.hs-menu-row {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 48px; margin: 0; padding: 8px 12px;
  border: 1px solid transparent; border-radius: 12px; background: var(--ui-fill); color: var(--ui-text);
  font: inherit; font-size: 15px; font-weight: 500; text-align: left; text-decoration: none; cursor: pointer;
}
@media (hover: hover) { .hs-menu-row:hover { background: var(--ui-hover); color: var(--ui-text); } }
.hs-menu-row:active { background: var(--ui-hover); }
.hs-menu-row:focus-visible { outline: 2px solid var(--ui-red-text); outline-offset: 2px; }
.hs-menu-row:disabled { opacity: .5; cursor: default; }
.hs-menu-row .ui-icon { flex: 0 0 auto; color: var(--ui-muted); }
.hs-menu-row[aria-pressed="true"] { background: var(--ui-select-bg); border-color: var(--ui-select-bg); color: var(--ui-select-text); }
.hs-menu-row[aria-pressed="true"] .ui-icon { color: var(--ui-select-text); }
.hs-menu-label { margin: 6px 0 -2px; font-size: 12px; font-weight: 600; color: var(--ui-muted); }
.hs-menu .hs-switch { display: flex; }
.hs-menu .hs-switch a { flex: 1 1 0; }
.hs-menu .hs-weeks { margin: 0; }
.hs-menu .hs-actions { margin: 0; }
.hs-menu .hs-actions .btn-ui { flex: 1 1 auto; }
.hs-menu .hs-manage-form .hs-select { flex: 1 1 12em; }
.hs-managebar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin: 0 0 10px; padding: 8px 8px 8px 14px; border: 1px solid transparent; border-radius: 14px;
  background: var(--ui-card); box-shadow: var(--ui-card-shadow); font-size: 14px; font-weight: 600;
}
.hs-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; margin-bottom: 12px; }
.hs-switch { flex: 0 0 auto; }
.hs-switch a {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 36px; padding: 0 12px; border-radius: 8px;
  color: var(--ui-muted); font-size: 13px; font-weight: 500; text-decoration: none; white-space: nowrap;
}
@media (hover: hover) { .hs-switch a:hover { color: var(--ui-text); } }
.hs-switch a[aria-current="page"] { background: var(--ui-select-bg); color: var(--ui-select-text); font-weight: 600; }
@media (hover: hover) { .hs-switch a[aria-current="page"]:hover { color: var(--ui-select-text); } }
.hs-dates-nav { display: inline-flex; align-items: center; gap: 8px; }
.hs-arrow {
  display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto;
  width: 36px; height: 36px; border: 1px solid var(--ui-line); border-radius: 50%;
  background: var(--ui-card); color: var(--ui-muted); text-decoration: none;
}
@media (hover: hover) { .hs-arrow:hover { background: var(--ui-hover); color: var(--ui-text); } }
.hs-arrow:active { background: var(--ui-hover); }
.hs-arrow-prev .ui-icon { transform: scaleX(-1); }
.hs-arrow:focus-visible,
.hs-switch a:focus-visible,
.hs-weekbtn:focus-visible { outline: 2px solid var(--ui-red-text); outline-offset: 2px; }
.hs-dates { min-width: 8.5em; text-align: center; font-size: 16px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.hs-statuses { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.hs-status { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ui-muted); white-space: nowrap; }
.hs-status-at { font-size: 13px; color: var(--ui-muted); }
.hs-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 0 auto; }
.hs-weeks { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 12px; }
.hs-weekbtn {
  display: inline-flex; align-items: center; min-height: 36px; padding: 0 12px;
  border: 1px solid transparent; border-radius: 999px; background: var(--ui-fill);
  color: var(--ui-muted); font-size: 13px; font-weight: 500; text-decoration: none; white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
@media (hover: hover) { .hs-weekbtn:hover { background: var(--ui-hover); color: var(--ui-text); } }
.hs-weekbtn[aria-current="page"] { background: var(--ui-select-bg); border-color: var(--ui-select-bg); color: var(--ui-select-text); font-weight: 600; }
@media (hover: hover) { .hs-weekbtn[aria-current="page"]:hover { background: var(--ui-select-bg); border-color: var(--ui-select-bg); color: var(--ui-select-text); } }
.hs-banner { display: flex; align-items: flex-start; gap: 10px; margin: 0 0 12px; padding: 10px 14px; border-radius: 12px; font-size: 14px; line-height: 1.4; }
.hs-banner .ui-icon { margin-top: 1px; }
.hs-banner-reviewed { background: var(--ui-checked-bg); color: var(--ui-checked-text); }
.hs-banner-locked { background: var(--ui-finished-bg); color: var(--ui-finished-text); }
.hs-manage-form { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0; }
.hs-page .hs-select {
  width: auto; min-width: 12em; min-height: 44px; padding: 8px 12px;
  border: 1px solid var(--ui-line); border-radius: 10px;
  background: var(--ui-card); color: var(--ui-text); font: inherit; font-size: 14px;
}
.hs-page .hs-select:focus { outline: 2px solid var(--ui-red-text); outline-offset: 1px; box-shadow: none; }
@media (max-width: 767.98px) {
  .hs-arrow { width: 44px; height: 44px; }
  .hs-switch a,
  .hs-weekbtn { min-height: 44px; }
  .hs-actions { margin-left: 0; }
}

/* Hours: the list. Phones: one card per department; every row is 52px high whatever it shows,
   so a total or a mark changing after a save never moves anything. Each row also holds that
   person's week, hidden on phones until the sheet below takes it. */
.hs-dept-count { font-weight: 500; color: var(--ui-muted); }
.hs-dept-total { min-width: 6ch; font-weight: 500; color: var(--ui-muted); font-variant-numeric: tabular-nums; text-align: right; }
.hs-page .hs-who {
  display: flex; flex: 1 1 auto; align-items: center; gap: 8px; min-width: 0; height: 100%;
  margin: 0; padding: 0 8px 0 14px; border: 0; background: none; color: var(--ui-text);
  font: inherit; text-align: left; cursor: pointer;
}
@media (hover: hover) { .hs-page .hs-who:hover { background: var(--ui-hover); } }
.hs-page .hs-who:active { background: var(--ui-hover); }
.hs-who:focus-visible { outline: 2px solid var(--ui-red-text); outline-offset: -2px; }
.hs-name { flex: 0 1 auto; min-width: 0; overflow: hidden; font-size: 15px; font-weight: 600; white-space: nowrap; text-overflow: ellipsis; }
.hs-mark { display: none; flex: 0 0 auto; width: 8px; height: 8px; border-radius: 50%; }
.hs-row[data-mark] .hs-mark { display: block; }
.hs-row[data-mark="red"] .hs-mark { background: var(--ui-problem-text); }
.hs-row[data-mark="amber"] .hs-mark { background: var(--ui-waiting-text); }
.hs-total-hm { flex: 0 0 auto; min-width: 5ch; margin-left: auto; font-size: 14px; text-align: right; color: var(--ui-muted); font-variant-numeric: tabular-nums; }
.hs-chev { display: inline-flex; flex: 0 0 auto; color: var(--ui-muted); }
.hs-rowctl { display: none; flex: 0 0 auto; align-items: center; gap: 4px; padding-right: 4px; }
[data-hs-week][data-managing] .hs-rowctl { display: flex; }
[data-hs-week][data-managing] .hs-chev { display: none; }
.hs-page [data-hs-week][data-managing] .hs-who { cursor: default; }
@media (hover: hover) { .hs-page [data-hs-week][data-managing] .hs-who:hover { background: none; } }
.hs-iconbtn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; padding: 0; border: 1px solid var(--ui-line); border-radius: 10px;
  background: var(--ui-card); color: var(--ui-muted); font: inherit; font-size: 13px; cursor: pointer;
}
@media (hover: hover) { .hs-iconbtn:hover { background: var(--ui-hover); color: var(--ui-text); } }
.hs-iconbtn:active { background: var(--ui-hover); }
.hs-iconbtn:disabled { opacity: .45; cursor: default; }
.hs-iconbtn-up .ui-icon { transform: rotate(180deg); }
@media (max-width: 767.98px) {
  .hs-group + .hs-group { margin-top: 14px; }
  .hs-dept {
    display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
    margin: 0; padding: 0 4px 6px; font-size: 13px; font-weight: 600; color: var(--ui-text);
  }
  .hs-row {
    display: flex; align-items: center; height: 52px; overflow: hidden;
    border: 1px solid var(--ui-line); border-top-width: 0; background: var(--ui-card);
  }
  .hs-dept + .hs-row { border-top-width: 1px; border-radius: 14px 14px 0 0; }
  .hs-row:last-child { border-radius: 0 0 14px 14px; }
  .hs-dept + .hs-row:last-child { border-radius: 14px; }
  .hs-person { display: flex; flex: 1 1 auto; align-items: center; min-width: 0; height: 100%; }
  .hs-row > .hs-pweek { display: none; }
}

/* Hours: the person sheet (phones). A modal <dialog>: a column of the name, the Start/End
   heading, the seven days (the part that scrolls) and the buttons. The week in it is the one
   moved in from the list. Its top stays put and its bottom sits on the keyboard (--hs-kb, set
   by static/timesheet.js), so the days never jump when the keyboard comes up. */
.hs-page .hs-panel {
  margin: 0; padding: 0; max-width: none; max-height: none; overflow: hidden;
  border: 1px solid var(--ui-line); background: var(--ui-card); color: var(--ui-text);
  cursor: pointer; /* iOS Safari sends a tap on the bare backdrop to the page only for a pointer cursor */
}
.hs-page .hs-panel[open] { display: flex; flex-direction: column; }
.hs-panel::backdrop { background: var(--ui-scrim); opacity: .6; }
.hs-panel > * { cursor: auto; }
.hs-pslot { display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; }
.hs-pslot > .hs-pweek { display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; }
.hs-phead { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 16px 16px 6px; }
.hs-pname { min-width: 0; margin: 0; overflow: hidden; color: var(--ui-text); font-size: 18px; font-weight: 600; white-space: nowrap; text-overflow: ellipsis; }
.hs-pdates { flex: 0 0 auto; font-size: 13px; color: var(--ui-muted); font-variant-numeric: tabular-nums; }
.hs-pcols,
.hs-cell { display: grid; grid-template-columns: 40px minmax(0, 1fr) 44px; column-gap: 8px; }
.hs-pcols { padding: 0 16px 4px; font-size: 12px; font-weight: 600; color: var(--ui-muted); }
.hs-pcols-t,
.hs-times { display: grid; grid-template-columns: minmax(0, 1fr) 12px minmax(0, 1fr); align-items: center; column-gap: 6px; }
.hs-pcols-t { text-align: center; }
.hs-pbody { flex: 1 1 auto; min-height: 0; padding: 0 16px; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
.hs-cell { align-items: start; padding: 4px 0; border-bottom: 1px solid var(--ui-line); }
.hs-cell:last-child { border-bottom: 0; }
.hs-dlabel { display: flex; flex-direction: column; justify-content: center; height: 44px; line-height: 1.15; }
.hs-dname { font-size: 12px; color: var(--ui-muted); }
.hs-dnum { font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; }
.hs-cell[data-mark="red"] .hs-dlabel { box-shadow: inset 3px 0 0 var(--ui-problem-text); padding-left: 7px; }
.hs-cell[data-mark="amber"] .hs-dlabel { box-shadow: inset 3px 0 0 var(--ui-waiting-text); padding-left: 7px; }
.hs-cell[data-outside] .hs-dlabel { opacity: .6; }
.hs-lines,
.hs-linebox,
.hs-shift { display: grid; gap: 4px; min-width: 0; }
.hs-sep { text-align: center; color: var(--ui-muted); }
.hs-page .hs-time {
  width: 100%; min-width: 0; height: 44px; margin: 0; padding: 0 4px;
  border: 1px solid var(--ui-line); border-radius: 10px; background: var(--ui-card); color: var(--ui-text);
  font: inherit; font-size: 16px; font-variant-numeric: tabular-nums; text-align: center;
}
.hs-page .hs-time:focus { outline: 2px solid var(--ui-red-text); outline-offset: 1px; border-color: var(--ui-line); box-shadow: none; }
.hs-page .hs-time:disabled { background: var(--ui-hover); color: var(--ui-muted); }
.hs-off { display: flex; align-items: center; height: 44px; font-size: 14px; color: var(--ui-muted); }
/* Shown only while the day is opened with its button: break, paid on the spot, place or job,
   second shift, Stratford and the single-shift links. */
.hs-xtra,
.hs-dmore { display: none; }
.hs-cell[data-open] .hs-xtra,
.hs-cell[data-open] .hs-dmore { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; }
.hs-cell[data-open] .hs-xtags:not(:has(> :not([hidden]))) { display: none; }
.hs-xtags { display: flex; flex-wrap: wrap; gap: 4px; }
.hs-page .hs-break,
.hs-page .hs-paid,
.hs-page .hs-check { display: flex; align-items: center; gap: 6px; min-height: 44px; margin: 0; font-size: 14px; font-weight: 500; color: var(--ui-text); }
.hs-page .hs-break-input {
  width: 64px; height: 40px; padding: 0 6px;
  border: 1px solid var(--ui-line); border-radius: 8px; background: var(--ui-card); color: var(--ui-text);
  font: inherit; font-size: 16px; font-variant-numeric: tabular-nums;
}
.hs-page .hs-break-input:focus { outline: 2px solid var(--ui-red-text); outline-offset: 1px; box-shadow: none; }
.hs-extras-action {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0;
  border: 0; background: none; color: var(--ui-red-text); font: inherit; font-size: 14px; font-weight: 600;
  text-align: left; text-decoration: none; cursor: pointer;
}
@media (hover: hover) { .hs-extras-action:hover { color: var(--ui-red-text); text-decoration: underline; } }
.hs-extras-action:active { opacity: .7; }
.hs-tags,
.hs-cell-tags { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.hs-tags:not(:has(> :not([hidden]))),
.hs-cell-tags:not(:has(> :not([hidden]))) { display: none; }
.hs-review {
  display: inline-flex; align-items: center; gap: 4px; min-height: 44px; padding: 0 12px;
  border: 1px solid transparent; border-radius: 999px; background: var(--ui-fill); color: var(--ui-text);
  font: inherit; font-size: 13px; font-weight: 600; cursor: pointer;
}
.hs-review:active { background: var(--ui-hover); }
.hs-review .ui-icon { width: 14px; height: 14px; }
.hs-review:disabled { color: var(--ui-muted); cursor: default; }
.hs-review .hs-review-wait { display: none; }
.hs-review[data-wait] .hs-review-go { display: none !important; }
.hs-review[data-wait] .hs-review-wait { display: inline; }
.hs-morebtn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; padding: 0; border: 0; border-radius: 10px;
  background: none; color: var(--ui-muted); font: inherit; cursor: pointer;
}
@media (hover: hover) { .hs-morebtn:hover { background: var(--ui-hover); color: var(--ui-text); } }
.hs-morebtn:active { background: var(--ui-hover); }
.hs-morebtn:focus-visible { outline: 2px solid var(--ui-red-text); outline-offset: -2px; }
.hs-morebtn[aria-expanded="true"] .hs-sm-only .ui-icon { transform: rotate(180deg); }
.hs-pfoot { display: grid; gap: 8px; flex: 0 0 auto; padding: 10px 16px 12px; border-top: 1px solid var(--ui-line); }
.hs-pnote { margin: 0; font-size: 13px; line-height: 1.4; color: var(--ui-problem-text); }
.hs-pbtns { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 8px; }
.hs-pbtns .btn-ui { min-height: 48px; }
.hs-pbtns .btn-ui:disabled { opacity: .5; cursor: default; }
.hs-next { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
@media (max-width: 767.98px) {
  .hs-page .hs-panel {
    position: fixed; top: calc(100vh - min(600px, 100vh - 24px)); top: calc(100dvh - min(600px, 100dvh - 24px));
    right: 8px; bottom: calc(max(8px, env(safe-area-inset-bottom)) + var(--hs-kb, 0px)); left: 8px; width: auto; height: auto;
    border: 0; border-radius: 26px; box-shadow: var(--ui-sheet-shadow);
  }
  /* The list behind an open sheet stays where it is. */
  body:has(.hs-panel[open]) { overflow: hidden; }
}

/* Hours: the table (768px and wider). People by Monday to Sunday: a name, then Start and End
   in every day, nothing else, so one person is one line of about 44px (two lines only for a
   split shift) and the whole week fits the window. A day's tags shrink to a dot in its corner;
   they open over the table while the day is hovered or has the focus (so "Looks right" is
   still reached with Tab), and sit in the day while it is opened with its "⋯" button. Each
   row's week block and its days are display: contents, so the days sit in the row's grid. */
@media (min-width: 768px) {
  body:has(.hs-page) .main-container { max-width: 1440px; }
  .hs-page { max-width: none; }
  .hs-week,
  .hs-form { min-width: 0; }
  .hs-list {
    --hs-person-col: clamp(88px, 9vw, 132px);
    --hs-week-col: 68px;
    overflow-x: auto;
    border: 1px solid transparent; border-radius: 12px; background: var(--ui-card); box-shadow: var(--ui-card-shadow); font-size: 13px;
  }
  /* Moving people: the move buttons take the week column's room. */
  .hs-page [data-hs-week][data-managing] .hs-list { --hs-person-col: clamp(150px, 14.5vw, 210px); --hs-week-col: 0px; }
  .hs-page [data-hs-week][data-managing] .hs-gh-week,
  .hs-page [data-hs-week][data-managing] .hs-wtotal { visibility: hidden; padding: 0; border: 0; }
  .hs-gridhead,
  .hs-row { display: grid; grid-template-columns: var(--hs-person-col) repeat(7, minmax(0, 1fr)) var(--hs-week-col); }
  .hs-row > .hs-pweek,
  .hs-row .hs-pbody { display: contents; }
  .hs-gridhead > span {
    padding: 6px; border-bottom: 1px solid var(--ui-line); background: var(--ui-hover);
    font-size: 12px; font-weight: 600; color: var(--ui-muted); white-space: nowrap;
  }
  .hs-gridhead > .hs-gh-person { position: sticky; left: 0; z-index: 2; }
  .hs-day-name { font-weight: 500; }
  .hs-day-num { font-size: 13px; color: var(--ui-text); font-variant-numeric: tabular-nums; }
  .hs-gridhead > [data-today] { background: var(--ui-waiting-bg); color: var(--ui-waiting-text); }
  .hs-gridhead > [data-today] .hs-day-num { color: var(--ui-waiting-text); }
  .hs-dept {
    margin: 0; padding: 5px 6px 5px 10px; border-bottom: 1px solid var(--ui-line); background: var(--ui-hover);
    font-size: 12px; font-weight: 600; color: var(--ui-text);
  }
  .hs-dept-total { display: none; }
  .hs-gridhead > .hs-gh-week { padding-right: 6px; padding-left: 4px; overflow: hidden; text-overflow: ellipsis; text-align: right; }
  .hs-row > .hs-wtotal {
    display: flex; align-items: center; justify-content: flex-end; min-width: 0; padding: 5px 6px 5px 4px;
    border-bottom: 1px solid var(--ui-line); border-left: 1px solid var(--ui-line); background: var(--ui-card);
    color: var(--ui-muted); font-variant-numeric: tabular-nums; white-space: nowrap;
  }
  .hs-row > .hs-person,
  .hs-row .hs-cell { min-width: 0; padding: 5px 4px; border-bottom: 1px solid var(--ui-line); background: var(--ui-card); }
  .hs-row .hs-cell { border-left: 1px solid var(--ui-line); }
  .hs-row .hs-cell[data-outside] { background: var(--ui-hover); }
  .hs-row .hs-cell[data-mark="red"] { box-shadow: inset 3px 0 0 var(--ui-problem-text); }
  .hs-row .hs-cell[data-mark="amber"] { box-shadow: inset 3px 0 0 var(--ui-waiting-text); }
  .hs-row > .hs-person { position: sticky; left: 0; z-index: 3; display: flex; align-items: center; gap: 6px; padding-left: 10px; }
  .hs-page .hs-who { display: flex; align-items: center; gap: 6px; height: 34px; padding: 0; border-radius: 6px; }
  .hs-who:focus-visible { outline-offset: 2px; }
  .hs-row .hs-name { flex: 0 1 auto; font-size: 13px; }
  .hs-row[data-mark] .hs-mark { display: block; }
  .hs-row .hs-who .ui-tag { flex: 0 0 auto; }
  .hs-rowctl { gap: 2px; padding: 0; }
  .hs-iconbtn { width: 28px; height: 28px; border-radius: 8px; }
  /* A day: the lines, then its "⋯" button in a narrow column on the right. */
  .hs-row .hs-cell { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) 18px; align-items: start; column-gap: 0; }
  .hs-row .hs-dlabel { display: none; }
  .hs-lines,
  .hs-linebox,
  .hs-shift { gap: 2px; }
  .hs-times { grid-template-columns: minmax(0, 54px) 6px minmax(0, 54px); justify-content: start; column-gap: 1px; }
  .hs-sep { font-size: 12px; line-height: 1; }
  .hs-page .hs-time { height: 34px; min-height: 0; padding: 0 1px; border-radius: 6px; font-size: 13px; letter-spacing: -.01em; }
  .hs-off { height: 34px; font-size: 13px; }
  .hs-cell[data-open] .hs-xtra,
  .hs-cell[data-open] .hs-dmore { display: grid; justify-items: start; gap: 2px; }
  .hs-cell[data-open] .hs-dmore { margin-top: 4px; padding-top: 4px; border-top: 1px solid var(--ui-line); }
  .hs-page .hs-break,
  .hs-page .hs-paid,
  .hs-page .hs-check { min-height: 28px; font-size: 12px; }
  .hs-page .hs-break-input { width: 56px; height: 28px; min-height: 0; border-radius: 6px; font-size: 13px; }
  .hs-extras-action { min-height: 28px; font-size: 12px; }
  .hs-cell .ui-tag { min-height: 20px; padding: 1px 7px; white-space: nowrap; }
  .hs-review { min-height: 24px; padding: 1px 8px; font-size: 12px; white-space: nowrap; }
  /* The tags: out of the line, over the table while the line (or the day) has the focus or
     the mouse; in the day while it is opened. */
  .hs-shift { position: relative; }
  .hs-cell:not([data-open]) .hs-tags,
  .hs-cell:not([data-open]) .hs-cell-tags {
    position: absolute; left: 0; z-index: 6; display: none; gap: 3px; width: max-content; max-width: 220px;
    padding: 4px; border: 1px solid var(--ui-line); border-radius: 8px; background: var(--ui-card);
  }
  .hs-cell:not([data-open]) .hs-tags { top: calc(100% + 2px); }
  .hs-cell:not([data-open]) .hs-cell-tags { bottom: calc(100% + 2px); }
  .hs-cell:not([data-open]) .hs-shift:focus-within .hs-tags:has(> :not([hidden])),
  .hs-cell:not([data-open]):focus-within .hs-cell-tags:has(> :not([hidden])) { display: flex; }
  .hs-cell[data-open] .hs-tags,
  .hs-cell[data-open] .hs-cell-tags { gap: 3px; }
  /* The dot: grey for a note (imported, holiday, Stratford, more shifts), amber for something
     to look at, red for a problem. */
  .hs-row .hs-cell:has(.hs-tags > :not([hidden]), .hs-cell-tags > :not([hidden]))::after {
    content: ""; position: absolute; top: 4px; right: 4px; width: 7px; height: 7px; border-radius: 50%;
    background: var(--ui-muted); pointer-events: none;
  }
  .hs-row .hs-cell:has([data-long-shift-badge]:not([hidden]), [data-review-button])::after { background: var(--ui-waiting-text); }
  .hs-row .hs-cell:has([data-validation-badge]:not([hidden]), [data-uncertain-shift-badge]:not([hidden]))::after { background: var(--ui-problem-text); }
  .hs-row .hs-cell[data-open]::after { display: none; }
  .hs-row .hs-morebtn { align-self: stretch; width: 18px; height: auto; min-height: 34px; border-radius: 6px; opacity: 0; }
  .hs-row .hs-morebtn .ui-icon { width: 16px; height: 16px; }
  .hs-row .hs-cell:focus-within .hs-morebtn,
  .hs-row .hs-cell[data-open] .hs-morebtn { opacity: 1; }
  .hs-row .hs-cell[data-open] .hs-morebtn { align-self: start; background: var(--ui-hover); color: var(--ui-text); }
  /* The person being typed in (static/timesheet.js sets data-active). */
  .hs-row[data-active] > .hs-person,
  .hs-row[data-active] .hs-cell { background: var(--ui-hover); }
  .hs-row[data-active] > .hs-person { box-shadow: inset 3px 0 0 var(--ui-gold); }
  /* The Save bar: room under the table, so the bar never covers the last person. */
  .hs-savebar { flex-wrap: nowrap; }
  .hs-save-hint { flex: 1 1 auto; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
  .hs-save-actions { flex: 0 0 auto; }
}
@media (hover: hover) {
  .hs-row .hs-cell:hover .hs-morebtn { opacity: 1; }
  .hs-cell:not([data-open]) .hs-shift:hover .hs-tags:has(> :not([hidden])),
  .hs-cell:not([data-open]):hover .hs-cell-tags:has(> :not([hidden])) { display: flex; }
}
@media (min-width: 768px) and (hover: none) { .hs-row .hs-morebtn { opacity: 1; } }
/* From 1024px the whole week fits, so the table needs no scrolling (and a day's tags can open
   over its edges); narrower laptops and tablets scroll it sideways, the names staying put. */
@media (min-width: 768px) and (max-width: 1023.98px) {
  .hs-gridhead,
  .hs-group { min-width: 900px; }
}
@media (min-width: 1024px) {
  .hs-list { overflow: visible; }
  .hs-gridhead > :first-child { border-top-left-radius: 11px; }
  .hs-gridhead > :last-child { border-top-right-radius: 11px; }
}

/* Hours: the Save bar (sticky at the bottom of the screen). */
.hs-savebar {
  position: sticky; bottom: 8px; z-index: 30;
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px;
  margin-top: 12px; padding: 8px 12px;
  border: 1px solid transparent; border-radius: 14px; background: var(--ui-card); box-shadow: var(--ui-float-shadow);
}
.hs-save-state { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; color: var(--ui-text); }
.hs-save-dot { flex: 0 0 auto; width: 8px; height: 8px; border-radius: 50%; background: var(--ui-done-text); }
.hs-save-state[data-state="unsaved"] { color: var(--ui-waiting-text); }
.hs-save-state[data-state="unsaved"] .hs-save-dot { background: var(--ui-waiting-text); }
.hs-save-state[data-state="error"] { color: var(--ui-problem-text); }
.hs-save-state[data-state="error"] .hs-save-dot { background: var(--ui-problem-text); }
.hs-save-hint { font-size: 13px; color: var(--ui-muted); }
.hs-save-actions { display: flex; gap: 8px; margin-left: auto; }
.hs-savebar .btn-ui:disabled { opacity: .5; cursor: default; }
.hs-savebar[data-quiet] { visibility: hidden; }
/* Laptops keep the bar in view, with its Ctrl+S hint, as the table always had it. */
@media (min-width: 768px) { .hs-savebar[data-quiet] { visibility: visible; } }
@media (max-width: 767.98px) {
  /* Phones: the Save bar is always there, floating just above the tab bar (whose top edge is
     76px up: 10 below it, padding 6 + 52 + 6, the edge), and the page keeps room for it, so
     nothing appears or moves as a save ends. One line: the state shortens before the buttons do. */
  .hs-page { padding-bottom: 88px; }
  .hs-savebar {
    position: fixed; left: 14px; right: 14px; bottom: calc(8px + env(safe-area-inset-bottom)); margin: 0;
    flex-wrap: nowrap;
  }
  body.has-app-nav .hs-savebar { bottom: calc(76px + 6px + env(safe-area-inset-bottom)); }
  .hs-save-state { flex: 1 1 auto; min-width: 0; }
  .hs-save-state [data-save-text] { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
  .hs-save-actions { flex: 0 0 auto; }
}

/* --- Single shift page (templates/shift_edit.html) ---
   One shift on a phone: a summary card (who, day, hours, tags, pay period), one form card of
   paired rows, Save fixed above the tab bar, Delete as quiet text. Tokens only, so Cream and
   Dark both work. Hover only where a mouse exists; a press shows on :active. */
.se-page { max-width: 720px; }
.se-page [hidden] { display: none !important; }
.se-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.se-head { display: flex; align-items: center; gap: 4px; margin: 0 0 8px -10px; }
.se-head .page-title-ui { font-size: 20px; }
.se-back {
  display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto;
  width: 44px; height: 44px; border-radius: 12px; color: var(--ui-red-text); text-decoration: none;
}
@media (hover: hover) { .se-back:hover { background: var(--ui-hover); } }
.se-back:active { background: var(--ui-hover); }
.se-back .ui-icon { transform: scaleX(-1); width: 22px; height: 22px; }

.se-summary { margin-bottom: 12px; padding: 12px 14px; }
.se-summary-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.se-who { min-width: 0; }
.se-name { margin: 0; font-size: 17px; font-weight: 600; overflow-wrap: anywhere; }
.se-when { margin: 2px 0 0; font-size: 14px; color: var(--ui-muted); }
.se-total { flex: 0 0 auto; margin: 0; text-align: right; }
.se-total b { display: block; font-size: 28px; font-weight: 600; line-height: 1.1; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.se-total span { font-size: 12px; color: var(--ui-muted); }
.se-span { margin: 8px 0 0; font-size: 15px; font-weight: 500; font-variant-numeric: tabular-nums; }
.se-span small { font-size: 13px; font-weight: 400; color: var(--ui-muted); }
/* The dot before "to pay" / "already paid" belongs to the badge, so it hides with it (no dot left hanging on an error). */
.se-pay::before { content: " · "; }
.se-tags { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 10px; }
.se-review[data-state="checked"] { background: var(--ui-checked-bg); color: var(--ui-checked-text); }
.se-review[data-state="waiting"] { background: var(--ui-waiting-bg); color: var(--ui-waiting-text); }
.se-muted { margin: 8px 0 0; font-size: 13px; color: var(--ui-muted); }
.se-period {
  display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px;
  margin: 10px 0 0; padding-top: 10px; border-top: 1px solid var(--ui-line);
  font-size: 13px; color: var(--ui-muted);
}
.se-period [data-shift-period] { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px; font-weight: 600; color: var(--ui-text); }
.se-banner { display: flex; align-items: flex-start; gap: 8px; margin: 10px 0 0; padding: 10px 12px; border-radius: 12px; font-size: 13px; line-height: 1.4; }
.se-banner .ui-icon { flex: 0 0 auto; margin-top: 1px; }
.se-banner-locked { background: var(--ui-finished-bg); color: var(--ui-finished-text); }
.se-banner-reviewed { background: var(--ui-checked-bg); color: var(--ui-checked-text); }

.se-card { margin-bottom: 4px; padding: 0; }
.se-row { padding: 8px 12px; }
.se-row + .se-row { border-top: 1px solid var(--ui-line); }
.se-pair { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; align-items: start; }
.se-pair-single { grid-template-columns: minmax(0, 1fr); }
body .se-page .ui-field { gap: 4px; }
body .se-page .ui-field label { font-size: 12px; font-weight: 500; color: var(--ui-muted); }
body .se-page .ui-field input[aria-invalid="true"] { border-color: var(--ui-red-text); }
.se-affix { position: relative; min-width: 0; }
body .se-page .se-affix input[name="break_minutes"] { padding-right: 44px; }
.se-suffix { position: absolute; top: 50%; right: 12px; transform: translateY(-50%); font-size: 14px; color: var(--ui-muted); pointer-events: none; }
.se-chip {
  position: absolute; top: 50%; right: 8px; transform: translateY(-50%);
  padding: 2px 7px; border-radius: 999px; font-size: 12px; font-weight: 600; line-height: 1.3; white-space: nowrap;
  background: var(--ui-waiting-bg); color: var(--ui-waiting-text); pointer-events: none;
}
.se-error { margin: 6px 0 0; font-size: 13px; font-weight: 500; color: var(--ui-problem-text); }
.se-switch-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 44px; font-size: 15px; }
body .se-page input.se-switch {
  position: relative; flex: 0 0 auto; width: 48px; min-width: 48px; height: 28px; min-height: 0; padding: 0;
  border: 0; border-radius: 999px; background: var(--ui-track);
  appearance: none; -webkit-appearance: none; cursor: pointer; transition: background 0.15s ease-out;
}
body .se-page input.se-switch::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%;
  background: var(--ui-knob); box-shadow: 0 1px 2px var(--ui-line); transition: left 0.15s ease-out;
}
body .se-page input.se-switch:checked { background: var(--ui-done-text); }
body .se-page input.se-switch:checked::after { left: 23px; }
body .se-page input.se-switch:disabled { opacity: .55; cursor: default; }
.se-note-summary {
  display: flex; align-items: center; gap: 8px; min-height: 44px; font-size: 15px; cursor: pointer; list-style: none;
}
.se-note-summary::-webkit-details-marker { display: none; }
.se-note-summary::marker { content: ""; }
@media (hover: hover) { .se-note-summary:hover { color: var(--ui-red-text); } }
.se-note-summary:active { background: var(--ui-hover); }
.se-note-value { flex: 1 1 auto; min-width: 0; overflow: hidden; text-align: right; text-overflow: ellipsis; white-space: nowrap; }
.se-note-value[data-empty] { color: var(--ui-muted); }
.se-note-summary .ui-icon { flex: 0 0 auto; color: var(--ui-muted); transition: transform 0.15s ease-out; }
.se-note[open] .se-note-summary .ui-icon { transform: rotate(90deg); }
.se-note[open] .se-note-value { visibility: hidden; }
.se-note-field { padding-bottom: 4px; }

.se-savebar { display: flex; flex-direction: column; align-items: stretch; gap: 6px; padding: 12px; border-top: 1px solid var(--ui-line); }
.se-savebar .btn-ui { width: 100%; min-height: 48px; font-size: 16px; }
.se-save-hint { margin: 0; font-size: 12px; text-align: center; color: var(--ui-muted); }
.se-delete { display: flex; justify-content: center; margin: 8px 0 0; }
body .se-delete-button {
  min-height: 44px; padding: 0 16px; border: 0; border-radius: 12px; background: none;
  font: inherit; font-size: 15px; font-weight: 500; color: var(--ui-red-text); cursor: pointer;
}
@media (hover: hover) { body .se-delete-button:hover { text-decoration: underline; } }
body .se-delete-button:active { background: var(--ui-hover); }
body .se-delete-button:disabled { opacity: .5; cursor: default; background: none; text-decoration: none; }
.se-page .btn-ui:disabled { opacity: .5; cursor: default; }
@media (min-width: 768px) {
  .se-savebar { flex-direction: row; justify-content: flex-end; align-items: center; }
  .se-savebar .btn-ui { width: auto; min-width: 180px; }
}
@media (max-width: 767.98px) {
  /* The floating tab bar's top edge is 76px up: the Save bar floats just above it, and the page leaves room under Delete. */
  .se-page { padding-bottom: 96px; }
  .se-savebar {
    position: fixed; left: 14px; right: 14px; bottom: calc(76px + 6px + env(safe-area-inset-bottom)); z-index: 30;
    padding: 10px 16px; border-top: 0; border-radius: 18px; background: var(--ui-raised); box-shadow: var(--ui-float-shadow);
  }
  /* static/timesheet.js sets data-keyboard while the phone's keyboard is open. */
  .se-savebar[data-keyboard] { position: static; padding: 12px; }
}

/* --- Staff rota (templates/staff_rota.html) --- */
/* Staff see their department's applied rota for one week, split by place (owner 2026-10-23):
   below 1024px one day at a time, picked in the day strip (a dot marks the viewer's working
   days); from 1024px the seven days side by side. The viewer's own line is tinted. The tsh-
   prefix is from the Team sheet this page replaced. Tokens only, so light and dark both work. */
.tsh-week { display: flex; align-items: center; gap: 8px; max-width: 480px; margin: 0 auto 16px; }
.tsh-arrow {
  display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto;
  width: 44px; height: 44px; border: 1px solid var(--ui-line); border-radius: 50%;
  background: var(--ui-card); color: var(--ui-muted); text-decoration: none;
}
@media (hover: hover) { .tsh-arrow:hover { background: var(--ui-hover); color: var(--ui-text); } }
.tsh-arrow:focus-visible { outline: 2px solid var(--ui-red-text); outline-offset: 2px; }
.tsh-arrow-prev .ui-icon { transform: scaleX(-1); }
.tsh-arrow-off { visibility: hidden; }
.tsh-dates {
  flex: 1 1 auto; min-width: 0; text-align: center;
  font-size: 16px; font-weight: 600; font-variant-numeric: tabular-nums;
}
.tsh-days { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; margin: 0 0 16px; }
body .tsh-day {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-height: 44px; padding: 6px 0 10px; border: 1px solid var(--ui-line); border-radius: 12px;
  background: var(--ui-card); color: var(--ui-text); font: inherit; font-size: 12px; cursor: pointer;
}
body .tsh-day[aria-pressed="true"] { background: var(--ui-select-bg); border-color: var(--ui-select-bg); color: var(--ui-select-text); }
body .tsh-day[data-works]::after {
  content: ""; position: absolute; bottom: 5px; left: 50%; width: 5px; height: 5px; margin-left: -2.5px;
  border-radius: 50%; background: var(--ui-red-text);
}
body .tsh-day[data-works][aria-pressed="true"]::after { background: var(--ui-select-text); }
body .tsh-day:focus-visible { outline: 2px solid var(--ui-red-text); outline-offset: 2px; }
.tsh-day-num { font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; }
.tsh-board { margin: 0 0 16px; }
.tsh-me {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  min-height: 52px; margin: 0 0 16px; padding: 8px 16px; border-radius: 16px;
  background: var(--ui-card); box-shadow: var(--ui-card-shadow); font-size: 15px;
}
.tsh-place + .tsh-place { margin-top: 16px; }
.tsh-place-name { display: flex; align-items: baseline; gap: 8px; margin: 0 4px 6px; font-size: 15px; font-weight: 600; color: var(--ui-text); }
.tsh-place-count { font-size: 13px; font-weight: 500; color: var(--ui-muted); font-variant-numeric: tabular-nums; }
.tsh-list { margin: 0; padding: 4px 16px; list-style: none; border-radius: 16px; background: var(--ui-card); box-shadow: var(--ui-card-shadow); }
.tsh-item { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 48px; padding: 8px 0; font-size: 15px; }
.tsh-item + .tsh-item { border-top: 1px solid var(--ui-line); }
.tsh-item[data-viewer] { margin: 0 -10px; padding-inline: 10px; border-radius: 10px; background: var(--ui-brand-soft); }
.tsh-item[data-viewer] + .tsh-item,
.tsh-item + .tsh-item[data-viewer] { border-top-color: transparent; }
.tsh-name { min-width: 0; }
.tsh-item[data-viewer] .tsh-name,
.tsh-me .tsh-name { font-weight: 600; }
.tsh-you { margin-left: 4px; font-size: 12px; font-weight: 600; color: var(--ui-red-text); }
.tsh-times { text-align: right; }
.tsh-time { display: block; font-variant-numeric: tabular-nums; }
.tsh-site { font-size: 12px; color: var(--ui-muted); }
.tsh-off { margin: 0; padding: 12px 4px; font-size: 14px; color: var(--ui-muted); }
@media (max-width: 1023.98px) {
  .tsh-board-only,
  .tsh-board:not([data-open]) { display: none; }
}
@media (min-width: 1024px) {
  .tsh-strip-only { display: none; }
  .tsh-boards { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 10px; align-items: start; }
  .tsh-board { margin: 0; }
  .tsh-board-head { display: flex; align-items: baseline; gap: 6px; margin: 0 4px 10px; font-size: 13px; font-weight: 600; color: var(--ui-muted); }
  .tsh-board-num { font-size: 20px; color: var(--ui-text); font-variant-numeric: tabular-nums; }
  .tsh-board[data-today] .tsh-board-head,
  .tsh-board[data-today] .tsh-board-num { color: var(--ui-red-text); }
  .tsh-me { flex-direction: column; align-items: flex-start; gap: 4px; min-height: 0; margin-bottom: 12px; padding: 8px 10px; border-radius: 12px; font-size: 13px; }
  .tsh-place + .tsh-place { margin-top: 12px; }
  .tsh-place-name { justify-content: space-between; margin-bottom: 4px; font-size: 13px; }
  .tsh-place-count { font-size: 12px; }
  .tsh-list { padding: 2px 10px; border-radius: 12px; }
  .tsh-item { flex-direction: column; align-items: flex-start; gap: 0; min-height: 0; padding: 7px 0; font-size: 14px; }
  .tsh-item[data-viewer] { margin: 0 -6px; padding-inline: 6px; }
  .tsh-times { text-align: left; font-size: 13px; color: var(--ui-muted); }
  .tsh-item[data-viewer] .tsh-times { color: var(--ui-text); }
  .tsh-off { padding: 8px 4px; font-size: 13px; }
}

/* --- Holidays page (templates/holidays_manage.html) --- */
/* Rota › Holidays: waiting requests first, then coming up, holiday left with gold bars, and
   earlier. Each request is one tap target that opens its sheet (the shared .ui-sheet). Tokens
   only, so Cream and Dark both work; bars are gold for taken and a lighter gold for booked, as on
   the Hours pages. One column, as wide as a comfortable list, on laptops too. */
.hol-page { max-width: 760px; }
.hol-page [hidden] { display: none !important; }
.hol-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.hol-head-text { min-width: 0; }
.hol-sub { margin: 4px 0 0; font-size: 14px; color: var(--ui-muted); }
.hol-link { font-weight: 500; color: var(--ui-red-text); }
@media (hover: hover) { .hol-link:hover { color: var(--ui-red-text); } }
.hol-section { margin-bottom: 22px; }
body .hol-h2 { margin: 0 2px 8px; font-family: inherit; font-size: 14px; font-weight: 600; letter-spacing: 0; color: var(--ui-muted); }
.hol-h2row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 2px 8px; }
body .hol-h2row .hol-h2 { margin: 0; }
.hol-list { margin: 0; padding: 0; overflow: hidden; list-style: none; border: 1px solid transparent; box-shadow: var(--ui-card-shadow); border-radius: 16px; background: var(--ui-card); }
.hol-list > li + li { border-top: 1px solid var(--ui-line); }
.hol-row,
.hol-left {
  width: 100%; min-height: 56px; padding: 10px 14px; border: 0; background: none;
  color: var(--ui-text); font: inherit; text-align: left; text-decoration: none; cursor: pointer;
}
.hol-row { display: flex; align-items: center; gap: 12px; }
.hol-left { display: grid; gap: 6px; }
@media (hover: hover) {
  .hol-row:hover,
  .hol-left:hover { background: var(--ui-hover); color: var(--ui-text); }
}
@media (hover: none) { .hol-row:active, .hol-left:active { background: var(--ui-hover); } }
.hol-row:focus-visible,
.hol-left:focus-visible { outline: 2px solid var(--ui-red-text); outline-offset: -2px; }
.hol-row .ui-icon { color: var(--ui-muted); }
.hol-row-main { display: grid; flex: 1 1 auto; gap: 2px; min-width: 0; }
.hol-row-top { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
.hol-name { font-size: 15px; font-weight: 600; overflow-wrap: anywhere; }
.hol-meta { font-size: 13px; color: var(--ui-muted); overflow-wrap: anywhere; }
.hol-empty { margin: 0; padding: 14px; border: 1px solid transparent; box-shadow: var(--ui-card-shadow); border-radius: 16px; background: var(--ui-card); font-size: 14px; color: var(--ui-muted); }
.hol-years { display: inline-flex; align-items: center; gap: 6px; }
.hol-arrow {
  display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto;
  width: 36px; height: 36px; border: 1px solid var(--ui-line); border-radius: 50%;
  background: var(--ui-card); color: var(--ui-muted); text-decoration: none;
}
@media (hover: hover) { .hol-arrow:hover { background: var(--ui-hover); color: var(--ui-text); } }
.hol-arrow:focus-visible { outline: 2px solid var(--ui-red-text); outline-offset: 2px; }
.hol-arrow-prev .ui-icon { transform: scaleX(-1); }
.hol-left-top { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.hol-left-days { flex: 0 0 auto; font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.hol-bar { display: flex; height: 8px; overflow: hidden; border-radius: 999px; background: var(--ui-track); }
.hol-bar-taken,
.hol-bar-booked { display: block; flex: 0 0 auto; height: 100%; background: var(--ui-gold); }
.hol-bar-booked { opacity: .5; }
.hol-figs { display: flex; flex-wrap: wrap; gap: 2px 12px; font-size: 12px; color: var(--ui-muted); }
.hol-fig { font-weight: 600; color: var(--ui-text); font-variant-numeric: tabular-nums; }
@media (max-width: 767.98px) {
  .hol-arrow { width: 44px; height: 44px; }
}

/* --- Staff availability page (templates/me_availability.html) --- */
/* The staff "Availability" tab: holiday left, the two choices, and the person's requests and
   dates, each row one tap target. The sheets are the shared .ui-sheet (Task 4). Tokens only, so
   Cream and Dark both work. */
.to-head { margin-bottom: 16px; }
.to-sub { margin: 4px 0 0; font-size: 14px; color: var(--ui-muted); }
@media (min-width: 900px) {
  .to-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; align-items: start; }
}
.to-left-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 12px; }
.to-left-days { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: flex-end; gap: 4px 8px; min-width: 0; font-size: 20px; font-weight: 600; font-variant-numeric: tabular-nums; }
.to-left-days > span { white-space: nowrap; }
.to-bar { display: flex; height: 8px; margin: 12px 0 0; overflow: hidden; border-radius: 999px; background: var(--ui-track); }
.to-bar-taken { background: var(--ui-gold); }
.to-bar-booked { background: var(--ui-gold); opacity: .45; }
.to-figures { display: grid; grid-template-columns: repeat(4, auto); justify-content: space-between; gap: 8px 12px; margin: 14px 0 2px; }
/* Each figure's label on top and its value at the foot, so a label on two lines keeps the values in a row. */
.to-figures > div { display: flex; flex-direction: column; justify-content: space-between; }
.to-figures dt { font-size: 12px; font-weight: 400; color: var(--ui-muted); }
.to-figures dd { margin: 2px 0 0; font-size: 15px; font-weight: 600; color: var(--ui-text); font-variant-numeric: tabular-nums; }
/* The two ways to ask: rows of one card, an icon in a Midnight tile, the whole row the tap target. */
.to-choices { padding-block: 4px; }
.to-choice {
  display: flex; align-items: center; gap: 12px;
  width: calc(100% + 16px); min-height: 64px; margin: 0 -8px; padding: 8px;
  border: 0; border-radius: 12px; background: none; color: var(--ui-text);
  font: inherit; text-align: left; cursor: pointer;
}
.to-choice + .to-choice { position: relative; }
.to-choice + .to-choice::before { content: ""; position: absolute; top: 0; right: 8px; left: 60px; border-top: 1px solid var(--ui-line); }
@media (hover: hover) { .to-choice:hover { background: var(--ui-hover); } }
@media (hover: none) { .to-choice:active { background: var(--ui-hover); } }
.to-choice-icon {
  display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto;
  width: 40px; height: 40px; border-radius: 12px; background: var(--ui-brand-soft); color: var(--ui-red-text);
}
.to-choice-main { display: flex; flex: 1 1 auto; flex-direction: column; gap: 2px; min-width: 0; }
.to-choice-title { font-size: 15px; font-weight: 600; }
.to-choice-sub { font-size: 13px; color: var(--ui-muted); }
.to-choice > .ui-icon { flex: 0 0 auto; color: var(--ui-muted); }
.to-item {
  display: flex; align-items: center; gap: 12px;
  width: calc(100% + 16px); min-height: 56px; margin: 0 -8px; padding: 8px;
  border: 0; border-radius: 10px;
  background: none; color: var(--ui-text);
  font: inherit; text-align: left;
}
button.to-item { cursor: pointer; }
@media (hover: hover) { button.to-item:hover { background: var(--ui-hover); } }
@media (hover: none) { button.to-item:active { background: var(--ui-hover); } }
.to-choice:focus-visible,
button.to-item:focus-visible { outline: 2px solid var(--ui-red-text); outline-offset: 2px; }
.to-item-main { flex: 1 1 auto; min-width: 0; font-size: 14px; }
.to-item-dates { display: block; font-weight: 600; }
.to-item > .ui-icon { color: var(--ui-muted); }
.to-sheet-line { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 12px; font-size: 14px; }

/* --- Who's off (templates/availability_manage.html) --- */
/* Rota › Time off and the supervisors' Team tab: managers get the waiting requests on top and a
   link to Holidays; then a month calendar for one department, with a dot for each kind of time off
   on a day (green holiday, grey not available, amber waiting), and the chosen day's people. Phones
   show the calendar above the list; from 900px they sit side by side. Tokens only. */
.wo-page [hidden] { display: none !important; }
.wo-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.wo-head-text { min-width: 0; }
.wo-sub { margin: 4px 0 0; font-size: 14px; color: var(--ui-muted); }
.wo-depts { flex-wrap: wrap; width: fit-content; max-width: 100%; margin: 0 0 14px; }
.wo-depts a {
  display: inline-flex; align-items: center; justify-content: center; min-height: 36px; padding: 0 12px;
  border-radius: 8px; color: var(--ui-muted); font-size: 13px; font-weight: 500; text-decoration: none; white-space: nowrap;
}
@media (hover: hover) { .wo-depts a:hover { color: var(--ui-text); } }
.wo-depts a[aria-current="page"] { background: var(--ui-select-bg); color: var(--ui-select-text); font-weight: 600; }
@media (hover: hover) { .wo-depts a[aria-current="page"]:hover { color: var(--ui-select-text); } }
.wo-depts a:focus-visible { outline: 2px solid var(--ui-red-text); outline-offset: 2px; }
.wo-layout { display: grid; gap: 16px; }
.wo-cal { padding: 12px; border: 1px solid transparent; box-shadow: var(--ui-card-shadow); border-radius: 16px; background: var(--ui-card); }
.wo-monthbar { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
body .wo-month { margin: 0; font-family: inherit; font-size: 16px; font-weight: 600; letter-spacing: 0; color: var(--ui-text); }
.wo-arrow,
.wo-arrow-gap { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; width: 36px; height: 36px; }
.wo-arrow { border: 1px solid var(--ui-line); border-radius: 50%; background: var(--ui-card); color: var(--ui-muted); text-decoration: none; }
@media (hover: hover) { .wo-arrow:hover { background: var(--ui-hover); color: var(--ui-text); } }
.wo-arrow:focus-visible { outline: 2px solid var(--ui-red-text); outline-offset: 2px; }
.wo-arrow-prev .ui-icon { transform: scaleX(-1); }
.wo-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.wo-dow { padding-bottom: 2px; font-size: 12px; color: var(--ui-muted); text-align: center; }
.wo-day {
  display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 44px;
  border-radius: 10px; background: var(--ui-hover); color: var(--ui-text);
  font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; text-decoration: none;
}
@media (hover: hover) { a.wo-day:hover { background: var(--ui-track); color: var(--ui-text); } }
.wo-day:focus-visible { outline: 2px solid var(--ui-red-text); outline-offset: 2px; }
.wo-day-out { background: none; color: var(--ui-muted); font-weight: 400; }
/* Today has a red ring; the chosen day is filled. The chosen rule comes after the hover rule, so a
   hovered chosen day stays filled. */
.wo-day[data-today] { box-shadow: inset 0 0 0 2px var(--ui-red-text); }
.wo-day[aria-current="date"] { background: var(--ui-text); color: var(--ui-card); }
@media (hover: hover) { a.wo-day[aria-current="date"]:hover { background: var(--ui-text); color: var(--ui-card); } }
.wo-dots { display: flex; gap: 3px; height: 6px; margin-top: 3px; }
.wo-dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; }
.wo-dot[data-dot="holiday"] { background: var(--ui-done-text); }
.wo-dot[data-dot="unavailable"] { background: var(--ui-muted); }
.wo-dot[data-dot="waiting"] { background: var(--ui-waiting-text); }
.wo-day[aria-current="date"] .wo-dot { box-shadow: 0 0 0 1px var(--ui-card); }
.wo-legend { display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 10px 2px 0; font-size: 12px; color: var(--ui-muted); }
.wo-legend-item { display: inline-flex; align-items: center; gap: 6px; }
.wo-waiting { margin-bottom: 12px; }
.wo-waiting .wo-entry .ui-icon { flex: 0 0 auto; color: var(--ui-muted); }
.wo-holidays {
  display: inline-flex; align-items: center; min-height: 44px; margin: 0 2px 8px;
  font-size: 14px; font-weight: 500; color: var(--ui-red-text); text-decoration: none;
}
@media (hover: hover) { .wo-holidays:hover { color: var(--ui-red-text); text-decoration: underline; } }
.wo-holidays:focus-visible { outline: 2px solid var(--ui-red-text); outline-offset: 2px; }
body .wo-h2 { margin: 0 2px 8px; font-family: inherit; font-size: 16px; font-weight: 600; letter-spacing: 0; color: var(--ui-text); }
.wo-list { margin: 0; padding: 0; overflow: hidden; list-style: none; border: 1px solid transparent; box-shadow: var(--ui-card-shadow); border-radius: 16px; background: var(--ui-card); }
.wo-list > li + li { border-top: 1px solid var(--ui-line); }
.wo-entry {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 56px; padding: 10px 14px;
  border: 0; background: none; color: var(--ui-text); font: inherit; text-align: left; text-decoration: none;
}
button.wo-entry,
a.wo-entry { cursor: pointer; }
@media (hover: hover) {
  button.wo-entry:hover,
  a.wo-entry:hover { background: var(--ui-hover); color: var(--ui-text); }
}
@media (hover: none) { button.wo-entry:active, a.wo-entry:active { background: var(--ui-hover); } }
.wo-entry:focus-visible { outline: 2px solid var(--ui-red-text); outline-offset: -2px; }
.wo-entry-main { display: grid; flex: 1 1 auto; gap: 2px; min-width: 0; }
.wo-name { font-size: 15px; font-weight: 600; overflow-wrap: anywhere; }
.wo-meta { font-size: 13px; color: var(--ui-muted); overflow-wrap: anywhere; }
.wo-empty { margin: 0; padding: 14px; border: 1px solid transparent; box-shadow: var(--ui-card-shadow); border-radius: 16px; background: var(--ui-card); font-size: 14px; color: var(--ui-muted); }
@media (min-width: 900px) {
  .wo-layout { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; }
}
@media (max-width: 767.98px) {
  .wo-arrow,
  .wo-arrow-gap { width: 44px; height: 44px; }
  .wo-depts a { min-height: 44px; }
}

/* --- Staff (templates/staff.html) --- */
/* Staff › People, People who left, a person's page, their notes and Signups (staff.html,
   staff_person.html, staff_notes.html, staff_signups.html and the _staff.html macros). One
   column, as wide as a comfortable list, on laptops too; each row is one tap target. The sheets
   are the shared .ui-sheet. Tokens only, so Cream and Dark both work. */
.stf-page { max-width: 760px; }
.stf-page [hidden] { display: none !important; }
.stf-back {
  display: inline-flex; align-items: center; min-height: 36px; margin-bottom: 6px;
  font-size: 14px; font-weight: 500; color: var(--ui-red-text); text-decoration: none;
}
@media (hover: hover) { .stf-back:hover { color: var(--ui-red-text); text-decoration: underline; } }
.stf-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.stf-head-text { min-width: 0; }
.stf-sub { margin: 4px 0 0; font-size: 14px; color: var(--ui-muted); }
body .stf-search {
  width: 100%; min-height: 40px; margin: 0 0 16px; padding: 8px 14px;
  border: 1px solid transparent; border-radius: 12px;
  background: var(--ui-fill); color: var(--ui-text); font: inherit; font-size: 15px;
}
body .stf-search:focus { outline: none; border-color: var(--ui-red-text); box-shadow: 0 0 0 3px var(--ui-brand-soft); }
.stf-group { margin-bottom: 20px; }
body .stf-h2 { margin: 0 2px 8px; font-family: inherit; font-size: 14px; font-weight: 600; letter-spacing: 0; color: var(--ui-muted); }
.stf-list { margin: 0; padding: 0; overflow: hidden; list-style: none; border: 1px solid transparent; box-shadow: var(--ui-card-shadow); border-radius: 16px; background: var(--ui-card); }
.stf-list > li + li { border-top: 1px solid var(--ui-line); }
.stf-row,
.stf-left-link {
  display: flex; align-items: center; gap: 12px;
  width: 100%; min-height: 56px; padding: 10px 14px; border: 0; background: none;
  color: var(--ui-text); font: inherit; text-align: left; text-decoration: none; cursor: pointer;
}
.stf-left-link { margin-bottom: 20px; border: 1px solid transparent; box-shadow: var(--ui-card-shadow); border-radius: 16px; background: var(--ui-card); }
@media (hover: hover) { .stf-row:hover, .stf-left-link:hover { background: var(--ui-hover); color: var(--ui-text); } }
@media (hover: none) { .stf-row:not(.stf-row-plain):active, .stf-left-link:active { background: var(--ui-hover); } }
.stf-row:focus-visible, .stf-left-link:focus-visible { outline: 2px solid var(--ui-red-text); outline-offset: -2px; }
.stf-row > .ui-icon, .stf-left-link > .ui-icon { flex: 0 0 auto; color: var(--ui-muted); }
.stf-initials {
  display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto;
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--ui-track); color: var(--ui-text); font-size: 13px; font-weight: 600;
}
.stf-row-main { display: grid; flex: 1 1 auto; gap: 2px; min-width: 0; }
.stf-name { font-size: 15px; font-weight: 600; overflow-wrap: anywhere; }
.stf-meta { font-size: 13px; color: var(--ui-muted); overflow-wrap: anywhere; }
.stf-contact { display: none; }
.stf-error { margin: 0; padding: 10px 12px; border: 1px solid var(--ui-problem-text); border-radius: 12px; background: var(--ui-problem-bg); color: var(--ui-problem-text); font-size: 14px; }
.stf-link { font-weight: 500; color: var(--ui-red-text); }
@media (hover: hover) { .stf-link:hover { color: var(--ui-red-text); } }
@media (min-width: 768px) { .stf-contact { display: inline; } }
@media (max-width: 767.98px) {
  body .stf-search { min-height: 44px; }
  .stf-back { min-height: 44px; }
}
/* The person page (staff_person.html): head, quick buttons, the missing line, six section rows
   (two columns on laptops), and the sheets' read-only bits. */
.stf-person-head { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.stf-person-head .page-title-ui { margin: 0; overflow-wrap: anywhere; }
.stf-initials-lg { width: 56px; height: 56px; font-size: 18px; }
.stf-quick { display: flex; gap: 10px; margin-bottom: 12px; }
.stf-quick-btn { flex: 1 1 0; justify-content: center; min-height: 44px; }
.stf-mail { display: inline-flex; align-items: center; min-height: 44px; color: var(--ui-red-text); font-weight: 500; }
.stf-missing {
  display: flex; align-items: center; width: 100%; min-height: 44px; margin-bottom: 12px; padding: 10px 14px;
  border: 1px solid var(--ui-waiting-text); border-radius: 14px; background: var(--ui-waiting-bg);
  color: var(--ui-waiting-text); font: inherit; font-size: 14px; font-weight: 500; text-align: left; cursor: pointer;
}
.stf-missing:focus-visible { outline: 2px solid var(--ui-red-text); outline-offset: 2px; }
.stf-missing.stf-alert { border-color: var(--ui-problem-text); background: var(--ui-problem-bg); color: var(--ui-problem-text); }
.stf-sections { margin-bottom: 16px; }
.stf-count { margin-left: 6px; vertical-align: middle; }
.stf-foot { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-bottom: 24px; }
/* A pause that isn't over (ADR 0007): its line and Resume, above the foot buttons. */
.stf-paused { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; margin: 0 0 16px; padding: 12px 16px; border-radius: 14px; background: var(--ui-card); }
.stf-paused-text { margin: 0; font-weight: 600; color: var(--ui-text); }
.stf-foot-btn { min-height: 44px; }
.stf-fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
.stf-fieldset:disabled input,
.stf-fieldset:disabled select { opacity: .7; }
.stf-holiday { display: grid; gap: 8px; margin: 14px 0 10px; padding: 12px; border: 1px solid var(--ui-line); border-radius: 14px; }
.stf-holiday-days { font-size: 15px; font-weight: 600; }
.stf-bar { display: flex; height: 8px; overflow: hidden; border-radius: 999px; background: var(--ui-track); }
.stf-bar-taken,
.stf-bar-booked { display: block; height: 100%; background: var(--ui-gold); }
.stf-bar-booked { opacity: .5; }
.stf-figs { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 13px; color: var(--ui-muted); }
.stf-fig { font-weight: 600; color: var(--ui-text); }
.stf-send { margin: 12px 0; }
.stf-fieldset > legend { margin-bottom: 6px; padding: 0; font-size: 14px; font-weight: 500; color: var(--ui-text); }
.stf-choice { display: flex; gap: 4px; padding: 3px; border-radius: 10px; background: var(--ui-hover); }
body .ui-field .stf-choice-option { display: flex; flex: 1 1 0; align-items: center; justify-content: center; gap: 8px; min-height: 44px; border-radius: 8px; color: var(--ui-muted); font-size: 14px; cursor: pointer; }
body .ui-field .stf-choice-option:has(input:checked) { background: var(--ui-select-bg); color: var(--ui-select-text); font-weight: 600; }
.stf-choice-option:has(input:focus-visible) { outline: 2px solid var(--ui-red-text); outline-offset: 2px; }
body .ui-field .stf-choice-option input { position: absolute; width: 1px; height: 1px; min-height: 0; padding: 0; border: 0; opacity: 0; }
@media (min-width: 768px) {
  .stf-sections { display: grid; grid-template-columns: 1fr 1fr; }
  .stf-sections > li:nth-child(2) { border-top: 0; }
  .stf-sections > li:nth-child(odd) { border-right: 1px solid var(--ui-line); }
}

/* The Notes page (staff_notes.html): a head with the privacy line, then one tappable row per note. */
.stf-notes-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.stf-notes-head .page-title-ui { margin: 0; }
.stf-private { margin: 4px 0 0; font-size: 13px; color: var(--ui-muted); }
.stf-note {
  display: grid; gap: 6px; width: 100%; min-height: 56px; padding: 12px 14px;
  border: 0; background: transparent; color: var(--ui-text);
  font: inherit; text-align: left; cursor: pointer;
}
@media (hover: hover) { .stf-note:hover { background: var(--ui-hover); } }
@media (hover: none) { .stf-note:active { background: var(--ui-hover); } }
.stf-note:focus-visible { outline: 2px solid var(--ui-red-text); outline-offset: -2px; }
.stf-note-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.stf-note-body { font-size: 14px; line-height: 1.45; white-space: pre-line; overflow-wrap: anywhere; }
.stf-empty { margin: 24px 0; font-size: 14px; color: var(--ui-muted); text-align: center; }
.stf-delete { margin-top: 12px; }
.stf-delete .btn-ui { min-height: 44px; color: var(--ui-red-text); }

/* The Signups page (staff_signups.html): a declined signup is a row that opens nothing. */
.stf-row-plain { cursor: default; }
@media (hover: hover) { .stf-row-plain:hover { background: transparent; } }

/* --- Payroll (templates/payroll.html) --- */
.pay-page { display: grid; gap: 16px; }
.pay-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.pay-head-text { display: grid; gap: 8px; min-width: 0; }
.pay-switch { display: flex; align-items: center; gap: 8px; }
.pay-arrow {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  width: 36px; min-height: 36px; border: 1px solid transparent; border-radius: 999px;
  background: var(--ui-fill); color: var(--ui-text);
}
@media (hover: hover) { .pay-arrow:hover { background: var(--ui-hover); } }
.pay-arrow:focus-visible { outline: 2px solid var(--ui-red-text); outline-offset: 2px; }
.pay-arrow-prev .ui-icon { transform: scaleX(-1); }
.pay-when { display: grid; gap: 2px; min-width: 0; }
.pay-month { font-size: 17px; font-weight: 600; }
.pay-dates { font-size: 13px; color: var(--ui-muted); }
.pay-head-actions { display: flex; flex: none; align-items: center; gap: 8px; }
.pay-download { flex: none; }
/* The ⋯ menu (app review, problem 7): Review on Hours, All periods and the other PDFs. A <details>;
   static/time_off.js closes it on a tap outside, Escape or a row. */
.pay-more { position: relative; flex: none; }
.pay-menubtn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 44px; min-height: 44px; border: 1px solid var(--ui-line); border-radius: 50%;
  background: var(--ui-card); color: var(--ui-text); cursor: pointer; list-style: none;
}
.pay-menubtn::-webkit-details-marker { display: none; }
@media (hover: hover) { .pay-menubtn:hover { background: var(--ui-hover); } }
.pay-menubtn:focus-visible { outline: 2px solid var(--ui-red-text); outline-offset: 2px; }
.pay-menubtn .ui-icon { width: 22px; height: 22px; }
.pay-menu {
  position: absolute; top: calc(100% + 6px); right: 0; z-index: 30; display: grid; gap: 6px;
  width: min(280px, calc(100vw - 32px)); padding: 8px; border: 1px solid transparent; border-radius: 16px;
  background: var(--ui-raised); box-shadow: var(--ui-shadow);
}
.pay-menu-row {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 48px; margin: 0; padding: 8px 12px;
  border: 0; border-radius: 10px; background: none; color: var(--ui-text);
  font: inherit; font-size: 15px; font-weight: 500; text-align: left; text-decoration: none; cursor: pointer;
}
@media (hover: hover) { .pay-menu-row:hover { background: var(--ui-hover); color: var(--ui-text); } }
.pay-menu-row:active { background: var(--ui-hover); }
.pay-menu-row:focus-visible { outline: 2px solid var(--ui-red-text); outline-offset: -2px; }
.pay-menu-row .ui-icon { flex: 0 0 auto; color: var(--ui-muted); }
.pay-status-line { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; }
.pay-note {
  display: flex; align-items: center; gap: 8px; margin: 0; padding: 10px 12px; border-radius: 14px;
  background: var(--ui-waiting-bg); color: var(--ui-waiting-text); font-size: 14px;
}
.pay-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin: 0; }
.pay-tile { margin: 0; padding: 12px 14px; border: 1px solid transparent; box-shadow: var(--ui-card-shadow); border-radius: 16px; background: var(--ui-card); }
.pay-tile dt { font-size: 12px; font-weight: 600; color: var(--ui-muted); }
.pay-tile dd { margin: 4px 0 0; font-size: 20px; font-weight: 600; font-variant-numeric: tabular-nums; }
.pay-needs {
  display: grid; gap: 4px; padding: 12px 14px; border-radius: 16px;
  background: var(--ui-waiting-bg); color: var(--ui-waiting-text);
}
.pay-needs-link {
  display: flex; align-items: center; gap: 10px; min-height: 44px;
  color: inherit; font-size: 14px; font-weight: 500; text-decoration: none;
}
.pay-needs-link span { flex: 1 1 auto; }
@media (hover: hover) { .pay-needs-link:hover { text-decoration: underline; } }
body .pay-h2 { margin: 0 0 8px; font-size: 15px; font-weight: 600; }
.pay-needs .pay-h2 { margin: 0; }
.pay-list {
  margin: 0; padding: 0; list-style: none; overflow: hidden;
  border: 1px solid transparent; box-shadow: var(--ui-card-shadow); border-radius: 16px; background: var(--ui-card);
}
.pay-list > li + li { border-top: 1px solid var(--ui-line); }
.pay-row {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 56px; padding: 10px 14px;
  border: 0; background: transparent; color: inherit; font: inherit; text-align: left; cursor: pointer;
}
@media (hover: hover) { .pay-row:hover { background: var(--ui-hover); } }
@media (hover: none) { .pay-row:active { background: var(--ui-hover); } }
.pay-row:focus-visible { outline: 2px solid var(--ui-red-text); outline-offset: -2px; }
.pay-initials {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  width: 36px; height: 36px; border-radius: 999px; background: var(--ui-track);
  font-size: 13px; font-weight: 600;
}
.pay-row-main { display: grid; flex: 1 1 auto; gap: 6px; min-width: 0; }
.pay-name { font-size: 15px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pay-bar { display: block; height: 6px; border-radius: 999px; background: var(--ui-track); overflow: hidden; }
.pay-bar-fill { display: block; height: 100%; border-radius: 999px; background: var(--ui-gold); }
.pay-tags { display: flex; flex-wrap: wrap; gap: 4px; }
.pay-side { display: grid; flex: none; justify-items: end; gap: 2px; }
.pay-figure { font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; }
.pay-money { font-size: 13px; color: var(--ui-muted); font-variant-numeric: tabular-nums; }
.pay-foot { margin: 8px 0 0; font-size: 13px; color: var(--ui-muted); }
.pay-paid-row,
.pay-where-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 48px; padding: 8px 14px; }
@media (max-width: 767.98px) {
  .pay-head { flex-wrap: wrap; }
  .pay-head-actions { width: 100%; }
  .pay-head-actions .pay-download { flex: 1 1 auto; }
  .pay-arrow { width: 44px; min-height: 44px; }
  .pay-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 768px) {
  .pay-page { max-width: 880px; }
}
/* Payroll sheets (templates/_payroll.html) */
.pay-block { display: grid; gap: 6px; margin: 0 0 16px; }
body .pay-block-title { margin: 0; font-size: 13px; font-weight: 600; color: var(--ui-muted); }
.pay-lines { display: grid; margin: 0; padding: 0; list-style: none; border: 1px solid var(--ui-line); border-radius: 14px; }
.pay-line { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 8px 12px; font-size: 14px; }
.pay-line + .pay-line { border-top: 1px solid var(--ui-line); }
.pay-line[data-total] { font-weight: 600; }
.pay-line-value { text-align: right; font-variant-numeric: tabular-nums; }
.pay-final { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 0; font-size: 14px; font-weight: 600; }
.pay-left { margin: 0; font-size: 14px; }
.pay-block-none {
  margin: 0 0 16px; padding: 10px 12px; border: 1px solid var(--ui-line); border-radius: 14px;
  font-size: 14px; color: var(--ui-muted);
}
.pay-periods { margin: 0 0 16px; padding: 0; list-style: none; border: 1px solid var(--ui-line); border-radius: 14px; overflow: hidden; }
.pay-periods > li + li { border-top: 1px solid var(--ui-line); }
.pay-period-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  min-height: 52px; padding: 8px 12px; color: inherit; text-decoration: none;
}
@media (hover: hover) { .pay-period-row:hover { background: var(--ui-hover); } }
@media (hover: none) { .pay-period-row:active { background: var(--ui-hover); } }
.pay-period-row:focus-visible { outline: 2px solid var(--ui-red-text); outline-offset: -2px; }
.pay-periods > li[aria-current="true"] .pay-period-row { background: var(--ui-hover); }
.pay-period-text { display: grid; gap: 2px; min-width: 0; }
.pay-period-text .pay-month { font-size: 15px; }
.pay-where { display: block; }
body .pay-where .pay-h2 { margin: 0; }
/* Folded by default (app review, problem 7): the heading row opens it. */
.pay-where-summary {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 48px;
  padding: 8px 14px; border: 1px solid var(--ui-line); border-radius: 16px; background: var(--ui-card);
  cursor: pointer; list-style: none;
}
.pay-where-summary::-webkit-details-marker { display: none; }
@media (hover: hover) { .pay-where-summary:hover { background: var(--ui-hover); } }
.pay-where-summary:focus-visible { outline: 2px solid var(--ui-red-text); outline-offset: 2px; }
.pay-where-summary .ui-icon { flex: none; color: var(--ui-muted); }
.pay-where[open] > .pay-where-summary { margin-bottom: 12px; }
.pay-where[open] > .pay-where-summary .ui-icon { transform: rotate(180deg); }
.pay-where-tag { display: grid; gap: 6px; margin: 0 0 12px; }
.pay-where-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
  margin: 0; font-size: 14px; font-weight: 600;
}

/* --- Settings (templates/settings.html) --- */
/* Settings: General, Special days, Other places and jobs, Departments and Manager password. One
   column of grouped card lists, as Staff; each row is one tap target that opens its sheet (the
   shared .ui-sheet). Tokens only, so Cream and Dark both work. */
.set-page { max-width: 760px; }
.set-page [hidden] { display: none !important; }
.set-head { margin-bottom: 16px; }
.set-sub { margin: 4px 0 0; font-size: 14px; color: var(--ui-muted); }
.set-group { margin-bottom: 24px; }
.set-group-head {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 8px 12px; margin-bottom: 8px;
}
body .set-h2 { margin: 0 2px; font-family: inherit; font-size: 14px; font-weight: 600; letter-spacing: 0; color: var(--ui-muted); }
.set-group-sub { margin: 0 2px 10px; font-size: 13px; color: var(--ui-muted); }
.set-list { margin: 0; padding: 0; overflow: hidden; list-style: none; border: 1px solid transparent; box-shadow: var(--ui-card-shadow); border-radius: 16px; background: var(--ui-card); }
.set-list > li + li { border-top: 1px solid var(--ui-line); }
.set-row {
  display: flex; align-items: center; gap: 12px;
  width: 100%; min-height: 56px; padding: 10px 14px; border: 0; background: none;
  color: var(--ui-text); font: inherit; text-align: left; cursor: pointer;
}
@media (hover: hover) { .set-row:hover { background: var(--ui-hover); color: var(--ui-text); } }
@media (hover: none) { .set-row:active { background: var(--ui-hover); } }
.set-row:focus-visible { outline: 2px solid var(--ui-red-text); outline-offset: -2px; }
.set-row > .ui-icon { flex: 0 0 auto; color: var(--ui-muted); }
.set-row-main { display: grid; flex: 1 1 auto; gap: 2px; min-width: 0; }
.set-name { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 15px; font-weight: 600; overflow-wrap: anywhere; }
.set-meta { font-size: 13px; color: var(--ui-muted); overflow-wrap: anywhere; }
.set-order { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 8px; }
.set-order .btn-ui { width: 100%; min-height: 44px; }
.set-aside { display: grid; gap: 8px; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--ui-line); }
.set-aside .btn-ui { justify-self: start; min-height: 44px; }
@media (max-width: 767.98px) {
  .set-group-head .btn-ui { min-height: 44px; }
  .set-aside .btn-ui { justify-self: stretch; width: 100%; }
}
/* A saved change goes back to its group or row (#fragment): keep it clear of the top bar. */
.set-group, .set-list > li { scroll-margin-top: 72px; scroll-margin-bottom: 160px; }
/* The flash is a toast fixed to the screen, so it shows wherever the page lands. It fades out by
   itself and never takes a tap, so nothing sits over the page for long. */
.set-toast-stack {
  position: fixed; left: 16px; right: 16px; bottom: 16px; z-index: 60;
  display: grid; gap: 8px; justify-items: center; pointer-events: none;
}
.set-toast {
  width: 100%; max-width: 480px; padding: 12px 16px;
  border: 1px solid var(--ui-line); border-left-width: 4px; border-radius: 12px;
  font-size: 14px; font-weight: 500; line-height: 1.4;
  animation: set-toast-out 0.3s ease 6s forwards;
}
.set-toast-info { background: var(--ui-checked-bg); color: var(--ui-checked-text); border-left-color: var(--ui-checked-text); }
.set-toast-success { background: var(--ui-done-bg); color: var(--ui-done-text); border-left-color: var(--ui-done-text); }
.set-toast-error { background: var(--ui-problem-bg); color: var(--ui-problem-text); border-left-color: var(--ui-problem-text); animation-delay: 10s; }
@keyframes set-toast-out { to { opacity: 0; visibility: hidden; } }
@media (max-width: 767.98px) {
  /* Above the floating tab bar (76px) and the phone's home bar. */
  .set-toast-stack { bottom: calc(76px + 12px + env(safe-area-inset-bottom)); }
}

/* --- View as employee (templates/view_as.html) --- */
.va-page { display: flex; flex-direction: column; gap: 16px; }
.va-head { display: flex; flex-direction: column; gap: 4px; }
.va-sub { margin: 0; font-size: 14px; color: var(--ui-muted); }
.va-group .ui-card-title { margin-bottom: 4px; }
.va-row { width: calc(100% + 16px); border: 0; background: transparent; font: inherit; text-align: left; cursor: pointer; }

/* --- Order sheets (templates/tools.html) --- */
.os-page { display: flex; flex-direction: column; gap: 16px; }
.os-head { display: flex; flex-direction: column; gap: 4px; }
.os-sub { margin: 0; font-size: 14px; color: var(--ui-muted); }

/* --- Rota first-run setup (templates/rota_setup.html) --- */
.rs-page { display: flex; flex-direction: column; gap: 16px; max-width: 560px; }
.rs-head { display: flex; flex-direction: column; gap: 4px; }
.rs-sub { margin: 0; font-size: 14px; color: var(--ui-muted); }
.rs-actions { display: flex; justify-content: flex-end; }
@media (max-width: 767.98px) { .rs-actions > .btn-ui { flex: 1 1 auto; } }
