/* ============================================================
   KI-Gateway · PlanFamilia-Rahmen in Graphit
   Helle Kopfleiste mit Haarlinie, große Flächen weiß, Graphit trägt die Schrift,
   #7d0303 markiert nur Aktives (Navigation, Fokus, Hervorhebung). Kein Dunkelmodus.
   ============================================================ */

@font-face {
  font-family: 'Inter'; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url(/statisch/inter-var-latin.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;
}
@font-face {
  font-family: 'Inter'; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url(/statisch/inter-var-latin-ext.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;
}

:root {
  color-scheme: light;
  --bg: #ffffff;
  --flaeche: #f7f7f8;
  --karte: #ffffff;
  --graphit: #2b2f33;
  --graphit-2: #3d4248;
  --text: #1f2328;
  --muted: #646b74;
  --line: #e6e7ea;
  --line-strong: #d0d3d8;
  --akzent: #7d0303;
  --akzent-tint: rgba(125, 3, 3, 0.08);
  --akzent-ring: rgba(125, 3, 3, 0.16);
  --ok: #2f7a4a;
  --ok-tint: rgba(47, 122, 74, 0.08);
  --warn: #8a6610;
  --warn-tint: rgba(199, 154, 26, 0.12);
  --danger: #a12a2a;
  --danger-tint: rgba(161, 42, 42, 0.07);
  --r-sm: 10px;
  --r: 16px;
  --shadow-sm: 0 1px 2px rgba(20, 22, 26, 0.04), 0 4px 16px rgba(20, 22, 26, 0.04);
  --font: "Inter", "Segoe UI", system-ui, -apple-system, Helvetica, Arial, sans-serif;
  --fs-s: 0.8rem;
  --fs-m: 0.94rem;
  --fs-l: 1.15rem;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; display: flex; flex-direction: column;
  font-family: var(--font); font-size: var(--fs-m); line-height: 1.55; color: var(--text);
  background: var(--bg); font-feature-settings: "tnum" 1;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
::selection { background: var(--akzent); color: #fff; }
a { color: var(--graphit); }

/* ---- Kopfleiste: hell, Haarlinie, aktiver Punkt als Akzentstrich ---- */
.kopf {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255, 255, 255, 0.88);
  -webkit-backdrop-filter: saturate(160%) blur(14px); backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid var(--line);
}
.kopf-inhalt {
  max-width: 72rem; margin: 0 auto; padding: 0 1.5rem; min-height: 3.75rem;
  display: flex; align-items: stretch; gap: 2rem;
}
.marke {
  display: inline-flex; align-items: baseline; align-self: center; gap: 0.5rem; flex: 0 0 auto;
  font-size: 1.2rem; font-weight: 650; letter-spacing: -0.025em; color: var(--graphit); text-decoration: none;
}
.marke span { font-size: 0.72rem; font-weight: 400; letter-spacing: 0; color: var(--muted); white-space: nowrap; }
.nav { display: flex; align-items: stretch; gap: 0.15rem; flex: 1 1 auto; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav a {
  position: relative; display: inline-flex; align-items: center; padding: 0 0.7rem;
  font-size: 0.9rem; font-weight: 500; letter-spacing: -0.005em; white-space: nowrap;
  color: var(--muted); text-decoration: none; border-radius: 6px; transition: color 0.15s ease-out;
}
.nav a:hover, .nav a[aria-current="page"] { color: var(--graphit); }
.nav a[aria-current="page"]::after {
  content: ""; position: absolute; left: 0.7rem; right: 0.7rem; bottom: -1px; height: 2px;
  background: var(--akzent); border-radius: 2px 2px 0 0;
}
.kopf form { margin: 0; align-self: center; }

/* ---- Inhalt ---- */
main { flex: 1 0 auto; width: 100%; max-width: 72rem; margin: 0 auto; padding: 2rem 1.5rem 3rem; }
h1 { font-size: 1.6rem; font-weight: 650; letter-spacing: -0.02em; color: var(--graphit); margin: 0 0 0.35rem; line-height: 1.2; }
h2 { font-size: var(--fs-l); font-weight: 600; letter-spacing: -0.01em; color: var(--graphit); margin: 0 0 0.9rem; line-height: 1.25; }
.unterzeile { color: var(--muted); margin: 0 0 1.75rem; max-width: 52rem; }
.karte {
  background: var(--karte); border: 1px solid var(--line); border-radius: var(--r);
  box-shadow: var(--shadow-sm); padding: 1.4rem 1.5rem; margin-bottom: 1.25rem;
}

/* ---- Kennzahlen ---- */
.raster { display: grid; gap: 0.9rem; grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); margin-bottom: 1.25rem; }
.kennzahl { border: 1px solid var(--line); border-radius: var(--r-sm); padding: 0.95rem 1.1rem; background: var(--karte); }
.kennzahl .titel { font-size: var(--fs-s); color: var(--muted); }
.kennzahl .wert { font-size: 1.45rem; font-weight: 650; letter-spacing: -0.015em; color: var(--graphit); margin-top: 0.2rem; }
.kennzahl .neben { font-size: var(--fs-s); color: var(--muted); }
.kennzahl:nth-child(2) { border-color: var(--akzent); box-shadow: inset 3px 0 0 var(--akzent); }

/* ---- Tabellen: Haarlinien, keine Flächen ---- */
.tabelle-huelle { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
th {
  text-align: left; font-weight: 500; color: var(--muted); font-size: 0.74rem; text-transform: uppercase;
  letter-spacing: 0.05em; padding: 0.55rem 0.7rem; border-bottom: 1px solid var(--line); white-space: nowrap;
}
td { padding: 0.65rem 0.7rem; border-bottom: 1px solid var(--line); vertical-align: top; }
tbody tr:hover td { background: var(--flaeche); }
tr:last-child td { border-bottom: 0; }
td.zahl, th.zahl { text-align: right; white-space: nowrap; }
code, .mono { font-family: ui-monospace, "JetBrains Mono", Consolas, monospace; font-size: 0.82rem; color: var(--graphit-2); }

/* ---- Marken (Status) ---- */
.marke-klein { display: inline-block; padding: 0.08rem 0.55rem; border-radius: 999px; font-size: 0.74rem; font-weight: 600; white-space: nowrap; }
.ok { background: var(--ok-tint); color: var(--ok); }
.nein { background: var(--danger-tint); color: var(--danger); }
.warn { background: var(--warn-tint); color: var(--warn); }
.neutral { background: var(--flaeche); color: var(--muted); border: 1px solid var(--line); }

/* ---- Hinweise: Farbe nur als Kante ---- */
.hinweis { padding: 0.75rem 1rem; border-radius: var(--r-sm); margin-bottom: 1rem; border: 1px solid var(--line); border-left-width: 4px; background: var(--karte); }
.hinweis.gut { border-left-color: var(--ok); color: var(--text); }
.hinweis.schlecht { border-left-color: var(--danger); color: var(--danger); background: var(--danger-tint); }
.hinweis.warnung { border-left-color: #c79a1a; color: var(--text); }

/* ---- Formulare: kleine graue Labels über den Feldern ---- */
label { display: block; margin: 1rem 0 0.35rem; font-size: var(--fs-s); font-weight: 500; color: var(--muted); letter-spacing: 0.02em; }
label.haken { display: flex; gap: 0.55rem; align-items: flex-start; font-size: var(--fs-m); font-weight: 400; color: var(--text); letter-spacing: 0; margin: 0.45rem 0; }
label.haken input { margin-top: 0.3rem; accent-color: var(--akzent); }
.hilfe { color: var(--muted); font-size: var(--fs-s); margin: 0.35rem 0 0; }
input[type=text], input[type=password], input[type=number], input[type=file], select, textarea {
  width: 100%; max-width: 34rem; padding: 0.6rem 0.8rem; font: inherit; font-size: var(--fs-m); color: var(--text);
  background: var(--karte); border: 1px solid var(--line-strong); border-radius: var(--r-sm);
  transition: border-color 0.2s, box-shadow 0.2s;
}
input::placeholder { color: #9aa0a8; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--akzent); box-shadow: 0 0 0 3px var(--akzent-ring); }
button:focus-visible, a:focus-visible, summary:focus-visible { outline: 2px solid var(--akzent); outline-offset: 2px; }
.code-feld { max-width: 12rem !important; font-size: 1.35rem !important; letter-spacing: 0.3em; text-align: center; }

/* ---- Knöpfe: Pills. Primär Graphit, sekundär weiß mit Haarlinie, Gefahr nur rot umrandet ---- */
button, .knopf {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
  padding: 0.62rem 1.25rem; font-family: var(--font); font-size: 0.9rem; font-weight: 600; line-height: 1.2;
  border-radius: 999px; border: 1px solid var(--line-strong); background: var(--karte); color: var(--graphit);
  text-decoration: none; white-space: nowrap; cursor: pointer;
  transition: background 0.2s, border-color 0.2s, color 0.2s, box-shadow 0.2s, transform 0.2s;
}
button:hover, .knopf:hover { border-color: var(--graphit); }
.primaer { background: var(--graphit); color: #fff; border-color: var(--graphit); box-shadow: var(--shadow-sm); }
.primaer:hover { background: var(--graphit-2); border-color: var(--graphit-2); box-shadow: 0 6px 18px rgba(20, 22, 26, 0.18); transform: translateY(-1px); }
.gefahr { color: var(--danger); border-color: rgba(161, 42, 42, 0.3); }
.gefahr:hover { background: var(--danger-tint); border-color: var(--danger); }
.klein { padding: 0.38rem 0.8rem; font-size: var(--fs-s); }
.leise-knopf { background: transparent; color: var(--muted); border-color: var(--line); }
.leise-knopf:hover { color: var(--graphit); border-color: var(--graphit); }
button:disabled { opacity: 0.45; cursor: not-allowed; transform: none; box-shadow: none; }
.zeile { display: flex; gap: 0.6rem; flex-wrap: wrap; align-items: center; }
.zeile h1, .zeile h2 { margin-right: auto; }
.zeile form { margin: 0; }
.abstand { margin-top: 1.25rem; }

/* ---- Anmeldung ---- */
.anmeldung { max-width: 26rem; margin: 9vh auto; }
.anmeldung .karte { padding: 2rem; }
.anmeldung .marke { display: flex; margin-bottom: 1.5rem; }
.qr { width: 220px; height: 220px; background: #fff; padding: 8px; border: 1px solid var(--line); border-radius: var(--r-sm); }
.qr svg { width: 100%; height: 100%; }
.codes { columns: 2; font-family: ui-monospace, Consolas, monospace; font-size: 1rem; line-height: 2; }
.token {
  word-break: break-all; padding: 0.85rem 1rem; border-radius: var(--r-sm);
  background: var(--flaeche); border: 1px solid var(--line); border-left: 4px solid var(--akzent);
  font-family: ui-monospace, Consolas, monospace; color: var(--graphit);
}

/* ---- Diagramm ---- */
.balken svg { width: 100%; height: 120px; display: block; }
.balken rect { fill: var(--graphit); opacity: 0.85; }
.balken rect:last-of-type { fill: var(--akzent); opacity: 1; }
.balken .achse { display: flex; justify-content: space-between; color: var(--muted); font-size: 0.74rem; margin-top: 0.35rem; }
meter { width: 7.5rem; height: 0.6rem; vertical-align: middle; }

details summary { cursor: pointer; color: var(--muted); font-size: var(--fs-s); font-weight: 500; }
details summary:hover { color: var(--graphit); }
pre.json {
  max-height: 32rem; overflow: auto; background: var(--flaeche); color: var(--text); border: 1px solid var(--line);
  padding: 1rem; border-radius: var(--r-sm); font-size: 0.8rem; line-height: 1.5;
}
.felder { display: grid; grid-template-columns: max-content 1fr; gap: 0.4rem 1.25rem; font-size: 0.9rem; margin: 0; }
.felder dt { color: var(--muted); }
.felder dd { margin: 0; }
.modelle-wahl { columns: 2; max-width: 46rem; }
.fuss { color: var(--muted); font-size: 0.74rem; text-align: center; padding: 1.25rem; border-top: 1px solid var(--line); }

@media (max-width: 52rem) {
  .kopf-inhalt { flex-wrap: wrap; gap: 0 1rem; }
  .nav { order: 3; flex: 1 0 100%; margin: 0 -1.5rem; padding: 0 0.8rem; border-top: 1px solid var(--line); }
  .nav a { min-height: 2.75rem; }
}
@media (max-width: 40rem) {
  .kopf { position: static; }
  .kopf-inhalt { padding: 0 1rem; }
  .nav { margin: 0 -1rem; }
  main { padding: 1.5rem 1rem 2.5rem; }
  .modelle-wahl, .codes { columns: 1; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
