/* ── Slack Scheduling Tab ───────────────────────────────────────── */
.qa-loc-bar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 8px;
}

.qa-loc-btn {
    padding: 5px 14px;
    border: 1px solid var(--border);
    border-radius: 20px;
    background: transparent;
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
}

.qa-loc-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.qa-loc-btn.active {
    background: var(--accent-dim);
    border-color: var(--accent);
    color: var(--accent);
}

.qa-date-bar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 10px 14px;
    margin-bottom: 14px;
}

.qa-presets {
    display: flex;
    gap: 4px;
}

.qa-preset-btn {
    padding: 5px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: transparent;
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
}

.qa-preset-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.qa-preset-btn.active {
    background: var(--accent);
    color: var(--text-on-accent);
    border-color: var(--accent);
    font-weight: 700;
}

.qa-date-fields {
    display: flex;
    gap: 10px;
    align-items: center;
}

.qa-date-fields label {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    color: var(--text-muted);
}

.qa-date-fields input[type="date"] {
    padding: 4px 8px;
    border: 1px solid var(--border);
    border-radius: 5px;
    background: var(--surface);
    color: var(--text);
    font-size: 12px;
}

.qa-header-actions {
    display: flex;
    gap: 8px;
    margin-left: auto;
}

.qa-btn {
    padding: 6px 14px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: transparent;
    color: var(--text);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
}

.qa-btn:hover {
    background: var(--surface-2);
}

.qa-btn-success {
    background: var(--tint-green);
    color: var(--green);
    border-color: var(--green);
}

.qa-btn-success:hover {
    background: var(--green);
    color: var(--text-on-accent);
}

.qa-btn-primary {
    background: var(--accent-dim);
    color: var(--accent);
    border-color: var(--accent);
}

.qa-btn-primary:hover {
    background: var(--accent);
    color: var(--text-on-accent);
}

.qa-btn-danger {
    color: var(--red);
    border-color: var(--red);
}

.qa-btn-danger:hover {
    background: var(--red);
    color: #fff;
}

/* ── Reset & base ──────────────────────────────────────────────── */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    /* The browser's own controls (the date and time pickers, selects,
       scrollbars) follow the theme too, so a picker opened on a dark page
       is dark on every page alike. The light block restates this. */
    color-scheme: dark;
    --bg: #0c0d10;
    --surface: #17181d;
    --surface-2: #1e2028;
    --border: #2d2f3a;
    --text: #f1f2f4;
    --text-muted: #8b8fa8;
    --accent: #f59e0b;
    --accent-dim: #2d1900;
    --green: #22c55e;
    --orange: #f97316;
    --red: #ef4444;
    --grey: #64748b;
    --radius: 8px;
    --header-h: 56px;
    --tab-h: 44px;
    /* Location colors, shared by every tab. */
    --loc-cary: #eab308;
    --loc-boxyard: #dc2626;
    --loc-patterson: #2563eb;
    --loc-greenville: #7c3aed;
    --loc-morehead: #0d9488;
    /* Chip text on each location color; index.js recomputes these from
       the saved colors (dark text on light colors, white otherwise). */
    --loc-cary-text: #111;
    --loc-boxyard-text: #fff;
    --loc-patterson-text: #fff;
    --loc-greenville-text: #fff;
    --loc-morehead-text: #fff;
    /* Dark palette details that the light theme overrides below. */
    --header-bg: #08090c;
    /* Development and anything else that is not production: see .site-header. */
    --dev-header-bg: #4c1116;
    --dev-header-line: #ef4444;
    --bg-translucent: rgba(8, 9, 12, 0.96);
    --text-on-accent: #0c0d10;
    --shadow-rgb: 0, 0, 0;
    --img-bg: #000;
    --table-line: #1a1a1a;
    --cyan: #22d3ee;
    --green-strong: #4caf50;
    --red-strong: #ef5350;
    --red-soft: #fca5a5;
    --red-softer: #fecaca;
    --amber-soft: #fcd9a0;
    --tint-green: #0d2e1a;
    --tint-green-2: #071a07;
    --tint-green-3: #0d2e0d;
    --tint-orange: #2c1800;
    --tint-red: #2c0010;
    --tint-red-2: #1a0505;
    --tint-blue: #0c1f30;
    --tint-cyan: #09272c;
    --nav-toggle-bg: #16233a;
    --nav-toggle-bg-active: #1d2f4f;
    --nav-toggle-border: #2f4d7a;
    --nav-toggle-text: #93c5fd;
    --modal-bg: #11161f;
    --modal-border: #303b4f;
    --modal-item-bg: #171f2d;
    --modal-item-border: #39465f;
    --modal-close-bg: #1b2433;
    --modal-close-border: #3d4b63;
    --modal-close-text: #cbd5e1;
    --modal-title: #f8b34a;
    --modal-item-title: #f2f6ff;
    --pp-save-bg: #1a3a1a;
    --pp-save-border: #2a5a2a;
    --pp-save-hover: #1f4a1f;
    /* Semantic hues as bare RGB triplets. Every translucent tint and border
       in the sheets is written rgba(var(--x-rgb), a), so a theme only has to
       restate the hue and each alpha lands on the right side of its backdrop.
       The dark values below are the literals these rules used before. */
    --accent-rgb: 245, 158, 11;
    --ok-rgb: 34, 197, 94;
    --warn-rgb: 249, 115, 22;
    --danger-rgb: 239, 68, 68;
    --info-rgb: 59, 130, 246;
    --grey-rgb: 100, 116, 139;
    /* Row / cell washes built from those hues. */
    --tint-ok: rgba(var(--ok-rgb), 0.08);
    --tint-warn: rgba(var(--warn-rgb), 0.08);
    --tint-danger: rgba(var(--danger-rgb), 0.08);
    --tint-info: rgba(var(--info-rgb), 0.08);
    /* Neutral chip / pill fill, inline code, overlays, table-row hover. */
    --chip-bg: var(--surface-2);
    --code-bg: rgba(255, 255, 255, 0.08);
    --code-bg-sunken: rgba(0, 0, 0, 0.35);
    --scrim: rgba(0, 0, 0, 0.6);
    --scrim-strong: rgba(0, 0, 0, 0.72);
    --scrim-image: rgba(0, 0, 0, 0.85);
    --header-glow: rgba(245, 158, 11, 0.08);
    --row-hover: brightness(1.3);
    --row-hover-soft: brightness(1.25);
    --card-hover-shadow: 0 0 18px rgba(var(--accent-rgb), 0.12);
    --duration-ok-bg: #14302014;
    /* Badge / pill fills. Dark keeps the exact alphas these rules had; light
       swaps in solid pales, because a dark hue at low alpha over a light
       surface only ever reads as mud. */
    --badge-ok: rgba(var(--ok-rgb), 0.18);
    --badge-ok-soft: rgba(var(--ok-rgb), 0.15);
    --badge-ok-pill: rgba(var(--ok-rgb), 0.14);
    --badge-warn: rgba(var(--warn-rgb), 0.18);
    --badge-danger: rgba(var(--danger-rgb), 0.2);
    --badge-danger-soft: rgba(var(--danger-rgb), 0.14);
    --badge-info: rgba(var(--info-rgb), 0.18);
    --badge-info-soft: rgba(var(--info-rgb), 0.12);
    --badge-neutral: rgba(var(--grey-rgb), 0.2);
    --badge-neutral-strong: rgba(var(--grey-rgb), 0.85);
    /* Named one-off colors that used to be hard-coded per selector. */
    --info: #60a5fa;
    --info-strong: #3b82f6;
    --info-text: #93c5fd;
    --info-pill-text: #bfdbfe;
    --ok-text: #bbf7d0;
    --ok-strong: #2e7d32;
    --danger-strong: #c62828;
    --violet: #a855f7;
    --btn-gold-bg: #f3a637;
    --btn-gold-text: #12151a;
    --modal-sub-text: #b7c2d4;
    --modal-item-desc: #a9b5c8;
    --pp-del-bg: #3a1a1a;
    --pp-del-border: #5a2a2a;
    --pp-del-hover: #4a1f1f;
}

/* ── Light theme (Settings > General) ───────────────────────────────────
   Dark values above stay untouched; this block only restates tokens.
   A warm-neutral page under white cards, a burnt-amber accent (a shade under
   amber-700, which misses 4.5:1 on --surface-2), and darker green/orange/red
   so badge text clears WCAG AA on its own wash. */
:root[data-theme="light"] {
    color-scheme: light;
    --bg: #f5f6f8;
    --surface: #ffffff;
    --surface-2: #eef0f3;
    --border: #d7dbe2;
    --text: #1f2430;
    --text-muted: #5c6472;
    --accent: #a34d08;
    --accent-dim: #fdf0dc;
    --green: #127437;
    --orange: #b83c0a;
    --red: #b91c1c;
    --grey: #556070;
    --header-bg: #ffffff;
    /* Pale enough to keep the dark header text readable, red enough to be
       unmistakable at a glance. */
    --dev-header-bg: #fee2e2;
    --dev-header-line: #dc2626;
    --bg-translucent: rgba(245, 246, 248, 0.94);
    --text-on-accent: #ffffff;
    --shadow-rgb: 122, 133, 155;
    --img-bg: #ffffff;
    --table-line: #e6e9ee;
    --cyan: #0e7490;
    --green-strong: #127437;
    --red-strong: #b91c1c;
    --red-soft: #b91c1c;
    --red-softer: #991b1b;
    --amber-soft: #92400e;
    --tint-green: #e2f3e9;
    --tint-green-2: #f3fbf6;
    --tint-green-3: #e2f3e9;
    --tint-orange: #fdf0e7;
    --tint-red: #fbeaea;
    --tint-red-2: #f9e0e0;
    --tint-blue: #e5edfc;
    --tint-cyan: #dcf1f6;
    --nav-toggle-bg: #e6eefc;
    --nav-toggle-bg-active: #d5e3fa;
    --nav-toggle-border: #a9c5f2;
    --nav-toggle-text: #1d4ed8;
    --modal-bg: #ffffff;
    --modal-border: #d7dbe2;
    --modal-item-bg: #f5f6f8;
    --modal-item-border: #e1e5eb;
    --modal-close-bg: #eef0f3;
    --modal-close-border: #d7dbe2;
    --modal-close-text: #3f4657;
    --modal-title: #a34d08;
    --modal-item-title: #1f2430;
    --pp-save-bg: #e2f3e9;
    --pp-save-border: #a8dcbd;
    --pp-save-hover: #d3ecdf;
    /* Same hues, darkened: a wash keeps its meaning and its text keeps AA. */
    --accent-rgb: 163, 77, 8;
    --ok-rgb: 18, 116, 55;
    --warn-rgb: 184, 60, 10;
    --danger-rgb: 185, 28, 28;
    --info-rgb: 29, 78, 216;
    --grey-rgb: 71, 82, 97;
    --tint-ok: rgba(var(--ok-rgb), 0.09);
    --tint-warn: rgba(var(--warn-rgb), 0.09);
    --tint-danger: rgba(var(--danger-rgb), 0.08);
    --tint-info: rgba(var(--info-rgb), 0.08);
    --chip-bg: #e7eaf0;
    --code-bg: rgba(31, 36, 48, 0.07);
    --code-bg-sunken: rgba(31, 36, 48, 0.07);
    --scrim: rgba(31, 36, 48, 0.45);
    --scrim-strong: rgba(31, 36, 48, 0.55);
    --scrim-image: rgba(31, 36, 48, 0.8);
    --header-glow: rgba(31, 36, 48, 0.05);
    /* Rows are already near-white, so hover darkens instead of brightening. */
    --row-hover: brightness(0.965);
    --row-hover-soft: brightness(0.97);
    --card-hover-shadow: 0 6px 18px rgba(var(--shadow-rgb), 0.28);
    --duration-ok-bg: var(--badge-ok-soft);
    --badge-ok: #e2f3e9;
    --badge-ok-soft: #e7f5ed;
    --badge-ok-pill: #e7f5ed;
    --badge-warn: #fdf0e7;
    --badge-danger: #fbe6e6;
    --badge-danger-soft: #fbeaea;
    --badge-info: #e5ecfc;
    --badge-info-soft: #eaf0fd;
    --badge-neutral: #e3e6ec;
    --badge-neutral-strong: #4d5766;
    --info: #1d4ed8;
    --info-strong: #1d4ed8;
    --info-text: #1d4ed8;
    --info-pill-text: #1d4ed8;
    --ok-text: #127437;
    --ok-strong: #127437;
    --danger-strong: #b91c1c;
    --violet: #7e22ce;
    --btn-gold-bg: #a34d08;
    --btn-gold-text: #ffffff;
    --modal-sub-text: #4b5262;
    --modal-item-desc: #5c6472;
    --pp-del-bg: #fbeaea;
    --pp-del-border: #eeb9b9;
    --pp-del-hover: #f7dada;
    /* Solid phone-only buttons in staff-directory.css, which this sheet
       re-points further down (that file is owned by another change). */
    --sd-call-bg: #127437;
    --sd-text-bg: #1d4ed8;
    --sd-mail-bg: #a34d08;
}

html,
body {
    height: 100%;
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
    font-size: 14px;
    line-height: 1.5;
}

/* ── Header ────────────────────────────────────────────────────── */
.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    height: var(--header-h);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    background: var(--header-bg);
    border-bottom: 1px solid var(--border);
    box-shadow: 0 1px 12px var(--header-glow);
}

.site-header h1 {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 1.6rem;
    color: var(--accent);
    letter-spacing: 0.06em;
    cursor: pointer;
}

/* Brand logo: the yellow mark in dark mode, the black mark in light mode.
   The text stays for screen readers and for when an image fails to load. */
.brand { display: inline-flex; align-items: center; margin: 0; line-height: 1; }
.brand-logo { display: none; height: 36px; width: auto; max-width: 60vw; }
.brand-logo-dark { display: inline-block; }
:root[data-theme="light"] .brand-logo-dark { display: none; }
:root[data-theme="light"] .brand-logo-light { display: inline-block; }
.brand .brand-text {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}
.login-brand .brand-logo { height: 72px; max-width: 80vw; }

/* Phone menu button; hidden on desktop where the tab bar is visible. */
.nav-toggle {
    display: none;
    align-items: center;
    gap: 8px;
    padding: 5px 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    color: var(--text);
    font-family: 'Oswald', sans-serif;
    font-size: 0.82rem;
    letter-spacing: 0.04em;
    cursor: pointer;
}

.nav-toggle-bars,
.nav-toggle-bars::before,
.nav-toggle-bars::after {
    display: block;
    width: 16px;
    height: 2px;
    background: currentColor;
    border-radius: 2px;
}

.nav-toggle-bars { position: relative; }

.nav-toggle-bars::before,
.nav-toggle-bars::after { content: ''; position: absolute; left: 0; }

.nav-toggle-bars::before { top: -5px; }

.nav-toggle-bars::after { top: 5px; }

.nav-current {
    max-width: 38vw;
    overflow: hidden;
    color: var(--accent);
    text-overflow: ellipsis;
    white-space: nowrap;
}

.header-sub {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-left: 8px;
}

.live-clock {
    font-family: monospace;
    font-size: 1.1rem;
    color: var(--text-muted);
}

.build-version {
    font-size: 0.7rem;
    font-family: monospace;
    color: var(--text-muted);
    opacity: 0.5;
    letter-spacing: 0.04em;
    margin-right: 4px;
}

.btn-header-refresh {
    padding: 5px 12px;
    background: var(--surface);
    color: var(--text);
    font-size: 0.8rem;
    font-weight: 600;
    border: 1px solid var(--border);
    border-radius: 12px;
    cursor: pointer;
    white-space: nowrap;
    transition: border-color 0.15s, color 0.15s;
}

.btn-header-refresh:hover:not(:disabled) {
    border-color: var(--accent);
    color: var(--accent);
}

.btn-header-refresh:disabled {
    opacity: 0.6;
    cursor: wait;
}

/* ── Main tabs ─────────────────────────────────────────────────── */
.main-tabs {
    display: flex;
    gap: 2px;
    padding: 8px 16px 0;
    background: var(--header-bg);
    border-bottom: 1px solid var(--border);
}

/* ── Not production ─────────────────────────────────────────────── */
/* The header goes red on anything that is not production, and says DEV.
   Written as :not([data-environment="production"]) on purpose: a shell
   composed without an environment, or with one nobody anticipated, warns
   rather than quietly passing itself off as the live dashboard. The stamp is
   on <body> from the server, so it is right from the first paint -- including
   on the sign-in screen, which is when somebody most needs telling. */
body:not([data-environment="production"]) .site-header {
    /* What sits on the header and rings itself in its colour (the
       notes dot) rings itself in this one. */
    --header-bg: var(--dev-header-bg);
    background: var(--dev-header-bg);
    border-bottom: 2px solid var(--dev-header-line);
}

.env-badge {
    display: none;
    padding: 2px 8px;
    border-radius: 999px;
    background: var(--dev-header-line);
    color: #fff;
    font-family: 'Oswald', sans-serif;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    white-space: nowrap;
}

body:not([data-environment="production"]) .env-badge { display: inline-block; }

.tab-btn {
    padding: 8px 20px;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    color: var(--text-muted);
    font-family: 'Oswald', sans-serif;
    font-size: 0.95rem;
    font-weight: 500;
    letter-spacing: 0.04em;
    cursor: pointer;
    transition: color 0.2s, border-color 0.2s;
}

.tab-btn:hover {
    color: var(--text);
}

.tab-btn.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

/* ── Tab content ───────────────────────────────────────────────── */
.main-content {
    padding: 16px;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Policies tab needs flex to chain height down to the editor */
#tab-policies.active {
    display: flex;
    flex-direction: column;
}

.tab-content--iframe.active {
    display: flex;
    flex-direction: column;
    padding: 0;
    position: fixed;
    inset: calc(var(--header-h) + 41px) 0 0 0;
    z-index: 10;
}

.schedule-iframe {
    flex: 1;
    width: 100%;
    border: none;
    display: block;
}

.sd-loc-chip {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    background: var(--border);
    color: var(--text);
}

/* Location chips, same colors everywhere (see --loc-* in :root). */
.sd-loc-cary       { background: var(--loc-cary); color: var(--loc-cary-text); }

.sd-loc-boxyard    { background: var(--loc-boxyard); color: var(--loc-boxyard-text); }

.sd-loc-patterson  { background: var(--loc-patterson); color: var(--loc-patterson-text); }

.sd-loc-greenville { background: var(--loc-greenville); color: var(--loc-greenville-text); }

.sd-loc-morehead   { background: var(--loc-morehead); color: var(--loc-morehead-text); }

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

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

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

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

.no-data-msg {
    color: var(--text-muted);
    font-size: 0.85rem;
    padding: 8px 0;
}

/* ── Reconciliation / Transactions tab ──────────────────────────────────── */

/* Filter bar */
.recon-filters {
    display: flex;
    align-items: flex-end;
    flex-wrap: wrap;
    gap: 12px 20px;
    padding: 12px 16px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 14px;
}

.rf-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.rf-label {
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
}

.rf-input,
.rf-select {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
    font-size: 0.83rem;
    padding: 5px 10px;
    height: 32px;
    outline: none;
    cursor: pointer;
}

.rf-input:focus,
.rf-select:focus { border-color: var(--accent); }

.rf-select option { background: var(--surface-2); }

.rf-run-btn {
    align-self: flex-end;
    padding: 5px 14px;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 5px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    letter-spacing: 0.04em;
    transition: opacity 0.15s;
}

.rf-run-btn:hover  { opacity: 0.85; }

.rf-run-btn:disabled { opacity: 0.45; cursor: wait; }

.rf-status {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-left: auto;
    align-self: center;
}

/* Summary chips */
.recon-summary {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 18px;
}

.recon-chip {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 6px 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    min-width: 100px;
}

.recon-chip-label {
    font-size: 0.67rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    line-height: 1.2;
}

.recon-chip-value {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text);
    line-height: 1.4;
}

.recon-chip-diff.diff-alert { border-color: var(--danger-strong); background: var(--tint-red-2); }

.diff-zero    { color: var(--green-strong); }

.diff-nonzero { color: var(--red-strong); }

/* Side-by-side panels */
.recon-panels {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    align-items: start;
}

@media (max-width: 1000px) {
    .recon-panels { grid-template-columns: 1fr; }
}

.recon-panel { display: flex; flex-direction: column; min-width: 0; }

.recon-panel-hdr {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-bottom: 8px;
    margin-bottom: 10px;
    border-bottom: 1px solid var(--border);
}

.recon-panel-title {
    font-family: 'Oswald', sans-serif;
    font-size: 1.05rem;
    letter-spacing: 0.04em;
    color: var(--text);
    flex: 1;
}

.recon-panel-filter {
    font-size: 0.75rem;
    padding: 3px 6px;
    height: 26px;
}

.recon-count-badge {
    font-size: 0.75rem;
    font-weight: 700;
    background: var(--chip-bg);
    border: 1px solid var(--border);
    color: var(--text-muted);
    padding: 2px 10px;
    border-radius: 12px;
}

.recon-table-wrap { overflow-x: auto; }

.recon-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.81rem;
}

.recon-table thead th {
    background: var(--surface-2);
    color: var(--text-muted);
    text-transform: uppercase;
    font-size: 0.67rem;
    letter-spacing: 0.06em;
    padding: 7px 10px;
    text-align: left;
    white-space: nowrap;
    border-bottom: 1px solid var(--border);
}

.recon-table tbody td {
    padding: 8px 10px;
    border-bottom: 1px solid var(--table-line);
    color: var(--text);
    vertical-align: top;
}

.recon-table tbody tr.recon-row:hover td { filter: var(--row-hover); }

.recon-amt       { font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }

.recon-total-cell { color: var(--green); }

.recon-mono      { font-family: monospace; font-size: 0.78rem; white-space: nowrap; }

/* OTC location + game stacked cell */
.otc-game { font-weight: 600; font-size: 0.85rem; white-space: nowrap; }

.otc-loc  { font-size: 0.75rem; color: var(--text-muted); margin-top: 2px; white-space: nowrap; }

.otc-time { color: var(--accent); font-weight: 600; margin-left: 4px; }

.recon-empty {
    text-align: center;
    color: var(--text-muted);
    padding: 24px 10px;
    font-size: 0.84rem;
}

.auth-status-overlay {
    position: fixed;
    inset: 0;
    z-index: 2300;
    background: var(--scrim-strong);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.auth-status-overlay.hidden {
    display: none;
}

.auth-status-card {
    width: min(720px, 96vw);
    background: var(--modal-bg);
    border: 1px solid var(--modal-border);
    border-radius: 14px;
    box-shadow: 0 16px 40px rgba(var(--shadow-rgb), 0.45);
    padding: 18px 18px 16px;
    position: relative;
}

.auth-status-close {
    position: absolute;
    right: 10px;
    top: 8px;
    border: 1px solid var(--modal-close-border);
    background: var(--modal-close-bg);
    color: var(--modal-close-text);
    border-radius: 8px;
    width: 32px;
    height: 32px;
    cursor: pointer;
    font-size: 20px;
    line-height: 1;
}

.auth-status-card h2 {
    margin: 0 36px 6px 0;
    font-size: 1.15rem;
    font-family: 'Oswald', sans-serif;
    letter-spacing: 0.04em;
    color: var(--modal-title);
}

.auth-status-sub {
    margin: 0 0 12px;
    color: var(--modal-sub-text);
    font-size: 0.93rem;
}

.auth-status-items {
    display: grid;
    gap: 10px;
}

.auth-status-item {
    display: flex;
    gap: 12px;
    align-items: center;
    justify-content: space-between;
    padding: 12px;
    border-radius: 10px;
    border: 1px solid var(--modal-item-border);
    background: var(--modal-item-bg);
}

.auth-status-item-left {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.auth-status-item-title {
    color: var(--modal-item-title);
    font-weight: 700;
    font-size: 0.95rem;
}

.auth-status-item-desc {
    color: var(--modal-item-desc);
    font-size: 0.84rem;
}

.auth-status-login-btn {
    border: 1px solid var(--btn-gold-bg);
    background: var(--btn-gold-bg);
    color: var(--btn-gold-text);
    border-radius: 8px;
    padding: 8px 12px;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
}

.auth-status-login-btn:hover {
    filter: brightness(1.06);
}

@media (max-width: 720px) {
    .auth-status-item {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* ══════════════════════════════════════════════════════════════════════════
   Dashboard access & user management
   ══════════════════════════════════════════════════════════════════════════ */
[hidden] {
    display: none !important;
}

.dashboard-access-gate {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: grid;
    place-items: center;
    padding: 24px;
    background: var(--bg-translucent);
    backdrop-filter: blur(8px);
}

.dashboard-access-gate.hidden {
    display: none;
}

.dashboard-access-card {
    width: min(440px, 100%);
    padding: 32px;
    text-align: center;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: 0 24px 80px rgba(var(--shadow-rgb), 0.5);
}

.dashboard-access-card h2 {
    margin: 14px 0 8px;
    color: var(--accent);
    font-family: 'Oswald', sans-serif;
    letter-spacing: 0.03em;
}

.dashboard-access-card p {
    margin: 0;
    color: var(--text-muted);
    line-height: 1.55;
}

.dashboard-access-card.access-denied {
    border-color: rgba(var(--danger-rgb), 0.55);
}

.dashboard-access-card.access-denied h2 {
    color: var(--red);
}

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

.access-denied .dashboard-access-spinner {
    display: none;
}

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

/* The signed-in person: avatar (or initial) and the name they go by. It is a
   button that opens "My profile", and inert for a visitor, who has none. */
.dashboard-user-chip {
    /* inline-flex, not flex: the header row lays its controls out inline, and
       a block-level chip would push "Sign out" onto its own line. */
    display: inline-flex;
    vertical-align: middle;
    align-items: center;
    gap: 6px;
    max-width: 220px;
    padding: 3px 10px 3px 3px;
    color: var(--text-muted);
    font-size: 0.75rem;
    background: var(--chip-bg);
    border: 1px solid var(--border);
    border-radius: 999px;
    cursor: pointer;
    transition: border-color 0.15s, color 0.15s;
}

.dashboard-user-chip:hover:not(:disabled),
.dashboard-user-chip:focus-visible:not(:disabled) {
    border-color: var(--accent);
    color: var(--accent);
}

.dashboard-user-chip:disabled {
    cursor: default;
}

.session-chip-name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.session-face {
    flex: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
}

.session-face-initial {
    display: grid;
    place-items: center;
    font-family: 'Bebas Neue', sans-serif;
    font-size: 0.88rem;
    color: var(--text-on-accent);
    background: var(--accent);
    letter-spacing: -0.01em;
}

.session-face-img {
    background: var(--surface-2);
    object-fit: cover;
}

/* The same face, sized for a list row: the Staff Directory's names and the
   Overview's "On now" people. 22px is the row's own text height, so a row
   with a picture is exactly as tall as one without. `flex: none` keeps it
   round inside the flex name wraps it rides in. */
.row-face {
    flex: none;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    vertical-align: middle;
}

.row-face-initial {
    display: inline-grid;
    place-items: center;
    font-family: 'Bebas Neue', sans-serif;
    font-size: 0.82rem;
    line-height: 1;
    color: var(--text-on-accent);
    background: var(--accent);
    letter-spacing: -0.01em;
}

.row-face-img {
    display: inline-block;
    background: var(--surface-2);
    object-fit: cover;
}

/* Header "Sign out" / "Switch user"; on phones it moves into the menu list. */
.btn-header-signout {
    padding: 5px 10px;
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 600;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 999px;
    cursor: pointer;
    white-space: nowrap;
    transition: border-color 0.15s, color 0.15s;
}

.btn-header-signout:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.nav-session {
    display: none;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 12px 18px;
    border-top: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* Phones: the same person, at the foot of the menu, and the same button. */
.nav-session-name {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    padding: 4px 8px 4px 4px;
    color: inherit;
    font: inherit;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 999px;
    cursor: pointer;
}

.nav-session-name:hover:not(:disabled),
.nav-session-name:focus-visible:not(:disabled) {
    color: var(--accent);
    border-color: var(--border);
}

.nav-session-name:disabled {
    cursor: default;
}

.nav-session-name .session-face {
    width: 28px;
    height: 28px;
}

.nav-signout-btn {
    flex: none;
    padding: 7px 12px;
    color: var(--accent);
    font-weight: 700;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
}

/* ── Login screen ─────────────────────────────────────────────────────────
   Replaces the access gate when there is no session. */
.login-screen {
    position: fixed;
    inset: 0;
    z-index: 10001;
    display: grid;
    place-items: center;
    padding: 24px 16px;
    overflow-y: auto;
    background: var(--bg);
}

body.login-open {
    overflow: hidden;
}

.login-card {
    width: min(420px, 100%);
    padding: 28px 26px 22px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: 0 24px 80px rgba(var(--shadow-rgb), 0.45);
}

.login-brand {
    margin-bottom: 20px;
    text-align: center;
}

.login-brand h1 {
    margin: 0;
    font-family: 'Bebas Neue', sans-serif;
    font-size: 2rem;
    letter-spacing: 0.06em;
    color: var(--accent);
    line-height: 1;
}

.login-brand span {
    display: block;
    margin-top: 4px;
    color: var(--text-muted);
    font-size: 0.8rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.login-google-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 11px 14px;
    color: var(--text);
    font-weight: 700;
    text-decoration: none;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 10px;
    transition: border-color 0.15s;
}

.login-google-btn:hover {
    border-color: var(--accent);
}

/* The Google "G" on a white disc, per Google's sign-in button guidelines. */
.login-google-mark {
    display: inline-grid;
    place-items: center;
    width: 28px;
    height: 28px;
    background: #fff;
    border-radius: 50%;
}

.login-help {
    margin: 8px 0 0;
    color: var(--text-muted);
    font-size: 0.78rem;
    line-height: 1.45;
    text-align: center;
}

.login-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 22px 0 14px;
    color: var(--text-muted);
    font-family: 'Oswald', sans-serif;
    font-size: 0.78rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.login-divider::before,
.login-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

.login-step-title {
    margin: 0 0 10px;
    font-family: 'Oswald', sans-serif;
    font-size: 1.05rem;
    letter-spacing: 0.02em;
}

/* Two tiles wide on a phone, which is what a thumb wants; four on a desktop
   or a shop tablet in landscape, where a long roster otherwise scrolls. The
   card widens with it so the tiles keep their size. */
.login-people {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin-bottom: 14px;
}

@media (min-width: 620px) {
    /* The class is set only while tiles are on show, so the sign-in card does
       not stretch for the plain email and PIN form. */
    .login-card.login-card-people {
        width: min(600px, 100%);
    }

    .login-people {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

.login-person {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    min-height: 84px;
    padding: 10px 8px;
    color: var(--text);
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 12px;
    cursor: pointer;
    transition: border-color 0.15s, transform 0.1s;
}

.login-person:hover,
.login-person:focus-visible {
    border-color: var(--accent);
    outline: none;
}

.login-person:active {
    transform: scale(0.97);
}

/* The tile's face: the avatar this person picked, or their initial. */
.login-person-face {
    flex: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
}

.login-person-face-initial {
    display: grid;
    place-items: center;
    font-family: 'Bebas Neue', sans-serif;
    font-size: 1.25rem;
    color: var(--text-on-accent);
    background: var(--accent);
    letter-spacing: -0.01em;
}

.login-person-face-img {
    background: var(--surface-2);
    object-fit: cover;
}

.login-person-name {
    max-width: 100%;
    overflow: hidden;
    font-size: 0.82rem;
    font-weight: 600;
    text-align: center;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.login-email-form .user-field-label {
    display: block;
    margin-bottom: 4px;
}

.login-email-form-secondary .user-field-label::before {
    content: 'Someone else? ';
    color: var(--text-muted);
    font-weight: 400;
}

.login-email-row {
    display: flex;
    gap: 8px;
}

.login-email-row .user-input {
    flex: 1;
    min-width: 0;
}

.login-back {
    margin: -6px 0 6px -4px;
    font-size: 0.82rem;
}

.login-pin-for {
    margin: -4px 0 12px;
    color: var(--text-muted);
    font-size: 0.85rem;
    overflow-wrap: anywhere;
}

.login-pin-dots {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin: 6px 0 16px;
}

.login-pin-dots span {
    width: 16px;
    height: 16px;
    background: transparent;
    border: 2px solid var(--border);
    border-radius: 50%;
    transition: background 0.1s, border-color 0.1s;
}

.login-pin-dots span.filled {
    background: var(--accent);
    border-color: var(--accent);
}

.login-pin-dots.shake {
    animation: login-shake 0.4s;
}

@keyframes login-shake {
    20%, 60% { transform: translateX(-6px); }
    40%, 80% { transform: translateX(6px); }
}

.login-keypad {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    max-width: 260px;
    margin: 0 auto;
}

.login-keypad button {
    min-height: 54px;
    color: var(--text);
    font-family: 'Oswald', sans-serif;
    font-size: 1.35rem;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 12px;
    cursor: pointer;
    transition: border-color 0.15s, transform 0.1s;
}

.login-keypad button:hover:not(:disabled),
.login-keypad button:focus-visible {
    border-color: var(--accent);
    outline: none;
}

.login-keypad button:active:not(:disabled) {
    transform: scale(0.95);
}

.login-keypad button:disabled {
    opacity: 0.55;
    cursor: wait;
}

.login-keypad .login-key-muted {
    color: var(--text-muted);
    font-size: 0.9rem;
    letter-spacing: 0.04em;
}

.login-error {
    margin: 14px 0 0;
    padding: 9px 12px;
    color: var(--red-soft);
    font-size: 0.85rem;
    text-align: center;
    background: var(--tint-red);
    border: 1px solid rgba(var(--danger-rgb), 0.4);
    border-radius: 8px;
}

.login-device {
    margin: 14px 0 0;
    color: var(--text-muted);
    font-size: 0.72rem;
    text-align: center;
}

.user-management-section {
    max-width: 1500px;
    margin: 0 auto;
}

.user-management-header,
.user-editor-title-row,
.user-list-summary,
.user-editor-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.user-management-header {
    margin-bottom: 18px;
}

.user-management-header h2,
.user-editor-card h3,
.user-list-card h3 {
    margin: 0;
    color: var(--text);
    font-family: 'Oswald', sans-serif;
}

.user-management-header p {
    max-width: 760px;
    margin: 4px 0 0;
    color: var(--text-muted);
    font-size: 0.86rem;
}

.user-management-layout {
    display: grid;
    grid-template-columns: minmax(340px, 0.85fr) minmax(520px, 1.5fr);
    gap: 18px;
    align-items: start;
}

.user-editor-card,
.user-list-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(var(--shadow-rgb), 0.18);
}

.user-editor-card {
    padding: 20px;
}

.user-editor-title-row {
    margin-bottom: 16px;
}

.user-field-label {
    display: block;
    margin: 12px 0 6px;
    color: var(--text-muted);
    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.user-input {
    width: 100%;
    padding: 9px 11px;
    color: var(--text);
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 6px;
    outline: none;
}

.user-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent-dim);
}

.user-input:disabled {
    opacity: 0.55;
}

.user-form-row {
    display: grid;
    grid-template-columns: 1.25fr 0.75fr;
    gap: 12px;
}

/* The two ends of an hours goal, side by side and the same width:
   "From" and "To" are one field, not a field and an afterthought. */
.hours-goal-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.hours-goal-end {
    display: block;
    margin: 0 0 4px;
    color: var(--text-muted);
    font-size: 0.74rem;
}

/* Which Square team member somebody is, one line per connected account:
   the account, the person, and who said so. */
.user-square-row {
    display: grid;
    grid-template-columns: 0.6fr 1fr auto;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.user-square-account {
    font-size: 0.85rem;
}

.user-square-owner {
    color: var(--text-muted);
    font-size: 0.74rem;
    white-space: nowrap;
}

@media (max-width: 640px) {
    .user-square-row {
        grid-template-columns: 1fr;
        gap: 4px;
    }
}

.user-fieldset {
    margin: 18px 0 0;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
}

.user-fieldset legend {
    padding: 0 6px;
    color: var(--accent);
    font-family: 'Oswald', sans-serif;
    font-size: 0.82rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.user-check-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px 10px;
}

.user-permission-grid {
    grid-template-columns: 1fr;
}

.user-check-option,
.user-active-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-muted);
    font-size: 0.82rem;
    cursor: pointer;
}

.user-check-option input,
.user-active-toggle input {
    accent-color: var(--accent);
}

.user-active-toggle {
    margin: 16px 0 4px;
    color: var(--text);
    font-weight: 600;
}

.user-editor-status {
    min-height: 20px;
    margin-top: 10px;
    color: var(--text-muted);
    font-size: 0.8rem;
}

.user-editor-status.error {
    color: var(--red);
}

.user-editor-status.success {
    color: var(--green);
}

.user-editor-actions {
    justify-content: flex-start;
    margin-top: 14px;
}

.user-btn,
.user-link-btn {
    border: 0;
    cursor: pointer;
    font-weight: 700;
}

.user-btn {
    padding: 8px 14px;
    border-radius: 6px;
}

.user-btn-primary {
    color: var(--text-on-accent);
    background: var(--accent);
}

.user-btn-secondary {
    color: var(--text);
    background: var(--surface-2);
    border: 1px solid var(--border);
}

.user-btn-danger {
    color: var(--red-softer);
    background: var(--badge-danger-soft);
    border: 1px solid rgba(var(--danger-rgb), 0.42);
}

.user-link-btn {
    padding: 4px;
    color: var(--accent);
    background: none;
}

.user-list-card {
    min-width: 0;
    overflow: hidden;
}

.user-list-summary {
    padding: 16px 18px;
    border-bottom: 1px solid var(--border);
}

.user-list-summary span {
    color: var(--text-muted);
    font-size: 0.8rem;
}

.user-table-wrap {
    overflow-x: auto;
}

.user-table {
    width: 100%;
    border-collapse: collapse;
}

/* Staff Directory rows share .user-table. This rule is declared before
   .user-table td so the table keeps the top alignment it always had. */
.sd-table td { vertical-align: middle; }

.user-table th,
.user-table td {
    padding: 12px 14px;
    text-align: left;
    vertical-align: top;
    border-bottom: 1px solid var(--border);
}

.user-table th {
    color: var(--text-muted);
    font-size: 0.7rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    background: var(--surface-2);
}

.user-table td {
    color: var(--text);
    font-size: 0.82rem;
}

.user-table tr:last-child td {
    border-bottom: 0;
}

.user-table tr.inactive {
    opacity: 0.55;
}

.user-name {
    display: block;
    font-weight: 700;
}

.user-email {
    display: block;
    margin-top: 2px;
    color: var(--text-muted);
    font-size: 0.74rem;
}

.user-badge,
.user-location-pill {
    display: inline-block;
    margin: 0 4px 4px 0;
    padding: 3px 7px;
    font-size: 0.68rem;
    white-space: nowrap;
    border-radius: 999px;
}

.user-badge {
    color: var(--accent);
    background: var(--accent-dim);
    border: 1px solid rgba(var(--accent-rgb), 0.25);
}

.user-location-pill {
    color: var(--info-pill-text);
    background: var(--badge-info-soft);
    border: 1px solid rgba(var(--info-rgb), 0.24);
}

.user-access-summary {
    max-width: 260px;
    color: var(--text-muted);
    line-height: 1.45;
}

.user-edit-btn {
    padding: 5px 9px;
    color: var(--text);
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 5px;
    cursor: pointer;
}

.user-empty {
    padding: 28px !important;
    color: var(--text-muted) !important;
    text-align: center !important;
}

/* ── My profile ──────────────────────────────────────────────────
   What a person sets about themselves: the name they go by, one of the
   bundled avatars, and the order of their own locations. */
.profile-overlay {
    position: fixed;
    inset: 0;
    z-index: 2400;
    background: var(--scrim-strong);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.profile-overlay.hidden {
    display: none;
}

.profile-card {
    position: relative;
    width: min(520px, 96vw);
    max-height: 92vh;
    overflow-y: auto;
    padding: 18px;
    background: var(--modal-bg);
    border: 1px solid var(--modal-border);
    border-radius: 14px;
    box-shadow: 0 16px 40px rgba(var(--shadow-rgb), 0.45);
}

.profile-card h2 {
    margin: 0 36px 4px 0;
    font-family: 'Oswald', sans-serif;
    font-size: 1.15rem;
    letter-spacing: 0.04em;
    color: var(--modal-title);
}

.profile-sub {
    margin: 0 0 14px;
    color: var(--text-muted);
    font-size: 0.8rem;
}

.profile-field {
    margin-bottom: 16px;
}

.profile-field .user-field-label {
    display: block;
    margin: 0 0 5px;
}

.profile-hint {
    margin: 5px 0 0;
    color: var(--text-muted);
    font-size: 0.74rem;
}

/* Thirty-one styles: one swipeable row of tabs above the grid, so the dialog
   keeps its height whatever the catalogue grows to. */
.profile-styles {
    display: flex;
    flex-wrap: nowrap;
    gap: 6px;
    margin-bottom: 6px;
    padding-bottom: 4px;
    overflow-x: auto;
    scrollbar-width: thin;
}

.profile-style {
    flex: 0 0 auto;
    padding: 4px 10px;
    color: var(--text-muted);
    font-size: 0.74rem;
    white-space: nowrap;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 999px;
    cursor: pointer;
}

.profile-style:hover,
.profile-style:focus-visible {
    color: var(--text);
    outline: none;
    border-color: var(--accent);
}

.profile-style.chosen {
    color: var(--text-on-accent);
    background: var(--accent);
    border-color: var(--accent);
}

/* Thirty avatars at a time — one style — in a scrolling grid, so the dialog
   stays the size of a dialog. It shrinks with the viewport, so a phone never
   has to scroll the card. */
.profile-avatars {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(52px, 1fr));
    gap: 6px;
    max-height: min(210px, 32vh);
    overflow-y: auto;
    padding: 8px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 10px;
}

/* The CC BY credit the README's licence table completes. */
.profile-credit a {
    color: inherit;
}

.profile-avatar {
    display: grid;
    place-items: center;
    aspect-ratio: 1;
    padding: 3px;
    background: transparent;
    border: 2px solid transparent;
    border-radius: 10px;
    cursor: pointer;
}

.profile-avatar img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.profile-avatar:hover,
.profile-avatar:focus-visible {
    border-color: var(--border);
    outline: none;
}

.profile-avatar.chosen {
    border-color: var(--accent);
}

/* "No picture": the initials everyone falls back to. */
.profile-avatar-none {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 1.3rem;
    color: var(--text-on-accent);
    background: var(--accent);
}

.profile-pin-row {
    display: flex;
    gap: 8px;
}

.profile-pin-row input {
    flex: 1 1 0;
    min-width: 0;
    letter-spacing: 0.3em;
}

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

.profile-order-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 10px;
    margin-bottom: 5px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 8px;
}

.profile-order-rank {
    flex: none;
    width: 20px;
    color: var(--text-muted);
    font-size: 0.75rem;
    text-align: center;
}

.profile-order-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    font-weight: 600;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.profile-order-moves {
    flex: none;
    display: flex;
    gap: 4px;
}

.profile-move {
    width: 28px;
    height: 28px;
    color: var(--text);
    background: var(--chip-bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    cursor: pointer;
}

.profile-move:disabled {
    opacity: 0.35;
    cursor: default;
}

.profile-error {
    margin: 0 0 10px;
    padding: 8px 11px;
    color: var(--red-soft);
    font-size: 0.82rem;
    background: var(--tint-red);
    border: 1px solid rgba(var(--danger-rgb), 0.4);
    border-radius: 8px;
}

.profile-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

@media (max-width: 1050px) {
    .user-management-layout {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .user-management-header,
    .user-form-row {
        display: block;
    }

    .user-management-header .user-btn {
        margin-top: 12px;
    }

    .user-check-grid {
        grid-template-columns: 1fr;
    }

    .dashboard-user-chip {
        display: none !important;
    }
}

/* ── Overview mobile layout ──────────────────────────────────────
   Keep the page viewport-width and show one location card at a time. */
@media (max-width: 640px) {
    html,
    body {
        width: 100%;
        max-width: 100%;
        overflow-x: clip;
    }

    .site-header {
        height: auto;
        min-height: var(--header-h);
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        gap: 8px;
        padding: 9px 12px;
    }

    .header-left,
    .header-right {
        display: flex;
        align-items: center;
        min-width: 0;
    }

    /* Brand on one line, "Admin Dashboard" under it. */
    .header-left {
        flex-direction: column;
        align-items: flex-start;
        gap: 1px;
        line-height: 1.05;
    }

    .site-header h1 {
        font-size: 1.35rem;
        white-space: nowrap;
    }

    .header-sub {
        margin-left: 0;
        font-size: 0.68rem;
        white-space: nowrap;
    }

    .header-right {
        justify-content: flex-end;
        gap: 6px;
    }

    .build-version,
    .dashboard-user-chip,
    .btn-header-signout {
        display: none !important;
    }

    /* Phones: the header is just the brand and the menu button; the
       signed-in name and sign-out sit at the bottom of the menu list. */
    .live-clock,
    .btn-header-refresh {
        display: none !important;
    }

    .nav-session:not([hidden]) {
        display: flex;
    }

    .site-header h1 {
        overflow: hidden;
        text-overflow: ellipsis;
    }

    /* Section name first, menu icon on the far right. */
    .nav-toggle {
        display: inline-flex;
        flex-direction: row-reverse;
        max-width: 62vw;
        min-height: 46px;
        padding: 8px 14px;
        border: 1px solid var(--nav-toggle-border);
        border-radius: 10px;
        background: var(--nav-toggle-bg);
        color: var(--nav-toggle-text);
        font-size: 0.98rem;
    }
    .nav-toggle:active { background: var(--nav-toggle-bg-active); }
    .nav-current { color: var(--nav-toggle-text); }
    .nav-toggle-bars,
    .nav-toggle-bars::before,
    .nav-toggle-bars::after { width: 20px; }
    .nav-toggle-bars::before { top: -6px; }
    .nav-toggle-bars::after { top: 6px; }

    /* The open menu must sit above the pinned Schedule/Policies frames. */
    .main-tabs.open { position: relative; z-index: 60; }

    /* Pinned iframe tabs start right under the real header height (no tab bar on phones). */
    .tab-content--iframe.active {
        inset: var(--header-actual, var(--header-h)) 0 0 0;
    }
    .nav-current { max-width: none; }

    /* Tabs fold into a drop-down list under the header, opened by the menu button. */
    .main-tabs {
        display: none;
        flex-direction: column;
        gap: 0;
        width: 100%;
        padding: 4px 0;
        border-bottom: 1px solid var(--border);
        box-shadow: 0 10px 24px rgba(var(--shadow-rgb), 0.45);
    }

    .main-tabs.open { display: flex; }

    .tab-btn {
        width: 100%;
        min-width: 0;
        padding: 11px 18px;
        border-bottom: 1px solid var(--border);
        border-left: 3px solid transparent;
        font-size: 0.95rem;
        line-height: 1.2;
        text-align: left;
        white-space: normal;
    }

    .tab-btn:last-child { border-bottom: 0; }

    .tab-btn.active {
        border-left-color: var(--accent);
        border-bottom-color: var(--border);
        background: var(--surface);
    }

    .main-content {
        width: 100%;
        min-width: 0;
        padding: 10px;
    }

    #tab-overview,
    #tab-overview .overview-grid,
    #tab-overview .glance-card {
        width: 100%;
        min-width: 0;
        max-width: 100%;
    }

    #tab-overview .overview-card-nav {
        position: sticky;
        top: calc(var(--header-h) + 4px);
        z-index: 30;
        display: flex;
        justify-content: center;
        gap: 2px;
        margin: -4px -4px 6px;
        padding: 2px 4px;
        background: var(--bg-translucent);
        backdrop-filter: blur(8px);
    }

    #tab-overview .overview-date-toolbar {
        display: grid;
        grid-template-columns: 1fr auto 1fr;
        gap: 7px;
        margin-bottom: 8px;
    }

    #tab-overview .overview-date-caption {
        justify-self: end;
        font-size: 0.62rem;
    }

    #tab-overview .overview-date-control {
        grid-template-columns: 34px minmax(110px, auto) 34px;
    }

    #tab-overview .overview-date-current {
        padding: 7px 9px;
        font-size: 0.82rem;
    }

    #tab-overview .overview-date-status {
        min-width: 0;
        font-size: 0.65rem;
    }

    #tab-overview .overview-card-nav-btn {
        width: 24px;
        height: 20px;
        padding: 0;
        background: transparent;
        border: 0;
        border-radius: 50%;
        cursor: pointer;
    }

    #tab-overview .overview-card-nav-btn::before {
        display: block;
        width: 8px;
        height: 8px;
        margin: auto;
        content: '';
        background: var(--text-muted);
        border-radius: 50%;
        transition: background 0.15s, transform 0.15s;
    }

    #tab-overview .overview-card-nav-btn.active::before {
        background: var(--accent);
        transform: scale(1.25);
    }

    #tab-overview .overview-card-nav-btn[data-location="cary"].active::before { background: var(--loc-cary); }
    #tab-overview .overview-card-nav-btn[data-location="boxyard"].active::before { background: var(--loc-boxyard); }
    #tab-overview .overview-card-nav-btn[data-location="patterson"].active::before { background: var(--loc-patterson); }
    #tab-overview .overview-card-nav-btn[data-location="greenville"].active::before { background: var(--loc-greenville); }
    #tab-overview .overview-card-nav-btn[data-location="morehead"].active::before { background: var(--loc-morehead); }

    #tab-overview .overview-card-nav-btn:focus-visible {
        outline: 2px solid var(--accent);
        outline-offset: -2px;
    }

    #tab-overview .overview-grid {
        display: flex;
        grid-template-columns: none;
        gap: 12px;
        overflow-x: auto;
        overflow-y: hidden;
        overscroll-behavior-inline: contain;
        scroll-behavior: smooth;
        scroll-snap-type: x mandatory;
        scrollbar-width: none;
        touch-action: pan-x pan-y;
        -webkit-overflow-scrolling: touch;
    }

    #tab-overview .overview-grid::-webkit-scrollbar {
        display: none;
    }

    #tab-overview .glance-card {
        flex: 0 0 100%;
        border-radius: 10px;
        scroll-snap-align: start;
        scroll-snap-stop: always;
    }

    /* The active-card ring leaves the top rule alone: that is the card's
       location colour, and it is how you know which card you swiped to. */
    #tab-overview .glance-card.mobile-card-active {
        border-right-color: rgba(var(--accent-rgb), 0.45);
        border-bottom-color: rgba(var(--accent-rgb), 0.45);
        border-left-color: rgba(var(--accent-rgb), 0.45);
    }

    #tab-overview .glance-header {
        min-width: 0;
        padding: 10px 12px;
    }

    #tab-overview .glance-header h2 {
        min-width: 0;
        font-size: 1.3rem;
    }

    #tab-overview .glance-revenue-badge {
        max-width: 55%;
        overflow: hidden;
        padding: 3px 9px;
        font-size: 0.76rem;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    #tab-overview .glance-schedule {
        height: auto;
        max-height: none;
    }

    #tab-overview .glance-summary {
        display: grid;
        grid-template-columns: auto minmax(0, 1fr) auto;
        gap: 7px;
        min-width: 0;
        padding: 10px 12px;
    }

    #tab-overview .glance-summary::before {
        grid-column: 1;
    }

    #tab-overview .glance-chip {
        grid-column: 3;
        max-width: min(58vw, 210px);
        overflow: hidden;
        margin-left: 0;
        padding: 2px 8px;
        font-size: 0.72rem;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    #tab-overview .glance-detail-body {
        min-width: 0;
        padding: 9px 12px 12px;
    }

    #tab-overview .glance-staff-row,
    #tab-overview .glance-tx-row,
    #tab-overview .tip-split-row {
        min-width: 0;
    }

    #tab-overview .glance-staff-name,
    #tab-overview .glance-staff-meta,
    #tab-overview .glance-tx-card,
    #tab-overview .tip-split-name {
        min-width: 0;
        overflow-wrap: anywhere;
    }
}

@media (max-width: 390px) {
    .site-header {
        grid-template-columns: minmax(0, 1fr) auto;
        padding-inline: 9px;
    }
}

.gs-table-card.gs-loc-cary { border-left: 4px solid var(--loc-cary); }

.gs-table-card.gs-loc-boxyard { border-left: 4px solid var(--loc-boxyard); }

.gs-table-card.gs-loc-patterson { border-left: 4px solid var(--loc-patterson); }

.gs-table-card.gs-loc-greenville { border-left: 4px solid var(--loc-greenville); }

.gs-table-card.gs-loc-morehead { border-left: 4px solid var(--loc-morehead); }

.gs-chip {
    padding: 3px 10px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface);
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 700;
    white-space: nowrap;
}

.gs-chip-warn {
    border-color: rgba(var(--warn-rgb), 0.5);
    color: var(--orange);
}

.gs-chip-conflict {
    border-color: rgba(var(--danger-rgb), 0.5);
    color: var(--red-soft);
}

/* Location tables */
.gs-tables {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.gs-table-card {
    min-width: 0;
    overflow: hidden;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(var(--shadow-rgb), 0.18);
}

.gs-table-hdr {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    background: var(--surface-2);
}

.gs-table-hdr h3 {
    margin: 0;
    color: var(--accent);
    font-family: 'Bebas Neue', sans-serif;
    font-size: 1.4rem;
    letter-spacing: 0.06em;
}

.gs-table-hdr .gs-chip { margin-left: auto; }

/* ── Header menu groups (Settings > Menu) ─────────────────────────────── */
/* A parent page with nested pages renders as .tab-group: the parent's own
   .tab-btn plus a caret that opens the children. Children are real .tab-btn
   elements so tab switching, #hash links, and permission gating are shared. */
.tab-group {
    position: relative;
    display: inline-flex;
    flex-direction: column;
}

.tab-group-head {
    display: flex;
    align-items: stretch;
}

.tab-group-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 8px 8px 2px;
    border: none;
    border-bottom: 3px solid transparent;
    background: transparent;
    color: var(--text-muted);
    font-family: 'Oswald', sans-serif;
    font-size: 0.95rem;
    font-weight: 500;
    letter-spacing: 0.04em;
    cursor: pointer;
    transition: color 0.2s;
}

.tab-group-toggle:hover,
.tab-group.open .tab-group-toggle,
.tab-group.has-active .tab-group-toggle {
    color: var(--accent);
}

.tab-group-caret {
    font-size: 0.8rem;
    line-height: 1;
}

/* When the parent page itself is shown, the caret is enough. */
.tab-group-head .tab-btn:not([hidden]) + .tab-group-toggle {
    padding-left: 0;
    margin-left: -12px;
}

.tab-group-head .tab-btn:not([hidden]) + .tab-group-toggle .tab-group-toggle-label {
    display: none;
}

/* A hidden parent with visible children: the caret button carries the label. */
.tab-group-headless .tab-group-toggle {
    padding: 8px 14px 8px 20px;
}

.tab-group-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 90;
    min-width: 200px;
    padding: 4px 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-top: 0;
    border-radius: 0 0 8px 8px;
    box-shadow: 0 12px 28px rgba(var(--shadow-rgb), 0.35);
}

.tab-group:hover .tab-group-menu,
.tab-group.open .tab-group-menu {
    display: block;
}

.tab-group-empty .tab-group-menu { display: none !important; }

.tab-group-empty .tab-group-toggle { display: none !important; }

/* The hidden attribute must win over the display rules above, on every screen size. */
.tab-btn[hidden],
.tab-group-toggle[hidden],
.tab-group[hidden] { display: none !important; }

.tab-group-menu .tab-btn {
    display: block;
    width: 100%;
    padding: 9px 16px;
    border-bottom: 0;
    border-left: 3px solid transparent;
    text-align: left;
    white-space: nowrap;
}

.tab-group-menu .tab-btn.active {
    border-left-color: var(--accent);
    background: var(--surface-2);
}

@media (max-width: 640px) {
    /* Phone menu: groups stack, children are indented under the parent. */
    .tab-group,
    .tab-group-head {
        display: block;
        width: 100%;
    }

    .tab-group-toggle {
        display: none;
    }

    .tab-group-headless .tab-group-toggle {
        display: block;
        width: 100%;
        padding: 10px 18px 2px;
        border: 0;
        color: var(--text-muted);
        font-size: 0.78rem;
        letter-spacing: 0.08em;
        text-transform: uppercase;
        text-align: left;
        pointer-events: none;
    }

    .tab-group-headless .tab-group-caret {
        display: none;
    }

    .tab-group-head .tab-btn:not([hidden]) + .tab-group-toggle {
        margin-left: 0;
    }

    .tab-group-menu,
    .tab-group:hover .tab-group-menu,
    .tab-group.open .tab-group-menu {
        display: block;
        position: static;
        min-width: 0;
        padding: 0;
        background: transparent;
        border: 0;
        border-radius: 0;
        box-shadow: none;
    }

    .tab-group-menu .tab-btn {
        padding: 10px 18px 10px 36px;
        border-bottom: 1px solid var(--border);
        white-space: normal;
    }

    .tab-group-menu .tab-btn::before {
        content: '\21B3';
        margin-right: 8px;
        color: var(--text-muted);
    }

    .tab-group-menu .tab-btn.active {
        border-left-color: var(--accent);
        background: var(--surface);
    }

    .main-tabs > :last-child .tab-btn:last-child {
        border-bottom: 0;
    }
}

/* ── Light-only touch-ups for sheets this change does not own ──────────────
   staff-directory.css draws its phone action buttons as solid brand colors
   with white labels. On light those three greens/blues/ambers were tuned for
   a dark page and left the labels under 4.5:1, so re-point them here. The
   selectors are more specific than the originals, so load order is moot. */
@media (max-width: 720px) {
    :root[data-theme="light"] .sd-action-call { background: var(--sd-call-bg); }

    :root[data-theme="light"] .sd-action-text { background: var(--sd-text-bg); }

    :root[data-theme="light"] .sd-action-mail { background: var(--sd-mail-bg); }
}

/* ── Admin notes ──────────────────────────────────────────────────────────
   The shared notepad for administrators and owners: the icon at the end
   of the header, after Sign out, the "Notes" row in the phone menu, and
   the panel that
   slides in from the right. Desktop leaves the page usable beside it; at
   820px and under it takes the whole screen. Markup is in index.html's
   chrome:notes blocks, code in core.js's "Admin notes" section. */
.notes-toggle {
    position: relative;
    display: inline-grid;
    place-items: center;
    vertical-align: middle;
    width: 32px;
    height: 32px;
    margin: 0 0 0 12px;
    padding: 0;
    color: var(--text-muted);
    background: var(--chip-bg);
    border: 1px solid var(--border);
    border-radius: 50%;
    cursor: pointer;
    transition: border-color 0.15s, color 0.15s;
}

.notes-toggle[hidden] {
    display: none;
}

.notes-toggle:hover,
.notes-toggle:focus-visible,
.notes-toggle[aria-expanded="true"] {
    border-color: var(--accent);
    color: var(--accent);
}

.notes-toggle svg {
    width: 18px;
    height: 18px;
}

/* Something new since you last looked: a blue dot, not a count. Blue is
   "new" here (red is the DEV header, delete and errors; amber would vanish
   in the icon's hover ring). Ringed in whichever header it sits on. */
.notes-dot {
    position: absolute;
    top: 1px;
    right: 1px;
    width: 9px;
    height: 9px;
    background: var(--info);
    border-radius: 50%;
    box-shadow: 0 0 0 2px var(--header-bg);
}

.notes-dot[hidden] {
    display: none;
}

/* Phones: the same notepad as a row in the menu list. */
.nav-notes-btn {
    display: none;
    align-items: center;
    gap: 10px;
    width: 100%;
    min-height: 44px;
    padding: 10px 18px;
    color: var(--text);
    font: inherit;
    font-weight: 600;
    text-align: left;
    background: transparent;
    border: 0;
    border-top: 1px solid var(--border);
    cursor: pointer;
}

.nav-notes-btn svg {
    width: 20px;
    height: 20px;
    color: var(--text-muted);
}

/* On the menu row the dot follows the word, 8px on (the row's gap is
   10px), with no ring. */
.nav-notes-btn .notes-dot {
    position: static;
    flex: none;
    margin-left: -2px;
    box-shadow: none;
}

.notes-panel {
    position: fixed;
    top: var(--header-actual, var(--header-h));
    right: 0;
    bottom: 0;
    z-index: 95;
    display: flex;
    flex-direction: column;
    width: 380px;
    max-width: 100vw;
    color: var(--text);
    background: var(--surface);
    border-left: 1px solid var(--border);
    box-shadow: -10px 0 28px rgba(var(--shadow-rgb), 0.35);
    animation: notes-slide-in 0.18s ease-out;
}

.notes-panel[hidden] {
    display: none;
}

@keyframes notes-slide-in {
    from { transform: translateX(24px); opacity: 0; }
    to { transform: none; opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
    .notes-panel { animation: none; }
}

.notes-head {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 10px 6px 16px;
}

.notes-title {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 1.35rem;
    font-weight: 400;
    letter-spacing: 0.05em;
    color: var(--accent);
    margin-right: auto;
}

/* Which way the log runs: one tap flips it, and it says what it will do. */
.notes-order {
    flex: none;
    padding: 5px 11px;
    color: var(--text-muted);
    font-size: 0.74rem;
    font-weight: 600;
    white-space: nowrap;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 999px;
    cursor: pointer;
}

.notes-order:hover:not(:disabled),
.notes-order:focus-visible {
    color: var(--accent);
    border-color: var(--accent);
}

.notes-order:disabled {
    cursor: default;
    opacity: 0.6;
}

.notes-close {
    width: 36px;
    height: 36px;
    color: var(--text-muted);
    font-size: 1.4rem;
    line-height: 1;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 8px;
    cursor: pointer;
}

.notes-close:hover,
.notes-close:focus-visible {
    color: var(--accent);
    border-color: var(--border);
}

.notes-filter {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 0 16px 10px;
    border-bottom: 1px solid var(--border);
}

.notes-filter-btn {
    padding: 5px 12px;
    color: var(--text-muted);
    font-size: 0.78rem;
    font-weight: 600;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 999px;
    cursor: pointer;
}

.notes-filter-btn.active {
    color: var(--accent);
    background: var(--accent-dim);
    border-color: var(--accent);
}

.notes-filter-btn:disabled {
    cursor: default;
    opacity: 0.45;
}

.notes-log {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 10px 12px 6px;
}

.notes-earlier {
    display: block;
    margin: 0 auto 10px;
    padding: 5px 14px;
    color: var(--text-muted);
    font-size: 0.78rem;
    font-weight: 600;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 999px;
    cursor: pointer;
}

.notes-earlier:hover:not(:disabled) {
    color: var(--accent);
    border-color: var(--accent);
}

.notes-earlier[hidden] {
    display: none;
}

/* Newest first: the earlier notes are below the oldest one shown. */
.notes-panel.newest-first .notes-earlier {
    margin: 10px auto 0;
}

.notes-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.notes-empty {
    margin: 24px 8px;
    color: var(--text-muted);
    font-size: 0.85rem;
    text-align: center;
}

.note {
    display: flex;
    gap: 9px;
    align-items: flex-start;
}

.note .row-face {
    width: 28px;
    height: 28px;
    margin-top: 2px;
}

.note .row-face-initial {
    font-size: 0.95rem;
}

.note-body {
    flex: 1 1 auto;
    min-width: 0;
    padding: 7px 10px 8px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 4px 10px 10px 10px;
}

.note.mine .note-body {
    background: var(--accent-dim);
    border-color: rgba(var(--accent-rgb), 0.35);
}

.note-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 8px;
    margin-bottom: 2px;
    font-size: 0.74rem;
    color: var(--text-muted);
}

.note-author {
    color: var(--text);
    font-weight: 700;
}

.note-day {
    padding: 0 7px;
    color: var(--accent);
    font-size: 0.7rem;
    font-weight: 700;
    line-height: 18px;
    background: transparent;
    border: 1px solid rgba(var(--accent-rgb), 0.5);
    border-radius: 999px;
    white-space: nowrap;
}

/* Each state has a hue nobody else in the panel uses, and a word: orange
   is flagged (attention), cyan is pinned (kept), the amber accent stays
   yours. The panel's shades of the two, per theme. */
.notes-panel {
    --notes-flag-wash: rgba(var(--warn-rgb), 0.08);
    --notes-pin-line: rgba(34, 211, 238, 0.55);
    --notes-pin-wash: rgba(34, 211, 238, 0.06);
    --notes-pin-ink: var(--cyan);
    --notes-band-bg: rgba(34, 211, 238, 0.04);
    --notes-band-line: rgba(34, 211, 238, 0.3);
}

:root[data-theme="light"] .notes-panel {
    --notes-flag-wash: rgba(var(--warn-rgb), 0.12);
    --notes-pin-line: rgba(14, 116, 144, 0.55);
    --notes-pin-wash: var(--tint-cyan);
    --notes-pin-ink: #0c5f78; /* --cyan is 4.6:1 on its wash; small text wants more */
    --notes-band-bg: #f3fafc;
    --notes-band-line: rgba(14, 116, 144, 0.3);
}

/* Pinned: a thin cyan outline and a faint cyan wash. No thick edge: that
   shape means flagged. Your own note keeps its amber wash inside it. */
.note.pinned .note-body {
    background: var(--notes-pin-wash);
    border: 1px solid var(--notes-pin-line);
}

.note.mine.pinned .note-body {
    background: var(--accent-dim);
}

/* Flagged: a 2px orange border with a 4px edge and a capped orange wash
   (capped so the muted timestamp still reads), a pixel less padding so
   the text sits where its neighbours' does. After pinned, so a note that
   is both wears the flag's colours. Your own keeps its amber wash. */
.note.flagged .note-body {
    padding: 6px 9px 7px;
    background: var(--notes-flag-wash);
    border: 2px solid var(--orange);
    border-left-width: 4px;
}

.note.mine.flagged .note-body {
    background: var(--accent-dim);
}

/* The end of the meta row: the state in a word with its glyph, "Flagged"
   then "Pinned". Solid for flagged, outline for pinned, so the two differ
   without the colour; the hover says who and when. */
.note-badges {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-left: auto;
}

.note-badge {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 0 7px 0 5px;
    font-size: 0.66rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    line-height: 18px;
    text-transform: uppercase;
    white-space: nowrap;
    border: 1px solid transparent;
    border-radius: 999px;
}

.note-badge svg {
    flex: none;
    width: 12px;
    height: 12px;
}

.note-badge .note-icon-fill {
    fill: currentColor;
}

.note-badge-flagged {
    color: var(--text-on-accent);
    background: var(--orange);
    border-color: var(--orange);
}

.note-badge-pinned {
    color: var(--notes-pin-ink);
    background: transparent;
    border-color: currentColor;
}

/* The Pinned band, the composer's shelf: every pinned note at the newest
   end of the log, full width on a faint cyan strip that meets the
   composer on one edge, with a cyan hairline on the timeline's. Newest
   last that is the bottom of the log, newest first the top. */
.notes-pinned {
    margin: 10px -12px -6px;
    padding: 8px 12px 10px;
    background: var(--notes-band-bg);
    border-top: 1px solid var(--notes-band-line);
}

.notes-pinned[hidden] {
    display: none;
}

.notes-panel.newest-first .notes-pinned {
    margin: -10px -12px 10px;
    border-top: 0;
    border-bottom: 1px solid var(--notes-band-line);
}

.notes-pinned-title {
    display: flex;
    align-items: center;
    gap: 4px;
    margin: 0 0 8px 2px;
    color: var(--cyan);
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.notes-pinned-title svg {
    flex: none;
    width: 12px;
    height: 12px;
}

.notes-pinned-title .note-icon-fill {
    fill: currentColor;
}

.notes-pinned-list {
    gap: 10px;
}

/* Under "Pinned" the pins are the whole list: the log takes the band's
   strip and the band's heading is the list's title. */
.notes-panel.pins-view .notes-log {
    background: var(--notes-band-bg);
}

.notes-pins-title[hidden] {
    display: none;
}

/* Under the text: the two thumbs with their counts on the left; on the
   right the pin, the flag and, a little apart, the trash can. */
.note-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    margin: 5px -4px -3px;
}

.note-actions-end {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    margin-left: auto;
}

.note-vote,
.note-pin,
.note-flag,
.note-delete {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 3px;
    min-width: 28px;
    height: 28px;
    padding: 0 5px;
    color: var(--text-muted);
    font: inherit;
    font-size: 0.74rem;
    font-weight: 700;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 6px;
    cursor: pointer;
}

.note-vote:hover,
.note-vote:focus-visible,
.note-pin:hover,
.note-pin:focus-visible,
.note-flag:hover,
.note-flag:focus-visible {
    color: var(--accent);
    border-color: var(--border);
}

.note-vote[aria-pressed="true"] {
    color: var(--accent);
}

/* A pressed pin or flag is in its state's colour, hovered or not. */
.note-pin[aria-pressed="true"],
.note-pin[aria-pressed="true"]:hover,
.note-pin[aria-pressed="true"]:focus-visible {
    color: var(--cyan);
}

.note-flag[aria-pressed="true"],
.note-flag[aria-pressed="true"]:hover,
.note-flag[aria-pressed="true"]:focus-visible {
    color: var(--orange);
}

.note-vote[aria-pressed="true"] {
    background: rgba(var(--accent-rgb), 0.12);
    border-color: rgba(var(--accent-rgb), 0.45);
}

.note-vote[aria-pressed="true"] .note-icon-fill,
.note-pin[aria-pressed="true"] .note-icon-fill,
.note-flag[aria-pressed="true"] .note-icon-fill {
    fill: currentColor;
}

.note-vote-count {
    font-variant-numeric: tabular-nums;
}

.note-vote-count[hidden] {
    display: none;
}

.note-delete {
    margin-left: 6px;
    opacity: 0.7;
}

.note-delete:hover,
.note-delete:focus-visible {
    color: var(--red);
    border-color: var(--border);
    opacity: 1;
}

.note-text {
    margin: 0;
    font-size: 0.86rem;
    line-height: 1.45;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.note-text a {
    color: var(--accent);
    text-decoration: underline;
}

.notes-composer {
    flex: none;
    padding: 8px 12px 12px;
    border-top: 1px solid var(--border);
    background: var(--surface);
}

/* Newest first: the composer sits under the filter row, above the log. */
.notes-panel.newest-first .notes-composer {
    padding: 10px 12px;
    border-top: 0;
    border-bottom: 1px solid var(--border);
}

.notes-tag {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    margin-bottom: 6px;
    padding-left: 9px;
    color: var(--accent);
    font-size: 0.74rem;
    font-weight: 700;
    background: var(--accent-dim);
    border: 1px solid rgba(var(--accent-rgb), 0.5);
    border-radius: 999px;
}

.notes-tag[hidden] {
    display: none;
}

.notes-tag-clear {
    width: 26px;
    height: 24px;
    color: inherit;
    font-size: 1rem;
    line-height: 1;
    background: transparent;
    border: 0;
    border-radius: 999px;
    cursor: pointer;
}

.notes-compose-row {
    display: flex;
    align-items: flex-end;
    gap: 8px;
}

.notes-text {
    flex: 1 1 auto;
    min-width: 0;
    min-height: 38px;
    max-height: calc(4 * 1.4em + 18px);
    padding: 8px 10px;
    color: var(--text);
    font: inherit;
    font-size: 0.88rem;
    line-height: 1.4;
    resize: none;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
}

.notes-text:focus {
    outline: none;
    border-color: var(--accent);
}

.notes-send {
    flex: none;
    min-height: 38px;
    padding: 0 16px;
    color: var(--text-on-accent);
    font-weight: 700;
    background: var(--accent);
    border: 1px solid var(--accent);
    border-radius: 8px;
    cursor: pointer;
}

.notes-send:disabled {
    cursor: default;
    opacity: 0.45;
}

.notes-error {
    margin: 6px 2px 0;
    color: var(--red);
    font-size: 0.78rem;
}

/* Phones and narrow tablets: the panel is the whole screen, header and
   all. Newest last, the composer is at the bottom where the keyboard pushes
   it; newest first, it is near the top, clear of the keyboard already. */
@media (max-width: 820px) {
    .notes-panel {
        top: 0;
        width: 100%;
        height: 100dvh;
        bottom: auto;
        z-index: 2200;
        border-left: 0;
        box-shadow: none;
    }

    .notes-head {
        padding: 8px 8px 6px 16px;
    }

    .notes-close {
        width: 44px;
        height: 44px;
    }

    .notes-order {
        min-height: 36px;
        padding: 6px 12px;
    }

    .notes-filter-btn {
        min-height: 36px;
        padding: 6px 14px;
    }

    .notes-earlier {
        min-height: 36px;
    }

    .note-vote,
    .note-pin,
    .note-flag,
    .note-delete {
        min-width: 44px;
        height: 44px;
    }

    .note-actions {
        margin-bottom: -6px;
    }

    .notes-tag-clear {
        width: 36px;
        height: 32px;
    }

    .notes-text {
        min-height: 44px;
        font-size: 16px; /* under 16px iOS zooms the page on focus */
    }

    .notes-send {
        min-height: 44px;
    }
}

@media (max-width: 640px) {
    /* The header is the brand and the menu button; the notepad is the
       "Notes" row in the menu, the way the signed-in name is. */
    .notes-toggle {
        display: none !important;
    }

    .nav-notes-btn:not([hidden]) {
        display: flex;
    }
}
