:root {
  --navy: #0d1b2a;
  --blue: #1c4e80;
  --blue-light: #2d6fa8;
  --accent: #e8a020;
  --accent-light: #f0b840;
  --white: #ffffff;
  --gray-50: #f7f9fc;
  --gray-100: #eef1f6;
  --gray-300: #c0c8d4;
  --gray-500: #6b7a8d;
  --gray-700: #3d4c5e;
  --text: #1a2533;
  --radius: 10px;
}

* { box-sizing: border-box; }

body {
  font-family: 'DM Sans', Arial, sans-serif;
  color: var(--text);
  background: var(--gray-50);
  margin: 0;
  line-height: 1.6;
}

.topbar {
  background: var(--navy);
  color: var(--white);
  padding: 1rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.topbar a { color: rgba(255,255,255,0.75); text-decoration: none; font-size: 0.9rem; }
.topbar a:hover { color: var(--white); }
.topbar strong { font-family: Georgia, serif; }
.topbar-logo-chip {
  background: var(--white);
  border-radius: 8px;
  padding: 5px 10px;
  display: inline-flex;
  align-items: center;
}
.topbar-logo-chip img { height: 26px; width: auto; display: block; }

.wrap {
  max-width: 860px;
  margin: 0 auto;
  padding: 2.5rem 1.5rem 4rem;
}

.letterhead {
  margin-bottom: 1.75rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--gray-100);
}
.letterhead-logo { height: 42px; display: block; margin: 0 auto 0.6rem; }
.letterhead-info {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  font-size: 0.8rem;
  color: var(--gray-700);
  line-height: 1.5;
}
.letterhead-meta { margin-top: 0.4rem; font-size: 0.75rem; color: var(--gray-500); }

h1 {
  font-size: 1.5rem;
  color: var(--navy);
  margin-bottom: 0.25rem;
  text-align: center;
}

h2 {
  font-size: 1.1rem;
  color: var(--navy);
  margin: 2rem 0 0.75rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--gray-100);
}
h2:first-of-type { border-top: none; padding-top: 0; margin-top: 1rem; }

.sub { color: var(--gray-500); margin-bottom: 1.5rem; }

/* Login-Seite: schmale Karte, Texte mittig */
.login-wrap { max-width: 680px; }
.login-card { max-width: 420px; margin: 0 auto; }
.login-sub { text-align: center; }
@media (min-width: 700px) { .login-sub { white-space: nowrap; } }
.login-hint { text-align: center; margin-top: 1.5rem; font-size: 0.85rem; }

.card {
  background: var(--white);
  border: 1px solid var(--gray-100);
  border-radius: var(--radius);
  padding: 2rem;
  box-shadow: 0 2px 12px rgba(13,27,42,0.06);
}

.notice {
  background: rgba(28,78,128,0.07);
  border-left: 3px solid var(--blue);
  padding: 1rem 1.25rem;
  border-radius: 0 8px 8px 0;
  margin-bottom: 1.5rem;
  font-size: 0.9rem;
  color: var(--gray-700);
}

.notice.warn { background: rgba(232,160,32,0.12); border-left-color: var(--accent); }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form-group { margin-bottom: 1.1rem; }
.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--gray-700);
  margin-bottom: 0.35rem;
}
.form-group .hint { font-size: 0.78rem; color: var(--gray-500); margin-top: 0.25rem; }

input[type=text], input[type=email], input[type=tel], input[type=date], input[type=password], select {
  width: 100%;
  height: 46px;
  box-sizing: border-box;
  padding: 0.65rem 0.9rem;
  border: 1.5px solid var(--gray-100);
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 0.95rem;
  color: var(--text);
  background: var(--white);
}
input:focus, select:focus { outline: none; border-color: var(--blue-light); box-shadow: 0 0 0 3px rgba(28,78,128,0.1); }

.email-suffix { display: flex; align-items: center; gap: 0.5rem; }
.email-suffix span { color: var(--gray-500); font-size: 0.9rem; white-space: nowrap; }

.date-compound {
  display: flex;
  align-items: stretch;
  height: 46px;
  box-sizing: border-box;
  border: 1.5px solid var(--gray-100);
  border-radius: var(--radius);
  background: var(--white);
  overflow: hidden;
}
.date-compound:focus-within { border-color: var(--blue-light); box-shadow: 0 0 0 3px rgba(28,78,128,0.1); }
.date-compound .date-fixed {
  display: flex;
  align-items: center;
  padding: 0 0 0 0.9rem;
  font-size: 0.95rem;
  color: var(--text);
  white-space: nowrap;
  user-select: none;
}
.date-compound input {
  flex: 1;
  height: 100% !important;
  border: none !important;
  border-radius: 0 !important;
  padding-left: 0.25rem !important;
  box-shadow: none !important;
}
.date-compound input:focus { box-shadow: none !important; }

.check-row { display: flex; align-items: center; gap: 0.6rem; margin-bottom: 0.6rem; font-size: 0.92rem; }
.check-row input { width: auto; }

.price-table { width: 100%; border-collapse: collapse; margin: 1rem 0 1.5rem; font-size: 0.92rem; }
.price-table th, .price-table td { text-align: left; padding: 0.55rem 0.5rem; border-bottom: 1px solid var(--gray-100); }
.price-table th:last-child, .price-table td:last-child { text-align: right; }
.price-table .foot { color: var(--gray-500); font-size: 0.8rem; }

.radio-choice { display: flex; gap: 1rem; margin-bottom: 1.5rem; flex-wrap: wrap; }
.radio-choice label {
  flex: 1; min-width: 220px;
  border: 1.5px solid var(--gray-100);
  border-radius: var(--radius);
  padding: 0.9rem 1.1rem;
  cursor: pointer;
  font-size: 0.9rem;
}
.radio-choice input { margin-right: 0.5rem; }
.radio-choice label:has(input:checked) { border-color: var(--blue); background: rgba(28,78,128,0.05); }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.6rem;
  border-radius: var(--radius);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  font-family: inherit;
  text-decoration: none;
}
.btn-primary { background: var(--accent); color: var(--navy); }
.btn-primary:hover { background: var(--accent-light); }
.btn-outline { background: transparent; color: var(--blue); border: 1.5px solid var(--gray-300); }
.btn-outline:hover { border-color: var(--blue); }

.print-only-break { display: none; }
.print-only { display: none; }

.zusatzbedingungen-text { font-size: 0.9rem; color: var(--gray-700); }

.signature-line {
  margin-top: 2rem;
  padding-top: 2.5rem;
  border-top: 1px solid var(--gray-300);
  font-size: 0.82rem;
  color: var(--gray-500);
}
.signature-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 2rem; }

.legal-text h3 { font-size: 1rem; color: var(--navy); margin: 1.5rem 0 0.5rem; }
.legal-text h4 { font-size: 0.92rem; color: var(--navy); margin: 1rem 0 0.35rem; }
.legal-text p, .legal-text li { font-size: 0.85rem; color: var(--gray-700); margin-bottom: 0.6rem; }
.legal-text ul { padding-left: 1.3rem; margin-bottom: 0.6rem; }
.legal-text { margin-top: 2.5rem; padding-top: 1.5rem; border-top: 1px solid var(--gray-100); }

.actions { display: flex; gap: 1rem; margin: 2rem 0 0; flex-wrap: wrap; }

.portal-links { display: grid; gap: 1rem; margin-top: 1.5rem; }
.portal-link {
  display: block;
  background: var(--white);
  border: 1.5px solid var(--gray-100);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  text-decoration: none;
  color: var(--text);
}
.portal-link:hover { border-color: var(--blue); }
.portal-link strong { display: block; color: var(--navy); margin-bottom: 0.25rem; }
.portal-link span { font-size: 0.85rem; color: var(--gray-500); }

@media (max-width: 640px) {
  .form-row, .signature-grid { grid-template-columns: 1fr; }
  .card { padding: 1.25rem; }
}

@media print {
  .topbar, .actions, .no-print { display: none !important; }
  body { background: var(--white); font-size: 10.5pt; line-height: 1.4; }
  .card { box-shadow: none; border: none; padding: 0; }
  .wrap { max-width: 100%; padding: 0; }
  input, select { border: 1px solid #999; }
  a { color: inherit; text-decoration: none; }

  /* Kompakte Druck-Typografie (Bildschirmgrößen sind für Papier zu groß) */
  .letterhead { margin-bottom: 0.75rem; padding-bottom: 0.5rem; }
  .letterhead-logo { height: 30px; margin-bottom: 0.3rem; }
  .letterhead-info { font-size: 7.5pt; }
  .letterhead-meta { font-size: 7pt; }
  h1 { font-size: 15pt; margin-bottom: 0.2rem; }
  h2 { font-size: 11.5pt; margin: 1rem 0 0.5rem; padding-top: 0.75rem; }
  .sub { font-size: 9pt; margin-bottom: 0.75rem; }
  .notice, .notice.warn {
    font-size: 6.5pt;
    line-height: 1.3;
    padding: 0;
    margin-bottom: 0.3rem;
    background: none;
    border-left: none;
    border-radius: 0;
    text-align: left;
  }
  .form-group { margin-bottom: 0.6rem; }
  .form-group label { font-size: 8.5pt; margin-bottom: 0.15rem; }
  .form-group .hint { font-size: 7.5pt; }
  input[type=text], input[type=email], input[type=tel], input[type=date], input[type=password], select,
  .date-compound { height: 26px; font-size: 9pt; padding: 0.25rem 0.5rem; }
  .date-compound .date-fixed { font-size: 9pt; padding-left: 0.5rem; }
  .email-suffix span { font-size: 8pt; }
  .check-row { font-size: 8.5pt; margin-bottom: 0.3rem; }
  .price-table { font-size: 8.5pt; margin: 0.5rem 0 0.75rem; }
  .price-table th, .price-table td { padding: 0.3rem 0.4rem; }
  .price-table .foot { font-size: 7.5pt; }
  .signature-line { font-size: 6.5pt; line-height: 1.3; margin-top: 0; padding-top: 0; border-top: none; }
  .zusatzbedingungen-text { font-size: 8.5pt; line-height: 1.4; color: var(--gray-700); margin-bottom: 0.35rem; }
  .signature-line.zusatzbedingungen-signature { font-size: 8.5pt; }
  .signature-grid { margin-top: 0.9rem !important; }
  .print-only-break { display: block; }
  .print-only { display: inline; }

  /* Abschnitte nicht mitten durchschneiden */
  h2, h3, h4 { break-after: avoid; }
  .form-row, .form-group, .price-table, .radio-choice, .check-row,
  .signature-line, .signature-grid, .notice, .print-keep-together { break-inside: avoid; }
  .price-table tr { break-inside: avoid; }

  .legal-text h3 { font-size: 10.5pt; margin: 1rem 0 0.4rem; }
  .legal-text p, .legal-text li { font-size: 8.5pt; margin-bottom: 0.35rem; }

  /* AGB kompakter, damit sie auf möglichst wenig Seiten passt (höhere Spezifität, damit es die Regel oben zuverlässig schlägt) */
  .legal-text .agb-full h4 { font-size: 8pt; margin: 0.5rem 0 0.15rem; }
  .legal-text .agb-full p, .legal-text .agb-full li { font-size: 7pt; line-height: 1.3; margin-bottom: 0.25rem; }
  .legal-text .agb-full ul { margin-bottom: 0.25rem; padding-left: 1rem; }

  /* Neue Hauptabschnitte starten auf neuer Seite (wie im Original-PDF) */
  .print-page-break { break-before: page; }
}
