/* Admin surfaces and semantic states, independent of the light palette. */
:root[data-theme="dark"] {
  --admin-canvas: #0b1926;
  --admin-panel: #142b3d;
  --admin-raised: #1b3449;
  --admin-control: #0e2233;
  --admin-border: #3d566b;
  --admin-text: #edf3f8;
  --admin-muted: #b5c5d2;
  --admin-accent: #b9df20;
  --admin-danger: #ffb7b4;
}

:root[data-theme="dark"] :is(.admin-page, .admin-tournament-page, .admin-modal, #adminMatchResultDialog, #adminDeleteTournamentDialog) {
  --surface: var(--admin-panel);
  --ink: var(--admin-text);
  --muted: var(--admin-muted);
  --line: var(--admin-border);
  --theme-border: var(--admin-border);
  --danger: var(--admin-danger);
  color: var(--admin-text);
}

:root[data-theme="dark"] :is(.admin-page, .admin-tournament-page) { background: var(--admin-canvas); }
:root[data-theme="dark"] :is(.admin-panel, .admin-access-card, .admin-tournament-manager, .admin-group-card, .admin-tournament-match, .admin-tournament-row, .admin-tournament-subpanel, .admin-ranking-starting-form) {
  background: var(--admin-panel);
  border-color: var(--admin-border);
  box-shadow: none;
}
:root[data-theme="dark"] :is(.admin-section, .admin-week, .admin-event-form, .admin-user-row, .admin-draw-card, .admin-ranking-audit, .admin-tournament-group-config, .admin-group-assignment, .admin-group-confirmation) {
  background: var(--admin-raised);
  border-color: var(--admin-border);
}
:root[data-theme="dark"] :is(.admin-event-form-section, .admin-event-row, .admin-booking-row, .availability-rule-row, .dashboard-booking-row, .admin-week-reservation, .admin-tournament-participant-row, .tournament-participant-summary, .admin-tournament-user-result) {
  background: var(--admin-panel);
  border-color: var(--admin-border);
}
:root[data-theme="dark"] .admin-section-nav { background: var(--admin-control); border-color: var(--admin-border); }
:root[data-theme="dark"] :is(.admin-section-tab, .admin-section-nav a) {
  background: var(--admin-raised);
  color: var(--admin-text);
  border-color: transparent;
}
:root[data-theme="dark"] :is(.admin-section-tab, .admin-section-nav a):hover {
  background: #243f54;
  border-color: #698296;
}
:root[data-theme="dark"] .admin-section-tab.is-active {
  background: #263f39;
  color: #f0f7ee;
  border-color: #90b63a;
}
:root[data-theme="dark"] .admin-section-tab small { color: var(--admin-muted); }
:root[data-theme="dark"] .admin-section-tab.is-active small { color: #ccdfbf; }

:root[data-theme="dark"] :is(.admin-page, .admin-tournament-page, .admin-modal, #adminMatchResultDialog) :is(input:not([type="checkbox"]):not([type="radio"]), select, textarea) {
  background: var(--admin-control);
  color: var(--admin-text);
  border-color: var(--admin-border);
}
:root[data-theme="dark"] :is(.admin-page, .admin-tournament-page, .admin-modal, #adminMatchResultDialog) :is(input, select, textarea):focus-visible {
  outline: 2px solid var(--admin-accent);
  outline-offset: 2px;
}
:root[data-theme="dark"] :is(.admin-page, .admin-tournament-page, .admin-modal, #adminMatchResultDialog) :is(input, textarea)::placeholder { color: #a6bac9; opacity: 1; }
:root[data-theme="dark"] :is(.admin-page, .admin-tournament-page, .admin-modal, #adminMatchResultDialog) :is(input[type="checkbox"], input[type="radio"]) { accent-color: var(--admin-accent); }

:root[data-theme="dark"] :is(.admin-page, .admin-tournament-page, .admin-modal, #adminMatchResultDialog) .primary-button {
  background: var(--admin-accent);
  color: #071a2d;
}
:root[data-theme="dark"] :is(.admin-page, .admin-tournament-page, .admin-modal, #adminMatchResultDialog, #adminDeleteTournamentDialog) .secondary-button {
  background: #213d52;
  color: var(--admin-text);
  border-color: #59758a;
}
:root[data-theme="dark"] :is(.admin-page, .admin-tournament-page, .admin-modal, #adminMatchResultDialog, #adminDeleteTournamentDialog) .secondary-button:hover:not(:disabled) { background: #2a4960; }
:root[data-theme="dark"] :is(.admin-page, .admin-tournament-page, .admin-modal, #adminMatchResultDialog) :is(.primary-button, .secondary-button):disabled { opacity: .55; }
:root[data-theme="dark"] :is(.admin-page, .admin-tournament-page, .admin-modal, #adminMatchResultDialog, #adminDeleteTournamentDialog) :is(.text-danger-button, .auth-message.error, .admin-user-feedback.error) { color: var(--admin-danger); }
:root[data-theme="dark"] :is(.admin-page, .admin-tournament-page) :is(.auth-message.success, .text-action-button, #adminTournamentNotice) { color: #c4e897; }
:root[data-theme="dark"] :is(.admin-modal, #adminMatchResultDialog) :is(.modal-card, .modal-actions) { background: var(--admin-panel); }
:root[data-theme="dark"] #adminDeleteTournamentDialog { background: var(--admin-panel); border-color: var(--admin-border); }
:root[data-theme="dark"] #confirmDeleteTournamentButton { background: #9d3b47; color: #fff; }

:root[data-theme="dark"] :is(.admin-tournament-page .admin-tournament-row.is-selected, .admin-week-day.is-selected, .admin-week-mobile-courts button.is-selected) {
  background: #263f39;
  color: var(--admin-text);
  border-color: #90b63a;
  box-shadow: inset 0 0 0 1px #90b63a;
}
:root[data-theme="dark"] .admin-tournament-page .admin-tournament-row:hover { background: var(--admin-raised); }
:root[data-theme="dark"] :is(.admin-week-corner, .admin-week-date, .admin-week-court-name) { background: var(--admin-control); color: var(--admin-text); }
:root[data-theme="dark"] :is(.admin-week-controls button, .admin-week-day, .admin-week-mobile-courts button, .admin-week-end-options button) { background: var(--admin-panel); color: var(--admin-text); border-color: var(--admin-border); }
:root[data-theme="dark"] .admin-week-slot.is-free { background: #17382c; color: #c9efd4; border-color: #4c785b; }
:root[data-theme="dark"] .admin-week-slot:is(.is-booked, .is-reserved, .is-closed):not(.category-friendly):not(.category-lesson):not(.category-tournament) { background: #452834; color: #ffd1d6; border-color: #a36772; }
:root[data-theme="dark"] .admin-week-slot:is(.is-elapsed, .is-unscheduled) { background: #172735; color: #a3b4c2; border-color: #344959; }
:root[data-theme="dark"] .admin-week-slot.is-free:is(.is-selected, .is-in-range) { background: #30513a; color: #f0ffe4; border-color: var(--admin-accent); box-shadow: inset 0 0 0 1px var(--admin-accent); }
:root[data-theme="dark"] .admin-week-slot.is-selected { outline: 2px solid var(--admin-accent); outline-offset: 1px; }
:root[data-theme="dark"] .admin-week-end-options button.is-selected { background: #30513a; color: #f0ffe4; border-color: var(--admin-accent); }
:root[data-theme="dark"] .admin-page .category-friendly { --booking-background: #49331f; --booking-color: #ffd7a7; --booking-border: #a57a49; }
:root[data-theme="dark"] .admin-page .category-lesson { --booking-background: #153c56; --booking-color: #bde5ff; --booking-border: #5685a4; }
:root[data-theme="dark"] .admin-page .category-tournament { --booking-background: #452834; --booking-color: #ffd1d6; --booking-border: #a36772; }

:root[data-theme="dark"] :is(.admin-role-pill, .admin-rule-pill:not(.category-friendly):not(.category-lesson):not(.category-tournament), .admin-event-status) { background: #263b4b; color: #d6e2eb; }
:root[data-theme="dark"] :is(.admin-role-pill.is-admin, .admin-event-category) { background: #213d57; color: #c6e4fa; }
:root[data-theme="dark"] .admin-event-status.is-published { background: #263f39; color: #cce8b8; }
:root[data-theme="dark"] :is(.admin-user-avatar, .admin-event-row-date) { background: #263f39; color: #cce8b8; }
:root[data-theme="dark"] :is(.admin-exclusion-summary, .admin-tournament-format-note, .admin-event-publish) { background: #263f39; color: var(--admin-text); border-color: #668b54; }
:root[data-theme="dark"] .admin-tournament-group-preview { color: var(--admin-muted); }
:root[data-theme="dark"] .admin-tournament-page .admin-tournament-manager-header :is(p, .eyebrow) { color: var(--admin-muted); }
:root[data-theme="dark"] .admin-match-navigation { background: var(--admin-panel); }
/* These sections deliberately have no surrounding surface. */
:root[data-theme="dark"] .admin-groups-card,
:root[data-theme="dark"] .admin-group-editor .admin-group-assignment { background: transparent; border: 0; }
