/* Tagesgeld - Stile. Farbtoken und Grundbausteine aus alt/Tagesgeld.html uebernommen. */
/* ============================================================
   Farbtoken. Hell ist die Basis, Dunkel wird zweimal definiert:
   einmal fuer die Systemeinstellung, einmal fuer den Umschalter.
   Serienfarben stammen aus der validierten Kategorialpalette.
   ============================================================ */
:root {
  color-scheme: light;
  --page:        #f9f9f7;
  --surface-1:   #fcfcfb;
  --surface-2:   #f2f1ed;
  --text-1:      #0b0b0b;
  --text-2:      #52514e;
  --muted:       #898781;
  --grid:        #e1e0d9;
  --axis:        #c3c2b7;
  --border:      rgba(11,11,11,0.10);
  --hover:       rgba(11,11,11,0.05);
  --good:        #0ca30c;
  --warning:     #fab219;
  --serious:     #ec835a;
  --critical:    #d03b3b;
  --good-text:   #006300;
  --s1: #2a78d6; --s2: #eb6834; --s3: #1baf7a; --s4: #eda100;
  --s5: #e87ba4; --s6: #008300; --s7: #4a3aa7; --s8: #e34948;
  --accent:      #2a78d6;
  --accent-soft: #cde2fb;
}
@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --page:        #0d0d0d;
    --surface-1:   #1a1a19;
    --surface-2:   #232322;
    --text-1:      #ffffff;
    --text-2:      #c3c2b7;
    --muted:       #898781;
    --grid:        #2c2c2a;
    --axis:        #383835;
    --border:      rgba(255,255,255,0.10);
    --hover:       rgba(255,255,255,0.06);
    --good-text:   #0ca30c;
    --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500;
    --s5: #d55181; --s6: #008300; --s7: #9085e9; --s8: #e66767;
    --accent:      #3987e5;
    --accent-soft: #184f95;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --page:        #0d0d0d;
  --surface-1:   #1a1a19;
  --surface-2:   #232322;
  --text-1:      #ffffff;
  --text-2:      #c3c2b7;
  --muted:       #898781;
  --grid:        #2c2c2a;
  --axis:        #383835;
  --border:      rgba(255,255,255,0.10);
  --hover:       rgba(255,255,255,0.06);
  --good-text:   #0ca30c;
  --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500;
  --s5: #d55181; --s6: #008300; --s7: #9085e9; --s8: #e66767;
  --accent:      #3987e5;
  --accent-soft: #184f95;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--page);
  color: var(--text-1);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-text-size-adjust: 100%;
}
h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -0.01em; }
h2 { font-size: 19px; }
h3 { font-size: 15px; }
p  { margin: 0 0 10px; }
a  { color: var(--accent); }

/* ---------- Kopfzeile (aus der alten App) ---------- */
.top {
  position: sticky; top: 0; z-index: 40;
  background: var(--surface-1);
  border-bottom: 1px solid var(--border);
}
.top[hidden] { display: none; }
.top-in {
  max-width: 1180px; margin: 0 auto; padding: 10px 16px;
  display: flex; align-items: center; gap: 8px 12px; flex-wrap: wrap;
}
.brand { font-size: 17px; font-weight: 600; letter-spacing: -0.01em; }
.top-spacer { flex: 1 1 auto; }
.wer { font-size: 13px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis;
       white-space: nowrap; max-width: 40vw; }

/* Am Handy steht der Name schon in der Begruessung. */
@media (max-width: 480px) { .wer { display: none; } }

main { max-width: 1180px; margin: 0 auto; padding: 22px 16px 40px; }
main.schmal { max-width: 640px; }
/* Die Rasteransicht ist eine Tabelle, kein Fliesstext - sie darf breiter werden. */
main.weit { max-width: 1680px; }
.laden { color: var(--muted); }

/* ---------- Bausteine (aus der alten App) ---------- */
.card {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 18px;
  margin-bottom: 18px;
}
.card h2 { margin-bottom: 12px; }
.hinweis { color: var(--text-2); }

.btn {
  appearance: none; font: inherit; font-size: 13.5px;
  padding: 7px 13px; border-radius: 7px;
  border: 1px solid var(--border);
  background: var(--surface-2); color: var(--text-1);
  cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
  line-height: 1.35; white-space: nowrap;
}
.btn:hover { background: var(--hover); }
.btn.primary { background: var(--accent); border-color: transparent; color: #fff; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { background: none; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.breit { width: 100%; padding: 9px 13px; }
.btnrow { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

input, select, textarea {
  font: inherit; font-size: 16px;   /* unter 16px zoomt iOS beim Antippen */
  padding: 8px 10px; border-radius: 7px;
  border: 1px solid var(--border);
  background: var(--surface-1); color: var(--text-1);
  min-width: 0;
}
input:focus-visible, select:focus-visible, textarea:focus-visible,
button:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 1px;
}
label.fld { display: flex; flex-direction: column; gap: 4px; font-size: 12px;
            color: var(--text-2); margin-bottom: 12px; }

/* ---------- Anmeldung ---------- */
.anmelde-karte { max-width: 400px; margin: 8vh auto 18px; }
.anmelde-karte .btnrow { margin-top: 4px; }

/* ---------- Meldungen ---------- */
.meldung {
  position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%);
  max-width: calc(100% - 32px); z-index: 60;
  padding: 10px 16px; border-radius: 8px;
  background: var(--surface-2); color: var(--text-1);
  border: 1px solid var(--border); box-shadow: 0 4px 18px rgba(0,0,0,.18);
  font-size: 14px;
}
.meldung[hidden] { display: none; }
.meldung.fehler { border-color: var(--critical); color: var(--critical); }
.meldung.erfolg { border-color: var(--good); color: var(--good-text); }

/* ---------- Fuss ---------- */
.fuss { display: flex; flex-direction: column; align-items: center; gap: 6px;
        font-size: 12px; color: var(--muted); padding: 0 16px 24px; }
.thema { font-size: 16px; padding: 4px 10px; }
.thema .symbol-sonne { display: none; }
:root[data-theme="dark"] .thema .symbol-mond { display: none; }
:root[data-theme="dark"] .thema .symbol-sonne { display: inline; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .thema .symbol-mond { display: none; }
  :root:not([data-theme="light"]) .thema .symbol-sonne { display: inline; }
}

/* ---------- Reiter (aus der alten App) ---------- */
nav.tabs {
  max-width: 1180px; margin: 0 auto; padding: 0 16px;
  display: flex; gap: 2px; overflow-x: auto;
}
nav.tabs button {
  appearance: none; background: none; border: 0;
  border-bottom: 2px solid transparent;
  padding: 9px 13px; font: inherit; font-size: 14px;
  color: var(--text-2); cursor: pointer; white-space: nowrap;
}
nav.tabs button:hover { color: var(--text-1); background: var(--hover); }
nav.tabs button[aria-selected="true"] {
  color: var(--text-1); border-bottom-color: var(--accent); font-weight: 550;
}

nav.tabs[hidden] { display: none; }
.konto-wahl { max-width: 40vw; font-size: 14px; padding: 5px 8px; }
.konto-wahl[hidden] { display: none; }

/* ---------- Aus der alten App: Kennzahlen, Tabellen, Diagramme, Hinweise ---------- */
/* ---------- Hero + Kennzahlen ---------- */
.hero-wrap { display: flex; flex-wrap: wrap; gap: 26px 34px; align-items: flex-start; }
.hero .lbl { font-size: 13px; color: var(--text-2); margin-bottom: 2px; }
.hero .val { font-size: 52px; line-height: 1.05; font-weight: 600; letter-spacing: -0.025em; }
.hero .note { font-size: 12.5px; color: var(--muted); margin-top: 5px; }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 1px;
         background: var(--border); border: 1px solid var(--border); border-radius: 9px; overflow: hidden; }
.tile { background: var(--surface-1); padding: 13px 15px; }
.tile .lbl { font-size: 12px; color: var(--text-2); }
.tile .val { font-size: 23px; font-weight: 600; letter-spacing: -0.015em; margin-top: 3px; }
.tile .sub { font-size: 12px; color: var(--muted); margin-top: 2px; }

.status { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; }
.status .ico { width: 15px; height: 15px; flex: none; }
.status.good     { color: var(--good-text); }
.status.warning  { color: var(--text-1); }
.status.critical { color: var(--critical); }

/* ---------- Tabellen ---------- */
.tablewrap { overflow-x: auto; }
table.data { border-collapse: collapse; width: 100%; font-size: 13.5px; }
table.data th, table.data td {
  text-align: left; padding: 7px 11px 7px 0;
  border-bottom: 1px solid var(--grid); white-space: nowrap;
}
table.data th {
  font-weight: 550; font-size: 12px; color: var(--text-2);
  text-transform: uppercase; letter-spacing: .04em;
  position: sticky; top: 0; background: var(--surface-1); z-index: 1;
}
table.data td.num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.data td.wrap { white-space: normal; min-width: 180px; }
table.data tbody tr:hover { background: var(--hover); }
table.data tfoot td { font-weight: 600; border-top: 2px solid var(--axis); border-bottom: 0; padding-top: 9px; }
.neg { color: var(--critical); }

.tdot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 7px;
        vertical-align: baseline; flex: none; }

.scroll-y { max-height: min(70vh, 900px); overflow-y: auto; }

/* ---------- Rasteransicht (Nachbau des Tabellenblatts) ---------- */
table.raster { border-collapse: separate; border-spacing: 0; }
table.raster th, table.raster td { padding: 5px 10px; white-space: nowrap; border-bottom: 1px solid var(--grid); }
/* Kein Versalsatz: hier stehen Eigennamen in den Spaltenkoepfen. */
table.raster thead th {
  position: sticky; top: 0; z-index: 3; background: var(--surface-1);
  font-size: 12.5px; text-transform: none; letter-spacing: 0;
  color: var(--text-2); font-weight: 550; text-align: right;
  border-bottom: 1px solid var(--axis);
}
table.raster thead th:first-child, table.raster tbody td:first-child { text-align: left; }
/* Erste Spalte bleibt beim Querscrollen stehen */
table.raster thead th:first-child { left: 0; z-index: 4; }
table.raster tbody td:first-child, table.raster tfoot td:first-child {
  position: sticky; left: 0; z-index: 2; background: var(--surface-1);
}
table.raster tbody td { text-align: right; font-variant-numeric: tabular-nums; }
table.raster tbody tr:hover td { background: var(--hover); }
table.raster tbody tr:hover td:first-child { background: var(--surface-2); }
td.zelle { cursor: pointer; }
td.zelle:hover { outline: 1px solid var(--accent); outline-offset: -1px; border-radius: 3px; }
td.zelle.leer::after { content: "+"; color: transparent; }
td.zelle.leer:hover::after { color: var(--muted); }
td.rand { border-left: 1px solid var(--grid); }
/* Hoehere Spezifitaet als `table.raster td`, sonst gewinnt dort das nowrap. */
table.raster td.zweck {
  text-align: left; white-space: normal;
  min-width: 150px; max-width: 230px;
  color: var(--text-2); font-size: 12.5px; line-height: 1.35;
}
tr.jahrsumme td {
  background: var(--surface-2); font-weight: 600;
  border-top: 1px solid var(--axis); border-bottom: 1px solid var(--axis);
}
tr.jahrsumme td:first-child { background: var(--surface-2); }
table.raster tfoot td {
  position: sticky; bottom: 0; background: var(--surface-1);
  font-weight: 600; text-align: right; font-variant-numeric: tabular-nums;
  border-top: 2px solid var(--axis); border-bottom: 0; z-index: 2;
}

/* ---------- Diagramm ---------- */
.chart { position: relative; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart text { font: 11.5px system-ui, -apple-system, "Segoe UI", sans-serif; }
.tick { fill: var(--muted); font-variant-numeric: tabular-nums; }
.dlabel { fill: var(--text-1); font-weight: 550; }
.dlabel-2 { fill: var(--text-2); }
.gridline { stroke: var(--grid); stroke-width: 1; }
.axisline { stroke: var(--axis); stroke-width: 1; }
.hit { fill: transparent; cursor: default; }
/* Fadenkreuz und Merkpunkt starten unsichtbar — das SVG hat overflow:visible,
   ein "Parken" ausserhalb des Sichtfelds wuerde sonst am Rand kleben. */
.crosshair { stroke: var(--axis); stroke-width: 1; pointer-events: none; }
.crosshair, .peek { visibility: hidden; }

.tooltip {
  position: absolute; z-index: 30; pointer-events: none;
  background: var(--surface-1); color: var(--text-1);
  border: 1px solid var(--border); border-radius: 8px;
  padding: 8px 10px; font-size: 12.5px;
  box-shadow: 0 4px 16px rgba(0,0,0,.14);
  min-width: 130px;
}
.tooltip .tt-head { font-size: 11.5px; color: var(--text-2); margin-bottom: 4px; }
.tooltip .tt-row { display: flex; align-items: center; gap: 7px; }
.tooltip .tt-key { width: 12px; height: 2px; border-radius: 1px; flex: none; }
.tooltip .tt-val { font-weight: 600; font-variant-numeric: tabular-nums; }
.tooltip .tt-name { color: var(--text-2); }

.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 12.5px; color: var(--text-2); margin-top: 10px; }
.legend .item { display: flex; align-items: center; gap: 6px; }
.legend .swatch { width: 11px; height: 11px; border-radius: 2px; flex: none; }

.smalls { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; }
.small { border: 1px solid var(--border); border-radius: 9px; padding: 11px 12px; background: var(--surface-1); }
.small .st { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--text-2); }
.small .sv { font-size: 18px; font-weight: 600; margin: 2px 0 6px; letter-spacing: -0.01em; }

/* ---------- Hinweise ---------- */
.notice {
  border: 1px solid var(--border); border-left: 3px solid var(--accent);
  background: var(--surface-1); border-radius: 8px;
  padding: 13px 15px; margin-bottom: 18px; font-size: 13.5px;
}
.notice.warn     { border-left-color: var(--warning); }
.notice.critical { border-left-color: var(--critical); }
.notice h3 { margin-bottom: 5px; }
.empty { color: var(--muted); font-size: 13.5px; padding: 22px 0; text-align: center; }

.filterbar {
  display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end;
  padding: 13px 15px; background: var(--surface-1);
  border: 1px solid var(--border); border-radius: 10px; margin-bottom: 18px;
}
.filterbar .grow { flex: 1 1 220px; }

.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  font-size: 12.5px; padding: 4px 10px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface-2);
  color: var(--text-2); cursor: pointer;
}
.chip[aria-pressed="true"] { background: var(--accent); border-color: transparent; color: #fff; }

dialog {
  border: 1px solid var(--border); border-radius: 12px; padding: 0;
  background: var(--surface-1); color: var(--text-1);
  max-width: min(760px, calc(100vw - 32px)); width: 100%;
}
dialog::backdrop { background: rgba(0,0,0,.45); }
dialog .dlg-body { padding: 20px; }
dialog h2 { margin-bottom: 12px; }


/* ---------- Ergaenzungen der Online-App ---------- */
.card > header { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.card > header h2 { margin-bottom: 0; }
.card > header .sub { font-size: 13px; color: var(--text-2); }
.card > header .grow, .grow { flex: 1 1 auto; }
.tiles { margin-bottom: 18px; }
.abgleich { flex: 0 1 400px; min-width: 240px; }
.abgleich .lbl { font-size: 13px; color: var(--text-2); }
.abgleich-wert { font-size: 23px; font-weight: 600; margin: 3px 0 4px; }
.abgleich .small-note { margin-top: 5px; }
.abgleich .btnrow { margin-top: 9px; }
.btn.klein { padding: 3px 8px; font-size: 12px; }
.btnrow.nowrap { flex-wrap: nowrap; }
dialog .btnrow { margin-top: 16px; }
.raster2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.raster2 .breit { grid-column: 1 / -1; }
@media (max-width: 520px) { .raster2 { grid-template-columns: 1fr; } }
.zeile { display: flex; gap: 8px; align-items: center; }
label.fld.zeile { flex-direction: row; font-size: 13px; }
label.fld.grow { flex: 1 1 220px; }
.filterbar label.fld { margin-bottom: 0; }
.fehlertext { color: var(--critical); min-height: 18px; }
.abstand { margin-top: 14px; }
.tdot.gross { width: 14px; height: 14px; }
th.links, table.raster th.links { text-align: left; }
.ico { width: 15px; height: 15px; flex: none; }
@media (max-width: 720px) { .hero .val { font-size: 40px; } }

/* ---------- Kleinigkeiten (aus der alten App) ---------- */
.srlabel { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.mono { font-variant-numeric: tabular-nums; }
.dim { color: var(--text-2); }
.small-note { font-size: 12px; color: var(--muted); }
.klein-hoch { max-height: 260px; }
.tiles .tile .val { overflow-wrap: anywhere; }
.sprache { font-size: 13px; padding: 3px 6px; }

/* ---------- Verwaltung ---------- */
.matrix th.mitte, .matrix td.mitte { text-align: center; }
.matrix th { text-transform: none; letter-spacing: 0; }
.matrix .rangzeile td { background: var(--surface-2); }
.matrix .rangzeile input { width: 4.5rem; }
.rollenwahl { display: flex; flex-wrap: wrap; gap: 4px 18px; }
.einmal { font-size: 22px; font-weight: 600; letter-spacing: .06em; user-select: all;
          background: var(--surface-2); border-radius: 8px; padding: 10px 14px; display: inline-block; }

/* ---------- Zwei-Faktor ---------- */
.qr-zeile { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; margin: 10px 0; }
.qr { background: #fff; padding: 6px; border-radius: 8px; width: 200px; height: 200px; }
.geheimnis { font-size: 15px; letter-spacing: .05em; user-select: all; overflow-wrap: anywhere; }
ol.codes { columns: 2; font-size: 16px; padding-left: 26px; }
ol.codes li { padding: 3px 0; }

/* Versionszeile im Fuss: sieht aus wie Text, ist aber ein Knopf zum Verlauf. */
.fuss-version { background: none; border: 0; color: var(--muted); font: inherit; font-size: 12px; padding: 2px 6px; cursor: default; }
.fuss-version.klickbar { cursor: pointer; text-decoration: underline dotted; }
.verlauf-eintrag { margin-bottom: 14px; }
.verlauf-eintrag h3 { margin-bottom: 4px; }
.verlauf-eintrag ul { margin: 0; padding-left: 20px; }
.verlauf-eintrag li { margin-bottom: 3px; }
