/* WALD-BRUK Ewidencja — arkusz główny
   Kolory z logo firmy: granat (indygo) + błękit. Tło „żwir”, akcent ostrzegawczy „hi-vis”. */

:root {
  --indigo: #1d1560;
  --indigo-2: #2b2174;
  --indigo-3: #3a2f8f;
  --blue: #0092dc;
  --blue-d: #0074b8;
  --blue-l: #e3f3fc;
  --ink: #16132e;
  --muted: #5c607a;
  --faint: #8a8ea6;
  --paper: #eceef3;
  --card: #ffffff;
  --line: #dde0ea;
  --line-2: #c9cdda;
  --hivis: #ffb000;
  --stop: #d23a2c;
  --stop-d: #b02d21;
  --ok: #137a43;
  --ok-bg: #e2f5e9;
  --warn: #8a5300;
  --warn-bg: #fff2d6;
  --err: #b42318;
  --err-bg: #fde8e6;

  --f-body: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --f-disp: "Barlow Condensed", "Arial Narrow", system-ui, sans-serif;

  --r-s: 8px;
  --r: 14px;
  --r-l: 20px;
  --sh: 0 1px 2px rgba(22, 19, 46, .06), 0 4px 14px rgba(22, 19, 46, .06);
  --sh-2: 0 2px 4px rgba(22, 19, 46, .08), 0 12px 32px rgba(22, 19, 46, .12);

  /* kostka brukowa — wzór „parkiet” */
  --pavers: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='48' height='48' viewBox='0 0 48 48'%3E%3Cg fill='none' stroke='%23ffffff' stroke-opacity='.07' stroke-width='1.2'%3E%3Crect x='.6' y='.6' width='22.8' height='10.8' rx='1.5'/%3E%3Crect x='.6' y='12.6' width='22.8' height='10.8' rx='1.5'/%3E%3Crect x='24.6' y='.6' width='10.8' height='22.8' rx='1.5'/%3E%3Crect x='36.6' y='.6' width='10.8' height='22.8' rx='1.5'/%3E%3Crect x='.6' y='24.6' width='10.8' height='22.8' rx='1.5'/%3E%3Crect x='12.6' y='24.6' width='10.8' height='22.8' rx='1.5'/%3E%3Crect x='24.6' y='24.6' width='22.8' height='10.8' rx='1.5'/%3E%3Crect x='24.6' y='36.6' width='22.8' height='10.8' rx='1.5'/%3E%3C/g%3E%3C/svg%3E");
  --hazard: repeating-linear-gradient(-45deg, var(--hivis) 0 12px, var(--ink) 12px 24px);

  --safe-b: env(safe-area-inset-bottom, 0px);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--f-body);
  font-size: 16px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
h1, h2, h3, h4 { margin: 0; line-height: 1.15; }
p { margin: 0 0 .75em; }
a { color: var(--blue-d); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: .2em; }
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; border-radius: 4px; }
[hidden] { display: none !important; }

.i { width: 1.25em; height: 1.25em; flex: none; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; vertical-align: -.25em; }

.logo { display: block; height: 26px; width: auto; }
.logo .lg-a { fill: var(--indigo); }
.logo .lg-b { fill: var(--blue); }

.disp { font-family: var(--f-disp); font-weight: 700; letter-spacing: .01em; }
.tnum { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.center { text-align: center; }
.mt { margin-top: 1rem; }
.mt2 { margin-top: 2rem; }
.mb { margin-bottom: 1rem; }
.row { display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.grow { flex: 1 1 auto; }
.stack > * + * { margin-top: 1rem; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- Przyciski ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  min-height: 44px; padding: .55rem 1.1rem;
  border: 1.5px solid transparent; border-radius: 12px;
  background: var(--blue-d); color: #fff;
  font-weight: 700; font-size: .95rem; text-decoration: none; cursor: pointer;
  transition: transform .12s ease, background-color .15s ease, box-shadow .15s ease;
  white-space: nowrap;
}
.btn:hover { text-decoration: none; background: #00669f; }
.btn:active { transform: scale(.97); }
.btn.ghost { background: var(--card); color: var(--ink); border-color: var(--line-2); }
.btn.ghost:hover { background: #f6f7fa; }
.btn.dark { background: var(--indigo); }
.btn.dark:hover { background: var(--indigo-2); }
.btn.danger { background: var(--stop); }
.btn.danger:hover { background: var(--stop-d); }
.btn.ok { background: var(--ok); }
.btn.ok:hover { background: #0f6537; }
.btn.sm { min-height: 36px; padding: .35rem .8rem; font-size: .85rem; border-radius: 10px; }
.btn.lg { min-height: 60px; font-size: 1.1rem; border-radius: 16px; padding: .8rem 1.4rem; }
.btn.block { width: 100%; }
.btn[disabled], .btn.busy { opacity: .7; pointer-events: none; }
.btn.busy::after {
  content: ""; width: 1em; height: 1em; border-radius: 50%;
  border: 2.5px solid currentColor; border-right-color: transparent;
  animation: spin .7s linear infinite;
}
.iconbtn {
  display: inline-grid; place-items: center; width: 44px; height: 44px;
  border: 0; border-radius: 12px; background: transparent; color: inherit; cursor: pointer;
}
.iconbtn:hover { background: rgba(127, 127, 160, .14); }
.linkbtn { border: 0; background: none; padding: 0; color: var(--blue-d); font-weight: 600; cursor: pointer; }
.linkbtn:hover { text-decoration: underline; }

/* ---------- Odznaki ---------- */
.badge {
  display: inline-flex; align-items: center; gap: .3rem;
  padding: .15rem .6rem; border-radius: 99px;
  background: #eef0f5; color: var(--muted);
  font-size: .78rem; font-weight: 700; white-space: nowrap;
}
.badge .i { width: 1em; height: 1em; vertical-align: 0; stroke-width: 3; }
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.wait { background: var(--warn-bg); color: var(--warn); }
.badge.err { background: var(--err-bg); color: var(--err); }
.badge.blue { background: var(--blue-l); color: var(--blue-d); }
.badge.live { background: #e7f8ee; color: var(--ok); }
.badge.live::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; animation: pulse 1.6s ease-in-out infinite; }

.avatar {
  display: inline-grid; place-items: center; flex: none;
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--blue); color: #fff; font-weight: 800; font-size: .8rem; letter-spacing: .02em;
}
.avatar.lg { width: 56px; height: 56px; font-size: 1.15rem; }

/* ---------- Karty ---------- */
.card { background: var(--card); border-radius: var(--r); box-shadow: var(--sh); padding: 1.1rem 1.15rem; }
.card + .card { margin-top: 1rem; }
.card-h { display: flex; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: .85rem; flex-wrap: wrap; }
.card-h h2, .card-h h3 { font-size: 1.05rem; font-weight: 800; }
.eyebrow { font-family: var(--f-disp); font-weight: 600; text-transform: uppercase; letter-spacing: .08em; font-size: .85rem; color: var(--muted); }
.empty { text-align: center; padding: 2rem 1rem; color: var(--muted); }
.empty .i { width: 40px; height: 40px; color: var(--line-2); margin-bottom: .5rem; }
.empty strong { display: block; color: var(--ink); margin-bottom: .2rem; }

/* ---------- Formularze ---------- */
.field { display: block; margin-bottom: 1rem; }
.field > span, .label { display: block; font-weight: 700; font-size: .9rem; margin-bottom: .35rem; }
.field > span small { font-weight: 500; color: var(--muted); }
.input, .field input:not([type=checkbox]):not([type=radio]):not([type=file]), .field select, .field textarea {
  width: 100%; min-height: 52px; padding: .7rem .9rem;
  border: 1.5px solid var(--line-2); border-radius: 12px; background: #fff;
  font-size: 1.0625rem; /* ≥16px — iOS nie przybliża */
  transition: border-color .15s, box-shadow .15s;
}
.field textarea { min-height: 96px; resize: vertical; }
.field select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%235c607a' stroke-width='2.5' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right .8rem center; background-size: 20px; padding-right: 2.6rem; }
.input:focus, .field input:focus, .field select:focus, .field textarea:focus { border-color: var(--blue); box-shadow: 0 0 0 4px rgba(0, 146, 220, .15); outline: none; }
.field .hint { display: block; color: var(--muted); font-size: .82rem; margin-top: .3rem; }
.field.err input, .field.err select, .field.err textarea { border-color: var(--err); }
.field .err-msg { color: var(--err); font-size: .85rem; font-weight: 600; margin-top: .3rem; display: block; }
.grid2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0 .75rem; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 .75rem; }
.grid2 > *, .grid3 > * { min-width: 0; }
@media screen and (max-width: 420px) { .grid3 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }
/* iOS Safari daje polom godziny/daty własną minimalną szerokość — bez tego „Od” wchodzi na „Do” */
.field input[type=time], .field input[type=date] { display: block; width: 100%; min-width: 0; max-width: 100%; -webkit-appearance: none; appearance: none; text-align: left; }
.field input[type=time]::-webkit-date-and-time-value, .field input[type=date]::-webkit-date-and-time-value { text-align: left; }
.time-wrap { position: relative; display: block; }
.time-wrap input[type=time] { padding-right: 4.8rem; }
.time-wrap .now {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  border: 0; background: var(--blue-l); color: var(--blue-d); font-weight: 700; font-size: .78rem;
  border-radius: 8px; padding: .35rem .5rem; cursor: pointer;
}
.check { display: flex; align-items: center; gap: .6rem; font-weight: 600; cursor: pointer; }
.check input { width: 22px; height: 22px; accent-color: var(--blue-d); }
.form-actions { display: flex; gap: .75rem; flex-wrap: wrap; margin-top: 1.25rem; }
.form-actions .btn { flex: 1 1 auto; }

/* Duża lista wyboru (rodzaj pracy, pojazd) */
.chips { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .5rem; }
.chip { position: relative; }
.chip input { position: absolute; opacity: 0; inset: 0; }
.chip span {
  display: flex; align-items: center; min-height: 54px; padding: .55rem .8rem;
  border: 1.5px solid var(--line-2); border-radius: 12px; background: #fff;
  font-weight: 650; font-size: .95rem; line-height: 1.2; cursor: pointer;
  transition: border-color .15s, background .15s, transform .1s;
}
.chip input:checked + span { border-color: var(--blue-d); background: var(--blue-l); color: var(--indigo); box-shadow: inset 0 0 0 1.5px var(--blue-d); }
.chip input:focus-visible + span { outline: 3px solid var(--blue); outline-offset: 2px; }
.chip span:active { transform: scale(.98); }
/* wielokrotny wybór: kwadracik z ptaszkiem */
.chips.multi .chip span { gap: .55rem; }
.chips.multi .tick { display: grid; place-items: center; flex: none; width: 22px; height: 22px; border-radius: 6px; border: 2px solid var(--line-2); background: #fff; }
.chips.multi .tick .i { width: 14px; height: 14px; stroke-width: 3.2; opacity: 0; color: #fff; }
.chips.multi .chip input:checked + span .tick { background: var(--blue-d); border-color: var(--blue-d); }
.chips.multi .chip input:checked + span .tick .i { opacity: 1; }

/* Zdjęcia */
.photo-pick {
  display: flex; align-items: center; justify-content: center; gap: .6rem;
  min-height: 64px; border: 2px dashed var(--line-2); border-radius: 14px;
  color: var(--blue-d); font-weight: 700; cursor: pointer; background: #fafbfd;
}
.photo-pick input { display: none; }
.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: .5rem; margin-top: .6rem; }
.thumbs a, .thumbs .th { position: relative; aspect-ratio: 1; border-radius: 10px; overflow: hidden; background: #dfe2ea; }
.thumbs img { width: 100%; height: 100%; object-fit: cover; }
/* zdjęcie obrócone w podglądzie (photos.rotation) — miniatura też */
[data-rot="90"] > img { transform: rotate(90deg); }
[data-rot="180"] > img { transform: rotate(180deg); }
[data-rot="270"] > img { transform: rotate(270deg); }
.thumbs .th button { position: absolute; top: 4px; right: 4px; width: 28px; height: 28px; border-radius: 50%; border: 0; background: rgba(22,19,46,.75); color: #fff; display: grid; place-items: center; cursor: pointer; }
.thumbs .th button .i { width: 16px; height: 16px; }

/* ---------- Komunikaty ---------- */
.toasts { position: fixed; left: 50%; transform: translateX(-50%); top: 12px; z-index: 90; display: grid; gap: .5rem; width: min(92vw, 440px); pointer-events: none; }
.toast {
  display: flex; align-items: center; gap: .6rem; padding: .8rem 1rem; border-radius: 14px;
  background: var(--ink); color: #fff; box-shadow: var(--sh-2); font-weight: 600;
  animation: toastIn .35s cubic-bezier(.2, .9, .3, 1.2) both, toastOut .4s ease 4.2s forwards;
}
.toast .i { color: #6fe3a2; }
.toast.error { background: var(--err); }
.toast.error .i { color: #fff; }
.toast.warn { background: #6b4200; }
.toast.warn .i { color: #ffcf66; }
.notice { display: flex; gap: .7rem; align-items: flex-start; padding: .85rem 1rem; border-radius: 12px; background: var(--blue-l); color: var(--indigo); font-weight: 550; }
.notice .i { margin-top: .1rem; }
.notice.warn { background: var(--warn-bg); color: var(--warn); }
.notice.err { background: var(--err-bg); color: var(--err); }
.notice.ok { background: var(--ok-bg); color: var(--ok); }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 50% { opacity: .35; transform: scale(.8); } }
@keyframes toastIn { from { opacity: 0; transform: translateY(-12px) scale(.96); } }
@keyframes toastOut { to { opacity: 0; transform: translateY(-8px); } }
@keyframes hazard { to { background-position: 68px 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }

/* =================================================================
   LOGOWANIE
   ================================================================= */
.login {
  min-height: 100vh; min-height: 100dvh; display: grid; grid-template-rows: 1fr auto;
  background: var(--indigo) var(--pavers); color: #fff;
}
.login-box { width: min(100% - 32px, 400px); margin: auto; padding: 2rem 0; }
.login .logo { height: 40px; margin: 0 auto 2.2rem; }
.login .logo .lg-a { fill: #fff; }
.login .logo .lg-b { fill: #4cc3ff; }
.login-card { background: #fff; color: var(--ink); border-radius: var(--r-l); padding: 1.6rem 1.4rem 1.4rem; box-shadow: 0 30px 60px rgba(0, 0, 0, .3); }
.login-card h1 { font-family: var(--f-disp); font-size: 2rem; text-transform: uppercase; letter-spacing: .02em; }
.login-card p { color: var(--muted); margin: .25rem 0 1.4rem; }
.login-road { height: 14px; background: var(--hazard); background-size: 34px 34px; opacity: .95; }
.login-foot { text-align: center; font-size: .8rem; opacity: .6; padding: 0 1rem 1rem; }
.pass-wrap { position: relative; }
.pass-wrap .iconbtn { position: absolute; right: 4px; top: 4px; color: var(--muted); }

/* =================================================================
   PANEL PRACOWNIKA
   ================================================================= */
.nav-worker { background: var(--paper); }
.wbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: .5rem;
  min-height: 60px; padding: .5rem max(12px, calc((100vw - 600px) / 2));
  padding-top: calc(.5rem + env(safe-area-inset-top, 0px));
  background: var(--indigo); color: #fff;
}
.wbar .logo { height: 22px; }
.wbar .logo .lg-a { fill: #fff; }
.wbar .logo .lg-b { fill: #4cc3ff; }
.wbar-logo { display: block; padding: .3rem .2rem; }
.wbar-back { display: grid; place-items: center; width: 44px; height: 44px; color: #fff; border-radius: 12px; }
.wbar-back:hover { background: rgba(255, 255, 255, .1); }
.wbar-back .i { width: 26px; height: 26px; }
.wbar-title { flex: 1; font-family: var(--f-disp); font-size: 1.35rem; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wbar-user { display: flex; align-items: center; gap: .25rem; }
.wbar-user form { margin: 0; }
.wbar .avatar { width: 34px; height: 34px; background: rgba(255, 255, 255, .14); }
/* menu pod inicjałami — przełączanie na brygadę obsługiwaną za brygadzistę */
.umenu { position: relative; }
.umenu > summary { list-style: none; cursor: pointer; position: relative; outline-offset: 2px; }
.umenu > summary::-webkit-details-marker { display: none; }
.umenu > summary::after { content: ""; position: absolute; right: -2px; bottom: -2px; width: 12px; height: 12px; border-radius: 50%; background: var(--hivis) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='m3.5 5 2.5 2.5L8.5 5' fill='none' stroke='%2316132e' stroke-width='1.6' stroke-linecap='round'/%3E%3C/svg%3E") center/100% no-repeat; box-shadow: 0 0 0 2px var(--indigo); }
.umenu > summary.on { background: var(--hivis); color: var(--ink); }
.umenu-pop { position: absolute; right: 0; top: calc(100% + 8px); z-index: 40; min-width: 250px; padding: 6px; border-radius: var(--r); background: var(--card); color: var(--ink); box-shadow: var(--sh-2); }
.umenu-who { padding: 8px 10px 10px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.umenu-who strong { display: block; font-size: .95rem; }
.umenu-who small { color: var(--muted); font-size: .8rem; }
.umenu-pop a { display: flex; align-items: center; gap: 10px; min-height: 46px; padding: 0 10px; border-radius: var(--r-s); color: var(--ink); font-weight: 700; text-decoration: none; }
.umenu-pop a:hover, .umenu-pop a:focus-visible { background: var(--blue-l); }
.umenu-pop a .i { width: 20px; height: 20px; color: var(--blue); }
.wmain { width: min(100%, 600px); margin: 0 auto; padding: 1rem 12px calc(2rem + var(--safe-b)); }

/* Licznik */
.timer {
  position: relative; overflow: hidden;
  margin: -1rem -12px 0; padding: 1.1rem 16px 1.4rem;
  background: var(--indigo) var(--pavers); color: #fff;
}
@media (min-width: 600px) { .timer { margin: 0 0 0; border-radius: 0 0 var(--r-l) var(--r-l); } }
.timer-top { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.timer-date { font-family: var(--f-disp); font-weight: 600; font-size: 1.05rem; letter-spacing: .1em; text-transform: uppercase; color: #bcd9f5; }
.timer-state { display: inline-flex; align-items: center; gap: .45rem; padding: .25rem .7rem; border-radius: 99px; background: rgba(255, 255, 255, .1); font-size: .8rem; font-weight: 700; }
.timer-state::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #8f8bb8; }
.timer.running .timer-state { background: rgba(255, 176, 0, .18); color: #ffd56b; }
.timer.running .timer-state::before { background: var(--hivis); animation: pulse 1.4s ease-in-out infinite; }
.timer-label { margin-top: 1.1rem; font-size: .85rem; font-weight: 700; color: #a9a4d9; text-transform: uppercase; letter-spacing: .08em; }
.timer-clock {
  font-family: var(--f-disp); font-weight: 700; font-variant-numeric: tabular-nums;
  font-size: clamp(4.2rem, 22vw, 6.2rem); line-height: .95; letter-spacing: .01em;
}
.timer-clock .sec { color: #7f79c2; font-size: .55em; margin-left: .06em; }
.timer.running .timer-clock .sec { color: var(--hivis); }
.timer-sub { margin-top: .4rem; color: #cfcbef; font-weight: 600; font-size: .95rem; }
.timer-sub b { color: #fff; }
.timer-btn { margin-top: 1.2rem; }
.timer-btn .btn { width: 100%; min-height: 72px; font-size: 1.3rem; font-family: var(--f-disp); letter-spacing: .06em; text-transform: uppercase; border-radius: 18px; }
.timer-btn .btn .i { width: 1.4em; height: 1.4em; }
.btn.start { background: var(--blue); box-shadow: 0 8px 24px rgba(0, 146, 220, .45); }
.btn.start:hover { background: #0a86c9; }
.btn.stopb { background: #fff; color: var(--stop); }
.btn.stopb:hover { background: #fff3f2; }
.timer-hazard { position: absolute; left: 0; right: 0; bottom: 0; height: 7px; background: var(--hazard); background-size: 34px 34px; opacity: 0; transition: opacity .3s; }
.timer.running .timer-hazard { opacity: 1; animation: hazard 1.8s linear infinite; }
.timer-note { margin-top: .9rem; font-size: .88rem; color: #ffd56b; display: flex; gap: .4rem; align-items: center; }
.timer.absent .timer-state { background: rgba(255, 255, 255, .14); color: #fff; }
.timer.absent .timer-state::before { background: #ffcf66; }

/* Kompaktowa samoobsługa nieobecności kierowcy — nad „Dzisiejsze wpisy” */
.driver-absence { grid-column: 1 / -1; position: relative; border: 1.5px solid var(--line-2); border-radius: var(--r); background: #fff; box-shadow: var(--sh); overflow: hidden; }
.driver-absence.on { border-color: #efc46e; background: #fffaf0; padding: .7rem .8rem; }
.absence-picker > summary { display: flex; align-items: center; gap: .7rem; min-height: 68px; padding: .7rem .85rem; cursor: pointer; list-style: none; }
.absence-picker > summary::-webkit-details-marker { display: none; }
.absence-picker > summary::after { content: "›"; margin-left: auto; color: var(--faint); font-size: 1.6rem; line-height: 1; transform: rotate(90deg); }
.absence-picker[open] > summary::after { transform: rotate(-90deg); }
.absence-picker > summary span:nth-child(2) { min-width: 0; }
.absence-picker > summary b { display: block; font-family: var(--f-disp); font-size: 1.08rem; text-transform: uppercase; letter-spacing: .03em; }
.absence-picker > summary small { display: block; color: var(--muted); font-size: .78rem; }
.absence-picker > form, .absence-change > form:not(.absence-cancel) { padding: .7rem .8rem .8rem; border-top: 1px solid var(--line); }
.absence-options { display: grid; grid-template-columns: 1fr 1.45fr 1fr; gap: 6px; }
.absence-options .btn { min-height: 42px; padding: .5rem .45rem; line-height: 1.12; }
.absence-other { margin-top: .7rem; padding-top: .7rem; border-top: 1px solid var(--line); }
.absence-other .field { margin-bottom: .55rem; }
.absence-other .btn { width: 100%; }
.absence-icon { display: grid; place-items: center; width: 40px; height: 40px; flex: none; border-radius: 11px; background: var(--warn-bg); color: var(--warn); }
.absence-icon .i { width: 23px; height: 23px; }
.absence-status { display: flex; gap: .65rem; align-items: center; padding-right: 5rem; }
.absence-status div { flex: 1; min-width: 0; }
.absence-status small { display: block; color: var(--muted); font-size: .75rem; font-weight: 700; }
.absence-status strong { display: block; font-family: var(--f-disp); font-size: 1.25rem; color: var(--indigo); }
.absence-status p { margin: .1rem 0 0; font-size: .85rem; }
.absence-change { position: absolute; top: 50%; right: .85rem; transform: translateY(-50%); }
.absence-change summary { padding: .5rem 0; cursor: pointer; color: var(--indigo); font-size: .82rem; font-weight: 800; }
.absence-change[open] { position: static; margin-top: .65rem; transform: none; }
.absence-change[open] summary { margin-bottom: .5rem; }
.absence-change > form:not(.absence-cancel) { background: #fff; border: 1px solid #eadbbd; border-radius: 10px; }
.absence-cancel { margin-top: .5rem; }
.absence-cancel .btn { width: 100%; min-height: 42px; padding: .5rem .55rem; }
.absence-admin-note { margin: .5rem 0 0; color: var(--muted); font-size: .8rem; }
@media (max-width: 430px) {
  .absence-picker > summary small { display: none; }
  .absence-options { grid-template-columns: 1fr 1fr; }
  .absence-options .btn:nth-child(2) { grid-column: 1 / -1; grid-row: 1; }
}

/* Kafle */
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 1rem; }
.tile {
  --tile: #fff;
  position: relative; display: flex; flex-direction: column; justify-content: space-between; gap: .9rem;
  min-height: 118px; padding: 1rem; border-radius: var(--r);
  background: var(--tile); color: var(--ink); box-shadow: var(--sh); text-decoration: none;
  transition: transform .12s ease, box-shadow .15s ease;
}
.tile:hover { text-decoration: none; box-shadow: var(--sh-2); }
.tile:active { transform: scale(.97); }
.tile .ti { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 12px; background: var(--blue-l); color: var(--blue-d); }
.tile .ti .i { width: 26px; height: 26px; }
.tile b { font-family: var(--f-disp); font-size: 1.25rem; font-weight: 700; letter-spacing: .03em; text-transform: uppercase; line-height: 1.05; }
.tile .cnt { position: absolute; top: .8rem; right: .8rem; min-width: 26px; height: 26px; padding: 0 .45rem; border-radius: 99px; background: var(--indigo); color: #fff; display: grid; place-items: center; font-weight: 800; font-size: .8rem; }
.tile.wide { grid-column: 1 / -1; flex-direction: row; align-items: center; min-height: 76px; }
.tile.wide .ti { background: #eceaf8; color: var(--indigo); }
.tile.wide b { flex: 1; }
.tile.wide .cnt { position: static; }
.tiles .tile:nth-child(2) { animation-delay: .04s; } .tiles .tile:nth-child(3) { animation-delay: .08s; }
.tiles .tile:nth-child(4) { animation-delay: .12s; } .tiles .tile:nth-child(5) { animation-delay: .16s; }
.tile.t-trip .ti { background: #fff1d6; color: #a05f00; }
.tile.t-mat .ti { background: #e5f5ea; color: #157341; }
.tile.t-wz .ti { background: #eceaf8; color: var(--indigo-3); }

.manual-link { display: flex; align-items: center; justify-content: center; gap: .5rem; margin-top: 1rem; padding: .9rem; border-radius: 14px; border: 1.5px dashed var(--line-2); color: var(--indigo); font-weight: 700; }
.manual-link:hover { background: #fff; text-decoration: none; }

.ongoing { display: flex; align-items: center; gap: .8rem; margin-top: 1rem; padding: .9rem 1rem; border-radius: var(--r); background: #fff8e8; border: 1.5px solid #f3d38a; }
.ongoing .i { color: #a05f00; width: 28px; height: 28px; }
.ongoing div { flex: 1; min-width: 0; }
.ongoing strong { display: block; }
.ongoing small { color: var(--muted); }

/* Formularze pracownika */
.wform { padding-top: .25rem; }
.wform .card { padding: 1.15rem 1rem; }
.sec-title { font-family: var(--f-disp); font-size: 1.1rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--indigo); margin: 1.4rem 0 .6rem; }
.sticky-save { position: sticky; bottom: 0; padding: .75rem 0 calc(.75rem + var(--safe-b)); background: linear-gradient(transparent, var(--paper) 30%); z-index: 5; }

/* Wpisy dnia (oś czasu) */
.daynav { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin-bottom: 1rem; }
.daynav .disp { font-size: 1.3rem; text-transform: uppercase; }
.tl { list-style: none; margin: 0; padding: 0; }
.tl li { position: relative; display: flex; gap: .85rem; padding: .85rem 0; border-top: 1px solid var(--line); }
.tl li:first-child { border-top: 0; }
.tl .tl-ic { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; flex: none; background: var(--blue-l); color: var(--blue-d); }
.tl .tl-ic.trip { background: #fff1d6; color: #a05f00; }
.tl .tl-ic.mat { background: #e5f5ea; color: #157341; }
.tl .tl-ic.wz { background: #eceaf8; color: var(--indigo-3); }
.tl .tl-ic.time { background: #edeef3; color: var(--ink); }
.tl .tl-body { flex: 1; min-width: 0; }
.tl .tl-body strong { display: block; }
.tl .tl-meta { color: var(--muted); font-size: .88rem; }
.tl .tl-act { align-self: center; }
.void { text-decoration: line-through; opacity: .55; }
/* odcinki czasu dnia jeden pod drugim: „13:46 – 13:47 ……… 1 min” */
.tl .ranges { display: grid; gap: 4px; margin-top: .45rem; }
.tl .ranges > div { display: flex; justify-content: space-between; align-items: baseline; gap: .75rem; padding: .35rem .65rem; border-radius: 8px; background: var(--paper); font-variant-numeric: tabular-nums; }
.tl .ranges b { font-weight: 700; white-space: nowrap; }
.tl .ranges small { color: var(--muted); font-weight: 600; font-size: .85rem; white-space: nowrap; }
.mt-xs { margin-top: .4rem; }
.day-note { margin: .75rem 0 0; padding: .6rem .75rem; border-radius: 10px; background: #fff8e6; font-size: .95rem; }

/* =================================================================
   PANEL ADMINISTRATORA
   ================================================================= */
.nav-admin { --side-w: 256px; }
.side {
  position: fixed; inset: 0 auto 0 0; z-index: 50; width: var(--side-w);
  display: flex; flex-direction: column;
  background: var(--indigo) var(--pavers); color: #d9d6f3;
}
.side-logo { display: flex; flex-direction: column; gap: .35rem; padding: 1.3rem 1.3rem 1rem; }
.side-logo:hover { text-decoration: none; }
.side-logo .logo { height: 24px; }
.side-logo .logo .lg-a { fill: #fff; }
.side-logo .logo .lg-b { fill: #4cc3ff; }
.side-logo span { font-family: var(--f-disp); font-weight: 600; letter-spacing: .2em; text-transform: uppercase; font-size: .78rem; color: #8f8ac7; }
.side-nav { flex: 1; overflow-y: auto; padding: .5rem .7rem; display: grid; align-content: start; gap: 2px; }
.side-nav a { display: flex; align-items: center; gap: .75rem; padding: .62rem .75rem; border-radius: 10px; color: #d9d6f3; font-weight: 600; font-size: .93rem; }
.side-nav a:hover { background: rgba(255, 255, 255, .07); text-decoration: none; color: #fff; }
.side-nav a.on { background: #fff; color: var(--indigo); box-shadow: 0 6px 18px rgba(0, 0, 0, .2); }
.side-nav a.on .i { color: var(--blue-d); }
.side-nav a span { flex: 1; }
.side-nav .count { background: var(--hivis); color: var(--ink); border-radius: 99px; font-size: .75rem; padding: .05rem .5rem; }
.side-foot { display: flex; align-items: center; gap: .6rem; padding: .9rem 1rem; border-top: 1px solid rgba(255, 255, 255, .1); }
.side-foot div { flex: 1; min-width: 0; line-height: 1.2; }
.side-foot strong { display: block; color: #fff; font-size: .9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-foot small { color: #8f8ac7; font-size: .78rem; }
.side-foot form { margin: 0; }
.side-scrim { display: none; }

.amain { margin-left: var(--side-w); min-height: 100vh; }
.atop {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: .75rem;
  padding: .9rem 1.75rem; background: rgba(236, 238, 243, .9); backdrop-filter: blur(8px);
  /* nagłówek w tej samej, wyśrodkowanej kolumnie co treść (.acontent) */
  padding-inline: max(1.75rem, calc((100% - 1400px) / 2 + 1.75rem));
  border-bottom: 1px solid transparent;
}
/* na dużym ekranie przyciski stoją tuż obok tytułu, nie przy prawej krawędzi */
.atop-title { flex: 0 1 auto; min-width: 0; margin-right: .75rem; }
.atop h1 { font-family: var(--f-disp); font-size: 1.85rem; font-weight: 700; text-transform: uppercase; letter-spacing: .02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.crumb { display: inline-flex; align-items: center; gap: .2rem; font-size: .85rem; font-weight: 700; color: var(--muted); }
.crumb .i { width: 1em; height: 1em; }
.atop-actions { flex: 1 1 auto; display: flex; gap: .5rem; flex-wrap: wrap; justify-content: flex-start; align-self: flex-end; }
.acontent { padding: .5rem 1.75rem 3rem; max-width: 1400px; margin: 0 auto; }
.only-m { display: none !important; }

@media screen and (max-width: 960px) {
  .side { transform: translateX(-100%); transition: transform .25s ease; box-shadow: var(--sh-2); }
  body.side-open .side { transform: none; }
  body.side-open .side-scrim { display: block; position: fixed; inset: 0; z-index: 45; background: rgba(22, 19, 46, .45); }
  .amain { margin-left: 0; padding-bottom: calc(72px + var(--safe-b)); }
  .atop { padding: .6rem 12px; }
  .atop h1 { font-size: 1.45rem; }
  .atop-title { flex: 1 1 auto; margin-right: 0; }
  .atop-actions { flex: 0 0 auto; justify-content: flex-end; align-self: center; }
  .atop-actions .btn span { display: none; }
  .acontent { padding: .25rem 12px 2rem; }
  .only-m { display: inline-grid !important; }
  .bnav.only-m { display: grid !important; }
  .hide-m { display: none !important; }
}
.bnav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  grid-template-columns: repeat(5, 1fr); padding: 6px 6px calc(6px + var(--safe-b));
  background: #fff; border-top: 1px solid var(--line); box-shadow: 0 -6px 20px rgba(22, 19, 46, .06);
}
.bnav a, .bnav button { position: relative; display: grid; justify-items: center; gap: 2px; padding: .35rem 0; border: 0; background: none; color: var(--muted); font-size: .7rem; font-weight: 700; cursor: pointer; border-radius: 10px; }
.bnav a:hover { text-decoration: none; }
.bnav .i { width: 24px; height: 24px; }
.bnav a.on { color: var(--blue-d); background: var(--blue-l); }
.bnav .bcount { position: absolute; top: 0; right: 22%; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 99px; background: var(--hivis); color: var(--ink); font-size: .68rem; line-height: 18px; text-align: center; }
.count-pill { display: inline-block; min-width: 20px; padding: 0 .4rem; border-radius: 99px; background: var(--hivis); color: var(--ink); font-size: .75rem; text-align: center; }
.toast.info { background: var(--indigo); }
.toast.info .i { color: #7fd2ff; }
.toast.link { pointer-events: auto; text-decoration: none; color: #fff; cursor: pointer; }
.toast.link:hover { filter: brightness(1.15); }
.bulkbar { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; padding: .6rem .7rem; margin-bottom: .6rem; border-radius: 12px; background: #f5f6fa; }
.bnav .dot { position: absolute; top: 4px; right: 30%; width: 9px; height: 9px; border-radius: 50%; background: var(--hivis); }

/* Statystyki */
.stats { display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; }
@media screen and (max-width: 1200px) { .stats { grid-template-columns: repeat(3, 1fr); } }
@media screen and (max-width: 560px) { .stats { grid-template-columns: repeat(2, 1fr); } }
.stat { background: var(--card); border-radius: var(--r); box-shadow: var(--sh); padding: .9rem 1rem; display: flex; flex-direction: column; gap: .15rem; border-top: 4px solid var(--line); }
.stat.hl { border-top-color: var(--hivis); }
.stat.blue { border-top-color: var(--blue); }
.stat.ind { border-top-color: var(--indigo-3); }
.stat .v { font-family: var(--f-disp); font-weight: 700; font-size: 2.3rem; line-height: 1; font-variant-numeric: tabular-nums; }
.stat .v small { font-size: .55em; color: var(--muted); font-weight: 600; }
.stat .k { color: var(--muted); font-size: .85rem; font-weight: 600; }
a.stat:hover { text-decoration: none; box-shadow: var(--sh-2); }

.cols { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 1rem; margin-top: 1rem; align-items: start; }
.cols.even { grid-template-columns: 1fr 1fr; }
.cols.stretch { align-items: stretch; }
.cols > .card + .card { margin-top: 0; } /* w siatce odstęp daje gap — margines przesuwał drugą kartę w dół */
@media screen and (max-width: 1100px) { .cols, .cols.even { grid-template-columns: minmax(0, 1fr); } }

/* Tabele */
.tbl-wrap { overflow-x: auto; margin: 0 -1.15rem; padding: 0 1.15rem; -webkit-overflow-scrolling: touch; }
table.tbl { width: 100%; border-collapse: collapse; font-size: .92rem; }
.tbl th { text-align: left; font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; padding: .55rem .6rem; border-bottom: 1.5px solid var(--line); white-space: nowrap; }
.tbl td { padding: .7rem .6rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tbody tr:hover td { background: #f8f9fc; }
.tbl tr.click { cursor: pointer; }
.tbl td.num, .tbl th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tbl tfoot td { font-weight: 800; border-bottom: 0; border-top: 2px solid var(--ink); }
.tbl .who { display: flex; align-items: center; gap: .6rem; font-weight: 700; white-space: nowrap; }
.tbl .who .avatar { width: 32px; height: 32px; font-size: .72rem; }
.tbl tr.weekend td { background: #f7f7fa; }
.tbl tr.absent td { color: var(--muted); }
.tbl .acts { display: flex; gap: .3rem; justify-content: flex-end; align-items: center; }

/* Ewidencja — siatka dni */
.grid-tbl { font-size: .82rem; }
.grid-tbl th, .grid-tbl td { padding: .45rem .3rem; text-align: center; }
.grid-tbl th:first-child, .grid-tbl td:first-child { text-align: left; position: sticky; left: 0; background: #fff; z-index: 1; padding-right: .8rem; }
.grid-tbl th.we, .grid-tbl td.we { background: #f3f4f8; }
.grid-tbl td a { color: var(--ink); font-weight: 600; }
.grid-tbl td a.ot { color: #a05f00; font-weight: 800; }
.grid-tbl td a.wait { color: var(--muted); font-weight: 500; font-style: italic; text-decoration: underline dotted; }
.tbl tr.notok td.num strong { color: var(--muted); font-style: italic; font-weight: 600; }
.grid-tbl .abs { display: inline-block; padding: 0 .3rem; border-radius: 4px; background: var(--blue-l); color: var(--blue-d); font-weight: 800; font-size: .72rem; }

/* Lista kart na telefonie zamiast tabeli */
@media screen and (max-width: 700px) {
  table.tbl.cards thead { display: none; }
  table.tbl.cards, .tbl.cards tbody, .tbl.cards tr, .tbl.cards td { display: block; width: 100%; }
  .tbl.cards tr { padding: .7rem 0; border-bottom: 1px solid var(--line); }
  .tbl.cards td { border: 0; padding: .12rem 0; text-align: left !important; }
  .tbl.cards td[data-l]::before { content: attr(data-l) ": "; color: var(--muted); font-size: .82rem; font-weight: 600; }
  .tbl.cards tfoot tr { border: 0; }
  .tbl.cards .acts { justify-content: flex-start; margin-top: .3rem; }
}

/* Filtry */
.filters { display: flex; flex-wrap: wrap; gap: .6rem; align-items: flex-end; margin-bottom: 1rem; }
.filters .field { margin: 0; min-width: 150px; flex: 1 1 150px; }
.filters .field input, .filters .field select { min-height: 44px; font-size: .95rem; padding: .45rem .7rem; }
.filters .field select { padding-right: 2.2rem; }
.seg { display: inline-flex; background: #e2e5ee; border-radius: 12px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg a { padding: .45rem .85rem; border-radius: 9px; font-weight: 700; font-size: .88rem; color: var(--muted); }
.seg a:hover { text-decoration: none; color: var(--ink); }
.seg a.on { background: #fff; color: var(--indigo); box-shadow: var(--sh); }

/* Alerty */
.alerts { display: grid; gap: .5rem; }
.alert { display: flex; gap: .7rem; align-items: center; padding: .7rem .85rem; border-radius: 12px; background: var(--warn-bg); color: #5e3a00; font-weight: 600; font-size: .92rem; }
.alert .i { color: #b06a00; }
.alert.err { background: var(--err-bg); color: #7a1a12; }
.alert.err .i { color: var(--err); }
.alert div { flex: 1; min-width: 0; }
.alert a { color: inherit; text-decoration: underline; }
.alert form { margin: 0; }

/* Profil pracownika */
.profile { display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; }
.profile h2 { font-size: 1.4rem; font-weight: 800; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: .35rem 1rem; font-size: .92rem; }
.kv dt { color: var(--muted); font-weight: 600; }
.kv dd { margin: 0; font-weight: 650; }

.monthbar { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.monthbar .disp { font-size: 1.4rem; text-transform: uppercase; min-width: 170px; text-align: center; }

/* Oś odcinków czasu (dzień) */
.segs { list-style: none; padding: 0; margin: 0; display: grid; gap: .45rem; }
.segs li { display: flex; align-items: center; gap: .75rem; padding: .6rem .75rem; border-radius: 10px; background: #f5f6fa; flex-wrap: wrap; }
.segs .t { font-family: var(--f-disp); font-weight: 700; font-size: 1.25rem; font-variant-numeric: tabular-nums; }
.segs .d { color: var(--muted); font-weight: 600; font-size: .88rem; flex: 1; }
.segs li.run { background: #fff7e2; }
.seg-acts { display: inline-flex; gap: .4rem; flex-wrap: wrap; margin-left: auto; }
.seg-acts form { margin: 0; }
.tl-acts { display: inline-flex; gap: 2px; }
.tl-acts form { margin: 0; }
.iconbtn.del-ic { color: var(--err); }
.iconbtn.del-ic:hover { background: var(--err-bg); }
.btn.del { color: var(--err); }
.btn.del:hover { background: var(--err-bg); border-color: #f1b8b2; }
.segs li.voided .t { text-decoration: line-through; opacity: .5; }
.dayline { position: relative; height: 26px; border-radius: 6px; background: repeating-linear-gradient(90deg, #edeff5 0 calc(100% / 24 - 1px), #dfe2ea calc(100% / 24 - 1px) calc(100% / 24)); overflow: hidden; margin: .4rem 0 1rem; }
.dayline span { position: absolute; top: 3px; bottom: 3px; border-radius: 4px; background: var(--blue); }
.dayline span.run { background: var(--hivis); }
.dayline-h { display: flex; justify-content: space-between; color: var(--faint); font-size: .72rem; font-weight: 600; }
/* oś dnia — interaktywna: kreska kursora, podświetlenie odcinka, dymek z godzinami */
.dayline[data-dayline] { cursor: crosshair; touch-action: pan-y; }
.dayline span { transition: filter .15s, outline-color .15s; outline: 2px solid transparent; outline-offset: 1px; }
.dayline span.hl { filter: brightness(1.12) saturate(1.15); outline-color: var(--indigo); }
.dl-cursor { position: absolute; top: 0; bottom: 0; left: 0; width: 2px; margin-left: -1px; background: var(--indigo); opacity: 0; pointer-events: none; z-index: 2; transition: opacity .12s; }
.dayline.hover .dl-cursor { opacity: .6; }
.segs li[data-seg-row] { transition: background .15s, box-shadow .15s; }
.segs li.hl { background: var(--blue-l); box-shadow: inset 3px 0 0 var(--blue); }
.dl-tip { position: fixed; z-index: 1000; left: 0; top: 0; display: flex; flex-direction: column; gap: .1rem; padding: .55rem .8rem .6rem; border-radius: 10px; background: var(--indigo); color: #fff; font-size: .8rem; font-weight: 550; line-height: 1.35; white-space: nowrap; pointer-events: none; box-shadow: 0 10px 28px rgba(20, 16, 70, .3); opacity: 0; transform: translate(-50%, calc(-100% - 10px)); transition: opacity .12s; }
.dl-tip.below { transform: translate(-50%, 10px); }
.dl-tip.on { opacity: 1; }
.dl-tip b { font-family: "Barlow Condensed", sans-serif; font-size: 1.25rem; font-weight: 700; letter-spacing: .02em; line-height: 1.1; }
.dl-tip .t-sub { opacity: .78; font-weight: 500; }
.dl-tip .t-warn { color: #ffb4b4; font-weight: 700; }
.dl-tip::after { content: ""; position: absolute; left: calc(50% + var(--arrow, 0px)); bottom: -5px; width: 10px; height: 10px; margin-left: -5px; background: var(--indigo); transform: rotate(45deg); }
.dl-tip.below::after { bottom: auto; top: -5px; }
@media (prefers-reduced-motion: reduce) { .dl-tip, .dl-cursor, .dayline span { transition: none; } }

details.segedit > summary { list-style: none; }
details.segedit > summary::-webkit-details-marker { display: none; }
.segs details.segedit[open] { flex-basis: 100%; }
.segs details.segedit[open] > summary { display: none; }

/* Historia zmian */
.chg { font-variant-numeric: tabular-nums; }
.chg .old { color: var(--err); text-decoration: line-through; text-decoration-thickness: 1.5px; }
.chg .new { color: var(--ok); font-weight: 700; }

/* Pozycje WZ w formularzu */
.items { display: grid; gap: .6rem; }
.item { display: flex; flex-wrap: wrap; gap: .45rem; align-items: center; }
.item .input { min-height: 48px; padding: .55rem .7rem; }
.item select.input { padding-right: .5rem; appearance: auto; }
.item .mat { flex: 1 1 220px; min-width: 0; }
.item .qty, .item .spare { flex: 0 0 88px; }
.item .unit { flex: 0 0 92px; }
.item .price, .item .value { flex: 0 0 116px; }
.item .val-auto { flex: 0 0 auto; min-width: 96px; font-weight: 800; font-variant-numeric: tabular-nums; color: var(--indigo); text-align: right; }
.item .val-auto:empty::before { content: "— zł"; color: var(--faint); font-weight: 600; }
.item .iconbtn { height: 48px; width: 40px; flex: 0 0 40px; color: var(--muted); }
.items-head { margin: -.2rem 0 .5rem; }
.items-total { display: flex; justify-content: flex-end; gap: .5rem; margin-top: .7rem; padding: .6rem .8rem; border-radius: 12px; background: var(--blue-l); color: var(--indigo); font-weight: 600; }
.items-total strong { font-size: 1.1rem; font-variant-numeric: tabular-nums; }
@media screen and (max-width: 520px) {
  .item { background: #f5f6fa; padding: .5rem; border-radius: 12px; }
  .item .mat { flex: 1 1 100%; }
  .item .qty, .item .spare, .item .unit, .item .price, .item .value { flex: 1 1 calc(50% - 30px); }
}

/* Okno dialogowe (arkusz od dołu na telefonie) */
dialog.sheet {
  border: 0; padding: 0; width: min(100%, 520px); max-width: 100%; max-height: 92vh;
  border-radius: var(--r-l); background: #fff; color: var(--ink); box-shadow: var(--sh-2);
}
dialog.sheet::backdrop { background: rgba(22, 19, 46, .5); backdrop-filter: blur(2px); }
dialog.sheet[open] { animation: rise .25s ease both; }
.sheet-in { padding: 1.3rem 1.2rem 1.2rem; }
.sheet-in h2 { font-family: var(--f-disp); font-size: 1.6rem; text-transform: uppercase; margin-bottom: .4rem; }
@media screen and (max-width: 600px) {
  dialog.sheet { margin: auto 0 0; width: 100%; border-radius: var(--r-l) var(--r-l) 0 0; padding-bottom: var(--safe-b); }
  dialog.sheet[open] { animation: sheetUp .28s cubic-bezier(.2, .9, .3, 1) both; }
}
@keyframes sheetUp { from { transform: translateY(100%); } }

/* Praca / Materiały — lista z przeciąganiem */
.tbl.dict td { padding: .45rem .5rem; }
.tbl.dict .input { min-height: 44px; padding: .4rem .65rem; font-size: .95rem; }
.tbl.dict select.input { appearance: auto; padding-right: .4rem; width: auto; min-width: 84px; }
.drag {
  display: inline-grid; place-items: center; width: 40px; height: 44px; border-radius: 10px;
  color: var(--faint); cursor: grab; touch-action: none; user-select: none;
}
.drag:hover, .drag:focus-visible { background: var(--blue-l); color: var(--blue-d); }
.drag .i { width: 22px; height: 22px; stroke-width: 2.4; }
.drag:active { cursor: grabbing; }
/* miejsce, gdzie wyląduje przeciągana pozycja */
tbody[data-sortable] tr.placeholder td {
  background: repeating-linear-gradient(-45deg, rgba(0, 146, 220, .06) 0 8px, rgba(0, 146, 220, .13) 8px 16px) !important;
  border-top: 2px dashed var(--blue); border-bottom: 2px dashed var(--blue);
}
tbody[data-sortable] tr.placeholder td:first-child { border-left: 2px dashed var(--blue); }
tbody[data-sortable] tr.placeholder td:last-child { border-right: 2px dashed var(--blue); }
tbody[data-sortable] tr.placeholder td > * { visibility: hidden; }
tbody[data-sortable] tr.dropped td { animation: dropFlash 1s ease; }
@keyframes dropFlash { 0%, 35% { background: #d3edff; } 100% { background: transparent; } }
/* „uniesiona” karta pod palcem / myszką */
.drag-ghost {
  position: fixed; z-index: 120; display: flex; align-items: center; gap: .8rem; padding: 0 .9rem 0 .75rem;
  background: #fff; border: 2px solid var(--blue); border-radius: 12px; color: var(--indigo); font-weight: 750;
  box-shadow: 0 4px 10px rgba(22, 19, 46, .1); pointer-events: none; will-change: top, transform;
  transition: transform .16s ease, box-shadow .16s ease;
}
.drag-ghost .i { width: 22px; height: 22px; color: var(--blue-d); stroke-width: 2.4; }
.drag-ghost .g-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.drag-ghost .g-unit { color: var(--muted); font-weight: 600; }
.drag-ghost .g-unit:empty { display: none; }
.drag-ghost .g-pos { font-family: var(--f-disp); font-size: .95rem; letter-spacing: .04em; padding: .1rem .6rem; border-radius: 99px; background: var(--indigo); color: #fff; }
.drag-ghost.lifted { transform: rotate(-1.2deg) scale(1.03); box-shadow: 0 20px 44px rgba(22, 19, 46, .28), 0 4px 10px rgba(22, 19, 46, .12); }
.drag-ghost.landing { transition: top .18s ease, left .18s ease, transform .18s ease, box-shadow .18s ease; }
body.is-dragging, body.is-dragging * { cursor: grabbing !important; user-select: none !important; -webkit-user-select: none !important; }
.unit-list { list-style: none; padding: 0; margin: 0; display: grid; gap: .35rem; }
.unit-list li { display: flex; align-items: center; gap: .6rem; padding: .35rem .35rem .35rem .8rem; border-radius: 10px; background: #f5f6fa; }
.unit-list li strong { flex: 1; }
.unit-list form { margin: 0; }

/* Okno potwierdzenia */
dialog.confirm { width: min(100%, 440px); }
.confirm .sheet-in { text-align: center; padding-top: 1.6rem; }
.confirm-ic { display: grid; place-items: center; width: 60px; height: 60px; margin: 0 auto .8rem; border-radius: 50%; background: var(--blue-l); color: var(--blue-d); }
.confirm.is-danger .confirm-ic { background: var(--err-bg); color: var(--err); }
.confirm-ic .i { width: 30px; height: 30px; }
.confirm .form-actions .btn { flex: 1 1 0; }

/* Zdjęcia — podgląd */
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: .6rem; }
.gallery a { display: block; border-radius: 12px; overflow: hidden; background: #dfe2ea; aspect-ratio: 4/3; position: relative; }
.gallery img { width: 100%; height: 100%; object-fit: cover; transition: transform .3s; }
.gallery a:hover img { transform: scale(1.04); }
.gallery small { position: absolute; left: 0; right: 0; bottom: 0; padding: .3rem .45rem; background: linear-gradient(transparent, rgba(0,0,0,.7)); color: #fff; font-size: .72rem; font-weight: 600; }

.print-head { display: none; }

/* Błąd */
.errpage { min-height: 70vh; display: grid; place-content: center; text-align: center; padding: 2rem 1rem; }
.errpage .disp { font-size: 3rem; color: var(--indigo); text-transform: uppercase; }

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

/* elementy widoczne tylko na wydruku */
.print-inline { display: none; }
@media print { .print-inline { display: inline !important; } }
.grid-tbl td { white-space: nowrap; }
.optlist { display: grid; gap: .55rem; padding: .8rem .9rem; border-radius: 12px; background: #f5f6fa; }
.optlist .check { font-weight: 600; align-items: flex-start; }
.optlist .check input { margin-top: 1px; }
.paycalc { margin-top: .8rem; padding: .7rem .9rem; border-radius: 12px; background: #f5f6fa; line-height: 1.7; }
@media print { .paycalc { background: none; padding: 0; margin-top: 4mm; } }
.chip-txt { display: flex; flex-direction: column; line-height: 1.2; }
.chip-txt small { font-weight: 500; font-size: .74rem; color: var(--muted); }
.brig-chips { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }

/* tylko na wydruku (np. podpisy pod ewidencją) — na ekranie ukryte */
.print-only { display: none; }

/* Podgląd zdjęć w powiększeniu */
/* okienko na środku strony (nie na cały ekran): pasek z podpisem i zamknięciem, zdjęcie ze strzałkami, na dole obracanie */
.lb {
  position: fixed; inset: 0; z-index: 150; display: grid; place-items: center; padding: 2.5rem 1.5rem;
  background: rgba(12, 10, 30, .55); backdrop-filter: blur(3px);
  opacity: 0; visibility: hidden; transition: opacity .2s ease, visibility 0s .2s;
}
.lb.on { opacity: 1; visibility: visible; transition: opacity .2s ease; }
.lb-box { width: min(56rem, 100%); max-height: calc(100vh - 5rem); max-height: calc(100dvh - 5rem); display: flex; flex-direction: column; background: var(--card); color: var(--ink); border-radius: 1rem; box-shadow: 0 1.5rem 4rem rgba(0, 0, 0, .35); overflow: hidden; }
.lb-bar { display: flex; align-items: center; gap: .6rem; padding: .55rem .6rem .55rem 1rem; border-bottom: 1px solid var(--line); }
.lb-cap { flex: 1; min-width: 0; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-count { flex: none; font-family: var(--f-disp); font-size: .85rem; letter-spacing: .06em; padding: .1rem .55rem; border-radius: 99px; background: var(--bg); color: var(--muted); }
.lb-count:empty { display: none; }
.lb-x { flex: none; display: grid; place-items: center; width: 2.4rem; height: 2.4rem; border: 0; border-radius: 50%; background: none; color: var(--muted); cursor: pointer; }
.lb-x:hover { background: var(--bg); color: var(--ink); }
.lb-x .i { width: 1.4rem; height: 1.4rem; }
.lb-fig { position: relative; margin: 0; min-height: 12rem; padding: 1rem; display: flex; align-items: center; justify-content: center; background: #1b1a2e; overflow: hidden; }
.lb-fig img { max-width: 100%; max-height: min(calc(100vh - 14rem), 42rem); max-height: min(calc(100dvh - 14rem), 42rem); object-fit: contain; border-radius: .4rem; opacity: 0; transition: opacity .2s ease, transform .25s ease; }
.lb-fig img.ready { opacity: 1; }
.lb-nav { position: absolute; top: 50%; transform: translateY(-50%); display: grid; place-items: center; width: 2.8rem; height: 2.8rem; border: 0; border-radius: 50%; background: rgba(255, 255, 255, .9); color: var(--indigo); box-shadow: 0 .2rem .8rem rgba(0, 0, 0, .3); cursor: pointer; }
.lb-nav:hover { background: #fff; }
.lb-nav .i { width: 1.5rem; height: 1.5rem; }
.lb-prev { left: .6rem; } .lb-next { right: .6rem; }
.lb.single .lb-nav { display: none; }
.lb-foot { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: .5rem; padding: .6rem; border-top: 1px solid var(--line); }
.lb-foot .btn .i { width: 1.1rem; height: 1.1rem; }
.lb-rot.l .i { transform: scaleX(-1); }
.lb-sep { width: 1px; height: 1.6rem; background: var(--line); margin: 0 .15rem; }
.lb-zoom.on { background: var(--indigo); border-color: var(--indigo); color: #fff; }
/* lupa: kółko z powiększeniem (pozycja i powiększenie ustawiane w app.js) */
.lb.lens .lb-fig { cursor: crosshair; touch-action: none; }
.lb-lens { position: fixed; z-index: 3; width: 12rem; height: 12rem; border-radius: 50%; overflow: hidden; pointer-events: none; border: .2rem solid #fff; background: #1b1a2e; box-shadow: 0 .4rem 1.6rem rgba(0, 0, 0, .5); }
.lb-lens img { position: absolute; max-width: none; max-height: none; transform-origin: center; }
.lb-hint { position: absolute; left: 50%; bottom: .6rem; transform: translateX(-50%); display: none; padding: .25rem .75rem; border-radius: 99px; background: rgba(0, 0, 0, .65); color: #fff; font-size: .8rem; white-space: nowrap; pointer-events: none; }
.lb.lens .lb-hint { display: block; }
/* pełny ekran: okienko na całą stronę */
.lb.full { padding: 0; }
.lb.full .lb-box { width: 100%; height: 100%; max-height: none; border-radius: 0; }
.lb.full .lb-fig { flex: 1; min-height: 0; }
.lb.full .lb-fig img { max-height: calc(100vh - 7.5rem); max-height: calc(100dvh - 7.5rem); }
body.lb-lock { overflow: hidden; }
.thumbs a, .gallery a { cursor: zoom-in; }
@media screen and (max-width: 600px) {
  .lb { padding: .5rem; }
  .lb-box { max-height: calc(100dvh - 1rem); }
  .lb-fig { padding: .5rem; }
  .lb-fig img { max-height: calc(100dvh - 12.5rem); }
  .lb.full .lb-fig img { max-height: calc(100dvh - 10rem); }
  .lb-foot { display: grid; grid-template-columns: 1fr 1fr; gap: .4rem; }
  .lb-foot .btn { padding-inline: .6rem; }
  .lb-sep { display: none; }
  .lb-lens { width: 9.5rem; height: 9.5rem; }
}

/* wyjazd: szybki wybór „Od nas (baza)” pod polem Skąd */
.quick-fill { display: flex; flex-wrap: wrap; gap: .4rem; margin: -.35rem 0 .9rem; }
/* ekran pracownika: trzy kafelki akcji w jednym rzędzie (Dodaj pracę · Dodaj wyjazd · Wystaw WZ) */
.tiles.three { grid-template-columns: repeat(3, 1fr); }
@media screen and (max-width: 420px) { .tiles.three { gap: 8px; } .tiles.three .tile:not(.wide) { padding: .8rem .7rem; min-height: 112px; } .tiles.three .tile:not(.wide) b { font-size: 1.08rem; } .tiles.three .tile:not(.wide) .cnt { top: .55rem; right: .55rem; } }
/* Budowy: liczba prac z dzisiaj (zielona, klikalna — otwiera dzisiejsze prace na budowie) */
.today-n { display: inline-grid; place-items: center; min-width: 30px; height: 26px; padding: 0 .5rem; border-radius: 99px; background: var(--ok-bg); color: var(--ok); font-weight: 800; text-decoration: none; }
.today-n:hover { text-decoration: none; filter: brightness(.96); }
@media screen and (min-width: 761px) { .sites-tbl td:nth-child(2) { min-width: 240px; } .sites-tbl td:nth-child(2) .small { white-space: nowrap; } }
.sites-tbl .c-drag { width: 44px; padding-right: 0; }
.sites-tbl td.c-drag { cursor: grab; }
/* Ustawienia: dodatek za nadgodziny — procent stawki albo złotych więcej za godzinę */
.ot-mode { border: 0; padding: 0; min-width: 0; }
.ot-mode legend { padding: 0; font-weight: 700; font-size: .9rem; margin-bottom: .35rem; }
.ot-opt { display: flex; align-items: center; gap: .7rem; padding: .6rem .75rem; margin-bottom: .45rem; border: 1.5px solid var(--line-2); border-radius: 12px; background: #fff; cursor: pointer; transition: border-color .15s, background .15s; }
.ot-opt:has(input[type=radio]:checked) { border-color: var(--blue-d); background: var(--blue-l); }
.ot-opt input[type=radio] { flex: none; width: 20px; height: 20px; min-height: 0; margin: 0; accent-color: var(--blue-d); }
.ot-txt { display: flex; flex-direction: column; flex: 1; min-width: 0; line-height: 1.3; }
.ot-txt small { color: var(--muted); font-size: .8rem; }
.ot-val { display: flex; align-items: center; gap: .35rem; flex: none; }
.ot-val input { width: 78px !important; text-align: right; }
.ot-val i { font-style: normal; font-weight: 700; color: var(--muted); min-width: 1.2em; }
.ot-opt:not(:has(input[type=radio]:checked)) .ot-val input { opacity: .55; }
/* logowanie: link do animowanej instrukcji „aplikacja na telefonie” */
.login-help { display: inline-flex; align-items: center; gap: .4rem; margin-top: 1rem; font-weight: 700; font-size: .95rem; color: var(--blue-d); }
.login-help .i { width: 18px; height: 18px; }

/* ---------- Praca / Materiały: kategorie i numer miejsca (2026-10-19) ---------- */
.tbl.dict .c-pos { width: 4.2rem; }
.tbl.dict .c-drag { width: 2.75rem; }
.input.pos { width: 3.6rem; min-width: 0; text-align: center; padding: .35rem .3rem; font-weight: 700; font-variant-numeric: tabular-nums; -moz-appearance: textfield; }
.input.pos::-webkit-outer-spin-button, .input.pos::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.tbl.dict select.cat-sel { max-width: 12rem; }
.matcat { padding-top: .8rem; }
.matcat .cat-h { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; padding: .5rem .6rem; margin-bottom: .5rem;
  background: #fbd9b8; border-radius: .7rem; }
.matcat .cat-h .input { min-height: 2.5rem; background: #fff; }
.matcat .cat-name { flex: 1 1 12rem; min-width: 8rem; font-family: var(--f-disp); font-size: 1.15rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.matcat .cat-dash { font-weight: 800; color: #8a4a12; }
.matcat .cat-title { flex: 1; font-family: var(--f-disp); font-size: 1.15rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.matcat .cat-unit { display: inline-flex; align-items: center; gap: .3rem; color: #6b3a0e; font-weight: 600; }
.matcat .cat-unit select { width: auto; appearance: auto; padding: .2rem .4rem; }
.sticky-side { position: sticky; top: 4.5rem; }
@media (max-width: 1100px) { .sticky-side { position: static; } }

/* ---------- Pracownicy w brygadach ---------- */
.tbl tr.grp-h td { background: #eef0f5; font-family: var(--f-disp); font-weight: 700; font-size: 1.05rem; text-transform: uppercase; letter-spacing: .06em; color: var(--indigo); padding: .55rem .7rem; }
.tbl tr.grp-h:hover td { background: #eef0f5; }
.tbl tr.grp-h .badge { margin-left: .4rem; vertical-align: middle; font-family: inherit; }
.tbl tr.grp-h .grp-lead { font-family: system-ui, sans-serif; text-transform: none; letter-spacing: 0; font-weight: 600; font-size: .85rem; color: var(--muted); margin-left: .6rem; }
.tbl .lead-pos { font-weight: 800; color: var(--indigo); }
.tbl select.brig-sel { appearance: auto; min-height: 2.3rem; padding: .2rem .4rem; width: auto; max-width: 11rem; font-size: .88rem; }
.brig-list { width: 100%; border-collapse: separate; border-spacing: 0 .45rem; margin: -.45rem 0 .1rem; }
.brig-list td { padding: 0 .2rem; vertical-align: middle; background: var(--card); }
.brig-list td.grow { width: 100%; }
.brig-list td.grow .input { width: 100%; }
.brig-list .input { min-height: 2.5rem; }
.tbl.dict th.c-name, .tbl.dict td.c-name { width: 100%; min-width: 12rem; }
.tbl.dict td.c-name .input { width: 100%; }
.tbl.dict select.cat-sel { max-width: 8.5rem; min-width: 6rem; }
@media screen and (min-width: 1101px) { .cols.wide-main { grid-template-columns: minmax(0, 3fr) minmax(16rem, 1fr); } }
.sites-tbl th { white-space: normal; }
.sites-tbl th, .sites-tbl td { padding-left: .45rem; padding-right: .45rem; }

/* Notatki biura przy pracach (faktura, zapłacone, uwaga) — widzi je tylko panel administratora */
.tnotes { display: grid; gap: .4rem; margin-top: .55rem; justify-items: start; }
.tnote { --tn: var(--indigo); --tn-bg: #efeefa; display: flex; align-items: flex-start; gap: .6rem; width: 100%; max-width: 46rem; padding: .5rem .5rem .5rem .7rem; border-radius: 10px; border-left: 4px solid var(--tn); background: var(--tn-bg); }
.tn-invoice { --tn: var(--blue-d); --tn-bg: var(--blue-l); }
.tn-paid { --tn: var(--ok); --tn-bg: var(--ok-bg); }
.tn-alert { --tn: var(--stop); --tn-bg: #fff1e0; }
.tn-kind { flex: none; display: inline-flex; align-items: center; gap: .3rem; padding: .15rem .55rem; border-radius: 99px; background: var(--tn); color: #fff; font-size: .78rem; font-weight: 800; letter-spacing: .02em; text-transform: uppercase; white-space: nowrap; }
.tn-kind .i { width: .95em; height: .95em; stroke-width: 2.6; }
.tn-main { flex: 1; min-width: 0; }
.tn-body { font-weight: 600; color: var(--ink); overflow-wrap: anywhere; }
.tn-meta { font-size: .78rem; color: var(--muted); margin-top: .1rem; }
.tnote .iconbtn { flex: none; width: 30px; height: 30px; margin: -.2rem -.1rem 0 0; color: var(--muted); }
.tn-add { display: inline-flex; align-items: center; gap: .35rem; padding: .3rem .7rem; border: 1px dashed var(--line-2); border-radius: 99px; background: none; color: var(--indigo); font: inherit; font-size: .82rem; font-weight: 700; cursor: pointer; }
.tn-add:hover { border-color: var(--indigo); background: #efeefa; }
.tn-add .i { width: 1em; height: 1em; }
.tn-kinds { display: grid; grid-template-columns: repeat(4, 1fr); gap: .4rem; margin-bottom: .8rem; }
.tn-k input { position: absolute; opacity: 0; pointer-events: none; }
.tn-k span { display: flex; flex-direction: column; align-items: center; gap: .25rem; padding: .55rem .3rem; border: 2px solid var(--line); border-radius: 10px; font-weight: 700; font-size: .85rem; color: var(--muted); cursor: pointer; text-align: center; }
.tn-k span .i { width: 1.25rem; height: 1.25rem; }
.tn-k input:checked + span { border-color: var(--tn, var(--indigo)); background: var(--tn-bg, #efeefa); color: var(--tn, var(--indigo)); }
.tn-k input:focus-visible + span { outline: 2px solid var(--blue); outline-offset: 2px; }
.tn-k.tn-note { --tn: var(--indigo); --tn-bg: #efeefa; }
@media (max-width: 520px) { .tn-kinds { grid-template-columns: repeat(2, 1fr); } .tnote { flex-wrap: wrap; } }
@media print { .tnote { break-inside: avoid; } }
