/* StokPilot – wspólne style: kolory, kroje, przyciski, pola, okna. */
/* Barlow – krój inspirowany oznakowaniem dróg i tablicami rejestracyjnymi; Barlow Condensed – nagłówki i przyciski. */
@font-face { font-family: "Barlow"; font-weight: 400; font-display: swap; src: url(/fonts/barlow-latin-400-normal.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Barlow"; font-weight: 400; font-display: swap; src: url(/fonts/barlow-latin-ext-400-normal.woff2) format("woff2"); unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Barlow"; font-weight: 500; font-display: swap; src: url(/fonts/barlow-latin-500-normal.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Barlow"; font-weight: 500; font-display: swap; src: url(/fonts/barlow-latin-ext-500-normal.woff2) format("woff2"); unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Barlow"; font-weight: 600; font-display: swap; src: url(/fonts/barlow-latin-600-normal.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Barlow"; font-weight: 600; font-display: swap; src: url(/fonts/barlow-latin-ext-600-normal.woff2) format("woff2"); unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Barlow"; font-weight: 700; font-display: swap; src: url(/fonts/barlow-latin-700-normal.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Barlow"; font-weight: 700; font-display: swap; src: url(/fonts/barlow-latin-ext-700-normal.woff2) format("woff2"); unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Barlow Condensed"; font-weight: 500; font-display: swap; src: url(/fonts/barlow-condensed-latin-500-normal.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Barlow Condensed"; font-weight: 500; font-display: swap; src: url(/fonts/barlow-condensed-latin-ext-500-normal.woff2) format("woff2"); unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Barlow Condensed"; font-weight: 600; font-display: swap; src: url(/fonts/barlow-condensed-latin-600-normal.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Barlow Condensed"; font-weight: 600; font-display: swap; src: url(/fonts/barlow-condensed-latin-ext-600-normal.woff2) format("woff2"); unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Barlow Condensed"; font-weight: 700; font-display: swap; src: url(/fonts/barlow-condensed-latin-700-normal.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Barlow Condensed"; font-weight: 700; font-display: swap; src: url(/fonts/barlow-condensed-latin-ext-700-normal.woff2) format("woff2"); unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }

:root {
  /* Asfalt, beton, papier, linia, niebieski znak drogowy */
  --ink: #15191E;
  --ink-2: #262C34;
  --concrete: #EDEFF1;
  --paper: #FFFFFF;
  --line: #D9DDE2;
  --navigator: #3E6FA8;
  --navigator-dark: #335C8C;
  --marking: #F2C14E;        /* żółte oznakowanie poziome – tylko drobne akcenty */
  --bg: var(--concrete);
  --surface: var(--paper);
  --surface-2: #F4F5F7;
  --glass: rgba(255, 255, 255, 0.95);
  --fg: var(--ink);
  --fg-2: #3A424C;
  --muted: #69727D;
  --accent: var(--navigator);
  --accent-fg: #FFFFFF;
  --accent-soft: #E7EEF7;
  --go: #2F7D57;
  --go-hover: #286B4A;
  --danger: #B4322B;
  --danger-soft: #FBEAE8;
  --warn: #A86500;
  --warn-soft: #FFF3DC;
  --ok-soft: #E6F3EC;
  --shadow: 0 10px 30px rgba(21, 25, 30, 0.14), 0 1px 3px rgba(21, 25, 30, 0.08);
  --shadow-s: 0 1px 2px rgba(21, 25, 30, 0.08);
  --radius: 6px;
  --font: "Barlow", "Segoe UI", system-ui, -apple-system, sans-serif;
  --display: "Barlow Condensed", "Barlow", "Arial Narrow", sans-serif;
  --mono: "Cascadia Mono", Consolas, ui-monospace, "SFMono-Regular", monospace;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; font-family: var(--font); color: var(--fg); background: var(--bg); font-size: 15.5px; line-height: 1.45; -webkit-font-smoothing: antialiased; }
[hidden] { display: none !important; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--navigator); outline-offset: 2px; }
a { color: var(--navigator); }
h1, h2, h3 { font-family: var(--display); font-weight: 600; letter-spacing: .01em; line-height: 1.1; }
.mono { font-family: var(--mono); letter-spacing: 0.02em; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 42px; padding: 0 18px; border-radius: var(--radius); border: 1px solid var(--line);
  background: var(--surface); color: var(--fg); font-family: var(--display); font-weight: 600; font-size: 16px; letter-spacing: .03em; cursor: pointer;
  transition: background .15s, border-color .15s, transform .05s; white-space: nowrap; text-decoration: none;
}
.btn:hover { background: var(--surface-2); border-color: #C5CBD2; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn svg { width: 18px; height: 18px; flex: none; }
.btn-primary, .btn-go { background: var(--navigator); border-color: var(--navigator); color: #fff; }
.btn-primary:hover, .btn-go:hover { background: var(--navigator-dark); border-color: var(--navigator-dark); }
.btn-dark { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn-dark:hover { background: var(--ink-2); border-color: var(--ink-2); }
.btn-danger { color: var(--danger); }
.btn-danger:hover { background: var(--danger-soft); border-color: #E7B7B2; }
.btn-danger-solid { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger-solid:hover { background: #9C2A24; }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: rgba(21, 25, 30, .06); border-color: transparent; }
.btn-sm { min-height: 34px; padding: 0 12px; font-size: 15px; }

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > span, .label { font-size: 13.5px; font-weight: 600; color: var(--fg-2); }
.field small { color: var(--muted); font-size: 12.5px; }
.field .err { color: var(--danger); font-size: 13px; font-style: normal; }
.input, select.input, textarea.input {
  width: 100%; min-height: 44px; padding: 10px 12px; border-radius: var(--radius); border: 1px solid #C9CFD6;
  background: var(--surface); color: var(--fg); outline: none; transition: border-color .15s, box-shadow .15s;
}
textarea.input { min-height: 72px; resize: vertical; }
.input:focus { border-color: var(--navigator); box-shadow: 0 0 0 3px rgba(62, 111, 168, .18); }
.input.invalid { border-color: var(--danger); }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 520px) { .row2 { grid-template-columns: 1fr; } }
.check { display: inline-flex; gap: 8px; align-items: center; cursor: pointer; font-weight: 500; }
.check input { width: 18px; height: 18px; accent-color: var(--navigator); margin: 0; }

.seg { display: inline-grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 3px; gap: 3px; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label { padding: 8px 16px; border-radius: 5px; text-align: center; font-family: var(--display); font-weight: 600; font-size: 16px; cursor: pointer; letter-spacing: .03em; color: var(--fg-2); }
.seg input:checked + label { background: var(--ink); color: #fff; }
.seg input:focus-visible + label { outline: 2px solid var(--navigator); }

.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; }
.switch input { appearance: none; width: 38px; height: 22px; border-radius: 22px; background: #C9CFD6; position: relative; cursor: pointer; transition: background .15s; flex: none; margin: 0; }
.switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 2px rgba(0,0,0,.3); }
.switch input:checked { background: var(--navigator); }
.switch input:checked::after { transform: translateX(16px); }

dialog.modal {
  border: none; padding: 0; border-radius: 10px; background: var(--surface); color: var(--fg);
  box-shadow: var(--shadow); width: min(580px, calc(100vw - 24px)); max-height: calc(100dvh - 24px);
}
dialog.modal.wide { width: min(860px, calc(100vw - 24px)); }
dialog.modal::backdrop { background: rgba(21, 25, 30, 0.55); }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 20px 4px; }
.modal-head h2 { margin: 0; font-size: 26px; }
.modal-body { padding: 12px 20px; display: flex; flex-direction: column; gap: 14px; overflow: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 12px 20px 18px; flex-wrap: wrap; }
.icon-btn { width: 38px; height: 38px; border-radius: 8px; border: none; background: transparent; display: grid; place-items: center; cursor: pointer; color: var(--fg-2); }
.icon-btn:hover { background: var(--surface-2); }
.icon-btn svg { width: 20px; height: 20px; }

.toast-wrap { position: fixed; left: 50%; top: calc(76px + env(safe-area-inset-top, 0px)); transform: translateX(-50%); z-index: 3000; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; width: max-content; max-width: calc(100vw - 32px); }
.toast { background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 8px; font-weight: 600; box-shadow: var(--shadow); font-size: 14.5px; animation: toastIn .2s ease; }
.toast.error { background: var(--danger); }
.toast.ok { background: var(--go); }
@keyframes toastIn { from { opacity: 0; transform: translateY(-6px); } }

.pill { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px; border-radius: 999px; font-size: 12.5px; font-weight: 600; background: var(--surface-2); color: var(--fg-2); white-space: nowrap; border: 1px solid var(--line); }
.pill.ok { background: var(--ok-soft); color: var(--go); border-color: #BFE0CD; }
.pill.warn { background: var(--warn-soft); color: var(--warn); border-color: #F1D49C; }
.pill.bad { background: var(--danger-soft); color: var(--danger); border-color: #EDC0BB; }
.dot { width: 10px; height: 10px; border-radius: 3px; display: inline-block; flex: none; }
.form-err { background: var(--danger-soft); color: var(--danger); padding: 10px 12px; border-radius: var(--radius); font-weight: 600; font-size: 14px; }
.notice { background: var(--warn-soft); color: #6E4600; border: 1px solid #F1D49C; padding: 10px 14px; border-radius: var(--radius); font-weight: 500; }
.empty { padding: 18px; color: var(--muted); text-align: center; }

/* Pasek ogłoszeń serwisowych (prace, przerwy) */
.maint { position: fixed; z-index: 2500; left: 0; right: 0; top: 0; background: var(--marking); color: var(--ink); font-weight: 600; text-align: center; padding: 6px 40px; font-size: 14px; }
.maint button { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); border: 0; background: transparent; cursor: pointer; font-size: 18px; line-height: 1; }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; } }

/* Uprawnienia konta w salonie – grupy pól wyboru */
.acc-perms { display: grid; gap: 8px; }
.acc-pg { display: flex; flex-wrap: wrap; gap: 4px 14px; align-items: center; }
.acc-pg > span { width: 100%; font-size: 12.5px; font-weight: 600; color: var(--muted); }
.acc-pg label { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; white-space: nowrap; cursor: pointer; }
.acc-pg input { margin: 0; accent-color: var(--navigator); }
.acc-tbl select[data-role] { min-width: 132px; }

/* ============ Mikroanimacje: otwieranie i zamykanie ============ */
/* osobne właściwości translate/scale – nie kolidują z transform używanym do centrowania okien */
/* Jedno miejsce na tempo animacji: otwieranie ok. 0,5 s z miękkim wyhamowaniem (większość ruchu w pierwszej połowie,
   więc okno jest od razu „pod ręką”), zamykanie krócej – żeby nie czekać na zniknięcie okna. */
:root { --sp-open: .5s; --sp-close: .3s; --sp-fast: .2s; --sp-ease: cubic-bezier(.16, 1, .3, 1); --sp-ease-close: cubic-bezier(.4, 0, .8, .4); }
@keyframes spIn { from { opacity: 0; translate: var(--in-x, 0) var(--in-y, -6px); scale: var(--in-s, .985); } }
@keyframes spOut { to { opacity: 0; translate: var(--in-x, 0) var(--in-y, -6px); scale: var(--in-s, .985); } }
@keyframes spPop { from { opacity: 0; translate: 0 10px; scale: .96; } }
@keyframes spPopOut { to { opacity: 0; translate: 0 6px; scale: .97; } }
@keyframes spFade { from { opacity: 0; } }
@keyframes spFadeOut { to { opacity: 0; } }
dialog.modal[open] { animation: spPop var(--sp-open) var(--sp-ease); }
dialog.modal[open]::backdrop { animation: spFade var(--sp-open) var(--sp-ease); }
dialog.modal.sp-closing { animation: spPopOut var(--sp-close) var(--sp-ease-close) forwards; }
dialog.modal.sp-closing::backdrop { animation: spFadeOut var(--sp-close) var(--sp-ease-close) forwards; }
dialog.modal .modal-head { cursor: grab; touch-action: none; }
dialog.modal.dragging .modal-head { cursor: grabbing; }
dialog.modal.dragging { user-select: none; }
.toast.sp-closing { animation: spOut var(--sp-close) var(--sp-ease-close) forwards; --in-y: -8px; }
/* Pozostałe okna, panele i menu wszystkich stron (mapa, panel salonu, przechowalnia, panel właściciela) */
.toast { animation: spIn var(--sp-open) var(--sp-ease); --in-y: -10px; }
.menu:not([hidden]) { animation: spIn var(--sp-open) var(--sp-ease); --in-y: -8px; transform-origin: top; }
.menu.sp-closing { animation: spOut var(--sp-close) var(--sp-ease-close) forwards; --in-y: -8px; }
.stw:not([hidden]), .rgw:not([hidden]) { animation: spPop var(--sp-open) var(--sp-ease); }
.stw.sp-closing, .rgw.sp-closing { animation: spPopOut var(--sp-close) var(--sp-ease-close) forwards; }
.lw-backdrop.sp-closing { animation: spFadeOut var(--sp-close) var(--sp-ease-close) forwards; }
.rgw-side:not([hidden]) { animation: spIn var(--sp-open) var(--sp-ease); --in-x: 18px; --in-y: 0; --in-s: 1; }
.ord-card.sp-closing:not([hidden]) { animation: spOut var(--sp-close) var(--sp-ease-close) forwards; --in-x: 14px; --in-y: 0; }
#leadPanel.sp-closing:not([hidden]) { animation: spOut var(--sp-close) var(--sp-ease-close) forwards; --in-y: -8px; }
.form-err:not([hidden]), .notice { animation: spIn var(--sp-open) var(--sp-ease); --in-y: -4px; --in-s: 1; }
details[open] > :not(summary) { animation: spIn var(--sp-open) var(--sp-ease); --in-y: -6px; --in-s: 1; }
.main > .tab:not([hidden]), .tz-pane:not([hidden]) { animation: spIn var(--sp-open) var(--sp-ease); --in-y: 6px; --in-s: 1; }
#main > header, #main > .tbl-wrap, #main > .bk-plan, #main > .notice, #main > .card, #main > section { animation: spIn var(--sp-open) var(--sp-ease); --in-y: 8px; --in-s: 1; }
@media (prefers-reduced-motion: reduce) {
  dialog.modal[open], dialog.modal[open]::backdrop, dialog.modal.sp-closing, .toast, .menu, .stw, .rgw, .rgw-side, .ord-card, .form-err, .notice, details > *, .tz-pane, .main > .tab, #main > * { animation: none !important; }
}

/* ---------- Znak StokPilot (jak w panelu logowania): pinezka z trzema słupkami + „Stok” „Pilot” ---------- */
.sp-brand { --sp-gold: #dcbc80; display: inline-flex; align-items: center; gap: .3em; font-family: "Segoe UI", system-ui, -apple-system, Arial, sans-serif;
  font-weight: 600; letter-spacing: -.035em; line-height: 1; white-space: nowrap; color: inherit; text-decoration: none; }
.sp-brand svg { width: .8em; height: 1em; flex: none; overflow: visible; }
.sp-brand .g { color: var(--sp-gold); }
.sp-brand.on-light { --sp-gold: #a8864d; color: #111b1e; }
.sp-legal { font-size: 11.5px; color: var(--fg-3, #8a939c); letter-spacing: .01em; }
.sp-legal .legal-link { color: inherit; text-decoration: underline; text-underline-offset: 2px; margin-left: 10px; white-space: nowrap; }
.sp-legal .legal-link:hover { color: var(--fg); }
.menu-legal { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px 6px; margin-top: 6px; border-top: 1px solid var(--line); }
.menu-legal .sp-brand { font-size: 15px; }
.menu-legal { flex-wrap: wrap; }
.menu-legal .sp-legal { display: flex; flex-wrap: wrap; gap: 3px 10px; min-width: 0; }
.menu-legal .sp-legal .legal-link { margin-left: 0; }
.menu-legal:only-child, .menu-legal .sp-legal:only-child { margin-left: auto; }
.page-legal { text-align: center; padding: 26px 16px 22px; }

/* Znacznik środowiska testowego (SP_ENV_LABEL): „zakładka” u góry ekranu w taśmie ostrzegawczej – nie zasłania przycisków
   (przepuszcza kliknięcia), a nie da się go pomylić z produkcją */
.sp-env { position: fixed; top: 0; left: 50%; transform: translateX(-50%); z-index: 3000; pointer-events: none; white-space: nowrap;
  padding: 3px 14px 4px; border-radius: 0 0 10px 10px; font: 700 12.5px/1.3 var(--font); color: #15191E;
  background: repeating-linear-gradient(135deg, #F2C14E 0 12px, #E4AE34 12px 24px); box-shadow: 0 2px 8px rgba(21, 25, 30, .25); }
/* Dział marki przy dostępie do salonu (salon BMW + MINI) i lista dodatkowych marek salonu */
.acc-makes { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: center; margin-top: 8px; padding: 8px 10px; border-radius: 8px; background: var(--surface-2); }
.acc-makes > span { width: 100%; font-size: 12.5px; font-weight: 700; color: var(--fg-2); }
.acc-makes small { width: 100%; font-size: 12px; color: var(--muted); }
.acc-makes .check, .chk-list .check { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; cursor: pointer; }
.chk-list { display: flex; flex-wrap: wrap; gap: 6px 16px; min-height: 38px; align-items: center; }
