/* APPEARANCE_PREFS_V1 — user theme + automatic device preference */
html[data-theme="dark"] {
  color-scheme: dark;
  background: #101827;
  color: #e8eef8;
}
html[data-theme="dark"] body { background:#101827; color:#e8eef8; }
html[data-theme="dark"] header { background:#182337; border-bottom-color:#334155; }
html[data-theme="dark"] .brand { color:#93c5fd; }
html[data-theme="dark"] .toolbar, html[data-theme="dark"] main, html[data-theme="dark"] #heading { color:#e8eef8; }
html[data-theme="dark"] .calendar { background:#40516a; border-color:#40516a; }
html[data-theme="dark"] .weekday { background:#26364c; color:#e8eef8; }
html[data-theme="dark"] .cell { background:#1b293c; color:#e8eef8; }
html[data-theme="dark"] .cell:hover { background:#293b54; }
html[data-theme="dark"] .cell.muted { background:#172234; color:#93a4bc; }
html[data-theme="dark"] .day-event, html[data-theme="dark"] .empty, html[data-theme="dark"] .panel, html[data-theme="dark"] #preferencesScreen { background:#1b293c; color:#e8eef8; }
html[data-theme="dark"] .day-event p, html[data-theme="dark"] .login-panel p, html[data-theme="dark"] .preferences-note { color:#aebed2; }
html[data-theme="dark"] .day-event[style*="background: rgb(229, 231, 235)"], html[data-theme="dark"] .day-event[style*="background: #e5e7eb"] { background:#e5e7eb; color:#111827; }
html[data-theme="dark"] .day-event[style*="background: rgb(229, 231, 235)"] p, html[data-theme="dark"] .day-event[style*="background: #e5e7eb"] p { color:#374151; }
html[data-theme="dark"] button.subtle, html[data-theme="dark"] .nav button, html[data-theme="dark"] .back { background:#33465f; color:#f1f5f9; }
html[data-theme="dark"] input:not([type=checkbox]):not([type=radio]), html[data-theme="dark"] textarea, html[data-theme="dark"] select { background:#26364c; color:#f8fafc; border-color:#52657e; }
html[data-theme="dark"] label, html[data-theme="dark"] #preferencesMessage { color:#e8eef8; }
html[data-theme="dark"] dialog { background:#1b293c; color:#e8eef8; }
html[data-theme="dark"] #preferencesForm fieldset { border-color:#52657e; }
html[data-theme="dark"] .user-row { border-bottom-color:#40516a; }
html[data-theme="dark"] .events-list-table th, html[data-theme="dark"] #eventsListScreen, html[data-theme="dark"] #eventsListRange, html[data-theme="dark"] #eventsListMessage { color:#e8eef8; }
html[data-theme="dark"] .events-list-table tbody tr { color:#e8eef8; }
html[data-theme="dark"] #toast { background:#33465f; color:#f8fafc; }

@media (prefers-color-scheme: dark) {
html:not([data-theme]):not([data-theme="light"]) {
  color-scheme: dark;
  background: #101827;
  color: #e8eef8;
}
html:not([data-theme]):not([data-theme="light"]) body { background:#101827; color:#e8eef8; }
html:not([data-theme]):not([data-theme="light"]) header { background:#182337; border-bottom-color:#334155; }
html:not([data-theme]):not([data-theme="light"]) .brand { color:#93c5fd; }
html:not([data-theme]):not([data-theme="light"]) .toolbar, html:not([data-theme]):not([data-theme="light"]) main, html:not([data-theme]):not([data-theme="light"]) #heading { color:#e8eef8; }
html:not([data-theme]):not([data-theme="light"]) .calendar { background:#40516a; border-color:#40516a; }
html:not([data-theme]):not([data-theme="light"]) .weekday { background:#26364c; color:#e8eef8; }
html:not([data-theme]):not([data-theme="light"]) .cell { background:#1b293c; color:#e8eef8; }
html:not([data-theme]):not([data-theme="light"]) .cell:hover { background:#293b54; }
html:not([data-theme]):not([data-theme="light"]) .cell.muted { background:#172234; color:#93a4bc; }
html:not([data-theme]):not([data-theme="light"]) .day-event, html:not([data-theme]):not([data-theme="light"]) .empty, html:not([data-theme]):not([data-theme="light"]) .panel, html:not([data-theme]):not([data-theme="light"]) #preferencesScreen { background:#1b293c; color:#e8eef8; }
html:not([data-theme]):not([data-theme="light"]) .day-event p, html:not([data-theme]):not([data-theme="light"]) .login-panel p, html:not([data-theme]):not([data-theme="light"]) .preferences-note { color:#aebed2; }
html:not([data-theme]):not([data-theme="light"]) .day-event[style*="background: rgb(229, 231, 235)"], html:not([data-theme]):not([data-theme="light"]) .day-event[style*="background: #e5e7eb"] { background:#e5e7eb; color:#111827; }
html:not([data-theme]):not([data-theme="light"]) .day-event[style*="background: rgb(229, 231, 235)"] p, html:not([data-theme]):not([data-theme="light"]) .day-event[style*="background: #e5e7eb"] p { color:#374151; }
html:not([data-theme]):not([data-theme="light"]) button.subtle, html:not([data-theme]):not([data-theme="light"]) .nav button, html:not([data-theme]):not([data-theme="light"]) .back { background:#33465f; color:#f1f5f9; }
html:not([data-theme]):not([data-theme="light"]) input:not([type=checkbox]):not([type=radio]), html:not([data-theme]):not([data-theme="light"]) textarea, html:not([data-theme]):not([data-theme="light"]) select { background:#26364c; color:#f8fafc; border-color:#52657e; }
html:not([data-theme]):not([data-theme="light"]) label, html:not([data-theme]):not([data-theme="light"]) #preferencesMessage { color:#e8eef8; }
html:not([data-theme]):not([data-theme="light"]) dialog { background:#1b293c; color:#e8eef8; }
html:not([data-theme]):not([data-theme="light"]) #preferencesForm fieldset { border-color:#52657e; }
html:not([data-theme]):not([data-theme="light"]) .user-row { border-bottom-color:#40516a; }
html:not([data-theme]):not([data-theme="light"]) .events-list-table th, html:not([data-theme]):not([data-theme="light"]) #eventsListScreen, html:not([data-theme]):not([data-theme="light"]) #eventsListRange, html:not([data-theme]):not([data-theme="light"]) #eventsListMessage { color:#e8eef8; }
html:not([data-theme]):not([data-theme="light"]) .events-list-table tbody tr { color:#e8eef8; }
html:not([data-theme]):not([data-theme="light"]) #toast { background:#33465f; color:#f8fafc; }

}

/* Keep GOV.UK bank holiday chips readable in both appearances. */
.event-chip[style*="background: rgb(229, 231, 235)"], .event-chip[style*="background: #e5e7eb"] { color:#111827!important; }
