/* ISMS Grundschutz – sachliche Fachanwendung. Neutrale Grautöne, eine Akzentfarbe (gedecktes Blau).
   Hell als Standard, Dunkel als ruhige Variante. Keine externen Fonts/CDNs (CSP: style-src 'self').
   Farben ausschließlich über Variablen. */
:root {
  --bg: #f3f4f6; --panel: #ffffff; --panel-2: #f6f7f9; --panel-3: #e9ecf0;
  --text: #1c232c; --muted: #545f6c; --line: #d8dce2; --line-strong: #aeb6c1;
  --brand: #1f4e79; --brand-ink: #ffffff; --brand-soft: #e8eef5; --focus: #1f4e79;
  --ok: #2b6a3d; --ok-soft: #e6f0e8; --warn: #7a5200; --warn-soft: #f6eed9; --bad: #9b2b24; --bad-soft: #f5e4e2;
  --s1: #2b6a3d; --s1-soft: #e6f0e8; --s2: #7a5200; --s2-soft: #f6eed9; --s3: #9b2b24; --s3-soft: #f5e4e2;
  --nav-bg: #e9ecf0; --nav-text: #1c232c; --nav-muted: #545f6c; --nav-line: #cdd2d9; --nav-hover: #dde1e7; --nav-active: #ffffff; --nav-active-text: #1c232c; --nav-accent: #1f4e79;
  --radius: 4px; --radius-sm: 3px;
  --shadow: none; --shadow-lg: 0 6px 20px rgba(0, 0, 0, .18);
  --font: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --mono: Consolas, "Cascadia Mono", "SFMono-Regular", Menlo, monospace;
  --heat0: #f1f2f4; --heat1: #cfe3d3; --heat2: #efe0a8; --heat3: #f0be8e; --heat4: #de938b; --heat-ink: #1c232c;
  --b-ok: #3d8b57; --b-warn: #c08a12; --b-bad: #c0453b; --b-brand: #1f4e79; --b-neutral: #a4adb9;
  --seq1: #1f4e79; --seq2: #5b86ae; --seq3: #a9c2dc;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #15181d; --panel: #1c2026; --panel-2: #21262d; --panel-3: #2a3038;
    --text: #dde2e8; --muted: #9aa4b0; --line: #313842; --line-strong: #4a5360;
    --brand: #86aedb; --brand-ink: #11161c; --brand-soft: #263447; --focus: #86aedb;
    --ok: #82bf92; --ok-soft: #1f3226; --warn: #d6b062; --warn-soft: #36301b; --bad: #e39089; --bad-soft: #3b2422;
    --s1: #82bf92; --s1-soft: #1f3226; --s2: #d6b062; --s2-soft: #36301b; --s3: #e39089; --s3-soft: #3b2422;
    --nav-bg: #101317; --nav-text: #dde2e8; --nav-muted: #9aa4b0; --nav-line: #2a3038; --nav-hover: #1a1f25; --nav-active: #232a33; --nav-active-text: #ffffff; --nav-accent: #86aedb;
    --shadow-lg: 0 6px 20px rgba(0, 0, 0, .5);
    --heat0: #21262d; --heat1: #2f5a3d; --heat2: #6b5a1f; --heat3: #7d4d22; --heat4: #8a3a35; --heat-ink: #f2f4f7;
    --b-ok: #5fae7a; --b-warn: #d6a73a; --b-bad: #e0746b; --b-brand: #86aedb; --b-neutral: #5a6572;
    --seq1: #86aedb; --seq2: #5f8fc0; --seq3: #3b638f;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #15181d; --panel: #1c2026; --panel-2: #21262d; --panel-3: #2a3038;
  --text: #dde2e8; --muted: #9aa4b0; --line: #313842; --line-strong: #4a5360;
  --brand: #86aedb; --brand-ink: #11161c; --brand-soft: #263447; --focus: #86aedb;
  --ok: #82bf92; --ok-soft: #1f3226; --warn: #d6b062; --warn-soft: #36301b; --bad: #e39089; --bad-soft: #3b2422;
  --s1: #82bf92; --s1-soft: #1f3226; --s2: #d6b062; --s2-soft: #36301b; --s3: #e39089; --s3-soft: #3b2422;
  --nav-bg: #101317; --nav-text: #dde2e8; --nav-muted: #9aa4b0; --nav-line: #2a3038; --nav-hover: #1a1f25; --nav-active: #232a33; --nav-active-text: #ffffff; --nav-accent: #86aedb;
  --shadow-lg: 0 6px 20px rgba(0, 0, 0, .5);
  --heat0: #21262d; --heat1: #2f5a3d; --heat2: #6b5a1f; --heat3: #7d4d22; --heat4: #8a3a35; --heat-ink: #f2f4f7;
    --b-ok: #5fae7a; --b-warn: #d6a73a; --b-bad: #e0746b; --b-brand: #86aedb; --b-neutral: #5a6572;
    --seq1: #86aedb; --seq2: #5f8fc0; --seq3: #3b638f;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
html { -webkit-text-size-adjust: 100%; }
body { background: var(--bg); color: var(--text); font: 15px/1.5 var(--font); overflow-x: hidden; }
a { color: var(--brand); text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
h1 { font-size: 1.45rem; line-height: 1.25; margin: 0 0 .25rem; font-weight: 600; }
h2 { font-size: 1.1rem; margin: 1.4rem 0 .5rem; font-weight: 600; }
h3 { font-size: 1rem; margin: 1.1rem 0 .4rem; font-weight: 600; }
p { margin: .4rem 0 .8rem; }
code { font-family: var(--mono); font-size: .9em; background: var(--panel-3); padding: .05em .3em; border-radius: 2px; }
hr { border: 0; border-top: 1px solid var(--line); margin: 1rem 0; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.pad { padding: 1.5rem; }
.mono { font-family: var(--mono); font-size: .9em; font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Layout ---------- */
.app { display: grid; grid-template-columns: 264px minmax(0, 1fr); min-height: 100vh; }
.app.no-nav { grid-template-columns: minmax(0, 1fr); }
.nav {
  background: var(--nav-bg); color: var(--nav-text); border-right: 1px solid var(--nav-line);
  padding: .9rem .6rem 1.2rem; position: sticky; top: 0; height: 100vh; overflow-y: auto; scrollbar-width: thin;
}
.nav .brand { display: flex; gap: .6rem; align-items: center; padding: .2rem .5rem .8rem; border-bottom: 1px solid var(--nav-line); margin-bottom: .4rem; }
.nav .brand img { width: 28px; height: 28px; flex: none; }
.nav .brand b { display: block; font-size: .98rem; font-weight: 600; }
.nav .brand span { display: block; font-size: .8rem; color: var(--nav-muted); }
.nav .group { font-size: .78rem; font-weight: 600; color: var(--nav-muted); margin: 1rem .55rem .3rem; padding-bottom: .2rem; border-bottom: 1px solid var(--nav-line); }
.nav a {
  display: flex; align-items: baseline; gap: .5rem; padding: .35rem .55rem; border-radius: var(--radius-sm);
  color: var(--nav-text); text-decoration: none; font-size: .9rem; border-left: 3px solid transparent;
}
.nav a:hover { background: var(--nav-hover); }
.nav a.active { background: var(--nav-active); color: var(--nav-active-text); font-weight: 600; border-left-color: var(--nav-accent); }
.nav .num { display: inline-block; min-width: 1.7rem; flex: none; font-size: .82rem; color: var(--nav-muted); font-variant-numeric: tabular-nums; text-align: right; }
.nav a.active .num { color: var(--nav-active-text); }
.nav .user { border-top: 1px solid var(--nav-line); margin-top: 1.2rem; padding: .8rem .5rem 0; font-size: .85rem; }
.nav .user .muted { color: var(--nav-muted); }
.nav .user button.link { color: var(--nav-accent); }
.theme-seg { display: flex; margin: .2rem 0 .3rem; border: 1px solid var(--nav-line); border-radius: var(--radius); overflow: hidden; background: var(--panel); }
.theme-seg button { flex: 1 1 0; min-height: 30px; padding: .2rem .3rem; font-size: .82rem; border: 0; border-radius: 0; background: transparent; color: var(--nav-muted); }
.theme-seg button + button { border-left: 1px solid var(--nav-line); }
.theme-seg button:hover { background: var(--panel-3); color: var(--text); }
.theme-seg button.on { background: var(--brand); color: var(--brand-ink); font-weight: 600; }
.theme-float { position: fixed; top: .6rem; right: .8rem; z-index: 20; width: 14rem; }
.app:not(.no-nav) ~ .theme-float { display: none; }
.main { padding: 1.4rem 2rem 3rem; max-width: 1440px; width: 100%; min-width: 0; }
.head { display: flex; gap: 1rem; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; margin-bottom: 1rem; padding-bottom: .7rem; border-bottom: 1px solid var(--line); }
.head .actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.crumb { font-size: .82rem; line-height: 1.3; color: var(--muted); margin-bottom: .25rem; }
.crumb a { color: var(--muted); }

/* ---------- Panels & Grids ---------- */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: .9rem 1.1rem; margin-bottom: 1rem; position: relative; min-width: 0; }
.panel > h2:first-child, .panel > h3:first-child { margin-top: 0; }
.grid { display: grid; gap: 1rem; }
.grid > .panel { margin-bottom: 0; }
.grid.c2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.c3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.c4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.kpi { font: 600 1.6rem/1.15 var(--font); font-variant-numeric: tabular-nums; }
.step { display: grid; grid-template-columns: 2rem 1fr auto; gap: .8rem; align-items: center; padding: .7rem 0; border-top: 1px solid var(--line); }
.step:first-of-type { border-top: 0; }
.step .n { width: 2rem; height: 2rem; border-radius: var(--radius); display: grid; place-items: center; background: var(--panel-2); border: 1px solid var(--line); font-weight: 600; font-variant-numeric: tabular-nums; }
.step.done .n { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.step.now .n { background: var(--brand); color: var(--brand-ink); border-color: transparent; }
.step b { display: block; }
.bar { height: 8px; background: var(--panel-3); border-radius: 2px; overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--b-brand); }

/* ---------- Buttons & Formulare ---------- */
button, .btn {
  font: inherit; font-size: .9rem; border: 1px solid var(--line-strong); background: var(--panel); color: var(--text);
  padding: .4rem .85rem; min-height: 34px; border-radius: var(--radius); cursor: pointer; text-decoration: none; display: inline-flex; gap: .4rem; align-items: center; justify-content: center;
  touch-action: manipulation;
}
button:hover, .btn:hover { background: var(--panel-3); }
button:active, .btn:active { background: var(--line); }
button.primary, .btn.primary { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); font-weight: 600; }
button.primary:hover, .btn.primary:hover { background: var(--brand); filter: brightness(1.12); }
button.danger { color: var(--bad); border-color: var(--bad); }
button.danger:hover { background: var(--bad-soft); }
button:disabled { opacity: .5; cursor: not-allowed; }
button.link { border: 0; background: none; color: var(--brand); padding: 0; min-height: 0; }
button.link:hover { background: none; text-decoration: underline; }
label { display: block; font-size: .85rem; font-weight: 600; color: var(--text); margin: .6rem 0 .2rem; }
input, select, textarea {
  font: inherit; color: var(--text); background: var(--panel); border: 1px solid var(--line-strong); border-radius: var(--radius);
  padding: .4rem .55rem; width: 100%; min-height: 34px;
}
input:hover, select:hover, textarea:hover { border-color: var(--muted); }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--focus); outline-offset: 0; border-color: var(--focus); }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: .85; }
textarea { min-height: 5rem; resize: vertical; }
textarea.editor { min-height: 65vh; font-family: var(--mono); font-size: .86rem; line-height: 1.5; }
input[type="checkbox"], input[type="radio"] { width: auto; min-height: 0; accent-color: var(--brand); }
.row { display: flex; gap: .75rem; flex-wrap: wrap; align-items: end; }
.row > * { flex: 1 1 160px; min-width: 0; }
.row > .shrink { flex: 0 0 auto; }
.filters { display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: .75rem; }
.filters > * { width: auto; flex: 0 1 auto; }
.filters input[type="search"] { flex: 1 1 260px; }

/* ---------- Tabellen ---------- */
.tablewrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; font-variant-numeric: tabular-nums; }
th, td { text-align: left; padding: .4rem .6rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: .8rem; font-weight: 600; color: var(--muted); background: var(--panel-2); position: sticky; top: 0; border-bottom: 1px solid var(--line-strong); white-space: nowrap; }
tbody tr:nth-child(even) td { background: color-mix(in srgb, var(--panel-2) 60%, transparent); }
tbody tr:last-child td { border-bottom: 0; }
td.num, th.num, td.zahl, th.zahl { text-align: right; }
tr.click { cursor: pointer; }
tr.click:hover td { background: var(--brand-soft); }
tr.inaktiv td { color: var(--muted); }
td.group { background: var(--panel-3); font-weight: 600; font-size: .85rem; }

/* ---------- Status-Marken (nur für echte Status) ---------- */
.pill { display: inline-flex; align-items: center; gap: .3rem; border-radius: var(--radius-sm); padding: 0 .45rem; font-size: .78rem; font-weight: 600; border: 1px solid transparent; white-space: nowrap; line-height: 1.5; }
.pill.s1 { background: var(--s1-soft); color: var(--s1); border-color: color-mix(in srgb, var(--s1) 35%, transparent); }
.pill.s2 { background: var(--s2-soft); color: var(--s2); border-color: color-mix(in srgb, var(--s2) 35%, transparent); }
.pill.s3 { background: var(--s3-soft); color: var(--s3); border-color: color-mix(in srgb, var(--s3) 35%, transparent); }
.pill.s0 { background: var(--panel-2); color: var(--muted); border-color: var(--line); }
.pill.ok { background: var(--ok-soft); color: var(--ok); border-color: color-mix(in srgb, var(--ok) 35%, transparent); }
.pill.warn { background: var(--warn-soft); color: var(--warn); border-color: color-mix(in srgb, var(--warn) 35%, transparent); }
.pill.bad { background: var(--bad-soft); color: var(--bad); border-color: color-mix(in srgb, var(--bad) 35%, transparent); }
.pill.info { background: var(--panel-2); color: var(--text); border-color: var(--line-strong); }
.pill.r { background: var(--panel-2); color: var(--text); border-color: var(--line-strong); }
.cia { display: inline-flex; gap: .2rem; }
.cia .pill { min-width: 1.8rem; justify-content: center; padding: 0 .3rem; }

/* ---------- Schutzbedarfsmatrix ---------- */
.matrix th, .matrix td { vertical-align: top; }
.matrix td.sz { width: 22%; font-weight: 600; font-size: .88rem; }
.matrix .zelle select { margin-bottom: .3rem; }
.matrix .zelle textarea { min-height: 3.2rem; font-size: .85rem; }
.matrix tr.ergebnis td { background: var(--panel-3); font-weight: 600; }
.matrix .def { font-size: .78rem; color: var(--muted); font-weight: 400; margin-top: .2rem; }
.sel-s1 { border-color: var(--s1); }
.sel-s2 { border-color: var(--s2); }
.sel-s3 { border-color: var(--s3); }
.hint { background: var(--panel-2); border: 1px solid var(--line); border-left: 3px solid var(--brand); padding: .5rem .8rem; border-radius: var(--radius-sm); margin: .6rem 0; font-size: .9rem; }
.hint.warn { background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 30%, var(--line)); border-left-color: var(--warn); }
details.hinweis { margin: .3rem 0 .6rem; font-size: .9rem; color: var(--muted); max-width: 60rem; }
details.hinweis > summary { cursor: pointer; color: var(--brand); font-size: .85rem; width: fit-content; }
details.hinweis > :not(summary) { margin: .3rem 0 0; }

/* ---------- Markdown ---------- */
.doc { line-height: 1.6; max-width: 52rem; }
.doc h1 { font-size: 1.4rem; margin-top: .5rem; }
.doc h2 { font-size: 1.15rem; margin-top: 1.5rem; border-bottom: 1px solid var(--line); padding-bottom: .2rem; }
.doc table { margin: .6rem 0 1rem; width: auto; min-width: 50%; }
.doc li { margin: .2rem 0; }
.doc, .doc td, .doc th { overflow-wrap: anywhere; }
.split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 1rem; }
.split .doc { max-height: 70vh; overflow-y: auto; padding-right: .5rem; }

/* ---------- Kompendium ---------- */
.anf { border-top: 1px solid var(--line); padding: .6rem 0; }
.anf h4 { margin: 0 0 .3rem; font-size: .93rem; }
.anf p { white-space: pre-line; font-size: .9rem; margin: .2rem 0; }
.prewrap { white-space: pre-line; }
details > summary { cursor: pointer; color: var(--brand); }

.toast { position: fixed; right: 1rem; bottom: 1rem; background: var(--text); color: var(--panel); padding: .6rem 1rem; border-radius: var(--radius); box-shadow: var(--shadow-lg); opacity: 0; pointer-events: none; max-width: min(28rem, calc(100vw - 2rem)); z-index: 100; }
.toast.show { opacity: 1; }
.toast.err { background: var(--bad); color: #fff; }
.login { max-width: 420px; margin: 8vh auto; padding: 0 16px; }
.login .panel { padding: 1.4rem; border-top: 3px solid var(--brand); }
.empty { text-align: center; padding: 2rem 1rem; color: var(--muted); }

/* ---------- Auswahloptionen ---------- */
label.opt { display: flex; gap: .6rem; align-items: flex-start; color: var(--text); font-size: .92rem; font-weight: 400; margin: .5rem 0; padding: .5rem .7rem; border: 1px solid var(--line); border-radius: var(--radius); cursor: pointer; }
label.opt:hover { border-color: var(--line-strong); }
label.opt input { margin-top: .25rem; flex: 0 0 auto; width: auto; }
label.opt:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); }
select.rel { width: auto; min-width: 9.5rem; padding: .2rem .4rem; font-size: .85rem; min-height: 0; }

/* ---------- Übersicht ---------- */
.d-head { display: flex; gap: 1.5rem; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; margin-bottom: 1rem; padding-bottom: .8rem; border-bottom: 1px solid var(--line); }
.d-head h1 { margin-bottom: .15rem; }
.d-meta { margin: 0; color: var(--muted); font-size: .9rem; }
.d-gesamt { min-width: 14rem; flex: 0 1 18rem; }
.d-gesamt b { font-variant-numeric: tabular-nums; }
.d-gesamt .bar { margin-top: .25rem; }
.d-note { background: var(--panel); border: 1px solid var(--line); border-left: 3px solid var(--brand); padding: .5rem .9rem; margin-bottom: 1rem; font-size: .92rem; border-radius: var(--radius); }
.d-sec { margin-bottom: 1.2rem; }
.d-sec > h2 { margin: 0 0 .4rem; font-size: 1rem; padding-left: .5rem; border-left: 3px solid var(--brand); line-height: 1.3; }
.d-sec > h2 .src { font-weight: 400; font-size: .85rem; margin-left: .5rem; }
.d-sub { margin: .6rem 0 .3rem; font-size: .85rem; color: var(--muted); font-weight: 600; }
.d-cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 1.5rem; align-items: start; }
.d-cols > div { min-width: 0; }
.d-tab { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow-x: auto; }
.d-tab table { margin: 0; }
.d-tab th { position: static; }
.d-tab td.w { width: 22%; min-width: 5rem; }
.d-tab .bar { width: 100%; min-width: 4rem; }
.d-tab table.mitbalken th, .d-tab table.mitbalken td { padding: .4rem .35rem; }
.d-tab table.mitbalken th { white-space: normal; }
.d-tab table.mitbalken td:last-child { width: 30%; min-width: 4.5rem; }
.d-tab table.mitbalken .stack { min-width: 0; }
.d-find { list-style: none; margin: 0; padding: 0; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.d-find li { display: grid; grid-template-columns: 3rem minmax(0, 1fr); gap: .5rem; padding: .45rem .7rem; border-top: 1px solid var(--line); border-left: 4px solid var(--line-strong); }
.d-find li:first-child { border-top: 0; }
.d-find li.bad { border-left-color: var(--b-bad); }
.d-find li.warn { border-left-color: var(--b-warn); }
.d-find .cnt { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.d-find li.bad .cnt { color: var(--bad); }
.d-find li.warn .cnt { color: var(--warn); }
.d-find .ex { display: block; font-size: .82rem; color: var(--muted); overflow-wrap: anywhere; }
.d-risk { border-collapse: separate; border-spacing: 3px; width: 100%; table-layout: fixed; }
.d-risk th, .d-risk td { border: 0; text-align: center; padding: .45rem .3rem; }
.d-risk th { background: none; font-weight: 400; font-size: .7rem; overflow-wrap: anywhere; hyphens: auto; color: var(--muted); position: static; white-space: normal; }
.d-risk th.y { text-align: right; width: 5.5rem; }
.d-risk td { border-radius: 3px; font-weight: 700; font-size: 1.05rem; color: var(--heat-ink); }
.d-risk td.leer { font-weight: 400; }
.d-risk td.l1 { background: var(--heat1); }
.d-risk td.l2 { background: var(--heat2); }
.d-risk td.l3 { background: var(--heat3); }
.d-risk td.l4 { background: var(--heat4); }
.d-skel { height: 5rem; border-radius: var(--radius); background: var(--panel-3); }

/* Balken, gestapelte Balken, Legenden */
.stack { display: flex; gap: 2px; height: 10px; background: var(--panel-3); border-radius: 2px; overflow: hidden; min-width: 4rem; }
.stack > span { display: block; height: 100%; flex: none; }
.d-sec > .stack { margin: .2rem 0 .3rem; height: 12px; }
.legend { list-style: none; margin: .3rem 0 .6rem; padding: 0; display: flex; flex-wrap: wrap; gap: .2rem 1rem; font-size: .8rem; color: var(--muted); }
.legend i { display: inline-block; width: .7rem; height: .7rem; border-radius: 2px; margin-right: .3rem; vertical-align: -1px; }
.legend i.h1 { background: var(--heat1); } .legend i.h2 { background: var(--heat2); } .legend i.h3 { background: var(--heat3); } .legend i.h4 { background: var(--heat4); }
.legend i, .stack > span, .bar > span, .d-risk td { print-color-adjust: exact; -webkit-print-color-adjust: exact; }
.c-s0, .bar > span.c-s0, .stack > span.c-s0 { background: var(--b-neutral); }
.c-line, .bar > span.c-line, .stack > span.c-line { background: var(--line-strong); }
.c-s1, .bar > span.c-s1, .stack > span.c-s1, .c-ok, .bar > span.c-ok, .stack > span.c-ok { background: var(--b-ok); }
.c-s2, .bar > span.c-s2, .stack > span.c-s2, .c-warn, .bar > span.c-warn, .stack > span.c-warn { background: var(--b-warn); }
.c-s3, .bar > span.c-s3, .stack > span.c-s3, .c-bad, .bar > span.c-bad, .stack > span.c-bad { background: var(--b-bad); }
.c-brand, .bar > span.c-brand, .stack > span.c-brand, .c-info, .bar > span.c-info, .stack > span.c-info { background: var(--b-brand); }
.c-seq1, .bar > span.c-seq1, .stack > span.c-seq1 { background: var(--seq1); }
.c-seq2, .bar > span.c-seq2, .stack > span.c-seq2 { background: var(--seq2); }
.c-seq3, .bar > span.c-seq3, .stack > span.c-seq3 { background: var(--seq3); }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .grid.c4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .d-cols, .d-cols3 { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 900px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .nav { position: static; height: auto; max-height: 15rem; border-right: 0; border-bottom: 1px solid var(--nav-line); }
  .main { padding: 1rem 16px 2rem; }
  .grid.c2, .grid.c3, .grid.c4, .split { grid-template-columns: minmax(0, 1fr); }
  h1 { font-size: 1.3rem; }
}
@media (max-width: 520px) {
  .step { grid-template-columns: 2rem minmax(0, 1fr); }
  .step > a.btn { grid-column: 2; justify-self: start; }
  .kpi { font-size: 1.4rem; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; }
}
@media print {
  :root, :root:not([data-theme="light"]), :root[data-theme="dark"] {
    --bg: #fff; --panel: #fff; --panel-2: #f6f7f9; --panel-3: #e9ecf0; --text: #000; --muted: #333; --line: #bbb; --line-strong: #888;
    --brand: #1f4e79; --brand-ink: #fff; --brand-soft: #e8eef5; --ok: #1f5a30; --ok-soft: #e6f0e8; --warn: #6b4600; --warn-soft: #f6eed9; --bad: #8a2019; --bad-soft: #f5e4e2;
    --s1: #1f5a30; --s1-soft: #e6f0e8; --s2: #6b4600; --s2-soft: #f6eed9; --s3: #8a2019; --s3-soft: #f5e4e2;
    --heat1: #cfe3d3; --heat2: #efe0a8; --heat3: #f0be8e; --heat4: #de938b; --heat-ink: #000;
    --b-ok: #3d8b57; --b-warn: #c08a12; --b-bad: #c0453b; --b-brand: #1f4e79; --b-neutral: #a4adb9; --seq1: #1f4e79; --seq2: #5b86ae; --seq3: #a9c2dc;
    color-scheme: light;
  }
  .theme-seg, .theme-float, .nav-suche, details.hinweis { display: none !important; }
  .nav, .head .actions, .noprint, .toast { display: none !important; }
  .app { display: block; }
  .main { padding: 2mm 0 0; max-width: none; }
  .panel { border: 0; padding: 0; }
  body { background: #fff; color: #000; font-size: 9.5pt; }
  .small, .pill, .crumb { font-size: 8pt; }
  tbody tr:nth-child(even) td { background: none; }
  .tablewrap, .d-tab { overflow: visible; }
  thead { display: table-header-group; }
  tr, .d-find li { break-inside: avoid; }
  h1, h2, h3 { break-after: avoid; }
  th { position: static; }
  .d-risk, .d-cols > div { break-inside: avoid; }
  table { font-size: 8.5pt; }
  .d-risk th { font-size: 7pt; }
  .d-tab table.mitbalken td:last-child { width: 24%; }
  .d-cols { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .d-gesamt { min-width: 0; }
  .pill { print-color-adjust: exact; -webkit-print-color-adjust: exact; }
}

/* Mobiles Menü (Integration) */
.nav-toggle { display: none; margin-left: auto; }
@media (max-width: 900px) {
  .nav-toggle { display: inline-flex; }
  .nav:not(.offen) > :not(.brand) { display: none !important; }
  .nav { max-height: none !important; }
}

/* ---------- Kern-UI: globale Suche, Verantwortliche, Import ---------- */
.nav-suche { display: flex; align-items: center; justify-content: space-between; gap: .5rem; width: 100%; margin: .2rem 0 .3rem; padding: .4rem .6rem; background: var(--panel); color: var(--nav-muted); border: 1px solid var(--nav-line); border-radius: var(--radius); font-size: .88rem; }
.nav-suche:hover { background: var(--panel-2); color: var(--text); }
.nav-suche kbd { font: .72rem var(--font); border: 1px solid var(--nav-line); border-radius: 2px; padding: 0 .35rem; }
.nav-suche-kurz { display: none; margin-left: auto; }
@media (max-width: 900px) { .nav-suche-kurz { display: inline-flex; } .nav-toggle { margin-left: .4rem; } }
.suche { position: fixed; inset: 0; z-index: 50; background: rgba(0, 0, 0, .5); display: flex; align-items: flex-start; justify-content: center; padding: 8vh 16px 16px; }
.suche[hidden] { display: none; }
.suche-box { width: min(640px, 100%); max-height: 80vh; display: flex; flex-direction: column; background: var(--panel); color: var(--text); border: 1px solid var(--line-strong); border-radius: var(--radius); box-shadow: var(--shadow-lg); overflow: hidden; }
.suche-box input { border: 0; border-bottom: 1px solid var(--line); border-radius: 0; padding: .8rem 1rem; font-size: 1rem; }
.suche-liste { overflow-y: auto; flex: 1 1 auto; }
.suche-gruppe { font-size: .78rem; font-weight: 600; color: var(--muted); padding: .7rem 1rem .3rem; }
.suche-item { display: flex; flex-direction: column; padding: .4rem 1rem; color: var(--text); text-decoration: none; border-left: 3px solid transparent; }
.suche-item.sel { background: var(--brand-soft); border-left-color: var(--brand); }
.suche-item mark { background: var(--warn-soft); color: var(--text); }
.suche-fuss { padding: .4rem 1rem; border-top: 1px solid var(--line); }
.pad { padding: .8rem 1rem; }
.verant-k { cursor: help; }
.zugeh { margin: .2rem 0 .8rem; padding-left: 1.1rem; }
.num-badge { display: inline-block; min-width: 1.4rem; text-align: center; font-weight: 600; color: var(--muted); }
