:root {
  /* kolory Grupy FEST: pomarańcz, zieleń, niebieski + ciemny szary z logo */
  --ink: #1e1e1e; --ink2: #3a3a3a; --muted: #5d6168; --line: #e4e5e7; --bg: #f6f6f4; --card: #fff; --hover: #f2f4f6; --line2: #cdd2d8;
  --chrome: #1e1e1e; --chrome-hover: #333; --on-accent: #1e1e1e; --chip: #eef0f3; --sel: #1e1e1e; --on-sel: #fff;
  --accent: #f76a0c; --accent-dark: #c9540a; --accent-ink: #a34304; --accent-soft: #fff1e6;
  --green: #6fb436; --green-ink: #3c6a17; --green-soft: #eff8e7; --blue: #2b6cb0; --blue-soft: #e8f1fa;
  --ok: #3c6a17; --warn: #a34304; --bad: #b91c1c; --info: #2b6cb0;
  --r: 10px; --shadow: 0 1px 2px rgb(0 0 0 / .05), 0 2px 8px rgb(0 0 0 / .04);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; font-size: 15px; color: var(--ink); background: var(--bg); color-scheme: light;
}
/* ciemny ekran: wybrany w „Moje konto” albo automatycznie według ustawień urządzenia */
:root[data-theme="dark"] {
  --ink: #e9eaec; --ink2: #c9ccd1; --muted: #a7adb5; --line: #33363b; --line2: #484c53; --bg: #141517; --card: #1d1f22; --hover: #26292d;
  --chrome: #1e1e1e; --chrome-hover: #2e3135; --chip: #2b2e33; --sel: #e9eaec; --on-sel: #141517;
  --accent-ink: #ff9d5c; --accent-soft: #3a2414; --green-ink: #9ad16a; --green-soft: #1f2c15; --blue: #6aa6e6; --blue-soft: #16243a;
  --ok: #9ad16a; --warn: #ff9d5c; --bad: #f47272; --info: #7db4ee;
  --shadow: 0 1px 2px rgb(0 0 0 / .4), 0 2px 8px rgb(0 0 0 / .3); color-scheme: dark;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --ink: #e9eaec; --ink2: #c9ccd1; --muted: #a7adb5; --line: #33363b; --line2: #484c53; --bg: #141517; --card: #1d1f22; --hover: #26292d;
  --chrome: #1e1e1e; --chrome-hover: #2e3135; --chip: #2b2e33; --sel: #e9eaec; --on-sel: #141517;
  --accent-ink: #ff9d5c; --accent-soft: #3a2414; --green-ink: #9ad16a; --green-soft: #1f2c15; --blue: #6aa6e6; --blue-soft: #16243a;
  --ok: #9ad16a; --warn: #ff9d5c; --bad: #f47272; --info: #7db4ee;
  --shadow: 0 1px 2px rgb(0 0 0 / .4), 0 2px 8px rgb(0 0 0 / .3); color-scheme: dark;
} }
* { box-sizing: border-box; }
body { margin: 0; }
a { color: var(--info); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.45rem; margin: 0 0 .25rem; }
h2 { font-size: 1.1rem; margin: 0 0 .75rem; }
h3 { font-size: .95rem; margin: 1rem 0 .5rem; color: var(--ink2); }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.nowrap { white-space: nowrap; }

/* układ */
.layout { display: grid; grid-template-columns: 228px minmax(0, 1fr); min-height: 100vh; }
.side { background: var(--chrome); color: #cfd3d9; padding: 16px 10px; position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; color: #fff; font-weight: 700; }
.brand img { max-height: 92px; max-width: 100%; border-radius: 8px; }
.brand img.custom { background: #fff; padding: 6px 10px; }
.brand .dot { width: 28px; height: 28px; border-radius: 8px; background: var(--accent); flex: none; }
.nav a { display: flex; align-items: center; gap: 10px; color: #cfd3d9; padding: 9px 10px; border-radius: 8px; margin-bottom: 2px; }
.nav a:hover { background: #2e2e2e; text-decoration: none; color: #fff; }
.nav a.on { background: var(--chrome-hover); color: #fff; box-shadow: inset 4px 0 0 var(--accent); }
.nav .grp { font-size: .68rem; text-transform: uppercase; letter-spacing: .08em; color: #8d9096; padding: 12px 10px 4px; }
.nav .badge { margin-left: auto; background: var(--accent); color: var(--on-accent); border-radius: 99px; font-size: .72rem; font-weight: 800; padding: 1px 7px; }
.nav .sep { height: 1px; background: #383838; margin: 10px 6px; }
.side .who { margin-top: auto; padding: 12px 10px 0; border-top: 1px solid #383838; font-size: .85rem; }
.side .who a { color: #cfd3d9; }
.main { padding: 22px 26px 60px; max-width: 1280px; width: 100%; }
.topbar { display: none; }
.head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.head .actions { display: flex; gap: 8px; flex-wrap: wrap; }

@media (max-width: 860px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .side { position: fixed; inset: 0 30% 0 0; z-index: 30; transform: translateX(-105%); transition: transform .2s ease; height: 100%; }
  .layout.menu .side { transform: none; box-shadow: 0 0 0 100vmax rgb(0 0 0 / .35); }
  .topbar { display: flex; align-items: center; gap: 10px; background: var(--chrome); color: #fff; padding: 10px 14px; padding-top: calc(10px + env(safe-area-inset-top)); position: sticky; top: 0; z-index: 20; }
  .topbar button { background: none; border: 0; color: #fff; font-size: 1.4rem; padding: 2px 6px; }
  .main { padding: 14px 12px 70px; }
}
@media (prefers-reduced-motion: reduce) { .side { transition: none; } }

/* karty, siatki */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); padding: 16px; margin-bottom: 14px; }
.grid { display: grid; gap: 12px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 860px) { .g2, .g3, .g4 { grid-template-columns: 1fr; } .g4.stats { grid-template-columns: repeat(2, 1fr); } }
.stat { padding: 14px 16px; }
.stat b { display: block; font-size: 1.6rem; }
.stat span { color: var(--muted); font-size: .85rem; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.spread { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 4px 14px; font-size: .92rem; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }

/* formularze */
label.f { display: flex; flex-direction: column; gap: 4px; font-size: .82rem; color: var(--ink2); font-weight: 600; }
input, select, textarea { font: inherit; font-weight: 400; color: var(--ink); border: 1px solid var(--line2); border-radius: 8px; padding: 8px 10px; background: var(--card); min-width: 0; width: 100%; }
textarea { min-height: 80px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid #fbb27e; outline-offset: 0; border-color: var(--accent); }
input[type=checkbox], input[type=radio] { width: auto; accent-color: var(--accent); }
label.check { display: flex; gap: 8px; align-items: center; font-size: .9rem; }
fieldset { border: 1px solid var(--line); border-radius: var(--r); padding: 12px; margin: 0 0 12px; }
legend { font-weight: 700; font-size: .85rem; padding: 0 6px; color: var(--ink2); }
.hint { font-size: .85rem; color: var(--muted); font-weight: 400; }

button, .btn { font: inherit; font-weight: 600; border: 1px solid var(--line2); background: var(--card); color: var(--ink); border-radius: 8px; padding: 8px 14px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; text-decoration: none; min-height: 38px; }
button:hover, .btn:hover { background: var(--hover); text-decoration: none; }
button.primary, .btn.primary { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
button.primary:hover, .btn.primary:hover { background: #ff8a3d; }
button.dark, .btn.dark { background: var(--chrome); color: #fff; border-color: var(--chrome); }
button.dark:hover, .btn.dark:hover { background: var(--chrome-hover); }
button.green, .btn.green { background: var(--green); border-color: var(--green); color: var(--on-accent); }
button.green:hover, .btn.green:hover { background: #82c64a; }
button.blue, .btn.blue { background: var(--blue); border-color: var(--blue); color: #fff; }
button.blue:hover, .btn.blue:hover { background: #3a7fc6; }
button:focus-visible, .btn:focus-visible, a:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }
button.accent { background: var(--accent); border-color: var(--accent); color: #1f2329; }
button.danger { color: var(--bad); border-color: #f1c4c4; }
button.ghost { border-color: transparent; background: transparent; }
button.sm, .btn.sm { padding: 4px 10px; min-height: 30px; font-size: .85rem; }
button:disabled { opacity: .5; cursor: not-allowed; }

/* tabele */
.tablewrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th { text-align: left; font-size: .75rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); font-weight: 700; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 9px 10px; border-bottom: 1px solid #eef0f2; vertical-align: top; }
tr.click { cursor: pointer; }
tr.click:hover td { background: var(--hover); }
tfoot td { font-weight: 700; border-bottom: 0; }

/* znaczniki */
.tag { display: inline-block; font-size: .74rem; font-weight: 700; padding: 2px 8px; border-radius: 99px; background: var(--chip); color: var(--ink2); white-space: nowrap; }
.tag.nowe { background: var(--blue-soft); color: #1d4f85; }
.tag.planowane { background: #ede9fe; color: #5b21b6; }
.tag.umowione { background: var(--accent-soft); color: var(--accent-ink); }
.tag.wykonane, .tag.zaakceptowana { background: var(--green-soft); color: var(--green-ink); }
.tag.anulowane, .tag.odrzucona { background: #f3f4f6; color: #4b5563; text-decoration: line-through; }
.tag.szkic { background: #f3f4f6; }
.tag.wyslana { background: #dbeafe; color: #1e40af; }
.tag.pilny, .tag.strong { background: #fee2e2; color: #991b1b; }
.tag.weak { background: #fef3c7; color: #92400e; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { border: 1px solid var(--line2); background: var(--card); border-radius: 99px; padding: 4px 12px; font-size: .85rem; font-weight: 600; min-height: 32px; }
.chip.on { background: var(--sel); color: var(--on-sel); border-color: var(--sel); }
.warn { background: #fffbeb; border: 1px solid #fde68a; color: #78350f; border-radius: 8px; padding: 8px 12px; font-size: .88rem; margin: 8px 0; }
.err, .blocked { background: #fef2f2; border: 1px solid #fecaca; color: #991b1b; border-radius: 8px; padding: 8px 12px; font-size: .88rem; }
.empty { text-align: center; color: var(--muted); padding: 28px 12px; }

/* modal */
dialog { border: 0; border-radius: 14px; padding: 0; width: min(760px, 94vw); max-height: 90vh; box-shadow: 0 20px 60px rgb(0 0 0 / .3); }
dialog::backdrop { background: rgb(17 20 24 / .45); }
dialog .mh { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--card); z-index: 1; }
dialog .mb { padding: 16px 18px; overflow-y: auto; }
dialog .mf { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--line); position: sticky; bottom: 0; background: var(--card); }
dialog form { display: flex; flex-direction: column; max-height: 90vh; }

/* toasty */
#toasts { position: fixed; bottom: calc(16px + env(safe-area-inset-bottom)); right: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 100; }
.toast { background: var(--chrome); color: #fff; padding: 10px 14px; border-radius: 10px; box-shadow: var(--shadow); max-width: 360px; font-size: .9rem; }
.toast.bad { background: var(--bad); }

/* logowanie: public/login.css */

/* wycena */
.quote td input { padding: 5px 8px; }
.quote .qty { width: 90px; }
.totals { margin-left: auto; max-width: 360px; }
.totals .line { display: flex; justify-content: space-between; padding: 3px 0; font-size: .92rem; }
.totals .grand { font-size: 1.25rem; font-weight: 800; border-top: 2px solid var(--ink); margin-top: 6px; padding-top: 8px; }
.disc { font-size: .78rem; color: var(--accent-ink); }

/* zlecenia technika */
.job { display: block; color: inherit; }
.job:hover { text-decoration: none; border-color: var(--line2); }
.job .when { font-weight: 800; font-size: 1.05rem; }
.bigbtn { width: 100%; justify-content: center; min-height: 48px; font-size: 1rem; }
.logo-prev { max-height: 70px; max-width: 220px; border: 1px solid var(--line); border-radius: 8px; padding: 6px; background: #fff; }

/* ---- leady, paczki, kalendarz, protokół, mapa ---- */
.tag.lead { color: #fff; }
.tag.lead.POTWIERDZONY, .chip.lead.POTWIERDZONY.on { background: #1a8a3f; border-color: #1a8a3f; color: #fff; }
.tag.lead.WYKONANY, .chip.lead.WYKONANY.on { background: #f2c200; border-color: #d6ab00; color: #3a2e00; }
.tag.lead.PRZYSZLY_ROK, .chip.lead.PRZYSZLY_ROK.on { background: #bfe0f7; border-color: #8cc4ec; color: #0f3d61; }
.tag.lead.DO_WERYFIKACJI, .chip.lead.DO_WERYFIKACJI.on { background: #6b7280; border-color: #6b7280; color: #fff; }
.tag.lead.ODRZUCONY, .chip.lead.ODRZUCONY.on { background: #c62828; border-color: #c62828; color: #fff; }
a.chip { text-decoration: none; display: inline-flex; align-items: center; }
.chip .pin { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; border: 1px solid rgb(0 0 0 / .25); }
.bulk { position: sticky; top: 8px; z-index: 5; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; background: var(--chrome); color: #fff; border-radius: var(--r); padding: 10px 14px; margin-bottom: 12px; }
.bulk .ghost { color: #fff; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 500; }
.check.big { min-height: 44px; font-size: 1rem; }
.check input { width: 20px; height: 20px; flex: none; }
.quick { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
.quick .btn { flex: 1 1 130px; min-height: 46px; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; }
.job { cursor: pointer; }
table.cal { table-layout: fixed; min-width: 860px; }
table.cal th, table.cal td { vertical-align: top; border: 1px solid var(--line); padding: 6px; }
table.cal thead th { text-transform: capitalize; }
table.cal .today { background: #fff8e6; }
table.cal tbody th { width: 120px; text-align: left; }
.ev { display: block; border-left: 4px solid #94a3b8; background: #f3f4f6; border-radius: 6px; padding: 4px 6px; margin-bottom: 4px; color: inherit; font-size: .8rem; line-height: 1.25; }
.ev b, .ev span { display: block; }
.ev.umowione { border-color: #f59e0b; background: #fef3c7; }
.ev.planowane { border-color: #7c3aed; background: #ede9fe; }
.ev.wykonane { border-color: #16a34a; background: #dcfce7; }
.ev.nowe { border-color: #2563eb; background: #dbeafe; }
.checklist { display: grid; gap: 8px; margin: 12px 0; }
.checklist label { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.checklist select { max-width: 150px; }
.coop { border: 2px solid #6fb436; border-radius: var(--r); padding: 8px 12px; margin-top: 12px; background: #f4faee; }
.slot { border: 1px solid var(--line); border-radius: var(--r); padding: 12px; margin-top: 10px; }
.slot.missing { border-color: #f59e0b; background: #fffaf0; }
.thumbs { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; }
.thumb { position: relative; }
.thumb img { width: 96px; height: 96px; object-fit: cover; border-radius: 8px; display: block; }
.thumb button { position: absolute; top: 0; right: 0; min-height: 44px; min-width: 44px; padding: 0; justify-content: center; border-radius: 8px; }
.camera { position: relative; overflow: hidden; min-height: 46px; display: inline-flex; align-items: center; font-weight: 700; margin-right: 8px; }
.filepick { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; cursor: pointer; }
.camera:focus-within { outline: 3px solid var(--info); outline-offset: 2px; }
.sticky-bar { position: sticky; bottom: 0; display: flex; gap: 16px; padding: 10px; background: var(--card); border-top: 1px solid var(--line); box-shadow: 0 -2px 8px rgb(0 0 0 / .06); z-index: 5; }
.sticky-bar button { flex: 1; min-height: 48px; font-weight: 700; }
.card.ok { border-color: #16a34a; background: #f0fdf4; }
.mapgrid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(260px, 1fr); gap: 12px; align-items: start; }
#map { height: 62vh; min-height: 360px; border-radius: var(--r); border: 1px solid var(--line); z-index: 0; }
@media (max-width: 800px) { .mapgrid { grid-template-columns: 1fr; } #map { height: 50vh; } }
.btn.accent { background: var(--accent); border-color: var(--accent); color: #1f2329; }
[hidden] { display: none !important; }
.sigpad { width: 100%; max-width: 600px; aspect-ratio: 3 / 1; border: 2px dashed #9aa3ad; border-radius: var(--r); background: #fff; touch-action: none; display: block; margin: 8px 0; }
.sigimg { max-width: 300px; width: 100%; border: 1px solid var(--line); border-radius: 8px; background: #fff; display: block; }

/* ---- wygląd FEST: pasek trzech kolorów, kolorowe karty, widok technika ---- */
.main::before { content: ""; display: block; height: 4px; border-radius: 4px; margin: -8px 0 16px; background: linear-gradient(90deg, var(--accent) 0 34%, var(--green) 34% 67%, var(--blue) 67% 100%); }
h1 { letter-spacing: -.01em; }
.card h2 { display: flex; align-items: center; gap: 8px; }
.card h2::before { content: ""; width: 4px; height: 1.05em; border-radius: 2px; background: var(--accent); flex: none; }
.stat { border-top: 4px solid var(--accent); transition: transform .12s ease, box-shadow .12s ease; }
.stats .stat:nth-child(4n+2) { border-top-color: var(--blue); }
.stats .stat:nth-child(4n+3) { border-top-color: var(--green); }
.stats .stat:nth-child(4n+4) { border-top-color: var(--chrome); }
a.stat:hover, .card.job:hover { transform: translateY(-2px); box-shadow: 0 6px 18px rgb(0 0 0 / .1); }
.stat.hot { background: var(--accent-soft); }
.card.job { border-left: 6px solid #b9bcc2; transition: transform .12s ease, box-shadow .12s ease; }
.card.job.s-umowione { border-left-color: var(--accent); }
.card.job.s-nowe { border-left-color: var(--blue); }
.card.job.s-planowane { border-left-color: #7c3aed; }
.card.job.s-wykonane { border-left-color: var(--green); background: #fbfdf9; }
.card.job .ord { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--chrome); color: #fff; font-size: .8rem; font-weight: 800; margin-right: 8px; }
.quick .btn.call { background: var(--green); border-color: var(--green); color: var(--on-accent); }
.quick .btn.nav { background: var(--blue); border-color: var(--blue); color: #fff; }
.quick .btn.proto { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
section > h3 { border-left: 4px solid var(--accent); padding-left: 8px; }
.pill { display: inline-block; font-size: .74rem; font-weight: 700; padding: 2px 8px; border-radius: 6px; background: #eee; }
.pill.o { background: var(--accent-soft); color: var(--accent-ink); } .pill.g { background: var(--green-soft); color: var(--green-ink); } .pill.b { background: var(--blue-soft); color: #1d4f85; }
.pill.k { background: var(--chrome); color: #fff; } .pill.r { background: #fee2e2; color: #991b1b; }
.load { display: inline-block; min-width: 46px; text-align: center; font-weight: 800; border-radius: 6px; padding: 1px 6px; background: var(--green-soft); color: var(--green-ink); }
.load.full { background: #fee2e2; color: #991b1b; }
.teams { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.team { border-top: 4px solid var(--blue); cursor: pointer; }
.team.partner { border-top-color: var(--green); }
.kan { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px; }
@media (max-width: 860px) { .kan { grid-template-columns: repeat(2, 1fr); } }
.kan a { display: block; border-radius: var(--r); padding: 12px 14px; color: var(--ink); background: var(--card); border: 1px solid var(--line); border-left: 6px solid var(--accent); }
.kan a.on { background: var(--sel); color: var(--on-sel); }
.kan a b { display: block; font-size: 1.5rem; }
.kan a:hover { text-decoration: none; box-shadow: var(--shadow); }
.routelist { counter-reset: stop; list-style: none; margin: 0; padding: 0; }
.routelist li { counter-increment: stop; position: relative; padding: 8px 0 8px 40px; border-bottom: 1px solid #eef0f2; }
.routelist li::before { content: counter(stop); position: absolute; left: 0; top: 8px; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--accent); color: var(--on-accent); font-weight: 800; }
.routelist li.late::before { background: var(--bad); color: #fff; }
.offline { position: sticky; top: 0; z-index: 40; background: var(--chrome); color: #fff; text-align: center; font-size: .85rem; padding: 6px 10px; border-bottom: 3px solid var(--accent); }

/* ---- samouczek: podświetlenie elementu i dymek z opisem kroku ---- */
.tour-shade { position: fixed; z-index: 200; border-radius: 10px; box-shadow: 0 0 0 4px var(--accent), 0 0 0 100vmax rgb(20 20 20 / .62); pointer-events: none; transition: all .25s ease; }
.tour-block { position: fixed; inset: 0; z-index: 199; }
.tour-pop { position: fixed; z-index: 201; width: min(360px, calc(100vw - 24px)); background: var(--card); border-radius: 14px; box-shadow: 0 16px 50px rgb(0 0 0 / .35); padding: 16px 18px 14px; border-top: 5px solid var(--accent); }
.tour-pop h3 { margin: 0 0 6px; font-size: 1.05rem; color: var(--ink); border: 0; padding: 0; }
.tour-pop p { margin: 0 0 12px; font-size: .93rem; line-height: 1.45; color: var(--ink2); }
.tour-pop .foot { display: flex; align-items: center; gap: 8px; }
.tour-pop .steps { margin-right: auto; font-size: .8rem; color: var(--muted); font-weight: 700; }
.tour-pop .bar { height: 4px; background: #eee; border-radius: 4px; margin-bottom: 10px; overflow: hidden; }
.tour-pop .bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--green), var(--blue)); transition: width .25s ease; }
.helpfab { position: fixed; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom)); z-index: 50; border-radius: 99px; background: var(--chrome); color: #fff; border-color: var(--chrome); box-shadow: 0 6px 18px rgb(0 0 0 / .25); }
.helpfab:hover { background: var(--chrome-hover); }
.helpfab b { color: var(--accent); }
#toasts { bottom: calc(70px + env(safe-area-inset-bottom)); }
@media (prefers-reduced-motion: reduce) { .tour-shade, .stat, .card.job, .tour-pop .bar i { transition: none; } }

/* mapa: numer przystanku na trasie i pojazd */
.stopnum { display: grid !important; place-items: center; border-radius: 50%; background: var(--accent); color: var(--on-accent); font-weight: 800; font-size: 13px; border: 2px solid #fff; box-shadow: 0 1px 4px rgb(0 0 0 / .4); }
.stopnum.late { background: var(--bad); color: #fff; }
.stopnum.base { background: var(--chrome); color: #fff; }
.car { display: grid !important; place-items: center; font-size: 20px; background: #fff; border-radius: 50%; border: 2px solid var(--blue); box-shadow: 0 1px 4px rgb(0 0 0 / .4); }

/* na telefonie przewodnik jest w górnym pasku, żeby nie zasłaniał przycisków zlecenia */
.topbar .tophelp { margin-left: auto; width: 34px; height: 34px; min-height: 0; border-radius: 50%; border: 2px solid var(--accent); color: var(--accent); font-size: 1.05rem; font-weight: 800; padding: 0; justify-content: center; }
@media (max-width: 860px) { .helpfab { display: none; } #toasts { bottom: calc(16px + env(safe-area-inset-bottom)); } }

.okbox { background: #f0fdf4; border: 1px solid #bbf7d0; color: #166534; border-radius: 8px; padding: 8px 12px; font-size: .88rem; margin: 8px 0; }
ul.plain { margin: 4px 0 0; padding-left: 18px; }

/* protokół: wybór odpowiedzi i tabele pomiarowe (duże cele dotyku w terenie) */
.pick { display: flex; gap: 8px; flex-wrap: wrap; }
.pick .opt { flex: 1 1 0; min-width: 96px; min-height: 44px; border: 1px solid var(--line); border-radius: var(--r); background: var(--card); font-weight: 600; }
.pick.sm .opt { min-width: 64px; min-height: 40px; }
.pick .opt[aria-pressed="true"] { background: var(--sel); color: var(--on-sel); border-color: var(--sel); }
.pick .opt[aria-pressed="true"][data-v="negatywny"], .pick .opt[aria-pressed="true"][data-v="nie"], .pick .opt[aria-pressed="true"][data-v="nie_nadaje"] { background: var(--bad); border-color: var(--bad); }
.pick .opt[aria-pressed="true"][data-v="pozytywny"], .pick .opt[aria-pressed="true"][data-v="tak"], .pick .opt[aria-pressed="true"][data-v="nadaje"] { background: var(--ok, #2f7d32); border-color: var(--ok, #2f7d32); }
.mtable { display: grid; gap: 6px; overflow-x: auto; }
.mrow { display: grid; grid-template-columns: minmax(96px, 1.4fr) repeat(auto-fit, minmax(60px, 1fr)); gap: 6px; align-items: center; }
.mlab, .mhead { font-size: .82rem; color: var(--muted); }
.mhead { text-align: center; }
.cellin { min-height: 44px; width: 100%; text-align: center; }
.mocena { margin: 2px 0 10px; }

/* menu: spokojne przejścia, aktywna pozycja z akcentem w trzech kolorach marki */
.nav a { position: relative; transition: background-color 160ms ease-out, color 160ms ease-out, transform 160ms ease-out; }
.nav a.on { background: linear-gradient(90deg, rgb(247 106 12 / .2), rgb(255 255 255 / .05) 70%); box-shadow: none; font-weight: 600; }
.nav a.on::before { content: ""; position: absolute; left: 0; top: 7px; bottom: 7px; width: 4px; border-radius: 4px; background: linear-gradient(var(--accent), var(--green), var(--blue)); }
@media (hover: hover) { .nav a:hover:not(.on) { transform: translateX(2px); } }

/* zakładki technika na dole ekranu telefonu */
.tabbar { display: none; }
@media (max-width: 860px) {
  .tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
    background: rgb(30 30 30 / .94); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); border-top: 1px solid #383838; }
  .tabbar a { position: relative; display: grid; justify-items: center; gap: 3px; min-height: 48px; padding: 6px 4px; border-radius: 10px; color: #b9bdc4; font-size: .8rem; font-weight: 600; text-decoration: none; transition: color 160ms ease-out, background-color 160ms ease-out; }
  .tabbar svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
  .tabbar a.on { color: #fff; background: rgb(255 255 255 / .07); }
  .tabbar a.on::before { content: ""; position: absolute; top: -7px; left: 28%; right: 28%; height: 3px; border-radius: 3px; background: linear-gradient(90deg, var(--accent), var(--green), var(--blue)); }
  .has-tabbar .main { padding-bottom: calc(84px + env(safe-area-inset-bottom)); }
  .has-tabbar .sticky-bar { bottom: calc(64px + env(safe-area-inset-bottom)); }
  .has-tabbar .helpfab { display: none; }
  .has-tabbar ~ #toasts, body:has(.has-tabbar) #toasts { bottom: calc(76px + env(safe-area-inset-bottom)); }
}
@media (prefers-reduced-motion: reduce) { .nav a, .tabbar a { transition: none; } }

/* logo w aplikacji: znak nad napisem, oryginalne kolory, pod spodem słaba poświata (ten sam charakter co ekran logowania) */
.brand:has(.brand-sign) { display: grid; justify-items: center; gap: 10px; padding: 14px 8px 16px; margin-bottom: 8px; border-bottom: 1px solid #333; position: relative; }
.brand:has(.brand-sign)::after { content: ""; position: absolute; left: 22%; right: 22%; bottom: -1px; height: 2px; border-radius: 2px; background: linear-gradient(90deg, var(--accent), var(--green), #4f8fdb); }
.brand-sign { position: relative; display: block; width: 140px; aspect-ratio: 153.12 / 142.12; flex: none; }
.brand-sign i { position: absolute; inset: 0; background: url(brand/znak-dark.svg) center / contain no-repeat; }
.brand-sign.is-serwis i { background-image: url(brand/znak-serwis-dark.svg); }
.brand-sign .glow { filter: blur(12px) saturate(1.5); opacity: .7; animation: brand-breathe 2.8s ease-in-out infinite alternate; }
.brand-sign.sm { width: 30px; }
@keyframes brand-breathe { from { opacity: .08; } to { opacity: .8; } }
.brand-word { display: block; width: 176px; aspect-ratio: 317 / 147; background: url(brand/logo-dark.png) 96.06% 50% / 164.04% auto no-repeat; }
.brand-word.is-serwis { aspect-ratio: 287 / 145; background: url(brand/serwis-dark.png) 83.3% 50.6% / 181.2% auto no-repeat; }
@media (prefers-reduced-motion: reduce) { .brand-sign .glow { animation: none; } }

/* menu: grupy rozwijane płynnie (wysokość animowana przez grid 0fr -> 1fr), strzałka obraca się */
.nav .grp-wrap { margin-bottom: 2px; }
.nav button.grp { all: unset; box-sizing: border-box; width: 100%; display: flex; align-items: center; gap: 8px; cursor: pointer; font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: #8d9096; padding: 12px 10px 6px; border-radius: 6px; transition: color 160ms ease-out; }
.nav button.grp:hover { color: #e6e8eb; }
.nav button.grp:focus-visible { outline: 2px solid #4f8fdb; outline-offset: 2px; }
.nav button.grp span:first-child { flex: 1; }
.nav button.grp .chev { width: 8px; height: 8px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg) translate(-2px, -2px); transition: transform 260ms cubic-bezier(.23, 1, .32, 1); }
.nav button.grp[aria-expanded="false"] .chev { transform: rotate(-45deg); }
.nav .badge.sm { margin-left: 0; font-size: .64rem; padding: 0 6px; }
.nav .grp-box { display: grid; grid-template-rows: 1fr; transition: grid-template-rows 320ms cubic-bezier(.23, 1, .32, 1); }
.nav button.grp[aria-expanded="false"] + .grp-box { grid-template-rows: 0fr; }
.nav .grp-in { overflow: hidden; min-height: 0; }
.nav .grp-in a { transition: opacity 240ms ease-out, transform 240ms cubic-bezier(.23, 1, .32, 1), background-color 160ms ease-out, color 160ms ease-out; }
.nav button.grp[aria-expanded="false"] + .grp-box a { opacity: 0; transform: translateY(-6px); }
.nav .grp-in a:nth-child(2) { transition-delay: 25ms; } .nav .grp-in a:nth-child(3) { transition-delay: 50ms; } .nav .grp-in a:nth-child(4) { transition-delay: 75ms; } .nav .grp-in a:nth-child(5) { transition-delay: 100ms; } .nav .grp-in a:nth-child(6) { transition-delay: 125ms; }
@media (prefers-reduced-motion: reduce) { .nav .grp-box, .nav .grp-in a, .nav button.grp .chev { transition: none; } }

/* moja poczta: lista po lewej, treść po prawej (na telefonie jedno pod drugim) */
.mb { display: grid; grid-template-columns: minmax(260px, 360px) 1fr; gap: 0; padding: 0; overflow: hidden; min-height: 60vh; }
.mb-side { border-right: 1px solid var(--line); display: flex; flex-direction: column; min-width: 0; }
.mb-tabs { display: flex; gap: 4px; padding: 10px; border-bottom: 1px solid var(--line); }
.mb-tabs button { flex: 1; min-height: 38px; border-radius: 8px; border: 1px solid var(--line); background: var(--card); font-weight: 600; }
.mb-tabs button.on { background: var(--sel); color: var(--on-sel); border-color: var(--sel); }
.mb-list { overflow-y: auto; max-height: 70vh; }
.mb-row { all: unset; box-sizing: border-box; display: grid; grid-template-columns: 1fr auto; gap: 2px 8px; width: 100%; padding: 11px 14px; border-bottom: 1px solid var(--line); cursor: pointer; transition: background-color 140ms ease-out; }
.mb-row:hover { background: var(--hover); }
.mb-row.on { background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--accent); }
.mb-row:focus-visible { outline: 2px solid var(--blue); outline-offset: -2px; }
.mb-who { font-size: .9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mb-when { font-size: .82rem; color: var(--muted); }
.mb-subj { grid-column: 1 / -1; font-size: .85rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mb-row.unseen .mb-who, .mb-row.unseen .mb-subj { font-weight: 700; color: var(--ink); }
.mb-row.unseen .mb-who::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); margin-right: 7px; vertical-align: middle; }
.mb-view { padding: 18px 22px; min-width: 0; }
.mb-head h2 { margin: 0 0 4px; }
.mb-text { white-space: pre-wrap; word-break: break-word; font: inherit; font-size: .95rem; line-height: 1.55; margin: 16px 0; }
.mb-att { display: flex; flex-wrap: wrap; gap: 8px; }
.mb-invite { display: block; border-left: 4px solid var(--accent); text-decoration: none; color: var(--ink); }
.mb-adv summary { cursor: pointer; color: var(--muted); font-size: .88rem; }
@media (max-width: 860px) { .mb { grid-template-columns: 1fr; } .mb-side { border-right: 0; border-bottom: 1px solid var(--line); } .mb-list { max-height: 45vh; } }

/* lokalizacja techników */
.gps-box { border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px; margin-top: 12px; }
.gps-box h3 { margin: 0 0 8px; font-size: 1rem; }
.gps-steps { margin: 0 0 10px; padding-left: 18px; display: grid; gap: 8px; font-size: .9rem; }
.gps-kv { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 8px; align-items: center; margin-top: 6px; }
.gps-kv > span { grid-column: 1 / -1; font-size: .8rem; color: var(--muted); margin-top: 4px; }
.gps-kv > span:empty { display: none; }
.gps-kv code { background: var(--hover); border-radius: 6px; padding: 4px 8px; font-size: .82rem; word-break: break-all; }
.loc-switch { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.loc-right { display: grid; justify-items: end; gap: 4px; }
.loc-btn[aria-pressed="true"] { background: var(--green); border-color: var(--green); color: #fff; }
.car.phone { font-size: 22px; }
.car.stale { filter: grayscale(1); opacity: .6; }

.tech-pin b { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--accent); color: #fff; font-size: .8rem; font-weight: 800; border: 3px solid #fff; box-shadow: 0 2px 8px rgb(0 0 0 / .35); }
.tech-pin:not(.stale) b { animation: tech-ping 2.4s ease-out infinite; }
.tech-pin.stale b { background: #8d9096; }
@keyframes tech-ping { 0% { box-shadow: 0 2px 8px rgb(0 0 0 / .35), 0 0 0 0 rgb(247 106 12 / .55); } 70% { box-shadow: 0 2px 8px rgb(0 0 0 / .35), 0 0 0 14px rgb(247 106 12 / 0); } 100% { box-shadow: 0 2px 8px rgb(0 0 0 / .35), 0 0 0 0 rgb(247 106 12 / 0); } }
.leaflet-tooltip.tech-label { font-size: .75rem; padding: 2px 6px; }
@media (prefers-reduced-motion: reduce) { .tech-pin b { animation: none !important; } }

/* ciemny ekran: jasne pola komunikatów i znaczników przyciemnione, tekst pozostaje czytelny */
:root[data-theme="dark"] .warn { background: #2d2410; border-color: #5c4a1a; color: #f3d48a; }
:root[data-theme="dark"] .err, :root[data-theme="dark"] .blocked { background: #2e1616; border-color: #5e2626; color: #f4a5a5; }
:root[data-theme="dark"] .okbox, :root[data-theme="dark"] .card.ok { background: #15261a; border-color: #2c5a36; color: #a8dcb4; }
:root[data-theme="dark"] .tag.nowe, :root[data-theme="dark"] .tag.wyslana { background: #16243a; color: #9cc4f0; }
:root[data-theme="dark"] .tag.anulowane, :root[data-theme="dark"] .tag.odrzucona, :root[data-theme="dark"] .tag.szkic, :root[data-theme="dark"] .ev { background: #2b2e33; color: var(--ink2); }
:root[data-theme="dark"] .tag.pilny, :root[data-theme="dark"] .tag.strong, :root[data-theme="dark"] .load.full, :root[data-theme="dark"] .pill.r { background: #3a1a1a; color: #f4a5a5; }
:root[data-theme="dark"] .tag.weak, :root[data-theme="dark"] .ev.umowione { background: #33290f; color: #f3d48a; }
:root[data-theme="dark"] .tag.planowane, :root[data-theme="dark"] .ev.planowane { background: #2a2140; color: #c9b8f5; }
:root[data-theme="dark"] table.cal .today, :root[data-theme="dark"] .slot.missing { background: #2b2414; }
:root[data-theme="dark"] .coop, :root[data-theme="dark"] .card.job.s-wykonane { background: #18221a; }
:root[data-theme="dark"] tr.click:hover td { background: var(--hover); }
@media (prefers-color-scheme: dark) {
:root:not([data-theme="light"]) .warn { background: #2d2410; border-color: #5c4a1a; color: #f3d48a; }
:root:not([data-theme="light"]) .err, :root:not([data-theme="light"]) .blocked { background: #2e1616; border-color: #5e2626; color: #f4a5a5; }
:root:not([data-theme="light"]) .okbox, :root:not([data-theme="light"]) .card.ok { background: #15261a; border-color: #2c5a36; color: #a8dcb4; }
:root:not([data-theme="light"]) .tag.nowe, :root:not([data-theme="light"]) .tag.wyslana { background: #16243a; color: #9cc4f0; }
:root:not([data-theme="light"]) .tag.anulowane, :root:not([data-theme="light"]) .tag.odrzucona, :root:not([data-theme="light"]) .tag.szkic, :root:not([data-theme="light"]) .ev { background: #2b2e33; color: var(--ink2); }
:root:not([data-theme="light"]) .tag.pilny, :root:not([data-theme="light"]) .tag.strong, :root:not([data-theme="light"]) .load.full, :root:not([data-theme="light"]) .pill.r { background: #3a1a1a; color: #f4a5a5; }
:root:not([data-theme="light"]) .tag.weak, :root:not([data-theme="light"]) .ev.umowione { background: #33290f; color: #f3d48a; }
:root:not([data-theme="light"]) .tag.planowane, :root:not([data-theme="light"]) .ev.planowane { background: #2a2140; color: #c9b8f5; }
:root:not([data-theme="light"]) table.cal .today, :root:not([data-theme="light"]) .slot.missing { background: #2b2414; }
:root:not([data-theme="light"]) .coop, :root:not([data-theme="light"]) .card.job.s-wykonane { background: #18221a; }
:root:not([data-theme="light"]) tr.click:hover td { background: var(--hover); }
}
.theme-switch { margin-top: 8px; background: none; border: 1px solid #3a3d42; color: #cfd3d9; font-weight: 500; font-size: .82rem; min-height: 32px; padding: 4px 10px; }
.theme-switch:hover { background: #2e2e2e; }

/* wiadomości biuro <-> technik */
.msg-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; max-height: 55vh; overflow-y: auto; }
.msg-list.short { max-height: none; margin-bottom: 10px; }
.msg { max-width: 86%; padding: 8px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); }
.msg.other { justify-self: start; background: var(--hover); }
.msg.own { justify-self: end; border-color: var(--accent); }
.msg-body { white-space: pre-wrap; overflow-wrap: anywhere; }
.msg-meta { color: var(--muted); font-size: .78rem; margin-top: 4px; }
.msg-chip { display: inline-block; margin-top: 6px; padding: 6px 10px; min-height: 32px; border-radius: 99px; background: var(--chip); font-size: .85rem; font-weight: 600; }
.msg-compose { position: sticky; bottom: 0; z-index: 4; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 12px; display: grid; gap: 8px; }
.msg-compose button[type=submit] { min-height: 48px; min-width: 120px; font-weight: 700; }
.msg-about:empty { display: none; }
.msg-split { display: grid; grid-template-columns: minmax(220px, 300px) 1fr; gap: 14px; align-items: start; }
.msg-techs { display: grid; gap: 6px; }
.msg-tech { display: grid; gap: 2px; padding: 10px 12px; min-height: 48px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); color: var(--ink); text-decoration: none; }
.msg-tech.on { border-color: var(--accent); background: var(--hover); }
.msg-tech .nm { display: flex; justify-content: space-between; gap: 8px; font-weight: 700; }
.msg-techs .badge, .tabbar .badge { background: var(--accent); color: var(--on-accent); border-radius: 99px; font-size: .72rem; font-weight: 800; padding: 1px 7px; }
.tabbar .badge { position: absolute; top: 2px; left: calc(50% + 6px); }
@media (max-width: 860px) { .msg-split { grid-template-columns: 1fr; } .has-tabbar .msg-compose { bottom: calc(64px + env(safe-area-inset-bottom)); } .msg { max-width: 94%; } }

/* telefon (praca technika): wszystkie przyciski i chipy mają co najmniej 44 x 44 px, także w rękawicach */
@media (max-width: 860px) {
  button, .btn, .chip, button.sm, .btn.sm, .pick.sm .opt, .mb-tabs button { min-height: 44px; }
  button, .btn, .chip { min-width: 44px; }
  .topbar .tophelp { width: 44px; height: 44px; }
}

/* wydruk planu dnia: na ekranie ukryty, przy drukowaniu jedyna widoczna rzecz (A4 poziomo, czarno na białym) */
.printplan { display: none; }
@media print {
  @page { size: A4 landscape; margin: 12mm; }
  html, body { background: #fff !important; }
  body > *:not(.printplan) { display: none !important; }
  .printplan { display: block !important; color: #000; font-size: 11pt; }
  .printplan h1 { font-size: 16pt; margin: 0 0 2mm; }
  .printplan table { width: 100%; border-collapse: collapse; }
  .printplan th, .printplan td { border: 1px solid #000; padding: 2mm; text-align: left; vertical-align: top; font-size: 10pt; color: #000; white-space: normal; }
  .printplan td.blank { width: 28%; height: 16mm; }
  .printplan tr { break-inside: avoid; }
}
