/* KONTOR — Research Center
 *
 * Alle Farben, Abstände und Schriftgrößen stehen als Tokens hier oben. Kommt das
 * Design aus dem Design-Projekt, wird dieser Block getauscht und nicht acht Seiten.
 *
 * Zwei Regeln, die das Aussehen bestimmen und nicht verhandelbar sind:
 *   1. Ein fehlender Wert sieht anders aus als eine Null. „keine Daten" steht da,
 *      wo nichts gerechnet werden konnte — nie ein Strich, nie eine 0.
 *   2. Jede Zahl trägt sichtbar ihre Herkunft: gemessen, gerechnet oder formuliert.
 */

:root {
  --bg: #f4f4f2;
  --surface: #ffffff;
  --surface-2: #edece8;
  --surface-3: #e3e2dc;
  --ink: #12161f;
  --ink-soft: #4a5160;
  --ink-dim: #8b8f99;
  --accent: #a8761b;
  --accent-bright: #e9b44c;
  --deep: #12161f;
  --pos: #1c6b45;
  --pos-bg: #e3f0e9;
  --neg: #a52620;
  --neg-bg: #f6e5e4;
  --warn: #8a6412;
  --warn-bg: #f7efdd;
  --line: #e3e2dc;
  --sans: "Inter Tight", "Helvetica Neue", Helvetica, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, Menlo, monospace;
  --max-w: 1280px;
  --radius: 10px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; padding: 0; }
body { background: var(--bg); color: var(--ink); font-family: var(--sans); -webkit-font-smoothing: antialiased; font-size: 15px; line-height: 1.5; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; letter-spacing: -.025em; font-weight: 800; }
h1 { font-size: clamp(24px, 2.6vw, 34px); }
h2 { font-size: 19px; }
h3 { font-size: 15px; }

.shell { max-width: var(--max-w); margin: 0 auto; padding: 0 28px; }
@media (max-width: 720px) { .shell { padding: 0 16px; } }

/* Kopf */
.top { position: sticky; top: 0; z-index: 40; background: rgba(244, 244, 242, .88); backdrop-filter: blur(16px); border-bottom: 1px solid var(--line); }
.top__row { display: flex; align-items: center; gap: 28px; height: 58px; }
.brand { display: flex; align-items: baseline; gap: 8px; color: var(--ink); flex: none; }
.brand:hover { text-decoration: none; }
.brand__mark { font-weight: 900; letter-spacing: -.05em; font-size: 21px; }
.brand__sub { font-family: var(--mono); font-size: 10.5px; letter-spacing: .14em; color: var(--ink-dim); text-transform: uppercase; }
.nav { display: flex; align-items: center; gap: 20px; overflow-x: auto; scrollbar-width: none; min-width: 0; }
.nav::-webkit-scrollbar { display: none; }
.nav a { font-size: 14px; font-weight: 600; color: var(--ink-soft); white-space: nowrap; }
.nav a:hover { color: var(--ink); text-decoration: none; }
.nav a.is-active { color: var(--ink); background: var(--surface-3); padding: 5px 12px; border-radius: 999px; }
.stand { margin-left: auto; font-family: var(--mono); font-size: 11.5px; color: var(--ink-dim); white-space: nowrap; flex: none; }
/* Auf schmalen Fenstern hat die Navigation Vorrang vor dem Datenstand — er steht
   ohnehin auf jeder Seite noch einmal am Inhalt. */
@media (max-width: 1080px) { .stand { display: none; } }

/* Seitenkopf */
.pagehead { padding: 30px 0 20px; }
.pagehead p { color: var(--ink-soft); margin: 8px 0 0; max-width: 68ch; }

/* Karten und Raster */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.grid { display: grid; gap: 14px; }
.grid--2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.grid--3 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.sectrow { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin: 32px 0 12px; }
.sectrow .meta { font-family: var(--mono); font-size: 12px; color: var(--ink-dim); }

/* Kennzahlen */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.kpi { background: var(--surface); padding: 14px 16px; }
.kpi__label { font-family: var(--mono); font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-dim); }
.kpi__value { font-size: 26px; font-weight: 800; letter-spacing: -.03em; margin-top: 4px; }
.kpi__note { font-size: 12px; color: var(--ink-dim); margin-top: 2px; }

/* Werte */
.num { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.pos { color: var(--pos); }
.neg { color: var(--neg); }
.nodata { color: var(--ink-dim); font-style: italic; font-family: var(--sans); font-size: 13px; }
.prov { font-family: var(--mono); font-size: 9.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-dim); border: 1px solid var(--line); border-radius: 4px; padding: 1px 4px; vertical-align: 1px; }

/* Marken */
.tag { display: inline-block; font-family: var(--mono); font-size: 10.5px; letter-spacing: .06em; padding: 2px 7px; border-radius: 999px; background: var(--surface-2); color: var(--ink-soft); }
.tag--ok { background: var(--pos-bg); color: var(--pos); }
.tag--warn { background: var(--warn-bg); color: var(--warn); }
.tag--bad { background: var(--neg-bg); color: var(--neg); }

/* Heatmap */
.hm { display: grid; grid-template-columns: repeat(auto-fill, minmax(158px, 1fr)); gap: 8px; }
.hm__cell { border-radius: var(--radius); padding: 12px; min-height: 116px; display: flex; flex-direction: column; border: 1px solid var(--line); }
.hm__cell:hover { text-decoration: none; outline: 2px solid var(--ink); outline-offset: 1px; }
.hm__name { font-weight: 800; letter-spacing: -.02em; font-size: 15px; line-height: 1.15; }
.hm__val { font-family: var(--mono); font-size: 20px; font-weight: 600; margin-top: auto; }
/* Auf eingefärbten Kacheln muss die Unterzeile lesbar bleiben — deshalb Deckkraft
   statt einer festen grauen Farbe, die auf Grün oder Rot verschwindet. */
.hm__sub { font-family: var(--mono); font-size: 10.5px; color: currentColor; opacity: .78; margin-top: 3px; }
.hm__legend { display: flex; align-items: center; gap: 8px; margin-top: 12px; font-family: var(--mono); font-size: 11px; color: var(--ink-dim); }
.hm__swatch { width: 22px; height: 11px; border-radius: 3px; border: 1px solid var(--line); }

/* Tabellen — breite Inhalte scrollen in sich, nie die Seite */
.tablewrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th, td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-family: var(--mono); font-size: 10.5px; letter-spacing: .09em; text-transform: uppercase; color: var(--ink-dim); font-weight: 500; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; }

/* Zustände */
.state { padding: 44px 20px; text-align: center; border: 1px dashed var(--line); border-radius: var(--radius); background: var(--surface); }
.state__title { font-weight: 700; }
.state__text { color: var(--ink-soft); margin-top: 6px; font-size: 14px; }
.state__hint { font-family: var(--mono); font-size: 12px; color: var(--ink-dim); margin-top: 10px; word-break: break-all; }
.state--error { border-color: var(--neg); border-style: solid; }
.state--error .state__title { color: var(--neg); }
.banner { border: 1px solid var(--warn); background: var(--warn-bg); color: var(--warn); border-radius: var(--radius); padding: 10px 14px; font-size: 13.5px; margin-bottom: 16px; }
.skel { background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 37%, var(--surface-2) 63%); background-size: 400% 100%; animation: sk 1.3s ease infinite; border-radius: 6px; }
@keyframes sk { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

/* Listen */
.list { display: flex; flex-direction: column; gap: 10px; }
.item { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 13px 15px; }
.item__title { font-weight: 700; letter-spacing: -.015em; }
.item__meta { font-family: var(--mono); font-size: 11.5px; color: var(--ink-dim); margin-top: 5px; display: flex; flex-wrap: wrap; gap: 10px; }
.item--dup { opacity: .62; }

.foot { margin: 60px 0 40px; padding-top: 18px; border-top: 1px solid var(--line); font-family: var(--mono); font-size: 11.5px; color: var(--ink-dim); display: flex; flex-wrap: wrap; gap: 14px; justify-content: space-between; }
.prose p { max-width: 72ch; }
.prose ul { max-width: 72ch; padding-left: 20px; }
.prose li { margin: 4px 0; }
