/* Theme tokens are set only in dark mode. The component styles retain their light defaults. */
:root[data-theme="dark"] {
    color-scheme: dark;
    --theme-paper: #191b18;
    --theme-surface: #242720;
    --theme-surface-raised: #2d3028;
    --theme-control: #22251f;
    --theme-glass: rgb(36 39 32 / 88%);
    --theme-strong-surface: #30382d;
    --theme-border: #495145;
    --theme-edge: #61695d;
    --theme-ink: #f3f1e9;
    --theme-muted: #b3beb0;
    --theme-accent: #ffab8b;
    --theme-primary: #bd3e1d;
    --theme-primary-hover: #a83115;
    --theme-green: #a8d8b7;
    --theme-blue: #b9cffa;
    --theme-amber: #f3cd87;
    --theme-purple: #dac2ef;
    --theme-warm: #e4c2ad;
    --theme-bg-accent: #402c24;
    --theme-bg-green: #25382d;
    --theme-bg-blue: #29374a;
    --theme-bg-amber: #392f20;
    --theme-bg-purple: #392e43;
    --theme-border-accent: #795443;
    --theme-border-green: #557460;
    --theme-border-blue: #586d89;
    --theme-border-amber: #806841;
    --theme-border-purple: #745c84;
    --theme-photo: #f5efe5;
}

:root[data-theme="dark"] .dk-dashboard {
    --theme-paper: #171a20;
    --theme-surface: #22262f;
    --theme-surface-raised: #2b313c;
    --theme-control: #1c2028;
    --theme-glass: rgb(34 38 47 / 90%);
    --theme-strong-surface: #303744;
    --theme-border: #3c4553;
    --theme-edge: #586575;
    --theme-ink: #edf1f6;
    --theme-muted: #aeb9c8;
    background: var(--theme-paper);
}

.dk-cart-navigation { --product-photo-background: #fff; }
:root[data-theme="dark"] .dk-cart-navigation {
    --theme-paper: #252525;
    --theme-surface: #303030;
    --theme-surface-raised: #3a3a3a;
    --theme-control: #2a2a2a;
    --theme-strong-surface: #414141;
    --theme-glass: rgb(48 48 48 / 88%);
    --theme-border: #474747;
    --theme-edge: #666;
    --theme-muted: #bbb9b5;
    --theme-primary: #df4d22;
    --theme-primary-hover: #bd3e1d;
    --paper: var(--theme-paper);
    --muted: var(--theme-muted);
    --line: var(--theme-border);
    --product-photo-background: var(--theme-photo);
}
.dk-cart-navigation :is(.restaurant-menu-media:has(img), .product-summary > img.product-detail-image, .cart-line-image, .cart-complementary-media:has(img), .food-card-link > img.food-image) {
    background: var(--product-photo-background);
}
.dk-cart-navigation :is(.restaurant-menu-media img, .product-summary > img.product-detail-image, .food-card-link > img.food-image) {
    mix-blend-mode: normal;
}
:root[data-theme="dark"] .dk-cart-navigation :is(.restaurant-menu-media:has([data-product-cutout]), img[data-product-cutout], .cart-complementary-media:has([data-product-cutout])) {
    background: transparent;
}
:root[data-theme="dark"] .restaurant-card-cover:has(img) { background: var(--theme-photo); }

:root[data-theme="dark"] .zone-map-card .leaflet-tile-pane {
    filter: brightness(.67) contrast(1.13) saturate(.8);
}
:root[data-theme="dark"] .zone-map-card .leaflet-popup-content-wrapper,
:root[data-theme="dark"] .zone-map-card .leaflet-popup-tip,
:root[data-theme="dark"] .zone-map-card .leaflet-tooltip,
:root[data-theme="dark"] .zone-map-card .leaflet-bar a {
    background: var(--theme-surface);
    color: var(--theme-ink);
    border-color: var(--theme-border);
}
:root[data-theme="dark"] .zone-map-card .leaflet-bar a:hover,
:root[data-theme="dark"] .zone-map-card .leaflet-container .leaflet-control-attribution {
    background: var(--theme-surface-raised);
    color: var(--theme-ink);
}
:root[data-theme="dark"] .zone-map-card .leaflet-control-attribution a { color: var(--theme-blue); }
:root[data-theme="dark"] .zone-map-card .leaflet-tooltip-top::before { border-top-color: var(--theme-surface); }
:root[data-theme="dark"] .zone-map-card .leaflet-tooltip-bottom::before { border-bottom-color: var(--theme-surface); }
:root[data-theme="dark"] .zone-map-card .leaflet-tooltip-left::before { border-left-color: var(--theme-surface); }
:root[data-theme="dark"] .zone-map-card .leaflet-tooltip-right::before { border-right-color: var(--theme-surface); }

.theme-toggle[hidden], .theme-toggle .theme-sun { display: none; }
.dk-header-actions { display: inline-flex; align-items: center; gap: 8px; }
.theme-toggle, .dk-header .dk-header-actions .profile-icon {
    display: inline-grid;
    place-items: center;
    flex: 0 0 auto;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 1px solid var(--theme-border, #dfded4);
    border-radius: 9px;
    background: var(--theme-surface, #fff);
    color: var(--theme-ink, #263128);
    cursor: pointer;
}
.theme-toggle {
    background: transparent;
    border-color: transparent;
    color: var(--theme-muted, #62675f);
}
.dk-header .profile-icon:hover {
    background: var(--theme-bg-accent, #fff0e9);
    border-color: var(--theme-border-accent, #ebaa91);
    color: var(--theme-accent, #a9381d);
}
.theme-toggle:focus-visible {
    background: var(--theme-surface-raised, #f0eee6);
    color: var(--theme-ink, #263128);
}
@media (hover: hover) {
    .theme-toggle:hover {
        background: var(--theme-surface-raised, #f0eee6);
        color: var(--theme-ink, #263128);
    }
}
.theme-toggle:focus-visible, .dk-header .profile-icon:focus-visible {
    outline: 2px solid var(--theme-accent, #a9381d);
    outline-offset: 2px;
}
.theme-toggle svg, .profile-icon svg {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.theme-toggle svg { width: 18px; height: 18px; }
.theme-toggle[aria-pressed="true"] .theme-moon { display: none; }
.theme-toggle[aria-pressed="true"] .theme-sun { display: block; }
.dashboard-topbar .theme-toggle { width: 44px; height: 44px; }

.profile-menu { position: relative; margin: 0; padding: 0; border: 0; }
.profile-menu > summary { cursor: pointer; list-style: none; }
.profile-menu > summary::-webkit-details-marker { display: none; }
.profile-menu summary svg { display: block; }
.profile-menu .dashboard-account { min-height: 44px; padding: 0; }
.profile-menu .dashboard-account > .dashboard-avatar { display: grid; }
.profile-menu .dashboard-avatar svg { fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; }
.profile-menu[open] > .profile-icon {
    background: var(--theme-bg-accent, #fff0e9);
    border-color: var(--theme-border-accent, #ebaa91);
    color: var(--theme-accent, #a9381d);
}
.profile-menu-panel {
    position: absolute;
    z-index: 40;
    inset-block-start: calc(100% + 8px);
    inset-inline-end: 0;
    width: min(13rem, calc(100vw - 32px));
    padding: 5px;
    border: 1px solid var(--theme-border, #dfded4);
    border-radius: 10px;
    background: var(--theme-surface, #fff);
    color: var(--theme-ink, #263128);
    box-shadow: 0 10px 28px rgb(0 0 0 / 16%);
    font-size: 14px;
    font-weight: 600;
}
.profile-menu-panel :is(a, button) {
    display: flex;
    align-items: center;
    width: 100%;
    min-height: 44px;
    padding: 8px 10px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: inherit;
    text-align: start;
    text-decoration: none;
    font: inherit;
    cursor: pointer;
}
.profile-menu-identity {
    display: grid;
    gap: 2px;
    padding: 8px 10px;
    margin-bottom: 4px;
    border-bottom: 1px solid var(--theme-border, #dfded4);
    font-size: 12px;
    line-height: 1.4;
    overflow-wrap: anywhere;
}
.profile-menu-identity small { color: var(--theme-muted, #62675f); font-size: 11px; font-weight: 400; }
.dk-header .profile-menu-panel a:hover, .profile-menu-panel :is(a, button):is(:hover, :focus-visible) {
    background: var(--theme-surface-raised, #f0eee6);
    color: inherit;
    text-decoration: none;
}
.profile-menu-panel form {
    margin-top: 4px;
    padding-top: 4px;
    border-top: 1px solid var(--theme-border, #dfded4);
}

@media (max-width: 580px) {
    .dashboard-topbar > div:last-child { gap: 8px; }
    .theme-toggle, .dk-header .dk-header-actions .profile-icon { border-radius: 7px; }
    .dk-header { position: relative; }
    .dk-header .brand { min-height: 44px; }
    .dk-header nav { column-gap: 12px; row-gap: 6px; }
    .dk-header nav > .theme-toggle, .dk-header-actions { position: absolute; inset: 17px 20px auto auto; }
}
