/* Cel: Wspólny przełącznik i ciemny motyw; jasny zachowuje obecną paletę. */
:root[data-theme="light"]
{
    color-scheme: light;
}
body
{
    position: relative;
}
nav .main_menu
{
    padding-right: 110px;
    min-height: 60px;
}
#wso-theme-form
{
    position: absolute;
    top: 10px;
    right: 16px;
    z-index: 50;
    margin: 0;
    padding: 0;
}
#wso-theme-toggle
{
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: space-around;
    width: 82px;
    height: 40px;
    padding: 0;
    border: 1px solid #627459;
    border-radius: 999px;
    background: #e7efde;
    color: #35462c;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0,0,0,.2);
    isolation: isolate;
}
#wso-theme-toggle::before
{
    content: '';
    position: absolute;
    z-index: -1;
    left: 3px;
    top: 3px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 4px rgba(0,0,0,.2);
    transition: transform .18s ease;
}
#wso-theme-toggle svg
{
    width: 21px;
    height: 21px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}
#wso-theme-toggle:focus-visible
{
    outline: 3px solid #b2e56e;
    outline-offset: 3px;
}
#wso-theme-toggle:disabled
{
    cursor: progress;
}
#wso-theme-status:not(:empty)
{
    position: absolute;
    top: 46px;
    right: 0;
    width: min(280px, 80vw);
    padding: 12px;
    border: 1px solid #a34921;
    border-radius: 8px;
    color: #6a280e;
    background: #fff4df;
    font-size: 14px;
}
:root[data-theme="dark"]
{
    color-scheme: dark;
    --page-bg: #11151b;
    --panel-bg: #1a2029;
    --raised-bg: #202a35;
    --field-bg: #283241;
    --line: #3b4859;
    --text: #edf2f7;
    --muted: #b2bfce;
    --accent: #a2dc5c;
    background: var(--page-bg);
    color: var(--text);
}
html[data-theme="dark"] body
{
    color: var(--text) !important;
    background: var(--page-bg);
}
html[data-theme="dark"] nav
{
    background: linear-gradient(110deg, #192a20, #243d27);
    border-color: var(--line);
}
html[data-theme="dark"] nav ul li
{
    color: var(--muted);
}
html[data-theme="dark"] .main_menu a, html[data-theme="dark"] nav a
{
    color: #d3efa9 !important;
}
html[data-theme="dark"] a
{
    color: var(--accent);
}
html[data-theme="dark"] a:hover
{
    color: #d0f3a5;
}
html[data-theme="dark"] .event_show,
html[data-theme="dark"] .wso-page.event_show,
html[data-theme="dark"] form#login,
html[data-theme="dark"] form#event,
html[data-theme="dark"] form#member,
html[data-theme="dark"] fieldset,
html[data-theme="dark"] .events li
{
    color: var(--text);
    background: var(--panel-bg);
    border-color: var(--line);
}
html[data-theme="dark"] legend,
html[data-theme="dark"] .form_label,
html[data-theme="dark"] .events li:hover
{
    background: var(--raised-bg);
    color: var(--text);
    border-color: var(--line);
}
html[data-theme="dark"] input,
html[data-theme="dark"] select,
html[data-theme="dark"] textarea,
html[data-theme="dark"] button
{
    color: var(--text);
    background-color: var(--field-bg);
    border-color: var(--line);
    box-shadow: none;
    accent-color: var(--accent);
}
html[data-theme="dark"] .wso-page input[readonly],
html[data-theme="dark"] .wso-page textarea[readonly],
html[data-theme="dark"] input[readonly],
html[data-theme="dark"] textarea[readonly],
html[data-theme="dark"] select[readonly]
{
    background: var(--raised-bg);
    color: var(--muted);
}
html[data-theme="dark"] input:focus-visible,
html[data-theme="dark"] select:focus-visible,
html[data-theme="dark"] textarea:focus-visible
{
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}
html[data-theme="dark"] button:hover,
html[data-theme="dark"] input[type="submit"]:hover
{
    border-color: var(--accent);
}
html[data-theme="dark"] #your-events,
html[data-theme="dark"] #event,
html[data-theme="dark"] #member,
html[data-theme="dark"] .etykieta,
html[data-theme="dark"] table.members,
html[data-theme="dark"] table.members td,
html[data-theme="dark"] .wso-page th,
html[data-theme="dark"] .wso-page td,
html[data-theme="dark"] .wso-page fieldset
{
    border-color: var(--line);
}
html[data-theme="dark"] .wso-page th,
html[data-theme="dark"] .wso-page td.startlist-group,
html[data-theme="dark"] .wso-startlist-links a
{
    background: var(--raised-bg);
    color: var(--text);
    border-color: var(--line);
}
html[data-theme="dark"] .wso-startlist-links a:hover,
html[data-theme="dark"] #startlist-tabs button[aria-pressed=true]
{
    background: #31472e;
    border-color: var(--accent);
}
html[data-theme="dark"] .wso-page .notice
{
    background: #34331f;
    border-color: var(--accent);
    color: #f1edce;
}
html[data-theme="dark"] .wso-page .badge,
html[data-theme="dark"] .wso-page .muted
{
    color: var(--muted);
}
html[data-theme="dark"] .rej_1
{
    color: #70dfaa;
}
html[data-theme="dark"] .rej_
{
    color: #ff9b8f;
}
html[data-theme="dark"] a.przycisk
{
    color: #ecf7dd;
    background: #314d2a;
    border-color: #5e7d46;
}
html[data-theme="dark"] #wso-theme-toggle
{
    color: #dae5f5;
    background: #283549;
    border-color: #62758d;
}
html[data-theme="dark"] #wso-theme-toggle::before
{
    transform: translateX(42px);
    background: #465974;
}
@media (max-width: 700px)
{
    nav .main_menu { padding-right: 106px; padding-left: 8px; }
    nav ul li { padding: 12px 10px; }
    #wso-theme-form { right: 12px; }
}
@media (prefers-reduced-motion: reduce)
{
    #wso-theme-toggle::before { transition: none; }
}
@media print
{
    #wso-theme-form { display: none; }
    html[data-theme="dark"], html[data-theme="dark"] body, html[data-theme="dark"] .event_show, html[data-theme="dark"] .wso-page.event_show, html[data-theme="dark"] .wso-page th, html[data-theme="dark"] .wso-page td
    {
        background: #fff !important;
        color: #000 !important;
    }
}
