/*
  Lokani – Bereich Kundenportal: der Rahmen des Portals (templates/portal/basis.html), die Terminwahl, der
  Auftragsfortschritt und die Fotos – und die Terminanfragen im ERP (templates/portal/intern_anfragen.html).
  0.55: gleicher Aufbau für alle Betriebe, neutral (Lokani-Tokens, Hell/Dunkel über data-theme). Die Hauptfarbe des
  Betriebs kommt als --portal-* aus {% portal_stil %} (portal/farbe.py) und ersetzt hier nur die Primärfarbe.
  Abstände, die bis 0.53 Tabler-Hilfsklassen waren (mb-3, mt-2 …), sind benannte Regeln mit dem alten Wert im Kommentar.
*/

/* ---------- Hauptfarbe des Betriebs ---------- */
body.portal {
  --primaer: var(--portal-haupt); --erp-primaer-flaeche: var(--portal-haupt);
  --erp-primaer-flaeche-hover: var(--portal-haupt-dunkel); --auf-primaer: var(--portal-auf-haupt);
  --primaer-text: light-dark(var(--portal-text-hell), var(--portal-text-dunkel));
  --primaer-text-hover: var(--text);
  --primaer-hell: color-mix(in srgb, var(--portal-haupt) 14%, var(--flaeche));
  --primaer-linie: color-mix(in srgb, var(--portal-haupt) 45%, var(--flaeche));
  background: var(--grund); color: var(--text); min-height: 100vh; -webkit-font-smoothing: antialiased;
}

/* ---------- Rahmen ---------- */
.portal-breite { max-width: 1040px; margin: 0 auto; padding: 0 16px; }
.portal-kopf { background: var(--flaeche); border-bottom: 1px solid var(--linie); border-top: 4px solid var(--portal-haupt);
  padding: .75rem 0; margin-bottom: 1.5rem; position: sticky; top: 0; z-index: 20; }
.portal-marke { display: flex; align-items: center; gap: .65rem; font-weight: 700; color: var(--text); text-decoration: none; min-width: 0; }
.portal-marke:hover { color: var(--text); text-decoration: none; }
.portal-logo { max-height: 40px; max-width: 140px; object-fit: contain; }
.portal-marke .wort { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.portal-marke .name { font-size: 1.05rem; font-weight: 700; overflow-wrap: anywhere; }
.portal-marke .zeile { font-size: .72rem; font-weight: 500; color: var(--text-leise); letter-spacing: .04em; }
.portal-nav { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.portal-nav a { color: var(--text-leise); text-decoration: none; }
.portal-nav a:hover { color: var(--text); text-decoration: none; }
.portal-nav a[aria-current] { color: var(--text); font-weight: 600; text-decoration: underline; text-decoration-color: var(--portal-haupt);
  text-decoration-thickness: 3px; text-underline-offset: 7px; }
.portal-sprache { display: flex; gap: 0; font-size: .8rem; border: 1px solid var(--linie); border-radius: 999px; overflow: hidden; }
.portal-sprache a { padding: .15rem .5rem; color: var(--text-leise); text-decoration: none; }
.portal-sprache a:hover { text-decoration: none; color: var(--text); }
.portal-sprache a[aria-current] { background: var(--primaer-hell); color: var(--text); font-weight: 600; }
.portal-thema { width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--linie); background: transparent; color: var(--text);
  display: inline-grid; place-items: center; cursor: pointer; padding: 0; }
.portal-thema:hover { background: var(--primaer-hell); }
.portal-thema svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round;
  stroke-linejoin: round; grid-area: 1 / 1; }
html[data-portal-thema="hell"] .portal-thema .sonne, html[data-portal-thema="dunkel"] .portal-thema .mond { display: none; }
.portal-schmal { max-width: 440px; margin: 2rem auto; }
.portal-fuss { padding-top: 2rem; padding-bottom: 2rem; border-top: 1px solid var(--linie); margin-top: 2.5rem; }
.portal-fuss__recht { margin-top: .5rem; display: flex; gap: 1rem; flex-wrap: wrap; }
body.portal .termin-tag__eingabe:checked + .termin-tag { background: var(--primaer-hell); border-color: var(--portal-haupt); color: var(--text); }
body.portal .hinweis { border-left: 3px solid var(--portal-haupt); }

/* Handy: oben Logo, Sprache, Hell/Dunkel – darunter eine Menüzeile (seitlich wischbar) */
@media (max-width: 760px) {
  .portal-kopf { padding: .6rem 0 0; margin-bottom: 1.25rem; }
  .portal-kopf .portal-breite { gap: .6rem !important; }
  .portal-sprache { margin-left: auto !important; }
  .portal-nav { order: 3; width: 100%; margin-left: 0 !important; flex-wrap: nowrap; overflow-x: auto; gap: 1.1rem;
    padding: .55rem 0 .65rem; border-top: 1px solid var(--linie); scrollbar-width: none; }
  .portal-nav::-webkit-scrollbar { display: none; }
  .portal-nav a, .portal-nav form { white-space: nowrap; flex-shrink: 0; }
  .portal-nav a[aria-current] { text-underline-offset: 5px; }
  .portal-logo { max-height: 32px; max-width: 96px; }
  .portal-marke .name { font-size: .95rem; }
  .portal-abmelden .knopf { width: 2.25rem; padding-inline: 0; justify-content: center; }
  .portal-abmelden__text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
}

/* Überschrift der Seite: bis 0.53 h1 mit Tablers Klasse h2 (20 px / 28 px) */
.portal-titel { margin: 0 0 .5rem; font-size: 1.25rem; line-height: 1.75rem; text-wrap: balance; }   /* text-wrap: bis 0.53 aus „h1“ in erp.css */
.portal-titel--eng { margin-bottom: .25rem; }                  /* mb-1 */
.portal-titel--nach-verweis { margin-top: .5rem; }             /* mt-2 */

/* ---------- Abstände der Seiten (alte Hilfsklassen) ---------- */
.portal-feld { margin-bottom: 1rem; }                          /* mb-3 */
.portal-kleingedrucktes { margin: 1rem 0 0; }                  /* mt-3 mb-0 */
.portal-rechnungszeile { padding: .25rem 0; }                  /* py-1 */
.portal-pdf-knopf { margin-inline-start: .5rem; }              /* ms-2 */
.portal-bankhinweis { margin-top: .5rem; }                     /* mt-2 */
.karte + .portal-start { margin-top: 1rem; }                   /* mb-3 der Karten davor */
.portal-inhalt > .karte + .hinweis { margin-top: .5rem; }      /* mt-2: Fehler unter der Karte */

/* ---------- Terminwahl (Tage als Knöpfe, Auswahl = Wahlknopf dahinter) ---------- */
.termin-tage { display: grid; grid-template-columns: repeat(var(--spalten, 5), minmax(0, 1fr)); gap: .5rem; max-width: 44rem;
  margin-bottom: .5rem; }                                      /* mb-2 */
@media (max-width: 575.98px) {
  .termin-tage { gap: .3rem; }
  .termin-tag { padding: .35rem .1rem; }
}
.termin-tag { display: flex; flex-direction: column; align-items: center; gap: 0; padding: .4rem .25rem; line-height: 1.25; font-variant-numeric: tabular-nums; white-space: nowrap; }
.termin-tag .wt { font-size: .75rem; color: var(--text-leise); }
.termin-tag .datum { font-weight: 600; }
.termin-tag .zusatz { font-size: .75rem; color: var(--text-leise); }  /* 0.74: mind. 12 px */
.termin-tage__voll { margin: 0 0 .5rem; }
.termin-tag .zusatz.hu { color: var(--primaer-text); font-weight: 600; }
/* der Wahlknopf (radio) liegt unsichtbar vor dem Tag (bis 0.53 btn-check) */
.termin-tag__eingabe { position: absolute; clip: rect(0, 0, 0, 0); pointer-events: none; }
.termin-tag__eingabe:checked + .termin-tag .wt, .termin-tag__eingabe:checked + .termin-tag .zusatz { color: inherit; }
.termin-tag__eingabe:disabled + .termin-tag { opacity: .45; text-decoration: none; pointer-events: none; }
.termin-tag__eingabe:focus-visible + .termin-tag { outline: 3px solid color-mix(in srgb, var(--primaer) 55%, transparent); outline-offset: 2px; }
.portal-feld > legend + * { clear: inline-start; }               /* Bootstraps legend + * (die Legende schwebt, grundlage.css) */
.termin-hu { margin-bottom: 1rem; }                            /* mb-3 */
.termin-hu .haken-zeile { margin-bottom: .25rem; }             /* mb-1 */

/* ---------- Fortschritt des Auftrags und Fotos aus der Werkstatt ---------- */
.portal-schritte { display: flex; gap: .3rem; list-style: none; padding: 0; margin: .6rem 0 .3rem; counter-reset: schritt; }
.portal-schritte li { flex: 1; font-size: .78rem; text-align: center; padding-top: .55rem; border-top: 4px solid var(--linie); color: var(--text-leise); }
.portal-schritte li.erreicht { border-top-color: var(--primaer); color: var(--text); font-weight: 600; }
.portal-fotos { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: .5rem; margin: .6rem 0 .2rem; }
.portal-fotos a { display: flex; flex-direction: column; gap: .2rem; font-size: .78rem; color: var(--text-leise); text-decoration: none; }
.portal-fotos img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 6px; border: 1px solid var(--linie); }

/* ---------- Online im ERP (intern_anfragen) ---------- */
.online-reiter .reiter__eintrag { gap: 0; }                   /* die Reiter der Online-Seiten hatten keine Lücke zwischen Symbol und Text (Buchhaltung: 6,4 px) */
.online-zahl { margin-inline-start: .25rem; }                  /* ms-1: Zahl im Reiter */
.online-plakette { margin-inline-start: .25rem; }              /* ms-1 */
.online-hinweis { margin-top: .5rem; }                         /* mt-2 */
.online-hinweis-schmal { padding-block: .5rem; }               /* py-2 */
.online-eingetragen { margin-bottom: .5rem; }                  /* mb-2 */
.online-meldungen { margin-bottom: 1rem; }   /* mb-3 */
.online-erledigt { margin-top: .5rem; }                        /* mt-2 */
.online-spalten + .karte { margin-top: 1rem; }                 /* mt-3 */
/* Feld und Knopf aneinander (bis 0.53 Tablers input-group, nur hier) */
.online-kopierzeile { display: flex; flex-wrap: wrap; align-items: stretch; width: 100%; }
.online-kopierzeile > .eingabe { position: relative; flex: 1 1 auto; width: 1%; min-width: 0; border-top-right-radius: 0; border-bottom-right-radius: 0; }
.online-kopierzeile > .eingabe:focus { z-index: 5; }
.online-kopierzeile > .knopf { position: relative; margin-left: -1px; border-top-left-radius: 0; border-bottom-left-radius: 0; }

/* ---------- Einstiegsseite /portal/ (0.55): „Schon Kunde?“ zuerst, dann die Terminanfrage ---------- */
.portal-einstieg { display: grid; gap: 1.5rem; }
@media (min-width: 900px) {
  .portal-einstieg--zwei { grid-template-columns: minmax(16rem, 20rem) minmax(0, 1fr); align-items: start; }
  .portal-einstieg--zwei .portal-einstieg__konto { position: sticky; top: 6rem; }
}
.portal-anmeldung .karte__titel { margin-bottom: .5rem; }
/* 0.74: „Schon Kunde?“ als schmales Band über der Terminanfrage statt einer kurzen Spalte neben dem langen Formular */
@media (min-width: 900px) {
  .portal-einstieg--zwei { grid-template-columns: minmax(0, 1fr); }
  .portal-einstieg--zwei .portal-einstieg__konto { position: static; }
  .portal-einstieg--zwei .portal-anmeldung .karte__inhalt { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 22rem); column-gap: 2rem; align-items: start; }
  .portal-einstieg--zwei .portal-anmeldung .karte__inhalt > form { grid-column: 2; grid-row: 1 / span 3; }
  .portal-einstieg--zwei .portal-anmeldung .karte__inhalt > :not(form) { grid-column: 1; }
  .portal-einstieg--zwei .portal-anmeldung .leise:not(.portal-kleingedrucktes) { margin-bottom: .5rem; }
}

/* ---------- Impressum und Datenschutz (0.55) ---------- */
.portal-impressum { display: grid; grid-template-columns: minmax(10rem, max-content) 1fr; gap: .4rem 1.5rem; margin: 0; }
.portal-impressum dt { color: var(--text-leise); }
.portal-impressum dd { margin: 0; overflow-wrap: anywhere; }
@media (max-width: 575.98px) { .portal-impressum { grid-template-columns: 1fr; gap: .1rem; } .portal-impressum dd { margin-bottom: .5rem; } }
.portal-text { max-width: 46rem; overflow-wrap: anywhere; }

/* ---------- Einstellungen → Online-Termine: „Euer Link“ mit QR-Code ---------- */
.euer-link-qr { width: 9rem; margin-top: .75rem; }
.euer-link-qr svg { width: 100%; height: auto; display: block; }

/* ---------- Terminanfragen im ERP (seit 0.63, templates/portal/intern_anfragen.html) ----------
   Je Anfrage eine Zeile: Wunschtag | wer und was | Lage des Tages | Entscheidung. Ab 1200 px vier Spalten, darunter
   Tag + Inhalt nebeneinander und Lage/Entscheidung darunter. Nur eine Haarlinie zwischen den Anfragen, keine Karte je Zeile. */
.anfragen { margin-bottom: 2.5rem; }
.anfragen__titel { display: flex; align-items: center; gap: .5rem; margin: 0 0 .25rem; font-size: 1rem; font-weight: 600; }
.anfragen__anzahl { display: inline-flex; align-items: center; justify-content: center; min-width: 1.5rem; height: 1.5rem; padding: 0 .4rem;
  font-size: .8125rem; font-variant-numeric: tabular-nums; color: var(--text-leise); background: var(--flaeche-2); border-radius: 99px; }
.anfragen__leer { margin: 0; padding: 1.25rem 0; color: var(--text-leise); border-top: 1px solid var(--linie); }
.anfragen__zahl { font-variant-numeric: tabular-nums; white-space: nowrap; }

.anfrage { display: grid; grid-template-columns: 6.5rem minmax(0, 1fr); gap: .75rem 1.5rem; padding: 1.25rem 0;
  border-top: 1px solid var(--linie); }
.anfrage__tag { display: flex; flex-direction: column; gap: .125rem; }
.anfrage__wochentag { font-size: .8125rem; font-weight: 600; color: var(--text-leise); }
.anfrage__datum { font-family: var(--erp-schrift-titel); font-size: 1.625rem; font-weight: 600; line-height: 1.1; letter-spacing: -.02em;
  font-variant-numeric: tabular-nums; }
.anfrage__bis { font-size: .8125rem; color: var(--text-leise); }
.anfrage__bis--vorbei { font-weight: 600; color: var(--rot); }

.anfrage__inhalt { display: flex; flex-direction: column; gap: .3125rem; min-width: 0; }
.anfrage__wer { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin: 0; font-size: 1.0625rem; font-weight: 600; line-height: 1.4; }
.anfrage__wer .verweis { font-weight: inherit; }
.anfrage__was { margin: 0; }
.anfrage__was .hu-marke { margin-inline-end: .25rem; vertical-align: 1px; }
.anfrage__nachricht { max-width: 62ch; margin: .25rem 0 .125rem; padding: .5rem .75rem; font-size: .875rem; line-height: 1.45;
  color: var(--text); background: var(--flaeche-2); border-radius: var(--r-klein); }
.anfrage__kontakt { margin: 0; font-size: .8125rem; color: var(--text-leise); }
.anfrage__kontakt .verweis { font-weight: 500; color: var(--text); }
.anfrage__eingang { white-space: nowrap; }

.anfrage__lage { display: flex; flex-direction: column; gap: .375rem; margin: 0; padding: 0; font-size: .8125rem; list-style: none;
  grid-column: 2; }
.anfrage__warnung { font-weight: 600; color: var(--gelb); }

.anfrage__entscheidung { display: flex; flex-direction: column; align-items: flex-start; gap: .5rem; grid-column: 2; }
.anfrage__knoepfe { display: flex; flex-wrap: wrap; gap: .5rem; }
.anfrage__entscheidung .haken-zeile { margin: 0; }
.anfrage__ohne-mail { margin: 0; color: var(--gelb); font-weight: 600; }
.anfrage__mehr { width: 100%; }
.anfrage__mehr summary { display: inline-flex; align-items: center; min-height: 32px; font-size: .8125rem; font-weight: 600;
  color: var(--primaer-text); cursor: pointer; list-style: none; }
.anfrage__mehr summary::-webkit-details-marker { display: none; }
.anfrage__mehr summary::before { content: ""; width: .4rem; height: .4rem; margin-inline-end: .5rem; border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor; transform: rotate(-45deg); transition: transform .15s ease-out; }
.anfrage__mehr[open] summary::before { transform: rotate(45deg); }
.anfrage__mehr-inhalt { display: flex; flex-direction: column; gap: .75rem; padding-top: .5rem; }
.anfrage__mehr-inhalt .feld { margin: 0; }
@media (prefers-reduced-motion: reduce) { .anfrage__mehr summary::before { transition: none; } }

@media (max-width: 575.98px) {
  .anfrage { grid-template-columns: minmax(0, 1fr); }
  .anfrage__tag { flex-direction: row; align-items: baseline; gap: .5rem; }
  .anfrage__datum { font-size: 1.25rem; }
  .anfrage__lage, .anfrage__entscheidung { grid-column: 1; }
}
@media (min-width: 1200px) {
  .anfrage { grid-template-columns: 6.5rem minmax(0, 1fr) 10.5rem 17rem; }
  .anfrage__lage, .anfrage__entscheidung { grid-column: auto; }
  .anfrage__lage { padding-top: .25rem; }
}

/* Übersicht im Portal (0.74): Fahrzeuge | Termine, Rechnungen darunter über die volle Breite */
.portal-start { align-items: stretch; }
.portal-start > div > .karte { height: 100%; }
.portal-start > .portal-start__breit { grid-column: 1 / -1; }
/* Terminanfragen intern (0.74): „n weitere zeigen“ unter der Tabelle der bearbeiteten */
.anfragen__mehr { border-radius: var(--radius); }
