/* Shared palette for the public site, training, identity and administration. */
:root,
:root[theme="light"] {
    color-scheme: light;
    --navy: #072c48;
    --blue: #075f91;
    --aqua: #b9f1df;
    --ink: #17384b;
    --heading: #072c48;
    --muted: #586d7b;
    --paper: #f4f7f8;
    --surface: #ffffff;
    --surface-soft: #edf3f6;
    --surface-accent: #e2edea;
    --field: #fbfcfd;
    --border: #d8e3e8;
    --field-border: #b7c9d2;
    --button-ink: #072c48;
    --button-hover: #9de7cf;
    --secondary-hover: #e8f2f5;
    --disabled: #e6ebed;
    --disabled-ink: #5f6c73;
    --badge: #eaf4f0;
    --badge-ink: #1b5141;
    --notice: #eaf7f0;
    --notice-border: #b0dcca;
    --notice-ink: #20543f;
    --warning: #fff5de;
    --warning-border: #e7ce8e;
    --warning-ink: #75541b;
    --error: #9f2337;
    --error-surface: #fff0f2;
    --error-border: #efc3ca;
    --focus: #1284bd;
    --theme: var(--paper);
    --color: var(--ink);
    --brand: var(--blue) !important;
    --transparent: #ffffffd9;
    --translucid: var(--surface);
    --card: var(--surface);
    --title: var(--heading);
    --link: var(--blue);
    --label: var(--muted);
}

:root[theme="dark"] {
    color-scheme: dark;
    --blue: #8dcced;
    --ink: #dce9f2;
    --heading: #edf6fc;
    --muted: #a8becc;
    --paper: #071e30;
    --surface: #102f45;
    --surface-soft: #173a50;
    --surface-accent: #123d43;
    --field: #0b263a;
    --border: #315166;
    --field-border: #59798d;
    --secondary-hover: #20475b;
    --disabled: #294251;
    --disabled-ink: #b0c3ce;
    --badge: #1b4842;
    --badge-ink: #b9f1df;
    --notice: #143e35;
    --notice-border: #417b65;
    --notice-ink: #c0efda;
    --warning: #433821;
    --warning-border: #8b743d;
    --warning-ink: #ffe1a0;
    --error: #ffb3c0;
    --error-surface: #402b3b;
    --error-border: #98586d;
    --focus: #b9f1df;
    --transparent: #102f45e6;
}

.theme-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 44px;
    padding: 8px 12px;
    border: 1px solid var(--field-border);
    border-radius: 8px;
    background: var(--surface);
    color: var(--heading);
    font: 600 13px/1.4 Arial, Helvetica, sans-serif;
    cursor: pointer;
    white-space: nowrap;
}
.theme-toggle[hidden] { display: none; }
.theme-toggle:hover { background: var(--secondary-hover); }
.theme-toggle:focus-visible { outline: 3px solid var(--focus); outline-offset: 4px; }
.theme-toggle [data-theme-icon] { font-size: 20px; line-height: 1; }
.legacy-site .theme-toggle { color: var(--heading) !important; text-transform: none; }
.legacy-site .theme-toggle:hover { background: var(--secondary-hover) !important; }
.legacy-site input:not([type="button"]):not([type="submit"]):not([type="reset"]):not([type="hidden"]):not([type="checkbox"]):not([type="radio"]),
.legacy-site textarea,
.legacy-site select { background: var(--field); color: var(--ink); border-color: var(--field-border); }
.legacy-site .red,
.legacy-site .error { color: var(--error) !important; }

/* Existing editorial tools keep their layout and use the same two palettes. */
[theme="dark"] .fr-box .fr-toolbar,
[theme="dark"] .fr-box .fr-wrapper,
[theme="dark"] .fr-box .fr-element,
[theme="dark"] .fr-box .fr-second-toolbar,
[theme="dark"] .fr-popup,
[theme="dark"] .fr-modal .fr-modal-wrapper,
[theme="dark"] .fr-box .fr-command.fr-btn {
    background: var(--surface) !important;
    color: var(--ink) !important;
    border-color: var(--border) !important;
}
[theme="dark"] .fr-box .fr-command svg path { fill: var(--ink); }
[theme="dark"] .fr-box .fr-command.fr-btn:hover { background: var(--surface-soft) !important; }
[theme="dark"] .fr-box textarea.fr-code { background: var(--field) !important; color: var(--ink) !important; }

@media print { .theme-toggle { display: none; } }
