/* Wohnungsgeberbestätigung Generator – clean, trustworthy "official document tool" look */
:root {
  --blue-900: #1e3a5f;
  --blue-700: #2456a6;
  --blue-600: #2f6bd0;
  --blue-50: #eef4fd;
  --gray-900: #1f2937;
  --gray-600: #4b5563;
  --gray-400: #9ca3af;
  --gray-200: #e5e7eb;
  --gray-100: #f3f4f6;
  --red-600: #c0392b;
  --red-50: #fdf0ef;
  --green-700: #1e7e34;
  --radius: 10px;
  --shadow: 0 2px 12px rgba(30, 58, 95, 0.08);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font);
  color: var(--gray-900);
  background: #fff;
  line-height: 1.6;
  font-size: 16px;
}

.container { max-width: 1120px; margin: 0 auto; padding: 0 20px; }
.container.narrow { max-width: 780px; }

.skip-link {
  position: absolute; left: -9999px; top: 0;
  background: var(--blue-900); color: #fff; padding: 8px 16px; z-index: 100;
}
.skip-link:focus { left: 8px; top: 8px; }

/* ---------- Header ---------- */
.site-header {
  background: var(--blue-900);
  color: #fff;
  position: sticky; top: 0; z-index: 50;
  box-shadow: 0 1px 6px rgba(0,0,0,.15);
}
.header-inner {
  display: flex; align-items: center; justify-content: space-between;
  padding-top: 12px; padding-bottom: 12px;
}
.brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; }
.brand-mark {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: 8px;
  background: rgba(255,255,255,.15); font-weight: 700; font-size: 20px;
}
.brand-text { font-weight: 700; font-size: 17px; line-height: 1.2; }
.brand-sub { display: block; font-weight: 400; font-size: 12px; opacity: .8; }
.main-nav { display: flex; gap: 20px; }
.main-nav a { color: #fff; text-decoration: none; font-size: 15px; opacity: .9; }
.main-nav a:hover { opacity: 1; text-decoration: underline; }

/* ---------- Hero / Tool ---------- */
.hero {
  background: linear-gradient(180deg, var(--blue-50) 0%, #fff 320px);
  padding: 40px 0 56px;
}
.hero h1 { font-size: clamp(26px, 4vw, 38px); line-height: 1.25; margin: 0 0 12px; color: var(--blue-900); }
.lead { font-size: 18px; color: var(--gray-600); max-width: 780px; margin: 0 0 16px; }
.privacy-note {
  background: #fff; border: 1px solid var(--gray-200); border-left: 4px solid var(--green-700);
  border-radius: 8px; padding: 12px 16px; font-size: 14.5px; max-width: 780px; margin: 0 0 28px;
  box-shadow: var(--shadow);
}

.tool-grid {
  display: grid; grid-template-columns: 1.05fr .95fr; gap: 32px; align-items: start;
}

/* ---------- Form ---------- */
.tool-form {
  background: #fff; border: 1px solid var(--gray-200); border-radius: var(--radius);
  padding: 24px; box-shadow: var(--shadow);
}
.form-section {
  border: 1px solid var(--gray-200); border-radius: 8px;
  padding: 18px; margin: 0 0 20px;
}
.form-section legend {
  padding: 0 10px; font-weight: 700; color: var(--blue-900); font-size: 16px;
}
.step {
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--blue-700); color: #fff; font-size: 14px; margin-right: 6px;
}
.field { margin-bottom: 14px; }
.field:last-child { margin-bottom: 0; }
.field-row { display: flex; gap: 12px; }
.field-row .grow { flex: 1 1 auto; min-width: 0; }
.field-row .small { flex: 0 0 110px; }
.field label { display: block; font-weight: 600; font-size: 14px; margin-bottom: 6px; }
.req { color: var(--red-600); }
.opt { color: var(--gray-400); font-weight: 400; }
.hint { font-size: 13.5px; color: var(--gray-600); margin: 0 0 12px; }
.field input[type="text"],
.field input[type="date"] {
  width: 100%; padding: 10px 12px; font-size: 15px; font-family: inherit;
  border: 1px solid var(--gray-400); border-radius: 6px; background: #fff;
}
.field input:focus {
  outline: 2px solid var(--blue-600); outline-offset: 0; border-color: var(--blue-600);
}
.field input.invalid { border-color: var(--red-600); background: var(--red-50); }
.field-error { color: var(--red-600); font-size: 13px; margin-top: 4px; }
.field.check { display: flex; align-items: flex-start; gap: 10px; }
.field.check input { width: 20px; height: 20px; margin-top: 2px; accent-color: var(--blue-700); }
.field.check label { font-weight: 500; margin: 0; }

.person-row {
  display: flex; gap: 10px; align-items: flex-end; margin-bottom: 12px;
  padding: 12px; background: var(--gray-100); border-radius: 8px;
}
.person-row .field { flex: 1; margin: 0; min-width: 0; }
.person-row .pnum {
  flex: 0 0 auto; font-weight: 700; color: var(--blue-900);
  width: 28px; height: 42px; display: flex; align-items: center; justify-content: center;
}
.btn-remove {
  flex: 0 0 auto; background: none; border: 1px solid var(--gray-400); color: var(--gray-600);
  border-radius: 6px; width: 42px; height: 42px; cursor: pointer; font-size: 18px; line-height: 1;
}
.btn-remove:hover { border-color: var(--red-600); color: var(--red-600); }

.form-errors {
  background: var(--red-50); border: 1px solid var(--red-600); color: var(--red-600);
  border-radius: 8px; padding: 12px 16px; margin-bottom: 20px; font-size: 14.5px;
}
.form-errors ul { margin: 6px 0 0; padding-left: 20px; }

.form-actions {
  display: flex; flex-wrap: wrap; gap: 10px; margin-top: 4px;
}
.btn {
  font-family: inherit; font-size: 15px; font-weight: 600;
  padding: 12px 20px; border-radius: 8px; cursor: pointer;
  border: 1px solid transparent; transition: background .15s, transform .05s;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--blue-700); color: #fff; flex: 1 1 auto; }
.btn-primary:hover { background: var(--blue-900); }
.btn-primary:disabled { background: var(--gray-400); cursor: wait; }
.btn-secondary { background: #fff; border-color: var(--blue-700); color: var(--blue-700); }
.btn-secondary:hover { background: var(--blue-50); }
.btn-ghost { background: #fff; border-color: var(--gray-400); color: var(--gray-600); }
.btn-ghost:hover { border-color: var(--gray-600); color: var(--gray-900); }
.btn-small { padding: 8px 14px; font-size: 13.5px; }

#sign-pad {
  width: 100%; height: 120px; border: 1px dashed var(--gray-400); border-radius: 6px;
  background: #fff; cursor: crosshair; touch-action: none;
}
.sign-actions { margin-top: 8px; }

/* ---------- Preview ---------- */
.preview-sticky { position: sticky; top: 76px; }
.preview-title { font-size: 18px; color: var(--blue-900); margin: 0 0 10px; }
.preview-hint { margin-top: 10px; }

.document {
  background: #fff; border: 1px solid var(--gray-400); border-radius: 4px;
  box-shadow: var(--shadow); padding: 28px 26px; font-size: 13.5px; line-height: 1.5;
  color: var(--gray-900);
}
.doc-title { text-align: center; margin: 0 0 2px; font-size: 19px; color: var(--blue-900); }
.doc-sub { text-align: center; margin: 0 0 18px; font-size: 12.5px; color: var(--gray-600); }
.doc-box { border: 1px solid var(--gray-400); border-radius: 4px; padding: 10px 12px; margin-bottom: 12px; }
.doc-box h3 { margin: 0 0 6px; font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--blue-900); }
.doc-box p { margin: 2px 0; }
.doc-label { color: var(--gray-600); font-size: 12px; }
.doc-value { font-weight: 600; }
.doc-empty { color: var(--gray-400); font-style: italic; font-weight: 400; }
.doc-persons { margin: 4px 0; padding-left: 22px; }
.doc-persons li { margin-bottom: 2px; }
.doc-note { font-size: 11.5px; color: var(--gray-600); background: var(--gray-100); }
.doc-sign-row { display: flex; gap: 16px; margin-top: 6px; }
.doc-sign-row > div { flex: 1; }
.doc-sign-line { border-top: 1px solid var(--gray-900); margin-top: 34px; padding-top: 4px; font-size: 12px; color: var(--gray-600); }
.doc-sign-img { max-width: 100%; max-height: 60px; display: block; margin-top: 6px; }

/* ---------- Content / FAQ ---------- */
.content { padding: 56px 0; }
.content h2 { color: var(--blue-900); font-size: 24px; margin: 36px 0 12px; }
.content h2:first-child { margin-top: 0; }
.content p { color: var(--gray-600); margin: 0 0 14px; max-width: 70ch; }
.content strong { color: var(--gray-900); }

.faq { background: var(--gray-100); padding: 56px 0; }
.faq h2 { color: var(--blue-900); font-size: 24px; margin: 0 0 20px; }
.faq-item {
  background: #fff; border: 1px solid var(--gray-200); border-radius: 8px;
  margin-bottom: 12px; box-shadow: var(--shadow); overflow: hidden;
}
.faq-item summary {
  cursor: pointer; padding: 16px 20px; font-weight: 600; color: var(--blue-900);
  list-style: none; display: flex; justify-content: space-between; align-items: center; gap: 12px;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after { content: "+"; font-size: 22px; color: var(--blue-600); flex: 0 0 auto; }
.faq-item[open] summary::after { content: "–"; }
.faq-item summary:hover { background: var(--blue-50); }
.faq-item p { padding: 0 20px 18px; margin: 0; color: var(--gray-600); }

/* ---------- Legal pages ---------- */
.legal { padding: 48px 0 64px; }
.legal h1 { color: var(--blue-900); font-size: 30px; margin: 0 0 8px; }
.legal h2 { color: var(--blue-900); font-size: 20px; margin: 30px 0 10px; }
.legal p, .legal li { color: var(--gray-600); max-width: 72ch; }
.placeholder {
  background: #fff8e1; border: 1px dashed #d4a017; border-radius: 4px;
  padding: 1px 6px; font-family: monospace; font-size: .92em; white-space: nowrap;
}
.legal-notice {
  background: var(--blue-50); border: 1px solid var(--blue-600); border-radius: 8px;
  padding: 14px 18px; margin: 20px 0; font-size: 14.5px;
}

/* ---------- Footer ---------- */
.site-footer { background: var(--blue-900); color: #fff; padding: 32px 0; }
.footer-inner { text-align: center; }
.footer-note { font-size: 13px; opacity: .75; max-width: 640px; margin: 0 auto 14px; }
.site-footer nav { display: flex; gap: 24px; justify-content: center; margin-bottom: 12px; }
.site-footer nav a { color: #fff; text-decoration: none; font-size: 14.5px; }
.site-footer nav a:hover { text-decoration: underline; }
.copyright { font-size: 13px; opacity: .6; margin: 0; }

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
  .tool-grid { grid-template-columns: 1fr; }
  .preview-sticky { position: static; }
  .preview-col { order: -1; }
}
@media (max-width: 560px) {
  .tool-form { padding: 16px; }
  .form-section { padding: 14px; }
  .field-row { flex-direction: column; gap: 0; }
  .field-row .small { flex: 1 1 auto; }
  .main-nav { gap: 14px; }
  .main-nav a { font-size: 14px; }
  .form-actions .btn { flex: 1 1 100%; }
  .person-row { flex-wrap: wrap; }
}

/* ---------- Print: nur das Dokument ---------- */
@media print {
  .site-header, .tool-form, .preview-title, .preview-hint, .privacy-note,
  .content, .faq, .site-footer, .skip-link, .hero h1, .hero .lead { display: none !important; }
  .hero { padding: 0; background: none; }
  .tool-grid { display: block; }
  .document { box-shadow: none; border: none; padding: 0; }
  @page { size: A4; margin: 18mm; }
}
