/* ==========================================================================
   Inno4School Cards – styles.css (Phase 1 / Fundament)
   Farbpalette (Pflicht):
     --color-primary:   #474747  (Überschriften, Navigation, Struktur)
     --color-secondary: #F9891D  (Primär-Buttons, aktive Zustände, Fortschritt)
     --color-accent:    #5E3735  (Sekundäre Akzente, ausgewählte Zustände)
   Helle neutrale Hintergründe, barrierefreie Kontraste.
   ========================================================================== */

:root {
  /* Pflicht-Farben */
  --color-primary: #474747;
  --color-secondary: #F9891D;
  --color-accent: #5E3735;

  /* Abgeleitete, neutrale Flächen & Text */
  --color-bg: #f6f4f2;            /* helles warmes Neutrales */
  --color-surface: #ffffff;       /* Karten / Panels */
  --color-surface-alt: #efece9;   /* abgesetzte Flächen */
  --color-text: #2c2a28;          /* Fließtext */
  --color-text-muted: #6b6660;    /* gedämpfter Text */
  --color-border: #ded9d3;        /* Rahmen */
  --color-header-bg: #474747;     /* dunkle Kopfleiste (primary) */
  --color-header-text: #ffffff;

  /* Typo-Skalierung & Maße */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 2px rgba(40, 35, 30, 0.08);
  --shadow-md: 0 6px 18px rgba(40, 35, 30, 0.12);
  --shadow-lg: 0 16px 40px rgba(40, 35, 30, 0.22);
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --space-6: 2rem;
  --space-7: 3rem;
  --max-width: 1080px;
  --focus-ring: 0 0 0 3px rgba(249, 137, 29, 0.45);

  /* Text/Titel-Tokens: In der hellen Variante nutzen wir die Brand-Farben.
     Im dunklen Theme (data-theme="dark") werden sie aufgehellt, damit die
     I4S-Palette in beiden Designs sichtbar UND barrierefrei lesbar bleibt. */
  --heading-color: #474747;   /* = brand primary (hell) */
  --accent-text:   #5E3735;   /* = brand accent  (hell) */
  --brand-secondary-text: #F9891D; /* = brand secondary (hell) */
}

/* ==========================================================================
   Dunkles Design (Phase 3): Übersteuert die neutralen Flächen/Texte.
   Die Pflichtpalette bleibt in beiden Designs sichtbar:
     - Kopfleiste bleibt #474747 (primary)
     - Primär-Buttons bleiben #F9891D (secondary)
     - Akzent-Elemente bleiben auf #5E3735 (accent)
   Nur die daraus abgeleiteten Text-Tokens werden für Lesbarkeit aufgehellt.
   ========================================================================== */
[data-theme="dark"] {
  --color-bg: #201d1b;
  --color-surface: #2b2725;
  --color-surface-alt: #37322e;
  --color-text: #e8e3de;
  --color-text-muted: #aaa29b;
  --color-border: #47413b;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.35);
  --shadow-md: 0 6px 18px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.55);
  --heading-color: #d8d2cc;      /* aufgehellt ab primary */
  --accent-text: #cf9a95;        /* aufgehellt ab accent */
  --brand-secondary-text: #ffab4d; /* aufgehellt ab secondary */
}

/* ---------- Reset ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

/* Verhindert sichtbares „Flashen" des falschen Designs, falls das Theme
   erst asynchron aus dem Konto geladen wird. */
body.theme-loading { color: transparent; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 1rem;
  line-height: 1.55;
  color: var(--color-text);
  background: var(--color-bg);
  min-height: 100vh;
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  color: var(--heading-color);
  line-height: 1.2;
  margin: 0 0 var(--space-3);
}

h1 { font-size: 1.6rem; }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.1rem; }

p { margin: 0 0 var(--space-3); }

a {
  color: var(--accent-text);
  text-decoration: none;
}
a:hover { text-decoration: underline; }

img, svg { max-width: 100%; height: auto; }

/* ---------- Layout-Grundgerüst ---------- */
.app-shell {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

/* Sichtbarer Fokusring für alle tastatursteuerbaren Elemente (Zugänglichkeit). */
:focus-visible {
  outline: 3px solid var(--color-secondary);
  outline-offset: 2px;
}
.app-shell > .content {
  flex: 1 1 auto;
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: var(--space-5) var(--space-4);
  display: flex;
  flex-direction: column;
}

.container {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--space-4);
}

/* ---------- Header ---------- */
.app-header {
  background: var(--color-header-bg);
  color: var(--color-header-text);
  box-shadow: var(--shadow-sm);
}

.app-header .container {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  min-height: 68px;
  padding-top: var(--space-3);
  padding-bottom: var(--space-3);
}

/* Pflicht-Reihenfolge: Logo → Appname → Navigation/Konto */
.brand {
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
  color: var(--color-header-text);
  text-decoration: none;
}
a.brand:hover { text-decoration: none; }

.brand-logo {
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  padding: 3px;
  box-sizing: border-box;
}

.brand-name {
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: 0.2px;
  color: var(--color-header-text);
  white-space: nowrap;
}
.brand-name .brand-sub {
  color: #ffb877;
  font-weight: 600;
}

/* Spacer pushes Navigation after name */
.app-header .spacer { flex: 1 1 auto; }

.header-nav {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  color: var(--color-header-text);
  font-size: 0.95rem;
}
.header-nav a {
  color: var(--color-header-text);
  opacity: 0.92;
}
.header-nav a:hover {
  opacity: 1;
  text-decoration: none;
}

/* Benutzer-Chip im Header (zeigt den angezeichneten Benutzernamen) */
.header-nav .chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.85rem;
  border: 1px solid rgba(255, 255, 255, 0.2);
  white-space: nowrap;
}
.header-nav .chip::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #4ade80;
}

/* ---------- Buttons ---------- */
.btn {
  font: inherit;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 0.6rem 1.1rem;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  line-height: 1.1;
  transition: transform 0.05s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}
.btn:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.btn-primary {
  background: var(--color-secondary);
  color: #2a1502;
  border-color: var(--color-secondary);
}
.btn-primary:hover {
  background: #ff9b30;
  text-decoration: none;
}

.btn-accent {
  background: var(--color-accent);
  color: #fff;
}
.btn-accent:hover {
  background: #6f4441;
  text-decoration: none;
}

.btn-neutral {
  background: var(--color-surface);
  color: var(--color-primary);
  border-color: var(--color-border);
}
.btn-neutral:hover {
  background: var(--color-surface-alt);
  text-decoration: none;
}

.btn-ghost-on-dark {
  background: rgba(255, 255, 255, 0.08);
  color: var(--color-header-text);
  border: 1px solid rgba(255, 255, 255, 0.25);
}
.btn-ghost-on-dark:hover {
  background: rgba(255, 255, 255, 0.18);
  text-decoration: none;
}

.btn-danger {
  background: #b42318;
  color: #fff;
}
.btn-danger:hover {
  background: #d03121;
  text-decoration: none;
}

.btn-sm {
  padding: 0.4rem 0.7rem;
  font-size: 0.85rem;
}

.btn[disabled] {
  opacity: 0.55;
  cursor: not-allowed;
}

/* Icon-only buttons */
.icon-btn {
  background: transparent;
  border: none;
  padding: 0.35rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  line-height: 0;
}
.icon-btn svg { display: block; }
.icon-btn.hover {
  background: rgba(0, 0, 0, 0.06);
}

/* ---------- Auth area ---------- */
.auth-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 200px);
  padding: var(--space-5) 0;
}

.auth-hero {
  margin-bottom: var(--space-5);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}
.auth-hero .brand-logo-lg {
  width: 96px;
  height: 96px;
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  padding: 8px;
  box-shadow: var(--shadow-md);
  margin-bottom: var(--space-4);
}
.auth-hero h1 {
  font-size: 1.9rem;
  margin-bottom: var(--space-2);
}
.auth-hero p {
  color: var(--color-text-muted);
  margin: 0;
}

.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
}

.card-pad {
  padding: var(--space-6);
}
.card-pad.narrow { max-width: 480px; width: 100%; margin: 0 auto; }

/* ---------- Forms ---------- */
.form {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.field {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.field label {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--color-primary);
}

.input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.input {
  font: inherit;
  padding: 0.6rem 0.85rem;
  padding-right: 2.4rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  color: var(--color-text);
  width: 100%;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.input.no-pad-right {
  padding-right: 0.85rem;
}
.input:focus {
  outline: none;
  border-color: var(--color-secondary);
  box-shadow: var(--focus-ring);
}

.input-wrap .toggle-pass {
  position: absolute;
  right: 0.35rem;
  color: var(--color-text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
}

.field .hint {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  margin: 0;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: 0.92rem;
  color: var(--color-text);
}
.checkbox-row input[type="checkbox"] {
  width: 1.1rem;
  height: 1.1rem;
  accent-color: var(--color-secondary);
}

/* Strength indicator */
.strength-meter {
  display: flex;
  gap: 3px;
  margin-top: 4px;
}
.strength-meter .seg {
  flex: 1;
  height: 6px;
  border-radius: 3px;
  background: var(--color-border);
  transition: background-color 0.15s ease;
}
.strength-meter .seg.on { background: #b42318; }
.strength-meter.seg-1 .seg.on { background: #b42318; }
.strength-meter.seg-2 .seg.on { background: #f97316; }
.strength-meter.seg-3 .seg.on { background: #f9ba1d; }
.strength-meter.seg-4 .seg.on { background: #65a30d; }
.strength-meter.seg-5 .seg.on { background: #15803d; }

.strength-label {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  margin-top: 4px;
}

/* Local-data notice on auth */
.notice {
  background: var(--color-surface-alt);
  border: 1px solid var(--color-border);
  border-left: 4px solid var(--color-accent);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  font-size: 0.9rem;
  color: var(--color-text);
}
.notice .notice-lead {
  font-weight: 600;
  display: block;
  margin-bottom: var(--space-1);
  color: var(--color-primary);
}
.notice.error {
  border-left-color: #b42318;
  color: #4a0a04;
}
.hidden { display: none !important; }

/* Das [hidden]-Attribut muss jede author-seitige display-Regel ueberstehen,
   sonst bleiben Views mit z. B. .auth-wrap (display: flex) auch bei
   hidden=true sichtbar. */
[hidden] { display: none !important; }

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(16px);
  background: #222;
  color: #fff;
  padding: 0.7rem 1.1rem;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  font-size: 0.92rem;
  max-width: min(90vw, 480px);
  text-align: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.toast.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
  pointer-events: auto;
}
.toast.success { background: #15803d; }
.toast.error { background: #b42318; }
.toast.info { background: #3a3a3a; }

/* ---------- Dashboard ---------- */
.dash-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-5);
}
  margin: 0;
  font-size: 1.4rem;
  color: var(--heading-color);
  font-weight: 700;
}
.dash-head .greeting span { color: var(--accent-text); }

.dash-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: var(--space-4);
}
.dash-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  transition: box-shadow 0.15s ease, transform 0.05s ease;
}
.dash-card:hover {
  box-shadow: var(--shadow-md);
}
.dash-card .ico {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  background: rgba(249, 137, 29, 0.12);
  color: var(--brand-secondary-text);
  display: flex;
  align-items: center;
  justify-content: center;
}
.dash-card .ico svg { width: 24px; height: 24px; }
.dash-card h3 { margin: 0; }
.dash-card p { color: var(--color-text-muted); font-size: 0.9rem; margin: 0; }
.dash-card .btn { align-self: flex-start; margin-top: auto; }

/* Empty state */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  padding: var(--space-7) var(--space-4);
  color: var(--color-text-muted);
  text-align: center;
  border: 2px dashed var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface-alt);
  margin-top: var(--space-4);
}
.empty-state .illo {
  width: 120px;
  color: var(--color-accent);
  opacity: 0.7;
}
.empty-state .illo svg { width: 100%; height: auto; }
.empty-state h3 { color: var(--color-text); margin: 0; }

/* ---------- Modal ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(20, 18, 16, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
  z-index: 100;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.18s ease, visibility 0.18s ease;
}
.modal-overlay.open {
  opacity: 1;
  visibility: visible;
}
.modal {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow: auto;
  border: 1px solid var(--color-border);
  transform: translateY(8px) scale(0.99);
  transition: transform 0.18s ease;
}
.modal-overlay.open .modal {
  transform: translateY(0) scale(1);
}
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--color-border);
  background: var(--color-surface-alt);
}
.modal-head h2 {
  margin: 0;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  gap: var(--space-2);
}
.modal-head .icon-btn { color: var(--color-text); }
.modal-body { padding: var(--space-5); }

.modal .notice {
  margin-bottom: var(--space-4);
}

.section-sep {
  height: 1px;
  background: var(--color-border);
  margin: var(--space-5) 0;
}

.danger-zone {
  border: 1px solid #f4c2be;
  background: rgba(180, 35, 24, 0.04);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  margin-top: var(--space-4);
}
.danger-zone h3 {
  color: #b42318;
  font-size: 1rem;
}
.danger-zone p { color: var(--color-text); font-size: 0.9rem; }

/* ---------- Footer ---------- */
.app-footer {
  flex: 0 0 auto;
  background: var(--color-header-bg);
  color: #e7e4e0;
  font-size: 0.88rem;
}
.app-footer .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  flex-wrap: wrap;
  padding-top: var(--space-4);
  padding-bottom: var(--space-4);
}
.app-footer .copyright {
  color: #b7b1aa;
}
.footer-links {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  flex-wrap: wrap;
}
.footer-links a {
  color: #e7e4e0;
  opacity: 0.85;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.footer-links a:hover {
  opacity: 1;
  color: #ff9b30;
  text-decoration: none;
}

/* ---------- Legal pages ---------- */
.legal-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
.legal-shell > .content {
  flex: 1 1 auto;
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: var(--space-6) var(--space-4);
}
.legal-hero {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  margin-bottom: var(--space-5);
}
.legal-hero .brand-logo-lg {
  width: 72px;
  height: 72px;
  background: var(--color-surface);
  border-radius: var(--radius-md);
  padding: 6px;
  box-shadow: var(--shadow-sm);
}
.legal-hero h1 {
  font-size: 1.6rem;
  margin: 0;
}
.legal-hero p {
  color: var(--color-text-muted);
  margin: 0;
  font-size: 0.92rem;
}
.legal-body {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  box-shadow: var(--shadow-sm);
}
  font-size: 1.15rem;
  color: var(--heading-color);
  border-bottom: 1px solid var(--color-border);
  padding-bottom: var(--space-2);
  margin-top: var(--space-5);
  margin-bottom: var(--space-3);
}
.legal-body p {
  color: var(--color-text);
}
.legal-body ul {
  color: var(--color-text);
  padding-left: var(--space-5);
}
.legal-placeholder {
  background: var(--color-surface-alt);
  border: 1px dashed var(--color-border);
  border-left: 4px solid var(--color-primary);
  border-radius: var(--radius-md);
  padding: var(--space-4) var(--space-5);
  color: var(--color-text);
  margin-top: var(--space-4);
}
.legal-back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: var(--space-5);
  color: var(--brand-secondary-text);
  font-weight: 600;
}
.legal-back-link:hover {
  color: #e07a10;
  text-decoration: none;
}

/* ---------- Responsive ---------- */
@media (max-width: 640px) {
  .app-header .container {
    gap: var(--space-2);
  }
  .header-nav .label {
    display: none;
  }
  .card-pad {
    padding: var(--space-4) var(--space-3);
  }
  .dash-head {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-2);
  }
  .app-footer .container {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

/* ================= PHASE 2 ================= */
/* ============================================================================
   Inno4School Cards – styles.css · PHASE 2 (Stapel, Karten, Lernen, Import/Export)
   Setzt die Pflicht-Farben aus Phase 1 fort:
     --color-primary   #474747 – Überschriften, Navigation, Struktur
     --color-secondary #F9891D – Primär-Buttons, Fortschritt, Akzente
     --color-accent    #5E3735 – Sekundär-Akzente, ausgewählte Zustände
   ========================================================================== */

/* ---------- Formular-Aktionen & kleine Hilfsmittel ---------- */
.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  justify-content: flex-end;
  margin-top: var(--space-4);
}
.textarea {
  resize: vertical;
  min-height: 72px;
  line-height: 1.5;
}
.icon-btn-danger { color: #b42318; }
.icon-btn-danger:hover { background: rgba(180, 35, 24, 0.12); color: #912018; }
.muted { color: var(--color-text-muted); }
.radio-row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.radio-row:hover { background: var(--color-surface-alt); }
.radio-row input[type="radio"] { accent-color: var(--color-accent); width: 18px; height: 18px; }
.center { text-align: center; }
.link-btn {
  background: none;
  border: none;
  color: var(--brand-secondary-text);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  padding: var(--space-1) 0;
}
.link-btn:hover { color: #e07a10; text-decoration: underline; }
.modal-slim { max-width: 440px; }
.modal-wide { max-width: 640px; }

/* ---------- Password-Stärke (Seg-Farben) ---------- */
.strength-meter .seg.on.weak   { background: #b42318; }
.strength-meter .seg.on.mid    { background: var(--color-secondary); }
.strength-meter .seg.on.strong { background: #15803d; }
.strength-label.weak   { color: #b42318; }
.strength-label.mid    { color: #b06a10; }
.strength-label.strong { color: #15803d; }

/* ---------- Dashboard: Kennzahlen ---------- */
.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-3);
  margin-bottom: var(--space-5);
}
.stat {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  padding: var(--space-4);
  text-align: center;
}
.stat-num {
  display: block;
  font-size: 1.9rem;
  font-weight: 700;
  color: var(--brand-secondary-text);
  line-height: 1.1;
}
.stat-label {
  display: block;
  margin-top: var(--space-1);
  font-size: 0.82rem;
  color: var(--color-text-muted);
}
.dash-head-actions { display: flex; gap: var(--space-2); }

/* ---------- Dashboard: Suchleiste + Filter ---------- */
.toolbar { display: flex; flex-direction: column; gap: var(--space-3); margin-bottom: var(--space-5); }
.search-box {
  position: relative;
  display: flex;
  align-items: center;
}
.search-box svg { position: absolute; left: 12px; color: var(--color-text-muted); pointer-events: none; }
.search-input { width: 100%; padding-left: 40px; }
.filter-row { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.chip-btn {
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text);
  padding: var(--space-2) var(--space-3);
  border-radius: 999px;
  font: inherit;
  font-size: 0.9rem;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.chip-btn:hover { border-color: var(--color-secondary); }
.chip-btn[aria-pressed="true"] {
  background: var(--color-secondary);
  border-color: var(--color-secondary);
  color: #fff;
  font-weight: 600;
}

/* ---------- Dashboard: Aktionsspalte ---------- */
.dash-actions { display: flex; flex-wrap: wrap; gap: var(--space-3); margin-bottom: var(--space-5); }

/* ---------- Stapel-Liste ---------- */
.deck-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: var(--space-4); }
.deck-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  padding: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  transition: box-shadow 0.15s, border-color 0.15s;
}
.deck-card:hover { box-shadow: var(--shadow-md); border-color: var(--color-accent); }
.deck-card-title { margin: 0 0 var(--space-1); color: var(--heading-color); font-size: 1.15rem; }
.deck-card-desc { margin: 0; color: var(--color-text-muted); font-size: 0.9rem; }
.deck-card-stats { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: center; font-size: 0.85rem; color: var(--color-text); }
.due-badge {
  background: var(--color-accent);
  color: #fff;
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 0.78rem;
  font-weight: 600;
}
.deck-card-actions { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-top: auto; }
.deck-empty-note { color: var(--color-text-muted); grid-column: 1 / -1; }

/* ---------- Empty-State-Aktionen ---------- */
.empty-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--space-3); margin-top: var(--space-4); }

/* ---------- Stapel-Detail ---------- */
.deck-detail {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: var(--space-5);
}
.deck-detail-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3);
  padding-bottom: var(--space-4);
  border-bottom: 1px solid var(--color-border);
  margin-bottom: var(--space-4);
}
.deck-detail-title { margin-left: auto; text-align: right; min-width: 200px; }
.deck-detail-title h1 { margin: 0; color: var(--heading-color); font-size: 1.6rem; }
.deck-desc { margin: 0; color: var(--color-text-muted); }
.deck-detail-actions { display: flex; flex-wrap: wrap; gap: var(--space-2); width: 100%; }

/* ---------- Kartenliste im Stapel ---------- */
.card-list { display: flex; flex-direction: column; gap: var(--space-3); }
.deck-cards-empty { color: var(--color-text-muted); }
.card-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-3);
  transition: background 0.15s;
}
.card-row:hover { background: var(--color-surface-alt); }
.card-row-text {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  flex: 1 1 260px;
  min-width: 220px;
}
.card-front-preview { font-weight: 600; color: var(--heading-color); }
.card-back-preview { color: var(--color-text-muted); font-size: 0.92rem; }
.card-updated { color: var(--color-text-muted); font-size: 0.78rem; margin-top: 2px; }
.card-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 2px; }
.tag-pill {
  background: rgba(94, 55, 53, 0.12);
  color: var(--color-accent);
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 0.76rem;
  font-weight: 600;
}
.card-row-actions { display: flex; gap: var(--space-1); }

/* ---------- Lernmodus ---------- */
/* Lernkarte vertikal + horizontal zentrieren: Hoehenkette
   body(100dvh) > .app-shell > .content(flex) > #view-study > .study-wrap.
   Das gewaehlte View-Element wachst auf die verbleibende Hoehe,
   die .study-wrap fuellt sie und zentriert die aktive Ansicht. */
#view-study {
  flex: 1 0 auto;
  display: flex;
}
.study-wrap {
  display: flex;
  flex-direction: column;
  justify-content: center;
  max-width: 720px;
  margin: 0 auto;
  min-width: 0;
}
.study-skip { display: flex; justify-content: space-between; gap: var(--space-2); margin-bottom: var(--space-3); }
.study-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  overflow: hidden;
}
.study-progress {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: var(--color-surface-alt);
  border-bottom: 1px solid var(--color-border);
}
.study-progress-fill {
  position: relative;
  flex: 1;
  height: 8px;
  border-radius: 999px;
  background: var(--color-border);
  overflow: hidden;
}
.study-progress-fill div {
  height: 100%;
  background: linear-gradient(90deg, var(--color-secondary), #ffb877);
}
.study-progress-text { font-size: 0.85rem; color: var(--color-text-muted); white-space: nowrap; }
.study-cardbox { padding: var(--space-5) var(--space-4); }
.study-side {
  margin: 0 0 var(--space-2);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-muted);
}
.study-front, .study-back { font-size: 1.25rem; color: var(--heading-color); white-space: pre-wrap; word-break: break-word; }
#study-back-wrap.study-cardbox { border-top: 1px dashed var(--color-border); }
.study-actions { display: flex; flex-wrap: wrap; gap: var(--space-2); padding: var(--space-4); justify-content: center; }
.choice-grid { display: flex; flex-wrap: wrap; gap: var(--space-3); justify-content: center; margin: var(--space-4) 0; }
.study-sub { color: var(--color-text-muted); font-size: 0.9rem; }
.study-done-actions { display: flex; flex-wrap: wrap; gap: var(--space-3); justify-content: center; margin-top: var(--space-4); }
.done-illo { display: flex; justify-content: center; margin-bottom: var(--space-3); }
.done-illo svg { width: 72px; height: 72px; }

/* ---------- Lernen-Start-Modal ---------- */
.study-start-help { color: var(--color-text-muted); margin-top: 0; }
.study-deck-list { display: flex; flex-direction: column; gap: 4px; margin-bottom: var(--space-3); }
.deck-choice small { color: var(--color-text-muted); font-weight: 400; }

/* ---------- Import-Modal ---------- */
.import-drop {
  border: 2px dashed var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-5);
  text-align: center;
  background: var(--color-surface-alt);
}
.import-drop p { color: var(--color-text-muted); margin-top: 0; }
.import-actions { display: flex; flex-wrap: wrap; gap: var(--space-2); justify-content: center; margin-top: var(--space-3); }
.import-preview { margin-top: var(--space-4); }
.preview-stats { display: flex; flex-wrap: wrap; gap: var(--space-4); margin: var(--space-3) 0; }
.preview-stats strong { color: var(--brand-secondary-text); }
.preview-decks { max-height: 220px; overflow-y: auto; border: 1px solid var(--color-border); border-radius: var(--radius-sm); padding: var(--space-2) var(--space-3); margin-bottom: var(--space-3); }
.preview-deck-item { padding: var(--space-2) 0; border-bottom: 1px solid var(--color-border); }
.preview-deck-item:last-child { border-bottom: none; }
.import-modes { border: 1px solid var(--color-border); border-radius: var(--radius-sm); padding: var(--space-3); margin: 0 0 var(--space-3); }
.import-modes legend { font-weight: 600; color: var(--heading-color); padding: 0 var(--space-1); }
.preview-empty { color: var(--color-text-muted); }

/* ---------- Kopfleiste: Zurück-Button ---------- */
.header-back {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--color-header-text);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: var(--radius-sm);
  padding: var(--space-1);
  background: none;
  text-decoration: none;
}
.header-back:hover { background: rgba(255, 255, 255, 0.12); }

/* ---------- Responsive (Phase 2) ---------- */
@media (max-width: 640px) {
  .stats-row { grid-template-columns: repeat(2, 1fr); }
  .dash-actions { flex-direction: column; }
  .dash-actions .btn { width: 100%; }
  .deck-detail-title { margin-left: 0; text-align: left; }
  .deck-detail-actions { width: 100%; }
  .study-front, .study-back { font-size: 1.05rem; }
  .form-actions { flex-direction: column-reverse; align-items: stretch; }
  .form-actions .btn { width: 100%; }
}

/* ==========================================================================
   Phase 3 – PWA-Installations-Banner (einzige Banner dieser App)
   ========================================================================== */
.pwa-banner {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: var(--space-4);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-left: 4px solid var(--color-accent);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  padding: var(--space-4) var(--space-5);
  margin-bottom: var(--space-4);
}
.pwa-banner[hidden] { display: none; }
.pwa-banner-icon {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  background: rgba(249, 137, 29, 0.14);
  color: var(--brand-secondary-text);
  flex: 0 0 auto;
}
.pwa-banner-text h2 {
  margin: 0 0 var(--space-1);
  font-size: 1.05rem;
  color: var(--heading-color);
}
.pwa-banner-text p {
  margin: 0;
  font-size: 0.9rem;
  color: var(--color-text-muted);
}
.pwa-banner-ios { margin-top: var(--space-1); font-size: 0.85rem; }
.pwa-banner-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}
@media (max-width: 640px) {
  .pwa-banner { grid-template-columns: auto 1fr; }
  .pwa-banner-actions { grid-column: 1 / -1; }
  .pwa-banner-actions .btn { flex: 1 1 auto; justify-content: center; }
}

/* ---------- Dunkles Design: feste Farben, die im Dunkeln zu hell/dunkel sind ---------- */
[data-theme="dark"] .icon-btn.hover { background: rgba(255, 255, 255, 0.08); }
[data-theme="dark"] .toast { background: #4a453f; }
[data-theme="dark"] .strength-meter .seg.on,
[data-theme="dark"] .strength-meter.seg-1 .seg.on,
[data-theme="dark"] .strength-meter .seg.on.weak { background: #ff6a5a; }
[data-theme="dark"] .strength-meter .seg.on.strong { background: #4ade80; }
[data-theme="dark"] .danger-zone { border-color: rgba(224, 65, 33, 0.55); background: rgba(180, 35, 24, 0.12); }
[data-theme="dark"] .danger-zone h3 { color: #ff8072; }
[data-theme="dark"] .notice.error { border-left-color: #ff6a5a; }
[data-theme="dark"] .icon-btn-danger { color: #ff8072; }
[data-theme="dark"] .icon-btn-danger:hover { background: rgba(255, 106, 90, 0.15); color: #ff9a8f; }
[data-theme="dark"] .link-btn:hover { color: #ffab4d; }
[data-theme="dark"] .strength-label.weak { color: #ff6a5a; }
[data-theme="dark"] .strength-label.mid { color: #f9ba1d; }
[data-theme="dark"] .strength-label.strong { color: #4ade80; }
[data-theme="dark"] .study-progress-fill { background: #47413b; }
[data-theme="dark"] .chip-btn[aria-pressed="true"] { color: #201d1b; }
[data-theme="dark"] .due-badge { background: #5E3735; color: #ffe9e7; }
[data-theme="dark"] .legal-placeholder { border-left-color: var(--brand-secondary-text); }
[data-theme="dark"] ::selection { background: rgba(249, 137, 29, 0.35); }
