/* =====================================================================
   Pino – Oberfläche
   Farben als Variablen (hell / dunkel). Datenfarben = validierte Palette
   (Kategorien in fester Reihenfolge), Markenfarbe nur für Bedienelemente.
   ===================================================================== */
:root {
  color-scheme: light;
  --page: #f5f4ef;
  --surface: #fcfcfb;
  --surface-2: #f3f2ed;
  --ink: #141413;
  --ink-2: #52514e;
  --muted: #898781;
  --hairline: #e4e3dc;
  --axis: #c3c2b7;
  --ring: rgba(11, 11, 11, .08);
  --shadow: 0 1px 2px rgba(20, 20, 19, .04), 0 4px 16px rgba(20, 20, 19, .04);
  --brand: #1f5e4b;
  --brand-ink: #ffffff;
  --brand-soft: #e3eee8;
  --brand-hover: #174a3b;
  --brand-text: #1f5e4b;
  --s1: #2a78d6; --s2: #eb6834; --s3: #1baf7a; --s4: #eda100;
  --good: #0ca30c; --good-text: #006300;
  --warning: #fab219; --serious: #ec835a; --critical: #d03b3b;
  --critical-soft: #fbeaea; --serious-soft: #fdf0e9;
  --radius: 16px;
  --radius-s: 10px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --page: #0f0f0e;
    --surface: #1a1a19;
    --surface-2: #222220;
    --ink: #f0efec;
    --ink-2: #c3c2b7;
    --muted: #898781;
    --hairline: #2c2c2a;
    --axis: #383835;
    --ring: rgba(255, 255, 255, .08);
    --shadow: none;
    --brand: #2c7259;
    --brand-ink: #ffffff;
    --brand-soft: #1c2c25;
    --brand-hover: #358468;
    --brand-text: #6cc19f;
    --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500;
    --good-text: #0ca30c;
    --critical-soft: #3a1d1d; --serious-soft: #3a261d;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--page); color: var(--ink);
  font: 15px/1.5 var(--font); -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -.01em; }
h1 { font-size: 26px; line-height: 1.2; }
h2 { font-size: 16px; }
p { margin: 0; }
.leise { color: var(--ink-2); }
.klein { font-size: 13px; }
.zahl { font-variant-numeric: tabular-nums; }
.versteckt { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }

/* ---------- Kopfzeile ---------- */
.kopf {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--page) 85%, transparent);
  backdrop-filter: saturate(1.4) blur(12px); -webkit-backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--hairline);
}
.kopf-innen {
  max-width: 1240px; margin: 0 auto; padding: 10px 24px;
  display: flex; align-items: center; gap: 24px;
}
.marke { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.marke-zeichen {
  width: 34px; height: 34px; border-radius: 10px; background: var(--brand); color: var(--brand-ink);
  display: grid; place-items: center; font-weight: 700; font-size: 17px; letter-spacing: -.02em;
}
.marke-text { display: flex; flex-direction: column; line-height: 1.15; }
.marke-text b { font-size: 15px; }
.marke-text span { font-size: 12px; color: var(--muted); }
.nav { display: flex; gap: 4px; flex: 1; overflow-x: auto; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav a {
  text-decoration: none; color: var(--ink-2); padding: 7px 14px; border-radius: 999px;
  font-weight: 500; font-size: 14px; white-space: nowrap; display: flex; align-items: center; gap: 7px;
}
.nav a:hover { background: var(--surface-2); color: var(--ink); }
.nav a[aria-current="page"] { background: var(--brand-soft); color: var(--brand-text); }
.nav svg { width: 16px; height: 16px; }
.konto { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--ink-2); }
.konto form { margin: 0; }

/* ---------- Seite ---------- */
main { max-width: 1240px; margin: 0 auto; padding: 28px 24px 64px; }
.seitenkopf { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.seitenkopf .unterzeile { margin-top: 4px; color: var(--ink-2); font-size: 14px; }
.aktionen { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---------- Knöpfe & Felder ---------- */
.knopf {
  display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 16px;
  border-radius: var(--radius-s); border: 1px solid var(--hairline); background: var(--surface);
  color: var(--ink); font: 500 14px var(--font); text-decoration: none; cursor: pointer; white-space: nowrap;
}
.knopf:hover { background: var(--surface-2); }
.knopf svg { width: 16px; height: 16px; flex: none; }
.knopf.haupt { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.knopf.haupt:hover { background: var(--brand-hover); border-color: var(--brand-hover); }
.knopf.still { border-color: transparent; background: transparent; color: var(--ink-2); }
.knopf.still:hover { background: var(--surface-2); color: var(--ink); }
.knopf.klein { height: 30px; padding: 0 10px; font-size: 13px; }
.knopf:disabled { opacity: .5; cursor: default; }
.knopf:focus-visible, .feld:focus-visible, .nav a:focus-visible, select:focus-visible {
  outline: 2px solid var(--brand); outline-offset: 2px;
}
.feld, select.feld {
  height: 38px; padding: 0 12px; border-radius: var(--radius-s); border: 1px solid var(--hairline);
  background: var(--surface); color: var(--ink); font: 14px var(--font); min-width: 0;
}
select.feld { padding-right: 32px; appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23898781' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; }
label.beschriftung { display: block; font-size: 13px; font-weight: 500; color: var(--ink-2); margin-bottom: 6px; }

.monatswahl { display: flex; align-items: center; gap: 4px; background: var(--surface); border: 1px solid var(--hairline); border-radius: var(--radius-s); padding: 3px; }
.monatswahl a { display: grid; place-items: center; width: 32px; height: 30px; border-radius: 7px; color: var(--ink-2); text-decoration: none; }
.monatswahl a:hover { background: var(--surface-2); color: var(--ink); }
.monatswahl a[aria-disabled="true"] { opacity: .3; pointer-events: none; }
.monatswahl svg { width: 16px; height: 16px; }
.monatswahl select { border: 0; height: 30px; background-color: transparent; font-weight: 600; }

/* ---------- Karten & Raster ---------- */
.karte {
  background: var(--surface); border: 1px solid var(--ring); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 20px 22px; min-width: 0;
}
.karte-kopf { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.karte-kopf p { font-size: 13px; color: var(--muted); }
.raster { display: grid; gap: 16px; }
.raster.zwei { grid-template-columns: repeat(2, minmax(0, 1fr)); }
main > * + * { margin-top: 16px; }                 /* gleichmäßiger Abstand zwischen Abschnitten */
main > .seitenkopf + * { margin-top: 0; }
.breit { grid-column: 1 / -1; }

/* ---------- Kennzahlen ---------- */
.kennzahlen { display: grid; grid-template-columns: 1.45fr repeat(4, minmax(0, 1fr)); gap: 16px; }
.kz { display: flex; flex-direction: column; justify-content: space-between; gap: 6px; }
.kz-label { font-size: 13px; color: var(--ink-2); font-weight: 500; }
.kz-wert { font-size: 26px; font-weight: 600; letter-spacing: -.02em; line-height: 1.15; }
.kz-unten { font-size: 13px; color: var(--muted); }
.kz.held { background: var(--brand); border-color: transparent; color: var(--brand-ink); }
.kz.held .kz-label, .kz.held .kz-unten { color: color-mix(in srgb, var(--brand-ink) 78%, transparent); }
.kz.held .kz-wert { font-size: 48px; letter-spacing: -.03em; }
.delta { font-weight: 600; }
.delta.auf { color: var(--good-text); }
.delta.ab { color: var(--critical); }
.kz.held .delta { color: inherit; }

/* ---------- Hinweise / Warnungen ---------- */
.hinweisbox { border-radius: var(--radius); padding: 16px 20px; border: 1px solid var(--ring); background: var(--surface); box-shadow: var(--shadow); }
.hinweisbox.warnung { background: var(--serious-soft); border-color: color-mix(in srgb, var(--serious) 35%, transparent); }
.hinweisbox.ok { background: var(--brand-soft); border-color: transparent; }
.hinweisbox-kopf { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.hinweisbox-kopf svg { width: 20px; height: 20px; flex: none; }
.hinweisbox.warnung .hinweisbox-kopf svg { color: var(--serious); }
.hinweisbox.ok .hinweisbox-kopf svg { color: var(--brand-text); }
.warnliste { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 8px; }
.warnliste li { display: grid; grid-template-columns: 110px 1fr; gap: 12px; font-size: 14px; }
.warnliste .wann { font-weight: 600; font-variant-numeric: tabular-nums; }
.warnliste .art { font-weight: 600; }
.status { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; }
.status::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.status.ok { color: var(--good-text); }
.status.warn { color: var(--serious); }
.status.fehler { color: var(--critical); }

/* ---------- Tabellen ---------- */
.tabelle-huelle { overflow-x: auto; margin: 0 -22px; padding: 0 22px; }
table.tabelle { width: 100%; border-collapse: collapse; font-size: 14px; }
.tabelle th, .tabelle td { padding: 9px 10px; text-align: right; white-space: nowrap; border-bottom: 1px solid var(--hairline); }
.tabelle th:first-child, .tabelle td:first-child { text-align: left; padding-left: 0; }
.tabelle th:last-child, .tabelle td:last-child { padding-right: 0; }
.tabelle thead th { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; border-bottom-color: var(--axis); }
.tabelle td { font-variant-numeric: tabular-nums; }
.tabelle tbody tr:hover td { background: var(--surface-2); }
.tabelle tfoot td { font-weight: 700; border-top: 1px solid var(--axis); border-bottom: 0; padding-top: 12px; }
.tabelle .links { text-align: left; }
.tabelle .leer { color: var(--muted); }
.tabelle td.markiert { background: var(--critical-soft); color: var(--critical); font-weight: 600; }
.tabelle tbody tr:hover td.markiert { background: var(--critical-soft); }
.tabelle td.fehlt { background: var(--serious-soft); }
.tabelle .wt { color: var(--muted); display: inline-block; width: 26px; }
.marker { display: inline-flex; vertical-align: -3px; margin-left: 6px; color: var(--serious); cursor: help; }
.marker svg { width: 16px; height: 16px; }
.balkenzelle { display: flex; align-items: center; gap: 10px; justify-content: flex-end; }
.minibalken { width: 80px; height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; display: inline-block; }
.minibalken i { display: block; height: 100%; background: var(--s1); border-radius: 3px; }

details.tabellenansicht { margin-top: 12px; }
details.tabellenansicht summary { cursor: pointer; font-size: 13px; color: var(--muted); list-style: none; display: inline-flex; align-items: center; gap: 6px; }
details.tabellenansicht summary::-webkit-details-marker { display: none; }
details.tabellenansicht summary::before { content: "▸"; font-size: 11px; transition: transform .15s; }
details.tabellenansicht[open] summary::before { transform: rotate(90deg); }
details.tabellenansicht .tabelle { margin-top: 10px; font-size: 13px; }

/* ---------- Diagramme ---------- */
.diagramm { position: relative; width: 100%; min-height: 220px; }
.diagramm.hoch { min-height: 300px; }
.diagramm svg { display: block; overflow: visible; }
.diagramm text { font: 12px var(--font); fill: var(--muted); font-variant-numeric: tabular-nums; }
.diagramm text.wert { fill: var(--ink-2); font-weight: 500; }
.diagramm text.label { fill: var(--ink); }
.diagramm .gitter { stroke: var(--hairline); stroke-width: 1; shape-rendering: crispEdges; }
.diagramm .achse { stroke: var(--axis); stroke-width: 1; shape-rendering: crispEdges; }
.diagramm .band { fill: transparent; }
.diagramm .band.aktiv { fill: var(--surface-2); }
.diagramm-leer { display: grid; place-items: center; min-height: 160px; color: var(--muted); font-size: 14px; }
.legende { display: flex; flex-wrap: wrap; gap: 14px; font-size: 13px; color: var(--ink-2); margin-bottom: 10px; }
.legende span { display: inline-flex; align-items: center; gap: 6px; }
.legende i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.legende i.s1 { background: var(--s1); } .legende i.s2 { background: var(--s2); }
.legende i.s3 { background: var(--s3); } .legende i.s4 { background: var(--s4); }
.tooltip {
  position: absolute; z-index: 10; pointer-events: none; min-width: 150px;
  background: var(--surface); color: var(--ink); border: 1px solid var(--ring); border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .12); padding: 10px 12px; font-size: 13px; line-height: 1.45;
  opacity: 0; transform: translateY(4px); transition: opacity .12s, transform .12s;
}
.tooltip.sichtbar { opacity: 1; transform: none; }
.tooltip b { display: block; margin-bottom: 4px; }
.tooltip .zeile { display: flex; justify-content: space-between; gap: 16px; font-variant-numeric: tabular-nums; }
.tooltip .zeile span:first-child { color: var(--ink-2); }
.tooltip .haupt { font-size: 15px; font-weight: 600; }

.segmentiert { display: block; margin-bottom: 10px; }
.segmentiert .s1 { fill: var(--s1); } .segmentiert .s2 { fill: var(--s2); } .segmentiert .s3 { fill: var(--s3); }
.anteile { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 13px; color: var(--ink-2); }
.anteile span { display: inline-flex; align-items: center; gap: 6px; }
.anteile i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.anteile i.s1 { background: var(--s1); } .anteile i.s2 { background: var(--s2); } .anteile i.s3 { background: var(--s3); }
.anteile b { color: var(--ink); font-variant-numeric: tabular-nums; }

/* ---------- Zeitraum-Chips ---------- */
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { height: 32px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--hairline); background: var(--surface); color: var(--ink-2); font-size: 13px; font-weight: 500; text-decoration: none; display: inline-flex; align-items: center; }
.chip:hover { color: var(--ink); background: var(--surface-2); }
.chip[aria-current="true"] { background: var(--ink); color: var(--surface); border-color: var(--ink); }

/* ---------- Formular Überweisung ---------- */
.formzeile { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.formzeile > div { display: flex; flex-direction: column; }
.formzeile .feld.betrag { width: 130px; text-align: right; }
.formzeile .feld.notiz { width: 240px; }

/* ---------- Hochladen ---------- */
.ablage {
  position: relative; display: grid; place-items: center; text-align: center; gap: 10px;
  border: 1.5px dashed var(--axis); border-radius: var(--radius); background: var(--surface);
  padding: 44px 24px; cursor: pointer; transition: border-color .15s, background .15s;
}
.ablage:hover, .ablage.ueber { border-color: var(--brand); background: var(--brand-soft); }
.ablage input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.ablage-symbol { width: 52px; height: 52px; border-radius: 14px; background: var(--brand-soft); color: var(--brand-text); display: grid; place-items: center; }
.ablage-symbol svg { width: 26px; height: 26px; }
.ablage b { font-size: 16px; }
.dateiliste { list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 6px; }
.dateiliste li { display: flex; align-items: center; gap: 10px; padding: 8px 12px; background: var(--surface-2); border-radius: 8px; font-size: 14px; }
.dateiliste .typ { font-size: 11px; font-weight: 700; letter-spacing: .04em; padding: 2px 6px; border-radius: 5px; background: var(--surface); color: var(--ink-2); }
.dateiliste .groesse { margin-left: auto; color: var(--muted); font-size: 13px; }
.protokoll {
  font: 12.5px/1.6 var(--mono); background: var(--surface-2); border-radius: var(--radius-s);
  padding: 14px 16px; max-height: 360px; overflow: auto; white-space: pre-wrap; word-break: break-word; margin-top: 12px;
}
.lader { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--hairline); border-top-color: var(--brand); animation: drehen .8s linear infinite; }
@keyframes drehen { to { transform: rotate(360deg); } }
.schritte { margin: 0; padding-left: 18px; color: var(--ink-2); font-size: 14px; display: grid; gap: 6px; }

/* ---------- Anmeldung ---------- */
.anmelde-seite { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.anmelde-karte { width: 100%; max-width: 380px; }
.anmelde-karte .marke { margin-bottom: 26px; }
.anmelde-karte .marke-zeichen { width: 44px; height: 44px; font-size: 21px; border-radius: 12px; }
.anmelde-karte .marke-text b { font-size: 18px; }
.anmelde-karte form { display: grid; gap: 14px; }
.anmelde-karte .feld { width: 100%; height: 44px; font-size: 15px; }
.anmelde-karte .knopf { height: 44px; justify-content: center; width: 100%; font-size: 15px; }
.fehlermeldung { background: var(--critical-soft); color: var(--critical); border-radius: var(--radius-s); padding: 10px 12px; font-size: 14px; font-weight: 500; }

.fuss { max-width: 1240px; margin: 0 auto; padding: 0 24px 32px; color: var(--muted); font-size: 12px; }

/* ---------- Mobil ---------- */
@media (max-width: 1060px) {
  .kennzahlen { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kz.held { grid-column: 1 / -1; }
}
@media (max-width: 860px) {
  .raster.zwei { grid-template-columns: minmax(0, 1fr); }
  .kopf-innen { flex-wrap: wrap; gap: 10px 16px; padding: 10px 16px; }
  .nav { order: 3; flex-basis: 100%; }
  .konto { margin-left: auto; }
  main { padding: 20px 16px 48px; }
  .karte { padding: 16px; }
  .tabelle-huelle { margin: 0 -16px; padding: 0 16px; }
  .kz.held .kz-wert { font-size: 40px; }
  .kz-wert { font-size: 22px; }
  .warnliste li { grid-template-columns: 1fr; gap: 0; }
  h1 { font-size: 22px; }
}
@media (max-width: 480px) {
  .marke-text span { display: none; }
  .konto .wer { display: none; }
}
@media print {
  .kopf, .aktionen, .no-print, details.tabellenansicht { display: none !important; }
  body { background: #fff; }
  .karte { box-shadow: none; border-color: #ddd; break-inside: avoid; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
.warnliste li.ganz { grid-template-columns: 1fr; }
.abstand-oben { margin-top: 14px; }
code { font: 12.5px var(--mono); background: var(--surface-2); padding: 1px 5px; border-radius: 5px; }
