/* PalettenProfis: Gestaltungskonzept siehe docs/GESTALTUNG.md */
:root {
  color-scheme: light;
  color-scheme: only light;
  --ink: #14213D;
  --ink-2: #334155;
  --muted: #5B6475;
  --sand: #F6F3EE;
  --sand-2: #EDE8DF;
  --line: #E2DED6;
  --surface: #FFFFFF;
  --accent: #0F766E;
  --accent-hover: #0B5E58;
  --accent-tint: #E3F1EF;
  --pos: #15803D;
  --pos-tint: #E7F4EA;
  --neg: #B91C1C;
  --neg-tint: #FBE9E9;
  --warn: #B45309;
  --warn-tint: #FBF0E2;
  --hero-text: #FFFFFF;
  --hero-muted: #C9D2E3;
  --s1: #2563EB; /* Diagramm: vorsichtig */
  --s2: #0D9488; /* Diagramm: mittel / Erlös */
  --s3: #EA580C; /* Diagramm: günstig / Kosten */
  --radius: 16px;
  --shadow: 0 1px 2px rgba(20, 33, 61, .06), 0 8px 24px rgba(20, 33, 61, .06);
  --pad: 80px;
  --gut: 32px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--surface);
}
* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; }
img, svg { display: block; }
a { color: var(--accent); text-underline-offset: 3px; }
a:hover { color: var(--accent-hover); }
:focus-visible { outline: 3px solid #F59E0B; outline-offset: 2px; border-radius: 6px; }
.wrap { max-width: 1240px; margin: 0 auto; padding: 0 var(--gut); }
h1, h2, h3 { margin: 0; letter-spacing: -0.01em; }
h1 { font-size: clamp(34px, 3vw + 13px, 56px); line-height: 1.06; font-weight: 800; }
h2 { font-size: 30px; line-height: 1.2; font-weight: 750; }
h3 { font-size: 20px; line-height: 1.3; font-weight: 700; }
p { margin: 0; }
.lead { font-size: 18px; color: var(--ink-2); max-width: 760px; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.num { font-variant-numeric: tabular-nums; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Kopf */
.top { background: var(--ink); color: var(--hero-text); position: sticky; top: 0; z-index: 20;
       border-bottom: 1px solid rgba(255, 255, 255, .08); }
.top .wrap { display: flex; align-items: center; gap: 24px; min-height: 64px; }
.brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; font-weight: 800;
         font-size: 19px; white-space: nowrap; }
.brand:hover { color: #fff; }
.brand .ico { color: #5EEAD4; }
.nav { display: flex; gap: 4px; flex: 1; overflow-x: auto; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav a { color: var(--hero-muted); text-decoration: none; padding: 8px 12px; border-radius: 10px; font-weight: 600;
         font-size: 15px; white-space: nowrap; }
.nav a:hover { color: #fff; background: rgba(255, 255, 255, .08); }
.nav a[aria-current="page"] { color: #fff; background: rgba(255, 255, 255, .14); }
.top-actions { display: flex; gap: 8px; align-items: center; }

/* Knöpfe und Eingaben */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px;
       border-radius: 12px; border: 1.5px solid var(--accent); background: var(--accent); color: #fff; font: inherit;
       font-weight: 650; font-size: 15px; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: #fff; }
.btn.ghost { background: transparent; color: var(--accent); }
.btn.ghost:hover { background: var(--accent-tint); color: var(--accent-hover); }
.btn.light { background: transparent; border-color: rgba(255, 255, 255, .45); color: #fff; }
.btn.light:hover { background: rgba(255, 255, 255, .1); }
.btn.small { min-height: 36px; padding: 0 12px; font-size: 14px; border-radius: 10px; }
.btn[disabled] { opacity: .55; cursor: progress; }
.btn .ico { width: 18px; height: 18px; }
input, select, textarea { font: inherit; font-size: 15px; color: var(--ink); background: #fff; border: 1.5px solid #CFC9BE;
       border-radius: 10px; min-height: 44px; padding: 8px 12px; width: 100%; }
textarea { min-height: 88px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--accent-tint); }
label { font-weight: 600; font-size: 14px; color: var(--ink-2); display: block; margin-bottom: 6px; }
.field { min-width: 0; }
.hint { font-size: 13px; color: var(--muted); margin-top: 4px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; align-items: end; }
.form-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 16px; align-items: center; }

/* Abschnitte */
.band { padding: var(--pad) 0; background: var(--surface); }
.band.sand { background: var(--sand); }
.band + .band.same { padding-top: 0; }
.hero { background: var(--ink); color: var(--hero-text); padding: 72px 0 var(--pad); }
.hero .lead { color: var(--hero-muted); }
.hero a:not(.btn) { color: #99F6E4; }
.eyebrow { font-size: 14px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: #5EEAD4;
           margin-bottom: 14px; display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.band .eyebrow { color: var(--accent); }
.section-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; margin-bottom: 32px;
                flex-wrap: wrap; }
.section-head > div { max-width: 780px; }
.section-head p { color: var(--ink-2); margin-top: 8px; }
.crumb { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; margin-bottom: 16px; }

/* Karten */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
        padding: 24px; min-width: 0; }
.sand .card { border-color: var(--sand-2); }
.grid { display: grid; gap: 20px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.stack > * + * { margin-top: 16px; }

/* Kennzahlkacheln */
.tile { display: flex; flex-direction: column; gap: 6px; }
.tile .ico-box { width: 44px; height: 44px; border-radius: 12px; background: var(--accent-tint); color: var(--accent);
                 display: grid; place-items: center; margin-bottom: 6px; }
.tile .ico-box .ico { width: 22px; height: 22px; }
.tile .label { font-size: 14px; font-weight: 650; color: var(--ink-2); }
.tile .value { font-size: 34px; line-height: 1.1; font-weight: 800; font-variant-numeric: tabular-nums;
               overflow-wrap: anywhere; }
.tile .value.na { font-size: 20px; font-weight: 700; color: var(--muted); line-height: 1.35; }
.tile .note { font-size: 14px; color: var(--muted); }
.value.pos { color: var(--pos); } .value.neg { color: var(--neg); }

/* Empfehlungskarten */
.rec { display: flex; flex-direction: column; gap: 14px; }
.rec .rank { width: 40px; height: 40px; border-radius: 12px; background: var(--ink); color: #fff; display: grid;
             place-items: center; font-weight: 800; font-size: 18px; }
.rec .rec-head { display: flex; gap: 14px; align-items: flex-start; }
.rec h3 { font-size: 18px; }
.kv { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 16px; margin: 0; }
.kv dt { font-size: 13px; color: var(--muted); font-weight: 600; }
.kv dd { margin: 0; font-weight: 750; font-size: 18px; font-variant-numeric: tabular-nums; }
.rec .actions { margin-top: auto; display: flex; gap: 10px; flex-wrap: wrap; }

/* Kein Kandidat */
.verdict { display: flex; gap: 20px; align-items: flex-start; margin-top: 32px; padding: 24px; border-radius: var(--radius);
           background: rgba(255, 255, 255, .06); border: 1px solid rgba(255, 255, 255, .14); max-width: 980px; }
.verdict .ico { width: 28px; height: 28px; color: #FCD34D; flex: none; margin-top: 2px; }
.verdict ul { margin: 10px 0 0; padding-left: 20px; color: var(--hero-muted); }
.verdict li + li { margin-top: 6px; }

/* Prüfungen */
.gates { display: grid; gap: 12px; }
.gate { display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; gap: 16px; align-items: start; padding: 18px 20px; }
.gate .ico-box { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; }
.gate.ok .ico-box { background: var(--pos-tint); color: var(--pos); }
.gate.fail .ico-box { background: var(--neg-tint); color: var(--neg); }
.gate .ico { width: 22px; height: 22px; }
.gate h3 { font-size: 17px; }
.gate .ev { color: var(--ink-2); font-size: 15px; margin-top: 4px; overflow-wrap: anywhere; }
.gate .why { font-size: 14px; color: var(--muted); margin-top: 2px; }
.gate .side { text-align: right; }
.count { font-size: 30px; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1; }

/* Statusmarken */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; font-size: 13px;
         font-weight: 700; white-space: nowrap; border: 1px solid transparent; line-height: 1.4; }
.badge .ico { width: 14px; height: 14px; }
.badge.pos { background: var(--pos-tint); color: var(--pos); }
.badge.neg { background: var(--neg-tint); color: var(--neg); }
.badge.warn { background: var(--warn-tint); color: var(--warn); }
.badge.neutral { background: var(--sand-2); color: var(--ink-2); }
.hero .badge.neutral { background: rgba(255, 255, 255, .12); color: #fff; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.dots { display: inline-flex; gap: 4px; vertical-align: middle; }
.dots i { width: 10px; height: 10px; border-radius: 3px; background: #D7D2C8; display: block; }
.dots i.on { background: var(--pos); }

/* Hinweisband */
.banner { display: flex; gap: 16px; align-items: flex-start; padding: 20px 24px; border-radius: var(--radius); margin-bottom: 28px; }
.banner .ico { width: 24px; height: 24px; flex: none; margin-top: 2px; }
.banner.warn { background: var(--warn-tint); color: #7C3A06; }
.banner.pos { background: var(--pos-tint); color: #14532D; }
.banner.neg { background: var(--neg-tint); color: #7F1D1D; }
.banner strong { display: block; margin-bottom: 2px; }

/* Tabellen */
.table-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--line); background: #fff; }
table.data { width: 100%; border-collapse: collapse; font-size: 15px; }
table.data th { text-align: left; font-size: 13px; font-weight: 700; color: var(--ink-2); background: #FAF8F4;
                padding: 12px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.data td { padding: 12px 14px; border-bottom: 1px solid #EEEAE3; vertical-align: top; }
table.data tr:last-child td { border-bottom: 0; }
table.data td.r, table.data th.r { text-align: right; font-variant-numeric: tabular-nums; }
table.data tbody tr:hover { background: #FBFAF7; }
.cell-title { font-weight: 650; }
.cell-sub { font-size: 13px; color: var(--muted); }
.issue { color: var(--warn); font-size: 13px; }

/* Filterleiste */
.filters { display: grid; grid-template-columns: 1.6fr repeat(5, minmax(0, 1fr)) 1.2fr; gap: 12px; align-items: end;
           margin-bottom: 20px; }
.result-line { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; gap: 12px;
               flex-wrap: wrap; }

/* Diagramme */
.chart { position: relative; }
.chart svg text { font-family: inherit; }
.chart .legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 14px; color: var(--ink-2); margin: 4px 0 8px; }
.chart .legend span { display: inline-flex; align-items: center; gap: 8px; }
.chart .legend svg { flex: none; }
.tip { position: absolute; pointer-events: none; background: var(--ink); color: #fff; border-radius: 10px; padding: 8px 12px;
       font-size: 13px; line-height: 1.5; box-shadow: var(--shadow); white-space: nowrap; z-index: 5; display: none; }
.tip b { font-weight: 700; }
details.values { margin-top: 10px; font-size: 14px; }
details.values summary { cursor: pointer; color: var(--accent); font-weight: 650; }
details.values .table-wrap { margin-top: 10px; max-height: 280px; overflow: auto; }
details.values table.data th { position: sticky; top: 0; }  /* nur hier rollt die Tabelle in sich */
.chart-card h3 { margin-bottom: 4px; }
.chart-card .sub { font-size: 14px; color: var(--muted); margin-bottom: 8px; }
.prov-chip { margin-bottom: 8px; }
.section-head .banner.prov { margin: 12px 0 12px; }

/* Anmeldung */
.login { min-height: 100vh; display: grid; place-items: center; background: var(--ink); padding: 24px; }
.login .card { width: 100%; max-width: 420px; }
.login h1 { font-size: 34px; margin: 8px 0 6px; }

/* Meldung */
.toast { position: fixed; right: 24px; bottom: 24px; z-index: 50; max-width: min(460px, calc(100vw - 48px));
         background: var(--ink); color: #fff; padding: 14px 18px; border-radius: 12px; box-shadow: var(--shadow);
         display: none; font-size: 15px; }
.toast.err { background: var(--neg); }
.toast.show { display: block; }

.empty { padding: 32px; text-align: center; color: var(--muted); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; overflow-wrap: anywhere; }
.ico { width: 22px; height: 22px; flex: none; }
.foot { padding: 32px 0; background: var(--sand); color: var(--muted); font-size: 14px; border-top: 1px solid var(--sand-2); }
.split { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.price-big { font-size: 40px; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1.1; }
.hero-grid { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 32px; align-items: end; }
.hero-side { text-align: right; }
.hero-side .muted { color: var(--hero-muted); }
.list-plain { margin: 0; padding-left: 20px; }
.list-plain li + li { margin-top: 6px; }
.tag-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; }
.pager { display: flex; justify-content: center; margin-top: 16px; }

@media (max-width: 1100px) {
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filters { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .filters .f-search { grid-column: 1 / -1; }
}
@media (max-width: 900px) {
  :root { --pad: 56px; --gut: 20px; }
  .top .wrap { flex-wrap: wrap; gap: 8px 16px; padding-top: 10px; padding-bottom: 6px; }
  .nav { order: 3; flex-basis: 100%; margin: 0 -6px; }
  .top-actions { margin-left: auto; }
  .g3, .g2, .split { grid-template-columns: minmax(0, 1fr); }
  .hero { padding: 48px 0 var(--pad); }
  .hero-grid { grid-template-columns: minmax(0, 1fr); }
  .hero-side { text-align: left; }
}
@media (max-width: 640px) {
  h2 { font-size: 24px; }
  .g4 { grid-template-columns: minmax(0, 1fr); }
  .filters { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .tile .value { font-size: 30px; }
  .gate { grid-template-columns: 40px minmax(0, 1fr); }
  .gate .side { grid-column: 2; text-align: left; }
  .btn-label-wide { display: none; }
  /* Tabellen als Karten */
  table.cards thead { display: none; }
  table.cards, table.cards tbody, table.cards tr, table.cards td { display: block; width: 100%; }
  table.cards tr { padding: 14px 16px; border-bottom: 1px solid var(--line); }
  table.cards td { border: 0; padding: 4px 0; display: grid; grid-template-columns: 112px minmax(0, 1fr); gap: 10px; }
  table.cards td.r { text-align: left; }
  table.cards td::before { content: attr(data-label); font-size: 13px; font-weight: 650; color: var(--muted); }
  table.cards td.full { display: block; }
  table.cards td.full::before { content: none; }
  .price-big { font-size: 32px; }
  .verdict { flex-direction: column; gap: 12px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* Abstände als Klassen (statt Inline-Stil, wegen CSP) */
.mt10 { margin-top: 10px; }
.mt12 { margin-top: 12px; }
.mt14 { margin-top: 14px; }
.mt16 { margin-top: 16px; }
.mt20 { margin-top: 20px; }
.mt28 { margin-top: 28px; }
.mt32 { margin-top: 32px; }
.mt40 { margin-top: 40px; }
.mt8 { margin-top: 8px; }
.mb20 { margin-bottom: 20px; }
.my612 { margin: 6px 0 12px; }

.card .eyebrow { color: var(--accent); }

/* Kopf: Navigation in eigener Zeile, sobald sie nicht mehr neben Marke und Knöpfe passt */
@media (max-width: 1199px) {
  .top .wrap { flex-wrap: wrap; gap: 8px 16px; padding-top: 10px; padding-bottom: 6px; }
  .nav { order: 3; flex-basis: 100%; margin: 0 -6px; }
  .top-actions { margin-left: auto; }
}

/* Karten: Titel auf zwei Zeilen begrenzt, damit gleichrangige Werte nebeneinander auf einer Höhe stehen */
.rec-title { min-width: 0; }
.rec-title h3 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
                min-height: calc(2 * 1.3em); }
.kv .full { grid-column: 1 / -1; }
.card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 8px; }

/* Schlüsselwerte: Wert an den Fuß, damit Werte einer Reihe auf einer Höhe stehen, auch bei umbrechenden Bezeichnungen */
.kv > div { display: flex; flex-direction: column; }
.kv > div > dd { margin-top: auto; }
.card-head { flex-wrap: wrap; }
.card-head h3 { min-width: 0; }
/* Annahmen: Quellfeld breit genug; unter 1200 px als Karten statt Tabelle */
table.assume .src { min-width: 150px; }
@media (max-width: 1199px) {
  table.assume thead { display: none; }
  table.assume, table.assume tbody, table.assume tr, table.assume td { display: block; width: 100%; }
  table.assume tr { padding: 14px 0; border-bottom: 1px solid var(--line); }
  table.assume td { border: 0; padding: 4px 0; display: grid; grid-template-columns: 112px minmax(0, 1fr); gap: 10px; }
  table.assume td::before { content: attr(data-label); font-size: 13px; font-weight: 650; color: var(--muted); }
  table.assume td.full { display: block; }
  table.assume td.full::before { content: none; }
  table.assume .src { min-width: 0; }
}

/* Quellenkarten: Abzeichen über dem Titel, damit Abzeichen nebeneinanderliegender Karten auf einer Höhe stehen */
.card-head { flex-direction: column; align-items: flex-start; gap: 8px; }
.nowrap { white-space: nowrap; }
