/* Vertrags- und Abo-Kuendigung. Baut auf styles.css auf und fuehrt nur,
   was diese Seite zusaetzlich braucht. */

.kv-form { margin-bottom: 0; }
.kv-abschnitt { margin-top: 30px; }
.kv-optional { font-weight: 400; color: var(--ink-4); }
.kv-sr {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

.kv-wahl { border: 0; margin: 0; padding: 0; display: grid; gap: 10px; }
.kv-option {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 12px 14px; min-height: 44px;
  border: 1px solid var(--line-2); border-radius: var(--radius-sm);
  cursor: pointer; font-size: 14px; color: var(--ink-2);
}
.kv-option:has(input:checked) { border-color: var(--blue); background: var(--blue-tint); }
.kv-option input { margin-top: 3px; flex: none; width: 18px; height: 18px; accent-color: var(--blue); }
.kv-empfohlen {
  display: inline-block; margin-left: 6px; padding: 1px 8px;
  font-size: 11.5px; font-weight: 700; border-radius: 999px;
  background: var(--green-soft); color: var(--green);
}
.kv-unter { margin: 0 0 4px 44px; }
.kv-unter .job-form { margin-top: 4px; }

/* PLZ schmal, Ort breit -- auch auf dem Telefon nebeneinander: eine PLZ
   braucht keine volle Zeile. */
.kv-plz-ort {
  grid-column: 1 / -1;
  display: grid; grid-template-columns: minmax(6.5rem, 9rem) minmax(0, 1fr); gap: 16px 20px;
}

/* Weich einblenden, was erst durch eine Auswahl gebraucht wird. Nur Deckkraft
   und ein kurzer Weg -- keine Hoehenanimation, die das Layout darunter
   springen liesse. */
@keyframes kv-einblenden {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: none; }
}
.kv-eingeblendet { animation: kv-einblenden 180ms ease-out; }
@media (prefers-reduced-motion: reduce) {
  .kv-eingeblendet { animation: none; }
}

.kv-haken { display: grid; gap: 4px; }
.kv-haken label {
  display: flex; gap: 12px; align-items: center; min-height: 44px;
  font-size: 14px; color: var(--ink-2); cursor: pointer;
}
.kv-haken input { width: 18px; height: 18px; flex: none; accent-color: var(--blue); }

.job-field [aria-invalid="true"] { border-color: var(--warn-ink); outline: 2px solid color-mix(in srgb, var(--warn-ink) 25%, transparent); }
.kv-feldfehler { font-size: 12.5px; color: var(--warn-ink); font-weight: 600; }
.kv-fehler {
  margin-top: 20px; padding: 12px 14px;
  border: 1px solid var(--warn-ink); border-radius: var(--radius-sm);
  font-size: 14px; color: var(--warn-ink);
}
.kv-fehler ul { margin: 6px 0 0; padding-left: 20px; }

/* Vorschau: das A4-Blatt aus demselben Plan wie das PDF (a4-vorschau.js,
   Blatt-Stile in styles.css). Bis zum 2026-09-25 ein Textkasten. */
.kv-vorschau-kopf { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin: -4px 0 10px; }
.kv-a4 { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px 8px; }
.kv-warnung { color: var(--warn-ink); margin-top: 10px; }
.kv-ersetzt { margin-top: 10px; }

.kv-schritte { margin: 0 0 14px; padding-left: 22px; display: grid; gap: 10px; font-size: 14.5px; color: var(--ink-2); }

/* Zielgroesse nach Zeigerfaehigkeit, nicht nach Breite: ein iPad im
   Querformat ist breit und trotzdem ein Finger. */
@media (pointer: coarse) {
  .kv-form input[type="text"], .kv-form input[type="email"], .kv-form input[type="date"], .kv-form input[type="tel"],
  .kv-form select { min-height: 44px; }
  /* Unter 16 px zoomt iOS beim Tippen ins Feld. */
  .kv-form input, .kv-form select, .kv-form textarea { font-size: 16px; }
  .tool-actions .btn { min-height: 44px; }
}
@media (max-width: 640px) {
  .kv-unter { margin-left: 0; }
  .tool-actions .btn { flex: 1 1 100%; justify-content: center; }
}

/* ── Unterschrift ── (der Dialog selbst steht in styles.css, geteilt mit dem Geschaeftsbrief-Generator) */
.kv-unterschrift { display: grid; gap: 14px; }
/* Zwei Unterzeichner (Maengelanzeige mit zwei Mietern): je ein Feld mit Namen. */
.kv-sig-slot { display: grid; gap: 8px; }
.kv-sig-slot[hidden] { display: none; }
.kv-sig-wer { font-size: 13px; font-weight: 700; color: var(--ink-2); }
.kv-sig-wer:empty { display: none; }
.kv-sig-stand img[hidden] { display: none; }
.kv-sig-stand img {
  display: block; max-width: 220px; max-height: 70px;
  background: var(--paper); border: 1px dashed var(--line-2); border-radius: var(--radius-sm); padding: 6px;
}





/* ── Export ── */
.kv-export-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; }
.kv-export-knopf {
  display: flex; flex-direction: column; align-items: flex-start; gap: 4px; text-align: left;
  min-height: 72px; padding: 14px 16px; cursor: pointer;
  border: 1px solid var(--line-2); border-radius: var(--radius); background: var(--white); color: var(--ink);
  transition: border-color .2s ease, background-color .2s ease;
}
.kv-export-knopf:hover { border-color: var(--blue); }
.kv-export-knopf:disabled { opacity: .6; cursor: progress; }
.kv-export-haupt { background: var(--blue); border-color: var(--blue); color: var(--white); }
.kv-export-haupt:hover { background: var(--blue-2); }
.kv-export-name { font-weight: 700; font-size: 15px; }
.kv-export-zweck { font-size: 12.5px; opacity: .85; }
.kv-export-status { margin: 12px 0 0; min-height: 1.4em; }
.kv-textknopf {
  border: 0; background: none; padding: 0; min-height: 44px; font: inherit; font-weight: 700;
  color: var(--blue); text-decoration: underline; cursor: pointer;
}
@media (max-width: 760px) {
  .kv-export-grid { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  .kv-export-knopf { transition: none; }
}

/* Kasten "Das gilt beim Kuendigen" auf den Seiten je Vertragsart */
.kv-recht { border-left: 4px solid var(--blue); }
.kv-recht-liste { margin: 0 0 12px; padding-left: 20px; display: grid; gap: 8px; font-size: 14.5px; color: var(--ink-2); }
.kv-recht a { color: var(--blue); }

/* ── Mietkuendigung ── */
.kv-pflicht { border-left-color: var(--warn-ink); }
.kv-pflicht .tool-card-title { color: var(--warn-ink); }
.mk-ergebnis:not(:empty) {
  margin-top: 16px; padding: 14px 16px; border-radius: var(--radius-sm);
  background: var(--blue-tint); border: 1px solid var(--blue-soft); color: var(--ink-2); font-size: 14.5px;
}
.mk-ergebnis p { margin: 0 0 4px; }
.mk-ergebnis .mk-ende { font-weight: 700; font-size: 16px; color: var(--blue-2); }
/* .mk-export-grid folgt seit dem ODT-Knopf dem allgemeinen, passenden Raster. */

/* Aufklappbare Zusatzinformation (z. B. Ausnahmen vom Widerrufsrecht) */
.kv-details { margin: 8px 0 12px; }
.kv-details summary {
  display: flex; align-items: center; min-height: 44px; cursor: pointer; font-weight: 700; color: var(--blue-2);
}
.kv-details summary:focus-visible { outline: 3px solid var(--blue-2); outline-offset: 2px; border-radius: 4px; }

/* ── Arbeitsflaeche: Formular links, Vorschau rechts ──
   Ab 992 px nebeneinander; die Vorschau bleibt stehen, waehrend man durch das
   Formular scrollt -- 16 px unter der Kopfleiste, deren Hoehe brief-ui.js
   misst (--kv-kopf). Darunter untereinander, mit einer Leiste zum Springen. */
@media (min-width: 992px) {
  .kv-arbeit { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr); gap: 32px; align-items: start; margin: 28px 0 40px; }
  .kv-arbeit > .tool-card, .kv-vorschau-spalte > .tool-card { margin: 0; }
  .kv-vorschau-spalte { position: sticky; top: calc(var(--kv-kopf, 108px) + 16px); }
  /* Die Spalte klebt; das Blatt fuellt ihre Hoehe und passt sich ein (fit). */
  .kv-vorschau-spalte .kv-a4 { height: calc(100vh - var(--kv-kopf, 108px) - 190px); min-height: 360px; overflow: auto; }
}
/* Die Leiste Formular/Vorschau steht in styles.css -- der Geschaeftsbrief nutzt sie auch. */

/* ── Merken und Entwurf ── */
.kv-speicher { margin: 18px 0 6px; padding: 10px 14px; border: 1px dashed var(--line-2); border-radius: var(--radius-sm); }
.kv-speicher > label { display: flex; align-items: center; gap: 10px; min-height: 44px; font-weight: 600; }
.kv-speicher .field-hint { margin: 0; }
.kv-speicher-status { margin: 4px 0 0; min-height: 1.2em; font-size: 13px; color: var(--ink-2); }
.kv-entwurf-knoepfe { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0 8px; }
.kv-entwurf-knoepfe button, .kv-dateiknopf {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 14px; border: 1px solid var(--line-2);
  border-radius: var(--radius-sm); background: var(--white); color: var(--ink-2); font: inherit; font-weight: 600; cursor: pointer;
}
.kv-entwurf-knoepfe button:focus-visible { outline: 3px solid var(--blue-2); outline-offset: 2px; }
.kv-entwurf-knoepfe .kv-gefahr { color: #b42318; border-color: #f1b8b3; }

/* ── Druck: nur das Blatt ──
   Strg+P druckt auf jeder Briefseite dasselbe A4-Blatt wie das PDF -- ohne
   Formular, Kopf und Fuss. Die Seite traegt dafuer `druckt-blatt` am <body>
   (styles.css: @page ohne Rand, Kopf/Fuss/Hero ausgeblendet). */
@media print {
  .druckt-blatt main > :not(:has(.a4-blaetter)),
  .druckt-blatt .kv-arbeit > :not(.kv-vorschau-spalte),
  .druckt-blatt .kv-vorschau-spalte > :not(:has(.a4-blaetter)),
  .druckt-blatt .kv-vorschau-spalte .tool-card > :not(.a4-blaetter) { display: none !important; }
  .druckt-blatt .kv-arbeit, .druckt-blatt .kv-vorschau-spalte, .druckt-blatt .kv-vorschau-spalte .tool-card {
    display: block; position: static; margin: 0; padding: 0; border: 0; box-shadow: none; background: none;
  }
  .druckt-blatt .kv-a4 { height: auto; min-height: 0; overflow: visible; padding: 0; border: 0; background: none; }
  /* Nach Stellung statt nach Klassen: im Druck bleibt nur, was die Blaetter
     enthaelt oder in ihnen liegt. Bis zum 2026-09-25 kamen "Herunterladen"
     und "So geht es weiter" als eigene Druckseite hinter den Brief -- sie
     sind Geschwister von .kv-arbeit, und die Regeln oben kannten sie nicht. */
  .druckt-blatt main :not(:has(.a4-blaetter)):not(.a4-blaetter):not(.a4-blaetter *) { display: none !important; }
}
