/**
 * Staff-area dark mode — first pass.
 * Activated by html[data-ws-theme="dark"] (toggle in the admin topbar; the
 * choice persists in localStorage and is applied pre-paint by admin-html-base.php).
 *
 * Strategy: the sidebar is already dark; these overrides re-skin the workspace,
 * cards, tables, forms, and the most-used module surfaces. Pages keep working
 * even where a corner case stays light — this sheet errs on the safe side.
 */

html[data-ws-theme="dark"] { color-scheme: dark; }

/* ——— shell ——— */
html[data-ws-theme="dark"] body.admin-body,
html[data-ws-theme="dark"] .admin-workspace { background: #0f1216; color: #e5e7eb; }
html[data-ws-theme="dark"] .admin-topbar { background: #161a20; border-bottom-color: #232a33; box-shadow: none; }
html[data-ws-theme="dark"] .admin-topbar__title { color: #f3f4f6; }
html[data-ws-theme="dark"] .admin-topbar__user-name { color: #d1d5db; }
html[data-ws-theme="dark"] .admin-topbar__search input { background: #0f1216; border-color: #2b323d; color: #e5e7eb; }
html[data-ws-theme="dark"] .admin-topbar__theme,
html[data-ws-theme="dark"] .admin-alerts__bell,
html[data-ws-theme="dark"] .admin-topbar__search-link { color: #cbd5e1; }
html[data-ws-theme="dark"] .admin-topbar__theme:hover,
html[data-ws-theme="dark"] .admin-alerts__bell:hover { background: #232a33; }
html[data-ws-theme="dark"] .admin-alerts__panel { background: #161a20; border-color: #2b323d; }
html[data-ws-theme="dark"] .admin-alerts__item { border-bottom-color: #20262e; color: #d1d5db; }
html[data-ws-theme="dark"] .admin-alerts__item:hover { background: #1b2129; }
html[data-ws-theme="dark"] .admin-alerts__label { color: #cbd5e1; }

/* ——— generic content surfaces ——— */
html[data-ws-theme="dark"] .admin-main h1,
html[data-ws-theme="dark"] .admin-main h2,
html[data-ws-theme="dark"] .admin-main h3,
html[data-ws-theme="dark"] .admin-main h4 { color: #f3f4f6; }
html[data-ws-theme="dark"] .admin-main p,
html[data-ws-theme="dark"] .admin-main li,
html[data-ws-theme="dark"] .admin-main label,
html[data-ws-theme="dark"] .admin-main dt,
html[data-ws-theme="dark"] .admin-main dd { color: #cbd5e1; }

/* Cards & panels: every white box becomes a dark elevated surface. */
html[data-ws-theme="dark"] .admin-main .stat-card,
html[data-ws-theme="dark"] .admin-main .card,
html[data-ws-theme="dark"] .admin-main [class*="-card"],
html[data-ws-theme="dark"] .admin-main [class*="__card"],
html[data-ws-theme="dark"] .admin-main [class*="-panel"],
html[data-ws-theme="dark"] .admin-main [class*="__panel"],
html[data-ws-theme="dark"] .admin-main fieldset {
    background: #161a20; border-color: #232a33; color: #d1d5db;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
}
html[data-ws-theme="dark"] .admin-main .stat-card h3 { color: #9ca3af; }

/* Tables */
html[data-ws-theme="dark"] .admin-main table { background: #161a20; color: #d1d5db; }
html[data-ws-theme="dark"] .admin-main th { background: #1b2129; color: #e5e7eb; border-color: #232a33; }
html[data-ws-theme="dark"] .admin-main td { border-color: #20262e; color: #cbd5e1; }
html[data-ws-theme="dark"] .admin-main tr:hover td { background: #1b2129; }

/* Forms */
html[data-ws-theme="dark"] .admin-main input:not([type="checkbox"]):not([type="radio"]):not([type="range"]),
html[data-ws-theme="dark"] .admin-main select,
html[data-ws-theme="dark"] .admin-main textarea {
    background: #0f1216; border-color: #2b323d; color: #e5e7eb;
}
html[data-ws-theme="dark"] .admin-main input::placeholder,
html[data-ws-theme="dark"] .admin-main textarea::placeholder { color: #6b7280; }

/* Buttons that are light-on-white in the light theme */
html[data-ws-theme="dark"] .admin-main .btn-outline,
html[data-ws-theme="dark"] .admin-main .btn-light,
html[data-ws-theme="dark"] .admin-main .btn-default {
    background: #1b2129; border-color: #2b323d; color: #d1d5db;
}

/* Alerts keep their tone but on dark tints */
html[data-ws-theme="dark"] .admin-main .alert-success { background: rgba(22, 163, 74, 0.14); color: #86efac; border-color: rgba(22, 163, 74, 0.4); }
html[data-ws-theme="dark"] .admin-main .alert-error   { background: rgba(220, 38, 38, 0.14); color: #fca5a5; border-color: rgba(220, 38, 38, 0.4); }
html[data-ws-theme="dark"] .admin-main .alert-warning { background: rgba(202, 138, 4, 0.14);  color: #fde68a; border-color: rgba(202, 138, 4, 0.4); }
html[data-ws-theme="dark"] .admin-main .alert-info    { background: rgba(37, 99, 235, 0.14);  color: #93c5fd; border-color: rgba(37, 99, 235, 0.4); }

/* ——— custom dashboard ——— */
html[data-ws-theme="dark"] .wsdash__card { background: #161a20; border-color: #232a33; }
html[data-ws-theme="dark"] .wsdash__card h3 { color: #f3f4f6; }
html[data-ws-theme="dark"] .wsdash__kv { border-bottom-color: #20262e; }
html[data-ws-theme="dark"] .wsdash__kv span { color: #cbd5e1; }
html[data-ws-theme="dark"] .wsdash__big,
html[data-ws-theme="dark"] .wsdash__wx-day { background: #1b2129; border-color: #232a33; }
html[data-ws-theme="dark"] .wsdash__wx-day.is-today { background: rgba(156, 28, 52, 0.18); border-color: rgba(156, 28, 52, 0.45); }
html[data-ws-theme="dark"] .wsdash__notes { background: #1b2129; border-color: #2b323d; color: #e5e7eb; }
html[data-ws-theme="dark"] .wsdash__link-chip { background: rgba(156, 28, 52, 0.16); border-color: rgba(156, 28, 52, 0.45); color: #f1a7b4; }
html[data-ws-theme="dark"] .wsdash__modal-card { background: #161a20; color: #d1d5db; }
html[data-ws-theme="dark"] .wsdash__pick { background: #1b2129; border-color: #2b323d; color: #d1d5db; }
html[data-ws-theme="dark"] .wsdash__add { border-color: #2b323d; color: #9ca3af; }
html[data-ws-theme="dark"] .wsdash__hr i { background: #232a33; }

/* ——— quick search + toasts already dark-friendly; palette card flips ——— */
html[data-ws-theme="dark"] .ws-qs__card { background: #161a20; }
html[data-ws-theme="dark"] .ws-qs__head { border-bottom-color: #232a33; }
html[data-ws-theme="dark"] .ws-qs__input { color: #e5e7eb; }
html[data-ws-theme="dark"] .ws-qs__esc { border-color: #2b323d; color: #6b7280; }
html[data-ws-theme="dark"] .ws-qs__item { color: #cbd5e1; }
html[data-ws-theme="dark"] .ws-qs__item.is-active,
html[data-ws-theme="dark"] .ws-qs__item:hover { background: rgba(156, 28, 52, 0.18); color: #f1a7b4; }
html[data-ws-theme="dark"] .ws-ptr { background: #161a20; }

/* ——— empty states / skeletons ——— */
html[data-ws-theme="dark"] .wsdash__empty,
html[data-ws-theme="dark"] .ws-empty { border-color: #2b323d; color: #6b7280; }
html[data-ws-theme="dark"] .ws-skel { background: #20262e; }
html[data-ws-theme="dark"] .ws-skel::after { background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.08), transparent); }

/* ——— messages (basic surfaces; bubbles keep their accent) ——— */
html[data-ws-theme="dark"] body.messages-app .ws-msg-line { background: #1b2129; border-color: #232a33; }
html[data-ws-theme="dark"] body.messages-app .ws-msg-line__body { color: #e5e7eb; }
html[data-ws-theme="dark"] body.messages-app .ws-msg-line--me { background: linear-gradient(160deg, #b32744 0%, #9c1c34 100%); }
html[data-ws-theme="dark"] body.messages-app .ws-msg-line--me .ws-msg-line__body { color: #fff; }
html[data-ws-theme="dark"] .ws-msg-react { background: #2a313b; border-color: #3a424d; color: #e5e7eb; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.5); }
html[data-ws-theme="dark"] .ws-msg-react.is-mine { background: #3a2630; border-color: rgba(214, 58, 84, 0.55); color: #f9b9c5; }
html[data-ws-theme="dark"] .ws-msg-react__n { color: #9ca3af; }
html[data-ws-theme="dark"] .ws-msg-react.is-mine .ws-msg-react__n { color: #f9b9c5; }

/* ——— shared light surfaces the generic card/panel/table rules above miss ———
   Legacy admin.css section cards (Orders/settings/system-status/filter bars) and
   the shared dashboard partial's .dashboard-section use bespoke class names, so
   they stayed white-on-dark. Darken the container + its heading; colored status
   badges keep their own hues. Tables are already handled by `.admin-main table`. */
html[data-ws-theme="dark"] .admin-main .quick-actions,
html[data-ws-theme="dark"] .admin-main .system-status,
html[data-ws-theme="dark"] .admin-main .orders-section,
html[data-ws-theme="dark"] .admin-main .settings-section,
html[data-ws-theme="dark"] .admin-main .filter-controls,
html[data-ws-theme="dark"] .admin-main .dashboard-section,
html[data-ws-theme="dark"] .admin-main .modal-content { background: #161a20; border-color: #232a33; color: #d1d5db; }
html[data-ws-theme="dark"] .admin-main .quick-actions h2,
html[data-ws-theme="dark"] .admin-main .system-status h2,
html[data-ws-theme="dark"] .admin-main .orders-section h2,
html[data-ws-theme="dark"] .admin-main .settings-section h2,
html[data-ws-theme="dark"] .admin-main .filter-controls h2,
html[data-ws-theme="dark"] .admin-main .recent-activity h2,
html[data-ws-theme="dark"] .admin-main .dashboard-section h2,
html[data-ws-theme="dark"] .admin-main .modal-content h3 { color: #f3f4f6; border-bottom-color: #2b323d; }
html[data-ws-theme="dark"] .admin-main .settings-related-nav { background: #1b2129; border-color: #2b323d; }
html[data-ws-theme="dark"] .admin-main .settings-related-nav__label { color: #9ca3af; }
html[data-ws-theme="dark"] .admin-main .settings-related-nav__sep { color: #3a424d; }
html[data-ws-theme="dark"] .admin-main .status-item { background: #1b2129; }
html[data-ws-theme="dark"] .admin-main .status-label { color: #9ca3af; }
html[data-ws-theme="dark"] .admin-main .no-data,
html[data-ws-theme="dark"] .admin-main .no-orders { color: #9ca3af; }
html[data-ws-theme="dark"] .admin-main .order-item { border-bottom-color: #20262e; }
html[data-ws-theme="dark"] .admin-main .order-info h4 { color: #e5e7eb; }
html[data-ws-theme="dark"] .admin-main .order-info p { color: #9ca3af; }
/* Search results rows (bespoke .srch-* on search.php) */
html[data-ws-theme="dark"] .admin-main .srch-list li { border-bottom-color: #20262e; }
html[data-ws-theme="dark"] .admin-main .srch-list a { color: #e5e7eb; }
html[data-ws-theme="dark"] .admin-main .srch-list a:hover { background: #1b2129; }

/* My Dashboard: view pills + App Shelf module tiles */
html[data-ws-theme="dark"] .wsdash__viewpills { background: #1b2129; border-color: #2b323d; }
html[data-ws-theme="dark"] .wsdash__viewpill { color: #cbd5e1; }
html[data-ws-theme="dark"] .wsdash__viewpill:hover { color: #f3f4f6; }
html[data-ws-theme="dark"] .appshelf__cat { color: #9ca3af; }
html[data-ws-theme="dark"] .appshelf__card { background: #161a20; border-color: #232a33; }
html[data-ws-theme="dark"] .appshelf__card:hover { border-color: var(--c, #9c1c34); }
html[data-ws-theme="dark"] .appshelf__ico { background: color-mix(in srgb, var(--c, #9c1c34) 26%, #161a20); }
html[data-ws-theme="dark"] .appshelf__name { color: #e5e7eb; }
html[data-ws-theme="dark"] .appshelf__blurb { color: #9ca3af; }

/* Internal announcements on staff dashboards */
html[data-ws-theme="dark"] .ws-ann { background: #2a1c20; border-color: #5c2230; border-left-color: #d63a54; }
html[data-ws-theme="dark"] .ws-ann--pinned { background: #2a2410; border-color: #5c4a16; border-left-color: #d97706; }
html[data-ws-theme="dark"] .ws-ann__title { color: #f3f4f6; }
html[data-ws-theme="dark"] .ws-ann__text { color: #d1d5db; }
/* Announcements management page (admin/announcements.php) */
html[data-ws-theme="dark"] .anns-card,
html[data-ws-theme="dark"] .anns-item { background: #161a20; border-color: #232a33; }
html[data-ws-theme="dark"] .anns-field input[type=text],
html[data-ws-theme="dark"] .anns-field textarea,
html[data-ws-theme="dark"] .anns-field select,
html[data-ws-theme="dark"] .anns-field input[type=datetime-local] { background: #0f1216; border-color: #2b323d; color: #e5e7eb; }
html[data-ws-theme="dark"] .anns-item__body { color: #cbd5e1; }
html[data-ws-theme="dark"] .anns-field label,
html[data-ws-theme="dark"] .anns-check { color: #cbd5e1; }

/* Local Events page */
html[data-ws-theme="dark"] .le-card { background: #161a20; border-color: #232a33; }
html[data-ws-theme="dark"] .le-day__head { color: #9ca3af; border-bottom-color: #232a33; }
html[data-ws-theme="dark"] .le-ev__title { color: #e5e7eb; }
html[data-ws-theme="dark"] .le-ev__time, html[data-ws-theme="dark"] .le-ev__sub { color: #9ca3af; }
html[data-ws-theme="dark"] .le-field label { color: #cbd5e1; }
html[data-ws-theme="dark"] .le-field input,
html[data-ws-theme="dark"] .le-field textarea { background: #0f1216; border-color: #2b323d; color: #e5e7eb; }
html[data-ws-theme="dark"] .le-pills { background: #1b2129; border-color: #2b323d; }
html[data-ws-theme="dark"] .le-pill { color: #cbd5e1; }
html[data-ws-theme="dark"] .le-mnav__btn { background: #161a20; border-color: #2b323d; color: #cbd5e1; }
html[data-ws-theme="dark"] .le-cell { border-color: #232a33; }
html[data-ws-theme="dark"] .le-cell.is-out { background: #12161b; }
html[data-ws-theme="dark"] .le-cell.is-out .le-cell__n { color: #3a424d; }
html[data-ws-theme="dark"] .le-cell__n { color: #9ca3af; }

/* App footer strip */
html[data-ws-theme="dark"] .admin-app-footer { background: #161a20; border-top-color: #232a33; }
html[data-ws-theme="dark"] .admin-app-footer__copy,
html[data-ws-theme="dark"] .admin-app-footer__extra { color: #9ca3af; }

/* ——— Schedule app (admin/schedule.php, body.schedule-app) ———
   The grid reads --admin-* tokens (only ever set via fallbacks) and its own
   --sched-* tokens. Re-point both for dark, then darken the surfaces that
   hardcode a white/grey background instead of going through a token. */
html[data-ws-theme="dark"] body.schedule-app {
    --admin-surface: #161a20;
    --admin-surface-2: #1b2129;
    --admin-text: #e5e7eb;
    --admin-text-muted: #9ca3af;
    --admin-border: #2b323d;
    --sched-canvas: #0f1216;
    --sched-panel: #161a20;
    --sched-panel-deep: #1b2129;
}
html[data-ws-theme="dark"] body.schedule-app .admin-main { background: #0f1216; }
/* Week-grid header cells + labor totals (literal #f9fafb / #f1f5f9) */
html[data-ws-theme="dark"] body.schedule-app .schedule-grid__corner,
html[data-ws-theme="dark"] body.schedule-app .schedule-grid__day { background: #1b2129; color: #e5e7eb; border-color: #2b323d; }
html[data-ws-theme="dark"] body.schedule-app .schedule-grid__row--labor-totals .schedule-grid__cell--labor { background: #1b2129; }
/* Table headers (pay matrix / directory / patterns) */
html[data-ws-theme="dark"] body.schedule-app .schedule-pay-matrix thead th,
html[data-ws-theme="dark"] body.schedule-app .schedule-directory-table thead th,
html[data-ws-theme="dark"] body.schedule-app .schedule-pattern-table thead { background: #1b2129; color: #e5e7eb; }
/* Toolbar icon buttons + segmented toggle */
html[data-ws-theme="dark"] body.schedule-app .schedule-icon-btn,
html[data-ws-theme="dark"] body.schedule-app .schedule-groupby { background: #1b2129; color: #e5e7eb; border-color: #2b323d; }
/* Absolute-positioned white popovers / menus / pickers */
html[data-ws-theme="dark"] body.schedule-app .schedule-copy-week,
html[data-ws-theme="dark"] body.schedule-app .schedule-quickadd,
html[data-ws-theme="dark"] body.schedule-app .schedule-shift__menu-list,
html[data-ws-theme="dark"] body.schedule-app .schedule-bulk-edit-summary,
html[data-ws-theme="dark"] body.schedule-app .schedule-bulk-update-form { background: #161a20; color: #e5e7eb; border-color: #2b323d; }
html[data-ws-theme="dark"] body.schedule-app .schedule-shift__menu-item { color: #e5e7eb; }
html[data-ws-theme="dark"] body.schedule-app .schedule-shift__menu-item:hover { background: #1b2129; }
/* Staff views (My schedule / availability / time-off cards + forms) */
html[data-ws-theme="dark"] body.schedule-app .schedule-panel,
html[data-ws-theme="dark"] body.schedule-app .schedule-my-list__item,
html[data-ws-theme="dark"] body.schedule-app .schedule-to-list__item,
html[data-ws-theme="dark"] body.schedule-app .schedule-avail-list li { background: #161a20; border-color: #232a33; color: #d1d5db; }
html[data-ws-theme="dark"] body.schedule-app .schedule-panel__title { color: #f3f4f6; }
html[data-ws-theme="dark"] body.schedule-app .schedule-form input:not([type="checkbox"]):not([type="radio"]),
html[data-ws-theme="dark"] body.schedule-app .schedule-form select,
html[data-ws-theme="dark"] body.schedule-app .schedule-form textarea { background: #0f1216; border-color: #2b323d; color: #e5e7eb; }
/* Day view */
html[data-ws-theme="dark"] body.schedule-app .schedule-day-card { background: #161a20; border-color: #232a33; }
html[data-ws-theme="dark"] body.schedule-app .schedule-day-card__name,
html[data-ws-theme="dark"] body.schedule-app .schedule-day-title { color: #e5e7eb; }
html[data-ws-theme="dark"] body.schedule-app .schedule-day-card__time { background: #232a33; color: #e5e7eb; }
html[data-ws-theme="dark"] body.schedule-app .schedule-daypicker__day { background: #161a20; color: #cbd5e1; border-color: #2b323d; }
html[data-ws-theme="dark"] body.schedule-app .schedule-locfilter input,
html[data-ws-theme="dark"] body.schedule-app .schedule-locfilter select { background: #0f1216; color: #e5e7eb; border-color: #2b323d; }
/* Legends / extras text on now-dark containers */
html[data-ws-theme="dark"] body.schedule-app .schedule-extras__summary,
html[data-ws-theme="dark"] body.schedule-app .schedule-color-legend__title,
html[data-ws-theme="dark"] body.schedule-app .schedule-cut-legend__title,
html[data-ws-theme="dark"] body.schedule-app .schedule-cut-legend__item,
html[data-ws-theme="dark"] body.schedule-app .schedule-cut-legend__name { color: #cbd5e1; }
html[data-ws-theme="dark"] body.schedule-app .schedule-also-detail { background: #1b2129; color: #d1d5db; }

/* ——— modals & popovers commonly used across modules ——— */
html[data-ws-theme="dark"] .admin-viewas__panel,
html[data-ws-theme="dark"] .ws-msg-menu,
html[data-ws-theme="dark"] .ws-react-picker,
html[data-ws-theme="dark"] .ws-mention-pop { background: #161a20; border-color: #2b323d; }
html[data-ws-theme="dark"] .ws-msg-menu__item { color: #d1d5db; }
html[data-ws-theme="dark"] .ws-msg-menu__item:hover { background: #1b2129; }
