/* Shared opt-in theme; screen-only colours keep printed results and QR signs light. */
.site-theme-toggle,
.site-header .site-theme-toggle,
.member-shell .site-theme-toggle {
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 44px;
  min-height: 44px;
  padding: 10px 12px;
  margin: 0;
  border: 1px solid #cedae7;
  border-radius: 11px;
  background: #ffffff;
  color: #294b6d;
  font: 650 12px/1.25 "Inter", "Segoe UI", system-ui, sans-serif;
  cursor: pointer;
  white-space: nowrap;
  flex: none;
  -webkit-tap-highlight-color: transparent;
}
.site-theme-toggle:hover,
.site-header .site-theme-toggle:hover { background: #edf3fa; border-color: #8aa6c2; }
.site-theme-toggle:focus-visible,
.site-header .site-theme-toggle:focus-visible { outline: 3px solid #bf881e; outline-offset: 3px; }
.site-theme-toggle svg,
.site-header .site-theme-toggle svg {
  display: block;
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.site-theme-toggle .site-theme-sun,
.site-header .site-theme-toggle .site-theme-sun { display: none; }
.site-theme-toggle--standalone { display: flex; width: fit-content; margin: 0 0 16px auto; }
@media (max-width: 960px) {
  .site-header .site-theme-toggle { width: 40px; min-width: 40px; height: 44px; padding: 0; gap: 0; }
  .site-header .site-theme-toggle span { display: none; }
}
@media (max-width: 385px) {
  .site-header-right { gap: 6px; }
  .site-header .site-theme-toggle { width: 36px; min-width: 36px; }
}

@media screen {
  html[data-theme="dark"] {
    color-scheme: dark;
    --theme-bg: #0c1521;
    --theme-surface: #152232;
    --theme-raised: #1c2d40;
    --theme-hover: #243b53;
    --theme-line: #365069;
    --theme-text: #e8eff8;
    --theme-muted: #adbed1;
    --theme-link: #9fcdff;
    --theme-green: #97e1bb;
    --theme-green-bg: #153d32;
    --theme-gold: #f5d184;
    --theme-gold-bg: #45371e;
    --theme-red: #ffb5af;
    --theme-red-bg: #492b30;
    --bg: var(--theme-bg);
    --background: var(--theme-bg);
    --card: var(--theme-surface);
    --surface: var(--theme-surface);
    --soft: var(--theme-raised);
    --blue-soft: var(--theme-raised);
    --text: var(--theme-text);
    --ink: var(--theme-text);
    --muted: var(--theme-muted);
    --border: var(--theme-line);
    --line: var(--theme-line);
    --danger: var(--theme-red);
    --danger-soft: var(--theme-red-bg);
    --success: var(--theme-green);
    --success-soft: var(--theme-green-bg);
    --shadow: 0 12px 32px #00000030;
    --acct-muted: var(--theme-muted);
    --acct-line: var(--theme-line);
    --acct-bg: var(--theme-bg);
    --acct-soft: var(--theme-raised);
    --sc-bg: var(--theme-bg);
    --sc-card: var(--theme-surface);
    --sc-text: var(--theme-text);
    --sc-muted: var(--theme-muted);
    --sc-border: var(--theme-line);
    --sc-success: var(--theme-green);
    --sc-success-bg: var(--theme-green-bg);
    background: var(--theme-bg) !important;
    color: var(--theme-text) !important;
  }
  html[data-theme="dark"] body {
    background: var(--theme-bg) !important;
    color: var(--theme-text) !important;
  }
  html[data-theme="dark"] :is(h1,h2,h3,h4,h5,h6,label,legend,dt) {
    color: var(--theme-text) !important;
  }
  html[data-theme="dark"] a { color: var(--theme-link); }
  html[data-theme="dark"] :is(input:not([type="checkbox"]):not([type="radio"]):not([type="range"]),select,textarea) {
    background: var(--theme-bg) !important;
    color: var(--theme-text) !important;
    border-color: var(--theme-line) !important;
    caret-color: var(--theme-link);
  }
  html[data-theme="dark"] :is(input,textarea)::placeholder { color: var(--theme-muted) !important; opacity: 1; }
  html[data-theme="dark"] :is(input[type="checkbox"],input[type="radio"],input[type="range"]) { accent-color: #78b8fa; }
  html[data-theme="dark"] :is(input[readonly],input:disabled,select:disabled,textarea:disabled) {
    background: var(--theme-raised) !important;
    color: var(--theme-muted) !important;
  }
  html[data-theme="dark"] :is(a,button,input,select,textarea,summary):focus-visible {
    outline-color: var(--theme-gold) !important;
  }
  html[data-theme="dark"] :is(hr,th,td) { border-color: var(--theme-line) !important; }
  html[data-theme="dark"] table { background: var(--theme-surface); border-color: var(--theme-line); color: var(--theme-text); }
  html[data-theme="dark"] thead,
  html[data-theme="dark"] thead th { background: #1e3b58; color: #f4f8ff; }
  html[data-theme="dark"] tbody :is(tr,td) { background-color: transparent; }
  html[data-theme="dark"] tbody tr:nth-child(even) { background: var(--theme-raised) !important; }
  html[data-theme="dark"] tbody tr:hover { background: var(--theme-hover) !important; }
  html[data-theme="dark"] td.team,
  html[data-theme="dark"] :is(.player-link,.text-link,.sc-ranking-table td a,.sc-schedule-table td a) { color: var(--theme-link) !important; }
  html[data-theme="dark"] :is(.rank-1,.sc-place-1 td) { background: var(--theme-gold-bg) !important; color: var(--theme-gold); }
  html[data-theme="dark"] :is(.rank-2,.sc-place-2 td) { background: #334152 !important; color: #e0e9f3; }
  html[data-theme="dark"] :is(.rank-3,.sc-place-3 td) { background: #463329 !important; color: #f7cfac; }

  /* Site header, account dialog and shared navigation. */
  html[data-theme="dark"] :is(.site-header,.site-footer-wrap,.site-sponsors,.site-footer) {
    color: var(--theme-muted);
    border-color: var(--theme-line);
  }
  html[data-theme="dark"] .site-brand-name { color: var(--theme-text); }
  html[data-theme="dark"] :is(.site-brand-caption,.site-footer a,.site-page-tools a,.site-page-tools button,.site-menu-link) { color: var(--theme-muted); }
  html[data-theme="dark"] :is(.site-staff-menu>summary,.site-staff-links,.site-account-dialog,.menu-dialog,.admin-account-delete-dialog) {
    background: var(--theme-surface) !important;
    color: var(--theme-text) !important;
    border-color: var(--theme-line) !important;
    box-shadow: 0 18px 48px #00000045;
  }
  html[data-theme="dark"] :is(.site-staff-links a,.site-staff-links small) { color: var(--theme-muted); }
  html[data-theme="dark"] :is(.site-staff-links a:hover,.site-staff-menu>summary:hover,.site-page-tools a:hover,.site-page-tools button:hover) {
    background: var(--theme-hover);
    color: var(--theme-text);
  }
  html[data-theme="dark"] .site-header .site-theme-toggle {
    background: var(--theme-raised);
    color: var(--theme-text);
    border-color: var(--theme-line);
  }
  html[data-theme="dark"] .site-theme-toggle--standalone { background: var(--theme-raised); color: var(--theme-text); border-color: var(--theme-line); }
  html[data-theme="dark"] .site-theme-toggle:hover { background: var(--theme-hover); }
  html[data-theme="dark"] .site-theme-toggle .site-theme-moon { display: none; }
  html[data-theme="dark"] .site-theme-toggle .site-theme-sun { display: block; }
  html[data-theme="dark"] :is(.site-sponsors .sponsors-heading h2,.site-sponsors .sponsors-toggle) { color: var(--theme-muted); }
  html[data-theme="dark"] .site-sponsors { background: var(--theme-surface); }
  html[data-theme="dark"] .site-sponsors .sponsors-marquee { background: #000; border-color: var(--theme-line); }
  html[data-theme="dark"] .site-sponsors .sponsors-item { background: transparent !important; border-radius: 8px; }
  /* The shared monochrome logos become light marks on the black strip. */
  html[data-theme="dark"] .site-sponsors .sponsors-item img {
    filter: grayscale(1) invert(1) !important;
    mix-blend-mode: screen;
  }
  html[data-theme="dark"] .site-sponsors .sponsors-link:is(:hover, :focus-visible) {
    background: var(--theme-hover);
    box-shadow: 0 0 0 1px var(--theme-line);
  }
  html[data-theme="dark"] .site-sponsors .sponsors-toggle:hover { background: var(--theme-hover); border-color: var(--theme-line); }
  html[data-theme="dark"] :is(.site-account-dialog,.menu-dialog,.admin-account-delete-dialog)::backdrop { background: #000000a8; }
  html[data-theme="dark"] :is(.destination,.close-dialog,.skip,.sm-skip,.record-skip) {
    background: var(--theme-raised) !important;
    color: var(--theme-text) !important;
    border-color: var(--theme-line) !important;
  }
  html[data-theme="dark"] .destination:hover { background: var(--theme-hover) !important; }
  html[data-theme="dark"] :is(.destination strong,.site-account-dialog h2) { color: var(--theme-text); }
  html[data-theme="dark"] :is(.destination small,.dialog-description,.dialog-note,.account-small,.account-field-help,.preview-note,.eyebrow) { color: var(--theme-muted) !important; }

  /* Main menu and public information pages. */
  html[data-theme="dark"] :is(.menu-card,.secondary-menu-button,.series-photo-content,.members-building-card,.hall-booking-panel,
    .hall-booking-offer,.contact-card,.contact-form-card,.gallery-item,.club-thanks,
    .company-activity-card,.company-lounge,.company-fact,.company-mission,.company-booking,
    .board-hero,.board-hero-facts,.board-person,.board-contact,.price-page,.price-option,.price-details) {
    background: var(--theme-surface) !important;
    color: var(--theme-text) !important;
    border-color: var(--theme-line) !important;
  }
  html[data-theme="dark"] :is(.menu-card:hover,.secondary-menu-button:hover,.board-person:hover,.gallery-item:hover) { border-color: #6c99c5 !important; }
  html[data-theme="dark"] :is(.menu-card .card-title,.card-action,.menu-heading h1,.secondary-menu-icon,
    .board-person-name,.board-hero h1,.board-facts-list strong,.board-contact h2,
    .hall-booking-offer-price,.company-fact p strong,.price-option-cost strong,.price-option-kind,
    .price-section-heading h2,.price-section-heading h3,.contact-name) { color: var(--theme-text) !important; }
  html[data-theme="dark"] :is(.menu-card .icon,.series-photo-arrow,.pins i,.coming-next,.about-choice-icon,.contact-icon,
    .board-jump-nav,.board-jump-nav a,.board-portrait-year,.members-building-icon,.hall-booking-check,
    .company-activity-icon,.company-mission-icon,.company-fact-icon,.company-lounge-visual,
    .pricelist-jump-nav a,.price-section-index,.price-info-only,.price-future-highlight,
    .gallery-count,.gallery-caption,.social-option-icon,.club-section-nav a) {
    background: var(--theme-raised) !important;
    color: var(--theme-link) !important;
    border-color: var(--theme-line) !important;
  }
  html[data-theme="dark"] :is(.card-description,.number,.menu-card--photo .card-description,.clubshop-divider span,
    .club-breadcrumb,.club-lead,.contact-description,.contact-note,.gallery-heading p,.gallery-caption small,
    .board-person-bio,.board-person-role,.board-section-heading p,.board-hero-copy>p,
    .board-facts-list,.board-jump-nav a span,.board-section-eyebrow,.board-contact p,
    .members-building-lead,.members-building-detail,.hall-booking-lead,.hall-booking-help,
    .hall-booking-offer-detail,.hall-booking-next p,.price-option-details,.price-option-cost span,
    .price-section-copy p,.price-section-meta,.price-section-note,.price-details p,.price-footer-note,
    .company-intro p,.company-section-head>p:last-child,.company-activity-card p,.company-lounge-copy>p,
    .company-lounge-visual>p,.company-fact p,.company-form-heading p,.company-optional,.company-date-hint,
    .company-privacy-confirmation span,.company-status,.company-bottom-note) { color: var(--theme-muted) !important; }
  html[data-theme="dark"] :is(.members-building-card h1 span,.members-building-eyebrow,.company-section-eyebrow,
    .company-intro strong,.company-mission strong,.profile-details-link strong) { color: var(--theme-green) !important; }
  html[data-theme="dark"] :is(.board-section-line,.clubshop-divider::before,.clubshop-divider::after,.hall-booking-offer-divider) { background: var(--theme-line); }
  html[data-theme="dark"] :is(.hall-booking-secondary,.company-button--light,.board-hero-action,.board-contact>a) {
    background: var(--theme-raised);
    color: var(--theme-link);
    border-color: var(--theme-line);
  }
  html[data-theme="dark"] :is(.company-button--outline,.company-button--light:hover) { color: #fff; }
  html[data-theme="dark"] .company-hero-copy h1 { color: #fff; }
  html[data-theme="dark"] :is(.company-booking-aside,.company-price) { background: #10372f; color: #f4fff9; }

  /* The league toolbar and final-path legends also have late-loaded light styles. */
  html[data-theme="dark"] :is(.series-toolbar,.div1-final-path,.div2-final-path) {
    background: var(--theme-raised) !important;
    color: var(--theme-text) !important;
    border-color: var(--theme-line) !important;
  }
  html[data-theme="dark"] .series-toolbar :is(.player-search-icon,.player-search-clear) {
    color: var(--theme-muted) !important;
  }

  /* League pages, player cards, records and SM teams. */
  html[data-theme="dark"] :is(.container,.page-shell,.card,.ranking-panel,.ranking-right,.players-section,.players-panel,
    .profile-card,.stat,.stat-card,.round-card,.admin-card,.admin-login-panel,.sc-card,.sc-toolbar,
    .scp-card,.scp-result,.scp-stat,.scp-series,.player-trend,.trend-panel,.follow-panel,
    .record-card,.record-empty,.sm-team,.sm-admin,.sm-hero) {
    background: var(--theme-surface) !important;
    color: var(--theme-text) !important;
    border-color: var(--theme-line) !important;
  }
  html[data-theme="dark"] :is(.tabs,.main-tabs,.series-switch,.sc-tabs,.filter-row,.sc-start-head,.sc-player-item,
    .sc-empty,.stat-total,.record-throws,.record-group-count,.record-meta time,.record-card--vacant .record-score,
    .sm-team-top,.sm-total,.sm-count,.sm-explanation,.sm-admin-player,.scp-meta-pill,.scp-meta,.scp-result-sets>span) {
    background: var(--theme-raised) !important;
    color: var(--theme-text) !important;
    border-color: var(--theme-line) !important;
  }
  html[data-theme="dark"] :is(.tabs button,.division-tabs button,.main-tabs button,.category-tabs button,.series-switch button,.sc-tab-button) {
    background: var(--theme-raised);
    color: var(--theme-muted);
    border-color: var(--theme-line);
  }
  html[data-theme="dark"] :is(.tabs button,.division-tabs button,.main-tabs button,.category-tabs button,.series-switch button,.sc-tab-button):hover {
    background: var(--theme-hover);
    color: var(--theme-text) !important;
  }
  html[data-theme="dark"] :is(.tabs button.active,.division-tabs button.active,.main-tabs button.active,
    .category-tabs button.active,.series-switch button.active,.sc-tab-button.active) {
    background: #275c8e !important;
    color: #fff !important;
  }
  html[data-theme="dark"] :is(.stat strong,.stat-card strong,.section-title,.ranking-panel h2,.players-section h3,#schedule h3,
    .sc-section-head h2,.sc-start-head strong,.scp-section-head h2,.scp-stat strong,.scp-series strong,
    .scp-result-main strong,.scp-set-detail strong,.scp-result-summary strong,.sm-section-heading h2,
    .sm-hero h1,.sm-format strong,.sm-explanation strong,.record-empty h2) { color: var(--theme-text) !important; }
  html[data-theme="dark"] :is(.muted,.season-line,.empty-state,.loading,.admin-help,.stat-card span,.round-card span,
    .stat-small,.sc-meta,.sc-kicker,.sc-player-item small,.sc-start-head span,.sc-import-status,
    .scp-note,.scp-kicker,.scp-stat span,.scp-stat small,.scp-series>span,.scp-series small,.scp-result-detail,
    .scp-result-main small,.scp-set-detail small,.scp-result-summary span,.sm-back,.sm-info p,.sm-loading,
    .sm-section-heading p,.sm-balance,.sm-team-top span,.sm-player-labels,.sm-player-rank,.sm-value--missing,
    .sm-total span,.sm-total-note,.sm-records h4,.sm-record small,.sm-record details,
    .sm-admin>p,.sm-admin label,.sm-admin-player small,.sm-hero p,.sm-hero .sm-kicker,.sm-format span,
    .record-field,.record-results-info,.record-person-copy small,.record-meta,.record-source-note,
    .record-vacant,.record-vacant-note) { color: var(--theme-muted) !important; }
  html[data-theme="dark"] :is(.total-good,.sc-schedule-total.has-result) { background: var(--theme-green-bg) !important; color: var(--theme-green) !important; }
  html[data-theme="dark"] .total-verygood { background: #203e67 !important; color: #a9d3ff !important; }
  html[data-theme="dark"] :is(.total-elite,.record-badge) { background: var(--theme-gold-bg) !important; color: var(--theme-gold) !important; border-color: #826938; box-shadow: none; }
  html[data-theme="dark"] :is(.record-badge--shared,.sm-portrait,.record-portrait,.scp-stat) { border-color: var(--theme-line); }
  html[data-theme="dark"] :is(.sc-start-block,.sc-schedule-total,.sc-row-button,.sc-secondary-button,.sm-button--light,.sm-remove,
    .ghost-btn,.admin-toggle,.logout-btn,.follow-button,#excelBlock) { background: var(--theme-raised) !important; color: var(--theme-link) !important; border-color: var(--theme-line) !important; }
  html[data-theme="dark"] .sm-balance strong { color: var(--theme-green); }
  html[data-theme="dark"] :is(.sm-player,.sm-record,.sm-total,.sm-records,.record-meta,.record-source-note) { border-color: var(--theme-line); }

  /* Booking calendar: keep free, booked, closed and pending states distinct. */
  html[data-theme="dark"] :is(.booking-shell,.calendar,.calendar-scroll,.choice-card,.bookings-card,.form-card) {
    background: var(--theme-surface) !important;
    color: var(--theme-text);
    border-color: var(--theme-line) !important;
  }
  html[data-theme="dark"] :is(.top nav,.calendar-view-switch,.lane-head,.time-head,.time-label,.week-corner,.week-day,.week-time,
    .selection,.connection,.lane-badge,.price-box,.lane-player,.choice-button,.booking-status,.month-weekday) {
    background: var(--theme-raised) !important;
    color: var(--theme-text) !important;
    border-color: var(--theme-line) !important;
  }
  html[data-theme="dark"] :is(.top nav a,.top .quiet,.calendar-view-switch button,.datebar h2,.lane-badge strong,.price-box strong,.month-date) { color: var(--theme-text); }
  html[data-theme="dark"] :is(.secondary,.quiet,.square,.choice-button,.legal-settings-button,.shop-forgot-link) {
    background: var(--theme-raised) !important;
    color: var(--theme-link) !important;
    border-color: var(--theme-line) !important;
  }
  html[data-theme="dark"] :is(.slot,.week-slot,.month-day) { background: var(--theme-green-bg) !important; color: var(--theme-green) !important; border-color: #32624e !important; }
  html[data-theme="dark"] :is(.slot.booked,.slot.reserved,.week-slot.partial,.week-slot.reserved,.month-day.partial,.month-day.reserved) {
    background: #1d3f60 !important; color: #acd4ff !important; border-color: #456d94 !important;
  }
  html[data-theme="dark"] :is(.slot.blocked,.slot.attention,.slot.awaiting,.week-slot.match,.month-day.match,
    .booking-status.attention,.booking-status.blocked,.booking-status.missed,.booking-status.awaiting_payment,.booking-status.cancelling_payment) {
    background: var(--theme-gold-bg) !important; color: var(--theme-gold) !important; border-color: #826938 !important;
  }
  html[data-theme="dark"] :is(.slot.past,.slot:disabled:not(.booked):not(.awaiting):not(.blocked),.week-slot.closed,.week-slot.past,
    .week-slot.unknown,.month-day.past,.month-day.outside-month,.month-day.unknown) {
    background: var(--theme-raised) !important; color: var(--theme-muted) !important; border-color: var(--theme-line) !important;
  }
  html[data-theme="dark"] :is(.slot.selected,.lane-player:has(input:checked),.choice-button[aria-pressed="true"]) {
    background: #245683 !important; color: #fff !important; border-color: #8dc5ff !important;
  }
  html[data-theme="dark"] :is(.slot:not(:disabled):hover,.week-slot:not(:disabled):hover,.month-day:hover) { outline: 2px solid #8dc5ff; outline-offset: -2px; }
  html[data-theme="dark"] :is(.calendar-view-switch button[aria-pressed="true"],.month-day.is-today .month-date) { background: #275c8e !important; color: #fff !important; }
  html[data-theme="dark"] :is(.booking-status.active,.card-benefit) { background: var(--theme-green-bg); color: var(--theme-green); }
  html[data-theme="dark"] :is(.booking-row,.calendar-top,.intro) { border-color: var(--theme-line); }
  html[data-theme="dark"] :is(.hint,.rules p,.count,.booking-description p,.players-summary,.month-capacity,.week-opening,
    .payment-countdown,.footer-note,.people-fields small,.choice-card>p,.login-card p) { color: var(--theme-muted) !important; }
  html[data-theme="dark"] .payment-detail { color: var(--theme-link) !important; }
  html[data-theme="dark"] .booking-description .refund-ok { color: var(--theme-green) !important; }
  html[data-theme="dark"] #shop-plan-section .choice-button { background: var(--theme-green-bg) !important; border-color: #32624e !important; }

  /* Administration, membership and personal account pages. */
  html[data-theme="dark"] :is(.login-card,.context-card,.quick-search-card,.quick-results,.quick-result,.metric-card,.panel-card,
    .list-card,.editor-disclosure,.admin-row,.admin-mfa-card,.admin-account-row,.admin-create-account,
    .benefit-header,.benefit-header-mdu,.benefit-form,.benefit-list-row,.member-plan,.member-card,
    .acct-guest,.acct-overview-card,.acct-sidebar,.acct-panel,.reset-panel,
    .profile-editor-shell .profile-section) {
    background: var(--theme-surface) !important;
    color: var(--theme-text) !important;
    border-color: var(--theme-line) !important;
  }
  html[data-theme="dark"] :is(.admin-tabs,.editor-form,.quick-kind,.badge,.empty-state,.admin-account-pill,.admin-account-policy,
    .admin-account-delete-confirm,.admin-free-member-choice,.benefit-header-icon,.benefit-selected,
    .member-status,.member-quote,.member-installation,.member-secret,.member-detail dd,
    .acct-icon,.acct-panel-icon,.acct-readonly,.acct-current-email,.acct-resource-links a,.acct-identity-section,
    .acct-identity-icon,.acct-alert,.acct-member-admin-panel,.acct-mdu-panel,.acct-mdu-mark,
    .reset-icon,.reset-invite-identity,.reset-invite-privacy,.profile-photo-note,.profile-details-link,.profile-details-icon) {
    background: var(--theme-raised) !important;
    color: var(--theme-text) !important;
    border-color: var(--theme-line) !important;
  }
  html[data-theme="dark"] :is(.context-card h2,.panel-head h2,.row-title,.quick-search-label strong,.metric-card strong,
    .editor-disclosure>summary,.main-player-export-card strong,.admin-mfa-card h2,.admin-account-email,
    .admin-account-policy strong,.admin-create-account>summary,.admin-account-invited-name,.admin-free-member-choice strong,
    .benefit-form h3,.benefit-list-heading h3,.benefit-list-row strong,.benefit-form label,
    .member-card h2,.member-plan h2,.member-plan strong,.member-payment dd,.member-detail dd,
    .acct-page-intro h1,.acct-overview-copy strong,.acct-panel h2,.acct-readonly strong,.acct-current-email strong,
    .acct-security-list strong,.acct-identity-heading h3,.acct-mdu-panel strong,.acct-member-admin-panel strong,
    .reset-panel label,.reset-invite-privacy h2,.reset-invite-privacy strong,.profile-editor-shell h1,
    .profile-editor-shell h2,.profile-editor-shell .profile-approval span) { color: var(--theme-text) !important; }
  html[data-theme="dark"] :is(.panel-hint,.row-sub,.quick-search-label span,.quick-result small,.metric-card span,
    .admin-mfa-card>p,.admin-account-details,.admin-account-role-help,.admin-account-create-note,.admin-optional,
    .admin-account-count,.admin-create-account>summary>small,.admin-free-member-choice small,
    .benefit-header p,.benefit-helper,.benefit-list-row span,.benefit-feedback,.benefit-selected,
    .member-muted,.member-plan small,.member-card p,.member-payment dt,.member-list small,.member-detail dt,
    .acct-page-intro p,.acct-page-intro .acct-eyebrow,.acct-overview-copy small,.acct-sidebar-caption,
    .acct-panel-description,.acct-readonly span,.acct-helper,.acct-form>label,.acct-optional,.acct-form-footer>span,
    .acct-current-email>span,.acct-security-list span,.acct-danger-zone p,.acct-bottom-note,.acct-identity-heading p,
    .acct-identity-description,.acct-identity-name-note,.acct-identity-privacy,.acct-identity-no-membership,
    .acct-mdu-panel p,.acct-member-admin-panel p,.reset-lead,.reset-help,.reset-footnote,.reset-done p,
    .reset-invite-privacy p,.profile-editor-shell .profile-section p,.profile-editor-shell .profile-lead,
    .profile-editor-shell .profile-hint,.profile-editor-shell .profile-photo-note) { color: var(--theme-muted) !important; }
  html[data-theme="dark"] :is(.ghost,.row-actions button,.row-actions a,.benefit-choices button,.benefit-list-row button,
    .member-shell button.secondary,.member-link.secondary,.member-shell .member-list button,.acct-nav-link,
    .acct-button-light,.acct-button-outline,.acct-password-toggle,.profile-editor-shell button.profile-secondary) {
    background: var(--theme-raised) !important;
    color: var(--theme-link) !important;
    border-color: var(--theme-line) !important;
  }
  html[data-theme="dark"] :is(.admin-tabs button.active,.benefit-choices button[aria-pressed="true"],
    .member-list button[aria-current="true"],.acct-nav-link[aria-current="page"]) {
    background: #275c8e !important; color: #fff !important; border-color: #6398c9 !important;
  }
  html[data-theme="dark"] :is(.quick-result:hover,.admin-row:hover,.acct-overview-card:hover,.acct-nav-link:hover) { background: var(--theme-hover) !important; }
  html[data-theme="dark"] :is(.editor-disclosure[open]>summary,.member-payment,.member-links,.acct-sidebar-separator,
    .acct-security-list>div+div,.acct-identity-section,.acct-danger-zone,.reset-separator) { border-color: var(--theme-line); }
  html[data-theme="dark"] .editor-disclosure>summary::after { background: var(--theme-raised); color: var(--theme-text); }
  html[data-theme="dark"] :is(.admin-free-member-choice:has(input:checked),.benefit-flag,.acct-email-check,
    .acct-profile-badge[data-state="saved"],.reset-free-membership,.reset-success-icon) {
    background: var(--theme-green-bg) !important; color: var(--theme-green) !important; border-color: #32624e !important;
  }
  html[data-theme="dark"] :is(.acct-profile-badge[data-state="missing"],.admin-account-pill[data-status="warning"]) {
    background: var(--theme-gold-bg) !important; color: var(--theme-gold) !important;
  }
  html[data-theme="dark"] :is(.admin-account-remove,.delete-btn,.sc-row-button.danger,.sm-remove,.acct-danger-zone strong) { color: var(--theme-red) !important; }

  /* Notices, consent and tournament registration share the same dark surfaces. */
  html[data-theme="dark"] :is(.legal-card,.legal-note,.legal-table-wrap,.message,.profile-message,.reset-notice,
    .sc-2027-registration-card,.sc-2027-registration-form,.sc-2027-photo-field,.sc-2027-generated-preview,
    .sc-2027-registration-table-wrap,.sc-2027-mobile-camera,.sc-2027-profile-options,
    .sc-2027-privacy-card,.sc-2027-qualification-day,.sc-2027-time-disclaimer,.sc-2027-registration-empty,
    .privacy-consent,.privacy-consent-banner,.privacy-consent-dialog) {
    background: var(--theme-surface) !important; color: var(--theme-text) !important; border-color: var(--theme-line) !important;
  }
  html[data-theme="dark"] :is(.legal-shell p,.legal-shell li,.sc-2027-registration-card>p,.sc-2027-time-hint,
    .sc-2027-registration-time-field small,.sc-2027-photo-field small,.sc-2027-generated-preview p,.sc-2027-photo-preview span,
    .sc-2027-qualification-day span,.sc-2027-profile-options p) { color: var(--theme-muted) !important; }
  html[data-theme="dark"] :is(.legal-eyebrow,.legal-brand,.legal-back,.legal-links a,.site-legal-footer a,
    .sc-2027-registration-card h2,.sc-2027-registration-card h3,.sc-2027-qualification-day strong) { color: var(--theme-text) !important; }
  html[data-theme="dark"] :is(.legal-storage-table th,.sc-2027-registration-table th) { background: var(--theme-raised); color: var(--theme-text); }
  html[data-theme="dark"] .sc-2027-registration-table tbody tr:nth-child(even) td { background: var(--theme-raised); }
  html[data-theme="dark"] :is(.sc-2027-view-profile,.sc-2027-delete-registration,.sc-2027-photo-field input::file-selector-button) { background: var(--theme-raised); color: var(--theme-link); border-color: var(--theme-line); }
  html[data-theme="dark"] :is(.message.error,.member-status.is-error,.sm-loading[data-error="true"],.profile-message[data-kind="error"],
    .reset-notice[data-kind="error"],.acct-status[data-kind="error"],.acct-form-message[data-kind="error"]) {
    background: var(--theme-red-bg) !important; color: var(--theme-red) !important; border-color: #805058 !important;
  }
  html[data-theme="dark"] :is(.admin-status.error,.benefit-feedback[data-error="true"],.sm-admin-status[data-error="true"],
    .booking-description .payment-error,.company-status[data-state="error"],.sc-2027-registration-status.error,
    .sc-2027-registration-empty.error,#adminAccountMessage[data-kind="error"],#adminAccountInviteStatus[data-kind="error"],
    #adminAccountDeleteStatus[data-kind="error"],.acct-identity-age[data-kind="error"]) { color: var(--theme-red) !important; }
  html[data-theme="dark"] :is(.admin-status.success,.acct-form-message[data-kind="success"],.sc-2027-registration-status.success) { color: var(--theme-green) !important; }

  html[data-theme="dark"] :is(.privacy-consent-card,.pwa-install-bar,.pwa-ios-guide,.following-card,.following-header,
    .following-empty,.following-loading,.trend-chart-wrap,.trend-detail,.admin-match-import,.admin-match-import-file) {
    background: var(--theme-surface) !important; color: var(--theme-text) !important; border-color: var(--theme-line) !important;
  }
  html[data-theme="dark"] :is(.privacy-settings-button,.privacy-consent-actions button,.privacy-consent-close,
    .pwa-install-close,.pwa-ios-guide-x,.pwa-ios-guide-icon,.trend-filter,.trend-detail-close,
    .trend-detail-stats>div,.following-icon,.following-notice-list span) {
    background: var(--theme-raised) !important; color: var(--theme-link) !important; border-color: var(--theme-line) !important;
  }
  html[data-theme="dark"] :is(.privacy-consent-card h2,.pwa-install-copy strong,.pwa-ios-guide h2,.following-player-name,
    .following-header h1,.following-empty strong,.trend-detail h3,.trend-detail-stats strong,.contact-field label,
    .admin-match-import label) { color: var(--theme-text) !important; }
  html[data-theme="dark"] :is(.privacy-consent-card p,.privacy-current-choice,.pwa-install-copy span,.following-header p,
    .trend-detail p,.trend-detail-kicker,.trend-detail-stats span,.contact-address,.contact-form-heading p,
    .contact-form-privacy,.contact-status,.admin-match-import-file small) { color: var(--theme-muted) !important; }
  html[data-theme="dark"] .privacy-consent-link { color: var(--theme-link) !important; }
  html[data-theme="dark"] :is(.following-permission,.pwa-ios-browser-note) { background: var(--theme-gold-bg); color: var(--theme-gold); }
  html[data-theme="dark"] :is(.following-remove,.trend-down,.contact-status[data-state="error"]) { background: var(--theme-red-bg); color: var(--theme-red); }
  html[data-theme="dark"] :is(.trend-up,.contact-status:not(:empty):not([data-state="error"])) { background: var(--theme-green-bg); color: var(--theme-green); }
  html[data-theme="dark"] .trend-neutral { background: var(--theme-raised); color: var(--theme-muted); }
  html[data-theme="dark"] .trend-filter.active { background: #275c8e !important; color: #fff !important; }
  html[data-theme="dark"] #trendChart text { fill: var(--theme-muted); }

  /* A few page-specific styles and mobile overrides use stronger selectors. */
  html[data-theme="dark"] :is(.site-header,.site-footer-wrap,.site-footer) { background: transparent !important; }
  html[data-theme="dark"] :is(.site-page-tools a,.site-page-tools button,.hall-booking-next,.player-follow-card,
    .scp-empty,.main-profile-stat,.profile-card #roundStats .round-card,.sc-2027-privacy-box,.sc-2027-privacy-choice,
    .sc-2027-existing-profile-option,.sc-2027-club-logo-field,.clubshop-mobile-cta,.company-privacy-confirmation,
    .company-noscript,.sc-back-link,.scp-back,.account-switch,.account-status,.account-email,.account-membership-price) {
    background: var(--theme-surface) !important; color: var(--theme-text) !important; border-color: var(--theme-line) !important;
  }
  html[data-theme="dark"] .site-layout[data-site-page="controller"]>main { background: var(--theme-surface); }
  html[data-theme="dark"] :is(.hall-booking-eyebrow,.hall-booking-offer-label,.hall-booking-facts li,.club-eyebrow,
    .company-form-kicker,.company-privacy-confirmation span,.contact-address strong,.pricelist-breadcrumb,
    .price-option-benefit,.price-option-benefit strong,.price-section-note strong,.price-details strong,
    .price-future-highlight p,.profile-details-link p,.profile-editor-shell .profile-back,.player-follow-card p,
    .player-follow-status,.board-contact-label,.sc-2027-privacy-content,.sc-2027-privacy-choice>span,
    .sc-2027-privacy-choice small,.sc-2027-existing-profile-option small,.sc-2027-club-logo-field small) { color: var(--theme-muted) !important; }
  html[data-theme="dark"] :is(.hall-booking-next a,.hall-booking-back,.company-booking-contact a,.company-button--light,
    .board-hero-action,.board-contact>a,.player-follow-manage,.reset-footer-actions a,.reset-footer-actions button,
    .sc-back-link,.scp-back,.sc-2027-privacy-content a,.profile-details-link a,
    .site-account-dialog .account-small a,.site-account-dialog .account-small label a) { color: var(--theme-link) !important; }
  html[data-theme="dark"] :is(.company-button--light,.board-hero-action,.board-contact>a,
    .price-section-meta,.board-person-role,.sm-portrait) {
    background: var(--theme-raised) !important; border-color: var(--theme-line) !important;
  }
  html[data-theme="dark"] :is(.sm-portrait,.main-profile-section-title,.main-profile-stat strong,
    .profile-card #roundStats .round-card>strong,.sc-2027-existing-profile-option strong) { color: var(--theme-text) !important; }
  html[data-theme="dark"] .profile-card #roundStats .round-card>span { color: var(--theme-muted); }
  html[data-theme="dark"] .profile-card #roundStats .round-card>span:nth-of-type(1) { background: var(--theme-raised); color: var(--theme-text); }
  html[data-theme="dark"] :is(.record-card--vacant .record-score strong,.record-card--vacant .record-score small,
    .site-account-dialog .account-status,.sc-select-group,.sc-admin-form label) { color: var(--theme-muted) !important; }
  html[data-theme="dark"] :is(.site-layout[data-site-page="index"] section:has(>#about9pin),
    .site-layout[data-site-page="index"] section[aria-labelledby="about9pin"] p,
    .site-layout[data-site-page="index"] #about9pin,.clubshop-mobile-cta small,.sc-select-group span,
    .company-checks li,.company-privacy-confirmation strong,.company-breadcrumb) { color: var(--theme-muted) !important; }
  html[data-theme="dark"] :is(.account-switch button,.account-secondary) {
    background: var(--theme-raised) !important; color: var(--theme-link) !important; border-color: var(--theme-line) !important;
  }
  html[data-theme="dark"] .account-switch button[aria-pressed="true"] { background: #275c8e !important; color: #fff !important; }
  html[data-theme="dark"] :is(.account-dialog .account-forgot-password,.account-acceptance a) { color: var(--theme-link) !important; }
  html[data-theme="dark"] .account-status[data-kind="error"] { background: var(--theme-red-bg) !important; color: var(--theme-red) !important; }
  html[data-theme="dark"] .company-field label span[aria-hidden="true"] { color: var(--theme-red) !important; }

  /* Preserve white text on filled brand buttons and leave images/QR artwork untouched. */
  html[data-theme="dark"] :is(.account-button,.primary,.sm-button:not(.sm-button--light),.reset-primary,.acct-button-primary,
    .member-link:not(.secondary),.member-shell button:not(.secondary):not(.site-theme-toggle):not(.member-list button),
    .company-submit,.hall-booking-primary,.members-building-button,.profile-action,
    .profile-editor-shell button:not(.profile-secondary),.sc-secondary-button:not(.sc-row-button),
    .sc-pdf-link,.scp-pdf-link,.clubshop-banner) { color: #fff; }
  html[data-theme="dark"] :is(.qr-sign,.sign-face) { background: #fff; color: #173a5e; }
  html[data-theme="dark"] .qr-sign :is(h1,h2,h3,a) { color: #173a5e !important; }
}
@media print {
  .site-theme-toggle { display: none !important; }
}

