:root {
  --bg: #f4f5f7; --panel: #fff; --ink: #1d2330; --muted: #6b7280; --line: #e3e6eb;
  --accent: #0f5c8c; --accent-soft: #e5f0f7; --warn: #a15c00; --warn-soft: #fff4e0;
  --bad: #a3221b; --bad-soft: #fdecea; --ok: #1d6b3a; --ok-soft: #e6f4ea;
  --brand: #16324a;   /* hlavička a dlaždice Celkem; klient přepíše v theme.css */
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink);
  font: 15px/1.45 Calibri, Carlito, "Segoe UI", system-ui, sans-serif; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.6rem; margin: 0 0 .75rem; font-weight: 600; }
h2 { font-size: 1.2rem; margin: 1.5rem 0 .5rem; font-weight: 600; }
.muted { color: var(--muted); }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }

header.top { background: var(--brand); color: #fff; padding: .45rem 1rem; }
.top-in { max-width: 1280px; margin: 0 auto; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: .35rem 1.2rem; }
header.top a { color: #fff; }
.brand { white-space: nowrap; display: flex; flex-direction: column; align-items: flex-start; gap: .2rem; line-height: 1.15; }
.brand a.brand-name { font-weight: 700; font-size: 1.15rem; }
.brand span { opacity: .65; font-size: .85rem; }
header nav.mainnav { display: flex; gap: .2rem; flex-wrap: wrap; justify-content: center; }
header nav.mainnav a { padding: .35rem .75rem; border-radius: 4px; opacity: .85; }
header nav.mainnav a.on, header nav.mainnav a:hover { background: rgba(255,255,255,.16); opacity: 1; text-decoration: none; }
header nav.mainnav a.on { font-weight: 600; }
.user { font-size: .9rem; justify-self: end; white-space: nowrap; display: flex; flex-direction: column; align-items: flex-end; gap: .1rem; line-height: 1.2; }
.user a { opacity: .9; }
.user a.logout { font-size: .8rem; opacity: .7; }
.user a:hover { opacity: 1; }
nav.subnav { background: var(--subnav-bg, var(--panel, #fff)); border-bottom: 1px solid var(--line); }
.subnav-in { max-width: 1280px; margin: 0 auto; padding: 0 1rem; display: flex; gap: .1rem; flex-wrap: wrap; justify-content: center; }
nav.subnav a { padding: .5rem .8rem; opacity: .8; border-bottom: 3px solid transparent; margin-bottom: -1px; }
nav.subnav a:hover { opacity: 1; text-decoration: none; border-bottom-color: var(--line); }
nav.subnav a.on { opacity: 1; font-weight: 600; color: var(--brand); border-bottom-color: var(--brand); }

main { max-width: 1280px; margin: 0 auto; padding: 1.25rem 1rem 3rem; }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 1rem 1.2rem; }
.card.narrow { max-width: 380px; margin: 3rem auto; display: grid; gap: .8rem; }
label { display: grid; gap: .25rem; font-size: .9rem; color: var(--muted); }
input, select, button { font: inherit; }
input, select { padding: .45rem .6rem; border: 1px solid #c9ced6; border-radius: 4px; background: #fff; color: var(--ink); }
button, .btn { padding: .5rem 1rem; border: 0; border-radius: 4px; background: var(--accent); color: #fff; cursor: pointer; display: inline-block; }
.btn.light { background: var(--accent-soft); color: var(--accent); }
.alert { background: var(--bad-soft); color: var(--bad); padding: .5rem .7rem; border-radius: 4px; margin: 0; }

.toolbar { display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; margin-bottom: .75rem; }
.toolbar .filter { flex: 1; min-width: 200px; max-width: 420px; }
.toolbar .count { color: var(--muted); font-size: .9rem; }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: .8rem; margin-bottom: 1rem; }
.tile { background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: .8rem 1rem; }
.tile .label { color: var(--muted); font-size: .85rem; }
.tile .value { font-size: 1.6rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.tile .sub { color: var(--muted); font-size: .85rem; }
.tile.warn .value { color: var(--warn); }

.tablewrap { overflow-x: auto; background: var(--panel); border: 1px solid var(--line); border-radius: 6px; }
table { border-collapse: collapse; width: 100%; }
th, td { padding: .4rem .65rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { background: #f8f9fb; font-weight: 600; font-size: .88rem; color: #3b4352; white-space: nowrap; position: sticky; top: 0; }
th[data-sort] { cursor: pointer; user-select: none; }
th[data-sort]::after { content: ' ↕'; opacity: .3; font-size: .8em; }
th.asc::after { content: ' ↑'; opacity: .8; }
th.desc::after { content: ' ↓'; opacity: .8; }
tbody tr:hover { background: #f7fafc; }
tr.vacant td { color: var(--muted); }
tr.gap td { background: var(--warn-soft); color: var(--warn); }
tr.gap td .badge { background: #fff; }
tr.ended td:first-child a { text-decoration: line-through; text-decoration-color: #bbb; }
tr.old td { color: var(--muted); text-decoration: line-through; text-decoration-color: #bbb; }
tfoot td { font-weight: 600; background: #f8f9fb; }
tr.group td { background: #eef1f5; font-weight: 600; }

.badge { display: inline-block; padding: .05rem .45rem; border-radius: 3px; font-size: .8rem; background: #eef1f5; color: #3b4352; white-space: nowrap; }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }
.badge.info { background: var(--accent-soft); color: var(--accent); }

dl.props { display: grid; grid-template-columns: max-content 1fr; gap: .3rem 1.2rem; margin: 0; }
dl.props dt { color: var(--muted); }
dl.props dd { margin: 0; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 1rem; }

.check { margin-bottom: 1rem; }
.check h2 { display: flex; gap: .5rem; align-items: center; margin-top: 0; }
.check p { margin: .2rem 0 .6rem; color: var(--muted); }

@media (max-width: 900px) {
  .top-in { grid-template-columns: 1fr auto; }
  header nav.mainnav { grid-column: 1 / -1; grid-row: 2; }
}
@media (max-width: 640px) {
  th, td { padding: .35rem .45rem; }
}

.flash { background: var(--ok-soft); color: var(--ok); padding: .5rem .8rem; border-radius: 4px; margin: 0 0 1rem; }
form.stack { display: grid; gap: .8rem; max-width: 520px; }
form.stack .row { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; }
label.check { display: flex; gap: .5rem; align-items: center; color: var(--ink); }
.actions { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }
button.danger, .btn.danger { background: var(--bad); }

/* Průvodci */
.wizard { display: grid; gap: 1rem; }
.step h2 { margin-top: 0; display: flex; gap: .6rem; align-items: center; }
.step .n { display: inline-grid; place-items: center; width: 1.7rem; height: 1.7rem; border-radius: 50%; background: var(--accent); color: #fff; font-size: .95rem; }
.grid-form { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: .7rem 1rem; align-items: end; }
.grid-form .wide { grid-column: 1 / -1; }
.inline { display: flex; gap: .4rem; }
.inline input { flex: 1; min-width: 0; }
.tablewrap.scroll { max-height: 420px; overflow-y: auto; }
table.units td, table.items td { vertical-align: middle; }
table.items input:not([type=checkbox]), table.items select { width: 100%; min-width: 70px; }
table.items td:nth-child(2) input { min-width: 170px; }
table.mini { width: auto; }
tr.busy td { color: var(--muted); }
button.link { background: none; color: var(--bad); padding: .2rem .4rem; }
.actions.sticky { position: sticky; bottom: 0; background: var(--bg); padding: .8rem 0; border-top: 1px solid var(--line); margin-top: 1rem; }
.warnbox { background: var(--warn-soft); color: var(--warn); padding: .6rem .9rem; border-radius: 4px; margin-bottom: 1rem; }
.warnbox ul, .alert ul { margin: .3rem 0 0; padding-left: 1.2rem; }
div.alert { padding: .6rem .9rem; }
input[readonly] { background: #f1f3f6; }
[hidden] { display: none !important; }
tr.bad-row td { background: var(--bad-soft); }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }   /* honeypot (formuláře přihlášení a obnovy hesla) */
.cf-turnstile { min-height: 65px; }

/* Volba měsíce */
.monthbar { background: #e9eff5; border-bottom: 1px solid #d3dde8; }
.mb-in { max-width: 1280px; margin: 0 auto; padding: .55rem 1rem; display: flex; gap: 1.6rem; align-items: center; justify-content: center; flex-wrap: wrap; }
.mb-label { color: var(--muted); font-size: .95rem; }
.mb-label strong { color: var(--ink); font-weight: 600; }
.mb-group { display: inline-flex; align-items: center; gap: .5rem; }
.mb-group select { font-weight: 600; font-size: 1rem; padding: .35rem 2rem .35rem .8rem; min-width: 11rem; text-align: center; border-radius: 6px; border-color: #b9c6d4; }
.mb-btn { display: inline-grid; place-items: center; width: 2.1rem; height: 2.1rem; border-radius: 50%; background: #fff; border: 1px solid #b9c6d4; color: var(--accent); transition: background .15s, color .15s; }
.mb-btn:hover { background: var(--accent); color: #fff; border-color: var(--accent); text-decoration: none; }
.mb-today { font-size: .9rem; padding: .3rem .8rem; border-radius: 999px; border: 1px solid #b9c6d4; background: #fff; }
.mb-today:hover { text-decoration: none; background: var(--accent-soft); }
.mb-today.on { color: var(--muted); border-color: transparent; background: transparent; pointer-events: none; }
.notice { background: var(--accent-soft); color: var(--accent); padding: .5rem .8rem; border-radius: 4px; margin: 0 0 1rem; }

/* Přehled – dashboard */
.tiles.t4 { grid-template-columns: repeat(4, 1fr); }
.tiles.t5 { grid-template-columns: repeat(5, 1fr); }
.tiles.t6 { grid-template-columns: repeat(6, 1fr); }
@media (max-width: 1100px) { .tiles.t5, .tiles.t6 { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 800px)  { .tiles.t4, .tiles.t5, .tiles.t6 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 480px)  { .tiles.t4, .tiles.t5, .tiles.t6 { grid-template-columns: 1fr; } }
.tile { display: flex; flex-direction: column; gap: .15rem; color: var(--ink); }
a.tile:hover { text-decoration: none; border-color: var(--accent); }
.tile .value { font-size: 1.45rem; line-height: 1.2; white-space: nowrap; }
.tiles.t6 .tile .value, .tiles.t5 .tile .value { font-size: 1.25rem; }
.tile .sub { line-height: 1.4; }
.tile .of { font-size: .95rem; color: var(--muted); font-weight: 400; }
.tile .ln { display: flex; justify-content: space-between; gap: .5rem; font-size: .82rem; border-top: 1px dashed var(--line); padding-top: .15rem; margin-top: .15rem; }
.tile .ln span:last-child { font-variant-numeric: tabular-nums; white-space: nowrap; }
.tile.cost .value { color: #7a3b12; }
.tile.est { border-style: dashed; }
.tile.placeholder { background: #f8f9fb; }
.tile.placeholder .value { color: #b0b6bf; }
.tile.ok .value { color: var(--ok); }
.tile.total { background: var(--brand); border-color: var(--brand); color: #fff; }
.tile.total .label, .tile.total .sub, .tile.total .muted { color: #c9d6e3; }
.tile.total .value { color: #7ee2a8; font-size: 1.6rem; }
.tile.total.neg .value { color: #ffb4a8; }
.tile.total .badge.warn { background: #ffe2b8; }
.tile.span2 { grid-column: span 2; }
.tile .label .op { display: inline-block; width: 1.1rem; font-weight: 700; color: var(--accent); }
.tile.total .label .op { color: #7ee2a8; }
@media (max-width: 1100px) { .sum-row .tile.span2 { grid-column: span 3; } }
@media (max-width: 800px)  { .sum-row .tile.span2 { grid-column: span 2; } }
@media (max-width: 480px)  { .sum-row .tile.span2 { grid-column: span 1; } }

/* ---------- Vývoj: grafy a roční tabulka ---------- */
.yearbar { display: flex; align-items: center; justify-content: center; gap: 1rem; margin: .3rem 0 .2rem; }
.yearbar h1 { margin: 0; min-width: 8ch; text-align: center; }
.mb-btn.off { visibility: hidden; }
.center { text-align: center; }
.small { font-size: .82rem; }
.chartcard { margin-bottom: 1rem; }
.chartcard h2 { margin: 0 0 .4rem; font-size: 1.05rem; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 900px) { .grid2 { grid-template-columns: 1fr; } }
.legend { display: flex; flex-wrap: wrap; gap: .3rem 1.1rem; font-size: .82rem; color: var(--muted); margin-bottom: .3rem; }
.legend i { display: inline-block; width: .8rem; height: .8rem; border-radius: 3px; margin-right: .35rem; vertical-align: -1px; }
.legend i.dot { width: .7rem; height: .7rem; border-radius: 50%; background: var(--ink); border: 2px solid #fff; box-shadow: 0 0 0 1px var(--ink); }
.s1 { fill: #2a78d6; background: #2a78d6; } .s2 { fill: #eb6834; background: #eb6834; }
.s3 { fill: #1baf7a; background: #1baf7a; } .s4 { fill: #6250d6; background: #6250d6; }
.s5 { fill: #d6a12a; background: #d6a12a; }
svg.chart { width: 100%; height: auto; display: block; font-family: inherit; }
svg.chart .grid { stroke: #eceef1; stroke-width: 1; } svg.chart .grid.zero { stroke: #b9c0ca; }
svg.chart .ax { fill: var(--muted); font-size: 11px; }
svg.chart g.dim { opacity: .45; }
svg.chart .ln { fill: none; stroke: var(--ink); stroke-width: 2; pointer-events: none; }
svg.chart .ln.s1 { stroke: #2a78d6; fill: none; background: none; }
svg.chart .pt { fill: var(--ink); stroke: #fff; stroke-width: 2; pointer-events: none; }
svg.chart .pt.s1 { fill: #2a78d6; } svg.chart .pt.dim { opacity: .5; }
svg.chart .hit { fill: transparent; cursor: pointer; }
svg.chart .hit:hover { fill: rgba(15, 92, 140, .06); }
.charttip { position: fixed; z-index: 50; pointer-events: none; background: #fff; color: var(--ink); border: 1px solid var(--line); border-radius: 6px;
  box-shadow: 0 4px 14px rgba(0,0,0,.12); padding: .45rem .65rem; font-size: .82rem; white-space: pre-line; max-width: 320px; }
table.yeartab th, table.yeartab td { white-space: nowrap; padding: .3rem .5rem; }
table.yeartab thead th { text-align: right; } table.yeartab thead th a { color: var(--ink); }
table.yeartab tbody th { font-weight: 400; text-align: left; }
table.yeartab .tag { font-size: .7rem; color: var(--muted); font-weight: 400; }
table.yeartab .dimcol .tag { color: var(--warn); }
table.yeartab tr.strong th, table.yeartab tr.strong td { font-weight: 600; }
table.yeartab tr.total td, table.yeartab tr.total th { border-top: 2px solid var(--ink); }
table.yeartab tr.sub th, table.yeartab tr.sub td { color: var(--muted); font-size: .85rem; }
table.yeartab tr.sep td { padding: .2rem; border: 0; background: var(--bg); }
table.yeartab .tot { background: #f8f9fb; font-weight: 600; }
table.yeartab .neg { color: var(--bad); }

/* Vývoj – přepínač režimu, srovnání */
.seg { display: flex; justify-content: center; gap: 0; margin: .4rem 0 .2rem; }
.seg a { padding: .35rem .9rem; border: 1px solid #b9c6d4; color: var(--accent); background: #fff; font-size: .92rem; }
.seg a:first-child { border-radius: 4px 0 0 4px; } .seg a:last-child { border-radius: 0 4px 4px 0; border-left: 0; }
.seg a.on { background: var(--accent); color: #fff; border-color: var(--accent); pointer-events: none; }
.seg a:hover { text-decoration: none; background: var(--accent-soft); }
.mb-year { font-size: 1.15rem; min-width: 4ch; text-align: center; }
svg.chart .ax.yr { font-size: 10px; font-weight: 600; }
svg.chart .pt.ghost { fill: #fff; stroke: #8a8f98; stroke-width: 2; }
.legend i.dot.ghost { background: #fff; border: 2px solid #8a8f98; box-shadow: none; }
table.yeartab .cmp { background: #fbfbfc; color: var(--muted); }
table.yeartab .pos { color: var(--ok); }

/* ---------- Přijaté faktury a akce ---------- */
td.neg { color: var(--bad); font-weight: 600; }
.tile .bar { height: 6px; background: var(--line); border-radius: 3px; margin-top: .5rem; overflow: hidden; }
.tile .bar span { display: block; height: 100%; background: var(--accent); }
.tile.total .bar span { background: #ffb4a8; }
#fpitems { padding: .4rem .6rem; display: grid; gap: 0; }
.fp-row { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 1.1fr) minmax(0, .7fr) minmax(0, 1.1fr) minmax(0, 1.3fr) minmax(0, .9fr) minmax(0, 1.1fr) 1.6rem;
  gap: .3rem .4rem; padding: .45rem 0; border-bottom: 1px solid var(--line); align-items: center; }
.fp-row > * { min-width: 0; width: 100%; }
.fp-row .p-ucet { grid-column: 1 / 4; } .fp-row .p-akce { grid-column: 4 / 7; } .fp-row .p-jedn { grid-column: 7 / 9; }
.fp-row .p-mn, .fp-row .p-cena, .fp-row .p-zak, .fp-row .p-dph { text-align: right; }
.fp-row.fp-head { font-size: .8rem; color: var(--muted); padding: .2rem 0; }
.fp-row.fp-head span:nth-child(n+9) { display: none; }
.fp-row .del { padding: 0; }

/* ---------- Přehled: dlaždice indexace (nájmy / parking) ---------- */
.ixcols { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; margin-top: .3rem; }
.ixcol { display: flex; flex-direction: column; gap: .1rem; color: var(--ink); border-left: 3px solid var(--line); padding-left: .7rem; }
.ixcol:hover { text-decoration: none; border-left-color: var(--accent); }
.ixcol .sub { color: var(--muted); font-size: .82rem; line-height: 1.35; }
@media (max-width: 480px) { .ix-row .tile.span2 { grid-column: span 1; } .ixcols { grid-template-columns: 1fr; } }

/* ---------- Průvodce indexací ---------- */
.ix-tab .ix-head td { background: var(--bg, #f3f5f8); border-top: 2px solid var(--line); }
.ix-tab .ix-head .badge { margin-top: .2rem; }
.ix-tab input.num { width: 9rem; }

/* ---------- Filtr typů (čipy) ---------- */
.chips { display: flex; flex-wrap: wrap; gap: .35rem; margin: .1rem 0 .6rem; }
.chips a { padding: .2rem .7rem; border: 1px solid #b9c6d4; border-radius: 999px; background: #fff; color: var(--accent); font-size: .88rem; }
.chips a:hover { text-decoration: none; background: var(--accent-soft); }
.chips a.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.chips a .n { opacity: .65; font-size: .8rem; margin-left: .15rem; }
.chips a.pref { border-style: dashed; }
.yeartab a.poh { font-weight: 700; text-decoration: none; }
.yeartab a.poh:hover { text-decoration: underline; }
.yeartab a.poh.on { background: var(--accent); color: #fff; border-radius: 3px; padding: 0 .25rem; text-decoration: none; }
.pohyby h3 { margin: .2rem 0 .4rem; }
.pohyby .poh-det h3 { margin: .2rem 0 .4rem; }
.pohyby .poh-det h3 + .tablewrap, .pohyby .poh-det h3 + p { margin-bottom: 1rem; }
.poh-wrap { display: grid; grid-template-columns: minmax(210px, 1fr) 3fr; gap: 1rem; align-items: start; }
.poh-sum { background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: .8rem 1rem; position: sticky; top: .5rem; }
.poh-sum .label { color: var(--muted); font-size: .85rem; }
.poh-sum .label.sep { margin-top: .9rem; padding-top: .7rem; border-top: 1px solid var(--line); }
.poh-sum .value { font-size: 1.5rem; font-weight: 600; line-height: 1.25; white-space: nowrap; font-variant-numeric: tabular-nums; }
.poh-sum .value.pos { color: var(--ok); }
.poh-sum .value.neg { color: var(--bad); }
.poh-sum .ln { display: flex; justify-content: space-between; gap: .5rem; font-size: .85rem; border-top: 1px dashed var(--line); padding-top: .15rem; margin-top: .15rem; font-variant-numeric: tabular-nums; }
@media (max-width: 900px) { .poh-wrap { grid-template-columns: 1fr; } .poh-wrap > * { min-width: 0; } .poh-sum { position: static; } }
fieldset.pv { border: 1px solid var(--line); border-radius: 6px; padding: .5rem .8rem .7rem; margin: 0; }
fieldset.pv legend { font-size: .9rem; color: var(--muted); padding: 0 .3rem; }
.pv-typy { display: flex; flex-wrap: wrap; gap: .3rem 1.1rem; }

/* ---------- Půdorys jednotky ---------- */
.plan-card { margin-top: 1rem; }
.plans { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 420px), 1fr)); gap: 1rem; }
.plan { margin: .6rem 0 0; }
.plan-box { position: relative; width: 100%; background: #f7f9fb; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.plan-box img, .plan-box svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.plan-on { fill: #eb6834; fill-opacity: .78; stroke: #b5481c; stroke-width: 1.5; vector-effect: non-scaling-stroke; }
.plan-lbl { font-weight: 700; fill: #fff; stroke: #8a3512; stroke-width: 3px; paint-order: stroke; vector-effect: non-scaling-stroke; font-family: inherit; }
.plan figcaption { font-size: .85rem; margin-top: .3rem; }

/* ---------- Krátkodobé nájmy ---------- */
.kn-t { display: flex; gap: .8rem; align-items: end; flex-wrap: wrap; margin-bottom: .4rem; }
.kn-t label { display: flex; flex-direction: column; min-width: 10rem; }
.kn-t .del { margin-bottom: .45rem; }
.kn-quick { display: flex; gap: .3rem; align-items: center; margin: 0 0 .3rem; }
.kn-quick input { width: 8.5rem; padding: .2rem .35rem; font-size: .85rem; }
.kn-quick .btn { padding: .2rem .5rem; font-size: .8rem; }
.kn-act { white-space: nowrap; font-size: .85rem; }
.kn-tab td.kn-term { white-space: nowrap; }
.kn-quick input { width: 7.5rem; }
#knCalc { color: var(--muted); }
.kn-form fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
.kn-form .grid-form { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.kn-form .grid-form label, .kn-form .inline { min-width: 0; }
.kn-form .grid-form input, .kn-form .grid-form select { width: 100%; min-width: 0; box-sizing: border-box; }
.kn-form .inline select { flex: 0 0 7.5rem; width: 7.5rem; }
.kn-form .inline .btn { flex: 0 0 auto; }

/* ---------- Parking – krátkodobý (tržby z automatů) ---------- */
.ptbox { background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: .8rem 1rem; margin-bottom: 1rem; }
.dropzone { display: flex; flex-direction: column; align-items: center; gap: .35rem; text-align: center; padding: 1.1rem 1rem; border: 2px dashed var(--line); border-radius: 6px; background: var(--bg); transition: border-color .15s, background .15s; }
.dropzone.over, .dropzone:focus { border-color: var(--accent); background: var(--accent-soft); outline: 0; }
.pttab td.num, .pttab th.num { white-space: nowrap; }
.pttab tr.we td { background: #f7f8fa; }
.pttab tfoot td { font-weight: 600; }
svg.chart .ax.we { fill: var(--accent); font-weight: 600; }
tr.on td { background: var(--accent-soft); }
.ptprev .tiles { margin-bottom: .6rem; }

/* ---------- Akce – workflow (úkoly, časová osa, přílohy) ---------- */
.mbadge { display: inline-block; min-width: 1.25rem; padding: 0 .35rem; margin-left: .3rem; border-radius: 9px; font-size: .75rem; line-height: 1.25rem;
  text-align: center; font-weight: 700; background: rgba(255,255,255,.28); color: #fff; vertical-align: 1px; }
.mbadge.red { background: #d93025; color: #fff; }
nav.subnav .mbadge { background: var(--line); color: var(--ink); }
nav.subnav .mbadge.red { background: #d93025; color: #fff; }
header nav.mainnav a.alert-red { background: #b3261e; opacity: 1; }
header nav.mainnav a.alert-red:hover, header nav.mainnav a.alert-red.on { background: #c5221f; }
.akce-hlava { display: flex; flex-wrap: wrap; gap: .5rem 1.4rem; align-items: center; margin: -.2rem 0 1rem; color: var(--muted); }
.akce-hlava strong { color: var(--ink); }
.inline-form { display: inline-flex; gap: .35rem; align-items: center; margin: 0; flex-wrap: wrap; }
.inline-form select, .inline-form input { width: auto; }
.akce-hlava .inline-form { margin-left: auto; }
table.ukoly td { vertical-align: top; }
tr.ukol-novy td { background: var(--bad-soft); }
tr.ukol-novy td:first-child { box-shadow: inset 3px 0 0 #d93025; }
.ukol-kroky { white-space: nowrap; }
.ukol-kroky > * { margin: 0 .25rem .25rem 0; vertical-align: top; }
.ukol-kroky .btn, .ukol-kroky button { padding: .3rem .7rem; font-size: .88rem; }
details.ukol-det { display: inline-block; }
details.ukol-det > summary { list-style: none; cursor: pointer; }
details.ukol-det > summary::-webkit-details-marker { display: none; }
details.ukol-det[open] { display: block; white-space: normal; background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: .5rem; margin: .3rem 0; min-width: 300px; }
details.ukol-det[open] > summary { margin-bottom: .4rem; }
details.ukol-det form.stack { max-width: none; gap: .5rem; }
details.ukol-novy-form { margin-top: .7rem; }
details.ukol-novy-form > summary { cursor: pointer; color: var(--accent); }
form.komentar-form { max-width: none; margin-bottom: 1rem; }
.osa { display: grid; gap: .5rem; }
.osa-z { background: var(--panel); border: 1px solid var(--line); border-left: 3px solid var(--line); border-radius: 6px; padding: .5rem .8rem; }
.osa-z.osa-komentar { border-left-color: var(--accent); }
.osa-z.osa-ukol_novy, .osa-z.osa-ukol_delegace { border-left-color: #6250d6; }
.osa-z.osa-ukol_stav { border-left-color: var(--ok); }
.osa-z.osa-akce_stav, .osa-z.osa-akce_nova { border-left-color: var(--warn); }
.osa-z.osa-faktura { border-left-color: #d6a12a; background: #fffcf3; }
.osa-z.osa-akce_zmena, .osa-z.osa-priloha_smazana { color: var(--muted); font-size: .92rem; }
.osa-z.nove { box-shadow: 0 0 0 2px #f2b8b5; }
.osa-hl { font-size: .92rem; }
.osa-cas { color: var(--muted); margin-right: .5rem; font-variant-numeric: tabular-nums; }
.osa-text { margin-top: .3rem; white-space: normal; }
.pril { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .45rem; }
.pril-img { position: relative; margin: 0; width: 132px; height: 100px; border: 1px solid var(--line); border-radius: 4px; overflow: hidden; background: #f0f2f5; }
.pril-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pril-img .pril-plne { position: absolute; left: 4px; bottom: 4px; }
.pril-img .pril-del { position: absolute; right: 2px; top: 2px; }
.pril-img .pril-del button { background: rgba(255,255,255,.85); border-radius: 50%; padding: 0 .35rem; line-height: 1.4; }
.pril-soubor { display: flex; align-items: center; gap: .35rem; padding: .3rem .6rem; border: 1px solid var(--line); border-radius: 4px; background: #fafbfc; }
.pril-soubor .pril-del { display: inline; margin: 0; }
.akce-drop { position: relative; border: 2px dashed #b9c6d4; border-radius: 6px; padding: .7rem .9rem; color: var(--muted); background: #fafbfc; cursor: pointer; font-size: .92rem; }
.akce-drop.over { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.akce-drop input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
.akce-drop .drop-list { list-style: none; margin: .4rem 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: .35rem; }
.akce-drop .drop-list:empty { display: none; }
.akce-drop .drop-list li { position: relative; z-index: 1; background: #fff; border: 1px solid var(--line); border-radius: 4px; padding: .15rem .25rem .15rem .5rem; color: var(--ink); font-size: .85rem; display: flex; gap: .35rem; align-items: center; }
.akce-drop .drop-list li img { width: 34px; height: 34px; object-fit: cover; border-radius: 3px; }
.akce-drop .drop-list li button { background: none; color: var(--bad); padding: 0 .3rem; }
.akce-drop .drop-list li.chyba { border-color: var(--bad); color: var(--bad); }
.akce-upl .odesilam { color: var(--muted); font-size: .9rem; margin-left: .6rem; }
.tile.upoz { background: var(--bad-soft); border-color: #f2b8b5; }
.tile.upoz .value { color: var(--bad); }
fieldset.opr { border: 1px solid var(--line); border-radius: 6px; padding: .5rem .8rem; margin: 0; }
fieldset.opr legend { color: var(--muted); font-size: .9rem; padding: 0 .3rem; }
@media (max-width: 700px) {
  table.ukoly thead { display: none; }
  table.ukoly, table.ukoly tbody, table.ukoly tr, table.ukoly td { display: block; width: 100%; }
  table.ukoly tr { border-bottom: 1px solid var(--line); padding: .4rem 0; }
  table.ukoly td { border: 0; padding: .15rem .65rem; }
  .ukol-kroky { white-space: normal; }
  details.ukol-det[open] { min-width: 0; }
  .akce-hlava .inline-form { margin-left: 0; }
}

.udrzba { background: var(--bad); color: #fff; padding: .6rem .9rem; border-radius: 4px; font-weight: 600; margin: 0 0 .8rem; }

/* ---------- Testovací prostředí ---------- */
body.env-test header.top { background: repeating-linear-gradient(135deg, #7a3a06 0 18px, #8d4508 18px 36px); }
.env-badge { display: inline-block; margin-left: .5rem; padding: .05rem .5rem; border-radius: 3px; background: #ffb020; color: #3a1d00; font-weight: 800; font-size: .8rem; letter-spacing: .08em; }
.env-pruh { background: #fff1d6; color: #7a3a06; border: 2px solid #f0a020; padding: .5rem .8rem; border-radius: 4px; font-weight: 600; margin: 0 0 .8rem; }
.top .user a.env-prepni { font-size: .8rem; background: rgba(255,255,255,.15); padding: .1rem .45rem; border-radius: 3px; }
.env-volba { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-top: 1rem; }
.env-btn { display: flex; flex-direction: column; gap: .3rem; padding: 1.2rem; border-radius: 6px; border: 2px solid var(--line); text-decoration: none; }
.env-btn strong { font-size: 1.15rem; } .env-btn span { color: var(--muted); font-size: .85rem; }
.env-btn.ostra { border-color: var(--accent); } .env-btn.test { border-color: #f0a020; background: #fff8ea; }
.env-btn:hover { box-shadow: 0 2px 8px rgba(0,0,0,.12); }
@media (max-width: 600px) { .env-volba { grid-template-columns: 1fr; } }

/* ---------- Obraty nájemců ---------- */
.obr-bar { position: relative; min-width: 6.5rem; height: 1.25rem; background: #f1f3f6; border-radius: 3px; overflow: hidden; }
.obr-bar span { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 3px; }
.obr-bar span.ok { background: #8fd3a8; } .obr-bar span.warn { background: #f2cf7a; } .obr-bar span.bad { background: #ef9a92; }
.obr-bar b { position: relative; font-weight: 600; font-size: .8rem; padding-left: .4rem; line-height: 1.25rem; color: var(--ink); }
td.obr-ok { background: #e6f4ea; } td.obr-warn { background: #fff4e0; } td.obr-bad { background: #fdecea; }
.obr-grid input { width: 6.5rem; text-align: right; padding: .25rem .35rem; }
.obr-grid td, .obr-grid th { white-space: nowrap; }
.obr-legend span { display: inline-block; padding: .1rem .5rem; border-radius: 3px; margin-right: .3rem; font-size: .82rem; }
.obr-legend .ok { background: #8fd3a8; } .obr-legend .warn { background: #f2cf7a; } .obr-legend .bad { background: #ef9a92; }
svg.chart .ob-ok { fill: #4caf73; } svg.chart .ob-warn { fill: #e0a82e; } svg.chart .ob-bad { fill: #d6453a; } svg.chart .ob-na { fill: #b9c0ca; }
.obr-slozky { font-size: .8rem; color: var(--muted); white-space: normal; line-height: 1.35; }
td.num .obr-slozky { max-width: 15rem; margin-left: auto; }
.obr-tab td { vertical-align: top; }

/* ---------- Kontakty subjektů ---------- */
.kt-role { display: inline-block; font-size: .78rem; line-height: 1.3; padding: .05rem .45rem; margin: .05rem 0; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent); white-space: nowrap; }
.kt-role.off { background: transparent; color: var(--muted); border: 1px dashed var(--line); }
.kt-tab td { vertical-align: top; }
.kt-tab a.nowrap { white-space: nowrap; }
.kt-tab tr.kt-off td { opacity: .65; }
fieldset.kt-role-vyber { border: 1px solid var(--line); border-radius: 6px; padding: .5rem .8rem .7rem; margin: 0;
  display: flex; flex-wrap: wrap; gap: .3rem 1.2rem; }
fieldset.kt-role-vyber legend { font-size: .9rem; color: var(--muted); padding: 0 .3rem; }
fieldset.kt-role-vyber label.check { width: auto; }
form.kt-form { max-width: 760px; }
form.kt-form select, form.kt-form input { max-width: 100%; min-width: 0; }
form.kt-form label { min-width: 0; }
@media (max-width: 600px) { form.kt-form .row { grid-template-columns: 1fr; } }
.kt-filtr { flex-wrap: wrap; gap: .5rem; align-items: center; }
.kt-filtr select, .kt-filtr input[type=search] { width: auto; }
.kt-filtr label.check { display: inline-flex; align-items: center; gap: .35rem; margin: 0; }
.kt-filtr label.check input { width: auto; margin: 0; }
details.kt-maily { margin: 0 0 .8rem; }
.kt-zprava { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin: 0 0 .6rem; }
.kt-tab th.kt-chk, .kt-tab td.kt-chk { width: 1.6rem; padding-left: .5rem; padding-right: .2rem; text-align: center; }
.kt-tab .kt-chk input { width: auto; margin: 0; }
.kt-zprava .kt-n { display: inline-block; margin-left: .3rem; padding: 0 .4rem; border-radius: 999px; background: rgba(255,255,255,.25); font-size: .8rem; }
details.kt-maily summary { cursor: pointer; color: var(--accent); }
details.kt-maily textarea { width: 100%; font-size: .85rem; }
.kt-chybi { line-height: 1.8; }
.kt-role-tab input { width: auto; }
tr.kt-nova td { background: var(--accent-soft); }

/* ---------- Přehled – provozní (střediska) ---------- */
table.pv { min-width: 860px; }
table.pv th, table.pv td { vertical-align: top; }
table.pv thead th { font-weight: 600; line-height: 1.2; }
table.pv tbody th, table.pv tfoot th { text-align: left; font-size: 1.05rem; white-space: nowrap; }
table.pv td { padding: 0; }
table.pv td > .pv-v, table.pv td > .pv-s { padding: 0 .6rem; }
table.pv td > .pv-v { padding-top: .45rem; }
table.pv td > .pv-s { padding-bottom: .45rem; }
table.pv td { position: relative; }
a.pv-a { display: block; padding: .45rem .6rem; color: var(--ink); }
a.pv-a::before { content: ''; position: absolute; inset: 0; }   /* klikací celá buňka */
a.pv-a:hover { text-decoration: none; }
table.pv td:has(> a.pv-a:hover) { background: var(--accent-soft); }
table.pv .pv-ind { width: 20px; min-width: 20px; padding: 0; }
table.pv td.pv-ind.o100 { background: #1d6b3a; }
table.pv td.pv-ind.o80 { background: #8fd19e; }
table.pv td.pv-ind.o60 { background: #f2c94c; }
table.pv td.pv-ind.o0 { background: #d64541; }
.pv-v { display: block; font-size: 1.2rem; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.pv-v .of { font-size: .85rem; font-weight: 400; color: var(--muted); }
.pv-s { display: block; color: var(--muted); font-size: .82rem; line-height: 1.4; }
table.pv tfoot td, table.pv tfoot th { background: var(--accent-soft); border-top: 2px solid var(--line); }
table.pv tr.pv-nez th { color: var(--warn); }
.pv-volne { display: grid; grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr)); gap: .5rem 1rem; align-items: start; }
.pv-volne details { background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: .45rem .7rem; }
.pv-volne summary { cursor: pointer; }
.pv-volne table.mini { margin-top: .4rem; width: 100%; }
.stc-bar { margin: .4rem 0 .6rem; align-items: end; }
.stc-form { display: flex; flex-wrap: wrap; gap: .3rem; margin-top: .3rem; max-width: 100%; }
.stc-form select { min-width: 0; max-width: 100%; }

/* ---------- Nápověda ---------- */
.brand a.help-link { font-size: .72rem; font-weight: 600; padding: .05rem .55rem; border-radius: 999px; background: var(--help-bg, #f5b82e); color: var(--help-ink, #1d2330); text-decoration: none; vertical-align: middle; }
.brand a.help-link:hover, .brand a.help-link.on { background: var(--help-bg-hover, #ffd166); }
.help { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 2rem; align-items: start; }
.help-toc { position: sticky; top: 1rem; background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: .8rem 1rem; font-size: .9rem; max-height: calc(100vh - 2rem); overflow: auto; }
.help-toc ol { margin: .5rem 0 0; padding-left: 1.3rem; }
.help-toc li { margin: .25rem 0; }
.help-body { max-width: 860px; line-height: 1.55; }
.help-body h2 { margin-top: 2.2rem; padding-top: .6rem; border-top: 1px solid var(--line); scroll-margin-top: 1rem; }
.help-body h2 .hn { display: inline-block; min-width: 1.8rem; height: 1.8rem; line-height: 1.8rem; text-align: center; border-radius: 50%; background: var(--brand); color: #fff; font-size: .95rem; margin-right: .5rem; }
.help-body h3 { font-size: 1.02rem; margin: 1.2rem 0 .4rem; }
.help-body table.mini { margin: .5rem 0 1rem; width: 100%; }
.help-body table.mini td, .help-body table.mini th { vertical-align: top; }
.help-body li { margin: .2rem 0; }
@media (max-width: 900px) { .help { grid-template-columns: 1fr; } .help-toc { position: static; max-height: none; } }
@media (max-width: 480px) { .user { white-space: normal; text-align: right; } }

/* ---------- Energie ---------- */
.en-h3 { font-size: 1rem; margin: 1rem 0 .5rem; font-weight: 600; }
.en-drop { position: relative; display: grid; place-items: center; text-align: center; border: 2px dashed #b9c6d4; border-radius: 8px;
  background: #f8fafc; color: var(--ink); padding: 1.2rem; cursor: pointer; transition: background .15s, border-color .15s; }
.en-drop input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
.en-drop.over { background: var(--accent-soft); border-color: var(--accent); }
.en-drop-big { min-height: 9rem; }
.en-pdfcard p { margin: 0 0 .6rem; }
/* formulář: náhled PDF vlevo (svisle, sticky), pole vpravo – od 1100 px vedle sebe, jinak pod sebou */
body:has(.en-split) main { max-width: 1900px; }
.en-split { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1rem; align-items: start; }   /* minmax: na mobilu nepřetéká název PDF */
.en-preview { display: flex; flex-direction: column; gap: .5rem; }
.en-pbar { display: flex; justify-content: space-between; align-items: center; gap: .5rem; min-height: 1.6rem; }
.en-preview { min-width: 0; }
.en-pbar .en-pname { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.en-pbar .actions { flex-shrink: 0; }
.en-frame { display: none; width: 100%; height: 75vh; border: 1px solid var(--line); border-radius: 6px; background: #fff; }
.en-drop-big { min-height: 12rem; }
.en-split.has-pdf .en-frame { display: block; }
.en-split.has-pdf .en-drop-big { display: none; }
.en-split.hide-pdf .en-frame, .en-split.hide-pdf .en-drop-big { display: none; }
.en-split .grid-form { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
.en-split .grid-form label, .en-split .inline { min-width: 0; }
.en-split .grid-form input, .en-split .grid-form select { width: 100%; min-width: 0; }
.en-split .inline select { flex: 0 0 5.2rem; width: 5.2rem; }
table.items .p-mn, table.items .p-cena, table.items .p-zak, table.items .p-dph { text-align: right; }
table.items td:nth-child(2) input { min-width: 150px; }
#ensum.bad { color: var(--bad); font-weight: 600; }
#ensum.ok { color: var(--ok); }
@media (min-width: 1100px) {
  .en-split { grid-template-columns: minmax(0, 46fr) minmax(0, 54fr); }
  .en-split.hide-pdf { grid-template-columns: minmax(0, 12rem) minmax(0, 1fr); }
  .en-preview { position: sticky; top: .5rem; height: calc(100vh - 1rem); }
  .en-frame, .en-drop-big { flex: 1; height: auto; min-height: 0; }
  .en-split.hide-pdf .en-pbar { flex-direction: column; align-items: flex-start; }
  .en-split.hide-pdf .en-pbar .en-pname { flex: none; width: 100%; white-space: normal; overflow-wrap: anywhere; font-size: .82rem; }
}
