/* Petřín monitoring — Statotest brand 2026.02 (black/red/indigo, Manrope, 70/20/10) */
:root {
  --black: #000000; --white: #ffffff;
  --red: #E21752; --indigo: #1F04A3;
  --n1: #f6f6f7; --n2: #e5e5e8; --n3: #5a5a62;
  --bg: #0b0b0d; --panel: #16161a; --panel2: #1e1e24; --line: #2a2a31;
  --ok: #22c55e; --warn: #f59e0b; --off: #5a5a62;
  --txt: #f6f6f7; --muted: #9a9aa4; --dim: #6a6a74; --zero: #3a3a44;
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #f6f6f7; --panel: #ffffff; --panel2: #eeeef1; --line: #dcdce1;
  --txt: #17171c; --muted: #5a5a62; --dim: #8a8a92; --zero: #c2c2ca;
  color-scheme: light;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: 'Manrope', system-ui, sans-serif; background: var(--bg); color: var(--txt);
  -webkit-font-smoothing: antialiased; line-height: 1.45;
}
.wrap { max-width: 1400px; margin: 0 auto; padding: 20px 24px 60px; }

/* Header */
header { display: flex; align-items: center; justify-content: space-between; padding: 8px 0 20px; border-bottom: 1px solid var(--line); margin-bottom: 22px; }
.logo { font-weight: 800; letter-spacing: -0.5px; font-size: 20px; line-height: 0.95; }
.logo span { display: block; }
.logo .t2 { color: var(--red); }
.title { text-align: right; }
.title h1 { font-size: 19px; font-weight: 700; }
.title p { font-size: 13px; color: var(--muted); }
.updated { font-size: 12px; color: var(--muted); }

/* Stat strip */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin-bottom: 24px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; }
.stat .k { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.5px; }
.stat .v { font-size: 26px; font-weight: 700; margin-top: 4px; }
.stat .v small { font-size: 14px; color: var(--muted); font-weight: 400; }

/* Map */
#map { height: 380px; border-radius: 14px; border: 1px solid var(--line); margin-bottom: 26px; z-index: 1; }
.leaflet-popup-content-wrapper { background: var(--panel2); color: var(--txt); border-radius: 10px; }
.leaflet-popup-tip { background: var(--panel2); }
.mp-pop b { color: var(--red); }
.mp-pop .d { font-size: 12px; color: var(--muted); margin-top: 4px; white-space: pre-line; }

/* Section title */
h2.sec { font-size: 15px; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); margin: 8px 0 14px; }

/* Station cards */
.stations { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 18px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; }
.card-h { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.card-h .id { font-size: 22px; font-weight: 800; letter-spacing: -0.5px; }
.card-h .wall { font-size: 12px; color: var(--muted); }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; margin-right: 6px; }
.dot.on { background: var(--ok); box-shadow: 0 0 8px var(--ok); }
.dot.off { background: var(--off); }
.badge { font-size: 11px; padding: 3px 8px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); }
.badge.on { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 40%, transparent); }

.card-b { padding: 14px 18px 18px; }
.sensrow { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.chip { font-size: 12px; padding: 4px 10px; border-radius: 8px; background: var(--panel2); border: 1px solid var(--line); color: var(--muted); }
.chip b { color: var(--txt); }

.dynos { display: grid; gap: 8px; }
.dyno { background: var(--panel2); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.dyno .lbl { font-size: 12px; color: var(--muted); }
.dyno .force { font-size: 20px; font-weight: 700; }
.dyno .force small { font-size: 12px; color: var(--muted); font-weight: 400; }
.dyno .meta { font-size: 11px; color: var(--muted); text-align: right; }
.dyno.fault .force { color: var(--warn); }
.dyno.nodata .force { color: var(--off); font-size: 14px; }
.dyno-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.dyno-main { flex-shrink: 0; }
.dyno .meta { white-space: nowrap; }
.spark { width: 100%; height: 40px; display: block; margin-top: 10px; }
.spark-ax { display: flex; justify-content: space-between; font-size: 10px; color: var(--muted); margin-top: 2px; }
.spark-ax span:nth-child(2) { color: color-mix(in srgb, var(--muted) 80%, transparent); }

.src-label { font-size: 11px; color: var(--muted); margin: 10px 0 6px; text-transform: uppercase; letter-spacing: 0.5px; }
.desc { font-size: 12px; color: var(--muted); margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--line); white-space: pre-line; }
/* Vrty */
.boreholes { display: grid; grid-template-columns: repeat(auto-fill, minmax(440px, 1fr)); gap: 18px; }
.borehole { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; }
.bore-h { padding: 14px 18px; border-bottom: 1px solid var(--line); }
.bore-h .id { font-size: 20px; font-weight: 800; }
.bore-h .wall { font-size: 12px; color: var(--muted); }
.bore-body { display: flex; gap: 14px; padding: 16px 18px; align-items: flex-start; }
.bore { width: 250px; height: 340px; flex-shrink: 0; }
.bore .ax-t { fill: var(--muted); font-size: 9px; font-family: 'Manrope', sans-serif; }
.bore .ax-t.muted { fill: #6a6a74; }
.bore-info { flex: 1; min-width: 0; }
.bore-note { font-size: 12px; color: var(--muted); margin-bottom: 12px; line-height: 1.5; }
.bore-tab { width: 100%; border-collapse: collapse; font-size: 12px; }
.bore-tab th { text-align: right; color: var(--muted); font-weight: 600; padding: 5px 8px; border-bottom: 1px solid var(--line); font-size: 11px; }
.bore-tab th:first-child { text-align: left; }
.bore-tab td { text-align: right; padding: 5px 8px; border-bottom: 1px solid var(--panel2); font-variant-numeric: tabular-nums; }
.bore-tab td:first-child { text-align: left; color: var(--muted); }
.bore-empty { color: var(--muted); padding: 40px; text-align: center; }

/* Alarmy */
.alarm-panel { margin-bottom: 24px; }
.al-sum { display: flex; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.al-chip { font-size: 13px; padding: 8px 14px; border-radius: 10px; background: var(--panel); border: 1px solid var(--line); }
.al-chip b { font-size: 16px; margin-right: 4px; }
.al-chip.alarm { border-color: var(--red); color: var(--red); }
.al-chip.warn { border-color: var(--warn); color: var(--warn); }
.al-chip.ok { border-color: color-mix(in srgb, var(--ok) 50%, var(--line)); color: var(--ok); }
.al-list { display: grid; gap: 8px; }
.al-item { display: flex; align-items: center; gap: 10px; padding: 10px 14px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; font-size: 13px; }
.al-item.alarm { border-left: 3px solid var(--red); }
.al-item.warn { border-left: 3px solid var(--warn); }
.al-dot { width: 8px; height: 8px; border-radius: 50%; }
.al-dot.alarm { background: var(--red); box-shadow: 0 0 8px var(--red); }
.al-dot.warn { background: var(--warn); }
.al-st { font-weight: 700; }
.al-type { color: var(--muted); }
.al-item b { margin-left: auto; font-variant-numeric: tabular-nums; }
.al-lv { font-size: 11px; padding: 2px 8px; border-radius: 6px; }
.al-lv.alarm { background: color-mix(in srgb, var(--red) 20%, transparent); color: var(--red); }
.al-lv.warn { background: color-mix(in srgb, var(--warn) 20%, transparent); color: var(--warn); }
.al-none { color: var(--ok); font-size: 14px; padding: 12px 16px; background: var(--panel); border: 1px solid color-mix(in srgb, var(--ok) 30%, var(--line)); border-radius: 10px; }

/* Události */
.events { display: grid; gap: 2px; }
.ev-row { display: grid; grid-template-columns: 60px 16px 1fr auto; align-items: center; gap: 12px; padding: 10px 14px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; font-size: 13px; }
.ev-time { font-size: 12px; color: var(--muted); text-align: right; }
.ev-dot { width: 10px; height: 10px; border-radius: 50%; }
.ev-dot.alarm { background: var(--red); box-shadow: 0 0 8px var(--red); }
.ev-dot.warn { background: var(--warn); }
.ev-dot.ok { background: var(--ok); }
.ev-st { font-weight: 700; }
.ev-type { color: var(--muted); }
.ev-lv { font-size: 11px; padding: 2px 8px; border-radius: 6px; }
.ev-lv.alarm { background: color-mix(in srgb, var(--red) 20%, transparent); color: var(--red); }
.ev-lv.warn { background: color-mix(in srgb, var(--warn) 20%, transparent); color: var(--warn); }

/* GNSS */
.gnss-note { font-size: 13px; color: var(--muted); background: var(--panel); border: 1px solid var(--line); border-left: 3px solid var(--warn); border-radius: 10px; padding: 12px 16px; margin-bottom: 16px; line-height: 1.5; }
.gnss-note b { color: var(--txt); }
.gnss-toggle { display: flex; gap: 8px; margin-bottom: 10px; }
.tg { font-size: 12px; padding: 6px 14px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel2); color: var(--muted); cursor: pointer; font-family: inherit; }
.tg.on { background: var(--red); border-color: var(--red); color: #fff; font-weight: 600; }
.gnss-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 18px; }
.gnss-card { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 16px 18px; }
.gnss-card.wide { grid-column: 1 / -1; }
@media (min-width: 900px) { .gnss-card.wide { grid-column: span 2; } }
.gc-h { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 12px; }
.gc-h .id { font-size: 18px; font-weight: 800; }
.gc-h .wall { font-size: 12px; color: var(--muted); }
.gc-acc { font-size: 12px; color: var(--muted); text-align: right; }
.gc-acc span { display: inline-block; margin-top: 2px; padding: 1px 7px; border-radius: 6px; background: var(--panel2); border: 1px solid var(--line); font-size: 10px; }
.gc-acc span.rtk { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 40%, transparent); }
.gc-cur { display: flex; gap: 16px; margin-bottom: 12px; flex-wrap: wrap; }
.gc-kv span { display: block; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.4px; }
.gc-kv b { font-size: 16px; font-weight: 700; }
.gc-chart { height: 200px; position: relative; }
.gc-chart.tall { height: 360px; }

/* Karta klikací + detail modal */
.card.clickable { cursor: pointer; transition: border-color .15s, transform .15s; position: relative; }
.card.clickable:hover { border-color: var(--red); }
.card-detail-hint { position: absolute; top: 16px; right: 90px; font-size: 11px; color: var(--muted); opacity: 0; transition: opacity .15s; }
.card.clickable:hover .card-detail-hint { opacity: 1; }

.detail-modal { position: fixed; inset: 0; background: rgba(0,0,0,.7); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); display: none; align-items: flex-start; justify-content: center; z-index: 1000; padding: 40px 20px; overflow-y: auto; }
.detail-modal.open { display: flex; }
.dm-inner { background: var(--panel); border: 1px solid var(--line); border-radius: 18px; width: 100%; max-width: 900px; }
.dm-head { display: flex; align-items: center; justify-content: space-between; padding: 20px 24px; border-bottom: 1px solid var(--line); }
.dm-id { font-size: 26px; font-weight: 800; }
.dm-wall { font-size: 13px; color: var(--muted); }
.dm-actions { display: flex; gap: 10px; align-items: center; }
.dm-btn { font-size: 13px; padding: 8px 14px; border-radius: 9px; background: var(--panel2); border: 1px solid var(--line); color: var(--txt); text-decoration: none; cursor: pointer; }
.dm-btn:hover { border-color: var(--red); }
.dm-close { width: 34px; height: 34px; border-radius: 9px; background: var(--panel2); border: 1px solid var(--line); color: var(--txt); cursor: pointer; font-size: 15px; }
.dm-body { padding: 22px 24px; }
.dm-rawbar { display: flex; align-items: center; gap: 14px; margin-bottom: 22px; padding: 12px 16px; background: var(--panel2); border: 1px solid var(--line); border-radius: 10px; flex-wrap: wrap; }
.dm-rawbar .raw-toggle { margin-left: 0; color: var(--txt); }
.dm-rawbar .dim { font-size: 12px; color: #6a6a74; }
.dm-block { margin-bottom: 26px; }
.dm-block h4 { font-size: 14px; font-weight: 700; margin-bottom: 12px; color: var(--txt); }
.dm-sub { font-size: 12px; color: var(--muted); font-weight: 400; margin-left: 6px; }
.dm-chart { height: 260px; position: relative; }
.dm-r { font-size: 12px; color: var(--txt); margin-top: 10px; }
.dm-note { font-size: 13px; color: var(--muted); padding: 14px 16px; background: var(--panel2); border: 1px solid var(--line); border-radius: 10px; margin-bottom: 14px; line-height: 1.5; }
.dm-note.dim, .dm-r .dim { color: #6a6a74; }

/* Výběr období */
.period-bar { display: flex; align-items: center; gap: 14px; margin: 6px 0 20px; flex-wrap: wrap; }
.period-label { font-size: 13px; color: var(--muted); font-weight: 600; }
.period-btns { display: flex; gap: 6px; }
.pb { font-size: 13px; padding: 7px 16px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel2); color: var(--muted); cursor: pointer; font-family: inherit; }
.pb.on { background: var(--indigo); border-color: var(--indigo); color: #fff; font-weight: 600; }
.period-range { display: flex; gap: 6px; align-items: center; font-size: 13px; color: var(--muted); }
.pdate { background: var(--panel2); border: 1px solid var(--line); color: var(--txt); border-radius: 7px; padding: 6px 9px; font-family: inherit; font-size: 12px; color-scheme: inherit; }
.pb.ghost { background: transparent; color: var(--txt); }
.pb.ghost:hover { border-color: var(--indigo); }
.raw-toggle { display: flex; align-items: center; gap: 7px; font-size: 13px; color: var(--muted); cursor: pointer; margin-left: auto; -webkit-user-select: none; user-select: none; }
.raw-toggle input { accent-color: var(--red); width: 15px; height: 15px; }

/* Vrt detail (průběh + animace) */
.borehole.clickable { cursor: pointer; transition: border-color .15s; }
.borehole.clickable:hover { border-color: var(--red); }
.bore-h { display: flex; align-items: flex-start; justify-content: space-between; }
.bore-hint { font-size: 11px; color: var(--muted); opacity: 0; transition: opacity .15s; }
.borehole.clickable:hover .bore-hint { opacity: 1; }
.bd-wrap { display: flex; gap: 24px; align-items: flex-start; flex-wrap: wrap; }
.bd-svg { width: 340px; height: 460px; flex-shrink: 0; }
.bd-svg .ax-t { fill: var(--muted); font-size: 10px; font-family: 'Manrope', sans-serif; }
.bd-svg .ax-t.muted { fill: #6a6a74; }
.bd-side { flex: 1; min-width: 240px; }
.bd-time { font-size: 15px; font-weight: 700; margin-bottom: 14px; }
.bd-ctrl { display: flex; gap: 12px; align-items: center; margin-bottom: 18px; }
#bd-play { font-size: 13px; padding: 8px 16px; border-radius: 9px; background: var(--red); border: none; color: #fff; cursor: pointer; font-family: inherit; font-weight: 600; white-space: nowrap; }
.bd-slider { flex: 1; accent-color: var(--red); cursor: pointer; }

.loading { text-align: center; padding: 60px; color: var(--muted); }
.err { background: color-mix(in srgb, var(--red) 15%, var(--panel)); border: 1px solid var(--red); border-radius: 10px; padding: 14px; color: var(--txt); }

/* ── Přihlášení ─────────────────────────────────────────────────────── */
.login-modal { position: fixed; inset: 0; background: var(--bg); display: flex; align-items: center; justify-content: center; z-index: 2000; padding: 24px; }
.login-modal.hidden { display: none; }
.login-box { width: 100%; max-width: 380px; background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: 34px 30px; display: flex; flex-direction: column; gap: 12px; box-shadow: 0 24px 60px rgba(0,0,0,.35); }
.login-logo { font-weight: 800; font-size: 22px; letter-spacing: -0.5px; }
.login-logo .t2 { color: var(--red); }
.login-box h2 { font-size: 20px; font-weight: 700; margin-top: 6px; }
.login-sub { font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.login-box input { background: var(--panel2); border: 1px solid var(--line); color: var(--txt); border-radius: 10px; padding: 12px 14px; font-family: inherit; font-size: 14px; }
.login-box input:focus { outline: none; border-color: var(--red); }
.login-box button { background: var(--red); border: none; color: #fff; border-radius: 10px; padding: 12px; font-family: inherit; font-size: 15px; font-weight: 700; cursor: pointer; margin-top: 4px; }
.login-box button:disabled { opacity: .6; cursor: default; }
.login-err { color: var(--red); font-size: 13px; min-height: 0; }
.login-note { font-size: 12px; color: var(--muted); border-top: 1px dashed var(--line); padding-top: 12px; margin-top: 4px; line-height: 1.5; }
.login-note b { color: var(--txt); }

/* ── Topbar (uživatel + akce) ───────────────────────────────────────── */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 4px 0 12px; flex-wrap: wrap; }
.user { font-size: 13px; color: var(--muted); }
.user b { color: var(--txt); font-weight: 700; }
.user .role { display: inline-block; margin-left: 8px; padding: 2px 9px; border-radius: 999px; background: var(--panel2); border: 1px solid var(--line); font-size: 11px; color: var(--muted); }
.tb-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.tb-btn { font-size: 13px; padding: 7px 13px; border-radius: 9px; border: 1px solid var(--line); background: var(--panel2); color: var(--txt); cursor: pointer; font-family: inherit; }
.tb-btn:hover { border-color: var(--red); }

/* ── Kalibrace ──────────────────────────────────────────────────────── */
.calib-global { display: flex; align-items: center; gap: 12px; padding: 14px 16px; background: var(--panel2); border: 1px solid var(--line); border-radius: 10px; margin-bottom: 18px; flex-wrap: wrap; }
.calib-global label { font-size: 13px; color: var(--txt); font-weight: 600; }
.calib-note { font-size: 12px; color: var(--muted); line-height: 1.5; margin-bottom: 16px; }
.calib-row { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 10px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.calib-row.head { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; border-bottom: 1px solid var(--line); padding-bottom: 8px; }
.calib-row .cl-name { font-size: 13px; font-weight: 600; }
.calib-row .cl-name small { display: block; color: var(--muted); font-weight: 400; font-size: 11px; }
.calib-inp { background: var(--panel2); border: 1px solid var(--line); color: var(--txt); border-radius: 8px; padding: 8px 10px; font-family: inherit; font-size: 13px; width: 100%; color-scheme: inherit; }
.calib-inp:focus { outline: none; border-color: var(--red); }
.calib-actions { display: flex; gap: 10px; align-items: center; margin-top: 20px; }
.calib-save { background: var(--red); border: none; color: #fff; border-radius: 9px; padding: 10px 20px; font-family: inherit; font-size: 14px; font-weight: 700; cursor: pointer; }
.calib-reset { background: var(--panel2); border: 1px solid var(--line); color: var(--txt); border-radius: 9px; padding: 10px 16px; font-family: inherit; font-size: 13px; cursor: pointer; }
.calib-msg { font-size: 13px; color: var(--ok); }

/* ── Analýza úseku ──────────────────────────────────────────────────── */
.dm-analysis { margin-top: 10px; padding: 12px 14px; background: var(--panel2); border: 1px solid var(--line); border-radius: 10px; }
.an-top { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 10px; }
.an-top .an-hint { font-size: 12px; color: var(--dim); }
.an-btn { font-size: 12px; padding: 5px 11px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel); color: var(--txt); cursor: pointer; font-family: inherit; }
.an-btn:hover { border-color: var(--red); }
.an-zero { display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--txt); cursor: pointer; -webkit-user-select: none; user-select: none; }
.an-zero input { accent-color: var(--red); width: 14px; height: 14px; }
.an-stats { display: flex; gap: 8px; flex-wrap: wrap; }
.an-stat { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 6px 11px; font-size: 12px; min-width: 74px; }
.an-stat .k { color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .4px; }
.an-stat .v { font-weight: 700; font-variant-numeric: tabular-nums; margin-top: 1px; }
.an-range { font-size: 11px; color: var(--dim); margin-top: 8px; }
