/* Taxisimo GPS Dozor – moderný tmavý dizajn vo farbách Taxisima */
:root {
  --brand: #ffc400; --brand-2: #ffdd55; --brand-ink: #1a1400;
  --bg: #0c0e12; --bg-2: #12151b; --panel: rgba(20, 23, 30, .82); --card: #171b22; --card-2: #1d222b;
  --line: rgba(255, 255, 255, .08); --line-2: rgba(255, 255, 255, .14);
  --text: #eef1f6; --muted: #8b94a6; --muted-2: #b7bfcd;
  --move: #22c55e; --stop: #3b82f6; --off: #6b7280; --warn: #f59e0b; --err: #ef4444; --ok: #22c55e;
  --radius: 16px; --radius-sm: 10px;
  --shadow: 0 10px 30px rgba(0, 0, 0, .45), 0 2px 6px rgba(0, 0, 0, .3);
  --blur: saturate(160%) blur(16px);
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #f3f5f8; --bg-2: #e9edf2; --panel: rgba(255, 255, 255, .86); --card: #ffffff; --card-2: #f6f8fb;
  --line: rgba(15, 23, 42, .08); --line-2: rgba(15, 23, 42, .14);
  --text: #0f172a; --muted: #64748b; --muted-2: #475569;
  --shadow: 0 10px 30px rgba(15, 23, 42, .12), 0 2px 6px rgba(15, 23, 42, .08);
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; font: 14.5px/1.5 var(--font); background: var(--bg); color: var(--text); -webkit-font-smoothing: antialiased; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
code { font: 12.5px ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--card-2); padding: 1px 6px; border-radius: 6px; }
.muted { color: var(--muted); }
small { font-size: 12px; }
svg.i { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ---------- Horná lišta ---------- */
.top { position: sticky; top: 0; z-index: 1000; height: 60px; display: flex; align-items: center; gap: 18px; padding: 0 18px;
  background: color-mix(in srgb, var(--bg) 86%, transparent); backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
  border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-weight: 800; letter-spacing: .02em; }
.brand:hover { text-decoration: none; }
.brand .logo { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--brand); color: var(--brand-ink);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 22%, transparent); }
.brand .logo svg { width: 20px; height: 20px; }
.brand b { color: var(--brand); }
.brand span small { display: block; font-weight: 500; color: var(--muted); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; margin-top: -3px; }
.nav { display: flex; gap: 4px; padding: 4px; background: var(--card); border: 1px solid var(--line); border-radius: 999px; margin: 0 auto; }
.nav a { display: flex; align-items: center; gap: 7px; padding: 7px 14px; border-radius: 999px; color: var(--muted-2); font-weight: 600; font-size: 13.5px; }
.nav a:hover { color: var(--text); background: var(--card-2); text-decoration: none; }
.nav a.on { background: var(--brand); color: var(--brand-ink); }
.top-right { display: flex; align-items: center; gap: 8px; }
.icon-btn { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 10px; border: 1px solid var(--line); background: var(--card); color: var(--muted-2); cursor: pointer; }
.icon-btn:hover { color: var(--text); border-color: var(--line-2); text-decoration: none; }
.avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: linear-gradient(135deg, var(--brand), #ff8a00); color: var(--brand-ink); font-weight: 800; font-size: 13px; text-transform: uppercase; }

/* ---------- Základné prvky ---------- */
main.wide { padding: 22px; max-width: 1440px; margin: 0 auto; }
.page-head { display: flex; align-items: end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head h1 { margin: 0; font-size: 24px; letter-spacing: -.01em; }
.page-head p { margin: 2px 0 0; color: var(--muted); }
h2 { font-size: 17px; margin: 28px 0 12px; } h3 { font-size: 15px; margin: 22px 0 10px; color: var(--muted-2); }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: 0 1px 0 rgba(255,255,255,.02) inset; }

input, select, textarea { font: inherit; color: var(--text); background: var(--card-2); border: 1px solid var(--line-2); border-radius: var(--radius-sm); padding: 9px 12px; outline: none; transition: border-color .15s, box-shadow .15s; }
input:focus, select:focus { border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 25%, transparent); }
button, .btn { font: inherit; font-weight: 700; display: inline-flex; align-items: center; gap: 8px; padding: 9px 16px; border-radius: var(--radius-sm); border: 1px solid transparent;
  background: var(--brand); color: var(--brand-ink); cursor: pointer; transition: transform .08s, filter .15s; white-space: nowrap; }
button:hover, .btn:hover { filter: brightness(1.06); text-decoration: none; }
button:active, .btn:active { transform: translateY(1px); }
.btn.ghost, button.ghost { background: var(--card-2); color: var(--text); border-color: var(--line-2); }
button.danger { background: color-mix(in srgb, var(--err) 18%, transparent); color: #fca5a5; border-color: color-mix(in srgb, var(--err) 45%, transparent); }
button.sm, .btn.sm { padding: 6px 10px; font-size: 13px; }
button.icon { padding: 7px 9px; }

.box { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--radius-sm); margin: 12px 0; background: var(--card); border: 1px solid var(--line-2); }
.box.error { border-color: color-mix(in srgb, var(--err) 50%, transparent); background: color-mix(in srgb, var(--err) 10%, var(--card)); }
.box.ok { border-color: color-mix(in srgb, var(--ok) 50%, transparent); background: color-mix(in srgb, var(--ok) 10%, var(--card)); }
.box.warn { border-color: color-mix(in srgb, var(--warn) 50%, transparent); background: color-mix(in srgb, var(--warn) 10%, var(--card)); }

.filters { display: flex; gap: 10px; align-items: end; flex-wrap: wrap; }
.filters label { display: flex; flex-direction: column; gap: 5px; font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }

/* ŠPZ štítok */
.plate { display: inline-flex; align-items: stretch; height: 24px; border-radius: 5px; overflow: hidden; background: #fff; color: #111; border: 1.5px solid #111;
  font: 700 13px/1 "DIN Alternate", "Arial Narrow", system-ui, sans-serif; letter-spacing: .06em; box-shadow: 0 1px 3px rgba(0,0,0,.35); flex: none; }
.plate i { font-style: normal; background: #0b4ea2; color: #fff; font-size: 8.5px; width: 15px; display: grid; place-items: end center; padding-bottom: 3px; letter-spacing: 0; }
.plate b { padding: 0 7px; display: grid; place-items: center; }
.plate.lg { height: 30px; font-size: 16px; } .plate.lg i { width: 18px; font-size: 10px; }

/* Stavové prvky */
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; background: var(--card-2); color: var(--muted-2); border: 1px solid var(--line); }
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill.move { color: var(--move); background: color-mix(in srgb, var(--move) 14%, transparent); border-color: color-mix(in srgb, var(--move) 30%, transparent); }
.pill.stop { color: #60a5fa; background: color-mix(in srgb, var(--stop) 14%, transparent); border-color: color-mix(in srgb, var(--stop) 30%, transparent); }
.pill.off { color: var(--muted); }
.pill.lock { color: var(--brand); background: color-mix(in srgb, var(--brand) 12%, transparent); border-color: color-mix(in srgb, var(--brand) 30%, transparent); }
.pill.lock::before { display: none; }

/* KPI dlaždice */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin: 0 0 18px; }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; position: relative; overflow: hidden; }
.kpi .l { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.kpi .v { font-size: 26px; font-weight: 800; letter-spacing: -.02em; margin-top: 2px; }
.kpi .v small { font-size: 14px; color: var(--muted); font-weight: 600; margin-left: 3px; }
.kpi.vcard::after { display: none; }
.kpi::after { content: ""; position: absolute; right: -20px; top: -20px; width: 80px; height: 80px; border-radius: 50%; background: color-mix(in srgb, var(--brand) 9%, transparent); }

/* Tabuľky */
.table-wrap { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: auto; }
table.grid { width: 100%; border-collapse: collapse; }
table.grid th, table.grid td { padding: 11px 14px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
table.grid th { position: sticky; top: 0; z-index: 1; font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); background: var(--card-2); font-weight: 700; }
table.grid tbody tr:hover { background: color-mix(in srgb, var(--brand) 4%, transparent); }
table.grid tr:last-child td { border-bottom: none; }
table.grid .r { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
table.grid .no { color: var(--muted); font-variant-numeric: tabular-nums; }
.route-cell { display: grid; grid-template-columns: 14px 1fr; gap: 2px 8px; align-items: center; }
.route-cell .d { width: 9px; height: 9px; border-radius: 50%; border: 2px solid var(--move); }
.route-cell .d.e { border-color: var(--err); }
form.inline { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin: 0; }
form.inline input { padding: 6px 9px; font-size: 13.5px; }
.w-driver { width: 150px; } .w-purpose { width: 250px; } .w-note { width: 140px; } .w-km { width: 150px; }

/* ---------- Mapa (celá obrazovka) ---------- */
body.map-page { overflow: hidden; }
.map-wrap { position: fixed; inset: 60px 0 0 0; }
#map { position: absolute; inset: 0; background: var(--bg-2); }
.map-dark .leaflet-tile-pane { filter: invert(100%) hue-rotate(180deg) brightness(.92) contrast(.88) saturate(.6); }
.leaflet-container { font: inherit; background: var(--bg-2) !important; }
.leaflet-control-attribution { background: color-mix(in srgb, var(--bg) 70%, transparent) !important; color: var(--muted) !important; }
.leaflet-control-attribution a { color: var(--muted-2) !important; }
.leaflet-bar a { background: var(--panel) !important; color: var(--text) !important; border-color: var(--line) !important; backdrop-filter: var(--blur); }

.panel { position: absolute; z-index: 500; top: 16px; left: 16px; bottom: 16px; width: 360px; display: flex; flex-direction: column;
  background: var(--panel); backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur); border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow); overflow: hidden; }
.panel-head { padding: 16px 16px 10px; }
.panel-head .row { display: flex; justify-content: space-between; align-items: center; }
.panel-head h2 { margin: 0; font-size: 18px; }
.live { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.live::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--move); box-shadow: 0 0 0 0 rgba(34,197,94,.6); animation: pulse 2s infinite; }
.live.err::before { background: var(--err); animation: none; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 12px; }
.stat { background: var(--card-2); border: 1px solid var(--line); border-radius: 12px; padding: 8px 10px; }
.stat b { display: block; font-size: 20px; font-weight: 800; line-height: 1.1; }
.stat span { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; font-weight: 600; }
.stat.move b { color: var(--move); } .stat.stop b { color: #60a5fa; } .stat.off b { color: var(--muted-2); }
.search { position: relative; margin-top: 12px; }
.search input { width: 100%; padding-left: 36px; background: var(--card-2); }
.search svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.cars { list-style: none; margin: 0; padding: 6px 10px 12px; overflow: auto; flex: 1; }
.car-card { display: grid; grid-template-columns: 1fr auto; gap: 6px 10px; padding: 12px; margin: 6px 0; border-radius: 14px; cursor: pointer;
  background: var(--card); border: 1px solid var(--line); transition: border-color .15s, transform .08s, background .15s; }
.car-card:hover { border-color: var(--line-2); }
.car-card.sel { border-color: var(--brand); background: color-mix(in srgb, var(--brand) 7%, var(--card)); }
.car-card .who { display: flex; align-items: center; gap: 8px; color: var(--muted-2); font-size: 13px; grid-column: 1 / -1; }
.car-card .ini { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: var(--card-2); border: 1px solid var(--line-2); font-size: 10px; font-weight: 800; color: var(--text); }
.car-card .addr { grid-column: 1 / -1; font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.car-card .spd { font-size: 20px; font-weight: 800; text-align: right; line-height: 1; font-variant-numeric: tabular-nums; }
.car-card .spd small { font-size: 11px; color: var(--muted); font-weight: 600; margin-left: 2px; }
.empty { text-align: center; color: var(--muted); padding: 30px 10px; }

.map-tools { position: absolute; z-index: 500; right: 16px; top: 16px; display: flex; flex-direction: column; gap: 8px; }
.map-tools .icon-btn { width: 42px; height: 42px; border-radius: 12px; background: var(--panel); backdrop-filter: var(--blur); box-shadow: var(--shadow); }
.map-tools .icon-btn.on { color: var(--brand); border-color: color-mix(in srgb, var(--brand) 50%, transparent); }
.map-tools { align-items: flex-end; }
.layer-switch { display: flex; gap: 4px; padding: 4px; background: var(--panel); backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
  border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); }
.layer-switch button { background: transparent; color: var(--muted-2); border: none; padding: 7px 11px; border-radius: 10px; font-size: 12.5px; font-weight: 700; gap: 6px; }
.layer-switch button:hover { color: var(--text); background: var(--card-2); filter: none; }
.layer-switch button.on { background: var(--brand); color: var(--brand-ink); }
.layer-switch svg.i { width: 16px; height: 16px; }
.hmap-wrap .layer-switch { position: absolute; z-index: 500; left: 14px; top: 14px; }

.detail { position: absolute; z-index: 600; right: 16px; bottom: 16px; width: 340px; background: var(--panel); backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
  border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow); padding: 16px; transform: translateY(20px); opacity: 0; pointer-events: none; transition: .2s ease; }
.detail.show { transform: none; opacity: 1; pointer-events: auto; }
.detail .row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.detail .big { display: flex; align-items: baseline; gap: 6px; margin: 14px 0 4px; }
.detail .big b { font-size: 44px; font-weight: 800; letter-spacing: -.03em; line-height: 1; font-variant-numeric: tabular-nums; }
.detail .big span { color: var(--muted); font-weight: 600; }
.detail dl { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 12px 0; font-size: 13px; }
.detail dt { color: var(--muted); } .detail dd { margin: 0; font-weight: 600; text-align: right; }
.detail .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.detail .close { position: absolute; top: 12px; right: 12px; }

/* Značky áut na mape */
.car-icon { background: none !important; border: none !important; }
.mk { position: relative; display: flex; align-items: center; gap: 6px; transform: translate(-17px, -17px); width: max-content; }
.mk .dot { position: relative; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--off); border: 3px solid #fff; box-shadow: 0 4px 12px rgba(0,0,0,.45); }
.mk.move .dot { background: var(--move); } .mk.stop .dot { background: var(--stop); }
.mk.move .dot::after { content: ""; position: absolute; inset: -9px; border-radius: 50%; border: 2px solid var(--move); animation: ring 1.8s ease-out infinite; }
.mk .dot svg { width: 16px; height: 16px; fill: #fff; stroke: none; }
.mk .lbl { background: rgba(10, 12, 16, .9); color: #fff; padding: 3px 8px; border-radius: 8px; font-size: 12px; font-weight: 800; letter-spacing: .04em; box-shadow: 0 2px 8px rgba(0,0,0,.4); }
.mk .lbl small { color: var(--brand); margin-left: 4px; font-weight: 700; }
.mk.sel .dot { border-color: var(--brand); box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 45%, transparent), 0 4px 12px rgba(0,0,0,.45); }
@keyframes ring { from { transform: scale(.6); opacity: .9; } to { transform: scale(1.5); opacity: 0; } }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(34,197,94,.55); } 70% { box-shadow: 0 0 0 8px rgba(34,197,94,0); } 100% { box-shadow: 0 0 0 0 rgba(34,197,94,0); } }

/* ---------- História ---------- */
.hist { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 16px; }
.hmap-wrap { position: relative; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); min-height: 560px; }
#hmap { position: absolute; inset: 0; }
.player { position: absolute; z-index: 500; left: 14px; right: 14px; bottom: 14px; display: flex; align-items: center; gap: 12px; padding: 10px 14px;
  background: var(--panel); backdrop-filter: var(--blur); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); }
.player input[type=range] { flex: 1; accent-color: var(--brand); padding: 0; background: none; border: none; box-shadow: none; }
.player .t { font-variant-numeric: tabular-nums; font-weight: 700; min-width: 64px; }
.player select { padding: 5px 8px; }
.timeline { list-style: none; margin: 0; padding: 0; max-height: 560px; overflow: auto; }
.trip { position: relative; padding: 12px 14px 12px 34px; border-radius: 12px; cursor: pointer; border: 1px solid transparent; }
.trip:hover { background: var(--card-2); border-color: var(--line); }
.trip::before { content: ""; position: absolute; left: 14px; top: 18px; bottom: -14px; width: 2px; background: var(--line-2); }
.trip:last-child::before { display: none; }
.trip::after { content: ""; position: absolute; left: 9px; top: 15px; width: 12px; height: 12px; border-radius: 50%; background: var(--card); border: 3px solid var(--brand); }
.trip .h { display: flex; justify-content: space-between; font-weight: 700; }
.trip .p { font-size: 12.5px; color: var(--muted); margin-top: 3px; }

/* ---------- Kniha jázd ---------- */
.vehicle-head { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.vehicle-head .meta { display: flex; gap: 22px; flex-wrap: wrap; color: var(--muted); font-size: 13px; }
.vehicle-head .meta b { display: block; color: var(--text); font-size: 14px; }
form.lock { margin: 18px 0; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }

/* ---------- Prihlásenie ---------- */
body.login-page { min-height: 100vh; display: grid; place-items: center; padding: 20px;
  background: radial-gradient(1200px 600px at 10% -10%, color-mix(in srgb, var(--brand) 18%, transparent), transparent 60%),
              radial-gradient(900px 500px at 110% 110%, rgba(59,130,246,.18), transparent 60%), var(--bg); }
.login-card { width: 100%; max-width: 400px; background: var(--panel); backdrop-filter: var(--blur); border: 1px solid var(--line); border-radius: 24px; box-shadow: var(--shadow); padding: 30px; }
.login-card .brand { justify-content: center; margin-bottom: 22px; font-size: 18px; }
.login-card label { display: flex; flex-direction: column; gap: 6px; margin: 14px 0; font-size: 13px; font-weight: 600; color: var(--muted-2); }
.login-card button { width: 100%; justify-content: center; padding: 12px; margin-top: 8px; font-size: 15px; }

/* ---------- Mobil ---------- */
@media (max-width: 900px) {
  .nav a span { display: none; } .nav a { padding: 8px 11px; }
  .brand span { display: none; }
  .hist { grid-template-columns: 1fr; }
}
@media (max-width: 700px) {
  .panel { top: auto; left: 8px; right: 8px; bottom: 8px; width: auto; height: 46vh; }
  .detail { left: 8px; right: 8px; width: auto; bottom: calc(46vh + 16px); }
  .map-tools { right: 8px; top: 8px; }
  .map-page .leaflet-control-zoom { display: none; }
  main.wide { padding: 14px; }
  .w-purpose { width: 100%; }
}

/* ---------- Tlač ---------- */
main.print { padding: 16px; }
main.print table.meta th { text-align: left; padding-right: 8px; color: var(--muted); font-weight: normal; }
main.print table.meta td { padding-right: 24px; font-weight: 600; }
@media print {
  :root { --bg: #fff; --card: #fff; --card-2: #f3f3f3; --text: #000; --muted: #555; --line: #ccc; --line-2: #bbb; }
  .top, .noprint { display: none !important; }
  body { background: #fff; color: #000; font-size: 10.5px; }
  table.grid th, table.grid td { padding: 3px 5px; border-bottom: 1px solid #ccc; }
}
@media (max-width: 700px) {
  .layer-switch span { display: none; }
  .layer-switch button { padding: 8px 9px; }
}
