/* Design system sdílený se svjk-wallbox-portal (stejné tokeny/komponenty --
   oba appky teď mají stejné adminy, vizuální konzistence dává smysl), viz
   havictron/docs/flats-portal.md §6. */
:root {
  color-scheme: light dark;
  --bg: #ffffff;
  --fg: #1a1a1a;
  --muted: #6b7280;
  --accent: #2563eb;
  --border: #e5e7eb;
  --good-bg: #dcfce7;
  --good: #15803d;
  --bad-bg: #fde2e2;
  --bad: #b91c1c;
  --locked-bg: #fef3c7;
  /* Kategoriální paleta (dataviz skill, validováno pro CVD) -- fixní přiřazení
     podle technologie, nikdy se necykluje. */
  --series-teplo: #eb6834;
  --series-voda: #2a78d6;
  --series-ee: #eda100;
  --series-pristupy: #4a3aa7;
  --series-wb: #1baf7a;
  --series-baterie: #008300;
  --chart-grid: #e1e0d9;
  --chart-baseline: #c3c2b7;
  /* Sankey "Tok energie teď" (2026-09-04) -- fixní přiřazení uzel->barva,
     sdílí hex s existujícími --series-* (PV/síť/TUV = stejný koncept jako
     ee/voda/teplo jinde v appce), jen baterie je nová kategorie. */
  --flow-pv: var(--series-ee);
  --flow-grid: var(--series-voda);
  --flow-battery: var(--series-baterie);
  --flow-home: var(--series-pristupy);
  --flow-tuv: var(--series-teplo);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12141a;
    --fg: #f0f0f0;
    --muted: #9aa0aa;
    --accent: #6ea8fe;
    --border: #2a2d36;
    --good-bg: #16321f;
    --good: #4ade80;
    --bad-bg: #3a1d1d;
    --bad: #f87171;
    --locked-bg: #3a3420;
    --series-teplo: #d95926;
    --series-voda: #3987e5;
    --series-ee: #c98500;
    --series-pristupy: #9085e9;
    --series-wb: #199e70;
    --chart-grid: #2c2c2a;
    --chart-baseline: #383835;
  }
}
html { overflow-x: hidden; }
body {
  background: var(--bg);
  color: var(--fg);
  font-family: system-ui, sans-serif;
  max-width: 860px;
  width: 100%;
  box-sizing: border-box;
  margin: 0 auto;
  padding: 1.5rem 1rem 4rem;
  overflow-x: hidden;
}
h1 { font-size: 1.25rem; margin: 0; }
h2 { font-size: 1.05rem; margin: 0 0 0.75rem; }
h3 { font-size: 0.95rem; margin: 0 0 0.5rem; }
.eyebrow { color: var(--accent); font-size: 0.72rem; font-weight: 700; letter-spacing: 0.12em; margin: 0 0 0.35rem; }

.page-header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.header-actions { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }

.card {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1rem 1.25rem;
  margin-bottom: 1rem;
}
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 0.75rem; }

table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
th, td { text-align: left; padding: 0.45rem 0.6rem; border-bottom: 1px solid var(--border); }
th { color: var(--muted); font-weight: 600; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.03em; }
tbody tr:last-child td { border-bottom: none; }
.table-wrap { overflow-x: auto; }

label { display: block; font-size: 0.85rem; color: var(--muted); margin: 0.6rem 0 0.25rem; }
input, select {
  padding: 0.5rem 0.6rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--fg);
  font-size: 0.95rem;
  box-sizing: border-box;
}
input:not([size]), select:not([size]) { width: 100%; }

button {
  padding: 0.55rem 1rem;
  border-radius: 8px;
  border: none;
  background: var(--accent);
  color: white;
  font-size: 0.9rem;
  cursor: pointer;
}
button:disabled { opacity: 0.5; cursor: default; }
.compact { padding: 0.3rem 0.6rem; font-size: 0.82rem; }
.danger { background: var(--bad); }
.secondary { background: transparent; color: var(--accent); border: 1px solid var(--border); }
.user-badge {
  padding: 0.15rem 0.5rem; border-radius: 999px; border: 1px solid var(--border);
  background: transparent; color: var(--muted); font-size: 0.75rem;
  max-width: 14ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.user-badge.expanded { max-width: none; }
.user-badge-row { display: flex; justify-content: flex-end; margin-bottom: 0.25rem; }
.file-btn { display: inline-block; border-radius: 8px; cursor: pointer; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.text-button { background: transparent; color: var(--accent); padding: 0.2rem 0.3rem; font-size: 0.82rem; }
.action-link { display: inline-block; text-decoration: none; padding: 0.55rem 1rem; border-radius: 8px; }
.button-row { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; }
.inline-form { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: flex-end; margin-top: 0.75rem; }
.inline-form label { margin: 0; }
.inline-form > div { display: flex; flex-direction: column; }

.status-pill { display: inline-block; border: 1px solid var(--border); color: var(--muted); border-radius: 999px; font-size: 0.75rem; padding: 0.2rem 0.55rem; white-space: nowrap; }
.status-pill.cost { border-color: var(--accent); color: var(--accent); }
.status-pill.ended { border-color: var(--muted); }

.error { color: var(--bad); }
.muted { color: var(--muted); font-size: 0.9rem; }
.empty-state { color: var(--muted); border: 1px dashed var(--border); padding: 0.9rem; text-align: center; border-radius: 8px; font-size: 0.9rem; }

.flat-card { border-top: 1px solid var(--border); padding: 0.9rem 0; }
.flat-card:first-child { border-top: none; }
.flat-card-header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.flat-extras { margin: 0.3rem 0 0; }

.relations, .meters-admin { border-top: 1px solid var(--border); margin-top: 0.75rem; padding-top: 0.75rem; }
.relations summary, .meters-admin summary { cursor: pointer; color: var(--accent); font-size: 0.85rem; font-weight: 600; list-style: none; }
.relations summary::-webkit-details-marker, .meters-admin summary::-webkit-details-marker { display: none; }
.relations summary::before, .meters-admin summary::before { content: "▸ "; }
.relations[open] summary::before, .meters-admin[open] summary::before { content: "▾ "; }
.relation-group { margin-top: 0.75rem; }
.relation-row { display: flex; align-items: center; justify-content: space-between; gap: 0.6rem; padding: 0.35rem 0; border-top: 1px solid var(--border); font-size: 0.88rem; flex-wrap: wrap; }
.relation-row:first-of-type { border-top: none; }

.sparkline { color: var(--accent); vertical-align: middle; }

.tech-group { border-top: 1px solid var(--border); margin-top: 0.9rem; padding-top: 0.75rem; }
.tech-group:first-of-type { border-top: none; margin-top: 0; }
.meter-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); gap: 0.75rem; }
.meter-card { border: 1px solid var(--border); border-radius: 10px; padding: 0.75rem 0.9rem; }
.meter-card-header { display: flex; align-items: baseline; justify-content: space-between; gap: 0.5rem; }
.meter-card-header h4 { font-size: 0.85rem; margin: 0; }
.meter-card-value { font-size: 1.3rem; font-weight: 700; margin: 0.15rem 0 0; }
.meter-card-value .unit { font-size: 0.8rem; font-weight: 400; color: var(--muted); margin-left: 0.2rem; }
.delta { font-size: 0.78rem; font-weight: 600; margin-left: 0.4rem; }
.delta.down { color: var(--good); }
.delta.up { color: var(--muted); }
.meter-chart { margin-top: 0.5rem; }
.meter-chart .bar { fill: currentColor; }
.meter-chart .bar-predicted { fill-opacity: 0.35; stroke: currentColor; stroke-width: 0.6; stroke-dasharray: 1.2 1; }
.chart-swatch.bar-predicted { opacity: 0.35; border: 1px dashed currentColor; }
.meter-chart .bar-label { fill: var(--muted); font-size: 7px; }
.meter-chart .axis-label { fill: var(--muted); font-size: 7px; }
.meter-chart .baseline { stroke: var(--chart-baseline); stroke-width: 0.5; }
.meter-card-footer { display: flex; justify-content: space-between; align-items: baseline; margin-top: 0.5rem; padding-top: 0.5rem; border-top: 1px solid var(--border); font-size: 0.82rem; }

.building-status { display: flex; flex-wrap: wrap; gap: 1rem; }
.building-status-item { min-width: 10rem; }
.building-status-item h3 { font-size: 0.85rem; color: var(--muted); font-weight: 600; margin-bottom: 0.4rem; }
.building-status-values { display: flex; flex-wrap: wrap; gap: 0.9rem; }
.building-status-values strong { font-size: 1.1rem; }
.building-forecast { margin-top: 0.6rem; font-size: 0.85rem; }
.building-forecast-items { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.3rem; }
.building-forecast-items span { border: 1px solid var(--border); border-radius: 6px; padding: 0.2rem 0.5rem; }

.house-cmp { display: flex; flex-direction: column; gap: 0.7rem; margin-top: 0.4rem; }
.house-cmp-row { display: flex; flex-direction: column; gap: 0.2rem; }
.house-cmp-head { display: flex; justify-content: space-between; align-items: baseline; font-size: 0.88rem; font-weight: 600; }
.house-cmp-bar { position: relative; height: 1.15rem; background: var(--border); border-radius: 4px; overflow: hidden; font-size: 0.75rem; }
.house-cmp-fill { position: absolute; inset: 0 auto 0 0; border-radius: 4px; min-width: 2px; }
.house-cmp-fill.house { background: var(--chart-baseline); }
.house-cmp-val { position: absolute; left: 0.4rem; top: 0; line-height: 1.15rem; color: var(--fg); white-space: nowrap; }

.house-context { display: flex; flex-wrap: wrap; gap: 0.6rem; font-size: 0.85rem; }
.house-context-tile { display: inline-flex; align-items: center; gap: 0.35rem; border: 1px solid var(--border); border-radius: 8px; padding: 0.3rem 0.6rem; }
.house-context-tile.house-tile { flex-direction: column; align-items: flex-start; gap: 0.3rem; }
.house-tile-value { font-weight: 700; }
.temp-gauge { width: 150px; height: 12px; }

.rf-scopes { display: flex; flex-wrap: wrap; gap: 0.4rem 0.8rem; border: none; padding: 0; margin: 0; }
.rf-scope { display: inline-flex; align-items: center; gap: 0.3rem; font-size: 0.85rem; white-space: nowrap; }
#rf-lookup { align-items: end; margin-bottom: 0.6rem; }

/* --- nástěnka: moderní karty oznámení (2026-09-01) --- */
.announcement-list { display: flex; flex-direction: column; gap: 0.7rem; margin-top: 0.4rem; }
.announcement {
  display: grid; grid-template-columns: auto 1fr; gap: 0.7rem;
  border: 1px solid var(--border); border-left: 3px solid var(--accent);
  border-radius: 10px; padding: 0.8rem 0.9rem;
  background: color-mix(in srgb, var(--accent) 4%, var(--bg));
}
.announcement.importance-warning { border-left-color: var(--series-ee); background: color-mix(in srgb, var(--series-ee) 7%, var(--bg)); }
.announcement.importance-critical { border-left-color: var(--bad); background: var(--bad-bg); }
.announcement-badge {
  flex-shrink: 0; width: 1.5rem; height: 1.5rem; border-radius: 50%;
  display: grid; place-items: center; font-size: 0.8rem; font-weight: 700;
  color: #fff; background: var(--accent); letter-spacing: -0.03em;
}
.announcement.importance-warning .announcement-badge { background: var(--series-ee); }
.announcement.importance-critical .announcement-badge { background: var(--bad); }
.announcement-main { min-width: 0; }
.announcement-top { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.announcement-top h3 { font-size: 0.98rem; margin: 0; font-weight: 650; flex: 1; min-width: 8rem; }
.announcement-tag {
  font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--muted); border: 1px solid var(--border); border-radius: 999px; padding: 0.1rem 0.5rem;
}
.announcement-actions { display: flex; gap: 0.4rem; }
.announcement-body { margin: 0.4rem 0 0; line-height: 1.45; white-space: pre-wrap; }
.announcement-doc {
  display: inline-flex; align-items: center; gap: 0.35rem; margin-top: 0.5rem;
  font-size: 0.85rem; font-weight: 600; color: var(--accent); text-decoration: none;
  border: 1px solid var(--border); border-radius: 8px; padding: 0.3rem 0.6rem;
  background: var(--bg);
}
.announcement-doc:hover { border-color: var(--accent); }
.announcement-doc-ic { font-weight: 700; }
.announcement-meta { margin: 0.5rem 0 0; color: var(--muted); font-size: 0.8rem; }
.announcement-edit { margin-top: 0.7rem; padding-top: 0.7rem; border-top: 1px dashed var(--border); }
.announcement-edit .grow { flex: 1 1 14rem; }
.announcement-edit-actions { display: flex; gap: 0.5rem; align-self: flex-end; }
.inline-form .grow { flex: 1 1 16rem; }
.inline-form .grow input { width: 100%; }

/* --- admin: záložky (2026-09-01) --- */
.admin-tabs { display: flex; flex-wrap: wrap; gap: 0.3rem; margin-bottom: 1rem; border-bottom: 1px solid var(--border); }
.admin-tab { background: transparent; color: var(--muted); border: 1px solid transparent; border-bottom: none;
  border-radius: 6px 6px 0 0; padding: 0.5rem 0.9rem; cursor: pointer; font: inherit; }
.admin-tab:hover { color: var(--fg); }
.admin-tab.active { color: var(--fg); border-color: var(--border); background: var(--card, #fff); margin-bottom: -1px; }
.tab-panel > .card:first-child { margin-top: 0; }

/* --- byt IA redesign: taby + accordiony (2026-09-10, docs/uc-portal-
   navigation-and-forecast.md §3) -- vizuálně stejný vzor jako .admin-tabs
   výš, vlastní třídy kvůli více nezávislým skupinám na stránce (jeden byt
   = jedna sada tabů, na rozdíl od jediné admin stránky). */
.ia-tabs { display: flex; flex-wrap: wrap; gap: 0.3rem; margin: 1rem 0 0; border-bottom: 1px solid var(--border); }
.ia-tab { background: transparent; color: var(--muted); border: 1px solid transparent; border-bottom: none;
  border-radius: 6px 6px 0 0; padding: 0.5rem 0.9rem; cursor: pointer; font: inherit; }
.ia-tab:hover { color: var(--fg); }
.ia-tab.active { color: var(--fg); border-color: var(--border); background: var(--card, #fff); margin-bottom: -1px; font-weight: 600; }
.ia-accordion { border: 1px solid var(--border); border-top: none; border-radius: 0 0 8px 8px; padding: 0 0.9rem 0.9rem; margin-bottom: 0.5rem; }
.ia-accordion:last-of-type { border-radius: 8px; border-top: 1px solid var(--border); margin-top: 0.6rem; }
.ia-accordion summary { cursor: pointer; padding: 0.7rem 0; font-weight: 600; }
.ia-water-toggle { display: flex; gap: 0.4rem; margin-bottom: 0.6rem; }

.audience-checks { display: flex; flex-direction: row; flex-wrap: wrap; gap: 0.6rem; border: 1px solid var(--border);
  border-radius: 6px; padding: 0.4rem 0.6rem; align-items: center; }
.audience-checks legend { font-size: 0.8rem; color: var(--muted); padding: 0 0.3rem; }
.audience-checks label { display: inline-flex; align-items: center; gap: 0.3rem; margin: 0; }

.pricelist-row-past { color: var(--muted); }
.pricelist-row-active td:first-child { font-weight: 600; }

.meter-map { font-size: 0.8rem; margin: 0.1rem 0 0.5rem; }
.meter-map code { font-size: 0.78rem; }

.hidden { display: none !important; }

/* --- UC-2 „Můj byt" dashboard --- */
.period-switcher { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0.25rem 0 1rem; }
.field-inline { display: flex; align-items: center; gap: 0.5rem; margin: 0 0 1rem; }
.field-inline label { color: var(--muted); font-size: 0.85rem; }
.period-option { background: transparent; color: var(--fg); border: 1px solid var(--border);
  border-radius: 999px; padding: 0.3rem 0.7rem; font-size: 0.82rem; }
.period-option.is-selected { border-color: var(--accent); color: var(--accent);
  background: color-mix(in srgb, var(--accent) 9%, var(--bg)); font-weight: 600; }

.status-line { font-size: 1rem; font-weight: 600; margin: 0 0 1rem; padding: 0.55rem 0.8rem;
  border-radius: 8px; }
.status-line.good { color: var(--good); background: var(--good-bg); }
.status-line.warn { color: var(--bad); background: var(--bad-bg); }

.meter-card.tile { cursor: pointer; }
.meter-card.tile:hover { border-color: var(--accent); }
.tile-badge { font-size: 1rem; font-weight: 700; }
.tile-badge.good { color: var(--good); }
.tile-badge.bad { color: var(--bad); }
.tile-badge.muted { color: var(--muted); }
.tile-cost { margin: 0.1rem 0 0.3rem; font-size: 0.9rem; }
.tile-detail { margin-bottom: 1rem; }

.total-row td { font-weight: 700; border-top: 2px solid var(--border); }
.howcalc-panel { margin-top: 0.6rem; }

.financial-donuts { display: flex; gap: 1.5rem; flex-wrap: wrap; }
.financial-donut-block { flex: 1 1 16rem; min-width: 16rem; }
.financial-donut-note { margin: 0.15rem 0 0; font-size: 0.78rem; }
.financial-donut { display: flex; align-items: center; gap: 1.25rem; flex-wrap: wrap; margin: 0.5rem 0 0.75rem; }
.donut-chart { width: 8.5rem; height: 8.5rem; flex-shrink: 0; }
.donut-center { fill: var(--fg); font-size: 0.5rem; font-weight: 700; }
.donut-center-sub { fill: var(--muted); font-size: 0.28rem; }
.donut-legend { list-style: none; padding: 0; margin: 0; flex: 1; min-width: 12rem; }
.donut-legend li { display: flex; align-items: center; gap: 0.5rem; padding: 0.28rem 0; font-size: 0.9rem; }
.legend-dot { width: 0.7rem; height: 0.7rem; border-radius: 2px; flex-shrink: 0; }
.legend-label { flex: 1; }
.legend-value { font-variant-numeric: tabular-nums; }

.status-pill.good { border-color: var(--good); color: var(--good); }
.status-pill.bad { border-color: var(--bad); color: var(--bad); }
.status-pill.warn { border-color: #9a6700; color: #9a6700; }

/* UC-5: správa objektu */
.revision-detail > td { background: var(--bad-bg, #f6f6f6); }
.revision-plan { margin: .3rem 0 .5rem; font-style: italic; }
tr.task-done td { opacity: .5; text-decoration: line-through; }
.revision-new, .revision-detail form { margin-top: .5rem; }

.push-card .push-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.push-card .push-head h3 { margin: 0; }
.push-scopes { display: flex; flex-wrap: wrap; gap: .5rem 1.2rem; margin-top: .6rem; }
.push-scope { display: flex; align-items: center; gap: .4rem; font-size: .9rem; }
.push-scope input:disabled + * , .push-scope:has(input:disabled) { color: var(--muted); }
.ia-accordion .push-card, .ia-accordion .ev-settings { margin-top: 1rem; }
.ev-settings h3 { margin: 0 0 .4rem; }

.notify-form { display: flex; flex-direction: column; gap: .8rem; max-width: 640px; }
.notify-form .notify-row { display: flex; gap: .8rem; flex-wrap: wrap; }
.notify-field { display: flex; flex-direction: column; gap: .25rem; }
.notify-field.grow, .notify-row .notify-field.grow { flex: 1; }
.notify-field > span { font-size: .8rem; color: var(--muted); }
.notify-field input, .notify-field select { width: 100%; }
.notify-groups { display: flex; flex-wrap: wrap; gap: .4rem 1rem; border: 1px solid var(--border); border-radius: 6px; padding: .5rem .7rem; }
.notify-groups legend { font-size: .8rem; color: var(--muted); padding: 0 .3rem; }
.notify-check { display: flex; align-items: center; gap: .4rem; font-size: .9rem; }

.wysiwyg { border: 1px solid var(--border); border-radius: 6px; overflow: hidden; }
.wysiwyg-toolbar { display: flex; gap: .2rem; padding: .3rem; background: var(--bad-bg, #f3f3f3); border-bottom: 1px solid var(--border); }
.wysiwyg-btn { min-width: 2rem; padding: .2rem .4rem; font-weight: 600; background: transparent; border: 1px solid var(--border); border-radius: 4px; cursor: pointer; color: inherit; }
.wysiwyg-btn:hover { background: var(--border); }
.wysiwyg-editor { min-height: 220px; padding: .7rem; font-size: .95rem; line-height: 1.5; outline: none; overflow-y: auto; }
.wysiwyg-editor:empty::before { content: "Text zprávy — dá se formátovat tučně, kurzívou, odrážkami, odkazem."; color: var(--muted); }

@media (max-width: 560px) {
  .inline-form { flex-direction: column; align-items: stretch; }
  .relation-row { flex-direction: column; align-items: flex-start; }
}

/* UC-6: strom struktury + RFID */
.struct-node { border: 1px solid var(--border, #ddd); border-radius: 6px; margin: .4rem 0; padding: .3rem .6rem; }
.struct-node > summary { cursor: pointer; font-weight: 600; }
.struct-meter { border-top: 1px solid var(--border, #eee); padding: .5rem 0; }
.struct-meter.is-inactive { opacity: .55; }
.struct-meter-head { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.struct-meter-edit { margin-top: .35rem; align-items: center; }
.struct-readonly .struct-meter-edit, .struct-readonly .struct-add-meter, .struct-readonly .struct-circuit-edit, .struct-readonly .struct-new-circuit { display: none; }
.conn-badge { font-size: .78rem; padding: .05rem .4rem; border-radius: 10px; border: 1px solid currentColor; }
.conn-ok { color: #1a7f37; }
.conn-late { color: #9a6700; }
.conn-nodata { color: #cf222e; }
.chk { display: inline-flex; gap: .3rem; align-items: center; }
.hint { font-size: .75rem; opacity: .7; }

/* UC-1: Provozní dashboard objektu */
.provoz-header { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: .5rem; }
.provoz-header h1 { margin: 0; }
.meteo-strip { display: flex; flex-wrap: wrap; gap: .5rem 1.1rem; padding: .5rem .2rem 0; font-size: .85rem; }
.provoz-band { margin-top: 1rem; }
/* LA vizuální review 2026-09-05 nález #3: admin "Provoz domu" byl na
   desktopu jeden úzký sloupec karet i na širokých viewportech. 2sloupcový
   grid nad 900px, obsah karet beze změny -- ne měnit, jen využít šířku. */
@media (min-width: 900px) {
  .provoz-bands { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1.2rem; align-items: start; }
  .provoz-bands .provoz-band { margin-top: 1rem; }
}
.provoz-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .6rem; margin: .5rem 0 .8rem; }
.provoz-kpis > div { display: flex; flex-direction: column; gap: .1rem; }
.provoz-kpis .muted { font-size: .78rem; }
.anomaly-list { list-style: none; padding: 0; margin: .3rem 0; }
.anomaly-list li { padding: .35rem .5rem; border-left: 3px solid var(--muted); margin: .25rem 0; background: color-mix(in srgb, var(--muted) 8%, var(--bg)); }
.anomaly-list li.sev-warn { border-left-color: #9a6700; background: color-mix(in srgb, #9a6700 10%, var(--bg)); }
.anomaly-list li.sev-bad { border-left-color: var(--bad); background: var(--bad-bg); }
.health-grid { display: flex; flex-wrap: wrap; gap: .4rem; }
.health-dot { font-size: .78rem; padding: .15rem .5rem; border-radius: 999px; border: 1px solid currentColor; }
.health-dot.good { color: var(--good); }
.health-dot.bad { color: var(--bad); }
.health-dot.warn { color: #9a6700; }
.flow-period-tabs { display: flex; flex-wrap: wrap; gap: 0.3rem; margin: 0.3rem 0 0.5rem; }
.flow-period-tabs button.active { color: var(--fg); border-color: var(--accent, var(--fg)); font-weight: 600; }
.flow-partial-note { margin-top: 0.3rem; font-size: 0.78rem; }
.sankey-card { margin-top: 0.3rem; }
.sankey-svg { width: 100%; height: auto; display: block; }
.sankey-legend { display: flex; flex-wrap: wrap; gap: 0.7rem 1rem; margin-top: 0.4rem; font-size: 0.78rem; color: var(--muted); }
.sankey-legend span { display: inline-flex; align-items: center; gap: 0.3rem; }
.sankey-swatch { width: 0.7rem; height: 0.7rem; border-radius: 2px; display: inline-block; }

/* UC-2: KPI mřížka rezidentského detailu (dnešní spotřeba + odhad za období) */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: .5rem; margin: .6rem 0 .9rem; }
.kpi { display: flex; flex-direction: column; gap: .15rem; padding: .5rem .65rem; border: 1px solid var(--border); border-radius: 8px; background: color-mix(in srgb, var(--muted) 5%, var(--bg)); }
.kpi-label { font-size: .74rem; color: var(--muted); }
.kpi strong { font-size: 1.15rem; font-variant-numeric: tabular-nums; }
.kpi strong .unit { font-size: .7rem; font-weight: 400; color: var(--muted); margin-left: .2rem; }

.auth-loading { padding: 2.5rem 1rem; text-align: center; }

/* WB->flats-portal consolidation (todo/portal.md [NÁVRH LA], krok 6) --
   ported verbatim from svjk-wallbox-portal's style.css for the /progress
   page (charging countdown/chart/mode-badge components). */
.locked { background: var(--locked-bg); }
.access-card { border-color: #b91c1c; }
.info-box { color: var(--accent); background: var(--locked-bg); border-radius: 6px; padding: 0.5rem 0.7rem; margin-top: 0.5rem; font-size: 1rem; font-weight: 700; }
.info-box.warning { color: #b91c1c; background: #fde2e2; }
.info-box.success { color: #15803d; background: #dcfce7; }
.progress-header { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: clamp(0.3rem, 1.5vw, 0.6rem); margin-bottom: 0.9rem; }
.progress-header .progress-photo-block { justify-self: center; }
.progress-header .progress-countdown { justify-self: center; align-self: stretch; }
.progress-countdown { display: flex; flex-direction: column; align-items: center; gap: clamp(0.3rem, 1.5vw, 0.6rem); justify-content: center; padding: clamp(0.4rem, 2.5vw, 1rem) clamp(0.5rem, 3vw, 1.4rem); border: 1px solid var(--border); border-radius: 10px; flex-shrink: 0; min-width: 0; }
.countdown-row { display: flex; align-items: center; gap: clamp(0.3rem, 1.5vw, 0.6rem); }
.countdown-icon { width: clamp(16px, 5.5vw, 30px); height: clamp(16px, 5.5vw, 30px); color: var(--accent); flex-shrink: 0; }
.countdown-row > div { display: flex; flex-direction: column; line-height: 1.15; }
.countdown-label { font-size: clamp(0.55rem, 1.8vw, 0.75rem); color: var(--muted); text-transform: uppercase; letter-spacing: 0.03em; white-space: nowrap; }
.countdown-value { font-size: clamp(0.72rem, 2.6vw, 1.05rem); font-weight: 700; font-variant-numeric: tabular-nums; }
.countdown-relative { font-weight: 600; color: var(--muted); }
.progress-countdown.state-done { border-color: color-mix(in srgb, #16a34a 45%, var(--bg)); background: color-mix(in srgb, #16a34a 14%, var(--bg)); }
.progress-countdown.state-waiting { border-color: color-mix(in srgb, #2563eb 45%, var(--bg)); background: color-mix(in srgb, #2563eb 14%, var(--bg)); }
.progress-countdown.state-charging { border-color: color-mix(in srgb, #f59e0b 55%, var(--bg)); background: color-mix(in srgb, #f59e0b 16%, var(--bg)); }
.progress-countdown.state-late { border-color: color-mix(in srgb, #dc2626 50%, var(--bg)); background: color-mix(in srgb, #dc2626 14%, var(--bg)); }
.countdown-state { font-size: clamp(0.6rem, 2vw, 0.8rem); font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; white-space: nowrap; }
.state-done .countdown-state { color: #15803d; white-space: normal; text-transform: none; letter-spacing: normal; }
.state-waiting .countdown-state { color: #1d4ed8; }
.state-charging .countdown-state { color: #b45309; }
.state-late .countdown-state { color: #b91c1c; }
.progress-car-photo { width: clamp(52px, 17vw, 240px); height: auto; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 10px; flex-shrink: 0; }
.progress-car-photo.car-placeholder { display: grid; place-items: center; background: var(--border); color: var(--muted); font-size: 0.7rem; }
.progress-photo-block { display: flex; flex-direction: column; align-items: center; gap: 0.3rem; flex-shrink: 0; min-width: 0; }
.progress-car-name { font-size: clamp(0.6rem, 1.8vw, 0.8rem); max-width: clamp(52px, 17vw, 240px); text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.progress-charging-frame { flex: 1; min-width: 0; border: 1px solid var(--border); border-radius: 10px; padding: 0.7rem 0.9rem; }
.progress-charging-frame strong { display: block; font-size: 1.15rem; }
.progress-charging-frame p { margin: 0.3rem 0 0; color: var(--muted); }
.mode-badge { flex-shrink: 0; font-size: clamp(0.62rem, 2vw, 0.85rem); font-weight: 700; padding: clamp(0.2rem, 1.2vw, 0.4rem) clamp(0.35rem, 2vw, 0.8rem); border-width: 1.5px; align-self: center; white-space: nowrap; }
.progress-header .mode-badge {
  justify-self: end; margin-left: 0; white-space: normal;
  width: clamp(52px, 17vw, 240px); height: clamp(39px, 12.75vw, 180px);
  display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: clamp(0.1rem, 0.8vw, 0.3rem);
}
.mode-badge-label { font-size: clamp(0.5rem, 1.6vw, 0.7rem); font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; opacity: 0.75; }
.mode-badge-value { font-size: clamp(0.95rem, 4vw, 1.6rem); font-weight: 800; line-height: 1.05; }
.mode-badge-normal { color: #2563eb; border-color: #2563eb; background: color-mix(in srgb, #2563eb 12%, var(--bg)); }
.mode-badge-eco { color: #15803d; border-color: #15803d; background: color-mix(in srgb, #15803d 12%, var(--bg)); }
.mode-badge-boost { color: #dc2626; border-color: #dc2626; background: color-mix(in srgb, #dc2626 12%, var(--bg)); }
.mode-badge-socket230 { color: #6b7280; border-color: #6b7280; background: color-mix(in srgb, #6b7280 12%, var(--bg)); }
.charge-progress { position: relative; height: 1.5rem; background: var(--border); border-radius: 999px; overflow: hidden; margin: 0.6rem 0 0.35rem; }
.charge-progress-fill {
  height: 100%; border-radius: 999px; background: var(--accent);
  background-image: repeating-linear-gradient(45deg, rgba(255,255,255,.28) 0 10px, transparent 10px 20px);
  background-size: 28px 28px;
  transition: width 0.6s ease;
  animation: charge-progress-stripes 1.1s linear infinite;
}
@keyframes charge-progress-stripes { to { background-position: 28px 0; } }
.charge-progress-labels { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: 0.1rem 0.6rem; font-size: 0.85rem; margin-bottom: 0.9rem; }
.charge-progress-labels strong { font-size: 1.15rem; }
.progress-stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.7rem 1rem; margin: 0.9rem 0; }
.progress-stats > div { display: flex; flex-direction: column; gap: 0.1rem; }
.progress-stats span { font-size: 0.75rem; }
.progress-stats strong { font-size: 1rem; }
.progress-chart-card { background: var(--card, transparent); border: 1px solid var(--border); border-radius: 10px; padding: 1rem; margin-top: 1rem; }
.progress-chart-card h3 { margin: 0 0 0.6rem; font-size: 0.95rem; }
.progress-chart { width: 100%; height: auto; display: block; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 0.9rem; margin-top: 0.6rem; font-size: 0.78rem; color: var(--muted); }
.chart-legend span { display: inline-flex; align-items: center; gap: 0.35rem; }
.chart-swatch { width: 0.7rem; height: 0.7rem; border-radius: 2px; display: inline-block; }

/* WB /help page (todo/portal.md [NÁVRH LA], krok 8) */
.field-help { color: var(--muted); font-size: 0.8rem; margin: 0.3rem 0 0; }
.help-steps, .help-list { padding-left: 1.3rem; margin: 0.6rem 0; }
.help-steps li, .help-list li { margin: 0.4rem 0; }

/* WB /history page (todo/portal.md [NÁVRH LA], krok 8) */
.history-summary { display: flex; align-items: center; gap: 1.6rem; flex-wrap: wrap; }
.history-summary > div { display: flex; flex-direction: column; gap: 0.15rem; }
.history-summary strong { font-size: 1.15rem; }
.history-summary #export-csv { margin-left: auto; width: auto; }
.sessions-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.sessions-table th, .sessions-table td { text-align: left; padding: 0.5rem 0.6rem; border-bottom: 1px solid var(--border); white-space: nowrap; }
.sessions-table-wrap { overflow-x: auto; }

/* WB /chips page (todo/portal.md [NÁVRH LA], krok 9) */
.danger-text { color: #b91c1c; }
.chip-item input { margin: 0.6rem 0; }
.chip-status-allowed { border-color: #15803d; color: #15803d; }
.chip-status-denied { border-color: #b91c1c; color: #b91c1c; }
.chip-owner-label { display: block; font-size: 0.75rem; color: var(--muted); margin-bottom: 0.4rem; }
.chip-owner-label select { width: 100%; margin-top: 0.15rem; }
.chip-car-checks { border: 1px solid var(--border); border-radius: 6px; padding: 0.4rem 0.5rem; margin: 0 0 0.5rem; }
.chip-car-checks legend { font-size: 0.72rem; color: var(--muted); padding: 0 0.3rem; }
.chip-car-checks label { display: flex; align-items: center; gap: 0.4rem; font-size: 0.85rem; margin: 0.2rem 0; }
.chip-car-checks input { width: auto; }

/* WB /wallbox (settings/params) + /profile pages (todo/portal.md [NÁVRH LA], krok 10) */
.input-with-unit { display: flex; align-items: center; gap: 0.5rem; }
.input-with-unit input { min-width: 0; }
.input-with-unit span { color: var(--muted); font-size: 0.9rem; }
.check-row { display: flex; align-items: flex-start; gap: 0.6rem; margin-top: 1.1rem; }
.check-row input { width: auto; margin-top: 0.2rem; }
.check-row small { display: block; color: var(--muted); margin-top: 0.2rem; }
.feedback { min-height: 1.2rem; margin-top: 1rem; color: var(--muted); }
.feedback.error, .field-error { color: #b91c1c; }
.action-bar { position: sticky; bottom: 0; background: var(--bg); padding-top: 0.5rem; }
.section-divider { border: none; border-top: 3px solid var(--accent); opacity: 0.3; margin: 2.2rem 0 1.6rem; }
.car-list { display: grid; gap: 0.6rem; margin: 1rem 0; }
.car-item { display: flex; align-items: center; flex-wrap: wrap; gap: 0.8rem; border-top: 1px solid var(--border); padding: 0.7rem 0; cursor: pointer; }
.car-item img, .car-placeholder { width: 56px; height: 44px; object-fit: cover; border-radius: 6px; background: var(--border); display: grid; place-items: center; color: var(--muted); font-size: 0.75rem; }
.car-item.is-selected { border: 2px solid var(--accent); border-radius: 8px; padding: calc(0.7rem - 1px); background: color-mix(in srgb, var(--accent) 7%, var(--bg)); }
.car-details { flex: 1; min-width: 0; }
.car-details strong, .car-details span { display: block; }
.car-details span { color: var(--muted); font-size: 0.85rem; margin-top: 0.2rem; }
.car-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 0.2rem; }
.car-editor { border-top: 1px solid var(--border); padding-top: 1rem; margin-bottom: 1rem; }
.mode-field { border: 0; padding: 0; margin: 1rem 0 1.4rem; }
.mode-field legend { color: var(--muted); font-size: 0.85rem; margin-bottom: 0.5rem; }
.mode-options { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.6rem; }
.mode-option { display: flex; flex-direction: column; align-items: flex-start; gap: 0.2rem; min-height: 4.5rem; text-align: left; border: 1px solid var(--border); background: var(--bg); color: var(--fg); margin: 0; }
.mode-option span { color: var(--muted); font-size: 0.78rem; }
.mode-option.is-selected { border: 2px solid var(--accent); padding: calc(0.75rem - 1px); background: color-mix(in srgb, var(--accent) 9%, var(--bg)); }
.mode-normal.is-selected { --accent: #2563eb; border-color: #2563eb; color: #2563eb; background: color-mix(in srgb, #2563eb 9%, var(--bg)); }
.mode-eco.is-selected { --accent: #15803d; border-color: #15803d; color: #15803d; background: color-mix(in srgb, #15803d 9%, var(--bg)); }
.mode-boost.is-selected { --accent: #dc2626; border-color: #dc2626; color: #dc2626; background: color-mix(in srgb, #dc2626 9%, var(--bg)); }
.resident-email { display: inline-flex; align-items: center; border: 1px solid var(--border); border-radius: 999px; padding: 0.2rem 0.4rem 0.2rem 0.7rem; margin: 0.2rem 0.35rem 0.2rem 0; font-size: 0.85rem; }
.resident-access-row { display: flex; flex-wrap: wrap; align-items: center; gap: 0.8rem; border-top: 1px solid var(--border); padding: 0.6rem 0; }
.resident-access-row .resident-email { flex: 1; min-width: 10rem; margin: 0; border: 0; padding: 0; display: block; line-height: 1.3; }
.resident-access-row .resident-email strong { font-size: 0.95rem; }
.resident-access-row label { display: inline-flex; align-items: center; gap: 0.3rem; width: auto; font-size: 0.85rem; color: var(--muted); }
.resident-access-row input[type="checkbox"] { width: auto; }
.save-notice { display: flex; align-items: center; gap: 1rem; border: 2px solid #15803d; background: #dcfce7; color: #14532d; }
.save-notice-illustration { width: 110px; height: 55px; flex-shrink: 0; color: #15803d; }
.save-notice #save-notice-text { margin: 0; font-size: 1.05rem; font-weight: 600; }
.save-notice-cable { animation: save-notice-flow 1.4s linear infinite; }
.save-notice-plug { animation: save-notice-pulse 1.4s ease-in-out infinite; }
@keyframes save-notice-flow { to { stroke-dashoffset: -18; } }
@keyframes save-notice-pulse { 0%, 100% { r: 7; opacity: 1; } 50% { r: 9; opacity: 0.7; } }
@media (max-width: 560px) {
  .save-notice { flex-direction: column; text-align: center; }
  .save-notice-illustration { width: 140px; height: 70px; }
}
.plan-list { display: grid; gap: 1rem; margin: 0.6rem 0 1rem; }
.plan-card { border: 1px solid var(--border); border-radius: 14px; padding: 1rem; background: color-mix(in srgb, var(--fg) 3%, var(--bg)); }
.plan-card-head { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.8rem; }
.plan-label { flex: 1; padding: 0.55rem 0.6rem; font-size: 1rem; font-weight: 600; border-radius: 10px; }
.plan-card-head .text-button { flex-shrink: 0; }
.plan-days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 0.3rem; margin: 0.5rem 0 0.9rem; }
.plan-day { width: 100%; padding: 0.55rem 0; margin: 0; font-size: 0.8rem; background: var(--bg); color: var(--muted); border: 1px solid var(--border); border-radius: 10px; }
.plan-day.is-on { background: var(--accent); color: #fff; border-color: var(--accent); font-weight: 700; }
.plan-day.is-elsewhere { opacity: 0.45; border-style: dashed; }
.plan-modes { display: grid; grid-template-columns: 1fr; gap: 0.45rem; margin-top: 0.4rem; }
.plan-mode { display: flex; flex-direction: column; align-items: flex-start; gap: 0.15rem; margin: 0; padding: 0.7rem 0.85rem; text-align: left; background: var(--bg); color: var(--fg); border: 1.5px solid var(--border); border-radius: 12px; }
.plan-mode strong { font-size: 0.95rem; font-weight: 700; }
.plan-mode span { font-size: 0.78rem; color: var(--muted); }
.plan-mode.is-selected { border-width: 2px; padding: calc(0.7rem - 0.5px) calc(0.85rem - 0.5px); }
.plan-mode.mode-normal.is-selected { border-color: #2563eb; background: color-mix(in srgb, #2563eb 10%, var(--bg)); }
.plan-mode.mode-normal.is-selected strong { color: #2563eb; }
.plan-mode.mode-eco.is-selected { border-color: #15803d; background: color-mix(in srgb, #15803d 10%, var(--bg)); }
.plan-mode.mode-eco.is-selected strong { color: #15803d; }
.plan-mode.mode-boost.is-selected { border-color: #dc2626; background: color-mix(in srgb, #dc2626 10%, var(--bg)); }
.plan-mode.mode-boost.is-selected strong { color: #dc2626; }
.plan-hint { color: var(--muted); font-size: 0.82rem; line-height: 1.35; margin: 0.7rem 0 0; }
.plan-temp { display: flex; align-items: center; gap: 0.5rem; margin-top: 0.8rem; padding-top: 0.7rem; border-top: 1px solid var(--border); color: var(--muted); font-size: 0.82rem; }
.plan-temp input { width: auto; flex-shrink: 0; }

/* WB admin "Wallboxy" tab (todo/portal.md [NÁVRH LA], krok 11) */
.resident-line { margin-right: 0.4rem; }
.admin-chips { border-top: 1px solid var(--border); margin-top: 0.75rem; padding-top: 0.6rem; }
.admin-access { border-top: 1px solid var(--border); margin-top: 0.75rem; padding-top: 0.6rem; }
.chips-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 0.6rem; }
.chip-card { border: 1px solid var(--border); border-left: 3px solid var(--muted); border-radius: 8px; padding: 0.6rem 0.7rem; background: var(--bg); }
.chip-card.chip-status-allowed { border-left-color: #15803d; }
.chip-card.chip-status-denied { border-left-color: #b91c1c; }
.chip-card-top { display: flex; align-items: center; gap: 0.4rem; margin-bottom: 0.4rem; flex-wrap: wrap; }
.chip-dot { width: 0.6rem; height: 0.6rem; border-radius: 50%; flex: none; background: currentColor; }
.chip-status-allowed .chip-dot { color: #15803d; }
.chip-status-denied .chip-dot { color: #b91c1c; }
.chip-name-input { flex: 1; min-width: 0; font-weight: 600; border: 1px solid transparent; background: transparent; color: var(--fg); padding: 0.1rem 0.3rem; margin: 0; border-radius: 4px; }
.chip-name-input:hover, .chip-name-input:focus { border-color: var(--border); background: var(--bg); }
.chip-id { font-size: 0.72rem; color: var(--muted); background: var(--border); border-radius: 4px; padding: 0.1rem 0.35rem; }
.chip-card .button-row { margin: 0; }

/* WB admin quick-mode QR (todo/portal.md [NÁVRH LA], krok 12) */
.quick-mode-tokens { border-top: 1px solid var(--border); margin-top: 0.75rem; padding-top: 0.6rem; }
.quick-mode-token-row { display: flex; gap: 0.7rem; align-items: center; border-top: 1px solid var(--border); padding: 0.6rem 0; }
.quick-mode-token-row:first-child { border-top: none; }
.quick-mode-qr { width: 96px; height: 96px; background: var(--border); border-radius: 4px; flex: none; }

/* Resident home rozcestník: byt vs. wallbox (todo/portal.md [NÁVRH LA], appka-konsolidace, 2026-09-08) */
.hub-tiles { display: flex; gap: 0.6rem; }
.hub-tile { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 0.2rem; padding: 0.7rem 0.5rem; border: 1px solid var(--border); border-radius: 8px; text-decoration: none; color: inherit; font-size: 1.5rem; }
.hub-tile span { font-size: 0.85rem; font-weight: 600; }
.hub-tile-active { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, transparent); }

/* UC-1st welcome screen, ported from svjk-wallbox-portal (todo/portal.md [NÁVRH LA], 2026-09-08) */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.5); display: flex; align-items: center; justify-content: center; padding: 1rem; z-index: 50; }
.modal-card { background: var(--bg); border: 1px solid var(--border); border-radius: 14px; padding: 1.3rem; max-width: 26rem; width: 100%; }
.modal-card h3 { margin-bottom: 0.5rem; }
