*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* REGUPOL Brandfarben – CI 2025 */
  /* Primärfarben */
  --brand:    #96be0d;   /* REGUPOL Hellgrün  (Pantone 376C) */
  --brand-l:  #a8cf10;  /* Hellgrün, aufgehellt */
  --brand-d:  #008132;  /* REGUPOL Dunkelgrün (Pantone 348C) */
  --brand-bg: #edf6c0;  /* Hellgrün tint */
  --accent:   #ffdd00;  /* REGUPOL Gelb       (Pantone 116C) – auf dunklem Grund */
  --accent-l: #ffe633;
  --accent-bg: #fffde0;
  /* Graustufen – REGUPOL Grau-Palette */
  --dark:     #3a3a3a;  /* REGUPOL Grau       (Pantone Black 7C) */
  --mid:      #4d4d4d;
  --panel:    #F4F4F4;
  --border:   #DDDDDD;
  --text:     #3a3a3a;
  --muted:    #868786;  /* REGUPOL Grau 60K   (Pantone 423C)  */
  /* Nachweis-Farben */
  --pass:     #96be0d;  /* REGUPOL Hellgrün */
  --pass-bg:  #edf6c0;
  --fail:     #C0392B;
  --fail-bg:  #FBEAEA;
  /* Fonts: Midpoint Pro = REGUPOL Hausschrift (Dateien von REGUPOL anfordern).
     Syne dient als Fallback bis die Schriftdateien vorliegen. */
  --mono:     'DM Mono', monospace;
  --sans:     'Midpoint Pro', 'DM Sans', sans-serif;
  --step-w:   820px;
}

body {
  font-family: var(--sans);
  background: var(--panel);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── Hero / Titelseite ── */
.hero-screen {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  height: 100%;
  z-index: 400;
  background-color: #222222;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  opacity: 1;
  transition: opacity 0.4s ease;
}
.hero-screen.hero-out  { opacity: 0; pointer-events: none; }
.hero-screen.hidden    { display: none; }

.hero-inner {
  max-width: 580px;
  width: 100%;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.6rem;
}

.hero-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.1rem;
}
.hero-logo-mark {
  width: 80px;
  height: 80px;
  background: var(--brand);
  clip-path: polygon(0 100%, 50% 0, 100% 100%);
}
.hero-brand-text {
  font-family: var(--sans);
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #fff;
}
.hero-brand-text span { color: var(--brand); }

.hero-divider {
  width: 3rem;
  height: 3px;
  background: var(--brand);
}

.hero-headline {
  font-family: var(--sans);
  font-size: 1.35rem;
  font-weight: 700;
  color: #fff;
  line-height: 1.5;
  letter-spacing: 0.01em;
}

.hero-body {
  font-family: system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
  font-size: 0.95rem;
  color: #888;
  line-height: 1.7;
}

.btn-hero-start {
  background: var(--brand);
  color: #fff;
  border: none;
  font-family: var(--sans);
  font-weight: 700;
  font-size: 0.88rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 1rem 2.8rem;
  cursor: pointer;
  transition: background 0.15s;
  margin-top: 0.25rem;
}
.btn-hero-start:hover { background: var(--brand-l); }

.hero-footer {
  font-family: var(--mono);
  font-size: 0.65rem;
  color: #444;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* ── Disclaimer Modal ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  z-index: 500;
  /* flex-column + overflow-y: auto → scrollable on small screens;
     margin: auto on .modal-box keeps it centered when there is room */
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 1rem;
  overflow-y: auto;
}
.modal-overlay.hidden { display: none; }
.modal-box {
  background: #fff;
  max-width: 560px;
  width: 100%;
  border-top: 4px solid var(--brand);
  overflow: visible;
  /* centers the box vertically when the viewport is tall enough;
     on short viewports the overlay scrolls instead */
  margin-top: auto;
  margin-bottom: auto;
}
.modal-header {
  background: var(--dark);
  padding: 1rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}
.modal-logo {
  width: 24px; height: 24px;
  background: var(--brand);
  clip-path: polygon(0 100%, 50% 0, 100% 100%);
  flex-shrink: 0;
}
.modal-header h2 {
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #fff;
}
.modal-body {
  padding: 1.5rem 1.5rem 1rem;
  font-size: 15px;
  line-height: 1.7;
  color: #222222;
  font-family: system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}
.modal-body p { margin-bottom: 0.75rem; }
.modal-body p:last-child { margin-bottom: 0; }
.modal-body strong { color: #111111; }
.modal-check {
  display: block;
  padding: 0 1.5rem 1.25rem;
  font-size: 15px;
  line-height: 1.7;
  color: #555555;
  cursor: pointer;
  font-family: system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  text-transform: none;
  font-weight: 400;
  letter-spacing: 0;
}
.modal-check input[type=checkbox] {
  margin-right: 0.5rem;
  vertical-align: middle;
  accent-color: var(--brand);
}
.modal-footer { padding: 0 1.5rem 1.5rem; }
.btn-accept {
  width: 100%;
  background: var(--brand);
  color: #fff;
  border: none;
  padding: 0.85rem;
  font-family: var(--sans);
  font-weight: 700;
  font-size: 0.82rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.15s;
}
.btn-accept:hover:not(:disabled) { background: var(--brand-l); }
.btn-accept:disabled { opacity: 0.35; cursor: not-allowed; }

/* ── Header ── */
header {
  background: var(--dark);
  padding: 0 2rem;
  display: flex;
  align-items: center;
  gap: 1.5rem;
  height: 60px;
  position: sticky;
  top: 0;
  z-index: 100;
}
.logo-mark {
  width: 32px; height: 32px;
  background: var(--brand);
  clip-path: polygon(0 100%, 50% 0, 100% 100%);
  flex-shrink: 0;
}
header h1 {
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #fff;
}
header h1 span { color: var(--brand); }
.header-norm {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 0.72rem;
  color: #666;
  letter-spacing: 0.04em;
}
.btn-lang {
  background: transparent;
  border: 1px solid #444;
  color: #aaa;
  font-family: var(--mono);
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  padding: 0.25rem 0.55rem;
  cursor: pointer;
  transition: all 0.15s;
  margin-left: 0.75rem;
  flex-shrink: 0;
}
.btn-lang:hover { border-color: var(--brand); color: var(--brand); }

/* Language toggle on the hero screen – top-right corner */
.btn-lang-hero {
  position: absolute;
  top: 1.25rem;
  right: 1.5rem;
  margin-left: 0;
  border-color: #555;
  color: #888;
  z-index: 1;
}
.btn-lang-hero:hover { border-color: var(--brand); color: var(--brand); }

/* ── Progress Bar ── */
.progress-bar {
  background: var(--mid);
  padding: 0 2rem;
  display: flex;
  overflow-x: auto;
  overflow-y: visible;
}
.prog-step {
  flex: 1;
  padding: 0.7rem 1rem;
  font-size: 0.73rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #aaa;              /* light gray — readable on #4d4d4d dark background */
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
  white-space: nowrap;
  /* overflow:hidden removed — it clipped descenders (g, j, p…);
     the progress-bar itself scrolls horizontally on narrow screens */
}
.prog-step.active { color: var(--brand); border-bottom-color: var(--brand); }
.prog-step.done   { color: #888; border-bottom-color: #666; }
.prog-step:hover:not(.active) { color: #ccc; }

/* ── Main Layout ── */
main {
  flex: 1;
  display: flex;
  justify-content: center;
  padding: 3rem 1.5rem 5rem;
}
.step-card {
  width: 100%;
  max-width: var(--step-w);
  display: none;
  animation: fadeUp 0.3s ease;
}
.step-card.active { display: block; }
#step-5 { max-width: 1200px; }

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

.step-header { margin-bottom: 2rem; overflow: visible; }
.step-num {
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--brand);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 0.3rem;
}
.step-title {
  font-size: 1.8rem;
  font-weight: 800;
  line-height: 1.2;
  color: var(--dark);
  padding-bottom: 0.5em;
  overflow: visible;
}
.step-sub {
  font-size: 0.82rem;
  color: var(--muted);
  margin-top: 0.4rem;
  font-family: var(--mono);
}

/* ── Form Grid ── */
.form-section {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 2px;
  margin-bottom: 1rem;
  overflow: hidden;
}
.form-section-title {
  background: var(--dark);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 0.5rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.form-section-title sub,
.form-section-title sup { text-transform: none; letter-spacing: 0; font-size: 0.75em; }
.form-section-title sub { vertical-align: sub; }
.form-section-title sup { vertical-align: super; }
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
}
.field {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}
.field:nth-child(even) { border-right: none; }
.field:last-child, .field:nth-last-child(2):nth-child(odd) { border-bottom: none; }
.field.full { grid-column: 1 / -1; border-right: none; }

label {
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
label sub, label sup { text-transform: none; font-size: 0.72em; letter-spacing: 0; }
label sub { vertical-align: sub; }
label sup { vertical-align: super; }

/* Formelzeichen-Span: verhindert Großbuchstabenumwandlung griechischer Buchstaben */
label .sym { text-transform: none; letter-spacing: 0; font-style: italic; }
label .sym sub, label .sym sup { font-style: normal; }

/* Eingabe + Einheit in einer Zeile */
.input-row {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
}
.input-row input, .input-row select { flex: 1; min-width: 0; }
.input-row .unit {
  font-family: var(--mono);
  font-size: 0.85rem;
  color: var(--muted);
  font-weight: 400;
  white-space: nowrap;
  flex-shrink: 0;
}
input[type=number], input[type=text], select {
  font-family: var(--mono);
  font-size: 1.1rem;
  font-weight: 500;
  color: var(--dark);
  border: none;
  outline: none;
  background: transparent;
  width: 100%;
  padding: 0;
  -moz-appearance: textfield;
}
input[type=number]::-webkit-outer-spin-button,
input[type=number]::-webkit-inner-spin-button { -webkit-appearance: none; }
input[type=number]:focus, input[type=text]:focus, select:focus { color: var(--brand); }
select { cursor: pointer; appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23888'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 0 center; padding-right: 1rem; }

.field-hint { font-family: system-ui, -apple-system, "Segoe UI", Arial, sans-serif; font-size: 0.82rem; color: #777777; line-height: 1.5; }
.field-computed { font-family: var(--mono); font-size: 1rem; font-weight: 500; color: var(--brand); }

/* ── Toggle-Gruppe ── */
.toggle-group {
  padding: 0.75rem 1rem;
  display: flex;
  gap: 1.5rem;
  border-bottom: 1px solid var(--border);
}
.toggle-group label {
  text-transform: none;
  letter-spacing: 0;
  font-size: 0.78rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  cursor: pointer;
}
.toggle-group input[type=radio] { accent-color: var(--brand); }

/* ── Öffnungen ── */
.opening-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 1fr auto;
  border-bottom: 1px solid var(--border);
  align-items: stretch;
}
.opening-field {
  padding: 0.85rem 1rem;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}
.opening-field:last-of-type { border-right: none; }
.btn-remove-opening {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  padding: 0 1rem;
  font-size: 0.9rem;
  transition: color 0.15s;
}
.btn-remove-opening:hover { color: var(--fail); }
.btn-add-opening {
  background: none;
  border: 1px solid #555;
  color: #aaa;
  cursor: pointer;
  padding: 0.2rem 0.6rem;
  font-size: 0.62rem;
  font-family: var(--mono);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  transition: all 0.15s;
}
.btn-add-opening:hover { border-color: var(--brand); color: var(--brand); }
.opening-empty { padding: 0.85rem 1rem; font-family: var(--mono); font-size: 0.72rem; color: #BBBBBB; }
.opening-row-error { background: #FFF5F5; }
.opening-error-msg {
  grid-column: 1 / -1;
  padding: 0.3rem 1rem;
  font-family: system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
  font-size: 0.78rem;
  color: var(--fail);
  border-top: 1px solid var(--fail-bg);
  background: var(--fail-bg);
}

/* ── Computed/read-only value display ── */
.computed-value {
  display: inline-block;
  min-width: 6rem;
  padding: 0.35rem 0.55rem;
  background: var(--surface, #f5f5f5);
  border: 1px solid #ddd;
  border-radius: 4px;
  color: var(--muted, #555);
  font-size: 1rem;
  line-height: 1.5;
  cursor: default;
  user-select: none;
}

/* ── Info-Button + Popup ── */
.btn-info {
  background: none;
  border: 1px solid #bbb;
  color: var(--muted);
  font-size: 0.78rem;
  padding: 0.05rem 0.4rem;
  cursor: pointer;
  border-radius: 3px;
  line-height: 1.4;
  font-family: system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
  flex-shrink: 0;
  transition: all 0.15s;
}
.btn-info:hover { border-color: var(--brand); color: var(--brand); }
.info-popup {
  background: var(--brand-bg);
  border-left: 3px solid var(--brand);
  padding: 0.6rem 1rem;
  font-size: 0.82rem;
  font-family: system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
  color: #444;
  line-height: 1.6;
  margin-top: 0.25rem;
}

/* ── DSGVO-Hinweis im Disclaimer-Modal ── */
.modal-gdpr {
  margin-top: 0.85rem;
  padding: 0.55rem 0.85rem;
  background: var(--brand-bg);
  border-left: 3px solid var(--brand);
  font-size: 0.78rem;
  font-family: system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
  color: #555;
  line-height: 1.55;
}

/* ── Spannungs-Dehnungs-Kurve ── */
.chart-wrap { padding: 1rem; }
.chart-title {
  font-family: var(--mono);
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.5rem;
}
#ss-chart          { width: 100%; height: 300px; display: block; }
#ss-chart-result   { width: 100%; height: 520px; display: block; }
#wall-sketch       { width: 100%; display: block; }
#wall-sketch-result{ width: 100%; display: block; }

/* ── Navigation ── */
.step-nav { display: flex; gap: 0.75rem; margin-top: 1.5rem; flex-wrap: wrap; }
.btn {
  font-family: var(--sans);
  font-weight: 700;
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.8rem 1.8rem;
  border: none;
  cursor: pointer;
  transition: all 0.15s;
}
.btn-primary   { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-l); }
.btn-secondary { background: transparent; color: var(--muted); border: 1px solid var(--border); }
.btn-secondary:hover { border-color: #aaa; color: var(--dark); }
.btn-calculate { background: var(--dark); color: #fff; flex: 1; }
.btn-calculate:hover { background: var(--mid); }
.btn-print { background: transparent; color: var(--muted); border: 1px solid var(--border); }
.btn-print:hover { border-color: var(--brand); color: var(--brand); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ── Results ── */
.results-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1rem;
}
.result-block {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 2px;
  overflow: hidden;
}
.result-block-header {
  padding: 0.6rem 1rem;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.result-block-header.pass { background: var(--pass-bg); color: var(--brand-d); }
.result-block-header.fail { background: var(--fail-bg); color: var(--fail); }
.result-block-header .pr-lower { text-transform: none; }
.result-block-header.neutral { background: var(--dark); color: #fff; }
.check-icon { font-size: 0.9rem; }

.result-sub-header {
  background: var(--panel);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 0.35rem 1rem;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

/* Result fields – same layout as input .field (2×2 grid) */
.result-fields-grid {
  grid-template-columns: 1fr 1fr;
}
.result-field {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}
.result-field:nth-child(even) { border-right: none; }
.result-field:last-child,
.result-field:nth-last-child(2):nth-child(odd) { border-bottom: none; }
.result-field label {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.25rem;
  line-height: 1.3;
}
.result-field label sub, .result-field label sup { text-transform: none; font-size: 0.72em; letter-spacing: 0; }
.result-field label sub { vertical-align: sub; }
.result-field label sup { vertical-align: super; }
.result-field label .sym { text-transform: none; letter-spacing: 0; font-style: italic; color: #999; font-size: 0.85em; flex-shrink: 0; }

.result-value-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
}
.result-num {
  font-family: var(--mono);
  font-size: 1.25rem;
  font-weight: 500;
  color: var(--dark);
}
.result-num-unit {
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--muted);
  flex-shrink: 0;
}
.result-num.highlight { color: var(--brand-d); font-weight: 700; }
.result-num.opt-ok    { color: var(--brand-d); font-weight: 700; }
.result-num.opt-warn  { color: #997a00;        font-weight: 700; } /* Dunkelgelb (kontrastfähig) */

/* Eta bar */
.eta-bar-wrap { padding: 0.6rem 1rem 0.8rem; border-bottom: 1px solid #EEEEEE; }
.eta-label-row {
  display: flex;
  justify-content: space-between;
  font-family: var(--mono);
  font-size: 0.7rem;
  margin-bottom: 0.35rem;
  color: var(--muted);
}
.eta-label-row sub, .eta-label-row sup { text-transform: none; font-size: 0.75em; }
.eta-val { font-weight: 700; font-size: 0.85rem; }
.eta-bar-bg { height: 6px; background: #EEE; overflow: hidden; }
.eta-bar-fill { height: 100%; transition: width 0.6s ease; }
.eta-bar-fill.pass { background: var(--pass); }
.eta-bar-fill.fail { background: var(--fail); }

/* Gesamtnachweis Banner */
.result-banner {
  padding: 1.2rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
  border-radius: 2px;
}
.result-banner.pass { background: var(--pass); color: #fff; }
.result-banner.fail { background: var(--fail); color: #fff; }
.banner-icon { font-size: 1.8rem; }
.banner-text h3 { font-size: 1rem; font-weight: 800; }
.banner-text p  { font-size: 0.78rem; opacity: 0.85; font-family: var(--mono); margin-top: 0.1rem; }

.intermediary-section {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 2px;
  margin-bottom: 1rem;
  overflow: hidden;
}

/* Loading */
.loading { display: none; align-items: center; gap: 0.75rem; padding: 1.5rem; font-family: var(--mono); font-size: 0.8rem; color: var(--muted); }
.loading.visible { display: flex; }
.spinner {
  width: 18px; height: 18px;
  border: 2px solid var(--border);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.error-box {
  background: var(--fail-bg);
  border-left: 3px solid var(--fail);
  padding: 0.8rem 1rem;
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--fail);
  margin-bottom: 1rem;
  display: none;
}
.error-box.visible { display: block; }

/* ── Mobil (Hochformat) ── */
@media (max-width: 640px) {
  main { padding: 2rem 0.75rem 4rem; }

  /* Ergebnisse: 2 Spalten → 1 Spalte */
  .results-grid { grid-template-columns: 1fr; }
  .result-fields-grid { grid-template-columns: 1fr; }
  .result-field { border-right: none !important; }
  .result-field:last-child,
  .result-field:nth-last-child(2):nth-child(odd) { border-bottom: 1px solid var(--border); }
  .result-field:last-child { border-bottom: none; }

  /* Eingabefelder: 2 Spalten → 1 Spalte */
  .form-grid { grid-template-columns: 1fr; }
  .field { border-right: none !important; }
  .field:last-child,
  .field:nth-last-child(2):nth-child(odd) { border-bottom: 1px solid var(--border); }
  .field:last-child { border-bottom: none; }

  /* Opening-Zeilen: 4 Felder → 2×2 */
  .opening-row { grid-template-columns: 1fr 1fr; }
  .opening-row .opening-field:nth-child(2) { border-right: none; }
  .opening-row .opening-field:nth-child(3) { border-right: 1px solid var(--border); border-top: 1px solid var(--border); }
  .opening-row .opening-field:nth-child(4) { border-right: none; border-top: 1px solid var(--border); }
  .opening-row .btn-remove-opening { grid-column: 1 / -1; border-top: 1px solid var(--border); text-align: right; }

  /* Fortschrittsleiste: Schriftgröße reduzieren */
  .prog-step { font-size: 0.6rem; padding: 0.6rem 0.4rem; }

  /* Toggle-Gruppe: untereinander statt nebeneinander */
  .toggle-group { flex-direction: column; gap: 0.75rem; }

  /* Ergebnis-Kopfzeile */
  .step-title { font-size: 1.4rem; }
}

/* ── Drucken ── */
@media print {
  .modal-overlay, .hero-screen, header, .progress-bar, .step-nav { display: none !important; }
  body {
    background: #fff;
    /* Use a system font that prints cleanly in all languages (including German umlauts) */
    font-family: Arial, "Helvetica Neue", sans-serif !important;
  }
  main { padding: 0; display: block; }
  .step-card { display: none !important; }
  .step-card#step-5 { display: block !important; }
  .results-grid { grid-template-columns: 1fr 1fr; }
  .result-block { break-inside: avoid; }

  /* Labels: switch from flex to block so text wraps freely in both languages.
     flex + no flex-wrap clips content to the grid-track width in print. */
  label {
    display: block !important;
    color: #333 !important;
    font-size: 0.64rem !important;
    letter-spacing: 0 !important;
    white-space: normal !important;
    overflow: visible !important;
    overflow-wrap: break-word !important;
    word-break: break-word !important;
    /* Automatic hyphenation based on html[lang] set by applyLang() */
    hyphens: auto !important;
    -webkit-hyphens: auto !important;
  }
  /* Keep symbol (Vap,Rd etc.) inline after the description text */
  label .sym { display: inline !important; margin-left: 0.25em; }
  .result-num { color: #000 !important; font-size: 1.05rem !important; }
  .result-num-unit { color: #555 !important; }
  .step-title { color: #000 !important; font-size: 1.4rem !important; }
  .step-sub { color: #444 !important; }
  .result-num.highlight,
  .result-num.opt-ok  { color: #006627 !important; }
  .result-num.opt-warn { color: #7a5c00 !important; }
  .muted, .field-hint  { color: #555 !important; }

  /* Result fields grid: preserve 2-column layout in print */
  .result-fields-grid { display: grid; grid-template-columns: 1fr 1fr; }
  .result-field { border: none; border-bottom: 1px solid #ddd; border-right: 1px solid #ddd; }
  .result-field:nth-child(even) { border-right: none; }

  /* Canvas: override inline style.height set by JS so aspect ratio is preserved */
  #wall-sketch-result, #wall-sketch {
    width: 100% !important;
    height: auto !important;
    aspect-ratio: auto;
  }

  /* Fix overflow:hidden so Chrome allows page breaks at section boundaries */
  .intermediary-section { overflow: visible; }

  /* Stress-strain curve starts on a new page (both legacy and modern property) */
  #ss-chart-section {
    page-break-before: always;
    break-before: page;
  }

  /* Ensure backgrounds and colors print */
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .result-block-header, .result-sub-header, .eta-bar-fill, .result-banner { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  @page { margin: 1.5cm; }
}
