/* Vozplan – wygląd. Kolory marki: granat #0B1F3B, niebieski #0D6EFD, cyjan #22C1F3, zielony #22C55E, szary #E5EAF3, tło #F8FAFC.
   Cyjan i jasny zielony tylko jako wypełnienia i akcenty (na białym tle tekst w tych kolorach byłby nieczytelny).
   Nowoczesny, spokojny, czytelny dla starszych użytkowników:
   duży tekst, przyciski min. 48 px, kontrast tekstu ≥ 4,5:1.
   Trzy wielkości interfejsu (klasa na <html>): std = standardowy, brak = duży (domyślny), xl = bardzo duży. */
:root {
  --bg: #F8FAFC;
  --brand-navy: #0B1F3B;
  --brand-blue: #0D6EFD;
  --brand-cyan: #22C1F3;
  --brand-green: #22C55E;
  --surface: #ffffff;
  --surface-2: #f7f9fc;
  --ink: #0B1F3B;
  --muted: #475569;
  --faint: #94a3b8;
  --line: #E5EAF3;
  --line-strong: #cbd5e1;
  --primary: #0B5ED7;            /* niebieski marki przyciemniony do tekstu (kontrast 5,8:1) */
  --primary-ink: #ffffff;
  --primary-soft: #E7F0FF;
  --primary-soft-ink: #0A3D91;
  --danger: #b91c1c;
  --danger-soft: #fef2f2;
  --warn-soft: #fffbeb;
  --warn-ink: #78350f;
  --good: #15803d;
  --good-soft: #f0fdf4;
  --violet-soft: #f1edff;
  --violet-ink: #4c1d95;
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .05), 0 6px 20px rgba(15, 23, 42, .06);
  --shadow-lg: 0 2px 6px rgba(15, 23, 42, .06), 0 16px 40px rgba(15, 23, 42, .10);
  --nav-h: 76px;
  color-scheme: light;
}
* { box-sizing: border-box; }
/* Wielkość liter: wybór użytkownika × --fit (przekątna ekranu, src/ui/fit.ts, wersja 88).
   Tekst podstawowy nigdy poniżej 18 px (procenty = szanują ustawienie przeglądarki). */
html { --fit: 1; font-size: max(112.5%, calc(125% * var(--fit))); -webkit-text-size-adjust: 100%; } /* duży: 20 px */
html.std { font-size: max(112.5%, calc(112.5% * var(--fit))); }  /* standardowy: 18 px */
html.xl { font-size: max(125%, calc(150% * var(--fit))); }       /* bardzo duży: 24 px */
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 1rem/1.5 "Inter", "Segoe UI Variable", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
}
h1, h2, h3, p { margin: 0; }
a { color: var(--primary); text-underline-offset: 3px; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.loading { padding: 48px; text-align: center; color: var(--muted); }
[hidden] { display: none !important; }
.ico { flex: 0 0 auto; vertical-align: -0.15em; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- pasek górny ---------- */
.top {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px;
  padding: calc(env(safe-area-inset-top) + 10px) 16px 10px;
  background: var(--brand-navy); color: #fff; border-bottom: 1px solid #0B1F3B;
}
.top h1, .brand { display: flex; align-items: center; gap: 10px; font-size: 1.15rem; font-weight: 800; letter-spacing: -.01em; color: #fff; text-decoration: none; }
.brand-mark { width: 44px; height: 44px; flex: 0 0 auto; display: block; }
/* napis marki: „Voz” biały, „plan” cyjan, pochylony i gruby (jak w logo) */
.wordmark { font-style: italic; font-weight: 850; font-size: 1.45rem; letter-spacing: -.02em; line-height: 1; color: #fff; }
.wordmark span { color: var(--brand-cyan); }
.top .spacer { flex: 1; }
.size-btn {
  min-width: 48px; min-height: 48px; border: 1px solid rgba(255, 255, 255, .45); border-radius: 14px; background: rgba(255, 255, 255, .08);
  color: #fff; font: inherit; font-weight: 800; cursor: pointer;
}
.size-btn:hover { background: rgba(255, 255, 255, .16); }

/* ---------- nawigacja: na telefonie dolny pasek, na komputerze boczny ---------- */
.nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: flex; justify-content: space-around;
  padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
  background: rgba(255, 255, 255, .94); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--line); box-shadow: 0 -4px 20px rgba(15, 23, 42, .05);
}
.nav a {
  flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 2px; min-height: 56px; justify-content: center;
  border-radius: 14px; color: var(--muted); text-decoration: none; font-size: .72rem; font-weight: 650;
}
.nav a .ico { font-size: 1.5rem; padding: 3px 14px; border-radius: 999px; box-sizing: content-box; }
/* napis pod ikoną: szerokość wg długości słowa (6 pozycji na wąskim telefonie), nigdy na sąsiedni napis (wersja 90) */
.nav a { flex: 1 1 auto; padding: 0 2px; }
.nav-lbl { display: block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; letter-spacing: -.01em; }
@media (max-width: 400px) { .nav a .ico { padding: 3px 8px; } .nav { padding-left: 2px; padding-right: 2px; } }
/* menu na dole nigdy nie poszerza strony (telefon dopasowałby ekran do za szerokiego menu i powiększył wszystko) */
@media (max-width: 959px) { .nav { overflow: hidden; } }
@media (max-width: 340px) { .nav a { font-size: .66rem; padding: 0 1px; } .nav a .ico { padding: 3px 6px; } }
.nav a.on { color: var(--primary); }
.nav a.on .ico { background: var(--primary-soft); }
main { max-width: 980px; margin: 0 auto; padding: 18px 16px calc(var(--nav-h) + 40px + env(safe-area-inset-bottom)); }
.foot { text-align: center; color: var(--faint); font-size: .8rem; padding: 0 0 calc(var(--nav-h) + 24px + env(safe-area-inset-bottom)); margin-top: -24px; }

@media (min-width: 960px) {
  .nav {
    top: 69px; right: auto; bottom: 0; width: 248px; flex-direction: column; justify-content: flex-start; gap: 4px;
    padding: 18px 12px; border-top: 0; border-right: 1px solid var(--line); box-shadow: none; background: var(--surface);
  }
  .nav a { flex: 0 0 auto; flex-direction: row; justify-content: flex-start; gap: 12px; padding: 0 14px; font-size: .95rem; min-height: 52px; }
  .nav a .ico { font-size: 1.35rem; padding: 0; background: none !important; }
  .nav a.on { background: var(--primary-soft); color: var(--primary-soft-ink); }
  main { margin-left: 248px; margin-right: 0; max-width: none; padding: 28px 36px 60px; }
  main > * { max-width: 1040px; }
  .foot { margin-left: 248px; padding-bottom: 24px; margin-top: 0; }
}

/* ---------- typografia i układ ---------- */
.title { font-size: 1.6rem; font-weight: 800; letter-spacing: -.02em; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.page-head p { margin-top: 4px; }
h3 { font-size: 1.08rem; font-weight: 750; letter-spacing: -.01em; }
.stack > * + * { margin-top: 14px; }
.row { display: flex; gap: 12px; align-items: flex-start; }
.row > * { flex: 1; min-width: 0; }
.row.wrap { flex-wrap: wrap; }
.row.wrap > * { flex: 1 1 220px; }
.between { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.align-end { align-self: flex-end; flex: 0 0 auto !important; }
.narrow { max-width: 520px; margin: 0 auto; }

/* ---------- karty ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.card.item > * + * { margin-top: 6px; }
.card.item h3 { font-size: 1.12rem; }
.card.item.off { opacity: .65; }
.card-actions { display: flex; flex-wrap: wrap; gap: 8px; padding-top: 6px; }
.rack-row { border-left: 6px solid var(--line-strong); }
.step { display: flex; align-items: center; gap: 12px; }
.step-no { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: .95rem;
  background: var(--primary); color: #fff; box-shadow: 0 4px 10px rgba(13, 110, 253, .3); flex: 0 0 auto; }

/* ---------- przyciski ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px; width: 100%; min-height: max(48px, 2.8rem);
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); border-radius: 14px;
  font: inherit; font-weight: 700; padding: 10px 18px; text-decoration: none; cursor: pointer; text-align: center;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .05); transition: background .15s, box-shadow .15s, transform .05s;
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn .ico { font-size: 1.25em; }
.btn.primary { background: linear-gradient(180deg, #0D6EFD, #0B5ED7); border-color: #0B5ED7; color: #fff; box-shadow: 0 6px 16px rgba(13, 110, 253, .28); }
.btn.primary:hover { background: #0A53BE; }
.btn.tonal { background: var(--primary-soft); border-color: transparent; color: var(--primary-soft-ink); box-shadow: none; }
.btn.danger { color: var(--danger); border-color: #fecaca; background: var(--danger-soft); box-shadow: none; }
.btn.big { min-height: max(56px, 3.2rem); font-size: 1.08rem; border-radius: 16px; }
.btn.sm { width: auto; min-height: 48px; padding: 6px 14px; font-size: .92rem; border-radius: 12px; }
.btn:disabled { opacity: .5; cursor: default; }
:focus-visible { outline: 3px solid #f59e0b; outline-offset: 2px; }

/* ---------- formularze ---------- */
label { display: block; font-weight: 650; margin-bottom: 6px; font-size: .95rem; }
input, select, textarea {
  width: 100%; min-height: max(48px, 2.8rem); font: inherit; color: var(--ink); background: var(--surface);
  border: 1.5px solid var(--line-strong); border-radius: 14px; padding: 10px 14px; transition: border-color .15s, box-shadow .15s;
}
input:hover, select:hover, textarea:hover { border-color: var(--faint); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 4px rgba(13, 110, 253, .18); }
select { appearance: none; -webkit-appearance: none; padding-right: 44px;
  background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23475569' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 14px center / 20px; }
textarea { min-height: 100px; }
input::placeholder { color: #64748b; }
.hint { display: block; margin-top: 6px; color: var(--muted); font-size: .875rem; }
.unit-input { display: flex; align-items: stretch; }
.unit-input input { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.unit { display: flex; align-items: center; padding: 0 14px; border: 1.5px solid var(--line-strong); border-left: 0; border-radius: 0 14px 14px 0;
  background: var(--surface-2); color: var(--muted); font-weight: 650; font-size: .9rem; }
.check { display: flex; align-items: center; gap: 14px; min-height: max(48px, 2.8rem); font-weight: 600; cursor: pointer; margin: 0; }
.check input { width: 26px; height: 26px; min-height: 0; flex: 0 0 auto; accent-color: var(--primary); }

/* liczba z przyciskami − / + */
.stepper { display: flex; align-items: stretch; border: 1.5px solid var(--line-strong); border-radius: 14px; overflow: hidden; background: var(--surface); }
.stepper:focus-within { border-color: var(--primary); box-shadow: 0 0 0 4px rgba(13, 110, 253, .18); }
.stepper button { width: max(48px, 2.8rem); min-height: max(48px, 2.8rem); border: 0; background: var(--surface-2); color: var(--ink); font-size: 1.3rem; cursor: pointer; display: grid; place-items: center; }
.stepper button:hover { background: var(--primary-soft); }
.stepper input { border: 0; border-radius: 0; text-align: center; font-weight: 700; min-width: 0; box-shadow: none !important; }
.stepper .unit { border: 0; border-left: 1px solid var(--line); border-right: 1px solid var(--line); border-radius: 0; }

/* przełącznik segmentowy */
.seg { display: flex; gap: 4px; flex-wrap: wrap; padding: 4px; background: #eef2f7; border-radius: 16px; }
.seg label { flex: 1 1 160px; display: flex; align-items: center; justify-content: center; gap: 8px; min-height: max(48px, 2.6rem); padding: 0 12px;
  border-radius: 12px; cursor: pointer; margin: 0; color: var(--muted); font-weight: 700; text-align: center; }
.seg label.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(15, 23, 42, .12); }
.seg input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.seg label:focus-within { outline: 3px solid #f59e0b; outline-offset: 1px; }

fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
fieldset > legend { font-weight: 750; font-size: 1.05rem; margin-bottom: 8px; padding: 0; }

/* ---------- komunikaty i oznaczenia ---------- */
.alert { display: block; background: var(--danger-soft); border: 1px solid #fecaca; color: #7f1d1d; border-radius: 14px; padding: 12px 16px; }
.alert > * + * { margin-top: 4px; }
/* informacja do wiadomości (wersja 139) – spokojna, nie czerwona */
.info-box { display: block; background: #eff6ff; border: 1px solid #bfdbfe; color: #1e3a5f; border-radius: 14px; padding: 12px 16px; }
.info-box ul { margin: 4px 0 0; padding-left: 1.3em; }
.info { background: var(--primary-soft); border: 1px solid #c7d7fe; color: var(--primary-soft-ink); border-radius: 14px; padding: 12px 16px; }
.badge { display: inline-flex; align-items: center; gap: 6px; border-radius: 999px; padding: 3px 12px; font-weight: 700; font-size: .82rem; }
.badge.todo { background: var(--warn-soft); color: var(--warn-ink); border: 1px solid #fde68a; }
.badge.sample { background: var(--violet-soft); color: var(--violet-ink); letter-spacing: .04em; }
.badge.template { background: var(--good-soft); color: #14532d; letter-spacing: .04em; margin-left: 6px; }
.summary.good { border-color: #bbf7d0; }
.summary.warn { border-color: #fecaca; background: #fffafa; }
.summary > * + * { margin-top: 4px; }
.big-number { font-size: 1.35rem; font-weight: 800; letter-spacing: -.01em; }
.result > * + * { margin-top: 6px; }

/* kafelki wskaźników */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
.kpi .k { color: var(--muted); font-size: .85rem; font-weight: 650; display: flex; align-items: center; gap: 6px; }
.kpi .v { font-size: 1.45rem; font-weight: 800; letter-spacing: -.02em; margin-top: 2px; }
.kpi .s { color: var(--muted); font-size: .82rem; }
.kpi.bad { border-color: #fecaca; background: #fffafa; }
.kpi.bad .v { color: var(--danger); }
.kpi.ok .v { color: var(--ink); }
.bar { height: 8px; border-radius: 99px; background: #e9eef5; overflow: hidden; margin-top: 8px; }
.bar > i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--brand-cyan), var(--brand-blue)); }
.bar.bad > i { background: linear-gradient(90deg, #f87171, #b91c1c); }

/* ---------- ekran startowy ---------- */
.hello { padding: 22px; border-radius: 22px; color: #fff; background: radial-gradient(120% 140% at 100% 0%, #0D6EFD 0%, #0B3A82 45%, #0B1F3B 100%);
  box-shadow: var(--shadow-lg); }
.hello h2 { font-size: 1.5rem; font-weight: 800; letter-spacing: -.02em; }
.hello p { opacity: .92; margin-top: 4px; }
.hello .btn { margin-top: 14px; width: auto; background: #fff; color: var(--brand-navy); border: 0; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.tile { display: flex; align-items: center; gap: 14px; min-height: 96px; padding: 16px; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); color: var(--ink); text-decoration: none; box-shadow: var(--shadow); transition: box-shadow .15s, transform .15s; }
.tile:hover { box-shadow: var(--shadow-lg); transform: translateY(-1px); }
.tile .tile-ico { width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center; font-size: 1.6rem; flex: 0 0 auto; }
.tile .tile-txt { flex: 1; min-width: 0; }
.tile strong { display: block; font-size: 1.05rem; }
.tile span.d { display: block; color: var(--muted); font-size: .88rem; margin-top: 2px; }
.tile > .ico:last-child { color: var(--faint); font-size: 1.3rem; }
.c-blue { background: #E7F0FF; color: #0B5ED7; } .c-green { background: #e7f8ee; color: #15803d; } .c-amber { background: #fff4dc; color: #b45309; }
.c-violet { background: #f1edff; color: #6d28d9; } .c-rose { background: #ffe9ef; color: #be123c; } .c-slate { background: #eef2f7; color: #334155; }
.quick-links { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.quick-links .btn { justify-content: flex-start; }

/* ---------- rysunki planu ---------- */
.topview { margin: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow); }
.topview svg { display: block; width: 100%; height: auto; }
.topview.vertical svg { max-height: 80vh; }
.topview figcaption { margin-top: 8px; color: var(--muted); font-size: .85rem; }
.topview svg .rack { cursor: pointer; }
.legend { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 8px 10px; }
.legend li { display: flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); font-size: .9rem; }
.swatch { width: 18px; height: 18px; border: 1.5px solid rgba(15, 23, 42, .55); border-radius: 6px; display: inline-block; flex: 0 0 auto; }
.side-views { display: grid; grid-template-columns: 3fr 1fr; gap: 12px; align-items: start; }
.scroll-x { overflow-x: auto; }
.topview.rear svg { max-height: 50vh; }
.section-tools { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.section-tools input[type=range] { flex: 1 1 220px; min-height: 48px; padding: 0; border: 0; box-shadow: none; accent-color: var(--primary); background: none; }
.section-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; align-items: start; }
@media (max-width: 700px) {
  .side-views, .section-grid { grid-template-columns: 1fr; }
  .wide:not(main) { min-width: 640px; }
  .topview.rear { max-width: 320px; }
}

/* ---------- listy, kształty ---------- */
.plain { list-style: none; padding: 0; margin: 0; }
.plain li { padding: 8px 0; border-bottom: 1px solid var(--line); }
fieldset.poly { border: 1px solid var(--line); border-radius: 16px; padding: 12px 14px; background: var(--surface-2); }
fieldset.poly legend { font-weight: 700; padding: 0 6px; }
fieldset.poly > * + * { margin-top: 10px; }
details summary { cursor: pointer; min-height: 48px; display: flex; align-items: center; }
table.pts { width: 100%; border-collapse: collapse; }
table.pts th { text-align: left; font-size: .85rem; color: var(--muted); padding: 4px; }
table.pts td { padding: 3px 4px; }
table.pts td:first-child { width: 2.5em; font-weight: 700; }
table.pts td:last-child { width: 1%; }
table.pts input { min-width: 0; }

/* ---------- podgląd druku planu (A4 poziomo) ---------- */
.sheet { background: #fff; color: #000; border: 1px solid var(--line); border-radius: 12px; padding: 18px; margin-top: 14px; font-size: .9rem; box-shadow: var(--shadow); }
.sheet > * + * { margin-top: 10px; }
.sheet h1 { font-size: 1.4rem; }
.sheet .topview { box-shadow: none; border: 0; padding: 0; }
.sheet-head { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; border-bottom: 2px solid #000; padding-bottom: 8px; }
.pfields { display: grid; grid-template-columns: repeat(2, minmax(160px, 1fr)); gap: 6px 14px; flex: 1; max-width: 520px; }
.pf { display: flex; flex-direction: column; font-weight: 600; margin: 0; }
.pf span { font-size: .8rem; color: #333; }
.pf input, .pf textarea { min-height: 40px; border: 0; border-bottom: 1.5px solid #000; border-radius: 0; padding: 2px 4px; background: #fffbe6; box-shadow: none !important; }
.pf.wide { width: 100%; }
table.kv, table.racks { width: 100%; border-collapse: collapse; }
table.kv th, table.kv td, table.racks th, table.racks td { border: 1px solid #555; padding: 3px 6px; text-align: left; vertical-align: top; }
table.kv th { width: 1%; white-space: nowrap; background: #f1f3f5; }
table.racks th { background: #f1f3f5; }
.swatch.sm { width: 14px; height: 14px; border-width: 1px; vertical-align: -2px; }
.sheet-foot { font-size: .75rem; color: #444; border-top: 1px solid #999; padding-top: 4px; }
.print-side .side-views { grid-template-columns: 3fr 1fr; }
.print-side .wide { min-width: 0; }

@media print {
  @page { size: A4 landscape; margin: 9mm; }
  html, html.xl, html.std { font-size: 10pt; }
  body { background: #fff; }
  .top, .nav, .foot, .no-print, .btn { display: none !important; }
  main { max-width: none; padding: 0; margin: 0 !important; }
  main > * { max-width: none !important; }
  .sheet { border: 0; padding: 0; margin: 0; font-size: 9pt; box-shadow: none; }
  .pf input, .pf textarea { background: none; min-height: 0; }
  .pf textarea { resize: none; }
  .topview { border: 0; padding: 0; break-inside: avoid; box-shadow: none; }
  .topview svg { max-height: 62mm; }
  .print-side .topview svg { max-height: 45mm; }
  .print-side .topview.rear svg { max-height: 45mm; }
  table.racks tr { break-inside: avoid; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* przekrój – nie za duży na komputerze */
.section-fig svg { max-height: 52vh; }
.stepper button { width: 52px; }

/* przesuwanie stojaków */
.topview svg.movable { touch-action: pan-y; } /* palcem po pustej podłodze lub obok auta przewija się strona (wersja 100) */
.topview svg.movable .rack.drag { touch-action: none; }
@media (max-width: 700px) { .topview.vertical svg.movable { max-height: calc(100vh - 230px); max-height: calc(100dvh - 230px); } }
.topview svg .rack.drag { cursor: grab; }
.topview svg .rack.drag:active { cursor: grabbing; }
.nudge { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.issues { list-style: none; margin: 0; padding: 0; }
.issues li { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0; border-bottom: 1px solid var(--line); }
.lvl { flex: 0 0 auto; border-radius: 999px; padding: 2px 10px; font-size: .78rem; font-weight: 800; }
.lvl.KOLIZJA, .lvl.ZA_BLISKO { background: var(--danger-soft); color: #991b1b; border: 1px solid #fecaca; }
.lvl.GRANICA { background: var(--warn-soft); color: var(--warn-ink); border: 1px solid #fde68a; }
button[aria-pressed=true].btn { background: var(--primary-soft); border-color: var(--primary); color: var(--primary-soft-ink); }

/* Rysunek kształtu z wymiarami do dotykania (ShapeDrawing) */
.dd-wrap { padding: 8px; }
.dd-measure { width: 100%; overflow-x: auto; }
.dd { position: relative; margin: 0 auto; }
.dd svg { position: absolute; inset: 0; display: block; }
.dd-lbl, .dd-pt { position: absolute; transform: translate(-50%, -50%); font: 700 18px/1 system-ui, sans-serif; cursor: pointer;
  border: 2px solid var(--line-strong); background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(15, 23, 42, .15); }
.dd-lbl { min-height: 44px; min-width: 56px; padding: 0 10px; border-radius: 12px; white-space: nowrap; }
.dd-pt { width: 44px; height: 44px; padding: 0; border: 0; background: transparent; box-shadow: none; display: flex; align-items: center; justify-content: center; font-size: 15px; }
.dd-pt span { width: 28px; height: 28px; border-radius: 50%; background: #212529; color: #fff; border: 2px solid #fff; display: flex; align-items: center; justify-content: center; box-shadow: 0 1px 3px rgba(15, 23, 42, .3); }
.dd-lbl.on, .dd-pt.on span { background: var(--primary); color: #fff; border-color: var(--primary); }
.dd-lbl:focus-visible, .dd-pt:focus-visible { outline: 3px solid #f59e0b; outline-offset: 2px; }
.dd-panel { border: 2px solid var(--primary); }

/* ---------- Planuj: dwie kolumny na komputerze (formularz | plan) ---------- */
.row.bottom { align-items: flex-end; }
details.more { border-top: 1px dashed var(--line-strong); padding-top: 4px; }
details.more > summary { font-weight: 700; color: var(--primary-soft-ink); }
details.more[open] > summary { margin-bottom: 8px; }
.plan-empty { border-style: dashed; box-shadow: none; background: var(--surface-2); }
.todo-list { margin: 0; padding-left: 1.2em; }
.todo-list li + li { margin-top: 4px; }
@media (min-width: 1200px) {
  main > .plan-page { max-width: none; }
  .plan-grid { display: grid; grid-template-columns: minmax(430px, 5fr) minmax(0, 8fr); gap: 28px; align-items: start; }
  .plan-in, .plan-out { min-width: 0; }
  .plan-out { position: sticky; top: 88px; max-height: calc(100vh - 100px); overflow-y: auto; padding: 2px 8px 24px 2px; margin-top: 0 !important; }
  .plan-in .card { padding: 16px; }
}
@media (max-width: 1199px) {
  .plan-grid > * + * { margin-top: 14px; }
}

/* plan na cały ekran (z powiększaniem) */
html.noscroll { overflow: hidden; }
.fullplan { position: fixed; inset: 0; z-index: 100; background: var(--bg); padding: 14px 20px 16px; display: flex; flex-direction: column; gap: 10px; }
.fullplan-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.topview.big { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
.topview.big svg { flex: 1 1 auto; min-height: 0; height: 100%; max-height: none; }
.zoom-tools { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 8px; }
.topview svg.pannable { cursor: grab; touch-action: none; }
.topview svg.pannable:active { cursor: grabbing; }

/* telefon: przekrój – strzałki po bokach suwaka; widok z boku nie rozpycha strony */
.section-tools { flex-wrap: nowrap; }
.section-tools input[type=range] { flex: 1 1 0; min-width: 0; }
.side-views { grid-template-columns: minmax(0, 3fr) minmax(0, 1fr); }
@media (max-width: 700px) { .side-views { grid-template-columns: minmax(0, 1fr); } }
.fullplan { margin: 0 !important; }
/* wiersz stojaka: pola w siatce dwóch kolumn, podpisy nad polami wyrównane do dołu */
.rack-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; align-items: end; }
@media (min-width: 1200px) {
  .plan-out .kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (min-width: 1200px) {
  .plan-out .kpi .v { font-size: 1.3rem; white-space: nowrap; }
}
@media (min-width: 1200px) { .only-narrow { display: none !important; } }

/* widok 3D */
.view3d .v3d-tools { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 8px; }
.view3d .v3d-tools .spacer { flex: 1; }
.view3d .v3d-tools .btn.sm { min-height: 48px; padding: 4px 12px; font-size: .85rem; }
.v3d-canvas { position: relative; height: clamp(320px, 52vh, 620px); border-radius: 12px; overflow: hidden; background: #eef2f7; }
.view3d.big .v3d-canvas { height: auto; flex: 1 1 auto; min-height: 0; }
.v3d-msg { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; padding: 20px; color: var(--muted); }
.view-tabs { display: flex; gap: 4px; padding: 4px; background: #eef2f7; border-radius: 14px; flex-wrap: wrap; }
.view-tabs button { flex: 1 1 auto; min-height: 48px; border: 0; background: transparent; border-radius: 10px; font: inherit; font-weight: 700; color: var(--muted); cursor: pointer; padding: 0 14px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.view-tabs button[aria-selected=true] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(15, 23, 42, .12); }
.rack-info { border-left: 6px solid var(--primary); }
/* ikony w przyciskach wewnątrz rysunków nie mogą dziedziczyć rozmiaru rysunku */
.topview svg.ico { display: inline-block; width: 1em; height: 1em; flex: 0 0 auto; }

/* pasek wskaźników (LDM, m², m³) i licznik przy wierszu stojaków */
.statbar { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px 18px; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 16px; box-shadow: var(--shadow); }
.statbar > div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.statbar .k { color: var(--muted); font-size: .82rem; font-weight: 650; }
.statbar .v { font-weight: 800; font-size: 1.1rem; white-space: nowrap; }
.statbar .v small { font-weight: 600; color: var(--muted); font-size: .8rem; }
.statbar .s { color: var(--muted); font-size: .8rem; }
.statbar .bar { margin-top: 4px; }
.row-head label { margin-bottom: 0; }
.row-head { margin-bottom: 6px; }
.badge.ok { background: var(--good-soft); color: #14532d; border: 1px solid #bbf7d0; }
.badge.bad { background: var(--danger-soft); color: #991b1b; border: 1px solid #fecaca; }
.bar.split { background: #fde68a; }
.bar.split > i { border-radius: 99px 0 0 99px; }
@media (min-width: 1200px) { .plan-out .statbar { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.statbar .v { white-space: normal; line-height: 1.2; }
.statbar .v small { display: block; margin-top: 2px; }
@media (min-width: 1200px) { .plan-out .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); } .plan-out .kpi { padding: 10px 14px; } }

/* rysowanie kształtu myszką (ShapeSketch) */
.sketch-area { position: relative; flex: 1 1 auto; min-height: 0; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: #fff; box-shadow: var(--shadow); }
.sketch-area > svg { display: block; width: 100%; height: 100%; touch-action: none; user-select: none; }
.sketch-area > svg.drawing { cursor: crosshair; }
.sketch-zoom { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; margin: 0; } /* pod rysunkiem – nie zasłania kształtu (wersja 86) */
.sketch-tpl { width: auto; min-height: 48px; padding-top: 6px; padding-bottom: 6px; font-size: .92rem; }
.fullplan.sketch > .info, .fullplan.sketch > .alert { margin: 0; }

/* warianty ułożenia – miniatury do wyboru */
.variants { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; }
.variant { display: flex; flex-direction: column; gap: 4px; text-align: left; font: inherit; color: var(--ink); background: var(--surface);
  border: 2px solid var(--line); border-radius: var(--radius-sm); padding: 8px 10px; cursor: pointer; min-height: 48px; }
.variant:hover { border-color: var(--line-strong); }
.variant.on { border-color: var(--primary); background: var(--primary-soft); }
.variant .vt { font-weight: 800; display: flex; align-items: center; gap: 6px; }
.variant .vs { color: var(--muted); font-size: .8rem; }
.variant .topview { padding: 4px; box-shadow: none; border: 0; background: transparent; pointer-events: none; }

/* załadunek krok po kroku */
.step-card { border-left: 6px solid var(--primary); }
.step-main { font-size: 1.35rem; font-weight: 800; }
.step-where { font-size: 1.1rem; }
.step-list { margin: 8px 0 0; padding-left: 0; list-style: none; }
.step-list li button { width: 100%; text-align: left; font: inherit; color: var(--ink); background: none; border: 0; border-bottom: 1px solid var(--line);
  min-height: 48px; padding: 6px 8px; cursor: pointer; border-radius: 8px; }
.step-list li button:hover { background: var(--surface-2); }
.step-list li.on button { background: var(--primary-soft); }

/* miejsca rozładunku */
.stop-row { display: flex; gap: 12px; align-items: flex-start; border-left: 6px solid var(--line-strong); background: var(--surface-2);
  border-radius: var(--radius-sm); padding: 10px 12px; }
.stop-letter { flex: 0 0 auto; width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: 1.2rem;
  color: #0f172a; border: 2px solid rgba(15, 23, 42, .5); margin-top: 26px; }
.stop-fields { flex: 1; min-width: 0; }
.stop-fields > * + * { margin-top: 8px; }
.stop-tools { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.stop-tools .spacer { flex: 1; }
.swatches { display: flex; gap: 6px; flex-wrap: wrap; }
.swatch-btn { width: 36px; height: 36px; border-radius: 50%; border: 2px solid rgba(15, 23, 42, .35); cursor: pointer; padding: 0; }
.swatch-btn.on { outline: 3px solid #0f172a; outline-offset: 2px; }

/* zlecenia */
.order-list { display: flex; flex-direction: column; gap: 10px; }
.order-row { display: flex; align-items: center; gap: 12px; padding: 12px 16px; }
.order-main { flex: 1; min-width: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; color: var(--ink); text-decoration: none; min-height: 48px; }
.order-main:hover .order-no { text-decoration: underline; }
.order-no { font-weight: 800; font-size: 1.1rem; }
.order-stops { display: flex; flex-wrap: wrap; gap: 6px; }
.stop-chip { display: inline-flex; align-items: center; gap: 6px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 999px; padding: 2px 10px 2px 3px; font-size: .9rem; }
.stop-dot { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: .8rem; color: #0f172a; border: 1.5px solid rgba(15, 23, 42, .45); }
.badge.st-draft { background: #eef2f7; color: #334155; }
.badge.st-ready { background: var(--good-soft); color: #14532d; border: 1px solid #bbf7d0; }
.badge.st-sent { background: var(--primary-soft); color: var(--primary-soft-ink); }
.order-head { border-left: 6px solid var(--primary); }
.dirty { color: var(--warn-ink); font-weight: 700; }
.seg.compact label { flex: 1 1 90px; }

/* Excel: szablon i wczytywanie */
.excel-bar { display: flex; flex-wrap: wrap; gap: 8px; }
.file-btn { position: relative; margin: 0; }
.file-btn input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; min-height: 0; }
.file-btn:focus-within { outline: 3px solid #f59e0b; outline-offset: 2px; }

/* wersja testowa – czerwony napis */
.test-badge { margin-left: 10px; padding: 3px 10px; border-radius: 8px; background: #b91c1c; color: #fff; font-size: .78rem; font-weight: 800; letter-spacing: .06em; white-space: nowrap; }
.test-text { color: #b91c1c; }
@media (max-width: 420px) { .test-badge { font-size: .62rem; padding: 2px 6px; margin-left: 6px; } }
/* Telefon: znaczek skrócony do „TESTOWA” – inaczej nachodzi na znaczek licencji w nagłówku. */
@media (max-width: 700px) { .test-long { display: none; } }

/* podział na kilka aut */
.fleet { border-left: 6px solid #15803d; }
.fleet-list { display: flex; flex-direction: column; gap: 12px; }
.fleet-truck { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 12px; background: var(--surface-2); }
.fleet-truck .topview { padding: 6px; box-shadow: none; }

/* trasa i mapa */
.route-map { height: clamp(320px, 50vh, 560px); border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); background: #e5e7eb; }
.map-pin span { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; font: 800 15px/1 system-ui, sans-serif; color: #0f172a;
  border: 2.5px solid #0f172a; box-shadow: 0 2px 6px rgba(0, 0, 0, .35); }
.map-booth span { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: #ffd65a; color: #713d00; font: 800 11px/1 system-ui, sans-serif; border: 2px solid #713d00; box-shadow: 0 1px 4px rgba(0,0,0,.4); }
.map-toll-start span, .map-toll-end span { display: block; width: 14px; height: 14px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 1px 3px rgba(0,0,0,.5); }
.map-toll-start span { background: #dc2626; } .map-toll-end span { background: #15803d; }
.map-legend { background: #fff; color: #1f2937; padding: 6px 10px; border-radius: 8px; font: 13px/1.6 system-ui, sans-serif; box-shadow: 0 1px 4px rgba(0,0,0,.3); }
.map-legend summary { cursor: pointer; font-weight: 700; }
.map-legend .lg-line { display: inline-block; width: 26px; border-top: 4px dashed #f59e0b; vertical-align: middle; }
.map-legend .lg-dot { display: inline-block; width: 11px; height: 11px; border-radius: 50%; vertical-align: middle; } .lg-dot.start { background: #dc2626; } .lg-dot.end { background: #15803d; }
.map-legend .lg-booth, .map-booth-inline { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: #ffd65a; color: #713d00; font-weight: 800; font-size: 10px; border: 1.5px solid #713d00; }
.avoid-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 8px 16px; }
.toll-legend { display: inline-block; width: 22px; height: 6px; background: #ea580c; border-radius: 3px; vertical-align: middle; margin-right: 6px; }
.route-stops li { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.route-stops li .hint { flex-basis: 100%; margin-left: 40px; }
table.legs { width: 100%; border-collapse: collapse; }
table.legs th, table.legs td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.legs th { font-size: .85rem; color: var(--muted); }
.timeline { margin: 8px 0 0; padding-left: 1.2em; }
.timeline li { padding: 3px 0; }
.timeline .ev-break, .timeline .ev-rest { color: var(--warn-ink); font-weight: 650; }
@media (min-width: 1200px) { .plan-out .view-tabs button { padding: 0 10px; font-size: .95rem; } }

/* ---------- arkusz zmniejszony do szerokości ekranu (FitPage, wersja 91) ---------- */
.fit-outer { width: 100%; max-width: 100%; overflow: hidden; }
.fit-inner.fitted > * { margin-top: 0; }
.fit-note { text-align: center; margin-top: 4px; }
@media print { .fit-inner { zoom: 1 !important; width: auto !important; } }
.snapshot .fit-inner { zoom: 1 !important; }  /* na czas zapisu obrazu – pełna szerokość kartki */

/* ---------- dokumenty WZ i CMR (A4 pionowo) ---------- */
@page doc { size: A4 portrait; margin: 10mm; }
.docs-wrap > * + * { margin-top: 16px; }
.doc-page { page: doc; background: #fff; color: #000; border: 1px solid var(--line); border-radius: 8px; padding: 14px 16px; box-shadow: var(--shadow);
  max-width: 800px; font-size: 13px; line-height: 1.35; position: relative; }
.doc-page h1 { font-size: 20px; } .doc-page h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .03em; color: #333; margin-bottom: 2px; }
.doc-field { width: 100%; min-height: 0; border: 1px dashed #94a3b8; border-radius: 4px; padding: 3px 5px; font: inherit; font-size: 13px; line-height: 1.3;
  background: #fffbe6; resize: vertical; color: #000; box-shadow: none !important; field-sizing: content; }
.doc-test { position: absolute; top: 6px; right: 12px; color: #b91c1c; font-weight: 800; font-size: 11px; letter-spacing: .05em; border: 1.5px solid #b91c1c; padding: 1px 6px; border-radius: 4px; }
.doc-page p.small { font-size: 12px; margin: 4px 0; }
.doc-foot { margin-top: 10px; font-size: 10px; color: #444; border-top: 1px solid #999; padding-top: 3px; }
.wz-head { display: flex; justify-content: space-between; gap: 12px; border-bottom: 2px solid #000; padding-bottom: 6px; margin: 14px 0 8px; }
.wz-meta { text-align: right; }
.wz-parties { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 10px; }
.wz-table { width: 100%; border-collapse: collapse; margin-bottom: 8px; }
.wz-table th, .wz-table td { border: 1px solid #555; padding: 4px 6px; text-align: left; vertical-align: top; }
.wz-table th { background: #f1f3f5; font-size: 12px; }
.wz-table tr.sum td { font-weight: 800; }
.wz-sign { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-top: 40px; }
.wz-sign div { border-top: 1px solid #000; padding-top: 3px; font-size: 11px; text-align: center; }
/* CMR według wzoru CMR/IRU/Polska 1976 – kolor egzemplarza w --cmr */
.cmr { --cmr: #d71f4b; padding: 8px 26px 8px 30px; line-height: 1.15; }
.cmr .cl, .cmr-t, .cmr-conv, .cmr-conv2, .cmr-pay, .cmr-opt, .cmr-sig, .cmr-pd > span, .cmr .adr > span, .cmr-copy, .cmr-side, .cmr-foot, .cmr-plate > strong { color: var(--cmr); }
.cmr .cl { display: flex; gap: 4px; align-items: flex-start; font-size: 7.5px; }
.cmr .cn { font-size: 17px; font-weight: 800; line-height: .9; color: var(--cmr); }
.cmr .cn.big { font-size: 20px; }
.cmr-copy { display: flex; gap: 8px; align-items: center; font-size: 8.5px; min-height: 30px; margin-bottom: 2px; }
.cmr-copy-no { font-size: 34px; font-weight: 900; line-height: 1; }
.cmr-frame { display: grid; grid-template-columns: 1fr 1fr; border-top: 1px solid var(--cmr); border-left: 1px solid var(--cmr);
  grid-template-areas: "c1 t" "c2 c16" "c3 c17" "c4 c18" "c5 c18" "g g" "c13 c19" "c13 c20" "c14 c20" "c21 c15" "s s"; }
.cmr .cb { border-right: 1px solid var(--cmr); border-bottom: 1px solid var(--cmr); padding: 2px 4px; min-width: 0; }
.cmr .heavy { box-shadow: inset 0 0 0 2px var(--cmr); }
.cmr .c1 { grid-area: c1; min-height: 84px; } .cmr .ctitle { grid-area: t; }
.cmr .c2 { grid-area: c2; min-height: 70px; } .cmr .c16 { grid-area: c16; }
.cmr .c3 { grid-area: c3; min-height: 48px; } .cmr .c17 { grid-area: c17; }
.cmr .c4 { grid-area: c4; min-height: 48px; } .cmr .c18 { grid-area: c18; }
.cmr .c5 { grid-area: c5; min-height: 36px; }
.cmr .c13 { grid-area: c13; } .cmr .c19 { grid-area: c19; min-height: 44px; } .cmr .c20 { grid-area: c20; padding: 0; }
.cmr .c14 { grid-area: c14; } .cmr .c21 { grid-area: c21; } .cmr .c15 { grid-area: c15; }
.cmr-t { font-size: 8px; }
.cmr-logo { display: flex; align-items: center; gap: 6px; margin: 2px 0 2px 40%; }
.cmr-logo span { border: 2px solid var(--cmr); border-radius: 8px; padding: 1px 8px; font-size: 17px; font-weight: 900; color: var(--cmr); }
.cmr-logo small { color: var(--cmr); font-size: 9px; } .cmr-logo strong { font-size: 11px; color: #000; }
.cmr-conv { font-size: 7.5px; margin: 2px 0; } .cmr-conv2 { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; font-size: 7px; }
.cmr-conv2 p { margin: 0; }
.cmr-plate { display: grid; grid-template-columns: auto 1fr auto 1fr; align-items: center; gap: 4px; font-size: 11px; margin-top: 4px; }
.cmr-goods { grid-area: g; display: grid; grid-template-columns: 13% 12% 12% 13% 17% 17% 16%; grid-template-rows: minmax(150px, auto) auto; }
.cmr .cg { border-right: 1px solid var(--cmr); border-bottom: 1px solid var(--cmr); padding: 2px 3px; min-width: 0; }
.cmr .heavy-l { box-shadow: inset 2px 0 0 var(--cmr); }
.cmr .adr { grid-column: 1 / 5; display: grid; grid-template-columns: repeat(4, 1fr) auto; gap: 2px 6px; font-size: 7px; }
.cmr .adr .doc-field { grid-column: 1 / -1; }
.cmr .adr-r { grid-column: 5 / 8; }
.cmr-pay { width: 100%; border-collapse: collapse; font-size: 7px; }
.cmr-pay th, .cmr-pay td { border-right: 1px solid var(--cmr); border-bottom: 1px solid var(--cmr); padding: 1px 3px; text-align: left; font-weight: 400; vertical-align: top; }
.cmr-pay th:first-child { width: 40%; } .cmr-pay tr > *:last-child { border-right: 0; } .cmr-pay tr:last-child > * { border-bottom: 0; }
.cmr-pay thead th { vertical-align: middle; } .cmr-pay thead .cn { float: left; margin-right: 4px; }
.cmr-pay .doc-field { font-size: 9px; line-height: 1.1; padding: 0 2px; margin: 0; }
.cmr-pay td { padding: 1px 2px; }
.cmr-pay tr.total th { font-weight: 700; }
.cmr-opt { font-size: 8px; margin: 3px 0 0; display: flex; align-items: center; gap: 4px; }
.cmr-tick { display: inline-grid; place-items: center; width: 11px; height: 11px; border: 1px solid var(--cmr); color: #000; font-size: 10px; font-weight: 800; }
.cmr-pd { display: grid; grid-template-columns: 1fr auto 1fr; gap: 4px; align-items: center; font-size: 7px; margin-top: 2px; }
.cmr .s24 .cmr-pd { grid-template-columns: auto 1fr auto 1fr; }
.cmr-sign { grid-area: s; display: grid; grid-template-columns: 1fr 1fr 1fr; }
.cmr-sign .cb { min-height: 96px; display: flex; flex-direction: column; justify-content: space-between; }
.cmr-sign .cb:last-child { border-right: 0; }
.cmr-sig { font-size: 7px; margin: 0; }
.cmr-side { position: absolute; top: 120px; bottom: 50px; display: flex; gap: 6px; font-size: 6.5px; line-height: 1.2; }
.cmr-side-l { left: 4px; writing-mode: vertical-rl; transform: rotate(180deg); justify-content: space-around; }
.cmr-side-r { right: 2px; writing-mode: vertical-rl; }
.cmr-foot { font-size: 7px; margin: 3px 0 0; }
.cmr .doc-field { font-size: 10.5px; line-height: 1.2; margin-top: 1px; padding: 1px 4px; }
.cmr .cg .doc-field { font-size: 9.5px; padding: 1px 2px; }
@media print {
  .docs-wrap .doc-page { border-radius: 0; box-shadow: none; max-width: none; margin: 0 !important; break-after: page; }
  .docs-wrap .doc-page:last-child { break-after: auto; }
  /* od wersji 91 każda kartka jest w FitPage – podział stron po ramce, ostatnia bez pustej strony */
  .docs-wrap .fit-outer { overflow: visible; }
  .docs-wrap .fit-outer:not(:last-child) .doc-page { break-after: page; }
  .docs-wrap .fit-outer:last-child .doc-page { break-after: auto; }
  .docs-wrap > * + * { margin-top: 0 !important; }
  .doc-field { border: 0; background: none; resize: none; padding: 0; overflow: hidden; }
  .cmr { border: 0; }
  .cmr .doc-field { overflow: hidden; }
}

/* wybór języka wydruku */
.lang-pick { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.lang-pick-label { font-weight: 650; margin-right: 4px; }
.lang-btn { min-height: 48px; padding: 0 12px; border: 2px solid var(--line-strong); border-radius: 10px; background: var(--surface, #fff); color: inherit; font: inherit; cursor: pointer;
  display: inline-flex; align-items: center; gap: 4px; }
.lang-btn .flag { display: block; border-radius: 3px; }
.lang-plus { font-weight: 800; color: var(--muted); }
.lang-btn.on { border-color: var(--primary); background: var(--primary-soft); box-shadow: 0 0 0 2px var(--primary) inset; }
.lang-btn.on .lang-plus { color: var(--primary-soft-ink); }

/* wydruki dwujęzyczne: drugi język w nowej linii (zdania) i pochylony (podpisy) */
.sheet figcaption, .sheet p.small, .sheet-foot, .side-views figcaption, .doc-page.wz p.small, .doc-page .doc-foot, .wz-sign span { white-space: pre-line; }
.bi2 { font-style: italic; color: #475569; }

/* konto „kilka urządzeń”: stan w nagłówku i paski */
.sync-badge { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 12px; border-radius: 999px; background: #dcfce7; color: #14532d; font-weight: 650; font-size: .9rem; text-decoration: none; margin-right: 8px; }
.sync-badge.warn { background: #fef3c7; color: #78350f; }
.sync-banner { margin-bottom: 16px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
@media (max-width: 700px) { .sync-badge { font-size: 0; padding: 0 10px; } .sync-badge svg { font-size: 1rem; } }

/* ---------- powitanie: znak marki ---------- */
.welcome-head { display: flex; align-items: center; gap: 16px; }
.welcome-mark { flex: 0 0 auto; width: 72px; height: 72px; border-radius: 18px; background: var(--brand-navy); display: grid; place-items: center; }
.welcome-mark .brand-mark { width: 56px; height: 56px; }
/* wąski telefon: mniejszy znak i napis, żeby przycisk wielkości tekstu się mieścił */
@media (max-width: 480px) {
  .top { gap: 8px; padding-left: 12px; padding-right: 12px; }
  .top h1, .brand { gap: 7px; min-width: 0; }
  .brand-mark { width: 34px; height: 34px; }
  .wordmark { font-size: 1.1rem; }
}

/* śródtytuł w formularzu (np. „Naciski osi”) */
.field-heading { margin: 10px 0 8px; padding-top: 14px; border-top: 1px solid var(--line); font-size: 1.05rem; }

/* ---------- naciski osi ---------- */
.axle-kpi { border-left: 6px solid var(--line-strong); }
.axle-kpi.ok { border-left-color: var(--brand-green); }
.axle-kpi.bad { border-left-color: var(--danger); }
.axle-kpi > * + * { margin-top: 10px; }
.axle-rows { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px 24px; }
.axle-row { display: grid; gap: 2px; }
.axle-row .an { color: var(--muted); font-weight: 650; font-size: .92rem; }
.axle-row .av { font-weight: 800; font-size: 1.15rem; }
.axle-row .av small { font-weight: 600; color: var(--muted); }
.axle-row .bar > i { background: var(--brand-green); }
.axle-row.bad .bar > i { background: var(--danger); }
.axle-row .ao { color: var(--danger); font-weight: 750; }
.axle-kpi .axle-view { flex: 0 1 auto; }
.axle-kpi .axle-view label { flex: 0 1 auto; min-height: 48px; }
.axle-row .s { color: var(--muted); font-size: .85rem; }
.axle-row .bar.cargo > i { background: var(--brand-blue); }
@media (max-width: 600px) { .axle-kpi .axle-view { width: 100%; } .axle-kpi .axle-view label { flex: 1 1 100%; } }
.axle-note { color: var(--warn-ink); background: var(--warn-soft); border-radius: 10px; padding: 8px 12px; }

/* ---------- licencje: panel właściciela ---------- */
main.wide { max-width: 1200px; }
@media (min-width: 960px) { main.wide { margin-left: auto; margin-right: auto; padding: 28px 36px 60px; } main.wide + .foot { margin-left: 0; } }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { min-height: 48px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); font: inherit; font-weight: 650; cursor: pointer; }
.chip.on { background: var(--primary-soft); border-color: var(--primary); color: var(--primary-soft-ink); }
.owner-firm { border-left: 6px solid var(--brand-green); }
.owner-firm.warn { border-left-color: #f59e0b; }
.owner-firm.bad { border-left-color: var(--danger); }
.owner-firm h4 { margin: 0; font-size: 1rem; }
.lic { display: inline-block; padding: 2px 10px; border-radius: 999px; font-weight: 750; font-size: .9rem; }
.lic.ok { background: var(--good-soft); color: #14532d; }
.lic.warn { background: var(--warn-soft); color: var(--warn-ink); }
.lic.bad { background: var(--danger-soft); color: #991b1b; }
.owner-user { padding: 8px 0; border-top: 1px solid var(--line); }
.owner-user.off { opacity: .65; }
.warn-box { background: var(--warn-soft); color: var(--warn-ink); border: 1px solid #fde68a; border-radius: var(--radius-sm); padding: 12px 14px; }

/* ---------- porównanie trybów danych ---------- */
.mode-cmp { border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; font-size: .92rem; }
.mc-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr) minmax(0, 1.4fr); border-top: 1px solid var(--line); }
.mc-row > span { overflow-wrap: break-word; hyphens: manual; } /* bez dzielenia wyrazów myślnikiem (uwaga właściciela, wersja 84) */
.mc-row:first-child { border-top: 0; }
.mc-row > span { padding: 10px 12px; }
.mc-row > span[role=rowheader] { font-weight: 750; background: var(--surface-2); }
.mc-head > span { font-weight: 800; background: var(--surface-2); }
.mc-row > span.on { background: var(--primary-soft); color: var(--primary-soft-ink); }
.mc-head > span.on { background: var(--brand-blue); color: #fff; }
@media (max-width: 700px) {
  .mc-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .mc-row > span[role=rowheader], .mc-head > span:first-child { grid-column: 1 / -1; }
  .mc-head > span:first-child { display: none; }
}

/* środowisko testowe (gałąź test) */
.test-env { background: #f59e0b; color: #1f1300; font-weight: 800; text-align: center; padding: 6px 12px; font-size: .9rem; }
/* Wygenerowane hasło: duże, z wyraźnymi znakami, do podyktowania. */
.pass-shown { font-family: ui-monospace, Consolas, monospace; font-size: 1.15em; letter-spacing: .02em; word-break: break-all; user-select: all; }
/* Drogi płatne tylko dla ciężarówek (e-TOLL, Maut) – fioletowa linia na mapie */
.map-legend .lg-line.truck { border-top: 6px solid #7c3aed; opacity: .8; }
.truck-legend { display: inline-block; width: 22px; height: 6px; background: #7c3aed; border-radius: 3px; vertical-align: middle; margin-right: 6px; }
.kpi .s.bad-text { color: var(--danger); font-weight: 750; }
/* Trasa (wersja 77): przerwy na trasie, postoje planisty, odległości odcinków, dodawanie postoju kliknięciem */
.map-break span { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 6px; background: #fff7ed; color: #9a3412; font: 800 14px/1 system-ui, sans-serif; border: 2px solid #9a3412; box-shadow: 0 1px 4px rgba(0,0,0,.4); }
.map-break.rest span { background: #1e1b4b; color: #fff; border-color: #fff; }
.map-pin.via span { border-radius: 8px; }
.map-pin.drag span { cursor: grab; }
.map-leg span { position: absolute; transform: translate(-50%, -50%); white-space: nowrap; background: #fff; color: #0f172a; border: 1.5px solid #1d4ed8; border-radius: 6px; padding: 1px 6px; font: 700 12px/1.3 system-ui, sans-serif; box-shadow: 0 1px 3px rgba(0,0,0,.3); }
.map-legend .lg-break, .map-legend .lg-via { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 5px; background: #fff7ed; color: #9a3412; font-weight: 800; font-size: 11px; border: 1.5px solid #9a3412; }
.map-legend .lg-break.rest { background: #1e1b4b; color: #fff; }
.map-legend .lg-via { background: #e0f2fe; color: #0c4a6e; border-color: #0c4a6e; }
.route-map.map-picking, .route-map.map-picking .leaflet-container { cursor: crosshair; }
.route-vias li { display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; align-items: start; padding: 10px 0; border-bottom: 1px solid var(--line, #e2e8f0); }
.route-vias .via-fields { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; }
.route-vias .via-fields > div { min-width: 160px; flex: 1 1 200px; }
.map-tools { display: flex; flex-wrap: wrap; gap: 8px 18px; align-items: center; }
/* Trasa (wersja 80): miarka na trasie i „+ Dodaj punkt z mapy” */
.map-measure span { display: block; width: 22px; height: 22px; border-radius: 50%; background: #fff; border: 5px solid #1d4ed8; box-shadow: 0 1px 5px rgba(0,0,0,.45); cursor: grab; }
.leaflet-tooltip.map-measure-tip { font: 700 14px/1.35 system-ui, sans-serif; color: #0f172a; border: 2px solid #1d4ed8; border-radius: 8px; padding: 4px 8px; white-space: nowrap; }
.map-add { width: 48px; height: 48px; font: 800 28px/1 system-ui, sans-serif; background: #fff; color: #0f172a; border: 2px solid rgba(0,0,0,.25); border-radius: 8px; cursor: pointer; }
.map-add[aria-pressed="true"] { background: #1d4ed8; color: #fff; }
.map-add-menu { display: grid; gap: 8px; min-width: 200px; font: 16px/1.3 system-ui, sans-serif; }
.map-add-menu .btn { min-height: 44px; }
/* powitanie (wersja 83): na telefonie znak nad tytułem, tytuł w jednej linii */
@media (max-width: 480px) { .welcome-head { flex-direction: column; align-items: flex-start; gap: 10px; } }
/* nigdzie nie dzielimy wyrazów myślnikiem (uwaga właściciela, wersja 85) */
html, body, * { hyphens: manual; -webkit-hyphens: manual; }

/* wersja 86: duży widok rysunku z wymiarami i okienko zmiany wymiaru zawsze widoczne na dole ekranu */
.dd-sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 1200; max-height: 70vh; overflow: auto; margin: 0; border-radius: 18px 18px 0 0;
  box-shadow: 0 -8px 30px rgba(15, 23, 42, .3); padding-bottom: calc(16px + env(safe-area-inset-bottom)); }
@media (min-width: 900px) { .dd-sheet { left: 50%; right: auto; width: 640px; transform: translateX(-50%); } }
.dd-big { position: fixed; inset: 0; z-index: 1100; background: var(--bg, #f8fafc); overflow: auto; padding: 12px 12px 40vh; }
.dd-big .dd-wrap { margin: 0; }
.dd-tools { display: flex; flex-wrap: wrap; gap: 8px; }
/* rysowanie kształtu na telefonie (wersja 86): rysunek zawsze ma miejsce, okno przewija się w pionie */
@media (max-width: 760px) {
  .fullplan.sketch { overflow-y: auto; }
  .fullplan.sketch .sketch-area { flex: 0 0 auto; height: 58vh; min-height: 320px; }
}

/* pasek „Jest nowa wersja” (wersja 91) */
.update-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px 14px; padding: 8px 16px;
  background: var(--primary-soft); color: var(--primary-soft-ink); font-weight: 650; text-align: center; }
.update-bar .btn { width: auto; }

/* kod dla zewnętrznego kierowcy (wersja 95) */
.driver-code { font: 800 1.6rem/1.2 ui-monospace, "SF Mono", Menlo, Consolas, monospace; letter-spacing: .06em; text-align: center;
  padding: 10px; border: 2px dashed var(--line); border-radius: var(--radius-sm); background: var(--surface-2); }
.driver-qr { display: flex; justify-content: center; }
.driver-qr svg { width: min(240px, 70vw); height: auto; }
.break { overflow-wrap: anywhere; }
#gk { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; letter-spacing: .06em; text-transform: uppercase; }

/* „Kup program” u kierowcy (wersja 96) */
.buy-program { background: var(--good-soft); color: #14532d; border-color: #bbf7d0; white-space: normal; text-align: center; }

/* Okna na stojakach (wersja 103) */
.table-scroll { overflow-x: auto; }
table.wp-lines { table-layout: fixed; min-width: 70em; }
table.wp-lines td, table.wp-lines th { padding: 3px 3px; }
table.wp-lines th:nth-child(1) { width: 8.6em; } table.wp-lines th:nth-child(2) { width: 3.6em; }
table.wp-lines th:nth-child(n+4):nth-child(-n+5), table.wp-lines th:nth-child(n+7):nth-child(-n+11) { width: 5em; } table.wp-lines th:nth-child(12) { width: 5.2em; }
table.wp-lines th.wp-sl { width: 4.2em; }
/* położenie słupków od lewej (wersja 152) */
table.wp-lines th.wp-sp { width: 7em; }
/* kolumna „System” (wersja 120) – nazwa systemu musi być czytelna */
table.wp-lines th.wp-sys { width: 11em; } table.wp-lines td:nth-child(6) select { width: 100%; }
table.wp-lines td:first-child { width: auto; font-weight: 400; }
table.wp-lines input { width: 100%; padding-left: 8px; padding-right: 6px; }
.wp-type { border-top: 1px solid var(--line); padding-top: 10px; }
.wp-type .row { margin-top: 6px; }
/* pole „ile mam” (wersja 154) */
.wp-count { align-items: center; gap: 10px; flex-wrap: wrap; }
.wp-type .wp-count input { width: 7.5em; flex: 0 0 auto; }
ol.wp-side { margin: 4px 0 0; padding-left: 1.6em; }
ol.wp-side li + li { margin-top: 4px; }
.wz-extras { background: #f8fafc; }
table.wz-tab td:first-child { width: 3.5em; font-weight: 400; }
table.wz-tab td:last-child { width: 1%; white-space: nowrap; }
.nowrap { white-space: nowrap; }
.wp-stack + .wp-stack { margin-top: 10px; border-top: 1px dashed var(--line); padding-top: 6px; }
/* rysunek stojaka w widokach (wersja 106) */
.rack-views { display: grid; grid-template-columns: 1.4fr 1fr; gap: 12px; align-items: end; }
@media (max-width: 700px) { .rack-views { grid-template-columns: 1fr; } }
.rack-svg { margin: 0; background: #f8fafc; border: 1px solid var(--line); border-radius: 12px; padding: 8px; }
.rack-svg figcaption { font-weight: 700; margin-bottom: 4px; }
.measure-no { display: inline-flex; align-items: center; justify-content: center; width: 1.5em; height: 1.5em; border-radius: 50%; background: #b45309; color: #fff; font-size: .85em; }
/* ręczne układanie okien (wersja 108) */
.wp-side .linklike { background: none; border: 0; padding: 4px 0; font: inherit; color: var(--ink); text-align: left; cursor: pointer; min-height: 48px; text-decoration: underline dotted; }
.wp-side li.wp-picked > .linklike { font-weight: 700; color: #b91c1c; }
/* zaznaczone okno – pierwsze dotknięcie (wersja 135) */
.wp-side .linklike.wp-on, .wp-upper .linklike.wp-on { font-weight: 700; color: #b91c1c; background: #fee2e2; border-radius: 6px; padding: 4px 6px; text-decoration: none; outline: 2px solid #dc2626; }
.wp-picked-box { border: 2px solid #dc2626; background: #fef2f2; border-radius: 12px; padding: 10px 14px;
  position: sticky; bottom: 8px; z-index: 5; box-shadow: 0 6px 24px rgba(15, 23, 42, .25); }
.wp-picked-box p { margin: 0 0 6px; }
.wp-shift { border-top: 1px solid #fecaca; margin-top: 8px; padding-top: 8px; }
.wp-shift .btn[disabled] { opacity: .45; }
.wp-upright { border: 1px solid var(--line); border-radius: 12px; padding: 8px 14px; margin: 8px 0; }
.wp-upright legend { font-weight: 700; padding: 0 6px; }
.wp-shift .row { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
.wp-shift .row .btn { padding-left: 6px; padding-right: 6px; white-space: normal; }
@media (max-width: 700px) { .wp-shift .row { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.wp-move { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 4px 0 10px; }
.wp-move select { max-width: 100%; }
/* okna zdjęte na listę (wersja 110) */
.wp-loose { border: 2px solid #f59e0b; background: #fffbeb; }
ol.wp-loose-list { margin: 0; padding: 0; list-style: none; }
ol.wp-loose-list li { display: flex; flex-direction: column; gap: 6px; padding: 8px 0; border-bottom: 1px dashed var(--line); }
/* standardy pakowania firmy (wersja 113) */
.wp-standards { background: #f0f9ff; }
ul.std-list { list-style: none; margin: 0; padding: 0; }
ul.std-list li { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; border-bottom: 1px dashed var(--line); padding: 4px 0; }
/* widok z góry (wersja 114) */
.rack-top { display: grid; grid-template-columns: 1.4fr 1fr; gap: 12px; align-items: center; }
@media (max-width: 700px) { .rack-top { grid-template-columns: 1fr; } }
ul.rack-use { margin: 0; padding-left: 1.2em; }
ul.rack-use li + li { margin-top: 6px; }
/* warianty ułożenia (wersja 115) */
.wp-variant-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; }
.wp-variant { display: flex; flex-direction: column; gap: 4px; border: 1px solid var(--line); border-radius: 12px; padding: 10px; background: var(--surface); }
.wp-variant.on { border: 2px solid var(--primary); }
.wp-variant .btn { margin-top: auto; }
.wp-upper { padding-left: 1.2em; color: var(--muted); }

/* legenda miejsc rozładunku pod widokiem 3D (wersja 131) */
.stop-legend { list-style: none; margin: .5rem 0 0; padding: 0; display: grid; gap: .35rem; }
.stop-legend li { display: grid; grid-template-columns: auto auto 1fr; align-items: start; gap: .5rem; }
.stop-legend .swatch { width: 1.4em; height: 1.4em; border-radius: .3em; border: 2px solid #0f172a; flex: none; }
/* rejestr stojaków (moduł, wersja 147) */
.rr-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.rr-list > li { border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.rr-list > li.on { border-color: #2563eb; box-shadow: 0 0 0 2px rgba(37, 99, 235, .15); }
.rr-row { all: unset; box-sizing: border-box; width: 100%; cursor: pointer; display: grid; grid-template-columns: minmax(90px, auto) minmax(160px, 1.4fr) auto minmax(140px, 1.6fr) minmax(150px, auto) auto;
  gap: 10px; align-items: center; padding: 10px 14px; min-height: 48px; }
.rr-row:focus-visible { outline: 3px solid #f59e0b; outline-offset: 2px; border-radius: 12px; }
.rr-no { font-size: 1.1em; }
.rr-over { color: #b91c1c; font-weight: 700; }
.rr-soon { color: #b45309; font-weight: 700; }
.rr-detail { margin: 0 10px 10px; }
.rr-photos { display: flex; flex-wrap: wrap; gap: 10px; }
.rr-photos figure { margin: 0; display: grid; gap: 4px; }
.rr-photos img { width: 180px; height: 135px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); }
.rr-history { margin: 0; padding-left: 1.4em; }
.rr-history li + li { margin-top: 4px; }
@media (max-width: 700px) { .rr-row { grid-template-columns: 1fr auto; } }

/* ---------- Menu w górnym pasku (wersja 170): zawsze widoczne, panel pod paskiem ---------- */
.app-menu { position: relative; flex: 0 0 auto; }
.menu-toggle { padding: 0 14px; }
.app-menu-panel {
  position: absolute; right: 0; top: calc(100% + 10px); z-index: 40; width: min(340px, calc(100vw - 24px));
  max-height: calc(100vh - 120px); overflow-y: auto; display: flex; flex-direction: column;
  background: var(--surface); color: var(--ink); border: 1px solid var(--line-strong); border-radius: 16px;
  box-shadow: 0 12px 32px rgba(11, 31, 59, .25); padding: 8px;
}
.app-menu-head { margin: 8px 12px 4px; font-size: .9rem; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.app-menu-panel a {
  display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 0 12px; border-radius: 10px;
  color: inherit; text-decoration: none; font-weight: 700;
}
.app-menu-panel a:hover, .app-menu-panel a:focus-visible { background: var(--primary-soft); color: var(--primary-soft-ink); }
@media (max-width: 400px) { .menu-toggle { padding: 0 10px; } }
