:root {
  color-scheme: light dark;

  --ink:      #0e1319;
  --ink-2:    #3d4753;
  --muted:    #6d7885;
  --line:     #e4e8ee;
  --line-2:   #eef1f5;
  --bg:       #f5f6f8;
  --surface:  #ffffff;
  --raised:   #fbfcfd;
  --navy:     #1f3348;
  --navy-2:   #27415c;
  --on-navy:  #ffffff;
  --ok:       #0e7a52;
  --ok-bg:    #eaf6f0;
  --low:      #a8620a;
  --low-bg:   #fdf3e4;
  --new:      #2f5fa8;
  --new-bg:   #eef3fb;
  --focus:    rgba(31,51,72,.16);
  --radius:   8px;
  --shadow:   0 1px 2px rgba(14,19,25,.05), 0 8px 24px -12px rgba(14,19,25,.18);
}

/* Ciemny motyw: jeden zestaw zmiennych, bez odwracania sekcji.
   Bez czystej czerni i bieli — gubią głębię i męczą przy tabelach. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ink:      #e8edf4;
    --ink-2:    #b3becd;
    --muted:    #8b97a7;
    --line:     #2a3340;
    --line-2:   #222a35;
    --bg:       #10151c;
    --surface:  #171d26;
    --raised:   #1c232e;
    --navy:     #4a7fc1;
    --navy-2:   #5b8fd0;
    --on-navy:  #0d1219;
    --ok:       #48c99a;
    --ok-bg:    #11291f;
    --low:      #e0a44c;
    --low-bg:   #2c2113;
    --new:      #7cadf0;
    --new-bg:   #16233a;
    --focus:    rgba(122,173,240,.28);
    --shadow:   0 1px 2px rgba(0,0,0,.4), 0 8px 24px -12px rgba(0,0,0,.7);
  }
}
:root[data-theme="dark"] {
  --ink:      #e8edf4;
  --ink-2:    #b3becd;
  --muted:    #8b97a7;
  --line:     #2a3340;
  --line-2:   #222a35;
  --bg:       #10151c;
  --surface:  #171d26;
  --raised:   #1c232e;
  --navy:     #4a7fc1;
  --navy-2:   #5b8fd0;
  --on-navy:  #0d1219;
  --ok:       #48c99a;
  --ok-bg:    #11291f;
  --low:      #e0a44c;
  --low-bg:   #2c2113;
  --new:      #7cadf0;
  --new-bg:   #16233a;
  --focus:    rgba(122,173,240,.28);
  --shadow:   0 1px 2px rgba(0,0,0,.4), 0 8px 24px -12px rgba(0,0,0,.7);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }   /* display:inline-flex na .btn bije UA */
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 14px/1.45 ui-sans-serif, -apple-system, "Segoe UI", Inter, Roboto, sans-serif;
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--navy); }

/* ---------------------------------------------------------------- topbar */
.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
  height: 56px; padding: 0 20px;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: saturate(1.6) blur(12px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: inherit; }
.brand-mark { text-decoration: none; }
.fleet-pick select { font-weight: 600; }
.brand-mark {
  font-weight: 700; font-size: 15px; letter-spacing: .12em;
  color: var(--navy);
}
.brand-sub { font-size: 12px; color: var(--muted); letter-spacing: .01em; }
.topnav { display: flex; align-items: center; gap: 6px; }
.topnav > a {
  padding: 7px 11px; border-radius: 6px; text-decoration: none;
  color: var(--ink-2); font-size: 13px; font-weight: 500;
}
.topnav > a:hover { background: var(--line-2); }
.topnav > a.on { background: var(--navy); color: var(--on-navy); }
.select-wrap { position: relative; margin-right: 6px; }
.select-wrap select {
  appearance: none; padding: 7px 30px 7px 11px;
  border: 1px solid var(--line); border-radius: 6px; background: var(--surface);
  font: inherit; font-size: 13px; font-weight: 600; color: var(--ink); cursor: pointer;
}
.select-wrap::after {
  content: ""; position: absolute; right: 11px; top: 50%; pointer-events: none;
  width: 6px; height: 6px; margin-top: -4px;
  border-right: 1.5px solid var(--muted); border-bottom: 1.5px solid var(--muted);
  transform: rotate(45deg);
}

/* ---------------------------------------------------------------- layout */
.wrap { max-width: 1440px; margin: 0 auto; padding: 28px 20px 96px; }

.head { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; flex-wrap: wrap; }
.head h1 {
  margin: 0; font-size: 26px; line-height: 1.15; letter-spacing: -.02em;
  font-weight: 650; text-transform: capitalize;
}
.head-sub { margin: 5px 0 0; color: var(--muted); font-size: 13px; max-width: 62ch; }
.head-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* ---------------------------------------------------------------- buttons */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px; border: 1px solid var(--line); border-radius: 6px;
  background: var(--surface); color: var(--ink);
  font: inherit; font-size: 13px; font-weight: 550; text-decoration: none;
  cursor: pointer; transition: background .12s, border-color .12s, transform .06s;
}
.btn:hover { background: var(--line-2); border-color: var(--line); }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--navy); border-color: var(--navy); color: var(--on-navy); }
.btn-primary:hover { background: var(--navy-2); border-color: var(--navy-2); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--line-2); color: var(--ink); }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-lg { padding: 12px 22px; font-size: 15px; }
.btn[disabled] { opacity: .5; pointer-events: none; }

.pill { display: inline-flex; padding: 6px 12px; border-radius: 999px; font-size: 12.5px; font-weight: 600; }
.pill-ok { background: var(--ok-bg); color: var(--ok); }

/* ---------------------------------------------------------------- stats */
.stats {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1px; margin: 22px 0 18px;
  background: var(--line); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden;
}
.stat { background: var(--surface); padding: 13px 16px; }
.stat-k { display: block; font-size: 11px; font-weight: 600; letter-spacing: .06em;
          text-transform: uppercase; color: var(--muted); margin-bottom: 4px; }
.stat b { font-size: 19px; font-weight: 620; letter-spacing: -.01em; }
.stat-hero b { color: var(--navy); }
.stat b.warn { color: var(--low); }

.hint {
  margin: 0 0 18px; padding: 11px 14px;
  background: var(--low-bg); border: 1px solid var(--line); border-left: 3px solid var(--low);
  border-radius: 6px; font-size: 13px; color: var(--ink-2);
}
.hint a { color: var(--low); }
.hint.hint-ok {
  background: var(--ok-bg); border-color: var(--line);
  border-left-color: var(--ok); color: var(--ink-2);
}

/* ---------------------------------------------------------------- grid */
.grid {
  width: 100%; border-collapse: separate; border-spacing: 0;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
/* bez overflow:hidden — inaczej sticky thead przestaje działać */
.grid thead th:first-child { border-top-left-radius: var(--radius); }
.grid thead th:last-child  { border-top-right-radius: var(--radius); }
.grid tfoot td:first-child { border-bottom-left-radius: var(--radius); }
.grid tfoot td:last-child  { border-bottom-right-radius: var(--radius); }
.grid tbody tr:last-child td:first-child { border-bottom-left-radius: var(--radius); }
.grid tbody tr:last-child td:last-child  { border-bottom-right-radius: var(--radius); }
.grid thead th {
  position: sticky; top: 56px; z-index: 10;
  background: var(--raised); border-bottom: 1px solid var(--line);
  padding: 9px 10px; text-align: left;
  font-size: 11px; font-weight: 650; letter-spacing: .05em;
  text-transform: uppercase; color: var(--muted); white-space: nowrap;
}
.grid tbody td { padding: 7px 10px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.grid tbody tr:last-child td { border-bottom: 0; }
.grid .num { text-align: right; font-variant-numeric: tabular-nums; }
.grid tfoot td {
  padding: 10px; background: var(--raised); border-top: 1px solid var(--line);
  font-weight: 620; font-size: 13px;
}

.row { cursor: pointer; }
.row:hover td { background: var(--raised); }
.row.row-idle { color: var(--muted); }
.row.row-idle .c-route, .row.row-idle .c-purpose { color: var(--muted); opacity: .7; }
.row.row-wknd .c-date .d-name { color: var(--low); }
.row.is-ok    .c-st { box-shadow: inset 3px 0 0 var(--ok); }
.row.is-new   .c-st { box-shadow: inset 3px 0 0 var(--new); }
.row.is-low   .c-st { box-shadow: inset 3px 0 0 var(--low); }
.row.is-low td { background: color-mix(in srgb, var(--low-bg) 45%, var(--surface)); }
.row.open td { background: var(--new-bg) !important; }

.c-st { width: 26px; padding-left: 12px !important; }
.c-n  { width: 34px; color: var(--muted); font-size: 12px; }
.c-date { width: 74px; white-space: nowrap; }
.d-num { font-weight: 620; }
.d-name { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin-left: 4px; }
.c-km { width: 66px; font-weight: 600; }
.c-route { width: 22%; }
.c-purpose { width: 26%; }
.c-driver { width: 130px; color: var(--ink-2); font-size: 13px; }
.c-odo { width: 100px; color: var(--ink-2); font-size: 13px; }

.dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; }
.dot-ok { background: var(--ok); }
.dot-new { background: var(--new); }
.dot-low { background: var(--low); }
.dot-idle { background: var(--line); }

/* ---------------------------------------------------------------- editor */
.editor-row > td { padding: 0 !important; background: var(--new-bg); }
.editor {
  padding: 16px 18px 18px; border-bottom: 1px solid var(--line);
  border-left: 3px solid var(--navy);
}
.ed-form { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.fld { display: flex; flex-direction: column; gap: 4px; flex: 0 0 190px; }
.fld-wide { flex: 1 1 260px; }
.fld > span { font-size: 11px; font-weight: 650; letter-spacing: .05em;
              text-transform: uppercase; color: var(--muted); }
.fld > em { font-size: 11.5px; color: var(--muted); font-style: normal; line-height: 1.4; }
.fld input, .search, .grid input[type=text], .grid input:not([type]) {
  width: 100%; padding: 8px 10px;
  border: 1px solid var(--line); border-radius: 6px; background: var(--surface);
  font: inherit; font-size: 13.5px; color: var(--ink);
}
.fld input:focus, .search:focus, .grid input:focus {
  outline: none; border-color: var(--navy); box-shadow: 0 0 0 3px var(--focus);
}
.ed-actions { display: flex; gap: 8px; }

.trips { margin-top: 16px; padding-top: 14px; border-top: 1px dashed var(--line); }
.trips-head { display: flex; justify-content: space-between; align-items: center;
              gap: 16px; flex-wrap: wrap; margin-bottom: 8px; }
.trips-head b { font-size: 12px; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.trips-move { display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--muted); }
.trips-move input[type=date] {
  padding: 5px 8px; border: 1px solid var(--line); border-radius: 6px;
  font: inherit; font-size: 12.5px; background: var(--surface);
}
.trips-list { list-style: none; margin: 0; padding: 0;
              display: grid; grid-template-columns: repeat(auto-fill, minmax(310px, 1fr)); gap: 4px; }
.trips-list li {
  display: flex; align-items: center; gap: 9px;
  padding: 6px 10px; background: var(--surface);
  border: 1px solid var(--line); border-radius: 6px; font-size: 12.5px;
}
.trips-list .t-time { color: var(--muted); font-size: 11.5px; white-space: nowrap; }
.trips-list .t-path { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.trips-list .t-km { font-weight: 620; white-space: nowrap; }
.trips-list li.t-gap { background: var(--low-bg); border-color: var(--low); }
.trips-list li.t-moved { background: var(--new-bg); border-color: var(--new); }
.t-badge { font-size: 10px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase;
           padding: 2px 5px; border-radius: 3px; background: var(--low); color: var(--on-navy); }
.t-badge.moved { background: var(--new); }

/* historia pobrań */
.log { margin-top: 4px; box-shadow: none; font-size: 12.5px; }
.log thead th { position: static; font-size: 10px; }
.log tbody td { padding: 6px 10px; }
.log .c-when { width: 118px; white-space: nowrap; color: var(--ink-2); }
.log .c-src { width: 108px; color: var(--muted); }
.log .c-num { width: 84px; }
.log .c-note { color: var(--muted); min-width: 220px; }
.log { table-layout: auto; }
.log .warn { color: var(--low); }
.log tr.is-low td { background: color-mix(in srgb, var(--low-bg) 45%, var(--surface)); }

/* ---------------------------------------------------------------- tabs */
.tabs { display: flex; gap: 4px; margin: 20px 0 12px; border-bottom: 1px solid var(--line); }
.tab {
  padding: 9px 14px; text-decoration: none; color: var(--muted);
  font-size: 13px; font-weight: 550; border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.tab b { font-weight: 700; color: var(--low); margin-left: 4px; }
.tab:hover { color: var(--ink); }
.tab.on { color: var(--navy); border-bottom-color: var(--navy); }

/* ---------------------------------------------------------------- places */
.places .c-vis { width: 60px; color: var(--muted); }
.places .c-addr { width: 24%; }
.places .c-city { width: 130px; }
.places .c-label { width: 20%; }
.places .c-purpose { width: 22%; }
.places .c-base { width: 52px; text-align: center; }
.places .c-save { width: 140px; white-space: nowrap; }
.places .addr { font-weight: 550; }
.places .maplink { font-size: 11px; color: var(--muted); margin-left: 6px; text-decoration: none; }
.places .maplink:hover { color: var(--navy); text-decoration: underline; }
.places tbody td { padding: 5px 8px; }
.places tr.is-low .addr { color: var(--low); }
.search { width: 260px; }

/* ---------------------------------------------------------------- settings */
.settings { max-width: 860px; margin-top: 8px; }
.settings fieldset {
  margin: 0 0 16px; padding: 18px 20px 20px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  display: flex; flex-wrap: wrap; gap: 14px;
}
.settings legend {
  padding: 0 8px; font-size: 12px; font-weight: 650;
  letter-spacing: .06em; text-transform: uppercase; color: var(--navy);
}
.tag { font-size: 10px; padding: 2px 6px; border-radius: 3px; font-style: normal;
       background: var(--line-2); color: var(--muted); letter-spacing: .04em; }
.form-actions { display: flex; justify-content: flex-end; }

/* ---------------------------------------------------------------- auth */
.auth-body {
  display: grid; place-items: center; min-height: 100dvh; padding: 24px;
  background: var(--bg);
}
.auth-card {
  width: 100%; max-width: 400px; padding: 34px 34px 28px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 12px; box-shadow: var(--shadow);
}
.auth-brand { display: flex; align-items: baseline; gap: 9px; margin-bottom: 26px; }
.auth-card h1 {
  margin: 0 0 6px; font-size: 21px; font-weight: 640; letter-spacing: -.02em;
}
.auth-lede { margin: 0 0 20px; color: var(--muted); font-size: 13px; line-height: 1.5; }
.auth-card h1 + .auth-form { margin-top: 20px; }
.auth-form { display: flex; flex-direction: column; gap: 14px; }
/* .fld ma flex-basis 190px — w kolumnie liczyłby się jako wysokość */
.auth-form .fld { flex: 0 0 auto; }
.auth-form .fld input { padding: 10px 12px; font-size: 14.5px; }
.btn-block { width: 100%; justify-content: center; margin-top: 4px; }
.auth-msg {
  margin: 14px 0 0; padding: 10px 13px; border-radius: 6px;
  font-size: 13px; line-height: 1.45;
}
.auth-msg.err { background: color-mix(in srgb, #a83232 14%, var(--surface)); border: 1px solid #a83232; color: var(--ink); }
.auth-msg.ok  { background: var(--ok-bg); border: 1px solid var(--ok); color: var(--ink); }
.auth-msg.warn { background: var(--low-bg); border: 1px solid var(--low); color: var(--ink); }
.auth-msg code { background: var(--line-2); padding: 1px 5px; border-radius: 3px; font-size: 11.5px; }
.auth-link {
  display: block; margin-top: 18px; text-align: center;
  font-size: 12.5px; color: var(--muted); text-decoration: none;
}
.auth-link:hover { color: var(--navy); text-decoration: underline; }

/* sekrety w ustawieniach */
.fs-note {
  flex: 1 0 100%; margin: -4px 0 6px;
  font-size: 12.5px; color: var(--muted); line-height: 1.55;
}
.fs-note code, .settings code {
  background: var(--line-2); padding: 2px 6px; border-radius: 4px;
  font-size: 11.5px; word-break: break-all;
}
.fld.sec > span { display: flex; align-items: center; gap: 7px; }
.tag-ok  { background: var(--ok-bg); color: var(--ok); }
.tag-off { background: var(--line-2); color: var(--muted); }
.fld.sec .clr {
  display: flex; align-items: center; gap: 5px; margin-top: 5px;
  font-size: 11.5px; font-weight: 400; color: var(--muted);
  text-transform: none; letter-spacing: 0; cursor: pointer;
}
.fld.sec .clr input { width: auto; }
#envForm .ed-actions { flex: 1 0 100%; margin-top: 2px; }
.fld-row { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }

/* ---------------------------------------------------------------- misc */
.empty { max-width: 620px; margin: 60px auto; text-align: center; }
.empty h1 { font-size: 24px; font-weight: 620; letter-spacing: -.02em; }
.steps { text-align: left; margin: 24px 0 28px; padding-left: 22px; color: var(--ink-2); line-height: 1.9; }

.toast {
  position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%);
  z-index: 90; padding: 11px 18px; border-radius: 8px;
  background: var(--navy); color: var(--on-navy); font-size: 13.5px; font-weight: 500;
  box-shadow: 0 10px 30px -8px rgba(0,0,0,.4);
}
.toast.err { background: #a83232; color: #fff; }

@media (max-width: 1080px) {
  #grid th:nth-child(7), #grid td:nth-child(7),   /* kierowca */
  #grid th:nth-child(8), #grid td:nth-child(8) {  /* licznik start */
    display: none;
  }
  .head { align-items: flex-start; flex-direction: column; }
  .stats { grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); }
}

/* ================================================================ raport */
.range-bar { display: flex; flex-wrap: wrap; gap: 6px; margin: 20px 0 6px; }
.range {
  padding: 7px 13px; border: 1px solid var(--line); border-radius: 999px;
  background: var(--surface); color: var(--ink-2);
  font-size: 12.5px; font-weight: 550; text-decoration: none; white-space: nowrap;
  transition: background .12s, border-color .12s, color .12s;
}
.range:hover { background: var(--line-2); color: var(--ink); }
.range.on { background: var(--navy); border-color: var(--navy); color: var(--on-navy); }
.range-note { margin: 4px 0 20px; font-size: 12.5px; color: var(--muted); }
.range-note b { color: var(--ink); font-weight: 600; }

/* kafle statystyk — bez pudełek, dane oddzielone linią (VISUAL_DENSITY 8) */
.metrics {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(168px, 1fr));
  background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
}
/* Separatory rysujemy na kafelkach, nie odstępem siatki. Przy odstępie
   niewykorzystana komórka świeciła jako dziura w środku panelu. */
.metric {
  padding: 14px 16px 15px;
  box-shadow: inset -1px 0 0 var(--line), inset 0 -1px 0 var(--line);
}
.metric-k {
  display: block; font-size: 10.5px; font-weight: 650; letter-spacing: .07em;
  text-transform: uppercase; color: var(--muted); margin-bottom: 6px;
}
.metric-v {
  display: block; font-size: 22px; font-weight: 620; letter-spacing: -.02em;
  font-variant-numeric: tabular-nums; line-height: 1.15; text-wrap: balance;
}
/* czas trwania to najdłuższa wartość i jako jedyna łamała się na dwie linie */
.metric-v.compact { font-size: 18px; }
.metric-v small { font-size: 13px; font-weight: 550; color: var(--muted); margin-left: 3px; }
.metric-sub { display: block; margin-top: 5px; font-size: 11.5px; color: var(--muted); }
.metric.lead .metric-v { color: var(--navy); font-size: 26px; }

/* wykres słupkowy — czysty CSS, bez biblioteki */
.chart-wrap {
  margin-top: 18px; padding: 18px 18px 12px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.chart-head {
  display: flex; justify-content: space-between; align-items: baseline;
  gap: 16px; margin-bottom: 14px;
}
.chart-head h2 { margin: 0; font-size: 14px; font-weight: 620; letter-spacing: -.01em; }
.unit-pick { display: flex; gap: 2px; padding: 2px; background: var(--line-2); border-radius: 7px; }
.unit {
  padding: 5px 11px; border-radius: 5px; font-size: 12px; font-weight: 550;
  color: var(--muted); text-decoration: none; white-space: nowrap;
}
.unit:hover { color: var(--ink); }
.unit.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.unit.off { opacity: .35; cursor: not-allowed; }
.chart-note { margin: -6px 0 12px; font-size: 12px; color: var(--muted); }
/* Przy długich okresach słupków bywa kilkaset — wykres dostaje własne
   przewijanie w poziomie, żeby nie rozpychał strony.
   padding/margin u góry robi miejsce na dymki, których overflow by uciął. */
.chart-scroll {
  overflow-x: auto; overflow-y: hidden;
  padding-top: 42px; margin-top: -42px;
  scrollbar-width: thin;
}
.chart {
  display: flex; align-items: flex-end; gap: var(--bar-gap, 3px);
  height: 190px; padding-bottom: 22px; position: relative;
  border-bottom: 1px solid var(--line);
  min-width: 100%; width: max-content;
}
/* height:100% jest konieczne — bez tego procentowa wysokość słupka
   nie ma się do czego odnieść i wykres znika. */
.bar { flex: 1 1 var(--bar-min, 6px); position: relative; min-width: var(--bar-min, 6px);
       height: 100%; display: flex; align-items: flex-end; }
.bar i {
  display: block; width: 100%; border-radius: 2px 2px 0 0;
  background: var(--navy); opacity: .82; min-height: 1px;
  transition: opacity .12s;
}
.bar:hover i { opacity: 1; }
.bar.zero i { background: var(--line); opacity: 1; }
.bar b {
  position: absolute; left: 50%; bottom: -19px; transform: translateX(-50%);
  font-size: 9.5px; font-weight: 500; color: var(--muted); white-space: nowrap;
}
.bar .tip {
  position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%);
  margin-bottom: 6px; padding: 6px 9px; border-radius: 6px;
  background: var(--navy); color: var(--on-navy);
  font-size: 11.5px; white-space: nowrap; opacity: 0; pointer-events: none;
  transition: opacity .12s; z-index: 5; box-shadow: var(--shadow);
}
.bar:hover .tip { opacity: 1; }

/* kalendarz wyboru zakresu */
.cal-wrap {
  margin-top: 18px; padding: 16px 18px 18px; display: inline-block; min-width: 470px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.cal-head { display: flex; align-items: center; justify-content: space-between;
            margin-bottom: 12px; max-width: 430px; }
.cal-head h2 { margin: 0; font-size: 14px; font-weight: 620; text-transform: capitalize; }
.cal-nav { display: flex; gap: 4px; }
/* Kalendarz: jawna wysokość wiersza. Przy wysokości wynikającej z treści
   wiersze z pustymi komórkami rozjeżdżały się do 164 px. */
.cal-dow-row, .cal-grid {
  display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; max-width: 430px;
}
.cal-grid { grid-auto-rows: 44px; }
.cal-dow {
  text-align: center; font-size: 10px; font-weight: 650; letter-spacing: .06em;
  text-transform: uppercase; color: var(--muted); padding-bottom: 4px;
}
.cal-day {
  position: relative; height: 100%; border: 1px solid transparent;
  border-radius: 6px; background: var(--line-2); cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 1px; font-size: 12.5px; color: var(--ink); user-select: none;
  transition: background .1s, border-color .1s;
}
.cal-day:hover { border-color: var(--navy); }
.cal-day em { font-style: normal; font-size: 9px; color: var(--muted); font-variant-numeric: tabular-nums; }
.cal-day.empty { background: transparent; cursor: default; }
.cal-day.empty:hover { border-color: transparent; }
.cal-day.future { opacity: .38; }
.cal-day.wknd em { color: var(--low); }
.cal-day.in-range { background: color-mix(in srgb, var(--navy) 22%, var(--surface)); }
.cal-day.edge { background: var(--navy); color: var(--on-navy); font-weight: 650; }
.cal-day.edge em { color: var(--on-navy); opacity: .75; }
.cal-hint { margin: 12px 0 0; font-size: 12px; color: var(--muted); }

.month-nav { display: flex; align-items: center; gap: 2px; }
.arrow {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 32px; border: 1px solid var(--line); background: var(--surface);
  color: var(--ink-2); border-radius: 6px; cursor: pointer; font: inherit; font-size: 14px;
  text-decoration: none;
}
.arrow:hover:not([aria-disabled="true"]) { background: var(--line-2); color: var(--ink); }
.arrow[aria-disabled="true"] { opacity: .35; pointer-events: none; }
.month-nav .select-wrap { margin: 0 2px; }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
