/* Logbuch Verlag - Farben fuer die Authelia-Anmeldeseite (Authelia 4.39).
   Eingebunden vom nginx-Sidecar (infra/authelia/brand.nginx.conf) per sub_filter als /authelia/brand.css.
   Uebernommen aus dem frueheren Nginx-Setup (Logbuch Unit Economics/_tool/server/authelia-brand.css).
   Authelia nutzt Tailwind mit Cascade Layers; diese Datei ist ungelayert und hat daher Vorrang (deshalb !important).
   Farben: --brand #03526D (Logbuch-Petrol), dunkler #02313f (Hover/aktiv), Fokusring #7fb5c9, Navy #1f3864 (Fehler/Warnung).
   Es sind ausschliesslich Logbuch-Farben erlaubt (siehe docs/zwei-faktor/04_authelia_farben.md, Test src/lib/autheliaBrandCss.test.ts). */
:root{--lbv-brand:#03526D;--lbv-brand-dark:#02313f;--lbv-accent:#7fb5c9;--lbv-navy:#1f3864}

/* Anmelde-Button */
#form-login button[type="submit"],#first-factor-stage button.bg-primary{background-color:var(--lbv-brand)!important;color:#fff!important;border-color:var(--lbv-brand)!important}
#form-login button[type="submit"]:hover,#first-factor-stage button.bg-primary:hover,
#form-login button[type="submit"]:active{background-color:var(--lbv-brand-dark)!important}
#form-login button[type="submit"]:focus-visible{outline:2px solid var(--lbv-accent)!important;outline-offset:2px}

/* Eingabefelder: Fokus */
#form-login input:focus,#form-login input:focus-visible{border-color:var(--lbv-brand)!important;box-shadow:0 0 0 1px var(--lbv-brand)!important;outline:none!important}

/* "Angemeldet bleiben" */
#form-login input[type="checkbox"]{accent-color:var(--lbv-brand)}
#form-login [role="checkbox"][data-state="checked"],#form-login [role="checkbox"][aria-checked="true"]{background-color:var(--lbv-brand)!important;border-color:var(--lbv-brand)!important;color:#fff!important}

/* Links (z. B. "Passwort vergessen", Hilfe) */
#first-factor-stage a,#first-factor-stage a:visited{color:var(--lbv-brand)}
#first-factor-stage a:hover{color:var(--lbv-brand-dark)}
#first-factor-stage a:focus-visible{outline:2px solid var(--lbv-accent);outline-offset:2px}

/* "Passwort zuruecksetzen?" ist in 4.39 ein <button id="reset-password-button" class="text-primary"> (kein <a>) - sonst Authelia-Blau */
#reset-password-button,#first-factor-stage button.text-primary{color:var(--lbv-brand)!important;text-underline-offset:4px}
#reset-password-button:hover,#first-factor-stage button.text-primary:hover{color:var(--lbv-brand-dark)!important;text-decoration:underline}
#reset-password-button:focus-visible{outline:2px solid var(--lbv-accent)!important;outline-offset:2px}

/* Feldbeschriftung bei Fokus: Petrol statt Authelia-Blau */
#form-login div:focus-within > label{color:var(--lbv-brand)!important}

/* Logo (Segelboot, /config/assets/logo.png) groesser darstellen */
#first-factor-stage img{width:170px!important;max-width:60%!important;height:auto!important}

/* Fallback fuer aeltere MUI-Versionen */
.MuiButton-contained.MuiButton-colorPrimary,.MuiButton-containedPrimary{background-color:var(--lbv-brand)!important;color:#fff!important}

/* ---------------------------------------------------------------------------------------------------------------------
   Zwei-Faktor (docs/zwei-faktor/01_z1_umsetzung.md): Einrichtungsseite /authelia/settings/two-factor-authentication, Registrierungsdialog,
   Identitaetsbestaetigung (E-Mail-Code), Code-Eingabe der Anmeldung (Schirm der zweiten Stufe).
   Selektoren aus dem Web-Quellcode von Authelia 4.39.28 (web/src: components/UI/*.tsx = Button/Dialog/Input/Stepper/Card mit data-slot,
   views/Settings/TwoFactorAuthentication/*, views/Settings/Common/IdentityVerificationDialog.tsx, views/LoginPortal/SecondFactor/*).
   Dialoge werden per Portal ausserhalb von #root gerendert: Selektoren duerfen daher NICHT an #root haengen.
   Bei einem Authelia-Update (Image ist gepinnt, infra/authelia/compose.yml) die Selektoren neu pruefen. */

/* Theme-Variablen: siehe Block "Farbpalette" am Ende der Datei */

/* Knoepfe: gefuellt (Kopieren-Knoepfe), Umriss und Text-Variante in Primaerfarbe; Abbrechen (destructive) wird ueber die Palette unten Navy */
[data-slot="button"].bg-primary{background-color:var(--lbv-brand)!important;color:#fff!important;border-color:var(--lbv-brand)!important}
[data-slot="button"].bg-primary:hover{background-color:var(--lbv-brand-dark)!important}
[data-slot="button"].text-primary,[data-slot="button"].border-primary{color:var(--lbv-brand)!important}
[data-slot="button"].border-primary{border-color:var(--lbv-brand)!important}
[data-slot="button"].text-primary:hover:not(:disabled){background-color:rgba(3,82,109,.08)!important;color:var(--lbv-brand-dark)!important}
[data-slot="button"]:focus-visible{outline:2px solid var(--lbv-accent)!important;outline-offset:2px;box-shadow:none!important}

/* Einrichtungsseite: Karte "One-Time Password" */
#one-time-password-panel h5{color:var(--lbv-brand)}

/* Dialoge (Registrierung, Identitaetsbestaetigung, Zweite-Stufe-Dialog): Titel und Links in Petrol */
[data-slot="dialog-content"] [data-slot="dialog-title"]{color:var(--lbv-brand)}
[data-slot="dialog-content"] a,[data-slot="dialog-content"] a:visited{color:var(--lbv-brand)}
[data-slot="dialog-content"] a:hover{color:var(--lbv-brand-dark)}

/* Schrittanzeige (Registrierung: Optionen > Geheimnis/QR > Bestaetigung) */
[data-slot="stepper"] .bg-primary{background-color:var(--lbv-brand)!important}
[data-slot="stepper"] .border-primary{border-color:var(--lbv-brand)!important}
[data-slot="stepper"] .text-primary{color:var(--lbv-brand)!important}
[data-slot="stepper"] .text-primary-foreground{color:#fff!important}

/* Schalter "QR Code" und Optionsfelder (Algorithmus/Laenge/Sekunden): Base-UI setzt data-checked bzw. aria-checked */
#qr-toggle[data-checked],#qr-toggle[aria-checked="true"]{background-color:var(--lbv-brand)!important}
#one-time-password-advanced [role="radio"][data-checked],#one-time-password-advanced [role="radio"][aria-checked="true"]{border-color:var(--lbv-brand)!important;color:var(--lbv-brand)!important}

/* Eingabefelder: Einmalcode der Identitaetsbestaetigung (#one-time-code, 8 Zeichen) und alle Felder mit data-slot=input */
[data-slot="input"]:focus,[data-slot="input"]:focus-visible,#one-time-code:focus{border-color:var(--lbv-brand)!important;box-shadow:0 0 0 1px var(--lbv-brand)!important;outline:none!important}

/* Code-Eingabe der Anmeldung (zweite Stufe): Kaestchen des 6-stelligen Codes (Base-UI OTPField im Element #otp-input) */
#otp-input input:focus,#otp-input input:focus-visible{border-color:var(--lbv-brand)!important;box-shadow:0 0 0 1px var(--lbv-brand)!important;outline:none!important}

/* Schirm der zweiten Stufe: Ueberschrift und Links (Registrierungslink bei "nicht registriert", Methodenwechsel) */
#second-factor-stage h6{color:var(--lbv-brand)}
#register-link,#selection-link,#second-factor-stage a,#second-factor-stage a:visited{color:var(--lbv-brand)!important;text-underline-offset:4px}
#register-link:hover,#selection-link:hover,#second-factor-stage a:hover{color:var(--lbv-brand-dark)!important;text-decoration:underline}
#register-link:focus-visible,#selection-link:focus-visible,#methods-button:focus-visible{outline:2px solid var(--lbv-accent)!important;outline-offset:2px}

/* ---------------------------------------------------------------------------------------------------------------------
   Alle Bildschirme nur in Logbuch-Farben (docs/zwei-faktor/04_authelia_farben.md).
   Authelia 4.39.28 nutzt Tailwind v4 + Base-UI (kein MUI): alle Farben kommen aus den CSS-Variablen in
   web/src/themes/tailwind-themes.css (Light: primary blau, secondary rosa, destructive rot, success gruen, warning orange,
   info hellblau) und aus wenigen festen Werten (PasswordMeter, OTPDial, MethodContainer, Brand, Tailwind-Palette green/amber).
   Fehler/Warnung/Erfolg werden daher ohne Rot/Orange/Gruen dargestellt: Petrol bzw. Navy, Flaeche #eaf3f6, linker Rahmen 4px. */

/* Farbpalette: ersetzt die Theme-Variablen; ungelayert + !important schlaegt die gelayerte Vorgabe in jedem Theme */
:root,[data-theme]{
  --background:#fff!important;--foreground:#101828!important;
  --card:#fff!important;--card-foreground:#101828!important;
  --popover:#fff!important;--popover-foreground:#101828!important;
  --primary:#03526D!important;--primary-foreground:#fff!important;
  --secondary:#1f3864!important;--secondary-foreground:#fff!important;
  --muted:#f0f2f6!important;--muted-foreground:#5b6577!important;
  --accent:#e7ecf6!important;--accent-foreground:#101828!important;
  --destructive:#1f3864!important;--destructive-foreground:#fff!important;
  --success:#03526D!important;--success-foreground:#fff!important;
  --warning:#1f3864!important;--warning-foreground:#101828!important;
  --info:#03526D!important;--info-foreground:#fff!important;
  --border:#e6e9f0!important;--input:#7d8594!important;--ring:#7fb5c9!important;
  --custom-icon:#101828!important;--custom-loading-bar:#03526D!important;--divider:rgba(16,24,40,.10)!important;
  color-scheme:light!important;
}
/* Feste Tailwind-Farben, die Authelia direkt nutzt: Erfolgs-Knopf (bg-green-600, WebAuthn/Push), Warn-Icon (text-amber-500, Anmeldemethoden) */
:root{
  --color-green-500:#3a88a3!important;--color-green-600:#03526D!important;--color-green-700:#02313f!important;
  --color-amber-500:#1f3864!important;--color-red-500:#1f3864!important;--color-red-600:#1f3864!important;
  --color-orange-500:#1f3864!important;--color-blue-500:#03526D!important;--color-blue-600:#03526D!important;
}

/* Fehlerhafte Felder (Anmeldung, Einmalcode, Passwort aendern, Registrierung): Rahmen und Hilfetext Navy statt Rot */
[aria-invalid="true"]:not([data-slot="button"]),[data-slot="floating-input"][class*="border-destructive"]{border-color:var(--lbv-navy)!important;box-shadow:0 0 0 3px rgba(31,56,100,.18)!important}
[data-slot="field-error"],[data-invalid="true"],[data-slot="field"][data-invalid="true"] [data-slot="field-label"]{color:var(--lbv-navy)!important}
#otp-input input[aria-invalid="true"]{border-color:var(--lbv-navy)!important}

/* Alert-Kaesten (Warnung auf der Anmeldung/Passwortstufe, Fehler): helle Petrol-Flaeche, linker Rahmen 4px, Text fett, Icon Petrol/Navy */
[data-slot="alert"].border-warning,[data-slot="alert"].text-destructive{background-color:#eaf3f6!important;border-color:#bfdbe5!important;border-left:4px solid var(--lbv-navy)!important;color:#101828!important;font-weight:600}
[data-slot="alert"].border-warning svg,[data-slot="alert"].text-destructive svg{color:var(--lbv-navy)!important}
[data-slot="alert"] [data-slot="alert-description"]{color:#101828!important}

/* Hinweise (Snackbar/Toast): Fehler und Warnung Navy, Erfolg und Info Petrol; Flaeche #eaf3f6, linker Rahmen 4px */
[data-slot="toast"]{--toast-ink:#101828!important;--toast-surface:#eaf3f6!important;--toast-edge:#bfdbe5!important;--toast-accent:#5b6577!important;border-left:4px solid var(--toast-accent)!important;font-weight:600}
[data-slot="toast"][data-type="success"],[data-slot="toast"][data-type="info"]{--toast-accent:#03526D!important}
[data-slot="toast"][data-type="error"],[data-slot="toast"][data-type="warning"]{--toast-accent:#1f3864!important}
[data-slot="toast"] svg{color:var(--toast-accent)!important}

/* Status-Symbole (Erfolg/Fehler/Info grosse Icons in Anmeldung, Einrichtung, Consent-Abschluss): feste Farbe statt aus Gruen/Rot abgeleitet */
.success-icon,.information-icon{color:#03526D!important}
.failure-icon{color:var(--lbv-navy)!important}

/* Consent-Seite (OIDC-Zustimmung, z. B. Claude-Connector): Accept = primary (Petrol), Ablehnen/Abbrechen = Umriss secondary (Navy), Hinweis- und Fehlerkarten */
[data-slot="button"].border-secondary{border-color:var(--lbv-navy)!important}
[data-slot="button"].text-secondary{color:var(--lbv-navy)!important}
[data-slot="button"].text-secondary:hover:not(:disabled),[data-slot="button"].border-secondary:hover:not(:disabled){background-color:rgba(31,56,100,.08)!important}
[data-slot="button"].bg-secondary{background-color:var(--lbv-navy)!important;color:#fff!important}
[data-slot="button"].bg-secondary:hover{background-color:var(--lbv-brand-dark)!important}
/* Destructive-Knoepfe (Abbrechen, Loeschen, Passwort aendern) und Erfolgs-Knoepfe */
[data-slot="button"].bg-destructive,[data-slot="button"].bg-green-600{background-color:var(--lbv-navy)!important;color:#fff!important}
[data-slot="button"].bg-destructive:hover,[data-slot="button"].bg-green-600:hover{background-color:var(--lbv-brand-dark)!important}
[data-slot="button"].text-destructive,[data-slot="button"].border-destructive,[data-slot="button"].text-green-600{color:var(--lbv-navy)!important}
[data-slot="button"].border-destructive{border-color:var(--lbv-navy)!important}
[data-slot="card"].border-destructive\/40{border-color:var(--lbv-navy)!important}
.bg-destructive\/10,.bg-success\/10,.bg-warning\/10{background-color:#eaf3f6!important}
.text-success,.text-info{color:#03526D!important}
.text-destructive,.text-warning{color:var(--lbv-navy)!important}

/* Fortschritt: Balken (Fortschrittsanzeige, Lade-Balken beim Abmelden/Umleiten) und Ladekreis */
[data-slot="progress-track"]{background-color:#bfdbe5!important}
[data-slot="progress-indicator"]{background-color:#03526D!important}
[data-slot="spinner"] svg{color:#03526D!important}

/* Code-Eingabe der Anmeldung: Countdown-Ring (SVG, fest Schwarz/Weiss) in Petrol; Fortschrittsanzeige (Tortenstueck) bleibt weiss */
circle[stroke$="000"]{stroke:#03526D!important}
circle[fill$="000"]{fill:#03526D!important}

/* Passwortstaerke (Passwort aendern, Zuruecksetzen): Balken in Petrol-Abstufungen statt Rot/Orange/Gelb/Gruen (Farbe per style-Attribut) */
[style*="211, 47, 47"]{background-color:#bfdbe5!important}
[style*="255, 87, 34"]{background-color:#7fb5c9!important}
[style*="255, 235, 59"]{background-color:#3a88a3!important}
[style*="175, 180, 43"]{background-color:#03526D!important}
[style*="98, 211, 47"]{background-color:#02313f!important}

/* Hinweistexte "Zwei-Faktor erforderlich" (feste Farbe #5858ff, Violett) und Fusszeile (feste Farbe #9e9e9e, Grau) */
[class*="5858ff"]{color:#03526D!important}
[class*="9e9e9e"]{color:#5b6577!important}

/* Fusszeile "Betrieben mit Authelia" (Brand.tsx: <a target="_blank" class="text-[#9e9e9e]..."> mit Link auf authelia.com) auf allen Portalseiten ausblenden.
   Der Datenschutz-Link daneben (PrivacyPolicyLink) zeigt nicht auf authelia.com und bleibt sichtbar. */
a[target="_blank"][class*="9e9e9e"][href*="authelia.com"]{display:none!important}

/* Kontrollkaestchen und Optionsfelder (Angemeldet bleiben, Registrierung, Methodenwahl, Consent-Scopes): Base-UI setzt data-checked */
[data-slot="checkbox"][data-checked],[data-slot="checkbox"][aria-checked="true"]{background-color:#03526D!important;border-color:#03526D!important;color:#fff!important}
[data-slot="radio-group-item"]{color:#03526D!important}
[data-slot="radio-group-item"][data-checked],[data-slot="radio-group-item"][aria-checked="true"]{border-color:#03526D!important}
[data-slot="radio-group-indicator"] svg{fill:#03526D!important;color:#03526D!important}
/* Auswahlkarten (FieldLabel mit gewaehlter Option): Petrol-Rahmen und -Flaeche */
[data-slot="field-label"]:has(> [data-slot="field"] [data-checked]),[data-slot="field-label"]:has(> [data-slot="field"] [aria-checked="true"]){border-color:#03526D!important;background-color:#eaf3f6!important}

/* Schalter (QR Code, Optionen): an = Petrol, aus = Feldrahmen-Grau, Griff weiss */
[data-slot="switch"][data-checked],[data-slot="switch"][aria-checked="true"]{background-color:#03526D!important}
[data-slot="switch"][data-unchecked],[data-slot="switch"][aria-checked="false"]{background-color:#7d8594!important}
[data-slot="switch-thumb"]{background-color:#fff!important}

/* Schrittanzeige: noch offene Schritte und Verbindungslinien in neutralen Linienfarben */
[data-slot="stepper"] .border-muted-foreground\/40{border-color:#c3c9d6!important}
[data-slot="stepper"] .bg-muted-foreground\/30{background-color:#c3c9d6!important}

/* Auswahl im Text und Fokusringe aller Bedienelemente */
::selection{background-color:#bfdbe5;color:#101828}
a:focus-visible,[role="checkbox"]:focus-visible,[role="radio"]:focus-visible,[role="switch"]:focus-visible{outline:2px solid var(--lbv-accent);outline-offset:2px}
