/*
 * SPDX-FileCopyrightText: 2026 Frank Winter
 * SPDX-License-Identifier: MIT
 */

/* ==========================================================================
   Grundschutz++ Explorer – Stylesheet
   Eigenständiges Design-System (kein Build-Schritt, keine Utility-Klassen).
   Hell/Dunkel über die Klasse .dark auf <html>.
   ========================================================================== */

/* ==========================================================================
   Schriftart: Open Sans (Variable Font, lokal, wght 300–800 stufenlos)
   ========================================================================== */

@font-face {
  font-family: 'Open Sans';
  font-style: normal;
  font-weight: 300 800;
  font-display: swap;
  src: url('fonts/open-sans-latin-ext-variable.woff2') format('woff2-variations'),
       url('fonts/open-sans-latin-ext-variable.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: 'Open Sans';
  font-style: normal;
  font-weight: 300 800;
  font-display: swap;
  src: url('fonts/open-sans-latin-variable.woff2') format('woff2-variations'),
       url('fonts/open-sans-latin-variable.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  /* Schriftgrößen-Faktor (Header: A A A), wird per JS gesetzt */
  --font-scale: 1;
  --bg: #f4f5f7;
  --surface: #ffffff;
  --surface-2: #f8f9fa;
  --surface-hover: #eef0f3;
  --subhead-bg: #eef0f3;
  --border: #e2e4e8;
  --border-strong: #cbd0d8;
  --text: #101828;
  --text-2: #475467;
  --text-3: #667085; /* mind. 4,5:1 gegen alle hellen Hintergründe (WCAG AA) */
  --text-faint: #98a2b3; /* bewusst kontrastarm, nur für Nebensächliches wie die UUID */
  --icon-subtle: #6187e1; /* dezentes Blau für Info-Symbole: mind. 3:1 gegen alle hellen Hintergründe (WCAG 1.4.11) */

  --accent: #2459d6;
  --accent-hover: #1c47b3;
  --accent-soft: #eef3ff;
  --accent-border: #c4d4fb;
  --accent-text: #1f4fc4;

  --muss: #c8281c;
  --muss-soft: #fef3f2;
  --muss-border: #fbc8c3;
  --sollte: #a15c07;
  --sollte-soft: #fff8e6;
  --sollte-border: #f6d88a;
  --kann: #0b7285;
  --kann-soft: #ebfbfd;
  --kann-border: #a6e6ef;
  --added: #067647;
  --list-other: #cbd0d8; /* Stern und Notizen-Punkt "andere Liste": hebt sich klar von der aktiven Liste ab */
  --added-soft: #ecfdf3;
  --added-border: #abefc6;
  --threat: #b54708;
  --threat-soft: #fff6ed;

  /* Filter-Ausschluss (✕) */
  --exclude: #dc2626;
  --exclude-hover: #b91c1c;
  --exclude-soft: rgba(220, 38, 38, 0.08);
  --exclude-border: rgba(220, 38, 38, 0.32);
  --exclude-text: #b91c1c;

  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.05);
  --shadow-md: 0 4px 12px -2px rgba(16, 24, 40, 0.08), 0 2px 4px -2px rgba(16, 24, 40, 0.04);
  --shadow-lg: 0 24px 48px -12px rgba(16, 24, 40, 0.25);
  --overlay: rgba(16, 24, 40, 0.45);
  /* Sekundäre Buttons: dezenter Verlauf, damit sie sich von weißen Flächen abheben */
  --btn-bg: linear-gradient(180deg, #ffffff 0%, #f0f2f5 100%);
  --btn-bg-hover: linear-gradient(180deg, #ffffff 0%, #e5e8ed 100%);
  /* Stern (Listen): Füllung und Kontur, Kontur mindestens 3:1 gegen den Hintergrund */
  --star: #fbbf24;
  --star-stroke: #a16207;

  --radius-sm: 6px;
  --radius: 8px;
  --radius-lg: 12px;

  --font: 'Open Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, 'Cascadia Code', Consolas, monospace;

  color-scheme: light;
}

.dark {
  --list-other: var(--text-3);
  --bg: #0c0e13;
  --surface: #13161d;
  --surface-2: #181c24;
  --surface-hover: #1e232d;
  --subhead-bg: #1e232d;
  --border: #252a35;
  --border-strong: #353c4a;
  --text: #e8ebf1;
  --text-2: #a5adbb;
  --text-3: #8990a0; /* mind. 4,5:1 gegen alle dunklen Hintergründe (WCAG AA) */
  --text-faint: #4b5263; /* bewusst kontrastarm, nur für Nebensächliches wie die UUID */
  --icon-subtle: #476cb4; /* mind. 3:1 gegen alle dunklen Hintergründe */

  --accent: #5b8def;
  --accent-hover: #7ba4f4;
  --accent-soft: rgba(91, 141, 239, 0.14);
  --accent-border: rgba(91, 141, 239, 0.38);
  --accent-text: #93b4f7;

  --muss: #f97a70;
  --muss-soft: rgba(240, 68, 56, 0.13);
  --muss-border: rgba(240, 68, 56, 0.35);
  --sollte: #f5b83d;
  --sollte-soft: rgba(247, 144, 9, 0.13);
  --sollte-border: rgba(247, 144, 9, 0.35);
  --kann: #3fd0e8;
  --kann-soft: rgba(6, 174, 212, 0.13);
  --kann-border: rgba(6, 174, 212, 0.35);
  --added: #4ad295;
  --added-soft: rgba(23, 178, 106, 0.13);
  --added-border: rgba(23, 178, 106, 0.35);
  --threat: #f5a35c;
  --threat-soft: rgba(247, 144, 9, 0.1);

  /* Filter-Ausschluss (✕) */
  --exclude: #f87171;
  --exclude-hover: #fca5a5;
  --exclude-soft: rgba(239, 68, 68, 0.14);
  --exclude-border: rgba(239, 68, 68, 0.38);
  --exclude-text: #fca5a5;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px -2px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 24px 48px -12px rgba(0, 0, 0, 0.6);
  --overlay: rgba(0, 0, 0, 0.6);
  --btn-bg: linear-gradient(180deg, #1d212a 0%, #161a21 100%);
  --btn-bg-hover: linear-gradient(180deg, #252a35 0%, #1d212a 100%);
  --star: #fbbf24;
  --star-stroke: #fbbf24;

  color-scheme: dark;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
/* Vollbild-Layout: nur die Bereiche scrollen, nie die Seite selbst (auch nicht durch Scroll-Chaining oder überstehende Elemente) */
html, body { height: 100%; margin: 0; overflow: hidden; }
body {
  font-family: var(--font);
  font-size: calc(14px * var(--font-scale));
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  font-feature-settings: 'cv11', 'ss01';
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
button:disabled { cursor: not-allowed; opacity: 0.55; }
h1, h2, h3, h4, h5, p { margin: 0; }
ul { margin: 0; padding: 0; list-style: none; }
.mono { font-family: var(--mono); }
[v-cloak] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.icon { width: 16px; height: 16px; flex-shrink: 0; }
.icon-sm { width: 14px; height: 14px; flex-shrink: 0; }
.icon-xs { width: 12px; height: 12px; flex-shrink: 0; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 10px; border: 3px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background-color: var(--text-3); }

.app { height: 100%; display: flex; flex-direction: column; overflow: hidden; }

/* ---------- Barrierefreiheit: Sprunglinks ---------- */
.skip-link {
  position: fixed;
  top: -120px;
  left: 16px;
  z-index: 9999;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  padding: 0 16px;
  background: var(--accent);
  color: #fff;
  border-radius: var(--radius);
  font-size: calc(13px * var(--font-scale));
  font-weight: 600;
  text-decoration: none;
  box-shadow: var(--shadow-lg);
  transition: top 0.15s ease-out;
}
.dark .skip-link { color: var(--bg); }
.skip-link:focus {
  top: 12px;
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 32px; padding: 0 12px; border-radius: var(--radius);
  font-size: calc(13px * var(--font-scale)); font-weight: 500; white-space: nowrap;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }
.dark .btn-primary { color: var(--bg); }
.btn-secondary { background: var(--btn-bg); border: 1px solid var(--border); color: var(--text); box-shadow: var(--shadow-sm); }
.btn-secondary:hover:not(:disabled) { background: var(--btn-bg-hover); border-color: var(--border-strong); }
.btn-ghost { color: var(--text-2); }
.btn-ghost:hover:not(:disabled) { background: var(--surface-hover); color: var(--text); }
.btn-danger { color: var(--muss); }
.btn-danger:hover { border-color: var(--muss-border); background: var(--muss-soft); }
.btn-danger-solid { background: var(--muss); color: #fff; }
.btn-danger-solid:hover:not(:disabled) { filter: brightness(0.92); }
.dark .btn-danger-solid { color: var(--bg); }
.btn-lg { height: 42px; padding: 0 18px; font-size: calc(14px * var(--font-scale)); font-weight: 600; }
.btn-sm { height: 26px; padding: 0 9px; font-size: calc(12px * var(--font-scale)); border-radius: var(--radius-sm); }
.btn-block { width: 100%; }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border-radius: var(--radius); color: var(--text-2);
  transition: background 0.12s, color 0.12s;
}
.icon-btn:hover:not(:disabled) { background: var(--surface-hover); color: var(--text); }
.icon-btn.sm { width: 26px; height: 26px; border-radius: var(--radius-sm); }
.icon-btn.btn-outline {
  border: 1px solid var(--border);
  background: var(--btn-bg);
  box-shadow: var(--shadow-sm);
}
.icon-btn.btn-outline:hover:not(:disabled) {
  border-color: var(--border-strong);
  background: var(--btn-bg-hover);
  color: var(--text);
}
.dark .icon-btn.btn-outline {
  background: var(--btn-bg);
  border-color: var(--border-strong);
}
.dark .icon-btn.btn-outline:hover:not(:disabled) {
  background: var(--btn-bg-hover);
  border-color: var(--text-3);
  color: var(--text);
}
.icon-btn.btn-outline.active {
  background: var(--accent-soft);
  border-color: var(--accent-border);
  color: var(--accent-text);
  z-index: 2;
}
.dark .icon-btn.btn-outline.active {
  background: var(--accent-soft);
  border-color: var(--accent-border);
  color: var(--accent-text);
  z-index: 2;
}

/* ---------- Button Group (Segmented / Abutting Buttons) ---------- */
.btn-group {
  display: inline-flex;
  align-items: center;
  vertical-align: middle;
  position: relative;
}
.btn-group > .btn,
.btn-group > .icon-btn {
  border-radius: 0;
  position: relative;
}
.btn-group > :first-child {
  border-top-left-radius: var(--radius-sm);
  border-bottom-left-radius: var(--radius-sm);
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}
.btn-group > :last-child {
  border-top-right-radius: var(--radius-sm);
  border-bottom-right-radius: var(--radius-sm);
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
}
.btn-group > :not(:first-child) {
  margin-left: -1px;
}
.btn-group > :hover:not(:disabled),
.btn-group > :focus-visible {
  z-index: 2;
}
.link-btn { color: var(--accent-text); font-size: calc(12px * var(--font-scale)); font-weight: 500; }
.link-btn:hover { text-decoration: underline; }

.spinner {
  width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid currentColor; border-top-color: transparent;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Tags ---------- */
.tag {
  display: inline-flex; align-items: center; gap: 4px;
  height: 20px; padding: 0 7px; border-radius: 5px;
  font-size: calc(11px * var(--font-scale)); font-weight: 600; line-height: 1; white-space: nowrap;
  background: var(--surface-hover); color: var(--text-2);
}
.tag-outline { background: transparent; border: 1px solid var(--border); }
.tag-mono { font-family: var(--mono); font-weight: 500; }
.tag-lg { height: 24px; padding: 0 9px; font-size: calc(12px * var(--font-scale)); }
.verb-muss { background: var(--muss-soft); color: var(--muss); }
.verb-sollte { background: var(--sollte-soft); color: var(--sollte); }
.verb-kann { background: var(--kann-soft); color: var(--kann); }
.diff-added { background: var(--added-soft); color: var(--added); }
.diff-modified { background: var(--sollte-soft); color: var(--sollte); }
.diff-deleted { background: var(--muss-soft); color: var(--muss); }
.tag-accent { background: var(--accent-soft); color: var(--accent-text); }
.tag-sec-erhoeht { background: var(--muss-soft); color: var(--muss); border: 1px solid var(--muss-border); }
.tag-interactive { cursor: pointer; transition: background 0.15s, border-color 0.15s, color 0.15s; }
.tag-interactive:hover { background: var(--surface-hover); color: var(--text); border-color: var(--border-strong); }
.tag-interactive.is-active { background: var(--accent-soft); color: var(--accent-text); border-color: var(--accent); }

.dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; display: inline-block; }
.dot-muss { background: var(--muss); }
.dot-sollte { background: var(--sollte); }
.dot-kann { background: var(--kann); }

/* ---------- Topbar ---------- */
.topbar {
  display: grid; grid-template-columns: minmax(220px, 1fr) minmax(280px, 560px) minmax(220px, 1fr);
  align-items: center; gap: 16px;
  height: 56px; padding: 0 16px; flex-shrink: 0;
  background: var(--surface); border-bottom: 1px solid var(--border);
  position: relative; z-index: 20;
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-mark {
  width: 40px; height: 40px; border-radius: 9px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  box-sizing: border-box;
}
.brand-logo {
  width: 100%; height: 100%; object-fit: contain; display: block;
}
.dark .brand-mark {
  background: #ffffff;
  padding: 2.5px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
}
.brand-text { min-width: 0; }
.brand-title { font-size: calc(14px * var(--font-scale)); font-weight: 650; letter-spacing: -0.01em; line-height: 1.2; }
.brand-sub { font-size: calc(12px * var(--font-scale)); color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.search {
  position: relative; display: flex; align-items: center;
}
/* Ohne Katalog gibt es nichts zu durchsuchen; der Platz im Kopf bleibt erhalten */
.search.is-hidden { visibility: hidden; }
.search .icon { position: absolute; left: 11px; color: var(--text-3); pointer-events: none; }
.search input {
  width: 100%; height: 36px; padding: 0 70px 0 36px;
  border-radius: var(--radius); border: 1px solid var(--border);
  background: var(--surface-2); color: var(--text); font-size: calc(13px * var(--font-scale));
  transition: border-color 0.12s, box-shadow 0.12s, background 0.12s;
}
.search input::placeholder { color: var(--text-3); }
.search input:focus { outline: none; border-color: var(--accent); background: var(--surface); box-shadow: 0 0 0 3px var(--accent-soft); }
.search-end { position: absolute; right: 8px; display: flex; align-items: center; gap: 4px; }
.kbd {
  font-family: var(--mono); font-size: calc(10.5px * var(--font-scale)); color: var(--text-3);
  border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 4px;
  padding: 1px 5px; background: var(--surface);
}
.topbar-actions { display: flex; align-items: center; justify-content: flex-end; gap: 6px; }

/* ---------- Diff banner ---------- */
.diff-banner {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 8px 16px; font-size: calc(13px * var(--font-scale)); flex-shrink: 0;
  background: var(--accent-soft); border-bottom: 1px solid var(--accent-border); color: var(--text);
}
.diff-banner strong { font-weight: 600; }
.diff-banner .spacer { flex: 1; }

/* ---------- Workspace ---------- */
.workspace { flex: 1; display: flex; min-height: 0; }

/* Rail (Facetten: Modalverben, Niveau, Praktiken, Gefährdungen, Diff) */
.rail {
  /* wächst mit der Schriftgröße, damit Beschriftungen und Chips weiter passen */
  width: calc(275px * var(--font-scale)); flex-shrink: 0; display: flex; flex-direction: column;
  background: var(--surface-2); border-right: 1px solid var(--border); min-height: 0;
}
.rail-header {
  display: flex; align-items: center; gap: 8px;
  height: 40px; padding: 0 10px 0 14px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  flex-shrink: 0;
}
.rail-header-title {
  font-size: calc(11.5px * var(--font-scale)); font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.05em; color: var(--text-2);
}
.rail-header .spacer { flex: 1; }
.rail-scroll { flex: 1; overflow-y: auto; padding: 10px 8px; }

.rail-section { margin-bottom: 10px; }
.rail-heading {
  display: flex; align-items: center; gap: 6px; width: 100%; text-align: left;
  padding: 5px 8px; border-radius: var(--radius-sm);
  font-size: calc(11px * var(--font-scale)); font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.05em; color: var(--text-3);
  cursor: pointer; user-select: none;
  transition: background 0.1s, color 0.1s;
}
.rail-heading:hover { background: var(--surface-hover); color: var(--text-2); }
.rail-heading-title { flex: 1; min-width: 0; }
/* Zahl aktiver Filter: zart getönt und eckig, damit sie nicht wie das runde Info-„i“ wirkt */
.rail-active-badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 16px; height: 16px; padding: 0 4px; border-radius: 4px;
  background: var(--accent-soft); color: var(--accent-text); box-shadow: inset 0 0 0 1px var(--accent-border);
  font-size: calc(10px * var(--font-scale)); font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums;
  letter-spacing: 0; text-transform: none;
}
.rail-heading .chev { transition: transform 0.15s ease; color: var(--text-3); }
.rail-heading .chev.open { transform: rotate(90deg); }
.head-toggle { display: inline-flex; align-items: center; justify-content: center; margin: -4px; padding: 4px; border-radius: 4px; }
.head-toggle:hover { background: var(--border); }
.head-toggle:hover .chev { color: var(--text); }

.rail-section-body { display: flex; flex-direction: column; gap: 2px; padding: 2px 0 4px; }

.rail-threat-search { padding: 4px 4px 6px; }
/* Umschalter innerhalb eines Filterbereichs (z. B. übergeordnete Zielobjektkategorien einschließen) */
.rail-option {
  display: flex; align-items: center; gap: 6px; padding: 0 8px 6px;
  font-size: calc(12px * var(--font-scale)); color: var(--text-2); cursor: pointer; user-select: none;
}
.rail-option input { margin: 0; accent-color: var(--accent); }
.rail-search-input {
  width: 100%; height: 28px; padding: 0 8px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  font-size: calc(11.5px * var(--font-scale));
}
.rail-search-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }

.rail-subfilter-row { padding: 0 4px 6px; display: flex; }
.rail-threats-scroll {
  max-height: 260px; overflow-y: auto; padding-right: 2px;
  display: flex; flex-direction: column; gap: 2px;
}

.rail-row {
  width: 100%; display: flex; align-items: center; gap: 4px;
  min-height: 30px; padding: 2px 4px 2px 8px; border-radius: var(--radius-sm);
  font-size: calc(12.5px * var(--font-scale)); color: var(--text-2); border: 1px solid transparent;
  transition: background 0.1s, border-color 0.1s;
}
.rail-row:hover { background: var(--surface-hover); color: var(--text); }
.rail-row.is-included {
  background: var(--accent-soft); color: var(--accent-text); border-color: var(--accent-border);
}
.rail-row.is-excluded {
  background: var(--exclude-soft); color: var(--exclude-text); border-color: var(--exclude-border);
}
.rail-row.is-empty { opacity: 0.45; }
/* Über eine gewählte Unterkategorie eingeschlossen, selbst nicht gewählt */
.rail-row.is-implied { color: var(--accent-text); opacity: 1; }

.rail-row-main {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 6px;
  cursor: pointer; user-select: none;
}
.rail-row-label {
  flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  font-size: calc(12.5px * var(--font-scale));
}
.rail-row.is-excluded .rail-row-label { text-decoration: line-through; opacity: 0.85; }
.rail-row-count {
  font-size: calc(11px * var(--font-scale)); font-variant-numeric: tabular-nums; color: var(--text-3);
  margin-right: 4px; flex-shrink: 0;
}
.rail-row.is-included .rail-row-count { color: var(--accent-text); font-weight: 600; }
.rail-row.is-excluded .rail-row-count { color: var(--exclude); font-weight: 600; }

.rail-code {
  font-family: var(--mono); font-size: calc(11px * var(--font-scale)); font-weight: 600; width: 38px;
  flex-shrink: 0; color: var(--text-3);
}
.rail-row.is-included .rail-code { color: inherit; }

.threat-pill-code {
  font-family: var(--mono); font-size: calc(10.5px * var(--font-scale)); font-weight: 600; color: var(--text-3);
  flex-shrink: 0; width: 44px;
}
.rail-row.is-included .threat-pill-code { color: inherit; }


.rail-row-actions {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  opacity: 0.75;
  transition: opacity 0.1s;
  position: relative;
}
.rail-row:hover .rail-row-actions,
.rail-row.is-included .rail-row-actions,
.rail-row.is-excluded .rail-row-actions {
  opacity: 1;
}

.rail-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  padding: 0;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-3);
  cursor: pointer;
  user-select: none;
  transition: all 0.12s ease;
  position: relative;
}
.rail-btn:hover {
  border-color: var(--border-strong);
  color: var(--text);
  background: var(--surface-hover);
}

/* Nahtlose Button-Gruppe für Nur (✓) und Nicht (✕) ohne Abstand und mit gerader Stoßkante */
.rail-row-actions > .btn-check {
  border-top-left-radius: 4px;
  border-bottom-left-radius: 4px;
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}
.rail-row-actions > .btn-cross {
  border-top-right-radius: 4px;
  border-bottom-right-radius: 4px;
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
  margin-left: -1px;
}
.rail-row-actions > .rail-btn:hover,
.rail-row-actions > .rail-btn:focus-visible {
  z-index: 2;
}

/* Einzelner Papierkorb-Button behält rundherum abgerundete Ecken */
.rail-row-actions > .btn-trash {
  border-radius: 4px;
  margin-left: 0;
}

.rail-btn.btn-check:hover {
  color: var(--added);
  border-color: var(--added-border);
  background: var(--added-soft);
}

.rail-btn.btn-cross:hover {
  color: var(--exclude);
  border-color: var(--exclude-border);
  background: var(--exclude-soft);
}

.rail-btn.btn-trash {
  color: var(--text-3);
  border-color: var(--border);
  background: var(--surface);
}
.rail-btn.btn-trash:hover {
  color: var(--exclude);
  border-color: var(--exclude);
  background: var(--exclude-soft);
}
.rail-row.is-included .rail-btn.btn-trash {
  color: var(--accent-text);
  border-color: var(--accent-border);
}
.rail-row.is-included .rail-btn.btn-trash:hover {
  color: var(--exclude);
  border-color: var(--exclude);
  background: var(--exclude-soft);
}
.rail-btn.btn-trash.is-exclude-trash {
  color: var(--exclude);
  border-color: var(--exclude-border);
}
.rail-btn.btn-trash.is-exclude-trash:hover {
  color: var(--exclude-hover);
  border-color: var(--exclude-hover);
  background: var(--exclude-soft);
}

.icon-check,
.icon-cross,
.icon-trash {
  width: 12px;
  height: 12px;
  display: block;
}

.rail-subfilter-row {
  padding: 4px 6px;
  display: flex;
  align-items: center;
}
.link-btn.xs {
  font-size: calc(11.5px * var(--font-scale));
  padding: 2px 4px;
}


/* ---------- Eigene Listen (Filterleiste) ---------- */
.list-rows { display: flex; flex-direction: column; gap: 2px; }
.list-row { position: relative; padding-left: 2px; }
.list-radio {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; flex-shrink: 0; border-radius: 50%;
}
.list-radio-dot {
  width: 12px; height: 12px; border-radius: 50%;
  border: 1.5px solid var(--border-strong); background: var(--surface);
  transition: background 0.12s, border-color 0.12s, box-shadow 0.12s;
}
.list-radio:hover .list-radio-dot { border-color: var(--added); }
.list-radio[aria-checked="true"] .list-radio-dot {
  border-color: var(--added); background: var(--added);
  box-shadow: inset 0 0 0 2px var(--surface);
}
.list-radio:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.list-row.is-active-list .rail-row-label { font-weight: 600; color: var(--text); }
.list-row.is-included.is-active-list .rail-row-label { color: inherit; }
.rail-row-actions > .list-menu-btn { margin-left: 4px; border-radius: 4px; }
.list-edit { padding: 2px 4px; }
.list-tools { gap: 6px; padding: 4px 4px 2px; }
.list-tools .spacer { flex: 1; }
.list-menu-anchor { position: relative; }
.list-menu {
  position: absolute; right: 4px; top: calc(100% - 2px); z-index: 20;
  min-width: 170px; padding: 4px; display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-md);
}
.list-menu-anchor .list-menu { right: 0; top: calc(100% + 4px); }
.list-menu button {
  text-align: left; padding: 6px 10px; border-radius: var(--radius-sm);
  font-size: calc(12.5px * var(--font-scale)); color: var(--text-2);
}
.list-menu button:hover:not(:disabled) { background: var(--surface-hover); color: var(--text); }
.list-menu button.is-danger { color: var(--muss); }
.list-notice { color: var(--text-2); }

/* Stern am Titel: leer = in keiner Liste, grau = in anderer Liste, gelb = in der aktiven Liste */
.detail-title-row { display: flex; align-items: flex-start; gap: 12px; }
.detail-title-row .detail-title { flex: 1; min-width: 0; }
.star-btn {
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
  /* mittig zur ersten Zeile der Überschrift (20px, Zeilenhöhe 1,3, 2px Abstand oben) */
  width: 36px; height: 36px; margin: calc(2px + (26px * var(--font-scale) - 36px) / 2) -6px 0 0; border-radius: var(--radius);
  /* was über die erste Zeile hinausragt, vergrößert nicht den Abstand zu den Tags */
  margin-bottom: min(0px, calc(13px * var(--font-scale) - 18px));
  transition: background 0.12s, transform 0.08s;
}
.star-btn svg { width: 24px; height: 24px; fill: none; stroke: var(--text-3); transition: fill 0.12s, stroke 0.12s; }
.star-btn.star-other svg { fill: var(--list-other); stroke: var(--list-other); }
.star-btn.star-here svg { fill: var(--star); stroke: var(--star-stroke); }
.star-btn:not([aria-disabled="true"]):hover { background: var(--surface-hover); }
.star-btn:not([aria-disabled="true"]):active { transform: scale(0.92); }
.star-btn[aria-disabled="true"] { cursor: default; opacity: 0.8; }
.star-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

/* Reiter "Notizen": Punkt grau = Notiz in anderer Liste, grün (wie der Punkt der aktiven Liste) = Notiz in der aktiven Liste */
.note-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.note-dot-here { background: var(--added); }
.note-dot-other { background: var(--list-other); }

.notes-panel { display: grid; gap: 10px; }
.notes-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.notes-select { width: auto; max-width: 100%; height: 32px; padding: 0 8px; }
.notes-list-name { font-size: calc(13px * var(--font-scale)); font-weight: 600; color: var(--text); }
.notes-meta { margin-left: auto; font-size: calc(12px * var(--font-scale)); color: var(--text-3); }
.notes-text {
  height: auto; min-height: 240px; padding: 10px 12px; resize: vertical; overflow: auto;
  white-space: pre-wrap; overflow-wrap: anywhere; cursor: text;
  font-size: calc(13.5px * var(--font-scale)); line-height: 1.55;
}
.notes-text[contenteditable="false"] { cursor: default; background: var(--surface-2); color: var(--text-2); }
.notes-text:empty::before { content: attr(data-placeholder); color: var(--text-3); pointer-events: none; }
.notes-readonly { margin: 0; font-size: calc(12.5px * var(--font-scale)); color: var(--text-3); }
.notes-readonly .link-btn { font-size: inherit; }

/* Main split */
.split { flex: 1; display: flex; min-width: 0; min-height: 0; overflow: hidden; }

/* List pane */
.list-pane { flex: 1 1 0%; min-width: 280px; display: flex; flex-direction: column; background: var(--surface); min-height: 0; }
.filterbar { padding: 10px 16px; border-bottom: 1px solid var(--border); display: grid; gap: 8px; flex-shrink: 0; }

/* Tag-basierte Filterleiste */
.active-tags-bar { display: flex; flex-direction: column; gap: 6px; }
.tags-container {
  display: flex; align-items: center; flex-wrap: wrap; gap: 8px;
}
.tags-lead-label {
  font-size: calc(11px * var(--font-scale)); font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--text-3); flex-shrink: 0;
}
.tag-chips-wrap { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; flex: 1; }
.tag-chip {
  display: inline-flex; align-items: center; gap: 4px; height: 26px; padding: 1px 4px 1px 2px;
  border-radius: var(--radius-sm); font-size: calc(12px * var(--font-scale)); line-height: 1; transition: all 0.12s ease;
}
.tag-chip.is-include {
  background: var(--accent-soft); border: 1px solid var(--accent-border); color: var(--text);
}
.tag-chip.is-exclude {
  background: var(--exclude-soft); border: 1px solid var(--exclude-border); color: var(--text);
}
.tag-chip.is-search {
  background: var(--surface-hover); border: 1px solid var(--border-strong); color: var(--text);
}
.chip-mode-badge {
  display: inline-flex; align-items: center; gap: 4px; height: 20px; padding: 0 6px;
  border-radius: 4px; font-size: calc(10.5px * var(--font-scale)); font-weight: 700; border: none;
  user-select: none;
}
.chip-mode-badge.badge-include { background: var(--accent); color: #ffffff; }
.chip-mode-badge.badge-exclude { background: var(--exclude); color: #ffffff; }
.chip-mode-badge.badge-search { background: var(--text-3); color: #ffffff; }
.dark .chip-mode-badge { color: var(--bg); }

.icon-chip-svg {
  width: 10.5px; height: 10.5px; display: block; flex-shrink: 0;
}
.chip-mode-text {
  font-size: calc(10px * var(--font-scale)); font-weight: 700; letter-spacing: 0.03em; line-height: 1;
}

.chip-category { font-size: calc(11px * var(--font-scale)); color: var(--text-3); margin-left: 2px; font-weight: 500; }
.chip-label {
  font-weight: 600; color: var(--text); max-width: 240px; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
}
.chip-sep { font-weight: 400; color: var(--text-2); }
.chip-extra { font-weight: 400; color: var(--accent-text); }
.tag-chip.is-exclude .chip-label { color: var(--exclude-text); }

.icon-chip-trash {
  width: 12px; height: 12px; display: block;
}
.chip-remove-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 20px; height: 20px; margin-left: 2px; border-radius: 4px; border: none;
  background: transparent; color: var(--text-3); cursor: pointer;
  transition: background 0.1s, color 0.1s;
}
.chip-remove-btn:hover { background: var(--exclude-soft); color: var(--exclude); }

.clear-all-btn {
  font-size: calc(11.5px * var(--font-scale)); color: var(--text-3); white-space: nowrap; margin-left: auto;
}
.clear-all-btn:hover { color: var(--accent); }

.list-meta { display: flex; align-items: center; gap: 10px; font-size: calc(12.5px * var(--font-scale)); color: var(--text-3); }
.list-meta strong { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
.list-meta .spacer { flex: 1; }

.list-scroll { flex: 1; overflow-y: auto; padding-bottom: 24px; min-height: 0; }

.practice-head {
  position: sticky; top: 0; z-index: 3;
  width: 100%; display: flex; align-items: center; gap: 10px;
  height: 38px; padding: 0 16px; text-align: left; cursor: pointer;
  background: var(--surface-2); border-bottom: 1px solid var(--border);
  font-size: calc(13px * var(--font-scale)); font-weight: 600;
}
.practice-head:hover { background: var(--surface-hover); }
/* Beim Hineinscrollen (Auswahl, Pfeiltasten) nicht unter der mitlaufenden Praktik-Überschrift verschwinden */
.list-scroll .subgroup-head, .list-scroll .ctrl-row { scroll-margin-top: 38px; }
/* Fokus der Liste (Tab): Rahmen innen, sonst schnitte der Scrollbereich ihn ab */
.list-scroll:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; border-radius: 0; }
/* Ziel des Sprunglinks „Direkt zum Detailbereich“ */
.detail-pane:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; border-radius: 0; }
.practice-head.active { background: var(--accent-soft); }
.practice-head .code { font-family: var(--mono); font-size: calc(12px * var(--font-scale)); color: var(--accent-text); font-weight: 600; }
.practice-head .title { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.practice-head .count, .subgroup-head .count { font-size: calc(12px * var(--font-scale)); font-weight: 500; color: var(--text-3); font-variant-numeric: tabular-nums; }

.chev { color: var(--text-3); transition: transform 0.15s; }
.chev.open { transform: rotate(90deg); }

.subgroup-head {
  width: 100%; display: flex; align-items: center; gap: 8px;
  height: 34px; padding: 0 16px 0 22px; text-align: left; cursor: pointer;
  font-size: calc(12.5px * var(--font-scale)); font-weight: 600; color: var(--text-2);
  border-bottom: 1px solid var(--border);
}
.subgroup-head:hover { background: var(--surface-hover); color: var(--text); }
.subgroup-head.active { background: var(--accent-soft); color: var(--accent-text); }
.subgroup-head.active .code { color: var(--accent-text); font-weight: 600; }
.subgroup-head .chev { margin: 0 4px; }
.subgroup-head .code { font-family: var(--mono); font-size: calc(11.5px * var(--font-scale)); font-weight: 500; color: var(--text-3); min-width: 78px; }
.subgroup-head .title { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.ctrl-row {
  position: relative; display: flex; align-items: center; gap: 8px;
  min-height: 40px; padding: 0 16px 0 22px; cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: background 0.08s;
}
.ctrl-row:hover { background: var(--surface-hover); }
.ctrl-row.selected { background: var(--accent-soft); }
.ctrl-row.selected::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--accent);
}
.ctrl-row.dimmed .ctrl-title, .ctrl-row.dimmed .ctrl-id { opacity: 0.5; }
.ctrl-row.deleted .ctrl-title { text-decoration: line-through; }
.ctrl-toggle {
  width: 20px; height: 20px; border-radius: 4px; display: grid; place-items: center; flex-shrink: 0; color: var(--text-3);
}
.ctrl-toggle:hover { background: var(--border); color: var(--text); }
.ctrl-toggle-spacer { width: 20px; flex-shrink: 0; }
.ctrl-id { font-family: var(--mono); font-size: calc(12px * var(--font-scale)); font-weight: 500; color: var(--text-2); min-width: 78px; flex-shrink: 0; }
.ctrl-row.selected .ctrl-id { color: var(--accent-text); font-weight: 600; }
.ctrl-title { flex: 1; min-width: 0; font-size: calc(13px * var(--font-scale)); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text); }
.ctrl-meta { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
/* Listen-Markierungen in der Explorerliste: gleiche Farben wie Stern und Notizen-Punkt in der Detailansicht */
.list-mark { display: inline-flex; flex-shrink: 0; }
.list-mark svg { width: calc(14px * var(--font-scale)); height: calc(14px * var(--font-scale)); }
.star-mark svg { fill: var(--list-other); stroke: var(--list-other); }
.star-mark.star-here svg { fill: var(--star); stroke: var(--star-stroke); }
.note-mark { color: var(--list-other); }
.note-mark.note-here { color: var(--added); }

/* Aufwand als horizontaler, segmentierter Balken (Farbe per Inline-Style: grün = 0 … rot = Maximum) */
.effort-group { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 6px 12px; max-width: 100%; }
.effort-meter-btn,
.effort-text-btn { display: inline-flex; align-items: center; padding: 0; border: none; background: transparent; font: inherit; color: inherit; cursor: pointer; }
.effort-group:has(.effort-meter-btn:hover) .effort-value,
.effort-text-btn:hover .effort-value { color: var(--accent-text); }
.effort-group:has(.effort-meter-btn:hover) .effort-val-text,
.effort-text-btn:hover .effort-val-text { border-bottom-color: var(--accent); }
.effort-meter { display: inline-flex; gap: 3px; flex-shrink: 0; }
.effort-seg { width: 28px; height: 8px; border-radius: 2px; background: var(--border); transition: filter 0.1s; }
.effort-meter-btn:hover .effort-seg { filter: brightness(0.92); }
.effort-meter.sm { gap: 2px; margin-right: 2px; }
.effort-meter.sm .effort-seg { width: 7px; height: 6px; border-radius: 1px; }
.effort-label-group { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.effort-label-group .info-btn { margin: 0; }
.effort-value { font-size: calc(13.5px * var(--font-scale)); font-variant-numeric: tabular-nums; white-space: nowrap; }
.effort-val-text { border-bottom: 1px dashed var(--border-strong); }
.effort-value .muted { font-weight: 400; color: var(--text-3); }
.info-btn {
  display: inline-flex; align-items: center; justify-content: center; margin-left: 5px; vertical-align: middle;
  width: calc(12px * var(--font-scale)); height: calc(12px * var(--font-scale)); padding: 0; border: 0; border-radius: 50%; background: none;
  color: var(--icon-subtle); box-shadow: var(--shadow-sm); cursor: pointer; flex-shrink: 0;
}
.kv-value { display: inline-flex; align-items: flex-start; gap: 5px; max-width: 100%; }
.kv-value .info-btn { margin: 4px 0 0; flex-shrink: 0; }
.kv-value-list { display: flex; flex-wrap: wrap; gap: 2px 16px; }
/* Zielobjektkategorien: je Kategorie eine Zeile mit den übergeordneten Kategorien, gedämpft */
.kv-value-list.to-paths { flex-direction: column; gap: 6px; }
/* Reicht die Breite nicht, rutschen ganze Oberkategorien („‹ Nutzende“) in die nächste Zeile statt Wörter zu trennen */
.to-paths .kv-value { flex-wrap: wrap; row-gap: 0; }
.to-ancestor { display: inline-flex; flex: none; max-width: 100%; align-items: baseline; gap: 5px; color: var(--text-2); }
.to-sep { color: var(--text-3); }
/* Dezentes Blau mit mind. 3:1 Kontrast; Hover in Akzentfarbe, geöffnet in Akzent-Textfarbe */
.info-btn:hover { color: var(--accent); }
/* Info-Symbol: gefüllter Kreis mit ausgestanztem „i“ (mit Serifen), wächst mit der Schriftgröße */
.info-glyph { width: 100%; height: 100%; flex-shrink: 0; }
.info-btn.on { color: var(--accent-text); }
/* Schutzziele */
.st-head { display: flex; align-items: center; gap: 5px; }
.st-head .info-btn { margin: 0; }
/* Zwei Spalten, solange sie passen; die Mindestbreite wächst mit der Schriftgröße */
.st-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, calc(230px * var(--font-scale))), 1fr)); gap: 6px 24px; margin-top: 2px; }
.st-row { display: flex; align-items: center; gap: 10px; padding: 3px 0; font: inherit; color: inherit; text-align: left; cursor: pointer; }
.st-label { flex: 1; min-width: 0; font-size: calc(13.5px * var(--font-scale)); }
/* Label = Filterlink wie Handlung/Dokumentation */
.st-label > span { border-bottom: 1px dashed var(--border-strong); }
.st-row:hover .st-label > span { color: var(--accent-text); border-bottom-color: var(--accent); }
.st-dots { display: inline-flex; gap: 3px; }
.st-level { width: calc(72px * var(--font-scale)); white-space: nowrap; font-size: calc(12px * var(--font-scale)); color: var(--text-3); }
.st-dot { width: 9px; height: 9px; border-radius: 50%; border: 1.5px solid var(--border-strong); }
.st-dot.on { background: var(--accent); border-color: var(--accent); }
/* Farbabstufung nur an den Punkten: 2 = Akzentfarbe, 1 = abgeschwächt, 0 = leer */
.st-level-1 .st-dot.on { background: color-mix(in srgb, var(--accent) 45%, transparent); border-color: color-mix(in srgb, var(--accent) 45%, transparent); }
.st-badges { display: inline-flex; gap: 2px; }
.st-badge {
  display: inline-flex; align-items: center; justify-content: center; min-width: 16px; height: 16px; padding: 0 3px;
  border-radius: 4px; font-size: calc(10px * var(--font-scale)); font-weight: 700; background: var(--accent-soft); color: var(--accent-text);
}
.st-rail-row { display: flex; align-items: center; gap: 6px; padding: 3px 4px 3px 8px; font-size: calc(12.5px * var(--font-scale)); color: var(--text-2); }
.st-rail-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.st-chips { display: inline-flex; gap: 2px; flex-shrink: 0; }
.st-chip {
  display: inline-flex; align-items: center; gap: 3px; height: 22px; padding: 0 4px; border-radius: 5px;
  border: 1px solid var(--border); font: inherit; font-size: calc(11.5px * var(--font-scale)); cursor: pointer; color: var(--text-2);
}
.st-chip { width: 44px; justify-content: space-between; }
.st-chip:hover { border-color: var(--border-strong); color: var(--text); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.st-dots.sm { gap: 2px; }
.st-dots.sm { gap: 1px; }
.st-dots.sm .st-dot { width: 6px; height: 6px; border-width: 1.2px; }
.st-chip .st-chip-count { min-width: 3ch; text-align: right; font-size: calc(10.5px * var(--font-scale)); color: var(--text-3); font-variant-numeric: tabular-nums; }
.st-chip.is-empty { opacity: 0.45; }
.st-chip.is-included { background: var(--accent-soft); border-color: var(--accent-border); color: var(--accent-text); }
.st-chip.is-excluded { background: var(--exclude-soft); border-color: var(--exclude-border); color: var(--exclude); text-decoration: line-through; }

.kv-link { padding: 0; font: inherit; color: inherit; text-align: left; cursor: pointer; border-bottom: 1px dashed var(--border-strong); overflow-wrap: anywhere; word-break: break-word; }
.kv-link:hover { color: var(--accent-text); border-bottom-color: var(--accent); }
.kv-verb { font-weight: 700; letter-spacing: 0.03em; }
.kv-verb.muss { color: var(--muss); }
.kv-verb.sollte { color: var(--sollte); }
.kv-verb.kann { color: var(--kann); }
.rail-empty-note { font-size: calc(12px * var(--font-scale)); color: var(--text-3); padding: 4px 8px; margin: 0; }
.meta-num { display: inline-flex; align-items: center; gap: 3px; font-size: calc(11.5px * var(--font-scale)); color: var(--text-3); font-variant-numeric: tabular-nums; }
.meta-num.threat { color: var(--threat); }
.verb-label { font-size: calc(10.5px * var(--font-scale)); font-weight: 700; letter-spacing: 0.03em; width: 50px; text-align: right; }
.verb-label.muss { color: var(--muss); }
.verb-label.sollte { color: var(--sollte); }
.verb-label.kann { color: var(--kann); }

/* Unteranforderungen: Einrückung je Ebene (--depth = 1, 2, …) */
.ctrl-row.sub { padding-left: calc(22px + var(--depth, 1) * 20px); min-height: 36px; background: var(--surface-2); }
.ctrl-row.sub:hover { background: var(--surface-hover); }
.ctrl-row.sub.selected { background: var(--accent-soft); }
.ctrl-row.sub::after {
  content: ''; position: absolute; left: 13px; top: 0; bottom: 0; width: calc(var(--depth, 1) * 20px);
  background: repeating-linear-gradient(to right, transparent 0 19px, var(--border-strong) 19px 20px);
}
.ctrl-row.sub .ctrl-id { min-width: 90px; font-size: calc(11.5px * var(--font-scale)); }
.ctrl-row.sub .ctrl-title { font-size: calc(12.5px * var(--font-scale)); color: var(--text-2); }
.ctrl-row.sub.selected .ctrl-title { color: var(--text); }

.list-empty { padding: 56px 24px; text-align: center; color: var(--text-3); font-size: calc(13px * var(--font-scale)); }
.list-empty .icon { width: 28px; height: 28px; margin-bottom: 8px; }
.list-empty p + p { margin-top: 4px; }

/* Resizer */
.resizer { width: 1px; background: var(--border); position: relative; flex-shrink: 0; cursor: col-resize; touch-action: none; }
.resizer::after { content: ''; position: absolute; inset: 0 -5px; z-index: 5; }
.resizer:hover, .resizer.active { background: var(--accent); }
.resizer:focus-visible { outline: none; background: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }

/* Detail pane */
.detail-pane {
  flex: 0 1 auto;
  min-width: 280px;
  max-width: calc(100% - 281px);
  display: flex;
  flex-direction: column;
  background: var(--bg);
  min-height: 0;
  container-type: inline-size;
}

/* Hinweisbanner im Detailbereich, wenn die Auswahl links durch Filter ausgeblendet ist */
.detail-filtered-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 8px 24px;
  font-size: calc(12.5px * var(--font-scale));
  flex-shrink: 0;
  background: var(--sollte-soft);
  border-bottom: 1px solid var(--sollte-border);
  color: var(--sollte);
}
.detail-filtered-banner .icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  color: var(--sollte);
}
.detail-filtered-banner-text {
  flex: 1;
  min-width: 180px;
  line-height: 1.4;
  color: var(--sollte);
}
.detail-filtered-banner-text strong {
  font-weight: 600;
  color: var(--sollte);
}
.detail-filtered-banner-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.detail-head { padding: 18px 28px 0; background: var(--surface); border-bottom: 1px solid var(--border); flex-shrink: 0; }
.crumbs { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: calc(12px * var(--font-scale)); color: var(--text-3); margin-bottom: 16px; }
.crumbs button { background: none; border: none; padding: 0; font: inherit; color: var(--text-2); cursor: pointer; display: inline-flex; align-items: center; }
.crumbs button:hover { color: var(--accent-text); text-decoration: underline; }
.crumbs .crumb-current { color: var(--text); font-weight: 600; }
/* Wurzel der Pfadleiste: in der Katalogübersicht ein zugeklapptes Buch, darunter (Praktik, Anforderung) ein aufgeschlagenes */
.crumbs .crumb-home { width: calc(16px * var(--font-scale)); height: calc(16px * var(--font-scale)); display: block; color: var(--text-3); transition: color 0.12s; }
.crumbs button:hover .crumb-home { color: var(--accent-text); }
.crumbs .crumb-current { display: inline-flex; align-items: center; }
.detail-head.scope-head { padding-bottom: 18px; }
.crumbs .sep { opacity: 0.5; font-size: calc(13px * var(--font-scale)); line-height: 1; margin: 0 2px; user-select: none; }
.detail-titlebar { display: flex; align-items: flex-start; gap: 12px; }
.detail-titlebar .titles { flex: 1; min-width: 0; }
.detail-id { font-family: var(--mono); font-size: calc(13px * var(--font-scale)); font-weight: 600; color: var(--accent-text); }
.detail-title { font-size: calc(20px * var(--font-scale)); font-weight: 650; letter-spacing: -0.015em; line-height: 1.3; margin-top: 2px; }
.detail-nav { display: flex; gap: 2px; flex-shrink: 0; }
.detail-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 18px; }

.tabs { display: flex; gap: 20px; margin-top: 18px; overflow-x: auto; padding-bottom: 1px; margin-bottom: -1px; }
.tab {
  height: 38px; font-size: calc(13px * var(--font-scale)); font-weight: 500; color: var(--text-3); white-space: nowrap;
  border-bottom: 2px solid transparent; margin-bottom: -1px; display: inline-flex; align-items: center; gap: 6px;
}
.tab:hover { color: var(--text); }
.tab:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; border-radius: 4px 4px 0 0; }
.tab.on { color: var(--text); border-bottom-color: var(--accent); }
.tab .tab-count { font-size: calc(11px * var(--font-scale)); padding: 0 6px; height: 17px; line-height: 17px; border-radius: 9px; background: var(--surface-hover); color: var(--text-2); }

.detail-body { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 24px 28px 48px; min-height: 0; }
.stack { display: grid; gap: 20px; }
.stack > * { min-width: 0; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); }
.card-pad { padding: 18px 20px; }
.card-head {
  display: flex; align-items: center; gap: 8px; padding: 11px 20px;
  background: var(--surface-2); border-bottom: 1px solid var(--border);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}
/* Karte ohne Inhalt (z. B. keine Gefährdungen zugeordnet): keine Trennlinie unter der Kopfzeile */
.card-head:last-child { border-bottom: 0; border-radius: var(--radius-lg); }
.card-head h3,
.card-head h4 { font-size: calc(13px * var(--font-scale)); font-weight: 600; color: var(--text); flex: 1; letter-spacing: -0.01em; }
.card-head .hint { font-size: calc(12px * var(--font-scale)); color: var(--text-3); font-weight: 400; }
/* Katalogübersicht: Beteiligte, Verweise, frühere Fassungen */
.meta-party { display: flex; flex-wrap: wrap; gap: 4px 12px; }
.meta-links { list-style: none; margin: 0; padding: 4px 20px 12px; display: grid; gap: 8px; font-size: calc(13.5px * var(--font-scale)); }
.meta-rel { margin-left: 8px; font-size: calc(11.5px * var(--font-scale)); color: var(--text-3); }
.meta-remarks { margin: 2px 0 0; font-size: calc(12.5px * var(--font-scale)); color: var(--text-2); }
.section-label { font-size: calc(11px * var(--font-scale)); font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-3); margin-bottom: 8px; }

.statement {
  position: relative; padding: 18px 20px 18px 22px;
  font-size: calc(15.5px * var(--font-scale)); line-height: 1.7; color: var(--text);
  border-left: 3px solid var(--border-strong);
  border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
  white-space: pre-line;
}
.statement.muss { border-left-color: var(--muss); }
.statement.sollte { border-left-color: var(--sollte); }
.statement.kann { border-left-color: var(--kann); }
.statement mark { background: none; font-weight: 700; padding: 0 1px; }
.statement mark.muss { color: var(--muss); }
.statement mark.sollte { color: var(--sollte); }
.statement mark.kann { color: var(--kann); }


.kv-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.kv { padding: 14px 20px; border-top: 1px solid var(--border); }
.kv:nth-child(-n + 2) { border-top: 0; }
.kv:nth-child(odd) { border-right: 1px solid var(--border); }
.kv.full { grid-column: 1 / -1; border-right: 0; }
/* Beginnt das Raster mit einer ganzen Zeile, steht schon der zweite Eintrag in einer neuen Zeile */
.kv.full:first-child + .kv { border-top: 1px solid var(--border); }
.kv.full:first-child + .kv:not(.full) { border-right: 1px solid var(--border); }
.kv.full:first-child + .kv:not(.full) + .kv { border-right: 0; }
.kv dt { font-size: calc(11.5px * var(--font-scale)); color: var(--text-3); margin-bottom: 3px; }
.kv dd { margin: 0; font-size: calc(13.5px * var(--font-scale)); color: var(--text); }
.kv dd.muted { color: var(--text-3); }

/* Schmaler Detailbereich (z. B. auf kleinen Bildschirmen oder bei 30 % Breite): Felder wie Aufwand und Dokumentation einspaltig untereinander */
@container (max-width: 500px) {
  .kv-grid { grid-template-columns: 1fr; }
  .kv-grid > .kv { border-right: 0 !important; border-top: 1px solid var(--border) !important; }
  .kv-grid > .kv:first-child { border-top: 0 !important; }
}
@container (max-width: 440px) {
  .detail-head, .detail-body, .detail-filtered-banner, .detail-callout {
    padding-left: 16px;
    padding-right: 16px;
  }
}

/* Tags in Detailansicht */
.tag-chip-group { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.tag-item {
  display: inline-flex; align-items: center;
  background: var(--btn-bg); border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  border-radius: var(--radius-sm); font-size: calc(12px * var(--font-scale)); color: var(--text-2);
  transition: all 0.12s ease;
}
.tag-item:hover {
  background: var(--btn-bg-hover);
  border-color: var(--border-strong);
  color: var(--text);
}
.tag-item.active {
  background: var(--accent-soft); border-color: var(--accent-border);
  color: var(--accent-text); font-weight: 600;
  box-shadow: var(--shadow-sm);
}
.tag-item.active:hover {
  border-color: var(--accent);
}
.tag-item-btn {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 8px; font: inherit; color: inherit;
  cursor: pointer; background: transparent; border: none;
}
.tag-item-btn:hover { color: var(--accent-text); }
.icon-tag-filter { width: 12px; height: 12px; flex-shrink: 0; opacity: 0.65; }
.tag-item.active .icon-tag-filter { opacity: 1; }
.tag-item .info-btn { margin: 0 7px 0 0; }
/* Tag mit Info-Symbol: Symbol dicht am Text */
.tag-item-btn:has(+ .info-btn) { padding-right: 4px; }

.sub-list,
.threat-list {
  padding: 6px 8px 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.sub-item {
  width: 100%; display: flex; align-items: center; gap: 10px;
  padding: 8px 12px; text-align: left;
  border-radius: var(--radius-sm);
  transition: background 0.1s ease;
}
.sub-item:hover { background: var(--surface-hover); }
.sub-item:hover .mono { color: var(--accent-text); }
.scope-counts { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; }
.scope-counts > span:not(.tag) { display: inline-flex; align-items: center; gap: 6px; font-variant-numeric: tabular-nums; }
.sub-item .mono {
  font-family: var(--mono);
  font-size: calc(12px * var(--font-scale));
  font-weight: 500;
  color: var(--text-2);
  min-width: 86px;
  flex-shrink: 0;
}
.sub-item .grow {
  flex: 1; min-width: 0;
  font-size: calc(13px * var(--font-scale));
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.threat-item {
  width: 100%; display: flex; align-items: center; gap: 10px;
  padding: 8px 12px; text-align: left;
  border-radius: var(--radius-sm);
  transition: background 0.1s ease;
}
.threat-item:hover { background: var(--surface-hover); }
.threat-item:hover .threat-code { color: var(--accent-text); }
.threat-code {
  font-family: var(--mono); font-size: calc(12px * var(--font-scale));
  font-weight: 600; color: var(--threat); min-width: 52px; flex-shrink: 0;
  transition: color 0.1s ease;
}
.threat-title { flex: 1; min-width: 0; font-size: calc(13px * var(--font-scale)); }
.threat-item.active { background: var(--accent-soft); }
.threat-item.active .threat-code { color: var(--accent-text); }
.threat-item.is-excluded { background: var(--exclude-soft); }
.threat-item.is-excluded .threat-code { color: var(--exclude); }
.threat-item.is-excluded .threat-title { text-decoration: line-through; opacity: 0.8; }

.empty-note { padding: 16px 20px; font-size: calc(13px * var(--font-scale)); color: var(--text-2); }
.empty-note p + p { margin-top: 6px; color: var(--text-3); }
.pill-links { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }

/* Sub-Kategorien (z. B. verknüpfte Anforderungen) */
.sub-block { padding: 0 0 6px; margin-top: 8px; }
.sub-block:last-child { margin-bottom: 4px; }
.sub-block .sub-list { padding: 0 8px; }
.sub-head {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 12px; margin: 0 8px 4px;
  background: var(--subhead-bg);
  border-radius: var(--radius-sm);
  font-size: calc(11px * var(--font-scale));
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-2);
}
.sub-head .hint {
  margin-left: auto;
  font-size: calc(11px * var(--font-scale));
  color: var(--text-3);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  text-transform: none;
}

.prose { font-size: calc(14.5px * var(--font-scale)); line-height: 1.75; color: var(--text); white-space: pre-line; }
.muted-note { font-size: calc(13px * var(--font-scale)); color: var(--text-3); font-style: italic; }

.diff-status { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.change-list { display: grid; gap: 8px; font-size: calc(13px * var(--font-scale)); }
.change-list li { display: grid; gap: 2px; }
.change-list .old { color: var(--muss); text-decoration: line-through; }
.change-list .new { color: var(--added); }
.change-list .muted { color: var(--text-3); }
.diff-note { margin: 0 0 12px; font-size: calc(13px * var(--font-scale)); color: var(--text-2); }
.diff-text { padding: 14px 16px; border-radius: var(--radius); background: var(--surface-2); border: 1px solid var(--border); font-size: calc(14px * var(--font-scale)); line-height: 1.7; }
.diff-text.scroll { max-height: 320px; overflow-y: auto; font-size: calc(13px * var(--font-scale)); }
.tok-add { background: var(--added-soft); color: var(--added); border-radius: 3px; padding: 0 2px; }
.tok-del { background: var(--muss-soft); color: var(--muss); text-decoration: line-through; border-radius: 3px; padding: 0 2px; }

/* UUID am Ende der Übersicht: 8px darüber (statt 20px Abstand der .stack), darunter derselbe Innenabstand wie oben (24px statt 48px) */
.detail-uuid { margin: -12px 0 0; line-height: 1.2; text-align: right; font-size: calc(10.5px * var(--font-scale)); color: var(--text-faint); word-break: break-all; }
.detail-body:has(.detail-uuid) { padding-bottom: 24px; }

/* Erläuterungs-Callout (GitHub Callout Style) am unteren Rand des Detailbereichs;
   der Wrapper ist immer da (Live-Region) und ohne Callout 0 px hoch */
.detail-callout-slot { flex-shrink: 0; }
.detail-callout {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 12px 24px;
  background: var(--surface-2);
  border-top: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  box-shadow: 0 -2px 10px rgba(16, 24, 40, 0.05);
  flex-shrink: 0;
  max-height: 220px;
  overflow-y: auto;
  position: relative;
  animation: calloutSlideUp 0.16s ease-out;
}
@keyframes calloutSlideUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.detail-callout-icon {
  color: var(--accent);
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  margin-top: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.detail-callout-icon .info-glyph {
  width: 18px;
  height: 18px;
}
.detail-callout-main {
  flex: 1;
  min-width: 0;
}
.detail-callout-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
}
.detail-callout-title {
  margin: 0;
  font-size: calc(13px * var(--font-scale));
  font-weight: 600;
  color: var(--accent-text);
  line-height: 1.35;
}
.detail-callout-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text-3);
  border-radius: var(--radius-sm);
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.12s ease;
}
.detail-callout-close:hover {
  background: var(--surface-hover);
  color: var(--text);
}
.detail-callout-close svg {
  width: 14px;
  height: 14px;
}
.detail-callout-body {
  font-size: calc(12.5px * var(--font-scale));
  line-height: 1.55;
  color: var(--text-2);
  white-space: pre-line;
}
.detail-callout-body p {
  margin: 0 0 6px;
}
.detail-callout-body p:last-child {
  margin-bottom: 0;
}
.callout-lead {
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}
.callout-st-list {
  margin: 4px 0 8px;
  padding-left: 0;
  list-style: none;
  display: grid;
  gap: 3px;
  white-space: normal;
}
.callout-st-list:last-child {
  margin-bottom: 0;
}
.callout-st-list li {
  font-size: calc(12px * var(--font-scale));
  color: var(--text-2);
}
.callout-st-list strong {
  color: var(--text);
  font-weight: 600;
}
.callout-meta {
  font-size: calc(11.5px * var(--font-scale));
  color: var(--text-3);
  font-style: italic;
  margin-top: 6px;
}


/* ---------- Full-screen states ---------- */
.center-state { flex: 1; display: grid; place-items: center; padding: 24px; }
.loading-state { display: flex; align-items: center; gap: 12px; color: var(--text-2); font-size: calc(13px * var(--font-scale)); }
.loading-state .spinner { color: var(--accent); }
/* Startseite */
.center-state:has(.welcome) { place-items: start center; overflow-y: auto; padding: 0 16px; }
.welcome { width: 100%; max-width: 880px; padding: 56px 0 40px; }
.welcome-hero {
  position: relative; text-align: center; padding: 8px 0 0;
}
.welcome-hero::before {
  content: ''; position: absolute; z-index: 0; left: 50%; top: -40px; width: min(720px, 100%); height: 360px; transform: translateX(-50%);
  background: radial-gradient(closest-side, var(--accent-soft), transparent); pointer-events: none;
}
.welcome-hero > * { position: relative; z-index: 1; }
.welcome-logo { display: block; width: 112px; height: 112px; margin: 0 auto 20px; filter: drop-shadow(0 8px 18px rgba(16, 24, 40, 0.18)); }
.welcome-title { margin: 0; font-size: calc(34px * var(--font-scale)); font-weight: 700; letter-spacing: -0.025em; line-height: 1.15; color: var(--text); }
.welcome-meta {
  display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 2px 0; margin-top: 10px;
  font-size: calc(13px * var(--font-scale)); color: var(--text-3); font-variant-numeric: tabular-nums;
}
.welcome-sep { margin: 0 10px; color: var(--border-strong); }
.link-inline { padding: 0; font: inherit; color: var(--accent-text); text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }
.welcome-lead {
  max-width: 560px; margin: 22px auto 0;
  font-size: calc(17px * var(--font-scale)); line-height: 1.55; color: var(--text-2);
}
.welcome-cta {
  height: auto; min-height: 50px; margin-top: 30px; padding: 0 30px; border-radius: 10px;
  font-size: calc(15.5px * var(--font-scale)); font-weight: 600; gap: 10px; box-shadow: var(--shadow-md);
}
.welcome-cta .icon { width: 19px; height: 19px; }
.welcome-disclaimer {
  max-width: 520px; margin: 26px auto 0;
  font-size: calc(12.5px * var(--font-scale)); line-height: 1.55; color: var(--text-3);
}
.welcome-features {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, calc(230px * var(--font-scale))), 1fr)); gap: 16px;
  margin-top: 52px;
}
.feature {
  padding: 22px 22px 20px; text-align: left;
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow-sm);
}
.feature-icon {
  display: grid; place-items: center; width: 40px; height: 40px; margin-bottom: 14px;
  border-radius: 10px; background: var(--accent-soft); color: var(--accent-text);
}
.feature-icon svg { width: 21px; height: 21px; }
.feature h2 { margin: 0 0 6px; font-size: calc(14.5px * var(--font-scale)); font-weight: 650; color: var(--text); }
.feature p { margin: 0; font-size: calc(13px * var(--font-scale)); line-height: 1.6; color: var(--text-2); }
.feature a { color: var(--accent-text); text-decoration: underline; text-underline-offset: 2px; }
.welcome-more { margin: 22px 0 0; text-align: center; font-size: calc(13px * var(--font-scale)); }
@media (max-width: 560px) {
  .welcome { padding-top: 32px; }
  .welcome-title { font-size: calc(26px * var(--font-scale)); }
  .welcome-lead { font-size: calc(15px * var(--font-scale)); }
  .welcome-cta { width: 100%; justify-content: center; }
}

/* ---------- Modal (natives <dialog>, geöffnet per showModal) ---------- */
dialog.modal { width: calc(100% - 32px); margin: auto; padding: 0; color: var(--text); }
dialog.modal:not([open]) { display: none; }
dialog.modal::backdrop { background: rgba(16, 24, 40, 0.45); background: var(--overlay); backdrop-filter: blur(3px); animation: fade 0.12s ease-out; }
.modal {
  width: 100%; max-width: 560px; max-height: 88vh; display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow-lg);
  animation: pop 0.14s ease-out;
}
.modal.wide { max-width: 680px; }
.modal-head { display: flex; align-items: center; gap: 12px; padding: 18px 20px 0; }
.modal-head h2 { font-size: calc(16px * var(--font-scale)); font-weight: 650; flex: 1; }
.modal-head p { font-size: calc(13px * var(--font-scale)); color: var(--text-3); margin-top: 2px; }
.modal-tabs { padding: 0 20px; border-bottom: 1px solid var(--border); display: flex; gap: 20px; margin-top: 12px; }
.modal-body { padding: 20px; overflow-y: auto; display: grid; gap: 14px; }
.modal-foot { padding: 12px 20px; border-top: 1px solid var(--border); display: flex; align-items: center; gap: 8px; }
.modal-foot .spacer { flex: 1; }
/* Bestätigungsdialog */
.confirm-dialog { max-width: 440px; }
.confirm-dialog form { display: flex; flex-direction: column; min-height: 0; }
.confirm-dialog .modal-body { gap: 8px; }
.confirm-message { margin: 0; font-size: calc(13.5px * var(--font-scale)); line-height: 1.5; color: var(--text-2); }
.confirm-hint { margin: 0; font-size: calc(12.5px * var(--font-scale)); line-height: 1.5; color: var(--text-3); }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(6px) scale(0.985); } }

.alert { padding: 10px 12px; border-radius: var(--radius); font-size: calc(13px * var(--font-scale)); }
.alert-error { background: var(--muss-soft); color: var(--muss); border: 1px solid var(--muss-border); }
.alert-success { background: var(--added-soft); color: var(--added); border: 1px solid var(--added-border); }
/* Meldung im Dialog "Katalog laden": rot, ohne Rahmen, direkt über der Fußzeile */
.welcome-error {
  max-width: 560px; margin: 0 auto 20px; padding: 10px 14px; border-radius: var(--radius);
  background: var(--muss-soft); border: 1px solid var(--muss-border); color: var(--text);
  font-size: calc(13.5px * var(--font-scale)); line-height: 1.5; text-align: left;
}
.load-msg { margin: 0; color: var(--muss); font-size: calc(13px * var(--font-scale)); line-height: 1.45; }

.check-card { display: flex; gap: 12px; padding: 12px 14px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface-2); cursor: pointer; }
.check-card input { margin-top: 3px; accent-color: var(--accent); width: 15px; height: 15px; }
.check-card strong { font-size: calc(13px * var(--font-scale)); font-weight: 600; display: block; }
.check-card span { font-size: calc(12.5px * var(--font-scale)); color: var(--text-3); }

.option-card { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-radius: var(--radius); border: 1px solid var(--border); }
.option-card .opt-icon { width: 36px; height: 36px; border-radius: 9px; display: grid; place-items: center; flex-shrink: 0; }
.option-card .grow { flex: 1; min-width: 0; }
.option-card h3 { font-size: calc(13.5px * var(--font-scale)); font-weight: 600; }
.option-card p { font-size: calc(12.5px * var(--font-scale)); color: var(--text-3); margin-top: 1px; }

.field-label { font-size: calc(12.5px * var(--font-scale)); font-weight: 500; color: var(--text-2); margin-bottom: 6px; display: block; }
.input {
  width: 100%; height: 36px; padding: 0 12px; border-radius: var(--radius);
  border: 1px solid var(--border); background: var(--surface); color: var(--text); font-size: calc(13px * var(--font-scale));
}
.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.input-row { display: flex; gap: 8px; }

.dropzone {
  border: 1.5px dashed var(--border-strong); border-radius: var(--radius-lg); padding: 36px 20px; text-align: center; cursor: pointer;
  background: var(--surface-2); transition: border-color 0.12s, background 0.12s;
}
.dropzone:hover, .dropzone.over { border-color: var(--accent); background: var(--accent-soft); }
.dropzone .icon { width: 26px; height: 26px; color: var(--text-3); margin-bottom: 8px; }
.dropzone strong { display: block; font-size: calc(13.5px * var(--font-scale)); font-weight: 600; }
.dropzone span { font-size: calc(12.5px * var(--font-scale)); color: var(--text-3); }

.version-item { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius); }
.version-item.is-base { border-color: var(--accent-border); background: var(--accent-soft); }
.version-item.is-comp { border-color: var(--sollte-border); background: var(--sollte-soft); }
.version-item .grow { flex: 1; min-width: 0; }
.version-item h3 { font-size: calc(13.5px * var(--font-scale)); font-weight: 600; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.version-item p { font-size: calc(12px * var(--font-scale)); color: var(--text-3); margin-top: 2px; }
.version-item .acts { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }
.version-item .btn { height: 28px; padding: 0 10px; font-size: calc(12px * var(--font-scale)); }
/* Dialog "Kataloge": je Zeile ein Auswahlknopf "Anzeigen" (blau) und "Vergleich" (gelb), wie die Listen in der Filterleiste */
.cat-grid-head {
  display: flex; gap: 12px; padding: 0 15px 2px;
  font-size: calc(11px * var(--font-scale)); font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-3);
}
.cat-grid-head > span, .cat-radio-cell { width: calc(64px * var(--font-scale)); flex-shrink: 0; text-align: center; }
.cat-grid-head > span:last-child { width: auto; text-align: left; }
.cat-radio-cell { display: inline-flex; justify-content: center; }
.cat-radio { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: 50%; }
.cat-radio-dot {
  width: 14px; height: 14px; border-radius: 50%;
  border: 1.5px solid var(--border-strong); background: var(--surface);
  transition: background 0.12s, border-color 0.12s;
}
.cat-radio:hover:not(:disabled) .cat-radio-dot { border-color: var(--accent); }
.cat-radio[aria-pressed="true"] .cat-radio-dot { border-color: var(--accent); background: var(--accent); box-shadow: inset 0 0 0 2.5px var(--surface); }
.cat-radio.is-comp:hover:not(:disabled) .cat-radio-dot { border-color: var(--sollte); }
.cat-radio.is-comp[aria-pressed="true"] .cat-radio-dot { border-color: var(--sollte); background: var(--sollte); }
.cat-radio:disabled { opacity: 0.35; }
.cat-radio:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.cat-hint { margin: 4px 2px 0; font-size: calc(12px * var(--font-scale)); color: var(--text-3); line-height: 1.5; }
.empty-box { text-align: center; padding: 32px; color: var(--text-3); font-size: calc(13px * var(--font-scale)); }

/* ---------- Footer ---------- */
.app-footer {
  min-height: 34px;
  padding: 4px 16px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: var(--surface);
  border-top: 1px solid var(--border);
  font-size: calc(12px * var(--font-scale));
  color: var(--text-3);
  z-index: 10;
}
.app-footer .footer-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
}
.app-footer .footer-version { color: var(--text-2); font-variant-numeric: tabular-nums; }
/* Reicht der Platz nicht, entfallen links nacheinander App-Name, Version und Projektlink (siehe updateFooterCompact) */
.app-footer .footer-left[data-hide="1"] .footer-hide-1,
.app-footer .footer-left[data-hide="2"] :is(.footer-hide-1, .footer-hide-2),
.app-footer .footer-left[data-hide="3"] :is(.footer-hide-1, .footer-hide-2, .footer-hide-3) { display: none; }
.app-footer .footer-brand {
  font-weight: 600;
  color: var(--text-2);
}
.app-footer .footer-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  margin-left: auto;
  white-space: nowrap;
}
.app-footer .footer-link {
  color: var(--text-2);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.12s;
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
  font-size: calc(12px * var(--font-scale));
  display: inline-flex;
  align-items: center;
}
.app-footer .footer-link:hover {
  color: var(--accent-text);
  text-decoration: underline;
}
.app-footer .footer-sep {
  color: var(--border-strong);
  user-select: none;
  opacity: 0.6;
}

/* ---------- Responsive ---------- */
.only-narrow { display: none; }
.rail-toggle .rail-active-badge { margin-left: 2px; }
@media (max-width: 980px) {
  /* Filterleiste als Drawer von links, geöffnet über den Button "Filter" */
  .rail {
    position: fixed; top: 0; bottom: 0; left: 0; z-index: 45;
    width: min(calc(300px * var(--font-scale)), 88vw); box-shadow: var(--shadow-lg);
    transform: translateX(-100%); visibility: hidden;
    transition: transform 0.18s ease-out, visibility 0s linear 0.18s;
  }
  .rail.open { transform: none; visibility: visible; transition: transform 0.18s ease-out; }
  .rail-backdrop { position: fixed; inset: 0; z-index: 44; background: var(--overlay); animation: fade 0.12s ease-out; }
  .only-narrow { display: inline-flex; }
  .topbar { grid-template-columns: auto minmax(200px, 1fr) auto; }
  .brand-sub { display: none; }
}
@media (max-width: 860px) {
  .split { flex-direction: column; overflow-y: auto; }
  .list-pane { min-width: 0; flex: none; height: 55vh; }
  .resizer { display: none; }
  .detail-pane { width: 100% !important; min-width: 0; max-width: none; flex: none; }
  .detail-body { overflow: visible; }
  .topbar { grid-template-columns: auto 1fr auto; gap: 8px; padding: 0 12px; }
  .brand-text, .hide-sm, .search-end .kbd { display: none; }
  .detail-head, .detail-body, .detail-filtered-banner, .detail-callout { padding-left: 16px; padding-right: 16px; }
  .detail-callout-slot { position: sticky; bottom: 0; z-index: 10; }
  .kv-grid { grid-template-columns: 1fr; }
  .kv-grid > .kv { border-right: 0 !important; border-top: 1px solid var(--border) !important; }
  .kv-grid > .kv:first-child { border-top: 0 !important; }
  .ctrl-meta .meta-num { display: none; }
  .app-footer { padding: 4px 10px; }
  .app-footer .footer-right { gap: 8px; }
}

/* Schriftgröße (Header) */
.hdr-group { display: inline-flex; overflow: hidden; }
.font-size-group button {
  display: inline-flex; align-items: flex-end; justify-content: center; width: 30px; height: 100%; padding: 0 0 8px;
  font-weight: 600; line-height: 1; color: var(--text-3); cursor: pointer;
}
.hdr-group button + button { border-left: 1px solid var(--border); }
.hdr-group button:hover { background: var(--surface-hover); color: var(--text); }
.hdr-group button.on { background: var(--accent-soft); color: var(--accent-text); }
/* Die Buchstaben selbst bleiben unabhängig vom gewählten Faktor gleich groß */
.font-size-group .fs-1 { font-size: 12px; }
.font-size-group .fs-2 { font-size: 15px; }
.font-size-group .fs-3 { font-size: 18px; }

/* Header: einheitliche Steuerelemente (Suchfeld, Buttons, Schriftgrößen-Gruppe) */
.topbar { --hdr-h: 36px; }
.search input,
.topbar-actions > .btn,
.topbar-actions > .icon-btn,
.topbar .hdr-group {
  height: var(--hdr-h); border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); box-shadow: var(--shadow-sm);
}
.topbar-actions > .btn,
.topbar-actions > .icon-btn,
.topbar .hdr-group { background: var(--btn-bg); }
.topbar-actions > .btn { padding: 0 12px; font-weight: 500; color: var(--text-2); }
.topbar-actions > .icon-btn { width: var(--hdr-h); color: var(--text-2); }
.topbar-actions > .btn:hover:not(:disabled),
.topbar-actions > .icon-btn:hover:not(:disabled),
.search input:hover:not(:focus):not(:disabled) { background: var(--surface-hover); border-color: var(--border-strong); color: var(--text); }
.topbar-actions > .btn:hover:not(:disabled),
.topbar-actions > .icon-btn:hover:not(:disabled) { background: var(--btn-bg-hover); }
.topbar .hdr-group:hover { border-color: var(--border-strong); }
.topbar-actions > .btn:focus-visible,
.topbar-actions > .icon-btn:focus-visible,
.hdr-group button:focus-visible { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.hdr-group button:focus-visible { position: relative; z-index: 1; }

/* Darstellungs-Gruppe (Hell/Dunkel, Kontrast) */
.display-group button { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 100%; color: var(--text-2); cursor: pointer; }

/* ============ Hoher Kontrast ============
   Alle Textfarben mindestens 7:1 (WCAG AAA), Rahmen mindestens 3:1 gegen den Hintergrund */
.hc {
  --list-other: var(--text-3);
  --btn-bg: var(--surface);
  --btn-bg-hover: var(--surface-hover);
  --star: #f5b301;
  --star-stroke: #7a4304;
  --bg: #ffffff;
  --surface: #ffffff;
  --surface-2: #ffffff;
  --surface-hover: #eaecf0;
  --border: #667085;
  --border-strong: #344054;
  --text: #000000;
  --text-2: #1d2939;
  --text-3: #344054;
  --icon-subtle: #1a3fa0;

  --accent: #1a3fa0;
  --accent-hover: #142f78;
  --accent-soft: #dce6ff;
  --accent-border: #1a3fa0;
  --accent-text: #1a3fa0;

  /* Auch auf der Auswahlfläche (--accent-soft) mindestens 7:1 */
  --muss: #901a11;
  --muss-border: #901a11;
  --sollte: #6f3d04;
  --sollte-border: #6f3d04;
  --kann: #07515f;
  --kann-border: #07515f;
  --added: #045534;
  --added-border: #045534;
  --threat: #803105;

  --exclude: #901a11;
  --exclude-hover: #901a11;
  --exclude-soft: #fef3f2;
  --exclude-border: #901a11;
  --exclude-text: #901a11;
}
.dark.hc {
  --star: #ffd27a;
  --star-stroke: #ffd27a;
  --bg: #000000;
  --surface: #000000;
  --surface-2: #0a0c10;
  --surface-hover: #1d2129;
  --border: #8a94a6;
  --border-strong: #c0c6d1;
  --text: #ffffff;
  --text-2: #e4e7ec;
  --text-3: #c0c6d1;
  --icon-subtle: #8fb3ff;

  --accent: #8fb3ff;
  --accent-hover: #b3cbff;
  --accent-soft: rgba(143, 179, 255, 0.22);
  --accent-border: #8fb3ff;
  --accent-text: #b3cbff;

  --muss: #ffa39c;
  --muss-border: #ffa39c;
  --sollte: #ffd27a;
  --sollte-border: #ffd27a;
  --kann: #7ae6f5;
  --kann-border: #7ae6f5;
  --added: #7eeab8;
  --added-border: #7eeab8;
  --threat: #ffbf85;

  --exclude: #ffa39c;
  --exclude-hover: #ffa39c;
  --exclude-soft: rgba(255, 163, 156, 0.22);
  --exclude-border: #ffa39c;
  --exclude-text: #ffa39c;
}
/* Abgeschwächte Darstellungen weniger stark ausblenden */
.hc .rail-row.is-empty,
.hc .st-chip.is-empty { opacity: 0.7; }
.hc .ctrl-row.dimmed .ctrl-title,
.hc .ctrl-row.dimmed .ctrl-id { opacity: 0.75; }
.hc .rail-row.is-excluded .rail-row-label,
.hc .threat-item.is-excluded .threat-title,
.hc .crumbs .sep,
.hc .icon-tag-filter { opacity: 1; }
.hc button:disabled { opacity: 0.7; }
.hc .sub-head { outline: 1px solid var(--border-strong); }
/* Deutlicher Tastaturfokus */
.hc :focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
/* Gestrichelte Filterlinks durchgezogen und kräftiger */
.hc .kv-link, .hc .st-label > span, .hc .effort-val-text { border-bottom-style: solid; border-bottom-color: var(--text-3); }
/* Schrift auf farbigen Flächen: im dunklen Design sind die Flächen hell, daher dunkle Schrift */
.dark .btn-primary,
.dark .chip-mode-badge.badge-include,
.dark .chip-mode-badge.badge-search { color: #0c0e13; }
.dark.hc .btn-primary,
.dark.hc .chip-mode-badge.badge-include,
.dark.hc .chip-mode-badge.badge-search { color: #000000; }
/* Aufwand: leere Segmente nur als Umriss, damit sie nicht wie gefüllte aussehen */
.hc .effort-seg { background: transparent; box-shadow: inset 0 0 0 1px var(--border); }

/* Lizenz-Dialog */
.license-body { gap: 16px; font-size: calc(13.5px * var(--font-scale)); line-height: 1.6; color: var(--text-2); }
.license-body h3 { font-size: calc(14px * var(--font-scale)); font-weight: 650; color: var(--text); margin: 0 0 6px; }
.license-note { margin: 0; color: var(--text-3); font-size: calc(12.5px * var(--font-scale)); }
.license-text {
  margin: 0; padding: 14px 16px; max-height: 320px; overflow: auto;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius);
  font-family: var(--mono); font-size: calc(12px * var(--font-scale)); line-height: 1.55; color: var(--text);
  white-space: pre-wrap;
}
.license-list { margin: 0; padding-left: 18px; list-style: disc; display: grid; gap: 6px; }
.license-list a { color: var(--accent-text); text-decoration: underline; }

/* Impressum und Datenschutz */
.legal-body { gap: 16px; font-size: calc(13.5px * var(--font-scale)); line-height: 1.6; color: var(--text-2); }
.legal-body h3 { font-size: calc(14px * var(--font-scale)); font-weight: 650; color: var(--text); margin: 0 0 4px; }
.legal-body p { margin: 0; }
.legal-body p + p, .legal-body ul + p { margin-top: 8px; }
.legal-body ul { margin: 6px 0 0; padding-left: 18px; list-style: disc; display: grid; gap: 4px; }
.legal-body a { color: var(--accent-text); text-decoration: underline; }

/* Dialog "Katalog laden" */
.load-body { gap: 16px; }
.load-divider { display: flex; align-items: center; gap: 10px; color: var(--text-3); font-size: calc(12px * var(--font-scale)); }
.load-divider::before, .load-divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.dropzone.compact { padding: 14px 16px; display: flex; align-items: center; justify-content: center; gap: 10px; }
.dropzone.compact strong { display: inline; }
.dropzone.selected { border-style: solid; border-color: var(--accent-border); background: var(--accent-soft); color: var(--accent-text); }
.load-body .field-label { display: block; }
.dropzone.compact .icon { width: 20px; height: 20px; margin-bottom: 0; }

/* Button "Offiziellen BSI Grundschutz++ Anwenderkatalog laden" mit Quelle darunter */
.official-btn { height: auto; min-height: 42px; padding-top: 8px; padding-bottom: 8px; white-space: normal; }
/* Primärer Weg: in Akzentfarbe getönt, aber schwächer als der gefüllte Button "Laden" */
.official-btn { background: var(--accent-soft); border-color: var(--accent-border); }
.official-btn:hover:not(:disabled) { background: var(--accent-soft); border-color: var(--accent); }
.official-btn > .icon, .official-btn-text > span { color: var(--accent-text); }
.official-btn-text small { color: var(--text-2); }
.official-btn-text { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; min-width: 0; text-align: left; }
.official-btn-text small { font-size: calc(11px * var(--font-scale)); font-weight: 400; opacity: 0.85; word-break: break-all; line-height: 1.35; }
