:root {
  --navy: #0e223b;
  --navy-2: #163456;
  --ink: #1c2833;
  --muted: #5d6d7e;
  --line: #d5dce3;
  --bg: #eef2f6;
  --card: #fff;
  --drive: #1e8449;
  --work: #1a5276;
  --avail: #d4ac0d;
  --rest: #c0392b;
  --warn: #b9770e;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: "IBM Plex Sans", system-ui, sans-serif;
  color: var(--ink);
  background: var(--bg);
  display: flex;
}
a { color: #1a5276; }
.sidebar {
  width: 240px;
  background: linear-gradient(180deg, var(--navy), #0a192d);
  color: #d6e0ea;
  min-height: 100vh;
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  position: sticky;
  top: 0;
}
.brand, .brand-lg { display: flex; gap: 10px; align-items: center; color: inherit; text-decoration: none; }
.brand small, .brand-lg small { display: block; opacity: .7; font-size: 11px; }
.brand-mark {
  width: 38px; height: 38px; border-radius: 10px;
  background: #1e8449; color: #fff; display: grid; place-items: center;
  font-weight: 700; letter-spacing: .04em;
}
.sidebar nav { display: flex; flex-direction: column; gap: 4px; }
.sidebar nav a {
  color: inherit; text-decoration: none; padding: 8px 10px; border-radius: 8px; font-size: 14px;
}
.sidebar nav a.active, .sidebar nav a:hover { background: var(--navy-2); color: #fff; }
.sidebar-user { margin-top: auto; font-size: 13px; opacity: .9; }
.sidebar-user a { color: #7dcea0; }
.content { flex: 1; padding: 28px 32px 64px; max-width: 1400px; }
.content:has(.detail-report) { max-width: none; }
.head-actions { display: flex; gap: 10px; align-items: flex-start; flex-wrap: wrap; }
.range-picker { position: relative; }
.range-pop {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 40;
  width: 308px; background: #fff; border: 1px solid var(--line); border-radius: 14px;
  box-shadow: 0 16px 40px rgba(14,34,59,.16); padding: 12px;
}
.range-nav { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.range-nav strong { text-transform: capitalize; font-size: 14px; }
.range-prev, .range-next {
  width: 32px; height: 32px; border: 1px solid var(--line); background: #fff;
  border-radius: 8px; cursor: pointer; font-size: 18px;
}
.range-weekdays, .range-grid {
  display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; text-align: center;
}
.range-weekdays { color: var(--muted); font-size: 11px; margin-bottom: 4px; }
.range-grid button {
  height: 34px; border: 0; background: transparent; border-radius: 8px; cursor: pointer; font: inherit;
}
.range-grid button:hover:not(:disabled) { background: #eef3f8; }
.range-grid button:disabled { color: #c5ced6; cursor: default; }
.range-grid button.has-data { font-weight: 700; }
.range-grid button.in-range { background: #d6eaf8; border-radius: 0; }
.range-grid button.is-start, .range-grid button.is-end {
  background: var(--navy); color: #fff; font-weight: 700;
}
.range-grid button.is-start { border-radius: 8px 0 0 8px; }
.range-grid button.is-end { border-radius: 0 8px 8px 0; }
.range-grid button.is-start.is-end { border-radius: 8px; }
.range-hint { font-size: 12px; color: var(--muted); margin: 8px 0 6px; }
.range-actions { display: flex; justify-content: flex-end; padding-bottom: 4px; }
.page-head h1 { margin: 0 0 4px; font-size: 28px; }
.crumbs { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.muted { color: var(--muted); }
.tiny { font-size: 12px; }
.mono { font-family: "IBM Plex Mono", ui-monospace, monospace; font-size: 12px; }
.panel {
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  padding: 18px 18px 8px; margin-bottom: 18px; box-shadow: 0 8px 24px rgba(14,34,59,.04);
}
.panel h2 { margin: 0 0 12px; font-size: 16px; }
.panel-head { display: flex; justify-content: space-between; gap: 12px; align-items: center; }
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 18px; }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; }
.kpi span { display: block; color: var(--muted); font-size: 12px; }
.kpi strong { font-size: 22px; }
.kpi-drive { border-top: 4px solid var(--drive); }
.kpi-work { border-top: 4px solid var(--work); }
.kpi-avail { border-top: 4px solid var(--avail); }
.kpi-rest { border-top: 4px solid var(--rest); }
.kpi-warn { border-top: 4px solid var(--warn); }
.meta-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 16px; }
.meta-grid div { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.meta-grid span { display: block; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-size: 12px; color: var(--muted); border-bottom: 1px solid var(--line); padding: 8px; }
.table td { border-bottom: 1px solid #eef2f5; padding: 8px; vertical-align: top; }
.table.compact td, .table.compact th { padding: 6px 8px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--line); background: #fff; color: var(--ink);
  border-radius: 10px; padding: 9px 14px; text-decoration: none; cursor: pointer; font-weight: 600;
}
.btn-primary { background: var(--navy); color: #fff; border-color: var(--navy); }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.input, select.input {
  width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 9px 11px; font: inherit;
}
.tag { font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 999px; }
.tag-driver { background: #e8f6ef; color: #145a32; }
.tag-vehicle { background: #fdebd0; color: #7d6608; }
.split { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(280px, .9fr); gap: 16px; }
.grow { min-width: 0; }
.day-summary { display: flex; flex-wrap: wrap; gap: 14px; font-size: 13px; margin-bottom: 10px; }
.tacho-label { font-size: 11px; color: var(--muted); margin: 6px 0 2px; }
.tacho-label-2 { margin-top: 10px; }
.tacho-axis { position: relative; height: 18px; color: var(--muted); font-size: 11px; }
.tacho-axis span { position: absolute; transform: translateX(-50%); }
.tacho-track {
  position: relative; height: 42px; background: #f7f9fb; border: 1px solid var(--line); border-radius: 8px; overflow: hidden;
}
.seg { position: absolute; top: 0; bottom: 0; }
.seg-jazda, .dot-jazda { background: var(--drive); }
.seg-praca, .dot-praca { background: var(--work); }
.seg-dyspozycja, .dot-dyspozycja { background: var(--avail); }
.seg-odpoczynek, .dot-odpoczynek { background: var(--rest); }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--muted); margin-top: 8px; align-items: center; }
.legend i { width: 12px; height: 12px; display: inline-block; border-radius: 3px; margin-right: 4px; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-right: 6px; }
.violations { list-style: none; padding: 0; margin: 0; }
.violations li { border-left: 4px solid var(--warn); background: #fdf6e3; padding: 8px 10px; border-radius: 0 8px 8px 0; margin-bottom: 8px; }
.violations li.sev-critical { border-color: var(--rest); background: #fdecea; }
.violations strong { display: block; }
.violations span { font-size: 12px; color: var(--muted); }
.violations p { margin: 4px 0 0; font-size: 13px; }
.ok { color: var(--drive); font-weight: 600; }
.detail-report {
  background: #fff;
  border: 1px solid #cfd6dd;
  padding: 18px 18px 8px;
  margin-bottom: 18px;
}
.report-title {
  margin: 0 0 10px;
  color: #163456;
  font-size: 26px;
  font-weight: 700;
}
.report-meta, .report-totals {
  margin: 0 0 8px;
  font-size: 13px;
  color: #1c2833;
  line-height: 1.55;
}
.report-meta span, .report-totals span { color: #8a97a6; padding: 0 6px; }
.act-wrap { overflow: auto; max-height: 72vh; border: 1px solid #c5ced6; margin: 12px 0 14px; }
.act-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  font-family: Arial, Helvetica, sans-serif;
  white-space: nowrap;
}
.act-table th {
  position: sticky; top: 0; z-index: 2;
  background: #163456;
  color: #fff;
  font-weight: 700;
  text-align: left;
  padding: 7px 8px;
  border-bottom: 1px solid #0f2744;
}
.act-table td {
  padding: 5px 8px;
  border-bottom: 1px solid #e4e8ed;
}
.act-table tbody tr.act-jazda { background: #d8f0d8; }
.act-table tbody tr.act-postoj { background: #e6def6; }
.act-table tbody tr.act-praca { background: #fde3c8; }
.act-table tbody tr.act-dyspozycja { background: #fff4c4; }
.act-table tbody tr.act-karta { background: #eef1f4; }
.act-table td:nth-child(3),
.act-table td:nth-child(5),
.act-table td:nth-child(6) { text-align: right; font-variant-numeric: tabular-nums; }
.dropzone { border: 2px dashed var(--line); border-radius: 16px; padding: 28px; text-align: center; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.auth-wrap { min-height: 100vh; width: 100%; display: grid; place-items: center; background: radial-gradient(circle at top, #163456, #0e223b); }
.auth-card { width: min(420px, 92vw); background: #fff; padding: 28px; border-radius: 18px; }
.auth-card h1 { margin: 16px 0 6px; }
.flash-stack { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.flash { padding: 10px 12px; border-radius: 10px; font-size: 14px; }
.flash-success { background: #e8f6ef; color: #145a32; }
.flash-danger { background: #fdecea; color: #7b241c; }
.flash-warning, .flash-info { background: #fdf6e3; color: #7d6608; }
.inline-search { min-width: 280px; }
@media (max-width: 980px) {
  body { display: block; }
  .sidebar { width: auto; min-height: auto; position: relative; flex-direction: row; flex-wrap: wrap; }
  .split, .meta-grid { grid-template-columns: 1fr; }
  .content { padding: 16px; }
}
