/* Driver and admin panels. Builds on the tokens and buttons in /styles.css. */

.panel-body { background: var(--mint-soft); min-height: 100dvh; display: flex; flex-direction: column; }
.panel-main { flex: 1; padding-block: 40px 80px; }
.container-wide { max-width: calc(1280px + var(--gutter) * 2); }

.panel-main h1 { font-size: clamp(1.75rem, 3vw, 2.25rem); margin-bottom: 24px; }
.panel-main h2 { font-size: 1.25rem; }
.muted { color: var(--ink-soft); }
.hint { font-size: .875rem; color: var(--ink-soft); margin-top: 6px; }
.lead-text { color: var(--ink-soft); max-width: 62ch; margin: -8px 0 24px; }
.section-title { margin: 48px 0 16px; }

/* Header */
.panel-nav { display: flex; gap: 4px; margin-right: auto; }
.panel-nav a {
  position: relative; padding: 10px 12px; border-radius: var(--r-sm);
  text-decoration: none; font-weight: 500; font-size: .9375rem; color: var(--ink-soft);
}
.panel-nav a:hover { color: var(--ink); }
.panel-nav a[aria-current="page"] { color: var(--green-strong); }
.panel-nav a[aria-current="page"]::after {
  content: ""; position: absolute; left: 12px; right: 12px; bottom: 4px; height: 2px; border-radius: 2px; background: var(--green);
}
.panel-body .brand { margin-right: 16px; }
.panel-body .header-inner { gap: 16px; }
.logout-form { display: flex; align-items: center; gap: 12px; }
.user-name { font-size: .9375rem; font-weight: 500; color: var(--ink-soft); }

.lang-switch a {
  display: inline-grid; place-items: center;
  min-width: 40px; min-height: 34px; padding: 0 8px; border-radius: var(--r-pill);
  font: 500 .8125rem/1 var(--font); color: var(--ink-soft); text-decoration: none;
}
.lang-switch a:hover { color: var(--ink); }
.lang-switch a[aria-current="true"] { background: var(--mint); color: var(--green-deep); }

/* Buttons */
.btn-block { width: 100%; }
.btn-danger { background: #fff; color: #A3261B; border-color: #F0C9C4; }
.btn-danger:hover { background: #FDF1EF; border-color: #A3261B; }
.btn .icon { width: 18px; height: 18px; }

/* Cards */
.panel-card {
  background: #fff; border: 1px solid var(--line); border-radius: var(--r-md);
  padding: clamp(20px, 3vw, 28px);
}
.panel-card > h2 { margin-bottom: 16px; }
.panel-card > p + p { margin-top: 8px; }
.detail-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: 24px; align-items: start; }
.detail-grid-wide { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); }
.settlement-grid { grid-template-columns: minmax(300px, 1fr) minmax(0, 2fr); }
.data-table.numeric th, .data-table.numeric td { padding: 12px 10px; }
.data-table.numeric th:first-child { padding-left: 4px; }
.data-table.numeric :is(th, td):last-child { padding-right: 4px; }
.data-table.numeric thead th { background: transparent; }

.page-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 24px; margin-bottom: 24px; }
.page-head h1 { margin-bottom: 0; }
.page-head-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.page-head .muted { margin-top: 4px; }
.paid-on { margin: -12px 0 24px; }
.back-link {
  display: inline-flex; align-items: center; gap: 8px; margin-bottom: 16px;
  color: var(--ink-soft); text-decoration: none; font-weight: 500; font-size: .9375rem;
}
.back-link:hover { color: var(--ink); }
.driver-line { margin-bottom: 16px; color: var(--ink-soft); }
.driver-line a { color: var(--ink); }

/* Badges: icon + text, never colour alone */
.badge {
  display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
  padding: 4px 10px 4px 8px; border-radius: var(--r-pill);
  font-size: .8125rem; font-weight: 600;
}
.badge .icon { width: 15px; height: 15px; }
.badge-paid { background: var(--mint); color: var(--green-deep); }
.badge-pending { background: #FFF4D6; color: #7A4B00; }
.badge-off { background: #F1F1F1; color: #555; padding-left: 10px; }

/* Latest week card – the one big number in the driver panel */
.latest-card {
  display: grid; grid-template-columns: 1fr auto; gap: 20px 32px; align-items: end;
  padding: clamp(24px, 4vw, 36px); border-radius: 20px;
  background: var(--green-deep); color: #fff; text-decoration: none;
  transition: background-color .2s var(--ease-out);
}
.latest-card:hover { background: #0B5728; }
.latest-card:focus-visible { outline-color: var(--amber); }
.latest-label { display: block; font-size: .9375rem; color: #CFE8D8; }
.latest-week { display: block; margin-top: 4px; font-size: 1.25rem; font-weight: 600; }
.latest-amount { text-align: right; }
.latest-amount strong { display: block; font-size: clamp(2.25rem, 6vw, 3.25rem); font-weight: 700; letter-spacing: -0.03em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.latest-foot { grid-column: 1 / -1; display: flex; justify-content: space-between; align-items: center; gap: 12px; padding-top: 16px; border-top: 1px solid rgba(255,255,255,.18); }
.latest-link { font-weight: 600; }
.latest-link::after { content: ""; display: inline-block; width: 8px; height: 8px; margin-left: 10px; border-top: 2px solid currentColor; border-right: 2px solid currentColor; transform: translateY(-1px) rotate(45deg); }

/* Tables */
.table-scroll { overflow-x: auto; background: #fff; border: 1px solid var(--line); border-radius: var(--r-md); }
.panel-card .table-scroll { border: 0; border-radius: 0; margin-inline: -4px; }
.data-table { width: 100%; border-collapse: collapse; font-size: .9375rem; }
.data-table th, .data-table td { padding: 14px 16px; text-align: left; vertical-align: middle; border-bottom: 1px solid var(--line); }
.data-table thead th { font-size: .8125rem; font-weight: 500; color: var(--ink-soft); background: var(--mint-soft); white-space: nowrap; }
.data-table tbody th { font-weight: 500; }
.data-table tbody tr:last-child > * { border-bottom: 0; }
.data-table tfoot > tr > * { border-top: 2px solid var(--ink); border-bottom: 0; font-weight: 600; }
.data-table .num, .data-table.numeric td, .data-table.numeric tfoot td { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.data-table.numeric thead th:not(:first-child) { text-align: right; }
.data-table thead th.num { text-align: right; }
.cell-strong { display: block; font-weight: 600; }
.cell-sub { display: block; font-size: .8125rem; color: var(--ink-soft); font-weight: 400; }
.cell-action { text-align: right; white-space: nowrap; }
.cell-action .inline-form + .btn, .cell-action .inline-form { margin-left: 6px; }
.error-table th { width: 90px; }

/* Ledger (summary list) */
.ledger { margin: 0; display: grid; }
.ledger > div { display: flex; justify-content: space-between; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.ledger dt { color: var(--ink-soft); }
.ledger dd { margin: 0; font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ledger.plain dd { white-space: normal; overflow-wrap: anywhere; }
.ledger .minus dd { color: var(--ink-soft); font-weight: 500; }
.ledger-total { border-bottom: 0 !important; border-top: 2px solid var(--ink); margin-top: -1px; padding-top: 16px !important; }
.ledger-total dt { color: var(--ink); font-weight: 600; }
.ledger-total dd { font-size: 1.75rem; color: var(--green-deep); letter-spacing: -0.02em; }
.ledger-total.is-owed dd { color: #9A3412; }
.note { margin-top: 20px; padding: 16px; border-radius: var(--r-sm); background: #FFF8E6; }
.note h3 { font-size: .9375rem; margin-bottom: 4px; }

/* Forms */
.stack { display: grid; gap: 18px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.form-field { display: grid; gap: 6px; }
.form-field label { font-size: .9375rem; font-weight: 500; }
.form-field input, .form-field select {
  width: 100%; min-height: 48px; padding: 10px 14px;
  font: 400 1rem/1.4 var(--font); color: var(--ink);
  background: #fff; border: 1px solid #C9D5CD; border-radius: var(--r-sm);
  transition: border-color .2s var(--ease-out), box-shadow .2s var(--ease-out);
}
.form-field input:hover, .form-field select:hover { border-color: var(--ink-soft); }
.form-field input:focus, .form-field select:focus { outline: none; border-color: var(--green-strong); box-shadow: 0 0 0 3px rgba(22, 163, 74, .25); }
.form-field input[type="file"] { padding: 10px; }
.password-wrap { position: relative; }
.password-wrap input { padding-right: 52px; }
.password-toggle {
  position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
  width: 44px; height: 40px; display: grid; place-items: center;
  border: 0; background: transparent; color: var(--ink-soft); cursor: pointer; border-radius: var(--r-sm);
}
.password-toggle[aria-pressed="true"] { color: var(--green-strong); }
.inline-form { display: inline; }
.panel-card .inline-form .btn { margin: 8px 8px 0 0; }

.filters { display: flex; flex-wrap: wrap; align-items: end; gap: 12px 16px; margin-bottom: 20px; }
.filters .form-field { min-width: 180px; }
.filters .grow { flex: 1; min-width: 220px; }
.filters .btn { min-height: 48px; }

.flash {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px 16px; margin-bottom: 20px; border-radius: var(--r-sm);
  font-weight: 500;
}
.flash .icon { margin-top: 2px; }
.flash-success { background: var(--mint); color: var(--green-deep); }
.flash-error { background: #FDECEA; color: #8A1F14; }

.summary-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }

/* Dashboard */
.stat-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 24px; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: var(--r-md); padding: 20px 24px; }
.stat-label { display: block; font-size: .9375rem; color: var(--ink-soft); }
.stat strong { display: block; margin-top: 6px; font-size: 2rem; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.task-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.task-list a {
  display: flex; align-items: center; gap: 12px; padding: 12px; margin-inline: -12px;
  border-radius: var(--r-sm); text-decoration: none; font-weight: 500;
}
.task-list a:hover { background: var(--mint-soft); }
.task-list .icon { color: var(--green-strong); }

.col-list { margin: 16px 0 0; padding-left: 18px; display: grid; gap: 8px; }
code { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: .875em; background: var(--mint-soft); padding: 1px 5px; border-radius: 4px; }
.password-code { font-size: 1.25rem; padding: 6px 12px; background: #FFF4D6; color: var(--ink); user-select: all; }
.temp-pass { max-width: 640px; }

.empty { background: #fff; border: 1px dashed #C9D5CD; border-radius: var(--r-md); padding: 48px 24px; text-align: center; }
.empty h2 { margin-bottom: 8px; }
.empty p { color: var(--ink-soft); max-width: 46ch; margin-inline: auto; }

/* Login */
.auth-wrap { max-width: 440px; margin: clamp(0px, 4vh, 40px) auto 0; }
.auth-card { background: #fff; border: 1px solid var(--line); border-radius: 20px; padding: clamp(24px, 5vw, 40px); box-shadow: 0 30px 60px -40px rgba(15, 31, 23, .35); }
.auth-card h1 { margin-bottom: 8px; }
.auth-card > .muted { margin-bottom: 24px; }
.auth-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 32px; }
.auth-help { margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--line); font-size: .9375rem; display: grid; gap: 6px; }
.auth-help a { font-weight: 600; white-space: nowrap; }
.auth-back { display: inline-flex; align-items: center; gap: 8px; margin-top: 20px; color: var(--ink-soft); text-decoration: none; font-weight: 500; }
.auth-back:hover { color: var(--ink); }
.panel-body:has(.auth-wrap) .site-header { display: none; }

/* Responsive */
@media (max-width: 1023px) {
  .detail-grid, .detail-grid-wide { grid-template-columns: 1fr; }
  .user-name { display: none; }
}

@media (max-width: 760px) {
  .panel-body .header-inner { flex-wrap: wrap; height: auto; padding-block: 10px; }
  .panel-nav { order: 3; width: 100%; margin: 0 -12px; overflow-x: auto; }
  .panel-body .header-actions { margin-left: auto; }
  .logout-form .btn span { display: none; }
  .stat-row { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }

  /* Tables become stacked rows */
  .data-table:not(.numeric) thead { display: none; }
  .data-table:not(.numeric) tbody tr { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 12px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
  .data-table:not(.numeric) tbody tr:last-child { border-bottom: 0; }
  .data-table:not(.numeric) tbody > tr > * { border: 0; padding: 0; }
  .data-table:not(.numeric) tbody th { grid-column: 1 / -1; margin-bottom: 4px; }
  .data-table:not(.numeric) td[data-label]::before { content: attr(data-label); display: block; font-size: .75rem; color: var(--ink-soft); }
  .data-table:not(.numeric) td.num { text-align: left; }
  .data-table:not(.numeric) .cell-action { grid-column: 1 / -1; text-align: left; margin-top: 8px; display: flex; flex-wrap: wrap; gap: 8px; }
  .data-table:not(.numeric) .cell-action .inline-form { margin: 0; }
  .latest-card { grid-template-columns: 1fr; }
  .latest-amount { text-align: left; }
}

/* ---------- Settlement module (rozliczenia z raportów) ---------- */
.section-title.first { margin-top: 8px; }
.stepper { display: flex; gap: 8px; list-style: none; padding: 0; margin: 0 0 24px; flex-wrap: wrap; }
.stepper li { display: flex; align-items: center; gap: 8px; padding: 6px 14px 6px 6px; border-radius: var(--r-pill);
  background: #fff; border: 1px solid var(--line); font-weight: 500; font-size: .9375rem; color: var(--ink-soft); }
.stepper li span { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%;
  background: var(--mint-soft); font-size: .8125rem; font-weight: 600; }
.stepper li span .icon { width: 15px; height: 15px; }
.stepper li.done span { background: var(--mint); color: var(--green-deep); }
.stepper li.now { border-color: var(--green); color: var(--ink); }
.stepper li.now span { background: var(--green-strong); color: #fff; }
.dropzone { position: relative; display: grid; justify-items: center; gap: 2px; margin-top: 16px; padding: 28px;
  border: 2px dashed var(--leaf); border-radius: var(--r-md); background: var(--mint-soft); color: var(--ink-soft);
  text-align: center; cursor: pointer; }
.dropzone:hover, .dropzone.is-over { border-color: var(--green-strong); }
.dropzone strong { color: var(--ink); font-size: 1.0625rem; }
.dropzone .icon { width: 30px; height: 30px; stroke: var(--green-strong); margin-bottom: 6px; }
.dropzone input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; }
.file-list { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 6px; }
.file-list li { padding: 8px 12px; border: 1px solid var(--line); border-radius: var(--r-sm); background: #fff; font-size: .9375rem; }
.chip { display: inline-flex; align-items: center; padding: 2px 10px; border-radius: var(--r-pill); font-size: .8125rem;
  font-weight: 600; white-space: nowrap; vertical-align: middle; letter-spacing: 0; }
.chip-draft { background: #EEF1EF; color: var(--ink-soft); }
.chip-approved { background: #E7EEFF; color: #2848A8; }
.chip-published { background: var(--mint); color: var(--green-deep); }
.chip-new { background: #FFF1D6; color: var(--amber-text); }
.chip-hand { background: #E7EEFF; color: #2848A8; }
.cell-sub.chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.mbar { display: flex; gap: 10px; align-items: flex-start; padding: 12px 16px; border-radius: var(--r-sm);
  margin-bottom: 12px; font-size: .9375rem; }
.mbar .icon { flex: none; margin-top: 3px; }
.mbar-info { background: var(--mint); color: var(--green-deep); margin-top: 20px; }
.mbar-warn { background: #FFF4DC; color: #7A4E00; }
.mbar a { font-weight: 600; color: inherit; }
.actions-row { display: flex; gap: 10px; justify-content: flex-end; align-items: center; margin-top: 24px; flex-wrap: wrap; }
.actions-row > .muted { margin-right: auto; font-size: .9375rem; }
.lock { display: inline-flex; gap: 6px; align-items: center; font-size: .8125rem; color: var(--ink-soft); }
.lock .icon { width: 15px; height: 15px; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.review-table tr.row-new th, .review-table tr.row-new td { background: #FFFBF0; }
.review-table tr.row-owed td.paycell { color: #A3261B; }
.review-table tfoot th, .review-table tfoot td { font-weight: 700; background: var(--mint-soft); }
.items { list-style: none; padding: 0; margin: 12px 0 16px; border-top: 1px solid var(--line); }
.items li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.items li > span:last-child { display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.item-form .fields { display: grid; grid-template-columns: 1fr 140px; gap: 12px; }
.seg { display: flex; border: 1px solid var(--line); border-radius: var(--r-pill); padding: 4px; margin: 0; }
.seg label { flex: 1; text-align: center; padding: 8px; border-radius: var(--r-pill); font-weight: 500; color: var(--ink-soft); cursor: pointer; }
.seg label:has(input:checked) { background: var(--green-strong); color: #fff; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.ledger dt small { display: block; font-size: .8125rem; color: var(--ink-soft); font-weight: 400; }
.ledger .plus dd { color: var(--green-strong); }
details.messages { margin-top: 24px; color: var(--ink-soft); font-size: .9375rem; }
details.messages summary { cursor: pointer; font-weight: 500; }
@media (max-width: 640px) { .item-form .fields { grid-template-columns: 1fr; } }
.apps-mobile { display: none; }
@media (max-width: 640px) { .apps-wide { display: none; } .apps-mobile { display: block; } }
.form-grid { align-items: start; }
.amount-input { width: 130px; text-align: right; font: inherit; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.amount-input:focus { outline: none; border-color: var(--green-strong); box-shadow: 0 0 0 3px rgba(22, 163, 74, .25); }
.transfers-table tr.row-edited th, .transfers-table tr.row-edited td { background: #FFF8E6; }
.row-edited .amount-input { border-color: var(--amber); }
.was { display: block; font-size: .75rem; color: var(--amber-text); margin-top: 2px; }
.inline-field { display: flex; align-items: center; gap: 8px; }
.inline-field label { margin: 0; white-space: nowrap; }
.form-field textarea { font: inherit; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--r-sm); background: #fff; resize: vertical; }
/* History */
.history-filters .filter-row { flex-basis: 100%; display: flex; flex-wrap: wrap; align-items: end; gap: 12px 20px; }
.seg-inline { display: inline-flex; align-items: center; gap: 2px; border: 1px solid var(--line); border-radius: var(--r-pill); padding: 3px; margin: 0; background: #fff; position: relative; }
.seg-inline legend { position: absolute; top: -24px; left: 0; font-size: .9375rem; font-weight: 500; padding: 0; }
.seg-inline label { cursor: pointer; }
.seg-inline label span { display: inline-block; padding: 7px 14px; border-radius: var(--r-pill); font-size: .9375rem; font-weight: 500; color: var(--ink-soft); }
.seg-inline label:has(input:checked) span { background: var(--mint); color: var(--green-deep); }
.seg-inline input { position: absolute; opacity: 0; pointer-events: none; }
.history-filters .filter-row { margin-top: 18px; }
.chart-card { margin: 20px 0; }
.chart-card svg { width: 100%; height: auto; display: block; margin-top: 8px; font-family: var(--font); }
.chart-card .grid { stroke: var(--line); }
.chart-card .axis { stroke: var(--ink-soft); }
.chart-card .tick { font-size: 12px; fill: var(--ink-soft); }
.chart-card .val { font-size: 12px; font-weight: 600; fill: var(--ink); }
.chart-card .fill { fill: var(--green-strong); }
.chart-card .bar:hover .fill { fill: var(--green-deep); }
.review-table tr.row-owed-all td:last-child { color: #A3261B; }
.qr { display: block; margin: 12px 0; border: 1px solid var(--line); border-radius: var(--r-sm); background: #fff; }
.backup-codes { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(2, max-content); gap: 8px 24px; margin: 16px 0 24px; }
.backup-codes code { font-size: 1.125rem; letter-spacing: .04em; }
.panel-card.narrow { max-width: 560px; }
.actions-row.tight { margin-top: 0; justify-content: flex-start; }
.api-options { display: grid; gap: 10px; margin-top: 16px; }
.check { display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; align-items: start; font-weight: 500; }
.check input { width: 18px; height: 18px; margin-top: 3px; accent-color: var(--green-strong); }
.check .hint { grid-column: 2; margin: 0; font-weight: 400; }
.week-buttons { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.form-grid > * { min-width: 0; }
.form-grid .form-field input { width: 100%; min-width: 0; }
.week-buttons { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.week-buttons .btn { justify-content: center; padding-inline: 10px; white-space: nowrap; font-size: .875rem; }
@media (max-width: 640px) { .week-buttons { grid-template-columns: 1fr; } }
/* Zestawienia */
.month-nav { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 16px; margin: 8px 0 12px; }
.month-title { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.month-title strong { font-size: clamp(1.25rem, 2.4vw, 1.75rem); letter-spacing: -.01em; }
.month-jump select { font: inherit; padding: 6px 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.view-switch { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 16px; }
.view-switch .seg-inline a { display: inline-block; padding: 7px 14px; border-radius: var(--r-pill); font-weight: 500; color: var(--ink-soft); text-decoration: none; }
.view-switch .seg-inline a.on { background: var(--mint); color: var(--green-deep); }
.coverage { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.coverage .mbar { margin: 0 0 12px; }
.col-key { font-weight: 700; }
.year-table th a { color: inherit; }
.reports-bottom { margin-top: 32px; }
.chip-uber { background: #111; color: #fff; }
.chip-bolt { background: #DDF7E6; color: #0E6630; }
.results .mbar { margin-bottom: 8px; }
.month-field input { max-width: 260px; }
@media (max-width: 760px) {
  .month-nav { grid-template-columns: 1fr 1fr; }
  .month-title { grid-column: 1 / -1; order: -1; }
  .coverage { grid-template-columns: 1fr; }
}
.icon.flip { transform: scaleX(-1); }

/* Zestawienia: monthly driver statements */
.statements { margin-top: 24px; }
.income-details { margin-top: 24px; }
.income-details > summary { list-style: none; cursor: pointer; margin-bottom: 16px; }
.income-details > summary::-webkit-details-marker { display: none; }
.income-details > summary::after { content: "▾"; margin-left: 8px; }
.income-details[open] > summary::after { content: "▴"; }
.income-details .when-open, .income-details[open] .when-closed { display: none; }
.income-details[open] .when-open { display: inline; }
.statements .section-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.statements .section-head h2 { margin: 0; }
.statements .form-actions { margin-top: 16px; }
.statement-table .amount-input { width: 110px; }
.statement-table .amount-input.is-manual { border-color: var(--green-strong); font-weight: 600; }
.statement-table .cell-sub { text-align: right; }
.statement-table th .cell-sub { text-align: left; }
.statement-table th[scope="row"] { min-width: 170px; }
.statement-table th, .statement-table td { padding-left: 10px; padding-right: 10px; }
.dl-links { display: flex; flex-direction: column; gap: 4px; font-weight: 600; }
.dl-links a { color: var(--green-strong); text-decoration: underline; text-underline-offset: 2px; }

/* Tabs inside "Ustawienia" (settlement settings, import, administrators) */
.subnav { display: flex; flex-wrap: wrap; gap: 4px; padding: 4px; margin: 0 0 20px; background: #fff; border: 1px solid var(--line); border-radius: 999px; width: fit-content; max-width: 100%; }
.subnav a { padding: 8px 16px; border-radius: 999px; color: var(--ink-soft); text-decoration: none; font-weight: 500; }
.subnav a:hover { color: var(--ink); }
.subnav a[aria-current="page"] { background: var(--mint); color: var(--green-deep); }
.new-account { display: inline-block; margin-top: 4px; font-size: .8125rem; font-weight: 600; color: var(--green-strong); }

/* Settlement rows by payout: owes the fleet (red), to pay out (green), zero (light blue) */
.data-table tr.row-owed > th, .data-table tr.row-owed > td { background: #FBDCD8; }
.data-table tr.row-pay > th, .data-table tr.row-pay > td { background: #D8F1E0; }
.data-table tr.row-zero > th, .data-table tr.row-zero > td { background: #DCEBF8; }
.data-table tr.row-owed td.paycell { color: #A3261B; }
.pay-legend { display: flex; flex-wrap: wrap; gap: 16px; font-size: .8125rem; color: var(--ink-soft); margin: 8px 0 0; }
.pay-legend span::before { content: ""; display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; border: 1px solid rgba(0,0,0,.08); }
.pay-legend .lg-pay::before { background: #D8F1E0; }
.pay-legend .lg-owed::before { background: #FBDCD8; }
.pay-legend .lg-zero::before { background: #DCEBF8; }
.owed { color: #A3261B; }
.debts-card { margin-top: 24px; }
.debts-overview { margin: 0 0 24px; }
.debts-overview > summary { cursor: pointer; }
.debts-overview .items li { display: flex; justify-content: space-between; gap: 12px; }
.chip-owed { background: #fff; color: #A3261B; border: 1px solid #F0B8B1; }

/* Dashboard: revenue per month */
.revenue-card { margin: 24px 0; --s1: #15803D; --s2: #2a78d6; }
.revenue-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 16px; align-items: flex-start; }
.revenue-head h2 { margin: 0 0 4px; }
.revenue-hero { text-align: right; }
.revenue-hero strong { display: block; font-size: 1.75rem; line-height: 1.2; }
.revenue-hero .delta { font-size: .8125rem; font-weight: 600; }
.revenue-hero .delta.up { color: #15803D; }
.revenue-hero .delta.down { color: #A3261B; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 16px; margin: 16px 0 4px; font-size: .875rem; color: var(--ink); }
.chart-legend .lg::before { content: ""; display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.chart-legend .s1::before { background: var(--s1); }
.chart-legend .s2::before { background: var(--s2); }
.chart-wrap { position: relative; overflow-x: auto; }
.rev-chart { display: block; width: 100%; min-width: 680px; height: auto; font-family: inherit; }
.rev-chart .grid { stroke: #E3E8E5; stroke-width: 1; }
.rev-chart .base { stroke: #9AA79F; stroke-width: 1; }
.rev-chart .ylab, .rev-chart .xlab { fill: #5B6B62; font-size: 15px; }
.rev-chart .s1 { fill: var(--s1); }
.rev-chart .s2 { fill: var(--s2); }
.rev-chart .hit { fill: transparent; }
.rev-chart .bar { cursor: default; outline: none; }
.rev-chart .bar:hover .hit, .rev-chart .bar:focus .hit { fill: rgba(15, 31, 23, .05); }
.chart-tip { position: absolute; pointer-events: none; background: #0F1F17; color: #fff; padding: 8px 10px; border-radius: 8px; font-size: .8125rem; line-height: 1.45; white-space: pre; box-shadow: 0 4px 16px rgba(0,0,0,.18); z-index: 2; }
.chart-tip .tip-title { font-weight: 700; }
.chart-table { margin-top: 12px; }
.chart-table summary { cursor: pointer; color: var(--ink-soft); font-size: .875rem; }
@media (max-width: 600px) { .revenue-hero { text-align: left; } }
.revenue-sum { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line); }
.revenue-sum-title { margin: 0 0 12px; font-weight: 600; }
.revenue-sum .stat-row { margin: 0; }
.revenue-sum .dot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: 0; }
.revenue-sum .dot.s1 { background: var(--s1); }
.revenue-sum .dot.s2 { background: var(--s2); }

/* Podsumowanie */
.period-card { margin: 16px 0 24px; }
.period-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; }
.period-form .form-field { margin: 0; min-width: 0; }
.preset-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.preset-row .is-on { background: var(--mint); color: var(--green-deep); border-color: transparent; }
.summary-stats { --s1: #15803D; --s2: #2a78d6; margin-bottom: 4px; }
.summary-stats .dot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; }
.summary-stats .dot.s1 { background: var(--s1); }
.summary-stats .dot.s2 { background: var(--s2); }

/* Dashboard: today */
.today-card { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px 32px; background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 16px 20px; margin: 0 0 20px; }
.today-date { display: flex; align-items: center; gap: 14px; }
.today-day { display: inline-flex; align-items: center; min-height: 52px; padding: 0 18px; border-radius: 12px; background: var(--mint); color: var(--green-deep); font-size: 1.375rem; font-weight: 700; white-space: nowrap; }
.today-facts { display: flex; flex-wrap: wrap; gap: 12px 32px; margin: 0; }
.today-facts dt { font-size: .8125rem; color: var(--ink-soft); }
.today-facts dd { margin: 2px 0 0; font-weight: 600; }
.today-facts dd.muted { font-weight: 400; font-size: .8125rem; }
.stat-actions { padding: 14px 16px; }
.stat-actions .stat-label { display: block; padding: 0 8px; margin-bottom: 4px; }
.stat-actions .task-list { gap: 0; }
.stat-actions .task-list a { padding-top: 6px; padding-bottom: 6px; }
.week-status { display: block; text-decoration: none; color: var(--ink); }
.week-status strong { display: flex; align-items: center; gap: 8px; font-size: 1.75rem; }
.week-status strong .icon { width: 26px; height: 26px; }
.week-status .week-note { display: block; margin-top: 4px; font-size: .8125rem; color: var(--ink-soft); }
.week-status.is-settled { background: #D8F1E0; border-color: #A9DDBB; }
.week-status.is-settled strong { color: #0E6630; }
.week-status.is-open { background: #FBDCD8; border-color: #F0B8B1; }
.week-status.is-open strong { color: #A3261B; }
.week-status:hover { filter: brightness(.98); }

/* Kalendarz. Status colours: overdue red, soon amber, valid green, done grey (always with words or a label too) */
.cal-badge { display: inline-block; padding: 3px 10px; border-radius: var(--r-pill); font-size: .8125rem; font-weight: 600; white-space: nowrap; }
.is-overdue:is(.cal-badge, .cal-event, .mini-day) { background: #FBDCD8; color: #8A1F14; }
.is-soon:is(.cal-badge, .cal-event, .mini-day) { background: #FFEDC2; color: #6E4400; }
.is-ok:is(.cal-badge, .cal-event, .mini-day) { background: var(--mint); color: var(--green-deep); }
.is-done:is(.cal-badge, .cal-event, .mini-day) { background: #EEF1EF; color: #55625B; }
.is-service:is(.cal-badge, .cal-event, .mini-day) { background: #E3ECFB; color: #1F3F8F; }
.chip-gps { background: #E7EEFF; color: #2848A8; font-size: .75rem; padding: 1px 8px; vertical-align: 1px; }
.cal-due { display: block; white-space: nowrap; }
.cal-gps-note { margin: 12px 0 0; }
.mini-recent { margin-top: 20px; }
.cal-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.cal-nav { display: flex; gap: 8px; }
.cal-nav .btn { min-width: 44px; padding-inline: 12px; justify-content: center; }
.cal-next .icon { transform: scaleX(-1); }
.cal-grid { width: 100%; table-layout: fixed; border-collapse: collapse; }
.cal-grid th { padding: 0 8px 8px; text-align: left; font-size: .8125rem; font-weight: 500; color: var(--ink-soft); }
.cal-grid td { height: 104px; padding: 4px; vertical-align: top; border: 1px solid var(--line); }
.cal-grid td.is-out { background: #FAFCFB; }
.cal-grid td.is-out .cal-day { color: #66756D; }
.cal-day { display: inline-grid; place-items: center; min-width: 28px; height: 28px; border-radius: 50%; font-size: .875rem; font-weight: 500; text-decoration: none; color: var(--ink); font-variant-numeric: tabular-nums; }
.cal-day:hover { background: var(--mint); }
.cal-grid .is-today .cal-day { background: var(--green-strong); color: #fff; }
.cal-event { display: block; margin-top: 4px; padding: 4px 8px; border-radius: 6px; font-size: .8125rem; line-height: 1.3; text-decoration: none; }
.cal-event:hover { filter: brightness(.96); }
.cal-event-name { display: block; font-weight: 600; overflow-wrap: anywhere; }
.cal-event-about { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-event.is-done .cal-event-name { text-decoration: line-through; }
.cal-legend { display: flex; flex-wrap: wrap; gap: 8px 16px; margin: 14px 0 0; font-size: .8125rem; color: var(--ink-soft); }
.cal-legend span::before { content: ""; display: inline-block; width: 12px; height: 12px; margin-right: 6px; border-radius: 3px; vertical-align: -1px; border: 1px solid rgba(0, 0, 0, .08); }
.cal-legend .is-overdue::before { background: #FBDCD8; }
.cal-legend .is-soon::before { background: #FFEDC2; }
.cal-legend .is-ok::before { background: var(--mint); }
.cal-legend .is-done::before { background: #EEF1EF; }
.cal-legend .is-service::before { background: #E3ECFB; }
.cal-section { margin-top: 32px; }
.cal-section.is-overdue { color: #8A1F14; }
.cal-empty { margin-top: 24px; }
.cal-form-single { max-width: 820px; }
.cal-driver { margin-top: 20px; }
.cal-delete { margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--line); }
.cal-table .cell-action .btn .icon { width: 16px; height: 16px; }
.cal-table .cell-action .btn { vertical-align: middle; }
@media (min-width: 761px) { .cal-table td.cell-action { text-align: right; } }
details.messages .table-scroll { margin-top: 12px; color: var(--ink); }

/* Dashboard: small calendar */
.mini-cal-card { margin-bottom: 24px; scroll-margin-top: calc(var(--header-h) + 16px); }
.mini-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; margin-bottom: 16px; }
.mini-counts { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; }
.mini-all { margin-left: auto; font-weight: 600; font-size: .9375rem; color: var(--green-strong); }
.mini-body { display: grid; grid-template-columns: 320px minmax(0, 1fr); gap: 24px 40px; align-items: start; }
.mini-month { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.mini-nav { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; color: var(--ink-soft); }
.mini-nav:hover { background: var(--mint-soft); color: var(--ink); }
.mini-nav .icon { width: 18px; height: 18px; }
.mini-grid { width: 100%; table-layout: fixed; border-collapse: collapse; text-align: center; }
.mini-grid th { padding-bottom: 4px; font-size: .75rem; font-weight: 500; color: var(--ink-soft); }
.mini-grid td { padding: 2px 0; }
.mini-day { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; font-size: .875rem; text-decoration: none; font-variant-numeric: tabular-nums; }
a.mini-day { font-weight: 700; }
a.mini-day:hover { filter: brightness(.95); }
.mini-grid .is-out .mini-day { color: #8A978F; }
.mini-grid .is-today .mini-day { box-shadow: inset 0 0 0 2px var(--green-strong); font-weight: 700; }
.mini-list-wrap h3 { font-size: 1rem; margin-bottom: 8px; }
.mini-list { list-style: none; margin: 0; padding: 0; }
.mini-list li + li { border-top: 1px solid var(--line); }
.mini-list a { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 9px 8px; margin-inline: -8px; border-radius: var(--r-sm); text-decoration: none; }
.mini-list a:hover { background: var(--mint-soft); }
.mini-what { min-width: 0; }
.mini-what strong, .mini-what .muted { display: block; overflow: hidden; text-overflow: ellipsis; }
.mini-what strong { font-weight: 600; }
.mini-what .muted { font-size: .875rem; }
.mini-when { display: flex; align-items: center; justify-content: flex-end; flex: none; gap: 12px; font-variant-numeric: tabular-nums; }
.mini-when .cal-badge { min-width: 148px; text-align: center; }
.mini-more { display: inline-block; margin-top: 8px; font-weight: 600; font-size: .9375rem; color: var(--green-strong); }
.mini-add { margin-top: 12px; }
@media (max-width: 1023px) { .mini-body { grid-template-columns: 1fr; } .mini-cal { max-width: 400px; } }
@media (max-width: 760px) {
  .cal-card { padding: 16px 12px; }
  .cal-grid th { padding-inline: 0; text-align: center; }
  .cal-grid td { height: 62px; padding: 2px; text-align: center; }
  .cal-event { min-height: 14px; padding: 0; margin-top: 3px; }
  .cal-event > span { display: none; }
  .mini-when { flex-direction: column; align-items: flex-end; gap: 4px; }
  .mini-when .cal-badge { min-width: 0; }
}

/* Mapa live */
.live-layout { display: grid; grid-template-columns: 340px minmax(0, 1fr); gap: 16px; align-items: stretch; margin-bottom: 12px; }
.live-map { height: calc(100dvh - 250px); min-height: 460px; border-radius: var(--r-md); border: 1px solid var(--line); overflow: hidden; background: #E8EEEA; z-index: 0; }
.live-side { display: flex; flex-direction: column; gap: 12px; padding: 16px; max-height: calc(100dvh - 250px); min-height: 460px; }
.live-summary { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: .875rem; color: var(--ink-soft); }
.live-summary strong { color: var(--ink); width: 100%; font-size: 1rem; }
.live-count { display: inline-flex; align-items: center; gap: 6px; }
.live-list { list-style: none; margin: 0 -8px; padding: 0; overflow-y: auto; flex: 1; }
.live-car { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 10px; width: 100%; padding: 10px 8px; border: 0; border-radius: var(--r-sm); background: none; font: inherit; color: inherit; text-align: left; cursor: pointer; }
.live-car:hover:not(:disabled) { background: var(--mint-soft); }
.live-car.is-selected { background: var(--mint); }
.live-car:disabled { cursor: default; opacity: .7; }
.live-car-main { min-width: 0; }
.live-car-main strong, .live-car-sub { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.live-car-main strong { font-weight: 600; }
.live-car-sub, .live-car-time { font-size: .8125rem; color: var(--ink-soft); }
.live-empty { padding: 12px 8px; color: var(--ink-soft); }
.live-fit { align-self: flex-start; }
.map-updated { font-size: .875rem; color: var(--ink-soft); }
.dot { display: inline-block; flex: none; width: 10px; height: 10px; border-radius: 50%; background: #9AA79F; }
.dot.moving { background: #16A34A; }
.dot.idle { background: #E8A317; }
.dot.parked { background: #2563EB; }
.car-marker { position: relative; width: 30px; height: 30px; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, .35); background: #9AA79F; }
.car-marker.moving { background: #16A34A; }
.car-marker.idle { background: #E8A317; }
.car-marker.parked { background: #2563EB; }
.car-marker.selected { outline: 3px solid var(--ink); }
.car-arrow { position: absolute; inset: 0; }
.car-arrow::before { content: ""; position: absolute; left: 50%; top: 3px; margin-left: -5px; border: 5px solid transparent; border-bottom: 8px solid #fff; border-top: 0; }
.car-marker:not(.moving) .car-arrow { display: none; }
.leaflet-tooltip.car-label { padding: 2px 6px; font: 600 12px/1.3 var(--font); color: var(--ink); background: #fff; border: 0; box-shadow: 0 1px 4px rgba(0, 0, 0, .25); }
.leaflet-tooltip.car-label::before { display: none; }
.car-popup { font: 400 13px/1.4 var(--font); min-width: 200px; }
.car-popup strong { font-size: 14px; }
.car-popup dl { display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; margin: 8px 0 0; }
.car-popup dt { color: var(--ink-soft); }
.car-popup dd { margin: 0; font-weight: 500; }
@media (max-width: 900px) {
  .live-layout { grid-template-columns: 1fr; }
  .live-map { order: -1; height: 60dvh; min-height: 320px; }
  .live-side { max-height: none; min-height: 0; }
}
.mbar[hidden] { display: none; }
.panel-nav a, .user-name { white-space: nowrap; }
@media (max-width: 1360px) { .panel-nav a { padding-inline: 9px; } .panel-nav a[aria-current="page"]::after { left: 9px; right: 9px; } .user-name { display: none; } }
