/* OLPRO – od 2.43 spokojna kolorystyka: grafit, stalowy niebieski, biel; czerwień marki (--brand) tylko w logo i cienkiej linii
   pod paskiem górnym. Bez czerwonych napisów – ostrzeżenia i kwoty ujemne ciemnym bursztynem (--err). */
:root {
  --brand: #E61220;
  --accent: #2F5F8A; --accent-dark: #244A6C; --accent-soft: #EEF3F8; --accent-line: #C9D6E3;
  --ink: #1B1D21; --ink-2: #374151; --muted: #6B7280; --line: #E5E7EB; --line-2: #D1D5DB;
  --bg: #F4F5F7; --card: #FFFFFF; --head: #23262B;
  --ok: #1E7B34; --ok-soft: #E7F5EA; --err: #8A5300; --err-soft: #FDF6E9;
  --radius: 12px; --shadow: 0 1px 2px rgba(16,24,40,.06), 0 1px 3px rgba(16,24,40,.08);
  --shadow-lg: 0 10px 30px rgba(16,24,40,.10);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif; background: var(--bg); color: var(--ink); }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; height: auto; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
h1 { font-size: 24px; line-height: 1.2; margin: 6px 0 16px; letter-spacing: -.01em; }
h2 { font-size: 18px; margin: 0 0 12px; }
code { font-family: ui-monospace, Consolas, monospace; font-size: 14px; background: #F3F4F6; padding: 2px 6px; border-radius: 6px; }

/* ---------- pasek górny ---------- */
.top { position: sticky; top: 0; z-index: 10; background: #fff; border-bottom: 2px solid var(--brand); box-shadow: var(--shadow);
       display: flex; align-items: center; gap: 12px 20px; padding: 8px 20px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; margin-right: auto; color: var(--ink); text-decoration: none !important; }
.brand img { display: block; width: 88px; height: 40px; }
.brand-sub { font-weight: 700; font-size: 15px; color: var(--ink-2); padding-left: 10px; border-left: 1px solid var(--line-2); }
.main-nav { display: flex; gap: 4px; flex-wrap: wrap; }
.main-nav a { color: var(--ink-2); font-weight: 600; font-size: 15px; padding: 8px 12px; border-radius: 8px; text-decoration: none; }
.main-nav a:hover { background: var(--bg); color: var(--ink); }
.main-nav a.on { color: var(--ink); background: var(--accent-soft); }
.main-nav a.logout { color: var(--muted); font-weight: 500; }

/* 2.41: „Więcej” i wyszukiwarka w pasku górnym */
.main-nav { align-items: center; }
.nav-more { position: relative; }
.nav-more summary { list-style: none; cursor: pointer; color: var(--ink-2); font-weight: 600; font-size: 15px; padding: 8px 12px; border-radius: 8px; }
.nav-more summary::-webkit-details-marker { display: none; }
.nav-more summary::after { content: " ▾"; font-size: 12px; }
.nav-more summary:hover, .nav-more[open] summary { background: var(--bg); color: var(--ink); }
.nav-more summary.on { color: var(--ink); background: var(--accent-soft); }
.nav-drop { position: absolute; right: 0; top: calc(100% + 6px); z-index: 20; background: #fff; border: 1px solid var(--line); border-radius: 12px;
            box-shadow: var(--shadow-lg); padding: 12px; display: grid; grid-template-columns: repeat(3, minmax(150px, auto)); gap: 4px 18px; }
.nd-title { font-size: 13px; font-weight: 600; color: var(--muted); margin: 2px 0 4px; }
.nd-group a { display: block; padding: 6px 8px; border-radius: 8px; color: var(--ink-2); font-weight: 600; font-size: 14px; white-space: nowrap; }
.nd-group a:hover { background: var(--bg); text-decoration: none; }
.nd-group a.on { color: var(--ink); background: var(--accent-soft); }
.nav-search { flex: 1 1 220px; max-width: 360px; order: 2; }
.nav-search input { margin: 0; padding: 8px 12px; font-size: 14px; border-radius: 999px; background: var(--bg); }
.main-nav { order: 3; }
@media (max-width: 760px) {
  .nav-drop { position: fixed; left: 8px; right: 8px; top: auto; grid-template-columns: 1fr 1fr; }
  .nav-search { order: 4; flex-basis: 100%; max-width: none; }
}

.start-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.start-head h1 { margin-bottom: 2px; }
.start-quick { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.start-h { font-size: 15px; font-weight: 600; color: var(--muted); margin: 22px 0 8px; }
.start-todo { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
.start-todo a { display: block; background: #fff; border: 1px solid var(--line); border-left: 4px solid var(--line-2); border-radius: 0 10px 10px 0;
                padding: 10px 12px; color: var(--ink-2); font-size: 14px; font-weight: 600; }
.start-todo a:hover { text-decoration: none; border-color: var(--line-2); box-shadow: var(--shadow); }
.start-todo b { display: block; font-size: 24px; line-height: 1.1; color: var(--ink); }
.start-todo .todo-err { border-left-color: var(--err); } .start-todo .todo-err b { color: var(--err); }
.start-todo .todo-warn { border-left-color: #D97706; } .start-todo .todo-warn b { color: #B45309; }
.start-more { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.start-more .card { margin: 0; padding: 12px 16px; }
.start-more a { display: inline-block; margin: 2px 14px 2px 0; font-weight: 600; font-size: 14px; }

nav.sub { display: flex; gap: 6px; padding: 14px 20px 0; max-width: 1240px; margin: 0 auto; overflow-x: auto; }
nav.sub a { padding: 8px 16px; border-radius: 999px; text-decoration: none; background: #fff; color: var(--ink-2); font-weight: 600;
            font-size: 14px; white-space: nowrap; border: 1px solid var(--line); }
nav.sub a:hover { border-color: var(--line-2); }
nav.sub a.on { background: var(--ink); border-color: var(--ink); color: #fff; }

main { max-width: 760px; margin: 0 auto; padding: 18px 16px 96px; }
main.narrow { max-width: 420px; }
main.wide { max-width: 1240px; }
footer { text-align: center; color: var(--muted); font-size: 13px; padding: 0 16px 28px; }

/* ---------- karty, komunikaty ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin: 0 0 14px; box-shadow: var(--shadow); }
.flash { padding: 12px 16px; border-radius: 10px; margin-bottom: 14px; font-weight: 500; border: 1px solid transparent; }
.flash.ok { background: var(--ok-soft); color: var(--ok); border-color: #CBE8D2; }
.flash.err { background: var(--err-soft); color: var(--err); border-color: #EBD3A8; }
.hint { color: var(--muted); font-size: 14px; margin-top: -6px; }

/* ---------- formularze ---------- */
label { display: block; font-size: 14px; font-weight: 600; color: var(--ink-2); margin-bottom: 12px; }
input, select, textarea { display: block; width: 100%; margin-top: 6px; font: inherit; font-weight: 400; color: var(--ink); padding: 11px 12px;
  border: 1px solid var(--line-2); border-radius: 10px; background: #fff; transition: border-color .15s, box-shadow .15s; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(47,95,138,.15); }
input[type=checkbox] { width: 18px; height: 18px; display: inline-block; margin: 0; accent-color: var(--accent); }
button, .btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; font: inherit; font-weight: 600; padding: 10px 18px;
  border-radius: 10px; border: 1px solid var(--line-2); background: #fff; color: var(--ink); cursor: pointer; text-decoration: none !important;
  transition: background .15s, border-color .15s, transform .05s; }
button:hover, .btn:hover { border-color: var(--ink-2); }
button:active { transform: translateY(1px); }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button.primary:hover { background: var(--accent-dark); border-color: var(--accent-dark); }
button.big { width: 100%; padding: 14px; font-size: 17px; }
button.small, .btn.small { padding: 6px 12px; font-size: 14px; }
button.danger { background: #fff; color: var(--err); border-color: #EBD3A8; width: 100%; }
button.danger:hover { background: var(--err-soft); }
button.sticky { position: sticky; bottom: 14px; box-shadow: 0 8px 20px rgba(230,18,32,.35); }
.row2 { display: grid; gap: 0 14px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.cols { display: grid; gap: 0 14px; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); align-items: start; }
label.check { display: flex; gap: 10px; align-items: center; color: var(--ink); font-size: 15px; font-weight: 500; padding: 6px 0; }

/* ---------- logowanie ---------- */
body.login-page { background: var(--bg); min-height: 100vh; border-top: 3px solid var(--brand); }
body.login-page main { padding-top: 7vh; }
.login-card { padding: 28px 26px 24px; box-shadow: var(--shadow-lg); border-top: 3px solid var(--accent-line); }
.login-logo { text-align: center; margin: 4px 0 18px; }
.login-logo img { display: inline-block; width: 100%; max-width: 240px; height: auto; }
.login-card h1 { font-size: 20px; margin: 0 0 2px; text-align: center; }
.login-card .hint { text-align: center; margin: 0 0 18px; }

/* ---------- listy budów / budynków ---------- */
.blist { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.blist a { display: grid; grid-template-columns: 1fr auto; gap: 8px 12px; align-items: center; background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px 18px; text-decoration: none; color: var(--ink); box-shadow: var(--shadow); transition: border-color .15s, box-shadow .15s; }
.blist a:hover { border-color: var(--accent-line); box-shadow: var(--shadow-lg); }
.bname { font-weight: 700; font-size: 17px; }
.bpct { font-weight: 700; color: var(--accent); font-variant-numeric: tabular-nums; }
.bsub { grid-column: 1 / -1; font-size: 13px; }
.bar { grid-column: 1 / -1; height: 8px; background: #EEF0F3; border-radius: 99px; overflow: hidden; }
.bar span { display: block; height: 100%; background: var(--accent); border-radius: 99px; }

/* ---------- formularz wpisu ---------- */
fieldset.el { border: 1px solid var(--line); padding: 8px 18px 10px; }
fieldset.el legend { font-weight: 700; padding: 2px 10px; font-size: 16px; background: var(--ink); color: #fff; border-radius: 999px; }
.stage { display: grid; grid-template-columns: 1fr 110px; gap: 2px 14px; align-items: center; padding: 10px 0; }
.stage + .stage { border-top: 1px dashed var(--line-2); }
.sname { font-weight: 600; }
.nums { grid-column: 1; font-size: 13px; color: var(--muted); }
.nums b { color: var(--ink-2); }
.stage input { grid-column: 2; grid-row: 1 / span 2; margin: 0; font-size: 20px; font-weight: 600; text-align: center; }
.stage input.noplan { background: #F6F7F9; }
.neg { color: var(--err) !important; }

.elist { list-style: none; padding: 0; margin: 0; }
.elist .eh { margin-bottom: 4px; }
.elist .btn { margin-top: 10px; }

/* ---------- panel kierownika ---------- */
.filters { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.filters label { margin: 0; min-width: 160px; flex: 1; }
.filters .full { flex-basis: 100%; }
.tablewrap { overflow-x: auto; border-radius: 10px; }
table.grid { width: 100%; border-collapse: separate; border-spacing: 0; background: var(--card); font-size: 14px; }
table.grid th, table.grid td { border-bottom: 1px solid var(--line); padding: 9px 10px; text-align: left; vertical-align: top; }
table.grid th { background: var(--head); color: #fff; font-weight: 600; font-size: 13px; letter-spacing: .01em; }
table.grid thead tr:first-child th:first-child { border-top-left-radius: 10px; }
table.grid thead tr:first-child th:last-child { border-top-right-radius: 10px; }
table.grid tbody tr:nth-child(even) td { background: #FAFAFB; }
table.grid tbody tr:hover td { background: #F6F8FA; }
table.grid td input, table.grid td select { margin: 0; padding: 7px 9px; }
table.grid .r { text-align: right; font-variant-numeric: tabular-nums; }
table.grid .c { text-align: center; }
tr.off td { opacity: .5; }
.badge { background: var(--accent-soft); color: var(--accent); border-radius: 999px; padding: 2px 10px; font-size: 14px; font-weight: 700; margin-left: 6px; }
code.copy { display: block; padding: 10px 12px; background: #F3F4F6; border-radius: 8px; word-break: break-all; user-select: all; margin: 8px 0; }
details summary { cursor: pointer; font-weight: 600; }

/* ---------- strefy, duplikaty ---------- */
label .opt { font-weight: 400; color: var(--muted); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: -4px 0 14px; }
.chip { padding: 7px 12px; border-radius: 999px; font-size: 14px; font-weight: 600; background: #fff; border: 1px solid var(--line-2); color: var(--ink-2); }
.chip.on { background: var(--ink); border-color: var(--ink); color: #fff; }
.zone-tag { display: inline-block; background: #EEF0F3; color: var(--ink-2); border-radius: 6px; padding: 0 7px; font-size: 13px; font-weight: 600; }
.zone-row { display: grid; grid-template-columns: minmax(140px, 220px) 1fr auto; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }
.zone-row:last-child { border-bottom: 0; }
.zone-row input { margin: 0; }
.zr-name { font-weight: 600; }
.dup-card { border-top: 3px solid var(--accent-line); }
.dup-card h1 { margin-top: 0; }
.dup-list { padding-left: 20px; margin: 8px 0 14px; }
.dup-list li { margin: 4px 0; }
.dup-card form { margin: 12px 0; }
.big-link { width: 100%; padding: 13px; }
@media (max-width: 560px) { .zone-row { grid-template-columns: 1fr auto; } .zone-row .zr-name { grid-column: 1 / -1; } }

/* ---------- czas pracy ---------- */
.kind-seg { display: flex; margin-bottom: 14px; }
.seg-opt { margin: 0; flex: 1; text-align: center; }
.seg-opt input { position: absolute; opacity: 0; pointer-events: none; }
.seg-opt span { display: block; padding: 9px 10px; border-radius: 8px; font-weight: 600; color: var(--ink-2); cursor: pointer; }
.seg-opt input:checked + span { background: var(--ink); color: #fff; }
.seg-opt input:focus-visible + span { outline: 2px solid var(--accent); }
.month-nav { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 18px 0 12px; }
.month-nav h2 { margin: 0; text-transform: capitalize; }
.kind { display: inline-block; border-radius: 6px; padding: 0 7px; font-size: 13px; font-weight: 600; }
.kind-praca { background: #EEF0F3; color: var(--ink-2); }
.kind-urlop { background: #E7F0FB; color: #1C5CAB; }
.kind-l4 { background: #FFF4CC; color: #8A6100; }
.inline-form { display: flex; gap: 6px; align-items: center; }
.inline-form input { width: 90px; margin: 0; padding: 6px 8px; }
.inline-form input.note { width: 120px; }
input.rate { width: 90px; }
.miss-row { display: grid; grid-template-columns: 90px 1fr 1fr auto; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.ok-text { color: var(--ok); font-weight: 600; }
.tiles-labor { margin-top: -2px; }

/* ---------- strona startowa ---------- */
.start-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); margin-top: 8px; }
.start-tile { display: flex; flex-direction: column; gap: 6px; background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  padding: 20px 18px 18px; box-shadow: var(--shadow); color: var(--ink); text-decoration: none !important; min-height: 168px;
  transition: border-color .15s, box-shadow .15s, transform .1s; }
.start-tile:hover { border-color: var(--accent-line); box-shadow: var(--shadow-lg); transform: translateY(-1px); }
.st-icon { width: 46px; height: 46px; border-radius: 12px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; margin-bottom: 6px; }
.st-icon svg { width: 26px; height: 26px; }
.st-title { font-size: 19px; font-weight: 700; }
.st-desc { font-size: 14px; color: var(--muted); }
.st-info { margin-top: auto; padding-top: 8px; font-size: 13px; font-weight: 600; color: var(--ink-2); border-top: 1px dashed var(--line-2); }
.start-tile.soon { background: #FAFAFB; }
.start-tile.soon .st-icon { background: #EEF0F3; color: var(--muted); }
.st-soon { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; background: #EEF0F3; color: var(--muted);
  border-radius: 6px; padding: 2px 6px; vertical-align: 3px; }
@media (max-width: 560px) { .start-grid { grid-template-columns: 1fr 1fr; gap: 10px; } .start-tile { min-height: 150px; padding: 14px; }
  .st-desc { font-size: 13px; } .st-title { font-size: 17px; } }

/* ---------- role i uprawnienia ---------- */
.perm-grid td, .perm-grid th { vertical-align: middle; }
.perm-grid td.c input { width: 20px; height: 20px; }
.th-sub { font-weight: 400; font-size: 11px; opacity: .75; }
.perm-help { margin: 0; padding-left: 18px; font-size: 14px; color: var(--ink-2); }
.perm-help li { margin: 4px 0; }
.role-tag { display: inline-block; border-radius: 6px; padding: 2px 8px; font-size: 13px; font-weight: 700; }
.role-master { background: var(--ink-2); color: #fff; }

/* ---------- pulpit kierownika ---------- */
.dash-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; margin-bottom: 6px; }
.dash-head h1 { margin: 6px 0; }
.dash-filters { display: flex; gap: 8px; flex-wrap: wrap; }
.seg { display: inline-flex; background: #fff; border: 1px solid var(--line-2); border-radius: 10px; padding: 3px; gap: 2px; }
.seg a { padding: 6px 12px; border-radius: 8px; font-size: 14px; font-weight: 600; color: var(--ink-2); text-decoration: none !important; white-space: nowrap; }
.seg a:hover { background: var(--bg); }
.seg a.on { background: var(--ink); color: #fff; }
.dash-filters { align-items: center; }
.dash-filters select { margin: 0; width: auto; min-width: 180px; padding: 9px 12px; }
.tiles { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); margin-bottom: 14px; }
.tile { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); }
.t-label { font-size: 13px; font-weight: 600; color: var(--muted); }
.t-value { font-size: 28px; font-weight: 700; line-height: 1.2; margin: 6px 0 2px; color: var(--ink); }
.t-sub { font-size: 13px; color: var(--ink-2); }
.meter { height: 8px; background: var(--accent-soft); border-radius: 99px; overflow: hidden; margin-top: 8px; }
.meter span { display: block; height: 100%; background: var(--accent); border-radius: 99px; }
svg.chart { display: block; width: 100%; height: auto; overflow: visible; }
svg.chart .tick { font-size: 11px; fill: var(--muted); font-variant-numeric: tabular-nums; }
svg.chart .val { font-size: 12px; font-weight: 700; fill: var(--ink-2); }
svg.chart .hit { cursor: default; }
svg.chart .hit:hover path { opacity: .78; }
svg.chart .hit:hover rect { fill: rgba(17,24,39,.04); }
svg.chart .hit:hover circle { r: 6; }
.key { display: inline-block; width: 10px; height: 10px; border-radius: 3px; vertical-align: -1px; }
.key-cur { background: var(--accent); }
.card details { margin-top: 10px; }
.card details table { margin-top: 8px; max-width: 420px; }
.hbar { padding: 8px 0; border-bottom: 1px solid var(--line); }
.hbar:last-child { border-bottom: 0; }
.hb-top { display: flex; justify-content: space-between; gap: 10px; font-size: 14px; }
.hb-name { font-weight: 600; }
.hb-val { font-weight: 700; font-variant-numeric: tabular-nums; }
.hbar .meter { margin-top: 6px; }
.hb-sub { font-size: 12px; color: var(--muted); margin-top: 4px; }
.ubar { display: grid; grid-template-columns: minmax(120px, 200px) 1fr auto; gap: 12px; align-items: center; padding: 7px 0; font-size: 14px; }
.ub-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ub-track { height: 14px; background: #EEF0F3; border-radius: 4px; overflow: hidden; }
.ub-track span { display: block; height: 100%; background: #3A3F47; border-radius: 0 4px 4px 0; }
.ub-val { font-weight: 700; font-variant-numeric: tabular-nums; min-width: 110px; text-align: right; }

@media (max-width: 560px) {
  .ubar { grid-template-columns: 1fr auto; }
  .ub-track { grid-column: 1 / -1; grid-row: 2; }
  .t-value { font-size: 24px; }
  .top { padding: 8px 12px; gap: 8px; }
  .brand img { width: 70px; height: 32px; }
  .brand-sub { display: none; }
  .main-nav a { padding: 7px 9px; font-size: 14px; }
  main { padding: 14px 12px 96px; }
  h1 { font-size: 21px; }
  .card { padding: 14px; }
}

/* 2.5: obiekty – kategorie, zakres, klient */
.cat-filter { margin: 0 0 12px; }
.seg a.on .muted { color: rgba(255,255,255,.75); }
.cat-tag { display: inline-block; border-radius: 6px; padding: 2px 8px; margin: 0 4px 2px 0; font-size: 13px; font-weight: 700; vertical-align: middle; }
h1 .cat-tag { font-size: 14px; margin-left: 6px; }
.cat-instalacje { background: var(--ink); color: #fff; }
.cat-serwis { background: var(--accent-soft); color: var(--accent-dark); }
fieldset.checks { border: 1px solid var(--line); border-radius: 10px; padding: 6px 14px 10px; margin: 0 0 12px; display: flex; flex-wrap: wrap; gap: 2px 18px; }
fieldset.checks legend { font-weight: 600; font-size: 14px; padding: 0 6px; }
fieldset.checks label.check { margin: 4px 0; }
fieldset.checks input[name="systems_other"] { flex-basis: 100%; }
.pf-grid { display: grid; gap: 0 24px; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }

/* 2.6: godziny – obiekty wg kategorii */
.row2 .full { grid-column: 1 / -1; }
.cat-seg { display: flex; margin: 0 0 8px; }
.cat-seg small { font-weight: 500; opacity: .75; }

/* 2.8: usuwanie obiektu */
.danger-zone { border-color: #EBD3A8; }
.danger-zone summary { cursor: pointer; font-weight: 700; color: var(--err); }
.danger-zone[open] summary { margin-bottom: 8px; }
.danger-zone button.danger { width: auto; }

/* 2.9: raport miesięczny osoby */
.day-report td { vertical-align: top; }
.day-report tr.weekend td { background: #F7F8FA; }
.day-report tr.missing td { background: var(--err-soft); }
.nowrap { white-space: nowrap; }
.print-only { display: none; }
@media print {
  header.top, nav.sub, footer, .no-print, .flash { display: none !important; }
  .print-only { display: block; color: #555; font-size: 12px; margin: 0 0 8px; }
  body { background: #fff; }
  main, main.wide { max-width: none; padding: 0; }
  .card, .tile { box-shadow: none; break-inside: avoid; }
  .tablewrap { overflow: visible; }
  .day-report { font-size: 11px; }
  .day-report tr { break-inside: avoid; }
  a { color: inherit; text-decoration: none; }
}

/* 2.11: serwis – kalendarz, statusy wizyt */
.vs { display: inline-block; border-radius: 6px; padding: 1px 8px; font-size: 13px; font-weight: 600; white-space: nowrap; }
.vs-do_wykonania { background: #EEF0F3; color: var(--ink-2); }
.vs-zaplanowany { background: #E7F0FB; color: #1C5CAB; }
.vs-przelozony { background: #FFF4CC; color: #8A6100; }
.vs-wykonany { background: var(--ok-soft); color: var(--ok); }
.vs-zalegly { background: var(--err-soft); color: var(--err); }
.vs-anulowany { background: #F3F4F6; color: var(--muted); text-decoration: line-through; }
h1 .vs { font-size: 14px; vertical-align: middle; }
.st-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.progress { height: 8px; background: #EEF0F3; border-radius: 999px; overflow: hidden; margin-top: 10px; }
.progress span { display: block; height: 100%; background: var(--ok); border-radius: 999px; }
.t-value small { font-size: 15px; font-weight: 600; }
.actions .inline-form { display: inline; }
.actions .btn, .actions button { margin: 2px 0; }
.overdue-card { border-color: #EBD3A8; }
.overdue-card h2 { color: var(--err); }
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.cal-h { font-size: 12px; font-weight: 700; color: var(--muted); text-align: center; text-transform: uppercase; padding: 2px 0; }
.cal-d { min-height: 96px; border: 1px solid var(--line); border-radius: 8px; padding: 4px; background: #fff; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.cal-d.we { background: #F9FAFB; }
.cal-d.out { opacity: .45; }
.cal-d.today { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.cal-n { font-size: 13px; font-weight: 700; color: var(--ink-2); display: flex; justify-content: space-between; align-items: center; }
.cal-add { visibility: hidden; text-decoration: none; font-weight: 700; color: var(--muted); padding: 0 5px; border-radius: 4px; }
.cal-d:hover .cal-add { visibility: visible; }
.cal-add:hover { background: #EEF0F3; color: var(--ink); }
.cal-v { display: block; font-size: 12px; font-weight: 600; line-height: 1.3; border-radius: 5px; padding: 2px 5px; text-decoration: none;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-v:hover { filter: brightness(.95); }
.legend .vs { margin-right: 2px; }
.visit-info { display: grid; gap: 6px; font-size: 15px; }
.prewrap { white-space: pre-wrap; }
.hist { list-style: none; padding: 0; margin: 0; }
.hist li { padding: 6px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.hist-at { display: inline-block; min-width: 88px; color: var(--muted); font-variant-numeric: tabular-nums; }
.hist-k { display: inline-block; min-width: 92px; font-size: 12px; font-weight: 600; color: var(--accent-dark); background: var(--accent-soft); border-radius: 6px; padding: 0 6px; margin-right: 6px; text-align: center; }
.term { font-variant-numeric: tabular-nums; }
.term-wygaslo { color: var(--err); font-weight: 700; }
.term-wygasa { color: #B45309; font-weight: 600; }
.term-pilne { color: var(--err); font-weight: 600; }   /* 3.02: samochody – do 7 dni */
.term-wazne { color: var(--ink-2); }
.book-form, .actions .book-form { display: inline-flex; flex-wrap: nowrap; align-items: center; gap: 6px; }
.book-form input[type=date] { width: 150px; }
.book-form select { width: auto; max-width: 170px; margin: 0; padding: 6px 8px; font-size: 14px; }
.obj-no { display: inline-block; min-width: 2.6em; padding: 0 5px; border-radius: 6px; background: var(--bg); border: 1px solid var(--line);
          font-variant-numeric: tabular-nums; font-weight: 700; color: var(--ink-2); text-align: center; }
h1 .obj-no { font-size: .8em; vertical-align: 2px; }
.inv-dlg { width: min(980px, 96vw); height: 92vh; padding: 0; border: 0; border-radius: 12px; overflow: hidden; }
.inv-dlg::backdrop { background: rgba(17, 24, 39, .55); }
.inv-dlg[open] { display: flex; flex-direction: column; }
.inv-dlg-bar { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 12px; background: #3A3F47; color: #fff; }
.inv-dlg iframe { flex: 1; width: 100%; border: 0; background: #F4F5F7; }
.plan-grid select, .plan-grid input { margin: 0; }
.service-link { padding: 12px 18px; }
/* 2.87: przebieg obiektu / powiązania zlecenia – tylko zmienne (ciemny motyw działa sam) */
.flow-chain { display: flex; flex-wrap: wrap; gap: 6px; align-items: stretch; margin: 4px 0 12px; padding: 0; list-style: none; }
.flow-chain li { flex: 1 1 140px; background: var(--accent-soft); border: 1px solid var(--accent-line); border-radius: 10px; padding: 8px 12px; position: relative; }
.flow-chain li:not(:last-child)::after { content: "→"; position: absolute; right: -11px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: 13px; z-index: 1; }
.flow-chain .fc-k { display: block; font-size: 12px; color: var(--muted); }
.flow-chain .fc-v { display: block; font-weight: 600; color: var(--ink); }
.flow-chain a.fc-v { color: var(--accent); }
.flow-chain .fc-s { display: block; font-size: 12px; color: var(--ink-2); }
.crumbs { font-size: 13px; color: var(--muted); margin: 0 0 4px; }
.crumbs a { color: var(--accent); }
.crumbs .sep { margin: 0 6px; color: var(--line-2); }
.line-links { display: block; margin-top: 4px; }
/* 2.88: listy płac z PDF */
.lc-pdf { margin: 4px 0 14px; padding: 10px 12px; border: 1px dashed var(--accent-line); border-radius: 10px; background: var(--accent-soft); }
.lc-pdf .btn { cursor: pointer; margin-right: 8px; }
.lc-pdf-out { margin-top: 8px; }
.lc-pdf-files { margin: 0; padding-left: 18px; font-size: 13px; color: var(--ink-2); }
input.lc-filled { border-color: var(--accent); background-color: var(--accent-soft); }
input.lc-missing, html[data-theme="dark"] input.lc-missing { border-color: var(--err); background-color: var(--err-soft); }
input.lc-missing::placeholder { color: var(--err); }
.lc-miss-tag { color: var(--err); font-weight: 600; }
.lc-pdf-text { max-height: 260px; overflow: auto; white-space: pre-wrap; font-size: 11px; background: var(--card); border: 1px solid var(--line); border-radius: 6px; padding: 8px; margin: 6px 0 0; }
@media (max-width: 760px) {
  .cal-card { display: none; }      /* na telefonie wystarcza lista wizyt */
}

/* 2.14: faktury z KSeF */
.filters-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 0 0 12px; }
.filters-row select { margin: 0; width: auto; }
.seg .cnt { display: inline-block; min-width: 18px; padding: 0 6px; margin-left: 4px; border-radius: 999px; background: var(--ink-2); color: #fff; font-size: 12px; text-align: center; }
.ksef-status { display: flex; flex-wrap: wrap; gap: 6px 18px; align-items: center; padding: 12px 18px; font-size: 14px; }
.ksef-status .flash { margin: 0; }
.inv-lines select { margin: 0; min-width: 130px; }
.inv-lines tr.done td { background: #F6FBF7; }.card > button.big + .hint { margin-top: 10px; }

/* 2.17: wersja przy nazwie panelu */
.brand-ver { font-size: 11px; font-weight: 500; color: var(--muted); margin-left: 4px; letter-spacing: .02em; }

/* 2.18: magazyn */
tr.low td { background: #FFF6F6; }
.mv { display: inline-block; border-radius: 6px; padding: 1px 7px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.mv-przyjecie { background: var(--ok-soft); color: var(--ok); }
.mv-wydanie { background: #EEF0F3; color: var(--ink-2); }
.mv-zwrot { background: #E7F0FB; color: #1C5CAB; }
.mv-korekta { background: #FFF4CC; color: #8A6100; }
.wh-search { display: flex; gap: 8px; }
.wh-search input, .wh-search select { margin: 0; width: auto; }
.inv-lines select.itm { margin-top: 4px; max-width: 260px; }
/* 2.22: obiekt wybranego zlecenia pod polem */
.order-info { color: var(--ink-2); font-weight: 600; }

/* 2.25: oferty */
.card-inner { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin: 0 0 12px; background: #FCFCFD; }
.sec-head { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.sec-head .sec-title { margin: 0; font-weight: 700; }
.of-items input, .of-items select { margin: 0; min-width: 0; }
.of-items .it-name { min-width: 460px; width: 100%; }
.of-items td:nth-child(2) { width: 100%; }
.of-items .it-qty { width: 70px; } .of-items .it-price { width: 100px; } .of-items .it-unit { width: 72px; }
input.r { text-align: right; }
.lump-amount input { max-width: 220px; }
.offer-total { text-align: right; font-size: 18px; margin: 6px 0 4px; }
.offer-actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 0 0 16px; }
.offer-actions button.primary { min-width: 180px; }
.danger-text { color: var(--err) !important; }
/* 2.27: formularz obiektu i edytor planu */
.plan-editor h3 { font-size: 15px; margin: 14px 0 6px; }
.plan-count { display: flex; gap: 8px; align-items: center; }
.plan-count input { width: 90px; margin: 0; }
.plan-grid-b input, .plan-grid-w input { margin: 0; min-width: 0; }
.plan-grid-b .pl-name { min-width: 180px; }
.plan-grid-b .pl-q { width: 64px; }
.plan-grid-w input { width: 90px; }
.plan-grid-b tfoot th { white-space: nowrap; }
.new-object { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; padding: 14px 18px; }
.new-object .hint { margin: 0; }
/* 2.28: NIP – pobranie danych z wykazu MF */
.nip-row { display: flex; gap: 8px; align-items: center; }
.nip-row input { margin: 0; flex: 1; min-width: 0; }
.nip-row button { white-space: nowrap; }
.nip-info { display: block; margin-top: 4px; }

/* 2.29: zlecający */
.party-h { margin-top: 18px; }
.orderer-toggle { margin-bottom: 8px; }
/* 2.30: plan instalacji osobno dla systemów – zakładki systemów (edytor planu, raport) */
.plan-tabs, .sys-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 8px; }
.plan-tab, .sys-tab { padding: 7px 14px; border-radius: 999px; font-size: 14px; font-weight: 600; background: #fff;
  border: 1px solid var(--line-2); color: var(--ink-2); cursor: pointer; }
.plan-tab.on, .sys-tab.on { background: var(--ink); border-color: var(--ink); color: #fff; }
.plan-tab[hidden], .plan-tabs[hidden] { display: none; }
.plan-tab .pt-val { font-weight: 400; opacity: .8; }
.plan-editor .sx-hide { display: none; }
.sys-block[hidden] { display: none; }
.sys-h { font-size: 15px; margin: 14px 0 6px; }
.sys-pcts { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 4px 0 0; font-size: 13px; color: var(--muted); }
.sys-pcts b { color: var(--ink-2); }
.bsys { display: block; font-size: 12px; color: var(--muted); margin-top: 2px; }
.el-admin input { margin: 0; }
.el-admin .el-name { min-width: 200px; }
.el-admin .el-unit { width: 70px; }
.el-admin .el-sort { width: 60px; }
.grid tr.subhead th { background: var(--bg-2, #F3F4F6); text-align: left; font-size: 13px; }
/* 2.31: protokoły przerobu */
.prot-table tr.prot-sec th { background: var(--bg-2, #F3F4F6); color: var(--ink); text-align: left; font-size: 13px; }
.prot-table tr.prot-sub td { font-style: italic; color: var(--ink-2); }
.prot-table tfoot td { font-weight: 700; }
.prot-sum { margin: 10px 0 0; }
.prot-period input[type=month], .prot-period input[type=date] { max-width: 220px; }
.prot-att h3 { font-size: 15px; margin: 14px 0 6px; }
.badge.ok { background: #DCFCE7; color: #166534; }
.badge.grey { background: #F3F4F6; color: var(--ink-2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; text-decoration: none; }
.prot-period .pp-row { display: flex; align-items: center; gap: 8px 10px; flex-wrap: wrap; margin: 0 0 10px; }
.prot-period .pp-row input[type=month], .prot-period .pp-row input[type=date] { width: auto; margin: 0; }
.prot-period .pp-opt { display: flex; align-items: center; gap: 8px; font-weight: 600; min-width: 200px; margin: 0; }
.prot-period .pp-opt input { width: auto; margin: 0; }
/* 2.35: kartoteka klientów */
.contact-row { border-top: 1px solid var(--line); padding: 8px 0; }
.contact-row summary { cursor: pointer; }
.contact-row form { margin-top: 10px; }
.party-new { border-left: 3px solid var(--line-2); padding-left: 12px; margin: 6px 0 12px; }

/* 2.57: wyszukiwanie w długich listach wyboru (static/wybor.js) */
.szukaj-box { position: relative; }
.szukaj-inline { display: inline-block; min-width: 240px; vertical-align: middle; }
.szukaj-inline .szukaj-in { margin-top: 0; }
.szukaj-sel { position: absolute !important; left: 0; bottom: 0; width: 1px !important; height: 1px; opacity: 0; pointer-events: none; padding: 0 !important; }
.szukaj-in { padding-right: 34px; background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236B7280' stroke-width='2'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E") no-repeat right 12px center; text-overflow: ellipsis; }
.szukaj-in.szukaj-err { border-color: var(--err); }
.szukaj-list { position: absolute; z-index: 30; left: 0; right: 0; top: calc(100% + 4px); max-height: 320px; overflow-y: auto; background: #fff;
  border: 1px solid var(--line-2); border-radius: 10px; box-shadow: var(--shadow); padding: 4px; min-width: 240px; }
.szukaj-opt { padding: 7px 10px; border-radius: 7px; cursor: pointer; font-weight: 400; color: var(--ink); }
.szukaj-opt:hover, .szukaj-opt.act { background: var(--bg); }
.szukaj-opt.on { font-weight: 600; }
.szukaj-grp { padding: 8px 10px 3px; font-size: 12px; font-weight: 600; color: var(--muted); }
.szukaj-none { padding: 8px 10px; color: var(--muted); font-size: 14px; }

/* 2.59: raport „Miesiąc pracowników” */
.row-sel td { background: var(--accent-soft); }
.pm-h { font-size: 15px; margin: 16px 0 6px; }
.pm-tiles { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); margin: 4px 0 8px; }
.pm-tile { background: #F7F8FA; border-radius: 8px; padding: 10px 12px; }
.pm-tile span { display: block; font-size: 13px; color: var(--muted); }
.pm-tile b { display: block; font-size: 22px; line-height: 1.25; }
.pm-tile small { font-size: 12px; color: var(--ink-2); }
.day-chart { width: 100%; height: auto; display: block; }
.pm-legend { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12px; color: var(--ink-2); margin: 4px 0 0; }
.pm-sw { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }
.pm-proj, .pm-days { width: 100%; border-collapse: collapse; font-size: 14px; }
.pm-proj th, .pm-proj td, .pm-days th, .pm-days td { text-align: left; padding: 5px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
.pm-proj th, .pm-days th { font-size: 13px; color: var(--muted); font-weight: 600; }
.pm-proj .r, .pm-days .r { text-align: right; white-space: nowrap; }
.pm-barcol { width: 34%; }
.pm-bar { display: block; height: 9px; border-radius: 3px; margin-top: 6px; }
.pm-days tr.weekend td { background: #F7F8FA; }
.pm-days tr.missing td { background: var(--err-soft); }
.pm-row + .pm-row { margin-top: 2px; }
/* 2.60: delegacja */
.kind-deleg { background: var(--accent-soft); color: var(--accent-dark); }
.pm-d { color: var(--accent-dark); }
.deleg-pick { margin: 0 0 12px; }

/* 2.61: wynagrodzenia – karta wypłaty */
.pay-card { width: 100%; border-collapse: collapse; font-size: 15px; }
.pay-card td { padding: 5px 4px; border-bottom: 1px solid var(--line); }
.pay-card .r { text-align: right; white-space: nowrap; }
.pay-card tr.sum td { font-weight: 700; border-top: 1px solid var(--line-2); }
.pay-card tr.big td { font-size: 18px; background: var(--accent-soft); }
.pay-table td.r, .pay-table th.r { white-space: nowrap; }

/* 2.62: podpowiedź pod tabelą nie nachodzi na pasek sumy (.hint ma ujemny margines – pod polami formularza) */
.tablewrap + .hint, table + .hint, .tablewrap + p, table.grid + p { margin-top: 10px; }
table.grid tfoot tr:last-child th:first-child, table.grid tfoot tr:last-child td:first-child { border-bottom-left-radius: 10px; }
table.grid tfoot tr:last-child th:last-child, table.grid tfoot tr:last-child td:last-child { border-bottom-right-radius: 10px; }

/* 2.69: szukanie faktur */
.inv-search { display: flex; gap: 6px; align-items: center; flex: 1 1 320px; }
.inv-search input[type=search] { flex: 1; min-width: 200px; margin: 0; }
.inv-found { margin: 0 0 10px; }

/* 2.70: pozycja faktury tylko do wiadomości (nie liczona w zleceniu) */
.nocount-row td { color: var(--muted); }

/* 2.71: adnotacja dla księgowej */
.badge.warn { background: #FDF0DC; color: var(--err); }
a.badge.warn { text-decoration: none; }
.acc-cell { min-width: 90px; }
.acc-ok { cursor: help; margin-left: 0; }

/* 2.74: zestawienie dla księgowej */
.acc-sum { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.acc-sum div { border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; background: var(--card, #fff); }
.acc-sum span { display: block; font-size: 13px; color: var(--muted); }
.acc-sum b { display: block; font-size: 20px; }
.acc-sum small { font-size: 12px; color: var(--muted); }
.acc-sum .acc-sum-warn { border-color: var(--err); }
.acc-sum .acc-sum-warn b { color: var(--err); }
.acc-groups { margin: 10px 0 0; font-size: 14px; }
.acc-list { width: 100%; border-collapse: collapse; }
.acc-list thead th { background: #23272E; color: #fff; text-align: left; font-size: 13px; padding: 8px 10px; }
.acc-list thead th:first-child { border-top-left-radius: 10px; } .acc-list thead th:last-child { border-top-right-radius: 10px; }
.acc-list th.r, .acc-list td.r { text-align: right; }
.acc-list td { padding: 6px 10px; vertical-align: top; }
.acc-list .acc-main td { border-top: 1px solid var(--line); padding-top: 10px; }
.acc-list .acc-sub td { padding-bottom: 12px; }
.acc-lp, .acc-ksef { color: var(--muted); font-size: 12px; }
.acc-tag { font-size: 12px; font-weight: 600; background: var(--accent-soft); color: var(--accent); border-radius: 4px; padding: 0 6px; }
.acc-where { font-size: 13px; color: var(--muted); margin-bottom: 4px; }
.acc-w + .acc-w::before { content: " · "; }
.acc-todo { color: var(--err); font-weight: 600; }
.acc-note { border-left: 3px solid var(--accent); background: var(--accent-soft); border-radius: 0 6px 6px 0; padding: 6px 10px; white-space: pre-line; }
.acc-note-h { font-weight: 700; color: var(--accent); }
.acc-missing { border-left-color: var(--err); background: #FDF6E9; }
.acc-missing .acc-note-h { color: var(--err); }
.acc-skip td { color: var(--muted); }

/* 2.75: koszty z list płac (Wynagrodzenia) */
.lc-grid { display: grid; grid-template-columns: 1fr 150px; gap: 8px 14px; align-items: center; margin-bottom: 12px; }
.lc-grid label { margin: 0; }
.lc-grid label .opt { display: block; font-weight: 400; font-size: 12px; margin-top: 2px; }
.lc-grid input { text-align: right; margin: 0; }
@media (max-width: 600px) { .lc-grid { grid-template-columns: 1fr 120px; } }
.res-table { width: 100%; }
.res-table td.r, .res-table th.r { white-space: nowrap; }
.res-table tr.res-future td { color: var(--muted); }
.res-detail td.r { white-space: nowrap; }
.res-detail tr.sub td { color: var(--muted); font-size: 14px; padding-left: 22px; }
.res-table tr.sel td { background: var(--accent-soft); }

/* 2.76: zakładki modułu (Finanse) pod górnym menu */
.subtabs { display: flex; gap: 4px; flex-wrap: wrap; margin: 0 0 16px; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.subtabs a { padding: 7px 12px; border-radius: 8px; color: var(--ink-2); font-weight: 600; font-size: 14px; text-decoration: none; }
.subtabs a:hover { background: var(--accent-soft); }
.subtabs a.on { background: var(--ink); color: #fff; }
@media (max-width: 600px) { .subtabs { flex-wrap: nowrap; overflow-x: auto; } .subtabs a { white-space: nowrap; } }
.fc-table th a { color: inherit; text-decoration: none; }
.fc-table th a.on { text-decoration: underline; font-weight: 700; }
.fc-table td.fc-sel { background: var(--accent-soft); }
tr.fc-muted td { color: var(--muted); }
tr.fc-group td { background: var(--accent-soft); }

/* 2.77: ustawienia w Wynagrodzeniach (mini menu), poprawki godzin */
.set-tabs { margin: 0 0 14px; }
.set-panel[hidden] { display: none; }
.pm-edit { margin-left: 6px; }
.people-filter { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.people-filter select { width: auto; min-width: 240px; margin: 0; }
.set-panel .lc-grid { max-width: 560px; }
.set-save { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-top: 6px; }
.set-save .hint { margin: 0; }
.pay-people { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 6px 16px; margin-bottom: 12px; }

/* 2.80: kalkulator JDG */
.cj-inv input, .cj-inv select { width: 100%; min-width: 0; }
.cj-inv .cj-num { text-align: right; max-width: 140px; }
.cj-inv td:last-child { width: 1%; }
.cj-kwoty { margin-top: 12px; }
.cj-kwoty summary { cursor: pointer; color: var(--accent); }
.cj-kwoty .lc-grid { margin-top: 10px; max-width: 760px; }
.cj-sum { max-width: 640px; }
@media (max-width: 600px) {
  .cj-inv thead { display: none; }
  .cj-inv tr { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)) auto; gap: 6px; padding: 8px 0; border-bottom: 1px solid var(--line, #ddd); }
  .cj-inv td { display: block; padding: 0; border: 0; width: auto !important; }
  .cj-inv td:first-child { grid-column: 1 / -1; }
  .cj-inv .cj-num { max-width: none; }
  .cj-inv select { padding-left: 6px; padding-right: 2px; }
  .cj-inv input[name=opis]::placeholder { color: var(--muted, #888); }
}

/* 2.81: rozliczenie zaliczek */
.adv-sum { max-width: 520px; }
.adv-add { display: grid; grid-template-columns: 150px 170px minmax(0, 1fr) 130px auto; gap: 8px; align-items: end; margin-top: 12px; }
.adv-add button { height: 40px; }
.adv-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; justify-content: space-between; }
.adv-actions form:last-child { margin-left: auto; }
@media (max-width: 700px) { .adv-add { grid-template-columns: 1fr 1fr; } .adv-add .adv-note { grid-column: 1 / -1; } }

/* 2.85: przełącznik motywu (jasny / ciemny) – przycisk w pasku górnym; wybór w przeglądarce (localStorage „motyw”),
   bez wyboru – wg ustawienia systemu. Atrybut html[data-theme] ustawia skrypt w <head> base.html (bez mignięcia). */
.theme-btn { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; padding: 0; border-radius: 8px;
  border: 1px solid transparent; background: transparent; color: var(--ink-2); font-size: 17px; line-height: 1; }
.theme-btn:hover { background: var(--bg); border-color: var(--line); color: var(--ink); }
.theme-btn .tb-dark, html[data-theme="dark"] .theme-btn .tb-light { display: none; }
html[data-theme="dark"] .theme-btn .tb-dark { display: inline; }
.theme-float { position: fixed; right: 14px; bottom: 14px; background: var(--card); border-color: var(--line); box-shadow: var(--shadow); }

/* 2.91: Planer – siatka pracownicy × dni; paski zleceń w kolorze zlecenia (--h = odcień, bez czerwieni) */
.pl-bar-top { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; margin-bottom: 12px; }
.pl-bar-top .pl-period { font-size: 18px; font-weight: 700; min-width: 190px; text-align: center; }
.pl-wrap { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 14px; align-items: start; }
.pl-orders { position: sticky; top: 70px; max-height: calc(100vh - 90px); display: flex; flex-direction: column; gap: 8px; padding: 12px; }
.pl-orders h2 { margin: 0; font-size: 15px; }
.pl-orders input { margin: 0; }
.pl-olist { overflow-y: auto; display: flex; flex-direction: column; gap: 4px; margin: 0 -4px; padding: 0 4px; }
.pl-chip { display: block; width: 100%; text-align: left; padding: 6px 8px 6px 10px; border-radius: 8px; border: 1px solid var(--line);
  border-left: 6px solid hsl(var(--h) 45% 45%); background: var(--card); color: var(--ink); font-size: 13px; line-height: 1.25; cursor: pointer; }
.pl-chip small { display: block; color: var(--muted); font-size: 12px; }
.pl-chip:hover { background: var(--bg); }
.pl-chip.on { background: hsl(var(--h) 60% 90%); border-color: hsl(var(--h) 45% 45%); box-shadow: 0 0 0 2px hsl(var(--h) 45% 45%) inset; }
.pl-chip[hidden] { display: none; }
.pl-sel { font-size: 13px; padding: 8px; border-radius: 8px; background: var(--accent-soft); border: 1px solid var(--accent-line); }
.pl-board { padding: 0; overflow-x: auto; }
.pl-grid { --name: 150px; min-width: calc(var(--name) + var(--n) * var(--cw)); user-select: none; -webkit-user-select: none; }
.pl-row { display: grid; grid-template-columns: var(--name) minmax(0, 1fr); border-bottom: 1px solid var(--line); }
.pl-row:last-child { border-bottom: 0; }
.pl-name { position: sticky; left: 0; z-index: 3; background: var(--card); padding: 8px 10px; border-right: 1px solid var(--line-2);
  font-weight: 600; font-size: 14px; display: flex; flex-direction: column; justify-content: center; }
.pl-name small { font-weight: 400; color: var(--muted); font-size: 12px; }
.pl-track { display: grid; grid-template-columns: repeat(var(--n), minmax(0, 1fr)); grid-template-rows: repeat(var(--lanes, 1), var(--lh)) minmax(0, 1fr);
  position: relative; padding: 3px 0; }
.pl-grid.mode-week { --cw: 110px; --lh: 44px; }
.pl-grid.mode-month { --cw: 32px; --lh: 30px; }
.pl-cell { grid-row: 1 / -1; border-right: 1px solid var(--line); margin: -3px 0; }
.pl-cell.we { background: var(--bg); }
.pl-cell.td { background: var(--accent-soft); box-shadow: inset 2px 0 0 var(--accent), inset -2px 0 0 var(--accent); }
.pl-cell.off { background-image: repeating-linear-gradient(135deg, transparent 0 5px, var(--line-2) 5px 6px); }
.pl-off { grid-row: 1; align-self: start; justify-self: center; font-size: 10px; font-weight: 700; color: var(--err); z-index: 1;
  pointer-events: none; margin-top: -2px; }
.pl-head .pl-name { font-weight: 400; color: var(--muted); font-size: 12px; }
.pl-head .pl-track { grid-template-rows: auto; padding: 0; }
.pl-day { text-align: center; padding: 6px 0; font-size: 12px; color: var(--muted); border-right: 1px solid var(--line); line-height: 1.2; }
.pl-day b { display: block; font-size: 15px; color: var(--ink); }
.pl-day.we { background: var(--bg); }
.pl-day.td { background: var(--accent); color: #fff; } .pl-day.td b { color: #fff; }
.pl-grid.mode-month .pl-day b { font-size: 13px; }
.pl-bar { position: relative; z-index: 2; margin: 3px 2px; padding: 3px 8px; border-radius: 7px; overflow: hidden; white-space: nowrap;
  text-overflow: ellipsis; font-size: 12px; line-height: 1.3; color: var(--ink); cursor: grab; touch-action: none;
  background: hsl(var(--h) 62% 88%); border: 1px solid hsl(var(--h) 40% 72%); border-left: 5px solid hsl(var(--h) 45% 42%); }
.pl-bar b { font-weight: 700; }
.pl-bar span { display: block; overflow: hidden; text-overflow: ellipsis; color: var(--ink-2); }
.pl-grid.mode-month .pl-bar { padding: 2px 5px; font-size: 11px; } .pl-grid.mode-month .pl-bar span { display: none; }
.pl-bar.cut-l { border-left-style: dashed; border-top-left-radius: 0; border-bottom-left-radius: 0; }
.pl-bar.cut-r { border-top-right-radius: 0; border-bottom-right-radius: 0; border-right-style: dashed; }
.pl-bar.ghost { opacity: .75; pointer-events: none; box-shadow: var(--shadow-lg); }
.pl-bar.dragging { opacity: .35; }
.pl-bar .pl-h { position: absolute; top: 0; bottom: 0; width: 9px; cursor: ew-resize; }
.pl-bar .pl-h.l { left: 0; } .pl-bar .pl-h.r { right: 0; }
.pl-grid.picking .pl-track { cursor: crosshair; touch-action: none; }
/* 2.96: podgląd (bez zmian) – sama siatka, klik w pasek pokazuje opis; podpis grup wierszy */
.pl-wrap.view { grid-template-columns: minmax(0, 1fr); }
.pl-grid.view .pl-bar { cursor: pointer; touch-action: auto; }
.pl-group { padding: 5px 10px; font-size: 12px; font-weight: 600; color: var(--muted); background: var(--bg); border-bottom: 1px solid var(--line); }
.pl-group span { position: sticky; left: 10px; }
/* 2.98: blokada Planera – zablokowany = samo przeglądanie (bez panelu zleceń, bez uchwytów, palec przewija siatkę) */
.pl-lock { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 8px 14px; margin-left: auto; font-weight: 600; }
.pl-lock .lk-off { display: none; }
.pl-lock[aria-pressed="false"] { background: var(--accent); border-color: var(--accent); color: #fff; }
.pl-lock[aria-pressed="false"] .lk-on { display: none; } .pl-lock[aria-pressed="false"] .lk-off { display: inline; }
.pl-wrap.locked { grid-template-columns: minmax(0, 1fr); }
.pl-wrap.locked .pl-orders { display: none; }
.pl-wrap.locked .pl-bar { cursor: pointer; touch-action: auto; }
.pl-wrap.locked .pl-bar .pl-h { display: none; }
.pl-wrap.locked .pl-grid.picking .pl-track { cursor: default; touch-action: auto; }
/* 3.01: kilka zleceń jednego dnia – przy odblokowanej edycji pusty pas „+” na dole wiersza (pod paskami), tam powstaje nowy pasek */
.pl-grid.mode-week { --add: 24px; } .pl-grid.mode-month { --add: 20px; }
.pl-add { display: none; }
.pl-wrap:not(.locked):not(.view) .pl-track[data-user] { grid-template-rows: repeat(var(--lanes, 1), var(--lh)) var(--add); }
.pl-wrap:not(.locked):not(.view) .pl-add { display: flex; align-items: center; justify-content: center; grid-row: -2 / -1; z-index: 1;
  margin: 0 3px 2px; border: 1px dashed var(--line-2); border-radius: 6px; font-size: 13px; line-height: 1; color: var(--muted); }
.pl-grid.picking .pl-add { color: var(--accent); border-color: var(--accent-line); }
.pl-grid.picking .pl-add:hover { background: var(--accent-soft); }
.pl-dlg dl { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; margin: 8px 0 0; font-size: 14px; }
.pl-dlg dt { color: var(--muted); } .pl-dlg dd { margin: 0; }
.pl-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 12px; color: var(--muted); margin-top: 10px; }
.pl-legend i { display: inline-block; width: 14px; height: 10px; vertical-align: -1px; margin-right: 4px; border: 1px solid var(--line-2); }
.pl-legend .lg-off { background-image: repeating-linear-gradient(135deg, transparent 0 3px, var(--line-2) 3px 4px); }
.pl-legend .lg-td { background: var(--accent-soft); border-color: var(--accent); } .pl-legend .lg-we { background: var(--bg); }
.pl-dlg { border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; max-width: 420px; width: calc(100% - 32px);
  background: var(--card); color: var(--ink); box-shadow: var(--shadow-lg); }
.pl-dlg::backdrop { background: rgba(16, 24, 40, .35); }
.pl-dlg h2 { margin: 0 0 4px; } .pl-dlg .row2 { margin-top: 8px; }
.pl-dlg .pl-dlg-btns { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.pl-dlg .pl-dlg-btns .danger { margin-left: auto; }
.pl-toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 50; background: var(--head); color: #fff;
  padding: 10px 16px; border-radius: 10px; box-shadow: var(--shadow-lg); font-size: 14px; max-width: calc(100% - 32px); }
.pl-toast[hidden] { display: none; }
.order-plan { margin: 0; padding-left: 18px; } .order-plan li { margin: 2px 0; }
@media (max-width: 900px) {
  .pl-wrap { grid-template-columns: 1fr; }
  .pl-orders { position: static; max-height: none; }
  .pl-olist { max-height: 210px; }
  .pl-grid { --name: 104px; }
  .pl-grid.mode-week { --cw: 84px; }
}

/* 2.92: Zlecenia – lista, tablica statusów, oś czasu, mapa; Finanse – podsumowanie zleceń. Kolory statusów: --st-<status> */
:root { --st-otwarte: #9AA3AF; --st-w_realizacji: #2F5F8A; --st-zakonczone: #3D9A55; --st-rozliczone: #C4C9D0; --c-cost: #B9893A;
  --bar-ink: #FFFFFF; --bar-ink-2: #1B1D21; }
.o-name { display: block; font-size: 18px; font-weight: 700; line-height: 1.25; color: var(--ink); }
a.o-name { text-decoration: none; } a.o-name:hover { color: var(--accent); text-decoration: underline; }
.o-obj { display: block; font-size: 15px; font-weight: 600; color: var(--ink-2); margin-top: 2px; }
.o-meta { font-size: 12.5px; color: var(--muted); margin-top: 4px; }
.o-meta .cat-tag { font-size: 11.5px; padding: 0 6px; margin: 0 3px 0 0; }
.o-val { font-size: 17px; font-weight: 700; }
table.orders-list td { padding-top: 12px; padding-bottom: 12px; vertical-align: top; }
.late { color: var(--err); font-weight: 700; }
.ost { display: inline-block; border-radius: 999px; padding: 1px 10px; font-size: 13px; font-weight: 600; white-space: nowrap; }
.ost-otwarte { background: #EEF0F3; color: var(--ink-2); }
.ost-w_realizacji { background: #E7F0FB; color: #1C5CAB; }
.ost-zakonczone { background: var(--ok-soft); color: var(--ok); }
.ost-rozliczone { background: #F3F4F6; color: var(--muted); }
.ost-bar-otwarte { background: var(--st-otwarte); color: var(--bar-ink-2); }
.ost-bar-w_realizacji { background: var(--st-w_realizacji); color: var(--bar-ink); }
.ost-bar-zakonczone { background: var(--st-zakonczone); color: var(--bar-ink); }
.ost-bar-rozliczone { background: var(--st-rozliczone); color: var(--bar-ink-2); }
.zl-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 13px; color: var(--ink-2); margin-top: 10px; }
.zl-legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.zl-list { list-style: none; margin: 0 0 8px; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.zl-list li { line-height: 1.4; }
/* tablica statusów – 2.94: poziome pasy jeden pod drugim, karty w siatce */
.kb { display: flex; flex-direction: column; gap: 12px; padding-bottom: 6px; }
.kb-col { background: var(--accent-soft); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; min-width: 0;
  transition: box-shadow .15s; }
.kb-col.over { box-shadow: 0 0 0 2px var(--accent) inset; }
.kb-h { display: flex; align-items: baseline; gap: 12px; font-weight: 700; font-size: 15px; padding: 2px 2px 6px; cursor: pointer;
  list-style: none; border-bottom: 3px solid var(--st-otwarte); }
.kb-h::-webkit-details-marker { display: none; }
.kb-t::before { content: "▾ "; color: var(--muted); }
.kb-col:not([open]) .kb-t::before { content: "▸ "; }
.kb-col:not([open]) .kb-h { padding-bottom: 2px; }
.kb-h .kb-note { font-weight: 400; margin-left: auto; }
.kb-col[open] .kb-list { margin-top: 10px; }
.kb-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); align-items: start; }
.kb-col:not(.all) .kb-card.kb-extra { display: none; }
.kb-more { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; margin-top: 8px; }
.kb-h-w_realizacji { border-bottom-color: var(--st-w_realizacji); } .kb-h-zakonczone { border-bottom-color: var(--st-zakonczone); }
.kb-h-rozliczone { border-bottom-color: var(--st-rozliczone); }
.kb-sum { font-size: 12.5px; color: var(--muted); font-weight: 600; white-space: nowrap; }
.kb-list { gap: 10px; min-height: 40px; }
.kb-card { display: flex; flex-direction: column; gap: 4px; background: var(--card); border: 1px solid var(--line); border-radius: 9px; padding: 10px;
  color: var(--ink); text-decoration: none !important; box-shadow: var(--shadow); }
.kb-card[draggable="true"] { cursor: grab; }
.kb-card:hover { border-color: var(--accent-line); }
.kb-card.dragging { opacity: .4; }
.kb-card.is-late { border-color: var(--err); box-shadow: inset 4px 0 0 var(--err), var(--shadow); }
.kb-card .o-name { font-size: 15.5px; } .kb-card .o-obj { font-size: 13.5px; }
.kb-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 13px; }
.kb-due { color: var(--muted); }
.kb-bar { display: block; height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; }
.kb-bar i { display: block; height: 100%; background: var(--st-zakonczone); }
.kb-empty { margin: 4px 2px; }
/* oś czasu */
.tl-top { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; margin-bottom: 10px; }
.tl-scroll { overflow-x: auto; }
.tl { min-width: 860px; }
.tl-row { display: grid; grid-template-columns: 270px minmax(0, 1fr); align-items: center; border-bottom: 1px solid var(--line); min-height: 50px; }
.tl-head { min-height: 30px; border-bottom-color: var(--line-2); }
.tl-lab { padding: 6px 12px 6px 0; min-width: 0; }
.tl-lab .o-name { font-size: 14.5px; } .tl-lab .o-obj { font-size: 12.5px; font-weight: 500; }
.tl-track { position: relative; height: 50px; }
.tl-head .tl-track { height: 30px; }
.tl-m { position: absolute; top: 6px; font-size: 12px; color: var(--muted); font-weight: 600; border-left: 1px solid var(--line-2); padding-left: 5px; height: 24px; white-space: nowrap; }
.tl-m.y { color: var(--ink-2); }
.tl-g { position: absolute; top: 0; bottom: 0; border-left: 1px dashed var(--line); }
.tl-today { position: absolute; top: 0; bottom: 0; border-left: 2px solid var(--accent); z-index: 2; }
.tl-today b { position: absolute; top: 4px; left: 4px; font-size: 11px; color: var(--accent); background: var(--card); padding: 0 3px; }
.tl-bar { position: absolute; top: 13px; height: 24px; border-radius: 6px; font-size: 12px; font-weight: 600; padding: 3px 8px; line-height: 18px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-decoration: none !important; z-index: 1; }
a.tl-bar:hover { box-shadow: 0 0 0 2px var(--accent); }
.tl-bar.cut-l { border-top-left-radius: 0; border-bottom-left-radius: 0; }
.tl-bar.cut-r { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.tl-bar.tl-open { border-top-right-radius: 0; border-bottom-right-radius: 0; border-right: 3px dashed var(--card);
  -webkit-mask-image: linear-gradient(to right, #000 85%, rgba(0,0,0,.35)); mask-image: linear-gradient(to right, #000 85%, rgba(0,0,0,.35)); }
.o-dates { margin: 4px 0 10px; font-size: 14px; color: var(--ink-2); }
.tl-late { background: var(--err); opacity: .85; }
span.tl-bar.tl-late { padding: 0; }
.zl-legend i.tl-late { opacity: 1; }
/* mapa */
.map-wrap { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 14px; align-items: start; }
.zl-map { height: 560px; border-radius: 10px; border: 1px solid var(--line); z-index: 0; }
.map-side h2 { font-size: 16px; }
.map-pop ul { margin: 6px 0 0; padding-left: 16px; }
.map-pop li { margin-bottom: 4px; }
/* podsumowanie zleceń (Finanse) */
.os-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 14px; align-items: start; }
.hb { display: grid; grid-template-columns: minmax(120px, 230px) minmax(0, 1fr) 96px; gap: 10px; align-items: center; font-size: 13px; padding: 6px 0;
  border-bottom: 1px solid var(--line); }
.hb:last-child { border-bottom: 0; }
.hb .nm { min-width: 0; } .hb .nm a { font-weight: 600; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hb .nm small { display: block; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hb .trk { position: relative; height: 22px; }
.hb .trk i { position: absolute; left: 0; border-radius: 3px; }
.hb .trk .v { top: 0; height: 22px; background: var(--line-2); }
.hb .trk .i { top: 3px; height: 7px; background: var(--st-w_realizacji); }
.hb .trk .c { top: 12px; height: 7px; background: var(--c-cost); }
.hb-legend i.v { background: var(--line-2); } .hb-legend i.i { background: var(--st-w_realizacji); } .hb-legend i.c { background: var(--c-cost); }
.alert-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.alert-list li { border-left: 3px solid var(--err); padding: 4px 0 4px 10px; font-size: 13.5px; }
.alert-list li.al-costs { border-left-color: var(--c-cost); }
.alert-list b { display: block; font-size: 14.5px; }
details.fo-proj { border-bottom: 1px solid var(--line); }
details.fo-proj > summary { cursor: pointer; list-style: none; display: grid; grid-template-columns: minmax(0, 1fr) repeat(5, 120px); gap: 8px;
  padding: 10px 6px; align-items: baseline; }
details.fo-proj > summary::-webkit-details-marker { display: none; }
details.fo-proj > summary > span:first-child::before { content: "▸ "; color: var(--muted); }
details.fo-proj[open] > summary > span:first-child::before { content: "▾ "; }
details.fo-proj > summary:hover { background: var(--bg); }
.fo-head { display: grid; grid-template-columns: minmax(0, 1fr) repeat(5, 120px); gap: 8px; padding: 6px; font-size: 13px; color: var(--muted);
  font-weight: 600; border-bottom: 1px solid var(--line-2); }
.fo-list { min-width: 760px; }
.card details table.fo-inner { width: 100%; max-width: none; margin: 0 0 12px; }
@media (max-width: 900px) {
  .map-wrap, .os-grid { grid-template-columns: 1fr; }
  .zl-map { height: 420px; }
  .hb { grid-template-columns: 110px minmax(0, 1fr) 80px; }
}

/* 3.0: Koszty miesiąca (Finanse) – ostrzeżenia tylko zmiennymi (ciemny motyw bez dodatkowych reguł) */
.mc-form { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; margin-bottom: 10px; }
.mc-form input[type=text] { width: 7em; }
.mc-proj { padding: 14px 6px 4px; border-bottom: 1px solid var(--line-2); }
details.mc-order > summary > span:first-child { padding-left: 14px; }
.mc-flag { display: inline-block; font-size: 12px; font-weight: 600; color: var(--err); background: var(--err-soft); border: 1px solid var(--err);
  border-radius: 6px; padding: 0 6px; margin: 2px 0 2px 6px; line-height: 1.5; }
tr.mc-warn > td { background: var(--err-soft); }
.mc-links { margin: -6px 0 12px; }
.mc-h3 { font-size: 15px; margin: 12px 0 6px; }

/* Ciemny motyw – tylko na ekranie (wydruk zawsze jasny). Te same nazwy zmiennych; poniżej poprawki miejsc z kolorem wpisanym na stałe. */
@media screen {
html[data-theme="dark"] {
  color-scheme: dark;
  --accent: #79A9D6; --accent-dark: #9CC0E2; --accent-soft: #1D2935; --accent-line: #35506B;
  --ink: #E6E8EB; --ink-2: #C4C9D0; --muted: #8E959F; --line: #2C3138; --line-2: #3B414A;
  --bg: #121417; --card: #1A1D22; --head: #0D0F12;
  --ok: #63C07F; --ok-soft: #15261A; --err: #E2AA4F; --err-soft: #2A2114;
  --shadow: 0 1px 2px rgba(0,0,0,.35), 0 1px 3px rgba(0,0,0,.4); --shadow-lg: 0 10px 30px rgba(0,0,0,.5);
  --bg-2: #22262C; --dk-raise: #22262C; --dk-row: #1E2126; --dk-hover: #252A31;
}
/* białe tła → karta / pole */
html[data-theme="dark"] .top, html[data-theme="dark"] .nav-drop, html[data-theme="dark"] .start-todo a, html[data-theme="dark"] nav.sub a,
html[data-theme="dark"] .chip, html[data-theme="dark"] .seg, html[data-theme="dark"] .cal-d, html[data-theme="dark"] .plan-tab,
html[data-theme="dark"] .sys-tab, html[data-theme="dark"] .szukaj-list, html[data-theme="dark"] button, html[data-theme="dark"] .btn,
html[data-theme="dark"] button.danger { background-color: var(--card); }
html[data-theme="dark"] input, html[data-theme="dark"] select, html[data-theme="dark"] textarea,
html[data-theme="dark"] .szukaj-in { background-color: #14171B; }
html[data-theme="dark"] input:focus, html[data-theme="dark"] select:focus, html[data-theme="dark"] textarea:focus { box-shadow: 0 0 0 3px rgba(121,169,214,.25); }
html[data-theme="dark"] input[type=checkbox] { background: transparent; }
html[data-theme="dark"] .theme-btn { background: transparent; }
html[data-theme="dark"] .theme-float { background: var(--card); }
html[data-theme="dark"] button.danger:hover { background-color: var(--err-soft); }
html[data-theme="dark"] .nav-search input { background-color: var(--bg); }
/* przyciski główne – ciemniejszy akcent, żeby biały napis był czytelny */
html[data-theme="dark"] button.primary, html[data-theme="dark"] .btn.primary { background: #2F6496; border-color: #2F6496; color: #fff; }
html[data-theme="dark"] button.primary:hover, html[data-theme="dark"] .btn.primary:hover { background: #3A74AA; border-color: #3A74AA; }
html[data-theme="dark"] button.sticky { box-shadow: 0 8px 20px rgba(0,0,0,.5); }
/* elementy „wybrane” (tło --ink + biały napis) – w ciemnym odwrotnie */
html[data-theme="dark"] .chip.on, html[data-theme="dark"] nav.sub a.on, html[data-theme="dark"] .seg a.on, html[data-theme="dark"] .subtabs a.on,
html[data-theme="dark"] .plan-tab.on, html[data-theme="dark"] .sys-tab.on, html[data-theme="dark"] .seg-opt input:checked + span,
html[data-theme="dark"] .cat-instalacje, html[data-theme="dark"] fieldset.el legend, html[data-theme="dark"] .role-master,
html[data-theme="dark"] .seg .cnt { background: var(--ink); border-color: var(--ink); color: var(--bg); }
html[data-theme="dark"] .seg a.on .muted { color: rgba(18,20,23,.7); }
/* jasne szarości → ciemne odcienie */
html[data-theme="dark"] code, html[data-theme="dark"] code.copy, html[data-theme="dark"] .zone-tag, html[data-theme="dark"] .kind-praca,
html[data-theme="dark"] .vs-do_wykonania, html[data-theme="dark"] .vs-anulowany, html[data-theme="dark"] .mv-wydanie,
html[data-theme="dark"] .st-soon, html[data-theme="dark"] .start-tile.soon .st-icon, html[data-theme="dark"] .badge.grey,
html[data-theme="dark"] .cal-add:hover, html[data-theme="dark"] .card-inner, html[data-theme="dark"] .pm-tile { background: var(--dk-raise); }
html[data-theme="dark"] .bar, html[data-theme="dark"] .progress, html[data-theme="dark"] .ub-track { background: #2A2F36; }
html[data-theme="dark"] .ub-track span { background: #9AA3AE; }
html[data-theme="dark"] .start-tile.soon, html[data-theme="dark"] .stage input.noplan { background: var(--dk-row); }
html[data-theme="dark"] table.grid tbody tr:nth-child(even) td { background: var(--dk-row); }
html[data-theme="dark"] table.grid tbody tr:hover td { background: var(--dk-hover); }
html[data-theme="dark"] .day-report tr.weekend td, html[data-theme="dark"] .pm-days tr.weekend td, html[data-theme="dark"] .cal-d.we { background: #16191D; }
html[data-theme="dark"] .acc-list thead th { background: var(--head); }
html[data-theme="dark"] svg.chart .hit:hover rect { fill: rgba(255,255,255,.05); }
/* kolorowe znaczniki (statusy, rodzaje, ruchy magazynu) */
html[data-theme="dark"] .kind-urlop, html[data-theme="dark"] .vs-zaplanowany, html[data-theme="dark"] .mv-zwrot { background: #1B2A3D; color: #8DB8E8; }
html[data-theme="dark"] .kind-l4, html[data-theme="dark"] .vs-przelozony, html[data-theme="dark"] .mv-korekta { background: #2E2712; color: #E3C46A; }
html[data-theme="dark"] .badge.ok { background: #15301E; color: #7FD39A; }
html[data-theme="dark"] .badge.warn, html[data-theme="dark"] .acc-missing { background: var(--err-soft); }
html[data-theme="dark"] .start-todo .todo-warn { border-left-color: #D49A3A; }
html[data-theme="dark"] .start-todo .todo-warn b, html[data-theme="dark"] .term-wygasa { color: #E0A24A; }
html[data-theme="dark"] .inv-lines tr.done td { background: #14231A; }
html[data-theme="dark"] tr.low td { background: #2A1C1C; }
/* obramowania ostrzeżeń / komunikatów */
html[data-theme="dark"] .flash.ok { border-color: #24452E; }
html[data-theme="dark"] .flash.err, html[data-theme="dark"] button.danger, html[data-theme="dark"] .danger-zone,
html[data-theme="dark"] .overdue-card { border-color: #5A4420; }
/* wykresy SVG (kolory wpisane w atrybutach – dashboard.py, reports.py, results.py) */
html[data-theme="dark"] svg.chart line[stroke="#E5E7EB"], html[data-theme="dark"] svg.chart line[stroke="#E3E6EA"] { stroke: #2C3138; }
html[data-theme="dark"] svg.chart line[stroke="#D1D5DB"], html[data-theme="dark"] svg.chart line[stroke="#9AA3AE"] { stroke: #4A515B; }
html[data-theme="dark"] svg.chart [fill="#3A3F47"] { fill: #8E98A4; }
html[data-theme="dark"] svg.chart [fill="#2F5F8A"] { fill: #4F89C0; }
html[data-theme="dark"] svg.chart [fill="#8A5300"] { fill: #C08A3E; }
html[data-theme="dark"] svg.chart [stroke="#2F5F8A"] { stroke: #79A9D6; }
html[data-theme="dark"] svg.chart circle[stroke="#fff"] { stroke: var(--card); }
html[data-theme="dark"] svg.chart [fill="rgba(47,95,138,0.10)"] { fill: rgba(121,169,214,.14); }
html[data-theme="dark"] svg.chart [fill="#EEF0F3"] { fill: #1E2227; }
html[data-theme="dark"] svg.chart text[fill="#1B1D21"], html[data-theme="dark"] svg.chart text[fill="#374151"] { fill: #C4C9D0; }
html[data-theme="dark"] svg.chart text[fill="#6B7280"] { fill: #8E959F; }
html[data-theme="dark"] svg.chart text[fill="#244A6C"] { fill: #9CC0E2; }
html[data-theme="dark"] .key[style*="#3A3F47"] { background: #8E98A4 !important; }
/* 2.91: Planer – paski i wybrane zlecenie w ciemnym wariancie odcienia */
html[data-theme="dark"] .pl-bar { background: hsl(var(--h) 32% 24%); border-color: hsl(var(--h) 30% 34%); border-left-color: hsl(var(--h) 55% 62%); }
html[data-theme="dark"] .pl-chip { border-left-color: hsl(var(--h) 55% 62%); }
html[data-theme="dark"] .pl-chip.on { background: hsl(var(--h) 32% 22%); border-color: hsl(var(--h) 55% 62%); box-shadow: 0 0 0 2px hsl(var(--h) 55% 62%) inset; }
html[data-theme="dark"] .pl-day.td, html[data-theme="dark"] .pl-day.td b { color: #0D0F12; }
html[data-theme="dark"] .pl-toast { background: #2C3138; color: var(--ink); }
html[data-theme="dark"] .pl-dlg::backdrop { background: rgba(0, 0, 0, .55); }
html[data-theme="dark"] .pl-lock[aria-pressed="false"] { background: #2F6496; border-color: #2F6496; color: #fff; }
/* 2.92: zlecenia – statusy, tablica, oś czasu, mapa, podsumowanie */
html[data-theme="dark"] { --st-otwarte: #5E6672; --st-w_realizacji: #6E9FCC; --st-zakonczone: #5DB377; --st-rozliczone: #3E444D; --c-cost: #D2A35A;
  --bar-ink: #0D0F12; --bar-ink-2: #E6E8EB; }
html[data-theme="dark"] .ost-otwarte, html[data-theme="dark"] .ost-rozliczone { background: var(--dk-raise); }
html[data-theme="dark"] .ost-w_realizacji { background: #1B2A3D; color: #8DB8E8; }
html[data-theme="dark"] .kb-col { background: #16191D; }
html[data-theme="dark"] .kb-bar { background: #2A2F36; }
html[data-theme="dark"] .zl-map .leaflet-tile-pane { filter: brightness(.62) invert(1) contrast(3) hue-rotate(200deg) saturate(.3) brightness(.72); }
html[data-theme="dark"] .zl-map { background: #1F2833; }
html[data-theme="dark"] .zl-map .leaflet-popup-content-wrapper, html[data-theme="dark"] .zl-map .leaflet-popup-tip,
html[data-theme="dark"] .zl-map .leaflet-tooltip, html[data-theme="dark"] .zl-map .leaflet-bar a { background: var(--card); color: var(--ink); border-color: var(--line-2); }
html[data-theme="dark"] .zl-map .leaflet-control-attribution { background: rgba(26,29,34,.8); color: var(--muted); }
html[data-theme="dark"] .zl-map .leaflet-control-attribution a, html[data-theme="dark"] .zl-map .leaflet-popup-content a { color: var(--accent); }
/* logo (czarne napisy) na ciemnym tle – jasna podkładka */
html[data-theme="dark"] .brand img, html[data-theme="dark"] .login-logo img { background: #F4F5F7; border-radius: 6px; padding: 2px 4px; }
}

/* 3.09: folder obiektu na dysku (protokoły przeglądów) */
.fold-err { color: var(--err); font-weight: 600; }
.fold-files { list-style: none; margin: 6px 0 0; padding: 0; columns: 2 320px; }
.fold-files li { padding: 2px 0; break-inside: avoid; }
.fold-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 6px 0; }
.fold-row select { min-width: 260px; max-width: 100%; }

/* 3.10: formularz protokołu przeglądu i zakładki obiektu – równe kolumny, etykiety w jednej linii, przyciski zawsze widoczne */
.ig { display: grid; gap: 14px 16px; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
.ig.c3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.ig > label { margin: 0; min-width: 0; }
.ig > .full { grid-column: 1 / -1; }
.ig > .span2 { grid-column: span 2; }
.ig label > input, .ig label > select, .ig label > textarea { margin-top: 6px; }
.ig textarea, .insp-form textarea { resize: vertical; min-height: 44px; }
.fh { display: block; margin-top: 4px; font-weight: 400; font-size: 12px; color: var(--muted); }
.ig-btn { align-self: end; }
.insp-form .card h2 { margin-top: 0; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.insp-form > .card > label { margin-bottom: 0; }
.insp-actions { position: sticky; bottom: 0; z-index: 5; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 10px 14px;
  margin: 0 0 14px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
@media (max-width: 800px) {
  .ig, .ig.c3 { grid-template-columns: minmax(0, 1fr); }
  .ig > .span2 { grid-column: auto; }
}

/* 3.18: urlopy w Planerze – pasek kreskowany na cały wiersz pracownika (bez czerwieni; kolory --err / --err-soft jak ostrzeżenia) */
.pl-leave { z-index: 1; margin: 2px 1px; border: 1px solid var(--err); border-radius: 7px; color: var(--err); font-size: 11px; font-weight: 600;
  display: flex; align-items: center; padding: 0 8px; overflow: hidden; white-space: nowrap; pointer-events: none;
  background: repeating-linear-gradient(135deg, var(--err-soft) 0 7px, transparent 7px 14px); }
.pl-leave span { background: var(--err-soft); padding: 0 4px; border-radius: 4px; overflow: hidden; text-overflow: ellipsis; }
.pl-leave.k-chorobowe { border-style: dashed; }
.pl-leave.cut-l { border-top-left-radius: 0; border-bottom-left-radius: 0; } .pl-leave.cut-r { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.pl-grid.lv-edit .pl-leave { pointer-events: auto; cursor: pointer; }
.pl-grid.mode-month .pl-leave { font-size: 10px; padding: 0 3px; }
.lg-leave { display: inline-block; width: 18px; height: 10px; border: 1px solid var(--err); border-radius: 3px; vertical-align: middle; margin-right: 6px;
  background: repeating-linear-gradient(135deg, var(--err-soft) 0 4px, transparent 4px 8px); }

/* 3.20: macierz kwalifikacji pracowników (pracownicy × rodzaje) – sticky nagłówek i kolumna, kolory statusów bez czerwieni */
.qm-filters { display: grid; gap: 10px 14px; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); align-items: end; margin-bottom: 10px; }
.qm-filters label { margin: 0; }
.qm-legend { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 0 0 10px; }
.qm-legend .qm-c { padding: 3px 10px; border-radius: 6px; font-size: 12px; font-weight: 600; }
.qm-card { padding: 0; overflow: hidden; }
.qm-wrap { overflow: auto; max-height: calc(100vh - 280px); min-height: 220px; }
table.qm { border-collapse: separate; border-spacing: 0; min-width: 100%; font-size: 13px; }
.qm th, .qm td { padding: 0; border-bottom: 1px solid var(--line); border-right: 1px solid var(--line); background: var(--card); }
.qm thead th { position: sticky; top: 0; z-index: 3; padding: 8px 6px; text-align: center; font-size: 12px; line-height: 1.2; min-width: 96px; max-width: 130px; vertical-align: bottom; white-space: normal; }
.qm thead th small { display: block; font-weight: 400; color: var(--muted); margin-top: 3px; }
.qm .qm-who { position: sticky; left: 0; z-index: 2; text-align: left; padding: 8px 10px; min-width: 150px; max-width: 190px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; box-shadow: 1px 0 0 var(--line); }
.qm thead .qm-who { z-index: 4; }
.qm .qm-p { min-width: 70px; text-align: center; white-space: nowrap; }
.qm thead .qm-p { min-width: 70px; }
.qm-req { color: var(--accent); font-style: normal; margin-left: 2px; }
.qm tr.qm-grp th { position: static; background: var(--bg, #F4F5F7); text-align: left; padding: 6px 10px; font-size: 13px; z-index: 1; left: auto; box-shadow: none; max-width: none; }
.qm tr.qm-grp th span { color: var(--muted); font-weight: 400; }
.qm-b { display: inline-block; min-width: 20px; padding: 1px 6px; margin: 0 1px; border-radius: 10px; font-size: 11px; font-weight: 700; }
.qm-b.b-exp { background: var(--err); color: #fff; } .qm-b.b-soon { background: var(--err-soft); color: var(--err); border: 1px solid var(--err); }
.qm-b.b-miss { background: transparent; color: var(--err); border: 1px dashed var(--err); }
.qm td.qm-c { text-align: center; }
.qm-cell { display: block; width: 100%; min-height: 40px; padding: 5px 4px; border: 0; border-radius: 0; background: transparent; color: inherit; font: inherit; font-size: 12px; cursor: pointer; line-height: 1.25; }
.qm-cell small { display: block; font-size: 10.5px; font-weight: 400; opacity: .85; }
.qm-cell:hover, .qm-cell:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.st-ok { background: var(--ok-soft); color: var(--ok); }
.st-soon { background: var(--err-soft); color: var(--err); font-weight: 600; }
.st-exp { background: var(--err); color: #fff; font-weight: 700; }
.st-perp { background: var(--accent-soft); color: var(--accent); }
.st-miss { background: var(--err-soft); color: var(--err); font-weight: 600; box-shadow: inset 0 0 0 1px var(--err); }
.st-none { color: var(--muted); }
.qm td.st-ok { background: var(--ok-soft); } .qm td.st-soon { background: var(--err-soft); } .qm td.st-exp { background: var(--err); color: #fff; }
.qm td.st-perp { background: var(--accent-soft); } .qm td.st-miss { background: var(--err-soft); } .qm td.st-none { background: var(--card); }
html[data-theme="dark"] .qm td.st-exp { color: #1B1D21; }
.qm-legend .st-none { background: transparent; border: 1px solid var(--line); }
html[data-theme="dark"] .st-exp, html[data-theme="dark"] .qm-b.b-exp { color: #1B1D21; }
@media (max-width: 800px) {
  .qm-wrap { max-height: calc(100vh - 220px); }
  .qm .qm-who { min-width: 118px; max-width: 130px; padding: 6px; font-size: 12px; }
  .qm thead th { min-width: 84px; }
  .qm-filters { grid-template-columns: 1fr 1fr; }
}
/* przycisk komórki macierzy ma przezroczyste tło (nad globalnym stylem przycisków, także w ciemnym motywie) */
.qm td .qm-cell { background: transparent !important; color: inherit !important; border: 0 !important; box-shadow: none !important; }

/* 3.22: lista faktur – zwarty układ (mieści się bez przewijania na ~1400 px), status płatności kolorem */
main.wide.xl { max-width: 1560px; }
.inv-grid { font-size: 13px; }
.inv-grid th, .inv-grid td { padding: 6px 7px; vertical-align: middle; }
.inv-grid td:nth-child(3) { min-width: 130px; max-width: 220px; overflow-wrap: break-word; }
.inv-grid .ksef-no { font-size: 10.5px; letter-spacing: .01em; white-space: nowrap; }
.inv-grid .inv-act-cell { white-space: nowrap; }
.inv-grid .inv-act { display: flex; gap: 4px; align-items: center; }
.inv-grid .inv-act .btn { padding: 4px 8px; }
.pay-cell { min-width: 112px; }
.pay-good { color: var(--ok); font-weight: 700; }
.pay-bad { color: #C62828; font-weight: 700; }
html[data-theme="dark"] .pay-bad { color: #FF8A80; }
@media (max-width: 1100px) {
  .inv-grid th:first-child, .inv-grid td:first-child { position: sticky; left: 0; z-index: 1; background: var(--card); box-shadow: 1px 0 0 var(--line); }
  .inv-grid thead th:first-child { background: #1F2328; }
}

/* 3.24: żeton „Urlop” w panelu zleceń Planera i wybór rodzaju urlopu */
.pl-chip-leave { border-style: dashed; }
.pl-leave-kind { margin: 6px 0 0; font-size: 13px; }
.pl-leave-kind select { margin-top: 4px; }

/* 3.25: urlop bezpłatny w Planerze (neutralny, bez czerwieni) i tabela wymiarów */
.pl-leave.k-bezplatny { border-color: var(--muted); color: var(--ink-2); border-style: dotted;
  background: repeating-linear-gradient(135deg, var(--line) 0 7px, transparent 7px 14px); }
.pl-leave.k-bezplatny span { background: var(--card); }
.lv-sum tr.lv-over td { background: var(--err-soft); }
.lv-person { margin: 0 0 8px; } .lv-person summary { cursor: pointer; padding: 6px 0; }
.lv-person .tablewrap table { width: 100%; }
