/* ===== SCHALTFLÄCHEN ===== */

/* 1. Der Knopf – Grundklasse */
.knopf {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: 0 var(--space-4);
    min-height: var(--target-min);
    border-radius: var(--radius-sm);
    border: none;
    background: transparent;
    color: inherit;
    font-family: var(--font-sans);
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-medium);
    line-height: 1;
    white-space: nowrap;
    cursor: pointer;
    text-decoration: none;
    transition: background-color var(--duration-control), color var(--duration-control), border-color var(--duration-control);
}

.knopf[hidden] {
    display: none;
}

.knopf:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

/* 2. Varianten */

/* Hauptaktion */
.knopf--primaer {
    background: var(--accent-gradient);
    color: var(--text-on-accent);
    box-shadow: var(--shadow-sm);
    transition: filter var(--duration-control);
}

/* Den Verlauf hellt ein Filter auf; zwei Verläufe lassen sich nicht ineinander überblenden. */
.knopf--primaer:hover:not(:disabled),
.knopf--primaer.zeige-hover:not(:disabled) {
    filter: brightness(1.1);
}

.knopf--primaer:active:not(:disabled) {
    filter: brightness(0.95);
}

/* Nebenaktion */
.knopf--sekundaer {
    background: var(--glass-surface-soft);
    border: 1px solid var(--glass-border-strong);
    color: var(--text-primary);
}

.knopf--sekundaer:hover:not(:disabled),
.knopf--sekundaer.zeige-hover:not(:disabled) {
    background: var(--glass-surface-hover);
    border-color: var(--glass-border-strong);
}

/* Leiser Knopf */
.knopf--leise {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
}

.knopf--leise:hover:not(:disabled),
.knopf--leise.zeige-hover:not(:disabled) {
    border-color: var(--border-color-strong);
    color: var(--text-primary);
}

/* Gefahrknopf */
.knopf--gefahr {
    background: var(--danger-surface);
    color: var(--text-on-danger);
}

.knopf--gefahr:hover:not(:disabled),
.knopf--gefahr.zeige-hover:not(:disabled) {
    background: var(--danger-surface-hover);
}

.knopf--gefahr:active:not(:disabled) {
    background: var(--danger-surface-active);
}

/* Zustimmknopf */
.knopf--zustimmen {
    background: var(--success-bg);
    border: 1px solid var(--success-border);
    color: var(--success-text);
}

.knopf--zustimmen:hover:not(:disabled),
.knopf--zustimmen.zeige-hover:not(:disabled) {
    background: color-mix(in srgb, var(--success) 25%, transparent);
}

/* 3. Sondergrößen */

/* Symbolknopf */
.knopf--symbol {
    width: var(--target-min);
    height: var(--target-min);
    padding: 0;
    min-height: unset;
    flex-shrink: 0;
}

/* Zeilenknopf */
.knopf--zeile {
    min-height: var(--target-small);
    padding: 0 var(--space-3);
    font-size: var(--font-size-sm);
}

/* Großknopf */
.knopf--gross {
    min-height: var(--target-gross);
    flex: 1 1 auto;
}

@media (pointer: coarse) {
    .knopf--gross {
        min-height: var(--target-gross-grob);
    }
}

/* Symbol im Knopf */
.knopf .symbol {
    width: var(--icon-size-sm);
    height: var(--icon-size-sm);
}

/* Fokusring für alle Knöpfe */
.knopf.zeige-fokus {
    outline: var(--focus-ring-width) solid var(--focus-ring);
    outline-offset: var(--focus-ring-offset);
}

/* 4. Aktionsgruppe */
.aktionsgruppe {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-3);
    align-items: center;
    justify-content: flex-end;
}

/* 6. Sprungverweis */
.sprungverweis {
    position: fixed;
    top: calc(-1 * var(--space-8) - var(--space-6));
    left: var(--space-4);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 var(--space-4);
    min-height: var(--target-min);
    background: var(--accent-surface);
    color: var(--text-on-accent);
    border-radius: var(--radius-sm);
    border: none;
    font-weight: var(--font-weight-medium);
    text-decoration: none;
    z-index: 100;
    transition: top var(--duration-fade);
}

.sprungverweis:focus-visible,
.sprungverweis.zeige-fokus {
    top: var(--space-3);
    outline: var(--focus-ring-width) solid var(--focus-ring);
    outline-offset: var(--focus-ring-offset);
}

@media (prefers-reduced-motion: reduce) {
    .sprungverweis {
        transition: none;
    }
}

/* ===== STATUS ===== */

/* 1. Abzeichen */
.abzeichen {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    padding: 0.15em 0.7em;
    border-radius: var(--radius-full);
    background: var(--badge-neutral-bg);
    color: var(--badge-neutral);
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-bold);
    line-height: 1;
    white-space: nowrap;
}

.abzeichen--erfolg {
    background: var(--badge-success-bg);
    color: var(--badge-success);
}

.abzeichen--warnung {
    background: var(--badge-warning-bg);
    color: var(--badge-warning);
}

.abzeichen--gefahr {
    background: var(--badge-danger-bg);
    color: var(--badge-danger);
}

.abzeichen--info {
    background: var(--badge-info-bg);
    color: var(--badge-info);
}

.abzeichen--bereich {
    background: var(--badge-accent-bg);
    color: var(--badge-accent);
}

/* 2. Infokasten */
.hinweis {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-4);
    border: 1px solid var(--info-border);
    border-left: 4px solid var(--info-border);
    border-radius: var(--radius-md);
    background: var(--info-bg);
    color: var(--text-primary);
}

.hinweis > :first-child {
    flex: 1;
    min-width: 0;
}

.hinweis p {
    margin: 0;
}

.hinweis p.kein-abstand-unten {
    margin-bottom: 0;
}

.hinweis__titel {
    font-size: var(--font-size-base);
    line-height: var(--line-height-base);
    font-weight: var(--font-weight-bold);
    color: inherit;
}

/* Infokasten – Varianten */
.hinweis--erfolg {
    border-color: var(--success-border);
    border-left-color: var(--success-border);
    background: var(--success-bg);
}

.hinweis--warnung {
    border-color: var(--warning-border);
    border-left-color: var(--warning-border);
    background: var(--warning-bg);
}

.hinweis--gefahr {
    border-color: var(--danger-border);
    border-left-color: var(--danger-border);
    background: var(--danger-bg);
}

/* 5. Fortschrittsbalken (STATUS 5) und Anteilsbalken (FLAECHEN 8) */
.fortschritt,
.anteile {
    --balken-farbe: var(--accent);
    padding: var(--space-4) var(--space-5);
    margin-bottom: var(--space-5);
    background: var(--bg-elevated);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
}

.fortschritt {
    display: grid;
    gap: var(--space-2);
}

.fortschritt--warnung {
    --balken-farbe: var(--warning);
    border-color: var(--warning-border);
}

.fortschritt--gefahr {
    --balken-farbe: var(--danger);
    border-color: var(--danger-border);
}

.fortschritt__kopf {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-2) var(--space-3);
}

.fortschritt__name {
    font-size: var(--font-size-lg);
    font-weight: var(--font-weight-medium);
    color: var(--text-primary);
}

.fortschritt__text {
    margin: 0;
    color: var(--text-secondary);
    font-variant-numeric: tabular-nums;
}

.fortschritt__balken,
.anteile__balken {
    -webkit-appearance: none;
    appearance: none;
    display: block;
    width: 100%;
    height: 0.75rem;
    border: 1px solid var(--border-color-strong);
    border-radius: var(--radius-full);
    background: var(--neutral-bg);
    overflow: hidden;
}

.fortschritt__balken::-webkit-meter-bar,
.anteile__balken::-webkit-meter-bar {
    height: 100%;
    border: 0;
    background: transparent;
}

.fortschritt__balken::-webkit-meter-optimum-value,
.anteile__balken::-webkit-meter-optimum-value {
    background: var(--balken-farbe);
}

.fortschritt__balken::-webkit-meter-suboptimum-value,
.anteile__balken::-webkit-meter-suboptimum-value {
    background: var(--balken-farbe);
}

.fortschritt__balken::-webkit-meter-even-less-good-value,
.anteile__balken::-webkit-meter-even-less-good-value {
    background: var(--balken-farbe);
}

.fortschritt__balken::-moz-meter-bar,
.anteile__balken::-moz-meter-bar {
    background: var(--balken-farbe);
}

.anteile {
    list-style: none;
    display: grid;
    gap: var(--space-4);
}

.anteile__zeile {
    display: grid;
    gap: var(--space-1);
}

.anteile__text {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 0 var(--space-3);
}

.anteile__name {
    font-weight: var(--font-weight-medium);
    color: var(--text-primary);
    overflow-wrap: anywhere;
}

.anteile__wert {
    color: var(--text-secondary);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

/* 3. Kurzmeldung */
.kurzmeldungen {
    position: fixed;
    right: var(--space-4);
    bottom: var(--space-4);
    z-index: 900;
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    width: min(22rem, calc(100vw - 2 * var(--space-4)));
}

.kurzmeldung {
    padding: var(--space-3);
    border-radius: var(--radius-md);
    background: var(--bg-elevated);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

.kurzmeldung p {
    margin: 0;
    font-size: var(--font-size-sm);
    line-height: var(--line-height-base);
    color: var(--text-primary);
}

.kurzmeldung--erfolg {
    border-left: 4px solid var(--success);
}

.kurzmeldung--fehler {
    border-left: 4px solid var(--danger);
}

/* Responsive */

/* Formulare: Grundlagen */

.feld {
    margin-bottom: var(--space-4);
}

.feld label {
    display: block;
    font-weight: var(--font-weight-medium);
    font-size: var(--font-size-sm);
    color: var(--text-primary);
    margin-bottom: var(--space-1);
}

.feld__beschriftung {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    align-items: baseline;
    margin-bottom: var(--space-1);
}

.feld__beschriftung label {
    margin-bottom: 0;
}

/* Eingabefelder: Text, Zahl, Datum, Auswahlfeld, Textarea */

input[type="search"],
input[type="text"],
input[type="email"],
input[type="password"],
input[type="date"],
input[type="datetime-local"],
input[type="time"],
input[type="number"],
input[type="tel"],
select,
textarea {
    width: 100%;
    min-height: var(--target-min);
    padding: 0 var(--space-3);
    border: 1px solid var(--input-border);
    border-radius: var(--radius-sm);
    background: var(--bg-input);
    font-family: inherit;
    font-size: var(--font-size-base);
    color: var(--text-primary);
    transition: border-color var(--duration-control);
}

input[type="search"]::placeholder,
input[type="text"]::placeholder,
input[type="email"]::placeholder,
input[type="password"]::placeholder,
input[type="date"]::placeholder,
input[type="datetime-local"]::placeholder,
input[type="time"]::placeholder,
input[type="number"]::placeholder,
input[type="tel"]::placeholder,
textarea::placeholder {
    color: var(--text-muted);
}

input[type="search"]:hover:not(:disabled),
input[type="text"]:hover:not(:disabled),
input[type="email"]:hover:not(:disabled),
input[type="password"]:hover:not(:disabled),
input[type="date"]:hover:not(:disabled),
input[type="datetime-local"]:hover:not(:disabled),
input[type="time"]:hover:not(:disabled),
input[type="number"]:hover:not(:disabled),
input[type="tel"]:hover:not(:disabled),
select:hover:not(:disabled),
textarea:hover:not(:disabled),
.zeige-hover {
    border-color: var(--input-border-hover);
}

input[type="search"]:focus-visible,
input[type="text"]:focus-visible,
input[type="email"]:focus-visible,
input[type="password"]:focus-visible,
input[type="date"]:focus-visible,
input[type="datetime-local"]:focus-visible,
input[type="time"]:focus-visible,
input[type="number"]:focus-visible,
input[type="tel"]:focus-visible,
select:focus-visible,
textarea:focus-visible,
.zeige-fokus {
    outline: var(--focus-ring-width) solid var(--focus-ring);
    outline-offset: var(--focus-ring-offset);
}

input[type="search"]:disabled,
input[type="text"]:disabled,
input[type="email"]:disabled,
input[type="password"]:disabled,
input[type="date"]:disabled,
input[type="datetime-local"]:disabled,
input[type="time"]:disabled,
input[type="number"]:disabled,
input[type="tel"]:disabled,
select:disabled,
textarea:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

input[type="search"][aria-invalid="true"],
input[type="text"][aria-invalid="true"],
input[type="email"][aria-invalid="true"],
input[type="password"][aria-invalid="true"],
input[type="date"][aria-invalid="true"],
input[type="datetime-local"][aria-invalid="true"],
input[type="time"][aria-invalid="true"],
input[type="number"][aria-invalid="true"],
input[type="tel"][aria-invalid="true"],
select[aria-invalid="true"],
textarea[aria-invalid="true"] {
    border-color: var(--danger);
}

textarea {
    min-height: var(--target-textarea);
    padding: var(--space-3);
    resize: vertical;
}

/* Feldgruppen: Fieldset und Legend */

fieldset {
    margin: 0;
    border: none;
    padding: 0;
}

legend {
    width: 100%;
    margin-bottom: var(--space-4);
    padding-bottom: var(--space-2);
    border-bottom: 1px solid var(--divider-color);
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-bold);
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

fieldset + fieldset {
    margin-top: var(--space-6);
}

/* Sind alle Felder einer Gruppe verborgen, verschwindet die Gruppe samt Überschrift. */
fieldset:not(:has(> :not(legend, [hidden]))) {
    display: none;
}

/* Prüfmeldungen, Feldwarnungen, Feldhilfe */

.feld__fehler,
.feld__warnung,
.feld__hilfe {
    font-size: var(--font-size-sm);
    margin: var(--space-1) 0 0;
}

.feld__fehler,
.feld__warnung {
    display: flex;
    align-items: flex-start;
    gap: var(--space-1);
}

.feld__fehler {
    color: var(--danger-text);
    font-weight: var(--font-weight-medium);
}

.feld__warnung {
    color: var(--warning-text);
}

.feld__hilfe {
    color: var(--text-muted);
}

/* Feldhinweis */

.feldhinweis {
    padding: var(--space-3) var(--space-4);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-elevated);
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
}

.feldhinweis p {
    max-width: none;
    margin: var(--space-2) 0 0;
}

.feldhinweis p:first-child {
    margin-top: 0;
}

.feldhinweis p:last-child {
    margin-bottom: 0;
}

/* Hilfezeichen */

.hilfe {
    display: inline-flex;
    position: relative;
    vertical-align: middle;
}

.hilfe__knopf {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: var(--target-min);
    height: var(--target-min);
    padding: 0;
    background: transparent;
    border: none;
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-bold);
    color: var(--text-secondary);
    cursor: pointer;
    transition: color var(--duration-control);
}

.hilfe__knopf:hover:not(:disabled) {
    color: var(--text-primary);
}

.hilfe__knopf:focus-visible,
.hilfe__knopf.zeige-fokus {
    outline: var(--focus-ring-width) solid var(--focus-ring);
    outline-offset: var(--focus-ring-offset);
}

.hilfe__zeichen {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border: 1px solid var(--border-color-strong);
    border-radius: var(--radius-full);
    background: transparent;
    font-size: 0.9em;
    font-weight: var(--font-weight-bold);
    color: inherit;
    transition: background-color var(--duration-control), color var(--duration-control);
}

.hilfe__knopf:hover:not(:disabled) .hilfe__zeichen {
    background: var(--glass-surface-hover);
    color: var(--text-primary);
}

/* Hilfepopup */

.hilfe__inhalt {
    position: absolute;
    top: calc(100% + var(--space-2));
    left: 0;
    z-index: 30;
    width: max-content;
    max-width: min(22rem, calc(100vw - 2 * var(--space-4)));
    padding: var(--space-4);
    border: 1px solid var(--glass-border-strong);
    border-radius: var(--radius-md);
    background: var(--glass-fallback);
    box-shadow: var(--shadow-md);
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-normal);
    color: var(--text-primary);
    text-align: left;
}

.hilfe__titel {
    font-weight: var(--font-weight-bold);
    margin-bottom: var(--space-1);
}

.hilfe__absatz {
    display: block;
}

.hilfe__absatz + .hilfe__absatz {
    margin-top: var(--space-2);
}

.hilfe__schliessen {
    display: block;
    height: var(--target-min);
    width: 100%;
    margin-top: var(--space-3);
    padding: 0 var(--space-3);
    border: none;
    border-radius: var(--radius-sm);
    background: var(--border-color);
    font-size: var(--font-size-sm);
    color: var(--text-primary);
    cursor: pointer;
    transition: background-color var(--duration-control);
}

.hilfe__schliessen:hover:not(:disabled) {
    background: var(--border-color-strong);
}

.hilfe__schliessen:focus-visible {
    outline: var(--focus-ring-width) solid var(--focus-ring);
    outline-offset: var(--focus-ring-offset);
}

/* Hilfepopup in Tabellen: Nach rechts */

.datentabelle .hilfe__inhalt {
    left: auto;
    right: 0;
}

/* Responsive: Kleine Bildschirme (max 639px) */

/* Tabellenrahmen und Datentabelle */

.tabellenrahmen {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
  overflow-x: auto;
  margin-bottom: var(--space-4);
}

.datentabelle {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--font-size-base);
}

.datentabelle thead {
  background: var(--table-head-surface);
}

.datentabelle thead th {
  padding: var(--space-3) var(--space-4);
  white-space: nowrap;
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  color: var(--text-secondary);
  text-align: left;
  border-bottom: 1px solid var(--divider-color);
}

.datentabelle tbody td {
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--divider-color);
  color: var(--text-primary);
}

.datentabelle tbody th {
  white-space: normal;
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--divider-color);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-normal);
  color: var(--text-primary);
  text-align: left;
}

.datentabelle tbody tr:last-child td,
.datentabelle tbody tr:last-child th {
  border-bottom: none;
}

.datentabelle tbody tr:hover {
  background: var(--row-hover-surface);
}

/* Eine Zeile, die als Ganzes öffnet: Der Verweis in der ersten Zelle legt seine Klickfläche über die ganze Zeile.
   So bleibt es ein echter Verweis, der auch ohne Skript und mit der Tastatur geht. */
.datentabelle__zeile--verweis {
  position: relative;
  cursor: pointer;
}

.datentabelle__zeilenverweis {
  color: inherit;
  text-decoration: none;
}

.datentabelle__zeilenverweis::after {
  content: '';
  position: absolute;
  inset: 0;
}

.datentabelle__zeilenverweis:focus-visible {
  outline: none;
}

.datentabelle__zeile--verweis:has(.datentabelle__zeilenverweis:focus-visible) {
  outline: var(--focus-ring-width) solid var(--focus-ring);
  outline-offset: calc(-1 * var(--focus-ring-width));
}

.datentabelle__betrag,
.datentabelle thead th.datentabelle__betrag {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.datentabelle--feste-spalten {
  table-layout: fixed;
}

.datentabelle--feste-spalten thead th:first-child {
  width: calc(16ch + var(--space-4) * 2);
}

/* Sortierkopf */

.sortierkopf {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  color: inherit;
  text-decoration: none;
  transition: color var(--duration-control);
}

.sortierkopf:hover {
  color: var(--text-primary);
}

.sortierkopf:focus-visible {
  outline: var(--focus-ring-width) solid var(--focus-ring);
  outline-offset: var(--focus-ring-offset);
}

.datentabelle__betrag .sortierkopf {
  justify-content: flex-end;
}

/* Zeilenaktionen */

.zeilenaktionen {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: var(--space-2);
}

/* Ziehgriff */

.ziehgriff {
  display: flex;
  align-items: center;
  justify-content: center;
  width: var(--target-min);
  height: var(--target-min);
  padding: 0;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-family: inherit;
  cursor: grab;
  transition: color var(--duration-control);
  touch-action: none;
}

.ziehgriff:hover {
  color: var(--text-primary);
}

.ziehgriff:active {
  cursor: grabbing;
}

.ziehgriff:focus-visible {
  outline: var(--focus-ring-width) solid var(--focus-ring);
  outline-offset: var(--focus-ring-offset);
}

/* Sortier-Zustände */

.sortierzeile--zieht {
  opacity: 0.55;
  border: 2px dashed var(--border-color-strong);
}

.sortierzeile--ziel-oben {
  box-shadow: inset 0 3px 0 var(--accent);
}

.sortierzeile--ziel-unten {
  box-shadow: inset 0 -3px 0 var(--accent);
}

/* Spaltenhilfe */

.tabellenhilfe {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
  margin-bottom: var(--space-3);
}

.tabellenhilfe__spalte {
  font-weight: var(--font-weight-bold);
  color: var(--text-primary);
  margin-bottom: var(--space-1);
}

.hilfe__spalte {
  font-weight: var(--font-weight-bold);
  color: var(--text-primary);
  margin-bottom: var(--space-1);
}

.hilfe__absatz {
  color: var(--text-primary);
  margin-bottom: var(--space-2);
}

.hilfe__absatz:last-child {
  margin-bottom: 0;
}

/* === KARTE (aus STYLE-GUIDE-FLAECHEN.md) === */
.karte {
  background-color: var(--bg-elevated);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  box-shadow: var(--shadow-sm);
}

a.karte--verweis {
  display: block;
  text-decoration: none;
  color: inherit;
  transition: border-color var(--duration-control);
}

a.karte--verweis:hover {
  border-color: var(--accent-muted);
}

a.karte--verweis:focus-visible {
  outline: var(--focus-ring-width) solid var(--focus-ring);
  outline-offset: var(--focus-ring-offset);
}

/* Zeilen in einer Verweiskarte sind nur Anzeige; ein eigener Hover täuschte
   einen zweiten Klickweg vor. */
a.karte--verweis .zeile:hover {
  background: var(--bg-elevated);
}

.karte__titel {
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-bold);
  margin-bottom: var(--space-2);
}

.karte__titel h2 {
  font-size: inherit;
  font-weight: inherit;
}

.karte__trenner {
  border: none;
  height: 1px;
  background-color: var(--divider-color);
  margin: var(--space-5) 0;
}

/* === GLASFLÄCHE (aus STYLE-GUIDE-FLAECHEN.md) === */
.glas {
  background: var(--glass-surface);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow), var(--glass-highlight);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  color: var(--text-primary);
}

@supports not (backdrop-filter: blur(1px)) {
  .glas {
    background-color: var(--glass-fallback);
    backdrop-filter: none;
  }
}

.glas h3 {
  margin-bottom: var(--space-3);
}

.glas p {
  margin: 0;
}

/* === LEERER ZUSTAND (aus STYLE-GUIDE-FLAECHEN.md) === */
.leerer-zustand {
  padding: var(--space-6) var(--space-5);
  border: 1px dashed var(--border-color-strong);
  border-radius: var(--radius-lg);
  text-align: center;
  color: var(--text-secondary);
}

.leerer-zustand p {
  max-width: 40ch;
  margin: 0 auto;
}

/* === DATENLISTE (aus STYLE-GUIDE-FLAECHEN.md) === */
.datenliste {
  display: grid;
  grid-template-columns: minmax(10rem, 14rem) 1fr;
  gap: var(--space-2) var(--space-4);
}

.datenliste > div {
  display: contents;
}

.datenliste dt {
  color: var(--text-secondary);
  font-weight: var(--font-weight-medium);
  padding-top: var(--space-2);
  padding-bottom: var(--space-2);
  border-bottom: 1px solid var(--divider-color);
}

.datenliste dd {
  padding-top: var(--space-2);
  padding-bottom: var(--space-2);
  border-bottom: 1px solid var(--divider-color);
  margin: 0;
}

/* Der Umschalter zeigt das Schema, zu dem er wechselt: im dunklen die Sonne, im hellen den Mond. */
[data-schema-symbol] {
    display: inline-flex;
}

:root[data-theme="dark"] [data-schema-symbol="light"],
:root[data-theme="light"] [data-schema-symbol="dark"] {
    display: none;
}

/* ===== FUHRPARK-KOMPONENTEN ===== */

/* 1. Dateifeld (Formulare) */
.dateifeld {
    margin-bottom: var(--space-4);
}

.dateifeld label {
    display: block;
    font-weight: var(--font-weight-medium);
    font-size: var(--font-size-sm);
    color: var(--text-primary);
    margin-bottom: var(--space-1);
}

.dateifeld input[type="file"] {
    width: 100%;
    min-height: var(--target-min);
    padding: 0 var(--space-3);
    border: 1px solid var(--input-border);
    border-radius: var(--radius-sm);
    background: var(--bg-input);
    font-family: inherit;
    font-size: var(--font-size-base);
    color: var(--text-primary);
    transition: border-color var(--duration-control);
}

.dateifeld input[type="file"]:hover:not(:disabled) {
    border-color: var(--input-border-hover);
}

.dateifeld input[type="file"]:focus-visible {
    outline: var(--focus-ring-width) solid var(--focus-ring);
    outline-offset: var(--focus-ring-offset);
}

.dateifeld input[type="file"]:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.dateifeld input[type="file"][aria-invalid="true"] {
    border-color: var(--danger);
}

.dateifeld .feld__hinweis {
    font-size: var(--font-size-sm);
    margin: var(--space-1) 0 0;
    color: var(--text-muted);
}

.dateifeld .feld__fehler {
    font-size: var(--font-size-sm);
    margin: var(--space-1) 0 0;
    color: var(--danger);
    font-weight: var(--font-weight-medium);
}

/* 2. Bildkachel (Flächen) */
.dateien {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(12rem, 1fr));
    gap: var(--space-4);
    list-style: none;
    margin: 0;
    padding: 0;
}

.bildkachel {
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-elevated);
    padding: var(--space-3);
    overflow: hidden;
}

.bildkachel__bild {
    width: 100%;
    height: auto;
    display: block;
    border-radius: var(--radius-md) var(--radius-md) 0 0;
    margin: calc(-1 * var(--space-3)) calc(-1 * var(--space-3)) var(--space-2) calc(-1 * var(--space-3));
    object-fit: cover;
}

.bildkachel__name {
    font-size: var(--font-size-sm);
    color: var(--text-primary);
    margin-bottom: var(--space-2);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.bildkachel__aktionen {
    display: flex;
    gap: var(--space-1);
    margin-top: auto;
}

.bildkachel__aktionen .knopf {
    flex: 1;
    min-height: var(--target-small);
    font-size: var(--font-size-sm);
}

/* 3. Fahrzeugkarte (Flächen) */
.fahrzeugkarten {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr));
    gap: var(--space-5);
    list-style: none;
    margin: 0 0 var(--space-5);
    padding: 0;
}

a.fahrzeugkarte {
    display: flex;
    flex-direction: column;
    text-decoration: none;
    color: inherit;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    background: var(--bg-elevated);
    padding: var(--space-4);
    transition: border-color var(--duration-control);
}

a.fahrzeugkarte:hover {
    border-color: var(--accent-muted);
}

a.fahrzeugkarte:focus-visible {
    outline: var(--focus-ring-width) solid var(--focus-ring);
    outline-offset: var(--focus-ring-offset);
}

.fahrzeugkarte__bild {
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    border-radius: var(--radius-md);
    margin-bottom: var(--space-3);
    display: block;
}

.fahrzeugkarte__platzhalter {
    width: 100%;
    height: 9rem;
    aspect-ratio: 16 / 9;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    margin-bottom: var(--space-3);
    border-radius: var(--radius-md);
    background: var(--neutral-bg);
}

.fahrzeugkarte__platzhalter .symbol {
    width: 3rem;
    height: 3rem;
}

.fahrzeugkarte__platzhalter .symbol--breit {
    width: min(70%, 14rem);
    height: auto;
}

.fahrzeugkarte__name {
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-bold);
    color: var(--text-primary);
    margin: 0 0 var(--space-1) 0;
}

.fahrzeugkarte__unter {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    margin: 0 0 var(--space-2) 0;
}

.fahrzeugkarte__merkmale {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    flex: 1;
}

.fahrzeugkarte__faelligkeit {
    margin-top: var(--space-2);
}

/* Responsive: Bildkacheln und Fahrzeugkarten auf kleinen Bildschirmen */
@media (max-width: 639px) {
    .dateien {
        grid-template-columns: repeat(auto-fill, minmax(8rem, 1fr));
    }

    .fahrzeugkarten {
        grid-template-columns: 1fr;
    }
}

/* Verkaufsblatt am Bildschirm; die Druckfassung steht in print.css. */
.verkaufsblatt__kopf {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: var(--space-5);
    margin-bottom: var(--space-5);
}

.verkaufsblatt__bild {
    width: min(100%, 24rem);
    height: auto;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    border-radius: var(--radius-md);
}

/* ===== DIAGRAMME ===== */

/* Balkendiagramm – SVG vom Server */
.diagramm {
    display: grid;
    gap: var(--space-2);
    padding: var(--space-4) var(--space-5);
    background: var(--bg-elevated);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    /* <figure> bringt seitliche Ränder mit, die das Diagramm schmaler als die Karten daneben machen. */
    margin: 0 0 var(--space-5);
    grid-template-columns: minmax(0, 1fr);
    min-width: 0;
    overflow-x: auto;
}

.diagramm__titel {
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-medium);
    color: var(--text-primary);
    margin: 0;
}

.diagramm__flaeche {
    display: block;
    width: 100%;
    height: auto;
    /* Das SVG wächst mit der Breite; begrenzt bleibt es auf breiten Bildschirmen flach und auf schmalen lesbar (dann scrollt es). */
    max-height: 18rem;
    min-width: 30rem;
}

/* Achsen und Beschriftung im Diagramm */
.diagramm__achse,
.diagramm__beschriftung {
    fill: var(--text-secondary);
    font-size: var(--font-size-xs);
}

/* Balken mit Reihenfarben */
.diagramm__balken {
    stroke: none;
}

.diagramm__balken--reihe-1 {
    fill: var(--diagramm-reihe-1);
}

.diagramm__balken--reihe-2 {
    fill: var(--diagramm-reihe-2);
}

.diagramm__balken--reihe-3 {
    fill: var(--diagramm-reihe-3);
}

/* Legende zum Diagramm */
.diagramm__legende {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-3);
    list-style: none;
    margin: 0;
    padding: 0;
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
}

.diagramm__legende li {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.diagramm__farbe {
    display: inline-block;
    width: 1rem;
    height: 1rem;
    border-radius: 2px;
    flex-shrink: 0;
}

/* Flächendiagramm: jede Reihe trägt ihre Farbe als currentColor, darunter eine nach unten auslaufende Fläche.
   Die Legende oben rechts schaltet Reihen ab; eine Spalte je Periode zeigt beim Überfahren Zeiger, Punkte und Werte. */
.diagramm__linie {
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linejoin: round;
    stroke-linecap: round;
}

.diagramm__verlaufsflaeche {
    stroke: none;
}

.diagramm__punkt {
    fill: currentColor;
    stroke: var(--bg-elevated);
    stroke-width: 2;
}

.diagramm__zeiger {
    stroke: var(--text-secondary);
    stroke-width: 1;
}

/* Die waagrechten Zeiger reichen über alle Spalten; ohne dies fingen sie das Überfahren der Nachbarspalten ab. */
.diagramm__spalte .diagramm__zeiger,
.diagramm__spalte .diagramm__punkt {
    pointer-events: none;
}

.diagramm__spalte .diagramm__zeiger,
.diagramm__spalte .diagramm__punkt {
    opacity: 0;
}

.diagramm__spalte:hover .diagramm__zeiger,
.diagramm__spalte:hover .diagramm__punkt {
    opacity: 1;
}

.diagramm__treffer {
    fill: transparent;
    pointer-events: all;
}

.diagramm--flaeche .diagramm__legende {
    justify-content: flex-end;
}

.diagramm__legende--schalter {
    border: 0;
    padding: 0;
    margin: 0;
}

.diagramm__schalter {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    min-height: var(--target-min);
    padding: 0 var(--space-2);
    border-radius: var(--radius-md);
    cursor: pointer;
}

.diagramm__schalter:hover {
    background: var(--bg-elevated-hover);
}

.diagramm__schalter input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    margin: 0;
}

.diagramm__schalter:has(input:focus-visible) {
    outline: var(--focus-ring-width) solid var(--focus-ring);
    outline-offset: var(--focus-ring-offset);
}

.diagramm__schalter .diagramm__farbe {
    width: 0.625rem;
    height: 0.625rem;
    border-radius: 50%;
    border: 2px solid transparent;
    background-clip: padding-box;
}

.diagramm__schalter:has(input:not(:checked)) {
    color: var(--text-secondary);
    opacity: 0.6;
}

.diagramm__schalter:has(input:not(:checked)) .diagramm__farbe {
    background: transparent;
    border-color: var(--text-secondary);
}

.diagramm__farbe--reihe-1 {
    background: var(--diagramm-reihe-1);
}

.diagramm__reihe--1,
.diagramm__verlauf--reihe-1 {
    color: var(--diagramm-reihe-1);
}

.diagramm:has(.diagramm__schalter input[value="1"]:not(:checked)) .diagramm__reihe--1 {
    display: none;
}

.diagramm__farbe--reihe-2 {
    background: var(--diagramm-reihe-2);
}

.diagramm__reihe--2,
.diagramm__verlauf--reihe-2 {
    color: var(--diagramm-reihe-2);
}

.diagramm:has(.diagramm__schalter input[value="2"]:not(:checked)) .diagramm__reihe--2 {
    display: none;
}

.diagramm__farbe--reihe-3 {
    background: var(--diagramm-reihe-3);
}

.diagramm__reihe--3,
.diagramm__verlauf--reihe-3 {
    color: var(--diagramm-reihe-3);
}

.diagramm:has(.diagramm__schalter input[value="3"]:not(:checked)) .diagramm__reihe--3 {
    display: none;
}

.diagramm__farbe--reihe-4 {
    background: var(--diagramm-reihe-4);
}

.diagramm__reihe--4,
.diagramm__verlauf--reihe-4 {
    color: var(--diagramm-reihe-4);
}

.diagramm:has(.diagramm__schalter input[value="4"]:not(:checked)) .diagramm__reihe--4 {
    display: none;
}

.diagramm__farbe--reihe-5 {
    background: var(--diagramm-reihe-5);
}

.diagramm__reihe--5,
.diagramm__verlauf--reihe-5 {
    color: var(--diagramm-reihe-5);
}

.diagramm:has(.diagramm__schalter input[value="5"]:not(:checked)) .diagramm__reihe--5 {
    display: none;
}

.diagramm__farbe--reihe-6 {
    background: var(--diagramm-reihe-6);
}

.diagramm__reihe--6,
.diagramm__verlauf--reihe-6 {
    color: var(--diagramm-reihe-6);
}

.diagramm:has(.diagramm__schalter input[value="6"]:not(:checked)) .diagramm__reihe--6 {
    display: none;
}

/* Tabelle als Alternative */
.diagramm__tabelle {
    margin-top: var(--space-3);
}

.diagramm__tabelle summary {
    cursor: pointer;
    color: var(--text-secondary);
    font-size: var(--font-size-sm);
    padding: var(--space-2);
    user-select: none;
}

.diagramm__tabelle summary:hover {
    color: var(--text-primary);
}

.diagramm__tabelle[open] summary {
    color: var(--text-primary);
    margin-bottom: var(--space-3);
}

/* ===== ANSICHT ANPASSEN ===== */

/* Klappbare Bedienelemente zum Anpassen der Ansicht */
.ansicht {
    margin-bottom: var(--space-5);
}

.ansicht__kopf {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-4);
    background: var(--bg-elevated);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    cursor: pointer;
    user-select: none;
    color: var(--text-secondary);
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
}

.ansicht__kopf:hover {
    background: var(--bg-elevated-hover);
    color: var(--text-primary);
}

.ansicht[open] > .ansicht__kopf {
    color: var(--text-primary);
    border-bottom: none;
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
}

.ansicht__inhalt {
    padding: var(--space-4) var(--space-5);
    background: var(--bg-elevated);
    border: 1px solid var(--border-color);
    border-top: none;
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
    display: grid;
    gap: var(--space-4);
}

/* ===== KALENDER-ARTKENNZEICHEN ===== */

/* Kalendertermin mit Artkennzeichen */
.kalender__termin--faelligkeit {
    border-left: 3px solid var(--warning);
}

.kalender__termin--wartung {
    border-left: 3px solid var(--info);
}

.kalender__termin--tanken {
    border-left: 3px solid var(--success);
}

.kalender__termin--kosten {
    border-left: 3px solid var(--warning);
}

.kalender__termin--kauf {
    border-left: 3px solid var(--accent);
}

.kalender__termin--verkauf {
    border-left: 3px solid var(--danger);
}

.kalender__termin--erstzulassung {
    border-left: 3px solid var(--info);
}

/* Artkennzeichen: Symbol und Wort zusammen tragen die Bedeutung */
.kalender__art {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    font-size: var(--font-size-xs);
    color: var(--text-secondary);
    font-weight: var(--font-weight-medium);
}

/* Die Druckfassung eines Dokuments erscheint nur im Druck (print.css). */
.druckfassung {
    display: none;
}

.diagramm--flaeche .diagramm__flaeche {
    max-height: none;
    min-width: 40rem;
}

/* Datumswahl: Knopf mit Kalender statt der Datumsanzeige des Browsers; das echte Datumsfeld bleibt verborgen im Formular. */
.datumswahl {
    position: relative;
}

.datumswahl__wert {
    position: absolute;
    inset: 0;
    opacity: 0;
    pointer-events: none;
}

.datumswahl__knopf {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    width: 100%;
    min-height: var(--target-min);
    padding: 0 var(--space-3);
    border: 1px solid var(--input-border);
    border-radius: var(--radius-sm);
    background: var(--bg-input);
    color: var(--text-primary);
    font-family: inherit;
    font-size: var(--font-size-base);
    text-align: left;
    cursor: pointer;
    transition: border-color var(--duration-control);
}

.datumswahl__knopf:hover:not(:disabled) {
    border-color: var(--input-border-hover);
}

.datumswahl__knopf:focus-visible {
    outline: var(--focus-ring-width) solid var(--focus-ring);
    outline-offset: var(--focus-ring-offset);
}

.datumswahl__knopf[aria-invalid="true"] {
    border-color: var(--danger);
}

.datumswahl__knopf:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.datumswahl__knopf .symbol {
    width: var(--icon-size-sm);
    height: var(--icon-size-sm);
    flex-shrink: 0;
    color: var(--text-secondary);
}

.datumswahl__text {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.datumswahl__text--leer {
    color: var(--text-muted);
}

.datumswahl__tafel {
    position: fixed;
    inset: auto;
    margin: 0;
    padding: 0;
    width: max-content;
    max-width: calc(100vw - 1rem);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-elevated);
    box-shadow: var(--glass-shadow);
    color: var(--text-primary);
    font-size: var(--font-size-sm);
}

.datumswahl__kopf {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-3) var(--space-2);
}

.datumswahl__kopf select {
    width: auto;
    min-height: 2.25rem;
    padding: 0 var(--space-2);
    font-size: var(--font-size-sm);
}

.datumswahl__jahr {
    min-width: 5.5rem;
}

.datumswahl__monat {
    min-width: 7.5rem;
    margin-right: auto;
}

.datumswahl__blaettern {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
}

.datumswahl__blaettern:hover {
    background: var(--bg-elevated-hover);
    color: var(--text-primary);
}

.datumswahl__blaettern .symbol {
    width: 1rem;
    height: 1rem;
}

.datumswahl__raster {
    display: grid;
    grid-template-columns: repeat(7, 2.5rem);
    gap: 2px;
    padding: var(--space-2) var(--space-3) var(--space-3);
}

.datumswahl__wochentag {
    padding-bottom: var(--space-2);
    text-align: center;
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-medium);
    color: var(--text-muted);
}

.datumswahl__tag {
    position: relative;
    height: 2.5rem;
    border: 0;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-primary);
    font-family: inherit;
    font-size: var(--font-size-sm);
    font-variant-numeric: tabular-nums;
    cursor: pointer;
}

.datumswahl__tag:hover:not(:disabled) {
    background: var(--bg-elevated-hover);
}

.datumswahl__tag:focus-visible {
    z-index: 1;
    outline: var(--focus-ring-width) solid var(--focus-ring);
    outline-offset: 0;
}

.datumswahl__tag--aussen {
    color: var(--text-muted);
}

/* Heute: ein kurzer Strich unter der Zahl, damit er neben dem gewählten Tag lesbar bleibt. */
.datumswahl__tag--heute {
    font-weight: var(--font-weight-bold);
}

.datumswahl__tag--heute::after {
    content: '';
    position: absolute;
    left: 50%;
    bottom: 0.375rem;
    width: 1rem;
    height: 2px;
    border-radius: 2px;
    background: var(--accent);
    transform: translateX(-50%);
}

.datumswahl__tag--gewaehlt,
.datumswahl__tag--gewaehlt:hover:not(:disabled) {
    background: var(--accent-surface);
    color: var(--text-on-accent);
}

.datumswahl__tag--gewaehlt.datumswahl__tag--heute::after {
    background: var(--text-on-accent);
}

.datumswahl__tag:disabled {
    color: var(--text-muted);
    text-decoration: line-through;
    cursor: not-allowed;
}

.datumswahl__fuss {
    display: flex;
    gap: var(--space-2);
    padding: var(--space-3);
    border-top: 1px solid var(--divider-color);
}

.datumswahl__fuss .knopf {
    flex: 1;
    min-height: 2.25rem;
}

.datumswahl__fuss .datumswahl__leeren {
    flex: 0 0 auto;
}

.datumswahl__fuss .datumswahl__leeren[hidden] {
    display: none;
}

/* ===== KÜCHE ===== */

/* Mengenzähler */
.mengenzaehler {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-1);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-full);
    background: var(--bg-input);
}

.mengenzaehler__knopf {
    display: grid;
    place-items: center;
    flex: 0 0 var(--target-min);
    width: var(--target-min);
    height: var(--target-min);
    padding: 0;
    border: none;
    border-radius: var(--radius-full);
    background: var(--accent-muted);
    color: var(--accent);
    font: inherit;
    font-size: var(--font-size-lg);
    font-weight: var(--font-weight-bold);
    cursor: pointer;
    transition: background var(--duration-control);
}

.mengenzaehler__knopf:hover:not(:disabled) {
    background: var(--accent-surface-hover);
}

.mengenzaehler__knopf:focus-visible {
    outline: var(--focus-ring-width) solid var(--focus-ring);
    outline-offset: var(--focus-ring-offset);
}

.mengenzaehler__knopf:disabled {
    background: transparent;
    color: var(--text-disabled);
    cursor: not-allowed;
}

.mengenzaehler__wert {
    font-size: var(--font-size-lg);
    font-weight: var(--font-weight-bold);
    font-variant-numeric: tabular-nums;
    text-align: center;
    min-width: 2rem;
}

.mengenzaehler__einheit {
    padding-right: var(--space-2);
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    white-space: nowrap;
}

/* Sternbewertung */
.sterne {
    display: inline-flex;
    gap: var(--space-1);
    font-size: var(--font-size-lg);
}

.sterne__stern {
    color: var(--text-muted);
}

.sterne__stern--an {
    color: var(--accent);
}

/* Sternwahl: fünf Sterne nebeneinander; gefüllt ist alles bis zum gewählten, beim Zeigen alles bis zum Stern unter dem Zeiger. */
.sternwahl {
    border: none;
    padding: 0;
    margin: 0;
}

/* Beschriftet wie ein Feld, nicht wie eine Feldgruppe; der Selektor schlägt die Regel der Einstellungskarte, die Legenden versteckt. */
.einstellungskarte__inhalt > .sternwahl > legend,
.sternwahl > legend {
    position: static;
    width: auto;
    height: auto;
    overflow: visible;
    clip-path: none;
    margin: 0 0 var(--space-1);
    padding: 0;
    border: none;
    font-weight: var(--font-weight-medium);
    font-size: var(--font-size-sm);
    color: var(--text-primary);
    text-transform: none;
    letter-spacing: normal;
}

/* Der Stern sitzt mittig in seiner Trefferfläche; der Versatz bringt den ersten bündig unter die Beschriftung. */
.sternwahl__sterne {
    margin-left: calc((var(--target-min) - 1em) / -2);
    font-size: var(--font-size-xl);
}

.sternwahl__sterne {
    display: inline-flex;
}

.sternwahl__stern {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: var(--target-min);
    height: var(--target-min);
    font-size: var(--font-size-xl);
    line-height: 1;
    color: var(--accent);
    cursor: pointer;
    border-radius: var(--radius-sm);
}

.sternwahl__feld {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.sternwahl__feld:checked + .sternwahl__stern ~ .sternwahl__stern,
.sternwahl__sterne input[value="0"]:checked ~ .sternwahl__stern {
    color: var(--text-muted);
}

.sternwahl__sterne:has(input[value="0"]:focus-visible),
.sternwahl__feld:focus-visible + .sternwahl__stern {
    outline: var(--focus-ring-width) solid var(--focus-ring);
    outline-offset: var(--focus-ring-offset);
}

@media (hover: hover) {
    .sternwahl__sterne:hover .sternwahl__stern {
        color: var(--accent);
    }

    .sternwahl__sterne .sternwahl__stern:hover ~ .sternwahl__stern {
        color: var(--text-muted);
    }
}

/* Zeileneditor */
.zeileneditor {
    width: 100%;
    table-layout: fixed;
    border-collapse: collapse;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
    background: var(--bg-elevated);
}

.zeileneditor th {
    padding: var(--space-2) var(--space-2) 0;
    text-align: left;
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
    color: var(--text-secondary);
}

/* Die Zutat bekommt den Platz; Menge und Einheit sind kurze Werte. */
[data-zeilen="zutat"] th:nth-child(1) { width: 5.5rem; }
[data-zeilen="zutat"] th:nth-child(2) { width: 6.5rem; }
[data-zeilen="zutat"] th:nth-child(4) { width: 28%; }
.zeileneditor th:last-child { width: 10rem; }

.zeileneditor__zeile {
    border-top: 1px solid var(--divider-color);
}

.zeileneditor tbody .zeileneditor__zeile:first-child {
    border-top: none;
}

.zeileneditor__zeile--abschnitt {
    background: var(--bg-secondary);
}

.zeileneditor__zeile td {
    padding: var(--space-2);
    border: none;
    vertical-align: top;
}

.zeileneditor__zeile input[type="text"],
.zeileneditor__zeile textarea {
    width: 100%;
    min-width: 0;
}

.zeileneditor__zeile--abschnitt input {
    font-weight: var(--font-weight-semibold);
}

.zeileneditor__aktionen {
    display: flex;
    justify-content: flex-end;
    gap: var(--space-1);
}

/* Die Schritte tragen dieselbe Nummer im Kreis wie auf der Rezeptseite, damit beim Verschieben klar bleibt, welcher Schritt wohin wandert. */
[data-zeilen="schritt"] tbody {
    counter-reset: schritt;
}

[data-zeilen="schritt"] .zeileneditor__zeile:not(.zeileneditor__zeile--abschnitt) {
    counter-increment: schritt;
}

/* Die Nummer steht absolut im Einzug der Zelle; ein Raster auf der Zelle nähme ihr die Tabellenrolle und schöbe die Knöpfe darunter. */
[data-zeilen="schritt"] .zeileneditor__zeile:not(.zeileneditor__zeile--abschnitt) td:first-child {
    position: relative;
    padding-left: calc(var(--space-2) + 2rem + var(--space-3));
}

[data-zeilen="schritt"] .zeileneditor__zeile:not(.zeileneditor__zeile--abschnitt) td:first-child::before {
    content: counter(schritt);
    position: absolute;
    top: calc(var(--space-2) + (var(--target-min) - 2rem) / 2);
    left: var(--space-2);
    display: grid;
    place-items: center;
    width: 2rem;
    height: 2rem;
    border-radius: var(--radius-full);
    background: var(--accent-muted);
    color: var(--accent);
    font-weight: var(--font-weight-bold);
    font-variant-numeric: tabular-nums;
}

@media (max-width: 639px) {
    [data-zeilen="schritt"] .zeileneditor__zeile:not(.zeileneditor__zeile--abschnitt) td:first-child {
        padding-left: calc(2rem + var(--space-3));
    }

    [data-zeilen="schritt"] .zeileneditor__zeile:not(.zeileneditor__zeile--abschnitt) td:first-child::before {
        top: calc((var(--target-min) - 2rem) / 2);
        left: 0;
    }

    /* In einer Karte rahmt schon die Karte; ein zweiter Rahmen samt Einzug ließe der Zutat am Telefon kaum Platz. */
    .einstellungskarte .tabellenrahmen:has(.zeileneditor),
    .einstellungskarte .zeileneditor {
        border: none;
        border-radius: 0;
        background: none;
    }

    .einstellungskarte .zeileneditor__zeile {
        padding-inline: 0;
    }

    .einstellungskarte .zeileneditor__zeile--abschnitt {
        padding-inline: var(--space-2);
        border-radius: var(--radius-sm);
    }
}

/* Ein Schritt wächst mit seinem Text, statt ihn hinter einem Rollbalken zu verstecken. */
[data-zeilen="schritt"] textarea {
    field-sizing: content;
    line-height: 1.65;
}

@media (max-width: 639px) {
    .zeileneditor thead {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip-path: inset(50%);
    }

    .zeileneditor,
    .zeileneditor tbody {
        display: block;
    }

    /* Am Telefon: Menge, Einheit und Zutat in einer Reihe, Notiz und Aktionen darunter. */
    .zeileneditor__zeile {
        display: grid;
        grid-template-columns: 4.5rem 5.5rem minmax(0, 1fr);
        gap: var(--space-2);
        padding: var(--space-3);
    }

    .zeileneditor__zeile td {
        display: block;
        padding: 0;
    }

    [data-zeilen="zutat"] .zeileneditor__zeile:not(.zeileneditor__zeile--abschnitt) td:nth-child(4) {
        grid-column: 1 / 3;
    }

    .zeileneditor__zeile td[colspan],
    [data-zeilen="schritt"] .zeileneditor__zeile td:first-child {
        grid-column: 1 / -1;
    }

    .zeileneditor__zeile .zeileneditor__aktionen {
        grid-column: 1 / -1;
    }
}

/* Abhakliste */
.abhakliste {
    list-style: none;
    padding: 0;
    margin: 0;
}

/* Zeile und Knopf „Bearbeiten“ stehen nebeneinander; die Nebenangaben brechen unter den Text um, statt ihn zu quetschen. */
.abhakliste__eintrag {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding-right: var(--space-2);
    border-bottom: 1px solid var(--divider-color);
}

.abhakliste__eintrag label {
    display: flex;
    flex: 1;
    flex-wrap: wrap;
    align-items: center;
    column-gap: var(--space-3);
    min-width: 0;
    padding: var(--space-3) var(--space-4);
    min-height: var(--target-min);
    cursor: pointer;
}

.abhakliste__eintrag input[type="checkbox"] {
    flex: 0 0 auto;
    width: 1.25rem;
    height: 1.25rem;
    accent-color: var(--accent);
}

.abhakliste__eintrag--erledigt label {
    text-decoration: line-through;
    opacity: 0.55;
}

.abhakliste__text {
    flex: 1;
}

.abhakliste__neben {
    flex-basis: 100%;
    padding-left: calc(1.25rem + var(--space-3));
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
}

.abhakliste__abschnitt {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin: 0;
    padding: var(--space-4) var(--space-4) var(--space-2);
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-semibold);
    color: var(--accent);
}

.abhakliste__anzahl {
    display: inline-block;
    min-width: 1.5rem;
    padding: 0 var(--space-2);
    border-radius: var(--radius-full);
    background: var(--neutral-bg);
    color: var(--text-secondary);
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-semibold);
    font-variant-numeric: tabular-nums;
    text-align: center;
}

.abhakliste__menge {
    font-weight: var(--font-weight-semibold);
    font-variant-numeric: tabular-nums;
}

/* Zutatenliste und Schrittliste */
.zutaten,
.schritte {
    list-style: none;
    padding: 0;
    margin: 0;
}

.zutaten__abschnitt,
.schritte__abschnitt {
    padding: var(--space-4) 0 var(--space-2);
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-semibold);
    color: var(--accent);
}

/* Menge rechtsbündig in fester Spalte, damit das Auge die Zahlen senkrecht überfliegen kann; die Notiz steht unter dem Namen. */
.zutaten__zeile {
    display: grid;
    grid-template-columns: 5.5rem minmax(0, 1fr);
    column-gap: var(--space-3);
    padding: var(--space-2) 0;
    border-bottom: 1px solid var(--divider-color);
}

.zutaten__zeile:last-child {
    border-bottom: none;
}

.zutaten__menge {
    font-weight: var(--font-weight-semibold);
    font-variant-numeric: tabular-nums;
    text-align: right;
}

.zutaten__notiz {
    grid-column: 2;
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
}

/* Teilrezept: ein eingebautes Rezept, abgesetzt als eigener Kasten, damit sichtbar bleibt, dass es ein eigenes Rezept ist. */
.teilrezept {
    margin: var(--space-4) 0;
    padding: var(--space-3) var(--space-4);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-elevated);
}

.teilrezept__kopf {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: var(--space-1) var(--space-2);
    margin: 0 0 var(--space-2);
    font-weight: var(--font-weight-semibold);
}

.teilrezept__marke {
    font-size: var(--font-size-xs);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-secondary);
}

.teilrezept__menge {
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-normal);
    color: var(--text-secondary);
}

/* Teilrezept im Editor: Auswahl des Rezepts und seine Portionen in einer Zeile. */
.teilrezeptwahl {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-2);
}

.teilrezeptwahl select {
    flex: 1 1 14rem;
    min-width: 0;
}

.teilrezeptwahl input {
    width: 5rem;
}

.teilrezeptwahl__name,
.teilrezeptwahl__einheit {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
}

/* Gezählt wird per CSS, weil ein natives ol die Abschnittszeilen mitzählen würde. */
.schritte {
    counter-reset: schritt;
}

.schritte__schritt {
    counter-increment: schritt;
    display: grid;
    grid-template-columns: 2rem minmax(0, 1fr);
    column-gap: var(--space-4);
    padding: var(--space-4) 0;
    line-height: 1.65;
    border-bottom: 1px solid var(--divider-color);
}

.schritte__schritt:last-child {
    border-bottom: none;
}

.schritte__schritt::before {
    content: counter(schritt);
    display: grid;
    place-items: center;
    width: 2rem;
    height: 2rem;
    border-radius: var(--radius-full);
    background: var(--accent-muted);
    color: var(--accent);
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-bold);
    font-variant-numeric: tabular-nums;
    line-height: 1;
}

/* Rezeptkarte */
.rezeptkarten {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr));
    gap: var(--space-5);
    margin-bottom: var(--space-5);
}

.rezeptkarten__weitere {
    grid-column: 1 / -1;
    justify-self: center;
}

.rezeptkarte {
    display: flex;
    flex-direction: column;
    text-decoration: none;
    color: inherit;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    background: var(--bg-elevated);
    padding: var(--space-4);
    transition: border-color var(--duration-control);
    position: relative;
}

.rezeptkarte:hover,
.rezeptkarte:focus-visible {
    border-color: var(--accent-muted);
}

.rezeptkarte:focus-visible {
    outline: var(--focus-ring-width) solid var(--focus-ring);
    outline-offset: var(--focus-ring-offset);
}

.rezeptkarte__bild {
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    border-radius: var(--radius-md);
    margin-bottom: var(--space-3);
}

.rezeptkarte__platzhalter {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 9rem;
    color: var(--text-secondary);
    margin-bottom: var(--space-3);
}

.rezeptkarte__platzhalter .symbol {
    width: 3rem;
    height: 3rem;
}

/* Kochbuchmotiv auf der Kachel: das Symbol steht mittig auf gedämpftem Akzentgrund, im Format des Fotos. */
.rezeptkarte__motiv {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    aspect-ratio: 16 / 9;
    border-radius: var(--radius-md);
    margin-bottom: var(--space-3);
    background: var(--accent-muted);
    color: var(--accent);
}

.rezeptkarte__motiv .motiv {
    height: 60%;
    width: auto;
}

/* Bildwahl im Kochbuchformular: Radioknöpfe als Kacheln, mit der Tastatur wie gewohnt bedienbar. */
.motivwahl {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(7.5rem, 1fr));
    gap: var(--space-3);
    margin-bottom: var(--space-4);
}

.motivkachel {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-1);
    padding: var(--space-2);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-elevated);
    text-align: center;
    cursor: pointer;
    transition: border-color var(--duration-control);
}

.motivkachel:hover {
    border-color: var(--accent-muted);
}

.motivkachel:has(.motivkachel__radio:checked) {
    border-color: var(--accent);
}

.motivkachel:has(.motivkachel__radio:focus-visible) {
    outline: var(--focus-ring-width) solid var(--focus-ring);
    outline-offset: var(--focus-ring-offset);
}

.motivkachel__radio {
    position: absolute;
    opacity: 0;
    inset: 0;
    margin: 0;
    cursor: pointer;
}

.motivkachel__vorschau {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    border-radius: var(--radius-sm);
    background: var(--accent-muted);
    color: var(--accent);
}

.motivkachel__vorschau--blass {
    background: transparent;
    color: var(--text-secondary);
    border: 1px dashed var(--border-color);
}

.motivkachel__vorschau .motiv {
    height: 70%;
    width: auto;
}

.motivkachel__vorschau .symbol {
    width: 1.75rem;
    height: 1.75rem;
}

.motivkachel__vorschau img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.motivkachel__name {
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
    color: var(--text-primary);
}

.motivkachel__hinweis {
    font-size: var(--font-size-xs, 0.75rem);
    color: var(--text-muted);
}

.rezeptkarte__titel {
    font-size: var(--font-size-lg);
    font-weight: var(--font-weight-bold);
    color: var(--text-primary);
    margin: 0 0 var(--space-2);
}

/* Die Sterne sitzen unten, damit sie in einer Reihe gleich hoher Karten auf einer Linie stehen, egal wie lang der Titel ist. */
.rezeptkarte__unter {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    margin: auto 0 0;
}

/* Der Schatten hält das Herz auf hellen Fotos sichtbar. */
.rezeptkarte__favorit {
    position: absolute;
    top: var(--space-4);
    right: var(--space-4);
    display: flex;
    align-items: center;
    justify-content: center;
    width: var(--target-min);
    height: var(--target-min);
    color: var(--accent);
    filter: drop-shadow(0 1px 2px rgb(0 0 0 / 0.6));
}

.rezeptkarte__favorit svg {
    width: 1.5rem;
    height: 1.5rem;
    fill: currentColor;
}

/* Kochmodus */
.kochmodus {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background: var(--bg-primary);
}

.kochmodus__kopf {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-3);
    min-height: var(--target-min);
    padding: var(--space-3) var(--space-4);
    flex: 0 0 auto;
    border-bottom: 1px solid var(--divider-color);
}

.kochmodus__kopf h1 {
    margin: 0;
    min-width: 0;
    font-size: var(--font-size-lg);
    overflow-wrap: anywhere;
}

.kochmodus__kopf .knopf {
    flex: 0 0 auto;
}

.kochmodus > [data-wachhalten] {
    padding: 0 var(--space-4);
}

.kochmodus__inhaltsbereich {
    display: flex;
    flex: 1;
    overflow: hidden;
}

.kochmodus__hauptbereich {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
    overflow-y: auto;
}

.kochmodus__hauptbereich [data-schritte] {
    flex: 1;
    padding: 0 var(--space-4) var(--space-6);
}


.kochmodus__zaehler {
    padding: var(--space-4) var(--space-4) 0;
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    margin-bottom: var(--space-4);
}

/* Lesbar aus einer Armlänge Abstand: groß, aber linksbündig und in normaler Stärke, weil es ganze Absätze sind. */
.kochmodus__schritt {
    font-size: max(1.5rem, var(--font-size-xl));
    max-width: 60ch;
    margin: 0 auto;
    line-height: var(--line-height-base);
}

.kochmodus__schritt h2 {
    margin: 0 0 var(--space-3);
    font-size: var(--font-size-base);
    color: var(--text-secondary);
    text-transform: uppercase;
}

.kochmodus__zutaten {
    flex: 0 0 auto;
    width: 20rem;
    padding: var(--space-4);
    background: var(--bg-secondary);
    border-left: 1px solid var(--divider-color);
    overflow-y: auto;
}

.kochmodus__zutaten h2 {
    margin: 0 0 var(--space-3);
    font-size: var(--font-size-lg);
}

.kochmodus__navigation {
    display: flex;
    gap: var(--space-3);
    padding: var(--space-4);
    flex: 0 0 auto;
    background: var(--bg-secondary);
    border-top: 1px solid var(--divider-color);
    min-height: var(--target-gross-grob);
}

.kochmodus__navigation .knopf {
    flex: 1;
}

@media (max-width: 639px) {
    .kochmodus__inhaltsbereich {
        flex-direction: column;
    }

    .kochmodus__zutaten {
        width: 100%;
        border-left: none;
        border-top: 1px solid var(--divider-color);
        max-height: 25vh;
    }
}

/* Küchenleiste */
.kuechenleiste {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    margin-bottom: var(--space-5);
}

.kuechenleiste__aktionen {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
}

/* Die Küchen-Bauteile setzen selbst display; ohne diese Regel bliebe, was das Skript per hidden ausblendet, sichtbar. */
.kochmodus [hidden],
[data-wachhalten][hidden],
[data-wachhalten] [hidden] {
    display: none;
}

/* Rechts neben der Überzeile: Drucken und Bearbeiten als Symbolknöpfe. */
.kopfzeile {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--space-3);
}

.kopfzeile .ueberzeile {
    flex: 1;
    min-width: 0;
}

.kopfzeile__werkzeuge {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    gap: var(--space-2);
}

/* Schalter mit Symbol statt Wörtern, für enge Stellen wie die Kopfzeile; der Name steht im aria-label und im Tooltip. */
.schalter--symbol {
    gap: var(--space-2);
    padding: 0 var(--space-2);
}

.schalter--symbol .symbol {
    width: var(--icon-size-sm);
    height: var(--icon-size-sm);
    color: var(--text-secondary);
}

.schalter--symbol:has(input:checked) .symbol {
    color: var(--accent);
}

.schalter--symbol:has(input:disabled) {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Rezeptseite: Kopf mit Titelbild, darunter Zutaten und Zubereitung nebeneinander */
.rezeptkopf {
    display: grid;
    gap: var(--space-6);
    margin-bottom: var(--space-7);
}

.rezeptkopf__bild {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    border-radius: var(--radius-lg);
    background: var(--bg-secondary);
    box-shadow: var(--shadow-md);
}

.rezeptkopf__kategorien {
    margin-bottom: var(--space-2);
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-semibold);
    color: var(--accent);
}

.rezeptkopf h1 {
    margin-bottom: var(--space-3);
}

.rezeptkopf__beschreibung {
    max-width: 60ch;
    margin-bottom: var(--space-5);
    color: var(--text-secondary);
    line-height: 1.6;
}

.rezeptkopf__zeiten {
    display: flex;
    flex-wrap: wrap;
    row-gap: var(--space-3);
    margin: 0 0 var(--space-5);
    padding: var(--space-3) 0;
    border-top: 1px solid var(--divider-color);
    border-bottom: 1px solid var(--divider-color);
}

.rezeptkopf__zeiten > div {
    padding: 0 var(--space-5);
    border-left: 1px solid var(--divider-color);
}

.rezeptkopf__zeiten > div:first-child {
    padding-left: 0;
    border-left: none;
}

.rezeptkopf__zeiten dt {
    font-size: var(--font-size-xs);
    color: var(--text-secondary);
}

.rezeptkopf__zeiten dd {
    margin: 0;
    font-weight: var(--font-weight-semibold);
    font-variant-numeric: tabular-nums;
}

.rezeptkopf__merkmale {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-2);
    margin-bottom: var(--space-5);
}

.rezeptkopf__aktionen {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-3);
    margin-bottom: var(--space-4);
}

.rezeptkopf__aktionen #favorit {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
}

.rezeptinhalt {
    display: grid;
    gap: var(--space-7);
    align-items: start;
}

.rezeptinhalt h2 {
    margin-bottom: var(--space-4);
}

.rezeptinhalt__zutaten {
    padding: var(--space-5);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    background: var(--bg-elevated);
}

.rezeptinhalt__zutaten .mengenzaehler {
    margin-bottom: var(--space-3);
}

.rezeptinhalt__zubereitung > h2 + .schritte .schritte__schritt:first-child {
    padding-top: 0;
}

.rezeptinhalt__quelle {
    margin-top: var(--space-6);
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
}

@media (min-width: 900px) {
    .rezeptkopf--mit-bild {
        grid-template-columns: minmax(0, 24rem) minmax(0, 1fr);
        align-items: center;
        gap: var(--space-7);
    }
}

@media (min-width: 1100px) {
    .rezeptinhalt {
        grid-template-columns: minmax(18rem, 24rem) minmax(0, 1fr);
    }

    /* Beim Lesen der Schritte bleiben die Zutaten im Blick. */
    .rezeptinhalt__zutaten {
        position: sticky;
        top: var(--space-5);
    }
}

@media (max-width: 639px) {
    .rezeptkopf {
        gap: var(--space-5);
    }

    .rezeptkopf__bild {
        aspect-ratio: 16 / 10;
    }

    .rezeptkopf__zeiten {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: var(--space-3);
    }

    .rezeptkopf__zeiten > div {
        padding: 0;
        border-left: none;
    }

    /* Am Telefon zwei Knöpfe je Reihe statt sieben untereinander; der Kochmodus führt über die ganze Breite. */
    .rezeptkopf__aktionen {
        display: grid;
        grid-template-columns: 1fr 1fr;
    }

    .rezeptkopf__aktionen > .knopf--primaer {
        grid-column: 1 / -1;
    }

    .rezeptkopf__aktionen .knopf,
    .rezeptkopf__aktionen form,
    .rezeptkopf__aktionen #favorit {
        width: 100%;
    }

    .rezeptkopf__aktionen #favorit .knopf {
        width: 100%;
    }

    .rezeptinhalt__zutaten {
        margin: 0 calc(-1 * var(--space-2));
        padding: var(--space-4);
    }
}

.favoritknopf--an svg {
    fill: currentColor;
    color: var(--accent);
}

/* Einkaufsliste */
.schnelleingabe {
    display: flex;
    gap: var(--space-2);
}

.schnelleingabe input[type="text"] {
    flex: 1;
    min-width: 0;
}

.schnelleingabe .knopf {
    flex: 0 0 auto;
}

.schnelleingabe__hilfe {
    margin: var(--space-1) 0 var(--space-5);
}

.einkaufszettel {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    background: var(--bg-elevated);
    overflow: hidden;
}

.einkaufszettel__stand {
    padding: var(--space-3) var(--space-4);
    border-bottom: 1px solid var(--divider-color);
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
}

.einkaufszettel .abhakliste__eintrag:last-child {
    border-bottom: none;
}

.einkaufszettel .abhakliste + .abhakliste__abschnitt,
.einkaufszettel .abhakliste + .einkaufszettel__erledigt {
    border-top: 1px solid var(--divider-color);
}

.einkaufszettel__erledigt > summary {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    min-height: var(--target-min);
    padding: 0 var(--space-4);
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-semibold);
    color: var(--text-secondary);
    cursor: pointer;
}

.einkaufszettel__erledigt > summary:focus-visible {
    outline: var(--focus-ring-width) solid var(--focus-ring);
    outline-offset: calc(-1 * var(--focus-ring-width));
}

.einkaufszettel__block + .einkaufszettel__block {
    border-top: 1px solid var(--border-color);
}

.einkaufszettel__blockkopf {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-2);
    padding: var(--space-4) var(--space-4) var(--space-2);
}

.einkaufszettel__blockkopf h2 {
    font-size: var(--font-size-lg);
}

.einkaufszettel__blockkopf h2 a {
    color: var(--text-primary);
    text-decoration: none;
}

.einkaufszettel__blockkopf h2 a:hover {
    text-decoration: underline;
}

.einkaufszettel .leerer-zustand {
    margin: var(--space-4);
}

/* 6. Wetterzeile (STATUS 6) */
.wetterzeile {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    column-gap: var(--space-3);
    row-gap: var(--space-1);
    margin: 0 0 var(--space-3);
    padding: var(--space-3) var(--space-4);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-elevated);
}

.wetterzeile .symbol {
    flex: 0 0 auto;
    width: var(--icon-size-nav);
    height: var(--icon-size-nav);
}

.wetterzeile__wort {
    font-weight: var(--font-weight-semibold);
}

.wetterzeile__text {
    flex: 1 1 12rem;
    min-width: 0;
}

.wetterzeile__ort {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
}

.wetterzeile--fehlt {
    border-color: var(--warning-border);
    background: var(--warning-bg);
}

/* 12. Monatsleiste (LISTEN 12) */
.monatsleiste {
    margin: 0 0 var(--space-5);
    padding: var(--space-2) var(--space-4);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    background: var(--bg-elevated);
}

.monatsleiste__zeile {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: var(--space-1);
    padding: var(--space-2) 0;
}

.monatsleiste__zeile + .monatsleiste__zeile {
    border-top: 1px solid var(--divider-color);
}

.monatsleiste__zeile--kopf {
    border-bottom: 1px solid var(--border-color);
}

.monatsleiste__name {
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-semibold);
}

.monatsleiste__felder {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    gap: 2px;
}

.monatsleiste__monat,
.monatsleiste__feld {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 1.75rem;
    border-radius: var(--radius-sm);
    font-size: var(--font-size-xs);
}

.monatsleiste__monat {
    color: var(--text-secondary);
}

.monatsleiste__initial {
    display: inline;
}

.monatsleiste__kurz {
    display: none;
}

.monatsleiste__feld {
    border: 1px solid var(--border-color);
}

/* Gefüllt, schraffiert und mit Häkchen: Die Markierung trägt auch ohne Farbe. */
.monatsleiste__feld--an {
    border-color: var(--accent-surface);
    background-color: var(--accent-surface);
    background-image: repeating-linear-gradient(135deg, transparent 0 5px, rgba(0, 0, 0, 0.2) 5px 7px);
    color: var(--text-on-accent);
    font-weight: var(--font-weight-bold);
}

.monatsleiste__monat--jetzt {
    color: var(--text-primary);
    font-weight: var(--font-weight-bold);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.monatsleiste__feld--jetzt {
    box-shadow: inset 0 0 0 2px var(--text-primary);
    border-color: var(--text-primary);
}

@media (min-width: 640px) {
    .monatsleiste__zeile {
        grid-template-columns: 7rem minmax(0, 1fr);
        align-items: center;
        gap: var(--space-3);
    }

    .monatsleiste__initial {
        display: none;
    }

    .monatsleiste__kurz {
        display: inline;
    }

/* ===== SAMMELERFASSUNG ===== */

.sammelerfassung {
    display: flex;
    flex-direction: column;
    gap: var(--space-5);
}

.sammelerfassung__zeilen {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr));
    gap: var(--space-4) var(--space-5);
    align-items: start;
}

.sammelerfassung__zeile {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.sammelerfassung__zeile .diagramm__tabelle {
    margin-top: 0;
}

.sammelerfassung__zeile .diagramm__tabelle summary {
    padding-left: 0;
}

@media print {
    .sammelerfassung {
        display: none;
    }
}
