/* Vzduch doma
   Desktop: left 40 % = status banner + 2×3 sensor tiles + pressure strip; right 60 % = permanent history chart + insights.
   ≤1100 px: panes stack (banner, tiles, chart, insights). */
:root{
  --bg:#F2F4F3; --tile:#FFFFFF; --ink:#111716; --muted:#56625F; --faint:#8C9794; --line:#DCE2E0;
  --accent:#2A6C88;
  --good:#1E8E4E; --fair:#C27400; --poor:#C9302C;
  --good-soft:#E5F3EA; --fair-soft:#FFF4E0; --poor-soft:#FCEBEA;
  --poor-strong:#B8261F; --on-strong:#FFFFFF; --on-strong-line:rgba(255,255,255,.32);
  --band-fair:rgba(214,138,0,.14); --band-poor:rgba(201,48,44,.12); --ribbon:rgba(17,23,22,.09);
  --thr-fair:rgba(194,116,0,.65); --thr-poor:rgba(201,48,44,.75); --txt-fair:#8A5300; --txt-poor:#A3261F;
  --hatch-poor:rgba(201,48,44,.38); --exc-fair-o:.22; --exc-poor-o:.26;
  --night:rgba(17,23,22,.04); --ghost:#A3ADAA; --sel-ring:var(--ink); --on-fair:#1A1206;
  --srv:#3A3F47; --on-srv:#FFFFFF;
  --f-num:"Barlow Semi Condensed","Arial Narrow",system-ui,sans-serif;
  --f-ui:"Archivo",system-ui,-apple-system,"Segoe UI",Roboto,sans-serif;
}
@media (prefers-color-scheme: dark){
  :root:not([data-theme="light"]){
    --bg:#0D1110; --tile:#161B1A; --ink:#ECF1EF; --muted:#9AA6A2; --faint:#68746F; --line:#272E2C;
    --accent:#72B6D4;
    --good:#3CC57B; --fair:#F0A53A; --poor:#FF5D55;
    --good-soft:#12261B; --fair-soft:#2D2211; --poor-soft:#3A1517;
    --poor-strong:#A8221C; --on-strong:#FFFFFF; --on-strong-line:rgba(255,255,255,.28);
    --band-fair:rgba(240,165,58,.12); --band-poor:rgba(255,93,85,.14); --ribbon:rgba(236,241,239,.11);
    --thr-fair:rgba(240,165,58,.6); --thr-poor:rgba(255,93,85,.7); --txt-fair:#F0A53A; --txt-poor:#FF5D55;
    --hatch-poor:rgba(255,93,85,.45); --exc-fair-o:.26; --exc-poor-o:.30;
    --night:rgba(236,241,239,.04); --ghost:#5A6662; --sel-ring:#8C9894; --on-fair:#1A1206;
    --srv:#3A3F47; --on-srv:#FFFFFF;
    color-scheme:dark;
  }
}
:root[data-theme="dark"]{
  --bg:#0D1110; --tile:#161B1A; --ink:#ECF1EF; --muted:#9AA6A2; --faint:#68746F; --line:#272E2C;
  --accent:#72B6D4;
  --good:#3CC57B; --fair:#F0A53A; --poor:#FF5D55;
  --good-soft:#12261B; --fair-soft:#2D2211; --poor-soft:#3A1517;
  --poor-strong:#A8221C; --on-strong:#FFFFFF; --on-strong-line:rgba(255,255,255,.28);
  --band-fair:rgba(240,165,58,.12); --band-poor:rgba(255,93,85,.14); --ribbon:rgba(236,241,239,.11);
  --thr-fair:rgba(240,165,58,.6); --thr-poor:rgba(255,93,85,.7); --txt-fair:#F0A53A; --txt-poor:#FF5D55;
  --hatch-poor:rgba(255,93,85,.45); --exc-fair-o:.26; --exc-poor-o:.30;
  --night:rgba(236,241,239,.04); --ghost:#5A6662; --sel-ring:#8C9894; --on-fair:#1A1206;
  --srv:#3A3F47; --on-srv:#FFFFFF;
  color-scheme:dark;
}

*{box-sizing:border-box}
[hidden]{display:none!important}
html,body{margin:0}
body{background:var(--bg);color:var(--ink);font-family:var(--f-ui);font-size:15px;line-height:1.45;-webkit-font-smoothing:antialiased;overflow-x:hidden}
button{font:inherit;color:inherit}
p{margin:0}
:focus-visible{outline:2px solid var(--accent);outline-offset:2px}
.wrap{max-width:1920px;margin:0 auto;min-height:100dvh;padding-block:10px 10px;padding-left:max(16px,env(safe-area-inset-left,0px));padding-right:max(16px,env(safe-area-inset-right,0px));display:flex;flex-direction:column;gap:10px}

.btn{border:1px solid var(--line);background:var(--tile);border-radius:999px;padding:4px 11px;cursor:pointer;font-size:13px}
.btn:hover{border-color:var(--faint)}

/* Header */
.top{display:flex;align-items:baseline;justify-content:space-between;gap:8px 16px;flex-wrap:wrap}
.place{display:flex;align-items:baseline;gap:4px 14px;flex-wrap:wrap}
.place h1{margin:0;font-family:var(--f-num);font-weight:600;font-size:26px;letter-spacing:.01em;line-height:1.1}
.place span{color:var(--muted);font-size:14px}
.top-right{display:flex;align-items:center;gap:14px}
.clock{font-family:var(--f-num);font-weight:500;font-size:30px;font-variant-numeric:tabular-nums;line-height:1}


/* Two panes */
.panes{flex:1;display:grid;grid-template-columns:minmax(0,4fr) minmax(0,6fr);gap:14px;min-height:0}
.left,.right{display:flex;flex-direction:column;gap:12px;min-width:0;min-height:0}

/* Status banner */
.banner{display:flex;flex-direction:column;gap:8px;padding:14px 20px 10px;border-radius:16px;background:var(--tile);border:1px solid var(--line)}
.b-main{display:flex;gap:12px;align-items:flex-start;min-width:0}
.b-icon{flex:none;width:18px;height:18px;margin-top:.45em;display:grid;place-items:center}
.b-icon svg{width:18px;height:18px}
.b-title{font-size:clamp(21px,1.75vw,28px);font-weight:600;line-height:1.15;text-wrap:balance}
.b-act{margin-top:3px;font-size:16px}
.b-more{margin-top:3px;font-size:14px;font-weight:500}
.b-fresh{display:flex;justify-content:space-between;flex-wrap:wrap;gap:2px 16px;border-top:1px solid var(--line);padding-top:9px;font-size:13.5px;color:var(--muted);font-variant-numeric:tabular-nums;position:relative}
.b-fresh .now{color:var(--ink);font-weight:500}
.b-fresh.late .now{color:var(--fair);font-weight:600}
.sweep{position:absolute;left:0;right:0;top:-1px;height:2px;background:var(--accent);transform-origin:left;transform:scaleX(0);opacity:0}
.sweep.go{animation:sweep 1.4s ease-out}
@keyframes sweep{0%{transform:scaleX(0);opacity:1}70%{transform:scaleX(1);opacity:1}100%{transform:scaleX(1);opacity:0}}
.banner.poor{background:var(--poor-strong);border-color:var(--poor-strong);color:var(--on-strong)}
.banner.poor .b-title{font-weight:700;font-size:clamp(23px,2vw,32px)}
.banner.poor .b-fresh{border-top-color:var(--on-strong-line);color:var(--on-strong)}
.banner.poor .b-fresh .now{color:var(--on-strong)}
.banner.fair{background:var(--fair-soft);border-color:var(--fair)}
.banner.fair .b-fresh{border-top-color:var(--fair)}
.banner.off .b-act{color:var(--muted)}

/* Sensor tiles */
.grid{flex:1;display:grid;grid-template-columns:repeat(2,minmax(0,1fr));grid-template-rows:repeat(3,1fr);gap:10px}
.tile{position:relative;display:flex;flex-direction:column;gap:2px;text-align:left;background:var(--tile);border:1px solid var(--line);border-radius:14px;padding:10px 14px 8px;cursor:pointer;min-width:0}
.tile:hover{border-color:var(--faint)}
.tile.fair{border-color:var(--fair);box-shadow:inset 0 0 0 1px var(--fair)}
.tile.poor{background:var(--poor-soft);border-color:var(--poor);box-shadow:inset 0 0 0 1px var(--poor)}
/* selected = neutral double ring around the tile, independent of status colour */
.tile.sel{box-shadow:0 0 0 3px var(--bg),0 0 0 5px var(--sel-ring)}
.tile.sel.fair{box-shadow:inset 0 0 0 1px var(--fair),0 0 0 3px var(--bg),0 0 0 5px var(--sel-ring)}
.tile.sel.poor{box-shadow:inset 0 0 0 1px var(--poor),0 0 0 3px var(--bg),0 0 0 5px var(--sel-ring)}
.t-head{display:flex;justify-content:space-between;align-items:center;gap:8px}
.t-name{font-family:var(--f-num);font-weight:600;font-size:16px;letter-spacing:.07em;text-transform:uppercase;color:var(--muted)}
.chip{display:inline-flex;align-items:center;gap:6px;font-weight:600;font-size:14px;white-space:nowrap}
.chip svg{width:11px;height:11px;flex:none}
.t-val{display:flex;align-items:baseline;gap:6px;flex-wrap:wrap}
.num{font-family:var(--f-num);font-weight:600;font-size:clamp(40px,6.4vh,74px);line-height:.95;font-variant-numeric:tabular-nums;letter-spacing:-.01em}
.unit{font-family:var(--f-num);font-weight:500;font-size:clamp(15px,2vh,22px);color:var(--muted)}
.t-sub{color:var(--muted);font-size:13px;font-variant-numeric:tabular-nums;min-height:1.4em;line-height:1.4;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.t-trend{font-size:13px;font-weight:500;font-variant-numeric:tabular-nums;min-height:1.4em;line-height:1.4}
.spark{flex:1 1 0;min-height:14px;max-height:44px;position:relative;margin-top:3px}
.spark svg{position:absolute;inset:0;display:block;width:100%;height:100%;overflow:visible}
.sp-band{fill:var(--good-soft)}
.sp-line{fill:none;stroke:var(--ink);stroke-width:1.5;stroke-linejoin:round;vector-effect:non-scaling-stroke;opacity:.75}
.sp-dot{position:absolute;right:-4px;width:7px;height:7px;border-radius:50%;background:var(--ink);transform:translateY(-50%);box-shadow:0 0 0 2px var(--tile)}
.tile.poor .sp-dot{box-shadow:0 0 0 2px var(--poor-soft)}
.t-foot{display:flex;justify-content:space-between;gap:8px;font-size:11.5px;color:var(--faint);letter-spacing:.02em;white-space:nowrap}
.t-foot .here{color:var(--ink);font-weight:600;visibility:hidden}
.tile.sel .t-foot .here{visibility:visible}
.panes.dead .tile .t-val,.panes.dead .tile .spark{opacity:.42}

/* Pressure strip */
.strip{flex-direction:row;align-items:center;gap:14px;padding:10px 14px}
.strip .t-name{flex:none}
.strip .t-val{flex:none}
.strip .num{font-size:30px}
.strip .unit{font-size:16px}
.strip .s-mid{flex:1;min-width:0;display:flex;flex-direction:column}
.strip .s-mid span{font-size:13px;line-height:1.35;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.strip .spark{flex:none;width:120px;height:30px;margin:0}
.strip .here{flex:none;font-size:11.5px;font-weight:600;visibility:hidden}
.strip.sel .here{visibility:visible}

/* History card */
.card{background:var(--tile);border:1px solid var(--line);border-radius:16px;padding:16px 20px}
.hist{flex:1;display:flex;flex-direction:column;gap:10px;min-height:0}
.h-head{display:flex;justify-content:space-between;align-items:flex-end;gap:10px 20px;flex-wrap:wrap}
.eyebrow{font-size:12px;letter-spacing:.08em;text-transform:uppercase;color:var(--muted);font-weight:600}
.h-title{display:flex;align-items:baseline;gap:4px 14px;flex-wrap:wrap;margin-top:2px}
.h-title h2{margin:0;font-family:var(--f-num);font-weight:600;font-size:30px;line-height:1}
.h-title .num{font-size:30px}
.h-title .unit{font-size:17px}
.h-title .t-trend{color:var(--muted);min-height:0}
.ranges{display:flex;gap:6px;flex-wrap:wrap}
.ranges button{white-space:nowrap;border:1px solid var(--line);background:transparent;border-radius:999px;padding:5px 14px;cursor:pointer;font-weight:500;font-size:14px}
.ranges button:hover{border-color:var(--faint)}
.ranges button[aria-pressed="true"]{background:var(--ink);color:var(--bg);border-color:var(--ink)}
.sum{display:flex;flex-wrap:wrap;align-items:flex-end;gap:10px 28px;border-top:1px solid var(--line);border-bottom:1px solid var(--line);padding-block:10px}
.stats{display:flex;gap:10px 28px;flex-wrap:wrap}
.stats div{display:flex;flex-direction:column;min-width:0}
.stats span{font-size:11.5px;color:var(--muted);letter-spacing:.05em;text-transform:uppercase}
.stats b{font-family:var(--f-num);font-weight:600;font-size:24px;font-variant-numeric:tabular-nums;line-height:1.15}
#share{flex:1;min-width:220px}
.share-bar{display:flex;gap:2px;height:9px;border-radius:5px;overflow:hidden}
.share-bar i{display:block;height:100%}
.share-lbl{display:flex;flex-wrap:wrap;gap:2px 16px;margin-top:6px;font-size:13px}
.share-lbl span{display:inline-flex;gap:6px;align-items:center;font-variant-numeric:tabular-nums}
.share-lbl svg{width:10px;height:10px}
.legend{display:flex;flex-wrap:wrap;gap:4px 16px;font-size:12.5px;color:var(--muted)}
.legend span{display:inline-flex;align-items:center;gap:6px}
.legend i{display:inline-block;width:16px;height:10px;border-radius:2px}
.legend i.ln{height:2px;border-radius:1px}
.legend .cmp{margin-left:auto;display:inline-flex;align-items:center;gap:6px;cursor:pointer;color:var(--ink)}
.chart{flex:1 1 0;min-height:230px;position:relative;min-width:0}
.chart svg{position:absolute;inset:0;display:block;width:100%;height:100%;overflow:visible}
.c-grid{stroke:var(--line);stroke-width:1}
.c-axis{stroke:var(--faint);stroke-width:1}
.c-txt{fill:var(--muted);font-size:11.5px;font-family:var(--f-ui);font-variant-numeric:tabular-nums}
.c-thr{fill:var(--ink);font-size:11.5px;font-weight:600;font-family:var(--f-ui)}
.c-thr-fair{fill:var(--txt-fair)} .c-thr-poor{fill:var(--txt-poor)}
.c-thrline{shape-rendering:crispEdges}
.c-thrline-fair{stroke:var(--thr-fair);stroke-width:1}
.c-thrline-poor{stroke:var(--thr-poor);stroke-width:1.5}
.c-exc-fair{fill:var(--fair);fill-opacity:var(--exc-fair-o)}
.c-exc-poor{fill:var(--poor);fill-opacity:var(--exc-poor-o)}
.c-exc-hatch{fill:url(#hatch-poor)}
.c-hatch{stroke:var(--hatch-poor);stroke-width:1}
.c-strip-fair{fill:var(--fair)} .c-strip-poor{fill:var(--poor)}
.c-out{fill:var(--muted);font-size:11px;font-weight:600;font-family:var(--f-ui)}
.c-line{fill:none;stroke:var(--ink);stroke-width:2;stroke-linejoin:round;stroke-linecap:round}
.c-line2{fill:none;stroke:var(--accent);stroke-width:2;stroke-linejoin:round;stroke-linecap:round}
.c-line-fair{stroke:var(--fair);stroke-width:2.5}
.c-line-poor{stroke:var(--poor);stroke-width:3}
.c-ghost{fill:none;stroke:var(--ghost);stroke-width:1.5;stroke-linejoin:round}
.c-night{fill:var(--night)}
.c-band{fill:var(--muted);font-size:11px;font-weight:600;font-family:var(--f-ui)}
.c-band-fair{fill:var(--txt-fair)} .c-band-poor{fill:var(--txt-poor)}
.c-rib{fill:var(--ribbon)}
.c-brush{fill:var(--accent);fill-opacity:.14;stroke:var(--accent);stroke-width:1}
.zoombar{display:flex;align-items:center;gap:12px;flex-wrap:wrap;font-size:12.5px;color:var(--faint);min-height:26px}
.zoombar.on{color:var(--ink);font-weight:500}
.zoombar button{border:1px solid var(--line);background:var(--tile);border-radius:999px;padding:3px 11px;cursor:pointer;font-size:13px;font-weight:500}
.zoombar button:hover{border-color:var(--faint)}
.h-ctrl{display:flex;gap:10px 14px;flex-wrap:wrap;align-items:center}
.views{display:flex;gap:2px;padding:2px;border:1px solid var(--line);border-radius:999px}
.views button{border:0;background:transparent;border-radius:999px;padding:4px 12px;cursor:pointer;font-weight:500;font-size:14px;white-space:nowrap}
.views button[aria-pressed="true"]{background:var(--ink);color:var(--bg)}
.view{flex:1;display:flex;flex-direction:column;gap:10px;min-height:0}
.map-sum{display:flex;gap:10px 28px;flex-wrap:wrap;border-top:1px solid var(--line);border-bottom:1px solid var(--line);padding-block:10px}
.map-sum div{display:flex;flex-direction:column;min-width:0}
.map-sum span{font-size:11.5px;color:var(--muted);letter-spacing:.05em;text-transform:uppercase}
.map-sum b{font-family:var(--f-num);font-weight:600;font-size:22px;font-variant-numeric:tabular-nums;line-height:1.2}
.hm{flex:1;display:flex;flex-direction:column;gap:3px;container-type:inline-size;min-height:0}
.hm-row{display:grid;grid-template-columns:28px repeat(24,minmax(0,1fr));gap:3px;flex:1;min-height:22px}
.hm-hd{flex:none;min-height:0;font-size:11px;color:var(--muted);font-variant-numeric:tabular-nums}
.hm-wd{font-size:13px;color:var(--muted);align-self:center}
.hm-c{border-radius:4px;display:grid;place-items:center;min-width:0;overflow:hidden;font-size:10.5px;font-weight:500;font-variant-numeric:tabular-nums;color:var(--ink)}
.hm-c.fair{color:var(--on-fair)}
.hm-c.poor{color:var(--on-strong)}
@container (max-width: 820px){ .hm-c .v{display:none} }
.b-power{display:flex;align-items:center;gap:8px;width:fit-content;margin-top:8px;padding:5px 10px;border:1px solid var(--line);border-radius:8px;font-size:14px;font-weight:500}
.b-power svg{width:20px;height:12px;flex:none}
.banner.poor .b-power{border-color:var(--on-strong-line)}
.c-fair{fill:var(--band-fair)} .c-poor{fill:var(--band-poor)}
.c-ref{stroke:var(--poor);stroke-width:1.5;stroke-dasharray:5 4}
.c-reftxt{fill:var(--poor);font-size:11.5px;font-weight:600;font-family:var(--f-ui)}
.c-dot{fill:var(--ink);stroke:var(--tile);stroke-width:2}
.c-cross{stroke:var(--faint);stroke-width:1}
.tip{position:absolute;pointer-events:none;background:var(--ink);color:var(--bg);padding:7px 10px;border-radius:8px;font-size:13px;line-height:1.35;white-space:nowrap;transform:translate(-50%,-100%);font-variant-numeric:tabular-nums;z-index:2}
.tip b{font-weight:600}
.note{color:var(--muted);font-size:13px;line-height:1.4;max-width:95ch}
.note .later{color:var(--faint)}

/* Insights */
.ins{padding:12px 20px 14px}
.ins ul{list-style:none;margin:6px 0 0;padding:0;display:grid;grid-template-columns:repeat(auto-fit,minmax(200px,1fr));gap:8px 24px}
.ins li{display:flex;gap:10px;font-size:14px;line-height:1.35}
.ins li::before{content:"";flex:none;width:6px;height:6px;border-radius:50%;background:var(--faint);margin-top:.5em}
.ins li.warn::before{background:var(--fair);width:8px;height:8px;margin-top:.42em}
.ins small{display:block;color:var(--muted);font-size:12.5px}

footer{display:flex;flex-wrap:wrap;justify-content:space-between;gap:4px 20px;color:var(--muted);font-size:12.5px;font-variant-numeric:tabular-nums}
.pill{white-space:nowrap;display:inline-flex;align-items:center;gap:6px}
.pill::before{content:"";width:7px;height:7px;border-radius:50%;background:var(--good)}
.pill.down::before{background:var(--faint)}

.swap{animation:xf .3s ease}
@keyframes xf{from{opacity:.2}to{opacity:1}}

/* Stacked: tablet & phone */
@media (max-width:1100px){
  .wrap{min-height:0}
  .panes{grid-template-columns:minmax(0,1fr)}
  .grid{grid-template-rows:none;flex:none}
  .tile{min-height:170px}
  .strip{min-height:0}
  .hist{flex:none}
  .chart{flex:none;height:320px}
}
@media (max-width:700px){
  .tile{padding:11px 12px 9px;min-height:160px;border-radius:12px}
  .num{font-size:clamp(34px,10vw,48px)}
  .t-name{font-size:14px}
  .chip{font-size:13px}
  .banner{padding:14px 16px 10px}
  .card{padding:14px 14px}
  .chart{height:260px}
  .clock{font-size:24px}
  .strip{flex-wrap:wrap}
  .strip .spark{display:none}
  .strip .s-mid{flex-basis:100%}
}
@media (max-width:380px){ .chip .lbl{display:none} }
@media (prefers-reduced-motion: reduce){
  .swap,.sweep.go{animation:none}
}

/* single readings when there are only a few */
.c-pt{fill:var(--ink)}

/* one-line answer to "how long and how bad" above the chart */
.exc{font-size:14px;line-height:1.4;font-variant-numeric:tabular-nums}
.exc.calm{color:var(--muted)}
.exc b{font-weight:600}
.exc .poor{color:var(--txt-poor)} .exc .fair{color:var(--txt-fair)}
.exc button{border:0;background:none;padding:0;font:inherit;color:inherit;cursor:pointer;text-decoration:underline dotted;text-underline-offset:3px}
.exc button:hover{text-decoration-style:solid}
