/* =====================================================================
   Meteo Otice – vzhled veřejné stránky
   ===================================================================== */
:root {
  color-scheme: light;
  --bg: #f1f2ee;
  --surface-1: #fcfcfb;
  --surface-2: #eef0eb;
  --border: #dcdfd7;
  --text-primary: #0b0b0b;
  --text-secondary: #52514e;
  --text-muted: #77766f;
  --grid: #e5e7e1;
  --axis: #b6b8b0;
  --header: #22303a;
  --header-2: #2d3d48;
  --header-text: #f1f2ee;
  --header-muted: #aab6bd;
  --hero: #22303a;
  --hero-text: #f8f8f6;
  --hero-muted: #b9c3c9;
  --accent: #2a78d6;
  --s-temp: #eb6834;
  --s-dew: #2a78d6;
  --s-hum: #1baf7a;
  --s-sig: #6250d6;
  --p0: #2a78d6; --p1: #eb6834; --p2: #1baf7a; --p3: #eda100;
  --p4: #e87ba4; --p5: #008300; --p6: #6250d6; --p7: #e34948;
  --good: #0ca30c; --warning: #fab219; --critical: #d03b3b;
  --div-mid: #f0efec;
  --shadow: 0 1px 2px rgba(20, 30, 35, .06), 0 2px 8px rgba(20, 30, 35, .04);
}
@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --bg: #121211; --surface-1: #1a1a19; --surface-2: #232321; --border: #33332f;
    --text-primary: #f0efec; --text-secondary: #c3c2b7; --text-muted: #96958c;
    --grid: #2a2a27; --axis: #4a4a45; --header: #182128; --header-2: #22303a; --hero: #22303a;
    --accent: #3987e5; --s-temp: #d95926; --s-dew: #3987e5; --s-hum: #199e70; --s-sig: #9085e9;
    --p0: #3987e5; --p1: #d95926; --p2: #199e70; --p3: #c98500;
    --p4: #d55181; --p5: #008300; --p6: #9085e9; --p7: #e66767;
    --div-mid: #383835; --shadow: none;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #121211; --surface-1: #1a1a19; --surface-2: #232321; --border: #33332f;
  --text-primary: #f0efec; --text-secondary: #c3c2b7; --text-muted: #96958c;
  --grid: #2a2a27; --axis: #4a4a45; --header: #182128; --header-2: #22303a; --hero: #22303a;
  --accent: #3987e5; --s-temp: #d95926; --s-dew: #3987e5; --s-hum: #199e70; --s-sig: #9085e9;
  --p0: #3987e5; --p1: #d95926; --p2: #199e70; --p3: #c98500;
  --p4: #d55181; --p5: #008300; --p6: #9085e9; --p7: #e66767;
  --div-mid: #383835; --shadow: none;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--text-primary);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}
.num { font-variant-numeric: tabular-nums; }
button { font: inherit; color: inherit; }
.link-btn {
  all: unset; cursor: pointer; color: var(--accent); font-weight: 600; font-size: 13px;
  display: inline-flex; align-items: center; gap: 4px;
}
.link-btn:hover { text-decoration: underline; }
.link-btn:focus-visible, .cell-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 3px; }
.cell-btn { all: unset; cursor: pointer; border-bottom: 1px dashed var(--axis); }
.cell-btn:hover { border-bottom-color: var(--accent); color: var(--accent); }

/* ---------- hlavička ---------- */
.top { background: var(--header); color: var(--header-text); }
.top-in { max-width: 1160px; margin: 0 auto; padding: 10px 16px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 650; font-size: 17px; }
.brand small { display: block; font-weight: 400; font-size: 12px; color: var(--header-muted); }
.spacer { flex: 1; }
.seg { display: inline-flex; background: var(--header-2); border-radius: 8px; padding: 3px; }
.seg button { all: unset; cursor: pointer; padding: 5px 12px; border-radius: 6px; color: var(--header-muted); font-size: 14px; font-weight: 600; }
.seg button[aria-pressed="true"] { background: var(--header-text); color: var(--header); }
.seg button:focus-visible, .icon-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.icon-btn { all: unset; cursor: pointer; width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center; background: var(--header-2); color: var(--header-text); }

main { max-width: 1160px; margin: 0 auto; padding: 16px; display: grid; gap: 16px; }
main > * { min-width: 0; }

/* ---------- řada čidel ---------- */
.strip { display: grid; grid-template-columns: repeat(auto-fill, minmax(155px, 1fr)); gap: 12px; }
.tile {
  all: unset; cursor: pointer; background: var(--surface-1); border: 1px solid var(--border); border-radius: 12px;
  padding: 12px 14px; box-shadow: var(--shadow); display: grid; gap: 2px; position: relative;
}
.tile:hover { border-color: var(--axis); }
.tile:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.tile[aria-pressed="true"] { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.tile .nm { font-weight: 650; display: flex; align-items: center; gap: 7px; }
.tile .nm i { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.tile .pl { font-size: 12px; color: var(--text-muted); }
.tile .tv { font-size: 26px; font-weight: 600; letter-spacing: -.5px; margin-top: 4px; }
.tile .hv { font-size: 13px; color: var(--text-secondary); }
.status { font-size: 12px; color: var(--text-secondary); display: inline-flex; align-items: center; gap: 5px; margin-top: 4px; }
.status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--good); }
.status.off::before { background: var(--critical); }

/* ---------- souhrn ---------- */
.summary { display: grid; grid-template-columns: 1.05fr 1fr 1fr; gap: 16px; }
@media (max-width: 920px) { .summary { grid-template-columns: 1fr 1fr; } .hero-card { grid-column: 1 / -1; } }
@media (max-width: 620px) { .summary { grid-template-columns: 1fr; } }
.card { background: var(--surface-1); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow); overflow: hidden; min-width: 0; }
.card h2 { margin: 0; font-size: 13px; font-weight: 650; text-transform: uppercase; letter-spacing: .6px; color: var(--text-secondary); padding: 14px 16px 8px; display: flex; align-items: center; gap: 8px; }
.card h2 .link-btn { margin-left: auto; text-transform: none; letter-spacing: 0; }

.hero-card { background: var(--hero); color: var(--hero-text); border: none; display: flex; flex-direction: column; }
.hero-main { padding: 16px 18px 12px; position: relative; }
.hero-main::before { content: ""; position: absolute; left: 0; top: 18px; bottom: 16px; width: 4px; border-radius: 0 4px 4px 0; background: var(--hero-accent, var(--s-temp)); }
.hero-label { font-size: 13px; color: var(--hero-muted); text-transform: uppercase; letter-spacing: .6px; font-weight: 600; }
.hero-value { display: flex; align-items: baseline; gap: 4px 10px; margin-top: 2px; flex-wrap: wrap; }
.hero-value b { font-size: 56px; font-weight: 600; line-height: 1.05; letter-spacing: -1.5px; }
.hero-value span { font-size: 22px; color: var(--hero-muted); }
.trend { white-space: nowrap; font-size: 14px; color: var(--hero-muted); margin-left: auto; }
.hero-time { font-size: 13px; color: var(--hero-muted); margin-top: 4px; }
.hero-minis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2px; margin-top: auto; background: rgba(255,255,255,.08); }
.mini { background: var(--hero); padding: 11px 16px 13px; }
.mini .k { font-size: 12px; color: var(--hero-muted); display: flex; align-items: center; gap: 6px; }
.mini .k i { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.mini .v { font-size: 21px; font-weight: 600; margin-top: 2px; }

/* ---------- tabulky ---------- */
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 7px 14px; text-align: right; white-space: nowrap; }
th:first-child, td:first-child { text-align: left; }
thead th { font-size: 12px; font-weight: 600; color: var(--text-muted); border-bottom: 1px solid var(--border); }
tbody tr + tr td { border-top: 1px solid var(--grid); }
td.muted, .muted { color: var(--text-secondary); }
.stat td:first-child { color: var(--text-secondary); }
.sub { font-size: 12px; color: var(--text-muted); display: block; }
.scroll { max-height: 440px; overflow: auto; border: 1px solid var(--border); border-radius: 8px; }
.scroll thead th { position: sticky; top: 0; background: var(--surface-1); z-index: 1; }
.empty { padding: 16px; color: var(--text-secondary); }

/* ---------- záložky ---------- */
.tabs { display: flex; border-bottom: 1px solid var(--border); overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
.tabs button { all: unset; cursor: pointer; padding: 13px 16px; font-size: 14px; font-weight: 600; color: var(--text-secondary); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs button[aria-selected="true"] { color: var(--text-primary); border-bottom-color: var(--accent); }
.tabs button:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.panel { padding: 16px; display: grid; gap: 20px; }
.panel[hidden] { display: none; }
.panel > * { min-width: 0; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 860px) { .two { grid-template-columns: 1fr; } }
.two > * { min-width: 0; }
.sec-title { margin: 0 0 6px; font-size: 15px; font-weight: 650; display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.sec-title small { font-weight: 400; color: var(--text-muted); font-size: 12px; }

.tiles4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
@media (max-width: 700px) { .tiles4 { grid-template-columns: 1fr 1fr; } }
.tiles4 > div { background: var(--surface-2); border-radius: 8px; padding: 10px 12px; }
.tiles4 .k { font-size: 12px; color: var(--text-muted); }
.tiles4 .v { font-size: 20px; font-weight: 600; }
.tiles4 .t { font-size: 12px; color: var(--text-secondary); }

.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { all: unset; cursor: pointer; font-size: 13px; font-weight: 600; padding: 5px 11px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); color: var(--text-secondary); display: inline-flex; align-items: center; gap: 6px; }
.chip[aria-pressed="true"] { background: var(--text-primary); color: var(--surface-1); border-color: var(--text-primary); }
.chip:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.chip i { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.form-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.form-row input, .form-row select { padding: 6px 9px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface-1); color: var(--text-primary); font: inherit; }

/* ---------- grafy ---------- */
.legend { display: flex; gap: 14px; font-size: 13px; color: var(--text-secondary); flex-wrap: wrap; font-weight: 400; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 16px; height: 2px; border-radius: 2px; display: inline-block; }
.legend i.band { height: 10px; opacity: .25; border-radius: 3px; }
.chart { position: relative; width: 100%; }
.chart svg { display: block; width: 100%; overflow: visible; }
.chart text { font-size: 11px; fill: var(--text-muted); font-variant-numeric: tabular-nums; }
.chart .dl { font-size: 12px; fill: var(--text-secondary); font-weight: 600; }
.tip {
  position: absolute; pointer-events: none; background: var(--surface-1); border: 1px solid var(--border);
  border-radius: 8px; padding: 8px 10px; font-size: 13px; box-shadow: 0 4px 16px rgba(0,0,0,.14);
  min-width: 150px; opacity: 0; transition: opacity .08s; z-index: 3; white-space: nowrap;
}
.tip .tt { color: var(--text-secondary); font-size: 12px; margin-bottom: 4px; }
.tip .row { display: flex; align-items: center; gap: 12px; justify-content: space-between; }
.tip .row span { display: inline-flex; align-items: center; gap: 6px; color: var(--text-secondary); }
.tip .row i { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.tip .row b { font-weight: 600; color: var(--text-primary); font-variant-numeric: tabular-nums; }
.heat { position: relative; }
.heat canvas { display: block; width: 100%; image-rendering: pixelated; border-radius: 4px; }
.heat-legend { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-muted); margin-top: 6px; }
.heat-legend .bar { height: 10px; flex: 0 1 220px; border-radius: 3px; }
.heat-axis { display: flex; justify-content: space-between; font-size: 11px; color: var(--text-muted); margin-top: 3px; }

/* ---------- okno (dialog) ---------- */
dialog {
  border: 1px solid var(--border); border-radius: 14px; padding: 0; background: var(--surface-1); color: var(--text-primary);
  width: min(920px, calc(100vw - 24px)); max-height: calc(100vh - 32px); box-shadow: 0 20px 60px rgba(0,0,0,.3);
}
dialog::backdrop { background: rgba(10, 14, 16, .55); }
.dlg-head { display: flex; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--surface-1); z-index: 2; }
.dlg-head h3 { margin: 0; font-size: 17px; }
.dlg-head button { all: unset; cursor: pointer; margin-left: auto; width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center; background: var(--surface-2); }
.dlg-head button:focus-visible { outline: 2px solid var(--accent); }
.dlg-body { padding: 16px 18px 20px; display: grid; gap: 18px; }
.dlg-body > * { min-width: 0; }
.note { font-size: 12px; color: var(--text-muted); }

footer { max-width: 1160px; margin: 0 auto; padding: 0 16px 28px; font-size: 12px; color: var(--text-muted); }
.loading { padding: 40px; text-align: center; color: var(--text-muted); }

/* tlačítko Správa (jen z domácí sítě) */
.admin-btn { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border-radius: 8px; background: var(--header-2); color: var(--header-text); text-decoration: none; font-size: 14px; font-weight: 600; }
.admin-btn[hidden] { display: none; }
.admin-btn:hover { background: var(--accent); }
.admin-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
