/* Cerbo App – základní vzhled (bez knihovny komponent). Světlý i tmavý režim podle systému. */
:root {
  --bg: #f4f6f9; --surface: #ffffff; --surface-2: #f0f3f7; --border: #e2e7ee;
  --text: #1c2430; --muted: #66707d; --accent: #0d6efd; --accent-soft: #e7f0ff;
  --ok: #1a9c5b; --ok-soft: #e3f6ec; --warn: #d98c00; --warn-soft: #fff4dc; --crit: #d63a3a; --crit-soft: #fde8e8;
  --radius: 14px; --shadow: 0 1px 2px rgba(16,24,40,.05), 0 4px 16px rgba(16,24,40,.06);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Code", "JetBrains Mono", Menlo, Consolas, monospace;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1419; --surface: #171d25; --surface-2: #1e2631; --border: #2a3441;
    --text: #e6ebf1; --muted: #8b96a5; --accent: #5aa2ff; --accent-soft: #14284a;
    --ok: #3ccf7f; --ok-soft: #10301f; --warn: #f2b03c; --warn-soft: #3a2a08; --crit: #ff6b6b; --crit-soft: #3d1414;
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 4px 16px rgba(0,0,0,.35);
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.45 var(--font); }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code { font-family: var(--mono); font-size: .9em; background: var(--surface-2); padding: .05em .35em; border-radius: 5px; }
h1 { font-size: 1.5rem; margin: 0 0 .25rem; letter-spacing: -.01em; }
h1:focus { outline: none; }
h2 { font-size: 1rem; margin: 0; font-weight: 600; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.nowrap { white-space: nowrap; }
.warn-text { color: var(--warn); }

/* shell */
.shell { min-height: 100dvh; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 1rem; padding: .6rem 1.25rem;
  background: color-mix(in srgb, var(--surface) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--border); }
.brand { display: flex; align-items: center; gap: .5rem; color: var(--text); font-weight: 700; font-size: 1.1rem; }
.brand:hover { text-decoration: none; }
.brand-mark { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 9px; background: linear-gradient(135deg, #ffb340, #ff7a1a); color: #fff; font-size: 1.05rem; }
.nav { display: flex; gap: .25rem; margin-left: .5rem; }
.nav a { display: flex; align-items: center; gap: .4rem; padding: .45rem .8rem; border-radius: 10px; color: var(--muted); font-weight: 500; }
.nav a:hover { background: var(--surface-2); text-decoration: none; color: var(--text); }
.nav a.active { background: var(--accent-soft); color: var(--accent); }
.nav .ico { display: inline-flex; line-height: 1; }
.nav .ico svg { width: 18px; height: 18px; }
.topbar-right { margin-left: auto; }
.content { flex: 1; width: 100%; max-width: 1240px; margin: 0 auto; padding: 1.25rem 1.25rem 4.5rem; }
.page-head { margin-bottom: 1rem; }
.page-head p { margin: 0; }

/* status pill */
.status-pill { display: inline-flex; align-items: center; gap: .5rem; padding: .35rem .8rem .35rem .6rem; border-radius: 999px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font-weight: 600; font-size: .9rem; }
.status-pill:hover { text-decoration: none; }
.status-pill .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--muted); }
.status-pill.ok .dot { background: var(--ok); box-shadow: 0 0 0 4px color-mix(in srgb, var(--ok) 25%, transparent); animation: pulse 2s infinite; }
.status-pill.warn .dot { background: var(--warn); }
.status-pill.crit .dot { background: var(--crit); box-shadow: 0 0 0 4px color-mix(in srgb, var(--crit) 25%, transparent); }
.status-pill .sub { color: var(--muted); font-weight: 400; font-variant-numeric: tabular-nums; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--ok) 45%, transparent); } 70% { box-shadow: 0 0 0 7px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }

/* grid + cards */
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 1rem; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.card.span2 { grid-column: span 2; }
.card.span-all { grid-column: 1 / -1; }
@media (max-width: 680px) { .card.span2 { grid-column: span 1; } }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; padding: .8rem 1rem; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.card-body { padding: .9rem 1rem; }
.card-body > p:first-child { margin-top: 0; }
.kv { display: flex; justify-content: space-between; gap: 1rem; padding: .3rem 0; border-bottom: 1px dashed var(--border); font-variant-numeric: tabular-nums; }
.kv:last-child { border-bottom: 0; }
.kv .k { color: var(--muted); flex: 0 0 auto; }
.kv .v { text-align: right; }
.big { font-size: 2.2rem; font-weight: 700; letter-spacing: -.02em; margin-bottom: .4rem; }

/* dům teď – dlaždice */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .6rem; }
.tile { padding: .6rem .7rem; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); }
.tile-label { font-size: .75rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.tile-value { font-size: 1.35rem; font-weight: 700; letter-spacing: -.01em; font-variant-numeric: tabular-nums; margin: .1rem 0; }
.tile-unit { font-size: .8rem; font-weight: 500; color: var(--muted); }
.tile-sub { font-size: .78rem; color: var(--muted); }
.ok-text { color: var(--ok); } .crit-text { color: var(--crit); }
.temps { display: flex; flex-wrap: wrap; gap: .4rem 1.1rem; margin-top: .7rem; font-size: .85rem; color: var(--muted); }
.temps b { color: var(--text); font-weight: 600; }

/* badges, alerts */
.badge { display: inline-block; padding: .15rem .6rem; border-radius: 999px; font-size: .78rem; font-weight: 600; letter-spacing: .02em; text-transform: uppercase; white-space: nowrap; }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.crit { background: var(--crit-soft); color: var(--crit); }
.badge.muted { background: var(--surface-2); color: var(--muted); }
.alert { padding: .7rem 1rem; border-radius: 10px; margin-bottom: 1rem; border: 1px solid; }
.alert.crit { background: var(--crit-soft); border-color: color-mix(in srgb, var(--crit) 40%, transparent); color: var(--crit); }
.alert.warn { background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 40%, transparent); color: var(--warn); }

/* ostrý provoz */
.groups { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; margin-bottom: .6rem; }
.group { padding: .55rem .6rem; border-radius: 10px; border: 1px solid var(--border); background: var(--surface-2); display: flex; flex-direction: column; gap: .1rem; }
.group.on { border-color: color-mix(in srgb, var(--ok) 50%, transparent); background: var(--ok-soft); }
.group.off { opacity: .75; }
.group-name { font-size: .8rem; color: var(--muted); }
.group-state { font-weight: 700; text-transform: uppercase; font-size: .9rem; }
.group.on .group-state { color: var(--ok); }

/* hlídač – komponenty */
.components { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: .4rem .9rem; }
.comp { display: flex; align-items: flex-start; gap: .6rem; padding: .4rem .2rem; border-bottom: 1px dashed var(--border); }
.comp-dot { flex: 0 0 auto; width: 10px; height: 10px; margin-top: .4rem; border-radius: 50%; background: var(--muted); }
.comp.ok .comp-dot { background: var(--ok); }
.comp.warn .comp-dot { background: var(--warn); }
.comp.crit .comp-dot { background: var(--crit); }
.comp-main { flex: 1; min-width: 0; }
.comp-name { font-weight: 600; font-size: .92rem; }
.comp-detail { color: var(--muted); font-size: .82rem; overflow-wrap: anywhere; }
.comp-age { color: var(--muted); font-size: .8rem; white-space: nowrap; font-variant-numeric: tabular-nums; }
.comp.crit .comp-name { color: var(--crit); }
.comp.warn .comp-name { color: var(--warn); }

/* log */
ul.log { list-style: none; margin: .4rem 0 0; padding: 0; font-size: .88rem; }
ul.log li { padding: .25rem 0; border-bottom: 1px dashed var(--border); }
ul.log li:last-child { border-bottom: 0; }
ul.log .ts { color: var(--muted); font-variant-numeric: tabular-nums; margin-right: .4rem; }

/* tabulky */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin-bottom: .8rem; }
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.tbl { width: 100%; border-collapse: collapse; font-size: .9rem; }
.tbl th { text-align: left; font-weight: 600; color: var(--muted); font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; padding: .65rem .8rem; background: var(--surface-2); border-bottom: 1px solid var(--border); white-space: nowrap; }
.tbl td { padding: .55rem .8rem; border-bottom: 1px solid var(--border); vertical-align: top; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tr.dim { opacity: .55; }
.tbl tr.row-warn td { background: var(--warn-soft); }
.tbl tr.clickable { cursor: pointer; }
.tbl tr.clickable:hover td { background: var(--surface-2); }
.tbl .val { font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tbl .reason { max-width: 320px; overflow-wrap: anywhere; }
.cell-main { font-weight: 600; }
.cell-sub { color: var(--muted); font-size: .78rem; margin-top: .1rem; }

/* Peníze: prodej a nákup rozdělené na „nedalo se ovlivnit“ a „tvoje rozhodnutí“ (30. 9. 2026) */
.mn { --mn-sell: #0f8a6a; --mn-buy: #c2562a; max-width: 46rem; display: flex; flex-direction: column; gap: 1.8rem; }
@media (prefers-color-scheme: dark) { .mn { --mn-sell: #3cc9a2; --mn-buy: #f08a5d; } }
.mn section { display: flex; flex-direction: column; gap: .65rem; }
.mn h2 { font-size: 1.2rem; display: flex; align-items: center; gap: .5rem; }
.mn h2 i { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.mn h3 { font-size: .95rem; margin: .5rem 0 0; font-weight: 600; }
.mn-lead { font-size: 1.05rem; margin: 0; }
.mn-num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.mn-two { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; }
@media (max-width: 560px) { .mn-two { grid-template-columns: 1fr; } }
.mn-box { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: .75rem .9rem; display: flex; flex-direction: column; gap: .35rem; min-width: 0; }
.mn-tag { font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.mn-ttl { font-weight: 600; }
.mn-fig { display: flex; flex-wrap: wrap; gap: .25rem 1rem; align-items: baseline; font-variant-numeric: tabular-nums; }
.mn-fig b { font-size: 1.35rem; }
.mn-why { font-size: .84rem; color: var(--muted); }
.mn-tbl { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.mn-tbl th { text-align: right; font-weight: 500; color: var(--muted); font-size: .74rem; text-transform: uppercase; letter-spacing: .04em; padding: .4rem; border-bottom: 1px solid var(--border); white-space: nowrap; }
.mn-tbl td { text-align: right; padding: .45rem .4rem; border-bottom: 1px solid var(--border); white-space: nowrap; vertical-align: top; }
.mn-tbl th:first-child, .mn-tbl td:first-child { text-align: left; padding-left: 0; }
.mn-sub { display: block; color: var(--muted); font-size: .78rem; }
.mn-days { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--border); }
.mn-days li { display: grid; grid-template-columns: 5.4rem 1fr auto; gap: .1rem .75rem; padding: .5rem 0; border-bottom: 1px solid var(--border); align-items: baseline; }
.mn-days .d { font-weight: 600; } .mn-days .what { min-width: 0; font-variant-numeric: tabular-nums; } .mn-days .what .mn-sub { white-space: normal; }
@media (max-width: 480px) { .mn-days li { grid-template-columns: 1fr auto; } .mn-days .what { grid-column: 1 / -1; order: 3; } }
.mn-v { font-size: .82rem; font-weight: 600; white-space: nowrap; display: inline-flex; align-items: center; gap: .3rem; }
.mn-v::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.mn-v.good { color: var(--ok); } .mn-v.mid { color: var(--warn); } .mn-v.bad { color: var(--crit); }
.mn-eq { display: flex; flex-direction: column; gap: .25rem; max-width: 28rem; }
.mn-eq .t { display: flex; align-items: baseline; gap: .6rem; }
.mn-eq .op { flex: 0 0 1rem; color: var(--muted); font-weight: 600; }
.mn-eq .vv { flex: 0 0 6.5rem; text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.mn-eq .t span:last-child { color: var(--muted); font-size: .88rem; }
.mn-eq .sum { border-top: 1px solid var(--border); padding-top: .25rem; }
.detail-row td { background: var(--surface-2); }
pre.json { margin: 0; font: .8rem/1.4 var(--mono); white-space: pre-wrap; overflow-wrap: anywhere; max-height: 60vh; overflow: auto; }

/* mobil: spodní navigace */
@media (max-width: 680px) {
  /* backdrop-filter na liště by z ní udělal kontejner pro position:fixed – spodní navigace by se přilepila nahoru */
  .topbar { padding: .5rem .9rem; backdrop-filter: none; background: var(--surface); }
  .brand-name { display: none; }
  .nav { position: fixed; left: 0; right: 0; bottom: 0; margin: 0; z-index: 10; justify-content: space-around; padding: .35rem .5rem calc(.35rem + env(safe-area-inset-bottom));
    background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(10px); border-top: 1px solid var(--border); }
  .nav a { flex-direction: column; gap: .1rem; padding: .3rem .6rem; font-size: .72rem; }
  .nav .ico svg { width: 22px; height: 22px; }
  .content { padding: 1rem .9rem 5rem; }
  .grid { grid-template-columns: 1fr; }
  .status-pill .text { display: none; }
  .status-pill { padding: .35rem .6rem; }
  .nav a { flex: 1 1 0; min-width: 0; padding: .3rem .2rem; font-size: .68rem; white-space: nowrap; }
  .nav a.nav-desktop { display: none; }
}

/* Blazor reconnect / error */
#blazor-error-ui { display: none; position: fixed; bottom: 0; left: 0; right: 0; z-index: 1000; padding: .8rem 1rem; background: var(--warn-soft); color: var(--text); border-top: 1px solid var(--warn); }
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: 1rem; top: .6rem; }
#components-reconnect-modal { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--text); padding: 1.25rem 1.5rem; max-width: 26rem; box-shadow: var(--shadow); }
#components-reconnect-modal::backdrop { background: rgba(0,0,0,.35); backdrop-filter: blur(3px); }
.components-reconnect-container { display: flex; flex-direction: column; align-items: center; gap: .6rem; text-align: center; }
.components-reconnect-container p { margin: 0; }
.components-reconnect-container button { padding: .45rem 1rem; border-radius: 8px; border: 1px solid var(--border); background: var(--accent); color: #fff; font: inherit; cursor: pointer; }
.components-rejoining-animation { position: relative; width: 36px; height: 36px; }
.components-rejoining-animation div { position: absolute; inset: 0; border: 3px solid var(--accent); border-radius: 50%; opacity: 0; animation: rejoin 1.6s ease-out infinite; }
.components-rejoining-animation div:nth-child(2) { animation-delay: .8s; }
@keyframes rejoin { 0% { transform: scale(.2); opacity: 1; } 100% { transform: scale(1); opacity: 0; } }

/* matice (Syncfusion Grid) */
.matrix-wrap { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.matrix-wrap .e-grid .e-content { overflow-y: visible !important; }
.matrix-wrap .e-grid .e-gridheader.e-sticky { top: 54px !important; } /* pod horní lištou */
.matrix-wrap .e-grid { border: 0; font-size: .85rem; }
.matrix-wrap .e-grid .e-headercell, .matrix-wrap .e-grid .e-headercelldiv { font-size: .75rem; font-weight: 600; padding: 4px 6px; }
.matrix-wrap .e-grid .e-rowcell { padding: 2px 6px; line-height: 24px; font-variant-numeric: tabular-nums; }
.matrix-wrap .e-grid .e-stackedheadercelldiv { font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; }
.matrix-wrap .e-grid tr.row-hour td { border-top: 2px solid color-mix(in srgb, var(--text) 35%, transparent) !important; }
.matrix-wrap .e-grid tr.row-current td { background: var(--accent-soft) !important; font-weight: 600; }
.matrix-wrap .e-grid tr.row-past td { opacity: .55; }
.matrix-wrap .e-grid .e-headercell.grp-exp, .matrix-wrap .e-grid .e-stackedheadercell.grp-exp { background: color-mix(in srgb, #2e9e6e 14%, var(--surface-2)); }
.matrix-wrap .e-grid .e-headercell.grp-dev, .matrix-wrap .e-grid .e-stackedheadercell.grp-dev { background: color-mix(in srgb, #d98c00 16%, var(--surface-2)); }
.matrix-wrap .e-grid .e-headercell.grp-bat, .matrix-wrap .e-grid .e-stackedheadercell.grp-bat { background: color-mix(in srgb, #3d7bff 14%, var(--surface-2)); }
.matrix-wrap .e-grid .e-rowcell.flag-col { padding: 0; text-align: center; }
.matrix-wrap .e-grid .e-rowcell.flag-col.grp-exp { background: color-mix(in srgb, #2e9e6e 5%, transparent); }
.matrix-wrap .e-grid .e-rowcell.flag-col.grp-dev { background: color-mix(in srgb, #d98c00 6%, transparent); }
.matrix-wrap .e-grid .e-rowcell.flag-col.grp-bat { background: color-mix(in srgb, #3d7bff 5%, transparent); }
.flag { display: inline-block; min-width: 100%; height: 24px; line-height: 24px; font-size: .95rem; position: relative; }
.flag.ov::after { content: ""; position: absolute; top: 0; right: 0; border: 5px solid transparent; border-top-color: var(--warn); border-right-color: var(--warn); }
.flag.ov.navrh::after { border-top-color: var(--muted); border-right-color: var(--muted); }
/* původ "plan" = zapsáno potvrzením simulace dne (návrh 45), ne ruční oprava uživatele */
.flag.ov.fromplan::after { border-top-color: var(--accent); border-right-color: var(--accent); }
.legend-ov { display: inline-block; width: 18px; height: 18px; min-width: 0; vertical-align: middle; border: 1px solid var(--border); border-radius: 3px; }
.flag.on { color: var(--ok); }
.grp-dev .flag.on { color: #c47a00; }
.grp-bat .flag.on { color: #3d7bff; }
.ov-text { text-decoration: underline dotted; }
.t-den { color: var(--muted); font-size: .75rem; margin-right: .2rem; }
.vt { color: var(--warn); } .nt { color: var(--accent); }
label.check { display: inline-flex; align-items: center; gap: .35rem; font-size: .85rem; margin-left: auto; cursor: pointer; }
details.legend { margin-top: .9rem; font-size: .85rem; }
details.legend summary { cursor: pointer; color: var(--accent); }
.legend-groups { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: .8rem; margin-top: .6rem; }
.legend-group ul { margin: .3rem 0 0; padding-left: 1.1rem; }
.legend-group li { margin: .15rem 0; }
@media (max-width: 680px) { .matrix-wrap .e-grid { font-size: .8rem; } label.check { margin-left: 0; } }

/* historie: přepínače, grafy, záznam */
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; background: var(--surface); }
.seg button { font: inherit; font-size: .85rem; padding: .4rem .75rem; border: 0; border-right: 1px solid var(--border); background: transparent; color: var(--muted); cursor: pointer; }
.seg button:last-child { border-right: 0; }
.seg button:hover { background: var(--surface-2); color: var(--text); }
.seg button.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.btn { font: inherit; font-size: .85rem; padding: .4rem .8rem; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer; }
.btn:hover { background: var(--surface-2); }
.btn:disabled { opacity: .6; cursor: default; }
.charts .card-body { padding: .5rem .5rem .3rem; }
.charts .e-chart { overflow: visible; }
.tbl th.r, .tbl td.r { text-align: right; }
.tbl tr.row-sel td { background: var(--accent-soft); }
.tbl.energy td { padding: .45rem .6rem; font-variant-numeric: tabular-nums; }
.chips { gap: .35rem; }
.chip { font: inherit; font-size: .8rem; padding: .25rem .65rem; border-radius: 999px; border: 1px solid var(--border); background: var(--accent-soft); color: var(--accent); cursor: pointer; }
.chip.off { background: var(--surface); color: var(--muted); text-decoration: line-through; }
h2.day-head { margin: 1rem 0 .3rem; font-size: .95rem; text-transform: capitalize; }
ul.log.events li.ev { display: flex; flex-wrap: wrap; align-items: baseline; gap: .3rem .5rem; padding: .35rem 0; }
ul.log.events .src { color: var(--muted); font-size: .8rem; }
ul.log.events .txt { flex: 1 1 100%; overflow-wrap: anywhere; }
ul.log.events li.crit .txt { color: var(--crit); }
ul.log.events li.warn .txt { color: var(--warn); }
@media (min-width: 681px) { ul.log.events .txt { flex: 1 1 auto; } }

/* přihlášení a účet */
.auth-shell { min-height: 100dvh; display: grid; place-items: center; padding: 1.5rem 1rem; }
.auth-card { width: 100%; max-width: 380px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.5rem 1.4rem; }
.auth-brand { display: flex; align-items: center; gap: .5rem; font-weight: 700; font-size: 1.15rem; margin-bottom: 1rem; }
.auth-card h1 { font-size: 1.3rem; margin-bottom: .8rem; }
.auth-form { display: flex; flex-direction: column; gap: .8rem; }
.field { display: flex; flex-direction: column; gap: .25rem; }
.field > span { font-size: .82rem; color: var(--muted); }
.field input, .field select, .inline-form input { font: inherit; padding: .55rem .7rem; border-radius: 9px; border: 1px solid var(--border); background: var(--bg); color: var(--text); }
.field input:focus, .inline-form input:focus { outline: 2px solid color-mix(in srgb, var(--accent) 45%, transparent); border-color: var(--accent); }
.field-err, .validation-message { color: var(--crit); font-size: .8rem; }
label.check { display: flex; align-items: center; gap: .45rem; font-size: .9rem; cursor: pointer; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.btn.primary:hover { filter: brightness(1.08); background: var(--accent); }
.btn.danger { color: var(--crit); border-color: color-mix(in srgb, var(--crit) 40%, transparent); }
.btn.wide { width: 100%; padding: .6rem; }
.btn.small { padding: .25rem .55rem; font-size: .78rem; }
.auth-or { text-align: center; color: var(--muted); font-size: .8rem; }
.auth-note { margin: 1rem 0 0; }
.alert.ok { background: var(--ok-soft); border-color: color-mix(in srgb, var(--ok) 40%, transparent); color: var(--ok); }
.recovery-codes { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .4rem; margin: .6rem 0; }
.recovery-codes code { font-size: 1rem; padding: .35rem .5rem; text-align: center; }
.qr { max-width: 240px; margin: 0 auto .5rem; }
.qr svg { width: 100%; height: auto; display: block; border-radius: 8px; }
kbd, code.otp { font-family: var(--mono); background: var(--surface-2); padding: .15em .45em; border-radius: 5px; font-size: .95em; }
.inline-form { display: inline-flex; gap: .35rem; align-items: center; flex-wrap: wrap; }
.inline-form input { padding: .3rem .5rem; font-size: .85rem; }
.user-menu { position: relative; margin-left: .5rem; }
.user-menu summary { list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: .35rem; padding: .35rem .6rem; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); font-size: .85rem; font-weight: 600; }
.user-menu summary::-webkit-details-marker { display: none; }
.user-menu-list { position: absolute; right: 0; top: calc(100% + .35rem); min-width: 200px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow); padding: .35rem; display: flex; flex-direction: column; z-index: 20; }
.user-menu-list a, .user-menu-list button { text-align: left; font: inherit; font-size: .9rem; padding: .45rem .7rem; border-radius: 8px; color: var(--text); background: transparent; border: 0; cursor: pointer; }
.user-menu-list a:hover, .user-menu-list button:hover { background: var(--surface-2); text-decoration: none; }
.user-menu-list form { display: contents; }
.topbar-right { display: flex; align-items: center; gap: .4rem; }
@media (max-width: 680px) { .user-name { display: none; } }

/* --- záměry / formuláře příkazů (F4) --- */
.form-col { display: flex; flex-direction: column; gap: .7rem; }
.form-row { display: flex; gap: .7rem; flex-wrap: wrap; } .form-row .field { flex: 1 1 120px; }
.alert.ok { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem; }
.alert .btn.small { margin-left: auto; }

/* --- nastavení parametrů (F4b), ostrý provoz (F4c) --- */
.settings-row { display: grid; grid-template-columns: minmax(180px, 1.4fr) minmax(90px, .6fr) minmax(140px, 1fr) auto; gap: .6rem; align-items: center; padding: .55rem 0; border-bottom: 1px solid var(--border); }
.settings-row:last-child { border-bottom: 0; }
.settings-row .eff { font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.settings-row .ctl { display: flex; gap: .35rem; align-items: center; flex-wrap: wrap; }
.settings-row .ctl input[type=number], .settings-row .ctl select { font: inherit; padding: .4rem .55rem; border-radius: 9px; border: 1px solid var(--border); background: var(--bg); color: var(--text); width: 7.5rem; }
.settings-row .ctl input[type=checkbox] { width: 1.15rem; height: 1.15rem; }
.settings-row .acts { display: flex; gap: .35rem; }
@media (max-width: 680px) { .settings-row { grid-template-columns: 1fr 1fr; } .settings-row .acts { grid-column: 1 / -1; } }
.live-groups { display: flex; flex-direction: column; gap: .5rem; }
.live-group { display: flex; align-items: center; gap: .6rem; padding: .55rem .7rem; border-radius: 10px; border: 1px solid var(--border); background: var(--surface-2); flex-wrap: wrap; }
.live-group .gname { font-weight: 600; flex: 1 1 160px; }
.confirm { border: 1px solid color-mix(in srgb, var(--crit) 40%, transparent); background: var(--crit-soft); border-radius: 10px; padding: .8rem 1rem; margin-bottom: 1rem; }
.confirm .row { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: .5rem; align-items: center; }
.btn.big { padding: .7rem 1.2rem; font-size: 1rem; font-weight: 700; }
.btn.danger.solid { background: var(--crit); color: #fff; border-color: var(--crit); }
/* užší horní lišta na středních šířkách (9 položek navigace) */
/* 13 položek menu: plná lišta (ikona + text) se vejde až od 1620 px; do té šířky bez ikon a těsněji, na tabletu (do 960 px) jen ikony s bublinou; pod 681 px je mobilní menu */
@media (min-width: 681px) and (max-width: 1620px) { .nav { gap: .1rem; margin-left: .25rem; } .nav a { padding: .45rem .5rem; gap: .3rem; font-size: .88rem; } .nav .ico { display: none; } .user-name { display: none; } }
@media (min-width: 681px) and (max-width: 1100px) { .nav a { padding: .4rem .35rem; font-size: .82rem; } }
@media (min-width: 681px) and (max-width: 960px) { .nav a { padding: .4rem .3rem; } .nav .ico { display: inline-flex; } .nav .ico + span { display: none; } }

/* Oznámení (F5) */
label.check { display: flex; gap: .5rem; align-items: flex-start; padding: .3rem 0; font-size: .92rem; line-height: 1.35; }
label.check input { margin-top: .2rem; flex: 0 0 auto; }

/* menu uživatele: položky jen na mobilu (na desktopu jsou v horní navigaci) */
.user-menu-list a.menu-mobile { display: none; }
@media (max-width: 680px) { .user-menu-list a.menu-mobile { display: block; } }

/* kalendář dnů */
.cal-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem; margin-bottom: .6rem; }
.cal-title { font-weight: 600; text-transform: capitalize; }
.cal-head .chips { display: flex; flex-wrap: wrap; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: .25rem; }
.cal-dow { text-align: center; font-size: .72rem; color: var(--muted); text-transform: uppercase; padding: .2rem 0; }
.cal-day { --c: var(--border); min-height: 3.2rem; padding: .3rem .35rem; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; cursor: pointer; text-align: left; display: flex; flex-direction: column; justify-content: space-between; }
.cal-day:hover { background: var(--surface-2); }
.cal-day.other { opacity: .45; }
.cal-day.past { color: var(--muted); }
.cal-day.today { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.cal-day.typed { background: color-mix(in srgb, var(--c) 18%, var(--surface)); border-color: var(--c); }
.cal-day.typed.past { color: var(--text); opacity: .7; }
.cal-day .n { font-size: .85rem; font-variant-numeric: tabular-nums; }
.cal-day .t { align-self: flex-end; font-size: .7rem; font-weight: 700; color: #fff; background: var(--c); border-radius: 6px; padding: 0 .35rem; }
.cal-day:disabled { cursor: default; opacity: .35; }
.type-chip { --c: var(--accent); display: inline-flex; align-items: center; gap: .4rem; font: inherit; font-size: .85rem; padding: .3rem .7rem; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer; }
.type-chip .dot { width: .7rem; height: .7rem; border-radius: 50%; background: var(--c); flex: 0 0 auto; }
.type-chip.on { border-color: var(--c); background: color-mix(in srgb, var(--c) 18%, var(--surface)); font-weight: 600; }
.type-chip:disabled { opacity: .6; cursor: default; }
.day-row { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; padding: .45rem 0; border-bottom: 1px dashed var(--border); }
.day-row:last-child { border-bottom: 0; }
.day-row .lbl { min-width: 9rem; }
@media (max-width: 680px) { .cal-day { min-height: 2.8rem; padding: .2rem .25rem; } .day-row .lbl { min-width: 100%; } .cal-head .chips { width: 100%; } }

/* teploty */
.tile.sensor { cursor: pointer; border-left: 4px solid var(--c, var(--border)); user-select: none; }
.tile.sensor.off { opacity: .5; }
.tile.sensor .tile-value.stale { color: var(--warn); }

/* Proč (záznam rozhodnutí, návrh 41) + důvod v buňce matice */
.flag.why { cursor: pointer; }
.flag.why:hover { outline: 2px solid var(--accent); outline-offset: -2px; border-radius: 4px; }
.flag.picked { background: var(--accent-soft); border-radius: 4px; }
.why-box { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem 1rem; padding: .6rem .9rem; margin-bottom: .8rem; border-radius: 10px; background: var(--surface); border: 1px solid var(--accent); box-shadow: var(--shadow); }
.why-box .why-cols, .step-data { display: flex; flex-wrap: wrap; gap: .25rem .9rem; font-size: .85rem; }
.dat { white-space: nowrap; font-variant-numeric: tabular-nums; }
.dat .muted { margin-right: .25rem; }
.summary { font-size: 1.05rem; margin: 0 0 .8rem; line-height: 1.5; }
.story { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 1rem; }
.story-part { padding: .8rem 1rem; border-radius: 10px; background: var(--surface-2); }
.story-part.pick { background: var(--ok-soft); }
.story-lead { margin: 0 0 .4rem; font-weight: 600; }
.story-part ul { margin: 0; padding-left: 1.1rem; }
.story-part li { margin: .35rem 0; }
.story-times { font-variant-numeric: tabular-nums; }
.step-more { margin-top: .2rem; }
.step-more summary { cursor: pointer; }
.tbl-details > summary { cursor: pointer; padding: .2rem 0; }
.glossary { margin: .6rem 0 0; display: grid; grid-template-columns: max-content 1fr; gap: .35rem 1rem; }
.glossary dt { font-weight: 600; }
.glossary dd { margin: 0; }
@media (max-width: 680px) { .glossary { grid-template-columns: 1fr; } .glossary dd { margin-bottom: .4rem; } }
.code-list { margin: .4rem 0 0; padding-left: 0; list-style: none; columns: 2; column-gap: 1.5rem; font-size: .85rem; }
.code-list li { margin: .15rem 0; break-inside: avoid; }
@media (max-width: 700px) { .code-list { columns: 1; } }
.explain-grid .kv .v { white-space: nowrap; }
.explain-grid .kv .k { flex: 1 1 auto; }
.tag { display: inline-block; font-size: .7rem; padding: 0 .4rem; border-radius: 999px; background: var(--surface-2); color: var(--muted); margin-left: .3rem; vertical-align: middle; }
.tag.warn { background: var(--warn-soft); color: var(--warn); }
.chip.static { cursor: default; }
.chip.static.ok { border-color: color-mix(in srgb, var(--ok) 50%, transparent); }
.chips.small .chip { font-size: .75rem; }
.steps { list-style: none; margin: 0; padding: 0; counter-reset: step; }
.step { position: relative; padding: .45rem 0 .45rem 2rem; border-bottom: 1px solid var(--border); counter-increment: step; }
.step:last-child { border-bottom: 0; }
.step::before { content: counter(step); position: absolute; left: 0; top: .55rem; width: 1.4rem; height: 1.4rem; border-radius: 50%; background: var(--surface-2); color: var(--muted); font-size: .75rem; font-weight: 600; display: flex; align-items: center; justify-content: center; }
.step.ok::before { background: var(--ok-soft); color: var(--ok); }
.step.warn::before { background: var(--warn-soft); color: var(--warn); }
.step-head { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.step-text { margin-top: .15rem; }
.step-data { margin-top: .25rem; }
.table-wrap.plain { box-shadow: none; }
.content:has(.explain-grid) { max-width: 1700px; } /* Proč: tabulka čtvrthodin má až 17 sloupců */
.tbl.explain { font-size: .8rem; }
.tbl.explain th { padding: .35rem .3rem; font-size: .68rem; line-height: 1.15; vertical-align: bottom; }
.tbl.explain th.num { white-space: normal; max-width: 72px; }
.tbl.explain td { padding: .25rem .3rem; }
.tbl.explain tr.row-pick td { background: color-mix(in srgb, var(--ok) 6%, transparent); }
.tbl.explain .reason { min-width: 200px; max-width: none; }
.tbl.explain th, .tbl.explain td.val { white-space: nowrap; }
.why-box .why-text { display: inline-flex; flex-wrap: wrap; align-items: center; gap: .2rem .5rem; }

/* Matice – úpravy z aplikace (návrh 41, krok 2) */
.toolbar .spacer, .edit-row .spacer { flex: 1 1 auto; }
.edit-box { background: var(--surface); border: 1px solid var(--accent); border-radius: 10px; padding: .5rem .9rem; margin-bottom: .8rem; box-shadow: var(--shadow); }
.edit-row { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .6rem; padding: .3rem 0; }
.edit-row + .edit-row { border-top: 1px solid var(--border); }
.edit-row select, .edit-row input { font: inherit; font-size: .85rem; padding: .3rem .5rem; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text); }
.matrix-wrap.editing .flag { cursor: pointer; }
.matrix-wrap.editing .flag:not(.plan):hover { outline: 2px solid var(--accent); outline-offset: -2px; border-radius: 4px; }
/* sloupec Plán se needituje ani v režimu Upravit – klik jen ukáže důvod */
.matrix-wrap.editing .flag.plan:hover, .strip-wrap.editing .flag.plan:hover { outline: 1px dashed var(--muted); outline-offset: -2px; border-radius: 4px; }
.flag.pend { background: var(--accent-soft); color: var(--accent); font-weight: 700; border-radius: 4px; }
.flag.pend.clear { color: var(--crit); }
.crit { color: var(--crit); }
.btn.danger { background: var(--crit); color: #fff; border-color: var(--crit); }

/* Matice: dvojice sloupců Plán / Matice (návrh 44) */
.matrix-wrap .e-grid .e-headercell .hdr-f { display: block; line-height: 1.1; }
.matrix-wrap .e-grid .e-headercell .hdr-sub { display: block; min-height: .8rem; font-size: .62rem; font-weight: 500; color: var(--muted); text-transform: none; letter-spacing: 0; line-height: 1; }
.matrix-wrap .e-grid .e-headercell.plan-col, .matrix-wrap .e-grid .e-rowcell.flag-col.plan-col { border-left: 2px solid var(--border); }
.matrix-wrap .e-grid .e-rowcell.flag-col.plan-col { background: color-mix(in srgb, var(--muted) 7%, transparent); }
.flag.plan { color: var(--muted); cursor: pointer; }
.flag.plan.off { color: color-mix(in srgb, var(--muted) 55%, transparent); font-size: 1.3rem; }
.flag.plan.on { color: var(--muted); }
.flag.plan.empty { cursor: default; }
.flag.diff { background: var(--warn-soft); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--warn) 45%, transparent); border-radius: 4px; }
.matrix-wrap .e-grid .e-rowcell.flag-col.plan-col:has(.flag.diff), .matrix-wrap .e-grid .e-rowcell.flag-col.mat-col:has(.flag.diff) { background: var(--warn-soft); }
.legend-ov.diff { background: var(--warn-soft); }

/* pruh: nad sebou plán a matice */
.s-flags { display: grid; justify-items: center; gap: .1rem; }
.s-flags.two { grid-template-columns: auto auto; align-items: center; gap: .15rem .35rem; justify-items: end; padding: .15rem .25rem; border-radius: 8px; }
.s-flags.two.diff { background: var(--warn-soft); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--warn) 45%, transparent); }
.s-lbl { font-size: .68rem; color: var(--muted); line-height: 1; }
.s-flags.two .s-flag { min-width: 2.4rem; height: 1.9rem; line-height: 1.9rem; font-size: 1.1rem; }
.s-flags.two .flag.diff { background: transparent; box-shadow: none; }

/* Plán dne (návrh 42): pruh na stránce Proč, karta v Přehledu */
.dayplan { background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--muted); border-radius: 10px; padding: .6rem .9rem; margin-bottom: 1rem; box-shadow: var(--shadow); }
.dayplan.ok { border-left-color: var(--ok); }
.dayplan.warn { border-left-color: var(--warn); }
.dayplan-head { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem .6rem; }
.dayplan-reason { margin: .4rem 0 .2rem; }
.dayplan .summary { font-size: 1rem; margin-bottom: .4rem; }
.dayplan-steps summary { cursor: pointer; }
.dp-steps { list-style: none; margin: .4rem 0 0; padding: 0; }
.dp-step { display: flex; gap: .6rem; padding: .3rem 0; border-top: 1px solid var(--border); }
.dp-icon { flex: 0 0 1.4rem; height: 1.4rem; border-radius: 50%; background: var(--surface-2); color: var(--muted); font-size: .8rem; display: flex; align-items: center; justify-content: center; margin-top: .1rem; }
.dp-step.ok .dp-icon { background: var(--ok-soft); color: var(--ok); }
.dp-step.warn .dp-icon { background: var(--warn-soft); color: var(--warn); }
.dp-step.crit .dp-icon { background: var(--crit-soft); color: var(--crit); }
select.small { font-size: .8rem; padding: .15rem .3rem; }

/* Matice – pruh jednoho pole po čtvrthodinách (telefon) a přepínač tabulka/pruh */
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.seg button { border: 0; background: var(--surface); color: var(--muted); padding: .3rem .6rem; font: inherit; font-size: .85rem; cursor: pointer; }
.seg button.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.strip-field { max-width: 100%; }
.strip-wrap { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.strip-head { padding: .5rem .8rem; border-bottom: 1px solid var(--border); background: var(--surface-2); border-radius: var(--radius) var(--radius) 0 0; }
.strip-row { display: grid; grid-template-columns: 5.6rem 1fr auto; align-items: center; gap: .4rem; padding: .15rem .5rem .15rem .8rem; border-top: 1px solid var(--border); font-variant-numeric: tabular-nums; }
.strip-row.row-hour { border-top: 2px solid color-mix(in srgb, var(--text) 35%, transparent); }
.strip-row.row-current { background: var(--accent-soft); font-weight: 600; }
.strip-row.row-past { opacity: .55; }
.strip-row.row-sel { background: color-mix(in srgb, var(--accent) 12%, var(--surface)); }
.strip-row .s-time .t-den { font-size: .72rem; color: var(--muted); display: block; line-height: 1; }
.strip-row .s-info { display: flex; flex-wrap: wrap; gap: .1rem .7rem; font-size: .82rem; }
.strip-row .s-flag { min-width: 3rem; height: 2.4rem; line-height: 2.4rem; font-size: 1.3rem; text-align: center; border-radius: 8px; border: 1px solid var(--border); cursor: pointer; }
.strip-wrap .flag.ov::after { border-width: 7px; }
.strip-wrap.grp-dev .flag.on { color: #c47a00; }
.strip-wrap.grp-bat .flag.on { color: #3d7bff; }
.strip-wrap .why-box { margin: .2rem .5rem .5rem; }
@media (max-width: 680px) { .strip-row { grid-template-columns: 4.6rem 1fr auto; padding-left: .5rem; } .strip-row .s-info { font-size: .78rem; gap: .1rem .5rem; } }
/* plovoucí lišta „Odeslat“ v režimu Upravit – změny bývají dole v pruhu, ovládání nahoře */
.edit-fab { position: sticky; bottom: .6rem; z-index: 5; display: flex; align-items: center; justify-content: center; gap: .6rem; margin: .6rem auto 0; width: max-content; max-width: 100%; padding: .5rem .9rem; border-radius: 999px; background: var(--surface); border: 1px solid var(--accent); box-shadow: 0 4px 16px rgba(0,0,0,.18); }
@media (max-width: 680px) { .edit-fab { bottom: calc(3.6rem + env(safe-area-inset-bottom)); } }

/* Dům – živé schéma (návrh 30, stránka /dum) */
.house-head { display: flex; flex-wrap: wrap; gap: .4rem 1.6rem; padding: .6rem .9rem; margin-bottom: .8rem; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow); }
.hh-item { display: flex; align-items: baseline; gap: .4rem; font-size: .9rem; }
.hh-lbl { font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.hh-item .muted { font-size: .8rem; }

.energy-wrap { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: .5rem; margin-bottom: 1rem; }
svg.energy { display: block; width: 100%; height: auto; }
svg.energy .enode rect { fill: var(--surface-2); stroke: var(--border); }
svg.energy .enode { cursor: pointer; }
svg.energy .enode:hover rect { stroke: var(--accent); }
svg.energy .enode.sel rect { fill: var(--accent-soft); stroke: var(--accent); }
svg.energy .enode.q-stale rect { stroke: var(--warn); }
svg.energy .enode.q-unavailable rect { stroke-dasharray: 4 3; opacity: .6; }
svg.energy .en-title { font-size: 12px; fill: var(--muted); }
svg.energy .en-big { font-size: 19px; font-weight: 700; fill: var(--text); }
svg.energy .en-sub { font-size: 11px; fill: var(--muted); }
svg.energy .eflow { fill: none; stroke: var(--border); stroke-linecap: round; }
svg.energy .eflow.k-grid.on { stroke: #c3562b; }
svg.energy .eflow.k-pv.on { stroke: #c98a0b; }
svg.energy .eflow.k-batt.on { stroke: #2f8f5b; }
svg.energy .eflow.k-house.on { stroke: #5b7a99; }
svg.energy .eflow.on { stroke-dasharray: 10 6; animation: eflow 1.2s linear infinite; }
svg.energy .eflow.on.rev { animation-direction: reverse; }
svg.energy .eflow-lbl { font-size: 11px; fill: var(--muted); }
@keyframes eflow { to { stroke-dashoffset: -16; } }
@media (prefers-reduced-motion: reduce) { svg.energy .eflow.on { animation: none; } }

.energy-mini { display: none; grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr)); gap: .4rem; }
.em-node { background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: .35rem .5rem; cursor: pointer; }
.em-node.sel { background: var(--accent-soft); border-color: var(--accent); }
.em-node.q-stale { border-color: var(--warn); }
.em-title { font-size: .72rem; color: var(--muted); }
.em-big { font-size: 1.05rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.em-sub { font-size: .75rem; color: var(--muted); }
.em-flows { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: .2rem .8rem; font-size: .8rem; color: var(--muted); }
@media (max-width: 900px) { svg.energy { display: none; } .energy-mini { display: grid; } }

.house-layout { display: grid; grid-template-columns: minmax(0, 1fr) 24rem; gap: 1rem; align-items: start; }
.plan { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: .6rem; align-items: start; }
.zone { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: .5rem .6rem .6rem; min-width: 0; }
.zone.out { background: color-mix(in srgb, var(--ok) 5%, var(--surface)); }
.zone h2 { display: flex; justify-content: space-between; gap: .5rem; font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 0 0 .4rem; }
.zone h2 small { font-size: .72rem; text-transform: none; letter-spacing: 0; font-weight: 400; }
.z-prip { grid-column: span 2; } .z-strecha { grid-column: span 4; } .z-pristresek { grid-column: span 4; } .z-zahrada { grid-column: span 2; }
.z-garaz { grid-column: span 4; } .z-kotelna { grid-column: span 4; } .z-obyvak { grid-column: span 2; } .z-patro { grid-column: span 2; }
.zone .tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(8.5rem, 1fr)); gap: .4rem; }
.htile { background: var(--surface-2); border: 1px solid var(--border); border-left: 3px solid var(--border); border-radius: 8px; padding: .35rem .5rem; cursor: pointer; min-width: 0; }
.htile:hover { border-color: var(--accent); }
.htile.sel { background: var(--accent-soft); border-color: var(--accent); }
.htile.q-stale { border-left-color: var(--warn); }
.htile.q-unavailable { border-left-color: var(--muted); opacity: .65; }
.ht-title { font-size: .75rem; color: var(--muted); }
.ht-big { font-size: 1.05rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.ht-sub { font-size: .78rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.ht-relays { display: flex; flex-wrap: wrap; gap: .2rem; margin-top: .25rem; }
.rly { font-size: .68rem; padding: .05rem .3rem; border-radius: 4px; background: var(--surface); border: 1px solid var(--border); color: var(--muted); }
.rly.on { background: var(--ok-soft); border-color: var(--ok); color: var(--ok); font-weight: 600; }
.rly.na { border-style: dashed; }
.rly.in { border-radius: 999px; }

.house-detail { position: sticky; top: 4.2rem; background: var(--surface); border: 1px solid var(--accent); border-radius: 10px; padding: .7rem .8rem; box-shadow: var(--shadow); max-height: calc(100dvh - 5rem); overflow: auto; }
.hd-head { display: flex; align-items: flex-start; justify-content: space-between; gap: .5rem; margin-bottom: .3rem; }
.hd-keys { width: 100%; font-size: .8rem; margin: .4rem 0 .6rem; }
.hd-keys td, .hd-keys th { padding: .2rem .3rem; vertical-align: top; }
.hd-keys .val { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.hd-cmd { border-top: 1px solid var(--border); padding-top: .4rem; margin-bottom: .5rem; }
.hd-cmd .kv { display: block; font-size: .82rem; padding: .15rem 0; }
.hd-cmd .kv .k { font-size: .75rem; }
.hd-cmd .kv .v { text-align: left; }
.hd-hist { border-top: 1px solid var(--border); padding-top: .4rem; }
.spark-row { display: grid; grid-template-columns: 1fr 7.5rem; gap: .4rem; align-items: center; padding: .2rem 0; }
.spark-lbl { font-size: .78rem; min-width: 0; }
svg.spark { width: 100%; height: 2.1rem; }
svg.spark polyline { fill: none; stroke: var(--accent); stroke-width: 1.5; vector-effect: non-scaling-stroke; }

@media (max-width: 1250px) { .house-layout { grid-template-columns: minmax(0, 1fr); } .house-detail { position: static; max-height: none; }
  .z-prip, .z-zahrada, .z-obyvak, .z-patro { grid-column: span 3; } .z-strecha, .z-pristresek, .z-garaz, .z-kotelna { grid-column: span 6; } }
@media (max-width: 760px) { .plan { grid-template-columns: 1fr; } .plan .zone { grid-column: auto; } .hh-item { font-size: .85rem; } }

/* Předpověď (téma v2/cerbo/forecast) */
.tbl.week td, .tbl.week th { padding: .3rem .5rem; }
.tbl.week .val { text-align: right; font-variant-numeric: tabular-nums; }
.tbl.week .rain { color: var(--accent); }
.wx { font-size: 1.1rem; }
.fc-days { display: grid; grid-template-columns: repeat(auto-fit, minmax(28rem, 1fr)); gap: 1rem; margin-top: 1rem; }
.fc-nums { display: flex; flex-wrap: wrap; gap: .3rem 1.2rem; margin-bottom: .5rem; }
.fc-nums > div { display: flex; flex-direction: column; }
.fc-lbl { font-size: .7rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.fc-nums b { font-variant-numeric: tabular-nums; }
svg.fc-chart { display: block; width: 100%; height: auto; }
svg.fc-chart .fc-grid { stroke: var(--border); stroke-width: 1; }
svg.fc-chart .fc-ax { font-size: 10px; fill: var(--muted); }
svg.fc-chart .fc-band { fill: color-mix(in srgb, #c98a0b 18%, transparent); stroke: none; }
svg.fc-chart .fc-curt { fill: color-mix(in srgb, var(--crit) 16%, transparent); }
svg.fc-chart polyline { fill: none; stroke-linejoin: round; stroke-linecap: round; }
svg.fc-chart .fc-da { stroke: #c98a0b; stroke-width: 1.6; }
svg.fc-chart .fc-mo { stroke: #c98a0b; stroke-width: 1.2; stroke-dasharray: 5 3; opacity: .8; }
svg.fc-chart .fc-la { stroke: var(--muted); stroke-width: 1.2; stroke-dasharray: 2 3; }
svg.fc-chart .fc-act { stroke: var(--ok); stroke-width: 2.4; }
svg.fc-chart .fc-rad { fill: var(--warn, #e0a01e); }
svg.fc-chart .fc-rain { fill: var(--accent); }
.legend-fc { list-style: none; margin: .4rem 0 0; padding: 0; }
.legend-fc li { margin: .2rem 0; }
.legend-fc .sw { display: inline-block; width: 1.4rem; height: .55rem; vertical-align: middle; margin-right: .3rem; border-radius: 2px; }
.legend-fc .sw.fc-band { background: color-mix(in srgb, #c98a0b 18%, transparent); border: 1px solid #c98a0b; }
.legend-fc .sw.fc-da { background: #c98a0b; height: .2rem; }
.legend-fc .sw.fc-mo { background: repeating-linear-gradient(90deg, #c98a0b 0 5px, transparent 5px 8px); height: .2rem; }
.legend-fc .sw.fc-la { background: repeating-linear-gradient(90deg, var(--muted) 0 2px, transparent 2px 5px); height: .2rem; }
.legend-fc .sw.fc-act { background: var(--ok); height: .25rem; }
.legend-fc .sw.fc-rad { background: linear-gradient(90deg, color-mix(in srgb, var(--warn, #e0a01e) 15%, transparent), var(--warn, #e0a01e)); }
.legend-fc .sw.fc-rainsw { width: .55rem; border-radius: 50%; background: var(--accent); }
.legend-fc .sw.fc-curt { background: color-mix(in srgb, var(--crit) 16%, transparent); border: 1px solid color-mix(in srgb, var(--crit) 40%, transparent); }
@media (max-width: 760px) { .fc-days { grid-template-columns: 1fr; } }

/* ---- Plán: den po čtvrthodinách, čas dolů ---- */
.mt { margin-top: .8rem; }
/* dlouhá tabulka: roste do výšky a scrolluje s celou stránkou, vlastní posuvník nemá */
.table-wrap.dlouha { overflow: visible; }

.tbl.ceny { width: 100%; font-variant-numeric: tabular-nums; font-size: .88rem; }
.tbl.ceny th, .tbl.ceny td { padding-left: 1.1rem; padding-right: 1.1rem; }
.tbl.ceny td.time { padding-left: .9rem; padding-right: 1.4rem; }
.tbl.ceny thead th { position: sticky; top: 54px; z-index: 2; }
.tbl.ceny th .unit { font-weight: 400; text-transform: none; letter-spacing: 0; color: var(--muted); font-size: .85em; }
.tbl.ceny td { padding: .28rem .8rem; vertical-align: middle; border-bottom: 1px solid var(--border); }
.tbl.ceny th, .tbl.ceny td { border-right: 1px solid var(--border); }
.tbl.ceny th:last-child, .tbl.ceny td:last-child { border-right: 0; }
.tbl.ceny tr.hour td { border-top: 2px solid color-mix(in srgb, var(--text) 35%, transparent); }
.tbl.ceny td.time { color: var(--muted); }
.tbl.ceny tr.hour td.time { color: var(--text); font-weight: 600; }

.tbl.ceny tr.now td.time::after { content: " ← teď"; font-weight: 600; color: var(--accent); font-size: .78rem; }
.tbl.ceny tr.day-sep td { background: var(--surface-2); color: var(--muted); padding: .35rem .8rem;
  font-size: .76rem; text-transform: uppercase; letter-spacing: .04em;
  border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }

/* podbarvení cenové buňky: --tint je síla 0–1, --tint-c barva (zelená = příležitost) */
/* cena: jeden spojitý přechod zelená → žlutá → červená, bez bílého místa uprostřed */
.tbl.ceny td.val.tint { background: hsl(var(--tint-h) 62% 86%); }

/* výroba v buňce: pruh přes pásmo p10–p90, značka na p50 */
.tbl.ceny td.pv { white-space: nowrap; }
.pv-bar { position: relative; display: inline-block; width: 5.5rem; height: .72rem; vertical-align: middle;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 3px; }
.pv-bar::before { content: ""; position: absolute; left: var(--a); width: var(--b); top: 0; bottom: 0;
  background: color-mix(in srgb, #e5a92f 45%, transparent); }
.pv-bar i { position: absolute; left: var(--p); top: -2px; bottom: -2px; width: 2px; background: #c98a0b; }
.pv-num { margin-left: .5rem; font-variant-numeric: tabular-nums; }
.pv-span { margin-left: .4rem; font-size: .78rem; }

/* graf předpovědi výroby */
.pvc-wrap { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: .8rem .9rem; }
.pvc { width: 100%; height: auto; display: block; }
.pvc-grid { stroke: var(--border); stroke-width: 1; }
.pvc-hour { stroke: var(--border); stroke-width: 1; opacity: .55; }
.pvc-day { stroke: var(--muted); stroke-width: 1.5; }
.pvc-zero { stroke: var(--muted); stroke-width: 1; }
.pvc-ax { fill: var(--muted); font-size: 12px; }
.pvc-band { fill: color-mix(in srgb, #e5a92f 28%, transparent); stroke: none; }
.pvc-p50 { fill: none; stroke: #c98a0b; stroke-width: 2; }
.pvc-wrap .sw { display: inline-block; width: 1.1rem; height: .6rem; vertical-align: middle;
  margin-right: .25rem; border-radius: 2px; }
.pvc-sw-band { background: color-mix(in srgb, #e5a92f 28%, transparent); border: 1px solid var(--border); }
.pvc-sw-p50 { background: #c98a0b; height: .2rem; }
h2.mt { font-size: 1.1rem; margin-bottom: .5rem; }

/* součet dne */
.tbl.ceny tr.day-sum td { background: var(--surface-2); font-weight: 600;
  border-top: 2px solid color-mix(in srgb, var(--text) 35%, transparent); }
.tbl.ceny tr.day-sum .lbl { font-weight: 400; font-size: .78rem; margin-left: .3rem; }
@media (max-width: 760px) { .tbl.ceny thead th { top: 48px; } }

/* sloupce plánu: úzké, vystředěné, barva skupiny jako v matici */
.tbl.ceny th.fc, .tbl.ceny td.fc { padding-left: .3rem; padding-right: .3rem; text-align: center; }
.tbl.ceny th.fc { font-size: .7rem; letter-spacing: 0; }
.tbl.ceny td.fc .flag { min-width: 0; height: auto; line-height: 1.4; }
.tbl.ceny th.fc.grp-exp { background: color-mix(in srgb, #2e9e6e 14%, var(--surface-2)); }
.tbl.ceny th.fc.grp-dev { background: color-mix(in srgb, #d98c00 16%, var(--surface-2)); }
.tbl.ceny th.fc.grp-bat { background: color-mix(in srgb, #3d7bff 14%, var(--surface-2)); }
.tbl.ceny tr.day-sum td.fc { font-size: .76rem; white-space: nowrap; }
.tbl.ceny tr.day-sum td.fc.grp-exp { color: var(--ok); }
.tbl.ceny tr.day-sum td.fc.grp-dev { color: #c47a00; }
.tbl.ceny tr.day-sum td.fc.grp-bat { color: #3d7bff; }
/* tabulka má 17 sloupců – potřebuje víc místa než ostatní stránky */
.content:has(.tbl.ceny) { max-width: 1700px; }

/* celý sloupec plánu má jemný podklad své skupiny – stejně jako matice na dashboardu */
.tbl.ceny tbody tr:not(.day-sum):not(.now) td.fc.grp-exp { background: color-mix(in srgb, #2e9e6e 5%, transparent); }
.tbl.ceny tbody tr:not(.day-sum):not(.now) td.fc.grp-dev { background: color-mix(in srgb, #d98c00 6%, transparent); }
.tbl.ceny tbody tr:not(.day-sum):not(.now) td.fc.grp-bat { background: color-mix(in srgb, #3d7bff 5%, transparent); }
.tbl.ceny tbody tr.now td { background: var(--accent-soft); }

/* barevné schéma matice: celý sloupec plánu má jemný podklad své skupiny */
.tbl.ceny tbody tr:not(.day-sum):not(.now) td.fc.grp-exp { background: color-mix(in srgb, #2e9e6e 5%, transparent); }
.tbl.ceny tbody tr:not(.day-sum):not(.now) td.fc.grp-dev { background: color-mix(in srgb, #d98c00 6%, transparent); }
.tbl.ceny tbody tr:not(.day-sum):not(.now) td.fc.grp-bat { background: color-mix(in srgb, #3d7bff 5%, transparent); }
/* aktuální čtvrthodina: stejně jako row-current v matici */
.tbl.ceny tbody tr.now td { background: var(--accent-soft); font-weight: 600; }

@media (prefers-color-scheme: dark) {
  .tbl.ceny td.val.tint { background: hsl(var(--tint-h) 38% 24%); }
}

/* součet dne u bojleru: kWh a přírůstek teploty pod sebou */
.tbl.ceny tr.day-sum td.fc b { display: block; }
.tbl.ceny tr.day-sum td.fc .lbl { display: block; margin-left: 0; }

/* ---- Plán: sloupce se zatrhávají klikem, klikací je celá buňka ---- */
/* Prázdná značka musí jít trefit stejně jako zatržená: inline-block bez obsahu má nulovou výšku. */
.tbl.ceny td.fc .flag { display: block; min-width: 100%; min-height: 1.3rem; }
.plan-edit .tbl.ceny td.fc { cursor: pointer; }
.plan-edit .tbl.ceny td.fc:hover .flag { outline: 2px solid var(--accent); outline-offset: -2px; border-radius: 4px; }
