/* Faberbit TMS — styl zgodny z makietą */
/* Czcionka Inter jest w programie (static/fonts, licencja OFL) — wygląda tak samo na każdym komputerze, także bez internetu */
@font-face { font-family: "Inter"; src: url("../fonts/Inter-Regular.3a7b195cdd4b.woff") format("woff"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Inter"; src: url("../fonts/Inter-Medium.7942ff0d09ee.woff") format("woff"); font-weight: 500; font-style: normal; font-display: swap; }
@font-face { font-family: "Inter"; src: url("../fonts/Inter-SemiBold.e6398321afd2.woff") format("woff"); font-weight: 600; font-style: normal; font-display: swap; }
@font-face { font-family: "Inter"; src: url("../fonts/Inter-Bold.3ab2a3e33db9.woff") format("woff"); font-weight: 700; font-style: normal; font-display: swap; }
@font-face { font-family: "Inter Display"; src: url("../fonts/InterDisplay-Bold.7df99cc26d29.woff") format("woff"); font-weight: 700; font-style: normal; font-display: swap; }
@font-face { font-family: "Inter Display"; src: url("../fonts/InterDisplay-ExtraBold.adc79abc8e9c.woff") format("woff"); font-weight: 800; font-style: normal; font-display: swap; }

:root {
  /* motyw „Cement i pomarańcz” (0.10.2): mocniejszy kontrast tła, ramek i nagłówków tabel */
  --bg: #DEDBD5; --card: #FFFFFF; --line: #BFB9AE; --line-soft: #E0DCD5; --field: #A39C90; --field-hover: #7F786D;
  --ink: #141618; --muted: #44494E;
  --side: #17191B; --side-ink: #D2D5D8; --side-muted: #8E9399; --side-active: #2E3236; --side-hover: #23262A; --side-mark: #FF7A2E;
  --side-line: #3A3F44;
  --accent: #CF4A0C; --accent-ink: #A93A06; --accent-dark: #842D04; --accent-soft: #FFE9DA; --accent-border: #F5B98F; --accent-chart: #E1600F;
  --blue: #23558A;
  --ok-bg: #D0EDDB; --ok: #13633A; --ok-border: #8FCDA9; --warn-bg: #FAE3A8; --warn: #684100; --warn-border: #E2BC5C;
  --bad-bg: #F7D3CC; --bad: #9C2213; --bad-border: #E39586; --info-bg: #D6E4F4; --info: #1D477A; --info-border: #9DBCE0;
  --gray-bg: #E7E4DF; --gray: #33373B; --purple-bg: #F3DDEC; --purple: #74235C;
  --thead-bg: #2A2D31; --thead-ink: #F3F1EE; --tfoot-bg: #EFECE7; --row-alt: #F7F5F2; --row-hover: #FFF4EC; --row-own: #FFF1E7;
  --tabs-bg: #CCC7BF; --tab-on: #17191B; --tab-on-ink: #FFFFFF; --bar-bg: #E7E4DF; --grid-line: #E4E0DA; --chart-axis: #A39C90;
  --notice-bg: #EFECE7; --up: #12793B; --down: #B0230F; --shadow: 0 1px 0 rgba(0, 0, 0, .06);
  --accent-hover: #A93A06;
}
/* tryb ciemny (Moje konto → Wygląd programu): ciemny zawsze albo „jak w systemie” */
:root[data-theme="dark"] {
  --bg: #121416; --card: #1B1E21; --line: #363B40; --line-soft: #272B2F; --field: #4D545B; --field-hover: #6E757C;
  --ink: #E9EAEB; --muted: #A4AAB0;
  --side: #0B0C0D; --side-ink: #C9CDD1; --side-muted: #80878E; --side-active: #25292D; --side-hover: #181B1E; --side-mark: #FF7A2E;
  --side-line: #2F3439;
  --accent: #E35D16; --accent-ink: #FF9A5C; --accent-dark: #FFB585; --accent-hover: #C94F10; --accent-soft: #33200F;
  --accent-border: #7A3D14; --accent-chart: #F07A2E; --blue: #5B9BE0;
  --ok-bg: #11301F; --ok: #6FD29B; --ok-border: #24603F; --warn-bg: #33290C; --warn: #F2C55C; --warn-border: #6B5516;
  --bad-bg: #3A1813; --bad: #FF8E7E; --bad-border: #7A2F25; --info-bg: #142A44; --info: #8EC2FF; --info-border: #2D5684;
  --gray-bg: #272B2F; --gray: #C9CDD1; --purple-bg: #351E31; --purple: #E9A8DA;
  --thead-bg: #0B0C0D; --thead-ink: #D9DCDF; --tfoot-bg: #212427; --row-alt: #1F2225; --row-hover: #2A231D; --row-own: #2B1F15;
  --tabs-bg: #0E1012; --tab-on: #363B40; --tab-on-ink: #FFFFFF; --bar-bg: #2A2E32; --grid-line: #25292D; --chart-axis: #4D545B;
  --notice-bg: #22262A; --up: #6FD29B; --down: #FF8E7E; --shadow: none;
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root[data-theme="auto"] {
  --bg: #121416; --card: #1B1E21; --line: #363B40; --line-soft: #272B2F; --field: #4D545B; --field-hover: #6E757C;
  --ink: #E9EAEB; --muted: #A4AAB0;
  --side: #0B0C0D; --side-ink: #C9CDD1; --side-muted: #80878E; --side-active: #25292D; --side-hover: #181B1E; --side-mark: #FF7A2E;
  --side-line: #2F3439;
  --accent: #E35D16; --accent-ink: #FF9A5C; --accent-dark: #FFB585; --accent-hover: #C94F10; --accent-soft: #33200F;
  --accent-border: #7A3D14; --accent-chart: #F07A2E; --blue: #5B9BE0;
  --ok-bg: #11301F; --ok: #6FD29B; --ok-border: #24603F; --warn-bg: #33290C; --warn: #F2C55C; --warn-border: #6B5516;
  --bad-bg: #3A1813; --bad: #FF8E7E; --bad-border: #7A2F25; --info-bg: #142A44; --info: #8EC2FF; --info-border: #2D5684;
  --gray-bg: #272B2F; --gray: #C9CDD1; --purple-bg: #351E31; --purple: #E9A8DA;
  --thead-bg: #0B0C0D; --thead-ink: #D9DCDF; --tfoot-bg: #212427; --row-alt: #1F2225; --row-hover: #2A231D; --row-own: #2B1F15;
  --tabs-bg: #0E1012; --tab-on: #363B40; --tab-on-ink: #FFFFFF; --bar-bg: #2A2E32; --grid-line: #25292D; --chart-axis: #4D545B;
  --notice-bg: #22262A; --up: #6FD29B; --down: #FF8E7E; --shadow: none;
  color-scheme: dark;
  }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 14px/1.45 Inter, "Segoe UI", system-ui, sans-serif;
       font-variant-numeric: tabular-nums; }
a { color: var(--accent-ink); } a:hover { color: var(--accent-dark); }
button.linklike { background: none; border: 0; padding: 0; font: inherit; color: var(--accent-ink); text-decoration: underline; cursor: pointer; }
button.linklike:hover { color: var(--accent-dark); }
h1, h2, h3 { margin: 0; }
h1 { font-family: "Inter Display", Inter, "Segoe UI", system-ui, sans-serif; font-size: 22px; font-weight: 700; }
h2 { font-size: 16px; font-weight: 600; }

.app { display: flex; min-height: 100vh; }
.side { width: 240px; flex-shrink: 0; background: var(--side); color: var(--side-ink); padding: 24px 16px;
        display: flex; flex-direction: column; gap: 20px; position: sticky; top: 0; height: 100vh;
        overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: var(--side-active) transparent; }
.side > * { flex-shrink: 0; }   /* niskie okno: menu się przewija zamiast ucinać */
.brand { display: flex; align-items: center; gap: 10px; padding: 0 8px; color: #fff; text-decoration: none; }
.brand .logo { width: 36px; height: 36px; border-radius: 8px; background: var(--accent); display: grid; place-items: center;
               font-family: "Inter Display", Inter, "Segoe UI", sans-serif; font-weight: 800; }
.brand b { font-family: "Inter Display", Inter, "Segoe UI", sans-serif; font-size: 17px; display: block; }
.brand small { color: var(--side-muted); font-size: 12px; }
.side nav { display: flex; flex-direction: column; gap: 2px; }
.side nav a { display: flex; align-items: center; height: 44px; padding: 0 12px; border-radius: 8px; color: var(--side-ink);
              text-decoration: none; font-weight: 500; }
.side nav a.active { background: var(--side-active); color: #fff; box-shadow: inset 3px 0 0 var(--side-mark); font-weight: 600; }
.side nav a:hover { background: var(--side-hover); color: #fff; }
.side .spacer { flex-grow: 1; }
.side .user { padding: 0 8px; font-size: 13px; }
.side .user b { color: #fff; display: block; }
.side .user a { color: var(--side-muted); }

.main { flex-grow: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { min-height: 72px; display: flex; align-items: center; gap: 12px; padding: 12px 32px; background: var(--card);
          border-bottom: 1px solid var(--line); }
.topbar .titles { flex-grow: 1; min-width: 0; }
.topbar > .btn, .topbar > .toolbar { white-space: nowrap; flex-shrink: 0; }   /* przyciski w nagłówku nie łamią się */
.crumb { font-size: 12px; color: var(--muted); }
.content { padding: 24px 32px; display: flex; flex-direction: column; gap: 16px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px; padding: 0 16px;
       border-radius: 8px; border: 1px solid var(--field); background: var(--card); color: var(--ink); font: inherit;
       font-weight: 500; text-decoration: none; cursor: pointer; }
.btn:hover { border-color: var(--field-hover); color: var(--ink); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: #fff; }
.btn.danger { color: var(--bad); border-color: var(--bad-border); }
.btn.small { min-height: 32px; padding: 0 10px; font-size: 13px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 20px; box-shadow: var(--shadow); }
.card.flush { padding: 0; overflow-x: auto; }
.card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.card-head h2 { flex-grow: 1; font-weight: 700; }
.card > .card-head:first-child { padding-bottom: 10px; border-bottom: 1px solid var(--line-soft); }
.card.flush > .card-head:first-child { border-bottom: 0; }
.grid { display: grid; gap: 16px; }
.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.split { display: grid; gap: 16px; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); align-items: start; }

.kpi { display: flex; flex-direction: column; gap: 2px; }
.kpi .label { font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.kpi .value { font-family: "Inter Display", Inter, "Segoe UI", sans-serif; font-size: 28px; font-weight: 700; }
.kpi .sub { font-size: 13px; color: var(--muted); }
.up { color: var(--up); font-weight: 600; } .down { color: var(--down); font-weight: 600; }

table.data { border-collapse: collapse; width: 100%; }
table.data th { text-align: left; font-size: 11.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--thead-ink);
                padding: 10px 12px; border-bottom: 1px solid var(--line); background: var(--thead-bg); white-space: nowrap; }
table.data th a, table.data th .muted { color: inherit; }
table.data tbody tr:nth-child(even) > td { background: var(--row-alt); }
table.data tbody tr:hover > td { background: var(--row-hover); }
table.data td { padding: 10px 12px; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
table.data tr.selected td { background: var(--accent-soft); }
table.data tfoot td { font-weight: 700; background: var(--tfoot-bg); border-top: 2px solid var(--line); }
.num { text-align: right !important; white-space: nowrap; }
.muted { color: var(--muted); } .small { font-size: 12px; }
.neg { color: var(--down); }

.pill { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 10px; border-radius: 999px; white-space: nowrap;
        background: var(--gray-bg); color: var(--gray); box-shadow: inset 0 0 0 1px color-mix(in srgb, currentColor 22%, transparent); }
.pill.ok { background: var(--ok-bg); color: var(--ok); } .pill.warn { background: var(--warn-bg); color: var(--warn); }
.pill.bad { background: var(--bad-bg); color: var(--bad); } .pill.info { background: var(--info-bg); color: var(--info); }
.pill.purple { background: var(--purple-bg); color: var(--purple); }
.pill.wrap { white-space: normal; border-radius: 8px; max-width: 22ch; line-height: 1.35; }

.tabs { display: inline-flex; gap: 4px; padding: 4px; background: var(--tabs-bg); border-radius: 10px; flex-wrap: wrap; }
.tabs a { padding: 7px 14px; border-radius: 7px; color: var(--ink); text-decoration: none; font-size: 13px; font-weight: 500; }
.tabs a.active { background: var(--tab-on); color: var(--tab-on-ink); font-weight: 600; }
.tabs a.active .muted { color: inherit; opacity: .7; }
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.toolbar .grow { flex-grow: 1; }

form .field { display: flex; flex-direction: column; gap: 5px; font-size: 13px; color: var(--muted); }
form .field.wide { grid-column: 1 / -1; }
input[type=text], input[type=number], input[type=email], input[type=date], input[type=datetime-local], input[type=search],
input[type=password], input[type=file], select, textarea {
  font: inherit; color: var(--ink); min-height: 42px; padding: 8px 10px; border: 1px solid var(--field);
  border-radius: 8px; background: var(--card); width: 100%; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent-border); outline-offset: 0; border-color: var(--accent); }
textarea { min-height: 84px; resize: vertical; }
.checks { display: flex; flex-wrap: wrap; gap: 8px; }
.checks label { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border: 1px solid var(--field);
                border-radius: 999px; color: var(--ink); font-size: 13px; }
.errorlist { margin: 0; padding: 0; list-style: none; color: var(--bad); font-size: 12px; }
.form-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 8px; }

.notice { padding: 12px 14px; border-radius: 4px 10px 10px 4px; font-size: 13px; background: var(--notice-bg); border-left: 4px solid var(--field); }
.notice.ok { background: var(--ok-bg); color: var(--ok); border-left-color: currentColor; } .notice.warn { background: var(--warn-bg); color: var(--warn); border-left-color: currentColor; }
.notice.bad { background: var(--bad-bg); color: var(--bad); border-left-color: currentColor; }
.notice.accent { background: var(--accent-soft); border: 1px solid var(--accent-border); border-left: 4px solid var(--accent); }
.messages { display: flex; flex-direction: column; gap: 8px; }

.bar { height: 10px; background: var(--bar-bg); border-radius: 5px; overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--accent-chart); border-radius: 5px; }
.bar.red > span { background: var(--down); }
.kv { display: grid; grid-template-columns: 180px minmax(0, 1fr); gap: 8px 14px; font-size: 13px; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; white-space: pre-line; }
.timeline { display: flex; flex-direction: column; }
.timeline .ev { display: grid; grid-template-columns: 80px 12px minmax(0, 1fr) auto; gap: 12px; padding: 10px 0;
                border-bottom: 1px solid var(--line-soft); align-items: start; }
.timeline .dot { width: 10px; height: 10px; border-radius: 5px; margin-top: 5px; background: var(--accent); }
.dark-card { background: var(--side); color: #fff; border-radius: 12px; padding: 20px; }
.dark-card .big { font-family: "Inter Display", Inter, "Segoe UI", sans-serif; font-size: 36px; font-weight: 800; }
.suggest { background: var(--side-hover); border-radius: 8px; padding: 12px; display: flex; flex-direction: column; gap: 6px;
           font-size: 13px; color: var(--side-ink); }
.suggest .head { color: var(--side-mark); font-weight: 600; font-size: 12px; }
.chart-bars { display: flex; align-items: flex-end; justify-content: space-around; height: 200px;
              border-bottom: 1px solid var(--chart-axis); gap: 8px; }
.chart-bars .group { display: flex; align-items: flex-end; gap: 4px; height: 100%; }
.chart-bars .b { width: 26px; border-radius: 4px 4px 0 0; min-height: 2px; }
.chart-labels { display: flex; justify-content: space-around; font-size: 12px; color: var(--muted); padding-top: 6px; }
.legend { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.legend i { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }

.login-wrap { min-height: 100vh; display: grid; place-items: center; }
.login { width: 380px; }
/* !important: kilka ekranów ustawia szerokości kolumn w samym szablonie — na wąskim oknie też mają iść jedna pod drugą */
@media (max-width: 1100px) { .cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .split { grid-template-columns: 1fr !important; } }
@media (max-width: 1680px) { .split.stack-early { grid-template-columns: 1fr; } }
.notice.banner { margin-bottom: 14px; }
.notice.banner a { color: inherit; font-weight: 600; }
.side .user .small { display: block; margin-top: 4px; }
.mono { font-family: ui-monospace, Consolas, monospace; font-size: 12px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.tile { display: flex; flex-direction: column; gap: 4px; text-decoration: none; color: var(--ink); }
.tile:hover { border-color: var(--accent); }
.tile b { font-size: 15px; }
.tile .count { font-size: 24px; font-weight: 700; }
form .field.check { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 8px; color: var(--ink); }
form .field.check input { width: auto; }
.wizard-steps { list-style: none; margin: 0; padding: 0; display: flex; gap: 6px; flex-wrap: wrap; }
.wizard-steps li a { display: block; padding: 8px 12px; border-radius: 999px; background: var(--card); border: 1px solid var(--line); text-decoration: none; color: var(--muted); font-size: 13px; font-weight: 600; }
.wizard-steps li.done a { color: var(--ok); border-color: var(--ok); }
.wizard-steps li.now a { background: var(--accent); border-color: var(--accent); color: #fff; }
details.danger-zone summary { cursor: pointer; color: var(--bad); font-weight: 600; }
[hidden] { display: none !important; }

/* ---------- telefon i mały tablet: menu wysuwane, jedna kolumna, tabele przewijane w bok ---------- */
.mbar, .side-overlay { display: none; }
.board-list { display: none; }
@media (max-width: 820px) {
  .mbar { display: flex; align-items: center; gap: 12px; position: sticky; top: 0; z-index: 30; padding: 10px 16px;
          background: var(--side); color: #fff; }
  .mbar .brand { padding: 0; }
  .mbar .brand .logo { width: 30px; height: 30px; font-size: 13px; }
  .menu-btn { min-height: 38px; padding: 0 12px; border-radius: 8px; border: 1px solid var(--side-line); background: transparent;
              color: #fff; font: inherit; font-weight: 600; cursor: pointer; }
  .app { display: block; }
  .side { position: fixed; z-index: 40; left: 0; top: 0; height: 100%; width: 270px; max-width: 85vw; overflow-y: auto;
          transform: translateX(-100%); transition: transform .2s ease; }
  .side.open { transform: none; }
  .side-overlay:not([hidden]) { display: block; position: fixed; inset: 0; z-index: 35; background: rgba(15, 20, 25, .45); }
  body.menu-open { overflow: hidden; }
  .topbar { min-height: 0; padding: 12px 16px; flex-wrap: wrap; }
  .topbar .titles { flex-basis: 100%; }
  .topbar h1 { font-size: 20px; }
  .content { padding: 14px 16px 24px; }
  .cols-2, .cols-3, .cols-4, .split { grid-template-columns: 1fr !important; }
  .card { padding: 14px; }
  .card.flush { padding: 0; overflow-x: auto; }
  table.data { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  table.data th, table.data td { padding: 8px 10px; }
  .toolbar { flex-wrap: wrap; }
  .tabs { display: flex; overflow-x: auto; flex-wrap: nowrap; max-width: 100%; }
  .tabs a { white-space: nowrap; }
  input, select, textarea { font-size: 16px; }      /* iPhone nie powiększa ekranu przy wpisywaniu */
  .login { width: min(380px, calc(100vw - 32px)); }
  .board-timeline { display: none; }
  .board-list { display: block; }
  .kpi .value { font-size: 22px; }
}
@media (prefers-reduced-motion: reduce) { .side { transition: none; } }
.board-list .lane { padding: 12px 14px; border-bottom: 1px solid var(--line-soft); }
.board-list .job { display: flex; gap: 10px; align-items: center; padding: 8px 10px; margin-top: 6px; border-radius: 8px;
                   text-decoration: none; border: 1px solid var(--line); }
.board-list .job b { font-size: 14px; }
.board-list .job .t { font-variant-numeric: tabular-nums; font-weight: 600; min-width: 46px; }
@media (max-width: 820px) { .cols-4:has(> .kpi) { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; } }
select { max-width: 100%; }
@media (max-width: 820px) { .toolbar select, .toolbar input[type=search] { width: 100% !important; flex: 1 1 100%; } }

/* ---------- Pomoc (instrukcja obsługi) ---------- */
.help { display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: 24px; align-items: start; }
.help-toc { position: sticky; top: 16px; display: flex; flex-direction: column; gap: 2px; }
.help-toc a { padding: 7px 10px; border-radius: 7px; color: var(--ink); text-decoration: none; font-size: 14px; }
.help-toc a.active { background: var(--accent-soft); color: var(--accent-ink); font-weight: 600; }
.help-toc a:hover { background: var(--gray-bg); }
.help-body { max-width: 860px; line-height: 1.6; }
.help-body h2 { font-size: 20px; margin: 28px 0 8px; }
.help-body h2:first-child { margin-top: 0; }
.help-body h3 { font-size: 16px; margin: 20px 0 6px; }
.help-body p, .help-body li { max-width: 72ch; }
.help-body ol, .help-body ul { padding-left: 22px; }
.help-body li { margin: 4px 0; }
.help-body figure { margin: 14px 0 18px; }
.help-body figure img { display: block; max-width: 100%; height: auto; border: 1px solid var(--line); border-radius: 10px;
                        box-shadow: 0 1px 3px rgba(20, 25, 30, .06); }
.help-body figure.phone img { max-width: 300px; }
.help-body figcaption { font-size: 13px; color: var(--muted); margin-top: 6px; }
.help-body .tip { border-left: 3px solid var(--accent); background: var(--accent-soft); padding: 10px 14px; border-radius: 0 8px 8px 0; margin: 12px 0; }
.help-body .warn { border-left: 3px solid var(--warn-border); background: var(--warn-bg); padding: 10px 14px; border-radius: 0 8px 8px 0; margin: 12px 0; }
.help-body kbd { font: 600 12px ui-monospace, Consolas, monospace; background: var(--gray-bg); border: 1px solid var(--line); border-radius: 4px; padding: 1px 5px; }
.help-body table.data { margin: 10px 0; }
.help-nav { display: flex; justify-content: space-between; gap: 12px; margin-top: 30px; padding-top: 16px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.phones { display: flex; gap: 14px; flex-wrap: wrap; }
.phones figure { margin: 0; }
@media (max-width: 820px) { .help { grid-template-columns: 1fr; } .help-toc { position: static; flex-direction: row; flex-wrap: wrap; } }

/* pola obowiązkowe */
.req { color: var(--bad); font-weight: 700; }
.field.missing input, .field.missing select, .field.missing textarea,
label.missing input, label.missing select, label.missing textarea { border-color: var(--bad); box-shadow: 0 0 0 2px rgba(140, 47, 33, .12); }
.req-legend { margin: 0; grid-column: 1 / -1; }
.form-summary { margin: 0; }
.idle-bar { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 60; display: flex; gap: 12px;
            align-items: center; box-shadow: 0 8px 24px rgba(0,0,0,.18); max-width: calc(100% - 32px); }

/* oferta: poprawki pozycji, propozycje klienta, historia */
.row-actions { display: flex; gap: 6px; justify-content: flex-end; }
.edit-row td { background: var(--gray-bg); }
.item-edit { padding: 6px 0; }
.proposal.open { border-color: var(--warn-border); box-shadow: 0 0 0 2px rgba(233, 196, 106, .25); }
.msg-quote { background: var(--gray-bg); border-radius: 10px; padding: 10px 12px; font-style: italic; }
table.data.compact td, table.data.compact th { padding: 6px 8px; }
.changelog summary { cursor: pointer; list-style: none; }
.timeline { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 10px; }
.timeline li { border-left: 3px solid var(--line); padding: 2px 0 2px 12px; }
.chg { display: inline-block; margin: 2px 10px 2px 0; }
.chg s { color: var(--muted); }
.outlook-done { display: flex; gap: 16px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.outlook-done > div { flex: 1 1 320px; }
.pos { color: var(--ok); }
.pager { display: flex; gap: 12px; align-items: center; justify-content: center; margin: 12px 0; }
.edit-row td { white-space: normal; }
.item-edit { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)) !important; max-width: 900px; }
/* flota: terminy, warsztat */
.deadline { display: grid; grid-template-columns: 1fr auto auto; gap: 10px; padding: 7px 10px; border-radius: 8px; font-size: 13px; margin-bottom: 4px; background: var(--gray-bg); }
.deadline.bad { background: var(--bad-bg); color: var(--bad); } .deadline.warn { background: var(--warn-bg); color: var(--warn); }
.deadline.soon { background: color-mix(in srgb, var(--warn-bg) 45%, var(--card)); }
a.btn.is-off { opacity: .45; cursor: not-allowed; }      /* zestawienie dla klienta: nic nie zaznaczono */
/* kartoteka auta: szybkie dodawanie wyposażenia pod tabelą */
.equip-add { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; padding: 12px 16px; border-top: 1px solid var(--line-soft); }
.equip-add .field { flex: 1 1 130px; min-width: 0; } .equip-add .field.grow { flex: 2 1 200px; } .equip-add .field.qty { flex: 0 0 76px; }
.equip-add .btn { min-height: 42px; }
.equip-add .form-summary { flex: 1 1 100%; order: -1; }     /* „uzupełnij pola” nad polami, na całą szerokość */
.points-parts { max-width: 520px; } .points-parts .deadline:last-child { margin-bottom: 0; }   /* punkty karne: pozycje z datą anulowania */
.checklist { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 6px; }
.checklist li { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; }
.checklist li.done { background: var(--ok-bg); border-color: var(--ok-border); }
.checklist .tick { width: 30px; height: 30px; border-radius: 8px; border: 2px solid var(--field); background: var(--card); font-weight: 700; color: var(--ok); cursor: pointer; display: grid; place-items: center; font-size: 16px; }
.checklist li.done .tick { border-color: var(--ok); }
.checklist .grow, .toolbar input.grow { flex: 1; }
.qr { display: grid; place-items: center; padding: 8px; background: #fff; border: 1px solid var(--line); border-radius: 12px; }
.qr svg { width: 220px; height: 220px; }
.crumbs-files { font-size: 15px; margin: 0 0 4px; }
.pdf-text { white-space: pre-wrap; font-size: 12px; max-height: 420px; overflow: auto; background: var(--gray-bg); padding: 12px; border-radius: 10px; }
/* mapa floty */
.map-wrap { display: grid; grid-template-columns: minmax(0, 1fr) 280px; height: calc(100vh - 230px); min-height: 460px; }
#map { height: 100%; border-radius: 14px 0 0 14px; }
.map-list { border-left: 1px solid var(--line); overflow: auto; display: flex; flex-direction: column; }
.map-list input { margin: 10px; }
.map-list button { text-align: left; border: 0; border-bottom: 1px solid var(--line-soft); background: none; padding: 8px 12px; cursor: pointer; font: inherit; }
.map-list button:hover { background: var(--gray-bg); }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin: 0 4px 0 2px; vertical-align: middle; }
@media (max-width: 820px) { .map-wrap { grid-template-columns: 1fr; height: auto; } #map { height: 60vh; border-radius: 14px 14px 0 0; } .map-list { max-height: 40vh; border-left: 0; } }
table.data tbody tr.row-ok > td, tr.row-ok td { background: var(--ok-bg); }
table.data tbody tr.row-own > td, tr.row-own td { background: var(--row-own); }

/* ---------- plan dyspozytora: kolory statusów (zamiast kolorów wpisanych w kodzie) ---------- */
.st-new { --st-bg: var(--card); --st-fg: var(--gray); --st-bd: var(--field); }
.st-plan { --st-bg: var(--card); --st-fg: var(--ink); --st-bd: var(--field); }
.st-load { --st-bg: var(--accent-soft); --st-fg: var(--accent-ink); --st-bd: var(--accent-border); }
.st-road { --st-bg: var(--info-bg); --st-fg: var(--info); --st-bd: var(--info-border); }
.st-done { --st-bg: var(--ok-bg); --st-fg: var(--ok); --st-bd: var(--ok-border); }
.st-cancel { --st-bg: var(--gray-bg); --st-fg: var(--muted); --st-bd: var(--line); }
.st-issue { --st-bg: var(--bad-bg); --st-fg: var(--bad); --st-bd: var(--bad-border); }
.job-box { background: var(--st-bg); color: var(--st-fg); border-color: var(--st-bd); }
.job-box.sel { border-color: var(--ink); }
.pill.st { background: var(--st-bg); color: var(--st-fg); }
.board-head { background: var(--thead-bg); color: var(--thead-ink); }
.board-track { background-image: linear-gradient(90deg, var(--grid-line) 1px, transparent 1px); }
.side nav .navsep { height: 1px; background: var(--side-active); margin: 6px 4px; }
a.notice { color: var(--ink); text-decoration: none; }
a.notice:hover { text-decoration: underline; }

/* zabezpieczenia: wysyłany formularz, okno potwierdzenia */
.is-busy { opacity: .6; cursor: progress; }
dialog.confirm-dialog { max-width: min(480px, calc(100vw - 32px)); color: var(--ink); background: var(--card); border: 1px solid var(--line); }
dialog.confirm-dialog::backdrop { background: rgba(10, 12, 14, .5); }
.soft-warnings { display: grid; gap: 8px; }
.soft-warnings ul { margin: 4px 0 0; padding-left: 18px; }

/* ---------- 0.14.0: podmenu floty, stan OK / UWAGA / PROBLEM, kalendarz nieobecności, pliki, zdjęcia ---------- */
.subnav { display: flex; gap: 2px; flex-wrap: wrap; border-bottom: 1px solid var(--line); margin: -6px 0 2px; }
.subnav a { padding: 8px 12px; color: var(--muted); text-decoration: none; font-size: 13px; font-weight: 600;
            border-bottom: 2px solid transparent; margin-bottom: -1px; }
.subnav a:hover { color: var(--ink); }
.subnav a.active { color: var(--ink); border-bottom-color: var(--accent); }
@media (max-width: 700px) { .subnav { flex-wrap: nowrap; overflow-x: auto; } .subnav a { white-space: nowrap; } }
.status-pill { letter-spacing: .02em; cursor: help; }
.status-list { margin: 6px 0 0; padding-left: 18px; font-size: 13px; }
.status-list li.bad { color: var(--bad); } .status-list li.warn { color: var(--warn); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.chips a { text-decoration: none; }
.chips a.on .pill { outline: 2px solid var(--ink); outline-offset: 1px; }
.cal-wrap { overflow-x: auto; }
table.cal { border-collapse: collapse; font-size: 12px; min-width: 100%; }
table.cal th, table.cal td { border: 1px solid var(--line-soft); padding: 0; text-align: center; height: 30px; min-width: 26px; }
table.cal th.name, table.cal td.name { text-align: left; padding: 0 10px; white-space: nowrap; min-width: 170px; position: sticky; left: 0; background: var(--card); z-index: 1; }
table.cal thead th { background: var(--thead-bg); color: var(--thead-ink); font-weight: 600; }
table.cal td.we { background: var(--gray-bg); }
table.cal thead th.name { background: var(--thead-bg); color: var(--thead-ink); }
table.cal td.today { background: color-mix(in srgb, var(--accent-soft) 75%, transparent); }
table.cal thead th.today { background: var(--accent); color: #fff; }
table.cal td button.day { width: 100%; height: 30px; border: 0; background: none; cursor: pointer; font: inherit; color: inherit; padding: 0; }
table.cal td button.day:hover { background: var(--accent-soft); }
table.cal .ab { display: block; height: 30px; line-height: 30px; font-weight: 700; font-size: 11px; text-decoration: none; }
.ab-vacation { background: var(--info-bg); color: var(--info); } .ab-sick { background: var(--bad-bg); color: var(--bad); }
.ab-unpaid { background: var(--warn-bg); color: var(--warn); } .ab-special { background: var(--purple-bg); color: var(--purple); }
.ab-training { background: var(--ok-bg); color: var(--ok); } .ab-other { background: var(--gray-bg); color: var(--muted); }
table.cal .ab.conflict { box-shadow: inset 0 -4px 0 var(--bad); }
.files { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.files li { display: flex; gap: 10px; align-items: center; padding: 7px 10px; border: 1px solid var(--line-soft); border-radius: 10px; font-size: 13px; }
.files li .grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.files li form { margin: 0; }
.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; }
.photos a { display: block; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; aspect-ratio: 4 / 3; background: var(--gray-bg); }
.photos img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photos a.doc { display: grid; place-items: center; font-size: 12px; color: var(--ink); text-decoration: none; padding: 8px; text-align: center; }
.answers { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.answers li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; padding: 8px 10px; border: 1px solid var(--line-soft); border-radius: 10px; font-size: 13px; }
.answers li.nok { background: var(--bad-bg); border-color: var(--bad-border); }
.answers li.head { border: 0; padding: 8px 0 0; font-weight: 700; display: block; }
.answers .photos { grid-column: 1 / -1; grid-template-columns: repeat(auto-fill, minmax(90px, 120px)); }
.notice.info { background: var(--info-bg); color: var(--info); border-left-color: currentColor; }
.notice.info a { color: inherit; }

/* 0.18.0: grafik (auta / kierowcy na osi dni) */
.grafik-wrap { overflow-x: auto; }
table.grafik { border-collapse: separate; border-spacing: 0; width: 100%; font-size: 12.5px; }
table.grafik th, table.grafik td { border-bottom: 1px solid var(--line-soft); border-right: 1px solid var(--line-soft);
  padding: 6px; vertical-align: top; }
table.grafik thead th { position: sticky; top: 0; background: var(--card); font-weight: 600; text-align: center;
  white-space: nowrap; z-index: 2; }
table.grafik thead th a { color: inherit; text-decoration: none; }
table.grafik th.who { position: sticky; left: 0; background: var(--card); text-align: left; z-index: 1; }
table.grafik thead th.who { z-index: 3; }
table.grafik { table-layout: fixed; min-width: 820px; }
table.grafik th.who { width: 112px; }
table.grafik th.sum { width: 86px; }
table.grafik.week td { overflow: hidden; }
table.grafik.month { min-width: 980px; }
table.grafik.month td { text-align: center; padding: 4px 1px; }
table.grafik.month thead th:not(.who):not(.sum) { padding: 4px 1px; font-size: 11px; white-space: normal; }
table.grafik .d { color: var(--muted); font-weight: 500; }
table.grafik .gr-weekend { background: var(--gray-bg); }
table.grafik .gr-today { box-shadow: inset 0 0 0 2px var(--accent); }
table.grafik td.gr-busy { background: var(--info-bg); }
table.grafik td.gr-off { background: var(--warn-bg); }
table.grafik td.gr-down { background: var(--bad-bg); }
.gr-tag { display: inline-block; font-size: 11px; font-weight: 700; border-radius: 6px; padding: 0 5px; margin-bottom: 2px; }
.gr-tag.down { color: var(--bad); } .gr-tag.off { color: var(--warn); }
.gr-job { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gr-mark { color: var(--purple); font-size: 11px; }
table.grafik .sum { text-align: left; }
@media print {
  .side, .side-overlay, .mbar, .subnav, .toolbar, .topbar .btn, .notice.banner { display: none !important; }
  .grafik-wrap { overflow: visible; box-shadow: none; border: 0; }
  table.grafik { font-size: 10px; }
  table.grafik.week td { min-width: 0; }
}

/* ---------- „Jak liczymy”: bloki wyliczeń z pozycjami źródłowymi ---------- */
.calc-eq { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.calc-eq .op, .calc-flow .op { font-size: 20px; font-weight: 700; color: var(--muted); }
.calc-eq .chip { display: flex; flex-direction: column; gap: 2px; padding: 8px 12px; border: 1px solid var(--line);
                 border-radius: 10px; background: var(--card); color: var(--ink); text-decoration: none; min-width: 120px; }
.calc-eq .chip span { font-size: 12px; color: var(--muted); }
.calc-eq a.chip:hover { border-color: var(--accent-border); background: var(--accent-soft); }
.calc-eq .chip.total { border-width: 2px; }
.calc-eq .chip.result { border: 2px solid var(--accent); background: var(--accent-soft); }
.calc-eq .chip.result.neg b { color: var(--down); }
.calc-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 420px), 1fr)); align-items: start; }
.calc-block { scroll-margin-top: 16px; }
.calc-block:target { box-shadow: 0 0 0 2px var(--accent); }
.calc-head { display: flex; align-items: baseline; gap: 10px; }
.calc-head h2 { flex-grow: 1; font-weight: 700; }
.calc-amount { font-family: "Inter Display", Inter, "Segoe UI", sans-serif; font-size: 22px; font-weight: 700; white-space: nowrap; }
.calc-rule { margin: 6px 0 10px; font-size: 13px; color: var(--muted); }
.calc-rows { margin-bottom: 8px; }
.calc-note { margin: 6px 0 0; }
.calc-src summary { cursor: pointer; font-weight: 600; color: var(--accent-ink); margin-top: 6px; }
.calc-src .table-wrap { margin-top: 8px; max-height: 360px; overflow-y: auto; }
.calc-section { margin: 8px 0 -4px; font-weight: 700; }
.calc-flow { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.calc-flow .card { display: flex; flex-direction: column; gap: 2px; flex: 1 1 200px; }
.calc-flow .label { font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.calc-flow b { font-size: 20px; }
@media (max-width: 820px) { .calc-eq .chip { flex: 1 1 40%; } .calc-flow .op { display: none; } }
@media print { .calc-src { display: block; } .calc-src summary { display: none; } }

/* pliki klienta: folder, nad którym trzyma się przeciągany plik */
tr[data-doc] { cursor: grab; }
[data-drop].drop-over > td, a[data-drop].drop-over { background: var(--accent-soft); outline: 2px dashed var(--accent); outline-offset: -2px; }


/* ================================================================================================================
   Dopracowanie interfejsu (cała aplikacja): obsługa z klawiatury, pola i przyciski, wąskie ekrany, menu boczne.
   Wszystko na zmiennych motywu — działa tak samo w trybie jasnym i ciemnym.
   ================================================================================================================ */

/* --- klawiatura: wyraźna ramka na elemencie z fokusem (tylko przy przechodzeniu klawiszem Tab, nie po kliknięciu) --- */
a:focus-visible, button:focus-visible, .btn:focus-visible, summary:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px; }
a:not(.btn):not(.card):focus-visible, summary:focus-visible { border-radius: 4px; }
.side a:focus-visible, .side button:focus-visible, .mbar :focus-visible { outline-color: var(--side-mark); }
input[type=checkbox]:focus-visible, input[type=radio]:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* --- przyciski: płynna reakcja na mysz, wciśnięcie, stan wyłączony --- */
.btn { transition: background-color .12s ease, border-color .12s ease, color .12s ease; }
.btn:not(.primary):hover { background: color-mix(in srgb, var(--card) 93%, var(--ink)); }
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; transform: none; }
.btn.danger:hover { background: var(--bad-bg); border-color: var(--bad); color: var(--bad); }

/* --- pola formularzy: reakcja na mysz, pola wyłączone, podpowiedź w polu --- */
input[type=text]:hover:not(:focus):not(:disabled), input[type=number]:hover:not(:focus):not(:disabled),
input[type=email]:hover:not(:focus):not(:disabled), input[type=date]:hover:not(:focus):not(:disabled),
input[type=search]:hover:not(:focus):not(:disabled), input[type=password]:hover:not(:focus):not(:disabled),
select:hover:not(:focus):not(:disabled), textarea:hover:not(:focus):not(:disabled) { border-color: var(--field-hover); }
input:disabled, select:disabled, textarea:disabled { background: var(--gray-bg); color: var(--muted); cursor: not-allowed; }
::placeholder { color: color-mix(in srgb, var(--muted) 75%, transparent); opacity: 1; }
/* pola wyboru: większe (łatwiej trafić myszą i palcem), w kolorze programu */
input[type=checkbox], input[type=radio] { width: 18px; height: 18px; accent-color: var(--accent); flex-shrink: 0;
  vertical-align: middle; cursor: pointer; }
label:has(> input[type=checkbox]), label:has(> input[type=radio]) { cursor: pointer; }
@media (pointer: coarse) { input[type=checkbox], input[type=radio] { width: 22px; height: 22px; } }   /* ekran dotykowy */
/* wybór pliku: przycisk w stylu programu zamiast systemowego */
input[type=file] { padding: 5px 8px; cursor: pointer; }
input[type=file]::file-selector-button { font: inherit; font-size: 13px; font-weight: 500; margin: 0 10px 0 0; padding: 5px 12px;
  min-height: 30px; border: 1px solid var(--field); border-radius: 6px; background: var(--gray-bg); color: var(--ink); cursor: pointer; }
input[type=file]::file-selector-button:hover { border-color: var(--field-hover); }

/* --- układ: nic nie rozpycha strony w poziomie --- */
/* kolumny siatki mogą być węższe niż ich najszersza zawartość; szeroka tabela przewija się wtedy w swojej karcie */
.grid > *, .split > * { min-width: 0; }
.card { overflow-wrap: break-word; }
.card:has(table.data) { overflow-x: auto; }
.table-wrap { overflow-x: auto; }
.card.flush, .table-wrap, .card:has(table.data) { scrollbar-width: thin; scrollbar-color: var(--field) transparent; }
.files { grid-template-columns: minmax(0, 1fr); }
.files li { flex-wrap: wrap; }
.pill { max-width: 100%; }
/* nagłówek strony: gdy przyciski się nie mieszczą, schodzą do drugiego wiersza */
.topbar { flex-wrap: wrap; row-gap: 8px; justify-content: flex-end; }
.topbar .titles { flex: 1 1 220px; }      /* tytuł ustępuje miejsca przyciskom (opis nad nim zawija się), zanim te zejdą niżej */
.topbar > .toolbar { flex-wrap: wrap; }
/* wykres słupkowy na pulpicie: słupki zwężają się na wąskim ekranie zamiast wychodzić poza kartę */
.chart-bars { min-width: 0; }
.chart-bars .group { flex: 0 1 auto; min-width: 0; }
.chart-bars .b { flex: 0 1 26px; min-width: 5px; }
/* ostatni wiersz tabeli bez kreski pod spodem (karta ma własną ramkę) */
.card.flush table.data tbody:last-child > tr:last-child > td { border-bottom: 0; }

/* --- odnośnik do sekcji (#wyposazenie, #pliki, #punkty…): płynne przewinięcie i podświetlenie sekcji --- */
html { scroll-behavior: smooth; scroll-padding-top: 16px; }
section:target, form.card:target, details.card:target { box-shadow: 0 0 0 2px var(--accent-border), var(--shadow); }

/* --- komunikaty po zapisie: delikatne pojawienie się --- */
@keyframes notice-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.messages .notice { animation: notice-in .2s ease-out; }
h1 { text-wrap: balance; }

/* --- menu boczne: nazwa programu i użytkownik zawsze widoczni, przewija się tylko lista pozycji --- */
.side { overflow: hidden; }
.side > nav { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin;
              scrollbar-color: var(--side-active) transparent; margin-right: -8px; padding-right: 8px; }
.side nav a { flex-shrink: 0; height: 42px; transition: background-color .12s ease, color .12s ease; }
.side .spacer { display: none; }
/* użytkownik: imię i rola po lewej, „Wyloguj” po prawej — jedna zwarta belka na dole menu */
.side .user { border-top: 1px solid var(--side-line); padding: 14px 8px 0; display: grid; grid-template-columns: minmax(0, 1fr) auto;
              column-gap: 10px; align-items: center; }
.side .user > b, .side .user > span { grid-column: 1; overflow: hidden; text-overflow: ellipsis; }
.side .user > b { white-space: nowrap; }
.side .user form { margin: 0; grid-column: 2; grid-row: 1 / span 2; }
.side .user .btn { background: transparent; color: var(--side-ink); border-color: var(--side-line); }
.side .user .btn:hover { background: var(--side-hover); color: #fff; border-color: var(--side-muted); }
/* są jeszcze pozycje niżej — dół listy łagodnie zanika (klasę ustawia skrypt w szablonie) */
.side > nav.more { -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 40px), transparent);
                   mask-image: linear-gradient(to bottom, #000 calc(100% - 40px), transparent); }
.side > nav.above { -webkit-mask-image: linear-gradient(to bottom, transparent, #000 40px);
                    mask-image: linear-gradient(to bottom, transparent, #000 40px); }
.side > nav.above.more { -webkit-mask-image: linear-gradient(to bottom, transparent, #000 40px, #000 calc(100% - 40px), transparent);
                         mask-image: linear-gradient(to bottom, transparent, #000 40px, #000 calc(100% - 40px), transparent); }
/* niskie okno (laptop 1366×768): ciaśniejsze menu, żeby zmieściło się jak najwięcej pozycji */
@media (max-height: 820px) and (min-width: 821px) {
  .side { padding: 16px; gap: 14px; }
  .side .brand small { display: none; }
  .side nav a { height: 38px; }
  .side .user { padding-top: 12px; }
}
/* bardzo niskie okno (telefon poziomo): przewija się całe menu, żeby lista pozycji nie została za mała */
@media (max-height: 560px) { .side { overflow-y: auto; } .side > nav { flex: 0 0 auto; overflow: visible; margin-right: 0; padding-right: 0; } }

/* --- długie formularze (dane pojazdu, kierowcy, klienta, ustawienia): „Zapisz” zawsze pod ręką na dole okna --- */
@media (min-height: 600px) {
  .content > form.grid:not(.card) > .form-actions { position: sticky; bottom: 0; z-index: 5; margin: 0 -32px; padding: 12px 32px;
    background: color-mix(in srgb, var(--bg) 88%, transparent); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
    border-top: 1px solid var(--line); }
}

/* --- telefon i mały tablet --- */
@media (max-width: 820px) {
  html { scroll-padding-top: 70px; }
  .content > form.grid:not(.card) > .form-actions { margin: 0 -16px; padding: 10px 16px; }                       /* pod przyklejonym paskiem z menu */
  .kv { grid-template-columns: minmax(92px, 38%) minmax(0, 1fr); }
  .topbar { justify-content: flex-start; }
  .topbar .titles { flex-basis: 100%; }                    /* tytuł w osobnym wierszu, przyciski pod nim */
  .card-head { flex-wrap: wrap; }
  .card-head .pill { white-space: normal; border-radius: 10px; }
  .form-actions { flex-wrap: wrap; }
  .form-actions .btn { flex: 1 1 auto; }
  .btn { min-height: 44px; }                               /* wygodny cel dla palca */
  .btn.small { min-height: 38px; }
  .subnav a { padding: 10px 12px; }
  .tabs a { padding: 9px 14px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .btn, .side nav a { transition: none; }
  .btn:active { transform: none; }
  .messages .notice { animation: none; }
}
@media print { html { scroll-behavior: auto; } .card:has(table.data), .table-wrap, .card.flush { overflow: visible; }
               .content > form.grid:not(.card) > .form-actions { position: static; } }


/* ================================================================================================================
   Długie listy: szukanie, sortowanie, zakładki, przyklejony nagłówek (static/js/tables.js)
   ================================================================================================================ */
.filtered-out { display: none !important; }
/* nagłówki do sortowania: strzałka pokazuje kierunek, kursor i podświetlenie — że da się kliknąć */
table.data th[data-sort] { cursor: pointer; user-select: none; -webkit-user-select: none; }
table.data th[data-sort]:hover { background: color-mix(in srgb, var(--thead-bg) 82%, var(--thead-ink)); }
table.data th[data-sort]::after { content: "↕"; display: inline-block; margin-left: 5px; opacity: .35; font-size: 11px; }
table.data th[aria-sort="ascending"]::after { content: "▲"; opacity: 1; font-size: 9px; }
table.data th[aria-sort="descending"]::after { content: "▼"; opacity: 1; font-size: 9px; }
table.data th[data-sort]:focus-visible { outline: 2px solid var(--side-mark); outline-offset: -2px; }
/* nagłówek tabeli przyklejony do góry okna — gdy tabela mieści się w karcie (klasę „fits” ustawia skrypt) */
.card.flush.sticky-head.fits, .card.flush.sticky-head.fits > .table-wrap { overflow: visible; }
.sticky-head.fits table.data thead th { position: sticky; top: 0; z-index: 3; }
.sticky-head.fits table.data tbody:last-child > tr:last-child > td:first-child { border-bottom-left-radius: 11px; }
.sticky-head.fits table.data tbody:last-child > tr:last-child > td:last-child { border-bottom-right-radius: 11px; }
/* pasek nad listą: zakładki, szukanie, filtry stanu */
.list-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.list-bar input[type=search] { width: auto; flex: 1 1 220px; max-width: 340px; }
.list-bar .chips { margin-left: auto; }
#plan-filtr .chips { margin-left: 0; } #plan-filtr input[type=search] { margin-left: auto; }
.tabs .count { opacity: .7; font-weight: 500; margin-left: 2px; }
.chip-btn { font: inherit; font-size: 12px; font-weight: 600; padding: 4px 11px; border-radius: 999px; border: 1px solid var(--line);
            background: var(--card); color: var(--ink); cursor: pointer; white-space: nowrap; }
.chip-btn:hover { border-color: var(--field-hover); }
.chip-btn.on { background: var(--tab-on); color: var(--tab-on-ink); border-color: var(--tab-on); }
.chip-btn b { font-weight: 700; opacity: .75; margin-left: 3px; }
.chip-btn.bad:not(.on) { color: var(--bad); border-color: var(--bad-border); }

/* --- lista floty --- */
table.fleet td { vertical-align: middle; }
table.fleet .veh { white-space: nowrap; min-width: 190px; }      /* numer i naczepa zawsze w jednej linii */
table.fleet .veh > div.small { white-space: normal; }
table.fleet .due { max-width: 260px; }
table.fleet .due .pill { margin: 1px 0; }
table.fleet a.quiet { color: inherit; text-decoration: none; border-bottom: 1px dotted var(--field); }
table.fleet a.quiet:hover { color: var(--accent-ink); border-bottom-color: currentColor; }
[data-tab-panel] { scroll-margin-top: 150px; }                 /* po wejściu z odnośnika #naczepy widać też zakładki */
[data-tab-panel]:target { box-shadow: var(--shadow); }
.bar.mini { height: 4px; margin-top: 4px; min-width: 64px; }
@media (max-width: 820px) { .list-bar .chips { margin-left: 0; } .list-bar input[type=search] { max-width: none; flex-basis: 100%; } }

/* --- plan dnia dyspozytora --- */
/* zgłoszenia od kierowców: jedna karta, jeden wiersz na zgłoszenie */
.issues { list-style: none; margin: 0; padding: 0; max-height: 292px; overflow-y: auto; scrollbar-width: thin; }
.issues li { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 8px 16px; border-top: 1px solid var(--line-soft); font-size: 13px; }
.issues li .what { flex: 1 1 320px; min-width: 0; }
.issues li .acts { display: flex; gap: 6px; flex-wrap: wrap; margin-left: auto; }
.issues li form { margin: 0; }
.issues-card > .card-head { margin-bottom: 8px; }
/* do przydzielenia: lista zadań dyspozytora nad planem — zlecenie, auto, kierowca i „Przydziel” w jednym wierszu */
#live-unassigned:not(:has(section)) { display: none; }
.todo-card > .card-head { margin-bottom: 8px; }
.todo-card { border-color: var(--warn-border); }
.assign-list { max-height: 412px; overflow-y: auto; scrollbar-width: thin; }
.assign-row { display: grid; grid-template-columns: minmax(0, 1fr) 190px 210px auto; gap: 8px; align-items: center; padding: 7px 16px;
              border-top: 1px solid var(--line-soft); margin: 0; }
.assign-row .what { color: inherit; text-decoration: none; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.assign-row .what:hover b { text-decoration: underline; }
.assign-row .what .t { font-weight: 600; margin-right: 4px; }
.assign-row select { min-height: 36px; padding: 4px 8px; font-size: 13px; }
@media (max-width: 1100px) { .assign-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } .assign-row .what { grid-column: 1 / -1; white-space: normal; }
                             .assign-row .btn { grid-column: 1 / -1; } .assign-list { max-height: none; } }
/* tory aut: auto i kierowca po lewej (trzy zwarte linijki), oś czasu po prawej */
.board-card { --lane-w: 232px; overflow: visible !important; }
.board-card .board-head, .lane-row { display: grid; grid-template-columns: var(--lane-w) minmax(0, 1fr); }
.board-card .board-head { position: sticky; top: 0; z-index: 4; border-bottom: 1px solid var(--line); font-size: 12px; font-weight: 600;
                          border-radius: 11px 11px 0 0; }
.board-card .board-head > span { padding: 9px 14px; }
.board-card .board-head .hours { display: grid; padding: 9px 0; }
.lane-row { border-bottom: 1px solid var(--line-soft); min-height: 56px; }
.lane-row:hover .lane-info { background: var(--row-hover); }
.lane-info { padding: 7px 14px; min-width: 0; font-size: 13px; line-height: 1.35; }
.lane-info .top { display: flex; align-items: baseline; gap: 6px; white-space: nowrap; }
.lane-info .top > b { flex-shrink: 0; }
.lane-info .top > .small { overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.lane-info .top .mark { margin-left: auto; font-size: 12px; flex-shrink: 0; font-weight: 600; }
.lane-info .line { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 12px; color: var(--muted); }
.lane-info .line.who { color: var(--ink); }
.board-track { position: relative; }
.job-bar { position: absolute; top: 7px; bottom: 7px; padding: 2px 8px; border-radius: 8px; border: 2px solid; text-decoration: none; overflow: hidden;
           display: flex; flex-direction: column; justify-content: center; transition: box-shadow .12s ease; }
.job-bar:hover { box-shadow: 0 2px 8px rgba(0, 0, 0, .18); z-index: 2; }
.job-bar b { font-size: 12px; white-space: nowrap; } .job-bar span { font-size: 11px; white-space: nowrap; }
/* pionowa kreska „teraz” przez wszystkie tory */
.board-timeline { position: relative; }
.now-line { position: absolute; top: 0; bottom: 0; width: 0; border-left: 2px solid var(--accent); z-index: 3; pointer-events: none;
            left: calc(var(--lane-w) + (100% - var(--lane-w)) * var(--now)); }
.now-line::before { content: attr(data-time); position: sticky; top: 36px; display: block; transform: translateX(-50%); width: max-content; margin-left: -1px;
                    background: var(--accent); color: #fff; font-size: 11px; font-weight: 700; padding: 1px 6px; border-radius: 999px; }
/* szczegóły zlecenia: zawsze w oknie, gdy przewijasz plan */
@media (min-width: 1101px) {
  #szczegoly { position: sticky; top: 16px; max-height: calc(100vh - 32px); overflow-y: auto; scrollbar-width: thin; }
}
.board-list .lane[hidden] { display: none; }
@media (max-width: 820px) { .board-card { --lane-w: 0px; } .now-line { display: none; } }
@media print { .board-card .board-head, #szczegoly { position: static; max-height: none; } .list-bar, .now-line { display: none !important; } }

/* protokół przekazania auta: podpisy i odpowiedzi w biurze */
.sig-view { display: flex; flex-direction: column; gap: 4px; padding: 8px 0; border-bottom: 1px solid var(--line-soft); }
.sig-view:last-child { border-bottom: 0; }
.sig-view img { max-width: 100%; height: 90px; object-fit: contain; object-position: left; background: #fff; border: 1px solid var(--line-soft); border-radius: 8px; }
.ho-rows { display: grid; gap: 6px; }
.ho-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 12px; align-items: center; padding: 6px 10px; border: 1px solid var(--line-soft); border-radius: 10px; }
.ho-row.missing { background: var(--bad-bg); border-color: var(--bad-border); }
.ho-row .opts { display: inline-flex; gap: 4px; flex-wrap: wrap; }
.ho-row .opts label { display: inline-flex; align-items: center; gap: 4px; padding: 5px 10px; border: 1px solid var(--line); border-radius: 8px; font-size: 13px; cursor: pointer; }
.ho-row .opts label:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); font-weight: 600; }
.ho-row .opts input { margin: 0; }
.ho-row input[type=text] { grid-column: 1 / -1; } .ho-row input[hidden] { display: none; }
.ho-unit { font-weight: 700; font-size: 13px; padding-top: 6px; }
@media (max-width: 640px) { .ho-row { grid-template-columns: minmax(0, 1fr); } }

/* długi znacznik w nagłówku karty (np. „przekroczony limit kupiecki… faktury po terminie…”) zawija się, a nie wypycha strony */
.card-head { min-width: 0; }
.card-head > .pill { white-space: normal; min-width: 0; text-align: left; border-radius: 12px; }
