/* Shared surfaces, including native form controls, follow the chosen theme. */
:root{color-scheme:light;--surface:#fff;--soft:#edf3e7;--field:#fff;--focus:#986b22}
:root[data-theme=dark]{color-scheme:dark;--ink:#e3eee7;--muted:#a8b9af;--green:#8bcba9;--lime:#deedbe;--line:#36493f;--paper:#15231d;--surface:#1e3027;--soft:#293e32;--field:#192a22;--red:#ff9d90;--orange:#ebbc79;--focus:#e1bc72}
.header-actions{display:flex;align-items:center;gap:12px}
.theme-toggle{display:grid;place-items:center;flex:0 0 44px;width:44px;height:44px;padding:10px;background:var(--soft);color:var(--ink);border:1px solid var(--line)}
.theme-toggle svg{width:22px;height:22px;fill:none;stroke:currentColor;stroke-width:1.7;stroke-linecap:round;stroke-linejoin:round}
.theme-sun{display:none}[data-theme=dark] .theme-sun{display:block}[data-theme=dark] .theme-moon{display:none}
:focus-visible{outline:3px solid var(--focus);outline-offset:3px}
/* Labels and controls share a baseline; dates never compete for a narrow flex slot. */
.page-heading{flex-wrap:wrap;align-items:flex-end}
.page-heading>div{flex:1 1 260px}
.period{display:grid;grid-template-columns:minmax(175px,1.3fr) repeat(2,minmax(145px,1fr)) auto;align-items:end;gap:10px;max-width:none;width:100%;flex:1 1 570px}
.period>label{min-width:0;margin:0;font-size:11px;line-height:1.4}
.period input,#flexMonth{width:100%;min-width:0;max-width:none;height:44px;margin:6px 0 0;padding:10px;font-size:13px;font-variant-numeric:tabular-nums}
.period button{height:44px;padding:10px 14px;white-space:nowrap}
[data-theme=dark] :is(aside,header,.card,.panel,dialog,.login-card,.report-download){background:var(--surface)}
[data-theme=dark] :is(input,select,textarea){background:var(--field);border-color:var(--line)}
[data-theme=dark] button{background:#285f47;color:#f3f8f4}
[data-theme=dark] :is(.secondary,.choice button,.theme-toggle){background:var(--soft);color:var(--ink)}
[data-theme=dark] :is(.ghost,.text-link,.bar-link){background:transparent;color:var(--green)}
[data-theme=dark] nav a{color:var(--muted)}
[data-theme=dark] :is(nav a.active,.business-total,.owner-orientation,.badge,.entry-progress .current,.review-path){background:var(--soft);color:var(--green);border-color:var(--line)}
[data-theme=dark] :is(.card.primary-card,.choice button.selected,.chart-switch [aria-pressed=true]){background:#285f47;color:#fff;border-color:#367257}
[data-theme=dark] :is(th,pre,.entry-choice,.entry-context,.extended-report,.expense-event,.entry-progress span){background:#23382c;color:var(--ink);border-color:var(--line)}
[data-theme=dark] :is(td,.summary-row,.entry-actions){border-color:var(--line)}
[data-theme=dark] tbody tr:hover{background:#2b4234}
[data-theme=dark] :is(.entry-choice:hover,.entry-choice:focus-visible){background:#304b38;border-color:var(--green)}
[data-theme=dark] :is(.owner-orientation p,.report-intro p,.entry-choice span,.field-hint,.review-description,.readable-bars .bar-label strong small,.cash-equation small,.expense-event small,.pending-value,.cell-note,footer){color:var(--muted)}
[data-theme=dark] :is(.alert,.method-note,.badge.warn){background:#3b3222;border-color:#80673e;color:#f0cf98}
[data-theme=dark] .alert.good{background:#283f2d;border-color:#456b4b;color:#b9dca4}
[data-theme=dark] .badge.bad{background:#492e2a;color:var(--red)}
[data-theme=dark] .tag{background:#3e432a;color:#d8dda5}
[data-theme=dark] .bar-track{background:#344b3c}
[data-theme=dark] .bar-fill{background:#83af82}
[data-theme=dark] .field-help>summary{background:#293e32;color:var(--ink);border-color:#77927d}
[data-theme=dark] .help-popover{background:#dcebdd;color:#193325}
[data-theme=dark] #toast{background:#dcebdd;color:#193325}
[data-theme=dark] .chart line{stroke:var(--line)}
[data-theme=dark] .chart polyline[stroke="#367257"]{stroke:#8bcba9}
@media(max-width:1150px){.period{flex:auto}.page-heading>div{flex:initial}}
@media(max-width:950px){
 .period{grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}
 .period .month-field,.period button{grid-column:1/-1}
 .period input{padding:10px 8px}
 .header-actions{gap:8px}
}
@media(max-width:359px){.period{grid-template-columns:minmax(0,1fr)}header{padding:0 12px}header .primary{padding:10px 8px}.header-actions{gap:6px}}
