/* saga.synx.ch — Rollen statt Rohwerte. Kategorie-Farben: geprüfte Acht (dataviz-Validator, hell + dunkel). */
:root {
  color-scheme: light;
  --flaeche-0: #f3f3f1;
  --flaeche-1: #fcfcfb;
  --linie: #e4e3df;
  --gitter: #ecebe7;
  --text-1: #0b0b0b;
  --text-2: #52514e;
  --text-3: #75736e;
  --akzent: #2a78d6;
  --fokus: #2a78d6;
  --s1: #2a78d6; --s2: #eb6834; --s3: #1baf7a; --s4: #eda100;
  --s5: #e87ba4; --s6: #008300; --s7: #6250d6; --s8: #e34948;
  --schatten: 0 1px 2px rgb(0 0 0 / .06);
}
@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --flaeche-0: #111110; --flaeche-1: #1a1a19; --linie: #2c2c2a; --gitter: #262624;
    --text-1: #f0efec; --text-2: #c3c2b7; --text-3: #94938b; --akzent: #3987e5; --fokus: #6da7ec;
    --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500;
    --s5: #d55181; --s6: #008300; --s7: #9085e9; --s8: #e66767;
    --schatten: none;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --flaeche-0: #111110; --flaeche-1: #1a1a19; --linie: #2c2c2a; --gitter: #262624;
  --text-1: #f0efec; --text-2: #c3c2b7; --text-3: #94938b; --akzent: #3987e5; --fokus: #6da7ec;
  --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500;
  --s5: #d55181; --s6: #008300; --s7: #9085e9; --s8: #e66767;
  --schatten: none;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--flaeche-0); color: var(--text-1);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-variant-numeric: tabular-nums;
}
a { color: var(--akzent); }
:focus-visible { outline: 2px solid var(--fokus); outline-offset: 2px; }
h2 { font-size: 1rem; margin: 0; font-weight: 600; }
.leise { color: var(--text-3); margin: 0; font-size: .85rem; }

.kopf {
  display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap;
  padding: 14px 16px; border-bottom: 1px solid var(--linie); background: var(--flaeche-1);
}
.kopf-titel { display: flex; gap: 8px; align-items: baseline; }
.marke { font-weight: 800; letter-spacing: .12em; }
.titel { color: var(--text-2); }
.kopf-stand { color: var(--text-3); font-size: .85rem; }

main { max-width: 1240px; margin: 0 auto; padding: 16px; display: grid; gap: 16px; }

.filter { display: flex; flex-wrap: wrap; gap: 12px 20px; align-items: end; }
.feld { display: grid; gap: 4px; }
.feld-name { font-size: .75rem; color: var(--text-3); text-transform: uppercase; letter-spacing: .06em; }
.segmente { display: inline-flex; border: 1px solid var(--linie); border-radius: 8px; overflow: hidden; background: var(--flaeche-1); }
.segmente button {
  border: 0; background: transparent; color: var(--text-2); padding: 7px 12px; font: inherit; cursor: pointer; min-height: 36px;
}
.segmente button + button { border-left: 1px solid var(--linie); }
.segmente button[aria-checked="true"] { background: var(--text-1); color: var(--flaeche-1); }
select { font: inherit; padding: 7px 10px; min-height: 36px; border-radius: 8px; border: 1px solid var(--linie); background: var(--flaeche-1); color: var(--text-1); }

.kacheln { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.kachel { background: var(--flaeche-1); border: 1px solid var(--linie); border-radius: 12px; padding: 14px 16px; box-shadow: var(--schatten); min-width: 0; }
.kachel-name { font-size: .8rem; color: var(--text-3); }
.kachel-wert { font-size: 1.6rem; font-weight: 650; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kachel-fuss { font-size: .8rem; color: var(--text-2); margin-top: 2px; }

.karte { background: var(--flaeche-1); border: 1px solid var(--linie); border-radius: 12px; padding: 16px; box-shadow: var(--schatten); min-width: 0; }
.karte-kopf { display: flex; justify-content: space-between; align-items: baseline; gap: 8px 16px; flex-wrap: wrap; margin-bottom: 12px; }

.legende { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: .82rem; color: var(--text-2); }
.legende li { display: inline-flex; align-items: center; gap: 6px; }
.punkt { width: 10px; height: 10px; border-radius: 3px; flex: none; display: inline-block; }

.diagramm { width: 100%; height: 280px; position: relative; }
.diagramm svg { display: block; width: 100%; height: 100%; overflow: visible; }
.achse text { fill: var(--text-3); font-size: 11px; }
.gitter line { stroke: var(--gitter); stroke-width: 1; }
.grundlinie { stroke: var(--linie); stroke-width: 1; }
.balken g:hover rect, .balken g:focus rect { opacity: .85; }
.leer { color: var(--text-3); display: grid; place-items: center; height: 100%; }

.rangliste { display: grid; gap: 2px; }
.zeile {
  display: grid; grid-template-columns: minmax(120px, 220px) 1fr minmax(84px, auto) 52px; gap: 12px; align-items: center;
  padding: 7px 4px; border-radius: 8px; width: 100%; border: 0; background: transparent; color: inherit; font: inherit; text-align: left;
}
button.zeile { cursor: pointer; }
button.zeile:hover { background: var(--flaeche-0); }
.zeile .name { display: flex; align-items: center; gap: 8px; min-width: 0; }
.zeile .name span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.zeile .spur { height: 14px; position: relative; }
.zeile .spur i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 0 4px 4px 0; min-width: 2px; }
.zeile .wert { text-align: right; white-space: nowrap; }
.zeile .anteil { text-align: right; color: var(--text-3); font-size: .85rem; }
.zeile.dienst { padding-left: 26px; font-size: .9rem; color: var(--text-2); }
.zeile.dienst .spur { height: 8px; }
.zeile .pfeil { color: var(--text-3); width: 10px; display: inline-block; transition: transform .15s; }
.zeile[aria-expanded="true"] .pfeil { transform: rotate(90deg); }
.zeile .neben { color: var(--text-3); font-size: .8rem; }

.tabelle-rahmen { overflow-x: auto; }
.tabelle { width: 100%; border-collapse: collapse; font-size: .9rem; }
.tabelle th { text-align: left; font-weight: 500; color: var(--text-3); font-size: .78rem; padding: 6px 8px; border-bottom: 1px solid var(--linie); white-space: nowrap; }
.tabelle td { padding: 7px 8px; border-bottom: 1px solid var(--gitter); vertical-align: top; }
.tabelle .zahl { text-align: right; white-space: nowrap; }
.tabelle .code { font-weight: 600; }
.tabelle .klein { color: var(--text-3); font-size: .8rem; display: block; max-width: 420px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mehr { margin-top: 10px; font: inherit; background: transparent; border: 1px solid var(--linie); color: var(--text-2); border-radius: 8px; padding: 6px 12px; cursor: pointer; }

.tipp {
  position: fixed; z-index: 10; pointer-events: none; background: var(--flaeche-1); color: var(--text-1);
  border: 1px solid var(--linie); border-radius: 8px; padding: 8px 10px; font-size: .82rem; box-shadow: 0 4px 16px rgb(0 0 0 / .18); max-width: 280px;
}
.tipp b { display: block; margin-bottom: 4px; }
.tipp .tz { display: flex; justify-content: space-between; gap: 14px; align-items: center; }
.tipp .tz span:first-child { display: inline-flex; gap: 6px; align-items: center; color: var(--text-2); }

.fuss { color: var(--text-2); font-size: .85rem; padding: 0 4px 24px; }

/* Anmeldung */
body.anmeldung { display: grid; place-items: center; min-height: 100vh; padding: 16px; }
.karte-anmeldung { background: var(--flaeche-1); border: 1px solid var(--linie); border-radius: 14px; padding: 28px; width: min(360px, 100%); display: grid; gap: 10px; }
.karte-anmeldung h1 { margin: 0; font-size: 1.3rem; display: flex; gap: 8px; align-items: baseline; }
.karte-anmeldung label { font-size: .85rem; color: var(--text-2); margin-top: 8px; }
.karte-anmeldung input { font: inherit; padding: 10px; border-radius: 8px; border: 1px solid var(--linie); background: var(--flaeche-0); color: var(--text-1); }
.karte-anmeldung button { font: inherit; padding: 10px; border-radius: 8px; border: 0; background: var(--text-1); color: var(--flaeche-1); cursor: pointer; margin-top: 6px; }
.meldung { margin: 0; color: var(--s8); font-size: .9rem; }

@media (max-width: 820px) {
  .kacheln { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .zeile { grid-template-columns: minmax(96px, 38%) 1fr minmax(64px, auto); }
  .zeile .anteil { display: none; }
  .diagramm { height: 220px; }
}
@media (max-width: 420px) {
  .kachel-wert { font-size: 1.3rem; }
  .segmente button { padding: 7px 9px; }
}
@media (forced-colors: active) { .zeile .spur i, .punkt, .balken rect { forced-color-adjust: none; } }
