/* Nur für /werkzeuge/nachlassverzeichnis/. Farben nur über --marke-… aus tokens.css. */
.nv [hidden] { display: none !important; }
.nv:not(.nv-js) .nv-nurjs { display: none !important; }
/* „Nachlassverzeichnis“ ist auf dem Handy breiter als die Zeile: Silbentrennung statt Querscrollen */
.artikel-kopf h1, .nv h2, .nv h3 { -webkit-hyphens: auto; hyphens: auto; overflow-wrap: break-word; }
.nv-unsichtbar { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

.nv-einstieg { margin-bottom: 40px; }
.nv-datenschutz p { font-size: 18px; }

/* Das Blatt */
.nv-blatt { max-width: 1040px; border-top: 3px solid var(--marke-text); padding-top: 28px; }
.nv-druckkopf, .nv-unterschrift { display: none; }
.nv-kopf { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px 24px; margin-top: 24px; }
.nv-kopf .nv-druck { display: none; }
.nv-lesehilfe { margin-top: 16px; font-size: 17px; }

.nv-seite { margin-top: 48px; }
.nv-seite-titel { font-size: 1.55rem; padding-bottom: 8px; border-bottom: 2px solid var(--marke-text); }
.nv-abschnitt { margin-top: 32px; }
.nv-abschnitt h3 { margin-bottom: 6px; }
.nv-abschnitt-hinweis { font-size: 17px; line-height: 1.5; color: var(--marke-text-2); max-width: 68ch; }

.nv-tabelle { width: 100%; border-collapse: collapse; margin-top: 12px; table-layout: fixed; }
.nv-tabelle th, .nv-tabelle td { text-align: left; vertical-align: top; padding: 6px 10px 6px 0; }
.nv-tabelle thead th { font-size: 15px; font-weight: 700; color: var(--marke-text-2); border-bottom: 2px solid var(--marke-text); padding-bottom: 8px; line-height: 1.3; }
.nv-tabelle thead th:nth-child(1) { width: 26%; }
.nv-tabelle thead th.nv-zahl { width: 180px; }
.nv-tabelle thead th.nv-bezug { width: 150px; }
.nv-tabelle thead th.nv-weg-zelle { width: 112px; }
.nv-tabelle tbody tr { border-bottom: 1px solid var(--marke-linie); }
.nv-tabelle tfoot th, .nv-tabelle tfoot td { padding-top: 10px; font-weight: 700; font-size: 18px; }
.nv-tabelle tfoot tr:last-child th, .nv-tabelle tfoot tr:last-child td { border-top: 2px solid var(--marke-text); }
.nv-tabelle tfoot th { text-align: right; padding-right: 16px; }
.nv-ausserhalb th, .nv-ausserhalb td { font-weight: 400 !important; color: var(--marke-text-2); font-size: 16px !important; }
.nv-zahl { text-align: right !important; }
.nv-tabelle input[type=text] { font-size: 17px; min-height: 46px; padding: 8px 10px; border-width: 1px; }
.nv-zahl input { text-align: right; font-variant-numeric: tabular-nums; }
.nv-tabelle output, .nv-bilanz output { font-variant-numeric: tabular-nums; white-space: nowrap; }
.nv-druck { display: none; }
.nv-feld[aria-invalid] { border-color: var(--marke-fehler); border-width: 2px; }
.nv-feldfehler { display: block; margin-top: 4px; font-size: 15px; line-height: 1.3; color: var(--marke-fehler); text-align: left; }
.nv-haken { display: inline-flex; align-items: center; gap: 10px; min-height: 46px; cursor: pointer; font-size: 17px; }
.nv-haken input { width: 24px; height: 24px; min-height: 0; margin: 0; padding: 0; accent-color: var(--marke-haupt); }
.nv-weg { min-height: 46px; padding: 0 12px; font: 400 16px/1 var(--marke-lauf); color: var(--marke-haupt); background: none; border: 1px solid var(--marke-linie); border-radius: var(--marke-radius); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.nv-weg:hover { border-color: var(--marke-haupt); }
.nv-dazu { margin-top: 12px; min-height: 48px; font-size: 17px; border: 2px solid var(--marke-haupt); }

/* Zusammenfassung */
.nv-ergebnis { margin-top: 56px; background: var(--marke-flaeche); border-radius: var(--marke-radius); padding: 28px; display: grid; gap: 16px; }
.nv-bilanz { width: 100%; border-collapse: collapse; }
.nv-bilanz th { text-align: left; font-weight: 400; padding: 10px 16px 10px 0; line-height: 1.4; }
.nv-bilanz td { padding: 10px 0; vertical-align: top; font-weight: 700; width: 200px; }
.nv-bilanz tr + tr th, .nv-bilanz tr + tr td { border-top: 1px solid var(--marke-linie); }
.nv-bilanz .nv-saldo th, .nv-bilanz .nv-saldo td { border-top: 3px solid var(--marke-text); font-weight: 700; font-size: 21px; }
.nv-bilanz-zusatz th, .nv-bilanz-zusatz td { font-size: 17px; color: var(--marke-text-2); }
.nv-bilanz-zusatz { margin-top: 8px; }
.nv-negativ { background: var(--marke-grund); }
.nv-fehlerhinweis { color: var(--marke-fehler); font-weight: 700; }
.nv-hinweis { font-size: 17px; }
.nv-knoepfe { display: flex; flex-wrap: wrap; gap: 16px; }
.nv-knoepfe .knopf-hell { border: 2px solid var(--marke-haupt); }
.nv-dateihinweis { font-size: 16px; }
.nv-meldung { font-weight: 700; }
.nv-meldung:empty { display: none; }

.nv-erklaerung { margin-top: 64px; }
.nv-erklaerung ul li { font-size: 18px; }

/* Handy: jede Zeile als Block, Beschriftung über dem Feld */
@media (max-width: 700px) {
  .nv-kopf { grid-template-columns: minmax(0, 1fr); }
  .nv-tabelle, .nv-tabelle tbody, .nv-tabelle tfoot, .nv-tabelle tr, .nv-tabelle td, .nv-tabelle tfoot th { display: block; width: 100%; }
  .nv-tabelle { table-layout: auto; }
  .nv-tabelle thead { display: none; } /* Jedes Feld hat ein aria-label, die Beschriftung steht sichtbar über dem Feld */
  .nv-tabelle tbody tr { border-bottom: 0; border-top: 2px solid var(--marke-text); padding: 10px 0 12px; }
  .nv-tabelle td { padding: 4px 0; }
  .nv-tabelle td[data-label]::before { content: attr(data-label); display: block; font-size: 15px; font-weight: 700; color: var(--marke-text-2); margin-bottom: 4px; }
  .nv-tabelle .nv-zahl input { text-align: left; }
  .nv-tabelle tbody .nv-zahl { text-align: left !important; }
  .nv-tabelle tfoot tr { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; border-top: 2px solid var(--marke-text); padding-top: 10px; }
  .nv-tabelle tfoot tr.nv-ausserhalb { border-top: 1px solid var(--marke-linie); }
  .nv-tabelle tfoot th, .nv-tabelle tfoot td { display: block; width: auto; border: 0 !important; padding: 0; text-align: left; }
  .nv-tabelle tfoot td.nv-zahl { flex: 0 0 auto; }
  .nv-tabelle tfoot .nv-weg-zelle { display: none !important; }
  .nv-ergebnis { padding: 20px 16px; }
  .nv-bilanz, .nv-bilanz tbody, .nv-bilanz tr, .nv-bilanz th, .nv-bilanz td { display: block; width: 100%; }
  .nv-bilanz th { padding: 10px 0 2px; }
  .nv-bilanz td { padding: 0 0 10px; border-top: 0 !important; text-align: left !important; }
  .nv-knoepfe .knopf { width: 100%; }
}

/* Drucken: nur das Blatt, A4 hoch */
@media print {
  @page { size: A4; margin: 14mm 13mm 16mm; }
  .kopf, .fuss { display: none !important; }
  /* Alles ausblenden, was weder das Blatt ist, noch es enthält, noch in ihm steht (ohne :has bleibt nur die Regel darüber) */
  body :not(:has(.nv-blatt)):not(.nv-blatt):not(.nv-blatt *) { display: none !important; }
  body :has(.nv-blatt) { display: block !important; margin: 0 !important; padding: 0 !important; max-width: none !important; border: 0 !important; background: none !important; }
  body { background: #fff; color: #111; font-size: 10pt; line-height: 1.35; }
  .nv-blatt { max-width: none; border-top: 0; padding-top: 0; }
  .nv-nurjs, .nv-abschnitt-hinweis, .nv-lesehilfe, .nv-feldfehler, .nv-fehlerhinweis, .nv-meldung, .nv-negativ { display: none !important; }
  .nv-druckkopf { display: flex; justify-content: space-between; gap: 6mm; font: 8pt var(--marke-mono); border-bottom: 0.4mm solid #111; padding-bottom: 2mm; margin-bottom: 4mm; }
  .nv-druckkopf span:first-child { white-space: nowrap; }
  #nv-blatt-titel { font-size: 18pt; }
  .nv-kopf { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 3mm 8mm; margin-top: 4mm; }
  .nv-kopf .feld { gap: 1mm; }
  .nv-kopf label { font-size: 8.5pt; }
  .nv-seite { margin-top: 6mm; }
  .nv-seite-titel { font-size: 13pt; border-bottom-width: 0.5mm; padding-bottom: 1mm; }
  .nv-abschnitt { margin-top: 4mm; break-inside: avoid; }
  .nv-abschnitt h3 { font-size: 11pt; margin-bottom: 1mm; }
  .nv-tabelle { margin-top: 1mm; }
  .nv-tabelle thead th { font-size: 8pt; color: #333; border-bottom: 0.4mm solid #111; padding: 0 2mm 1mm 0; }
  .nv-tabelle thead th.nv-zahl { width: 34mm; }
  .nv-tabelle thead th.nv-bezug { width: 31mm; }
  .nv-tabelle th, .nv-tabelle td { padding: 0.8mm 2mm 0.8mm 0; }
  .nv-tabelle tbody tr { border-bottom: 0; }
  .nv-tabelle tfoot th, .nv-tabelle tfoot td { font-size: 9.5pt; padding-top: 1.5mm; }
  .nv-tabelle tfoot tr:last-child th, .nv-tabelle tfoot tr:last-child td { border-top: 0.4mm solid #111; }
  .nv-ausserhalb th, .nv-ausserhalb td { font-size: 8.5pt !important; }

  /* Ohne JavaScript: Eingabefelder als Schreiblinien */
  .nv-blatt input[type=text], .nv-blatt input[type=date] { border: 0; border-bottom: 0.25mm solid #555; border-radius: 0; background: none; min-height: 6.5mm; height: 6.5mm; padding: 0; font-size: 9.5pt; color: #111; }
  .nv-blatt input::placeholder { color: transparent; }
  .nv-haken { min-height: 6.5mm; font-size: 9pt; }
  .nv-haken input { width: 3.8mm; height: 3.8mm; }
  /* Mit JavaScript: der gespiegelte Text bricht um, statt abgeschnitten zu werden */
  .nv-js .nv-blatt input[type=text], .nv-js .nv-blatt input[type=date] { display: none; }
  .nv-js .nv-druck { display: block !important; min-height: 6.5mm; border-bottom: 0.25mm solid #555; padding-top: 1.2mm; font-size: 9.5pt; overflow-wrap: anywhere; }
  .nv-js .nv-zahl .nv-druck { text-align: right; }

  .nv-ergebnis { margin-top: 6mm; background: none; padding: 0; gap: 2mm; break-inside: avoid; border-top: 0.5mm solid #111; padding-top: 2mm; }
  #nv-ergebnis-titel { font-size: 13pt; }
  .nv-bilanz th, .nv-bilanz td { padding: 1.2mm 0; font-size: 9.5pt; }
  .nv-bilanz td { width: 40mm; text-align: right; border-bottom: 0.25mm solid #555; }
  .nv-bilanz .nv-saldo th, .nv-bilanz .nv-saldo td { font-size: 11pt; border-top-width: 0.5mm; }
  .nv-bilanz-zusatz th, .nv-bilanz-zusatz td { font-size: 8.5pt; color: #333; }
  .nv-hinweis { font-size: 8.5pt; }
  .nv-unterschrift { display: grid; grid-template-columns: 1fr 1fr; gap: 12mm; margin-top: 16mm; font-size: 8.5pt; break-inside: avoid; }
  .nv-unterschrift span { border-top: 0.25mm solid #111; padding-top: 1mm; }
  a { color: #111; text-decoration: none; }
}
