/* Light layout stays unchanged. Lime is reserved for primary actions and indicators. */
:root{--brand:#d1f932;--brand-hover:#c4ec24;--on-brand:#1d2118;--selection-bg:#f5f9e9;--selection-text:#4d6200;--input-fill:#fff;--input-text:#202124}
.btn.primary:not(.danger),.send,.portal-tool.primary,.login-submit{background:var(--brand);border-color:var(--brand);color:var(--on-brand);filter:none}
.btn.primary:not(.danger):hover:not(:disabled),.send:hover:not(:disabled),.portal-tool.primary:hover:not(:disabled),.login-submit:hover:not(:disabled){background:var(--brand-hover);border-color:var(--brand-hover);color:var(--on-brand);filter:none;box-shadow:none}
.portal-tool.primary img{filter:brightness(0);opacity:1}
.login-submit:disabled{background:#b7c58d;color:#273219}
.login-submit[aria-busy=true]::before{border-color:#1d211840;border-top-color:var(--on-brand)}
input[type=checkbox],input[type=radio],input[type=range]{accent-color:var(--brand)}
::selection{background:var(--brand);color:var(--on-brand)}
:is(button,a,input,textarea,select):focus-visible{outline:2px solid var(--brand);outline-offset:2px}
input:focus,textarea:focus,select:focus{border-color:#829b18}
.login-form{--input-fill:#161719;--input-text:#f5f5f7}
.login-form input:focus{border-color:var(--brand);outline:2px solid var(--brand);outline-offset:2px;box-shadow:none}
.composer:focus-within,.radius-input:focus{border-color:#829b18;box-shadow:0 0 0 2px #d1f93233}
/* Reserve the focus ring inside the animated clipping region. */
#brandSearchWrap{padding-top:6px;padding-bottom:10px}
#brandSearch:focus{outline:2px solid var(--brand);outline-offset:2px;border-color:#829b18}
.modal :is(input,textarea,select):focus-visible,.lock-fields :is(input,textarea):focus-visible,.lock-close:focus-visible{outline-color:var(--brand)}
.login-shell button:focus-visible,.ap-toggle:focus-visible{outline-color:var(--brand)}
.radius-slider::-webkit-slider-thumb{background:var(--brand);box-shadow:none}
.radius-slider::-moz-range-thumb{background:var(--brand);box-shadow:none}
.daily-stat.selected,.radius-preset.active,.radius-inline-btn:hover,.mobile-nav .motion-selection{background:var(--selection-bg);border-color:#bbc98c;color:var(--selection-text)}
.daily-stat.selected strong,.mobile-nav.motion-tabs button.current{color:var(--selection-text)}
/* Paint over the browser autofill tint while retaining normal password-manager behavior. */
input:autofill,input:-webkit-autofill{box-shadow:0 0 0 1000px var(--input-fill) inset!important;-webkit-text-fill-color:var(--input-text)!important;caret-color:var(--input-text)}
.agentbtn.active,.navaction.current{box-shadow:inset 3px 0 var(--brand)}
.tabs .motion-selection,.mobile-nav .motion-selection{border-bottom:2px solid var(--brand)}
.tab.active{box-shadow:inset 0 -2px var(--brand)}
.progress:not(.blocked) span{background:var(--brand)}
.ap-step[data-step-state=running]{box-shadow:inset 3px 0 var(--brand)}

.theme-toggle{display:grid;place-items:center;width:36px;height:36px;flex:none;padding:7px;border:1px solid var(--line);border-radius:50%;background:transparent;color:var(--text);cursor:pointer}
.theme-toggle:hover{background:var(--surface-hover)}
.theme-toggle:focus-visible{outline:2px solid var(--brand);outline-offset:3px}
.theme-toggle svg{width:19px;height:19px;pointer-events:none}
.theme-sun{display:none}html[data-theme=dark] .theme-sun{display:block}html[data-theme=dark] .theme-moon{display:none}
.login-panel-tools{display:flex;align-items:center;gap:12px}
.login-panel .theme-toggle{color:#dfdfe4;border-color:#44464e}
.login-panel .theme-toggle:hover{background:#25272d}
html.theme-switching *,html.theme-switching *::before,html.theme-switching *::after{transition:none!important}

/* Dark surfaces are explicit; screenshots, brand colors and mascots are never filtered. */
html[data-theme=dark]{color-scheme:dark;--bg:#121316;--paper:#1b1d21;--deep:#292c32;--surface:#22252a;--surface-hover:#30343c;--text:#eeeef2;--muted:#b0b4bf;--line:#3b404a;--accent:#a5c6ff;--good:#83d5a5;--alert:#f0bd74;--bad:#ffaaa8;--card-shadow:none;--selection-bg:#30391d;--selection-text:#d1f932;--input-fill:#22252a;--input-text:#eeeef2}
html[data-theme=dark] .login-form{--input-fill:#22252a}
html[data-theme=dark] body,html[data-theme=dark] .app{background:var(--bg);color:var(--text)}
html[data-theme=dark] :is(.sidebar,.main,.panel,.gate,.lock-map,.lock-footer){background:var(--paper);border-color:var(--line);color:var(--text)}
html[data-theme=dark] :is(dialog,.modal,.lock-address-reminder,.lightbox-head,.lightbox-foot){background:var(--surface);color:var(--text);border-color:var(--line)}
html[data-theme=dark] :is(.query-group,.agentbtn.active,.agentbtn:hover,.navaction.current,.navaction:hover,.profile,.tabs.motion-tabs,.portal-tool,.event-tag,.inline-chip){background:var(--deep);color:var(--text)}
html[data-theme=dark] :is(.agent-list,.sectionline,.result-board,.board-cell,.daily-row,.audit-table td,.audit-table th){border-color:var(--line)}
html[data-theme=dark] :is(.agentbtn .name,.group-text strong,.profile strong,.lock-header h2,.lock-section h3,.lock-map h3){color:var(--text)}
html[data-theme=dark] :is(.detail,.topbar){background:var(--bg);color:var(--text)}
html[data-theme=dark] :is(.composer,.btn,.chip,.tab,.row,.daily-stat,.audit-scroll,.lock-fields .lock-store-row,.submitter-badge){background:var(--surface);border-color:var(--line);color:var(--text)}
html[data-theme=dark] :is(.btn:hover,.chip:hover,.tab.active,.daily-stat:hover,.circlebtn:hover){background:var(--surface-hover);border-color:var(--line);color:var(--text)}
html[data-theme=dark] :is(.message.user .bubble,.messages .card.agent-progress){background:var(--surface);border-color:var(--line);color:var(--text)}
html[data-theme=dark] :is(.bubble,.result-card.state-pending,.result-card.state-locked,.result-card.state-rejected){background:var(--deep);color:var(--text)}
html[data-theme=dark] :is(.card-sub,.hint,.sub,.navlabel,.breadcrumbs>span,.composefoot,.copyright,.record-note,.quota-freshness,.message:not(.user)::after){color:var(--muted)}
html[data-theme=dark] :is(.modal label,.row small,.empty,.pager,.intro p,.lock-header .lock-eyebrow,.lock-header .lock-eyebrow strong,.lock-section-heading .field-help){color:var(--muted)}
html[data-theme=dark] :is(input,textarea,select,.gate input,.modal input,.modal textarea,.modal select,.lock-fields input,.lock-fields textarea,#brandSearch){background:var(--surface);border-color:var(--line);color:var(--text)}
html[data-theme=dark] :is(input,textarea)::placeholder{color:#a3a8b3}
html[data-theme=dark] :is(.daily-stat.selected,.radius-preset.active,.radius-inline-btn:hover,.mobile-nav .motion-selection){background:var(--selection-bg);border-color:#687c2a;color:var(--selection-text)}
html[data-theme=dark] .motion-selection{background:var(--surface-hover);border-color:var(--line);border-bottom-color:var(--brand)}
html[data-theme=dark] :is(.profileicon,.submitter-avatar){background:#2e3a50;color:var(--accent);box-shadow:none}
html[data-theme=dark] :is(.location-preview,.pending-tasks){background:#253246;border-color:#526782;color:var(--text)}
html[data-theme=dark] :is(.notice,.location-preview[data-state=fallback],.badge.unknown,.badge.bad,.row .tag.unknown,.row .tag.bad){background:#3c3021;border-color:#8d6b3e;color:var(--alert)}
html[data-theme=dark] :is(.notice.bad,.location-preview.bad,.badge.err,.row .tag.err,.conflict-item,.ap-step[data-step-state=failed]){background:#3e2529;border-color:#975a60;color:var(--bad)}
html[data-theme=dark] :is(.badge.ok,.row .tag.ok,.event-tag.locked,.lock-summary){background:#20392d;border-color:#4c8263;color:var(--good)}
html[data-theme=dark] .verdict{color:var(--good)}html[data-theme=dark] .verdict.bad{color:var(--bad)}html[data-theme=dark] .verdict.unknown{color:var(--alert)}
html[data-theme=dark] :is(.btn.danger,.modal .err,.kv b.bad){color:var(--bad)}
html[data-theme=dark] :is(.lock-radius-badge,.lock-nearest){background:#30543e;color:#e3f5e8}
html[data-theme=dark] .lock-status-row>b{color:var(--good)}
html[data-theme=dark] .lock-header,html[data-theme=dark] .lock-footer,html[data-theme=dark] .lock-submitter{border-color:var(--line)}
html[data-theme=dark] :is(.lock-close,.ap-collapse-icon){background:var(--surface-hover);color:var(--text)}
html[data-theme=dark] .ap-step[data-step-state=running]{background:var(--surface);border-color:var(--line);color:var(--text)}
html[data-theme=dark] .ap-step[data-step-state=done]{color:#b6d1c1}
html[data-theme=dark] .ap-step[data-step-state=pending]{color:var(--muted)}
html[data-theme=dark] :is(.ap-overall[data-step-state=done],.ap-step[data-step-state=done] .ap-marker){background:#3c5548}
html[data-theme=dark] :is(.progress,.quota-bar,.radius-slider){background:#3a404b}
html[data-theme=dark] :is(.portal-tool img,.circlebtn img,.group-chevron,.ap-marker img,.ap-collapse-icon img){filter:brightness(0) invert(1);opacity:.8}
html[data-theme=dark] :is(.shot,.lock-map .shot){background:#fff;border-color:var(--line)}
html[data-theme=dark] .audit-table th{background:var(--paper)}

/* Dark mode uses the approved lime logotype and charcoal coffee fill. */
html[data-theme=dark] .login-wordmark{content:url('/icons/flowworks-coffee-loop-dark.svg')}
html[data-theme=dark] .startup-brand>img{content:url('/icons/flowworks-coffee-animated-dark.svg')}
html[data-theme=dark] .startup-splash{background:#151619;color:var(--text)}
html[data-theme=dark] .startup-brand>p{color:var(--muted)}
html[data-theme=dark] :is(.startup-skip,.startup-retry){background:var(--surface);color:var(--text);border-color:var(--line)}
html[data-theme=dark] .login-artwork{background:#1b1d21;color:var(--text)}
html[data-theme=dark] :is(.login-intro h1,.login-brand-name){color:var(--text)}
html[data-theme=dark] :is(.login-eyebrow,.login-intro p,.login-brands){color:var(--muted)}

/* Keep dark overrides from changing the approved primary-button contrast. */
html[data-theme=dark] :is(.btn.primary:not(.danger),.send,.portal-tool.primary){background:var(--brand);border-color:var(--brand);color:var(--on-brand)}
html[data-theme=dark] :is(.btn.primary:not(.danger),.send,.portal-tool.primary):hover:not(:disabled){background:var(--brand-hover);border-color:var(--brand-hover);color:var(--on-brand)}
html[data-theme=dark] .portal-tool.primary img{filter:brightness(0);opacity:1}
@media(max-width:720px){.topright .theme-toggle{width:32px;height:36px;padding:6px}#brandSearchWrap{padding:6px;background:var(--paper)}}
