.theme-toggle { display: inline-flex; align-items: center; gap: .45rem; color: var(--muted); border: 1px solid var(--line, #dcd3cc); background: transparent; border-radius: .45rem; padding: .4rem .65rem; cursor: pointer; }
.theme-toggle[hidden] { display: none; }
.theme-toggle[aria-pressed="true"] { color: var(--accent, #ff9d66); }
.admin-sidebar > .theme-toggle { align-self: flex-start; margin: .9rem .6rem; }
.login-theme { display: flex; justify-content: flex-end; }
.login-theme .theme-toggle { font: inherit; font-size: .88rem; }

:root[data-theme="dark"] {
    color-scheme: dark;
    --dark-page: #131719;
    --dark-surface: #1b2023;
    --dark-raised: #252c30;
    --dark-border: #414b50;
    --dark-ink: #f3f1ee;
    --dark-muted: #bdc4c8;
    --dark-orange: #ffaf80;
    --dark-action: #f98040;
    --dark-action-text: #1e130e;
    --dark-orange-surface: #442b20;
    --dark-green: #b1dfb0;
    --dark-green-surface: #273c2b;
    --ink: var(--dark-ink);
    --muted: var(--dark-muted);
    --line: var(--dark-border);
    --accent: var(--dark-orange);
    --orange: var(--dark-orange);
    background: var(--dark-page);
    color: var(--dark-ink);
}

[data-theme="dark"] .panel-interface {
    --ink: var(--dark-ink);
    --muted: var(--dark-muted);
    --line: var(--dark-border);
    --accent: var(--dark-orange);
    background: var(--dark-page);
}
[data-theme="dark"] :is(.admin-sidebar, .admin-surface, .admin-next, .card, .metric, .list, .empty, .admin-row-menu div, .jump-link, .floor-editor-controls) {
    background: var(--dark-surface);
    border-color: var(--dark-border);
    color: var(--dark-ink);
}
[data-theme="dark"] :is(.admin-table thead, .setup-address > span, .admin-table-footer nav [aria-disabled]) { background: var(--dark-raised); color: var(--dark-muted); }
[data-theme="dark"] :is(.admin-table th, .admin-table td, .admin-empty, .admin-table-footer, .admin-table-footer nav > *, .setup-address > span, .floor-editor-controls form + form) { border-color: var(--dark-border); }
[data-theme="dark"] :is(.admin-sidebar [aria-current], .admin-initials, .admin-row-menu a:hover, .admin-table-footer nav [aria-current]) { background: var(--dark-orange-surface); color: var(--dark-orange); }
[data-theme="dark"] :is(.panel-interface input:not([type="checkbox"]), .panel-interface select, .panel-interface textarea, .login-field input) {
    background: var(--dark-page);
    border-color: #5b666b;
    color: var(--dark-ink);
}
[data-theme="dark"] :is(input, textarea)::placeholder { color: var(--dark-muted); }
[data-theme="dark"] :is(.panel-interface .button.secondary, .floor-editor button, .reservation-map-tabs button) { background: var(--dark-raised); border-color: #5b666b; color: var(--dark-ink); }
[data-theme="dark"] :is(.panel-interface .button.primary, .login-submit, .floor-editor button[aria-pressed="true"], .floor-editor .floor-editor-primary, .reservation-map-tabs button[aria-selected="true"], .reservation-map-table[aria-pressed="true"]) {
    color: var(--dark-action-text);
    background: var(--dark-action);
    border-color: var(--dark-action);
}
[data-theme="dark"] .login-submit:hover { background: #f18b53; }
[data-theme="dark"] .badge { background: #493924; color: #f8dba3; }
[data-theme="dark"] .badge.live, [data-theme="dark"] .admin-table .badge.live { background: var(--dark-green-surface); color: var(--dark-green); }
[data-theme="dark"] .notice { border-color: #638766; background: var(--dark-green-surface); color: var(--dark-green); }
[data-theme="dark"] :is(.notice.error, .login-errors) { background: #4a2722; border-color: #a96f59; color: #ffd6c4; }
[data-theme="dark"] :is(.booking-panel article, .reservation-map-scroll, .floor-editor-canvas) { border-color: var(--dark-border); }
[data-theme="dark"] :is(.reservation-map-grid, .floor-editor-grid) {
    --grid-line: #343e43;
    background-color: #181e21;
    background-image: linear-gradient(to right, var(--grid-line) 1px, transparent 1px), linear-gradient(to bottom, var(--grid-line) 1px, transparent 1px);
}
[data-theme="dark"] .floor-editor-canvas { background: #181e21; }
[data-theme="dark"] :is(.reservation-map-table:not([aria-pressed="true"]), .floor-editor .floor-editor-piece[data-type="table"]:not([aria-pressed="true"])) { border-color: #759377; background: var(--dark-green-surface); color: var(--dark-green); }
[data-theme="dark"] .reservation-map-table:disabled { border-color: #877970; background: #36302c; color: #d0c2b8; }
[data-theme="dark"] .reservation-map-feature { background: #453a32; color: var(--dark-ink); }
[data-theme="dark"] :focus-visible { outline-color: var(--dark-orange); }

.theme-brand { display: block; position: relative; }
.theme-brand img { display: block; width: 100%; height: auto; }
.theme-brand img.theme-brand-light-wordmark { display: none; }
/* Recolor only the “Mesa” lettering in the supplied transparent artwork. */
[data-theme="dark"] .theme-brand img.theme-brand-light-wordmark {
    position: absolute;
    inset: 0;
    display: block;
    filter: brightness(0) invert(.96);
    clip-path: polygon(26% 0, 68% 0, 64.3% 68%, 60% 100%, 26% 100%);
}

.login-theme { position: absolute; top: clamp(.85rem, 2.5vw, 1.45rem); right: clamp(.85rem, 2.5vw, 1.45rem); }
.login-theme .theme-toggle { justify-content: center; width: 2.8rem; min-height: 2.8rem; border-radius: 50%; font-size: 0; }
[data-theme="dark"] .login-theme .theme-toggle { color: var(--dark-muted); border-color: #647075; }
[data-theme="dark"] .login-shell { width: min(calc(100% - 2rem), 45.5rem); padding-top: clamp(4.3rem, 12vh, 8.5rem); }
[data-theme="dark"] .login-card { background: var(--dark-surface); border: 1px solid var(--dark-border); border-radius: 1.2rem; padding: clamp(1.25rem, 4.3vw, 3.4rem); }
[data-theme="dark"] .login-logo { width: min(78%, 25rem); margin: -.75rem auto clamp(1.25rem, 4vh, 3rem); }
[data-theme="dark"] .login-heading { margin-bottom: clamp(1.5rem, 4vh, 2.4rem); }
[data-theme="dark"] .login-card .login-field input { background: var(--dark-raised); min-height: clamp(3rem, 6vh, 4.2rem); border-radius: .72rem; }
[data-theme="dark"] .login-submit { margin-top: .3rem; min-height: clamp(3.3rem, 6.5vh, 4.45rem); border-radius: .72rem; }
[data-theme="dark"] .login-footer { margin-top: 1.8rem; }
