/* #344 — CALENDAR DARK MODE (David's order 2026-08-29). Bound ONLY to data-theme="dark" on <html>, which theme.js sets
   from the ONE per-user preference Mission Control already stored (#310 item 5). Never bound to the OS scheme.
   Light mode is untouched: every rule below is scoped under the attribute, so with it absent nothing here applies.
   Palette per the order: navy canvas #0d1726 family (matches the left nav), text tiers #e8eef7 / #c8d3e2 / #7d8ba1,
   hairlines #24344d / #1c2a40. Every status colour is kept at dark-legible brightness — never removed. */

/* ── page canvas around the calendar ───────────────────────────────────────────────── */
:root[data-theme="dark"] body[data-page="calendar"]{background:#0d1726;color:#e8eef7}
:root[data-theme="dark"] body[data-page="calendar"] .content{background:#0d1726;color:#e8eef7}
:root[data-theme="dark"] body[data-page="calendar"] .content>h1{color:#e8eef7}

/* ── shell + toolbar ───────────────────────────────────────────────────────────────── */
:root[data-theme="dark"] .dc-calendar-shell,:root[data-theme="dark"] .dc-calendar-pvt2{color:#e8eef7}
/* #346: the control row sits ON the navy panel; chips #16233a with #24344d borders */
:root[data-theme="dark"] .dc-calendar-shell,:root[data-theme="dark"] .dc-calendar-pvt2,:root[data-theme="dark"] .dc-cal-pvt2-toolbar{background:#0f1b2d;border-color:#24344d}
:root[data-theme="dark"] .dc-cal-pvt2-toolbar>button,:root[data-theme="dark"] .dc-cal-pvt2-toolbar>input,:root[data-theme="dark"] .dc-cal-viewbtn,:root[data-theme="dark"] .dc-cal-pvt2-toolbar .dc-cal-searchwrap input{background:#16233a;border-color:#24344d;color:#c8d3e2}
:root[data-theme="dark"] .dc-cal-pvt2-toolbar>button:hover,:root[data-theme="dark"] .dc-cal-pvt2-toolbar button:hover,:root[data-theme="dark"] .dc-cal-viewbtn:hover,:root[data-theme="dark"] .dc-cal-iconbtn:hover,:root[data-theme="dark"] .dc-cal-pvt2-toolbar > button.dc-cal-chev:hover{background:#1a2a41;color:#e8eef7}
:root[data-theme="dark"] .dc-cal-today-pill{color:#8fb8ff;background:rgba(106,158,240,.16);border-color:rgba(106,158,240,.45)}
:root[data-theme="dark"] .dc-cal-today-pill:hover{background:rgba(106,158,240,.26)}
:root[data-theme="dark"] .dc-cal-monthlabel,:root[data-theme="dark"] .dc-cal-pvt2-toolbar h2,:root[data-theme="dark"] .dc-cal-pvt2-toolbar h2.dc-cal-monthlabel{color:#e8eef7}
:root[data-theme="dark"] .dc-cal-chev,:root[data-theme="dark"] .dc-cal-iconbtn{color:#c8d3e2}
/* #482: the hand-rolled view panel is gone — the control is a native <select>.
   color-scheme makes the browser draw ITS list dark too, so the dropdown the
   OS opens matches the header it drops from. Scoped to this control only. */
:root[data-theme="dark"] .dc-cal-viewselect{color-scheme:dark}
:root[data-theme="dark"] .dc-cal-viewwrap::after{color:#c8d3e2}
:root[data-theme="dark"] .dc-cal-searchwrap input{background:#121d2e;border-color:#24344d;color:#e8eef7}
:root[data-theme="dark"] .dc-cal-searchwrap input:focus{background:#121d2e;border-color:#6a9ef0}
:root[data-theme="dark"] .dc-cal-searchresults{background:#121d2e;border-color:#24344d;color:#e8eef7;box-shadow:0 8px 28px rgba(0,0,0,.5)}
:root[data-theme="dark"] .dc-cal-searchresults button{color:#e8eef7}
:root[data-theme="dark"] .dc-cal-searchresults button:hover{background:#1a2a41}
:root[data-theme="dark"] .dc-cal-weekends-toggle{background:#16233a;border-color:#24344d;color:#c8d3e2}
:root[data-theme="dark"] .dc-cal-weekends-toggle i{background:#24344d}
:root[data-theme="dark"] .dc-cal-weekends-toggle i::after{background:#7d8ba1}
:root[data-theme="dark"] .dc-cal-weekends-toggle.on{color:#8fb8ff;border-color:rgba(106,158,240,.45)}
:root[data-theme="dark"] .dc-cal-weekends-toggle.on i{background:rgba(106,158,240,.35)}
:root[data-theme="dark"] .dc-cal-weekends-toggle.on i::after{background:#8fb8ff}
:root[data-theme="dark"] .dc-cal-error{background:#3a2418;border-color:#8a5a2b;color:#f0b48a}
:root[data-theme="dark"] .dc-cal-loading-hint{color:#7d8ba1}

/* ── grid, headers, day cells ─────────────────────────────────────────────────────── */
/* #346: separators #152238 (faint seams), outer frame #1c2a40, day-label text #6b7a92 */
:root[data-theme="dark"] .dc-cal-pvt2-viewport,:root[data-theme="dark"] .dc-cal-pvt2-grid,:root[data-theme="dark"] .dc-cal-pvt2-days,:root[data-theme="dark"] .dc-cal-pvt2-weekdays{background:#152238}
:root[data-theme="dark"] .dc-calendar-pvt2 .dc-cal-canvas{border-color:#1c2a40}
:root[data-theme="dark"] .dc-cal-pvt2-weekdays span{background:#0f1b2d;color:#6b7a92}
:root[data-theme="dark"] .dc-cal-pvt2-day{background:#121d2e}
:root[data-theme="dark"] .dc-cal-pvt2-day.muted{background:#0f1a2b}
:root[data-theme="dark"] .dc-cal-pvt2-number{color:#c8d3e2}
:root[data-theme="dark"] .dc-cal-pvt2-day.muted .dc-cal-pvt2-number{color:#7d8ba1}
:root[data-theme="dark"] .dc-cal-pvt2-day.today .dc-cal-pvt2-number{background:#6a9ef0;color:#0d1726}
:root[data-theme="dark"] .dc-cal-somber-day .dc-cal-pvt2-number{color:#c8d3e2}
:root[data-theme="dark"] .dc-cal-pvt2-month{color:#8fb8ff}
:root[data-theme="dark"] .dc-cal-pvt2-days .dc-cal-pvt2-month{color:#f0a3a3}
:root[data-theme="dark"] .dc-cal-more{color:#8fb8ff}
:root[data-theme="dark"] .dc-cal-month-create{color:#7d8ba1}
:root[data-theme="dark"] .dc-cal-now{border-top-color:#f26d6d}
:root[data-theme="dark"] .dc-cal-now i{background:#f26d6d}

/* ── patient rows: dot colours untouched, text lifted ──────────────────────────────── */
:root[data-theme="dark"] .dc-cal-pvt2-event{color:#e8eef7}
:root[data-theme="dark"] .dc-cal-pvt2-event:hover{background:#1a2a41}
:root[data-theme="dark"] .dc-cal-pvt2-event time{color:#c8d3e2}
:root[data-theme="dark"] .dc-cal-ev-type{color:#c8d3e2;opacity:.85}
:root[data-theme="dark"] .dc-cal-cancelled,:root[data-theme="dark"] .dc-cal-headsup-band.dc-cal-cancelled,:root[data-theme="dark"] .dc-cal-outside-band.dc-cal-cancelled{background:#16213300;background:rgba(125,139,161,.12);border-color:#2d3c55;color:#7d8ba1}
:root[data-theme="dark"] .dc-cal-cancelled time,:root[data-theme="dark"] .dc-cal-cancelled strong,:root[data-theme="dark"] .dc-cal-cancelled .dc-cal-ev-type{color:#7d8ba1}
:root[data-theme="dark"] .dc-cal-reminder{color:#c8d3e2}
:root[data-theme="dark"] .dc-cal-reminder>i{background:#7d8ba1}
:root[data-theme="dark"] .dc-cal-phone{color:#6a9ef0}
:root[data-theme="dark"] .dc-cal-phone.dc-cal-phone-confirmed{color:#4ade80}
:root[data-theme="dark"] .dc-cal-envelope{color:#4ade80}
:root[data-theme="dark"] .dc-cal-clock{color:#8fb8ff}
:root[data-theme="dark"] .dc-cal-clock.is-scheduled .dc-cal-clock-face{fill:#121d2e}
/* #419 — the confirm mark keeps the one green token in the dark theme too (the dot beside it is never recoloured) */
:root[data-theme="dark"] .dc-cal-confirm-mark{background:#15803d}
/* #423 — the hollow "sent" ring lifts to the dark strip's light gray so it reads on the dark cell */
:root[data-theme="dark"] .dc-cal-confirm-mark.dc-cal-mark-sent{background:transparent;border-color:#9aa7bd}
:root[data-theme="dark"] .dc-cal-confirm-mark.dc-cal-mark-sent .dc-cal-confirmed-check path{stroke:#9aa7bd}
:root[data-theme="dark"] .dc-cal-badge{background:#1a2a41;color:#c8d3e2}
:root[data-theme="dark"] .dc-cal-badge.ready{background:rgba(74,222,128,.18);color:#4ade80}
:root[data-theme="dark"] .dc-cal-badge.warning{background:rgba(245,158,11,.2);color:#fbbf24}

/* ── bands: heads-up amber · holiday · block · membership (blue / PAID green / SENT tag) · outside ─ */
:root[data-theme="dark"] .dc-cal-headsup-band{background:rgba(245,158,11,.18);border-bottom-color:#b8862a;color:#fbd38d}
:root[data-theme="dark"] .dc-cal-results-reminder{background:#3a1714;border-color:#7a2d25;color:#f3a196}
:root[data-theme="dark"] .dc-cal-results-reminder.is-due{animation-name:dcResultsPulseDark}
:root[data-theme="dark"] .dc-cal-results-reminder.is-quiet{background:#232a36;border-color:#34405a;color:#9aa6b6}
@keyframes dcResultsPulseDark{0%,100%{background:#3a1714}50%{background:#5a211b}}
:root[data-theme="dark"] .dc-cal-pvt2-days .dc-cal-results-reminder{border-bottom-color:#f3a196}
:root[data-theme="dark"] .dc-cal-headsup-band:hover{background:rgba(245,158,11,.28)}
:root[data-theme="dark"] .dc-cal-holiday{color:#e8eef7}
:root[data-theme="dark"] .dc-cal-holiday-text{color:#e8eef7}
:root[data-theme="dark"] .dc-cal-holiday.somber .dc-cal-holiday-text{color:#c8d3e2}
:root[data-theme="dark"] .dc-cal-block-bar{filter:saturate(.9) brightness(.92)}
:root[data-theme="dark"] .dc-cal-block-bar:hover{filter:saturate(1) brightness(1)}
:root[data-theme="dark"] .dc-cal-membership-band{background:#2563eb;border-color:#3b82f6;color:#fff}
:root[data-theme="dark"] .dc-cal-membership-band.paid,:root[data-theme="dark"] .dc-cal-membership-band.is-paid{background:#15803d;border-color:#22c55e}
:root[data-theme="dark"] .dc-cal-outside-band{background:rgba(250,204,21,.18);border-color:#a16207;color:#fde68a}
:root[data-theme="dark"] .dc-cal-outside-band:hover{background:rgba(250,204,21,.28)}

/* ── hover card, name tip, legend ─────────────────────────────────────────────────── */
:root[data-theme="dark"] .dc-cal-hover{background:#121d2e;border-color:#24344d;color:#e8eef7;box-shadow:0 15px 42px rgba(0,0,0,.6)}
:root[data-theme="dark"] .dc-cal-hover small,:root[data-theme="dark"] .dc-cal-hover p,:root[data-theme="dark"] .dc-cal-hover-status{color:#c8d3e2}
:root[data-theme="dark"] .dc-cal-name-tip>*{background:#121d2e;color:#e8eef7;border-color:#24344d}

/* ── modals and popovers opened from the calendar follow the theme ─────────────────── */
:root[data-theme="dark"] .dc-cal-daypopover{background:#121d2e;border-color:#24344d;box-shadow:0 8px 28px rgba(0,0,0,.55)}
:root[data-theme="dark"] .dc-cal-daypopover-btn{color:#e8eef7}
:root[data-theme="dark"] .dc-cal-daypopover-btn:hover,:root[data-theme="dark"] .dc-cal-daypopover-btn:focus{background:#1a2a41}
:root[data-theme="dark"] .dc-cal-daypopover-btn.appt .dc-cal-daypopover-ico{color:#8fb8ff}
:root[data-theme="dark"] .dc-cal-daypopover-btn.reminder .dc-cal-daypopover-ico{color:#f3a196}
:root[data-theme="dark"] .dc-day-reminder header small{color:#f3a196}
:root[data-theme="dark"] .dc-cal-create,:root[data-theme="dark"] .dc-cal-settings,:root[data-theme="dark"] .dc-cal-manager,:root[data-theme="dark"] .dc-cal-holiday-modal,:root[data-theme="dark"] .dc-cal-delete-modal,:root[data-theme="dark"] .dc-envelope-modal,:root[data-theme="dark"] .dc-hold-pop,:root[data-theme="dark"] .dc-mobile-note-sheet{background:#121d2e;color:#e8eef7;box-shadow:0 22px 70px rgba(0,0,0,.65)}
:root[data-theme="dark"] .dc-cal-create>header,:root[data-theme="dark"] .dc-cal-create>footer,:root[data-theme="dark"] .dc-cal-detail>header,:root[data-theme="dark"] .dc-cal-setsection{border-color:#24344d}
:root[data-theme="dark"] .dc-cal-create h3,:root[data-theme="dark"] .dc-cal-create label,:root[data-theme="dark"] .dc-cal-settings h3,:root[data-theme="dark"] .dc-cal-settings label,:root[data-theme="dark"] .dc-cal-setrow,:root[data-theme="dark"] .dc-cal-setvalue{color:#e8eef7}
:root[data-theme="dark"] .dc-cal-create small,:root[data-theme="dark"] .dc-cal-settings small,:root[data-theme="dark"] .dc-cal-manager-sub,:root[data-theme="dark"] .dc-cal-buildline{color:#7d8ba1}
:root[data-theme="dark"] .dc-cal-create input,:root[data-theme="dark"] .dc-cal-create select,:root[data-theme="dark"] .dc-cal-create textarea,:root[data-theme="dark"] .dc-cal-settings input,:root[data-theme="dark"] .dc-cal-settings select,:root[data-theme="dark"] .dc-cal-detail input,:root[data-theme="dark"] .dc-cal-detail select,:root[data-theme="dark"] .dc-cal-detail textarea,:root[data-theme="dark"] .dc-cal-blockform,:root[data-theme="dark"] .dc-cal-patient-lookup input{background:#0f1a2b;border-color:#24344d;color:#e8eef7}
:root[data-theme="dark"] .dc-cal-create button,:root[data-theme="dark"] .dc-cal-settings button,:root[data-theme="dark"] .dc-cal-detail button,:root[data-theme="dark"] .dc-cal-manager button{background:#1a2a41;border-color:#24344d;color:#e8eef7}
:root[data-theme="dark"] .dc-cal-create button.primary,:root[data-theme="dark"] .dc-cal-detail button.primary,:root[data-theme="dark"] .dc-calendar-shell button.primary{background:#2f6ee5;border-color:#2f6ee5;color:#fff}
:root[data-theme="dark"] .dc-cal-chip,:root[data-theme="dark"] .dc-pill{background:#1a2a41;border-color:#24344d;color:#c8d3e2}
:root[data-theme="dark"] .dc-cal-chip.on,:root[data-theme="dark"] .dc-pill.on{background:rgba(106,158,240,.22);border-color:rgba(106,158,240,.5);color:#8fb8ff}
:root[data-theme="dark"] .dc-cal-detail{background:#121d2e;border-left-color:#24344d;color:#e8eef7;box-shadow:-14px 0 36px rgba(0,0,0,.6)}
:root[data-theme="dark"] .dc-cal-detail h3,:root[data-theme="dark"] .dc-cal-detail h4,:root[data-theme="dark"] .dc-cal-detail strong{color:#e8eef7}
:root[data-theme="dark"] .dc-cal-detail p,:root[data-theme="dark"] .dc-cal-detail small,:root[data-theme="dark"] .dc-cal-detail dd,:root[data-theme="dark"] .dc-cal-detail dt{color:#c8d3e2}
:root[data-theme="dark"] .dc-cal-create-backdrop,:root[data-theme="dark"] .dc-cal-day-backdrop,:root[data-theme="dark"] .dc-cal-holiday-backdrop,:root[data-theme="dark"] .dc-mobile-note-backdrop{background:rgba(3,8,16,.7)}
:root[data-theme="dark"] .dc-cal-legend,:root[data-theme="dark"] .dc-cal-pillmgr,:root[data-theme="dark"] .dc-cal-subedit{background:#121d2e;color:#e8eef7;border-color:#24344d}
:root[data-theme="dark"] .dc-cal-legend p,:root[data-theme="dark"] .dc-cal-legend li,:root[data-theme="dark"] .dc-cal-legend small{color:#c8d3e2}

/* the Mission Control card is its own dark (mission-control.css .mc-theme-dark) and opens over this by the same choice */

/* ── #349 item 3 — the top banner joins the theme on the calendar page (tokens re-pointed on the banner itself) ── */
:root[data-theme="dark"] body[data-page="calendar"] .pvt3-banner{--ink:#e8eef7;--muted:#c8d3e2;--line:#24344d;--blue:#8fb8ff;--blue-soft:rgba(106,158,240,.18);--blue-dark:#c9dcff;--purple-soft:rgba(175,169,236,.22);--mint-soft:rgba(93,202,165,.2);--amber-soft:rgba(250,199,117,.22);--shadow:0 8px 28px rgba(0,0,0,.5);background:#0f1b2d;border-color:#24344d;color:#e8eef7}
:root[data-theme="dark"] body[data-page="calendar"] .pvt3-banner button,:root[data-theme="dark"] body[data-page="calendar"] .pvt3-banner .ghost,:root[data-theme="dark"] body[data-page="calendar"] .pvt3-banner .pvt3-icon-btn{background:#16233a;border-color:#24344d;color:#c8d3e2}
:root[data-theme="dark"] body[data-page="calendar"] .pvt3-banner button:hover,:root[data-theme="dark"] body[data-page="calendar"] .pvt3-banner .ghost:hover{background:#1a2a41;color:#e8eef7}
:root[data-theme="dark"] body[data-page="calendar"] .pvt3-banner .pvt3-banner-search{background:#16233a;border-color:#24344d}
:root[data-theme="dark"] body[data-page="calendar"] .pvt3-banner .pvt3-banner-search input{color:#e8eef7}
:root[data-theme="dark"] body[data-page="calendar"] .pvt3-banner .pvt3-banner-search input::placeholder{color:#7d8ba1}
:root[data-theme="dark"] body[data-page="calendar"] .pvt3-banner .pvt3-banner-divider{background:#24344d}
:root[data-theme="dark"] body[data-page="calendar"] .pvt3-banner-search-results{background:#121d2e;border-color:#24344d;color:#e8eef7}
/* #361 — time field + reschedule screen, dark */
[data-theme="dark"] .p3-tf-box,.mc-dark .p3-tf-box{background:#16233a;border-color:#24344d}
[data-theme="dark"] .p3-tf-list,.mc-dark .p3-tf-list{background:#16233a;border-color:#24344d}
[data-theme="dark"] .p3-tf-item:hover,.mc-dark .p3-tf-item:hover{background:#1c2a40}
[data-theme="dark"] .p3-tf-item.on,.mc-dark .p3-tf-item.on{background:#1d3a6b}
[data-theme="dark"] .dc-rs-screen,.mc-dark .dc-rs-screen{background:#0f1b2d;color:#dbe4f0}
[data-theme="dark"] .dc-rs-confirm,.mc-dark .dc-rs-confirm{background:#16233a;border-color:#24344d}
[data-theme="dark"] .mc-rs-pill,.mc-dark .mc-rs-pill{background:#1d3a6b;border-color:#24344d;color:#bcd3f7}

/* #485 — THE DELETE CONFIRMATION IN DARK. Found by LOOKING at the proof screenshot (law 5.15), not by any
   assertion: the dialog came out half-themed. The patient name was dark-on-dark and effectively invisible on the
   one dialog whose whole job is to show you WHO you are about to erase; the footer band stayed light; and the
   destructive button lost its red to the generic dark button rule, so the dangerous action did not look
   dangerous. All three are specificity losses, so these rules name the delete modal explicitly. */
:root[data-theme="dark"] .dc-cal-deletewho strong{color:#e8eef7}
:root[data-theme="dark"] .dc-cal-deletewho span{color:#9aa7bd}
:root[data-theme="dark"] .dc-cal-delete-modal>header,:root[data-theme="dark"] .dc-cal-delete-modal>footer{background:transparent}
:root[data-theme="dark"] .dc-cal-delete-modal .dc-cal-note{background:#16233a;border-color:#2b4473;color:#c8d3e2}
:root[data-theme="dark"] .dc-cal-create>footer button{background:#1a2a41;border-color:#24344d;color:#e8eef7}
:root[data-theme="dark"] .dc-cal-delete-modal>footer button[type=submit]{background:#c0392f;border-color:#a93225;color:#fff}
:root[data-theme="dark"] .dc-cal-delete-modal>footer button[type=submit]:hover{background:#a93225}
/* #486 — the Cancel (CX) confirmation in dark: the same three specificity losses #485 found on Delete would recur
   here (name dark-on-dark, light header/footer bands), so they are named for this modal up front. Its primary stays
   the calendar's blue — CX is not destructive and must not look it. */
:root[data-theme="dark"] .dc-cal-cancel-modal{background:#121d2e;color:#e8eef7;box-shadow:0 22px 70px rgba(0,0,0,.65)}
:root[data-theme="dark"] .dc-cal-cancel-modal>header,:root[data-theme="dark"] .dc-cal-cancel-modal>footer{background:transparent}
:root[data-theme="dark"] .dc-cal-cancel-modal .dc-cal-note{background:#16233a;border-color:#2b4473;color:#c8d3e2}
:root[data-theme="dark"] .dc-cal-diff{color:#9aa7bd}
:root[data-theme="dark"] .dc-cal-diff b{color:#e8eef7}
:root[data-theme="dark"] .dc-cal-cancel-modal>footer button[type=submit]{background:#2563eb;border-color:#1d4ed8;color:#fff}
