:root {
    color-scheme: light;
    --sg-brand-strip: #fff;
    --sg-switch-text: #313e62;
    --sg-switch-bg: #f0f3f9;
    --sg-switch-edge: #ccd4e5;
    --sg-switch-active: #fff;
    --sg-switch-ring: #647bcc;
}
.sg-header { background: var(--sg-brand-strip); }
.sg-nav { background: #111936; }
.sg-header__top .sg-brand { min-width: 0; width: min(216px,100%); }
.sg-header .sg-brand img { display: block; width: 100%; height: auto; aspect-ratio: 528 / 91; object-fit: contain; }
.sg-header .sg-brand .sg-night-logo { display: none; }
.sg-header .sg-search-trigger, .sg-header .sg-icon-button {
    background: var(--sg-switch-bg); color: var(--sg-switch-text); border-color: var(--sg-switch-edge);
}
.sg-header .sg-search-trigger:hover, .sg-header .sg-icon-button:hover { border-color: var(--sg-switch-ring); }
.sg-theme { display: none; }
[data-appearance] .sg-theme {
    display: inline-flex; flex: none; align-items: center; padding: 2px;
    background: var(--sg-switch-bg); border: 1px solid var(--sg-switch-edge); border-radius: 12px;
    color: var(--sg-switch-text);
}
.sg-theme label { cursor: pointer; }
.sg-theme__choice { position: relative; }
.sg-theme__choice input, .sg-theme__mobile select {
    position: absolute; inset: 0; margin: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer;
}
.sg-theme__choice span {
    display: flex; align-items: center; justify-content: center; gap: 5px;
    padding: 0 8px; min-height: 40px; border: 1px solid transparent; border-radius: 9px;
    font-size: .78rem; font-weight: 600;
}
.sg-theme img { display: block; width: 22px; height: 22px; }
.sg-theme__choice input:checked + span, .sg-theme__mobile {
    border-color: var(--sg-switch-ring); background: var(--sg-switch-active); color: var(--sg-switch-text);
}
.sg-theme__choice:hover span { border-color: var(--sg-switch-edge); }
.sg-theme__choice input:focus-visible + span, .sg-theme__mobile:focus-within {
    outline: 3px solid var(--sg-switch-ring); outline-offset: 1px;
}
.sg-theme__mobile { display: none; }
@media (max-width: 720px) {
    .sg-header__top { grid-template-columns: minmax(0, 1fr) auto; }
    .sg-header__actions { grid-column: 2; gap: 5px; }
    .sg-header__top .sg-brand { max-width: 175px; }
    .sg-theme__choice { display: none; }
    [data-appearance] .sg-theme { padding: 0; border: 0; }
    .sg-theme__mobile {
        display: flex; width: 54px; height: 44px; align-items: center; justify-content: center;
        position: relative; gap: 5px; border: 1px solid var(--sg-switch-ring); border-radius: 9px;
    }
    .sg-theme__mobile::before { content: ''; width: 22px; height: 22px; background: center/contain no-repeat url('mode-auto.webp'); }
    [data-appearance="light"] .sg-theme__mobile::before { background-image: url('mode-light.webp'); }
    [data-appearance="dark"] .sg-theme__mobile::before { background-image: url('mode-dark.webp'); }
    .sg-theme__mobile::after { content: ''; width: 6px; height: 6px; border: solid currentColor; border-width: 0 1.5px 1.5px 0; transform: translateY(-2px) rotate(45deg); }
}
@media (forced-colors: active) {
    .sg-theme__choice input:checked + span, .sg-theme__mobile { outline: 2px solid Highlight; }
}
/* Some legacy tool utilities follow the OS even when the visitor chooses day. */
[data-scheme="light"] .sg-tool-workspace .text-slate-700 { color: #334155; }
[data-scheme="light"] .sg-breadcrumbs .text-slate-500 { color: #64748b; }
@media (min-width: 1051px) {
    /* Preserve the established 520px search track and its original centre. */
    .sg-header__top { grid-template-columns: calc(50% - 184.5px) 520px minmax(0,1fr); }
    .sg-theme__choice span { gap: 3px; padding-inline: 5px; }
}
@media (min-width: 1051px) and (max-width: 1200px) {
    .sg-theme__choice span { width: 40px; padding: 0; font-size: 0; gap: 0; }
}
