/* =====================================================================
   Angebote (Startseite): Kennzahlen, Suche, Auswahl, Tabelle am Rechner (ab 1100 px) und Karten am Handy.
   Farben nur über Variablen; Lage und Höhe nur über Klassen (kein style-Attribut). Bedienkonzept: doku/UX-KONZEPT.md, Abschnitt „Angebotsliste“.
   ===================================================================== */

/* Stände: eigene Farben je Stand (Hintergrund und Schrift, hell und dunkel; Kontrast mindestens 4,5:1) */
:root {
  --st-neu-bg: #FFF1E2;        --st-neu-fg: #A04D00;
  --st-ki-bg: #EFE9FB;         --st-ki-fg: #5B3BA6;
  --st-rueckruf-bg: #FCE7F1;   --st-rueckruf-fg: #A3194F;
  --st-daten-bg: #F1F4DC;      --st-daten-fg: #5A6400;
  --st-erstellt-bg: #E7ECF1;   --st-erstellt-fg: #3B5368;
  --st-fehlt-bg: #FFF3DC;      --st-fehlt-fg: #8F5B00;
  --st-freigabe-bg: #D8F1EF;   --st-freigabe-fg: #0B5F5B;
  --st-sendet-bg: #E4E8FB;     --st-sendet-fg: #2E3D9C;
  --st-verschickt-bg: #DCEBFA; --st-verschickt-fg: #0B4F8A;
  --st-bestellt-bg: #E6F4ED;   --st-bestellt-fg: #1D7A52;
  --st-bestaetigt-bg: #1D7A52; --st-bestaetigt-fg: #FFFFFF;
  --st-abgelehnt-bg: #EDE9E3;  --st-abgelehnt-fg: #6B6158;
  --st-problem-bg: #FCEBE9;    --st-problem-fg: #B3261E;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --st-neu-bg: #2E1F10;        --st-neu-fg: #FF9A2E;
    --st-ki-bg: #261D3D;         --st-ki-fg: #C8B6F5;
    --st-rueckruf-bg: #3A1526;   --st-rueckruf-fg: #F5A3C5;
    --st-daten-bg: #262A10;      --st-daten-fg: #CFD96B;
    --st-erstellt-bg: #1E2830;   --st-erstellt-fg: #A9C0D3;
    --st-fehlt-bg: #2E2311;      --st-fehlt-fg: #F0B455;
    --st-freigabe-bg: #0F2C2A;   --st-freigabe-fg: #6ED6D0;
    --st-sendet-bg: #1B2147;     --st-sendet-fg: #A6B4F7;
    --st-verschickt-bg: #13263A; --st-verschickt-fg: #7FB8E6;
    --st-bestellt-bg: #12291F;   --st-bestellt-fg: #5CC99A;
    --st-bestaetigt-bg: #2E9E70; --st-bestaetigt-fg: #06140E;
    --st-abgelehnt-bg: #2A2421;  --st-abgelehnt-fg: #B3A89D;
    --st-problem-bg: #331514;    --st-problem-fg: #FF8A80;
  }
}
:root[data-theme='dark'] {
  --st-neu-bg: #2E1F10;        --st-neu-fg: #FF9A2E;
  --st-ki-bg: #261D3D;         --st-ki-fg: #C8B6F5;
  --st-rueckruf-bg: #3A1526;   --st-rueckruf-fg: #F5A3C5;
  --st-daten-bg: #262A10;      --st-daten-fg: #CFD96B;
  --st-erstellt-bg: #1E2830;   --st-erstellt-fg: #A9C0D3;
  --st-fehlt-bg: #2E2311;      --st-fehlt-fg: #F0B455;
  --st-freigabe-bg: #0F2C2A;   --st-freigabe-fg: #6ED6D0;
  --st-sendet-bg: #1B2147;     --st-sendet-fg: #A6B4F7;
  --st-verschickt-bg: #13263A; --st-verschickt-fg: #7FB8E6;
  --st-bestellt-bg: #12291F;   --st-bestellt-fg: #5CC99A;
  --st-bestaetigt-bg: #2E9E70; --st-bestaetigt-fg: #06140E;
  --st-abgelehnt-bg: #2A2421;  --st-abgelehnt-fg: #B3A89D;
  --st-problem-bg: #331514;    --st-problem-fg: #FF8A80;
}

.stand {
  --st-bg: var(--bg-2); --st-fg: var(--muted);
  display: inline-flex; align-items: center; gap: 7px; padding: 4px 12px; border-radius: 99px;
  font-size: 13.5px; font-weight: 700; line-height: 1.3; white-space: nowrap;
  background: var(--st-bg); color: var(--st-fg); border: 1px solid color-mix(in srgb, var(--st-fg) 30%, transparent);
}
.stand::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: 0 0 auto; }
.stand--neu { --st-bg: var(--st-neu-bg); --st-fg: var(--st-neu-fg); }
.stand--ki { --st-bg: var(--st-ki-bg); --st-fg: var(--st-ki-fg); }
.stand--rueckruf { --st-bg: var(--st-rueckruf-bg); --st-fg: var(--st-rueckruf-fg); }
.stand--daten { --st-bg: var(--st-daten-bg); --st-fg: var(--st-daten-fg); }
.stand--erstellt { --st-bg: var(--st-erstellt-bg); --st-fg: var(--st-erstellt-fg); }
.stand--fehlt { --st-bg: var(--st-fehlt-bg); --st-fg: var(--st-fehlt-fg); }
.stand--freigabe { --st-bg: var(--st-freigabe-bg); --st-fg: var(--st-freigabe-fg); }
.stand--sendet { --st-bg: var(--st-sendet-bg); --st-fg: var(--st-sendet-fg); }
.stand--verschickt { --st-bg: var(--st-verschickt-bg); --st-fg: var(--st-verschickt-fg); }
.stand--bestellt { --st-bg: var(--st-bestellt-bg); --st-fg: var(--st-bestellt-fg); }
.stand--bestaetigt { --st-bg: var(--st-bestaetigt-bg); --st-fg: var(--st-bestaetigt-fg); }
.stand--abgelehnt { --st-bg: var(--st-abgelehnt-bg); --st-fg: var(--st-abgelehnt-fg); }
.stand--problem { --st-bg: var(--st-problem-bg); --st-fg: var(--st-problem-fg); border-color: var(--st-problem-fg); }

/* ---------------------------------------------------------------------
   Aufbau
   --------------------------------------------------------------------- */
.angebote { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.al-kopf { display: flex; align-items: center; justify-content: space-between; gap: 10px 16px; flex-wrap: wrap; }
.al-kopf h1 { font-size: 30px; }
@media (min-width: 1100px) { .al-kopf h1 { font-size: 28px; } }

/* Kennzahlen: vier schlichte Kacheln, am Handy 2 x 2 */
.kacheln { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
@media (min-width: 720px) { .kacheln { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; } }
.kachel {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px; min-width: 0; min-height: 104px; padding: 14px 14px 12px;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); box-shadow: var(--shadow-1);
  color: inherit; font: inherit; text-align: left; cursor: pointer;
  transition: border-color .15s, background .15s;
}
.kachel:hover { border-color: var(--subtle); }
.kachel[aria-pressed='true'] { border-color: var(--orange); background: var(--orange-tint); box-shadow: inset 0 0 0 1px var(--orange); }
.kachel--leer { cursor: default; box-shadow: none; }
.kachel__zahl { font-size: clamp(24px, 6.4vw, 31px); font-weight: 780; letter-spacing: -.02em; line-height: 1.1; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.kachel__name { font-size: 15.5px; font-weight: 700; }
.kachel__klein { font-size: 14px; color: var(--muted); line-height: 1.35; }

/* Suche und Auswahl */
.al-suche { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
/* Am Handy läuft die Auswahl über den Rand: der letzte sichtbare Knopf blendet aus, das zeigt „hier geht es weiter“ */
.al-suche .auswahl-gruppe--scroll { -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 36px), transparent); mask-image: linear-gradient(to right, #000 calc(100% - 36px), transparent); }
@media (min-width: 720px) {
  .al-suche .auswahl-gruppe--scroll { flex-wrap: wrap; overflow: visible; padding-bottom: 0; -webkit-mask-image: none; mask-image: none; }
}
@media (min-width: 1100px) {
  .al-suche { flex-direction: row; align-items: center; gap: 20px; }
  .al-suche .suchfeld { flex: 0 0 380px; }
  .al-suche .eingabe--suche { min-height: 50px; font-size: 16px; border-width: 1px; }
  .al-suche .auswahl-gruppe { flex: 1 1 auto; }
}
.al-filterhinweis { margin: 0; display: flex; align-items: center; flex-wrap: wrap; gap: 4px 6px; color: var(--muted); font-size: 15.5px; }
.al-filterhinweis .btn { min-height: 44px; }
.al-hinweisort:empty { display: none; }

/* ---------------------------------------------------------------------
   Zeilen: am Handy Karten (Standard), ab 1100 px Tabelle
   --------------------------------------------------------------------- */
.al-ergebnis { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.al-tabelle { width: 100%; border-collapse: collapse; }
:where(.al-tabelle, .al-tabelle tbody, .al-tabelle tr, .al-tabelle td) { display: block; }
.al-tabelle thead { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); }
.al-tabelle caption { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); }
.al-tabelle tbody { display: flex; flex-direction: column; gap: 12px; }
.al-zeile {
  display: grid; grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas: 'kunde stand' 'nr betrag' 'datum aenderung' 'hinweis hinweis' 'aktion aktion';
  align-items: start; gap: 6px 12px; padding: 14px; cursor: pointer;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-1);
}
.al-zeile:hover { border-color: var(--subtle); }
.al-zeile--problem { border-color: var(--err); background: color-mix(in srgb, var(--err-bg) 45%, var(--card)); }
.al-zeile td { padding: 0; border: 0; min-width: 0; }
.al-kunde { grid-area: kunde; display: flex; flex-direction: column; gap: 1px; }
.al-name { font-size: 18px; font-weight: 750; color: var(--text); text-decoration: none; overflow-wrap: anywhere; }
.al-name:hover { text-decoration: underline; }
.al-ort { font-size: 15px; color: var(--muted); overflow-wrap: anywhere; }
/* Die Zelle „Stand“ löst sich am Handy auf: Plakette oben rechts, Haken oder Hinweis in der Zeile darunter */
.al-stand { display: contents; }
.al-stand .stand { grid-area: stand; justify-self: end; }
.al-stand .al-haken, .al-stand .al-hinweis { grid-area: hinweis; }
.al-nr { grid-area: nr; font-size: 16px; font-weight: 650; overflow-wrap: anywhere; }
.al-betrag { grid-area: betrag; justify-self: end; text-align: right; font-size: 17px; font-weight: 750; font-variant-numeric: tabular-nums; }
.al-betrag__zahl, .al-betrag__klein { display: block; }
.al-betrag__klein { font-size: 13.5px; font-weight: 500; color: var(--muted); white-space: nowrap; }
.al-datum { grid-area: datum; font-size: 14.5px; color: var(--muted); white-space: nowrap; }
.al-aenderung { grid-area: aenderung; justify-self: end; font-size: 14.5px; color: var(--muted); white-space: nowrap; }
.al-label { color: var(--subtle); }
.al-aktion { grid-area: aktion; display: flex; flex-direction: column; gap: 6px; margin-top: 4px; }
.al-knoepfe { display: flex; flex-direction: column; gap: 8px; }
.al-knoepfe .btn { min-height: 56px; font-size: 17px; width: 100%; }
.al-text-rechner { display: none; }
.al-hinweis { margin: 0; font-size: 14.5px; color: var(--muted); line-height: 1.4; }
.al-hinweis--rot { color: var(--err); font-weight: 650; }
.al-haken { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 14.5px; color: var(--ok); font-weight: 600; }
.al-haken__eintrag { display: inline-flex; align-items: center; gap: 4px; }
.al-ab { align-self: flex-start; min-height: 44px; white-space: nowrap; }
.al-aktion .pdf-ort:empty { display: none; }

@media (min-width: 1100px) {
  .al-tafel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-1); overflow: hidden; }
  .al-tabelle { display: table; table-layout: fixed; }
  .al-tabelle thead { position: static; width: auto; height: auto; margin: 0; overflow: visible; clip: auto; display: table-header-group; }
  .al-tabelle tbody { display: table-row-group; }
  .al-tabelle tr { display: table-row; }
  .al-tabelle td, .al-tabelle th { display: table-cell; }
  .al-tabelle th {
    padding: 11px 12px; text-align: left; font-size: 13px; font-weight: 700; letter-spacing: .02em; color: var(--muted);
    background: var(--card-2); border-bottom: 1px solid var(--line-2);
  }
  .al-tabelle th.al-zahl, .al-tabelle td.al-zahl { text-align: right; }
  .al-sortiert { display: inline-flex; align-items: center; gap: 4px; color: var(--text); white-space: nowrap; }
  .al-th-datum { width: 120px; }
  .al-th-nr { width: 135px; }
  .al-th-stand { width: 190px; }
  .al-th-betrag { width: 150px; }
  .al-th-aenderung { width: 135px; }
  .al-th-aktion { width: 260px; }
  .al-zeile { display: table-row; padding: 0; border: 0; border-radius: 0; box-shadow: none; background: transparent; }
  .al-zeile td { display: table-cell; padding: 14px 12px; vertical-align: middle; border-bottom: 1px solid var(--line); }
  .al-tabelle tbody tr:last-child td { border-bottom: 0; }
  .al-zeile:hover td { background: var(--card-2); }
  .al-zeile--problem td { background: color-mix(in srgb, var(--err-bg) 45%, var(--card)); }
  .al-zeile--problem:hover td { background: color-mix(in srgb, var(--err-bg) 70%, var(--card)); }
  .al-zeile--problem td:first-child { box-shadow: inset 4px 0 0 var(--err); }
  .al-kunde { display: table-cell; }
  .al-kunde .al-name, .al-kunde .al-ort { display: block; }
  .al-stand { display: table-cell; }
  .al-stand .al-haken { margin-top: 6px; }
  .al-stand .al-hinweis { display: block; margin-top: 4px; }
  .al-nr { font-size: 15.5px; }
  .al-betrag { font-size: 16px; justify-self: auto; }
  .al-datum, .al-aenderung { font-size: 15px; justify-self: auto; }
  .al-label { display: none; }
  .al-aktion { display: table-cell; margin-top: 0; }
  .al-knoepfe { flex-direction: row; justify-content: flex-end; gap: 8px; }
  .al-knoepfe .btn { width: auto; min-height: 44px; font-size: 15px; padding: 8px 14px; }
  .al-aktion > * + * { margin-top: 6px; }
  .al-aktion .al-hinweis, .al-aktion .al-ab { text-align: right; align-self: flex-end; display: block; }
  .al-text-handy { display: none; }
  .al-text-rechner { display: inline; }
}
