/* BEC-1028 – contrast-only corrections. No layout, spacing or geometry changes.
   Explicit app theme (not the operating-system theme) controls native widgets. */
body.theme-mode-light,.theme-preview.theme-mode-light{color-scheme:light;--bec92-ok:#21613a;--bec92-warn:#795000;--bec92-error:#9f252b;--bec92-focus:var(--theme-accent);--bec92-chart:#17664e}
body.theme-mode-dark,.theme-preview.theme-mode-dark{color-scheme:dark;--bec92-ok:#a4e7b8;--bec92-warn:#ffda9b;--bec92-error:#ffb4ad;--bec92-focus:var(--theme-link);--bec92-chart:#8ee2b8}
/* The legacy --panel / --text aliases were missing, so dialogs fell back to white. */
body,.theme-preview{--panel:var(--theme-panel);--text:var(--theme-text)}
body :is(input,textarea,select){accent-color:var(--theme-accent)}
body :is(input,textarea)::placeholder,body #task-activity-detail::placeholder{color:var(--theme-muted);opacity:1}
body.theme-mode-light :is(input,textarea,select):not([type=checkbox]):not([type=radio]):not([type=range]):not([type=color]):not([type=submit]):not([type=button]):not([type=reset]):not([type=image]){color:var(--theme-text)}
body :is(button,input,select,textarea,a,summary):focus-visible{outline-color:var(--bec92-focus)}
body :is(.cal-dialog,.compact78-dialog,.gi dialog){background:var(--theme-panel);color:var(--theme-text);border-color:var(--theme-border)}
/* Permissions: legacy light cards must not inherit white text in dark mode. */
body.theme-mode-dark :is(.family-permission-overview,.family-permission-column,.family-permission-card){background:var(--theme-panel);color:var(--theme-text);border-color:var(--theme-border)}
body.theme-mode-dark :is(.family-permission-overview small,.family-permission-head,.family-permission-check){color:var(--theme-muted)}
/* Calendar/catalog selections use the appropriate surface in the dark palette. */
body.theme-mode-dark .cal-event:not(.cal-linked){background:var(--theme-soft);color:var(--theme-text)}
body.theme-mode-dark .catalog-option{background:var(--theme-soft);color:var(--theme-text)}
body.theme-mode-dark .catalog-option:hover{background:var(--theme-panel);color:var(--theme-text)}
body .catalog-results small{color:var(--theme-muted)}
body.theme-mode-dark .school-grade:not(.school-workspace .school-grade){background:var(--theme-soft);color:var(--theme-text)}
body .school-chart line{stroke:var(--theme-border)}
body .school-chart polyline{stroke:var(--bec92-chart)}
body .school-chart circle{fill:var(--bec92-chart)}
/* Existing pastel surfaces stay pastel, with readable dark text and links. */
body .lb-grid .lb-card.lb-paid{background:#dff2e4!important;color:#215b36!important}
body .lb-grid .lb-card.lb-pending{background:#fff0d5!important;color:#795000!important}
body .lb-grid .lb-card.lb-late{background:#f9e1df!important;color:#8b3430!important}
body.theme-mode-dark :is(.bb-card.bb-paid,.bb-card.bb-unpaid,.bb-paid-total,.bb-unpaid-total,.lb-paid-note,.lb-green,.family-task-card.is-done,.family-routine-item.is-done) a{color:#234e70}
body.theme-mode-dark .family-task-card.is-done .family-task-details{color:inherit}
/* Member message bubbles have a deliberately light, personal background. */
body .bubble{color:#20352e}
body .bubble .bubble-heading{color:var(--member-ink,#254c40)}
body .bubble :is(p,.chat-reply-reference) a{color:#2458a0}
body .bubble .message-time{color:#4b5d54}
body.theme-mode-dark .chat-pill-option:has(input:checked){background:var(--theme-soft);color:var(--theme-text)}
body .chat-edit-overlay .chat-inline-edit .chat-edit-buttons .chat-edit-save{background:#21613f;border-color:#21613f;color:#fff}
/* Keep the selected icon/avatar foreground readable, even without an avatar. */
body .task-member-circle{background:var(--member-color,var(--theme-soft));color:var(--theme-text)}
/* Member backgrounds are pastel when the original variable exists. */
body .task-member:has(input:checked){border-color:var(--member-color,var(--bec92-focus));box-shadow:inset 0 0 0 1px var(--member-color,var(--bec92-focus))}
/* Status labels: use a separate color for text, rather than decorative icon colors. */
body :is(.recipe-missing,.cal-warning,.fl-error,.req-state-declined,.ft-health-fail,.gi-bad,.vf-due){color:var(--bec92-error)}
body :is(.req-state-later,.req-state-pending,.fl-stale,.vf-soon){color:var(--bec92-warn)}
body :is(.req-state-approved,.req-state-purchased,.meal-liked,.fl-recent,.fl-live,.ft-health-ok,.gi-good,.task88-completed>summary,.task87-row.is-done .task87-icon,#task87-history>summary span,.school88-paid:has(input:checked),.shop88-dashboard .family-shop-buy){color:var(--bec92-ok)}
body .meal-card small,body .voice-hint{color:var(--theme-muted)}
body .task87-actions .task87-toggle,body .task87-mark,body .planner87-done button{color:var(--bec92-ok)!important}
body .vehicles-ui .vf-due{color:var(--bec92-error)}
body .vehicles-ui .vf-soon{color:var(--bec92-warn)}
body .chat-input-wrap #chat-image-remove,body #family-tv .ft-row-actions .ft-delete{color:var(--bec92-error)}
body #family-tv .ft-row .ft-favorite[aria-pressed=true]{color:var(--bec92-warn)}
body .shop-simple .shop-action-buy button,body .shopping-compact .shop-action-buy button{color:var(--bec92-ok)}
body .shop-simple .shop-delete summary,body .shopping-compact .shop-delete summary,body .catalog-compact button.is-delete{color:var(--bec92-error)}
/* A dark system preference must not change the chosen light app theme. */
body.theme-mode-light .gi dialog{background:var(--theme-panel);color:var(--theme-text)}
body.theme-mode-dark .gi dialog{background:var(--theme-panel);color:var(--theme-text)}
/* Keep white foregrounds legible on filled green buttons. */
body .pet80-filters button[aria-pressed=true]{background:#286d50;color:#fff}
body .fl-avatar{background:#456578;color:#fff}
/* On an editorial hero with no photo, use the actual theme surface foreground. */
body.theme-preset-editorial .dash-hero.hero-decorated[data-hero-enabled="0"] :is(.dash-greeting,.dash-greeting h1,.dash-weather){color:var(--theme-text);text-shadow:none}
body.theme-preset-editorial .dash-hero.hero-decorated[data-hero-enabled="0"] .dash-weather{background:var(--theme-soft)}

/* CSP-compatible fixed member palette, matching the old selection colors. */
body .task-member[data-bec92-member="93c5fd"]{--member-color:#93c5fd}
body .task-member[data-bec92-member="c4b5fd"]{--member-color:#c4b5fd}
body .task-member[data-bec92-member="f9a8d4"]{--member-color:#f9a8d4}
body .task-member[data-bec92-member="f4b476"]{--member-color:#f4b476}
body .task-member[data-bec92-member="cbd5e1"]{--member-color:#cbd5e1}
body .task-member[data-bec92-member] .task-member-circle{color:#1e293b}
