
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: linear-gradient(135deg, #f0f4f8 0%, #d9e2ec 100%);
  color: #243b53; min-height: 100vh; padding: 20px;
}
.container { max-width: 1400px; margin: 0 auto; }
.hdr { text-align: center; margin-bottom: 30px; position: relative; }
.hdr h1 { font-size: 2.2em; color: #102a43; margin-bottom: 8px; }
.subtitle { color: #486581; font-size: 1.05em; }
.hdr-actions {
  position: absolute; top: 0; right: 0; display: flex; gap: 10px; align-items: center;
}
.admin-link {
  background: #334e68; color: white; padding: 8px 16px;
  border-radius: 6px; text-decoration: none; font-size: 0.9em;
}
.admin-link:hover { background: #243b53; }
.mode-toggle {
  display: flex; align-items: center; gap: 8px; background: white;
  padding: 7px 12px; border-radius: 6px; font-size: 0.85em;
  box-shadow: 0 1px 4px rgba(16,42,67,0.1); cursor: pointer; user-select: none;
}
.mode-toggle input { width: 16px; height: 16px; cursor: pointer; }
.layout { display: grid; grid-template-columns: 1fr 420px; gap: 24px; }
@media (max-width: 1000px) {
  .layout { grid-template-columns: 1fr; }
  .hdr-actions { position: static; justify-content: center; margin-top: 10px; }
}

.card {
  background: white; border-radius: 12px; padding: 22px;
  margin-bottom: 18px; box-shadow: 0 2px 8px rgba(16,42,67,0.08);
}
.card h2 {
  font-size: 1.15em; margin-bottom: 14px; color: #102a43;
  display: flex; align-items: center; gap: 10px;
}
.step {
  display: inline-flex; align-items: center; justify-content: center;
  background: #2563eb; color: white; width: 28px; height: 28px;
  border-radius: 50%; font-size: 0.9em; font-weight: bold; flex-shrink: 0;
}
.opts { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
.opt {
  border: 2px solid #d9e2ec; border-radius: 8px; padding: 12px;
  cursor: pointer; text-align: center; transition: all 0.2s; background: white;
}
.opt:hover { border-color: #829ab1; }
.opt.active {
  border-color: #2563eb; background: #eff6ff;
  box-shadow: 0 0 0 3px rgba(37,99,235,0.15);
}
.opt .opt-code {
  display: inline-block; background: #334e68; color: white;
  font-weight: bold; width: 26px; height: 26px; line-height: 26px;
  border-radius: 50%; margin-bottom: 6px; font-size: 0.85em;
}
.opt.active .opt-code { background: #2563eb; }
.opt .opt-name { font-weight: 600; font-size: 0.95em; }
.opt .opt-price { color: #2563eb; font-size: 0.85em; margin-top: 4px; }
.opt .opt-desc { color: #627d98; font-size: 0.78em; margin-top: 4px; }
.opts-barva { grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); }
.opt-color-box {
  width: 100%; height: 36px; border-radius: 6px;
  margin-bottom: 6px; border: 1px solid rgba(0,0,0,0.1);
}
.tabs { display: flex; gap: 6px; margin-bottom: 14px; border-bottom: 2px solid #d9e2ec; flex-wrap: wrap; }
.tab {
  background: none; border: none; padding: 10px 16px; cursor: pointer;
  font-size: 0.95em; color: #627d98; border-bottom: 3px solid transparent;
  margin-bottom: -2px; transition: all 0.2s;
}
.tab.active { color: #2563eb; border-bottom-color: #2563eb; font-weight: 600; }
.tab-content.hidden { display: none; }
input[type="number"], input[type="text"] {
  width: 100%; padding: 10px 12px; border: 2px solid #d9e2ec;
  border-radius: 6px; font-size: 1em; transition: border-color 0.2s;
}
input[type="number"]:focus, input[type="text"]:focus { outline: none; border-color: #2563eb; }
label { display: block; margin-bottom: 6px; font-weight: 500; color: #334e68; font-size: 0.92em; }
.hint { color: #627d98; font-size: 0.85em; margin-top: 6px; }
.check { display: flex; align-items: center; gap: 10px; cursor: pointer; margin-bottom: 10px; }
.check input { width: 18px; height: 18px; cursor: pointer; }
.check span { font-weight: 500; }
#svah-detail.hidden { display: none; }

.draw-toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; flex-wrap: wrap; }
.draw-toolbar button {
  background: #f0f4f8; border: 1px solid #d9e2ec; padding: 6px 12px;
  border-radius: 5px; cursor: pointer; font-size: 0.9em;
}
.draw-toolbar button:hover { background: #d9e2ec; }
.draw-toolbar button.mode-btn.active {
  background: #2563eb; color: white; border-color: #2563eb; font-weight: 600;
}
.draw-toolbar button.mode-btn.active.delete { background: #dc2626; border-color: #dc2626; }
.map-mode-hint { font-size: 0.85em; color: #2563eb; margin-bottom: 8px; min-height: 1.2em; }

/* Otazník s vysvětlivkou */
.qmark {
  display: inline-flex; align-items: center; justify-content: center;
  width: 17px; height: 17px; border-radius: 50%; background: #d9e2ec;
  color: #334e68; font-size: 0.75em; font-weight: 700; cursor: help;
  position: relative; margin-left: 4px; vertical-align: middle;
}
.qmark::after {
  content: attr(data-tip);
  position: absolute; bottom: 130%; left: 50%; transform: translateX(-50%);
  background: #102a43; color: white; padding: 10px 12px; border-radius: 8px;
  width: 260px; font-size: 0.85rem; font-weight: 400; line-height: 1.4;
  opacity: 0; pointer-events: none; transition: opacity 0.15s; z-index: 50;
  text-align: left; white-space: normal;
}
.qmark:hover::after, .qmark:focus::after { opacity: 1; }

/* Ceník – dialogové okno */
.cenik-btn {
  background: #eab308; color: #102a43; padding: 8px 16px; border: none;
  border-radius: 6px; font-size: 0.9em; font-weight: 600; cursor: pointer;
}
.cenik-btn:hover { background: #ca8a04; }
.modal-overlay {
  position: fixed; inset: 0; background: rgba(16,42,67,0.55);
  display: none; align-items: flex-start; justify-content: center;
  z-index: 1000; padding: 30px 15px; overflow-y: auto;
}
.modal-overlay.open { display: flex; }
.modal {
  background: white; border-radius: 12px; max-width: 780px; width: 100%;
  padding: 26px; position: relative; box-shadow: 0 10px 40px rgba(0,0,0,0.25);
}
.modal h2 { color: #102a43; margin-bottom: 6px; }
.modal h3 { color: #334e68; font-size: 1em; margin: 18px 0 8px; }
.modal-close {
  position: absolute; top: 14px; right: 14px; background: #f0f4f8;
  border: none; width: 34px; height: 34px; border-radius: 50%;
  font-size: 1.2em; cursor: pointer; color: #334e68;
}
.modal-close:hover { background: #fee2e2; color: #b91c1c; }
.cenik-table { width: 100%; border-collapse: collapse; font-size: 0.88em; }
.cenik-table th, .cenik-table td { padding: 7px 8px; border-bottom: 1px solid #e5edf5; text-align: left; }
.cenik-table th { background: #f0f4f8; color: #334e68; font-size: 0.85em; }
.cenik-table .num { text-align: right; }
.cenik-note { font-size: 0.82em; color: #627d98; margin-top: 14px; }
.draw-info { color: #486581; font-size: 0.9em; margin-left: auto; }
#canvas {
  width: 100%; max-width: 600px; background: #f8fafc;
  border: 2px dashed #bcccdc; border-radius: 6px;
  cursor: crosshair; display: block;
}
.scale-row { margin-top: 8px; display: flex; align-items: center; gap: 8px; }
.scale-row input { width: 100px; }
.scale-row label { margin: 0; }

/* --- Mapy --- */
.map-box {
  width: 100%; height: 380px; border-radius: 8px;
  border: 2px solid #d9e2ec; z-index: 0;
}
.addr-row { display: flex; gap: 8px; margin-bottom: 10px; }
.addr-row input { flex: 1; }
.addr-row button {
  background: #2563eb; color: white; border: none; padding: 10px 16px;
  border-radius: 6px; cursor: pointer; font-size: 0.95em; white-space: nowrap;
}
.addr-row button:hover { background: #1e40af; }
.addr-results { margin-bottom: 10px; }
.addr-results .addr-item {
  padding: 8px 12px; background: #f8fafc; border: 1px solid #d9e2ec;
  border-radius: 6px; margin-bottom: 5px; cursor: pointer; font-size: 0.88em;
}
.addr-results .addr-item:hover { background: #eff6ff; border-color: #93c5fd; }
.doprava-info {
  display: flex; gap: 16px; flex-wrap: wrap; margin-top: 10px;
  background: #f0f9ff; border: 1px solid #bae6fd; border-radius: 8px; padding: 12px;
}
.doprava-info .di { font-size: 0.9em; color: #486581; }
.doprava-info .di strong { display: block; font-size: 1.2em; color: #102a43; }
.map-stats { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 10px; }
.map-stats .ms {
  background: #f0f9ff; border: 1px solid #bae6fd; border-radius: 8px;
  padding: 10px 14px; font-size: 0.88em; color: #486581;
}
.map-stats .ms strong { display: block; font-size: 1.15em; color: #102a43; }

.branka-row {
  display: grid; grid-template-columns: 1fr 100px 100px 40px; gap: 8px;
  align-items: center; margin-bottom: 8px; padding: 10px;
  background: #f8fafc; border-radius: 6px;
}
.branka-row select {
  padding: 8px; border: 1px solid #d9e2ec; border-radius: 5px;
  background: white; font-size: 0.9em;
}
.branka-row .pocet { text-align: center; }
.branka-row .cena { text-align: right; font-weight: 600; color: #2563eb; font-size: 0.9em; }
.btn-remove {
  background: #fee2e2; border: none; color: #b91c1c;
  width: 32px; height: 32px; border-radius: 50%; cursor: pointer; font-size: 1.1em;
}
.btn-remove:hover { background: #fecaca; }
.btn-add {
  background: #eff6ff; border: 2px dashed #93c5fd; color: #2563eb;
  padding: 10px; border-radius: 6px; cursor: pointer; width: 100%;
  font-size: 0.95em; font-weight: 500; margin-top: 8px;
}
.btn-add:hover { background: #dbeafe; }

/* --- Průvodce po krocích --- */
body.wizard .form-col .card { display: none; }
body.wizard .form-col .card.wizard-active { display: block; }
.wizard-nav { display: none; }
body.wizard .wizard-nav {
  display: flex; justify-content: space-between; align-items: center;
  gap: 10px; margin-bottom: 18px;
}
.wizard-nav button {
  background: #2563eb; color: white; border: none; padding: 11px 22px;
  border-radius: 6px; cursor: pointer; font-size: 0.95em; font-weight: 600;
}
.wizard-nav button:disabled { background: #bcccdc; cursor: not-allowed; }
.wizard-nav button.secondary { background: #f0f4f8; color: #334e68; border: 1px solid #d9e2ec; }
.wizard-progress { flex: 1; text-align: center; color: #486581; font-size: 0.9em; font-weight: 500; }
.wizard-dots { display: flex; gap: 6px; justify-content: center; margin-top: 6px; }
.wizard-dots i {
  width: 9px; height: 9px; border-radius: 50%; background: #d9e2ec; display: block;
}
.wizard-dots i.done { background: #93c5fd; }
.wizard-dots i.now { background: #2563eb; }

.result-sticky { position: sticky; top: 20px; }
#result-detail { margin-bottom: 16px; }
.result-row {
  display: flex; justify-content: space-between; padding: 8px 0;
  border-bottom: 1px dashed #d9e2ec; font-size: 0.95em;
}
.result-row:last-child { border-bottom: none; }
.result-row .label { color: #486581; }
.result-row .val { font-weight: 600; color: #102a43; }
.result-row.sub { font-size: 0.85em; padding: 4px 0 4px 16px; color: #627d98; }
.result-row.sub .val { color: #486581; font-weight: 500; }
.total {
  background: linear-gradient(135deg, #2563eb 0%, #1e40af 100%);
  color: white; padding: 16px 20px; border-radius: 8px;
  display: flex; justify-content: space-between; align-items: center; margin: 16px 0;
}
.total span { font-size: 1em; }
.total strong { font-size: 1.6em; }
.btn-primary {
  background: #102a43; color: white; border: none; padding: 12px;
  border-radius: 6px; width: 100%; cursor: pointer; font-size: 1em; font-weight: 600;
}
.btn-primary:hover { background: #243b53; }
.btn-send {
  background: #16a34a; margin-top: 8px;
}
.btn-send:hover { background: #15803d; }
.saved-badge {
  text-align: center; font-size: 0.78em; color: #16a34a; margin-top: 8px;
  opacity: 0; transition: opacity 0.3s;
}
.saved-badge.show { opacity: 1; }

.material-table { width: 100%; border-collapse: collapse; font-size: 0.9em; margin-top: 8px; }
.material-table th, .material-table td {
  padding: 8px 6px; text-align: left; border-bottom: 1px solid #e5edf5;
}
.material-table th {
  background: #f0f4f8; font-weight: 600; color: #334e68; font-size: 0.85em;
}
.material-table .num { text-align: right; }
.material-table tfoot td {
  font-weight: 700; color: #102a43; background: #f8fafc;
  border-top: 2px solid #334e68; border-bottom: none;
}
.material-note {
  margin-top: 10px; background: #fef9c3; padding: 10px;
  border-radius: 6px; border-left: 3px solid #eab308;
}
body.hide-material-ceny .col-cena, body.hide-material-ceny .row-total-material { display: none; }
@media print {
  body { background: white; padding: 0; }
  .form-col, .hdr-actions, .btn-primary, .wizard-nav { display: none !important; }
  .layout { grid-template-columns: 1fr; }
  .result-sticky { position: static; }
  .card { box-shadow: none; border: 1px solid #ddd; }
}
/* ============================================================
   Doplňky pro dynamické sekce (v2)
   ============================================================ */
.sekce-karta.podminka-skryta { display: none !important; }
body.wizard .form-col .sekce-karta { display: none; }
body.wizard .form-col .sekce-karta.wizard-active { display: block; }
body.wizard .form-col .sekce-karta.podminka-skryta { display: none !important; }
.opakovac-rows:empty + .btn-add { margin-top: 0; }
.result-row .label span { font-weight: 400; }

/* ============================================================
   Dlaždice s obrázkem, nadpisem a bublinou (v2)
   ============================================================ */
.opt { position: relative; }

.opt-kicker {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: #16a34a;
  margin-bottom: 2px;
}

.opt-img {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  margin-bottom: 8px;
  border-radius: 8px;
  overflow: hidden;
  background: #f1f5f9;
}
.opt-img img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: opacity .18s ease;
}
.opt-img img.hover { opacity: 0; }
.opt:hover .opt-img img.hover { opacity: 1; }
.opt.opt-foto { padding-top: 10px; }

/* ikonka „?" s dlouhým popisem */
.opt-info {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 20px;
  height: 20px;
  padding: 0;
  border: 1px solid #cbd5e1;
  border-radius: 50%;
  background: #fff;
  color: #64748b;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  cursor: help;
  z-index: 2;
}
.opt-info:hover { background: #0f172a; border-color: #0f172a; color: #fff; }
.opt-info.inline {
  position: static;
  vertical-align: middle;
  margin-left: 6px;
}

.opt-bublina {
  position: absolute;
  top: 30px;
  right: 6px;
  z-index: 20;
  width: 230px;
  max-width: 78vw;
  padding: 10px 12px;
  border-radius: 8px;
  background: #0f172a;
  color: #f8fafc;
  font-size: 12.5px;
  font-weight: 400;
  line-height: 1.5;
  text-align: left;
  white-space: pre-line;
  box-shadow: 0 8px 24px rgba(15, 23, 42, .28);
}
.opt-info.inline + .opt-bublina { top: auto; right: auto; margin-top: 6px; }

@media print {
  .opt-info, .opt-bublina { display: none !important; }
}

/* ============================================================
   Kontaktní sekce
   ============================================================ */
.kontakt-pole {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}
.kontakt-radek.siroky { grid-column: 1 / -1; }
.kontakt-radek label {
  display: block;
  margin-bottom: 5px;
  font-size: 13px;
  font-weight: 600;
  color: #334155;
}
.kontakt-radek .povinne { color: #dc2626; }
.kontakt-radek input,
.kontakt-radek textarea {
  width: 100%;
  padding: 10px 12px;
  font: inherit;
  color: #0f172a;
  background: #fff;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
}
.kontakt-radek input:focus,
.kontakt-radek textarea:focus {
  outline: none;
  border-color: #16a34a;
  box-shadow: 0 0 0 3px rgba(22, 163, 74, .15);
}
.kontakt-radek input:invalid:not(:placeholder-shown) { border-color: #f87171; }
.kontakt-souhlas { margin-top: 14px; }

/* Past na roboty. Musí zůstat ve stránce, jen ji člověk nesmí vidět –
   proto ne display:none, na to jsou roboti zvyklí. */
.past-na-roboty {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* Když se nepodaří stáhnout ceník */
.chyba-nacteni h2 { color: #b91c1c; }
.chyba-nacteni code {
  padding: 1px 5px;
  border-radius: 4px;
  background: #f1f5f9;
  font-size: 0.92em;
}

/* Krok, na který se skočilo přes ?krok= (jen v režimu „všechno naráz") */
.sekce-karta.krok-zvyrazneny {
  animation: krok-blik 2s ease-out;
}
@keyframes krok-blik {
  0%   { box-shadow: 0 0 0 3px rgba(22, 163, 74, .55); }
  70%  { box-shadow: 0 0 0 3px rgba(22, 163, 74, .35); }
  100% { box-shadow: 0 0 0 3px rgba(22, 163, 74, 0); }
}

/* Ať odskok nekončí těsně pod lepící hlavičkou */
.sekce-karta { scroll-margin-top: 16px; }

/* ===== Úvodní otázka (gate) ===== */
.gate-check {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  margin-bottom: 14px;
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 500;
  transition: background .15s;
}
.gate-check:hover { background: #e0f2fe; }
.gate-check input[type="checkbox"] {
  width: 20px;
  height: 20px;
  accent-color: #16a34a;
  flex-shrink: 0;
}
.gate-telo {
  transition: opacity .2s, max-height .3s;
  opacity: 1;
}
.gate-skryto {
  display: none;
}
.gate-pole {
  margin-bottom: 12px;
}
/* Pole pod volbami sekce (např. délka plotu ve svahu) – odsadit od dlaždic. */
.gate-telo > .opts + .gate-pole {
  margin-top: 16px;
}
.gate-pole label {
  display: block;
  font-size: 0.92em;
  font-weight: 500;
  margin-bottom: 4px;
  color: #334155;
}
.gate-pole input[type="number"] {
  width: 100%;
  max-width: 220px;
  padding: 8px 12px;
  font: inherit;
  color: #0f172a;
  background: #fff;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
}
.gate-pole input[type="number"]:focus {
  outline: none;
  border-color: #16a34a;
  box-shadow: 0 0 0 3px rgba(22, 163, 74, .15);
}

/* Náhled uloženého nastavení z administrace */
.pruh-nahledu { position: sticky; top: 0; z-index: 1000; background: #fef3c7; color: #78350f; border-bottom: 2px solid #f59e0b;
  padding: 10px 16px; text-align: center; font-size: .95em; }
