:root {
  --ink: #1d2433;
  --muted: #667085;
  --bg: #faf7f2;
  --surface: #ffffff;
  --line: #e6e0d6;
  --brand: #1f3a5f;
  --accent: #d9822b;
  --ok: #2f9e5b;
  --err: #c0392b;
  --radius: 10px;
  --header-h: 60px;
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.5;
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; display: flex; flex-direction: column; }
main { flex: 1; }
a { color: var(--brand); }
img { max-width: 100%; display: block; }
h1, h2, h3 { line-height: 1.2; }

/* ---------- Hlavička a patička ---------- */

.site-header {
  height: var(--header-h);
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: 0 1.25rem;
  background: var(--brand);
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 10;
}
.brand { display: flex; align-items: center; gap: 0.5rem; color: #fff; text-decoration: none; font-weight: 700; font-size: 1.1rem; }
.site-nav { display: flex; gap: 1rem; flex: 1; overflow-x: auto; }
.site-nav a { color: #dfe7f1; text-decoration: none; white-space: nowrap; }
.site-nav a.active, .site-nav a:hover { color: #fff; text-decoration: underline; text-underline-offset: 4px; }
.site-footer { padding: 1.5rem; font-size: 0.85rem; color: var(--muted); border-top: 1px solid var(--line); text-align: center; }
.site-footer p { margin: 0.25rem 0; }
.map-page .site-footer { display: none; }

@media (max-width: 760px) {
  .site-header { gap: 0.75rem; padding: 0 0.75rem; }
  .brand span { display: none; }
  .site-header .btn { padding: 0.4rem 0.6rem; font-size: 0.85rem; }
}

/* ---------- Základní prvky ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.55rem 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}
.btn:hover { border-color: var(--brand); }
.btn:disabled { opacity: 0.6; cursor: wait; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: #c4721f; border-color: #c4721f; }
.btn-danger { color: var(--err); border-color: var(--err); }
.btn-sm { padding: 0.3rem 0.65rem; font-size: 0.85rem; }
.btn-lg { padding: 0.8rem 1.6rem; font-size: 1.05rem; }
.btn-block { width: 100%; }

.badge {
  display: inline-block;
  padding: 0.1rem 0.55rem;
  border-radius: 999px;
  background: color-mix(in srgb, var(--c) 15%, white);
  color: color-mix(in srgb, var(--c) 70%, black);
  border: 1px solid color-mix(in srgb, var(--c) 40%, white);
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
}
.dot { display: inline-block; width: 0.75rem; height: 0.75rem; border-radius: 50%; background: var(--c); border: 2px solid #fff; box-shadow: 0 0 0 1px var(--line); }
.muted { color: var(--muted); }
.lead { font-size: 1.1rem; }
.note { background: var(--surface); border-left: 3px solid var(--accent); padding: 0.5rem 0.75rem; white-space: pre-line; }
.alert { background: #fff4e5; border: 1px solid #f3c78b; border-radius: var(--radius); padding: 0.75rem 1rem; margin: 0.75rem 0; }
.alert ul { margin: 0.4rem 0; }
.tags { display: flex; flex-wrap: wrap; gap: 0.35rem; list-style: none; padding: 0; }
.tags li { background: #eef2f7; border-radius: 6px; padding: 0.15rem 0.55rem; font-size: 0.85rem; }
ul.plain { list-style: none; padding: 0; }

/* ---------- Formuláře ---------- */

label { display: block; margin: 0.6rem 0; font-weight: 600; font-size: 0.92rem; }
input:not([type='checkbox'], [type='range'], [type='file']), select, textarea {
  display: block;
  width: 100%;
  margin-top: 0.25rem;
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  font: inherit;
  font-weight: 400;
  background: var(--surface);
}
input:focus, select:focus, textarea:focus { outline: 2px solid color-mix(in srgb, var(--brand) 40%, white); border-color: var(--brand); }
label.check { display: flex; align-items: center; gap: 0.45rem; font-weight: 400; }
label.check input { flex: none; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: 0.5rem 0.9rem; margin: 0.75rem 0; }
legend { font-weight: 600; font-size: 0.92rem; padding: 0 0.3rem; }
fieldset.mods { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 0 1rem; }
fieldset.mods label { margin: 0.3rem 0; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }
.form-msg { min-height: 1.5em; margin: 0.5rem 0 0; font-weight: 600; }
.form-msg.ok { color: var(--ok); }
.form-msg.err { color: var(--err); }
.photo-slots { display: grid; gap: 0.5rem; margin: 0.5rem 0; }
.photo-row { display: grid; grid-template-columns: 2fr 1.3fr 0.7fr 2fr; gap: 0.5rem; align-items: center; padding: 0.5rem; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; }
.photo-row input, .photo-row select { margin: 0 !important; }
@media (max-width: 760px) { .photo-row { grid-template-columns: 1fr 1fr; } .photo-row input[type='file'] { grid-column: 1 / -1; } }
.photo-slots > .btn { justify-self: start; }

/* ---------- Stránka s mapou ---------- */

.map-layout { display: grid; grid-template-columns: 320px 1fr; height: calc(100vh - var(--header-h)); }
.map-panel { padding: 1rem 1.25rem; overflow-y: auto; border-right: 1px solid var(--line); background: var(--surface); }
.map-panel h1 { font-size: 1.4rem; margin: 0.2rem 0 0.4rem; }
.map-panel .lead { font-size: 0.95rem; }
.filters fieldset label { margin: 0.25rem 0; }
.map { width: 100%; height: 100%; }
@media (max-width: 760px) {
  .map-layout { grid-template-columns: 1fr; grid-template-rows: auto 1fr; height: auto; }
  .map-panel { border-right: 0; border-bottom: 1px solid var(--line); }
  .map-panel .filters fieldset { display: grid; grid-template-columns: 1fr 1fr; }
  .map { height: 70vh; }
}
.popup { display: grid; gap: 0.35rem; color: var(--ink); text-decoration: none; }
.popup img { border-radius: 6px; aspect-ratio: 4 / 3; object-fit: cover; }
.popup-more { color: var(--brand); font-weight: 600; }

/* ---------- Obsahové stránky ---------- */

.page { max-width: 1200px; margin: 0 auto; padding: 1.5rem 1.25rem 3rem; }
.page.narrow { max-width: 760px; }
.prose p, .prose li { font-size: 1.05rem; }
.crumbs { color: var(--muted); font-size: 0.9rem; margin: 0; }
.columns { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1rem 2rem; }

.house h1 { margin: 0.3rem 0; }
.house .meta { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: center; color: var(--muted); }
.house-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 2rem; margin-top: 1rem; }
@media (max-width: 900px) { .house-grid { grid-template-columns: 1fr; } }
.facts { display: grid; grid-template-columns: auto 1fr; gap: 0.3rem 1rem; margin: 0 0 1rem; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; font-weight: 600; }
.mini-map { height: 220px; border-radius: var(--radius); overflow: hidden; margin: 1rem 0; border: 1px solid var(--line); }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 0.6rem 0.9rem; margin: 0.75rem 0; }
.panel summary { cursor: pointer; font-weight: 600; }
.confirm { margin: 1rem 0; }
.confirm .count { background: #eef2f7; border-radius: 999px; padding: 0 0.5rem; }
.history { padding-left: 1.1rem; font-size: 0.9rem; }
.history time { color: var(--muted); }

.streetview { margin-bottom: 1.5rem; }
.sv-frame { position: relative; aspect-ratio: 16 / 10; background: #dfe3ea; border-radius: var(--radius); overflow: hidden; }
.sv-frame img { position: absolute; inset: 0; z-index: 1; width: 100%; height: 100%; object-fit: cover; }
.sv-frame iframe { width: 100%; height: 100%; border: 0; }
.sv-interactive { position: absolute; right: 0.75rem; bottom: 0.75rem; }
.sv-placeholder { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); padding: 1rem; text-align: center; }
/* Zástupný text je pod obrázkem; když se panorama nenačte, obrázek schováme. */
.pano-missing img { display: none; }
.streetview .pano-missing { aspect-ratio: 16 / 5; }
.sv-links { font-size: 0.9rem; }
.sv-preview { position: relative; max-width: 640px; }
.sv-preview img { border-radius: var(--radius); }
.sv-controls { position: absolute; bottom: 0.6rem; left: 0; right: 0; display: flex; justify-content: center; gap: 0.35rem; }

.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 0.75rem; }
.gallery figure { margin: 0; }
.gallery img { aspect-ratio: 4 / 3; object-fit: cover; border-radius: 8px; }
.gallery figcaption { font-size: 0.85rem; margin-top: 0.25rem; }

/* Porovnání před a po */
.compare { position: relative; margin: 0 0 1.5rem; border-radius: var(--radius); overflow: hidden; aspect-ratio: 4 / 3; background: #ddd; }
.compare img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.compare-before { clip-path: inset(0 calc(100% - var(--pos)) 0 0); }
.compare::after { content: ''; position: absolute; top: 0; bottom: 0; left: var(--pos); width: 3px; background: #fff; transform: translateX(-50%); pointer-events: none; }
.compare input[type='range'] { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: ew-resize; margin: 0; }
.compare figcaption { position: absolute; top: 0.5rem; left: 0.5rem; right: 0.5rem; display: flex; justify-content: space-between; pointer-events: none; }
.compare figcaption span { background: rgb(0 0 0 / 0.55); color: #fff; border-radius: 6px; padding: 0.1rem 0.5rem; font-size: 0.85rem; }
.transformations { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 1.5rem; }
.transformations .compare { margin-bottom: 0.5rem; }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 1rem; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; color: var(--ink); text-decoration: none; }
.card:hover { border-color: var(--brand); }
.card-img { position: relative; aspect-ratio: 400 / 260; background: #eef0f3; }
.card-img img { position: absolute; inset: 0; z-index: 1; width: 100%; height: 100%; object-fit: cover; }
.card-noimg { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); }
.card-body { padding: 0.6rem 0.75rem; display: grid; gap: 0.35rem; justify-items: start; }

/* Přidání domu */
.add .step { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 0.5rem 1.25rem 1rem; margin: 1rem 0; }
.add h2 { font-size: 1.15rem; }
.add-map { height: 55vh; min-height: 360px; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); }
.geosearch { position: relative; margin-bottom: 0.75rem; }
.suggestions { position: absolute; z-index: 5; left: 0; right: 0; margin: 0.25rem 0 0; padding: 0.25rem; list-style: none; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 8px 24px rgb(0 0 0 / 0.12); }
.suggestions button { width: 100%; text-align: left; padding: 0.45rem 0.6rem; border: 0; background: none; font: inherit; cursor: pointer; border-radius: 6px; }
.suggestions button:hover { background: #eef2f7; }

/* Statistiky */
.tiles { display: flex; flex-wrap: wrap; gap: 1rem; margin-bottom: 1.5rem; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.5rem; display: grid; min-width: 180px; }
.tile-value { font-size: 2rem; font-weight: 700; color: var(--brand); }
.tile-label { color: var(--muted); }
.bars h2 { font-size: 1.1rem; }
.bar-row { display: grid; grid-template-columns: 11rem 1fr 2.5rem; gap: 0.6rem; align-items: center; margin: 0.35rem 0; font-size: 0.9rem; }
.bar-track { background: #eef0f3; border-radius: 4px; height: 0.8rem; }
.bar { display: block; height: 100%; border-radius: 4px; background: var(--c, var(--brand)); }
.bar-value { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }

/* Moderace */
.admin-nav { display: flex; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.mod-item { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 0.75rem 1rem; margin: 0.75rem 0; }
.mod-item header { display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: center; }
.mod-photos { display: flex; flex-wrap: wrap; gap: 0.75rem; }
.mod-photos figure { margin: 0; width: 220px; }
.mod-photos img { aspect-ratio: 4 / 3; object-fit: cover; border-radius: 6px; }
.actions { display: flex; gap: 0.5rem; margin-top: 0.75rem; }
form.inline { display: inline; }
.diff { border-collapse: collapse; margin: 0.5rem 0; font-size: 0.9rem; }
.diff th, .diff td { padding: 0.25rem 0.6rem; border-bottom: 1px solid var(--line); text-align: left; }
.diff .from { color: var(--err); text-decoration: line-through; }
.diff .to { color: var(--ok); font-weight: 600; }

.small { font-size: 0.85rem; }
.picked { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 1.5rem; margin: 1.25rem 0; padding: 1.25rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.picked[hidden] { display: none; }
.picked.no-pano { grid-template-columns: 1fr; max-width: 640px; }
.picked-pano { align-self: start; }
.picked h2 { margin: 0 0 0.25rem; font-size: 1.3rem; }
@media (max-width: 860px) { .picked { grid-template-columns: 1fr; } }
.chips { border: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.5rem; }
.chips legend { margin-bottom: 0.4rem; padding: 0; }
.chips label { margin: 0; font-weight: 500; }
.chips input { position: absolute; opacity: 0; pointer-events: none; }
.chips span { display: inline-block; padding: 0.4rem 0.85rem; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); cursor: pointer; }
.chips input:checked + span { background: var(--brand); border-color: var(--brand); color: #fff; }
.chips input:focus-visible + span { outline: 2px solid var(--accent); }

/* Barvy fasád */
.swatches { border: 0; padding: 0; margin: 1rem 0; }
.swatches legend { padding: 0; margin-bottom: 0.3rem; }
.swatch-list { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.swatch-list label { margin: 0; cursor: pointer; }
.swatch-list input { position: absolute; opacity: 0; pointer-events: none; }
.swatch { display: inline-block; width: 1.9rem; height: 1.9rem; border-radius: 50%; background: var(--c); border: 1px solid rgb(0 0 0 / 0.2); vertical-align: middle; }
.swatch-none { display: inline-grid; place-items: center; background: #fff; color: var(--muted); font-weight: 700; }
.swatch-list input:checked + .swatch { outline: 3px solid var(--brand); outline-offset: 2px; }
.swatch-list input:focus-visible + .swatch { outline: 3px solid var(--accent); outline-offset: 2px; }
.swatch-label { margin: 0.35rem 0 0; font-weight: 600; }
.facade-swatch .swatch { width: 1rem; height: 1rem; }
.can-pick img { cursor: crosshair; }
.pick-marker { position: absolute; z-index: 2; width: 22px; height: 22px; margin: -11px 0 0 -11px; border-radius: 50%; background: var(--c); border: 3px solid #fff; box-shadow: 0 0 0 1px rgb(0 0 0 / 0.5), 0 2px 6px rgb(0 0 0 / 0.4); pointer-events: none; }
