/* StokPilot – przełącznik w menu konta i TRYB CIEMNY (html[data-theme="dark"], ustawiany przez /js/theme.js).
   Ładowany jako ostatni arkusz na każdej stronie: najpierw zmienne kolorów, potem miejsca z kolorami wpisanymi na stałe. */

/* ---------- Przełącznik w menu konta (oba tryby) ---------- */
.theme-item .mini-sw { margin-left: auto; width: 34px; height: 20px; border-radius: 20px; background: #C9CFD6; position: relative; flex: none; transition: background .15s; }
.theme-item .mini-sw::after { content: ""; position: absolute; top: 3px; left: 3px; width: 14px; height: 14px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.3); transition: transform .15s; }
.theme-item[aria-checked="true"] .mini-sw { background: var(--navigator); }
.theme-item[aria-checked="true"] .mini-sw::after { transform: translateX(14px); }

/* Logo w dwóch wersjach – jasne tło / ciemne tło */

/* Światła aut na mapie – tylko w trybie ciemnym */
.tile .t-lights { display: none; }

/* =====================================================================================================
   TRYB CIEMNY – „stok nocą”: grafitowy asfalt, panele jak oświetlone tablice, akcenty bez zmian znaczenia
   ===================================================================================================== */
html[data-theme="dark"] {
  --concrete: #0E1216;
  --paper: #171C22;
  --line: #2B333C;
  --navigator: #4A7DBA;
  --navigator-dark: #3F6CA3;
  --bg: #0E1216;
  --surface: #171C22;
  --surface-2: #1F262E;
  --glass: rgba(23, 28, 34, .94);
  --fg: #E6E9ED;
  --fg-2: #B8C0C9;
  --muted: #8B95A0;
  --accent: #5C8DCB;
  --accent-soft: rgba(92, 141, 203, .18);
  --go: #33885E;
  --go-hover: #2C7651;
  --danger: #EE6A60;
  --danger-soft: rgba(238, 106, 96, .14);
  --warn: #EAA43A;
  --warn-soft: rgba(234, 164, 58, .13);
  --ok-soft: rgba(63, 170, 115, .15);
  --shadow: 0 10px 30px rgba(0, 0, 0, .5), 0 1px 3px rgba(0, 0, 0, .4);
  --shadow-s: 0 1px 2px rgba(0, 0, 0, .4);
  /* zlecenia, wydania, rezerwacje, przechowalnia – tła półprzezroczyste, napisy rozjaśnione */
  --ord-pdi-soft: rgba(240, 140, 0, .15); --ord-pdi-ink: #FFB45A;
  --ord-svc-soft: rgba(0, 102, 177, .24); --ord-svc-ink: #8FC3EE;
  --ord-tech-soft: rgba(226, 58, 46, .18); --ord-tech-ink: #FF978E;
  --rel-soft: rgba(55, 160, 80, .15); --rel-ink: #84D49A;
  --hold-soft: rgba(232, 89, 12, .18); --hold-ink: #FFB27A; --hold: #F0782D;
  --winter-soft: rgba(42, 126, 166, .22); --winter-ink: #93CBE6;
  --summer-soft: rgba(216, 138, 28, .18); --summer-ink: #F1BA6A;
  --beam: #56606B;
  --pick: #E6E9ED;
  color-scheme: dark;
}
html[data-theme="dark"] a:not(.btn):not(.menu-item):not(.tb-link):not(.home):not(.sp-brand):not(.plain) { color: #8DB3E2; }
html[data-theme="dark"] .menu-item, html[data-theme="dark"] .menu a.menu-item { color: var(--fg); }

/* przyciski, pola, przełączniki */
html[data-theme="dark"] .btn:hover { border-color: #46505C; }
html[data-theme="dark"] .btn-dark { background: #E6E9ED; border-color: #E6E9ED; color: #15191E; }
html[data-theme="dark"] .btn-dark:hover { background: #C9D0D7; border-color: #C9D0D7; }
html[data-theme="dark"] .btn-danger:hover { border-color: rgba(238, 106, 96, .45); }
html[data-theme="dark"] .btn-danger-solid { background: #C2392F; border-color: #C2392F; color: #fff; }
html[data-theme="dark"] .btn-danger-solid:hover { background: #A9322A; }
html[data-theme="dark"] .btn-ghost:hover { background: rgba(255, 255, 255, .07); }
html[data-theme="dark"] .input, html[data-theme="dark"] select.input, html[data-theme="dark"] textarea.input { border-color: #3A434E; background: #12171C; }
html[data-theme="dark"] .input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(92, 141, 203, .25); }
html[data-theme="dark"] .input::placeholder { color: #6E7883; }
html[data-theme="dark"] .switch input, html[data-theme="dark"] .theme-item .mini-sw { background: #3A434E; }
html[data-theme="dark"] .theme-item[aria-checked="true"] .mini-sw { background: var(--navigator); }
/* wybrane pozycje (dawniej czarne tło) – jasne, żeby nie wyglądały jak dziury */
html[data-theme="dark"] .seg input:checked + label,
html[data-theme="dark"] .side button[aria-current="true"],
html[data-theme="dark"] .rp-seg button[aria-pressed="true"],
html[data-theme="dark"] .pm-salons button[aria-selected="true"],
html[data-theme="dark"] .map-switch button[aria-selected="true"] { background: #E6E9ED; color: #15191E; }
html[data-theme="dark"] .map-switch button[aria-selected="true"] .ms-n { background: rgba(21, 25, 30, .14); }
html[data-theme="dark"] .map-switch button:not([aria-selected="true"]) .ms-n { background: color-mix(in srgb, var(--tic, #fff) 26%, transparent); color: color-mix(in srgb, var(--tic, #fff) 38%, #fff); }
html[data-theme="dark"] .map-switch button[data-map="main"][aria-selected="true"] .ms-n { background: #C9A564; color: #15191E; }
html[data-theme="dark"] .toast { background: #2A323B; color: #F1F3F5; box-shadow: 0 8px 24px rgba(0,0,0,.55); }
html[data-theme="dark"] .toast.error { background: #B6342B; }
html[data-theme="dark"] .toast.ok { background: #2C7651; }
html[data-theme="dark"] .pill.ok { border-color: rgba(63, 170, 115, .4); color: #7ED3A3; }
html[data-theme="dark"] .pill.warn { border-color: rgba(234, 164, 58, .4); }
html[data-theme="dark"] .pill.bad { border-color: rgba(238, 106, 96, .4); }
html[data-theme="dark"] .notice { color: #F0C27A; border-color: rgba(234, 164, 58, .35); }
html[data-theme="dark"] dialog.modal::backdrop { background: rgba(0, 0, 0, .6); }
html[data-theme="dark"] .mono.plate, html[data-theme="dark"] .res-car-meta .plate { background: #E6E9ED; color: #15191E; border-color: #E6E9ED; }
html[data-theme="dark"] .acc-pg input, html[data-theme="dark"] .check input { accent-color: var(--accent); }

/* ---------- Mapa w trybie ciemnym: zdjęcie i auta bez przyciemnienia, tylko minimalnie zapalone światła aut ---------- */
html[data-theme="dark"] #map, html[data-theme="dark"] .leaflet-container { background: #0B0E12; }
html[data-theme="dark"] .tile.car .t-lights {
  display: block; position: absolute; pointer-events: none;
  /* obrys auta: przód u góry kafelka, tył na dole; pole świateł wychodzi poza auto (przed autem – snop światła) */
  top: -34%; bottom: -14%; left: -30%; right: -30%;
  background:
    radial-gradient(ellipse 9% 3.4% at 33.6% 25.4%, rgba(255, 244, 214, .5), rgba(255, 244, 214, 0) 100%),
    radial-gradient(ellipse 9% 3.4% at 66.4% 25.4%, rgba(255, 244, 214, .5), rgba(255, 244, 214, 0) 100%),
    radial-gradient(ellipse 30% 11% at 50% 15%, rgba(255, 238, 196, .1), rgba(255, 238, 196, 0) 100%),
    radial-gradient(ellipse 7.5% 2.6% at 32.5% 88.4%, rgba(255, 46, 46, .42), rgba(255, 46, 46, 0) 100%),
    radial-gradient(ellipse 7.5% 2.6% at 67.5% 88.4%, rgba(255, 46, 46, .42), rgba(255, 46, 46, 0) 100%);
}
html[data-theme="dark"] .tile.car.ghost .t-lights, html[data-theme="dark"] .tile.small .t-lights { opacity: .7; }
html[data-theme="dark"] .leaflet-control-zoom a { background: var(--surface); color: var(--fg); border-color: var(--line); }
html[data-theme="dark"] .leaflet-control-zoom a:hover { background: var(--surface-2); }
html[data-theme="dark"] .leaflet-control-attribution { background: rgba(23, 28, 34, .7) !important; color: var(--muted); }
html[data-theme="dark"] .vc-tools .icon-btn { background: rgba(23, 28, 34, .85); }
html[data-theme="dark"] .avatar img, html[data-theme="dark"] .topbar .org img, html[data-theme="dark"] .org-block > header img { background: #E6E9ED; }
html[data-theme="dark"] .rot-handle b { background: #E6E9ED; }
html[data-theme="dark"] .pill.drive, html[data-theme="dark"] .vc-drive.on, html[data-theme="dark"] .cw-info.now { background: rgba(92, 141, 203, .16); border-color: rgba(92, 141, 203, .4); color: #A9C6EA; }
html[data-theme="dark"] .vc-drive { border-left-color: #4A535E; }
html[data-theme="dark"] .vc-hold-left { background: transparent; border-color: rgba(240, 120, 45, .55); }
html[data-theme="dark"] .btn-hold, html[data-theme="dark"] .vc-hold, html[data-theme="dark"] .hc-day.in { border-color: rgba(240, 120, 45, .45); }
html[data-theme="dark"] .btn-hold:hover { background: rgba(232, 89, 12, .28); border-color: rgba(240, 120, 45, .65); }
html[data-theme="dark"] .hc-day.end.today::after { background: var(--surface); }
html[data-theme="dark"] .btn-demo { background: rgba(92, 160, 230, .2); border-color: rgba(92, 160, 230, .5); color: #A9D0F5; }
html[data-theme="dark"] .pdi-badge.ok, html[data-theme="dark"] .pdi-switch[aria-checked="true"] .pdi-knob { color: #6FD39A; }
html[data-theme="dark"] .pdi-knob { background: #E6E9ED; }
html[data-theme="dark"] .draft-note { color: #F0C27A; }
html[data-theme="dark"] .res-lock { border-color: rgba(234, 164, 58, .35); }

/* zlecenia */
html[data-theme="dark"] .btn-ord.pdi, html[data-theme="dark"] .vc-ord.pdi { border-color: rgba(240, 140, 0, .45); }
html[data-theme="dark"] .btn-ord.service, html[data-theme="dark"] .vc-ord.service { border-color: rgba(40, 140, 215, .55); }
html[data-theme="dark"] .btn-ord.tech, html[data-theme="dark"] .vc-ord.tech { border-color: rgba(226, 58, 46, .5); }
html[data-theme="dark"] .btn-ord.pdi:hover { background: rgba(240, 140, 0, .25); }
html[data-theme="dark"] .btn-ord.service:hover { background: rgba(0, 102, 177, .34); }
html[data-theme="dark"] .btn-ord.tech:hover { background: rgba(226, 58, 46, .28); }

/* kalendarze: myjnia, pokój, rezerwacje */
html[data-theme="dark"] .cw-cell:not([aria-disabled="true"]):hover { background: rgba(242, 193, 78, .14); }
html[data-theme="dark"] .cw-cell.past { background: repeating-linear-gradient(135deg, #161B20 0 6px, #1A2026 6px 12px); }
html[data-theme="dark"] .cw-cell.sel { background: rgba(242, 193, 78, .32) !important; }
html[data-theme="dark"] .cw-bk.own { background: rgba(217, 162, 27, .2); }
html[data-theme="dark"] .cw-bk.bad { background: rgba(238, 106, 96, .18); }
html[data-theme="dark"] .cw-day { border-left-color: #222930; }
html[data-theme="dark"] .cw-day:hover { background: var(--surface-2); }
html[data-theme="dark"] .cw-cell { border-left-color: #222930; border-top-color: #1E242B; }
html[data-theme="dark"] .cw-cell.full { border-top-color: #2B333C; }
html[data-theme="dark"] .cw-cell.we { background: #14191E; }
html[data-theme="dark"] .cal-week.km-ok .cw-cell:not([aria-disabled="true"]) { background: rgba(80, 200, 120, .10); }
html[data-theme="dark"] .cal-week.km-ok .cw-cell:not([aria-disabled="true"]):hover { background: rgba(242, 193, 78, .14); }
html[data-theme="dark"] .cw-cell.dayfull { background: repeating-linear-gradient(135deg, #22181A 0 5px, #2A1C1E 5px 10px); }
html[data-theme="dark"] .res-car:hover { border-color: #46505C; }
html[data-theme="dark"] .res-car-img i { border-color: #4A535E; }

/* porównanie i lista aut */
html[data-theme="dark"] .lw-table tr.picked td { background: #232A33; }
html[data-theme="dark"] .cmp-tbl tr.diff td { background: rgba(242, 193, 78, .09); }
html[data-theme="dark"] .cmp-tbl tr.diff th { background: rgba(242, 193, 78, .15); }
html[data-theme="dark"] .cmp-chip i { background: #E6E9ED; }
html[data-theme="dark"] .cmp-mode[aria-pressed="true"] { background: #E6E9ED; border-color: #E6E9ED; color: #15191E; }

/* ---------- Panele (kierownik, sieć, właściciel), strona startowa, przechowalnia ---------- */
html[data-theme="dark"] .topbar { background: #0A0D10; border-bottom: 1px solid #1F262E; }
html[data-theme="dark"] .lotcard:hover { border-color: #46505C; }
html[data-theme="dark"] .lotcard .sign { border-color: #E6E9ED; }
html[data-theme="dark"] .picker .none-yet, html[data-theme="dark"] .drop, html[data-theme="dark"] .tz-none, html[data-theme="dark"] .tz-start { border-color: #3A434E; }
html[data-theme="dark"] .fe-row .nm input:focus { background: #12171C; }
html[data-theme="dark"] .rp-grid { stroke: #232A32; }
html[data-theme="dark"] .rp-axis { stroke: #3A434E; }
html[data-theme="dark"] .rp-tick.we { fill: #6E7883; }
html[data-theme="dark"] .rp-tip, html[data-theme="dark"] .bars i:hover::after { background: #2A323B; }
html[data-theme="dark"] .rp-share { background: #262D35; }
html[data-theme="dark"] .pm-g.g1, html[data-theme="dark"] .pm-k.g1 { background: #1D232A !important; }
html[data-theme="dark"] .pm-c.g1 { background: #191E24; }
html[data-theme="dark"] .pm-cell { border-color: #3A434E; }
html[data-theme="dark"] .pm-cell:hover:not(:disabled) { background: rgba(63, 170, 115, .15); }
html[data-theme="dark"] .pm-cell:disabled { border-color: #2B333C; }
html[data-theme="dark"] .pm-cell.on:disabled { background: #3D6B54; border-color: #3D6B54; }
html[data-theme="dark"] .pm-tbl tbody tr:hover td.hk { background-color: #22324A !important; }
html[data-theme="dark"] .own-qr { background: #fff; } /* kod QR musi zostać czarno-biały */
html[data-theme="dark"] .tz-card:hover { border-color: #46505C; }
html[data-theme="dark"] .tz-sw.free, html[data-theme="dark"] .tz-half.free { background: #232A32; box-shadow: inset 0 0 0 1px #343D47; }
html[data-theme="dark"] .tz-sign { background: #E6E9ED; color: #15191E; box-shadow: none; }
html[data-theme="dark"] .tz-act.a-add, html[data-theme="dark"] .tz-act.a-back { border-color: rgba(63, 170, 115, .4); color: #7ED3A3; }
html[data-theme="dark"] .tz-act.a-move { border-color: rgba(92, 141, 203, .45); color: #A9C6EA; }
html[data-theme="dark"] .tz-act.a-out { background: #262D35; color: var(--fg); border-color: #3A434E; }
html[data-theme="dark"] .tz-found .ok { color: #7ED3A3; }
html[data-theme="dark"] .tz-found .warn { color: #F0C27A; }

/* wybrane / aktywne elementy, które w jasnym trybie mają czarne tło */
html[data-theme="dark"] .chip-btn.st-toggle[aria-pressed="true"],
html[data-theme="dark"] .cal-view button[aria-pressed="true"],
html[data-theme="dark"] .svc-pay button[aria-checked="true"],
html[data-theme="dark"] .vc-pick.on { background: #E6E9ED; border-color: #E6E9ED; color: #15191E; }
html[data-theme="dark"] .ord-btn .badge, html[data-theme="dark"] .cal-btn-n,
html[data-theme="dark"] .lw-table td.lw-pick b, html[data-theme="dark"] .cmp-n { background: #E6E9ED; color: #15191E; }
html[data-theme="dark"] .lw-table td.lw-pick input { accent-color: #E6E9ED; }
html[data-theme="dark"] .chip-btn.avatar { background: #2A323B; border-color: #3A434E; }
html[data-theme="dark"] .ord-note.sum { --oc: var(--fg); --oi: var(--fg); }
html[data-theme="dark"] .tz-tabs button[aria-selected="true"] { border-bottom-color: var(--fg); }
html[data-theme="dark"] .tz-reasons label:has(input:checked) { border-color: var(--fg); box-shadow: 0 0 0 1px var(--fg) inset; }
/* pływające paski (tryb stawiania, porównanie) – odcięte od ciemnej mapy */
html[data-theme="dark"] .mode-bar, html[data-theme="dark"] .cmp-bar { background: #232A33; box-shadow: 0 0 0 1px #3A434E, 0 14px 36px rgba(0, 0, 0, .55); }
html[data-theme="dark"] .cw-day.today { background: var(--navigator); color: #fff; }
html[data-theme="dark"] .cw-bk { background: rgba(92, 141, 203, .26); }
html[data-theme="dark"] .cw-bk.picked { box-shadow: 0 0 0 2px var(--fg); }
html[data-theme="dark"] .cw-bk:hover { box-shadow: 0 3px 8px rgba(0, 0, 0, .45); }
/* jazda testowa */
html[data-theme="dark"] .vc-drive.ready { background: rgba(63, 170, 115, .14); }
html[data-theme="dark"] .drv-time b, html[data-theme="dark"] .vc-drive .drv-time b { color: #6FD39A; }

/* kafel z logo (telefon i tablet): jasna pinezka na ciemnym tle */
html[data-theme="dark"] .chip-btn.home-map { color: #E6E9ED; }
html[data-theme="dark"] .chip-btn.home-map[aria-pressed="true"] { border-color: #E6E9ED; box-shadow: inset 0 0 0 1px #E6E9ED, var(--shadow); }

/* znak StokPilot na jasnym tle – w trybie ciemnym jasny z jasnozłotym */
html[data-theme="dark"] .sp-brand.on-light { --sp-gold: #dcbc80; color: #f3f1eb; }
/* leady */
html[data-theme="dark"] { --lead: #8E6CF0; --lead-soft: rgba(142, 108, 240, .17); --lead-ink: #C4B2FA; }

/* szkody i wymiana kół – kolory w trybie ciemnym (tła półprzezroczyste, napisy jaśniejsze) */
html[data-theme="dark"] {
  --dmg: #E0528C; --dmg-soft: rgba(224, 82, 140, .16); --dmg-ink: #FF9CC4; --dmg-line: rgba(224, 82, 140, .45);
  --ord-wh: #7FB24E; --ord-wh-soft: rgba(127, 178, 78, .15); --ord-wh-ink: #B7DE8F; --ord-wh-line: rgba(127, 178, 78, .45);
}
html[data-theme="dark"] .btn-ord.damage:hover { background: rgba(224, 82, 140, .28); }
html[data-theme="dark"] .dmg-tags i, html[data-theme="dark"] .dmg-strip span { background: var(--surface); }
html[data-theme="dark"] .dmg-strip img { background: var(--surface-2); }
html[data-theme="dark"] .vc-ord.damage p, html[data-theme="dark"] .vc-ord.wheels p { color: var(--fg); }
html[data-theme="dark"] .dmg-car .dmg-body { fill: #222A33; stroke: #4A5562; }
html[data-theme="dark"] .dmg-car .dmg-glass { fill: #39434F; }
html[data-theme="dark"] .dmg-car text { fill: #8E9AA8; }
html[data-theme="dark"] .dmg-drop { border-color: #39424D; }
html[data-theme="dark"] .ms-tile { background: linear-gradient(150deg, color-mix(in srgb, var(--tc) 17%, var(--surface)) 0%, var(--surface) 62%); border-color: color-mix(in srgb, var(--tc) 26%, var(--line)); }
html[data-theme="dark"] .ms-tile:hover { border-color: color-mix(in srgb, var(--tc) 60%, var(--line)); }
html[data-theme="dark"] .cal-btn-n { box-shadow: 0 0 0 2px #15191E; }
html[data-theme="dark"] .wh-hint { background: rgba(92, 141, 203, .14); border-color: rgba(92, 141, 203, .4); color: #A9C6EA; }
html[data-theme="dark"] .wh-tag.ready { background: rgba(127, 178, 78, .22); color: #B7DE8F; }
html[data-theme="dark"] .wh-set:hover { background: var(--surface-2); border-color: #46505C; }

/* ciemny motyw: kolory funkcji rozjaśnione na ikonach białych/ciemnych przycisków */
html[data-theme="dark"] #btnStatus:not([aria-pressed="true"]) svg, html[data-theme="dark"] #btnLeadSend svg, html[data-theme="dark"] #btnLeads svg, html[data-theme="dark"] #btnStats svg,
html[data-theme="dark"] #btnOrders svg, html[data-theme="dark"] #btnOutTable svg, html[data-theme="dark"] .map-switch button:not([aria-selected="true"]) svg,
html[data-theme="dark"] .m-dock-btn:not(.go):not(.gold):not([aria-pressed="true"]) svg { color: color-mix(in srgb, var(--tic) 55%, #fff); }

/* Kolory zleceń – ciemny motyw */
html[data-theme="dark"] {
  --ord-wash-soft: rgba(14, 154, 167, .18); --ord-wash-ink: #6FD3DC; --ord-wash-line: rgba(14, 154, 167, .5);
  --ord-other: #7A7AE6; --ord-other-soft: rgba(91, 91, 214, .2); --ord-other-ink: #B5B5F5; --ord-other-line: rgba(122, 122, 230, .5);
}
html[data-theme="dark"] .btn-ord.wash:hover { background: rgba(14, 154, 167, .28); }
html[data-theme="dark"] .btn-ord.other:hover { background: rgba(91, 91, 214, .3); }
html[data-theme="dark"] .vc-ord.wash p, html[data-theme="dark"] .vc-ord.other p { color: var(--fg); }
html[data-theme="dark"] .due-tag { background: rgba(255, 255, 255, .06); }
html[data-theme="dark"] .due-tag.soon { background: rgba(240, 140, 0, .16); color: #FFC078; box-shadow: inset 0 0 0 1px rgba(240, 140, 0, .45); }
html[data-theme="dark"] .due-tag.late { background: rgba(226, 58, 46, .18); color: #FF9C94; box-shadow: inset 0 0 0 1px rgba(226, 58, 46, .5); }
html[data-theme="dark"] .modal .input, html[data-theme="dark"] .modal select.input, html[data-theme="dark"] .modal textarea.input { border-color: #46505C; }
html[data-theme="dark"] .modal .input::placeholder { color: #7E8893; }
/* karta auta – ciemny motyw strony logowania */
html[data-theme="dark"] .vcard, html[data-theme="dark"] #hoverCard {
  --surface: #182226; --surface-2: #213036; --line: rgba(255, 255, 255, .13); --fg: #F3F1EB; --fg-2: #C4D0CB; --muted: #98A3A4;
  background: linear-gradient(165deg, #1C2A2F 0%, #141E22 55%, #10181B 100%); border-color: rgba(220, 188, 128, .5);
  box-shadow: 0 26px 56px -24px rgba(0, 0, 0, .8), 0 0 0 1px rgba(220, 188, 128, .12);
}
html[data-theme="dark"] .vcard .vc-days b { color: #F3F1EB; }
html[data-theme="dark"] .vcard .vc-tools .icon-btn { background: rgba(16, 24, 27, .88); box-shadow: inset 0 0 0 1px rgba(220, 188, 128, .35); color: #F3F1EB; }
html[data-theme="dark"] .vcard .vc-actions { border-top-color: rgba(220, 188, 128, .3); }
