/* Seite „Tarif und Abo“ (konto/abo.html). Ergänzt konto.css und rechnungen.css (r-optionen, r-meldung).
   Aufbau nach dem Billing-Muster von Untitled UI: Seitenkopf, zwei Karten (Tarif mit Testbalken, Zahlung mit
   Kundenportal), Bereich Tarife mit Umschalter Monat/Jahr und drei Karten, Rechnungen als Tabelle. Bestellübersicht als eigene Ansicht mit Zurück wie datev.html.
   Ruhig nach Untitled UI: keine farbigen Balken, Hervorhebung nur über Rahmen und Chip. */

.ab-seite, .ab-bestellen { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.ab-seite[hidden], .ab-bestellen[hidden] { display: none; }
.ab-seite > .k-titel { margin: 0; }
.ab-fehler { margin: 0; }
.ab-fehler[hidden] { display: none; }

/* ---------- Seitenkopf (Untitled UI: Titel + eine Zeile) ---------- */
.ab-seitenkopf { display: flex; flex-direction: column; gap: 4px; }
.ab-seitenkopf .k-titel { margin: 0; }
.ab-seitenkopf-text { margin: 0; color: var(--text-3); font-size: 15px; line-height: 1.5; }

/* ---------- Oben: Karte Tarif und Karte Zahlung nebeneinander ---------- */
.ab-oben { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: stretch; }
.ab-oben > .k-karte + .k-karte { margin-top: 0; }
.ab-plan, .ab-zahlung { display: flex; flex-direction: column; gap: 0; padding: 0; overflow: hidden; }
.ab-plan-inhalt { display: flex; flex: 1; flex-direction: column; gap: 8px; padding: 20px 24px; min-width: 0; text-align: left; }
.ab-plan-kopf { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 8px 16px; }
.ab-plan-name-zeile { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; min-width: 0; }
.ab-plan-name { margin: 0; color: var(--text); font-size: 17px; font-weight: 600; line-height: 1.4; }
.ab-plan-preis { display: flex; align-items: baseline; gap: 4px; margin: 0; white-space: nowrap; }
.ab-plan-betrag { color: var(--text); font-size: 30px; font-weight: 700; line-height: 1.15; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.ab-plan-zeitraum { color: var(--text-3); font-size: 14px; font-weight: 500; }
.ab-plan-unter, .ab-plan-hinweis { margin: 0; }
.ab-plan-hinweis { color: var(--text-3); font-size: 14px; line-height: 1.45; }
.ab-plan-hinweis[hidden] { display: none; }
.ab-status-warnung { color: var(--error-text) !important; }

.ab-fortschritt { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.ab-fortschritt[hidden] { display: none; }
.ab-fortschritt-text { display: flex; justify-content: space-between; gap: 12px; margin: 0; color: var(--text); font-size: 14px; font-weight: 600; }
.ab-fortschritt-spur { height: 8px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.ab-fortschritt-wert {
  --wert: 0; height: 100%; width: 100%; border-radius: inherit; background: var(--primary);
  transform: scaleX(var(--wert)); transform-origin: left center; transition: transform .4s ease;
}
@media (prefers-reduced-motion: reduce) { .ab-fortschritt-wert { transition: none; } }

.ab-karten-fuss { display: flex; justify-content: flex-end; align-items: center; padding: 12px 24px; border-top: 1px solid var(--border); }
.ab-karten-fuss[hidden] { display: none; }
.ab-fuss-link { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; }
.ab-fuss-link .k-ikon { width: 16px; height: 16px; }

.ab-zahlung-kopf { display: flex; align-items: center; gap: 12px; }
.ab-zahlung-zeilen { display: flex; flex-direction: column; gap: 6px; margin: 4px 0 0; }
.ab-zahlung-zeilen[hidden] { display: none; }
.ab-zahlung-zeile { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; line-height: 1.45; }
.ab-zahlung-zeile dt { color: var(--text-3); }
.ab-zahlung-zeile dd { margin: 0; color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; text-align: right; }
.ab-zahlung-text { margin: 0; }
.ab-zahlung > .ab-plan-inhalt > .ab-fehler { margin-top: 4px; }

/* ---------- Bereiche mit Kopf (Tarife, Rechnungen) ---------- */
.ab-bereich { display: flex; flex-direction: column; gap: 16px; padding-top: 20px; border-top: 1px solid var(--border); scroll-margin-top: 80px; }
.ab-bereich[hidden] { display: none; }
.ab-bereich-kopf { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 16px; }
.ab-bereich-kopf p { margin: 2px 0 0; }
.ab-bereich-titel { margin: 0; color: var(--text); font-size: 18px; font-weight: 600; line-height: 1.4; }

/* ---------- Monat oder Jahr ---------- */
.ab-segment {
  display: inline-grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 2px; padding: 3px;
  border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--surface-2);
}
.ab-segment-teil {
  display: flex; align-items: center; justify-content: center; min-height: 38px; padding: 0 20px; border-radius: 6px;
  font-size: 14px; font-weight: 600; color: var(--text-3); cursor: pointer; -webkit-tap-highlight-color: transparent;
  transition: background-color .15s, color .15s, box-shadow .15s;
}
.ab-segment-teil:hover { color: var(--text); }
.ab-segment-teil:has(input:checked) { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.ab-segment-teil:has(input:focus-visible) { box-shadow: var(--ring); }
/* ---------- Tarifkarten ---------- */
.ab-karten { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; align-items: stretch; }
.ab-karte { display: flex; flex-direction: column; gap: 12px; min-width: 0; margin: 0; }
.ab-karten > .k-karte + .k-karte { margin-top: 0; }
.ab-karte--beliebt { box-shadow: inset 0 0 0 1px var(--primary), var(--shadow-sm); border-color: var(--primary); }
.ab-karte.ist-gewaehlt { box-shadow: var(--ring); }
.ab-karte-kopf { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; min-height: 28px; }
.ab-karte-name { margin: 0 auto 0 0; color: var(--text); font-size: 17px; font-weight: 600; line-height: 1.4; }
.ab-karte-unter { margin: -8px 0 0; }
.ab-preis { display: flex; flex-direction: column; gap: 2px; }
.ab-preis p { margin: 0; }
.ab-preis-zeile { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; }
.ab-preis-haupt { color: var(--text); font-size: 34px; font-weight: 700; line-height: 1.15; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.ab-preis-anker { color: var(--text-3); font-size: 16px; font-weight: 500; font-variant-numeric: tabular-nums; }
.ab-preis-zeitraum { color: var(--text-3); font-size: 14px; }
.ab-preis-gruender { color: var(--primary); font-size: 13px; font-weight: 600; }
.ab-karte-aktion { display: flex; flex-direction: column; gap: 6px; }
.ab-bald { margin: 0; text-align: center; }
.ab-funktionen { display: flex; flex-direction: column; gap: 8px; margin: 4px 0 0; padding: 12px 0 0; list-style: none; border-top: 1px solid var(--border); }
.ab-funktionen li { display: flex; align-items: flex-start; gap: 8px; color: var(--text-2); font-size: 14px; line-height: 1.45; }
.ab-funktionen .k-ikon { flex: none; margin-top: 2px; color: var(--primary); }

/* ---------- Rechnungen als Tabelle (Untitled UI „Billing history“) ---------- */
.ab-tabelle-karte { padding: 0; overflow: hidden; }
.ab-tabelle { width: 100%; border-collapse: collapse; font-size: 14px; }
.ab-tabelle thead th {
  padding: 12px 24px; background: var(--surface-2); border-bottom: 1px solid var(--border);
  color: var(--text-3); font-size: 12px; font-weight: 600; text-align: left; white-space: nowrap;
}
.ab-tabelle td, .ab-tabelle tbody th { padding: 14px 24px; color: var(--text-3); text-align: left; vertical-align: middle; font-weight: 400; }
.ab-tabelle tbody tr + tr > * { border-top: 1px solid var(--border); }
.ab-zelle-rechnung { display: flex; align-items: center; gap: 12px; min-width: 0; }
.ab-rechnung-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ab-rechnung-nummer { color: var(--text); font-weight: 600; overflow-wrap: anywhere; }
.ab-rechnung-unter { display: none; }
.ab-tabelle .ab-spalte-betrag { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; text-align: right; }
.ab-tabelle thead .ab-spalte-betrag { color: var(--text-3); }
.ab-zelle-dateien { white-space: nowrap; text-align: right !important; }
.ab-zelle-dateien .k-knopf + .k-knopf { margin-left: 4px; }

.ab-vertrag { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 20px; margin: 0; }

/* ---------- Bestellübersicht ---------- */
.ab-bestellen { max-width: 560px; width: 100%; margin: 0 auto; }
.ab-kopf { display: flex; align-items: center; gap: 8px; min-width: 0; }
.ab-kopf .k-titel { margin: 0; }
.ab-kopf .k-titel:focus { outline: none; }
.ab-zurueck {
  display: grid; place-items: center; flex: none; width: 44px; height: 44px; margin-left: -10px; padding: 0;
  border: 0; border-radius: 99px; background: none; color: var(--text-2); cursor: pointer;
  transition: background-color .15s, color .15s;
}
.ab-zurueck:hover { background: var(--surface-2); color: var(--text); }
.ab-zurueck:focus-visible { outline: none; box-shadow: var(--ring); }
.ab-bestellen-karte { display: flex; flex-direction: column; gap: 20px; }
.ab-kaeufer { margin: 0; padding: 0; border: 0; min-width: 0; }
.ab-kaeufer .k-label { padding: 0; margin-bottom: 8px; }
.ab-haken { display: flex; flex-direction: column; gap: 12px; }
.ab-haken .k-haken[hidden] { display: none; }
.ab-uebersicht { margin: 0; padding: 4px 16px; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface-2); }
.ab-uebersicht-zeile { display: grid; grid-template-columns: 9.5em minmax(0, 1fr); gap: 12px; padding: 10px 0; font-size: 14px; line-height: 1.45; }
.ab-uebersicht-zeile + .ab-uebersicht-zeile { border-top: 1px solid var(--border); }
.ab-uebersicht dt { color: var(--text-3); }
.ab-uebersicht dd { margin: 0; color: var(--text); font-weight: 550; overflow-wrap: anywhere; }

@media (max-width: 899.98px) {
  .ab-karten { grid-template-columns: minmax(0, 1fr); }
  .ab-oben { grid-template-columns: minmax(0, 1fr); }
  .ab-spalte-datum, .ab-spalte-status { display: none; }
  .ab-rechnung-unter { display: block; }
  .ab-tabelle td, .ab-tabelle tbody th, .ab-tabelle thead th { padding-left: 16px; padding-right: 16px; }
}
@media (max-width: 560px) {
  .ab-tabelle thead { display: none; }
  .ab-tabelle tbody tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; }
  .ab-tabelle tbody tr > * { border-top: 0 !important; }
  .ab-tabelle tbody tr + tr { border-top: 1px solid var(--border); }
  .ab-zelle-rechnung { padding-bottom: 4px !important; }
  .ab-tabelle .ab-spalte-betrag { padding-bottom: 4px; }
  .ab-zelle-dateien { grid-column: 1 / -1; padding-top: 4px !important; text-align: left !important; }
}
@media (max-width: 420px) {
  .ab-plan-inhalt { padding: 16px; }
  .ab-karten-fuss { padding: 12px 16px; }
  .ab-bereich-kopf, .ab-segment { width: 100%; }
  .ab-segment-teil { padding: 0 8px; }
  .ab-uebersicht { padding: 4px 12px; }
  .ab-uebersicht-zeile { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .ab-preis-haupt { font-size: 30px; }
  .ab-karten-fuss .k-knopf { width: 100%; }
}
@media (pointer: coarse) { .ab-segment-teil { min-height: 44px; } }

/* ---------- Kündigen und Widerrufen (kuendigen.html, widerrufen.html) ---------- */
.ab-vertrag-form .k-feld textarea.k-eingabe { min-height: 96px; resize: vertical; }
.ab-vertrag-form fieldset { margin: 0; padding: 0; border: 0; min-width: 0; }
.ab-vertrag-form fieldset .k-label { padding: 0; margin-bottom: 8px; }
.ab-vertrag-form .k-feld[hidden] { display: none; }
.ab-eingang { margin: 0; color: var(--text); font-weight: 600; }
.ab-vertrag-zeilen { width: 100%; text-align: left; }
