/* Sentinel light/dark appearance shared by SOC Web and Sentinel Local. */
:root {
    --color-primary: var(--s-gold-light);
    --text-primary: var(--s-text-primary);
    --text-secondary: var(--s-text-secondary);
    --bg-body: var(--s-bg-primary);
    --bg-card: var(--s-bg-secondary);
    --bg-surface: #14263a;
    --border-color: var(--s-border);
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-xl: 18px;
}

html[data-theme="light"] {
    --s-bg-primary: #edf2f6;
    --s-bg-secondary: #ffffff;
    --s-bg-panel: rgba(255, 255, 255, .92);
    --s-text-primary: #102638;
    --s-text-secondary: #536b7e;
    --s-border: rgba(28, 62, 88, .18);
    --s-shadow: 0 14px 34px rgba(24, 54, 76, .11);
    --color-primary: #9b7b00;
    --text-primary: #102638;
    --text-secondary: #536b7e;
    --bg-body: #edf2f6;
    --bg-card: #ffffff;
    --bg-surface: #f4f7f9;
    --border-color: rgba(28, 62, 88, .18);
}

.scc-theme-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-width: 92px;
    min-height: 38px;
    padding: 7px 10px;
    border: 1px solid rgba(216, 176, 0, .42);
    border-radius: 999px;
    color: #f4d64c;
    background: rgba(216, 176, 0, .07);
    cursor: pointer;
    font: inherit;
    font-size: 10px;
    font-weight: 850;
    letter-spacing: .08em;
}

.scc-theme-toggle:hover,
.scc-theme-toggle:focus-visible {
    border-color: #f0cc33;
    background: rgba(216, 176, 0, .14);
    outline: none;
}

.scc-theme-toggle__icon,
.scc-theme-toggle__icon svg {
    width: 18px;
    height: 18px;
}

.scc-theme-toggle__icon svg {
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.scc-theme-toggle__sun { display: none; }
.scc-theme-toggle__moon { display: block; }
html[data-theme="light"] .scc-theme-toggle__sun { display: block; }
html[data-theme="light"] .scc-theme-toggle__moon { display: none; }

html[data-theme="light"] body,
html[data-theme="light"] #app,
html[data-theme="light"] .scc-shell,
html[data-theme="light"] .scc-content {
    color: var(--s-text-primary);
    background: var(--s-bg-primary);
}

/* The navy header and navigation rail remain the high-contrast brand frame. */
html[data-theme="light"] .scc-header {
    background: rgba(7, 17, 29, .97);
    box-shadow: 0 8px 24px rgba(28, 54, 74, .14);
}

html[data-theme="light"] .operation-context {
    color: var(--text-primary);
    background: #ffffff;
    box-shadow: 0 7px 18px rgba(24, 54, 76, .07);
}

html[data-theme="light"] .operation-context__status,
html[data-theme="light"] .operation-context__selector select {
    color: var(--text-primary);
    background: #f4f7f9;
}

html[data-theme="light"] .s-panel,
html[data-theme="light"] .s-card {
    color: var(--text-primary);
    background: #ffffff;
}

/* Dashboard */
html[data-theme="light"] .dashboard-layout {
    --dashboard-surface: rgba(255, 255, 255, .96);
    --dashboard-surface-soft: #f2f6f8;
    --dashboard-border: rgba(28, 62, 88, .16);
    --dashboard-border-accent: rgba(155, 123, 0, .4);
    --dashboard-text: #102638;
    --dashboard-muted: #617789;
    --dashboard-accent: #9b7b00;
    --dashboard-success: #087a50;
    --dashboard-warning: #9b6900;
    --dashboard-error: #b52e3a;
}

html[data-theme="light"] .dashboard-card,
html[data-theme="light"] .scc-command-panel,
html[data-theme="light"] .team-unit,
html[data-theme="light"] .metric,
html[data-theme="light"] .command-event {
    box-shadow: 0 12px 28px rgba(24, 54, 76, .08);
}

html[data-theme="light"] .team-unit {
    background: #f7f9fb;
}

html[data-theme="light"] .team-unit.is-nd {
    background: linear-gradient(145deg, rgba(218, 56, 68, .08), #fff);
}

html[data-theme="light"] .team-unit.is-operational {
    background: linear-gradient(145deg, rgba(8, 122, 80, .09), #fff);
}

html[data-theme="light"] .map-card .leaflet-control-layers {
    color: #102638;
    background: rgba(255, 255, 255, .96);
}

/* Shared workspace pages: map, archive, assets, resources and downloads. */
html[data-theme="light"] .workspace-page {
    --workspace-surface: rgba(255, 255, 255, .97);
    --workspace-soft: #f3f6f8;
    --workspace-border: rgba(28, 62, 88, .16);
    --workspace-accent: #9b7b00;
    --workspace-text: #102638;
    --workspace-muted: #617789;
}

html[data-theme="light"] .workspace-panel,
html[data-theme="light"] .workspace-operation-item,
html[data-theme="light"] .workspace-definition-list > div,
html[data-theme="light"] .workspace-resource-card,
html[data-theme="light"] .workspace-log-item {
    box-shadow: 0 12px 28px rgba(24, 54, 76, .08);
}

html[data-theme="light"] .workspace-button--secondary {
    color: #795f00;
    background: rgba(155, 123, 0, .08);
}

html[data-theme="light"] .workspace-map-overlay-menu__content,
html[data-theme="light"] .workspace-feature-editor,
html[data-theme="light"] .workspace-dialog {
    color: #102638;
    background: #ffffff;
}

/* Forms and operational dialogs. */
html[data-theme="light"] :where(
    .workspace-page,
    .operation-dialog,
    .team-position-dialog,
    .team-asset-dialog,
    .team-telemetry-dialog,
    .asset-dialog,
    .messaging-compose,
    .local-card,
    .intelligence-page
) :where(input, select, textarea) {
    border-color: rgba(28, 62, 88, .24);
    color: #102638;
    background: #ffffff;
}

html[data-theme="light"] :where(select, option) {
    color: #102638;
    background-color: #ffffff;
}

html[data-theme="light"] .operation-dialog,
html[data-theme="light"] .team-position-dialog,
html[data-theme="light"] .team-asset-dialog,
html[data-theme="light"] .team-telemetry-dialog,
html[data-theme="light"] .team-command-feedback-dialog,
html[data-theme="light"] .asset-dialog,
html[data-theme="light"] .scc-logout-dialog {
    border-color: rgba(155, 123, 0, .35);
    color: #102638;
    background: #ffffff;
    box-shadow: 0 24px 70px rgba(24, 54, 76, .24);
}

html[data-theme="light"] :where(
    .operation-dialog,
    .team-position-dialog,
    .team-asset-dialog,
    .team-telemetry-dialog,
    .team-command-feedback-dialog,
    .asset-dialog,
    .scc-logout-dialog
) :where(h1, h2, h3, strong) {
    color: #102638;
}

html[data-theme="light"] .scc-logout-dialog p:not(.scc-logout-dialog__kicker) {
    color: #536b7e;
}

html[data-theme="light"] .scc-logout-dialog__cancel {
    border-color: rgba(28, 62, 88, .2);
    color: #102638;
    background: #f1f5f7;
}

/* Messaging */
html[data-theme="light"] .messaging-shell { color: #102638; }
html[data-theme="light"] .messaging-heading p,
html[data-theme="light"] .messaging-compose label,
html[data-theme="light"] .messaging-message time,
html[data-theme="light"] .messaging-message__state { color: #617789; }
html[data-theme="light"] .messaging-compose,
html[data-theme="light"] .messaging-conversation {
    border-color: rgba(28, 62, 88, .18);
    background: #ffffff;
    box-shadow: 0 14px 34px rgba(24, 54, 76, .09);
}
html[data-theme="light"] .messaging-message {
    border-color: rgba(28, 62, 88, .18);
    color: #102638;
    background: #eef5fb;
}
html[data-theme="light"] .messaging-message.is-outbound { background: #f8f4dc; }
html[data-theme="light"] .messaging-message.is-transit { background: #f1f4f6; }
html[data-theme="light"] .messaging-message__route strong { color: #102638; }

/* MEDEVAC */
html[data-theme="light"] .medevac-page { color: #102638; }
html[data-theme="light"] .medevac-page-header,
html[data-theme="light"] .medevac-toolbar,
html[data-theme="light"] .medevac-card {
    color: #102638;
    background: #ffffff;
    box-shadow: 0 12px 28px rgba(24, 54, 76, .08);
}
html[data-theme="light"] .medevac-page-header h1,
html[data-theme="light"] .medevac-current-operation strong,
html[data-theme="light"] .medevac-card h2,
html[data-theme="light"] .medevac-finding strong,
html[data-theme="light"] .medevac-profile dd,
html[data-theme="light"] .medevac-march dd,
html[data-theme="light"] .medevac-empty strong { color: #102638; }
html[data-theme="light"] .medevac-card > header,
html[data-theme="light"] .medevac-finding div,
html[data-theme="light"] .medevac-profile,
html[data-theme="light"] .medevac-score,
html[data-theme="light"] .medevac-march section,
html[data-theme="light"] .medevac-status-panel,
html[data-theme="light"] .medevac-status-history li { background: #f3f6f8; }

/* Intelligence catalog */
html[data-theme="light"] .intelligence-page { color: #102638; }
html[data-theme="light"] .intelligence-header p,
html[data-theme="light"] .intelligence-notice p,
html[data-theme="light"] .intelligence-category > header p,
html[data-theme="light"] .intelligence-source-card__provider { color: #617789; }
html[data-theme="light"] .intelligence-summary > div,
html[data-theme="light"] .intelligence-filter,
html[data-theme="light"] .intelligence-source-card,
html[data-theme="light"] .intelligence-profile-card,
html[data-theme="light"] .intelligence-profile-editor,
html[data-theme="light"] .intelligence-operation-source-editor,
html[data-theme="light"] .intelligence-observations,
html[data-theme="light"] .intelligence-map-controller {
    border-color: rgba(28, 62, 88, .16);
    color: #102638;
    background: #ffffff;
    box-shadow: 0 12px 28px rgba(24, 54, 76, .07);
}
html[data-theme="light"] .intelligence-operation-source,
html[data-theme="light"] .intelligence-observation,
html[data-theme="light"] .intelligence-source-card__facts div {
    color: #102638;
    background: #f3f6f8;
}

/* Administration and LAB pages contain older fixed dark palettes. */
html[data-theme="light"] .access-shell {
    --text-primary: #102638;
    --text-secondary: #617789;
    --bg-body: #edf2f6;
    --bg-card: #ffffff;
    --bg-surface: #f3f6f8;
    --border-color: rgba(28, 62, 88, .18);
}
html[data-theme="light"] .access-card,
html[data-theme="light"] .access-metric,
html[data-theme="light"] .access-user,
html[data-theme="light"] .access-facts div,
html[data-theme="light"] .access-association,
html[data-theme="light"] .access-association-form {
    color: #102638;
    background: #ffffff;
}
html[data-theme="light"] .access-card :where(h2, h3),
html[data-theme="light"] .access-detail-header h2,
html[data-theme="light"] .access-metric strong { color: #102638; }
html[data-theme="light"] .access-form :where(input, select),
html[data-theme="light"] .access-button {
    border-color: rgba(28, 62, 88, .24);
    color: #102638;
    background: #f3f6f8;
}
html[data-theme="light"] .access-button--primary { color: #07111d; background: #f0cc33; }

html[data-theme="light"] :where(.field-experiment-shell, .page-access-shell) { color: #102638; }
html[data-theme="light"] :where(.field-experiment-card, .page-access-card, .page-access-notice) {
    border-color: rgba(28, 62, 88, .2);
    color: #102638;
    background: #ffffff;
}
html[data-theme="light"] :where(.field-experiment-heading p, .field-experiment-card p, .page-access-heading p, .page-access-card p) { color: #617789; }
html[data-theme="light"] :where(.field-experiment-switch, .field-experiment-team, .page-access-option, .field-runtime-notice) { color: #102638; background: #f3f6f8; }
html[data-theme="light"] .field-experiment-grid :where(input, select) { color: #102638; background: #ffffff; }

/* Sentinel Local station page. */
html[data-theme="light"] .local-page { color: #102638; }
html[data-theme="light"] .local-summary,
html[data-theme="light"] .local-card label,
html[data-theme="light"] .local-muted { color: #617789; }
html[data-theme="light"] .local-card,
html[data-theme="light"] .local-radio-status {
    border-color: rgba(28, 62, 88, .18);
    color: #102638;
    background: #ffffff;
    box-shadow: 0 12px 28px rgba(24, 54, 76, .08);
}
html[data-theme="light"] .local-button {
    border-color: rgba(28, 62, 88, .28);
    color: #102638;
    background: #eef3f6;
}
html[data-theme="light"] .local-button.primary { color: #ffffff; background: #08766d; }

/* Refined daylight palette and legacy-module contrast. */
html[data-theme="light"] {
    color-scheme: light;
    --s-bg-primary: #e9eff4;
    --s-bg-secondary: #fff;
    --s-bg-panel: rgba(255,255,255,.96);
    --s-text-primary: #102536;
    --s-text-secondary: #526a7d;
    --s-border: rgba(30,67,94,.2);
    --light-surface: #fff;
    --light-soft: #f3f7fa;
    --light-border: #c7d4de;
    --light-text: #102536;
    --light-muted: #526a7d;
}
html[data-theme="light"] body {
    background: radial-gradient(circle at 88% 4%,rgba(58,153,202,.1),transparent 28rem),linear-gradient(155deg,#f5f8fa,#e7eef3);
}
html[data-theme="light"] .scc-content { background: linear-gradient(145deg,rgba(255,255,255,.2),rgba(218,229,237,.38)); }
html[data-theme="light"] :where(button,input,select,textarea):focus-visible { outline:3px solid rgba(0,121,177,.25);outline-offset:2px; }
html[data-theme="light"] :where(input,select,textarea)::placeholder { color:#788b9a;opacity:1; }
html[data-theme="light"] :where(input,select,textarea):disabled { color:#718493;background:#e7edf2; }
html[data-theme="light"] :where(.workspace-panel,.dashboard-card,.scc-command-panel,.operation-context,.medevac-card,.messaging-compose,.messaging-conversation,.access-card,.local-card) { border-color:var(--light-border);box-shadow:0 12px 30px rgba(26,55,76,.085); }
html[data-theme="light"] :where(.workspace-button,.admin-button,.asset-actions button,.asset-dialog footer button,.history-secondary-button,.mqtt-admin-button,.diagnostics-actions button) { border-color:#b8c8d3;color:#163044;background:#edf3f7; }
html[data-theme="light"] :where(.workspace-button,.admin-button,.asset-actions button,.asset-dialog footer button,.history-secondary-button,.mqtt-admin-button,.diagnostics-actions button):hover:not(:disabled) { border-color:#7896aa;color:#071b2a;background:#e0eaf1; }
html[data-theme="light"] table { color:var(--light-text);background:var(--light-surface); }
html[data-theme="light"] th { border-color:#c5d2dc;color:#3e586c;background:#e8eff4; }
html[data-theme="light"] td { border-color:#d5dfe6; }
html[data-theme="light"] tbody tr:nth-child(even) { background:#f7f9fb; }
html[data-theme="light"] tbody tr:hover { background:#edf4f8; }
html[data-theme="light"] :where(.history-page,.asset-page,.weather-page,.diagnostics-shell,.mqtt-admin-shell) { color:var(--light-text); }
html[data-theme="light"] :where(.history-table-panel,.history-operation-log,.history-detail-section,.history-dialog,.weather-operation-strip,.weather-current,.weather-alerts-panel,.weather-forecast-panel,.weather-source-card,.diagnostics-card,.diagnostics-check,.diagnostics-field-result,.mqtt-admin-card,.mqtt-admin-metric,.mqtt-admin-channel-settings,.mqtt-admin-facts>div) { border-color:var(--light-border);color:var(--light-text);background:var(--light-surface);box-shadow:0 10px 26px rgba(26,55,76,.07); }
html[data-theme="light"] :where(.history-heading p,.history-detail-summary,.history-detail-content,.history-operation-text,.weather-page p,.weather-source-card span,.diagnostics-heading p,.diagnostics-card p,.mqtt-admin-heading p,.mqtt-admin-card p,.mqtt-admin-summary) { color:var(--light-muted); }
html[data-theme="light"] :where(.history-filters input,.history-filters select,.asset-toolbar input,.device-toolbar input,.asset-assignment-controls select,.field-quick-pairing__controls select,.mqtt-admin-field input,.mqtt-admin-field select,.diagnostics-field-controls input,.diagnostics-field-controls select) { border-color:#b8c8d3;color:var(--light-text);background:#fff; }
html[data-theme="light"] :where(.asset-assignment-list article,.field-quick-pairing,.field-enrollment-link,.diagnostics-summary,.mqtt-admin-warning,.mqtt-admin-steps li) { border-color:var(--light-border);color:var(--light-text);background:var(--light-soft); }
html[data-theme="light"] :where(.asset-table small,.asset-assignment-controls label,.asset-assignment-list article span,.field-quick-pairing__copy span,.field-quick-pairing__controls label,.asset-form-grid label) { color:var(--light-muted); }
html[data-theme="light"] .asset-assignment-list button { border-color:#b8c8d3;color:#15354b;background:#e8f0f5; }
html[data-theme="light"] .asset-dialog :where(input,select,textarea) { border-color:#b8c8d3;color:var(--light-text);background:#fff; }
html[data-theme="light"] .operation-form--configuration .operation-form__actions,html[data-theme="light"] .operation-log-form__details { background:#fff; }
html[data-theme="light"] .operation-form--log .operation-form__actions { background:linear-gradient(to bottom,rgba(255,255,255,0),#fff 28%); }
html[data-theme="light"] .operation-form .operation-action--cancel { border-color:#b8c8d3;color:#29465a;background:#edf3f7; }
html[data-theme="light"] .operation-data-notice { border-color:rgba(151,110,0,.34);color:#5c4a0a;background:#fff8dc; }
html[data-theme="light"] .operation-data-notice strong { color:#6b5200; }
html[data-theme="light"] .operation-data-notice span { color:#655f49; }
html[data-theme="light"] .account-expiry-reminder { border-color:rgba(0,109,163,.34);color:#174d68;background:#eaf7fc; }
html[data-theme="light"] .account-expiry-reminder.is-urgent { border-color:rgba(181,78,0,.4);color:#713800;background:#fff1e1; }
html[data-theme="light"] .access-card,html[data-theme="light"] .access-metric { background:linear-gradient(155deg,#fff,#f5f8fa); }
html[data-theme="light"] .access-user { border-color:transparent;background:#edf3f7; }
html[data-theme="light"] .access-user:hover,html[data-theme="light"] .access-user.is-selected { border-color:rgba(133,105,0,.42);background:#fff8d9; }
html[data-theme="light"] .access-local-client,html[data-theme="light"] .access-association { border-color:var(--light-border);color:var(--light-text);background:var(--light-soft); }
html[data-theme="light"] .access-local-client__copy strong { color:var(--light-text); }
html[data-theme="light"] .access-local-client__copy small { color:var(--light-muted); }
html[data-theme="light"] :where(.intelligence-source-card__details,.intelligence-profile-sources,.intelligence-ingv-filters,.intelligence-acquisition-toolbar,.intelligence-snapshot-toolbar,.intelligence-snapshot-card,.intelligence-radar-observation,.intelligence-monitor) { border-color:var(--light-border);color:var(--light-text);background:var(--light-soft); }
html[data-theme="light"] :where(.intelligence-source-card p,.intelligence-source-card small,.intelligence-profile-card p,.intelligence-profile-card small,.intelligence-observation p,.intelligence-observation small,.intelligence-snapshot-card p,.intelligence-snapshot-card small,.intelligence-radar-observation p,.intelligence-radar-observation small,.intelligence-monitor span) { color:var(--light-muted); }
html[data-theme="light"] :where(.intelligence-profile-editor,.intelligence-operation-source-editor,.intelligence-ingv-filters) :where(input,select,textarea) { border-color:#b8c8d3;color:var(--light-text);background:#fff; }
html[data-theme="light"] .leaflet-bar a,html[data-theme="light"] .leaflet-control-layers { border-color:#b8c8d3;color:#17364b;background:rgba(255,255,255,.97); }
html[data-theme="light"] * { scrollbar-color:#9db1c0 #e5edf3; }

/* High-contrast daylight audit v3.
 * Keep the navy application frame and map overlays dark, while every content
 * surface uses an explicit light palette with WCAG-friendly semantic colours.
 */
html[data-theme="light"] {
    --light-accent: #705700;
    --light-accent-strong: #5d4800;
    --light-success: #006b45;
    --light-warning: #884600;
    --light-error: #a32635;
    --light-info: #075f98;
    --light-purple: #69409a;
    --light-focus: #006fa6;
    --light-border-strong: #a8bbc8;
    --light-muted: #455f72;
    --color-primary: var(--light-accent);
    --text-secondary: var(--light-muted);
}

html[data-theme="light"] :where(.scc-content, .workspace-page, .dashboard-layout) {
    color: var(--light-text);
}

html[data-theme="light"] :where(a, button) {
    text-underline-offset: 2px;
}

html[data-theme="light"] :where(input, select, textarea) {
    border-color: var(--light-border-strong);
    color: var(--light-text);
    background-color: #fff;
}

html[data-theme="light"] :where(input, select, textarea):focus {
    border-color: var(--light-focus);
}

html[data-theme="light"] :where(input, select, textarea):disabled {
    border-color: #c4d0d8;
    color: #5f7281;
    background: #e7edf1;
    opacity: 1;
}

html[data-theme="light"] :where(.dashboard-layout, .workspace-page) {
    --dashboard-muted: var(--light-muted);
    --dashboard-accent: var(--light-accent);
    --dashboard-success: var(--light-success);
    --dashboard-warning: var(--light-warning);
    --dashboard-error: var(--light-error);
    --workspace-muted: var(--light-muted);
    --workspace-accent: var(--light-accent);
}

/* Dashboard: active operation. */
html[data-theme="light"] .operation-summary__label,
html[data-theme="light"] .operation-details dt {
    color: var(--light-muted);
}

html[data-theme="light"] .operation-summary h2,
html[data-theme="light"] .operation-details dd {
    color: var(--light-text);
}

html[data-theme="light"] .operation-details > div {
    border-color: #cbd7df;
    background: #f2f6f8;
}

html[data-theme="light"] .operation-actions {
    border-top-color: #cbd7df;
}

html[data-theme="light"] .operation-status {
    border-color: rgba(0, 107, 69, .42);
    color: var(--light-success);
    background: #e9f7f1;
}

html[data-theme="light"] .operation-status.is-closed {
    border-color: #aebdca;
    color: #435a6d;
    background: #edf2f5;
}

html[data-theme="light"] .operation-status.is-error {
    border-color: rgba(163, 38, 53, .4);
    color: var(--light-error);
    background: #fff0f1;
}

html[data-theme="light"] .operation-log-button {
    border-color: rgba(7, 95, 152, .48);
    color: var(--light-info);
    background: #eaf5fb;
}

html[data-theme="light"] .operation-edit-button {
    border-color: rgba(112, 87, 0, .5);
    color: var(--light-accent-strong);
    background: #fff8d9;
}

html[data-theme="light"] .operation-end-button {
    border-color: rgba(163, 38, 53, .43);
    color: var(--light-error);
    background: #fff0f1;
}

html[data-theme="light"] :where(.operation-log-button, .operation-edit-button, .operation-end-button):hover:not(:disabled) {
    filter: saturate(1.1) brightness(.97);
}

/* Dashboard: team cards, states and controls. */
html[data-theme="light"] .team-unit {
    border-color: #c5d2dc;
}

html[data-theme="light"] .team-unit.is-nd {
    border-color: rgba(163, 38, 53, .38);
    background: linear-gradient(145deg, #fff0f1, #fff 72%);
}

html[data-theme="light"] .team-unit.is-operational {
    border-color: rgba(0, 107, 69, .4);
    background: linear-gradient(145deg, #eaf7f1, #fff 72%);
}

html[data-theme="light"] :where(.team-unit--ready, .team-unit--returned).is-operational .team-unit__state,
html[data-theme="light"] .team-unit__operational-flag:has(input:checked) {
    color: var(--light-success);
}

html[data-theme="light"] :where(.team-unit--deployed, .team-unit--started, .team-unit--finished).is-operational .team-unit__state {
    color: var(--light-warning);
    text-shadow: none;
}

html[data-theme="light"] .team-unit__operational-flag {
    color: var(--light-error);
}

html[data-theme="light"] .team-unit__operational-mark {
    border-color: rgba(163, 38, 53, .65);
    background: #fbe1e4;
}

html[data-theme="light"] .team-unit__operational-mark::after { background: var(--light-error); }
html[data-theme="light"] .team-unit__operational-flag input:checked + .team-unit__operational-mark {
    border-color: rgba(0, 107, 69, .62);
    background: #dff3e9;
}
html[data-theme="light"] .team-unit__operational-flag input:checked + .team-unit__operational-mark::after { background: var(--light-success); }

html[data-theme="light"] .team-unit__asset-icon {
    border-color: #c5d2dc;
    color: #425f73;
    background: #edf3f7;
}
html[data-theme="light"] .team-unit__asset-icon--lora { color: var(--light-info); }
html[data-theme="light"] .team-unit__asset-icon--medical { color: var(--light-error); }

html[data-theme="light"] :where(
    .team-unit select,
    .team-unit__back,
    .team-unit__advance,
    .team-unit__position,
    .team-unit__telemetry,
    .team-unit__asset,
    .team-position-dialog__actions button,
    .team-field-enrollment-dialog__qr-actions button
) {
    border-color: #afc0cc;
    color: #173348;
    background: #edf3f7;
}

html[data-theme="light"] .team-unit__advance { color: var(--light-accent-strong); background: #fff7d2; }
html[data-theme="light"] .team-unit__back:not(:disabled):hover,
html[data-theme="light"] .team-unit__advance:not(:disabled):hover,
html[data-theme="light"] :where(.team-unit__position, .team-unit__telemetry, .team-unit__asset):hover {
    border-color: #728fa3;
    background: #dfe9f0;
}

html[data-theme="light"] :where(.team-position-dialog, .team-asset-dialog, .team-telemetry-dialog) label,
html[data-theme="light"] :where(.team-position-dialog__hint, .team-telemetry-dialog__empty, .team-asset-dialog__check small) {
    color: var(--light-muted);
}

html[data-theme="light"] :where(.team-telemetry-item, .team-asset-dialog__check, .team-asset-dialog__equipment, .team-asset-dialog__equipment label) {
    border-color: #c4d1da;
    color: var(--light-text);
    background: #f2f6f8;
}

/* Dashboard timeline and status strip. */
html[data-theme="light"] .command-section h3,
html[data-theme="light"] .command-section__heading > span,
html[data-theme="light"] .event-data small,
html[data-theme="light"] .event-data time,
html[data-theme="light"] .status-label {
    color: var(--light-muted);
}

html[data-theme="light"] .event-data strong,
html[data-theme="light"] .status-value {
    color: var(--light-text);
}

html[data-theme="light"] .command-event {
    border-color: #cbd7df;
    border-left-color: var(--light-accent);
    color: var(--light-text);
    background: #f2f6f8;
}

html[data-theme="light"] .command-event:hover {
    border-color: #aebfcb;
    border-left-color: var(--light-accent-strong);
    background: #e8f0f5;
}

html[data-theme="light"] .event-icon--node { color: var(--light-success); border-color: rgba(0,107,69,.3); background: #e4f5ec; }
html[data-theme="light"] .event-icon--message { color: var(--light-info); border-color: rgba(7,95,152,.3); background: #e5f2f9; }
html[data-theme="light"] .event-icon--manual { color: var(--light-accent-strong); border-color: rgba(112,87,0,.32); background: #fff5c8; }
html[data-theme="light"] .event-icon--team { color: var(--light-purple); border-color: rgba(105,64,154,.3); background: #f2eafa; }
html[data-theme="light"] .event-sequence { color: var(--light-accent-strong); }
html[data-theme="light"] .event-coordinates { color: var(--light-info); }

html[data-theme="light"] .system-card .status-indicator {
    border: 1px solid #d1dce3;
    background: #f2f6f8;
}

/* Workspace cards, lists and map editor. */
html[data-theme="light"] :where(
    .workspace-operation-item,
    .workspace-definition-list > div,
    .workspace-resource-card,
    .workspace-log-item,
    .workspace-feature-item,
    .workspace-feature-form,
    .workspace-empty
) {
    border-color: #c6d3dc;
    color: var(--light-text);
    background: #f3f7f9;
}

html[data-theme="light"] :where(
    .workspace-page p,
    .workspace-page small,
    .workspace-page dt,
    .workspace-feature-item__meta,
    .workspace-feature-editor label
) { color: var(--light-muted); }

html[data-theme="light"] :where(.workspace-page h1, .workspace-page h2, .workspace-page h3, .workspace-page dd, .workspace-page strong) {
    color: var(--light-text);
}

html[data-theme="light"] .workspace-button--primary {
    border-color: #665000;
    color: #14202a;
    background: #e6bf16;
}

html[data-theme="light"] .workspace-button--danger {
    border-color: rgba(163,38,53,.45);
    color: var(--light-error);
    background: #fff0f1;
}

/* Semantic feedback across administration and operational modules. */
html[data-theme="light"] :where(.is-success, [data-state="success"], .success) { --feedback-color: var(--light-success); }
html[data-theme="light"] :where(.is-error, [data-state="error"], .error) { --feedback-color: var(--light-error); }
html[data-theme="light"] :where(.is-warning, [data-state="warning"], .warning) { --feedback-color: var(--light-warning); }
html[data-theme="light"] :where(
    .team-command-feedback-dialog__eyebrow,
    .team-command-feedback-dialog__message,
    .team-field-enrollment-dialog__feedback,
    .access-feedback,
    .asset-feedback,
    .intelligence-feedback,
    .mqtt-admin-feedback,
    .diagnostics-feedback
) { color: var(--feedback-color, var(--light-text)); }

html[data-theme="light"] :where(
    .medevac-page-header,
    .medevac-toolbar,
    .medevac-card,
    .messaging-compose,
    .messaging-conversation,
    .history-table-panel,
    .history-operation-log,
    .history-detail-section,
    .asset-card,
    .downloads-card,
    .intelligence-source-card,
    .intelligence-profile-card,
    .diagnostics-card,
    .mqtt-admin-card,
    .page-access-card,
    .field-experiment-card
) {
    border-color: #c5d2dc;
}

html[data-theme="light"] :where(
    .messaging-heading p,
    .messaging-compose label,
    .messaging-message time,
    .messaging-message__state,
    .medevac-page p,
    .medevac-page dt,
    .history-page p,
    .history-page small,
    .access-shell p,
    .access-shell small,
    .intelligence-page p,
    .intelligence-page small,
    .diagnostics-shell p,
    .mqtt-admin-shell p,
    .page-access-shell p,
    .field-experiment-shell p
) { color: var(--light-muted); }

html[data-theme="light"] :where(
    .medevac-page h1,
    .medevac-page h2,
    .medevac-page h3,
    .history-page h1,
    .history-page h2,
    .access-shell h1,
    .access-shell h2,
    .access-shell h3,
    .intelligence-page h1,
    .intelligence-page h2,
    .intelligence-page h3,
    .diagnostics-shell h1,
    .diagnostics-shell h2,
    .mqtt-admin-shell h1,
    .mqtt-admin-shell h2,
    .page-access-shell h1,
    .page-access-shell h2,
    .field-experiment-shell h1,
    .field-experiment-shell h2
) { color: var(--light-text); }

html[data-theme="light"] :where(.access-button--danger, .asset-button--danger, .history-danger-button) {
    border-color: rgba(163,38,53,.42);
    color: var(--light-error);
    background: #fff0f1;
}

html[data-theme="light"] :where(.access-badge, .workspace-badge, .medevac-status, .intelligence-badge) {
    color: #243b4d;
}

/* Map controls and floating map panels intentionally retain a dark surface. */
html[data-theme="light"] :where(
    .map-card .scc-dashboard-overlay-menu,
    .map-card .scc-dashboard-overlay-menu__content,
    .workspace-map-overlay-menu__content
) {
    color: #eef4f8;
    background: rgba(7, 19, 31, .96);
}

html[data-theme="light"] :where(
    .map-card .scc-dashboard-overlay-menu,
    .map-card .scc-dashboard-overlay-menu__content,
    .workspace-map-overlay-menu__content
) :where(h1, h2, h3, strong, span, label) {
    color: #eef4f8;
}

html[data-theme="light"] :where(
    .map-card .scc-dashboard-overlay-menu,
    .map-card .scc-dashboard-overlay-menu__content,
    .workspace-map-overlay-menu__content
) :where(p, small) {
    color: #c5d3dd;
}

html[data-theme="light"] .map-card .leaflet-control-layers,
html[data-theme="light"] .workspace-map .leaflet-control-layers {
    border-color: #9fb3c1;
    color: #17364b;
    background: rgba(255,255,255,.98);
}

html[data-theme="light"] .leaflet-control-attribution {
    color: #263e50;
    background: rgba(255,255,255,.9);
}

html[data-theme="light"] .leaflet-control-attribution a { color: #075f98; }

/* Downloads and history still use an older dark-only component palette. */
html[data-theme="light"] .downloads-page {
    --download-accent: var(--light-accent);
    color: var(--light-text);
}

html[data-theme="light"] :where(.downloads-header p, .downloads-muted, .downloads-security-note p, .download-card > p, .download-card dt, .download-card__actions small) {
    color: var(--light-muted);
}

html[data-theme="light"] :where(.downloads-header h1, .downloads-security-note h2, .download-card h2, .download-card dd) {
    color: var(--light-text);
}

html[data-theme="light"] .downloads-kicker,
html[data-theme="light"] .downloads-badge,
html[data-theme="light"] .download-card__type { color: var(--light-accent-strong) !important; }

html[data-theme="light"] .downloads-security-note {
    border-color: rgba(112,87,0,.32);
    color: var(--light-text);
    background: #fff8dc;
}

html[data-theme="light"] .download-card {
    border-color: #c5d2dc;
    color: var(--light-text);
    background: linear-gradient(145deg,#fff,#f4f7f9);
    box-shadow: 0 12px 28px rgba(24,54,76,.08);
}

html[data-theme="light"] .download-card dl div { border-color: #d0dbe2; background: #f1f5f8; }
html[data-theme="light"] .download-card__status { border-color: rgba(0,107,69,.35); color: var(--light-success); background: #e9f7f1; }
html[data-theme="light"] .download-card__status.is-unavailable { border-color: rgba(163,38,53,.35); color: var(--light-error); background: #fff0f1; }
html[data-theme="light"] .download-card__status.is-hidden { border-color: rgba(136,70,0,.35); color: var(--light-warning); background: #fff3e6; }
html[data-theme="light"] .downloads-button { border-color: #665000; color: #14202a; background: #e6bf16; }
html[data-theme="light"] .downloads-button.is-secondary { border-color: #a9913c; color: var(--light-accent-strong); background: #fff8dc; }

html[data-theme="light"] .history-filters {
    border-color: #c5d2dc;
    color: var(--light-text);
    background: #fff;
    box-shadow: 0 10px 26px rgba(24,54,76,.07);
}
html[data-theme="light"] .history-filters label,
html[data-theme="light"] :where(.history-pagination, .history-empty, .history-operation-log__heading p) { color: var(--light-muted); }
html[data-theme="light"] .history-kicker,
html[data-theme="light"] .history-table th,
html[data-theme="light"] .history-operation-name,
html[data-theme="light"] .history-detail-section h3 { color: var(--light-accent-strong) !important; }
html[data-theme="light"] .history-primary-button { border-color: #665000; color: #14202a; background: #e6bf16; }
html[data-theme="light"] :where(.history-secondary-button, .history-detail-button) { border-color: #a9913c; color: var(--light-accent-strong); background: #fff8dc; }
html[data-theme="light"] .history-feedback { color: var(--light-success); }
html[data-theme="light"] .history-feedback-error { color: var(--light-error); }
html[data-theme="light"] .history-table code { color: var(--light-info); }
html[data-theme="light"] .history-operation-log__heading h2 { color: var(--light-text); }
html[data-theme="light"] .history-operation-log__total { border-color: rgba(112,87,0,.32); color: var(--light-accent-strong); background: #fff8dc; }

html[data-theme="light"] .history-dialog {
    border-color: #a9913c;
    color: var(--light-text);
    background: #fff;
    box-shadow: 0 24px 70px rgba(24,54,76,.24);
}
html[data-theme="light"] .history-dialog-heading {
    border-bottom-color: #c5d2dc;
    background: rgba(239,244,247,.97);
}
html[data-theme="light"] :where(.history-dialog-heading h2, .history-dialog-heading button, .history-detail-summary h3, .history-detail-message, .history-detail-grid dd) { color: var(--light-text); }
html[data-theme="light"] .history-detail-summary {
    border-bottom-color: #c5d2dc;
    background: linear-gradient(135deg,#fff8dc,transparent 58%),#f3f7f9;
}
html[data-theme="light"] .history-detail-summary p { color: var(--light-accent-strong); }
html[data-theme="light"] :where(.history-detail-summary div > span, .history-detail-grid dt, .history-detail-status) { color: var(--light-muted); }
html[data-theme="light"] .history-detail-status { border-color: #afc0cc; background: #edf3f7; }
html[data-theme="light"] .history-detail-status.is-online { border-color: rgba(0,107,69,.35); color: var(--light-success); background: #e9f7f1; }
html[data-theme="light"] .history-detail-status.is-offline { border-color: rgba(163,38,53,.35); color: var(--light-error); background: #fff0f1; }
html[data-theme="light"] .history-detail-section { border-color: #cbd7df; color: var(--light-text); background: #f3f7f9; }
html[data-theme="light"] .history-detail-grid > div { border-bottom-color: #d4dee5; }
html[data-theme="light"] .history-technical-details { border-color: #b8cbd8; background: #eef5f8; }
html[data-theme="light"] .history-technical-details summary { color: var(--light-info); }

/* Operation forms and modal copy. */
html[data-theme="light"] :where(.operation-form label, .operation-dialog__context span, .operation-dialog__hint, .operation-node-option span) { color: var(--light-muted); }
html[data-theme="light"] :where(.operation-dialog__context strong, .operation-node-option strong) { color: var(--light-text); }
html[data-theme="light"] .operation-dialog__close { border-color: #afc0cc; color: #173348; background: #edf3f7; }
html[data-theme="light"] .operation-node-option { border-color: #c5d2dc; color: var(--light-text); background: #f3f7f9; }

/* Map layer control: the heading stays in the navy map frame, while the open
 * panel is a deliberately light, high-contrast control surface. */
html[data-theme="light"] .workspace-map-overlay-menu__content {
    border-color: #b59a2c;
    color: var(--light-text);
    background: rgba(255, 255, 255, .98);
    box-shadow: 0 16px 38px rgba(17, 39, 55, .28);
}

html[data-theme="light"] .workspace-map-overlay-menu__content > label,
html[data-theme="light"] .workspace-map-overlay-menu__content > span,
html[data-theme="light"] .workspace-map-overlay-menu__content p,
html[data-theme="light"] .workspace-map-overlay-menu__content .workspace-map-overlay-toggle {
    color: var(--light-muted);
}

html[data-theme="light"] .workspace-map-overlay-menu__content > label > span,
html[data-theme="light"] .workspace-map-overlay-menu__content .workspace-control-label {
    color: #334f63;
    font-weight: 750;
}

html[data-theme="light"] .workspace-map-overlay-menu__content .workspace-control-label {
    letter-spacing: .08em;
}

html[data-theme="light"] .workspace-map-overlay-menu__content select {
    border-color: #9fb4c3;
    color: var(--light-text);
    background: #fff;
}

html[data-theme="light"] .workspace-map-overlay-menu__content select:hover,
html[data-theme="light"] .workspace-map-overlay-menu__content select:focus {
    border-color: var(--light-focus);
}

html[data-theme="light"] .workspace-map-overlay-menu__content .workspace-layer-list label {
    border-color: #ccd8e0;
    color: #173348;
    background: #eef3f6;
}

html[data-theme="light"] .workspace-map-overlay-menu__content .workspace-layer-list label:hover {
    border-color: #97adbc;
    background: #e4edf2;
}

html[data-theme="light"] .workspace-map-overlay-menu__content .workspace-layer-list strong,
html[data-theme="light"] .workspace-map-overlay-menu__content [data-weather-radar-opacity-label] {
    color: var(--light-accent-strong);
}

html[data-theme="light"] .workspace-map-overlay-menu__content .workspace-layer-actions button {
    border-color: #b59a2c;
    color: var(--light-accent-strong);
    background: #fff8dc;
    box-shadow: none;
}

html[data-theme="light"] .workspace-map-overlay-menu__content .workspace-layer-actions button:hover {
    border-color: #806600;
    color: #443500;
    background: #f8ebae;
}

html[data-theme="light"] .workspace-map-overlay-menu__content input[type="checkbox"] {
    accent-color: #0876c9;
}

html[data-theme="light"] .workspace-map-overlay-menu__content input[type="range"] {
    accent-color: #806600;
}

html[data-theme="light"] .workspace-map-overlay-menu__content #map-visible-count {
    color: #334f63;
    font-weight: 750;
}

html[data-theme="light"] .workspace-map-overlay-menu__content [data-weather-radar-overlay-status] {
    color: #4b687c;
    font-weight: 650;
}

@media (prefers-contrast: more) {
    html[data-theme="light"] {
        --light-border: #91a6b5;
        --light-border-strong: #718b9d;
        --light-muted: #314c60;
    }

    html[data-theme="light"] :where(.dashboard-card, .workspace-panel, .medevac-card, .messaging-compose, .messaging-conversation) {
        box-shadow: none;
    }
}

@media (max-width: 760px) {
    .scc-theme-toggle {
        min-width: 40px;
        width: 40px;
        padding-inline: 0;
    }
    .scc-theme-toggle > [data-scc-theme-label] { display: none; }
}

@media (prefers-reduced-motion: reduce) {
    .scc-theme-toggle { transition: none; }
}
