:root {
  --bg: #F4F3EC;
  --surface: #FFFFFF;
  --surface-2: #FAF9F4;
  --ink: #16190F;
  --muted: #5B6150;
  --line: #DCD9C9;
  --brand: #2E5E1F;
  --brand-2: #3F7D2A;
  --brand-soft: #E5EFD9;
  --done: #2F8F2F;
  --done-soft: #E1F2DD;
  --progress: #C98A00;
  --progress-soft: #FFF2CC;
  --warn: #D9480F;
  --warn-soft: #FFE6DA;
  --danger: #C62828;
  --danger-soft: #FDE3E3;
  --water: #1E6FB8;
  --water-soft: #E0EEFB;
  --todo: #8A8F7E;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(22, 25, 15, .06), 0 4px 16px rgba(22, 25, 15, .06);
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--ink); font: 15px/1.45 var(--font); -webkit-font-smoothing: antialiased; font-variant-numeric: tabular-nums; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--brand); }
.boot { display: grid; place-items: center; height: 100vh; color: var(--muted); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.nowrap { white-space: nowrap; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- Tlačítka, odznaky ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 0 16px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); font-weight: 600; text-decoration: none; color: var(--ink); }
.btn:hover { border-color: #BDB9A4; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-2); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.sm { min-height: 32px; padding: 0 10px; font-size: 13px; border-radius: 8px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px; border-radius: 999px; font-size: 12.5px; font-weight: 600; white-space: nowrap; background: #EEEDE4; color: var(--muted); }
.badge::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge.hotovo, .badge.odeslano, .badge.online { background: var(--done-soft); color: var(--done); }
.badge.probiha, .badge.jede, .badge.kontrola { background: var(--progress-soft); color: #8A5D00; }
.badge.nedokonceno, .badge.stoji, .badge.chybi { background: var(--warn-soft); color: var(--warn); }
.badge.cizi, .badge.vysoka { background: var(--danger-soft); color: var(--danger); }
.badge.ceka, .badge.schazi { background: #EEEDE4; color: #4F5546; }
.chip-gps { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 700; letter-spacing: .02em; color: var(--brand); background: var(--brand-soft); border-radius: 6px; padding: 1px 6px; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; flex: none; }

/* ---------- Úvod ---------- */
.landing { max-width: 1040px; margin: 0 auto; padding: 40px 20px 60px; }
.logo { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 18px; letter-spacing: -.01em; color: var(--ink); text-decoration: none; }
.logo svg { width: 30px; height: 30px; }
.landing h1 { font-size: clamp(30px, 5vw, 48px); line-height: 1.08; letter-spacing: -.025em; margin: 40px 0 14px; max-width: 760px; }
.landing .lead { font-size: 18px; color: var(--muted); max-width: 640px; margin: 0 0 28px; }
.regions { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 28px; }
.region { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 8px 16px; font-weight: 600; }
.region[aria-pressed='true'] { background: var(--ink); color: #fff; border-color: var(--ink); }
.roles { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; }
.role { display: block; text-decoration: none; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 24px; box-shadow: var(--shadow); transition: transform .12s, border-color .12s; }
.role:hover { transform: translateY(-2px); border-color: var(--brand); }
.role h2 { margin: 12px 0 6px; font-size: 22px; }
.role p { margin: 0; color: var(--muted); }
.role .go { margin-top: 18px; font-weight: 700; color: var(--brand); }
.role-ico { width: 48px; height: 48px; border-radius: 12px; background: var(--brand-soft); display: grid; place-items: center; color: var(--brand); }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; margin-top: 36px; }
.fact { border-top: 2px solid var(--ink); padding-top: 10px; }
.fact b { display: block; font-size: 15px; margin-bottom: 4px; }
.fact span { color: var(--muted); font-size: 14px; }
.tip { margin-top: 28px; padding: 14px 16px; border-radius: 12px; background: var(--surface-2); border: 1px dashed var(--line); color: var(--muted); font-size: 14px; }

/* ---------- Kancelář ---------- */
.office { display: grid; grid-template-rows: auto auto 1fr; height: 100vh; height: 100dvh; }
.topbar { display: flex; align-items: center; gap: 16px; padding: 10px 20px; background: var(--surface); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.topbar .farm { display: flex; flex-direction: column; line-height: 1.2; }
.topbar .farm b { font-size: 15px; }
.topbar .farm span { font-size: 12.5px; color: var(--muted); }
.topbar .spacer { flex: 1; }
.select { min-height: 36px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); padding: 0 10px; }
.demo { display: flex; align-items: center; gap: 12px; padding: 8px 20px; background: #FFF8E1; border-bottom: 1px solid #F0E2B0; flex-wrap: wrap; font-size: 13.5px; }
.demo .lbl { font-weight: 700; color: #7A5A00; text-transform: uppercase; letter-spacing: .06em; font-size: 11.5px; }
.demo .clock { font-size: 20px; font-weight: 800; min-width: 62px; }
.demo input[type=range] { flex: 1; min-width: 160px; accent-color: var(--brand); }
.demo .speeds { display: flex; gap: 4px; }
.demo .speeds button { border: 1px solid #E5D49A; background: #fff; border-radius: 7px; padding: 3px 8px; font-size: 12.5px; font-weight: 600; }
.demo .speeds button[aria-pressed='true'] { background: #7A5A00; color: #fff; border-color: #7A5A00; }
.office-body { display: grid; grid-template-columns: 220px 1fr; min-height: 0; }
.nav { border-right: 1px solid var(--line); background: var(--surface-2); padding: 14px 10px; display: flex; flex-direction: column; gap: 2px; overflow: auto; }
.nav a { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 9px 12px; border-radius: 9px; color: var(--ink); text-decoration: none; font-weight: 500; }
.nav a:hover { background: #EFEEE5; }
.nav a[aria-current='page'] { background: var(--ink); color: #fff; }
.nav .count { font-size: 12px; font-weight: 700; background: var(--danger); color: #fff; border-radius: 999px; padding: 0 7px; min-width: 20px; text-align: center; }
.nav .sep { height: 1px; background: var(--line); margin: 10px 4px; }
.page { overflow: auto; padding: 20px 24px 40px; min-width: 0; }
.page h1 { font-size: 22px; letter-spacing: -.015em; margin: 0 0 4px; }
.page .sub { color: var(--muted); margin: 0 0 18px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 16px 0; }
.card-h h2 { font-size: 14px; margin: 0; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.card-b { padding: 12px 16px 16px; }

.overview { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 16px; height: calc(100dvh - 190px); min-height: 520px; }
.mapwrap { position: relative; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); background: #dfe3d4; min-height: 420px; }
.mapwrap .map { position: absolute; inset: 0; }
.map-tools { position: absolute; top: 12px; left: 12px; display: flex; gap: 6px; flex-wrap: wrap; z-index: 2; }
.seg { display: inline-flex; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 3px; box-shadow: var(--shadow); }
.seg button { border: 0; background: transparent; padding: 5px 10px; border-radius: 7px; font-size: 13px; font-weight: 600; color: var(--muted); }
.seg button[aria-pressed='true'] { background: var(--ink); color: #fff; }
.legend { position: absolute; left: 12px; bottom: 12px; background: rgba(255, 255, 255, .95); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; font-size: 12.5px; display: flex; gap: 12px; flex-wrap: wrap; z-index: 2; max-width: calc(100% - 24px); }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 5px; vertical-align: -2px; border: 1px solid rgba(0, 0, 0, .15); }
.side { display: flex; flex-direction: column; gap: 12px; overflow: auto; min-height: 0; padding-right: 2px; }
.kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; }
.kpi .v { font-size: 24px; font-weight: 800; letter-spacing: -.02em; line-height: 1.1; }
.kpi .l { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.kpi.hot .v { color: var(--danger); }
.machine { display: grid; grid-template-columns: auto 1fr auto; gap: 4px 12px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); }
.machine:first-child { border-top: 0; }
.machine .name { font-weight: 700; }
.machine .meta { grid-column: 2 / 4; font-size: 13px; color: var(--muted); }
.bar { height: 8px; border-radius: 99px; background: #ECEADF; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--done); border-radius: 99px; transition: width .4s; }
.bar.amber > i { background: var(--progress); }
.season-row { padding: 8px 0; border-top: 1px solid var(--line); }
.season-row:first-child { border-top: 0; }
.season-row .top { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 6px; font-size: 14px; }
.season-row .top b { font-weight: 600; }
.feed-item { display: grid; grid-template-columns: 44px 1fr; gap: 8px; padding: 8px 0; border-top: 1px solid var(--line); font-size: 13.5px; }
.feed-item:first-child { border-top: 0; }
.feed-item .t { color: var(--muted); font-weight: 600; }

.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.chips { display: inline-flex; gap: 4px; flex-wrap: wrap; }
.chips button { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 5px 12px; font-size: 13px; font-weight: 600; }
.chips button[aria-pressed='true'] { background: var(--ink); color: #fff; border-color: var(--ink); }
.summary { display: flex; gap: 22px; flex-wrap: wrap; margin: 0 0 14px; }
.summary div { font-size: 13px; color: var(--muted); }
.summary b { display: block; font-size: 20px; color: var(--ink); letter-spacing: -.01em; }

table.t { width: 100%; border-collapse: collapse; font-size: 14px; }
table.t th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; padding: 10px 12px; border-bottom: 1px solid var(--line); background: var(--surface-2); position: sticky; top: 0; }
table.t td { padding: 10px 12px; border-bottom: 1px solid #ECEADF; vertical-align: middle; }
table.t tr.click { cursor: pointer; }
table.t tr.click:hover td { background: #FAFAF5; }
table.t td.num, table.t th.num { text-align: right; }
table.t .code { font-weight: 700; }
table.t .code small { display: block; font-weight: 500; color: var(--muted); font-size: 12px; }
table.t input, table.t select { border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; background: #fff; max-width: 170px; }
table.t input.davka { width: 72px; }
.tablewrap { overflow: auto; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface); }

.planner { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 14px; }
.job { display: grid; grid-template-columns: 1fr auto; gap: 6px; padding: 10px 0; border-top: 1px solid var(--line); }
.job .acts { display: flex; gap: 2px; }
.job .acts button { width: 30px; height: 30px; border-radius: 7px; border: 1px solid var(--line); background: #fff; }
.job .sprej { grid-column: 1 / 3; display: flex; gap: 6px; align-items: center; font-size: 13px; }
.job .sprej select, .job .sprej input { border: 1px solid var(--line); border-radius: 7px; padding: 4px 6px; }
.job .sprej input { width: 64px; }
.addrow { display: flex; gap: 6px; padding-top: 10px; border-top: 1px solid var(--line); }
.addrow select { flex: 1; min-width: 0; }

.exc { display: grid; grid-template-columns: 6px 1fr auto; gap: 14px; padding: 14px 16px; }
.exc + .exc { border-top: 1px solid var(--line); }
.exc .stripe { border-radius: 4px; background: var(--todo); }
.exc.vysoka .stripe { background: var(--danger); }
.exc.stredni .stripe { background: var(--warn); }
.exc.nizka .stripe { background: var(--progress); }
.exc h3 { margin: 0 0 3px; font-size: 15px; }
.exc p { margin: 0; color: var(--muted); font-size: 13.5px; }

.sources { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.source { padding: 16px; }
.source h3 { margin: 6px 0 4px; font-size: 16px; }
.source dl { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; margin: 12px 0 0; font-size: 13.5px; }
.source dt { color: var(--muted); }
.source dd { margin: 0; font-weight: 500; }
.source.lpis { grid-column: 1 / -1; border-color: var(--brand); background: linear-gradient(0deg, var(--surface), var(--surface)), var(--brand-soft); }
.source.add { border-style: dashed; box-shadow: none; background: transparent; }

.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(440px, 100vw); background: var(--surface); box-shadow: -10px 0 40px rgba(0, 0, 0, .15); z-index: 40; display: flex; flex-direction: column; }
.drawer-h { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; padding: 18px 20px 12px; border-bottom: 1px solid var(--line); }
.drawer-h h2 { margin: 0; font-size: 20px; }
.drawer-b { padding: 16px 20px 30px; overflow: auto; }
.kv { display: grid; grid-template-columns: 140px 1fr; gap: 6px 12px; font-size: 14px; margin: 0 0 16px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 500; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: grid; grid-template-columns: 70px 1fr; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); font-size: 14px; }
.src-note { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 6px; margin-bottom: 14px; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 10px; font-weight: 600; z-index: 60; box-shadow: var(--shadow); }

/* ---------- Řidič ---------- */
.driver { position: fixed; inset: 0; display: grid; grid-template-rows: auto 1fr auto; background: #000; }
.d-top { display: flex; align-items: center; gap: 12px; padding: 10px 14px; padding-top: max(10px, env(safe-area-inset-top)); background: #fff; border-bottom: 2px solid var(--ink); z-index: 3; }
.d-top .who { line-height: 1.15; }
.d-top .who b { font-size: 17px; display: block; }
.d-top .who span { font-size: 13px; color: var(--muted); }
.d-top .clock { margin-left: auto; font-size: 22px; font-weight: 800; }
.d-top .sig { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 700; color: var(--done); }
.d-top .menu { width: 48px; height: 48px; border-radius: 12px; border: 2px solid var(--ink); background: #fff; display: grid; place-items: center; }
.d-map { position: relative; min-height: 0; }
.d-map .map { position: absolute; inset: 0; }
.d-locate { position: absolute; right: 14px; top: 14px; width: 60px; height: 60px; border-radius: 16px; border: 2px solid var(--ink); background: #fff; display: grid; place-items: center; z-index: 2; box-shadow: var(--shadow); }
.d-panel { background: #fff; border-top: 2px solid var(--ink); padding: 16px 18px; padding-bottom: max(16px, env(safe-area-inset-bottom)); z-index: 3; }
.d-op { font-size: 14px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.d-block { font-size: clamp(30px, 6vw, 44px); font-weight: 800; letter-spacing: -.02em; line-height: 1.05; margin: 2px 0 10px; }
.d-progress { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 14px; }
.d-progress .bar { height: 22px; background: #E4E2D6; border: 2px solid var(--ink); }
.d-progress .pct { font-size: clamp(34px, 7vw, 52px); font-weight: 800; letter-spacing: -.03em; line-height: 1; }
.d-left { font-size: 19px; font-weight: 600; margin: 10px 0 14px; }
.d-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.d-btn { min-height: 72px; border-radius: 16px; border: 3px solid var(--ink); background: #fff; font-size: 21px; font-weight: 800; display: flex; align-items: center; justify-content: center; gap: 10px; color: var(--ink); text-decoration: none; }
.d-btn.ok { background: var(--done); border-color: #1F6B1F; color: #fff; }
.d-btn.warn { background: #fff; border-color: var(--warn); color: var(--warn); }
.d-btn.wide { grid-column: 1 / -1; }
.d-go { display: grid; grid-template-columns: auto 1fr; gap: 18px; align-items: center; }
.d-arrow { width: 92px; height: 92px; border-radius: 50%; background: var(--ink); color: #fff; display: grid; place-items: center; }
.d-arrow svg { width: 54px; height: 54px; transition: transform .4s; }
.d-km { font-size: 40px; font-weight: 800; letter-spacing: -.02em; line-height: 1; }
.d-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.d-tabs button { min-height: 56px; border-radius: 14px; border: 2px solid var(--line); background: var(--surface-2); font-size: 17px; font-weight: 700; }
.d-tabs button[aria-pressed='true'] { border-color: var(--ink); background: #fff; }
.d-list { background: #fff; overflow: auto; }
.d-row { display: grid; grid-template-columns: 46px 1fr auto; gap: 14px; align-items: center; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.d-row .n { width: 46px; height: 46px; border-radius: 50%; border: 2px solid var(--ink); display: grid; place-items: center; font-weight: 800; font-size: 18px; }
.d-row.hotovo .n { background: var(--done); border-color: var(--done); color: #fff; }
.d-row.aktivni { background: #FFF8E1; }
.d-row b { font-size: 20px; display: block; }
.d-row span { color: var(--muted); }
.d-row .p { font-size: 22px; font-weight: 800; }

.d-pick { background: var(--bg); min-height: 100vh; padding: 24px 18px 40px; }
.d-pick h1 { font-size: 28px; margin: 18px 0 4px; }
.d-pick .grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; margin-top: 18px; }
.d-pick .who { display: block; text-align: left; background: #fff; border: 3px solid var(--ink); border-radius: 18px; padding: 18px; min-height: 120px; }
.d-pick .who b { font-size: 22px; display: block; }
.d-pick .who span { display: block; color: var(--muted); font-size: 15px; margin-top: 4px; }
.d-pick .who .op { margin-top: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; font-size: 13px; color: var(--ink); }

.d-alert { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 20px; background: rgba(0, 0, 0, .55); }
.alert-box { width: min(560px, 100%); border-radius: 22px; padding: 28px 24px 22px; background: #fff; border: 6px solid var(--danger); text-align: center; }
.alert-box.water { border-color: var(--water); }
.alert-box.reason { border-color: var(--ink); text-align: left; }
.alert-ico { width: 84px; height: 84px; border-radius: 50%; margin: 0 auto 12px; display: grid; place-items: center; background: var(--danger); color: #fff; }
.alert-box.water .alert-ico { background: var(--water); }
.alert-box h2 { font-size: 30px; line-height: 1.1; margin: 0 0 10px; letter-spacing: -.02em; }
.alert-box p { font-size: 19px; margin: 0 0 22px; color: #333; }
.reasons { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 12px; }

@media (max-width: 1100px) {
  .overview { grid-template-columns: 1fr; height: auto; }
  .overview .mapwrap { height: 60vh; }
}
@media (max-width: 760px) {
  .office { height: auto; min-height: 100dvh; }
  .office-body { grid-template-columns: 1fr; }
  .nav { flex-direction: row; border-right: 0; border-bottom: 1px solid var(--line); padding: 8px; overflow-x: auto; position: sticky; top: 0; z-index: 5; }
  .nav a { white-space: nowrap; padding: 8px 10px; }
  .nav .sep, .nav .navfoot { display: none; }
  .page { padding: 16px 16px 40px; }
  .topbar { padding: 10px 16px; }
  .demo { padding: 8px 16px; }
  .kv { grid-template-columns: 120px 1fr; }
  .d-actions { grid-template-columns: 1fr 1fr; }
  .d-btn { min-height: 64px; font-size: 18px; }
  .reasons { grid-template-columns: 1fr; }
}
