/* ==========================================================================
   DSGVO- & ISO-27001-Gap-Analysator – Stylesheet
   Heller Apple-Stil, keine externen Ressourcen. Enthält am Ende ein
   eigenes Druck-Layout (A4) für "Als PDF speichern".
   ========================================================================== */

:root {
  --bg: #ffffff;
  --surface: #f5f5f7;
  --text: #1d1d1f;
  --text-2: #6e6e73;
  --text-3: #86868b;
  --accent: #0071e3;
  --accent-hover: #0077ed;
  --accent-soft: rgba(0, 113, 227, 0.08);
  --line: #d2d2d7;
  --track: #e8e8ed;

  /* Risiko- und Statusfarben (sparsam einsetzen) */
  --high: #d7373f;
  --high-soft: rgba(215, 55, 63, 0.1);
  --medium: #e68a00;
  --medium-soft: rgba(230, 138, 0, 0.13);
  --low: #b8860b;
  --low-soft: rgba(184, 134, 11, 0.1);
  --green: #1a7f37;
  --green-soft: rgba(26, 127, 55, 0.1);

  --radius-card: 22px;
  --radius-item: 14px;
  --radius-pill: 980px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  --ease: cubic-bezier(0.25, 0.1, 0.25, 1);
  color-scheme: light;
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.47;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

[hidden] {
  display: none !important;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- Layout ---------- */

.page {
  max-width: 860px;
  margin: 0 auto;
  padding: 64px 16px 56px;
}

.intro {
  text-align: center;
  margin-bottom: 40px;
}

/* Nach der Startansicht: Kopf kompakter, ohne Einleitungstext */
body:not([data-view="start"]) .intro {
  margin-bottom: 28px;
}

body:not([data-view="start"]) .intro .lead {
  display: none;
}

body:not([data-view="start"]) .intro h1 {
  font-size: clamp(24px, 4.6vw, 32px);
}

.eyebrow {
  margin: 0 0 8px;
  font-size: 15px;
  font-weight: 600;
  color: var(--accent);
}

h1,
h2,
h3,
h4 {
  margin: 0;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.1;
}

h1 {
  font-size: clamp(30px, 6.4vw, 48px);
}

h2 {
  font-size: clamp(24px, 5vw, 30px);
  line-height: 1.15;
}

h3,
h4 {
  font-size: 19px;
  letter-spacing: -0.02em;
  line-height: 1.25;
}

h2:focus,
h3:focus {
  outline: none;
}

.lead {
  margin: 16px auto 0;
  max-width: 640px;
  font-size: clamp(17px, 2.6vw, 21px);
  color: var(--text-2);
}

/* ---------- Karten ---------- */

.card {
  background: var(--surface);
  border-radius: var(--radius-card);
  padding: 40px;
}

.card + .card {
  margin-top: 16px;
}

.section-title {
  margin-bottom: 6px;
}

.section-sub {
  margin: 0 0 24px;
  font-size: 15px;
  color: var(--text-2);
}

/* Übergang zwischen den Ansichten */
.stage-enter {
  animation: stageIn 0.4s var(--ease) both;
}

.stage-leave {
  animation: stageOut 0.18s var(--ease) both;
}

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

@keyframes stageOut {
  from { opacity: 1; transform: none; }
  to   { opacity: 0; transform: translateY(-8px); }
}

/* ---------- Startansicht ---------- */

.steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin: 20px 0 32px;
  padding: 0;
  list-style: none;
}

.steps li {
  display: flex;
  gap: 12px;
  padding: 18px;
  background: var(--bg);
  border-radius: var(--radius-item);
}

.steps strong {
  display: block;
  font-size: 16px;
  letter-spacing: -0.01em;
}

.steps span:not(.step-num) {
  display: block;
  margin-top: 2px;
  font-size: 14px;
  line-height: 1.4;
  color: var(--text-2);
}

.step-num {
  flex: none;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
  line-height: 26px;
  text-align: center;
}

.start-cta {
  text-align: center;
}

.start-hint {
  margin: 12px 0 0;
  font-size: 14px;
  color: var(--text-3);
}

.note {
  margin: 28px 0 0;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  font-size: 13px;
  color: var(--text-2);
  text-align: center;
}

/* ---------- Auswahlfelder (Vorauswahl & Antworten) ---------- */

.field {
  margin: 0 0 28px;
  padding: 0;
  border: 0;
  min-width: 0;
}

.field legend {
  margin-bottom: 12px;
  padding: 0;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.legend-sub {
  margin-left: 6px;
  font-size: 14px;
  font-weight: 400;
  color: var(--text-3);
}

.choice-grid {
  display: grid;
  gap: 10px;
}

.choice-grid--2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.choice-grid--4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.choice-list {
  display: grid;
  gap: 10px;
  margin: 28px 0 0;
  padding: 0;
  border: 0;
  min-width: 0;
}

.choice {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 15px 18px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-item);
  cursor: pointer;
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}

.choice:hover {
  border-color: var(--text-3);
}

/* Native Eingabefelder visuell ersetzen, aber zugänglich lassen */
.choice input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  margin: 0;
}

.choice-mark {
  flex: none;
  width: 20px;
  height: 20px;
  border: 1.5px solid var(--line);
  border-radius: 50%;
  background: var(--bg);
  transition: border-color 0.2s var(--ease), border-width 0.2s var(--ease), background-color 0.2s var(--ease);
}

.choice--checkbox .choice-mark {
  position: relative;
  border-radius: 6px;
}

.choice-text {
  min-width: 0;
}

.choice-title {
  display: block;
  font-weight: 600;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.choice-desc {
  display: block;
  margin-top: 2px;
  font-size: 14px;
  line-height: 1.4;
  color: var(--text-2);
}

.choice.is-selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}

.choice--radio.is-selected .choice-mark {
  border-color: var(--accent);
  border-width: 6px;
}

.choice--checkbox.is-selected .choice-mark {
  border-color: var(--accent);
  background: var(--accent);
}

/* Häkchen der Checkbox */
.choice--checkbox.is-selected .choice-mark::after {
  content: "";
  position: absolute;
  left: 5.5px;
  top: 2px;
  width: 5px;
  height: 10px;
  border: solid #ffffff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.choice input:focus-visible ~ .choice-mark {
  outline: 3px solid rgba(0, 113, 227, 0.35);
  outline-offset: 2px;
}

/* Größe: kompakte, zentrierte Felder */
.choice-grid--4 .choice {
  justify-content: center;
  padding: 13px 10px;
}

.choice-grid--4 .choice-mark {
  display: none;
}

.choice-grid--4 .choice input:focus-visible ~ .choice-text {
  outline: 3px solid rgba(0, 113, 227, 0.35);
  outline-offset: 4px;
  border-radius: 4px;
}

.field-error {
  margin: 10px 0 0;
  font-size: 14px;
  color: var(--high);
}

.setup-status {
  margin: 12px 0 0;
  min-height: 1em;
  font-size: 14px;
  color: var(--text-3);
  text-align: right;
}

/* ---------- Fortschritt ---------- */

.progress {
  margin-bottom: 16px;
}

.progress.is-hidden {
  display: none;
}

.progress-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 2px 16px;
  margin-bottom: 8px;
  font-size: 14px;
}

.progress-label {
  font-weight: 600;
}

.progress-area {
  color: var(--text-2);
}

.progress-track {
  height: 4px;
  border-radius: var(--radius-pill);
  background: var(--line);
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: var(--accent);
  transition: width 0.45s var(--ease);
}

/* ---------- Anforderung ---------- */

.question-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
  margin-bottom: 14px;
}

.ref {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--text-3);
}

.question-risk {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 8px;
  font-size: 13px;
  color: var(--text-2);
}

.question-title {
  font-size: clamp(21px, 4.2vw, 28px);
  line-height: 1.2;
}

.question-hint {
  margin: 12px 0 0;
  font-size: 15px;
  color: var(--text-2);
}

.adj {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-2);
  white-space: nowrap;
}

/* ---------- Buttons ---------- */

.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 32px;
}

.actions-right {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-left: auto;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 44px;
  padding: 11px 24px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--accent);
  font: inherit;
  font-size: 17px;
  font-weight: 500;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.2s var(--ease), color 0.2s var(--ease), opacity 0.2s var(--ease), border-color 0.2s var(--ease);
}

.btn:focus-visible,
.btn-inline:focus-visible {
  outline: 3px solid rgba(0, 113, 227, 0.35);
  outline-offset: 2px;
}

.btn-primary {
  background: var(--accent);
  color: #ffffff;
}

.btn-primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.btn-primary:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.btn-secondary {
  background: transparent;
  color: var(--accent);
}

.btn-secondary:hover {
  background: var(--accent-soft);
}

/* "Zurück" / "Neu beginnen" als ruhiger Textlink */
.btn-link {
  border-color: transparent;
  background: transparent;
  color: var(--accent);
  padding-left: 4px;
  padding-right: 4px;
}

.btn-link:hover {
  text-decoration: underline;
}

.actions > .btn-primary {
  margin-left: auto;
}

.btn-large {
  min-height: 50px;
  padding: 14px 32px;
}

.btn-inline {
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  color: var(--accent);
  cursor: pointer;
  border-radius: 4px;
}

.btn-inline:hover {
  text-decoration: underline;
}

/* ---------- Risiko-Badges und Status ---------- */

/*
 * Badge = Balkensymbol (1–3 gefüllte Balken) + Klartext. Dadurch bleibt die
 * Stufe auch ohne Farbe (Schwarz-Weiß-Druck, Farbsehschwäche) eindeutig.
 */
.risk {
  --risk: var(--text-3);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px 3px 8px;
  border: 1px solid var(--risk);
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.35;
  letter-spacing: 0.01em;
  color: var(--text);
  white-space: nowrap;
}

.risk--high {
  --risk: var(--high);
  background: var(--high);
  color: #ffffff;
}

.risk--medium {
  --risk: var(--medium);
  background: var(--medium-soft);
}

.risk--low {
  --risk: var(--low);
  background: var(--bg);
}

.risk-bars {
  display: inline-flex;
  align-items: flex-end;
  gap: 1.5px;
  height: 10px;
}

.risk-bars i {
  display: block;
  width: 3px;
  border-radius: 1px;
  background: var(--risk);
  opacity: 0.28;
}

.risk-bars i:nth-child(1) { height: 4px; }
.risk-bars i:nth-child(2) { height: 7px; }
.risk-bars i:nth-child(3) { height: 10px; }

.risk--high .risk-bars i {
  background: #ffffff;
  opacity: 1;
}

.risk--medium .risk-bars i:nth-child(-n+2),
.risk--low .risk-bars i:nth-child(1) {
  opacity: 1;
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  background: var(--bg);
  border: 1px solid var(--line);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.35;
  color: var(--text-2);
  white-space: nowrap;
}

/* Statussymbol: voll = offen, halb = in Arbeit, Häkchen = erfüllt */
.status::before {
  content: "";
  flex: none;
  width: 8px;
  height: 8px;
  border: 1.5px solid currentColor;
  border-radius: 50%;
}

.status--open {
  color: var(--text);
}

.status--open::before {
  background: currentColor;
}

.status--progress::before {
  background: linear-gradient(90deg, currentColor 50%, transparent 50%);
}

.status--done {
  color: var(--green);
  border-color: rgba(26, 127, 55, 0.35);
}

.status--done::before {
  width: 4px;
  height: 8px;
  margin: 0 2px 2px;
  border-width: 0 2px 2px 0;
  border-radius: 0;
  transform: rotate(45deg);
}

/* ---------- Ergebnis: Zusammenfassung ---------- */

.report-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 4px 16px;
  margin: 0 0 12px;
  padding: 0 4px;
  font-size: 14px;
  color: var(--text-2);
}

.tone--green  { --tone: var(--green); }
.tone--orange { --tone: var(--medium); }
.tone--red    { --tone: var(--high); }

.summary {
  display: grid;
  grid-template-columns: 172px 1fr;
  align-items: center;
  gap: 32px;
}

.ring {
  position: relative;
  width: 172px;
  height: 172px;
}

.ring svg {
  display: block;
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.ring-track {
  fill: none;
  stroke: var(--track);
  stroke-width: 10;
}

.ring-value {
  fill: none;
  stroke: var(--tone, var(--accent));
  stroke-width: 10;
  stroke-linecap: round;
  transition: stroke-dashoffset 1s var(--ease);
}

.ring-label {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.score-number {
  font-size: 54px;
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.score-pct {
  margin-left: 2px;
  font-size: 0.5em;
  letter-spacing: 0;
}

.score-unit {
  margin-top: 6px;
  font-size: 12px;
  color: var(--text-2);
}

.badge {
  display: inline-block;
  padding: 5px 12px;
  border-radius: var(--radius-pill);
  background: var(--bg);
  border: 1px solid var(--tone);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.3;
  color: var(--text);
}

.summary-title {
  margin-top: 12px;
  font-size: clamp(21px, 4vw, 26px);
  line-height: 1.2;
}

.summary-text {
  margin: 10px 0 0;
  color: var(--text-2);
}

.summary-points {
  margin: 8px 0 0;
  font-size: 14px;
  color: var(--text-3);
}

/* Zähler je Risikostufe */
.tiles {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 28px 0 0;
  padding: 0;
  list-style: none;
}

.tile {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  padding: 16px;
  background: var(--bg);
  border-radius: var(--radius-item);
}

.tile-num {
  font-size: 34px;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.tile--high .tile-num   { color: var(--high); }
.tile--medium .tile-num { color: var(--medium); }
.tile--low .tile-num    { color: var(--low); }
.tile--done .tile-num   { color: var(--green); }
.tile.is-zero .tile-num { color: var(--text-3); }

/* Werte je Rahmenwerk */
.fw-bars {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px 24px;
  margin: 24px 0 0;
  padding: 0;
  list-style: none;
}

.fw-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
  font-size: 15px;
  font-weight: 600;
}

.fw-value {
  font-variant-numeric: tabular-nums;
}

.bar-track {
  height: 8px;
  border-radius: var(--radius-pill);
  background: var(--track);
  overflow: hidden;
}

.bar-fill {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--tone, var(--accent));
  transition: width 0.9s var(--ease);
}

.summary-context {
  margin: 24px 0 0;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  font-size: 14px;
  color: var(--text-2);
}

/* ---------- Ergebnis: Gewichtungshinweis ---------- */

.adj-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.adj-list li + li {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.adj-note {
  margin: 0;
  font-size: 15px;
}

.adj-affected {
  margin: 4px 0 0;
  font-size: 14px;
  color: var(--text-2);
}

/* ---------- Ergebnis: Lückenkatalog ---------- */

.gap-group + .gap-group {
  margin-top: 28px;
}

.gap-group-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 12px;
  font-size: 15px;
  letter-spacing: -0.01em;
}

.gap-group-count {
  font-weight: 400;
  color: var(--text-3);
}

.gaps {
  margin: 0;
  padding: 0;
  list-style: none;
}

.gap {
  --risk: var(--line);
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 16px;
  padding: 20px 20px 20px 18px;
  background: var(--bg);
  border-radius: var(--radius-item);
  box-shadow: inset 3px 0 0 var(--risk);
}

.gap + .gap {
  margin-top: 10px;
}

.gap--high   { --risk: var(--high); }
.gap--medium { --risk: var(--medium); }
.gap--low    { --risk: var(--low); }

.gap-side {
  padding-top: 1px;
}

.gap-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px 16px;
}

.gap-title {
  min-width: 0;
  font-size: 17px;
  line-height: 1.3;
  -webkit-hyphens: auto;
  hyphens: auto;
  overflow-wrap: break-word;
}

.gap-num {
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
}

.gap-ref {
  margin: 4px 0 0;
  font-size: 13px;
  color: var(--text-3);
}

.gap-measure,
.gap-evidence {
  margin: 10px 0 0;
  font-size: 15px;
  line-height: 1.5;
}

.gap-evidence {
  margin-top: 6px;
  color: var(--text-2);
}

.gap-measure strong,
.gap-evidence strong {
  font-weight: 600;
  color: var(--text);
}

.all-done {
  margin: 0;
  padding: 18px 20px;
  background: var(--green-soft);
  border-radius: var(--radius-item);
}

/* ---------- Ergebnis: Erledigt (einklappbar) ---------- */

.done-details summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  list-style: none;
  cursor: pointer;
}

.done-details summary::-webkit-details-marker {
  display: none;
}

.done-details summary .section-title {
  margin: 0;
}

/* Pfeil zum Auf-/Zuklappen */
.done-details summary::after {
  content: "";
  flex: none;
  width: 9px;
  height: 9px;
  margin-right: 4px;
  border: solid var(--text-2);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg) translateY(-3px);
  transition: transform 0.2s var(--ease);
}

.done-details[open] summary::after {
  transform: rotate(-135deg) translateY(-3px);
}

.done-details summary:focus-visible {
  outline: 3px solid rgba(0, 113, 227, 0.35);
  outline-offset: 6px;
  border-radius: 6px;
}

.done-count {
  margin-left: 6px;
  font-size: 15px;
  font-weight: 400;
  letter-spacing: 0;
  color: var(--text-2);
}

.done-list {
  margin: 16px 0 0;
  padding: 0;
  list-style: none;
}

.done-list li {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr) auto;
  align-items: baseline;
  gap: 4px 12px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
  font-size: 15px;
}

.done-check {
  position: relative;
  top: 1px;
  width: 6px;
  height: 11px;
  margin-left: 6px;
  border: solid var(--green);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.done-ref {
  font-size: 13px;
  color: var(--text-3);
  text-align: right;
}

/* ---------- Ergebnis: nächste Schritte ---------- */

.card--next .btn-large {
  margin-top: 4px;
}

.next-divider {
  height: 1px;
  margin: 28px 0 24px;
  background: var(--line);
}

.company-field {
  display: block;
}

.company-field span {
  display: block;
  margin-bottom: 8px;
  font-size: 14px;
  color: var(--text-2);
}

.company-field input {
  width: 100%;
  max-width: 420px;
  min-height: 44px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg);
  font: inherit;
  color: var(--text);
}

.company-field input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.2);
}

.actions-result {
  justify-content: flex-start;
  margin-top: 20px;
}

.disclaimer {
  margin: 16px 0 0;
  padding: 16px 20px;
  background: var(--surface);
  border-radius: var(--radius-item);
  font-size: 14px;
  color: var(--text-2);
}

.disclaimer strong {
  color: var(--text);
}

/* ---------- Datenschutz-Hinweis ---------- */

.trust {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  max-width: 560px;
  margin: 32px auto 0;
  font-size: 13px;
  color: var(--text-3);
  text-align: center;
}

.trust-icon {
  flex: none;
  width: 16px;
  height: 16px;
  fill: var(--green);
}

/* Druckelemente auf dem Bildschirm ausblenden */
.print-header,
.print-closing {
  display: none;
}

@media (prefers-reduced-motion: reduce) {
  .stage-enter,
  .stage-leave {
    animation: none;
  }
  .progress-bar,
  .ring-value,
  .bar-fill {
    transition: none;
  }
}

/* ---------- Kleine Bildschirme ---------- */

@media screen and (max-width: 680px) {
  .page {
    padding-top: 40px;
  }

  .intro {
    margin-bottom: 28px;
  }

  .card {
    padding: 28px 20px;
  }

  .steps {
    grid-template-columns: 1fr;
  }

  .choice-grid--2 {
    grid-template-columns: 1fr;
  }

  .choice-grid--4,
  .tiles,
  .fw-bars {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .choice {
    padding: 14px;
    gap: 12px;
  }

  .summary {
    grid-template-columns: 1fr;
    justify-items: center;
    gap: 20px;
    text-align: center;
  }

  .ring {
    width: 156px;
    height: 156px;
  }

  .score-number {
    font-size: 48px;
  }

  .gap {
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
    padding: 16px 16px 16px 18px;
  }

  /* Status oben rechts in einer Zeile mit dem Risiko-Badge */
  .gap {
    position: relative;
  }

  .gap-head .status {
    position: absolute;
    top: 16px;
    right: 16px;
  }

  .gap-side {
    padding-top: 0;
  }

  .done-list li {
    grid-template-columns: 20px minmax(0, 1fr);
  }

  .done-ref {
    grid-column: 2;
    text-align: left;
  }
}

@media screen and (max-width: 420px) {
  .fw-bars {
    grid-template-columns: 1fr;
  }

  /* Fragebogen & Vorauswahl: "Weiter" oben, "Zurück" darunter */
  .actions:not(.actions-result) {
    flex-direction: column-reverse;
    align-items: stretch;
  }

  .actions-right {
    flex-direction: column-reverse;
    margin-left: 0;
  }

  .actions > .btn-primary {
    margin-left: 0;
  }

  .actions-result .btn,
  .card--next .btn-large {
    width: 100%;
  }

  .setup-status {
    text-align: center;
  }
}

/* ==========================================================================
   Druck-Layout ("Als PDF speichern")
   A4-Bericht: Kopf mit Titel, Unternehmen und Datum, Zusammenfassung,
   Lückenkatalog nach Priorität. Bedienelemente ausgeblendet.
   Risikostufen sind zusätzlich über Balkensymbol, Schraffur und
   Linienart erkennbar, falls in Schwarz-Weiß gedruckt wird.
   ========================================================================== */

/* Fußzeile in den Seitenrändern: wiederholt sich auf jeder Seite,
   ohne Inhalte zu überdecken (Chrome, Edge, Brave; andere Browser
   zeigen stattdessen die Abschlusszeile .print-closing). */
@page {
  size: A4;
  margin: 16mm 15mm 18mm;

  @bottom-left {
    content: "Erstellt mit boecker-advisory.de";
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
    font-size: 8pt;
    color: #86868b;
  }

  @bottom-right {
    content: "Seite " counter(page) " von " counter(pages);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
    font-size: 8pt;
    color: #86868b;
  }
}

@media print {
  :root {
    --surface: #ffffff;
  }

  * {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  body {
    font-size: 10pt;
    line-height: 1.38;
  }

  .page {
    max-width: none;
    padding: 0;
  }

  /* Bedienelemente und Bildschirm-Kopf ausblenden */
  .intro,
  .progress,
  .no-print,
  .actions,
  .report-meta,
  .trust,
  .done-details summary::after {
    display: none !important;
  }

  .stage-enter,
  .stage-leave {
    animation: none !important;
  }

  .ring-value,
  .bar-fill {
    transition: none !important;
  }

  /* Kopf */
  .print-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 14px;
    padding-bottom: 10px;
    border-bottom: 1.5pt solid var(--text);
  }

  .print-title {
    font-size: 18pt;
    font-weight: 700;
    letter-spacing: -0.03em;
    line-height: 1.1;
  }

  .print-context {
    margin-top: 3px;
    font-size: 9pt;
    color: var(--text-2);
  }

  .print-meta {
    text-align: right;
  }

  .print-company {
    font-size: 11pt;
    font-weight: 700;
    letter-spacing: -0.01em;
  }

  .print-date {
    font-size: 9pt;
    color: var(--text-2);
  }

  .print-closing {
    display: block;
    margin: 8px 0 0;
    font-size: 8pt;
    color: var(--text-3);
    text-align: right;
  }

  /* Kontext steht bereits im Kopf */
  .summary-context {
    display: none;
  }

  /* Karten: weiß mit feiner Linie statt grauer Fläche (tonersparend) */
  .card {
    padding: 12px 16px;
    border: 0.75pt solid var(--line);
    border-radius: 10px;
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .card + .card {
    margin-top: 10px;
  }

  /* Lange Abschnitte dürfen umbrechen, einzelne Einträge nicht.
     Der Katalog verzichtet auf den äußeren Rahmen, damit über
     Seitenumbrüche keine offenen Linien entstehen. */
  .card--catalog,
  .card--done {
    break-inside: auto;
    page-break-inside: auto;
  }

  /* Rahmen auf jeder Seite schließen, wenn eine Karte umbricht */
  .card--done {
    -webkit-box-decoration-break: clone;
    box-decoration-break: clone;
  }

  .card--catalog {
    margin-top: 16px !important;
    padding: 0;
    border: 0;
  }

  .section-title {
    font-size: 12.5pt;
    break-after: avoid;
    page-break-after: avoid;
  }

  .section-sub {
    margin: 2px 0 10px;
    font-size: 8.5pt;
  }

  /* Zusammenfassung */
  .summary {
    grid-template-columns: 30mm 1fr;
    gap: 16px;
  }

  .ring {
    width: 30mm;
    height: 30mm;
  }

  .score-number {
    font-size: 24pt;
  }

  .score-unit {
    margin-top: 2px;
    font-size: 6.5pt;
  }

  .badge {
    padding: 2px 9px;
    font-size: 8.5pt;
  }

  .summary-title {
    margin-top: 6px;
    font-size: 14pt;
  }

  .summary-text {
    margin-top: 4px;
    font-size: 9.5pt;
  }

  .summary-points {
    margin-top: 3px;
    font-size: 8.5pt;
  }

  .tiles {
    gap: 8px;
    margin-top: 12px;
  }

  .tile {
    gap: 5px;
    padding: 8px 10px;
    border: 0.75pt solid var(--line);
    border-radius: 8px;
  }

  .tile-num {
    font-size: 18pt;
  }

  .fw-bars {
    gap: 8px 20px;
    margin-top: 12px;
  }

  .fw-head {
    margin-bottom: 3px;
    font-size: 9.5pt;
  }

  .bar-track {
    height: 6px;
    border: 0.5pt solid var(--text-3);
    background: #ffffff;
  }

  .summary-context {
    margin-top: 12px;
    padding-top: 8px;
    font-size: 8.5pt;
  }

  /* Gewichtungshinweis */
  .adj-list li + li {
    margin-top: 6px;
    padding-top: 6px;
  }

  .adj-note {
    font-size: 9pt;
  }

  .adj-affected {
    font-size: 8.5pt;
  }

  /* Risiko-Badges: High dunkel gefüllt, Medium schraffiert, Low nur Umriss */
  .risk {
    font-size: 8pt;
    padding: 1px 8px 1px 6px;
  }

  .risk--medium {
    background: repeating-linear-gradient(-45deg, var(--medium-soft) 0 3px, rgba(230, 138, 0, 0.38) 3px 4.5px);
  }

  .risk--low {
    border-style: dashed;
  }

  .status {
    font-size: 8pt;
    padding: 1px 8px;
  }

  /* Lückenkatalog */
  .gap-group + .gap-group {
    margin-top: 12px;
  }

  .gap-group-head {
    margin-bottom: 6px;
    font-size: 10.5pt;
    break-after: avoid;
    page-break-after: avoid;
  }

  .gap {
    grid-template-columns: 22mm minmax(0, 1fr);
    gap: 10px;
    padding: 8px 12px 8px 10px;
    border: 0.75pt solid var(--line);
    border-left: 3pt solid var(--risk);
    border-radius: 6px;
    box-shadow: none;
    break-inside: avoid;
    page-break-inside: avoid;
  }

  /* Linienart als zweites Merkmal neben der Farbe */
  .gap--medium {
    border-left-style: double;
    border-left-width: 4pt;
  }

  .gap--low {
    border-left-style: dashed;
  }

  .gap + .gap {
    margin-top: 6px;
  }

  .gap-title {
    font-size: 10.5pt;
  }

  .gap-ref {
    margin-top: 1px;
    font-size: 8pt;
  }

  .gap-measure,
  .gap-evidence {
    margin-top: 4px;
    font-size: 9pt;
    line-height: 1.4;
  }

  .gap-evidence {
    margin-top: 3px;
  }

  .all-done {
    padding: 8px 12px;
    border: 0.75pt solid var(--green);
    font-size: 9.5pt;
  }

  /* Erledigt: im Druck immer vollständig */
  .done-count {
    font-size: 9.5pt;
  }

  .done-list {
    margin-top: 6px;
  }

  .done-list li {
    padding: 4px 0;
    font-size: 9pt;
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .done-check {
    height: 9px;
    width: 5px;
  }

  .done-ref {
    font-size: 8pt;
  }

  .disclaimer {
    margin-top: 10px;
    padding: 8px 12px;
    border: 0.75pt solid var(--line);
    font-size: 8.5pt;
    break-inside: avoid;
    page-break-inside: avoid;
  }

  a {
    color: inherit;
    text-decoration: none;
  }
}
