/* One control in every shell. Operational cards keep their existing theme tokens. */
:root{color-scheme:light;--theme-surface:#fff;--theme-text:#22352b;--theme-line:#d9e2db;--theme-hover:#e8f1eb}
:root[data-theme=dark]{color-scheme:dark;--theme-surface:#1b231e;--theme-text:#e4ece7;--theme-line:#354238;--theme-hover:#243d2e}
.platform-tools{display:flex;align-items:center;gap:6px;flex:none;max-width:100%}
.platform-tools .system-switch{margin:0;min-width:0;font-size:13px}
.platform-tools .system-switch>summary{padding-inline:9px;white-space:nowrap}
button.theme-toggle{display:inline-flex;align-items:center;justify-content:center;flex:none;width:44px;height:44px;min-height:44px;padding:0;border:1px solid var(--theme-line);border-radius:8px;background:var(--theme-surface);color:var(--theme-text);font:24px/1 system-ui,sans-serif;cursor:pointer}
button.theme-toggle:hover{background:var(--theme-hover)}
button.theme-toggle:focus-visible{outline:3px solid #d5ac63;outline-offset:2px}
#app>aside>.platform-tools,#structure-app>aside>.platform-tools{margin-top:16px}
.auth-heading{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:24px}
.auth .auth-heading .brand{margin-bottom:0}
@media(max-width:850px){#app>aside>.platform-tools{margin:0 0 0 auto}}
@media(max-width:700px){#structure-app>aside>.platform-tools{margin:0 0 0 auto}}

/* The non-operational shells share the Orders palette, with white text on green actions. */
:root[data-ui=platform]{--text:var(--ink);--bg:var(--canvas);--action:#247448;--action-hover:#1b5e39}
:root[data-ui=platform][data-theme=dark]{--accent:#8ed3ad;--accent-hover:#b2e5c6;--surface:#1b231e;--canvas:#131916;--ink:#e4ece7;--muted:#a4b2a8;--line:#354238;--tint:#243d2e;--danger:#ffabae;--action:#267248;--action-hover:#1d603b}
:root[data-ui=platform][data-theme=dark] :is(button,.button){background:var(--action)}
:root[data-ui=platform][data-theme=dark] :is(button,.button):hover{background:var(--action-hover)}
:root[data-ui=platform][data-theme=dark] :is(button.secondary,.button.secondary,.close){background:var(--tint);color:var(--ink)}
:root[data-ui=platform][data-theme=dark] :is(button.secondary,.button.secondary,.close):hover{background:var(--tint);outline:1px solid var(--line)}
:root[data-ui=platform][data-theme=dark] #structure-app .button.secondary:hover{background:var(--tint)}
:root[data-ui=platform][data-theme=dark] :is(input,textarea)::placeholder{color:var(--muted);opacity:1}
:root[data-ui=platform][data-theme=dark] :is(.linkbutton,.text-button,.permission-heading>button,.checklist-back,.checklist-refresh,.checklist-blocked button){background:transparent;color:var(--ink)}
:root[data-ui=platform][data-theme=dark] :is(.structure-nav a[aria-current=page],.archive-filters a[aria-current=page],#navigation>a.active,#navigation>button.active,.learning-tabs .active,.checklist-tabs .active){background:var(--action);color:#fff}
:root[data-ui=platform][data-theme=dark] #navigation>:not(.active){background:transparent;color:var(--ink)}
:root[data-ui=platform][data-theme=dark] #navigation>:not(.active):hover{background:var(--tint)}
:root[data-ui=platform][data-theme=dark] .checklist-task-open{background:transparent;color:var(--ink)}
:root[data-ui=platform][data-theme=dark] .checklist-task.is-available{background:var(--action);border-color:var(--action)}
:root[data-ui=platform][data-theme=dark] .checklist-task.is-available :is(.checklist-task-open,.checklist-task-status,.checklist-task-due){color:#fff}
:root[data-ui=platform][data-theme=dark] .checklist-task.is-available .checklist-task-open:hover{background:var(--action-hover)}
:root[data-ui=platform][data-theme=dark] button.theme-toggle{background:var(--theme-surface);color:var(--theme-text)}
:root[data-ui=platform][data-theme=dark] button.theme-toggle:hover{background:var(--theme-hover)}
:root[data-ui=platform][data-theme=dark] .card,:root[data-ui=platform][data-theme=dark] dialog{background:var(--surface);color:var(--ink)}

/* Older learning and task components still contain light-only colours. */
:root[data-ui=platform][data-theme=dark] :is(.muted,.eyebrow,.sidebar-bottom,.empty,.checklist-progress,.checklist-filter-details,.checklist-execution-details,.checklist-optional-photo,.checklist-completed,.checklist-item-detail .checklist-camera>p:first-child){color:var(--muted)}
:root[data-ui=platform][data-theme=dark] :is(.demo,.badge,.exam-history-sides>section,.checklist-blocked){background:var(--tint);color:var(--ink)}
:root[data-ui=platform][data-theme=dark] :is(.alert,.danger,.course-actions>button:last-child){background:#462529!important;color:var(--danger)!important;border-color:#75434a}
:root[data-ui=platform][data-theme=dark] .success{background:var(--tint);color:var(--accent)}
:root[data-ui=platform][data-theme=dark] :is(hr,.check-list,.exam-author-test,.exam-summary,.exam-author-question,.exam-question,.exam-options-editor,.exam-choices label,.exam-review-change,.checklist-editor-item,.checklist-version,.checklist-pages button,.checklist-photo,.checklist-dependencies,.checklist-item-detail.card,.checklist-execution-details){border-color:var(--line)}
:root[data-ui=platform][data-theme=dark] :is(.checklist-flow-header .checklist-form,.checklist-item-open,.checklist-check,.checklist-item-detail .checklist-camera video,.checklist-item-detail .checklist-camera img){background:var(--surface);color:var(--ink);border-color:var(--line)}
:root[data-ui=platform][data-theme=dark] .checklist-item-open:hover{background:var(--tint);border-color:var(--accent)}
:root[data-ui=platform][data-theme=dark] .checklist-item-detail .checklist-camera .inline-actions>button:first-child{background:var(--surface);color:var(--accent)}
:root[data-ui=platform][data-theme=dark] .checklist-task.is-in-progress{background:#42371f;border-color:#796137}
:root[data-ui=platform][data-theme=dark] .checklist-task.is-in-progress :is(.checklist-task-open,.checklist-task-status,.checklist-task-due){color:#f1cd86}
:root[data-ui=platform][data-theme=dark] .checklist-task.is-in-progress .checklist-task-open:hover{background:#504227}
:root[data-ui=platform][data-theme=dark] .checklist-task.is-completed{background:var(--tint);border-color:#42674d}
:root[data-ui=platform][data-theme=dark] .checklist-task.is-completed :is(.checklist-task-open,.checklist-task-title,.checklist-task-status,.checklist-task-arrow,.checklist-task-due){color:var(--accent)}
:root[data-ui=platform][data-theme=dark] .checklist-task.is-completed .checklist-task-open:hover{background:#2c4937}
:root[data-ui=platform][data-theme=dark] :is(.checklist-task.is-blocked,.checklist-task.is-cancelled){background:#252c28;border-color:var(--line)}
:root[data-ui=platform][data-theme=dark] :is(.checklist-task.is-blocked,.checklist-task.is-cancelled) :is(.checklist-task-open,.checklist-task-status){color:var(--muted)}
:root[data-ui=platform][data-theme=dark] :is(.checklist-task.is-blocked .checklist-task-arrow,.checklist-task.is-blocked .checklist-task-arrow::before){border-color:var(--muted)}
:root[data-ui=platform][data-theme=dark] :is(.checklist-finished,.checklist-item-row.is-completed .checklist-item-title){color:var(--accent)}
:root[data-ui=platform][data-theme=dark] .checklist-item-row.is-completed .checklist-check{background:var(--action);border-color:var(--action);color:#fff}
:root[data-ui=platform][data-theme=dark] .structure-badge.preparing{background:#42371f;color:#f1cd86}
