/* Kalkulačka ceny — tokeny jako ve vývojářském vieweru (templates/index.html). */
:root {
  --bg: #f1f5f9; --surface: #ffffff; --surface-2: #f8fafc;
  --border: #e2e8f0; --border-2: #cbd5e1;
  --text: #0f172a; --text-2: #475569; --text-3: #94a3b8;
  --accent: #0d9488; --accent-h: #0f766e; --accent-fg: #ffffff; --accent-bg: #f0fdfa;
  --warn: #b45309; --warn-bg: #fffbeb; --danger: #dc2626; --danger-bg: #fef2f2;
  --c1: #0d9488; --c2: #6366f1; --c3: #f59e0b; --c4: #ec4899; --c5: #64748b;
  --r: 6px; --r-lg: 10px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1220; --surface: #111a2c; --surface-2: #162036;
    --border: #22304a; --border-2: #2f3f5e;
    --text: #e2e8f0; --text-2: #a3b1c6; --text-3: #64748b;
    --accent: #2dd4bf; --accent-h: #5eead4; --accent-fg: #042f2e; --accent-bg: #0f2a2a;
    --warn: #fbbf24; --warn-bg: #2a2110; --danger: #f87171; --danger-bg: #2a1414;
  }
}
*, *::before, *::after { box-sizing: border-box; }
html { font-size: 14px; }
body {
  margin: 0; background: var(--bg); color: var(--text); line-height: 1.5;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
}
.bar {
  position: sticky; top: 0; z-index: 10; display: flex; flex-wrap: wrap; align-items: center;
  gap: 8px 20px; padding: 10px 16px; background: var(--surface); border-bottom: 1px solid var(--border);
}
.bar h1 { font-size: 16px; margin: 0; flex: 1 1 auto; }
.bar__back { color: var(--text-2); text-decoration: none; font-size: 13px; }
.bar__back:hover { color: var(--accent); }
.bar__money { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--text-2); flex-wrap: wrap; }
.bar__rate input { width: 64px; }
.seg { display: inline-flex; border: 1px solid var(--border-2); border-radius: var(--r); overflow: hidden; }
.seg button {
  border: 0; background: var(--surface); color: var(--text-2); padding: 4px 12px; cursor: pointer; font: inherit;
}
.seg button[aria-pressed="true"] { background: var(--accent); color: var(--accent-fg); font-weight: 600; }

main { max-width: 1280px; margin: 0 auto; padding: 16px 16px 48px; }
.intro { color: var(--text-2); max-width: 900px; margin: 4px 0 20px; }

.part {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
  padding: 16px 20px 20px; margin-bottom: 24px;
}
.part h2 { font-size: 17px; margin: 0 0 14px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.part h2 small { font-weight: 400; color: var(--text-3); font-size: 13px; }
.part__no {
  display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%;
  background: var(--accent); color: var(--accent-fg); font-size: 14px;
}
.part__grid { display: grid; grid-template-columns: minmax(280px, 380px) 1fr; gap: 24px; }
@media (max-width: 900px) { .part__grid { grid-template-columns: 1fr; } }

/* ── Ovládání ─────────────────────────────────────────────── */
.ctl { padding: 8px 10px; margin: 0 -10px; border-radius: var(--r); }
.ctl:hover, .ctl:focus-within { background: var(--surface-2); }
.ctl__head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.ctl label, .ctl__label { font-weight: 600; font-size: 13px; }
.ctl__value { display: flex; align-items: baseline; gap: 4px; }
.ctl__value input { width: 96px; text-align: right; }
.ctl__unit { color: var(--text-2); font-size: 12px; white-space: nowrap; }
.ctl__hint { color: var(--text-3); font-size: 12px; margin-top: 2px; }
.ctl__hint.warn { color: var(--warn); }
.ctl__hint.bad { color: var(--danger); font-weight: 600; }
.ctl input[type="range"] { width: 100%; accent-color: var(--accent); margin: 4px 0 0; }
.ctl select { width: 100%; margin-top: 4px; }
.ctl__check { display: flex; gap: 8px; align-items: center; font-size: 13px; }
.ctl-group { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); margin: 14px 0 2px; }
.ctl-group:first-child { margin-top: 0; }
input[type="number"], select {
  font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border-2);
  border-radius: var(--r); padding: 4px 6px;
}

/* ── Schéma závislostí ────────────────────────────────────── */
.flow {
  position: relative; display: grid; grid-template-columns: repeat(var(--cols, 4), minmax(0, 1fr));
  grid-auto-rows: minmax(64px, auto); gap: 10px 34px; margin-bottom: 16px;
}
.node {
  padding: 8px 10px; border-radius: var(--r); min-width: 0; align-self: center; z-index: 1;
  background: var(--surface-2); border: 1px solid var(--border); position: relative;
  transition: border-color .15s, box-shadow .15s, opacity .15s;
}
svg.edges { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; }
svg.edges path { fill: none; stroke: var(--border-2); stroke-width: 1.5; transition: stroke .15s; }
svg.edges path.hit { stroke: var(--accent); stroke-width: 2; }
@media (max-width: 700px) {
  .flow { grid-template-columns: 1fr; gap: 8px; }
  .flow .node { grid-column: auto !important; grid-row: auto !important; }
  svg.edges { display: none; }
}
.node__label { font-size: 11px; color: var(--text-2); text-transform: uppercase; letter-spacing: .04em; }
.node__value { font-size: 15px; font-weight: 650; font-variant-numeric: tabular-nums; }
.node__sub { font-size: 12px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.node__bar { height: 4px; border-radius: 2px; margin-top: 6px; background: var(--accent); }
.node.off { opacity: .45; }
.node.bad { border-color: var(--danger); background: var(--danger-bg); }
.flow.focus .node { opacity: .4; }
.flow.focus .node.hit { opacity: 1; border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-bg); }
.node.flash { animation: flash .5s; }
@keyframes flash { from { box-shadow: 0 0 0 3px var(--accent); } to { box-shadow: none; } }

/* ── Součty ───────────────────────────────────────────────── */
.totals { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; }
.total {
  border: 1px solid var(--border); border-radius: var(--r-lg); padding: 10px 14px; background: var(--surface);
}
.total--main { background: var(--accent-bg); border-color: var(--accent); }
.total__label { font-size: 12px; color: var(--text-2); }
.total__value { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.25; }
.total__sub { font-size: 12px; color: var(--text-2); }

.breakdown { margin-top: 16px; }
.stack { display: flex; height: 18px; border-radius: 4px; overflow: hidden; background: var(--surface-2); }
.stack span { display: block; height: 100%; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 6px; font-size: 12px; color: var(--text-2); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }

.notes { margin-top: 14px; font-size: 12.5px; color: var(--text-2); }
.notes p { margin: 4px 0; }
.notes .warn { color: var(--warn); background: var(--warn-bg); padding: 6px 10px; border-radius: var(--r); }
.notes .bad { color: var(--danger); background: var(--danger-bg); padding: 6px 10px; border-radius: var(--r); font-weight: 600; }
.quality { padding: 6px 10px; border-left: 3px solid var(--accent); background: var(--surface-2); border-radius: 0 var(--r) var(--r) 0; }
.quality.unmeasured { border-left-color: var(--text-3); }
.foot { color: var(--text-3); font-size: 12px; }
