/* ============================================================
   Trackio stylesheet (2026-09 redesign)

   One file, top to bottom: fonts, tokens, base, controls, shell,
   shared components, then page sections, print, and motion.

   Design rules the whole app follows:
   - Colors come from the tokens below, redefined for light mode
     under html[data-theme="light"]. Never hardcode a color in a
     component; add a token instead.
   - One accent: brand teal (--accent). Other hues only carry state:
     amber = on a break, sky = bathroom break, rose = late / danger,
     violet = waiting for the shift to start / locked month.
   - Shape: controls (buttons, inputs, nav items) 8px, panels 12px,
     tags 6px, avatars round. Nothing else is pill-shaped.
   - Surfaces are solid with a 1px border. No blur, no glows, no
     see-through glass (tried and rejected before).
   - Numbers use tabular figures; clocks and times use Geist Mono.
   ============================================================ */

/* ---------- Fonts (self-hosted, SIL OFL: assets/vendor/fonts) ---------- */
@font-face {
    font-family: "Geist";
    src: url("assets/vendor/fonts/Geist-Variable.woff2") format("woff2");
    font-weight: 100 900;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: "Geist Mono";
    src: url("assets/vendor/fonts/GeistMono-Variable.woff2") format("woff2");
    font-weight: 100 900;
    font-style: normal;
    font-display: swap;
}

/* ---------- Tokens: dark (default) ---------- */
:root {
    color-scheme: dark;

    --bg: #0c0d0f;
    --surface: #121316;
    --surface-2: #18191d;
    --surface-3: #212227;
    --field: #0e0f12;
    --line: #222328;
    --line-2: #2d2e34;

    --text: #ededef;
    --text-2: #a0a0a8;
    --text-3: #85858f;
    --text-4: #4a4b52;          /* idle/disabled figures only, never body text */

    --accent: #24ddb1;
    --accent-hover: #4be6c1;
    --on-accent: #03261d;
    --accent-text: #3ee0b9;
    --accent-soft: rgba(36, 221, 177, 0.10);
    --accent-line: rgba(36, 221, 177, 0.38);

    --warn: #fbb03b;
    --warn-text: #fbb03b;
    --warn-soft: rgba(251, 176, 59, 0.12);
    --warn-line: rgba(251, 176, 59, 0.40);
    --info: #5ed8fd;
    --info-text: #5ed8fd;
    --info-soft: rgba(94, 216, 253, 0.11);
    --info-line: rgba(94, 216, 253, 0.38);
    --danger: #f26b7f;
    --danger-text: #f58595;
    --danger-soft: rgba(242, 107, 127, 0.12);
    --danger-line: rgba(242, 107, 127, 0.40);
    --danger-fill: #c4263e;
    --wait: #a78bfa;
    --wait-text: #b39dfa;
    --wait-soft: rgba(167, 139, 250, 0.12);
    --wait-line: rgba(167, 139, 250, 0.38);

    --shadow-pop: 0 16px 40px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(0, 0, 0, 0.2);
    --scrim: rgba(4, 5, 6, 0.7);
    --heat-text: #03261d;

    --font-sans: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    --font-mono: "Geist Mono", ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;

    --r-xs: 6px;
    --r-sm: 8px;
    --r: 12px;

    --sb-w: 244px;
    --topbar-h: 56px;
    --page-w: 1200px;
    --gutter: 32px;
}

/* ---------- Tokens: light ---------- */
html[data-theme="light"] {
    color-scheme: light;

    --bg: #f7f7f8;
    --surface: #ffffff;
    --surface-2: #f3f3f5;
    --surface-3: #e9e9ec;
    --field: #ffffff;
    --line: #e6e6ea;
    --line-2: #d6d6dc;

    --text: #17171a;
    --text-2: #52525b;
    --text-3: #6e6e78;
    --text-4: #c9c9cf;

    --accent-hover: #1cc9a0;
    --accent-text: #0b7a60;
    --accent-soft: rgba(36, 221, 177, 0.13);
    --accent-line: rgba(11, 122, 96, 0.35);

    --warn-text: #9a5a00;
    --warn-soft: rgba(251, 176, 59, 0.16);
    --warn-line: rgba(154, 90, 0, 0.32);
    --info: #0a8fc2;
    --info-text: #0a6b8f;
    --info-soft: rgba(94, 216, 253, 0.18);
    --info-line: rgba(10, 107, 143, 0.30);
    --danger: #d63a52;
    --danger-text: #c4263e;
    --danger-soft: rgba(214, 58, 82, 0.08);
    --danger-line: rgba(196, 38, 62, 0.30);
    --wait: #7c5ce6;
    --wait-text: #6b46d9;
    --wait-soft: rgba(124, 92, 230, 0.10);
    --wait-line: rgba(107, 70, 217, 0.30);

    --shadow-pop: 0 12px 32px rgba(23, 23, 26, 0.12), 0 0 0 1px rgba(23, 23, 26, 0.04);
    --scrim: rgba(23, 23, 26, 0.32);
}

/* Version marker. includes/nav.php checks it and warns admins if the server
   is serving an older main.css than the pages expect. Bump both together. */
:root { --st-css-version: 57; }

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-padding-top: calc(var(--topbar-h) + 16px); -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    min-height: 100dvh;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-sans);
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}
h1, h2, h3 { margin: 0; color: var(--text); font-weight: 600; letter-spacing: -0.015em; line-height: 1.25; }
h1 { font-size: 26px; letter-spacing: -0.025em; }
h2 { font-size: 16px; }
h3 { font-size: 14px; }
p { margin: 0 0 0.75rem; }
a { color: var(--accent-text); text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
b, strong { font-weight: 600; }
code { font-family: var(--font-mono); font-size: 0.9em; background: var(--surface-2); border: 1px solid var(--line); padding: 0.05em 0.35em; border-radius: var(--r-xs); color: var(--text); }
hr { border: 0; border-top: 1px solid var(--line); margin: 1.5rem 0; }
::selection { background: rgba(36, 221, 177, 0.28); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

.ico { display: inline-block; flex-shrink: 0; vertical-align: middle; fill: currentColor; }
.muted, .hint, .chart-note { color: var(--text-3); }
.muted { font-size: 13px; }
.hint { font-size: 12.5px; line-height: 1.5; margin: 0; }
.error { color: var(--danger-text); }
.nowrap { white-space: nowrap; }
.num, .tnum { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.cents { color: var(--text-3); }
.muted-cell { color: var(--text-3); }
.msg {
    display: flex; align-items: center; gap: 0.5rem;
    margin: 0 0 1.25rem; padding: 0.7rem 0.9rem;
    border-radius: var(--r-sm);
    background: var(--accent-soft); border: 1px solid var(--accent-line);
    color: var(--accent-text); font-weight: 500;
}
.off { color: var(--text-3); }

/* ---------- Buttons ---------- */
button, .btn, label.file-pick-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    height: 36px;
    padding: 0 14px;
    border-radius: var(--r-sm);
    border: 1px solid var(--line-2);
    background: var(--surface-2);
    color: var(--text);
    font: 500 14px/1 var(--font-sans);
    letter-spacing: -0.005em;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
    transition: background-color 140ms cubic-bezier(0.16, 1, 0.3, 1), border-color 140ms cubic-bezier(0.16, 1, 0.3, 1), color 140ms ease, transform 80ms ease;
}
button:hover:not(:disabled), .btn:hover { background: var(--surface-3); text-decoration: none; }
button:active:not(:disabled), .btn:active { transform: translateY(1px); }
button:disabled { opacity: 0.45; cursor: not-allowed; }
a.btn { color: var(--text); }
a.btn:hover, a.btn:focus-visible { text-decoration: none; } /* links styled as buttons never underline */

.primary, button.primary, a.btn.primary {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--on-accent);
    font-weight: 600;
}
.primary:hover:not(:disabled), a.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.secondary, button.secondary, a.btn.secondary { background: var(--surface-2); border-color: var(--line-2); color: var(--text); }
.secondary:hover:not(:disabled), a.btn.secondary:hover { background: var(--surface-3); }
.danger, button.danger, a.btn.danger { background: var(--danger-fill); border-color: var(--danger-fill); color: #fff; }
.danger:hover:not(:disabled), a.btn.danger:hover { background: #ad1f35; border-color: #ad1f35; }
.btn.sm, a.btn.sm, button.sm { height: 30px; padding: 0 10px; font-size: 13px; }
.ghost-btn, button.ghost-btn { background: transparent; border-color: transparent; color: var(--text-2); }
.ghost-btn:hover:not(:disabled) { background: var(--danger-soft); color: var(--danger-text); }
.link-btn, button.link-btn {
    height: auto; padding: 0; border: 0; background: none;
    color: var(--accent-text); font-size: 13px; font-weight: 500;
}
.link-btn:hover:not(:disabled) { background: none; text-decoration: underline; }
.icon-btn, a.icon-btn, button.icon-btn {
    display: inline-grid; place-items: center;
    width: 32px; height: 32px; padding: 0;
    border-radius: var(--r-sm); border: 1px solid transparent;
    background: transparent; color: var(--text-3);
    vertical-align: middle;
}
.icon-btn:hover:not(:disabled) { background: var(--surface-3); color: var(--text); }
.icon-btn.danger-ghost:hover, .icon-btn.danger-ghost:focus-visible { background: var(--danger-soft); color: var(--danger-text); }
.icon-label-btn { display: inline-flex; align-items: center; gap: 0.45rem; }
.file-pick-btn { cursor: pointer; position: relative; }
.file-pick-btn input[type=file] { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.file-pick-btn:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- Form fields ---------- */
input[type=text], input[type=email], input[type=password], input[type=time], input[type=url],
input[type=date], input[type=month], input[type=number], input[type=datetime-local], input[type=search],
select, textarea {
    height: 36px;
    padding: 0 10px;
    border-radius: var(--r-sm);
    border: 1px solid var(--line-2);
    background: var(--field);
    color: var(--text);
    font: 400 14px/1.4 var(--font-sans);
    transition: border-color 120ms ease, box-shadow 120ms ease;
}
textarea { height: auto; min-height: 5.5rem; padding: 8px 10px; resize: vertical; width: 100%; line-height: 1.5; }
input[type=time], input[type=date], input[type=datetime-local], input[type=number] { font-variant-numeric: tabular-nums; }
select {
    appearance: none;
    -webkit-appearance: none;
    padding-right: 30px;
    background-image: linear-gradient(45deg, transparent 50%, var(--text-3) 50%), linear-gradient(135deg, var(--text-3) 50%, transparent 50%);
    background-position: calc(100% - 15px) 50%, calc(100% - 10px) 50%;
    background-size: 5px 5px, 5px 5px;
    background-repeat: no-repeat;
    cursor: pointer;
}
select option { background: var(--surface); color: var(--text); }
input:hover:not(:disabled):not(:focus), select:hover:not(:disabled):not(:focus), textarea:hover:not(:disabled):not(:focus) { border-color: var(--text-4); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
input:disabled, select:disabled, textarea:disabled { opacity: 0.55; cursor: not-allowed; }
::placeholder { color: var(--text-3); opacity: 1; }
input[type=checkbox], input[type=radio] { accent-color: var(--accent); width: 16px; height: 16px; margin: 0; cursor: pointer; }
input[type=color] { width: 36px; height: 36px; padding: 3px; border-radius: var(--r-sm); border: 1px solid var(--line-2); background: var(--field); cursor: pointer; }
input[type=file] { font: inherit; color: var(--text-2); }
::-webkit-calendar-picker-indicator { opacity: 0.6; cursor: pointer; }

.field, .auth-form label, .de-times label {
    display: flex; flex-direction: column; gap: 6px;
    font-size: 13px; font-weight: 500; color: var(--text-2);
}
.field input, .field select, .field textarea { font-weight: 400; width: 100%; }
.check-row, label.check { display: inline-flex; align-items: center; gap: 0.5rem; font-size: 14px; color: var(--text); cursor: pointer; }
.inline-form { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }

/* Segmented control (radio group) */
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 2px; padding: 3px; background: var(--field); border: 1px solid var(--line-2); border-radius: var(--r-sm); }
.seg label { position: relative; display: flex; justify-content: center; align-items: center; gap: 0.35rem; height: 30px; border-radius: 6px; cursor: pointer; font-size: 13px; font-weight: 500; color: var(--text-2); }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label:has(input:checked) { background: var(--surface-3); color: var(--text); }
.seg label:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 1px; }

/* ---------- Month picker (ui.js swaps <input type="month"> for this) ---------- */
.month-pick {
    position: relative;
    display: inline-flex; align-items: center;
    height: 36px;
    border: 1px solid var(--line-2);
    border-radius: var(--r-sm);
    background: var(--field);
}
.month-pick > button {
    height: 100%; padding: 0 8px; border: 0; border-radius: 0;
    background: none; color: var(--text); font-size: 14px; font-weight: 500;
}
.month-pick > button:first-child { border-radius: var(--r-sm) 0 0 var(--r-sm); }
.month-pick > button:nth-child(3) { border-radius: 0 var(--r-sm) var(--r-sm) 0; }
.month-pick > .mp-label { min-width: 150px; gap: 0.4rem; border-left: 1px solid var(--line); border-right: 1px solid var(--line); }
.month-pick > .mp-label svg { color: var(--text-3); }
.month-pick > button:not(:disabled):hover { background: var(--surface-2); }
.month-pick > button:disabled { opacity: 0.35; }
.month-pick > button:active:not(:disabled) { transform: none; }
.month-pick > button:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.mp-pop {
    position: absolute; top: calc(100% + 6px); left: 0; z-index: 60;
    width: 264px; padding: 12px;
    background: var(--surface); border: 1px solid var(--line-2);
    border-radius: var(--r); box-shadow: var(--shadow-pop);
}
.mp-year { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.mp-year b { font-size: 14px; font-variant-numeric: tabular-nums; }
.mp-year button { width: 30px; height: 30px; padding: 0; }
.mp-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
.mp-grid button { height: 34px; padding: 0; border-color: transparent; background: none; color: var(--text-2); font-size: 13px; }
.mp-grid button:not(:disabled):hover { background: var(--surface-2); color: var(--text); }
.mp-grid button.is-selected { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 600; }
.mp-grid button:disabled { opacity: 0.3; }

/* ---------- Panels ---------- */
.card, .panel, .money-card, .empty-note, form.add-user, .override-form, .account-gcal, .account-app {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r);
    padding: 20px;
}
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 0.75rem; margin-bottom: 14px; }
.card-head .card-title { margin: 0; }
.card-title { font-size: 14px; font-weight: 600; color: var(--text); letter-spacing: -0.005em; margin: 0 0 12px; }
.card-meta { font-size: 12.5px; color: var(--text-3); white-space: nowrap; }
.empty-note { color: var(--text-3); padding: 28px 20px; text-align: center; }

.warning-box, .error-box, .clear-box {
    margin: 0 0 1.25rem;
    padding: 14px 16px;
    border-radius: var(--r);
    border: 1px solid var(--warn-line);
    background: var(--warn-soft);
    color: var(--text);
}
.warning-box a { font-weight: 600; }
.warning-box table { margin: 10px 0 0; }
.error-box, .clear-box { border-color: var(--danger-line); background: var(--danger-soft); }
.clear-box strong { color: var(--danger-text); }
.issue-list, .stale-list { margin: 0.5rem 0 0; padding-left: 1.2rem; font-size: 13px; }

/* Section heading (inside a page) */
.report h2, .stats-page h2, .schedule h2:not(.sched-month), .dash-col h2, .admin h2 { font-size: 15px; margin: 32px 0 12px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; margin: 28px 0 12px; }
.section-head h2 { margin: 0 !important; }
.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 20px; }
.toolbar form { margin: 0; }

/* ---------- Tags (status labels) ---------- */
.status-pill, .state-pill, .tag, .today-chip, .month-lock, .paysheet-status, .wg-you {
    display: inline-flex; align-items: center; gap: 6px;
    height: 22px; padding: 0 8px;
    border-radius: var(--r-xs);
    font-size: 12px; font-weight: 500; line-height: 1;
    white-space: nowrap;
    background: var(--surface-3); color: var(--text-2);
}
.status-pill.working, .state-pill.working, .today-live .today-chip { background: var(--accent-soft); color: var(--accent-text); }
.status-pill.on_break, .state-pill.on_break { background: var(--warn-soft); color: var(--warn-text); }
.status-pill.bathroom, .state-pill.bathroom { background: var(--info-soft); color: var(--info-text); }
.status-pill.waiting, .state-pill.waiting, .today-upcoming .today-chip { background: var(--wait-soft); color: var(--wait-text); }
.status-pill.locked, .month-lock, .paysheet-status.is-closed { background: var(--wait-soft); color: var(--wait-text); }
.status-pill.stale, .status-pill.late { background: var(--danger-soft); color: var(--danger-text); }
.status-pill.off, .state-pill.idle { background: var(--surface-3); color: var(--text-3); }
.status-pill + .status-pill { margin-left: 4px; }
/* Live dot: only on states that are actually running right now */
.state-pill.working::before, .state-pill.on_break::before, .state-pill.bathroom::before, .today-live .today-chip::before {
    content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor;
    animation: live-pulse 2s ease-in-out infinite;
}
@keyframes live-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }

.over-flag {
    display: inline-grid; place-items: center;
    min-width: 22px; height: 20px; padding: 0 6px;
    border-radius: var(--r-xs);
    background: var(--danger-soft); color: var(--danger-text);
    font-weight: 600; font-size: 12px;
}

/* ---------- Tables ---------- */
.table-wrap {
    position: relative;
    overflow-x: auto;
    margin-bottom: 24px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r);
}
table { width: 100%; border-collapse: collapse; margin: 0 0 24px; }
.table-wrap > table { margin: 0; }
th, td { padding: 10px 14px; text-align: left; vertical-align: middle; border-bottom: 1px solid var(--line); font-size: 13.5px; }
th {
    height: 38px; padding-top: 0; padding-bottom: 0;
    background: var(--surface-2);
    color: var(--text-3);
    font-size: 12px; font-weight: 500;
    white-space: nowrap;
}
tbody tr:last-child td, table > tr:last-child td { border-bottom: 0; }
tbody tr { transition: background-color 120ms ease; }
.table-wrap tbody tr:hover { background: color-mix(in srgb, var(--surface-2) 60%, transparent); }
th.num, td.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
td.num { font-family: var(--font-sans); }
tfoot td { border-top: 1px solid var(--line-2); border-bottom: 0; font-weight: 600; background: var(--surface-2); }
tr.today td { background: var(--accent-soft); }
.stale-row td { background: var(--danger-soft); }
tr.row-same td { opacity: 0.5; }
table button { height: 30px; padding: 0 10px; font-size: 13px; }
.row-actions { white-space: nowrap; text-align: right; }
.row-actions form { display: inline; margin: 0; }
.row-link, .fix-cell a:not(.btn) { font-size: 13px; font-weight: 500; white-space: nowrap; color: var(--text-2); text-decoration: none; }
.row-link:hover, .fix-cell a:not(.btn):hover, tr:hover .fix-cell a:not(.btn) { color: var(--accent-text); }
.row-link:hover, .fix-cell a:not(.btn):hover { text-decoration: underline; }

/* ---------- App shell: sidebar ---------- */
body.has-sb { padding-left: var(--sb-w); }
.sidebar {
    position: fixed; top: 0; left: 0; bottom: 0; z-index: 50;
    width: var(--sb-w);
    display: flex; flex-direction: column;
    padding: 18px 12px 12px;
    background: var(--bg);
    border-right: 1px solid var(--line);
    overflow-y: auto;
    scrollbar-width: thin;
}
/* Brand block: centered wordmark + tagline, a divider underneath */
/* Brand block: centered wordmark + tagline, as tall as the top bar so its
   divider lines up with the top bar's bottom border */
.sb-brand {
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    height: var(--topbar-h);
    margin: -18px -12px 16px;
    border-bottom: 1px solid var(--line);
    color: var(--text); text-decoration: none; text-align: center;
}
.sb-name { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.sb-name small { font-size: 11px; line-height: 1.2; color: var(--text-3); font-weight: 400; }
.sb-nav { display: flex; flex-direction: column; gap: 1px; }
.sb-label { margin: 0 10px 6px; font-size: 12px; font-weight: 500; color: var(--text-3); }
.sb-item {
    display: flex; align-items: center; gap: 10px;
    height: 34px; padding: 0 10px;
    border-radius: var(--r-sm);
    color: var(--text-2);
    text-decoration: none;
    font-size: 14px; font-weight: 450;
    transition: background-color 120ms ease, color 120ms ease;
}
.sb-item .ico { color: var(--text-3); transition: color 120ms ease; }
.sb-item:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.sb-item:hover .ico { color: var(--text-2); }
.sb-item.active { background: var(--surface-2); color: var(--text); font-weight: 500; box-shadow: inset 0 0 0 1px var(--line); }
.sb-item.active .ico { color: var(--accent-text); }
.sb-count {
    margin-left: auto;
    display: inline-grid; place-items: center;
    min-width: 18px; height: 18px; padding: 0 5px;
    border-radius: var(--r-xs);
    background: var(--danger-fill); color: #fff;
    font-size: 11px; font-weight: 600; font-variant-numeric: tabular-nums;
}
.sb-group { display: flex; flex-direction: column; margin-top: 14px; }
.sb-group-head {
    display: flex; align-items: center; gap: 6px;
    height: 28px; padding: 0 10px;
    border-radius: var(--r-sm);
    list-style: none; cursor: pointer; user-select: none;
    font-size: 12px; font-weight: 500; color: var(--text-3);
}
.sb-group-head::-webkit-details-marker { display: none; }
.sb-group-head::marker { content: ""; }
.sb-group-head:hover { color: var(--text); }
.sb-group-head .sb-chev { margin-left: auto; color: var(--text-3); transition: transform 160ms cubic-bezier(0.16, 1, 0.3, 1); }
.sb-group[open] > .sb-group-head .sb-chev { transform: rotate(90deg); }
.sb-group-head .sb-count + .sb-chev { margin-left: 6px; }
.sb-group[open] > .sb-group-head .sb-count { display: none; }
.sb-group.has-active:not([open]) > .sb-group-head { color: var(--text); }
.sb-group-items { display: flex; flex-direction: column; gap: 1px; padding-top: 2px; }

/* Hours gauge: worked vs scheduled this month */
.sb-gauge {
    margin-top: auto;
    display: grid; grid-template-columns: auto 1fr; align-items: center; column-gap: 12px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: var(--r);
    background: var(--surface);
}
.sb-gauge svg { grid-row: 1 / span 2; width: 56px; height: 32px; display: block; overflow: visible; }
.g-track, .g-fill { fill: none; stroke-width: 9; stroke-linecap: round; }
.g-track { stroke: var(--surface-3); }
.g-fill { stroke: var(--accent); }
.g-val { font-size: 13px; color: var(--text-3); font-variant-numeric: tabular-nums; line-height: 1.3; }
.g-val b { color: var(--text); font-weight: 600; font-size: 15px; }
.g-sub { font-size: 12px; color: var(--text-3); line-height: 1.3; }
@media (max-height: 640px) { .sb-gauge { display: none; } }

.sb-user { display: flex; align-items: center; gap: 4px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.sb-account {
    flex: 1; min-width: 0;
    display: flex; align-items: center; gap: 10px;
    padding: 6px;
    border-radius: var(--r-sm);
    color: var(--text); text-decoration: none;
}
.sb-account:hover { background: var(--surface-2); text-decoration: none; }
.sb-account.active { background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line); }
.sb-avatar {
    display: grid; place-items: center;
    width: 32px; height: 32px; border-radius: 50%;
    background: var(--accent); color: var(--on-accent);
    font-weight: 600; font-size: 13px; flex-shrink: 0;
}
img.sb-avatar.has-photo { object-fit: cover; background: var(--surface-3); display: block; }
.sb-who { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.sb-who b { font-size: 13.5px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-who small { font-size: 12px; color: var(--text-3); }
.sb-logout { display: grid; place-items: center; width: 34px; height: 34px; border-radius: var(--r-sm); color: var(--text-3); flex-shrink: 0; }
.sb-logout:hover { background: var(--danger-soft); color: var(--danger-text); }
.sb-scrim { position: fixed; inset: 0; z-index: 45; background: var(--scrim); }

/* ---------- App shell: top bar ---------- */
.topbar {
    position: sticky; top: 0; z-index: 40;
    display: flex; align-items: center; gap: 12px;
    height: var(--topbar-h);
    padding: 0 var(--gutter);
    background: var(--bg);
    border-bottom: 1px solid var(--line);
}
.crumbs { font-size: 13.5px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.crumbs span { margin: 0 6px; color: var(--text-4); }
.crumbs b { color: var(--text); font-weight: 500; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.topbar-date { font-size: 13px; color: var(--text-2); font-variant-numeric: tabular-nums; padding: 0 10px; height: 32px; display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: var(--r-sm); }
.theme-toggle, .bell, .sb-toggle {
    width: 34px; height: 34px; padding: 0;
    border-radius: var(--r-sm);
    border: 1px solid var(--line);
    background: transparent; color: var(--text-2);
}
.theme-toggle:hover:not(:disabled), .bell:hover:not(:disabled), .bell[aria-expanded="true"], .sb-toggle:hover:not(:disabled) { background: var(--surface-2); color: var(--text); }
.theme-toggle .i-sun { display: none; }
html[data-theme="light"] .theme-toggle .i-sun { display: inline-block; }
html[data-theme="light"] .theme-toggle .i-moon { display: none; }
.sb-toggle, .topbar-brand { display: none; }
.topbar-brand { align-items: center; text-decoration: none; }
.sb-toggle .ico { color: var(--text); }

/* Wordmark: white letters for dark mode, dark letters for light mode */
.brand-logo { display: inline-flex; flex-shrink: 0; }
.brand-logo img { display: block; height: 100%; width: auto; }
.brand-logo .logo-on-light { display: none; }
html[data-theme="light"] .brand-logo .logo-on-dark { display: none; }
html[data-theme="light"] .brand-logo .logo-on-light { display: block; }
.sb-brand .brand-logo { height: 16px; }
.topbar-brand .brand-logo { height: 15px; }

/* ---------- Notification bell ---------- */
.bell-wrap { position: relative; }
.bell { position: relative; display: grid; place-items: center; }
.bell-badge {
    position: absolute; top: -5px; right: -5px;
    min-width: 17px; height: 17px; padding: 0 4px;
    border-radius: var(--r-xs);
    background: var(--danger-fill); color: #fff;
    font-size: 10.5px; font-weight: 600; line-height: 17px; text-align: center;
    box-shadow: 0 0 0 2px var(--bg);
}
.bell-panel {
    position: absolute; right: 0; top: calc(100% + 8px); z-index: 60;
    width: min(380px, calc(100vw - 24px));
    background: var(--surface);
    border: 1px solid var(--line-2);
    border-radius: var(--r);
    box-shadow: var(--shadow-pop);
    overflow: hidden;
}
.bell-head, .bell-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; }
.bell-head { border-bottom: 1px solid var(--line); }
.bell-head strong { font-size: 14px; }
.bell-foot { border-top: 1px solid var(--line); font-size: 13px; color: var(--text-2); }
.bell-foot label { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.bell-perm { display: flex; align-items: center; gap: 12px; padding: 12px 14px; background: var(--accent-soft); border-bottom: 1px solid var(--line); font-size: 13px; }
.bell-perm button { height: 30px; font-size: 13px; }
.bell-list { max-height: min(420px, 60vh); overflow-y: auto; }
.bell-empty { padding: 32px 16px; margin: 0; text-align: center; color: var(--text-3); font-size: 13px; }
.bell-item {
    display: flex; gap: 10px; align-items: flex-start; justify-content: flex-start;
    width: 100%; height: auto;
    padding: 12px 14px;
    border: 0; border-bottom: 1px solid var(--line); border-radius: 0;
    background: none; color: var(--text);
    text-align: left; font-weight: 400; white-space: normal;
    cursor: default;
}
.bell-item:last-child { border-bottom: 0; }
.bell-item:hover:not(:disabled) { background: none; }
.bell-item:active:not(:disabled) { transform: none; }
.bell-item.unread { background: var(--accent-soft); cursor: pointer; }
.bell-item.unread:hover:not(:disabled) { background: color-mix(in srgb, var(--accent) 16%, transparent); }
.bell-dot { width: 7px; height: 7px; margin-top: 6px; border-radius: 50%; flex-shrink: 0; background: transparent; }
.bell-item.unread .bell-dot { background: var(--accent); }
.bell-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.bell-title { font-weight: 500; font-size: 13.5px; line-height: 1.35; }
.bell-body { font-size: 13px; color: var(--text-2); line-height: 1.4; }
.bell-time { font-size: 12px; color: var(--text-3); font-variant-numeric: tabular-nums; }

/* ---------- Phone tab bar ---------- */
.tabbar { display: none; }

/* ---------- Get the app (Android phones, nav.php) ---------- */
/* Inverted on purpose so it stands out: the teal is the card, the dark ink is the button.
   --accent and --on-accent are the same in both themes, so it looks the same in each. */
.app-prompt {
    position: fixed; z-index: 29; left: 12px; right: 12px; bottom: 16px;
    max-width: 460px; margin: 0 auto;
    display: flex; align-items: center; gap: 12px; padding: 12px 10px 12px 14px;
    background: var(--accent); color: var(--on-accent);
    border: 1px solid color-mix(in srgb, var(--on-accent) 18%, transparent); border-radius: var(--r);
    box-shadow: var(--shadow-pop);
}
.app-prompt[hidden] { display: none; }
.app-prompt-icon {
    flex: none; width: 36px; height: 36px; display: grid; place-items: center;
    border-radius: var(--r-sm); background: color-mix(in srgb, var(--on-accent) 12%, transparent); color: var(--on-accent);
}
.app-prompt-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; font-size: 13px; line-height: 1.35; color: color-mix(in srgb, var(--on-accent) 78%, transparent); }
.app-prompt-text b { font-size: 14px; font-weight: 600; color: var(--on-accent); }
.app-prompt .btn, .app-prompt-close { flex: none; }
.app-prompt a.btn.primary { background: var(--on-accent); border-color: var(--on-accent); color: var(--accent); }
.app-prompt a.btn.primary:hover { background: color-mix(in srgb, var(--on-accent) 88%, var(--accent)); }
.app-prompt .app-prompt-close { color: var(--on-accent); background: transparent; }
.app-prompt .app-prompt-close:hover:not(:disabled) { background: color-mix(in srgb, var(--on-accent) 12%, transparent); color: var(--on-accent); }

/* ---------- Page header ---------- */
.page-hero { padding: 32px var(--gutter) 0; margin-bottom: 28px; }
.page-hero-inner { max-width: var(--page-w); margin: 0 auto; }
.page-hero h1 { font-size: 26px; }
.page-hero p { margin: 6px 0 0; color: var(--text-3); font-size: 14px; }
.page-hero-inner.hero-split { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; flex-wrap: wrap; }
.hero-chip {
    display: inline-flex; align-items: center; gap: 8px;
    margin-top: 14px; height: 28px; padding: 0 10px;
    border: 1px solid var(--line); border-radius: var(--r-sm);
    background: var(--surface);
    font-size: 13px; color: var(--text-2);
}
.hero-chip b { font-family: var(--font-mono); font-weight: 500; font-size: 12.5px; color: var(--text); }
.hero-chip .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.hero-chip.off .dot { background: var(--text-3); }

/* Page body: same left edge as the header on every page */
main, .dash { display: block; max-width: calc(var(--page-w) + 2 * var(--gutter)); margin: 0 auto; padding: 0 var(--gutter) 64px; }
main.admin > * { max-width: 880px; }
main.admin > .table-wrap, main.team-page > *, main.biz-page > * { max-width: none; }

/* ---------- Toasts (Notyf): solid, colored edge per type ---------- */
body .notyf { padding: calc(var(--topbar-h) + 12px) 20px 20px; }
.notyf .notyf__toast.st-toast {
    --tc: var(--info);
    width: 360px; max-width: calc(100vw - 24px);
    padding: 0 12px 0 14px;
    background: var(--surface) !important;
    color: var(--text);
    border: 1px solid var(--line-2);
    border-radius: var(--r);
    box-shadow: var(--shadow-pop);
    overflow: hidden;
}
.notyf .notyf__toast.st-toast::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--tc); }
.notyf .notyf__toast.st-toast--success { --tc: var(--accent); }
.notyf .notyf__toast.st-toast--info    { --tc: var(--info); }
.notyf .notyf__toast.st-toast--warning { --tc: var(--warn); }
.notyf .notyf__toast.st-toast--error   { --tc: var(--danger); }
.notyf .st-toast .notyf__wrapper { padding: 12px 0; gap: 10px; }
.notyf .st-toast .notyf__wrapper::before {
    content: ""; flex-shrink: 0; width: 18px; height: 18px; margin-top: 1px;
    background-color: var(--tc);
    -webkit-mask: var(--ico) center / 18px 18px no-repeat;
    mask: var(--ico) center / 18px 18px no-repeat;
}
.notyf .notyf__toast.st-toast--success { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 256 256'%3E%3Cpath d='M173.66,98.34a8,8,0,0,1,0,11.32l-56,56a8,8,0,0,1-11.32,0l-24-24a8,8,0,0,1,11.32-11.32L112,148.69l50.34-50.35A8,8,0,0,1,173.66,98.34ZM232,128A104,104,0,1,1,128,24,104.11,104.11,0,0,1,232,128Zm-16,0a88,88,0,1,0-88,88A88.1,88.1,0,0,0,216,128Z'/%3E%3C/svg%3E"); }
.notyf .notyf__toast.st-toast--info    { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 256 256'%3E%3Cpath d='M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm0,192a88,88,0,1,1,88-88A88.1,88.1,0,0,1,128,216Zm16-40a8,8,0,0,1-8,8,16,16,0,0,1-16-16V128a8,8,0,0,1,0-16,16,16,0,0,1,16,16v40A8,8,0,0,1,144,176ZM112,84a12,12,0,1,1,12,12A12,12,0,0,1,112,84Z'/%3E%3C/svg%3E"); }
.notyf .notyf__toast.st-toast--warning { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 256 256'%3E%3Cpath d='M236.8,188.09,149.35,36.22h0a24.76,24.76,0,0,0-42.7,0L19.2,188.09a23.51,23.51,0,0,0,0,23.72A24.35,24.35,0,0,0,40.55,224h174.9a24.35,24.35,0,0,0,21.33-12.19A23.51,23.51,0,0,0,236.8,188.09ZM222.93,203.8a8.5,8.5,0,0,1-7.48,4.2H40.55a8.5,8.5,0,0,1-7.48-4.2,7.59,7.59,0,0,1,0-7.72L120.52,44.21a8.75,8.75,0,0,1,15,0l87.45,151.87A7.59,7.59,0,0,1,222.93,203.8ZM120,144V104a8,8,0,0,1,16,0v40a8,8,0,0,1-16,0Zm20,36a12,12,0,1,1-12-12A12,12,0,0,1,140,180Z'/%3E%3C/svg%3E"); }
.notyf .notyf__toast.st-toast--error   { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 256 256'%3E%3Cpath d='M165.66,101.66,139.31,128l26.35,26.34a8,8,0,0,1-11.32,11.32L128,139.31l-26.34,26.35a8,8,0,0,1-11.32-11.32L116.69,128,90.34,101.66a8,8,0,0,1,11.32-11.32L128,116.69l26.34-26.35a8,8,0,0,1,11.32,11.32ZM232,128A104,104,0,1,1,128,24,104.11,104.11,0,0,1,232,128Zm-16,0a88,88,0,1,0-88,88A88.1,88.1,0,0,0,216,128Z'/%3E%3C/svg%3E"); }
.notyf .st-toast .notyf__message { color: var(--text); font-family: var(--font-sans); font-size: 13.5px; line-height: 1.45; }
.notyf .st-toast .notyf__dismiss { margin-right: -4px; }
.notyf .st-toast .notyf__dismiss-btn { width: 26px; height: 26px; padding: 0; border: 0; border-radius: var(--r-xs); background: transparent; opacity: 0.7; }
.notyf .st-toast .notyf__dismiss-btn:hover { background: var(--surface-3); opacity: 1; }
.notyf .st-toast .notyf__dismiss-btn::before, .notyf .st-toast .notyf__dismiss-btn::after { background: var(--text-2); }

/* ---------- Dialogs: SweetAlert2 ---------- */
.swal2-container.swal2-backdrop-show { background: var(--scrim) !important; }
.st-swal {
    width: min(420px, calc(100vw - 32px)) !important;
    padding: 24px 24px 20px !important;
    background: var(--surface) !important;
    color: var(--text) !important;
    border: 1px solid var(--line-2) !important;
    border-radius: var(--r) !important;
    box-shadow: var(--shadow-pop) !important;
    font-family: var(--font-sans) !important;
}
.st-swal .swal2-title { padding: 0 !important; font-size: 17px !important; font-weight: 600 !important; letter-spacing: -0.015em; color: var(--text) !important; text-align: center !important; }
.st-swal .swal2-html-container { margin: 10px 0 0 !important; padding: 0 !important; font-size: 14px !important; line-height: 1.55 !important; color: var(--text-2) !important; text-align: center !important; }
.st-swal .swal2-html-container:has(.day-edit) { text-align: left !important; }
.st-swal .swal2-icon { margin: 0 auto 12px !important; transform: scale(0.75); transform-origin: center top; }
.st-swal .swal2-icon + .swal2-title { margin-top: -12px !important; }
.st-swal-actions { width: 100%; justify-content: center !important; gap: 8px; margin: 22px 0 0 !important; padding: 0 !important; }
.st-swal-actions button { margin: 0 !important; min-width: 96px; }
.st-swal .swal2-validation-message { margin: 12px 0 0 !important; background: var(--danger-soft) !important; color: var(--danger-text) !important; border-radius: var(--r-sm); font-size: 13px; }
.st-swal .swal2-input, .st-swal .swal2-select, .st-swal .swal2-textarea { margin: 12px 0 0 !important; width: 100% !important; box-shadow: none !important; }

/* ---------- Dialogs: native <dialog class="st-dialog"> ---------- */
.st-dialog {
    width: min(460px, calc(100vw - 32px));
    padding: 20px 22px;
    background: var(--surface); color: var(--text);
    border: 1px solid var(--line-2);
    border-radius: var(--r);
    box-shadow: var(--shadow-pop);
}
.st-dialog::backdrop { background: var(--scrim); }
.st-dialog[open] { animation: dialog-in 200ms cubic-bezier(0.16, 1, 0.3, 1); }
@keyframes dialog-in { from { opacity: 0; transform: translateY(6px) scale(0.985); } to { opacity: 1; transform: none; } }
.st-dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.st-dialog-head .card-title { margin: 0; font-size: 16px; }
.st-dialog .st-dialog-close { width: 32px; height: 32px; padding: 0; border: 0; background: transparent; color: var(--text-3); }
.st-dialog .st-dialog-close:hover:not(:disabled) { background: var(--surface-3); color: var(--text); }
.st-dialog .hint { margin: 0 0 12px; }
.st-dialog .st-dialog-note { margin: 12px 0 0; font-size: 12.5px; }

/* Day editor (inside dialogs) */
.day-edit { display: flex; flex-direction: column; gap: 14px; text-align: left; }
.de-times { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.de-times input { width: 100%; }
.de-note { margin: 0; font-size: 12.5px; color: var(--text-3); }

/* ---------- Avatars ---------- */
.avatar {
    flex-shrink: 0;
    display: grid; place-items: center;
    width: 36px; height: 36px; border-radius: 50%;
    font-size: 13px; font-weight: 600; letter-spacing: 0.01em;
    color: #0c0d0f;
}
.avatar.av-0 { background: #24ddb1; }
.avatar.av-1 { background: #b39dfa; }
.avatar.av-2 { background: #fbb03b; }
.avatar.av-3 { background: #5ed8fd; }
.avatar.av-4 { background: #f5a3b0; }
.avatar.av-5 { background: #c7d36f; }
img.avatar.has-photo { object-fit: cover; background: var(--surface-3); display: block; }
.avatar-lg { width: 80px; height: 80px; font-size: 26px; }
.avatar-wrap { position: relative; display: inline-flex; flex-shrink: 0; }
.biz-badge { display: grid; place-items: center; border-radius: 50%; font-weight: 700; line-height: 1; object-fit: cover; overflow: hidden; }
.avatar-wrap > .biz-badge {
    position: absolute; right: -3px; bottom: -3px;
    width: 50%; height: 50%; min-width: 16px; min-height: 16px;
    font-size: 8px;
    border: 2px solid var(--surface);
    background-color: var(--surface-3);
}
.sidebar .avatar-wrap > .biz-badge { border-color: var(--bg); }
.avatar-wrap:has(.avatar-lg) > .biz-badge { width: 40%; height: 40%; font-size: 12px; border-width: 3px; }
.biz-badge-lg { width: 44px; height: 44px; font-size: 14px; }
.member { display: flex; align-items: center; gap: 10px; }

/* Click a photo to change it; the x on the corner removes it */
.avatar-editor { position: relative; display: inline-flex; flex-shrink: 0; }
.avatar-editor > form { margin: 0; display: contents; }
.avatar-pick { position: relative; display: inline-flex; cursor: pointer; border-radius: 50%; }
.avatar-pick input[type=file] { position: absolute; width: 1px; height: 1px; opacity: 0; }
.avatar-cam {
    position: absolute; inset: 0;
    display: grid; place-items: center;
    border-radius: 50%;
    background: rgba(12, 13, 15, 0.62); color: #fff;
    opacity: 0; transition: opacity 120ms ease; pointer-events: none;
}
.avatar-pick:hover .avatar-cam, .avatar-pick:focus-within .avatar-cam { opacity: 1; }
.avatar-pick:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.avatar-editor > .avatar-x-form { position: absolute; top: -4px; right: -4px; margin: 0; display: block; z-index: 2; }
.avatar-x {
    width: 18px; height: 18px; padding: 0;
    border-radius: 50%;
    background: var(--surface-3); border: 1px solid var(--line-2); color: var(--text-2);
    opacity: 0; transition: opacity 120ms ease;
}
.avatar-editor:hover .avatar-x, .avatar-x:focus-visible { opacity: 1; }
.avatar-x:hover:not(:disabled) { color: #fff; background: var(--danger-fill); border-color: var(--danger-fill); }
@media (hover: none) { .avatar-x { opacity: 1; } }

/* ============================================================
   Login / first-run setup
   ============================================================ */
.auth-page {
    min-height: 100dvh;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
    background: var(--bg);
}
.auth-side {
    display: flex; flex-direction: column; justify-content: center;
    padding: 48px clamp(24px, 6vw, 96px);
}
.auth-form {
    width: 100%; max-width: 360px;
    display: flex; flex-direction: column; gap: 16px;
}
.auth-form h1 { display: flex; align-items: center; margin: 0 0 28px; }
.auth-form h1 .brand-logo { height: 24px; }
.auth-form .auth-title { font-size: 24px; font-weight: 600; letter-spacing: -0.025em; margin: 0; }
.auth-form .tagline { margin: -8px 0 8px; color: var(--text-3); font-size: 14px; }
.auth-form label input { width: 100%; height: 40px; }
.auth-form button.primary { height: 42px; margin-top: 6px; font-size: 14.5px; }
.auth-form .error {
    margin: 0; padding: 10px 12px;
    border-radius: var(--r-sm);
    background: var(--danger-soft); border: 1px solid var(--danger-line);
    font-size: 13.5px;
}
.auth-foot { margin-top: 28px; font-size: 12.5px; color: var(--text-3); }
/* Right side: the team's local time, the one clock every shift runs on */
.auth-clock {
    display: flex; flex-direction: column; justify-content: flex-end; gap: 10px;
    margin: 16px 16px 16px 0;
    padding: clamp(28px, 4vw, 56px);
    border-radius: 16px;
    border: 1px solid var(--line);
    background: var(--surface);
}
.auth-clock-label { font-size: 13px; color: var(--text-3); }
.auth-clock-time {
    font-size: clamp(64px, 9vw, 128px);
    font-weight: 300;
    letter-spacing: -0.045em;
    line-height: 0.95;
    font-variant-numeric: tabular-nums;
    color: var(--text);
}
.auth-clock-time .sec { color: var(--text-4); }
.auth-clock-date { font-size: 15px; color: var(--text-2); }
/* How far through the day we are: 24 hour ruler, filled up to now */
.day-ruler { position: relative; margin-top: 28px; height: 4px; border-radius: 2px; background: var(--surface-3); }
.day-ruler > span { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 2px; background: var(--accent); }
.day-ticks { display: flex; justify-content: space-between; margin-top: 8px; font-family: var(--font-mono); font-size: 11.5px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.auth-page.is-setup { grid-template-columns: minmax(0, 1fr); }
.auth-page.is-setup .auth-side { align-items: center; }
@media (max-width: 860px) {
    .auth-page { grid-template-columns: minmax(0, 1fr); }
    .auth-clock { display: none; }
    .auth-side { padding: 48px 20px; justify-content: flex-start; padding-top: 18vh; align-items: center; }
    .auth-form h1 { justify-content: center; }
    .auth-form .auth-title, .auth-form .tagline, .auth-foot { text-align: center; }
}

/* ============================================================
   Dashboard
   ============================================================ */
.hero-team { display: flex; gap: 0; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); }
.hero-team-label { display: none; }
.hero-team-stats { display: flex; }
.hero-team .stat-box { padding: 12px 18px; min-width: 150px; }
.hero-team .stat-box + .stat-box { border-left: 1px solid var(--line); }
.hero-team .stat-label::after { content: " (team)"; }
.hero-team .stat-value { font-size: 20px; }

.dash {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
    gap: 24px;
    align-items: start;
}
.dash-col { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.dash-col > h2 { margin: 16px 0 0; }
.dash-col > h2:first-child { margin-top: 0; }
.dash-col .section-head { margin: 16px 0 0; }

/* Clock panel */
.clock-card { padding: 22px 24px 24px; }
.clock-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.clock-since { color: var(--text-3); font-size: 13px; font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.elapsed {
    margin: 16px 0 18px;
    font-variant-numeric: tabular-nums;
    font-size: clamp(52px, 6vw, 76px);
    font-weight: 300;
    letter-spacing: -0.045em;
    line-height: 1;
    color: var(--text);
}
.elapsed.idle { color: var(--text-4); }
.starts-in { margin: -6px 0 18px; font-size: 14px; font-weight: 500; color: var(--wait-text); font-variant-numeric: tabular-nums; }
.shift-progress { margin-bottom: 20px; }
.progress { height: 4px; background: var(--surface-3); border-radius: 2px; overflow: hidden; }
.progress > span { display: block; height: 100%; width: 0; background: var(--accent); border-radius: 2px; transition: width 600ms cubic-bezier(0.16, 1, 0.3, 1); }
.progress-labels { display: flex; justify-content: space-between; margin-top: 8px; font-size: 12px; color: var(--text-3); font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.progress-labels .mid { font-family: var(--font-sans); color: var(--text-2); font-weight: 500; }
.clock-card > button { width: 100%; height: 46px; font-size: 15px; }

/* Breaks and bathroom break, side by side */
.break-row { display: flex; gap: 12px; align-items: stretch; }
.break-row > .card { flex: 1 1 0; min-width: 0; margin: 0; display: flex; flex-direction: column; padding: 18px; }
.break-row:not(:has(> .card:not([hidden]))) { display: none; }
.break-card .card-head { margin-bottom: 12px; flex-wrap: wrap; row-gap: 2px; }
.break-card .card-title { white-space: nowrap; }
.break-buttons { display: flex; align-items: center; gap: 8px; }
.break-buttons .big-btn { flex: 1; }
.break-or { font-size: 12px; color: var(--text-3); flex-shrink: 0; }
.big-btn {
    flex-direction: column; gap: 4px;
    width: 100%; height: auto; min-height: 58px;
    padding: 10px;
    border-radius: var(--r-sm);
}
.big-btn .bb-main { font-size: 15px; font-weight: 600; }
.big-btn .bb-sub { font-size: 12px; font-weight: 400; color: var(--text-3); }
.big-btn:not(:disabled):hover { border-color: var(--accent-line); }
#bathroomBtn .bb-main { color: var(--info-text); }
#bathroomBtn:not(:disabled):hover { border-color: var(--info-line); }
#onBreakCard { border-color: var(--warn-line); }
#onBreakCard .elapsed, #inBathroomCard .elapsed { font-size: 40px; margin: 4px 0 16px; }
#onBreakCard .elapsed { color: var(--warn-text); }
#onBreakCard .elapsed.over { color: var(--danger-text); }
#inBathroomCard { border-color: var(--info-line); }
#inBathroomCard .elapsed { color: var(--info-text); }
#inBathroomCard .elapsed.over { color: var(--warn-text); }
#onBreakCard > button, #inBathroomCard > button { width: 100%; height: 40px; }
#onBreakCard, #inBathroomCard { text-align: center; }
/* No breaks left: the panel says so plainly */
#breakCard { position: relative; overflow: hidden; }
.breaks-done {
    position: absolute; inset: 0; z-index: 2;
    display: flex; flex-direction: column; align-items: flex-start; justify-content: center; gap: 4px;
    padding: 18px;
    background: var(--surface);
    border-radius: inherit;
    color: var(--danger-text);
}
.breaks-done strong { font-size: 14px; display: inline-flex; align-items: center; gap: 8px; }
.breaks-done span { font-size: 13px; color: var(--text-3); }

/* Next shifts: one panel, one row per day */
.upcoming-list { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.upcoming-item {
    display: flex; align-items: center; gap: 14px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--line);
}
.upcoming-item:last-child { border-bottom: 0; }
.date-badge {
    width: 40px; flex-shrink: 0;
    display: flex; flex-direction: column; align-items: center;
    line-height: 1.15;
}
.date-badge .num { font-size: 18px; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.date-badge .dow { font-size: 11.5px; color: var(--text-3); }
.upcoming-item .hours { font-family: var(--font-mono); font-size: 14px; font-weight: 500; font-variant-numeric: tabular-nums; }
.upcoming-item .off-label { color: var(--text-3); }
.upcoming-item .dur { margin-left: auto; font-size: 13px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.upcoming-item.is-today { background: var(--accent-soft); box-shadow: inset 2px 0 0 var(--accent); }
.upcoming-item.is-today .date-badge .dow { color: var(--accent-text); font-weight: 500; }
.today-done { opacity: 0.7; }

/* This month: one panel, split in four */
.stat-grid {
    display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1px;
    background: var(--line);
    border: 1px solid var(--line);
    border-radius: var(--r);
    overflow: hidden;
}
.stat-grid.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.stat-box { position: relative; overflow: hidden; padding: 16px 18px; background: var(--surface); min-width: 0; }
.stat-label { font-size: 13px; font-weight: 400; color: var(--text-3); }
.stat-value {
    position: relative; z-index: 1;
    margin-top: 6px;
    font-size: 24px; font-weight: 500; letter-spacing: -0.03em;
    font-variant-numeric: tabular-nums;
    white-space: nowrap; color: var(--text);
}
.stat-sub { position: relative; z-index: 1; margin-top: 4px; font-size: 12.5px; color: var(--text-3); }
.stat-box.accent .stat-value { color: var(--text); }
.spark { position: absolute; right: 0; bottom: 0; width: 55%; height: 60%; pointer-events: none; color: var(--accent); opacity: 0.9; }
.spark path.l { fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linejoin: round; stroke-linecap: round; }
.stat-box:first-child .spark { color: var(--text-3); opacity: 0.6; }

.money-card { padding: 16px 18px; }
.money-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 12px; }
.money-head .stat-label { font-size: 13px; color: var(--text-2); font-weight: 500; }
.money-head .of { font-size: 13px; font-weight: 500; font-variant-numeric: tabular-nums; color: var(--text); }
.money-foot { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 10px; font-size: 12.5px; color: var(--text-3); }
.money-foot b { color: var(--text); font-weight: 500; font-variant-numeric: tabular-nums; }

/* Who's on: small cards in a sliding row */
.carousel-nav { display: flex; gap: 4px; }
.carousel-btn { width: 30px; height: 30px; padding: 0; }
.team-carousel {
    display: flex; gap: 8px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    scrollbar-width: none;
    padding: 2px; margin: -2px;
    border-radius: var(--r);
}
.team-carousel::-webkit-scrollbar { display: none; }
.team-carousel:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.team-card {
    flex: 0 0 136px;
    scroll-snap-align: start;
    display: flex; flex-direction: column; align-items: center; gap: 8px;
    padding: 16px 10px 14px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r);
    text-align: center;
    min-width: 0;
}
.team-card .avatar { width: 52px; height: 52px; font-size: 17px; box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--ring, transparent); }
.team-card .avatar-wrap > .biz-badge { width: 42%; height: 42%; font-size: 9px; right: -4px; bottom: -4px; }
.team-card.is-working  { --ring: var(--accent); }
.team-card.is-on_break { --ring: var(--warn); }
.team-card.is-bathroom { --ring: var(--info); }
.team-card.is-waiting  { --ring: var(--wait); }
.team-card.is-off .avatar { opacity: 0.55; }
.team-card .tc-name { margin-top: 4px; font-weight: 500; font-size: 13.5px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.team-card .since { font-size: 12px; color: var(--text-3); font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.team-status-list { display: flex; flex-direction: column; gap: 8px; }
.team-status-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); }
.team-status-row .who { display: flex; align-items: center; gap: 10px; min-width: 0; }
.team-status-row .since { font-size: 12px; color: var(--text-3); }
.arrived { display: block; margin-top: 3px; font-size: 12px; color: var(--wait-text); }

/* ============================================================
   Reports: My hours, Team report, Pay summary
   ============================================================ */
.report-notes { margin: 12px 0 0; color: var(--text-3); font-size: 13px; }
.report-notes span + span::before { content: "\00a0\00a0|\00a0\00a0"; color: var(--text-4); }
.month-close-form { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 0 0 16px; }
.month-close-form .hint { margin: 0; }
.lock-note { color: var(--wait-text); display: inline-grid; place-items: center; width: 32px; height: 32px; }
.locked-row input:disabled { opacity: 0.6; }

.paysheet { max-width: none; margin: 0; padding: 28px 32px; }
.paysheet-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.paysheet-logo { height: 20px; }
.paysheet-title { text-align: right; }
.paysheet-kicker { font-size: 12.5px; color: var(--text-3); }
.paysheet-title h2 { margin: 2px 0 0; font-size: 22px; letter-spacing: -0.025em; }
.paysheet-who { display: flex; align-items: center; gap: 12px; padding: 18px 0; flex-wrap: wrap; }
.paysheet-name { font-weight: 600; font-size: 16px; }
.paysheet-status { margin-left: auto; }
.paysheet-totals {
    display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1px; margin-bottom: 14px;
    background: var(--line); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden;
}
.paysheet-totals > div { padding: 14px 16px; background: var(--surface-2); display: flex; flex-direction: column; gap: 4px; }
.paysheet-totals span { font-size: 12.5px; color: var(--text-3); }
.paysheet-totals b { font-size: 20px; font-weight: 500; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.paysheet-totals .paysheet-pay { color: var(--accent-text); }
.paysheet-notes { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 13px; color: var(--text-3); margin-bottom: 18px; }
.paysheet-table .paysheet-total-row td { border-top: 1px solid var(--line-2); font-weight: 600; background: var(--surface-2); }
.paysheet-sub { font-size: 14px; margin: 22px 0 8px; }
.paysheet-fixes { margin: 0; padding-left: 1.1rem; font-size: 13px; color: var(--text-2); }
.paysheet-foot { margin-top: 24px; padding-top: 14px; border-top: 1px solid var(--line); font-size: 12px; color: var(--text-3); }

/* Printed / saved-as-PDF pay summary: an invoice-style document, always light */
.print-only { display: none; }
.ps-invoice { text-align: left; color: #17171a; }
.ps-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 24px 48px; }
.ps-invoice .ps-name { margin: 0 0 10px; font-size: 28px; font-weight: 600; letter-spacing: -0.025em; line-height: 1.15; color: #17171a; }
.ps-doc { margin-left: auto; text-align: right; }
.ps-word { margin-bottom: 10px; font-size: 32px; font-weight: 600; line-height: 1.05; letter-spacing: -0.02em; color: #17171a; }
.ps-meta { margin: 0; display: grid; gap: 4px; font-size: 13.5px; color: #3f3f46; }
.ps-meta dt { display: inline; color: #6e6e78; }
.ps-meta dd { display: inline; margin: 0; }
.ps-section { margin-top: 34px; }
.ps-invoice .ps-label { margin: 0 0 10px; font-size: 11.5px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: #17171a; }
.ps-invoice .ps-table { width: 100%; margin: 0; border-collapse: collapse; }
.ps-invoice .ps-table th { height: auto; padding: 8px 10px; background: none; border-bottom: 1.5px solid #d4d4d8; color: #17171a; font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; }
.ps-invoice .ps-table td { padding: 10px; border-bottom: 1px solid #e8e8ec; color: #3f3f46; font-size: 13.5px; }
.ps-invoice .ps-table tr:last-child td { border-bottom: 1px solid #e8e8ec; }
.ps-invoice .ps-table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ps-invoice .ps-sums { margin-top: 24px; border-top: 2px solid #17171a; }
.ps-invoice .ps-sums td:first-child { text-transform: uppercase; letter-spacing: 0.03em; }
.ps-invoice .ps-sums .ps-grand td { color: #17171a; font-weight: 600; font-size: 15px; }
.ps-foot { margin-top: 36px; padding-top: 14px; border-top: 1px solid #e8e8ec; text-align: center; font-size: 11.5px; color: #6e6e78; }
.ps-billto-lines { display: flex; flex-direction: column; gap: 2px; font-size: 13.5px; color: #3f3f46; }
.ps-billto-lines b { color: #17171a; }

/* ============================================================
   Schedules: month calendar (my_schedule, admin_schedule)
   ============================================================ */
.sched-toolbar { justify-content: space-between; }
.sched-card { padding: 20px; }
.sched-cal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.sched-month { margin: 0; font-size: 18px; letter-spacing: -0.02em; }
.sched-sum { margin: 4px 0 0; font-size: 13px; }
.sched-nav { display: flex; align-items: center; gap: 6px; }
.nav-arrow { width: 34px; padding: 0; }
.sched-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.sched-dow { font-size: 12px; font-weight: 500; color: var(--text-3); padding: 0 8px 6px; }
.cal-pad { min-height: 88px; }
.cal-day {
    position: relative;
    min-height: 88px; height: auto;
    display: flex; flex-direction: column; align-items: stretch; justify-content: flex-start; gap: 6px;
    padding: 8px;
    border-radius: var(--r-sm);
    border: 1px solid var(--line);
    background: var(--surface-2);
    color: var(--text);
    font: inherit; font-weight: 400;
    text-align: left; white-space: normal;
    cursor: default;
}
button.cal-day { cursor: pointer; }
button.cal-day:hover:not(:disabled), button.cal-day:focus-visible { border-color: var(--accent-line); background: var(--surface-3); }
button.cal-day:active:not(:disabled) { transform: none; }
.cd-top { display: flex; align-items: center; justify-content: space-between; }
.cd-num { display: grid; place-items: center; width: 24px; height: 24px; border-radius: var(--r-xs); font-size: 13px; font-weight: 500; font-variant-numeric: tabular-nums; }
.cal-day.is-today .cd-num { background: var(--accent); color: var(--on-accent); font-weight: 600; }
.cd-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--warn); }
.cd-time {
    align-self: flex-start;
    display: inline-flex; gap: 2px;
    padding: 3px 6px;
    border-radius: var(--r-xs);
    background: var(--accent-soft); color: var(--accent-text);
    font-family: var(--font-mono); font-size: 12px; font-variant-numeric: tabular-nums;
}
.cd-time b { font-weight: 500; }
.cd-time i { font-style: normal; }
.cd-off { font-size: 12.5px; font-weight: 500; color: var(--text-3); }
.cd-none { color: var(--text-4); }
.cal-day.kind-off { background: repeating-linear-gradient(135deg, var(--surface) 0 6px, var(--surface-2) 6px 12px); }
.cal-day.is-changed { border-color: var(--warn-line); }
.cal-day.is-changed .cd-time { background: var(--warn-soft); color: var(--warn-text); }
/* Past days stay readable: muted colors instead of fading the whole cell */
.cal-day.is-past { background: var(--surface); }
.cal-day.is-past .cd-num { color: var(--text-3); }
.cal-day.is-past .cd-time { background: var(--surface-3); color: var(--text-2); }
.sched-foot { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-top: 14px; }
.sched-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 12.5px; color: var(--text-3); }
.sched-legend span { display: inline-flex; align-items: center; gap: 6px; }
.lg { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.lg-work { background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent-line); }
.lg-off { background: repeating-linear-gradient(135deg, var(--surface-2) 0 3px, var(--line-2) 3px 6px); }
.lg-changed { background: var(--warn); border-radius: 50%; width: 8px; height: 8px; }
.lg-none { background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line-2); }
.sched-lower { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 16px; margin-top: 16px; align-items: start; }
.sched-lower .hint, .my-weekly .hint { margin: -6px 0 14px; }
.weekly-table { margin-bottom: 16px; }
.weekly-table th, .weekly-table td { padding: 6px 8px; }
.weekly-table th { background: none; height: 30px; }
.weekly-table tr:last-child td { border-bottom: 0; }
.sched-clear form { display: flex; flex-direction: column; gap: 14px; align-items: flex-start; }
.sched-clear .field, .sched-clear select { width: 100%; }
.my-weekly { margin-top: 16px; max-width: 520px; }
.week-list { list-style: none; margin: 0; padding: 0; }
.week-list li { display: flex; justify-content: space-between; padding: 9px 2px; border-bottom: 1px solid var(--line); font-size: 14px; }
.week-list li:last-child { border-bottom: 0; }
.week-list li.today { font-weight: 600; color: var(--accent-text); }
.week-list b { font-family: var(--font-mono); font-weight: 500; font-variant-numeric: tabular-nums; }

/* Team schedule: week grid */
.week-nav { align-items: center; gap: 8px; }
.week-range { font-size: 14px; font-weight: 500; min-width: 150px; text-align: center; font-variant-numeric: tabular-nums; }
.week-grid { min-width: 760px; }
.week-grid th, .week-grid td { text-align: center; padding-left: 8px; padding-right: 8px; }
.week-grid .wg-person { padding-left: 14px; }
.week-grid .wg-person { text-align: left; white-space: nowrap; }
.week-grid th { height: auto; padding-top: 10px; padding-bottom: 10px; }
.wg-day { line-height: 1.25; }
.wg-dow { display: block; font-size: 12px; }
.wg-date { display: block; font-size: 15px; font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; }
.week-grid th.is-today, .week-grid th.is-today .wg-date { color: var(--accent-text); }
.week-grid td.is-today { background: var(--accent-soft); }
.wg-name { font-weight: 500; }
.wg-you { margin-left: 6px; height: 18px; padding: 0 5px; font-size: 11px; background: var(--accent-soft); color: var(--accent-text); }
.week-grid tr.is-me td { background: color-mix(in srgb, var(--accent) 4%, transparent); }
.wg-cell span { display: inline-block; padding: 3px 7px; border-radius: var(--r-xs); font-size: 12.5px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.wg-work span { background: var(--accent-soft); color: var(--accent-text); font-weight: 500; }
.wg-off span { color: var(--text-3); }
.wg-none span { color: var(--text-4); }
.wg-total { font-weight: 600; white-space: nowrap; }
.wg-count.is-thin { color: var(--danger-text); }

/* ============================================================
   Import schedule (schedule_upload.php)
   ============================================================ */
.upload-grid { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.upload-card, .howto-card { display: flex; flex-direction: column; gap: 16px; }
.upload-card > button { align-self: flex-start; }
.dropzone {
    position: relative;
    display: flex; flex-direction: column; align-items: center; gap: 4px;
    padding: 28px 16px;
    border: 1.5px dashed var(--line-2);
    border-radius: var(--r);
    background: var(--field);
    cursor: pointer; text-align: center;
    transition: border-color 120ms ease, background-color 120ms ease;
}
.dropzone input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.dropzone:hover, .dropzone.drag { border-color: var(--accent); background: var(--accent-soft); }
.dropzone.has-file { border-style: solid; border-color: var(--accent-line); background: var(--accent-soft); }
.dz-title { font-weight: 600; }
.dz-sub { font-size: 13px; color: var(--text-3); }
.or-sep { display: flex; align-items: center; gap: 12px; color: var(--text-3); font-size: 12.5px; }
.or-sep::before, .or-sep::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.howto-card ol { margin: 0; padding-left: 1.2rem; font-size: 14px; line-height: 1.65; color: var(--text-2); }
.howto-card .btn { align-self: flex-start; }
.import-actions { display: flex; gap: 8px; margin: 20px 0 8px; }

/* ============================================================
   Stats page
   ============================================================ */
.stats-page .stat-grid.four { margin-bottom: 8px; }
.chart-note { margin: -6px 0 12px; font-size: 13px; }
.chart-card { padding: 16px; height: 300px; }
.chart-card canvas { width: 100% !important; height: 100% !important; }
.chart-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; }
.chart-grid > div > h2 { margin-top: 32px; }
.heat-card { padding: 16px; overflow-x: auto; }
.heatmap { display: grid; gap: 3px; min-width: 560px; }
.hm-hour { font-size: 11.5px; color: var(--text-3); text-align: center; font-family: var(--font-mono); }
.hm-day { font-size: 12.5px; color: var(--text-3); font-weight: 500; align-self: center; }
.hm-cell {
    height: 30px; border-radius: 4px;
    background: rgba(36, 221, 177, var(--a));
    display: grid; place-items: center;
    font-size: 11px; font-family: var(--font-mono); font-variant-numeric: tabular-nums;
    color: var(--heat-text);
}
.hm-cell.empty, .cal-cell.empty { background: var(--surface-2); color: var(--text-3); }
.hm-cell.is-lo, .cal-cell.is-lo { color: var(--text); }   /* pale cells: ink that clears the surface, both themes */
.cal-card { padding: 16px; height: 300px; }
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; }
.cal-head { font-size: 11.5px; color: var(--text-3); text-align: center; font-weight: 500; padding-bottom: 4px; }
.cal-cell {
    height: 40px; border-radius: 4px;
    background: rgba(36, 221, 177, var(--a));
    display: flex; flex-direction: column; justify-content: space-between;
    padding: 3px 5px;
    color: var(--heat-text);
}
.cal-cell b { font-size: 11px; font-weight: 600; }
.cal-cell i { font-style: normal; font-size: 10.5px; font-family: var(--font-mono); text-align: right; }
.cal-cell.future { opacity: 0.4; }
.cal .cal-pad { min-height: 0; }

/* ============================================================
   Shifts (admin_shifts.php)
   ============================================================ */
table.shift-edit { min-width: 1060px; }
table.shift-edit td { padding: 8px 12px; }
table.shift-edit td:first-child { white-space: nowrap; font-weight: 500; }
table.shift-edit input[type=datetime-local] { width: 13.2rem; height: 32px; font-size: 13px; }
.late-input { width: 68px; height: 32px; text-align: right; }
.late-input.is-late { border-color: var(--danger-line); background: var(--danger-soft); color: var(--danger-text); font-weight: 600; }
.row-actions .btn-save { height: 30px; padding: 0 12px; font-size: 13px; }
.shifts > .hint { margin: -12px 0 24px; }
.break-pills { display: flex; flex-wrap: wrap; gap: 4px; }
.break-pill {
    display: inline-flex; align-items: center; gap: 4px;
    height: 22px; padding: 0 4px 0 7px;
    border-radius: var(--r-xs);
    font-size: 12px; font-weight: 500; font-variant-numeric: tabular-nums;
    white-space: nowrap; cursor: default;
    background: var(--surface-3); color: var(--text-2);
}
.break-pill.ok { background: var(--accent-soft); color: var(--accent-text); }
.break-pill.over { background: var(--danger-soft); color: var(--danger-text); }
.break-pill.live { background: var(--warn-soft); color: var(--warn-text); padding-right: 7px; }
.break-pill.bathroom { background: var(--info-soft); color: var(--info-text); }
.bp-del { display: grid; place-items: center; width: 16px; height: 16px; border-radius: 4px; color: inherit; opacity: 0.6; }
.bp-del:hover, .bp-del:focus-visible { opacity: 1; background: rgba(128, 128, 128, 0.18); }

/* Fix requests (top of Shifts, plus request_fix.php) */
.req-card { margin-bottom: 20px; border-color: var(--warn-line); }
.req-list { display: flex; flex-direction: column; gap: 8px; }
.req-item { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; padding: 12px 14px; border-radius: var(--r-sm); background: var(--surface-2); border: 1px solid var(--line); }
.req-main { flex: 1; min-width: 240px; display: flex; flex-direction: column; gap: 4px; }
.req-who .muted { font-size: 12.5px; margin-left: 4px; }
.req-times { display: flex; gap: 8px; align-items: center; font-family: var(--font-mono); font-size: 13.5px; font-variant-numeric: tabular-nums; }
.req-old { color: var(--text-3); text-decoration: line-through; }
.req-new { color: var(--accent-text); font-weight: 500; }
.req-arrow { color: var(--text-3); }
.req-note { font-size: 13px; color: var(--text-2); }
.req-actions { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin: 0; }
.req-actions input[type=text] { width: 200px; height: 32px; font-size: 13px; }
.req-actions button { height: 32px; font-size: 13px; }
.req-decision { font-size: 12.5px; color: var(--text-3); margin-top: 4px; }
main.admin > .fix-form { max-width: 640px; }
main.admin .fix-form .field { max-width: none; }
.fix-times { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.fix-actions { display: flex; gap: 8px; align-items: center; }
.history-table td { vertical-align: top; }

/* ============================================================
   Team, Businesses, Account
   ============================================================ */
.team-page form.add-user { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; align-items: end; margin-bottom: 24px; }
.team-page form.add-user .card-title { grid-column: 1 / -1; margin-bottom: 0; }
form.add-user, .override-form { display: flex; flex-direction: column; gap: 14px; }
/* Stacked forms: fields keep a readable width and buttons keep their own size */
form.add-user > button, form.add-user > .btn, .card form > button[type=submit]:only-of-type { align-self: flex-start; }
main.admin form.add-user .field, main.gcal-page .field { max-width: 440px; }
main.admin > form, main.admin > section, main.admin > .card, main.admin > details { margin-bottom: 16px; }
.override-form { flex-direction: row; align-items: center; flex-wrap: wrap; }
table.team-table td:nth-child(4) { text-transform: capitalize; color: var(--text-2); }
.rename-form { display: flex; gap: 6px; }
.rename-form input { width: 150px; height: 30px; font-size: 13px; }
.rename-form button { height: 30px; font-size: 13px; }
.biz-form { margin: 0; }
.biz-form select { height: 30px; font-size: 13px; min-width: 140px; }

.biz-add-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.biz-add-row input[type=text] { flex: 1; min-width: 200px; }
.biz-logo-label { max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.biz-color { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-2); cursor: pointer; }
.biz-list { display: flex; flex-direction: column; gap: 8px; margin-top: 20px; }
.biz-card { display: flex; align-items: center; gap: 16px; padding: 14px 16px; flex-wrap: wrap; }
.biz-edit { display: flex; gap: 8px; align-items: center; flex: 1; min-width: 240px; margin: 0; }
.biz-edit input[type=text] { flex: 1; min-width: 120px; }
.biz-count { font-size: 13px; color: var(--text-3); white-space: nowrap; }
.biz-delete { margin: 0; }
.biz-billto { flex-basis: 100%; border-top: 1px solid var(--line); padding-top: 12px; }
.biz-billto summary { cursor: pointer; font-size: 13px; font-weight: 500; color: var(--text-2); }
.biz-billto summary:hover { color: var(--text); }
.biz-billto-first { font-weight: 400; color: var(--text-3); }
.biz-billto form { display: flex; flex-direction: column; gap: 8px; margin: 10px 0 0; }
.biz-billto textarea { min-height: 7rem; }
.biz-billto button { align-self: flex-start; }

.avatar-edit { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.avatar-edit-controls { display: flex; flex-direction: column; gap: 10px; min-width: 0; flex: 1; }
form.avatar-form { margin-bottom: 20px; }
#avatarPreview { display: contents; }
.avatar-note { margin: 0; font-size: 13px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.avatar-note.is-file { color: var(--text); font-weight: 500; }
.avatar-edit-buttons { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.account-gcal, .account-app { display: flex; flex-direction: column; gap: 10px; }
.account-gcal .hint, .account-app .hint { margin: 0; }
.account-app .btn { align-self: flex-start; }

/* ============================================================
   Calendar sync (admin_calendar.php)
   ============================================================ */
main.gcal-page > * { max-width: 880px; }
main.gcal-page { display: flex; flex-direction: column; gap: 16px; }
main.gcal-page > .card, main.gcal-page > .msg, main.gcal-page > .warning-box, main.gcal-page > .table-wrap { margin: 0; }
.gcal-page .card-head { align-items: center; margin-bottom: 10px; }
.gcal-page .hint { margin: 10px 0 0; }
.gcal-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--r-sm); overflow: hidden; }
.gcal-stats > div { display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; background: var(--surface-2); }
.gcal-stats b { font-size: 20px; font-weight: 500; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; line-height: 1.15; }
.gcal-stats span { font-size: 12.5px; color: var(--text-3); }
.gcal-stats .is-bad b { color: var(--danger-text); }
.gcal-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.gcal-actions form { margin: 0; }
.gcal-failures { margin: 14px 0 0; padding-left: 1.1rem; font-size: 13px; color: var(--text-2); display: grid; gap: 4px; }
.gcal-page .table-wrap.flat { margin: 12px 0 0; background: transparent; }
.gcal-people .member { gap: 10px; white-space: nowrap; }
.gcal-person { flex-wrap: nowrap; align-items: center; }
.gcal-person input[type=email] { width: 230px; }
.gcal-page .check-row { font-weight: 500; }
.gcal-key { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.gcal-key form { margin: 0; }
.gcal-key input { flex: 1 1 260px; min-width: 0; font-family: var(--font-mono); font-size: 13px; }
.gcal-guide summary { cursor: pointer; font-weight: 600; }
.gcal-guide ol { margin: 14px 0 0; padding-left: 1.2rem; display: grid; gap: 8px; font-size: 13.5px; color: var(--text-2); line-height: 1.55; }

/* ============================================================
   Dev tools (admin_dev.php)
   ============================================================ */
main.dev-page { display: flex; flex-direction: column; gap: 16px; }
main.dev-page > * { max-width: 880px; }
main.dev-page > .card, main.dev-page > form, main.dev-page > .msg, main.dev-page > .warning-box { margin: 0; }
.dev-send .hint { margin: 0; }
main.admin .dev-send .field { max-width: 560px; }
.dev-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; max-width: 560px; }
.dev-page .card-head { align-items: center; margin-bottom: 10px; }
.dev-page .table-wrap.flat { margin: 12px 0 0; background: transparent; }
.dev-phones .member { gap: 10px; white-space: nowrap; }
.dev-phones td { white-space: nowrap; }
.dev-clear { display: inline-flex; align-items: center; gap: 8px; }
.dev-push .card-head { margin-bottom: 0; }
.dev-steps { margin: 0; padding-left: 1.2rem; color: var(--text-2); font-size: 13.5px; line-height: 1.6; }
.dev-push input[type=file] { height: auto; padding: 6px; font-size: 13px; color: var(--text-3); cursor: pointer; }
.dev-push input[type=file]::file-selector-button {
    height: 30px; margin-right: 10px; padding: 0 12px;
    border: 1px solid var(--line-2); border-radius: var(--r-sm); background: var(--surface-2);
    color: var(--text); font: inherit; font-weight: 500; cursor: pointer;
}
.dev-push input[type=file]::file-selector-button:hover { background: var(--surface-3); }
main.dev-page > .dev-push-off { margin-top: -8px; }

/* ============================================================
   Missing days (admin_add_days.php)
   ============================================================ */
.missing-card .card-head { align-items: center; margin-bottom: 6px; }
.missing-card > .hint { margin: 0 0 14px; }
.missing-list { border: 1px solid var(--line); border-radius: var(--r-sm); overflow: hidden; }
.missing-row {
    display: grid; grid-template-columns: auto minmax(90px, 1fr) auto auto auto; align-items: center; gap: 16px;
    padding: 10px 14px; border-bottom: 1px solid var(--line);
    cursor: pointer; font-variant-numeric: tabular-nums;
}
.missing-row:last-child { border-bottom: 0; }
.missing-row:hover { background: var(--surface-2); }
.missing-row:has(input:not(:checked)) > span { color: var(--text-3); }
.mr-date { font-weight: 500; }
.mr-time { font-family: var(--font-mono); font-size: 13px; color: var(--text-2); }
.mr-hours { color: var(--text-2); min-width: 64px; text-align: right; }
.mr-pay { font-weight: 500; min-width: 72px; text-align: right; }
.missing-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 16px; }
.missing-sum { font-size: 13.5px; color: var(--text-2); font-variant-numeric: tabular-nums; }

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 1100px) {
    .stat-grid.four { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 1024px) {
    :root { --gutter: 24px; }
    body.has-sb { padding-left: 0; }
    .sidebar { transform: translateX(-100%); transition: transform 240ms cubic-bezier(0.16, 1, 0.3, 1); box-shadow: var(--shadow-pop); }
    .sidebar.open { transform: none; }
    body.sb-locked { overflow: hidden; }
    .sb-toggle { display: grid; place-items: center; }
    .topbar-brand { display: flex; }
    .crumbs { display: none; }
}
@media (max-width: 900px) {
    .dash { grid-template-columns: minmax(0, 1fr); }
    .chart-grid, .sched-lower, .upload-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 720px) {
    :root { --gutter: 16px; --topbar-h: 52px; }
    body.has-sb { padding-bottom: calc(60px + env(safe-area-inset-bottom, 0px)); }
    .topbar-date { display: none; }
    .page-hero { padding-top: 20px; margin-bottom: 20px; }
    .page-hero h1 { font-size: 22px; }
    .hero-team { width: 100%; }
    .hero-team-stats { width: 100%; }
    .hero-team .stat-box { flex: 1; min-width: 0; }
    body .notyf { padding: calc(var(--topbar-h) + 8px) 12px 12px; }
    .notyf .notyf__toast.st-toast { width: 100%; max-width: none; }
    .bell-panel { position: fixed; top: calc(var(--topbar-h) + 6px); right: 12px; left: 12px; width: auto; }
    .paysheet { padding: 20px 16px; }
    .paysheet-totals { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .gcal-person { flex-wrap: wrap; }
    .gcal-person input[type=email] { width: 100%; flex: 1 1 100%; }
    .gcal-people, .gcal-people tbody, .gcal-people tr, .gcal-people td { display: block; }
    .gcal-people tr:first-child { display: none; }
    .gcal-people tr { padding: 12px 14px; border-bottom: 1px solid var(--line); }
    .gcal-people tr:last-child { border-bottom: 0; }
    .gcal-people td { padding: 3px 0; border: 0; }
    .gcal-people td.num { display: inline-block; margin-right: 16px; font-size: 13px; text-align: left; }
    .gcal-people td.num::before { content: attr(data-label) ": "; color: var(--text-3); }
    .dev-phones, .dev-phones tbody, .dev-phones tr, .dev-phones td { display: block; }
    .dev-phones tr:first-child { display: none; }
    .dev-phones tr { padding: 12px 14px; border-bottom: 1px solid var(--line); }
    .dev-phones tr:last-child { border-bottom: 0; }
    .dev-phones td { padding: 3px 0; border: 0; }
    .dev-phones td[data-label] { display: inline-block; margin-right: 16px; font-size: 13px; text-align: left; }
    .dev-phones td[data-label]::before { content: attr(data-label) ": "; color: var(--text-3); }

    .tabbar {
        display: flex;
        position: fixed; bottom: 0; left: 0; right: 0; z-index: 30;
        background: var(--surface);
        border-top: 1px solid var(--line);
        padding-bottom: env(safe-area-inset-bottom, 0px);
    }
    .app-prompt { bottom: calc(72px + env(safe-area-inset-bottom, 0px)); } /* above the tab bar */
    .tabbar a, .tabbar button.tab-more {
        flex: 1;
        display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
        height: 60px; padding: 0;
        border: 0; border-radius: 0; background: none;
        color: var(--text-3);
        font-size: 11px; font-weight: 500; text-decoration: none;
    }
    .tabbar a:hover, .tabbar button.tab-more:hover:not(:disabled) { background: none; color: var(--text); }
    .tabbar a.active { color: var(--accent-text); }
}
@media (max-width: 560px) {
    .break-row { flex-direction: column; }
    .break-row > .card { flex: none; } /* stacked: natural height (a 0 basis squeezed the break card to its title) */
    .missing-row { grid-template-columns: auto 1fr auto; gap: 4px 12px; }
    .mr-time { grid-column: 2; }
    .mr-hours { display: none; }
    .mr-pay { grid-column: 3; grid-row: 1; }
    .fix-times { grid-template-columns: minmax(0, 1fr); }
    .stat-value { font-size: 21px; }
    .sched-card { padding: 14px 8px; }
    .sched-grid { gap: 2px; }
    .cal-day, .cal-pad { min-height: 60px; }
    .cal-day { padding: 4px; gap: 3px; }
    .cd-num { width: 20px; height: 20px; font-size: 12px; }
    .cd-time { flex-direction: column; padding: 2px 3px; font-size: 10px; line-height: 1.25; }
    .cd-time i { display: none; }
    .cd-off { font-size: 11px; }
    .sched-dow { padding: 0 3px 4px; font-size: 11px; }
    .sched-cal-head { flex-direction: column; }
    .month-pick > .mp-label { min-width: 132px; }
}

/* ============================================================
   Print: pay summary as an invoice, everything else stripped
   ============================================================ */
@page { size: A4; margin: 16mm 14mm; }
@media print {
    :root, html[data-theme] {
        --bg: #fff; --surface: #fff; --surface-2: #f5f5f7; --surface-3: #ececef; --field: #fff;
        --line: #e4e4e8; --line-2: #d4d4d8;
        --text: #17171a; --text-2: #3f3f46; --text-3: #6e6e78; --text-4: #c9c9cf;
        --accent-text: #0b7a60; --wait-text: #6b46d9; --wait-soft: rgba(124, 92, 230, 0.10);
    }
    html, body, body.has-sb { background: #fff !important; color: #17171a; padding: 0 !important; }
    .sidebar, .topbar, .tabbar, .sb-scrim, .notyf, .no-print, .stale-css-banner { display: none !important; }
    main { padding: 0 !important; max-width: none !important; }
    .print-only { display: block !important; }
    .ps-section { break-inside: avoid-page; }
    .brand-logo .logo-on-dark { display: none !important; }
    .brand-logo .logo-on-light { display: block !important; }
    .table-wrap { overflow: visible !important; border: 0 !important; }
    .card, .stat-box, .table-wrap { background: #fff !important; }
    tr { break-inside: avoid; }
    a { color: inherit; text-decoration: none; }
}

/* ============================================================
   Motion: honour reduced motion everywhere
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
    /* Near-instant instead of "none", so anything waiting for an animation to
       finish (like dismissing a toast) still gets its animationend event. */
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-delay: 0s !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}
