/* Konto-Archiv (konto/archiv.html): ergänzt konto.css, nutzt deren Tokens und Klassen.
   Aufbau wie Qonto: Seitenkopf mit Titel und Export rechts, darunter direkt die Liste. */

.a-raster { display: flex; flex-direction: column; gap: 16px; }
.a-raster > .k-karte + .k-karte { margin-top: 0; }
/* .a-titel: Baustein .k-kartentitel in konto.css */
.a-email { min-width: 0; max-width: 32ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; color: var(--text-3); }
.a-skelett-kopf { padding: 4px 0 8px; }

/* ---------- Seitenkopf: Titel links, Export rechts ---------- */
.a-seitenkopf { display: flex; align-items: center; justify-content: space-between; gap: 12px 16px; }
.a-seitenkopf-text { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.a-seitenkopf-text .k-unter:empty { display: none; }
.a-export { flex: none; }
/* Export: ein beschrifteter Knopf, öffnet das Menü mit ZIP, CSV, Protokoll und Verfahrensdoku */
.a-export-knopf { gap: 8px; padding-left: 14px; padding-right: 12px; }
.a-export-knopf .k-ikon { width: 20px; height: 20px; }
.a-export-pfeil .k-ikon { width: 16px; height: 16px; color: var(--text-3); transition: rotate .15s var(--ease); }
.a-export-knopf[aria-expanded="true"] .a-export-pfeil .k-ikon { rotate: 180deg; }

/* ---------- Prüfstatus: nur sichtbar, wenn etwas abweicht ---------- */
.a-pruefung { display: flex; flex-direction: column; gap: 8px; }
.a-pruefung[hidden] { display: none; }
.a-pruef-zeile { display: flex; align-items: flex-start; gap: 10px; font-size: 14px; color: var(--text-2); }
.a-pruef-zeichen { display: grid; place-items: center; width: 22px; height: 22px; flex: none; margin-top: -1px; border-radius: 50%; color: var(--text-3); }
.a-pruef-zeichen .k-ikon { width: 16px; height: 16px; } /* klein: 16 px, Strich 2 */
.a-pruef-zeile[data-zustand="ok"] .a-pruef-zeichen { background: var(--success-soft); color: var(--success-text); }
.a-pruef-zeile[data-zustand="fehler"] .a-pruef-zeichen { background: var(--error-soft); color: var(--error-text); }
.a-pruef-zeile[data-zustand="fehler"] { color: var(--text); font-weight: 500; }
.a-pruef-zeile[data-zustand="laeuft"] .a-pruef-zeichen::before {
  content: ""; width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid var(--text-3); border-right-color: transparent; animation: k-drehen .7s linear infinite;
}
.a-pruef-fehler { margin: 0; padding-left: 32px; font-size: 13px; color: var(--text-2); display: flex; flex-direction: column; gap: 2px; overflow-wrap: anywhere; }
.a-pruef-fehler strong { font-weight: 600; color: var(--text); }

/* ---------- Liste der abgeschlossenen Rechnungen ---------- */
.a-liste-karte { padding-top: 8px; padding-bottom: 8px; }
.a-liste-karte > .skelett, .a-liste-karte > .k-leer { margin: 12px 0; }
.a-liste { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.a-liste[hidden] { display: none; }
.a-zeile {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; align-items: center; gap: 12px;
  min-height: 64px; padding: 8px 0; border-top: 1px solid var(--border);
}
.a-zeile:first-child { border-top: 0; }
.a-zeile:has(.a-menue:not([hidden])) { position: relative; z-index: 5; }
/* Dateisymbol links: Tipp lädt das PDF */
.a-symbol {
  display: grid; place-items: center; width: 40px; height: 40px; flex: none; border-radius: var(--radius-md);
  background: var(--primary-soft); color: var(--primary); text-decoration: none;
  transition: background-color .15s, color .15s;
}
.a-symbol .k-ikon { width: 20px; height: 20px; }
.a-symbol--leer { background: var(--surface-2); color: var(--text-3); }
a.a-symbol:focus-visible { box-shadow: var(--ring); outline: none; }
@media (hover: hover) { a.a-symbol:hover { background: var(--primary); color: var(--surface); } }
.a-zeile-text { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.a-nummer { font-size: 15px; line-height: 1.3; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.a-kunde { min-width: 0; font-size: 13px; line-height: 1.35; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.a-rechts { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.a-datum { font-size: 13px; line-height: 1.35; color: var(--text-3); font-variant-numeric: tabular-nums; white-space: nowrap; }
.a-zahl { text-align: right; font-size: 15px; line-height: 1.3; font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; white-space: nowrap; }
.a-zeile-aktion { display: flex; margin-right: -6px; }
.a-platz { width: 40px; height: 40px; flex: none; }

/* Überlaufknopf ⋮: ruhig, Tippfläche 44 px am Handy */
.a-mehr {
  display: grid; place-items: center; width: 40px; height: 40px; padding: 0; flex: none;
  border: 1px solid transparent; border-radius: var(--radius-md); background: none; cursor: pointer;
  color: var(--text-3); transition: background-color .15s, color .15s;
}
.a-mehr .k-ikon { width: 20px; height: 20px; }
.a-mehr:focus-visible { box-shadow: var(--ring); outline: none; }
@media (hover: hover) { .a-mehr:hover { background: var(--surface-2); color: var(--text); } }
.a-mehr[aria-expanded="true"] { background: var(--surface-2); color: var(--text); }

/* Menü */
.a-menue-huelle { position: relative; }
.a-menue {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 20; min-width: 220px; padding: 6px;
  display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
}
.a-menue[hidden] { display: none; }
.a-menue.nach-oben { top: auto; bottom: calc(100% + 6px); }
@media (prefers-reduced-motion: no-preference) {
  .a-menue:not([hidden]) { animation: a-menue-auf .14s var(--ease); }
}
@keyframes a-menue-auf { from { opacity: 0; scale: .97; } }
.a-menue-punkt {
  display: flex; align-items: center; gap: 10px; width: 100%; min-height: 38px; padding: 8px 10px; border-radius: var(--radius-sm);
  color: var(--text-2); font-size: 14px; font-weight: 500; text-decoration: none; white-space: nowrap;
}
.a-menue-punkt .k-ikon { width: 16px; height: 16px; color: var(--text-3); }
.a-menue-punkt:hover, .a-menue-punkt:focus-visible { background: var(--surface-2); color: var(--text); outline: none; }

/* ---------- Lücken ---------- */
.a-luecken { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.a-luecke {
  display: grid; grid-template-columns: minmax(9ch, auto) 1fr; align-items: center; gap: 6px 16px;
  padding: 12px 0; border-top: 1px solid var(--border);
}
.a-luecke:first-child { border-top: 0; padding-top: 0; }
.a-luecke-form { display: flex; gap: 8px; min-width: 0; }
.a-luecke-form .k-eingabe { flex: 1; min-height: 36px; padding: 6px 10px; font-size: 15px; }
.a-luecke-form .k-knopf { flex: none; }
.a-luecke-grund { font-size: 14px; color: var(--text-2); overflow-wrap: anywhere; }
.a-luecke-meldung { grid-column: 2; }
.a-luecke-meldung:empty { display: none; }

/* ---------- Protokoll (einklappbar) ---------- */
.a-protokoll { gap: 0; }
.a-protokoll[open] { gap: 16px; }
.a-protokoll-kopf {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; cursor: pointer; list-style: none;
  margin: -8px; padding: 8px 8px 8px 32px; border-radius: var(--radius-md); position: relative;
}
.a-protokoll-kopf::-webkit-details-marker { display: none; }
.a-protokoll-kopf::before {
  content: ""; position: absolute; left: 12px; top: 20px; width: 7px; height: 7px; margin-top: -5px;
  border: solid var(--text-3); border-width: 0 2px 2px 0; rotate: -45deg; transition: rotate .15s var(--ease);
}
.a-protokoll[open] > .a-protokoll-kopf::before { rotate: 45deg; margin-top: -6px; }
@media (hover: hover) { .a-protokoll-kopf:hover { background: var(--surface-2); } }
.a-eintraege { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.a-eintrag {
  display: grid; grid-template-columns: 17ch 1fr auto; align-items: baseline; gap: 2px 16px;
  padding: 10px 0; border-top: 1px solid var(--border); font-size: 14px;
}
.a-eintrag:first-child { border-top: 0; padding-top: 0; }
.a-eintrag-zeit { color: var(--text-3); font-size: 13px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.a-eintrag-text { display: flex; flex-wrap: wrap; gap: 0 10px; min-width: 0; }
.a-eintrag-aktion { color: var(--text); font-weight: 500; }
.a-eintrag-detail { color: var(--text-3); overflow-wrap: anywhere; }
.a-eintrag-seq { font-variant-numeric: tabular-nums; font-size: 12px; color: var(--text-3); white-space: nowrap; }
#protokoll-status:empty { display: none; }

/* ---------- Handy: Export kompakt, Zeilen dichter ---------- */
@media (max-width: 640px) {
  .a-email { display: none; }
  .a-export-knopf { padding-left: 12px; padding-right: 10px; gap: 6px; }
  .a-zeile { gap: 10px; min-height: 60px; }
  .a-symbol { width: 36px; height: 36px; }
}
/* Schmale Handys (360 bis 400 px): etwas enger, damit die Nummer ganz sichtbar bleibt */
@media (max-width: 400px) {
  .a-zeile { gap: 8px; }
  .a-symbol { width: 32px; height: 32px; }
  .a-symbol .k-ikon { width: 20px; height: 20px; }
  .a-luecke { grid-template-columns: 1fr; }
  .a-luecke-meldung { grid-column: 1; }
  .a-eintrag { grid-template-columns: 1fr auto; }
  .a-eintrag-zeit { grid-column: 1; grid-row: 1; }
  .a-eintrag-seq { grid-column: 2; grid-row: 1; }
  .a-eintrag-text { grid-column: 1 / -1; grid-row: 2; }
}

/* ---------- Touch: Tippflächen mindestens 44 px ---------- */
@media (max-width: 760px), (pointer: coarse) {
  .k-knopf--klein { min-height: 44px; }
  .a-mehr, .a-platz { width: 44px; height: 44px; }
  .a-zeile-aktion { margin-right: -10px; }
  .a-menue-punkt { min-height: 44px; font-size: 15px; }
  .a-luecke-form .k-eingabe { min-height: 44px; font-size: 16px; }
  .a-protokoll-kopf { min-height: 44px; }
}

/* Galaxy Fold zugeklappt (280 px): nichts breiter als der Bildschirm */
@media (max-width: 360px) {
  .a-luecke-form { flex-direction: column; }
  .a-luecke-form .k-knopf { width: 100%; }
}

/* Sehr schmal (unter 340 px): weiter in einer Zeile, das Symbol entfällt, Downloads bleiben im ⋮-Menü */
@media (max-width: 339px) {
  .a-zeile { grid-template-columns: minmax(0, 1fr) auto auto; gap: 8px; }
  .a-symbol { display: none; }
  .a-zahl { font-size: 14px; }
}

@media print {
  .a-export, .a-zeile-aktion, #protokoll-mehr { display: none; }
}
