/* Tema local: cores dos escritórios permanecem nos indicadores e bordas. */
:root{color-scheme:light;--paper:#fff;--theme-text:#20332d;--theme-surface:#fff;--theme-soft:#edf2e9;--theme-focus:#517d61}
html[data-theme=dark]{color-scheme:dark;--bg:#111b18;--paper:#1a2823;--green:#2e7058;--muted:#b7c8bf;--line:#3b5147;--theme-text:#edf4ee;--ink:#edf4ee;--theme-surface:#1a2823;--theme-soft:#24392f;--theme-focus:#aed6b7;--theme-warning:#ffcf99;--theme-error:#ffb7a6;--theme-success:#b4e2c0}
.themeControl{display:grid;grid-template-columns:auto minmax(0,1fr);align-items:center;gap:8px;margin:0 0 22px;max-width:230px}
.themeControl label{font-size:12px;color:var(--muted);margin:0;display:block}
.themeControl select{font:13px system-ui;box-sizing:border-box;max-width:100%;min-width:0;width:100%;padding:8px 9px;margin:0;border:1px solid var(--line);border-radius:8px;background:var(--theme-surface);color:var(--theme-text)}
.themeNote{position:absolute!important;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}
aside .brand:has(+.themeControl){margin-bottom:20px}
html[data-theme=dark] body{background:var(--bg);color:var(--theme-text)}
html[data-theme=dark] :is(aside,nav,dialog,.panel,.integration,.startGuide,.nextActionPanel,.quick,.weekday,#caseList,#globalSearchRecord,.actions,#feeDialog .actions){background:var(--theme-surface)!important;color:var(--theme-text);border-color:var(--line)!important}
html[data-theme=dark] body:not(:has(aside))>main{background:var(--theme-surface);border-color:var(--line)}
html[data-theme=dark] :is(input,select,textarea,button){background:var(--theme-surface)!important;color:var(--theme-text)!important;border-color:var(--line)!important}
html[data-theme=dark] :is(input,textarea)::placeholder{color:#a8b9af;opacity:1}
html[data-theme=dark] :is(input,select,textarea,button,a,summary):focus-visible{outline:3px solid var(--theme-focus)!important;outline-offset:3px}
html[data-theme=dark] :is(button:hover,.task .tiny:hover,.globalSearchHit:hover){background:#2e473b!important}
html[data-theme=dark] :is(.primary,nav button.active,.filters button.selected,#toast){background:#2e7058!important;color:#fff!important;border-color:#569e7e!important}
html[data-theme=dark] :is(.primary:hover,nav button.active:hover){background:#388064!important}
html[data-theme=dark] :is(p,.sub,.helper,.time,.empty,.footer,.taskgroup,.weekempty,.caseNote,.nextSnippet,.themeControl label){color:var(--muted)}
html[data-theme=dark] :is(h1,h2,h3,h4,dt,dd,strong,label,legend,summary){color:inherit}
html[data-theme=dark] .brand{color:#c3e5d0}
html[data-theme=dark] .brand img{filter:brightness(0) saturate(100%) invert(95%) sepia(8%) saturate(330%) hue-rotate(70deg)}
html[data-theme=dark] :is(.eventbody,.weekevent){background:var(--theme-soft)!important;color:var(--theme-text)!important;border-left-color:var(--context,#84bc9c)!important}
html[data-theme=dark] :is(.tag,.caseBadge,.repeatBadge,.documentStatus.approved){background:#294e3c!important;color:var(--theme-success)!important}
html[data-theme=dark] :is(.tag.office,.caseBadge.office){background:#353447!important;color:#e3d9ff!important}
html[data-theme=dark] :is(.documentStatus,.nextBadge,.draftNotice){background:#493d25!important;color:var(--theme-warning)!important}
html[data-theme=dark] .documentStatus.approved{background:#294e3c!important;color:var(--theme-success)!important}
html[data-theme=dark] :is(.documentStatus.correction,.captureFeedback .error,.taskError,#formError:not(:empty),#caseFormError:not(:empty),#planError:not(:empty),#documentError:not(:empty),#feeError:not(:empty),#feeReviewError:not(:empty),#checklistError:not(:empty),#generateError:not(:empty),#message:not(:empty)){background:#482e29!important;color:var(--theme-error)!important;border-radius:8px}
html[data-theme=dark] :is(.late,.feeWarning,.nextMissing,#feeReviewPending){color:var(--theme-error)!important}
html[data-theme=dark] :is(.gap,.checklistRowEditor,.documentSummary,fieldset){border-color:var(--line)!important}
html[data-theme=dark] :is(.gap,#suggest){background:var(--theme-soft)!important;color:var(--theme-text)!important}
html[data-theme=dark] .contextFilter{border:1px solid var(--context,var(--line))!important}
html[data-theme=dark] .contextDot{box-shadow:0 0 0 1px #cad7cf}
html[data-theme=dark] a{color:#b2ddc8}
html[data-theme=dark] dialog::backdrop{background:#050b09a8}
html[data-theme=dark] body>div[role=status]:not(#toast){background:#234d3e!important;color:#f4fff7!important}
html[data-theme=dark] #feeExportDialog{background:var(--bg)!important}
/* A proposta é uma folha de conferência: preserva o papel claro e as cores de impressão. */
html[data-theme=dark] .proposalSheet{background:#fff!important;color:#20352d!important;color-scheme:light}
html[data-theme=dark] .proposalSheet :is(p,.muted){color:#59685f}
html[data-theme=dark] .proposalSheet a{color:#194d3e}
@media(max-width:760px){aside:has(.themeControl){display:flex;align-items:center;justify-content:space-between;gap:14px;flex-wrap:wrap}aside .brand:has(+.themeControl){margin:0;min-width:0}aside .themeControl{margin:0;max-width:145px;gap:4px;grid-template-columns:1fr}aside .themeControl label{font-size:10px}aside .themeControl select{font-size:12px;padding:7px 8px;min-width:100px}html[data-theme=dark] .done{opacity:.8}}
@media(prefers-reduced-motion:reduce){.themeControl *{transition:none!important}}
html[data-theme=dark] :is(.documentStatus.received,.documentStatus.review){background:#243d54!important;color:#c6e0ff!important}
html[data-theme=dark] :is(.caseOverview,.caseOverviewCard){background:var(--theme-surface)!important;color:var(--theme-text);border-color:var(--line)!important}
html[data-theme=dark] .caseOverview{background:#15231d!important}
html[data-theme=dark] .caseOverviewCard progress{accent-color:#8ecaa6}
html[data-theme=dark] :is(.overviewAttention,#agendaStatus.agendaError p){color:var(--theme-error)!important}
html[data-theme=dark] #agendaStatus.agendaError{border-color:#d38b77!important}
html[data-theme=dark] .caseSectionTarget:focus{outline-color:var(--theme-focus)!important}

/* Alvos confortáveis em telas de toque; sem mudar as cores dos contextos. */
@media(max-width:760px){#themeMode,.task .tiny,.filters button,.date button,.date input,nav button{min-height:44px}.actions button{min-height:44px}html[data-theme=dark] .contextFilter:not(.selected){color:var(--theme-text)!important}}

.themeModes{display:flex;gap:3px;padding:3px;border:1px solid var(--line);border-radius:24px;background:var(--theme-surface)}.themeModes button{display:grid;place-items:center;width:38px;height:38px;padding:0;border:0;border-radius:50%;background:transparent;color:var(--theme-text);cursor:pointer}.themeModes button[aria-pressed=true]{background:#dce8df;color:#173f35;box-shadow:0 1px 3px #173f3520}html[data-theme=dark] .themeModes button[aria-pressed=true]{background:#355d49!important;color:#edf4ee!important}.themeControl select[hidden]{display:none!important}@media(max-width:760px){.themeModes button{width:44px;height:44px}.themeModes{gap:0}.themeControl{max-width:none}}

/* Preserve a semântica dos alertas, inclusive em botões e seus rótulos. */
html[data-theme=dark]{--theme-error:#ff9b91}
html[data-theme=dark] .dailySummaryGrid button.dailyUrgent{border-left:4px solid var(--theme-error)!important;background:#342624!important}
html[data-theme=dark] .dailySummaryGrid .dailyUrgent :is(span,strong){color:var(--theme-error)!important}
html[data-theme=dark] #dailyOverdue>.panelhead h2{color:var(--theme-error)!important}
html[data-theme=dark] :is(.late,.feeWarning,.nextMissing,.overviewAttention){color:var(--theme-error)!important}
html[data-theme=dark] #captureContexts button[aria-pressed=true]{border-color:var(--context)!important;background:#294237!important;color:#edf4ee!important}
html[data-theme=dark] :is(#cancelOccurrence,.danger,button.taskError){background:#482e29!important;color:var(--theme-error)!important;border-color:#dd8077!important}
