:root {
  color-scheme: light;
  --bg: #f4f0e7;
  --card: #fffaf2;
  --ink: #171411;
  --muted: #766f65;
  --line: #ded5c7;
  --accent: #c99343;
  --accent-dark: #7a5528;
  --wood: #2a2119;
  --soft: #f7efe3;
  --danger: #a83220;
  --danger-soft: #fff0ed;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Segoe UI", Arial, Helvetica, sans-serif;
  background:
    radial-gradient(circle at top left, rgba(201, 147, 67, .18) 0, transparent 34rem),
    linear-gradient(180deg, #eceff2 0, #f5f1e9 44%, #ebe3d7 100%);
  color: var(--ink);
}

.topbar {
  background:
    linear-gradient(135deg, #110f0d 0, #2b2118 58%, #1a1511 100%);
  border-bottom: 4px solid var(--accent);
  color: #fff;
}

.topbar-inner {
  width: min(1320px, calc(100% - 48px));
  min-height: 112px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 32px;
  padding: 18px 0;
}

.logo-wrap img {
  width: 260px;
  max-width: 48vw;
  display: block;
}

.system-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(160px, auto));
  justify-content: flex-end;
  gap: 12px;
  font-size: 13px;
  color: #e8dfd0;
}

.meta-card {
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 18px;
  padding: 11px 14px;
  background: rgba(255,255,255,.075);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.08);
  min-width: 170px;
  text-align: right;
}

.meta-card span {
  display: block;
  color: #d6c7ae;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.meta-card strong {
  display: block;
  margin-top: 5px;
  color: #fffaf2;
  font-size: 14px;
  white-space: nowrap;
}

.page {
  width: min(1180px, calc(100% - 40px));
  margin: 42px auto;
}

.card {
  background: rgba(255, 250, 241, .96);
  border: 1px solid var(--line);
  border-radius: 26px;
  padding: 36px 40px 40px;
  box-shadow: 0 28px 80px rgba(42, 33, 25, 0.16);
  position: relative;
  overflow: hidden;
}

.card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 5px;
  background: linear-gradient(90deg, var(--accent), #ead8ba, var(--wood));
}

.brand,
.section-title {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: flex-start;
  margin-bottom: 28px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .12em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(30px, 4vw, 48px);
  line-height: 1.02;
  letter-spacing: -.035em;
  color: #18130f;
}

h2 {
  margin: 0 0 14px;
  font-size: 22px;
}

h3 {
  margin: 0 0 12px;
}

.lead {
  max-width: 820px;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.55;
  margin-bottom: 28px;
}

.muted {
  color: var(--muted);
}

.pill {
  display: inline-flex;
  white-space: nowrap;
  border-radius: 999px;
  padding: 10px 15px;
  background: #2a2119;
  color: #fff6e8;
  font-size: 14px;
  font-weight: 800;
}

.alerts {
  display: grid;
  gap: 10px;
  margin: 18px 0;
}

.alert {
  border: 1px solid #e9b8ad;
  background: var(--danger-soft);
  color: var(--danger);
  border-radius: 14px;
  padding: 12px 14px;
}

/* ---- Spolecna navigace mezi aplikacemi (rozcestnik) ---- */
.appnav {
  background: #1a1511;
  border-bottom: 1px solid rgba(255, 255, 255, .08);
}

.appnav-inner {
  width: min(1320px, calc(100% - 48px));
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 8px 0;
}

.appnav a {
  color: #e8dfd0;
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 700;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid transparent;
}

.appnav a:hover {
  background: rgba(255, 255, 255, .08);
  color: #fff;
}

.appnav a.active {
  background: var(--accent);
  color: #2a2119;
}

.appnav .appnav-home {
  margin-right: 6px;
  border-color: rgba(255, 255, 255, .22);
}

@media (max-width: 720px) {
  .appnav-inner { width: calc(100% - 28px); }
  .appnav a { padding: 7px 11px; font-size: 12.5px; }
}

/* ---- Kalkulator uhlopricky ---- */
.page-wide { width: min(1320px, calc(100% - 48px)); }

.workspace {
  display: grid;
  grid-template-columns: minmax(300px, 420px) 1fr;
  gap: 18px;
  margin: 18px 0;
}

.input-card,
.result-card,
.drawing-card,
.explanation-card {
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--soft);
  padding: 20px;
}

.section-heading {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 14px;
}

.section-heading .step {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  height: 34px;
  border-radius: 12px;
  background: var(--wood);
  color: #fff;
  font-weight: 800;
  font-size: 13px;
}

.section-heading h2 { margin: 0; font-size: 1.15rem; }
.section-heading p { margin: 2px 0 0; color: var(--muted); font-size: 13px; }

.field-grid { display: grid; gap: 12px; }

.field { display: block; margin-bottom: 12px; }

.field > span:first-child {
  display: block;
  font-weight: 700;
  font-size: 13px;
  margin-bottom: 5px;
}

.field small { color: var(--muted); font-weight: 600; }

.field b { color: var(--accent-dark); }

.input-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  padding: 0 12px;
}

.input-wrap:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(201, 147, 67, .18); }

.input-wrap input {
  flex: 1;
  border: 0;
  outline: none;
  background: transparent;
  font: inherit;
  font-variant-numeric: tabular-nums;
  padding: 11px 0;
}

.input-wrap em { color: var(--muted); font-style: normal; font-size: 12.5px; font-weight: 700; }

.optional-field { margin-top: 6px; }
.optional-field p { margin: 4px 0 0; color: var(--muted); font-size: 12.5px; }

.form-error {
  margin: 12px 0 0;
  border: 1px solid #e7b7ad;
  background: var(--danger-soft);
  color: var(--danger);
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 13.5px;
  font-weight: 600;
}

.calculate-button {
  margin-top: 14px;
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border: 0;
  border-radius: 14px;
  padding: 13px 18px;
  background: var(--wood);
  color: #fff;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.calculate-button:hover { background: #3a2d21; }

.assumption {
  margin-top: 14px;
  display: flex;
  gap: 10px;
  align-items: flex-start;
  border-top: 1px dashed var(--line);
  padding-top: 12px;
  color: var(--muted);
  font-size: 13px;
}

.assumption > span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent);
  color: #2a2119;
  font-weight: 800;
  font-size: 12px;
  flex: none;
}

.assumption p { margin: 0; }

.status-panel {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  border: 1px solid var(--line);
  border-left: 5px solid var(--accent);
  border-radius: 16px;
  background: #fff;
  padding: 14px 16px;
}

.status-panel p { margin: 0; font-size: 12px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.status-panel h3 { margin: 4px 0; font-size: 1.05rem; }
.status-panel div p:last-child { text-transform: none; letter-spacing: 0; font-weight: 500; font-size: 13.5px; color: var(--muted); }

.status-panel.safe { border-left-color: #2f8f4e; }
.status-panel.tight { border-left-color: #c9932f; }
.status-panel.no { border-left-color: var(--danger); }

.status-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--soft);
  border: 1px solid var(--line);
  font-weight: 800;
  flex: none;
}

.status-panel.safe .status-icon { background: #e7f4ea; color: #2f8f4e; }
.status-panel.tight .status-icon { background: #fdf2dd; color: #8a6114; }
.status-panel.no .status-icon { background: var(--danger-soft); color: var(--danger); }

.metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.metric {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
  padding: 13px 14px;
}

.metric p { margin: 0 0 6px; font-size: 12.5px; font-weight: 700; color: var(--muted); }
.metric p span { display: block; font-weight: 500; font-size: 11.5px; }
.metric strong { font-size: 1.7rem; font-variant-numeric: tabular-nums; }
.metric small { color: var(--muted); font-weight: 700; }

.primary-metric { border-color: var(--accent); background: #fffaf0; }

.reserve-bar { margin-top: 14px; }
.reserve-bar > div:first-child { display: flex; justify-content: space-between; font-size: 13px; font-weight: 700; }
.reserve-bar small { color: var(--muted); font-size: 12px; }

.bar-track {
  position: relative;
  height: 10px;
  border-radius: 999px;
  background: #e8ddcb;
  margin: 8px 0 6px;
  overflow: hidden;
}

.bar-track i { display: block; height: 100%; background: var(--accent); }
.bar-track b { position: absolute; top: -3px; width: 2px; height: 16px; background: var(--wood); }

.drawing-card { margin-top: 18px; }

.drawing-header { display: flex; flex-wrap: wrap; gap: 12px; justify-content: space-between; align-items: flex-start; }

.legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 12.5px; color: var(--muted); font-weight: 600; }
.legend i { display: inline-block; width: 16px; height: 0; border-top: 3px solid var(--wood); vertical-align: middle; margin-right: 5px; }
.legend .legend-rotating { border-top-style: dashed; border-top-color: var(--accent-dark); }
.legend .legend-ceiling { border-top-color: #6a7c92; }

.drawing-layout { display: grid; grid-template-columns: 1fr minmax(220px, 300px); gap: 16px; }

.side-drawing,
.front-drawing { border: 1px solid var(--line); border-radius: 16px; background: #fff; padding: 12px; }

.drawing-label { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 6px; }
.drawing-label span { font-weight: 800; font-size: 13px; }
.drawing-label small { color: var(--muted); font-size: 12px; }

.side-drawing svg,
.front-drawing svg { width: 100%; height: auto; display: block; }

.floor-line { stroke: var(--wood); stroke-width: 2.5; }
.ceiling-line { stroke: #6a7c92; stroke-width: 3; }
.ceiling-line.collision { stroke: var(--danger); }
.cabinet-standing { fill: #ead8ba; stroke: var(--wood); stroke-width: 1.6; }
.cabinet-rotated { fill: rgba(201, 147, 67, .22); stroke: var(--accent-dark); stroke-width: 1.6; stroke-dasharray: 7 5; }
.cabinet-rotated.collision { fill: rgba(168, 50, 32, .16); stroke: var(--danger); }
.cabinet-detail { stroke: var(--wood); stroke-width: 1; opacity: .5; }
.diagonal-line { stroke: var(--accent-dark); stroke-width: 1.4; stroke-dasharray: 4 4; }
.critical-point { fill: var(--accent-dark); }
.critical-point.collision { fill: var(--danger); }
.pivot-point { fill: var(--wood); }
.rotation-arrow { fill: none; stroke: var(--accent-dark); stroke-width: 2; }
.dimension-line { stroke: #8a8378; stroke-width: 1.2; }
.svg-label, .dimension-text, .front-text {
  font-family: "Segoe UI", Arial, sans-serif;
  font-size: 13px;
  fill: #5c554c;
  font-variant-numeric: tabular-nums;
}
.svg-label.critical-text, .svg-label.angle-text { fill: var(--accent-dark); font-weight: 700; }
.ceiling-text { fill: #4c5b6d; font-weight: 700; }
.dimension-text.centered, .front-text { text-anchor: middle; }
.front-cabinet { fill: #ead8ba; stroke: var(--wood); stroke-width: 1.6; }
.front-detail { stroke: var(--wood); stroke-width: 1; opacity: .45; }
.front-handle { stroke: var(--accent-dark); stroke-width: 3; stroke-linecap: round; }
.front-dimension { stroke: #8a8378; stroke-width: 1.2; }

.dimension-list { margin: 12px 0 0; display: grid; gap: 6px; }
.dimension-list div { display: flex; justify-content: space-between; border-bottom: 1px dashed var(--line); padding-bottom: 5px; font-size: 13px; }
.dimension-list dt { color: var(--muted); font-weight: 600; margin: 0; }
.dimension-list dd { margin: 0; font-weight: 700; font-variant-numeric: tabular-nums; }

.explanation-card { margin-top: 18px; }
.explanation-card h2 { margin: 0 0 8px; }
.explanation-copy p { margin: 0 0 8px; color: var(--muted); font-size: 14px; line-height: 1.6; }
.explanation-copy strong { color: var(--ink); }

@media (max-width: 1000px) {
  .workspace { grid-template-columns: 1fr; }
  .drawing-layout { grid-template-columns: 1fr; }
}
