/* Karma Report: Performance-Dashboard (mandantenfaehig).
   Markenfarben kommen zur Laufzeit aus dem Mandanten-Branding (--brand, --accent),
   alles andere sind neutrale Tokens. Dark Mode: eigene Stufen, kein Auto-Flip. */

:root {
  color-scheme: light;
  --brand: #06962e;
  --brand-ink: #ffffff;
  --brand-soft: color-mix(in oklab, var(--brand) 12%, transparent);
  --accent: #efa414;
  --bg: #f5f5f2;
  --surface: #ffffff;
  --surface-2: #fafaf8;
  --line: #e6e5e0;
  --line-strong: #d4d3cc;
  --text: #141413;
  --text-2: #55544f;
  --text-3: #8a8983;
  --cmp: #a3a29b;
  --grid: #ecebe6;
  --good: #1a7f37;
  --bad: #c4322f;
  --shadow: 0 1px 2px rgba(20, 20, 19, .04), 0 4px 16px rgba(20, 20, 19, .04);
  --radius: 14px;
  --font: "Libre Franklin", system-ui, -apple-system, "Segoe UI", sans-serif;
  /* Kategorie-Palette (dataviz Referenz, feste Reihenfolge, validiert) */
  --s1: #2a78d6; --s2: #eb6834; --s3: #1baf7a; --s4: #eda100;
  --s5: #e87ba4; --s6: #008300; --s7: #6250d6; --s8: #e34948;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #121211;
    --surface: #1a1a19;
    --surface-2: #20201e;
    --line: #2c2c2a;
    --line-strong: #3a3a37;
    --text: #f0efec;
    --text-2: #c3c2b7;
    --text-3: #8f8e86;
    --cmp: #77766f;
    --grid: #262624;
    --good: #4cc26a;
    --bad: #f07470;
    --brand-soft: color-mix(in oklab, var(--brand) 22%, transparent);
    --shadow: none;
    --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500;
    --s5: #d55181; --s6: #008300; --s7: #9085e9; --s8: #e66767;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #121211; --surface: #1a1a19; --surface-2: #20201e; --line: #2c2c2a; --line-strong: #3a3a37;
  --text: #f0efec; --text-2: #c3c2b7; --text-3: #8f8e86; --cmp: #77766f; --grid: #262624;
  --good: #4cc26a; --bad: #f07470; --brand-soft: color-mix(in oklab, var(--brand) 22%, transparent); --shadow: none;
  --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500; --s5: #d55181; --s6: #008300; --s7: #9085e9; --s8: #e66767;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
  font-variant-numeric: tabular-nums;
}
a { color: inherit; }
button, input, select { font: inherit; color: inherit; }
.versteckt { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- Login ---------- */
.login {
  min-height: 100vh; display: grid; place-items: center; padding: 24px 16px;
  background:
    radial-gradient(1200px 500px at 10% -10%, var(--brand-soft), transparent 60%),
    radial-gradient(900px 500px at 110% 110%, color-mix(in oklab, var(--accent) 10%, transparent), transparent 60%),
    var(--bg);
}
.login-karte {
  width: 100%; max-width: 420px; background: var(--surface); border: 1px solid var(--line);
  border-radius: 20px; padding: 36px 32px; box-shadow: var(--shadow);
}
.login-karte img { height: 34px; display: block; margin-bottom: 26px; }
.login-karte h1 { font-size: 22px; margin: 0 0 6px; letter-spacing: -.01em; }
.login-karte p { margin: 0 0 22px; color: var(--text-2); }
.login-karte label { font-size: 13px; color: var(--text-2); font-weight: 600; }
.login-karte input {
  width: 100%; margin: 6px 0 14px; padding: 12px 14px; border-radius: 10px;
  border: 1px solid var(--line-strong); background: var(--surface-2); outline: none;
}
.login-karte input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.knopf {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 0; border-radius: 10px; padding: 12px 18px; cursor: pointer; font-weight: 600;
  background: var(--brand); color: var(--brand-ink); width: 100%;
}
.knopf:disabled { opacity: .6; cursor: default; }
.login-hinweis { margin-top: 16px; font-size: 14px; color: var(--text-2); }
.login-fuss { margin-top: 26px; font-size: 12px; color: var(--text-3); }

/* ---------- Kopf ---------- */
.kopf {
  position: sticky; top: 0; z-index: 30; background: color-mix(in oklab, var(--surface) 92%, transparent);
  backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--line);
}
.kopf-innen {
  max-width: 1360px; margin: 0 auto; padding: 12px 24px; display: flex; align-items: center; gap: 18px;
}
.kopf .logo { height: 26px; display: block; }
.kopf .titel { font-weight: 600; color: var(--text-2); font-size: 14px; border-left: 1px solid var(--line); padding-left: 16px; }
.kopf .spacer { flex: 1; }
.segment { display: inline-flex; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 3px; }
.segment button {
  border: 0; background: transparent; padding: 6px 14px; border-radius: 8px; cursor: pointer;
  font-weight: 600; font-size: 14px; color: var(--text-2);
}
.segment button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.stand {
  font-size: 12.5px; color: var(--text-2); background: var(--surface-2); border: 1px solid var(--line);
  padding: 5px 10px; border-radius: 999px; white-space: nowrap;
}
.stand b { color: var(--text); font-weight: 600; }
.ikon-knopf {
  border: 1px solid var(--line); background: var(--surface); border-radius: 10px; width: 36px; height: 36px;
  display: inline-grid; place-items: center; cursor: pointer; color: var(--text-2);
}
.ikon-knopf:hover { color: var(--text); border-color: var(--line-strong); }

/* ---------- Filterzeile + Reiter ---------- */
.leiste { max-width: 1360px; margin: 0 auto; padding: 18px 24px 0; }
.filter { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.dd { position: relative; }
.dd > button {
  display: inline-flex; align-items: center; gap: 10px; padding: 9px 14px; border-radius: 10px;
  border: 1px solid var(--line-strong); background: var(--surface); cursor: pointer; font-weight: 600; font-size: 14px;
}
.dd > button small { color: var(--text-3); font-weight: 500; }
.dd-menue {
  position: absolute; top: calc(100% + 6px); left: 0; z-index: 40; min-width: 260px; background: var(--surface);
  border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 12px 32px rgba(0,0,0,.14); padding: 6px;
}
.dd-menue button {
  display: flex; width: 100%; gap: 10px; align-items: center; border: 0; background: transparent; text-align: left;
  padding: 8px 10px; border-radius: 8px; cursor: pointer; font-size: 14px;
}
.dd-menue button:hover { background: var(--surface-2); }
.dd-menue button .haken { width: 16px; font-weight: 800; color: var(--brand); }
.dd-menue .eigener { border-top: 1px solid var(--line); margin-top: 6px; padding: 10px 8px 6px; display: grid; gap: 8px; }
.dd-menue .eigener div { display: flex; gap: 8px; }
.dd-menue input[type=date] { flex: 1; padding: 7px 8px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface-2); }
.dd-menue .knopf { padding: 8px 12px; }
.filter-hinweis { font-size: 13px; color: var(--text-3); }

.reiter { display: flex; gap: 4px; margin-top: 16px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.reiter button {
  border: 0; background: transparent; padding: 10px 14px; cursor: pointer; font-weight: 600; font-size: 14.5px;
  color: var(--text-2); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap;
}
.reiter button:hover { color: var(--text); }
.reiter button[aria-selected="true"] { color: var(--text); border-bottom-color: var(--brand); }

/* ---------- Inhalt ---------- */
main { max-width: 1360px; margin: 0 auto; padding: 22px 24px 60px; }
main.laedt { opacity: .55; transition: opacity .2s; }
.abschnitt-titel { display: flex; align-items: baseline; gap: 12px; margin: 28px 0 12px; }
.abschnitt-titel h2 { font-size: 17px; margin: 0; letter-spacing: -.01em; }
.abschnitt-titel span { color: var(--text-3); font-size: 13px; }
.abschnitt-titel:first-child { margin-top: 4px; }

.karte { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.karte-kopf { display: flex; align-items: center; gap: 10px; padding: 16px 18px 0; }
.karte-kopf h3 { margin: 0; font-size: 15px; }
.karte-kopf .spacer { flex: 1; }
.karte-kopf small { color: var(--text-3); }
.karte-inhalt { padding: 14px 18px 18px; }

/* KPI-Kacheln */
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.kpi { padding: 16px 16px 14px; position: relative; overflow: hidden; }
.kpi .label { font-size: 13px; color: var(--text-2); font-weight: 600; display: flex; gap: 6px; align-items: center; }
.kpi .wert { font-size: 28px; font-weight: 700; letter-spacing: -.02em; margin-top: 4px; line-height: 1.15; }
.kpi .vergleich { font-size: 12.5px; color: var(--text-3); margin-top: 6px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.delta { font-weight: 700; display: inline-flex; gap: 3px; align-items: center; }
.delta.plus { color: var(--good); }
.delta.minus { color: var(--bad); }
.delta.null { color: var(--text-3); }
.info { cursor: help; color: var(--text-3); font-weight: 500; border-bottom: 1px dotted var(--text-3); font-size: 12px; }
.kpi .spark { position: absolute; right: 12px; bottom: 12px; opacity: .9; }

/* Uebersicht: Kanal-Karten */
.kanaele { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.kanal { padding: 18px; cursor: pointer; transition: border-color .15s, transform .15s; text-align: left; }
.kanal:hover { border-color: var(--line-strong); transform: translateY(-1px); }
.kanal-kopf { display: flex; align-items: center; gap: 10px; font-weight: 700; }
.kanal-kopf .punkt { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); }
.kanal-kopf .pfeil { margin-left: auto; color: var(--text-3); }
.kanal-werte { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 14px; }
.kanal-werte .wert { font-size: 24px; }
.kanal-werte .label { font-size: 12.5px; }

.highlights { padding: 18px 20px; }
.highlights ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 10px; }
.highlights li { display: flex; gap: 10px; align-items: flex-start; }
.highlights li .ico { flex: 0 0 22px; height: 22px; border-radius: 6px; display: grid; place-items: center; font-size: 12px; background: var(--brand-soft); color: var(--brand); font-weight: 800; }

/* Raster */
.zwei { display: grid; grid-template-columns: 2fr 1fr; gap: 14px; }
.halb { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 980px) { .zwei, .halb { grid-template-columns: 1fr; } }

/* Diagramme */
.diagramm { position: relative; width: 100%; }
.diagramm svg { display: block; width: 100%; overflow: visible; }
.diagramm .achse text { fill: var(--text-3); font-size: 11.5px; }
.diagramm .gitter line { stroke: var(--grid); }
.legende { display: flex; flex-wrap: wrap; gap: 14px; font-size: 13px; color: var(--text-2); }
.legende span { display: inline-flex; align-items: center; gap: 6px; }
.legende i { width: 14px; height: 0; border-top: 2px solid; display: inline-block; }
.legende i.gestrichelt { border-top-style: dashed; }
.legende i.flaeche { height: 10px; border: 0; border-radius: 3px; }
.tooltip {
  position: absolute; pointer-events: none; z-index: 20; background: var(--surface); border: 1px solid var(--line);
  border-radius: 10px; padding: 8px 10px; font-size: 12.5px; box-shadow: 0 8px 24px rgba(0,0,0,.14); min-width: 150px;
  transform: translate(-50%, -100%); white-space: nowrap;
}
.tooltip .t-kopf { color: var(--text-3); margin-bottom: 4px; }
.tooltip .t-zeile { display: flex; align-items: center; gap: 8px; }
.tooltip .t-zeile b { font-size: 13.5px; }
.tooltip .t-zeile i { width: 12px; border-top: 2px solid; display: inline-block; }
.tooltip .t-zeile i.gestrichelt { border-top-style: dashed; }
.tooltip .t-zeile span { color: var(--text-2); }

/* Balkenliste */
.balken { display: grid; gap: 10px; }
.balken-zeile { display: grid; grid-template-columns: minmax(110px, 34%) 1fr auto; gap: 12px; align-items: center; font-size: 13.5px; }
.balken-zeile .name { color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.balken-zeile .spur { height: 10px; background: var(--surface-2); border-radius: 4px; overflow: hidden; }
.balken-zeile .fuell { height: 100%; border-radius: 0 4px 4px 0; }
.balken-zeile .zahl { font-weight: 700; min-width: 64px; text-align: right; }

/* Tabellen */
.tabelle-wrap { overflow-x: auto; }
table.daten { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.daten th {
  text-align: right; font-weight: 600; color: var(--text-2); padding: 9px 10px; border-bottom: 1px solid var(--line);
  white-space: nowrap; cursor: pointer; user-select: none; position: sticky; top: 0; background: var(--surface);
}
table.daten th:first-child, table.daten td:first-child { text-align: left; }
table.daten th[aria-sort="descending"]::after { content: " ↓"; color: var(--brand); }
table.daten th[aria-sort="ascending"]::after { content: " ↑"; color: var(--brand); }
table.daten td { padding: 9px 10px; border-bottom: 1px solid var(--line); text-align: right; white-space: nowrap; }
table.daten td:first-child { white-space: normal; min-width: 220px; }
table.daten tr:hover td { background: var(--surface-2); }
table.daten tfoot td { font-weight: 700; border-bottom: 0; border-top: 1px solid var(--line-strong); }
.tag { display: inline-block; font-size: 11.5px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); color: var(--text-2); margin-left: 6px; }
.tag.aktiv { background: var(--brand-soft); border-color: transparent; color: var(--brand); }
.klein-knopf { border: 1px solid var(--line); background: var(--surface); border-radius: 8px; padding: 5px 10px; font-size: 12.5px; cursor: pointer; color: var(--text-2); font-weight: 600; }
.klein-knopf:hover { color: var(--text); border-color: var(--line-strong); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { border: 1px solid var(--line-strong); background: var(--surface); border-radius: 999px; padding: 7px 14px; cursor: pointer; font-weight: 600; font-size: 14px; }
.chip[aria-pressed="true"] { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }

/* Beitraege */
.posts { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
.post { overflow: hidden; display: flex; flex-direction: column; text-decoration: none; }
.post .bild { aspect-ratio: 4 / 5; background: var(--surface-2) center / cover no-repeat; position: relative; }
.post .bild.yt { aspect-ratio: 16 / 9; }
.post .format { position: absolute; top: 8px; left: 8px; background: rgba(0,0,0,.62); color: #fff; font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 999px; }
.post .rang { position: absolute; top: 8px; right: 8px; background: var(--surface); color: var(--text); font-size: 12px; font-weight: 800; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; }
.post .text { padding: 10px 12px 0; font-size: 13px; color: var(--text-2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.9em; }
.post .zahlen { padding: 10px 12px 12px; display: flex; gap: 14px; font-size: 12.5px; color: var(--text-3); margin-top: auto; }
.post .zahlen b { color: var(--text); font-size: 14px; display: block; }

.leer { padding: 40px 20px; text-align: center; color: var(--text-2); }
.leer b { display: block; color: var(--text); font-size: 16px; margin-bottom: 6px; }
.hinweis-box { padding: 12px 14px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line); color: var(--text-2); font-size: 13.5px; }

footer.fuss { max-width: 1360px; margin: 0 auto; padding: 0 24px 36px; color: var(--text-3); font-size: 12.5px; display: flex; gap: 16px; flex-wrap: wrap; }

@media (max-width: 700px) {
  .kopf-innen, .leiste, main, footer.fuss { padding-left: 16px; padding-right: 16px; }
  .kopf-innen { flex-wrap: wrap; gap: 10px; row-gap: 10px; }
  .kopf .logo { height: 22px; }
  .kopf .segment { order: 10; width: 100%; }
  .kopf .segment button { flex: 1; }
  .stand { padding: 4px 8px; font-size: 12px; }
  .ikon-knopf { width: 32px; height: 32px; }
  .kopf .titel, .stand-lang { display: none; }
  .kpi .wert { font-size: 23px; }
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .balken-zeile { grid-template-columns: 1fr auto; }
  .balken-zeile .spur { grid-column: 1 / -1; grid-row: 2; }
}

@media print {
  .kopf { position: static; }
  .filter, .ikon-knopf, .klein-knopf, .reiter { display: none !important; }
  body { background: #fff; }
  .karte { box-shadow: none; break-inside: avoid; }
}
