/* =============================================================================
   Kurstafel – Erscheinungsbild. Stand 10.10.2026, Version 2.1

   Leitidee: Porzellan, Tinte und Messing – wie das Zifferblatt einer guten
   Uhr und das Kontoblatt einer Privatbank. Ruhig, präzise, wenig Farbe.
   Ein einziger auffälliger Moment: der Auftritt beim Öffnen und die
   rollenden Ziffern der Tafel. Alles andere bleibt still.

   Änderungen 2.1 (WARUM):
   - Kleine Schrift kontrastreicher (vorher 3,1 : 1, jetzt mindestens 4,5 : 1)
     und mindestens 13 px – die Tafel ist für ältere Augen gedacht.
   - Kurse stehen kommabündig in einer Spalte, „€“ steht im Spaltenkopf.
     So liest man Zahlen wie in einem Kontoauszug von oben nach unten.
   - Klickflächen mindestens 44 px; jede Kurszeile ist ein Knopf.
   - Meldungen stehen dort, wo man hinschaut: Verbindung oben in der Tafel,
     Speichern direkt über dem Knopf.
   - Dialoge erscheinen auf dem Handy als Blatt von unten.
   - Druckansicht ohne Knöpfe.
   ============================================================================= */

@font-face {
  font-family: "Inter";
  src: url("fonts/inter.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: block;
}
@font-face {
  font-family: "Cormorant";
  src: url("fonts/cormorant.woff2") format("woff2");
  font-weight: 300 700;
  font-style: normal;
  font-display: block;
}

:root {
  --porzellan: #EEF0EC;
  --papier: #FAFBF8;
  --papier-tief: #F2F4F0;
  --tinte: #17201B;
  --schiefer: #5E655F;
  --grafit: #666D67;        /* kleine Zusatztexte: 5,0 : 1 auf Papier */
  --hauch: #8A918B;         /* nur Zierde (Punkte, Platzhalter), nie für Text */
  --messing: #9A7B3F;
  --messing-hell: #E9E0CC;
  --smaragd: #1F6B4E;
  --smaragd-hell: #E2EEE7;
  --bordeaux: #8E2B33;
  --bordeaux-hell: #F5E4E4;
  --bernstein: #8A6116;
  --bernstein-hell: #F6EFDC;
  --linie: #D9DDD6;
  --linie-zart: #E7EAE4;
  --schatten: 0 1px 0 rgba(23, 32, 27, 0.04), 0 18px 40px -24px rgba(23, 32, 27, 0.22);
  --schatten-hoch: 0 30px 80px -30px rgba(23, 32, 27, 0.45);
  --kurve-an: cubic-bezier(0.16, 1, 0.3, 1);
  --kurve-sanft: cubic-bezier(0.32, 0.72, 0, 1);
  --rand: 24px;             /* Innenabstand der Tafeln */
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --porzellan: #0E1411;
    --papier: #151D19;
    --papier-tief: #1B241F;
    --tinte: #E8ECE6;
    --schiefer: #9AA39C;
    --grafit: #879089;
    --hauch: #5F6862;
    --messing: #C6A467;
    --messing-hell: #3A3322;
    --smaragd: #5DBB93;
    --smaragd-hell: #17291F;
    --bordeaux: #E58A90;
    --bordeaux-hell: #321A1C;
    --bernstein: #E2B65E;
    --bernstein-hell: #2E2716;
    --linie: #26302B;
    --linie-zart: #1D2621;
    --schatten: 0 1px 0 rgba(0, 0, 0, 0.3), 0 24px 48px -28px rgba(0, 0, 0, 0.8);
    --schatten-hoch: 0 30px 80px -30px rgba(0, 0, 0, 0.85);
    color-scheme: dark;
  }
}

[hidden] { display: none !important; }
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: var(--porzellan); scrollbar-color: var(--linie) transparent; }
body {
  margin: 0;
  background: var(--porzellan);
  color: var(--tinte);
  font-family: "Inter", "Segoe UI", system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  font-feature-settings: "cv11", "ss01";
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
::selection { background: var(--messing-hell); }
/* WARUM unsichtbar statt ausgeblendet: Das Layout steht schon fertig, nur
   gezeigt wird es erst, wenn der Auftritt beginnt. */
body.vor-start .seite { visibility: hidden; }
/* Hinter einem offenen Dialog scrollt die Seite nicht mit. */
body:has(dialog[open]) { overflow: hidden; }

button { font: inherit; color: inherit; }
.seite {
  max-width: 760px;
  margin: 0 auto;
  padding: max(32px, env(safe-area-inset-top)) 20px 56px;
}

/* ---------------------------------------------------------------- Kopf */
.kopf {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 16px;
  margin-bottom: 36px;
}
.emblem { width: 58px; height: 58px; display: block; overflow: visible; }
.emblem .lunette { fill: none; stroke: var(--messing); stroke-width: 1.1; }
.emblem .strich { stroke: var(--messing); stroke-width: 0.7; stroke-linecap: round; opacity: 0.75; }
.emblem .strich.lang { stroke-width: 1.4; opacity: 1; }
.emblem .emblem-euro { fill: var(--tinte); transform-box: fill-box; transform-origin: center; }
.wortmarke {
  font-family: "Cormorant", Georgia, serif;
  font-weight: 600;
  font-size: 38px;
  line-height: 1;
  letter-spacing: 0.01em;
  margin: 0;
}
.untertitel { margin: 6px 0 0; color: var(--schiefer); font-size: 14px; letter-spacing: 0.01em; }

/* Status: ein Knopf – ein Klick prüft die Verbindung */
.status {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 0 14px 0 12px;
  border: 1px solid var(--linie);
  border-radius: 999px;
  background: var(--papier);
  font-size: 13.5px;
  color: var(--schiefer);
  white-space: nowrap;
  cursor: pointer;
  transition: border-color 0.2s ease, color 0.2s ease;
}
.status:hover { border-color: var(--messing); color: var(--tinte); }
.status-punkt { width: 7px; height: 7px; border-radius: 50%; background: var(--hauch); flex: none; }
.status[data-zustand="aktuell"] .status-punkt { background: var(--smaragd); }
.status[data-zustand="warnung"] .status-punkt { background: var(--bernstein); }
.status[data-zustand="fehler"] .status-punkt { background: var(--bordeaux); }
.status[data-zustand="alt"] .status-punkt { background: var(--hauch); }
.status[data-zustand="laedt"] .status-punkt,
.status[data-zustand="verbinde"] .status-punkt { background: var(--messing); animation: atmen 1.6s ease-in-out infinite; }
@keyframes atmen { 50% { opacity: 0.25; } }

/* ---------------------------------------------------------------- Depot */
.depot {
  appearance: none;
  display: block;
  width: 100%;
  margin: 0 0 30px;
  padding: 0;
  border: 0;
  background: none;
  text-align: left;
  cursor: pointer;
  border-radius: 14px;
}
.depot > span { display: block; }
.depot-titel { font-size: 13.5px; color: var(--schiefer); }
.depot-mehr {
  margin-left: 10px;
  color: var(--grafit);
  text-decoration: underline;
  text-decoration-color: var(--linie);
  text-underline-offset: 3px;
  transition: color 0.2s ease, text-decoration-color 0.2s ease;
}
.depot:hover .depot-mehr { color: var(--tinte); text-decoration-color: var(--messing); }
.depot-summe {
  margin: 2px 0 4px;
  font-family: "Cormorant", Georgia, serif;
  font-weight: 500;
  font-size: 56px;
  line-height: 1.05;
  letter-spacing: -0.01em;
  font-variant-numeric: lining-nums tabular-nums;
}
.depot-zeile { display: flex !important; gap: 6px 22px; flex-wrap: wrap; font-size: 15px; font-variant-numeric: tabular-nums; }
.depot-zeile .auf { color: var(--smaragd); }
.depot-zeile .ab { color: var(--bordeaux); }
.depot-zeile .leise { color: var(--schiefer); }
.depot-stand { margin-top: 6px; font-size: 13px; color: var(--grafit); }
.depot-stand.warnung { color: var(--bernstein); }

/* ---------------------------------------------------------------- Reiter */
.reiter {
  position: relative;
  display: flex;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--linie);
}
.reiter button {
  position: relative;
  z-index: 1;
  appearance: none;
  border: 0;
  background: none;
  color: var(--schiefer);
  font-size: 15px;
  min-height: 44px;
  padding: 10px 2px 12px;
  margin-right: 28px;
  cursor: pointer;
  transition: color 0.2s ease;
}
.reiter button[aria-current="page"] { color: var(--tinte); font-weight: 600; }
.reiter button:hover { color: var(--tinte); }
/* Der Messing-Strich gleitet unter den aktiven Reiter */
.reiter-schieber {
  position: absolute;
  left: 0;
  bottom: -1px;
  height: 2px;
  width: 0;
  background: var(--messing);
  border-radius: 1px;
}

/* ---------------------------------------------------------------- Tafel */
.tafel {
  background: var(--papier);
  border: 1px solid var(--linie);
  border-radius: 22px;
  padding: 22px var(--rand);
  box-shadow: var(--schatten);
  margin-bottom: 18px;
}
.tafel-schmal { max-width: 460px; }
.tafel h2, .gruppe h2, dialog h2 {
  font-family: "Cormorant", Georgia, serif;
  font-weight: 600;
  font-size: 24px;
  line-height: 1.2;
  margin: 0 0 6px;
}
.tafel-kopf { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.tafel-kopf h2 { margin: 0; }
.tafel-stand { margin: 0; font-size: 13.5px; color: var(--schiefer); }
.tafel-boerse { margin: 2px 0 0; font-size: 13px; color: var(--grafit); }
.druck-stand { display: none; }

.lade-hinweis { margin: 18px 0 10px; text-align: center; font-size: 14px; color: var(--schiefer); }
.leer { text-align: center; padding: 26px 0 8px; }
.leer p { margin: 0 0 6px; }
.leer-titel { font-weight: 600; }
.leer .knopf-zweit { margin-top: 12px; }

/* Spaltenkopf und Kurszeilen teilen dasselbe Raster */
.spaltenkopf, .zeile-knopf {
  display: grid;
  /* WARUM feste Breiten: Jede Zeile ist ein eigenes Raster. Nur mit
     festen Spalten stehen die Kommas aller Zeilen genau untereinander. */
  grid-template-columns: minmax(0, 1fr) 128px 84px;
  column-gap: 16px;
  align-items: center;
}
.spaltenkopf {
  padding: 6px 0 8px;
  border-bottom: 1px solid var(--linie-zart);
  font-size: 13px;
  color: var(--grafit);
}
.sk-knopf {
  appearance: none;
  border: 0;
  background: none;
  padding: 6px 0;
  margin: -6px 0;
  color: inherit;
  font-size: 13px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  justify-self: start;
  border-radius: 6px;
}
.sk-knopf:hover { color: var(--tinte); }
.sk-knopf[aria-pressed="true"] { color: var(--tinte); font-weight: 600; }
/* Pfeil links vom Wort, damit „Heute“ rechtsbündig über den Zahlen steht */
.sk-heute { justify-self: end; flex-direction: row-reverse; }
.sk-kurs { text-align: right; }
.sk-pfeil { width: 0; height: 0; border-left: 4px solid transparent; border-right: 4px solid transparent; border-top: 5px solid currentColor; opacity: 0; transition: transform 0.25s var(--kurve-an), opacity 0.2s ease; }
.sk-knopf[aria-pressed="true"] .sk-pfeil { opacity: 1; }
.sk-knopf[data-richtung="auf"] .sk-pfeil { transform: rotate(180deg); }

.zeilen, .liste { list-style: none; margin: 0; padding: 0; }
.zeile { border-top: 1px solid var(--linie-zart); }
.zeile:first-child { border-top: 0; }
.zeile-knopf {
  appearance: none;
  width: calc(100% + 24px);
  margin: 0 -12px;
  padding: 13px 12px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  text-align: left;
  cursor: pointer;
  transition: background 0.18s ease;
}
.zeile-knopf:hover { background: var(--papier-tief); }
.zeile-knopf:active { background: var(--linie-zart); }
.zeile-knopf:focus-visible { outline-offset: -2px; }
.z-links { min-width: 0; }
.z-name { display: block; font-weight: 550; font-size: 16px; line-height: 1.3; overflow-wrap: anywhere; }
.z-info { display: block; font-size: 13px; color: var(--grafit); margin-top: 2px; font-variant-numeric: tabular-nums; }
.z-hinweis { display: block; font-size: 13px; color: var(--bernstein); margin-top: 3px; }
.zeile.fehlt .z-hinweis { color: var(--bordeaux); }

/* Kurs kommabündig: ganzer Teil rechtsbündig, Nachkommastellen linksbündig */
.z-kurs {
  display: inline-flex;
  justify-content: flex-end;
  justify-self: end;
  font-size: 20px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.005em;
  line-height: 1.25;
}
.k-ganz, .k-dez { display: inline-flex; height: 1.25em; overflow: hidden; }
.k-ganz { justify-content: flex-end; min-width: 3.6em; }
.k-dez { justify-content: flex-start; min-width: 2.2em; }
.z-kurs.leer { color: var(--hauch); }
.zeile.wartet .z-kurs { color: var(--hauch); }
.z-delta { font-size: 14px; text-align: right; font-variant-numeric: tabular-nums; color: var(--grafit); }
.z-delta.auf { color: var(--smaragd); }
.z-delta.ab { color: var(--bordeaux); }

/* Ziffernräder */
.zf { display: inline-block; height: 1.25em; line-height: 1.25em; overflow: hidden; vertical-align: top; }
.zf.ziffer { width: 0.62em; text-align: center; }
.zf .band { display: flex; flex-direction: column; will-change: transform; }
.zf .band span { display: block; height: 1.25em; line-height: 1.25em; }
.zf.zeichen { white-space: pre; }

/* WARUM klebend: Bei 27 Papieren läge der Knopf sonst weit unten. So ist
   „Kurse.xlsx speichern“ immer sichtbar und rastet am Ende der Liste ein. */
.tafel-fuss {
  position: sticky;
  bottom: 0;
  z-index: 2;
  margin: 14px calc(var(--rand) * -1) -22px;
  padding: 16px var(--rand) 18px;
  background: var(--papier);
  border-top: 1px solid var(--linie);
  border-radius: 0 0 21px 21px;
  text-align: center;
}
.tafel-fuss .meldung { text-align: left; margin-bottom: 14px; }
.fuss-zeile { margin: 10px auto 0; max-width: 520px; font-size: 13.5px; color: var(--schiefer); }

/* ---------------------------------------------------------------- Knöpfe */
.knopf-haupt {
  position: relative;
  overflow: hidden;
  appearance: none;
  border: 0;
  border-radius: 14px;
  background: var(--tinte);
  color: var(--papier);
  font-weight: 600;
  font-size: 16px;
  letter-spacing: 0.01em;
  min-height: 52px;
  min-width: 260px;
  padding: 0 28px;
  cursor: pointer;
  transition: transform 0.09s ease, opacity 0.2s ease;
}
.knopf-haupt:active { transform: scale(0.985); }
.knopf-haupt:disabled { opacity: 0.55; cursor: default; transform: none; }
.knopf-haupt.klein { min-width: 0; min-height: 44px; font-size: 15px; padding: 0 20px; }
.knopf-linie {
  position: absolute;
  left: 0;
  bottom: 0;
  height: 2px;
  width: 100%;
  background: var(--messing);
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 0.28s var(--kurve-an);
}
.knopf-zweit {
  appearance: none;
  border: 1px solid var(--linie);
  background: var(--papier);
  color: var(--tinte);
  font-size: 14.5px;
  font-weight: 500;
  border-radius: 12px;
  min-height: 44px;
  padding: 0 16px;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
  white-space: nowrap;
}
.knopf-zweit:hover { border-color: var(--messing); }
.knopf-zweit:disabled { opacity: 0.5; cursor: default; }
.knopf-zweit.gefahr { color: var(--bordeaux); }
.knopf-zweit.gefahr:hover { border-color: var(--bordeaux); }
.knopf-text-link {
  appearance: none;
  border: 0;
  background: none;
  color: var(--schiefer);
  font-size: 14px;
  text-decoration: underline;
  text-decoration-color: var(--linie);
  text-underline-offset: 3px;
  min-height: 40px;
  padding: 8px 2px;
  margin-top: 4px;
  cursor: pointer;
}
.knopf-text-link:hover { color: var(--tinte); text-decoration-color: var(--messing); }
.knopf-text-link.gefahr { color: var(--bordeaux); }
.knopf-text-link.gefahr:hover { text-decoration-color: var(--bordeaux); }
.knopf-rund {
  appearance: none;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--linie);
  background: var(--papier);
  color: var(--schiefer);
  display: grid;
  place-items: center;
  cursor: pointer;
  flex: none;
  transition: border-color 0.15s ease, color 0.15s ease;
}
.knopf-rund svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.knopf-rund:hover { color: var(--tinte); border-color: var(--messing); }
.knopf-rund.dreht svg { animation: drehen 0.9s linear infinite; }
@keyframes drehen { to { transform: rotate(360deg); } }

:focus-visible { outline: 2px solid var(--messing); outline-offset: 3px; }
button:focus:not(:focus-visible) { outline: none; }

/* Bestätigen direkt am Knopf – statt eines grauen Browser-Fensters */
.bestaetigen { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.bestaetigen p { margin: 0; font-size: 14px; color: var(--tinte); flex-basis: 100%; }

/* ---------------------------------------------------------------- Meldung */
.meldung {
  border-radius: 14px;
  padding: 12px 16px;
  font-size: 14.5px;
  line-height: 1.45;
  background: var(--papier-tief);
  border: 1px solid var(--linie);
  margin: 6px 0 12px;
}
.meldung p { margin: 0; }
.meldung.warnung { background: var(--bernstein-hell); border-color: transparent; color: var(--bernstein); }
.meldung.fehler { background: var(--bordeaux-hell); border-color: transparent; color: var(--bordeaux); }
.meldung .meldung-knoepfe { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.meldung .knopf-zweit { min-height: 38px; color: var(--tinte); }

/* ---------------------------------------------------------------- Liste */
.listen-status { margin: 0 0 8px; font-size: 14px; }
.eintrag { border-top: 1px solid var(--linie-zart); }
.eintrag:first-child { border-top: 0; }
.eintrag-knopf {
  appearance: none;
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr) auto;
  align-items: start;
  column-gap: 12px;
  width: calc(100% + 24px);
  margin: 0 -12px;
  padding: 13px 12px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  text-align: left;
  cursor: pointer;
  transition: background 0.18s ease;
}
.eintrag-knopf:hover { background: var(--papier-tief); }
.eintrag-knopf:focus-visible { outline-offset: -2px; }
.ampel { width: 8px; height: 8px; border-radius: 50%; margin-top: 8px; background: var(--hauch); }
.ampel.gruen { background: var(--smaragd); }
.ampel.gelb { background: var(--bernstein); }
.ampel.rot { background: var(--bordeaux); }
.e-name { display: block; font-weight: 550; overflow-wrap: anywhere; }
.e-info { display: block; font-size: 13px; color: var(--grafit); margin-top: 2px; }
.e-quelle { display: block; font-size: 13px; color: var(--schiefer); margin-top: 2px; }
.e-quelle.rot { color: var(--bordeaux); }
.e-kurs { display: block; text-align: right; font-variant-numeric: tabular-nums; font-weight: 500; padding-top: 1px; }

.neu-raster { display: grid; grid-template-columns: 1.2fr 1.4fr 1fr auto; gap: 12px; align-items: end; margin-top: 10px; }
.neu-knopf { margin-bottom: 0; }
.klein-text { font-size: 13.5px; }
#bestandText { margin: 0 0 6px; }

/* ---------------------------------------------------------------- Felder */
.feld { display: block; }
.feld span { display: block; font-size: 13px; color: var(--schiefer); margin-bottom: 5px; font-weight: 500; }
.feld input, .feld select {
  width: 100%;
  height: 46px;
  font: inherit;
  color: var(--tinte);
  background-color: var(--porzellan);
  border: 1px solid var(--linie);
  border-radius: 11px;
  padding: 0 12px;
}
/* Eigener Pfeil statt des grauen Systempfeils – gleiche Höhe wie die Felder */
.feld select {
  appearance: none;
  padding-right: 36px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%23666D67' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  cursor: pointer;
}
.feld input::placeholder { color: var(--hauch); }
.feld input:focus, .feld select:focus { outline: none; border-color: var(--messing); box-shadow: 0 0 0 3px var(--messing-hell); }
.feld input[aria-invalid="true"] { border-color: var(--bordeaux); }
.feldhinweis { min-height: 1.4em; margin: 8px 0 0; font-size: 13.5px; color: var(--schiefer); }
.feldhinweis:empty { min-height: 0; margin: 0; }
.feldhinweis.gut { color: var(--smaragd); }
.feldhinweis.fehler { color: var(--bordeaux); }
#zugangForm .feld { margin: 16px 0 10px; }
#zugangForm .knopf-haupt { margin-top: 12px; width: 100%; }
#zugangAbbrechen { display: block; margin: 8px auto 0; }

/* ---------------------------------------------------------------- Einstellungen */
.gruppe { margin-bottom: 26px; }
.gruppe h2 { font-size: 21px; margin: 0 0 8px 4px; }
.gruppe-liste {
  background: var(--papier);
  border: 1px solid var(--linie);
  border-radius: 18px;
  padding: 0 18px;
}
.wahl-zeile, .schalter-zeile, .aktion-zeile {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 56px;
  padding: 12px 0;
  border-top: 1px solid var(--linie-zart);
  cursor: pointer;
}
.gruppe-liste > :first-child { border-top: 0; }
.wahl-zeile > span, .schalter-zeile > span, .aktion-zeile > span { flex: 1; }
.wahl-zeile b, .schalter-zeile b, .aktion-zeile b { display: block; font-weight: 550; }
.wahl-zeile small, .schalter-zeile small, .aktion-zeile small { display: block; color: var(--schiefer); font-size: 13.5px; margin-top: 1px; }
.aktion-zeile { cursor: default; }
.schalter-zeile.klein { border: 0; min-height: 0; padding: 4px 0; font-size: 14px; color: var(--schiefer); }
.wahl-zeile input[type="radio"] {
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 1.5px solid var(--linie);
  background: var(--papier);
  margin: 0;
  flex: none;
  display: grid;
  place-items: center;
  transition: border-color 0.15s ease;
}
.wahl-zeile input[type="radio"]::after {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--messing);
  transform: scale(0);
  transition: transform 0.22s var(--kurve-an);
}
.wahl-zeile input[type="radio"]:checked { border-color: var(--messing); }
.wahl-zeile input[type="radio"]:checked::after { transform: scale(1); }
.schalter {
  appearance: none;
  width: 44px;
  height: 26px;
  border-radius: 13px;
  background: var(--linie);
  position: relative;
  margin: 0;
  flex: none;
  cursor: pointer;
  transition: background 0.25s ease;
}
.schalter::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #FAFBF8;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
  transition: transform 0.3s var(--kurve-sanft);
}
.schalter:checked { background: var(--smaragd); }
.schalter:checked::after { transform: translateX(18px); }
.einzug { padding: 0 0 12px 34px; }

/* Hilfe */
.hilfe-liste { padding-top: 4px; }
.schritte { margin: 10px 0 8px; padding-left: 22px; }
.schritte li { margin: 6px 0; padding-left: 4px; }
.schritte li::marker { color: var(--messing); font-weight: 600; }
.frage { border-top: 1px solid var(--linie-zart); }
.frage summary {
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 48px;
  cursor: pointer;
  font-weight: 500;
}
.frage summary::-webkit-details-marker { display: none; }
.frage summary::after, .abschnitt summary::after {
  content: "";
  width: 8px;
  height: 8px;
  border-right: 1.5px solid var(--grafit);
  border-bottom: 1.5px solid var(--grafit);
  transform: rotate(45deg) translate(-2px, -2px);
  transition: transform 0.25s var(--kurve-an);
  flex: none;
}
.frage[open] summary::after, .abschnitt[open] summary::after { transform: rotate(-135deg) translate(-2px, -2px); }
.frage p { margin: 0 0 14px; color: var(--schiefer); font-size: 14.5px; }

/* ---------------------------------------------------------------- Erfolg */
.erfolg {
  position: fixed;
  left: 50%;
  top: 50%;
  translate: -50% -50%;
  z-index: 20;
  background: var(--papier);
  border: 1px solid var(--linie);
  border-radius: 24px;
  padding: 26px 38px 22px;
  text-align: center;
  box-shadow: var(--schatten-hoch);
  min-width: 260px;
}
.erfolg svg { width: 72px; height: 72px; display: block; margin: 0 auto 10px; }
.haken-kreis { fill: none; stroke: var(--messing); stroke-width: 1.6; }
.haken-strich { fill: none; stroke: var(--tinte); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.erfolg-text { margin: 0; font-weight: 550; }

/* ---------------------------------------------------------------- Kurzmeldung */
.toast {
  position: fixed;
  left: 50%;
  top: max(16px, env(safe-area-inset-top));
  translate: -50% 0;
  z-index: 30;
  max-width: calc(100vw - 32px);
  padding: 10px 18px;
  border-radius: 999px;
  background: var(--tinte);
  color: var(--papier);
  font-size: 14px;
  font-weight: 500;
  box-shadow: var(--schatten-hoch);
}

/* ---------------------------------------------------------------- Dialoge */
dialog {
  border: 1px solid var(--linie);
  border-radius: 22px;
  padding: 22px 24px 20px;
  width: min(580px, calc(100vw - 32px));
  max-height: min(88vh, 920px);
  overflow: auto;
  background: var(--papier);
  color: var(--tinte);
  box-shadow: var(--schatten-hoch);
  overscroll-behavior: contain;
}
dialog.breit { width: min(720px, calc(100vw - 32px)); }
dialog::backdrop { background: rgba(14, 20, 17, 0.38); backdrop-filter: blur(3px); }
.dialog-kopf { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 10px; }
.dialog-kopf h2 { margin: 2px 0 2px; overflow-wrap: anywhere; }
.unterzeile { margin: 0; font-size: 14px; }
.schliessen {
  appearance: none;
  width: 40px;
  height: 40px;
  margin: -4px -8px 0 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--schiefer);
  display: grid;
  place-items: center;
  cursor: pointer;
  flex: none;
}
.schliessen:hover { background: var(--papier-tief); color: var(--tinte); }
.schliessen svg { width: 18px; height: 18px; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; fill: none; }
.dialog-knoepfe { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; flex-wrap: wrap; }
.dialog-fuss { margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--linie-zart); }
.kurzliste { max-height: 36vh; overflow: auto; padding-left: 18px; margin: 6px 0 10px; font-size: 14.5px; }
.kurzliste li { margin: 2px 0; }
.block { margin: 12px 0; }
.block b { font-weight: 600; }
.warn { color: var(--bernstein); font-size: 14.5px; }
.auswahl { display: flex; gap: 10px; align-items: flex-start; font-size: 14.5px; color: var(--schiefer); cursor: pointer; margin-top: 8px; }
.auswahl input { margin-top: 4px; accent-color: var(--messing); width: 16px; height: 16px; }

/* Wertpapier-Details */
.papier-kurs { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; margin: 6px 0 4px; }
.papier-zahl { font-family: "Cormorant", Georgia, serif; font-weight: 500; font-size: 44px; line-height: 1.05; font-variant-numeric: lining-nums tabular-nums; }
.papier-delta { font-size: 16px; font-variant-numeric: tabular-nums; color: var(--grafit); }
.papier-delta.auf { color: var(--smaragd); }
.papier-delta.ab { color: var(--bordeaux); }
.papier-hinweis { margin: 4px 0 10px; padding: 10px 14px; border-radius: 12px; background: var(--bernstein-hell); color: var(--bernstein); font-size: 14.5px; }
.papier-hinweis.rot { background: var(--bordeaux-hell); color: var(--bordeaux); }
.fakten { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 7px 22px; margin: 14px 0 16px; font-size: 14.5px; }
.fakten dt { color: var(--schiefer); }
.fakten dd { margin: 0; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.fakten .auf { color: var(--smaragd); }
.fakten .ab { color: var(--bordeaux); }
.abschnitt { border-top: 1px solid var(--linie-zart); }
.abschnitt summary {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  cursor: pointer;
  font-weight: 600;
}
.abschnitt summary .leise { font-weight: 400; font-size: 14px; }
.abschnitt summary::after { margin-left: auto; }
.abschnitt summary::-webkit-details-marker { display: none; }
.abschnitt form { padding-bottom: 12px; }
.abschnitt .wahl-zeile:first-child { border-top: 0; }
.name-raster { display: grid; grid-template-columns: 1.6fr 1fr auto; gap: 12px; align-items: end; }

/* Depot-Zusammensetzung */
.zus-summe { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin: 6px 0 18px; }
.zus-summe div { background: var(--papier-tief); border-radius: 14px; padding: 12px 14px; }
.zus-summe small { display: block; font-size: 13px; color: var(--schiefer); }
.zus-summe b { display: block; font-weight: 600; font-size: 17px; font-variant-numeric: tabular-nums; margin-top: 2px; }
.zus-liste { list-style: none; margin: 0 0 16px; padding: 0; }
.zus-liste li { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 16px; padding: 10px 0 8px; }
.zus-name { font-weight: 550; overflow-wrap: anywhere; }
.zus-info { display: block; font-size: 13px; color: var(--grafit); margin-top: 1px; font-variant-numeric: tabular-nums; }
.zus-rechts { text-align: right; font-variant-numeric: tabular-nums; }
.zus-wert { display: block; font-weight: 550; }
.zus-gewinn { display: block; font-size: 13px; color: var(--grafit); }
.zus-gewinn.auf { color: var(--smaragd); }
.zus-gewinn.ab { color: var(--bordeaux); }
.zus-balken { grid-column: 1 / -1; height: 3px; margin-top: 8px; border-radius: 2px; background: var(--linie-zart); overflow: hidden; }
.zus-balken i { display: block; height: 100%; background: var(--messing); transform-origin: left center; }
.zus-titel { font-family: "Cormorant", Georgia, serif; font-weight: 600; font-size: 20px; margin: 8px 0 4px; }
.zus-hinweis { font-size: 13.5px; color: var(--grafit); margin: 4px 0 0; }

/* Verbindung prüfen */
.pruefliste { list-style: none; margin: 4px 0 0; padding: 0; }
.pruefliste li { display: grid; grid-template-columns: 12px minmax(0, 1fr) auto; column-gap: 12px; align-items: start; padding: 11px 0; border-top: 1px solid var(--linie-zart); }
.pruefliste li:first-child { border-top: 0; }
.pruefliste .punkt { width: 8px; height: 8px; border-radius: 50%; margin-top: 8px; background: var(--hauch); }
.pruefliste .ok .punkt { background: var(--smaragd); }
.pruefliste .fehler .punkt { background: var(--bordeaux); }
.pruefliste .warnung .punkt { background: var(--bernstein); }
.pruefliste .laeuft .punkt { background: var(--messing); animation: atmen 1.6s ease-in-out infinite; }
.pruefliste b { display: block; font-weight: 550; }
.pruefliste small { display: block; font-size: 13.5px; color: var(--schiefer); margin-top: 1px; overflow-wrap: anywhere; }
.pruefliste .fehler small { color: var(--bordeaux); }
.pruefliste .ms { font-size: 13px; color: var(--grafit); font-variant-numeric: tabular-nums; padding-top: 2px; }

.fuss { text-align: center; color: var(--grafit); font-size: 13px; margin: 34px auto 0; line-height: 1.6; max-width: 560px; }
.leise { color: var(--schiefer); }
/* Nur für Vorleseprogramme – unsichtbar, aber vorgelesen */
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
.z-kurs { position: relative; }

/* ---------------------------------------------------------------- Schmal */
@media (max-width: 620px) {
  :root { --rand: 16px; }
  .seite { padding: max(24px, env(safe-area-inset-top)) 16px 40px; }
  .kopf { grid-template-columns: auto 1fr; gap: 12px; margin-bottom: 24px; }
  .status { grid-column: 1 / -1; justify-self: start; }
  .emblem { width: 48px; height: 48px; }
  .wortmarke { font-size: 32px; }
  .depot-summe { font-size: 44px; }
  .tafel { padding: 18px var(--rand); border-radius: 18px; }
  .tafel-fuss { margin-bottom: -18px; padding-bottom: max(16px, env(safe-area-inset-bottom)); border-radius: 0 0 17px 17px; }
  .knopf-haupt { width: 100%; min-width: 0; }
  .neu-raster, .name-raster { grid-template-columns: 1fr; }
  .reiter button { margin-right: 20px; }
  /* Kurs und Veränderung stehen untereinander */
  /* WARUM drei Zeilen: Kurs und Veränderung bleiben direkt untereinander,
     auch wenn der Name drei Zeilen braucht (vorher rutschte die
     Veränderung bis an den unteren Rand der Zeile). */
  .spaltenkopf, .zeile-knopf { grid-template-columns: minmax(0, 1fr) 128px; grid-template-rows: auto auto 1fr; grid-template-areas: "links kurs" "links delta" "links ."; row-gap: 2px; align-items: start; }
  .z-links { grid-area: links; }
  .z-kurs { grid-area: kurs; }
  .z-delta { grid-area: delta; }
  .spaltenkopf { grid-template-rows: auto auto; grid-template-areas: "links kurs" "links delta"; align-items: end; }
  .spaltenkopf .sk-knopf:first-child { grid-area: links; align-self: end; }
  .sk-kurs { grid-area: kurs; }
  .sk-heute { grid-area: delta; }
  .zus-summe { grid-template-columns: 1fr 1fr; }
  /* Dialoge als Blatt von unten */
  dialog, dialog.breit {
    width: 100%;
    max-width: 100%;
    margin: auto 0 0;
    border-radius: 22px 22px 0 0;
    border-bottom: 0;
    max-height: 92vh;
    padding: 18px 18px max(18px, env(safe-area-inset-bottom));
  }
  .dialog-knoepfe { justify-content: stretch; }
  .dialog-knoepfe > * { flex: 1; }
}
/* Niedrige Fenster (z. B. Zoom 150 %): klebender Fuß kompakter */
@media (max-height: 720px) {
  .tafel-fuss { padding-top: 12px; padding-bottom: 12px; }
  .tafel-fuss .knopf-haupt { min-height: 46px; }
  .fuss-zeile { margin-top: 6px; font-size: 13px; }
  .tafel-fuss .knopf-text-link { min-height: 32px; padding: 4px 2px; margin-top: 0; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

/* Windows-Kontrastmodus: eigene Schalter und Punkte sichtbar halten */
@media (forced-colors: active) {
  .schalter, .wahl-zeile input[type="radio"] { border: 1px solid ButtonText; }
  .schalter:checked, .wahl-zeile input[type="radio"]:checked::after { background: Highlight; }
  .status-punkt, .ampel, .pruefliste .punkt { forced-color-adjust: none; }
  .knopf-linie, .reiter-schieber { background: Highlight; }
}

/* ---------------------------------------------------------------- Druck */
@media print {
  @page { margin: 14mm; }
  html, body { background: #fff; color: #000; }
  .seite { max-width: none; padding: 0; }
  .status, .reiter, .tafel-fuss, .knopf-rund, .fuss, .spaltenkopf .sk-pfeil, #hinweis, .toast, .erfolg, .depot-mehr { display: none !important; }
  .tafel { box-shadow: none; border: 0; padding: 0; }
  .depot { margin-bottom: 16px; }
  .zeile { break-inside: avoid; }
  .zeile-knopf { padding: 8px 0; margin: 0; width: 100%; }
  .z-hinweis { color: #555; }
  /* Auf Papier ist „heute“ nichts wert – dort steht das volle Datum */
  .tafel-stand, .tafel-boerse { display: none !important; }
  .druck-stand { display: block; margin: 0 0 6px; font-size: 13px; }
}
