:root {
  --bg: #f3f4f9;
  --bg-grad:
    radial-gradient(1200px 620px at 10% -10%, #eceefb 0%, rgba(236, 238, 251, 0) 60%),
    radial-gradient(1000px 560px at 108% 112%, #e6f3ee 0%, rgba(230, 243, 238, 0) 55%),
    linear-gradient(168deg, #f6f6fb 0%, #eef0f7 100%);
  --surface: #ffffff;
  --surface-2: #eef0f7;
  --text: #232430;
  --text-2: #585969;
  --text-3: #8a8b98;
  --border: rgba(38, 40, 70, 0.10);
  --border-2: rgba(38, 40, 70, 0.18);
  --accent: #4b46c7;
  --accent-grad: linear-gradient(135deg, #5b4fd0 0%, #3f6fd6 100%);
  --accent-bg: #ecebfb;
  --accent-text: #3a32a0;
  --accent-soft: rgba(83, 74, 183, 0.12);
  --accent-2: #1d9e75;
  --accent-2-bg: #e1f5ee;
  --accent-2-text: #0f6e56;
  --warn-bg: #faeeda;
  --warn-text: #854f0b;
  --ok-bg: #e6f5ec;
  --ok-text: #1d7a4d;
  --shadow-sm: 0 1px 2px rgba(28, 30, 60, 0.05), 0 1px 3px rgba(28, 30, 60, 0.06);
  --shadow-md: 0 4px 14px rgba(28, 30, 60, 0.08), 0 2px 5px rgba(28, 30, 60, 0.05);
  --shadow-lg: 0 14px 40px rgba(28, 30, 60, 0.14), 0 4px 12px rgba(28, 30, 60, 0.08);
  --shadow-accent: 0 4px 14px rgba(70, 64, 190, 0.30);
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --rail: 84px;
  --aside: 300px;
  --font-display: "Inter Tight", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15151c;
    --bg-grad:
      radial-gradient(1200px 620px at 10% -10%, #1e1d33 0%, rgba(30, 29, 51, 0) 60%),
      radial-gradient(1000px 560px at 108% 112%, #14291f 0%, rgba(20, 41, 31, 0) 55%),
      linear-gradient(168deg, #18181f 0%, #131318 100%);
    --surface: #1e1e27;
    --surface-2: #26262f;
    --text: #ededf2;
    --text-2: #b0b1bd;
    --text-3: #82838f;
    --border: rgba(255, 255, 255, 0.10);
    --border-2: rgba(255, 255, 255, 0.20);
    --accent: #8189f2;
    --accent-grad: linear-gradient(135deg, #6f66e6 0%, #5a8bf0 100%);
    --accent-bg: #2a2570;
    --accent-text: #c7c4f8;
    --accent-soft: rgba(124, 132, 240, 0.16);
    --accent-2: #5dcaa5;
    --accent-2-bg: #103d31;
    --accent-2-text: #9fe1cb;
    --warn-bg: #633806;
    --warn-text: #fac775;
    --ok-bg: #123d2c;
    --ok-text: #8fe0b6;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.30), 0 1px 3px rgba(0, 0, 0, 0.35);
    --shadow-md: 0 4px 14px rgba(0, 0, 0, 0.40), 0 2px 5px rgba(0, 0, 0, 0.30);
    --shadow-lg: 0 14px 40px rgba(0, 0, 0, 0.55), 0 4px 12px rgba(0, 0, 0, 0.40);
    --shadow-accent: 0 4px 16px rgba(110, 102, 230, 0.45);
  }
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  background-image: var(--bg-grad);
  background-repeat: no-repeat;
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

#app { height: 100vh; display: flex; flex-direction: column; }

button {
  font: inherit;
  color: inherit;
  cursor: pointer;
  background: transparent;
  border: 0.5px solid var(--border-2);
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background .15s ease, border-color .15s ease, box-shadow .15s ease, color .15s ease, transform .08s ease;
}
button:hover { background: var(--surface-2); }
button:active { transform: scale(0.98); }
button.primary { background-color: var(--accent); background-image: var(--accent-grad); color: #fff; border-color: transparent; box-shadow: var(--shadow-accent); }
button.primary:hover { filter: brightness(1.07); }
button.ghost { border-color: transparent; box-shadow: none; }
button.accent-soft { background: var(--accent-bg); color: var(--accent-text); border-color: color-mix(in srgb, var(--accent) 30%, transparent); font-weight: 500; box-shadow: none; }
button.accent-soft:hover { background: color-mix(in srgb, var(--accent-bg) 80%, var(--accent)); }

textarea {
  font: inherit;
  width: 100%;
  resize: vertical;
  min-height: 96px;
  color: var(--text);
  background: var(--surface-2);
  border: 0.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  line-height: 1.6;
}
textarea:focus { outline: none; box-shadow: 0 0 0 2px var(--accent); }

/* Topbar */
.topbar {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px;
  border-bottom: 0.5px solid var(--border);
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  box-shadow: var(--shadow-sm);
  position: relative; z-index: 5;
}
.brand { display: flex; align-items: center; gap: 9px; font-weight: 600; font-family: var(--font-display); letter-spacing: -0.01em; }
.brand .ti {
  color: #fff; font-size: 16px;
  width: 28px; height: 28px; border-radius: 9px;
  background-image: var(--accent-grad);
  display: inline-flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow-accent);
}
.chip {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12px; padding: 4px 10px; border-radius: var(--radius-sm);
}
.chip.accent { background: var(--accent-bg); color: var(--accent-text); }
.chip.outline { border: 0.5px solid var(--border-2); }
.spacer { margin-left: auto; }
.lock { font-size: 12px; color: var(--text-3); display: inline-flex; align-items: center; gap: 5px; }

/* Body */
.body { flex: 1; display: flex; min-height: 0; overflow: hidden; }

.rail {
  width: var(--rail); flex-shrink: 0;
  border-right: 0.5px solid var(--border);
  background: linear-gradient(180deg, color-mix(in srgb, var(--surface) 94%, var(--accent) 6%), var(--surface) 55%);
  display: flex; flex-direction: column; align-items: center;
  padding: 12px 0; gap: 6px;
}
.rail button {
  position: relative;
  width: 72px; min-height: 52px; border: 0; border-radius: 12px;
  color: var(--text-3);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  padding: 6px 2px;
  transition: background .15s ease, color .15s ease, box-shadow .15s ease, transform .1s ease;
}
.rail button .ti { font-size: 21px; }
.rail-label {
  font-size: 10.5px; line-height: 1.1; font-weight: 500;
  text-align: center; letter-spacing: .01em;
}
.rail button:hover { background: var(--surface-2); color: var(--text-2); }
.rail button.active { background-image: var(--accent-grad); color: #fff; box-shadow: var(--shadow-accent); }
.rail button.active::before {
  content: ""; position: absolute; left: -8px; top: 50%; transform: translateY(-50%);
  width: 3px; height: 20px; border-radius: 0 2px 2px 0; background: var(--accent);
}
.rail .grow { margin-top: auto; }

.main { flex: 1; min-width: 0; overflow: auto; padding: 20px 22px; }
/* Eingangs-Animation nur beim echten Ansichtswechsel (Klasse wird in render()
   gesetzt) – nicht bei jedem Re-Render, sonst flackert es bei jedem Klick. */
.main.view-anim { animation: viewIn .24s cubic-bezier(.22, .61, .36, 1); }
@keyframes viewIn { from { opacity: 0; transform: translateY(7px); } to { opacity: 1; transform: none; } }

/* Student navigator */
.student-nav { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.avatar {
  width: 40px; height: 40px; border-radius: 50%;
  background-image: var(--accent-grad); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 600; flex-shrink: 0;
  box-shadow: var(--shadow-accent);
}
.student-name { font-weight: 500; }
.student-sub { font-size: 12px; color: var(--text-2); }
/* Ansicht-Umschalter Zeugnis ⇄ Kind-Version im Editor-Kopf (Segment-Control) */
.ed-modetoggle { display: inline-flex; border: 0.5px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; background: var(--surface); }
.ed-mode {
  display: inline-flex; align-items: center; gap: 6px;
  font: inherit; font-size: 12px; font-weight: 500;
  padding: 6px 12px; border: 0; background: transparent; color: var(--text-2);
  cursor: pointer; box-shadow: none; white-space: nowrap;
}
.ed-mode + .ed-mode { border-left: 0.5px solid var(--border); }
.ed-mode .ti { font-size: 16px; }
.ed-mode:hover { background: var(--surface-2); color: var(--text); }
.ed-mode.active { background: var(--accent-bg); color: var(--accent-text); }
.badge { font-size: 12px; padding: 3px 10px; border-radius: var(--radius-sm); }
.badge.draft { background: var(--warn-bg); color: var(--warn-text); }
.badge.done { background: var(--ok-bg); color: var(--ok-text); }
.badge.printed { background: var(--accent-bg); color: var(--accent-text); display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.badge.stale { background: var(--warn-bg); color: var(--warn-text); display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.print-note { display: flex; align-items: flex-start; gap: 6px; font-size: 12px; line-height: 1.45; margin: 8px 0 10px; padding: 7px 10px; border-radius: var(--radius-sm); background: var(--accent-bg); color: var(--accent-text); }
.print-note > .ti { flex: 0 0 auto; margin-top: 1px; }
.print-note.stale { background: var(--warn-bg); color: var(--warn-text); }
.status-meter { display: flex; flex-direction: column; gap: 5px; min-width: 158px; }
.sm-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.sm-pct { font-size: 13px; font-weight: 600; color: var(--text-2); font-variant-numeric: tabular-nums; }
.sm-bar { height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; }
.sm-fill { height: 100%; border-radius: 3px; transition: width .45s cubic-bezier(.4, 0, .2, 1), background .45s ease; }
.sm-hint { font-size: 11px; color: var(--text-3); display: inline-flex; align-items: center; gap: 4px; }
.status-meter.is-done .sm-pct { color: var(--ok-text); }
.status-meter.is-done .sm-hint { color: var(--ok-text); font-weight: 600; }
.iconbtn { width: 32px; height: 32px; justify-content: center; padding: 0; }

/* Subject cards */
.editor-layout { display: grid; grid-template-columns: minmax(0, 1fr) var(--aside); gap: 18px; align-items: start; }
.editor-layout.no-aside { grid-template-columns: 1fr; }
@media (max-width: 980px) { .editor-layout { grid-template-columns: 1fr; } }

.subject { border: 0.5px solid var(--border); border-radius: var(--radius); margin-bottom: 10px; background: var(--surface); box-shadow: var(--shadow-sm); transition: box-shadow .16s ease, border-color .16s ease; }
.subject.open { box-shadow: var(--shadow-md); }
.subject-head {
  display: flex; align-items: center; gap: 8px;
  padding: 11px 14px; cursor: pointer; user-select: none;
}
.subject-head .ti.lead { font-size: 18px; color: var(--text-2); }
.subject.open .subject-head .ti.lead { color: var(--accent); }
.subject-title { font-weight: 500; }
.subject-meta { margin-left: auto; font-size: 12px; color: var(--text-3); display: inline-flex; align-items: center; gap: 5px; }
.subject-meta.done { color: var(--ok-text); }
.subject-body { padding: 0 14px 14px; }

/* Formatierungsleiste über dem Verbaltext (Ausrichtung + Schriftgröße) */
.tf-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.tf-group { display: inline-flex; border: 0.5px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; }
.tf-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 28px; padding: 0; border: 0; border-radius: 0;
  background: var(--surface); color: var(--text-2); cursor: pointer; box-shadow: none;
}
.tf-btn + .tf-btn { border-left: 0.5px solid var(--border); }
.tf-btn .ti { font-size: 16px; }
.tf-btn:hover { background: var(--surface-2); color: var(--text); }
.tf-btn.active { background: var(--accent-bg); color: var(--accent-text); }
.tf-size { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: var(--text-3); }
.tf-size .ti { font-size: 16px; }
.tf-size select {
  font: inherit; font-size: 12px; color: var(--text); background: var(--surface);
  border: 0.5px solid var(--border); border-radius: var(--radius-sm);
  padding: 4px 6px; cursor: pointer;
}
.tf-size select:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }

.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.tag { font-size: 12px; padding: 3px 10px; border-radius: var(--radius-sm); border: 0.5px solid var(--border-2); color: var(--text-2); }
.tag.on { background: var(--accent-bg); color: var(--accent-text); border-color: transparent; }
.tag.ai { margin-left: auto; background: var(--accent-bg); color: var(--accent-text); border-color: transparent; cursor: pointer; }

/* Aside */
.aside { display: flex; flex-direction: column; gap: 18px; position: sticky; top: 0; }
.aside-label { font-size: 12px; color: var(--text-2); margin-bottom: 8px; display: flex; align-items: center; gap: 6px; }

/* Ziehbare Breite der Textbaustein-Spalte — dezenter Griff im Spalten-Spalt.
   Im Ruhezustand unsichtbar; beim Hover erscheint eine feine Linie, beim Ziehen Akzentfarbe. */
.aside-resizer { position: absolute; top: 2px; bottom: 2px; left: -14px; width: 12px; cursor: col-resize; touch-action: none; z-index: 3; -webkit-user-select: none; user-select: none; }
.aside-resizer::before { content: ""; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 2px; height: 34px; border-radius: 999px; background: var(--border-2); opacity: 0; transition: opacity .16s ease, height .16s ease, background .16s ease; }
.aside-resizer:hover::before, body.aside-resizing .aside-resizer::before { opacity: 1; height: 56px; background: var(--accent); }
body.aside-resizing { cursor: col-resize; -webkit-user-select: none; user-select: none; }
@media (max-width: 980px) { .aside-resizer { display: none; } }
/* Karten-Überschrift (z. B. Einstellungen) — deutlich größer als .aside-label */
.card-title { display: flex; align-items: center; gap: 8px; font-size: 15px; font-weight: 600; color: var(--text); margin-bottom: 14px; font-family: var(--font-display); letter-spacing: -0.01em; }
.card-title .ti { font-size: 18px; color: var(--accent); }
.card { background: var(--surface); border: 0.5px solid var(--border); border-radius: var(--radius-lg); padding: 16px; box-shadow: var(--shadow-sm); }

/* Live preview – das A4-Blatt schwebt auf einer dezent getönten „Schreibtisch"-Fläche */
.preview-scale {
  overflow: auto; max-height: calc(100vh - 150px);
  border-radius: var(--radius);
  background: radial-gradient(130% 90% at 50% -10%, var(--accent-soft), transparent 55%), var(--surface-2);
  padding: 16px 14px 22px;
}

/* Großflächige Vorschau unter dem Editor (volle Breite). Das Blatt wird auf
   eine angenehme Lesebreite begrenzt und mittig auf der Fläche zentriert. */
.preview-section { margin-top: 22px; }
.preview-section .preview-scale {
  max-height: calc(100vh - 120px);
  display: flex; justify-content: center;
  padding: 26px 18px;
}
.preview-section .preview-doc { width: 720px; max-width: 100%; align-self: flex-start; }

/* Zoom-/Vollbild-Leiste */
.preview-toolbar { margin-left: auto; display: inline-flex; align-items: center; gap: 2px; }
.preview-toolbar .pv-btn {
  height: 26px; min-width: 26px; padding: 0 5px; justify-content: center;
  border: 0.5px solid var(--border-2); border-radius: var(--radius-sm);
  color: var(--text-2); font-size: 11px;
}
.preview-toolbar .pv-btn .ti { font-size: 15px; }
.preview-toolbar .pv-btn:hover { background: var(--surface-2); color: var(--text); }
.preview-zoom-val { font-variant-numeric: tabular-nums; min-width: 42px; }

/* Vollbild-Overlay */
#preview-overlay { position: fixed; inset: 0; z-index: 50; background: rgba(0, 0, 0, 0.55); display: flex; flex-direction: column; }
.preview-overlay-bar {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 16px; background: var(--surface); border-bottom: 0.5px solid var(--border);
}
.preview-overlay-title { font-weight: 500; display: inline-flex; align-items: center; gap: 8px; }
.preview-overlay-name { font-size: 13px; color: var(--text-2); min-width: 120px; text-align: center; }
.preview-overlay-stage { flex: 1; overflow: auto; display: flex; justify-content: center; padding: 24px; }
.preview-overlay-stage .preview-page {
  /* echtes A4-Blatt, immer hell wie Papier — unabhängig vom Dark Mode */
  --text: #1a1a1a; --text-2: #444; --text-3: #666; --surface: #fff; --border: rgba(0, 0, 0, 0.2);
  width: 210mm; min-height: 297mm; flex-shrink: 0; align-self: flex-start;
  background: #fff; color: #1a1a1a; padding: 16mm;
  box-shadow: 0 8px 34px rgba(0, 0, 0, 0.35); transform-origin: top center;
}
.preview-overlay-stage .preview-page.form-doc { font-size: 11.5pt; line-height: 1.5; }
.preview-overlay-stage .preview-page .ff-n, .preview-overlay-stage .preview-page .zline,
.preview-overlay-stage .preview-page .zbox,
.preview-overlay-stage .preview-page .zchk { border-color: #1a1a1a; }
.preview-overlay-stage .preview-page .zfaecher { gap: 9px 22px; }
/* Zweiseitige Vordrucke (.zdoc): die Trägerseite wird neutral, jede .zpage ist ein
   eigenes A5-Hochformat-Blatt (148 × 210 mm) mit den Original-Rändern. */
.preview-overlay-stage .preview-page.form-doc:has(.zdoc) {
  width: auto; min-height: 0; padding: 0; background: transparent; box-shadow: none;
  font-size: 10pt; line-height: 1.4;
}
.preview-overlay-stage .preview-page.form-doc:has(.zdoc) .zdoc { gap: 18px; }
.preview-overlay-stage .preview-page.form-doc .zpage {
  width: 148mm; min-height: 210mm; box-sizing: border-box;
  padding: 8mm 15mm 13mm 22mm; background: #fff; color: #1a1a1a;
  box-shadow: 0 8px 34px rgba(0, 0, 0, 0.35);
  display: flex; flex-direction: column;
}
.preview-overlay-stage .preview-page.form-doc .zpage + .zpage { margin-top: 0; border-top: 0; }
.preview-overlay-stage .preview-page .sb-grid { grid-template-columns: 1fr 1fr; }
.preview-doc { background: var(--surface); border: 0.5px solid var(--border); border-radius: var(--radius-sm); padding: 18px; box-shadow: var(--shadow-md); }
.preview-school { font-size: 11px; text-align: center; color: var(--text-3); letter-spacing: 0.5px; text-transform: uppercase; }
.preview-type { font-size: 13px; text-align: center; font-weight: 500; margin: 4px 0 12px; }
.preview-name { font-size: 13px; margin-bottom: 12px; }
.preview-name b { font-weight: 500; }
.preview-subject { margin-bottom: 12px; }
.preview-subject h4 { margin: 0 0 4px; font-size: 12px; font-weight: 500; color: var(--accent); }
.preview-subject p { margin: 0; font-size: 12px; line-height: 1.6; color: var(--text); }
.preview-empty { font-size: 12px; color: var(--text-3); font-style: italic; }

/* Formulierungshilfen */
.search {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface-2); border: 0.5px solid var(--border);
  border-radius: var(--radius-sm); padding: 7px 10px; margin-bottom: 10px;
}
.search .ti { color: var(--text-3); font-size: 16px; }
.search input { border: 0; background: transparent; outline: none; color: inherit; font: inherit; width: 100%; }
/* Tab-Leiste der Top-Level-Kategorien (Fächer) – schneller Wechsel & Übersicht */
.ph-tabs { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 10px; }
.ph-tab {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12px; font-weight: 500; color: var(--text-2);
  border: 0.5px solid var(--border); border-radius: 999px;
  padding: 4px 11px; background: var(--surface); cursor: pointer; user-select: none;
  transition: background .14s ease, border-color .14s ease, color .14s ease, box-shadow .14s ease;
}
.ph-tab > i { font-size: 14px; color: var(--text-3); }
.ph-tab:hover { border-color: var(--border-2); background: var(--surface-2); color: var(--text); }
.ph-tab.on { background-image: var(--accent-grad); border-color: transparent; color: #fff; box-shadow: var(--shadow-sm); }
.ph-tab.on > i { color: #fff; }
.phrases { display: flex; flex-direction: column; gap: 8px; max-height: calc(100vh - 320px); overflow: auto; }
.phrase {
  text-align: left; font-size: 13px; line-height: 1.5;
  border: 0.5px solid var(--border); border-radius: var(--radius-sm);
  padding: 8px 10px; background: var(--surface);
  transition: background .14s ease, border-color .14s ease, box-shadow .14s ease, transform .1s ease;
}
.phrase:hover { background: var(--accent-bg); border-color: transparent; box-shadow: var(--shadow-sm); transform: translateX(2px); }

/* Suche: Löschen-Knopf + Treffer-Hervorhebung */
.search-clear { border: 0; background: transparent; color: var(--text-3); padding: 0 2px; cursor: pointer; display: inline-flex; }
.search-clear:hover { color: var(--text); }
.ph-txt mark { background: var(--warn-bg); color: var(--warn-text); border-radius: 3px; padding: 0 1px; }

/* Niveau-Filter (Stufe 1–4) */
.ph-niveau { display: flex; gap: 5px; margin-bottom: 9px; }
.ph-niv {
  min-width: 30px; height: 27px; padding: 0 9px; display: inline-flex; align-items: center; justify-content: center;
  border: 0.5px solid var(--border); border-radius: 999px; background: var(--surface);
  color: var(--text-2); font-size: 12px; font-weight: 600; cursor: pointer; user-select: none;
  transition: background .14s ease, border-color .14s ease, color .14s ease, box-shadow .14s ease;
}
.ph-niv:hover { border-color: var(--border-2); background: var(--surface-2); }
.ph-niv.on { color: #fff; border-color: transparent; box-shadow: var(--shadow-sm); }
.ph-niv[data-phraseniveau=""].on { background-image: var(--accent-grad); }
.ph-niv.lvl-1.on { background: #d98324; }
.ph-niv.lvl-2.on { background: #c9a31f; color: #2c2100; }
.ph-niv.lvl-3.on { background: #4f9a55; }
.ph-niv.lvl-4.on { background: #2f7d8a; }

/* Meta-Zeile: Trefferzahl + Alle auf-/zuklappen */
.ph-meta { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.ph-count { font-size: 11px; font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: .03em; }
.ph-allbtns { display: inline-flex; gap: 2px; }
.ph-mini { border: 0; background: transparent; color: var(--text-3); padding: 2px 5px; cursor: pointer; border-radius: var(--radius-sm); }
.ph-mini:hover { color: var(--text); background: var(--surface-2); }

/* Kompetenz-Akkordeon */
.ph-komp + .ph-komp { margin-top: 5px; }
.ph-komp-h {
  display: flex; align-items: center; gap: 7px; width: 100%; text-align: left;
  border: 0.5px solid var(--border); border-radius: var(--radius-sm);
  padding: 7px 9px; background: var(--surface); cursor: pointer; font-size: 12.5px;
  transition: background .12s ease, border-color .12s ease;
}
.ph-komp-h:hover { background: var(--surface-2); border-color: var(--border-2); }
.ph-komp.open .ph-komp-h { background: var(--surface-2); border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
.ph-komp-h > i { color: var(--text-3); font-size: 15px; }
.ph-komp-title { flex: 1; font-weight: 500; color: var(--text); }
.ph-komp-count { color: var(--text-3); font-size: 11px; font-weight: 600; background: var(--surface); border: 0.5px solid var(--border); border-radius: 999px; padding: 1px 7px; }
.ph-komp.open .ph-komp-count { background: var(--surface); }
.ph-komp-body {
  display: flex; flex-direction: column; gap: 5px; padding: 6px;
  border: 0.5px solid var(--border); border-top: 0; border-radius: 0 0 var(--radius-sm) var(--radius-sm);
}
.hint { font-size: 12px; color: var(--text-3); margin-top: 10px; display: flex; align-items: flex-start; gap: 6px; line-height: 1.5; }
/* Icon bleibt fix, der Text (inkl. <b>) füllt als EIN Flex-Element den Rest —
   sonst würden Inline-Elemente im Hinweis zu eigenen Spalten umbrechen. */
.hint > .ti { flex: 0 0 auto; margin-top: 1px; }
.hint > span { flex: 1; min-width: 0; }

/* Placeholder panes */
.placeholder { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 70%; color: var(--text-3); gap: 14px; text-align: center; }
.placeholder .ti, .empty-state .ti {
  font-size: 28px; color: #fff;
  width: 64px; height: 64px; border-radius: 50%;
  background-image: var(--accent-grad);
  display: inline-flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow-accent);
}

/* Headings */
.page-title { font-size: 23px; font-weight: 600; font-family: var(--font-display); letter-spacing: -0.02em; margin: 4px 0 4px; }
.page-sub { color: var(--text-2); margin: 0 0 16px; font-size: 13px; }
.mini { font-size: 12px; padding: 3px 8px; }
.avatar.sm { width: 30px; height: 30px; font-size: 12px; }

/* Dashboard metrics */
.metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.metric { background: var(--surface); border: 0.5px solid var(--border); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow-sm); transition: transform .15s ease, box-shadow .15s ease; }
.metric:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.metric-label { font-size: 12px; color: var(--text-2); display: flex; align-items: center; gap: 6px; }
.metric-label .ti { color: var(--accent); }
.metric-val { font-size: 28px; font-weight: 600; font-family: var(--font-display); letter-spacing: -0.02em; color: var(--accent); margin-top: 6px; }
/* Seriendruck-Panel (Übersicht) */
.serien { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; background: var(--surface); border: 0.5px solid var(--border); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow-sm); }
.serien-info { font-size: 13px; color: var(--text-2); max-width: 48ch; }
.serien-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.serien-actions button[disabled] { opacity: .5; cursor: not-allowed; box-shadow: none; }
.serien-actions button[disabled]:hover { background: transparent; filter: none; }

.ds-list { display: flex; flex-direction: column; gap: 6px; }
.ds-row { display: flex; align-items: center; gap: 12px; background: var(--surface); border: 0.5px solid var(--border); border-radius: var(--radius-sm); padding: 8px 12px; cursor: pointer; box-shadow: var(--shadow-sm); transition: border-color .14s ease, box-shadow .14s ease, transform .1s ease; }
.ds-row:hover { border-color: var(--border-2); box-shadow: var(--shadow-md); transform: translateX(2px); }
.ds-name { font-weight: 500; min-width: 150px; }
.bar { flex: 1; height: 6px; background: var(--surface-2); border-radius: 3px; overflow: hidden; }
.bar-fill { height: 100%; background-color: var(--accent); background-image: var(--accent-grad); border-radius: 3px; }
.ds-pct { font-size: 12px; color: var(--text-2); width: 44px; text-align: right; }

/* Notenraster */
.table-wrap { overflow: auto; border: 0.5px solid var(--border); border-radius: var(--radius); }
table.grid { border-collapse: collapse; width: 100%; font-size: 13px; }
table.grid th, table.grid td { border-bottom: 0.5px solid var(--border); border-right: 0.5px solid var(--border); padding: 6px 10px; text-align: center; }
table.grid th { background: var(--surface-2); font-weight: 500; position: sticky; top: 0; }
table.grid .sticky { text-align: left; position: sticky; left: 0; background: var(--surface); white-space: nowrap; }
.grade-select { height: 30px; padding: 2px 4px; border: 0.5px solid var(--border); border-radius: 6px; background: var(--surface); color: inherit; text-align: center; text-align-last: center; }
.grade-select option { text-align: center; }

/* Kompetenzraster (Ankreuzzeugnis) */
.ank-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12px; color: var(--text-2); margin-bottom: 12px; }
.ank-legend span { display: inline-flex; align-items: center; gap: 5px; }
.ank-legend b { display: inline-flex; align-items: center; justify-content: center; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 5px; background: var(--surface-2); font-size: 11px; font-weight: 600; }
.ank-toolbar { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.ank-list { display: flex; flex-direction: column; gap: 10px; }
/* Oberkategorie (z. B. „Lernen") mit Fächern als Unterkategorien */
.ank-group { background: var(--surface-2); border: 0.5px solid var(--border); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-sm); }
.ank-group-head { display: flex; align-items: center; gap: 10px; padding: 13px 15px; cursor: pointer; user-select: none; }
.ank-group-head:hover { background: var(--surface); }
.ank-group-head .spacer { flex: 1; }
.ank-group-head > i:first-child { color: var(--accent); }
.ank-group-title { font-weight: 600; font-size: 15px; }
.ank-group-body { display: flex; flex-direction: column; gap: 8px; padding: 10px 10px 12px; }
.ank-subj { background: var(--surface); border: 0.5px solid var(--border); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-sm); }
.ank-subj-head { display: flex; align-items: center; gap: 9px; padding: 11px 14px; cursor: pointer; user-select: none; }
.ank-subj-head:hover { background: var(--surface-2); }
.ank-subj-head .spacer { flex: 1; }
.ank-subj-title { font-weight: 500; }
.ank-count { display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px; padding: 0 7px; border-radius: 10px; background: var(--accent-bg); color: var(--accent-text); font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; }
.ank-count.empty { background: var(--surface-2); color: var(--text-3); }
.ank-count.complete { background: var(--ok-bg); color: var(--ok-text); }
.ank-subj-body { padding: 2px 14px 12px; --ank-item-w: 290px; --ank-rate-w: 200px; }
/* Mehr Luft zwischen den Kompetenzbereichen, damit die Überschrift klar zum
   folgenden Block gehört und nicht am vorherigen „klebt". */
.ank-bereich { margin-top: 26px; padding-top: 18px; border-top: 0.5px solid var(--border); }
.ank-subj-body > .ank-bereich:first-child { margin-top: 6px; padding-top: 0; border-top: 0; }
.ank-bereich-h { font-size: 12px; font-weight: 600; color: var(--text-2); text-transform: uppercase; letter-spacing: .03em; margin-bottom: 8px; }
/* table-layout: fixed + einheitliche Spaltenbreiten ⇒ das Raster beginnt in
   jedem Bereich an derselben x-Position und steht sauber untereinander. */
.ank-table { width: 100%; border-collapse: collapse; font-size: 13px; table-layout: fixed; }
.ank-table th { font-weight: 600; color: var(--text-3); padding-bottom: 7px; font-size: 10.5px; text-transform: uppercase; letter-spacing: .04em; }
.ank-th-item { width: var(--ank-item-w); }
.ank-th-rate { width: var(--ank-rate-w); text-align: left; padding: 0 4px; }
.ank-th-prev { width: auto; text-align: left; padding-left: 14px; }
.ank-table tr { border-top: 0.5px solid var(--border); }
.ank-table tr:first-child { border-top: 0; }
.ank-item { padding: 8px 18px 8px 0; line-height: 1.4; white-space: normal; vertical-align: middle; }
.ank-rate { padding: 6px 4px; vertical-align: middle; }

/* Segmented pill group: ein farbcodierter Wert je Kompetenz */
.ank-pills { display: inline-flex; gap: 4px; }
.ank-pill { position: relative; display: inline-flex; align-items: center; justify-content: center;
  min-width: 30px; height: 28px; padding: 0 7px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); background: var(--surface); color: var(--text-3);
  font-size: 13px; font-weight: 600; line-height: 1; cursor: pointer; user-select: none;
  transition: background .12s, border-color .12s, color .12s, box-shadow .12s; }
.ank-pill input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.ank-pill:hover { border-color: var(--border-2); background: var(--surface-2); color: var(--text-2); }
.ank-pill:focus-within { outline: 2px solid var(--accent); outline-offset: 1px; }
.ank-pill.off:has(input:checked) { background: var(--surface-2); border-color: var(--border-2); color: var(--text-2); }
.ank-pill.lvl-1:has(input:checked) { background: #d98324; border-color: #d98324; color: #fff; box-shadow: var(--shadow-sm); }
.ank-pill.lvl-2:has(input:checked) { background: #d9a91f; border-color: #d9a91f; color: #2c2100; box-shadow: var(--shadow-sm); }
.ank-pill.lvl-3:has(input:checked) { background: #4f9a55; border-color: #4f9a55; color: #fff; box-shadow: var(--shadow-sm); }
.ank-pill.lvl-4:has(input:checked) { background: #2f7d8a; border-color: #2f7d8a; color: #fff; box-shadow: var(--shadow-sm); }
.ank-prev { padding: 6px 0 6px 14px; color: var(--text-2); line-height: 1.4; font-size: 12.5px; vertical-align: middle; }
.ank-prev-txt { font-style: italic; }
/* Satztext ist klickbar und öffnet den Editor (besser auffindbar als nur der Stift) */
.ank-prev-txt.clickable { cursor: pointer; border-radius: var(--radius-sm); transition: color .12s, background .12s; }
.ank-prev-txt.clickable:hover { color: var(--text); background: var(--accent-soft); box-shadow: 0 0 0 3px var(--accent-soft); }
/* Hinweis in unbewerteten Zeilen, der zum Bewerten führt */
.ank-prev-hint { display: inline-flex; align-items: center; gap: 5px; color: var(--text-3); font-size: 12px; font-style: normal; }
/* Das explizite display oben überschreibt sonst das [hidden]-Attribut → ausblenden sicherstellen. */
.ank-prev-hint[hidden] { display: none; }
/* Aktionen rechts in der Formulierungsspalte */
.ank-prev-actions { display: inline-flex; gap: 5px; margin-left: 8px; white-space: nowrap; vertical-align: middle; }
.ank-edit { border: 0.5px solid var(--accent); border-radius: var(--radius-sm); padding: 3px 7px; background: var(--accent-bg); color: var(--accent-text); cursor: pointer; vertical-align: middle; transition: filter .12s, background .12s; }
.ank-edit:hover { filter: brightness(1.05); }
.ank-edit.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.ank-take { border: 0.5px solid var(--border-2); border-radius: var(--radius-sm); padding: 3px 8px; background: var(--surface-2); color: var(--text-2); cursor: pointer; vertical-align: middle; }
.ank-take:hover { background: var(--accent-bg); color: var(--accent-text); }

/* Dezenter Toast (selbst-verschwindend, nicht blockierend) */
#toast {
  position: fixed; left: 50%; bottom: 26px; transform: translate(-50%, 14px);
  display: inline-flex; align-items: center; gap: 8px;
  max-width: min(560px, 92vw); padding: 11px 16px;
  border-radius: var(--radius); border: 0.5px solid var(--border-2);
  background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg);
  font-size: 13.5px; z-index: 60; opacity: 0; pointer-events: none;
  transition: opacity .18s ease, transform .18s ease;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast > i { font-size: 18px; }
#toast.ok > i { color: var(--accent-2); }
#toast.info > i { color: var(--accent); }
#toast.warn { border-color: var(--warn-text); }
#toast.warn > i { color: var(--warn-text); }

/* Inline-Editor einer Raster-Zeile (Alternativformulierungen + Freitext) */
.ank-edit-row > td { padding: 0 0 10px; }
.ank-editor { margin: 2px 0 4px; padding: 12px 14px; border: 0.5px solid var(--border-2); border-radius: var(--radius); background: var(--surface-2); display: flex; flex-direction: column; gap: 10px; }
.ank-editor-h { display: flex; align-items: center; gap: 7px; font-size: 11px; font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: .03em; }
.ank-editor-lvl { display: inline-flex; align-items: center; height: 18px; padding: 0 7px; border-radius: 9px; color: #fff; font-size: 11px; font-weight: 700; text-transform: none; letter-spacing: 0; }
.ank-editor-lvl.lvl-1 { background: #d98324; } .ank-editor-lvl.lvl-2 { background: #c9a31f; color: #2c2100; }
.ank-editor-lvl.lvl-3 { background: #4f9a55; } .ank-editor-lvl.lvl-4 { background: #2f7d8a; }
.ank-editor-multi { display: inline-flex; align-items: center; gap: 5px; margin-left: auto; text-transform: none; letter-spacing: 0; font-weight: 600; color: var(--accent-text); }
.ank-editor-multi.muted { color: var(--text-3); font-weight: 400; }
.ank-editor-h { flex-wrap: wrap; }
.ank-vars { display: flex; flex-direction: column; gap: 5px; }
.ank-var { display: flex; align-items: flex-start; gap: 8px; text-align: left; padding: 8px 10px; border: 0.5px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); color: var(--text-2); cursor: pointer; font: inherit; font-size: 13px; line-height: 1.4; transition: border-color .12s, background .12s, color .12s; }
.ank-var:hover { border-color: var(--border-2); background: var(--surface-2); color: var(--text); }
.ank-var > i { flex: none; margin-top: 1px; color: var(--text-3); font-size: 16px; }
.ank-var.active { border-color: var(--accent); background: var(--accent-bg); color: var(--text); }
.ank-var.active > i { color: var(--accent); }
.ank-editor-custom { display: flex; flex-direction: column; gap: 5px; font-size: 11px; font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: .03em; }
.ank-editor-custom > span { display: inline-flex; align-items: center; gap: 5px; }
.ank-editor-custom textarea { resize: vertical; font: inherit; font-size: 13px; text-transform: none; letter-spacing: 0; font-weight: 400; color: var(--text); padding: 8px 10px; border: 0.5px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); }
.ank-editor-custom textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }
.ank-editor-empty { font-size: 12.5px; color: var(--text-3); font-style: italic; }
.ank-editor-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.ank-var-reset, .ank-editor-close { display: inline-flex; align-items: center; gap: 6px; border-radius: var(--radius-sm); padding: 6px 12px; cursor: pointer; font: inherit; font-size: 13px; }
.ank-var-reset { border: 0.5px solid var(--border); background: var(--surface); color: var(--text-2); }
.ank-var-reset:hover { border-color: var(--border-2); color: var(--text); }
.ank-editor-close { border: 0.5px solid var(--border-2); background: var(--accent-bg); color: var(--accent-text); }
.ank-editor-close:hover { filter: brightness(1.05); }

/* Formulierungshilfen: Fach-Gruppen (z. B. unter „Lernen und Lernentwicklung") */
.ph-subj + .ph-subj { margin-top: 10px; padding-top: 10px; border-top: 0.5px solid var(--border); }
.ph-subj-h { display: flex; align-items: center; gap: 6px; font-weight: 600; font-size: 13px; color: var(--text); margin: 2px 0 4px; }
.ph-subj-h > i { color: var(--accent); }

/* Niveau-Badge in den Formulierungshilfen */
.ph-group + .ph-group { margin-top: 4px; }
.ph-group-h { font-size: 11px; font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: .03em; margin: 8px 0 5px; }
.ph-lvl { display: inline-flex; align-items: center; justify-content: center; min-width: 17px; height: 17px; border-radius: 5px; font-size: 10px; font-weight: 700; color: #fff; }
.ph-lvl-1 { background: #d98324; }
.ph-lvl-2 { background: #c9a31f; }
.ph-lvl-3 { background: #4f9a55; }
.ph-lvl-4 { background: #2f7d8a; }
.phrase { display: flex; align-items: baseline; gap: 7px; cursor: pointer; }

/* „Aus Raster erzeugen" im Editor */
.gen-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 10px; }
.genbtn { display: inline-flex; align-items: center; gap: 6px; border: 0.5px solid var(--border-2); border-radius: var(--radius-sm); padding: 6px 12px; background: var(--accent-bg); color: var(--accent-text); cursor: pointer; font: inherit; font-size: 13px; }
.genbtn:hover { filter: brightness(1.05); }
.genbtn:disabled { background: var(--surface-2); color: var(--text-3); cursor: not-allowed; filter: none; }
.gen-hint { font-size: 12px; color: var(--text-3); }

/* Formulare (Bemerkungen, Einstellungen) */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; align-items: start; }
.fld { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--text-2); }
.fld + .fld { margin-top: 12px; }
.fld .req { color: #b3261e; font-weight: 700; margin-left: 2px; }
@media (prefers-color-scheme: dark) { .fld .req { color: #f2b8b5; } }
.fld input[type="text"], .fld input[type="number"], .fld input[type="date"], .fld select { height: 34px; padding: 4px 10px; border: 0.5px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); }
.fld select { cursor: pointer; }
.fld-row { display: flex; gap: 12px; }
.fld.check { flex-direction: row; align-items: center; gap: 8px; color: var(--text); }
.fld.check input { width: 16px; height: 16px; accent-color: var(--accent); }

/* Amtliches Muster — Nachbau BW "Zeugnis / Bildungsgang: Grundschule".
   Die amtlichen Vordrucke (1Plus-direkt) sind durchgängig in Arial gesetzt. */
.form-doc { font-family: Arial, "Helvetica Neue", Helvetica, sans-serif; color: var(--text); }
.preview-doc.form-doc { font-size: 11px; line-height: 1.45; }
.zland { font-weight: bold; margin-left: 8%; }
.zschule { font-weight: bold; margin: 14px 0 0 18%; }
.ztitle { margin: 10px 0 14px 18%; }
.zt-big { font-size: 1.7em; font-weight: bold; }
.zkv { display: flex; gap: 28px; margin: 4px 0; }
.zkv .zv { font-weight: bold; }
.zsec { font-weight: bold; margin: 16px 0 10px; }
/* 4-spaltiges Fächer-Raster: Fach · Note · Fach · Note. Unterstrichen ist nur die Note. */
.zfaecher { display: grid; grid-template-columns: max-content 1fr max-content 1fr; gap: 11px 22px; margin: 12px 0 16px; align-items: end; }
.ff-l { white-space: nowrap; }
.ff-n { font-weight: bold; border-bottom: 1px solid var(--text); padding: 0 6px 2px; }
/* Linksbündiger Kopf (Halbjahresinformation) */
.zhead-l { line-height: 1.4; }
.zhead-l .zschule-l { font-weight: bold; }
.ztitle-l { margin: 18px 0 14px; }
.zt-erg { font-style: italic; font-size: 0.62em; font-weight: normal; vertical-align: middle; }
/* Zentrierter Kopf mit Trennlinie UNTER dem Schulnamen (Zeugnis / Abschlusszeugnis).
   Im Original steht „Baden-Württemberg / *sn1* / *sn2*" zentriert und fett in einem
   Kasten, dessen Unterkante die Trennlinie zum Titel bildet. */
.zhead-c { text-align: center; line-height: 1.45; font-weight: bold;
  padding-bottom: 8px; border-bottom: 1.5px solid var(--text); }
.zhead-c .zschule-c { font-weight: bold; font-size: 1.05em; }
.zwappen-c svg { display: block; margin: 0 auto 2px; }
.ztitle-c { text-align: center; margin: 12px 0 14px; }
/* Titel „Zeugnis" ~13,5 pt (Original) statt der größeren Default-Überschrift */
.ztitle-c .zt-big { font-size: 1.35em; }
/* Zweiseitige Vordrucke (Jahreszeugnis): Seite 1 endet nach der Notenstufen-
   Fußnote, Seite 2 beginnt mit der „Allgemeinen Beurteilung". In der Editor-
   Vorschau (schmal) fließen die Seiten mit Trenn­linie untereinander; im
   Vollbild und im Druck wird daraus je ein echtes A5-Hochformat-Blatt. */
.zdoc { display: flex; flex-direction: column; }
.preview-doc.form-doc .zpage + .zpage { margin-top: 14px; padding-top: 14px; border-top: 1px dashed var(--border); }
/* „Allgemeine Beurteilung" als umrahmtes Textfeld */
.zbox-beurt { border: 1px solid var(--text); padding: 8px 10px; margin: 4px 0 12px; min-height: 200px; white-space: pre-wrap; }
.zblock { margin: 10px 0; }
.zlab { font-weight: bold; }
.zsub { font-size: 0.85em; color: var(--text-2); }
.ztext { margin: 2px 0 0; min-height: 1.4em; white-space: pre-wrap; }
.zdatum { margin: 18px 0; }
.zfoot { display: flex; align-items: flex-end; gap: 12px; margin-top: 22px; }
.zsign { flex: 1; text-align: center; font-size: 0.9em; }
.zsiegel { width: 86px; text-align: center; font-size: 0.7em; color: var(--text-2); border: 1px dashed var(--text-2); border-radius: 50%; padding: 12px 4px; }
.zline { border-top: 1px solid var(--text); margin-bottom: 4px; }
.zline.wide { flex: 1; margin-left: 10px; }
/* Gedruckter Name über der Unterschriftslinie */
.zsign-name { font-size: 0.95em; line-height: 1.2; margin-bottom: 3px; min-height: 1.1em; }

/* Kompetenzzeugnis (Ankreuzraster als Vordruck) */
.zk-legend { display: flex; flex-wrap: wrap; gap: 4px 18px; margin: 10px 0 6px; font-size: 0.9em; }
.zk-legend b { margin-right: 4px; }
.zk-body { margin: 6px 0; }
.zk-fach { margin: 12px 0; break-inside: avoid; }
.zk-fach-h { font-weight: bold; font-size: 1.1em; border-bottom: 1.5px solid var(--text); padding-bottom: 2px; margin-bottom: 4px; }
.zk-ber { font-style: italic; color: var(--text-2); margin: 6px 0 2px; }
.zk-tab { width: 100%; border-collapse: collapse; }
.zk-tab th { font-weight: normal; text-align: center; width: 26px; border-bottom: 1px solid var(--text-2); padding-bottom: 2px; }
.zk-tab th.zk-kh { width: auto; }
.zk-k { padding: 2px 6px 2px 0; }
.zk-c { width: 26px; text-align: center; border: 1px solid var(--text-2); }
.zk-c.on { font-weight: bold; }
.zk-empty { color: var(--text-2); font-style: italic; }
.zgesehen { display: flex; align-items: flex-end; gap: 8px; margin-top: 18px; }
.znoten { font-size: 0.82em; margin-top: 18px; }
.zerg { text-align: center; font-style: italic; font-size: 0.85em; color: var(--text-2); margin: -6px 0 8px; }
.zwappen { text-align: center; font-weight: bold; font-size: 1.05em; }
.zbox { border: 1px solid var(--text); padding: 6px 8px; margin: 8px 0; min-height: 54px; }
.zbox-l { font-weight: bold; }
.zcheck { display: flex; gap: 8px; align-items: flex-start; margin: 12px 0; }
.zchk { flex: none; width: 13px; height: 13px; border: 1px solid var(--text); text-align: center; line-height: 12px; }

/* Zeugnisart-Auswahl in der Topbar */
.typsel { font: inherit; font-size: 12px; padding: 4px 8px; border: 0.5px solid var(--border-2); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); }

/* ===== Schulbericht (Kl. 1/2) — amtlicher A5-Quer-Vordruck, 2 Seiten =====
   Maße aus dem Originaldokument: A5 quer (210 × 148 mm), Rand oben 8 mm,
   links 20 mm, rechts 15 mm. Alle Innenmaße in cqw (Container-Query-Einheiten),
   sodass Text und Abstände in Vorschau (schmal), Vollbild und Druck identisch
   skalieren. 1 cqw = 1 % der Seitenbreite (= 2,1 mm bei 210 mm). */
.sb-doc { display: flex; flex-direction: column; gap: 14px; }
.sb-page {
  container-type: inline-size;
  width: 100%;
  aspect-ratio: 210 / 148;
  box-sizing: border-box;
  display: flex; flex-direction: column;
  padding: 3.8cqw 7.14cqw 3.8cqw 9.52cqw;   /* 8 / 15 / 8 / 20 mm */
  background: #fff; color: #1a1a1a;
  font-family: Arial, "Helvetica Neue", Helvetica, sans-serif;
  font-size: 1.7cqw; line-height: 1.32;
  box-shadow: var(--shadow-md); overflow: hidden;
}
.sb-land { font-family: Georgia, "Times New Roman", serif; font-size: 1.7cqw; }
.sb-school { font-weight: bold; margin-top: 0.4cqw; min-height: 1.4em; }
.sb-title { font-weight: bold; font-size: 3cqw; margin: 1.4cqw 0 1.4cqw; padding-top: 1.4cqw; border-top: 1px solid #1a1a1a; }
.sb-kv { display: flex; gap: 7cqw; margin: 0.5cqw 0; }
.sb-kv-name { flex: 1; display: flex; }
.sb-v { font-weight: bold; }
.sb-box { border: 1px solid #1a1a1a; padding: 1cqw 1.2cqw; margin-top: 1.4cqw; display: flex; flex-direction: column; min-height: 0; }
.sb-box-l { font-weight: bold; }
.sb-box-t { white-space: pre-wrap; flex: 1; overflow: hidden; margin-top: 0.4cqw; }
.sb-grow { flex: 1; }
.sb-grades { display: flex; gap: 7cqw; margin: 1.2cqw 0 0.4cqw; }
.sb-block { margin: 0.9cqw 0; }
.sb-bem { flex: none; }
.sb-l { font-weight: bold; }
.sb-t { white-space: pre-wrap; min-height: 1.3em; margin-top: 0.2cqw; }
.sb-datum { margin: 1.4cqw 0 0.6cqw; }
.sb-sign { display: flex; align-items: flex-end; gap: 2cqw; margin-top: auto; padding-top: 1.4cqw; }
.sb-sig { flex: 1; text-align: center; font-size: 1.5cqw; }
.sb-line { border-top: 1px solid #1a1a1a; margin-bottom: 0.5cqw; }
.sb-name { font-size: 1.5cqw; line-height: 1.2; margin-bottom: 0.4cqw; min-height: 1.1em; }
.sb-siegel { width: 16cqw; flex: none; text-align: center; font-size: 1.2cqw; color: #444;
  border: 1px dashed #888; border-radius: 50%; padding: 1.4cqw 0.4cqw; }
.sb-gesehen { display: flex; align-items: flex-end; gap: 1cqw; margin-top: 1.2cqw; }
.sb-gesehen .sb-line { flex: 1; margin-bottom: 0.3cqw; }
.sb-noten { font-size: 1.25cqw; margin-top: 1cqw; }
.sb-erg { font-weight: normal; font-style: italic; font-size: 1.5cqw; color: #555; }

/* Vollbild & Druck: echte A5-Quer-Blätter (210 × 148 mm) statt fluider Breite */
.preview-overlay-stage .preview-page.typ-schulbericht {
  width: auto; min-height: 0; padding: 0; background: transparent; box-shadow: none;
}
.preview-overlay-stage .preview-page.typ-schulbericht .sb-page { width: 210mm; }

/* ===== Klassen- & Schülerverwaltung (v0.3) ===== */
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-items: stretch; }
/* Eingabefelder am Zellenboden ausrichten, damit sie in einer Reihe auf
   gleicher Höhe stehen – auch wenn ein Label (z. B. „Klassenlehrer:in
   (Unterschrift)") in zwei Zeilen umbricht und das andere nicht. */
.form-row .fld { justify-content: flex-end; }
.form-row .fld > input, .form-row .fld > select { margin-top: auto; }
@media (max-width: 640px) { .form-row { grid-template-columns: 1fr; } }

.empty-state { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 48px 20px; color: var(--text-3); text-align: center; background: var(--surface); border: 1px dashed var(--border-2); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); }
.empty-state p { margin: 0; }

/* Klassen-Karten */
.cls-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; margin: 10px 0 4px; }
.cls-card { text-align: left; display: flex; flex-direction: column; gap: 4px; background: var(--surface); border: 0.5px solid var(--border); border-radius: var(--radius); padding: 12px 14px; cursor: pointer; box-shadow: var(--shadow-sm); transition: border-color .14s ease, box-shadow .14s ease, transform .12s ease; }
.cls-card:hover { border-color: var(--border-2); box-shadow: var(--shadow-md); transform: translateY(-2px); }
.cls-card.active { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent), var(--shadow-md); }
.cls-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.cls-name { font-weight: 600; font-size: 15px; }
.cls-meta { font-size: 12px; color: var(--text-2); display: flex; align-items: center; gap: 6px; }
.cls-actions { display: flex; gap: 6px; margin-top: 8px; }
button.danger { color: #b3261e; }
button.danger:hover { background: #fbe9e7; }
@media (prefers-color-scheme: dark) { button.danger { color: #f2b8b5; } button.danger:hover { background: #5c1d18; } }
.cls-card.add { align-items: center; justify-content: center; flex-direction: column; color: var(--text-2); border-style: dashed; min-height: 92px; }
.cls-card.add .ti { font-size: 22px; }
.cls-form { margin: 12px 0 6px; }
/* Abgesetzter Block für die Zeugnis-Kopfdaten (Klassenlehrer:in + Ausgabedatum) im Klassenformular. */
.cf-sub { margin-top: 14px; padding-top: 14px; border-top: 0.5px dashed var(--border); }
.cf-sub-label { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; letter-spacing: .02em; text-transform: uppercase; color: var(--text-2); margin-bottom: 10px; }
.cf-sub-label .ti { font-size: 15px; }
/* Inline-Textlink, der wie ein Verweis aussieht (z. B. „… unter Klassen pflegen"). */
.linklike { background: none; border: 0; padding: 0; margin: 0; font: inherit; color: var(--accent); cursor: pointer; text-decoration: underline; }
.linklike:hover { opacity: .8; }

/* Schülertabelle */
table.stud-table { border-collapse: collapse; width: 100%; font-size: 13px; }
table.stud-table th { background: var(--surface-2); font-weight: 500; text-align: left; padding: 6px 10px; border-bottom: 0.5px solid var(--border); }
table.stud-table td { padding: 4px 8px; border-bottom: 0.5px solid var(--border); }
table.stud-table td.num { color: var(--text-3); text-align: center; width: 34px; }
table.stud-table input[type="text"], table.stud-table select { width: 100%; height: 32px; padding: 2px 8px; border: 0.5px solid var(--border); border-radius: 6px; background: var(--surface); color: var(--text); }
.stud-tools { margin-top: 10px; }
textarea.bulk { width: 100%; min-height: 96px; resize: vertical; padding: 8px 10px; border: 0.5px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); font: inherit; margin-top: 6px; }
.hint code { background: var(--surface-2); padding: 1px 5px; border-radius: 4px; font-size: 12px; }

/* Speichern-Button im Topbar */
button[data-action="save"].dirty { color: var(--accent-text); border-color: var(--accent); }

/* Modal */
#modal-root { position: fixed; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center; }
.modal-back { position: absolute; inset: 0; background: rgba(0,0,0,.4); }
.modal { position: relative; background: var(--surface); border: 0.5px solid var(--border-2); border-radius: var(--radius-lg); padding: 20px 22px; width: min(420px, 92vw); box-shadow: var(--shadow-lg); }
.modal h3 { margin: 0 0 6px; font-size: 16px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.modal .fld input { height: 34px; padding: 4px 10px; border: 0.5px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.modal-err { color: #b3261e; font-size: 12px; min-height: 16px; margin-top: 8px; }

/* On-Device-KI: Umformulierungs-Modal */
@keyframes spin { to { transform: rotate(360deg); } }
.spin { display: inline-block; animation: spin 0.9s linear infinite; }
.modal-ki { width: min(620px, 94vw); }
.ki-loading { display: flex; align-items: center; gap: 10px; padding: 18px 4px; color: var(--text-2); font-size: 13px; }
.ki-loading .ti { font-size: 20px; color: var(--accent); }
.ki-block { margin-top: 12px; }
.ki-cap { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .03em; color: var(--text-3); margin-bottom: 5px; }
.ki-edit-hint { font-weight: 400; text-transform: none; letter-spacing: 0; color: var(--accent-text); }
.ki-text { font-size: 13px; line-height: 1.55; color: var(--text-2); background: var(--surface-2); border: 0.5px solid var(--border); border-radius: var(--radius-sm); padding: 9px 11px; max-height: 130px; overflow: auto; white-space: pre-wrap; }
.ki-sugg-ta { width: 100%; box-sizing: border-box; font: inherit; font-size: 13px; line-height: 1.55; color: var(--text); background: var(--surface); border: 0.5px solid var(--accent); border-radius: var(--radius-sm); padding: 9px 11px; resize: vertical; }
.ki-sugg-ta:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

/* On-Device-KI: Status der Verbindungsprüfung (Einstellungen) */
.ki-status { font-size: 12px; display: inline-flex; align-items: center; gap: 5px; color: var(--text-2); }
.ki-status .ti { font-size: 15px; }
.ki-status.ok { color: #1a7f37; }
.ki-status.err { color: #b3261e; }
.ki-status code { font-family: ui-monospace, monospace; font-size: 11px; background: var(--surface-2); padding: 1px 5px; border-radius: 4px; }

/* On-Device-KI: geführtes Setup (Einstellungen) */
.ki-setup:empty { display: none; }
.ki-setup { margin: 10px 0 4px; display: flex; flex-direction: column; gap: 8px; }
.ki-setup-row { display: flex; gap: 8px; font-size: 12.5px; line-height: 1.5; padding: 9px 11px; border-radius: var(--radius-sm); border: 0.5px solid var(--border-2); background: var(--surface-2); }
.ki-setup-row .ti { font-size: 17px; flex: none; margin-top: 1px; }
.ki-setup-row.ok { color: #1a7f37; border-color: rgba(26,127,55,.3); background: rgba(26,127,55,.07); }
.ki-setup-row.warn .ti { color: var(--accent); }
.ki-setup-row.err { color: #b3261e; border-color: rgba(179,38,30,.3); background: rgba(179,38,30,.06); }
.ki-setup-row.info { color: var(--text-2); }
.ki-setup-row code { font-family: ui-monospace, monospace; font-size: 11px; background: var(--surface); padding: 1px 5px; border-radius: 4px; }
.ki-setup-busy { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--text-2); }
.ki-setup-busy .ti { font-size: 18px; color: var(--accent); }
.ki-setup-msg { font-size: 11.5px; color: var(--text-3); margin-top: -2px; word-break: break-word; }
.ki-prog { height: 7px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.ki-prog-bar { height: 100%; background: var(--accent); border-radius: 99px; transition: width .25s ease; }
.ki-prog[data-indet="1"] .ki-prog-bar { width: 35% !important; animation: kiIndet 1.2s ease-in-out infinite; }
@keyframes kiIndet { 0% { margin-left: -35%; } 100% { margin-left: 100%; } }
.ki-advanced { margin-top: 8px; font-size: 12.5px; }
.ki-advanced > summary { cursor: pointer; color: var(--text-2); padding: 4px 0; }
.ki-advanced[open] > summary { margin-bottom: 6px; }

/* On-Device-KI: Entscheidungshilfe zur Modellwahl */
.ki-modelhelp { margin: 8px 0 4px; padding: 11px 13px; border-radius: var(--radius-sm); border: 0.5px solid var(--border-2); background: var(--surface-2); font-size: 12.5px; line-height: 1.5; color: var(--text-2); }
.ki-mh-title { display: flex; align-items: center; gap: 6px; font-weight: 600; color: var(--text); margin-bottom: 5px; }
.ki-mh-title .ti { font-size: 16px; color: var(--accent); }
.ki-mh-lead { margin: 0 0 6px; }
.ki-modelhelp ul { margin: 0 0 6px; padding-left: 18px; display: flex; flex-direction: column; gap: 4px; }
.ki-mh-foot { margin: 0; color: var(--text-3); font-size: 11.5px; }

/* Passwort-Stärke-Anzeige */
.pw-meter { margin-top: 8px; }
.pw-meter-bars { display: flex; gap: 5px; }
.pw-meter-bars span { flex: 1; height: 5px; border-radius: 999px; background: var(--surface-2); transition: background-color .15s ease; }
.pw-meter-label { font-size: 12px; margin-top: 5px; min-height: 15px; font-weight: 600; color: var(--text-2); }
.pw-meter.is-empty .pw-meter-label { font-weight: 400; }
/* Sehr schwach (rot) */
.pw-meter.lvl-0 .pw-meter-bars span:nth-child(-n+1) { background: #d93025; }
.pw-meter.lvl-0 .pw-meter-label { color: #d93025; }
/* Schwach (orange) */
.pw-meter.lvl-1 .pw-meter-bars span:nth-child(-n+2) { background: #e8710a; }
.pw-meter.lvl-1 .pw-meter-label { color: #e8710a; }
/* Mittel (gelb) */
.pw-meter.lvl-2 .pw-meter-bars span:nth-child(-n+3) { background: #e3b008; }
.pw-meter.lvl-2 .pw-meter-label { color: #b8890a; }
/* Stark (grün) */
.pw-meter.lvl-3 .pw-meter-bars span { background: #1e8e3e; }
.pw-meter.lvl-3 .pw-meter-label { color: #1e8e3e; }

/* Entsperr-Bildschirm */
.lock-screen { height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--bg); }
.lock-card { background: var(--surface); border: 0.5px solid var(--border); border-radius: var(--radius-lg); padding: 28px 30px; width: min(380px, 92vw); text-align: center; box-shadow: var(--shadow-lg); }
.lock-card .brand.big { font-size: 24px; font-weight: 600; font-family: var(--font-display); letter-spacing: -0.01em; display: flex; align-items: center; justify-content: center; gap: 10px; margin-bottom: 10px; }
.lock-card .brand.big .ti { width: 40px; height: 40px; font-size: 22px; }
.lock-card p { color: var(--text-2); font-size: 13px; }
.lock-card input { width: 100%; height: 38px; padding: 4px 12px; border: 0.5px solid var(--border-2); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); margin: 8px 0; }
.lock-err { color: #b3261e; font-size: 12px; margin: 4px 0 8px; display: flex; align-items: center; gap: 6px; justify-content: center; }
button.block { width: 100%; justify-content: center; height: 38px; }

/* Druck & Vorschau der amtlichen DOCX-Vordrucke (gerendert via docx-preview).
   docx-preview erzeugt einen .docx-wrapper mit „section.docx"-Seiten in der
   Originalgröße samt Original-Rändern aus der Vorlage — Vorschau, Druck und
   Word-Export stammen damit aus EINER Quelle. */
#print-root { display: none; }

/* Vorschau: grauen Wrapper-Hintergrund/Polster neutralisieren, jede Seite als
   schwebendes Blatt darstellen. Gilt für Inline-Vorschau und Vollbild. */
.preview-doc .docx-wrapper,
.preview-page .docx-wrapper { background: transparent; padding: 0; box-shadow: none; }
.preview-doc section.docx,
.preview-page section.docx { margin: 0 auto 12px; box-shadow: var(--shadow-md); background: #fff; }
.preview-doc section.docx:last-child,
.preview-page section.docx:last-child { margin-bottom: 0; }
/* Kompetenzzeugnis (weiterhin HTML) behält seinen eigenen Stil. */

/* Zeichenzähler unter Verbalfeldern — zeigt die Auslastung der festen
   Vordruck-Box; rot bei Überschreitung. */
.char-count { font-size: 11px; color: var(--text-3); text-align: right; margin-top: 2px; font-variant-numeric: tabular-nums; }
.char-count.over { color: #b3261e; font-weight: 600; }


/* Faltblatt-Modus (.falt): A4-quer gefaltetes Blatt — aufgeschlagen liegen die
   zwei A5-Hochseiten NEBENEINANDER (z. B. Schulbericht: links Verhalten+Arbeiten,
   rechts Lernen+Unterschriften). In Vollbild und Druck zwei Seiten in einer Reihe.
   Die Inline-Aside-Vorschau bleibt gestapelt (schmale Spalte, besser lesbar). */
.preview-page.falt .docx-wrapper,
#print-root .falt .docx-wrapper {
  display: flex; flex-direction: row; align-items: flex-start; justify-content: center; gap: 0;
}
.preview-page.falt section.docx,
#print-root .falt section.docx { flex: 0 0 auto; margin: 0 !important; }

/* Seitenformat aus der Vorlage (alle 1Plus-Vordrucke: A5, 148 × 210 mm). Ränder
   stecken in der Vorlage (section.docx-Polster), daher @page ohne eigenen Rand. */
@page { size: 148mm 210mm; margin: 0; }
/* Faltblatt: A4 quer (zwei A5-Hochseiten nebeneinander, ein Blatt). */
@page sbland { size: 297mm 210mm; margin: 0; }

@media print {
  body.printing #app { display: none !important; }
  body.printing #print-root { display: block; }
  /* Wrapper neutralisieren; jede Vorlagenseite füllt ein eigenes Blatt
     (Größe & Ränder kommen aus der section.docx = der amtlichen Vorlage). */
  #print-root .docx-wrapper { background: transparent; padding: 0; margin: 0; }
  #print-root section.docx {
    box-shadow: none !important; margin: 0 !important; background: #fff;
    break-after: page; page-break-after: always;
  }
  #print-root section.docx:last-child { break-after: auto; page-break-after: auto; }
  /* Seriendruck: nach jedem Zeugnis (Schüler:in) eine neue Seite beginnen — das
     letzte braucht keinen Umbruch. Greift nur bei mehreren .print-page (Batch);
     beim Einzeldruck gibt es genau eine, also ohne Wirkung. */
  #print-root .print-page { break-after: page; page-break-after: always; }
  #print-root .print-page:last-child { break-after: auto; page-break-after: auto; }
  /* Faltblatt: A4 quer, beide A5-Seiten auf EIN Blatt, kein Umbruch dazwischen. */
  #print-root .print-page.falt { page: sbland; }
  #print-root .falt section.docx { break-after: auto !important; page-break-after: auto !important; }
}

/* ===================================================================
   Kompetenzen: Ansichts-Umschalter (pro Schüler:in ↔ Klassensatz)
   =================================================================== */
.ank-modes { display: inline-flex; gap: 4px; padding: 4px; margin: 0 0 14px; background: var(--surface-2); border-radius: var(--radius); }
.ankmode-btn { display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; border: 0; background: transparent; color: var(--text-2); font: inherit; font-size: 13px; font-weight: 600; border-radius: var(--radius-sm); cursor: pointer; }
.ankmode-btn:hover { color: var(--text); }
.ankmode-btn.active { background: var(--surface); color: var(--accent-text); box-shadow: var(--shadow-sm); }
.page-title-sub { font-weight: 500; color: var(--text-3); font-size: .7em; }

/* ===================================================================
   Klassensatz-Matrix (Kompetenz × Schüler:innen)
   =================================================================== */
.amx-wrap { overflow: auto; overflow-x: auto; max-height: calc(100vh - 246px); border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-sm); scrollbar-width: thin; scrollbar-gutter: stable; }
/* Horizontale Scrollbar bei vielen Schüler:innen klar sichtbar (statt Overlay,
   das in mancher Engine versteckt bleibt) — unten am Tabellenrahmen. */
.amx-wrap::-webkit-scrollbar { height: 12px; width: 12px; }
.amx-wrap::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 6px; border: 3px solid var(--surface); }
.amx-wrap::-webkit-scrollbar-thumb:hover { background: var(--text-3); }
.amx-wrap::-webkit-scrollbar-track { background: transparent; }
table.amx { border-collapse: separate; border-spacing: 0; font-size: 12.5px; }
.amx th, .amx td { border-bottom: 1px solid var(--border); }
.amx thead th { position: sticky; top: 0; z-index: 3; background: var(--surface-2); color: var(--text-2); font-weight: 600; padding: 8px 6px; vertical-align: bottom; }
.amx-corner { position: sticky; left: 0; top: 0; z-index: 5 !important; text-align: left; padding-left: 14px !important; min-width: 280px; }
.amx-colhead { min-width: 46px; max-width: 64px; }
.amx-colhead span { display: block; max-width: 60px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.amx-grouprow th { position: sticky; left: 0; z-index: 2; background: var(--accent-soft); color: var(--accent-text); text-align: left; padding: 6px 12px; font-weight: 700; }
.amx-grouprow th i { margin-right: 6px; }
.amx-rowhead { position: sticky; left: 0; z-index: 1; background: var(--surface); text-align: left; padding: 6px 12px; min-width: 280px; max-width: 320px; vertical-align: middle; box-shadow: 1px 0 0 var(--border); }
.amx-rowlabel { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; color: var(--text); }
.amx-rowset { display: flex; align-items: center; gap: 3px; margin-top: 4px; }
.amx-set-lbl { font-size: 10.5px; color: var(--text-3); margin-right: 2px; }
.amx-set { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; padding: 0; border: 1px solid var(--border-2); background: var(--surface); color: var(--text-2); border-radius: 5px; font-size: 11px; font-weight: 700; line-height: 1; cursor: pointer; }
.amx-set:hover { border-color: var(--accent); color: var(--accent-text); }
.amx-set.clr { color: var(--text-3); }
.amx-set.lvl-1:hover { background: #d98324; color: #fff; border-color: #d98324; }
.amx-set.lvl-2:hover { background: #d9a91f; color: #2c2100; border-color: #d9a91f; }
.amx-set.lvl-3:hover { background: #4f9a55; color: #fff; border-color: #4f9a55; }
.amx-set.lvl-4:hover { background: #2f7d8a; color: #fff; border-color: #2f7d8a; }
.amx-cell { padding: 3px; text-align: center; vertical-align: middle; }
/* Die Ziffer sitzt in einem flex-zentrierten <span> (in JEDER Engine exakt
   mittig); der <select> liegt unsichtbar darüber und fängt nur den Klick fürs
   Dropdown ab — gleiche Technik wie die Pillen im Einzel-Raster und mit den
   GLEICHEN kräftigen Stufenfarben (einheitliches Bild). */
.amx-pick { position: relative; display: flex; align-items: center; justify-content: center; width: 44px; height: 34px; margin: 0 auto; border: 1px solid var(--border-2); border-radius: 6px; background: var(--surface); cursor: pointer; }
.amx-pick:focus-within { outline: 2px solid var(--accent); outline-offset: 1px; }
.amx-num { font-size: 14px; font-weight: 700; line-height: 1; pointer-events: none; }
.amx-sel { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; padding: 0; border: 0; background: transparent; opacity: 0; cursor: pointer; -webkit-appearance: none; appearance: none; }
.amx-pick.empty { border-style: dashed; }
.amx-pick.empty .amx-num { color: var(--text-3); font-weight: 600; }
.amx-pick.skip { background: var(--surface-2); border-color: var(--border); }
.amx-pick.skip .amx-num { color: var(--text-3); }
.amx-pick.lvl-1 { background: #d98324; border-color: #d98324; } .amx-pick.lvl-1 .amx-num { color: #fff; }
.amx-pick.lvl-2 { background: #d9a91f; border-color: #d9a91f; } .amx-pick.lvl-2 .amx-num { color: #2c2100; }
.amx-pick.lvl-3 { background: #4f9a55; border-color: #4f9a55; } .amx-pick.lvl-3 .amx-num { color: #fff; }
.amx-pick.lvl-4 { background: #2f7d8a; border-color: #2f7d8a; } .amx-pick.lvl-4 .amx-num { color: #fff; }

/* ===================================================================
   Prüfung vor dem Druck (Konsistenz-/Rechtssicherheits-Check)
   =================================================================== */
.chk-banner { display: flex; align-items: center; gap: 12px; padding: 12px 16px; margin: 16px 0 0; border-radius: var(--radius); cursor: pointer; border: 1px solid var(--border); background: var(--surface); box-shadow: var(--shadow-sm); transition: box-shadow .12s, transform .06s; }
.chk-banner:hover { box-shadow: var(--shadow-md); }
.chk-banner:active { transform: translateY(1px); }
.chk-banner > i { font-size: 22px; }
.chk-banner-txt { flex: 1; color: var(--text-2); }
.chk-banner-txt b { color: var(--text); }
.chk-banner-go { display: inline-flex; align-items: center; gap: 4px; font-weight: 600; font-size: 13px; color: var(--accent-text); white-space: nowrap; }
.chk-banner.crit { background: #fbe9e7; border-color: #f0c2bb; } .chk-banner.crit > i { color: #b3261e; }
.chk-banner.warn { background: var(--warn-bg); border-color: transparent; } .chk-banner.warn > i { color: var(--warn-text); }
.chk-banner.info { background: var(--accent-bg); border-color: transparent; } .chk-banner.info > i { color: var(--accent-text); }
.chk-banner.ok { background: var(--ok-bg); border-color: transparent; } .chk-banner.ok > i { color: var(--ok-text); } .chk-banner.ok .chk-banner-go { color: var(--ok-text); }
@media (prefers-color-scheme: dark) { .chk-banner.crit { background: #4a1a15; border-color: #6c2a22; } .chk-banner.crit > i { color: #f2b8b5; } }

.chk-metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 4px 0 18px; }
.chk-metric { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 16px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-sm); }
.chk-metric i { font-size: 22px; margin-bottom: 2px; }
.chk-metric-val { font-family: var(--font-display); font-size: 28px; font-weight: 600; line-height: 1; }
.chk-metric-lbl { font-size: 12px; color: var(--text-3); font-weight: 600; }
.chk-metric.crit i, .chk-metric.crit .chk-metric-val { color: #b3261e; }
.chk-metric.warn i, .chk-metric.warn .chk-metric-val { color: var(--warn-text); }
.chk-metric.info i, .chk-metric.info .chk-metric-val { color: var(--accent-text); }
@media (prefers-color-scheme: dark) { .chk-metric.crit i, .chk-metric.crit .chk-metric-val { color: #f2b8b5; } }

.chk-allgood { display: flex; align-items: center; gap: 14px; padding: 22px; border-radius: var(--radius); background: var(--ok-bg); color: var(--ok-text); }
.chk-allgood > i { font-size: 30px; }
.chk-allgood b { font-size: 15px; }

.chk-list { display: flex; flex-direction: column; gap: 8px; }
.chk-item { display: flex; align-items: flex-start; gap: 12px; padding: 12px 14px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--border-2); box-shadow: var(--shadow-sm); }
.chk-item.crit { border-left-color: #b3261e; }
.chk-item.warn { border-left-color: var(--warn-text); }
.chk-item.info { border-left-color: var(--accent); }
.chk-ic { font-size: 18px; margin-top: 1px; }
.chk-item.crit .chk-ic { color: #b3261e; }
.chk-item.warn .chk-ic { color: var(--warn-text); }
.chk-item.info .chk-ic { color: var(--accent-text); }
.chk-body { flex: 1; min-width: 0; }
.chk-line { display: flex; align-items: center; gap: 8px; margin-bottom: 2px; }
.chk-who { font-weight: 600; color: var(--text); font-size: 13px; }
.chk-who.klassenweit { color: var(--text-2); display: inline-flex; align-items: center; gap: 4px; }
.chk-cat { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .03em; color: var(--text-3); background: var(--surface-2); border-radius: 9px; padding: 1px 8px; }
.chk-title { font-weight: 600; color: var(--text); }
.chk-detail { font-size: 12.5px; color: var(--text-2); line-height: 1.45; margin-top: 1px; }
.chk-jump { flex-shrink: 0; align-self: center; display: inline-flex; align-items: center; gap: 4px; padding: 7px 12px; border: 1px solid var(--border-2); background: var(--surface); color: var(--text-2); border-radius: var(--radius-sm); font: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.chk-jump:hover { border-color: var(--accent); color: var(--accent-text); }
@media (prefers-color-scheme: dark) { .chk-item.crit .chk-ic, .chk-item.crit { border-left-color: #f2b8b5; } .chk-item.crit .chk-ic { color: #f2b8b5; } }

/* ===================================================================
   Lernstands-Analyse
   =================================================================== */
.an-disclaimer { display: flex; align-items: flex-start; gap: 12px; padding: 12px 14px; margin-bottom: 16px; border-radius: var(--radius); background: var(--accent-soft); border: 0.5px solid var(--border); color: var(--text-2); font-size: 12.5px; line-height: 1.5; }
.an-disclaimer > i { font-size: 20px; color: var(--accent); margin-top: 1px; flex-shrink: 0; }
.an-disclaimer b { color: var(--text); }

.an-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); gap: 14px; align-items: stretch; }
@media (max-width: 900px) { .an-grid { grid-template-columns: 1fr; } }

.an-kindnav { display: flex; align-items: center; justify-content: center; gap: 12px; margin-bottom: 12px; }
.an-kindnav-pos { font-size: 13px; font-weight: 600; color: var(--text-2); min-width: 96px; text-align: center; }

.an-legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 11.5px; color: var(--text-2); margin-bottom: 10px; }
.an-legend span { display: inline-flex; align-items: center; gap: 5px; }
.an-dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.an-dot-niedrig { background: var(--accent-2); }
.an-dot-mittel { background: #d98324; }
.an-dot-hoch { background: #c0392b; }

.an-ranklist { display: flex; flex-direction: column; gap: 4px; }
.an-rank { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: var(--radius-sm); cursor: pointer; border: 1px solid transparent; transition: background .12s ease, border-color .12s ease; }
.an-rank:hover { background: var(--surface-2); }
.an-rank.active { background: var(--accent-soft); border-color: var(--accent); }
.an-rank-no { width: 18px; text-align: center; font-size: 12px; color: var(--text-3); font-weight: 600; flex-shrink: 0; }
.an-rank-name { flex: 1; min-width: 0; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; align-items: center; gap: 6px; }
.an-rank-track { width: 80px; height: 6px; background: var(--surface-2); border-radius: 3px; overflow: hidden; flex-shrink: 0; }
.an-rank-fill { height: 100%; border-radius: 3px; }
.an-rank-val { width: 30px; text-align: right; font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; flex-shrink: 0; }
.an-flag { color: #d98324; display: inline-flex; }
.an-hint { font-size: 11.5px; color: var(--text-3); margin-top: 10px; display: flex; align-items: center; gap: 5px; }
.an-empty, .an-muted { color: var(--text-3); font-size: 12.5px; }

/* Detail-Profil */
.an-detail-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.an-detail-id { flex: 1; min-width: 0; }
.an-detail-name { font-weight: 600; font-size: 16px; font-family: var(--font-display); letter-spacing: -0.01em; }
.an-detail-sub { font-size: 12.5px; color: var(--text-2); }
.an-detail .ghost.mini { flex-shrink: 0; }

.an-index { margin-bottom: 14px; }
.an-index-bar { height: 8px; background: var(--surface-2); border-radius: 4px; overflow: hidden; }
.an-index-fill { height: 100%; border-radius: 4px; transition: width .3s ease; }
.an-index-lab { font-size: 11.5px; color: var(--text-2); margin-top: 5px; }

/* Cockpit (Einzelkind): KPI-Kacheln + Kernaussage, immer sichtbar über den Tabs */
.an-cockpit { margin-bottom: 14px; }
.an-kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.an-kpi { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px; min-width: 0; }
.an-kpi-val { font-family: var(--font-display); font-size: 20px; font-weight: 600; letter-spacing: -0.01em; line-height: 1.15; }
.an-kpi-unit { font-size: 12px; font-weight: 500; color: var(--text-3); margin-left: 1px; }
.an-kpi-lab { font-size: 11px; color: var(--text-3); margin-top: 3px; }
.an-kpi-status { font-size: 14px; display: inline-flex; align-items: center; gap: 7px; }
.an-kpi-status .an-dot { width: 8px; height: 8px; }
.an-kpi-bar { height: 5px; background: var(--surface); border: 1px solid var(--border); border-radius: 3px; overflow: hidden; margin: 6px 0 2px; }
.an-kpi-bar-fill { height: 100%; border-radius: 3px; transition: width .3s ease; }
.an-kernaussage { display: flex; align-items: flex-start; gap: 9px; margin-top: 10px; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--accent-soft); font-size: 13px; line-height: 1.5; color: var(--text); }
.an-kernaussage > i { color: var(--accent); font-size: 17px; margin-top: 1px; flex-shrink: 0; }
.an-kernaussage b { font-weight: 600; }

/* Interne Reiter im Einzelkind-Profil + Panel */
.an-subtabs { display: flex; flex-wrap: wrap; width: 100%; margin: 0 0 14px; }
.an-subtabs .ankmode-btn { flex: 1 1 auto; justify-content: center; }
.an-kindpanel > .an-block:last-child, .an-kindpanel > .an-rec:last-child { margin-bottom: 0; }
.an-tab-empty { display: flex; align-items: center; gap: 8px; padding: 18px 14px; color: var(--text-3); font-size: 12.5px; background: var(--surface-2); border-radius: var(--radius-sm); }
.an-tab-empty .ti { font-size: 17px; }

/* Zwei-Spalten-Grid (Stärken / Entwicklungsfelder nebeneinander) */
.an-2col { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; margin-bottom: 16px; }
.an-2col > .an-block { margin-bottom: 0; }
@media (max-width: 620px) { .an-kpis { grid-template-columns: 1fr; } .an-2col { grid-template-columns: 1fr; } }

/* Aktionsleisten (Steckbrief/Empfehlungen, Beobachtungsbogen) — als klar
   erkennbare Buttons mit Fläche, abgesetzt durch eine feine Trennlinie. */
.ap-detail-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border); }
.ap-detail-actions button { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px 14px; font-size: 12.5px; font-weight: 500; color: var(--text); box-shadow: none; }
.ap-detail-actions button .ti { font-size: 15px; color: var(--accent); }
.ap-detail-actions button:hover { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 35%, transparent); color: var(--accent-text); }
.ap-detail-actions button[disabled] { opacity: .45; cursor: not-allowed; }
.ap-detail-actions button[disabled]:hover { background: var(--surface-2); border-color: var(--border); color: var(--text); }
.ap-detail-actions button.danger { margin-left: auto; }
.ap-detail-actions button.danger .ti { color: #b3261e; }
.ap-detail-actions button.danger:hover { background: color-mix(in srgb, #b3261e 10%, transparent); border-color: #e6b4ae; color: #b3261e; }

/* Gruppierte Eltern-Tipps: Zwischenüberschrift je Kategorie statt flacher Liste */
.an-tipgroups { display: flex; flex-direction: column; gap: 16px; }
.an-tipgroup-h { display: flex; align-items: center; gap: 7px; font-size: 11.5px; font-weight: 700; letter-spacing: .03em; text-transform: uppercase; color: var(--text-2); margin-bottom: 8px; padding-bottom: 5px; border-bottom: 1px solid var(--border); }
.an-tipgroup-h i { font-size: 15px; color: var(--text-3); }
.an-tipgroup-n { margin-left: auto; font-size: 11px; font-weight: 600; letter-spacing: 0; text-transform: none; background: var(--surface-2); color: var(--text-3); border-radius: 9px; padding: 1px 8px; }
.an-tipgroup.lg-stark .an-tipgroup-h i { color: var(--accent-2); }
.an-tipgroup.lg-wachstum .an-tipgroup-h i { color: #d98324; }
.an-tipgroup.lg-verhalten .an-tipgroup-h i { color: #8b5cf6; }
.an-tipgroup.lg-potenzial .an-tipgroup-h i { color: var(--accent); }
.an-tipgroup.lg-support .an-tipgroup-h i { color: #0e7490; }
.an-tipgroup.lg-rahmen .an-tipgroup-h i { color: var(--accent); }
@media (prefers-color-scheme: dark) { .an-tipgroup.lg-support .an-tipgroup-h i { color: #38bdf8; } }

.an-block { margin-bottom: 12px; }
.an-block-t { font-size: 12px; font-weight: 600; color: var(--text-2); display: flex; align-items: center; gap: 6px; margin-bottom: 7px; }
.an-block-t .ti { color: var(--accent); }
.an-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.an-chip { font-size: 12px; padding: 3px 9px; border-radius: var(--radius-sm); border: 1px solid color-mix(in srgb, var(--c) 40%, transparent); background: color-mix(in srgb, var(--c) 12%, transparent); color: var(--text); }
.an-chip b { color: var(--c); }

.an-pot { display: flex; align-items: flex-start; gap: 9px; padding: 9px 11px; border-radius: var(--radius-sm); background: var(--accent-soft); font-size: 12.5px; line-height: 1.45; margin-bottom: 12px; }
.an-pot > i { color: var(--accent); font-size: 17px; margin-top: 1px; flex-shrink: 0; }
.an-pot.ok { background: var(--ok-bg); }
.an-pot.ok > i { color: var(--ok-text); }

.an-meta { display: flex; flex-wrap: wrap; gap: 16px; margin-bottom: 12px; }
.an-meta-item { display: flex; flex-direction: column; }
.an-meta-k { font-size: 11px; color: var(--text-3); }
.an-meta-v { font-size: 13px; font-weight: 600; }

.an-rec { display: flex; align-items: flex-start; gap: 10px; padding: 11px 13px; border-radius: var(--radius); margin-bottom: 14px; }
.an-rec > i { font-size: 19px; margin-top: 1px; flex-shrink: 0; }
.an-rec.warn { background: var(--warn-bg); color: var(--warn-text); }
.an-rec.ok { background: var(--ok-bg); color: var(--ok-text); }
.an-rec b { font-size: 13.5px; }
.an-rec-sub { font-size: 12px; line-height: 1.45; margin-top: 2px; opacity: .92; }

/* Legende über den Tipps: Farbe + Symbol je Empfehlungsart (Icon-Farben = an-tip-*) */
.an-tip-legend { list-style: none; margin: 0 0 11px; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 14px; }
.an-tip-legend li { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; line-height: 1.3; color: var(--text-2); }
.an-tip-legend i { font-size: 14px; flex-shrink: 0; }
.an-tip-legend .lg-stark i { color: var(--accent-2); }
.an-tip-legend .lg-wachstum i { color: #d98324; }
.an-tip-legend .lg-verhalten i { color: #8b5cf6; }
.an-tip-legend .lg-potenzial i { color: var(--accent); }
.an-tip-legend .lg-support i { color: #0e7490; }
.an-tip-legend .lg-rahmen i { color: var(--accent); }
@media (prefers-color-scheme: dark) { .an-tip-legend .lg-support i { color: #38bdf8; } }

.an-tips { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.an-tip { display: flex; align-items: flex-start; gap: 9px; font-size: 12.5px; line-height: 1.5; color: var(--text); padding: 8px 10px; border-radius: var(--radius-sm); background: var(--surface-2); border-left: 3px solid var(--accent); }
.an-tip > i { font-size: 16px; margin-top: 1px; flex-shrink: 0; color: var(--accent); }
.an-tip-stark { border-left-color: var(--accent-2); } .an-tip-stark > i { color: var(--accent-2); }
.an-tip-wachstum { border-left-color: #d98324; } .an-tip-wachstum > i { color: #d98324; }
.an-tip-potenzial { border-left-color: var(--accent); }
.an-tip-verhalten { border-left-color: #8b5cf6; } .an-tip-verhalten > i { color: #8b5cf6; }
.an-tip-rahmen { border-left-color: var(--accent); background: var(--accent-soft); font-style: italic; }
.an-tip-support { border-left-color: #0e7490; background: rgba(14, 116, 144, 0.08); } .an-tip-support > i { color: #0e7490; }
@media (prefers-color-scheme: dark) { .an-tip-support { border-left-color: #38bdf8; background: rgba(56, 189, 248, 0.10); } .an-tip-support > i { color: #38bdf8; } }
.an-tip-body { flex: 1; min-width: 0; }
/* Konkrete „so geht's"-Beispiele als kleine Chips unter dem Tipp */
.an-tip-ex { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 7px; }
.an-tip-ex span { font-size: 11px; line-height: 1.3; background: var(--surface); border: 0.5px solid var(--border-2); border-radius: 999px; padding: 2px 9px; color: var(--text-2); }
.an-tip-ex span::before { content: "↳ "; color: var(--text-3); }

/* Fächer-Balken */
.an-subbars { display: flex; flex-direction: column; gap: 9px; }
.an-sub-row { display: flex; align-items: center; gap: 10px; }
.an-sub-name { width: 64px; font-size: 12.5px; color: var(--text-2); flex-shrink: 0; }
.an-sub-track { flex: 1; min-width: 48px; height: 9px; background: var(--surface-2); border-radius: 5px; overflow: hidden; }
.an-sub-fill { height: 100%; border-radius: 5px; transition: width .3s ease; }
.an-sub-val { width: 40px; text-align: right; font-size: 12.5px; font-weight: 600; font-variant-numeric: tabular-nums; flex-shrink: 0; }
/* Kompetenz-/Verhaltens-Balken: längere Bereichslabels brauchen mehr Platz und
   dürfen umbrechen, damit sie nicht vom Balken überdeckt werden. */
.an-kbars .an-sub-name { width: 150px; white-space: normal; line-height: 1.25; overflow-wrap: anywhere; hyphens: auto; }
@media (max-width: 1100px) { .an-kbars .an-sub-name { width: 120px; } }
/* Beobachtungsprofil: Wertspalte zeigt Wörter ("teilweise auffällig"), nicht nur
   Zahlen — daher breiter und umbrechend, damit der Text nicht über den Rand läuft. */
.beob-block .an-sub-val { width: 96px; white-space: normal; line-height: 1.2; overflow-wrap: anywhere; }

/* Notenspiegel */
.an-spiegel { display: flex; align-items: flex-end; gap: 10px; height: 130px; padding: 4px 4px 0; }
.an-spiegel-col { flex: 1; display: flex; flex-direction: column; align-items: center; height: 100%; justify-content: flex-end; gap: 4px; }
.an-spiegel-bar-wrap { flex: 1; width: 100%; display: flex; align-items: flex-end; justify-content: center; }
.an-spiegel-bar { width: 70%; min-height: 2px; border-radius: 4px 4px 0 0; transition: height .3s ease; }
.an-spiegel-n { font-size: 13px; font-weight: 700; }
.an-spiegel-c { font-size: 11px; color: var(--text-3); }
.an-spiegel-cap { font-size: 11.5px; color: var(--text-3); margin-top: 8px; }
/* Kennzahlen unter dem Notenspiegel — füllen die Karte und fassen die Verteilung zusammen */
.an-spiegel-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 14px; padding-top: 14px; border-top: 0.5px solid var(--border); }
.an-sstat { display: flex; flex-direction: column; gap: 3px; background: var(--surface-2); border-radius: var(--radius-sm); padding: 9px 11px; }
.an-sstat-k { font-size: 11px; color: var(--text-3); }
.an-sstat-v { font-size: 17px; font-weight: 700; color: var(--text); font-family: var(--font-display); letter-spacing: -0.01em; font-variant-numeric: tabular-nums; }

.an-insights { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 9px; }
.an-insights li { display: flex; align-items: flex-start; gap: 9px; font-size: 13px; line-height: 1.5; color: var(--text-2); }
.an-insights li .ti { color: var(--accent); font-size: 17px; margin-top: 1px; flex-shrink: 0; }
.an-insights b { color: var(--text); }

/* ===================================================================
   Klassenbuch
   =================================================================== */
.kb-muted { color: var(--text-3); font-weight: 400; font-size: .92em; }

/* Erfassungs-Formular */
.kb-form-top { display: flex; gap: 16px; flex-wrap: wrap; align-items: flex-start; margin-bottom: 12px; }
.kb-fld { display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; font-weight: 600; color: var(--text-2); margin-bottom: 12px; }
.kb-fld input[type="date"], .kb-fld textarea { font: inherit; font-weight: 400; padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); }
.kb-fld textarea { resize: vertical; min-height: 38px; }
.kb-fld-date { min-width: 150px; }
.kb-fld-who { flex: 1; min-width: 240px; }
.kb-who { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.kb-who-sep { width: 1px; align-self: stretch; background: var(--border); margin: 0 2px; }
.kb-chip { font: inherit; font-size: 12.5px; font-weight: 500; padding: 5px 11px; border: 1px solid var(--border); background: var(--surface); color: var(--text-2); border-radius: 999px; cursor: pointer; display: inline-flex; align-items: center; gap: 5px; }
.kb-chip:hover { border-color: var(--accent); color: var(--text); }
.kb-chip.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.kb-chip.active .ti { color: #fff; }
.kb-chip-all { font-weight: 600; }

/* Kategorie-Auswahl */
.kb-catpicker { font-weight: 400; display: flex; flex-direction: column; gap: 10px; margin-top: 2px; }
.kb-catgroup-t { font-size: 11.5px; font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: .03em; margin-bottom: 5px; display: flex; align-items: center; gap: 5px; }
.kb-catbtns { display: flex; flex-wrap: wrap; gap: 6px; }
.kb-catbtn { font: inherit; font-size: 12.5px; padding: 6px 11px; border: 1px solid var(--border); background: var(--surface); color: var(--text-2); border-radius: var(--radius-sm); cursor: pointer; display: inline-flex; align-items: center; gap: 6px; border-left-width: 3px; transition: opacity .18s ease, filter .18s ease, background .12s ease; }
.kb-catbtn .ti { font-size: 15px; }
/* Suche: nicht passende Kategorien ausgrauen, leere Gruppen ausblenden */
.kb-catsearch { margin: 2px 0 10px; }
.kb-catsearch input { font-weight: 400; }
.kb-catbtn.dimmed { opacity: .32; filter: grayscale(0.7); }
.kb-catbtn.dimmed:hover { opacity: .6; }
.kb-catgroup-empty { display: none; }
.kb-catnone { display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--text-3); padding: 6px 2px; }
.kb-catnone[hidden] { display: none; }
.kb-catbtn:hover { color: var(--text); border-color: var(--text-3); }
.kb-v-neg { border-left-color: #c0392b; } .kb-v-neg .ti { color: #c0392b; }
.kb-v-massnahme { border-left-color: #6741d9; } .kb-v-massnahme .ti { color: #6741d9; }
.kb-v-pos { border-left-color: var(--accent-2); } .kb-v-pos .ti { color: var(--accent-2); }
.kb-v-neutral { border-left-color: var(--text-3); } .kb-v-neutral .ti { color: var(--text-3); }
.kb-catbtn.active { color: #fff; border-color: transparent; }
.kb-catbtn.kb-v-neg.active { background: #c0392b; } .kb-catbtn.kb-v-massnahme.active { background: #6741d9; }
.kb-catbtn.kb-v-pos.active { background: var(--accent-2); } .kb-catbtn.kb-v-neutral.active { background: var(--text-2); }
.kb-catbtn.active .ti { color: #fff; }

.kb-excused { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-2); margin-bottom: 12px; cursor: pointer; }
.kb-form-actions { display: flex; gap: 10px; }
.kb-form-editing { box-shadow: 0 0 0 2px var(--accent); }
.kb-listcard .card-title { display: flex; align-items: center; gap: 8px; }
.kb-export-btn { margin-left: auto; }
.kb-entry.editing { background: var(--accent-soft); border-radius: var(--radius-sm); }

/* Liste / Zeitachse */
.kb-filterbar { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.kb-filterbar select { font: inherit; padding: 6px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); }
.kb-vfilters { display: inline-flex; gap: 4px; padding: 3px; background: var(--surface-2); border-radius: var(--radius-sm); }
.kb-vfilter { font: inherit; font-size: 12.5px; font-weight: 600; padding: 5px 11px; border: 0; background: transparent; color: var(--text-2); border-radius: var(--radius-sm); cursor: pointer; }
.kb-vfilter:hover { color: var(--text); }
.kb-vfilter.active { background: var(--surface); color: var(--accent-text); box-shadow: var(--shadow-sm); }
.kb-list { display: flex; flex-direction: column; }
.kb-entry { display: flex; gap: 12px; align-items: flex-start; padding: 11px 4px 11px 12px; border-bottom: 1px solid var(--border-2); border-left: 3px solid var(--c, var(--border)); }
.kb-entry:last-child { border-bottom: 0; }
.kb-entry-date { width: 64px; flex-shrink: 0; font-size: 12px; font-weight: 600; color: var(--text-3); font-variant-numeric: tabular-nums; padding-top: 1px; }
.kb-entry-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.kb-entry-cat { font-size: 13.5px; font-weight: 600; color: var(--text); display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.kb-entry-cat .ti { color: var(--c); font-size: 16px; }
.kb-entry-who { display: flex; flex-wrap: wrap; gap: 5px; }
.kb-who-tag { font-size: 11.5px; color: var(--text-2); background: var(--surface-2); border-radius: 999px; padding: 1px 9px; display: inline-flex; align-items: center; gap: 4px; }
.kb-entry-note { font-size: 12.5px; color: var(--text-2); line-height: 1.45; }
.kb-entry-actions { flex-shrink: 0; }
.kb-badge { font-size: 10.5px; font-weight: 600; padding: 1px 8px; border-radius: 999px; }
.kb-badge-ok { background: color-mix(in srgb, var(--accent-2) 16%, transparent); color: var(--accent-2); }
.kb-badge-warn { background: color-mix(in srgb, #c0392b 14%, transparent); color: #c0392b; }
.kb-confirm { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-2); }

/* Auffälligkeiten im Dashboard */
.kb-alert-list { display: flex; flex-direction: column; gap: 4px; }
.kb-alert-row { display: flex; gap: 10px; align-items: center; padding: 8px; border-radius: var(--radius-sm); cursor: pointer; }
.kb-alert-row:hover { background: var(--surface-2); }
.kb-alert-name { font-size: 13px; font-weight: 600; color: var(--text); width: 120px; flex-shrink: 0; }
.kb-alert-tags { display: flex; flex-wrap: wrap; gap: 5px; }
.kb-alert-tag { font-size: 11.5px; color: #c0392b; background: color-mix(in srgb, #c0392b 10%, transparent); border-radius: 999px; padding: 2px 9px; display: inline-flex; align-items: center; gap: 5px; }
.kb-alert-tag.severe { background: color-mix(in srgb, #c0392b 20%, transparent); font-weight: 600; }
.kb-alert-tag.block { display: flex; border-radius: var(--radius-sm); padding: 6px 10px; line-height: 1.35; }
.kb-alert-tot { color: var(--text-3); }
.kb-good { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-2); }
.kb-good .ti { color: var(--accent-2); font-size: 18px; }

/* Detail-Block (Einzelkind) */
.kb-detail-alerts { display: flex; flex-direction: column; gap: 5px; margin-bottom: 9px; }
.kb-counts { display: flex; flex-wrap: wrap; gap: 6px; }
.kb-count { font-size: 12px; color: var(--text-2); background: var(--surface-2); border-radius: var(--radius-sm); padding: 4px 9px; display: inline-flex; align-items: center; gap: 6px; border-left: 3px solid var(--c, var(--border)); }
.kb-count .ti { color: var(--c); font-size: 14px; }
.kb-count b { color: var(--text); }
.kb-mini-timeline { list-style: none; margin: 9px 0 0; padding: 0; display: flex; flex-direction: column; gap: 5px; }
.kb-mini-timeline li { font-size: 12px; color: var(--text-2); line-height: 1.4; }
.kb-mini-date { color: var(--text-3); font-variant-numeric: tabular-nums; font-weight: 600; }

/* Einstellungen: Schwellen */
.kb-th-title { font-size: 12.5px; font-weight: 600; color: var(--text-2); margin: 6px 0 8px; }
.kb-th-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 6px 16px; }
.kb-th-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 12.5px; color: var(--text-2); }
.kb-th-row span { display: inline-flex; align-items: center; gap: 6px; min-width: 0; }
.kb-th-row span { overflow-wrap: anywhere; }
.kb-th-row .ti { color: var(--text-3); font-size: 15px; }
.kb-th-row input { width: 58px; font: inherit; padding: 5px 8px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); text-align: center; }

/* ===================================================================
   Datenschutz & Sicherheit (Einstellungen)
   =================================================================== */
.sec-status { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: var(--radius-sm); font-size: 12.5px; line-height: 1.5; margin-bottom: 12px; }
.sec-status .ti { font-size: 20px; flex-shrink: 0; margin-top: 1px; }
.sec-status.ok { background: var(--accent-2-bg); color: var(--accent-2-text); }
.sec-status.ok .ti { color: var(--accent-2); }
.sec-status.warn { background: color-mix(in srgb, #d98324 14%, transparent); color: #9a5a12; }
.sec-status.warn .ti { color: #d98324; }
.sec-status b { color: inherit; }
.sec-points { list-style: none; margin: 0 0 14px; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.sec-points li { display: flex; gap: 9px; align-items: flex-start; font-size: 12.5px; line-height: 1.45; color: var(--text-2); }
.sec-points li .ti { color: var(--accent); font-size: 16px; flex-shrink: 0; margin-top: 1px; }
.sec-points b { color: var(--text); }
.sec-lock { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; margin-bottom: 8px; }
.sec-min { flex-direction: row; align-items: center; gap: 8px; }
.sec-min input { width: 64px; text-align: center; }
.sec-min.is-off { opacity: .5; }
.sec-lock-now { margin-left: auto; }

/* ===================================================================
   Persönliche Bausteinbibliothek (in den Formulierungshilfen)
   =================================================================== */
.up-box { margin-bottom: 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); padding: 6px 10px; }
.up-box > summary { cursor: pointer; font-weight: 600; font-size: 13px; color: var(--text-2); display: flex; align-items: center; gap: 6px; list-style: none; }
.up-box > summary::-webkit-details-marker { display: none; }
.up-count { margin-left: auto; font-size: 11px; font-weight: 600; background: var(--accent-bg); color: var(--accent-text); border-radius: 9px; padding: 1px 7px; }
.up-list { display: flex; flex-direction: column; gap: 4px; margin: 8px 0; }
.up-item { display: flex; align-items: stretch; gap: 4px; }
.up-ins { flex: 1; text-align: left; padding: 6px 9px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); font: inherit; font-size: 12.5px; cursor: pointer; line-height: 1.35; }
.up-ins:hover { border-color: var(--accent); background: var(--accent-soft); }
.up-del { flex: none; width: 30px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); color: var(--text-3); cursor: pointer; }
.up-del:hover { color: #b3261e; border-color: #e6b4ae; }
.up-empty { font-size: 12px; color: var(--text-3); padding: 4px 2px; }
.up-add { display: flex; gap: 4px; }
.up-add input { flex: 1; padding: 6px 9px; border: 1px solid var(--border-2); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); font: inherit; font-size: 12.5px; }
.up-addbtn { flex: none; width: 32px; border: 1px solid var(--accent); border-radius: var(--radius-sm); background: var(--accent-soft); color: var(--accent-text); cursor: pointer; font-size: 16px; }
.up-fromsel { margin-top: 6px; width: 100%; padding: 6px; border: 1px dashed var(--border-2); border-radius: var(--radius-sm); background: transparent; color: var(--text-2); font: inherit; font-size: 12px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.up-fromsel:hover { border-color: var(--accent); color: var(--accent-text); }

/* ===================================================================
   Kind-Version (Eltern-/Kind-Übersicht) + Druck
   =================================================================== */
.kv-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 6px; }
.kv-who { font-weight: 600; color: var(--text-2); font-size: 13px; }
.kv-stage { margin-top: 12px; display: flex; justify-content: center; }
.kv-card { width: 100%; max-width: 720px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); padding: 26px 30px; }
.kv-head { text-align: center; border-bottom: 2px dashed var(--border-2); padding-bottom: 14px; margin-bottom: 16px; }
.kv-title { font-family: var(--font-display); font-size: 26px; font-weight: 600; color: var(--accent-text); display: inline-flex; align-items: center; gap: 8px; }
.kv-title-star { color: #f2b705; }
.kv-name { font-size: 20px; font-weight: 600; margin-top: 6px; color: var(--text); }
.kv-sub { font-size: 13px; color: var(--text-3); margin-top: 2px; }
.kv-subj { margin-bottom: 16px; }
.kv-subj-h { font-weight: 700; color: var(--accent-text); display: flex; align-items: center; gap: 7px; padding-bottom: 5px; margin-bottom: 6px; border-bottom: 1px solid var(--border); }
.kv-row { display: flex; align-items: center; gap: 12px; padding: 5px 2px; }
.kv-komp { flex: 1; font-size: 14px; color: var(--text); }
.kv-stars { white-space: nowrap; font-size: 18px; line-height: 1; letter-spacing: 1px; }
.kv-star { color: #e2e0d2; }
.kv-star.on { color: #f2b705; }
.kv-legend { margin-top: 18px; padding-top: 12px; border-top: 1px dashed var(--border-2); }
.kv-leg-title { font-size: 12.5px; font-weight: 600; color: var(--text-2); margin-bottom: 8px; }
.kv-leg-rows { display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: auto auto; grid-auto-flow: column; gap: 6px 22px; }
.kv-leg-row { display: flex; align-items: center; gap: 9px; font-size: 12.5px; color: var(--text-2); }
.kv-leg-row .kv-stars { font-size: 15px; }
.kv-leg-txt b { color: var(--text); font-weight: 600; }
.kv-empty { text-align: center; color: var(--text-3); padding: 24px; }
@media print { @page kvpage { size: A4 portrait; margin: 16mm; } #print-root .kv-print { page: kvpage; } }
#print-root .kv-print .kv-card { border: 0; box-shadow: none; max-width: none; }

/* ===================================================================
   Zeugnis-Versionierung (Snapshots)
   =================================================================== */
.snap-list { display: flex; flex-direction: column; gap: 6px; margin: 8px 0; }
.snap-row { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); }
.snap-info { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.snap-label { font-weight: 600; color: var(--text); }
.snap-meta { font-size: 12px; color: var(--text-3); }
.snap-actions { display: flex; gap: 4px; flex: none; }

/* ===================================================================
   Fachlehrer-Austausch
   =================================================================== */
.fl-row { display: flex; align-items: flex-end; gap: 10px; flex-wrap: wrap; }
.fl-row .fld { min-width: 200px; }
.fl-row .fld select { width: 100%; }

/* ===================================================================
   Analyse-Plus (analyse-plus.js)
   =================================================================== */
.ap-lead { font-size: 12.5px; color: var(--text-2); line-height: 1.45; margin: 0 0 10px; }

/* Segment-Umschalter (Heatmap-Modus) */
.ap-seg { display: inline-flex; background: var(--surface-2); border-radius: var(--radius-sm); padding: 3px; gap: 2px; margin-bottom: 12px; }
.ap-seg-btn { border: 0; background: transparent; color: var(--text-2); font: inherit; font-size: 12.5px; padding: 4px 12px; border-radius: 6px; cursor: pointer; }
.ap-seg-btn.active { background: var(--surface); color: var(--accent-text); font-weight: 600; box-shadow: var(--shadow-sm); }

/* Heatmap */
.ap-hm-scroll { overflow-x: auto; }
.ap-hm { border-collapse: separate; border-spacing: 2px; width: 100%; font-variant-numeric: tabular-nums; }
.ap-hm th { font-size: 11px; font-weight: 600; color: var(--text-3); padding: 2px 4px; }
.ap-hm thead th { text-align: center; white-space: nowrap; }
.ap-hm-name { text-align: left !important; color: var(--text-2) !important; white-space: nowrap; max-width: 120px; overflow: hidden; text-overflow: ellipsis; }
.ap-hm-cell { text-align: center; color: #fff; font-size: 11.5px; font-weight: 600; padding: 5px 6px; border-radius: 5px; min-width: 34px; text-shadow: 0 1px 1px rgba(0,0,0,.18); }
.ap-hm-cell.empty { background: var(--surface-2); color: var(--text-3); text-shadow: none; font-weight: 400; }
.ap-hm-foot th, .ap-hm-foot td { font-size: 11px; font-weight: 600; padding-top: 5px; border-top: 1px solid var(--border); text-align: center; font-variant-numeric: tabular-nums; }
.ap-hm-foot th { color: var(--text-3); text-align: left; }

/* Stille Kinder */
.ap-quiet-list { display: flex; flex-wrap: wrap; gap: 8px; }
.ap-quiet-chip { display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--border-2); background: var(--surface); border-radius: 999px; padding: 4px 12px 4px 4px; font: inherit; font-size: 12.5px; color: var(--text); cursor: pointer; }
.ap-quiet-chip:hover { border-color: var(--accent); }

/* Geschlechter-Brille */
.ap-gg { display: flex; flex-direction: column; gap: 4px; }
.ap-gg-row { display: flex; align-items: center; gap: 10px; padding: 7px 0; border-bottom: 0.5px solid var(--border); }
.ap-gg-row:last-child { border-bottom: 0; }
.ap-gg-label { flex: 1; font-size: 12.5px; color: var(--text-2); }
.ap-gg-cells { display: flex; gap: 14px; }
.ap-gg-cell { text-align: right; min-width: 70px; }
.ap-gg-v { font-size: 15px; font-weight: 700; font-variant-numeric: tabular-nums; }
.ap-gg-grp { display: block; font-size: 10.5px; color: var(--text-3); }

/* Wochentagsmuster */
.ap-wd { display: flex; gap: 8px; align-items: stretch; height: 120px; }
.ap-wd-col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 4px; }
.ap-wd-bar-wrap { flex: 1; width: 100%; display: flex; align-items: flex-end; justify-content: center; }
.ap-wd-bar { width: 62%; min-height: 2px; border-radius: 4px 4px 0 0; background: color-mix(in srgb, #c0392b 55%, var(--surface-2)); transition: height .3s ease; }
.ap-wd-bar.peak { background: #c0392b; }
.ap-wd-n { font-size: 11.5px; color: var(--text-2); font-weight: 600; }
.ap-wd-c { font-size: 11px; color: var(--text-3); }

/* Stimmigkeit Note ↔ Text */
.ap-cons-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 7px; }
.ap-cons-list li { display: flex; align-items: flex-start; gap: 9px; font-size: 12.5px; color: var(--text); padding: 8px 10px; border-radius: var(--radius-sm); cursor: pointer; border: 1px solid var(--border); }
.ap-cons-list li:hover { border-color: var(--accent); }
.ap-cons-list li .ti { font-size: 17px; margin-top: 1px; }
.ap-cons-gut-kritisch .ti { color: #d98324; }
.ap-cons-schwach-positiv .ti { color: var(--accent); }
.ap-cons-detail { color: var(--text-2); }

/* Floskeln / Wiederholungen / Wortwolke */
.ap-flos { display: flex; flex-wrap: wrap; gap: 6px; }
.ap-flos-tag { font-size: 12px; padding: 3px 9px; border-radius: var(--radius-sm); background: var(--surface-2); color: var(--text-2); }
.ap-flos-tag.warn { background: color-mix(in srgb, #d98324 16%, transparent); color: #b5681a; border: 1px solid color-mix(in srgb, #d98324 40%, transparent); }
.ap-flos-tag b { color: inherit; }
.ap-dup { list-style: none; margin: 6px 0 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.ap-dup li { font-size: 12px; color: var(--text-2); display: flex; gap: 7px; align-items: baseline; }
.ap-dup-n { font-weight: 700; color: #b5681a; flex: none; }
.ap-balance .an-sub-name { width: 90px; cursor: pointer; }
.ap-cloud { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: baseline; line-height: 1.5; padding: 4px 0; }
.ap-cloud span { color: var(--accent-text); font-weight: 600; }

/* Lernverlauf / Trend */
.ap-trend-head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 8px; }
.ap-spark { background: var(--surface-2); border-radius: 6px; padding: 2px; }
.ap-trend-badge { font-size: 12.5px; font-weight: 600; display: inline-flex; align-items: center; gap: 5px; }
.ap-trend-subjs { display: flex; flex-wrap: wrap; gap: 6px; }
.ap-trend-chip { font-size: 12px; padding: 3px 9px; border-radius: var(--radius-sm); display: inline-flex; align-items: center; gap: 4px; font-variant-numeric: tabular-nums; }
.ap-trend-chip.up { background: color-mix(in srgb, var(--accent-2) 14%, transparent); color: var(--accent-2-text); }
.ap-trend-chip.down { background: color-mix(in srgb, #c0392b 13%, transparent); color: #b3261e; }
.ap-trend-empty .ap-lead { margin-bottom: 0; }

/* Auffälliges Profil */
.ap-outlier-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 7px; }
.ap-outlier-list li { display: flex; align-items: flex-start; gap: 9px; font-size: 12.5px; color: var(--text-2); line-height: 1.4; }
.ap-outlier-list .ti { color: #d98324; font-size: 17px; margin-top: 1px; flex: none; }

/* (Aktionsleisten-Styles stehen weiter oben bei den Einzelkind-Reitern.) */

/* ===================================================================
   Beobachtungs- & Förderprofil (beobachtung.js)
   =================================================================== */
.beob-block { border-top: 1px dashed var(--border-2); padding-top: 12px; margin-top: 4px; }
.beob-legal { font-size: 11.5px; color: var(--text-3); line-height: 1.45; display: flex; gap: 7px; align-items: flex-start; margin: 8px 0 0; }
.beob-legal .ti { margin-top: 1px; flex: none; color: var(--accent); }
.beob-optin { background: var(--surface-2); border-radius: var(--radius-sm); padding: 12px 14px; }
.beob-optin .ap-lead { margin-bottom: 6px; }
/* CTA „Beobachtungsbogen anlegen“ — als klar erkennbarer Button (analog zu den
   Aktionsleisten); helle Fläche, damit er sich vom grauen Opt-in-Kasten abhebt. */
.beob-optin button { margin-top: 10px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px 14px; font-size: 12.5px; font-weight: 500; color: var(--text); box-shadow: none; }
.beob-optin button .ti { font-size: 15px; color: var(--accent); }
.beob-optin button:hover { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 35%, transparent); color: var(--accent-text); }
.beob-meta { display: flex; gap: 8px; align-items: center; font-size: 12px; color: var(--text-2); margin-top: 2px; }
.beob-meta .ti { color: var(--accent); }
.beob-hints { margin-top: 8px; }

/* Strategien */
.beob-strat-dom { margin-top: 8px; }
.beob-strat-dom > b { font-size: 12.5px; display: inline-flex; align-items: center; gap: 6px; color: var(--text); }
.beob-strat-dom > b .ti { color: var(--accent); }
.beob-strat-dom .an-tip-ex { margin-top: 4px; }

/* Fragebogen-Editor */
.beob-editor { margin-top: 12px; border-top: 0.5px solid var(--border); padding-top: 10px; }
.beob-domgrp { margin-bottom: 12px; }
.beob-domgrp-t { font-size: 12.5px; font-weight: 600; color: var(--text-2); display: flex; align-items: center; gap: 6px; margin-bottom: 6px; }
.beob-domgrp-t .ti { color: var(--accent); }
.beob-item { display: flex; align-items: center; gap: 10px; justify-content: space-between; padding: 5px 0; border-bottom: 0.5px solid var(--border); }
.beob-item.pos { background: color-mix(in srgb, var(--accent-2) 6%, transparent); border-radius: 6px; padding-left: 8px; padding-right: 0; }
.beob-item-txt { font-size: 12.5px; color: var(--text); line-height: 1.35; }
.beob-rate { display: inline-flex; gap: 3px; flex: none; align-items: center; }
.beob-rate-btn { display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--border-2); background: var(--surface); color: var(--text-2); font: inherit; font-size: 11.5px; line-height: 1; padding: 4px 9px; border-radius: 6px; cursor: pointer; min-width: 42px; text-align: center; }
.beob-rate-btn:hover { border-color: var(--accent); }
.beob-rate-btn.active { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.beob-item.pos .beob-rate-btn.active { background: var(--accent-2); border-color: var(--accent-2); }
.beob-rate-clr { display: inline-flex; align-items: center; justify-content: center; border: 0; background: transparent; color: var(--text-3); cursor: pointer; padding: 2px; width: 22px; height: 22px; font-size: 13px; line-height: 1; border-radius: 6px; }
.beob-rate-clr:hover { color: #c0392b; background: color-mix(in srgb, #c0392b 10%, transparent); }
.beob-rate-clr.is-empty { visibility: hidden; pointer-events: none; }

/* ===== Notenrechner ===== */
/* Zelleninhalt oben ausrichten: so liegen alle Auswahlfelder einer Zeile auf
   gleicher Höhe, auch wenn eine Spalte einen ∑-Chip darunter trägt (sonst
   zentriert die Tabelle den Inhalt und die Felder „verrutschen"). */
.nr-grid td { vertical-align: top; }
.nr-grid .sticky { vertical-align: middle; }
.nr-grid .nr-cellwrap { display: flex; flex-direction: column; gap: 4px; align-items: stretch; }
/* Auswahlfeld echt in der Spaltenmitte zentrieren: symmetrische Polsterung links
   spiegelt den rechts schwebenden Rechner-Button, damit die Note exakt über dem
   ∑-Chip sitzt. Das Feld bleibt kompakt statt die ganze Zelle zu füllen. */
.nr-cellrow { position: relative; display: flex; align-items: center; justify-content: center; padding: 0 26px; }
.nr-cellrow .grade-select { flex: 0 1 auto; min-width: 56px; max-width: 100%; }
/* Dezenter Rechner-Opener — rechts schwebend, blasst aus, wird beim Überfahren der Zelle deutlich */
/* Vertikal über top/bottom + margin zentrieren (NICHT transform): so überschreibt
   der globale button:active{transform:scale(.98)} die Zentrierung nicht und das
   Icon springt beim Klick nicht weg. */
.nr-open { position: absolute; right: 0; top: 0; bottom: 0; margin: auto 0; display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; border: 0; background: transparent; color: var(--text-3); border-radius: 6px; cursor: pointer; opacity: .35; transition: opacity .12s, color .12s, background .12s; }
.nr-cellwrap:hover .nr-open, .nr-open:focus-visible { opacity: 1; }
.nr-open:hover { color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent); }
.nr-cellwrap > .nr-chip { align-self: center; }
.nr-chip { display: inline-flex; align-items: center; gap: 4px; border: 1px solid var(--border-2); background: var(--surface); color: var(--text-2); font: inherit; font-size: 11.5px; font-weight: 600; line-height: 1; padding: 3px 7px; border-radius: 6px; cursor: pointer; }
.nr-chip:hover { border-color: var(--accent); color: var(--text); }
.nr-chip.sug { background: color-mix(in srgb, var(--accent) 12%, transparent); border-color: color-mix(in srgb, var(--accent) 40%, transparent); color: var(--accent-text); }
.nr-chip.ok { background: var(--accent-2-bg); border-color: transparent; color: var(--accent-2-text); }

.nr-tabs { display: flex; flex-wrap: wrap; gap: 4px; margin: 0 0 14px; }
.nr-tab { border: 1px solid var(--border-2); background: var(--surface); color: var(--text-2); font: inherit; font-size: 12.5px; font-weight: 600; padding: 6px 12px; border-radius: var(--radius-sm); cursor: pointer; }
.nr-tab:hover { border-color: var(--accent); color: var(--text); }
.nr-tab.active { background: var(--accent); border-color: var(--accent); color: #fff; }

.nr-schema { margin: 0 0 16px; }
.nr-schead { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.nr-schead h3 { margin: 0; font-size: 14px; display: inline-flex; align-items: center; gap: 6px; }
.nr-sumok { font-size: 12px; color: var(--accent-2-text); font-weight: 600; }
.nr-sumwarn { font-size: 12px; color: #d98324; font-weight: 600; }
.nr-cats { display: flex; flex-direction: column; gap: 6px; margin-bottom: 8px; }
.nr-catrow { display: flex; align-items: center; gap: 8px; }
.nr-catname { flex: 1 1 auto; padding: 6px 9px; border: 1px solid var(--border-2); border-radius: 6px; background: var(--surface); color: var(--text); font: inherit; font-size: 13px; }
.nr-catgew { display: inline-flex; align-items: center; gap: 4px; color: var(--text-2); font-size: 13px; }
.nr-catgew input { width: 60px; padding: 6px 8px; border: 1px solid var(--border-2); border-radius: 6px; background: var(--surface); color: var(--text); font: inherit; text-align: right; }
.ghost.danger:hover { color: #c0392b; }

.nr-skbox { margin-top: 12px; border-top: 1px solid var(--border); padding-top: 10px; }
.nr-skbox summary { cursor: pointer; font-size: 13px; font-weight: 600; color: var(--text-2); display: inline-flex; align-items: center; gap: 6px; }
.nr-skenable { display: flex; align-items: center; gap: 8px; margin: 10px 0; font-size: 13px; color: var(--text-2); }
.nr-sktable { display: flex; flex-direction: column; gap: 5px; }
.nr-skrow { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--text-2); }
.nr-skrow input { width: 58px; padding: 5px 7px; border: 1px solid var(--border-2); border-radius: 6px; background: var(--surface); color: var(--text); font: inherit; text-align: right; }
.nr-skactions { display: inline-flex; gap: 6px; margin-top: 6px; }
.nr-skhint, .nr-hint { font-size: 12px; color: var(--text-3); }

.nr-addform { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 0 0 12px; padding: 12px; background: var(--surface-2); border-radius: var(--radius); }
.nr-addform input, .nr-addform select { padding: 7px 9px; border: 1px solid var(--border-2); border-radius: 6px; background: var(--surface); color: var(--text); font: inherit; font-size: 13px; }
.nr-af-titel { flex: 1 1 200px; }
.nr-af-max { width: 110px; }

.nr-amx .nr-mcell { padding: 4px; text-align: center; }
.nr-rowhead .nr-rowmeta { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--text-3); margin-top: 2px; }
.nr-leistdel { margin-left: auto; border: 0; background: transparent; color: var(--text-3); cursor: pointer; padding: 2px; border-radius: 4px; }
.nr-leistdel:hover { color: #c0392b; }
.nr-gw { font-size: 11px; font-weight: 600; opacity: .7; }
.nr-rowempty { color: var(--text-3); font-size: 12px; font-style: italic; padding: 8px 12px !important; text-align: left; }
.nr-val { display: inline-flex; align-items: center; gap: 4px; border: 1px solid var(--border-2); border-radius: 6px; padding: 1px; background: var(--surface); }
.nr-val select { border: 0; background: transparent; color: var(--text); font: inherit; font-size: 13px; padding: 4px 6px; text-align: center; }
.nr-val.pkt input { width: 52px; border: 0; background: transparent; color: var(--text); font: inherit; font-size: 13px; text-align: right; padding: 4px; }
.nr-val .nr-max { font-size: 11px; color: var(--text-3); padding-right: 5px; }

.nr-footrow { background: var(--surface-2); }
.nr-foot { text-align: center; font-weight: 700; font-size: 13px; }
.nr-foothead { font-weight: 700; }
.nr-applyall { margin-left: 8px; border: 1px solid var(--accent); background: transparent; color: var(--accent-text); font: inherit; font-size: 11px; font-weight: 600; padding: 3px 8px; border-radius: 6px; cursor: pointer; }
.nr-applyall:hover { background: var(--accent); color: #fff; }

.nr-panel { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-sm); padding: 16px; margin: 0 0 16px; }
.nr-phead { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.nr-pgroup { border-top: 1px solid var(--border); padding: 10px 0; }
.nr-pghead { display: flex; align-items: center; justify-content: space-between; font-weight: 600; font-size: 13px; margin-bottom: 6px; }
.nr-pgw { color: var(--text-3); font-weight: 500; }
.nr-pgavg { color: var(--text-2); font-size: 12.5px; }
.nr-prow { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 4px 0; }
.nr-pl { display: flex; align-items: baseline; gap: 8px; }
.nr-pdate { font-size: 11px; color: var(--text-3); }
.nr-pempty { font-size: 12px; color: var(--text-3); font-style: italic; }
.nr-pfoot { display: flex; align-items: center; justify-content: space-between; gap: 12px; border-top: 1px solid var(--border); margin-top: 10px; padding-top: 12px; flex-wrap: wrap; }
.nr-result { display: inline-flex; align-items: baseline; gap: 8px; }
.nr-rlab { font-size: 12px; color: var(--text-2); }
.nr-ravg { font-size: 22px; font-weight: 700; }
.nr-rsug { font-size: 13px; color: var(--text-2); }
.nr-hjbadge { display: inline-block; margin-left: 6px; font-size: 9.5px; font-weight: 700; letter-spacing: .02em; padding: 1px 5px; border-radius: 4px; background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--accent-text); vertical-align: middle; }
.nr-jahrbox { margin-top: 10px; }
.nr-jahrrow { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-2); margin: 8px 0; }
.nr-jahrrow input { width: 64px; padding: 5px 8px; border: 1px solid var(--border-2); border-radius: 6px; background: var(--surface); color: var(--text); font: inherit; text-align: right; }
.ap-lv-list { display: flex; flex-direction: column; gap: 4px; }
.ap-lv-row { display: grid; grid-template-columns: 84px 1fr auto; align-items: center; gap: 12px; padding: 4px 0; }
.ap-lv-sub { font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.ap-lv-spark { display: flex; align-items: center; min-height: 30px; }
.ap-lv-single { font-size: 14px; font-weight: 700; color: var(--text-2); }
.ap-lv-avg { font-size: 13px; font-weight: 700; white-space: nowrap; }
.ap-lv-n { font-size: 11px; font-weight: 400; color: var(--text-3); }
