.header {
            position: sticky;
            top: 0;
            z-index: 50;
            background: rgba(10, 14, 23, 0.78);
            backdrop-filter: blur(20px) saturate(1.6);
            -webkit-backdrop-filter: blur(20px) saturate(1.6);
            border-bottom: 1px solid rgba(255, 255, 255, 0.06);
            padding: 14px 20px;
            transition: background 0.3s ease, border-color 0.3s ease;
        }

        :root.light .header {
            background: rgba(255, 255, 255, 0.72);
            border-color: rgba(0, 0, 0, 0.08);
        }

        .header-inner {
            display: flex;
            align-items: center;
            gap: 14px;
            max-width: 1200px;
            margin: 0 auto;
        }

        .logo {
            font-family: var(--syne);
            font-size: 13px;
            font-weight: 600;
            letter-spacing: 0.22em;
            color: rgba(255, 255, 255, 0.85);
            text-transform: uppercase;
            flex-shrink: 0;
        }

        :root.light .logo {
            color: rgba(0, 0, 0, 0.85);
        }

        .header-date-block {
            display: flex;
            flex-direction: column;
            gap: 2px;
        }

        .date-nav {
            display: flex;
            align-items: center;
            gap: 6px;
        }

        .date-nav-arrow {
            background: transparent;
            color: rgba(255, 255, 255, 0.55);
            border: 1px solid rgba(255, 255, 255, 0.12);
            border-radius: 8px;
            width: 26px;
            height: 26px;
            font-size: 16px;
            line-height: 1;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            transition: all 0.15s ease;
        }

        .date-nav-arrow:hover {
            color: rgba(255, 255, 255, 0.95);
            border-color: rgba(255, 255, 255, 0.3);
            background: rgba(255, 255, 255, 0.05);
        }

        :root.light .date-nav-arrow {
            color: rgba(0, 0, 0, 0.55);
            border-color: rgba(0, 0, 0, 0.12);
        }

        :root.light .date-nav-arrow:hover {
            color: rgba(0, 0, 0, 0.9);
            border-color: rgba(0, 0, 0, 0.3);
            background: rgba(0, 0, 0, 0.05);
        }

        .date-nav-center {
            display: flex;
            align-items: center;
            gap: 4px;
            position: relative;
        }

        .date-picker-trigger {
            appearance: none;
            border: 0;
            background: transparent;
            padding: 0;
            margin: 0;
            color: inherit;
            cursor: pointer;
            text-align: left;
            font: inherit;
        }

        .date-picker-trigger:hover .date-line,
        .date-picker-trigger:hover .date-label {
            text-decoration: underline;
            text-decoration-thickness: 1px;
            text-underline-offset: 4px;
        }

        .date-line {
            font-family: var(--syne);
            font-size: 15px;
            font-weight: 600;
            color: rgba(255, 255, 255, 0.92);
            line-height: 1.3;
            letter-spacing: -0.01em;
        }

        :root.light .date-line {
            color: rgba(0, 0, 0, 0.88);
        }

        .date-prepared-dot {
            color: #4ade80;
            font-size: 18px;
            line-height: 1;
        }

        body.viewing-past .date-line { color: rgba(255, 255, 255, 0.7); }
        body.viewing-future .date-line { color: rgba(167, 200, 255, 0.95); }
        :root.light body.viewing-past .date-line { color: rgba(0, 0, 0, 0.65); }
        :root.light body.viewing-future .date-line { color: rgba(20, 70, 160, 0.85); }

        .date-nav-today {
            background: transparent;
            color: rgba(255, 255, 255, 0.7);
            border: 1px solid rgba(255, 255, 255, 0.18);
            border-radius: 999px;
            padding: 3px 10px;
            font-size: 11px;
            font-weight: 600;
            cursor: pointer;
            margin-left: 4px;
            letter-spacing: 0.02em;
            transition: all 0.15s ease;
        }

        .date-nav-today:hover {
            color: #fff;
            border-color: rgba(255, 255, 255, 0.4);
            background: rgba(255, 255, 255, 0.06);
        }

        .date-nav-today.is-current {
            opacity: 0.4;
            cursor: default;
        }

        .date-nav-today.is-current:hover {
            color: rgba(255, 255, 255, 0.7);
            border-color: rgba(255, 255, 255, 0.18);
            background: transparent;
        }

        :root.light .date-nav-today {
            color: rgba(0, 0, 0, 0.7);
            border-color: rgba(0, 0, 0, 0.18);
        }

        :root.light .date-nav-today:hover {
            color: #000;
            border-color: rgba(0, 0, 0, 0.4);
            background: rgba(0, 0, 0, 0.04);
        }

        .updated-line {
            font-family: var(--mono);
            font-size: 10px;
            color: rgba(255, 255, 255, 0.3);
        }

        :root.light .updated-line {
            color: rgba(0, 0, 0, 0.35);
        }

        .date-popover {
            position: absolute;
            top: calc(100% + 10px);
            left: 50%;
            transform: translateX(-50%);
            width: min(320px, calc(100vw - 24px));
            background: var(--surface);
            border: 1px solid var(--border);
            border-radius: 10px;
            box-shadow: 0 18px 48px rgba(0, 0, 0, 0.38);
            padding: 12px;
            z-index: 260;
        }

        .date-popover-head {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 10px;
            margin-bottom: 10px;
        }

        .date-popover-title {
            font-family: var(--syne);
            font-size: 14px;
            font-weight: 600;
            color: var(--text);
        }

        .date-popover-nav {
            width: 30px;
            height: 30px;
            border-radius: 8px;
            border: 1px solid var(--border);
            background: var(--surface2);
            color: var(--text);
            cursor: pointer;
            line-height: 1;
        }

        .date-popover-weekdays,
        .date-popover-grid {
            display: grid;
            grid-template-columns: repeat(7, 1fr);
            gap: 4px;
        }

        .date-popover-weekdays {
            margin-bottom: 4px;
            color: var(--muted);
            font-size: 10px;
            text-align: center;
            text-transform: uppercase;
        }

        .date-popover-day {
            position: relative;
            height: 34px;
            border: 1px solid transparent;
            border-radius: 8px;
            background: transparent;
            color: var(--text);
            cursor: pointer;
            font-family: var(--mono);
            font-size: 12px;
        }

        .date-popover-day.out-month {
            opacity: 0.28;
        }

        .date-popover-day.no-data {
            color: var(--muted);
            opacity: 0.55;
        }

        .date-popover-day.has-data::after {
            content: "";
            position: absolute;
            width: 4px;
            height: 4px;
            border-radius: 50%;
            left: 50%;
            bottom: 5px;
            transform: translateX(-50%);
            background: #4ade80;
        }

        .date-popover-day.today {
            border-color: rgba(61, 142, 240, 0.42);
        }

        .date-popover-day.selected {
            background: rgba(61, 142, 240, 0.18);
            color: var(--text);
            border-color: rgba(61, 142, 240, 0.58);
        }

        .date-popover-day:hover {
            background: var(--surface2);
            opacity: 1;
        }

        /* Hide today-only affordances when viewing other days */
        body.viewing-past #apUndoBtn,
        body.viewing-future #apUndoBtn { display: none; }

        /* Desktop stats inline */
        .header-stats {
            display: none;
            margin-left: auto;
            border: 1px solid rgba(255, 255, 255, 0.1);
            border-radius: 10px;
            overflow: hidden;
            background: rgba(255, 255, 255, 0.04);
            transition: all 0.3s ease;
        }

        :root.light .header-stats {
            border-color: rgba(0, 0, 0, 0.1);
            background: rgba(0, 0, 0, 0.04);
        }

        .header-stat {
            padding: 8px 22px;
            text-align: center;
            border-right: 1px solid rgba(255, 255, 255, 0.06);
        }

        :root.light .header-stat {
            border-right-color: rgba(0, 0, 0, 0.06);
        }

        .header-stat:last-child {
            border-right: none;
        }

        .header-stat-val {
            font-family: var(--syne);
            font-size: 17px;
            font-weight: 600;
            color: rgba(255, 255, 255, 0.92);
            line-height: 1.2;
            letter-spacing: -0.02em;
        }

        :root.light .header-stat-val {
            color: rgba(0, 0, 0, 0.88);
        }

        .header-stat-label {
            font-size: 9px;
            letter-spacing: 0.08em;
            text-transform: uppercase;
            color: rgba(255, 255, 255, 0.35);
            font-weight: 500;
        }

        :root.light .header-stat-label {
            color: rgba(0, 0, 0, 0.4);
        }

        .header-actions {
            display: flex;
            gap: 8px;
            align-items: center;
            flex-shrink: 0;
        }

        .guest-filter-toggle {
            display: none;
            align-items: center;
            gap: 7px;
            height: 32px;
            padding: 0 10px 0 8px;
            border: 1px solid rgba(255, 255, 255, 0.12);
            border-radius: 999px;
            background: rgba(255, 255, 255, 0.04);
            color: rgba(255, 255, 255, 0.76);
            cursor: pointer;
            user-select: none;
            font-size: 12px;
            font-weight: 600;
            line-height: 1;
            white-space: nowrap;
            transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
        }

        body.desktop .guest-filter-toggle {
            display: flex;
        }

        .guest-filter-toggle:hover {
            color: rgba(255, 255, 255, 0.94);
            border-color: rgba(255, 255, 255, 0.24);
            background: rgba(255, 255, 255, 0.08);
        }

        .guest-filter-toggle input {
            position: absolute;
            opacity: 0;
            pointer-events: none;
        }

        .guest-filter-track {
            width: 28px;
            height: 16px;
            border-radius: 999px;
            background: rgba(255, 255, 255, 0.18);
            position: relative;
            transition: background 0.15s ease;
            flex: 0 0 auto;
        }

        .guest-filter-track::after {
            content: "";
            position: absolute;
            top: 3px;
            left: 3px;
            width: 10px;
            height: 10px;
            border-radius: 50%;
            background: rgba(255, 255, 255, 0.88);
            transition: transform 0.15s ease, background 0.15s ease;
        }

        .guest-filter-toggle input:checked + .guest-filter-track {
            background: rgba(63, 207, 142, 0.72);
        }

        .guest-filter-toggle input:checked + .guest-filter-track::after {
            transform: translateX(12px);
            background: #ffffff;
        }

        .guest-filter-toggle:has(input:checked) {
            color: var(--success);
            border-color: rgba(63, 207, 142, 0.34);
            background: rgba(63, 207, 142, 0.1);
        }

        :root.light .guest-filter-toggle {
            color: rgba(0, 0, 0, 0.68);
            border-color: rgba(0, 0, 0, 0.12);
            background: rgba(0, 0, 0, 0.035);
        }

        :root.light .guest-filter-toggle:hover {
            color: rgba(0, 0, 0, 0.9);
            border-color: rgba(0, 0, 0, 0.22);
            background: rgba(0, 0, 0, 0.06);
        }

        :root.light .guest-filter-track {
            background: rgba(0, 0, 0, 0.18);
        }

        :root.light .guest-filter-track::after {
            background: #ffffff;
        }

        .theme-toggle {
            background: rgba(255, 255, 255, 0.06);
            border: 1px solid rgba(255, 255, 255, 0.1);
            border-radius: 8px;
            color: rgba(255, 255, 255, 0.5);
            font-size: 14px;
            width: 34px;
            height: 34px;
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            transition: all 0.25s ease;
        }

        .theme-toggle:hover {
            background: rgba(255, 255, 255, 0.1);
        }

        :root.light .theme-toggle {
            background: rgba(0, 0, 0, 0.05);
            border-color: rgba(0, 0, 0, 0.1);
            color: rgba(0, 0, 0, 0.5);
        }

        :root.light .theme-toggle:hover {
            background: rgba(0, 0, 0, 0.08);
        }

        .admin-btn {
            background: rgba(255, 255, 255, 0.06);
            border: 1px solid rgba(255, 255, 255, 0.1);
            border-radius: 8px;
            color: rgba(255, 255, 255, 0.5);
            font-family: var(--sans);
            font-size: 12px;
            font-weight: 500;
            padding: 6px 14px;
            height: 34px;
            cursor: pointer;
            transition: all 0.25s ease;
            white-space: nowrap;
            letter-spacing: 0.01em;
        }

        .admin-btn.active {
            border-color: rgba(77, 150, 247, 0.4);
            color: var(--accent);
            background: rgba(77, 150, 247, 0.1);
        }

        :root.light .admin-btn {
            background: rgba(0, 0, 0, 0.05);
            border-color: rgba(0, 0, 0, 0.1);
            color: rgba(0, 0, 0, 0.55);
        }

        /* Gear icon that replaces Admin btn once unlocked */
        .admin-gear-btn {
            background: rgba(61, 142, 240, 0.15);
            border: 1px solid rgba(61, 142, 240, 0.35);
            border-radius: 6px;
            color: var(--accent);
            font-size: 15px;
            width: 30px;
            height: 30px;
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            transition: all 0.15s;
        }

        .admin-gear-btn:hover {
            background: rgba(61, 142, 240, 0.25);
        }

        /* ════════════════════════════════
     MOBILE STATS BAR
  ════════════════════════════════ */
        .stats-bar {
            display: grid;
            grid-template-columns: 1fr 1fr 1fr;
            border-bottom: 1px solid var(--gold-dim);
            background: var(--surface);
            backdrop-filter: blur(12px);
            -webkit-backdrop-filter: blur(12px);
        }

        :root.light .stats-bar {
            border-color: rgba(200, 170, 112, 0.25);
        }

        .stat {
            padding: calc(var(--u)*3.5) 0;
            text-align: center;
            border-right: 1px solid var(--glass-border);
        }

        .stat:last-child {
            border-right: none;
        }

        .stat-val {
            font-family: var(--serif);
            font-size: calc(var(--u)*6.5);
            font-weight: 600;
            color: var(--text);
            line-height: 1;
        }

        .stat-label {
            font-size: calc(var(--u)*2.5);
            letter-spacing: 0.12em;
            text-transform: uppercase;
            color: var(--muted);
            margin-top: calc(var(--u)*0.8);
        }

        /* ════════════════════════════════
     ADMIN PANEL + OVERLAY
  ════════════════════════════════ */
        .ap-overlay {
            display: none;
            position: fixed;
            inset: 0;
            background: rgba(0, 0, 0, 0.55);
            z-index: 198;
            backdrop-filter: blur(2px);
        }

        .ap-overlay.visible {
            display: block;
        }
