/* ===========================================================================
   ISO/IEC 42001 Atlas — Stylesheet
   Farbrollen als Tokens; Dunkelmodus eigenständig gestuft (kein Invertieren).
   Die Nachweisklassen tragen eine validierte ordinale Rampe (eine Farbfamilie,
   monoton in der Helligkeit) — die Klassenbuchstaben stehen immer dabei, die
   Farbe trägt die Bedeutung nie allein.
   =========================================================================== */

:root {
  color-scheme: light;

  --page:          #f5f6f4;
  --surface:       #ffffff;
  --surface-2:     #fafbfa;
  --surface-3:     #f0f1ef;
  --ink:           #15181c;
  --ink-2:         #4b5058;
  --ink-muted:     #7b818b;
  --line:          #e3e4e0;
  --line-strong:   #cdcfc9;
  --ring:          rgba(21, 24, 28, .10);

  --brand:         #c0143c;
  --brand-deep:    #9d0f31;
  --brand-tint:    #fdeff2;
  --orange:        #ef8200;
  --teal:          #00677f;

  /* Nachweisklassen — ordinale Rampe, hell geprüft gegen #ffffff */
  --k-a1: #00657d;
  --k-a2: #2d7b92;
  --k-b:  #4a8fa5;
  --k-c:  #63a3b8;
  --k-d:  #7bb6ca;
  --k-a1-tint: #e6f0f3;
  --k-a2-tint: #eaf2f5;
  --k-b-tint:  #edf4f6;
  --k-c-tint:  #f0f6f8;
  --k-d-tint:  #f3f8fa;

  --good:     #0a8a0a;
  --warning:  #b07600;
  --critical: #c0332f;

  --grid:     #ebece8;
  --axis:     #c9cbc5;

  --radius:   10px;
  --radius-s: 6px;
  --shadow:   0 1px 2px rgba(21,24,28,.05), 0 8px 24px -12px rgba(21,24,28,.18);
  --shadow-lg:0 2px 4px rgba(21,24,28,.06), 0 24px 56px -20px rgba(21,24,28,.28);

  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;

  --nav-h: 60px;
}

@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --page:        #0d0f12;
    --surface:     #14161a;
    --surface-2:   #191c21;
    --surface-3:   #1f2329;
    --ink:         #f1f2f4;
    --ink-2:       #b6bbc4;
    --ink-muted:   #868c96;
    --line:        #272b31;
    --line-strong: #383d45;
    --ring:        rgba(255,255,255,.12);
    --brand:       #ef4062;
    --brand-deep:  #ff5f7d;
    --brand-tint:  #2a1219;
    --orange:      #f59a2e;
    --teal:        #4fa6bd;
    --k-a1: #98cee1; --k-a2: #7ab5c9; --k-b: #5c9db2; --k-c: #3c859c; --k-d: #166e86;
    --k-a1-tint: #16272e; --k-a2-tint: #152329; --k-b-tint: #142026;
    --k-c-tint: #131d23; --k-d-tint: #121a20;
    --good:     #24b324;
    --warning:  #f0b429;
    --critical: #ef5350;
    --grid:     #23262b;
    --axis:     #363a41;
    --shadow:   0 1px 2px rgba(0,0,0,.5), 0 8px 24px -12px rgba(0,0,0,.7);
    --shadow-lg:0 2px 4px rgba(0,0,0,.5), 0 24px 56px -20px rgba(0,0,0,.8);
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --page:        #0d0f12;
  --surface:     #14161a;
  --surface-2:   #191c21;
  --surface-3:   #1f2329;
  --ink:         #f1f2f4;
  --ink-2:       #b6bbc4;
  --ink-muted:   #868c96;
  --line:        #272b31;
  --line-strong: #383d45;
  --ring:        rgba(255,255,255,.12);
  --brand:       #ef4062;
  --brand-deep:  #ff5f7d;
  --brand-tint:  #2a1219;
  --orange:      #f59a2e;
  --teal:        #4fa6bd;
  --k-a1: #98cee1; --k-a2: #7ab5c9; --k-b: #5c9db2; --k-c: #3c859c; --k-d: #166e86;
  --k-a1-tint: #16272e; --k-a2-tint: #152329; --k-b-tint: #142026;
  --k-c-tint: #131d23; --k-d-tint: #121a20;
  --good:     #24b324;
  --warning:  #f0b429;
  --critical: #ef5350;
  --grid:     #23262b;
  --axis:     #363a41;
  --shadow:   0 1px 2px rgba(0,0,0,.5), 0 8px 24px -12px rgba(0,0,0,.7);
  --shadow-lg:0 2px 4px rgba(0,0,0,.5), 0 24px 56px -20px rgba(0,0,0,.8);
}

/* ------------------------------------------------------------------ Grundlagen */

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

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

body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--page);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { margin: 0; line-height: 1.2; font-weight: 640; letter-spacing: -.015em; }
h1 { font-size: clamp(1.7rem, 1.2rem + 1.8vw, 2.6rem); }
h2 { font-size: clamp(1.25rem, 1.05rem + .8vw, 1.6rem); }
h3 { font-size: 1.05rem; }
p  { margin: 0 0 .8em; }
a  { color: var(--brand); text-decoration-color: color-mix(in srgb, var(--brand) 40%, transparent); text-underline-offset: 2px; }
a:hover { text-decoration-color: currentColor; }

button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 3px; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.wrap { width: min(1320px, 100% - 3rem); margin-inline: auto; }
@media (max-width: 720px) { .wrap { width: calc(100% - 2rem); } }

.mono { font-family: var(--mono); font-size: .86em; }
.num  { font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------------- Kopfzeile */

.topbar {
  position: sticky; top: 0; z-index: 60;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: saturate(1.6) blur(12px);
  border-bottom: 1px solid var(--line);
}
.topbar__inner { display: flex; align-items: center; gap: 1.1rem; height: var(--nav-h); }

.brand { display: flex; align-items: center; gap: .65rem; text-decoration: none; color: inherit; flex: none; }
.brand__logo { height: 26px; width: auto; display: block; }
/* Der Schriftzug ist im Original grau; die Marke fuehrt fuer dunkle
   Hintergruende eine weisse Variante. Umschalten statt Filtern. */
.brand__logo--dunkel { display: none; }
@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) .brand__logo--hell { display: none; }
  :root:where(:not([data-theme="light"])) .brand__logo--dunkel { display: block; }
}
:root[data-theme="dark"] .brand__logo--hell { display: none; }
:root[data-theme="dark"] .brand__logo--dunkel { display: block; }
.brand__sep { width: 1px; height: 22px; background: var(--line-strong); }
.brand__txt { font-weight: 650; font-size: .95rem; letter-spacing: -.01em; white-space: nowrap; }
.brand__txt span { color: var(--brand); }

.nav { display: flex; gap: .15rem; margin-left: .4rem; overflow-x: auto; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav a {
  --c: var(--ink-2);
  color: var(--c); text-decoration: none; font-size: .9rem; font-weight: 520;
  padding: .45rem .7rem; border-radius: var(--radius-s); white-space: nowrap;
  border: 1px solid transparent;
}
.nav a:hover { background: var(--surface-3); color: var(--ink); }
.nav a[aria-current="page"] { color: var(--brand); background: var(--brand-tint); border-color: color-mix(in srgb, var(--brand) 22%, transparent); }

.topbar__tools { margin-left: auto; display: flex; align-items: center; gap: .4rem; flex: none; }

.btn {
  display: inline-flex; align-items: center; gap: .45rem;
  background: var(--surface); color: var(--ink-2);
  border: 1px solid var(--line-strong); border-radius: var(--radius-s);
  padding: .4rem .7rem; font-size: .85rem; font-weight: 520; cursor: pointer;
  transition: background .12s, color .12s, border-color .12s;
}
.btn:hover { background: var(--surface-3); color: var(--ink); }
.btn--icon { padding: .42rem .5rem; }
.btn--primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn--primary:hover { background: var(--brand-deep); border-color: var(--brand-deep); color: #fff; }
.btn--ghost { background: transparent; border-color: transparent; }
.btn--ghost:hover { background: var(--surface-3); }

.searchtrigger {
  display: inline-flex; align-items: center; gap: .5rem; min-width: 215px;
  background: var(--surface-3); border: 1px solid var(--line);
  border-radius: 99px; padding: .38rem .55rem .38rem .8rem;
  color: var(--ink-muted); font-size: .86rem; cursor: pointer;
}
.searchtrigger:hover { border-color: var(--line-strong); color: var(--ink-2); }
.searchtrigger kbd {
  margin-left: auto; font-family: var(--font); font-size: .72rem; font-weight: 600;
  background: var(--surface); border: 1px solid var(--line-strong);
  border-radius: 4px; padding: .05rem .3rem; color: var(--ink-muted);
}
@media (max-width: 1080px) { .searchtrigger { min-width: 0; } .searchtrigger span, .searchtrigger kbd { display: none; } }

/* Schmale Fenster: die Navigation bekommt eine eigene, scrollbare Zeile,
   sonst verdraengen Wortmarke und Werkzeuge die Menuepunkte vollstaendig. */
@media (max-width: 880px) {
  .topbar__inner { height: auto; flex-wrap: wrap; padding-block: .55rem; gap: .6rem; }
  .nav {
    order: 3; width: 100%; margin-left: 0;
    padding-bottom: 2px; -webkit-overflow-scrolling: touch;
  }
  .nav a { padding: .38rem .6rem; font-size: .86rem; }
  .brand img.brand__logo { height: 22px; }
  .brand__txt { font-size: .88rem; }
}
@media (max-width: 420px) {
  .brand__txt { font-size: .8rem; }
  .brand { gap: .45rem; }
}

/* ----------------------------------------------------------------- Seitenkörper */

main { padding-block: 1.9rem 5rem; }
.view[hidden] { display: none; }

.pagehead { margin-bottom: 1.6rem; max-width: 74ch; }
.pagehead__eyebrow {
  display: inline-flex; align-items: center; gap: .45rem;
  font-size: .76rem; font-weight: 640; letter-spacing: .07em; text-transform: uppercase;
  color: var(--brand); margin-bottom: .6rem;
}
.pagehead__eyebrow::before { content: ""; width: 18px; height: 2px; background: var(--brand); border-radius: 2px; }
.pagehead p { color: var(--ink-2); font-size: 1.02rem; margin-top: .55rem; }

.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 1.15rem 1.25rem;
}
.card--pad0 { padding: 0; overflow: hidden; }
.card__head { display: flex; align-items: baseline; gap: .7rem; flex-wrap: wrap; margin-bottom: .2rem; }
.card__head h3 { font-size: .98rem; font-weight: 640; }
.card__note { font-size: .8rem; color: var(--ink-muted); margin: .15rem 0 1rem; }
.card__foot { margin-top: .9rem; padding-top: .75rem; border-top: 1px solid var(--line); font-size: .78rem; color: var(--ink-muted); }

.grid { display: grid; gap: 1rem; }
.grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid--wide { grid-template-columns: 1.55fr 1fr; }
@media (max-width: 1040px) { .grid--3, .grid--4, .grid--wide { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 680px) { .grid--2, .grid--3, .grid--4, .grid--wide { grid-template-columns: 1fr; } }

section + section { margin-top: 2.1rem; }
.section__head { display: flex; align-items: baseline; gap: .8rem; flex-wrap: wrap; margin-bottom: .9rem; }
.section__head h2 { flex: none; }
.section__head p { color: var(--ink-muted); font-size: .88rem; margin: 0; }

/* ------------------------------------------------------------------- Startseite */

.hero {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.7rem 1.75rem; margin-bottom: 1.1rem;
  display: grid; grid-template-columns: 1.15fr .85fr; gap: 2rem; align-items: center;
}
@media (max-width: 900px) { .hero { grid-template-columns: 1fr; padding: 1.35rem; gap: 1.4rem; } }
.hero h1 { margin-bottom: .55rem; }
.hero__lead { color: var(--ink-2); font-size: 1.04rem; max-width: 56ch; }
.hero__meta { display: flex; flex-wrap: wrap; gap: .45rem; margin-top: 1rem; }

.pill {
  display: inline-flex; align-items: center; gap: .4rem;
  background: var(--surface-3); border: 1px solid var(--line);
  border-radius: 99px; padding: .25rem .68rem; font-size: .79rem; color: var(--ink-2);
}
.pill strong { color: var(--ink); font-weight: 620; }

.herofig { text-align: left; }
.herofig__val {
  font-size: clamp(3.2rem, 2rem + 5vw, 5rem); font-weight: 700; line-height: .95;
  letter-spacing: -.03em; color: var(--k-a1);
}
.herofig__unit { font-size: .95rem; font-weight: 620; color: var(--ink); margin-top: .5rem; }
.herofig__note { font-size: .83rem; color: var(--ink-muted); margin-top: .3rem; max-width: 34ch; }

/* Kennzahlkachel */
.stat {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: .95rem 1.05rem 1rem;
  display: flex; flex-direction: column; gap: .1rem; position: relative;
  text-align: left; width: 100%; cursor: pointer; font: inherit;
}
.stat:hover { border-color: var(--line-strong); }
.stat__label { font-size: .79rem; color: var(--ink-muted); font-weight: 520; }
.stat__val { font-size: 2.1rem; font-weight: 680; letter-spacing: -.025em; line-height: 1.05; margin-top: .1rem; }
.stat__sub { font-size: .78rem; color: var(--ink-2); margin-top: .2rem; }
.stat__bar { height: 3px; border-radius: 2px; margin-top: .6rem; background: currentColor; opacity: .85; }

/* Nachweisleiter */
.ladder { display: flex; flex-direction: column; gap: 2px; }
.ladder__row {
  display: grid; grid-template-columns: 46px minmax(0, 1fr) auto;
  align-items: center; gap: .8rem; width: 100%; text-align: left;
  background: transparent; border: 0; border-radius: var(--radius-s);
  padding: .5rem .55rem; cursor: pointer; font: inherit;
}
.ladder__row:hover { background: var(--surface-3); }
.ladder__row[aria-pressed="true"] { background: var(--surface-3); box-shadow: inset 0 0 0 1px var(--line-strong); }
.ladder__code {
  font-weight: 700; font-size: .85rem; text-align: center; padding: .18rem 0;
  border-radius: 5px; color: #fff;
}
.ladder__meter { height: 12px; background: var(--surface-3); border-radius: 3px; overflow: hidden; }
.ladder__fill { height: 100%; border-radius: 3px 2px 2px 3px; }
.ladder__txt { font-size: .86rem; color: var(--ink-2); }
.ladder__n { font-variant-numeric: tabular-nums; font-weight: 640; font-size: .95rem; min-width: 2.6rem; text-align: right; }

/* Nachweisklassen-Badge — Buchstabe immer sichtbar */
.kbadge {
  display: inline-flex; align-items: center; gap: .38rem; flex: none;
  font-size: .76rem; font-weight: 640; padding: .12rem .48rem .12rem .38rem;
  border-radius: 5px; border: 1px solid; white-space: nowrap;
}
.kbadge__dot { width: 8px; height: 8px; border-radius: 2px; background: currentColor; flex: none; }
.kbadge--A1 { color: var(--k-a1); background: var(--k-a1-tint); border-color: color-mix(in srgb, var(--k-a1) 32%, transparent); }
.kbadge--A2 { color: var(--k-a2); background: var(--k-a2-tint); border-color: color-mix(in srgb, var(--k-a2) 32%, transparent); }
.kbadge--B  { color: var(--k-b);  background: var(--k-b-tint);  border-color: color-mix(in srgb, var(--k-b) 32%, transparent); }
.kbadge--C  { color: var(--k-c);  background: var(--k-c-tint);  border-color: color-mix(in srgb, var(--k-c) 34%, transparent); }
.kbadge--D  { color: var(--k-d);  background: var(--k-d-tint);  border-color: color-mix(in srgb, var(--k-d) 38%, transparent); }
:root[data-theme="dark"] .kbadge, :root:where(:not([data-theme="light"])) .kbadge { border-width: 1px; }

/* ------------------------------------------------------------ Filter & Register */

.toolbar {
  display: flex; flex-wrap: wrap; align-items: center; gap: .55rem;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: .7rem .8rem; margin-bottom: .9rem;
}
.toolbar__search { position: relative; flex: 1 1 300px; min-width: 220px; }
.toolbar__search input {
  width: 100%; background: var(--surface-3); border: 1px solid var(--line);
  border-radius: var(--radius-s); padding: .48rem .7rem .48rem 2.1rem; font-size: .9rem;
}
.toolbar__search input::placeholder { color: var(--ink-muted); }
.toolbar__search svg { position: absolute; left: .62rem; top: 50%; transform: translateY(-50%); color: var(--ink-muted); }

.seg { display: inline-flex; background: var(--surface-3); border: 1px solid var(--line); border-radius: var(--radius-s); padding: 2px; gap: 2px; }
.seg button {
  border: 0; background: transparent; border-radius: 4px; cursor: pointer;
  padding: .32rem .6rem; font-size: .82rem; font-weight: 560; color: var(--ink-2);
  display: inline-flex; align-items: center; gap: .35rem;
}
.seg button:hover { color: var(--ink); }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px var(--ring); }
.seg button[aria-pressed="true"] .seg__dot { opacity: 1; }
.seg__dot { width: 7px; height: 7px; border-radius: 2px; opacity: .45; }

select.filter {
  background: var(--surface-3); border: 1px solid var(--line); border-radius: var(--radius-s);
  padding: .42rem 1.8rem .42rem .6rem; font-size: .84rem; cursor: pointer; max-width: 210px;
  appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'><path d='M3 4.5 6 8l3-3.5' fill='none' stroke='%237b818b' stroke-width='1.4' stroke-linecap='round' stroke-linejoin='round'/></svg>");
  background-repeat: no-repeat; background-position: right .55rem center;
}
select.filter:hover { border-color: var(--line-strong); }

.chips { display: flex; flex-wrap: wrap; gap: .35rem; align-items: center; margin-bottom: .8rem; min-height: 1.5rem; }
.chip {
  display: inline-flex; align-items: center; gap: .4rem;
  background: var(--brand-tint); color: var(--brand);
  border: 1px solid color-mix(in srgb, var(--brand) 25%, transparent);
  border-radius: 99px; padding: .18rem .3rem .18rem .6rem; font-size: .78rem; font-weight: 540;
}
.chip button { border: 0; background: transparent; cursor: pointer; color: inherit; line-height: 1; padding: .1rem .22rem; border-radius: 99px; font-size: .95rem; }
.chip button:hover { background: color-mix(in srgb, var(--brand) 16%, transparent); }

.resultbar { display: flex; align-items: baseline; gap: .7rem; flex-wrap: wrap; font-size: .85rem; color: var(--ink-muted); margin-bottom: .55rem; }
.resultbar strong { color: var(--ink); font-size: 1rem; font-weight: 650; font-variant-numeric: tabular-nums; }
.resultbar .spacer { margin-left: auto; }

/* Ergebnisliste */
.rows { display: flex; flex-direction: column; gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.row {
  display: grid; grid-template-columns: 84px minmax(0, 2.3fr) minmax(0, 1.3fr) 128px 108px;
  gap: .9rem; align-items: center; width: 100%; text-align: left;
  background: var(--surface); border: 0; padding: .72rem .9rem; cursor: pointer; font: inherit;
}
.row:hover { background: var(--surface-2); }
.row__name, .row__sub { display: block; }
.row__name { font-weight: 580; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row__sub { font-size: .79rem; color: var(--ink-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: .05rem; }
.row__cell { font-size: .83rem; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row__meta { font-size: .79rem; color: var(--ink-muted); font-variant-numeric: tabular-nums; }
@media (max-width: 960px) {
  .row { grid-template-columns: 76px minmax(0, 1fr); grid-auto-rows: min-content; row-gap: .3rem; }
  .row__cell, .row__meta { grid-column: 2; }
}

.empty { text-align: center; padding: 3rem 1rem; color: var(--ink-muted); background: var(--surface); border: 1px dashed var(--line-strong); border-radius: var(--radius); }
.empty strong { display: block; color: var(--ink); font-size: 1.05rem; margin-bottom: .3rem; }

.loadmore { display: block; margin: 1rem auto 0; }

/* ------------------------------------------------------------------ Detailtafel */

.drawer {
  position: fixed; inset: 0; z-index: 90; display: grid; grid-template-columns: 1fr min(660px, 94vw);
  pointer-events: none;
}
.drawer[hidden] { display: none; }
.drawer__scrim { background: rgba(10, 12, 15, .42); opacity: 0; transition: opacity .18s; pointer-events: auto; }
.drawer.is-open .drawer__scrim { opacity: 1; }
.drawer__panel {
  background: var(--surface); border-left: 1px solid var(--line);
  box-shadow: var(--shadow-lg); overflow-y: auto; pointer-events: auto;
  transform: translateX(100%); transition: transform .2s ease-out;
  display: flex; flex-direction: column;
}
.drawer.is-open .drawer__panel { transform: none; }
.drawer__head {
  position: sticky; top: 0; background: var(--surface); border-bottom: 1px solid var(--line);
  padding: 1rem 1.2rem .85rem; display: flex; align-items: flex-start; gap: .8rem; z-index: 2;
}
.drawer__head h2 { font-size: 1.15rem; }
.drawer__body { padding: 1.1rem 1.2rem 3rem; }

.deftable { width: 100%; border-collapse: collapse; font-size: .86rem; }
.deftable th, .deftable td { text-align: left; vertical-align: top; padding: .5rem .55rem; border-bottom: 1px solid var(--line); }
.deftable th { width: 38%; font-weight: 560; color: var(--ink-muted); }
.deftable td { color: var(--ink); overflow-wrap: anywhere; }
.deftable tr:last-child th, .deftable tr:last-child td { border-bottom: 0; }
.deftable td.unknown, .val-unknown { color: var(--ink-muted); font-style: italic; }

.subhead { font-size: .76rem; font-weight: 660; letter-spacing: .07em; text-transform: uppercase; color: var(--ink-muted); margin: 1.5rem 0 .5rem; }
.subhead:first-child { margin-top: 0; }

.quote {
  background: var(--surface-2); border: 1px solid var(--line); border-left: 3px solid var(--k-b);
  border-radius: var(--radius-s); padding: .7rem .85rem; font-size: .85rem; color: var(--ink-2);
  overflow-wrap: anywhere;
}

.srclist { display: flex; flex-direction: column; gap: .5rem; }
.src {
  background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-s); padding: .6rem .75rem; font-size: .83rem;
}
.src__top { display: flex; gap: .5rem; align-items: baseline; flex-wrap: wrap; margin-bottom: .25rem; }
.src__id { font-family: var(--mono); font-size: .75rem; color: var(--ink-muted); }
.src__pub { font-weight: 570; }
.src__type { font-size: .74rem; color: var(--ink-muted); background: var(--surface-3); border-radius: 99px; padding: .05rem .45rem; }
.src__txt { color: var(--ink-2); }
.src__url { display: inline-block; margin-top: .3rem; font-size: .78rem; overflow-wrap: anywhere; }
.src__warn { margin-top: .3rem; font-size: .78rem; color: var(--warning); }

/* --------------------------------------------------------------------- Hinweise */

.note {
  display: flex; gap: .7rem; align-items: flex-start;
  background: var(--surface-2); border: 1px solid var(--line);
  border-left: 3px solid var(--orange); border-radius: var(--radius-s);
  padding: .8rem .95rem; font-size: .87rem; color: var(--ink-2);
}
.note--brand { border-left-color: var(--brand); }
.note--info  { border-left-color: var(--k-b); }
.note strong { color: var(--ink); }
.note__icon { flex: none; margin-top: .1rem; color: var(--orange); }
.note--brand .note__icon { color: var(--brand); }
.note--info  .note__icon { color: var(--k-b); }

/* ---------------------------------------------------------------- Diagramme */

.chart { width: 100%; display: block; overflow: visible; }
.chart text { font-family: var(--font); }
.chart .tick { fill: var(--ink-muted); font-size: 11px; }
.chart .lbl  { fill: var(--ink-2); font-size: 12px; }
.chart .val  { fill: var(--ink); font-size: 12px; font-weight: 620; font-variant-numeric: tabular-nums; }
.chart .grid { stroke: var(--grid); stroke-width: 1; }
.chart .axis { stroke: var(--axis); stroke-width: 1; }
.chart .hit  { fill: transparent; cursor: pointer; }
.chart .mark { transition: opacity .12s; }
.chart.is-hovering .mark { opacity: .42; }
.chart.is-hovering .mark.is-active { opacity: 1; }

.legend { display: flex; flex-wrap: wrap; gap: .1rem 1rem; margin-top: .7rem; font-size: .8rem; color: var(--ink-2); }
.legend__item { display: inline-flex; align-items: center; gap: .4rem; }
.legend__key { width: 14px; height: 3px; border-radius: 2px; flex: none; }
.legend__key--sq { width: 10px; height: 10px; border-radius: 2px; }

.tooltip {
  position: fixed; z-index: 120; pointer-events: none; opacity: 0;
  background: var(--surface); color: var(--ink);
  border: 1px solid var(--line-strong); border-radius: var(--radius-s);
  box-shadow: var(--shadow); padding: .5rem .65rem; font-size: .82rem;
  min-width: 130px; max-width: 280px; transition: opacity .1s;
}
.tooltip.is-on { opacity: 1; }
.tooltip__t { font-weight: 620; margin-bottom: .25rem; }
.tooltip__r { display: flex; align-items: baseline; gap: .45rem; }
.tooltip__k { width: 12px; height: 3px; border-radius: 2px; flex: none; margin-top: .45rem; }
.tooltip__v { font-weight: 640; font-variant-numeric: tabular-nums; }
.tooltip__l { color: var(--ink-2); }
.tooltip__n { color: var(--ink-muted); font-size: .78rem; margin-top: .3rem; }

.chartswitch { display: flex; gap: .35rem; margin-left: auto; }

/* Datentabellen-Alternative zu jedem Diagramm */
.datatable { margin-top: .7rem; }
.datatable summary { cursor: pointer; font-size: .79rem; color: var(--ink-muted); }
.datatable summary:hover { color: var(--ink-2); }
.datatable table { width: 100%; border-collapse: collapse; font-size: .82rem; margin-top: .5rem; }
.datatable th, .datatable td { text-align: left; padding: .3rem .5rem; border-bottom: 1px solid var(--line); }
.datatable th { color: var(--ink-muted); font-weight: 560; }
.datatable td.n, .datatable th.n { text-align: right; font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------------- Tabellen */

.tablewrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
table.data { width: 100%; border-collapse: collapse; font-size: .86rem; min-width: 640px; }
table.data th, table.data td { text-align: left; padding: .6rem .8rem; border-bottom: 1px solid var(--line); vertical-align: top; }
/* Nicht klebend: der waagerecht scrollende Container wuerde sticky brechen,
   und die Spalten sind aus dem Zeileninhalt heraus eindeutig. */
table.data thead th {
  background: var(--surface-2);
  font-size: .78rem; font-weight: 620; color: var(--ink-muted); letter-spacing: .02em;
  text-transform: uppercase; white-space: nowrap;
  border-bottom: 1px solid var(--line-strong);
}
table.data tbody tr:last-child td { border-bottom: 0; }
table.data tbody tr:hover { background: var(--surface-2); }
table.data td.n { text-align: right; font-variant-numeric: tabular-nums; }

/* -------------------------------------------------------------- Befehlspalette */

.palette { position: fixed; inset: 0; z-index: 100; display: grid; place-items: start center; padding-top: 12vh; }
.palette[hidden] { display: none; }
.palette__scrim { position: absolute; inset: 0; background: rgba(10,12,15,.45); }
.palette__box {
  position: relative; width: min(640px, 94vw); background: var(--surface);
  border: 1px solid var(--line-strong); border-radius: 12px; box-shadow: var(--shadow-lg);
  overflow: hidden; display: flex; flex-direction: column; max-height: 70vh;
}
.palette__input { display: flex; align-items: center; gap: .6rem; padding: .85rem 1rem; border-bottom: 1px solid var(--line); }
.palette__input svg { color: var(--ink-muted); flex: none; }
.palette__input input { flex: 1; border: 0; background: transparent; font-size: 1rem; outline: 0; }
.palette__list { overflow-y: auto; padding: .35rem; }
.palette__group { font-size: .72rem; font-weight: 660; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-muted); padding: .6rem .7rem .3rem; }
.palette__item {
  display: flex; align-items: center; gap: .6rem; width: 100%; text-align: left;
  background: transparent; border: 0; border-radius: var(--radius-s);
  padding: .5rem .7rem; cursor: pointer; font: inherit;
}
.palette__item:hover, .palette__item.is-active { background: var(--surface-3); }
.palette__item.is-active { box-shadow: inset 0 0 0 1px var(--line-strong); }
.palette__txt { min-width: 0; flex: 1; }
.palette__t, .palette__s { display: block; }
.palette__t { font-weight: 560; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.palette__s { font-size: .78rem; color: var(--ink-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.palette__foot { border-top: 1px solid var(--line); padding: .5rem .8rem; font-size: .76rem; color: var(--ink-muted); display: flex; gap: 1rem; flex-wrap: wrap; }
.palette__foot kbd { font-family: var(--font); background: var(--surface-3); border: 1px solid var(--line); border-radius: 4px; padding: .02rem .3rem; font-size: .72rem; }

/* ------------------------------------------------------------------ Fußbereich */

.footer { border-top: 1px solid var(--line); background: var(--surface); padding-block: 2rem 2.5rem; margin-top: 3rem; }
.footer__grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 2rem; }
@media (max-width: 800px) { .footer__grid { grid-template-columns: 1fr; gap: 1.4rem; } }
.footer h4 { font-size: .78rem; text-transform: uppercase; letter-spacing: .07em; color: var(--ink-muted); margin-bottom: .6rem; }
.footer ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .3rem; font-size: .87rem; }
.footer a { color: var(--ink-2); text-decoration: none; }
.footer a:hover { color: var(--brand); }
.footer__legal { margin-top: 1.8rem; padding-top: 1.2rem; border-top: 1px solid var(--line); font-size: .8rem; color: var(--ink-muted); display: flex; gap: 1rem; flex-wrap: wrap; align-items: center; }

/* ------------------------------------------------------------- Ladezustand */

.loading { display: grid; place-items: center; min-height: 50vh; gap: .8rem; color: var(--ink-muted); }
.spinner { width: 26px; height: 26px; border: 2.5px solid var(--line-strong); border-top-color: var(--brand); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* --------------------------------------------------------------------- Druck */

@media print {
  .topbar, .toolbar, .footer, .drawer, .palette, .loadmore, .chartswitch { display: none !important; }
  body { background: #fff; }
  .card, .rows, .tablewrap { break-inside: avoid; }
}
