/* §DUAL-THEME-2026-11-10 — zentrale Monochrom-Token, Dunkel (Standard) und Hell.
   Schalter: html[data-ec-mode="dark"|"light"], gesetzt von theme-manager.js vor dem ersten Paint.
   NICHT html[data-theme]: das Attribut tragen die 10 App-Themes (ec-theme-boot.js), und
   html[data-theme]:not([data-theme="oled-midnight"]) loest deren Umfaerbung aus.
   Geltung Hell (Owner-Entscheid 10.11.): Landing, Anmeldung/Registrierung/2FA/PIN, Rechts-Unterseiten.
   Die eingeloggte App-Shell bleibt dunkel (eigene Stufe).
   Dunkel-Werte = die bisherigen festen Werte der Platin-Schicht → Dunkel bleibt pixelgleich. */

:root, [data-ec-mode="dark"] {
  --bg-canvas: #000000;
  --bg-surface-glass: rgba(18, 18, 20, 0.75);
  --bg-surface-elevated: rgba(26, 26, 30, 0.85);
  --bg-surface-subtle: rgba(255, 255, 255, 0.04);
  --bg-input: rgba(255, 255, 255, 0.05);

  --text-primary: #ffffff;
  --text-secondary: #d4d4d8;
  --text-muted: #8e8e93;
  --text-inverse: #000000;

  --border-hairline: 1px solid rgba(255, 255, 255, 0.08);
  --border-hover: 1px solid rgba(255, 255, 255, 0.22);
  --border-active: 1px solid rgba(255, 255, 255, 0.4);

  --btn-primary-bg: #ffffff;
  --btn-primary-text: #000000;
  --btn-secondary-bg: rgba(255, 255, 255, 0.08);
  --btn-secondary-border: rgba(255, 255, 255, 0.16);
  --btn-secondary-text: #ffffff;

  --glass-blur: blur(24px);
  --glass-shadow: 0 16px 40px rgba(0, 0, 0, 0.6);

  /* Ergaenzungen: Werte, die die Platin-Schicht schon nutzte, aber im Brief keinen Namen hatten. */
  --ec-ink-rgb: 255, 255, 255;          /* Tinte fuer rgba(var(--ec-ink-rgb), a): Linien, Schleier */
  --ec-canvas-rgb: 0, 0, 0;
  --text-soft: #a1a1aa;                 /* Fliesstext der Landing */
  --text-faint: #71717a;                /* Mono-Kleinzeilen */
  --text-code: #e4e4e7;
  --bg-surface-solid: #121214;
  --bg-surface-deep: rgba(14, 14, 16, 0.75);
  --bg-surface-raised: rgba(18, 18, 22, 0.85);
  --bg-surface-raised-2: rgba(20, 20, 24, 0.85);
  --bg-terminal: #050505;
  --ec-dot: #52525b;
  --ec-media-filter: grayscale(1);
  --text-dim: #94949e;
  --text-comment: #8a8a93;
  --bg-surface-banner: rgba(18, 18, 20, 0.98);
  --bg-surface-fab: rgba(18, 18, 20, 0.9);
  --ec-orb: #f4f4f5;
  --glass-shadow-card: 0 20px 40px rgba(0, 0, 0, 0.5);
  --ec-amber-text: #fbbf24;
}

[data-ec-mode="light"] {
  --bg-canvas: #ffffff;
  --bg-surface-glass: rgba(245, 245, 247, 0.82);
  --bg-surface-elevated: rgba(255, 255, 255, 0.95);
  --bg-surface-subtle: rgba(0, 0, 0, 0.03);
  --bg-input: rgba(0, 0, 0, 0.04);

  --text-primary: #000000;
  --text-secondary: #27272a;
  --text-muted: #636369;                /* Brief: #71717a — das sind auf der Glasflaeche nur 4,4:1 */
  --text-inverse: #ffffff;

  --border-hairline: 1px solid rgba(0, 0, 0, 0.09);
  --border-hover: 1px solid rgba(0, 0, 0, 0.2);
  --border-active: 1px solid rgba(0, 0, 0, 0.35);

  --btn-primary-bg: #000000;
  --btn-primary-text: #ffffff;
  --btn-secondary-bg: rgba(0, 0, 0, 0.05);
  --btn-secondary-border: rgba(0, 0, 0, 0.12);
  --btn-secondary-text: #000000;

  --glass-blur: blur(24px);
  --glass-shadow: 0 12px 32px rgba(0, 0, 0, 0.08);

  --ec-ink-rgb: 0, 0, 0;
  --ec-canvas-rgb: 255, 255, 255;
  --text-soft: #52525b;
  --text-faint: #636369;
  --text-code: #18181b;
  --bg-surface-solid: #f5f5f7;
  --bg-surface-deep: rgba(240, 240, 243, 0.86);
  --bg-surface-raised: rgba(250, 250, 251, 0.92);
  --bg-surface-raised-2: rgba(248, 248, 250, 0.92);
  --bg-terminal: #f5f5f7;
  --ec-dot: #a1a1aa;
  --ec-media-filter: grayscale(1);
  --text-dim: #636369;
  --text-comment: #636369;
  --bg-surface-banner: rgba(255, 255, 255, 0.98);
  --bg-surface-fab: rgba(255, 255, 255, 0.94);
  --ec-orb: #18181b;
  --glass-shadow-card: 0 16px 36px rgba(0, 0, 0, 0.10);
  --ec-amber-text: #8a4b00;
}

html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

/* ── Anmeldung / Registrierung / Wiederherstellung / PIN (vor dem Login) ─────────────────────
   apple-light-prelogin.css rechnet durchgehend mit --al-*; hier bekommen die Token je Modus
   ihre Werte. Dunkel = Obsidian-Glas (Standard), Hell = bisherige helle Flaechen, aber
   monochrom (Apple-Blau #0071E3 → Schwarz). Gleicher Scope-Guard wie dort: body:not(.auth-ready). */
html body:not(.auth-ready) {
  --al-paper: #ffffff;
  --al-paper-rgb: 255, 255, 255;
  --al-bg-rgb: 245, 245, 247;
  --al-accent-rgb: 0, 0, 0;
  --al-on-accent: #ffffff;
  --al-accent: #000000;
  --al-accent-hi: #1d1d1f;
  --al-accent-soft: rgba(0, 0, 0, 0.06);
}
html:not([data-ec-mode="light"]) body:not(.auth-ready),
html:not([data-ec-mode="light"]) body:not(.auth-ready) :is(#splash, #login-screen, #setup-new, #setup-join, #recovery-screen, #pin-screen, #cookie-banner, #aura-fab) {
  --al-bg: #000000;
  --al-bg-alt: #000000;
  --al-surface: rgba(18, 18, 20, 0.75);
  --al-surface-solid: rgba(22, 22, 25, 0.94);
  --al-fill: rgba(255, 255, 255, 0.05);
  --al-fill-2: rgba(255, 255, 255, 0.08);
  --al-fill-3: rgba(255, 255, 255, 0.12);
  --al-text: #ffffff;
  --al-text-2: #a1a1aa;
  --al-text-3: #8e8e93;
  --al-border: rgba(255, 255, 255, 0.10);
  --al-border-soft: rgba(255, 255, 255, 0.06);
  --al-accent: #ffffff;
  --al-accent-hi: #e4e4e7;
  --al-accent-soft: rgba(255, 255, 255, 0.08);
  --al-ink: #ffffff;
  --al-gold: #fbbf24;
  --al-gold-soft: rgba(245, 158, 11, 0.12);
  --al-green: #4ade80;
  --al-red: #f87171;
  --al-shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.4);
  --al-shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.4);
  --al-shadow-md: 0 10px 30px rgba(0, 0, 0, 0.5);
  --al-shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.6);
  --al-shadow-xl: 0 24px 60px rgba(0, 0, 0, 0.7);
  --al-paper: rgba(255, 255, 255, 0.07);
  --al-paper-rgb: 24, 24, 27;
  --al-bg-rgb: 0, 0, 0;
  --al-accent-rgb: 255, 255, 255;
  --al-on-accent: #000000;
}
/* Alt-Variablen der App (style.css), die apple-light fuer die Vor-Login-Flaechen umbiegt. */
html:not([data-ec-mode="light"]) body:not(.auth-ready) :is(#splash, #login-screen, #setup-new, #setup-join, #recovery-screen, #pin-screen, #cookie-banner, #aura-fab) {
  --bg: #000000; --bg2: #0b0b0d; --bg3: #141416; --bg4: #1c1c1f;
  --border: rgba(255, 255, 255, 0.10); --border-hi: rgba(255, 255, 255, 0.4);
  --accent: #ffffff; --accent-hi: #e4e4e7; --accent2: #ffffff;
  --cyan: #ffffff; --cyan-dim: #d4d4d8; --purple: #d4d4d8;
  --gold: #fbbf24; --gold-dim: #f59e0b; --danger: #f87171; --green: #4ade80;
  --text: #ffffff; --text2: #a1a1aa; --text3: #8e8e93;
  --glass: rgba(255, 255, 255, 0.04); --glass-hi: rgba(255, 255, 255, 0.07);
  --glow-cyan: none; --glow-purple: none; --glow-gold: none;
}
/* Hell: Nebentext war #86868B/#A1A1A6 = 2,5–3,6:1 auf den hellen Flaechen (gemessen 10.11.) → AA. */
html[data-ec-mode="light"] body:not(.auth-ready) {
  --al-text-2: #5f5f63;
  --al-text-3: #636366;
  --al-green: #14693a;
}
html[data-ec-mode="light"] body:not(.auth-ready) :is(#splash, #login-screen, #setup-new, #setup-join, #recovery-screen, #pin-screen, #cookie-banner, #aura-fab) {
  --border-hi: rgba(0, 0, 0, 0.35);
  --text2: #5f5f63; --text3: #636366; --green: #14693a;
  --accent: #000000; --accent-hi: #1d1d1f; --accent2: #000000;
  --cyan: #000000; --cyan-dim: #27272a; --purple: #3f3f46;
  --glow-cyan: 0 6px 18px rgba(0, 0, 0, 0.12); --glow-purple: 0 6px 18px rgba(0, 0, 0, 0.12);
}
html body:not(.auth-ready) :is(#captcha-hint-login, #captcha-hint-reg, .auth-helper-row) { color: var(--al-text-2) !important; }
/* Aura-Knopf vor dem Login, Hell: helle Glasflaeche (landing-dark-glass.css haelt ihn sonst dunkel, 2 IDs + :has).
   Dunkel bleibt unveraendert. */
html[data-ec-mode="light"] body:not(.auth-ready) #aura-fab#aura-fab#aura-fab {
  background: var(--bg-surface-fab) !important;
  border: 1px solid rgba(var(--ec-ink-rgb), 0.12) !important;
  color: var(--text-primary) !important;
}
html[data-ec-mode="light"] body:not(.auth-ready) #aura-fab#aura-fab#aura-fab .aura-fab-name { color: var(--text-primary) !important; }
html[data-ec-mode="light"] body:not(.auth-ready) #aura-fab#aura-fab#aura-fab .aura-fab-meta {
  background: rgba(var(--ec-ink-rgb), 0.08) !important;
  color: var(--text-soft) !important;
}
/* Hauptaktionen der Anmelde-Flaechen als Pille (Eingaben bleiben bei 12 px). */
html body:not(.auth-ready) :is(#splash, #login-screen, #setup-new, #setup-join, #recovery-screen) :is(.auth-primary-btn, .ec-auth-primary-action) { border-radius: 9999px !important; }

/* ── Schalter „Dunkel (Standard) | Hell“ in den App-Einstellungen (Shell ist immer dunkel → feste Werte).
   Gewicht ueber :not(#…)-Kette: die Shell faerbt Knoepfe mit ID-Ketten + !important um. */
html body .ec-mode-seg--app:not(#a):not(#b):not(#c):not(#d):not(#e):not(#f) {
  display: inline-flex !important; gap: 2px !important; padding: 3px !important; margin-top: 12px !important;
  border: 1px solid rgba(255, 255, 255, 0.14) !important; border-radius: 9999px !important;
  background: rgba(255, 255, 255, 0.04) !important; max-width: 100%;
}
html body .ec-mode-seg--app:not(#a):not(#b):not(#c):not(#d):not(#e):not(#f) > button {
  min-height: 44px !important; min-width: 96px !important; padding: 0 18px !important; margin: 0 !important;
  border: 0 !important; border-radius: 9999px !important; background: transparent !important; box-shadow: none !important;
  color: #d4d4d8 !important; -webkit-text-fill-color: currentColor !important; font: 500 13.5px/1 inherit !important; cursor: pointer;
  width: auto !important; flex: 0 1 auto !important; white-space: nowrap;
}
html body .ec-mode-seg--app:not(#a):not(#b):not(#c):not(#d):not(#e):not(#f) > button[aria-pressed="true"] {
  background: #ffffff !important; color: #000000 !important;
}
html body .ec-mode-seg--app:not(#a):not(#b):not(#c):not(#d):not(#e):not(#f) > button:focus-visible { outline: 2px solid #ffffff !important; outline-offset: 2px; }
html body .ec-mode-card .ec-mode-sub { margin: 6px 0 0; font-size: 13px; line-height: 1.5; color: #a1a1aa; }

/* Hell: Flaeche unter dem Landing-Scroller (Ueberscrollen am Handy) und Formular-Schema folgen dem Modus.
   landing-dark-glass.css setzt dort fest #06070B / color-scheme: dark. */
html[data-ec-mode="light"]:has(body:not(.auth-ready) #landing-screen.active),
html[data-ec-mode="light"] body:not(.auth-ready):has(#landing-screen.active) { background: var(--bg-canvas) !important; }
html[data-ec-mode="light"] body:not(.auth-ready) #landing-screen { color-scheme: light; }
/* Dunkel, Anmelde-Flaechen (nicht Landing — die bleibt pixelgleich): Aura-Marke lesbar statt Schwarz auf Schwarz. */
html:not([data-ec-mode="light"]) body:not(.auth-ready):not(:has(#landing-screen.active)) #aura-fab#aura-fab#aura-fab .aura-fab-meta {
  background: rgba(255, 255, 255, 0.08) !important;
  color: #a1a1aa !important;
}
