/* Investment-Tracker — Styles, abgeleitet aus docs/mockup.html (verbindliche Optik). */
:root {
  --ground: #eef1f4; --surface: #ffffff; --surface-2: #f6f8fa; --line: #dbe1e7;
  --ink: #16202a; --ink-2: #4a5763; --ink-3: #7c8896;
  --accent: #0e6e7d; --accent-soft: #d7ebee; --accent-ink: #0a5460;
  --gain: #1b7a4b; --gain-soft: #dbf0e4; --loss: #c0392b; --loss-soft: #f7dedb;
  --warn: #a86611; --warn-soft: #f8ebd2;
  /* Schriftfarbe AUF gefülltem Grün/Orange (Kauf/Verkauf-Umschalter): hell genug Kontrast mit Weiß. */
  --on-gain: #ffffff; --on-warn: #ffffff;
  /* Schriftfarbe AUF gefülltem Rot (Fehlermeldung). */
  --on-loss: #ffffff;
  /* Schriftfarbe AUF gefuelltem Akzent (schwebender "Erfassen"-Knopf). */
  --on-accent: #ffffff;
  /* Verlauf der türkisen Kacheln (Gesamtkapital, KPI). Als eigene Farben statt aus --accent gemischt:
     im Dunkelmodus ist --accent HELL, und weiße Schrift darauf lag bei 2,3-3,6:1 (Senior-Review 33). */
  --accent-fill-a: #0e6e7d; --accent-fill-b: #0a4550;
  --grid: #e4e9ee;
  --shadow: 0 1px 2px rgba(20,32,42,.06), 0 8px 24px rgba(20,32,42,.06);
  --shadow-lg: 0 16px 48px rgba(20,32,42,.22);
  --r: 14px; --r-sm: 9px;
  --font-ui: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
}
/* Dunkel-Variablen als eigenes Set, damit sie sowohl automatisch (System) ALS AUCH per manuellem
   Umschalter greifen. Der Umschalter (js/theme-init.js + makeThemeToggle in app.js) setzt data-theme
   auf <html>; ohne gespeicherte Wahl folgt die App dem System (prefers-color-scheme). */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ground: #0e141a; --surface: #161e27; --surface-2: #1c2732; --line: #29343f;
    --ink: #e7edf3; --ink-2: #a5b2bf; --ink-3: #71808e;
    --accent: #46b3c4; --accent-soft: #123138; --accent-ink: #8fdce8;
    --gain: #46d08a; --gain-soft: #123528; --loss: #f0776b; --loss-soft: #351d1b;
    --warn: #e6b053; --warn-soft: #33280f;
    /* Dunkel: Grün/Orange sind hier HELL — weiße Schrift darauf wäre unlesbar (ca. 2:1), daher dunkel. */
    --on-gain: #08231a; --on-warn: #2a1e08;
    /* Rot ist im Dunkelmodus HELL — weisse Schrift darauf lag bei 2,8:1 (Senior-Review Runde 31). */
    --on-loss: #2c0d09;
    /* Akzent ist im Dunkelmodus HELL — weisse Schrift darauf waere unlesbar (2,5:1). */
    --on-accent: #06232a;
    /* Dunkel deutlich gedaempfter fuehren, damit weisse Schrift lesbar bleibt (>= 4,5:1). */
    --accent-fill-a: #14535e; --accent-fill-b: #0c333b;
    --grid: #243039;
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.35);
    --shadow-lg: 0 18px 52px rgba(0,0,0,.6);
  }
}
:root[data-theme="dark"] {
  --ground: #0e141a; --surface: #161e27; --surface-2: #1c2732; --line: #29343f;
  --ink: #e7edf3; --ink-2: #a5b2bf; --ink-3: #71808e;
  --accent: #46b3c4; --accent-soft: #123138; --accent-ink: #8fdce8;
  --gain: #46d08a; --gain-soft: #123528; --loss: #f0776b; --loss-soft: #351d1b;
  --warn: #e6b053; --warn-soft: #33280f;
  --on-gain: #08231a; --on-warn: #2a1e08;
  /* Rot ist im Dunkelmodus HELL — weisse Schrift darauf lag bei 2,8:1 (Senior-Review Runde 31). */
  --on-loss: #2c0d09;
  /* Akzent ist im Dunkelmodus HELL — weisse Schrift darauf waere unlesbar (2,5:1). */
  --on-accent: #06232a;
  /* Dunkel deutlich gedaempfter fuehren, damit weisse Schrift lesbar bleibt (>= 4,5:1). */
  --accent-fill-a: #14535e; --accent-fill-b: #0c333b;
  --grid: #243039;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.35);
  --shadow-lg: 0 18px 52px rgba(0,0,0,.6);
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--font-ui); color: var(--ink);
  background: radial-gradient(1200px 600px at 80% -10%, color-mix(in srgb, var(--accent) 8%, transparent), transparent 60%), var(--ground);
  min-height: 100vh; line-height: 1.5; -webkit-font-smoothing: antialiased;
}
.num { font-variant-numeric: tabular-nums; }
.hidden { display: none !important; }
button { font: inherit; }

/* ===== App-Bar (oben) ===== */
/* z-index über dem schwebenden „Erfassen"-Knopf (55): auf sehr flachen Bildschirmen (kleines iPhone
   im Querformat) überlappten die beiden sonst, und ein Tipp auf „Abmelden" hätte den Knopf getroffen. */
/* Seitliche Sicherheitsabstaende: die Seite laeuft per `viewport-fit=cover` bis unter die abgerundeten
   Ecken des iPhones. Ohne `env(safe-area-inset-left/right)` steht der Inhalt dort teilweise unter dem
   Rand — auf Diegos Handy war die rechte Kachel und das ☰ angeschnitten (2026-08-01). Gilt fuer alle
   Bildschirm-Container gleichermassen. */
.appbar { position: sticky; top: 0; z-index: 65; display: flex; align-items: center; gap: 9px;
  padding: 10px max(16px, env(safe-area-inset-right, 0px)) 10px max(16px, env(safe-area-inset-left, 0px));
  border-bottom: 1px solid var(--line); background: var(--surface); }
.appbar .back { border: 1px solid var(--line); background: var(--surface); color: var(--ink); width: 36px; height: 36px; border-radius: 9px; font-size: 20px; cursor: pointer; display: none; place-items: center; }
.appbar .back.show { display: grid; }
.appbar .title { font-weight: 660; font-size: 16px; letter-spacing: -.01em; }
.appbar .sp { margin-left: auto; }
.iconbtn { position: relative; width: 36px; height: 36px; border-radius: 9px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font-size: 15px; display: grid; place-items: center; cursor: pointer; }
.iconbtn .dot { position: absolute; top: 5px; right: 6px; width: 8px; height: 8px; background: var(--loss); border-radius: 999px; border: 1.5px solid var(--surface); }
.iconbtn.spin { animation: spin .7s linear; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .iconbtn.spin { animation: none; } }
.logout-link { background: none; border: 0; color: var(--ink-3); cursor: pointer; font-size: 12.5px; text-decoration: underline; }

/* ===== ☰-Menue (nur Eingabe-Ansicht; im Dashboard ist oben genug Platz) =====
   Klappt unter dem Knopf auf. [hidden] muss display:none erzwingen, sonst gewinnt das display:grid. */
/* Bewusst KEIN position:relative: das Popup haengt an der Kopfzeile (die ist sticky und damit der
   Bezugsrahmen), nicht am Knopf — so behaelt es seine 8px Abstand auch dann, wenn der Titel auf
   schmalen Geraeten zweizeilig wird und die Kopfzeile mitwaechst. */
.menu-wrap { flex: none; }
.menu-wrap.on .menu-btn { border-color: var(--accent); color: var(--accent-ink); }
/* Unsichtbarer Fänger für den Tipp „daneben" (schließt das Menü, ohne das Element darunter auszulösen). */
/* [hidden] hier ausdruecklich, obwohl der Browser das von sich aus tut: kaeme je ein `display` in
   diese Regel, waere die Folge eine unsichtbare, bildschirmfuellende Tippsperre ueber der ganzen App. */
.menu-backdrop { position: fixed; inset: 0; z-index: 30; }
.menu-backdrop[hidden] { display: none; }
/* right: 16px = Innenabstand der Kopfzeile → fluchtet mit den Karten darunter.
   Breite: min() statt min-width, denn min-width schlaegt max-width — sonst raegte das rechts
   verankerte Menue bei starker Textvergroesserung ueber den linken Bildrand hinaus. */
.menu-pop { position: absolute; top: calc(100% + 8px); right: 16px; z-index: 40;
  width: min(212px, calc(100vw - 32px)); background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-sm); box-shadow: var(--shadow-lg); padding: 6px; display: grid; gap: 2px; }
.menu-pop[hidden] { display: none; }
.menu-item { display: flex; align-items: center; gap: 11px; width: 100%; text-align: left; background: none;
  border: 0; color: var(--ink); font-size: 14.5px; padding: 11px 10px; border-radius: 7px; cursor: pointer; }
.menu-item:hover { background: var(--surface-2); }
.menu-item:focus-visible { background: var(--surface-2); outline: 2px solid var(--accent); outline-offset: -2px; }
.menu-item .mi-ic { width: 20px; font-size: 15px; text-align: center; flex: none; }
.menu-sep { height: 1px; background: var(--line); margin: 4px 2px; }

/* ===== Einstellungen (Eingabe-Ansicht) ===== */
.set-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r);
  padding: 14px 15px; margin-bottom: 14px; box-shadow: var(--shadow); }
.set-h { font-size: 12px; text-transform: uppercase; letter-spacing: .07em; color: var(--ink-3); font-weight: 700; margin-bottom: 10px; }
.set-row { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; padding: 8px 0; border-top: 1px solid var(--line); }
/* Erste Zeile ohne Trennlinie. Ueber Geschwister-Selektor, NICHT :first-of-type/:first-child — das
   erste Kind der Karte ist die Ueberschrift (.set-h), beide Pseudoklassen griffen deshalb nie. */
.set-h + .set-row { border-top: 0; padding-top: 0; }
.set-l { color: var(--ink-2); font-size: 13.5px; flex: none; }
.set-v { color: var(--ink); font-weight: 620; font-size: 14px; text-align: right; min-width: 0; overflow-wrap: anywhere; }
/* Erklaersaetze in --ink-2: --ink-3 liegt bei dieser Groesse unter dem Lesbarkeits-Mindestkontrast. */
.set-note { color: var(--ink-2); font-size: 12.5px; margin-top: 10px; }
/* Warnung in der Karte (z.B. „letzte Kopie ist 5 Tage alt") — muss ins Auge fallen.
   Textfarbe --ink, NICHT --on-warn: letzteres ist fuer Text auf VOLLEM --warn gedacht und laege
   auf --warn-soft in beiden Modi bei ~1,2:1 (nachgerechnet). --ink liegt bei 14,0:1 / 12,3:1. */
.set-warn { color: var(--ink); background: var(--warn-soft); border: 1px solid var(--warn);
  border-radius: 8px; font-size: 12.5px; line-height: 1.4; margin-top: 10px; padding: 9px 11px; }
.set-card .cta, .set-card .cta.ghost { margin-top: 12px; }

/* Datensicherung: je Zeile eine herunterladbare Kopie. min-height 44px = bequeme Tippfläche.
   Bewusst ein <button> (kein Link): ein href böte „Ziel speichern unter" an, und dieser Weg ginge
   an der Prüfung der Server-Antwort vorbei. Daher hier der übliche Button-Reset. */
.bk-list { display: grid; gap: 0; }
/* Waagerecht ohne Innenabstand, damit das Datum genau mit „Name"/„E-Mail"/„Version" der anderen
   Karten fluchtet (.set-row hat dort ebenfalls 0). */
.bk-row { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 44px; padding: 6px 0;
  border: 0; border-top: 1px solid var(--line); background: none; font: inherit; text-align: left;
  color: inherit; cursor: pointer; }
.bk-row:active { background: var(--surface-2); }
/* „weitere anzeigen" ist hier der einzige Weg zu den älteren Kopien — auf 44px Tippfläche bringen
   (der App-weite 23px-Fall bleibt Etappe-7-Backlog). Drei Klassen, damit die Regel die weiter unten
   stehende `.editor-wrap .more-btn { padding-top: 2px }` über die höhere Spezifität schlägt;
   mit nur zwei Klassen gewann jene über die Reihenfolge (nachgemessen: 34px statt 45px). */
.editor-wrap .set-card .more-btn { padding: 13px 2px; }
.bk-list .bk-row:first-child { border-top: 0; }
.bk-row:hover .bk-d { text-decoration: underline; }
.bk-row:focus-visible { outline: 2px solid var(--accent-ink); outline-offset: -2px; border-radius: 6px; }
/* Waehrend die Datei geholt wird: sichtbar, dass etwas laeuft, und kein zweiter Tipp. */
.bk-row.busy { opacity: .55; pointer-events: none; }
.bk-d { font-size: 14px; font-weight: 620; color: var(--ink); flex: 1; min-width: 0; }
.bk-s { font-size: 12.5px; color: var(--ink-2); flex: none; font-variant-numeric: tabular-nums; }
.bk-dl { font-size: 15px; color: var(--accent-ink); flex: none; }

/* ===== Editor (Handy) ===== */
/* container-type: die mitwachsenden Schriftgrößen der Eingabe-Ansicht beziehen sich damit auf die
   BREITE DIESER SPALTE statt auf die Fensterbreite (siehe @supports-Block am Dateiende). Steht die App
   je in einem schmaleren Rahmen als das Fenster — iPad-Split-View, PWA-Fenster, eine Vorschau —, war
   die Schrift sonst zu groß für den Platz und Beträge brachen hinter dem €-Zeichen um
   (Diego 2026-08-01). Auf dem Handy im Vollbild ändert sich nichts: Spalte = Fensterbreite. */
.editor-wrap { max-width: 520px; margin: 0 auto; container-type: inline-size; container-name: app; }
/* Unten reichlich Luft NUR dort, wo der schwebende „Erfassen"-Knopf steht (Übersicht) — auf den
   Formularen stünde sonst leerer Raum unter dem Speichern-Knopf. */
.scroll { padding: 15px max(16px, env(safe-area-inset-right, 0px)) 40px max(16px, env(safe-area-inset-left, 0px)); }
.scroll.with-fab { padding-bottom: calc(104px + env(safe-area-inset-bottom, 0px)); }
.pscreen { display: none; }
.pscreen.on { display: block; animation: fade .25s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .pscreen.on { animation: none; } }
.greet { font-size: 14px; color: var(--ink-2); margin: 0 0 10px; }
.greet b { color: var(--ink); }
.balance { background: linear-gradient(150deg, var(--accent-fill-a), var(--accent-fill-b)); color: #fff; border-radius: var(--r); padding: 13px clamp(11px, 4vw, 15px); margin-bottom: 10px; box-shadow: var(--shadow); }
.balance .bl { font-size: 11.5px; opacity: .85; }
/* Beträge wachsen mit der Bildschirmbreite mit (gedeckelt auf die abgenommene Größe). Feste Größen +
   eine Media-Query-Stufe reichten nicht: auf einem 390px-iPhone brach das „€" in die nächste Zeile. */
.balance .bv { font-size: clamp(16px, 6.6vw, 26px); font-weight: 680; white-space: nowrap; margin-top: 2px; letter-spacing: -.015em; }
.balance .split { display: flex; gap: clamp(8px, 3.6vw, 14px); margin-top: 11px; padding-top: 10px; border-top: 1px solid rgba(255,255,255,.2); }
.balance .split > div { flex: 1; }
.balance .sl { font-size: 11px; opacity: .85; }
.balance .sv { font-size: clamp(9.5px, 3.3vw, 15px); font-weight: 680; white-space: nowrap; margin-top: 2px; }

/* Obere Reihe: türkise Gesamtkapital-Kachel (links, breiter) + prominente Gesamtgewinn-Kachel (rechts,
   kleiner). Nutzt den vorher leeren Platz rechts. In der schmaleren Kachel frei/investiert untereinander. */
.top-row { display: grid; grid-template-columns: minmax(0, 1.62fr) minmax(0, 1fr); gap: 9px; margin-bottom: 9px; align-items: stretch; }
.top-row > * { min-width: 0; }               /* verhindert Grid-Überlauf auf schmalen Handys */
.top-row .balance { margin-bottom: 0; }
.balance .split > div { min-width: 0; }
/* padding-top 12 statt 13: diese Karte hat einen 1px-Rahmen, die Gesamtkapital-Kachel nicht — sonst
   säßen Überschrift und Trennlinie exakt 1px tiefer als links (Diego 2026-08-01). */
.profit-card { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 12px clamp(9px, 3.4vw, 13px) 14px; box-shadow: var(--shadow); }
.profit-card .pl2 { font-size: 11.5px; color: var(--ink-3); font-weight: 600; }
/* Betrag skaliert mit der Bildschirmbreite und darf notfalls umbrechen — KEIN nowrap: in der schmalen
   rechten Kachel liefe eine feste 20px-Zahl auf 360px-Handys sonst über den Kartenrand hinaus. */
/* 3.8vw ist empirisch (320–900px in 1px-Schritten) die größte Stufe, bei der auch ein 6-stelliger
   Gesamtgewinn („+117.136,74 €") nirgends umbricht — größere Werte brechen u.a. bei 375px (iPhone SE/mini). */
/* min-height + margin-top wie bei der Gesamtkapital-Kachel (`.bl`/`.bv`/`.split`): nur so liegt die
   Trennlinie darunter auf EXAKT derselben Höhe wie links, obwohl die Zahl hier kleiner gesetzt ist
   (Diego 2026-08-01). Der Wert entspricht der Zeilenhöhe von `.bv` (Schriftgröße × 1.5).
   `align-items: center` setzt die Zahl in diesen reservierten Platz MITTIG statt an den oberen Rand —
   sonst klebte sie am Titel und der ganze Leerraum lag zwischen ihr und dem Strich. */
/* margin-top 11 (statt 2) und dafür 9px weniger min-height: die Summe bleibt gleich, der Strich darunter
   fluchtet also weiter mit links — die Zahl selbst rutscht aber so weit nach unten, dass der Abstand
   nach oben zum Titel und nach unten zum Strich GLEICH groß ist (gemessen je ~17px). */
.profit-card .pv2 { font-size: clamp(10px, 3.8vw, 20px); font-weight: 730; white-space: nowrap; margin-top: 11px; line-height: 1.15; letter-spacing: -.02em;
  min-height: calc(clamp(16px, 6.6vw, 26px) * 1.5 - 9px); display: flex; align-items: center; }
.profit-card.up .pv2 { color: var(--gain); }
.profit-card.down .pv2 { color: var(--loss); }
/* Renditen unten abgesetzt (margin-top:auto schiebt sie nach unten, feine Linie wie bei frei/investiert). */
/* Trennlinie dicht unter die Gewinn-Zahl statt ans Kartenende (`margin-top: auto`): dazwischen klaffte
   sonst eine Lücke von 45px, weil die Karte auf die Höhe der Gesamtkapital-Kachel gestreckt wird
   (Diego 2026-08-01). Der übrige Platz verteilt sich jetzt auf die beiden Prozentzeilen darunter. */
.profit-card .pc-bot { margin-top: 11px; padding-top: 12px; border-top: 1px solid var(--line); display: flex; flex-direction: column; justify-content: space-around; flex: 1; }
.profit-card .pp2 { font-size: clamp(11px, 3.1vw, 12px); color: var(--ink-3); line-height: 1.5; }
.profit-card .pp2 .up { color: var(--gain); font-weight: 660; }
.profit-card .pp2 .down { color: var(--loss); font-weight: 660; }

/* Erklärzeile, wenn „Frei zum Investieren" rechnerisch negativ ist (zeigt „–") — in beiden Ansichten. */
.cap-hint { font-size: 11.5px; color: var(--warn); margin: -2px 2px 10px; line-height: 1.4; }

/* Kompakte Gewinn-Kacheln: realisierte + offene Gewinne mit den GLEICHEN Begriffen wie das Dashboard. */
.gain2 { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin-bottom: 16px; }
.gcell { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 9px 12px; }
.gcell .gl { font-size: 11px; color: var(--ink-3); font-weight: 600; }
/* Skaliert mit wie der Gesamtgewinn darüber — sonst wären diese untergeordneten Zahlen auf dem Handy
   GRÖSSER als die prominente Kachel (die in ihrer schmaleren Spalte stärker schrumpfen muss). */
.gcell .gv { font-size: clamp(10px, 3.4vw, 18px); font-weight: 720; margin-top: 1px; line-height: 1.15; white-space: nowrap; }
.gcell .gv.up { color: var(--gain); } .gcell .gv.down { color: var(--loss); }
.gcell .gd { font-size: 10.5px; color: var(--ink-3); margin-top: 2px; }
/* Symbol-Kachel der beiden Aktionen (jetzt in der Auswahl des schwebenden Knopfes, s. .pick-item). */
.aic { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; font-size: 16px; flex: none; }
.aic.trade { background: var(--gain-soft); color: var(--gain); }
.aic.cash { background: var(--accent-soft); color: var(--accent-ink); }
.mini-h { font-size: 12px; text-transform: uppercase; letter-spacing: .07em; color: var(--ink-3); font-weight: 700; margin: 6px 4px 10px; }
/* Weitere Abschnitte (Abgeschlossene Positionen, Letzte Änderungen) etwas abgesetzt. */
.mini-h.section { margin-top: 20px; }
/* Überschrift, die selbst auf-/zuklappt: Pfeil rechts, ganze Zeile ist die Tippfläche. Etwas
   kräftiger als die übrigen Überschriften (--ink-2 statt --ink-3) — sie ist die einzige, die man
   antippen kann, und am Handy gibt es kein :hover, das das verraten würde.
   Zu den Zahlen: margin 10 + padding 10 ergibt denselben Textabstand wie die 20px margin der
   normalen .mini-h.section (und unten 10px padding statt 10px margin) — im Browser nachgemessen.
   Nicht "vereinfachen", sonst springt die Überschrift beim Wechsel leer↔gefüllt. */
/* Der 4px-Einzug aus .mini-h wandert hier von margin nach padding: als <button> waere width:auto nur
   inhaltsbreit, und width:100% PLUS Seitenrand wuerde ueber die Kartenkante hinausragen. So beginnt
   der Text auf einer Linie mit den anderen Überschriften und der Pfeil fluchtet mit den Karten. */
button.mini-h.head-toggle { display: flex; align-items: center; justify-content: space-between; gap: 8px;
  width: 100%; margin: 10px 0 0; padding: 10px 0 10px 4px; background: none; border: 0;
  cursor: pointer; text-align: left; color: var(--ink-2); }
button.mini-h.head-toggle:hover { color: var(--ink); }
/* Pfeil deutlich größer als der Überschriftentext: er ist das einzige Zeichen dafür, dass sich hier
   etwas aufklappen lässt (Diego 2026-07-31: „fast überhaupt nicht zu sehen"). */
/* 22px: bei 17px war der Pfeil auf dem Handy immer noch zu unscheinbar (Diego 2026-08-01). */
button.mini-h.head-toggle .tri { font-size: 22px; line-height: 1; letter-spacing: 0; color: var(--ink-2); }
.mini-pos { display: flex; align-items: center; gap: clamp(8px, 2.8vw, 11px); width: 100%; text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 11px clamp(9px, 3vw, 12px); margin-bottom: 8px; cursor: pointer; color: var(--ink); transition: .13s; }
.mini-pos:hover { border-color: var(--accent); }
/* Kachel und ihre Schrift wachsen mit der Gerätebreite. Die Schrift ist bewusst kleiner als früher:
   vier breite Großbuchstaben („NEWM") stießen sonst an den Rand des Quadrats (Diego 2026-07-31). */
.mini-pos .tk { width: clamp(32px, 9.2vw, 36px); height: clamp(32px, 9.2vw, 36px); border-radius: 8px; background: var(--surface-2); border: 1px solid var(--line); display: grid; place-items: center; font-weight: 700; font-size: clamp(9.5px, 2.8vw, 11px); letter-spacing: -.02em; overflow: hidden; color: var(--ink-2); flex: none; }
.mp-main { flex: 1; min-width: 0; }
.mp-top { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.mp-top .nm { font-weight: 640; font-size: clamp(12.5px, 3.6vw, 14px); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Prozentsatz bewusst NICHT fett und eine Spur kleiner (Diego 2026-08-01): der Euro-Betrag darunter
   trägt die Betonung und ist dafür etwas größer gesetzt (siehe `.mp-sub .pl`). */
.mp-top .pl { font-size: clamp(10.5px, 3vw, 11.5px); font-weight: 500; white-space: nowrap; flex: none; }
.pl.up { color: var(--gain); } .pl.down { color: var(--loss); }
.mp-sub { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 3px; }
.mp-sub .qty { font-size: clamp(11px, 3.1vw, 12px); color: var(--ink-3); }
/* Bewusst nur bis 13,5px: der Wertpapiername darüber liegt bei max. 14px und soll die Zeile führen. */
.mp-sub .pl { font-size: clamp(11.5px, 3.4vw, 13.5px); font-weight: 660; white-space: nowrap; flex: none; }
/* Zielstrahl: Weg vom Kaufkurs zum Verkaufsziel — gleiche Balken-Optik wie im Dashboard. */
.goal-row { display: flex; align-items: center; gap: clamp(7px, 2.4vw, 9px); margin-top: 7px; }
.goal-row .bar { flex: 1; min-width: 0; height: 6px; margin-top: 0; }
.goal-lbl { font-size: clamp(10.5px, 3vw, 11.5px); color: var(--ink-2); white-space: nowrap; flex: none; }
.goal-lbl.warntxt { color: var(--warn); font-weight: 640; }
.chev { color: var(--ink-3); font-size: 20px; flex: none; }
.empty-hint { font-size: 12.5px; color: var(--ink-3); text-align: center; margin-top: 10px; }
.empty-hint { padding: 24px 12px; }

/* Lade-Platzhalter: erscheint sofort beim Antippen und hält den Platz, bis der Server geantwortet hat.
   Ohne ihn stand die ALTE Liste unter dem NEUEN Titel — das wirkte wie ein Hänger (Diego 2026-08-01). */
.skel { display: grid; gap: 10px; }
.skel-card { height: 148px; border-radius: var(--r); background: var(--surface-2); }
.skel-row { height: 62px; border-radius: var(--r-sm); background: var(--surface-2); }
.skel-card, .skel-row { animation: skelpuls 1.1s ease-in-out infinite; }
@keyframes skelpuls { 0%, 100% { opacity: .55; } 50% { opacity: .95; } }
@media (prefers-reduced-motion: reduce) { .skel-card, .skel-row { animation: none; opacity: .7; } }

/* ===== Schwebender „Erfassen"-Knopf + Auswahl (Eingabe-Ansicht) =====
   Ersetzt die zwei breiten Knöpfe über der Liste (Diego 2026-07-31). Fest am unteren Rand, damit er
   auch weit unten in einer langen Positionsliste erreichbar bleibt; unter der Auswahl liegt eine
   abdunkelnde Fläche, die den Tipp daneben abfängt. safe-area: iPhones mit Home-Indikator. */
.fab-wrap.hidden { display: none; }
/* Runder Knopf mit Plus, ohne Beschriftung (Diego 2026-08-01): das Wort „Erfassen" schob ihn weit in
   die Liste hinein. right: an der App-Spalte ausrichten, nicht am Fensterrand — sonst steht er auf
   breiten Bildschirmen weit rechts im Leeren, während die Auswahl mittig aufklappt (520px/2 = 260,
   minus 16px Innenabstand = 244). Der Sicherheitsabstand rechts kommt dazu (abgerundete Ecken).
   bottom: 26px statt 18px — er saß sonst sehr tief in der unteren Ecke. */
.fab { position: fixed; right: max(16px, env(safe-area-inset-right, 0px), calc(50vw - 244px));
  bottom: calc(26px + env(safe-area-inset-bottom, 0px)); z-index: 55;
  width: 58px; height: 58px; padding: 0; border: 0; border-radius: 999px; background: var(--accent);
  color: var(--on-accent); display: grid; place-items: center;
  cursor: pointer; box-shadow: 0 8px 22px color-mix(in srgb, var(--accent) 45%, transparent); }
.fab:hover { filter: brightness(1.06); }
.fab:focus-visible { outline: 3px solid var(--accent-ink); outline-offset: 3px; }
/* Plus aus zwei Balken statt als Schriftzeichen: eine Glyphe sitzt je nach Systemschrift (Segoe UI
   hier, SF Pro auf dem iPhone) unterschiedlich hoch in ihrer Zeile und war senkrecht 1,5px daneben.
   So ist es auf jedem Gerät exakt mittig (Diego 2026-08-01). */
.fab .fab-plus { position: relative; width: 22px; height: 22px; }
.fab .fab-plus::before, .fab .fab-plus::after { content: ''; position: absolute; background: currentColor; border-radius: 2px; }
.fab .fab-plus::before { left: 0; right: 0; top: 50%; height: 2.6px; transform: translateY(-50%); }
.fab .fab-plus::after { top: 0; bottom: 0; left: 50%; width: 2.6px; transform: translateX(-50%); }
/* ÜBER der Kopfzeile (65): sonst blieb bei offener Auswahl genau der obere Streifen ungedimmt und
   bedienbar — ein Tipp auf ↻ baute die Liste hinter dem offenen Blatt neu auf. */
/* touch-action: none — ein Wisch auf der abgedunkelten Fläche darf nicht die Liste dahinter
   verschieben; sonst steht man nach dem Schließen an einer ganz anderen Stelle. */
.sheet-backdrop { position: fixed; inset: 0; z-index: 68; background: rgba(10, 20, 26, .45); touch-action: none; overscroll-behavior: contain; }
.sheet-backdrop[hidden] { display: none; }
/* max-height + overflow: auf sehr flachen Bildschirmen (kleines iPhone im Querformat) reichte das
   Blatt sonst über den oberen Rand hinaus und die Überschrift war nicht mehr erreichbar. */
.pick-sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 70; margin: 0 auto; max-width: 520px;
  /* Das Blatt darf nicht bis in das Meldungsband oben wachsen: im Querformat lag der Toast sonst
     wieder auf der Auswahl. Es hat overflow-y, wird dort also nur scrollbar. 160px = Toast-Oberkante
     (66) + zwei Zeilen Meldung + Luft. `dvh` ist auf iOS Pflicht: `100vh` ist dort die GROSSE
     Viewport-Höhe (eingeklappte Adressleiste), das Blatt hängt aber am sichtbaren Rand — im
     Querformat sind das ~45px Unterschied, und der Toast lag wieder darauf (Senior-Review Runde 32).
     Die vh-Zeile bleibt als Rückfall für iOS vor 15.4. */
  max-height: calc(100vh - 160px);
  max-height: calc(100dvh - 160px);
  overflow-y: auto; overscroll-behavior: contain;
  background: var(--surface); border-top-left-radius: 18px; border-top-right-radius: 18px;
  padding: 16px 14px calc(16px + env(safe-area-inset-bottom, 0px)); box-shadow: var(--shadow-lg); }
.pick-sheet[hidden] { display: none; }
.pick-sheet .sh-title { font-size: 13px; font-weight: 700; color: var(--ink-2); margin: 0 2px 12px; }
.pick-item { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-sm);
  padding: 13px 12px; margin-bottom: 9px; cursor: pointer; color: var(--ink); }
.pick-item:hover { border-color: var(--accent); }
.pick-item:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.pick-item b { display: block; font-size: clamp(13.5px, 3.8vw, 14.5px); font-weight: 660; }
.pick-item small { display: block; font-size: clamp(11px, 3.1vw, 11.5px); color: var(--ink-2); margin-top: 2px; }
.pick-cancel { width: 100%; background: none; border: 0; color: var(--ink-2); font-size: 13.5px; padding: 13px; cursor: pointer; border-radius: var(--r-sm); }
.pick-cancel:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

/* detail (editor) */
.detail-hd { display: flex; align-items: center; gap: 12px; margin: 2px 0 16px; }
.detail-hd .tk { width: 46px; height: 46px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line); display: grid; place-items: center; font-weight: 700; font-size: 13px; color: var(--ink-2); flex: none; }
.detail-hd .nm { font-weight: 680; font-size: 17px; line-height: 1.2; }
.detail-hd .isin { font-size: 12px; color: var(--ink-3); line-height: 1.1; }
.dl-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin-bottom: 16px; }
.dl-cell { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 10px 12px; }
.dl-cell.full { grid-column: 1 / -1; }
.dl-cell .k { font-size: 11px; color: var(--ink-3); }
.dl-cell .v { font-size: 15.5px; font-weight: 660; margin-top: 2px; }
.dl-cell .v2 { font-size: 13px; font-weight: 660; margin-top: 1px; }
.dl-cell .pct-sm { font-size: 12px; opacity: .8; font-weight: 600; }
.goal-cell { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 30%, var(--line)); }
.goal-cell .k { color: var(--accent-ink); font-weight: 700; font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; }
.goal-cell.near .k { color: var(--warn); }
.goal-cell.near { background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 35%, var(--line)); }
.goal-cell .v, .goal-cell .v2 { color: var(--accent-ink); }
.goal-cell.near .v, .goal-cell.near .v2 { color: var(--warn); }
.notes-h { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); font-weight: 700; margin: 4px 2px 9px; }
.note-item { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 10px 12px; margin-bottom: 8px; }
.note-item .nt { font-size: 13px; color: var(--ink); }
.note-item .nm2 { font-size: 11px; color: var(--ink-3); margin-top: 6px; display: flex; align-items: center; gap: 6px; }
.note-item .who-tag { background: var(--accent-soft); color: var(--accent-ink); padding: 1px 7px; border-radius: 999px; font-weight: 700; }
.note-empty { font-size: 12.5px; color: var(--ink-3); padding: 4px 2px 8px; }

/* forms */
.field { margin-bottom: 12px; }
.field label { display: block; font-size: 12px; font-weight: 620; color: var(--ink-2); margin: 0 2px 5px; }
/* MINDESTENS 16px bei allen Eingabefeldern — sonst zoomt iOS Safari beim Antippen automatisch in die
   Seite hinein, und dieser Zoom bleibt gespeichert: Die App startete danach vergrößert und rechts
   abgeschnitten, bis man von Hand herauszoomte (Diego 2026-08-02). Gilt für input, select und textarea. */
.field input, .field select { width: 100%; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 11px 12px; font: inherit; font-size: 16px; color: var(--ink); }
.field input:focus-visible, .field select:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
/* Kauf/Verkauf-Umschalter im gemeinsamen Erfassungs-Formular (Optik vom Login-Umschalter .authtabs).
   Startet NEUTRAL — erst der Beleg-Scan (doc_type) oder ein Tipp färbt die zutreffende Seite ein:
   grün = Kauf, orange = Verkauf, wie die Symbole in der Übersicht. */
.seg { display: flex; background: var(--surface-2); border: 1px solid var(--line); border-radius: 999px; padding: 4px; gap: 4px; margin: 14px 0 16px; }
/* --ink-2 statt --ink-3: im neutralen Startzustand stehen BEIDE Labels so da — --ink-3 läge unter WCAG-AA. */
/* padding 12px → Trefferfläche ~46px (Empfehlung ≥44px), gut tippbar auch mit größeren Fingern. */
.seg-btn { flex: 1; border: 0; background: transparent; color: var(--ink-2); cursor: pointer; font-weight: 620; font-size: 14.5px; padding: 12px 6px; border-radius: 999px; transition: background .12s, color .12s; }
.seg-btn:hover { color: var(--ink); }
.seg-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.seg-btn.seg-buy.on { background: var(--gain); color: var(--on-gain); }
.seg-btn.seg-sell.on { background: var(--warn); color: var(--on-warn); }
@media (prefers-reduced-motion: reduce) { .seg-btn { transition: none; } }
/* Hinweis, solange weder Beleg gelesen noch Richtung gewählt ist (dann sind noch keine Felder sichtbar). */
.trade-start { text-align: center; }
.plausi { display: flex; gap: 8px; align-items: center; font-size: 12.5px; font-weight: 600; margin: 4px 2px 14px; }
.plausi.ok { color: var(--gain); } .plausi.warn { color: var(--warn); }
.cta { width: 100%; border: 0; border-radius: var(--r); background: var(--accent); color: var(--on-accent); font-weight: 660; font-size: 15.5px; padding: 14px; cursor: pointer; box-shadow: 0 4px 14px color-mix(in srgb, var(--accent) 40%, transparent); }
.cta:disabled { opacity: .5; cursor: not-allowed; }
.cta.ghost { background: var(--surface); color: var(--ink); border: 1px solid var(--line); box-shadow: none; margin-top: 9px; }
.result { text-align: center; background: var(--gain-soft); color: var(--gain); border-radius: var(--r); padding: 15px; font-weight: 700; margin: 4px 0 14px; }
.result.neg { background: var(--loss-soft); color: var(--loss); }
.result .rv { font-size: 26px; }
.formerror { background: var(--loss-soft); color: var(--loss); border-radius: var(--r-sm); padding: 10px 12px; font-size: 13px; font-weight: 600; margin-bottom: 12px; }
.info-box { background: var(--accent-soft); color: var(--accent-ink); border-radius: var(--r-sm); padding: 10px 12px; font-size: 12.5px; margin: 4px 0 12px; }

/* ===== Analyst-Dashboard ===== */
.dash-wrap { max-width: 1120px; margin: 0 auto;
  padding: clamp(12px, 2.4vw, 22px) max(clamp(16px, 4vw, 36px), env(safe-area-inset-right, 0px))
           clamp(24px, 4vw, 40px) max(clamp(16px, 4vw, 36px), env(safe-area-inset-left, 0px)); }
.top { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; margin-bottom: 12px; }
.brand { display: flex; align-items: center; gap: 12px; }
.logo { width: 42px; height: 42px; border-radius: 11px; flex: none; background: linear-gradient(150deg, var(--accent-fill-a), var(--accent-fill-b)); color: #fff; display: grid; place-items: center; font-size: 22px; box-shadow: var(--shadow); }
.brand h1 { font-size: clamp(19px, 3vw, 25px); margin: 0; letter-spacing: -.02em; font-weight: 680; }
.brand .sub { color: var(--ink-2); font-size: 13px; margin: 2px 0 0; }
.refresh-btn { border: 1px solid var(--line); background: var(--surface); color: var(--accent-ink); font-size: 12.5px; font-weight: 660; padding: 8px 15px; border-radius: 999px; cursor: pointer; box-shadow: var(--shadow); }
.refresh-btn:hover { border-color: var(--accent); }
/* Hell/Dunkel-Umschalter (kompaktes Icon-Feld) — passt in beide Leisten (Dashboard + Handy-Eingabe). */
.theme-btn { border: 1px solid var(--line); background: var(--surface); color: var(--ink); width: 36px; height: 36px; border-radius: 9px; font-size: 15px; line-height: 1; cursor: pointer; display: grid; place-items: center; box-shadow: var(--shadow); flex: none; }
.theme-btn:hover { border-color: var(--accent); }
.synbar { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; font-size: 12.5px; color: var(--ink-3); flex-wrap: wrap; }
.synbar .rtext { color: var(--ink-2); }
.synbar button { border: 1px solid var(--line); background: var(--surface); color: var(--accent-ink); font-size: 12.5px; font-weight: 660; padding: 7px 13px; border-radius: 999px; cursor: pointer; box-shadow: var(--shadow); }
.dash { display: grid; gap: 18px; }
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
@media (max-width: 820px) { .kpis { grid-template-columns: 1fr 1fr; } }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 16px 17px; box-shadow: var(--shadow); }
.kpi .kl { font-size: 12px; color: var(--ink-3); font-weight: 600; }
.kpi .kv { font-size: clamp(22px, 3vw, 28px); font-weight: 680; letter-spacing: -.015em; margin-top: 6px; }
/* Detail-Zeile: kleine, NICHT fette Beschreibung in Überschrift-Größe (Diegos Wunsch). */
.kpi .kd { font-size: 12px; font-weight: 400; margin-top: 5px; color: var(--ink-2); }
/* Kachel „Frei zum Investieren“: zwei kompakte Wertepaare, etwas kleiner als die anderen Kacheln
   und enger gestapelt, damit die KPI-Reihe niedriger wird (weniger Leerraum unter den anderen). */
.kpi-double .kv { font-size: clamp(16px, 2vw, 19px); margin-top: 1px; }
.kpi-double .kv + .kl { margin-top: 4px; }
.kpi.accent { background: linear-gradient(155deg, var(--accent-fill-a), var(--accent-fill-b)); border-color: transparent; color: #fff; }
.kpi.accent .kl, .kpi.accent .kd { color: rgba(255,255,255,.85); }
/* min-width: 0 — ohne das wächst die Grid-Spalte auf die `min-width: 720px` der Tabelle darin, und
   das ganze Dashboard scrollt seitlich (gemessen: 1013px Inhalt bei 390px Bildschirm). Der
   `overflow-x: auto` des Tabellen-Rahmens greift erst dadurch (Senior-Review Runde 35). */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); min-width: 0; }
.panel .ph { display: flex; align-items: center; gap: 10px; padding: 15px 18px 0; }
.panel .ph h3 { font-size: 15px; margin: 0; letter-spacing: -.01em; }
.panel .ph .pmeta { margin-left: auto; font-size: 12px; color: var(--ink-3); }
.chart-placeholder { padding: 30px 18px; color: var(--ink-3); font-size: 13px; text-align: center; }
/* Verlaufs-Chart (SVG) */
.chart-empty { padding: 22px 18px 24px; color: var(--ink-2); font-size: 13px; }
.chart-wrap { padding: 8px 18px 16px; position: relative; }
.chart-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin-bottom: 4px; }
.chart-val { font-size: 23px; font-weight: 720; color: var(--ink); letter-spacing: -.015em; }
.chart-val.up { color: var(--gain); } .chart-val.down { color: var(--loss); }
/* Rendite (gesamt + p.a.) oben rechts im Chart-Kopf; erste Zeile grundlinien-bündig mit der Überschrift (Diego).
   .panel .ph-chart überschreibt das align-items:center von .panel .ph (gleiche Spezifität, steht später). */
.panel .ph-chart { align-items: baseline; }
.chart-rendite { margin-left: auto; text-align: right; line-height: 1.25; }
.chart-rendite .cr-line { font-size: 13px; font-weight: 700; white-space: nowrap; }
.chart-rendite .cr-sub { font-size: 12px; font-weight: 600; opacity: .8; }
.chart-rendite.up .cr-line { color: var(--gain); }
.chart-rendite.down .cr-line { color: var(--loss); }
.chart-legend { display: flex; gap: 16px; margin: 2px 0 6px; font-size: 11.5px; color: var(--ink-3); flex-wrap: wrap; }
.cl-item { display: inline-flex; align-items: center; gap: 6px; }
.cl-line { display: inline-block; width: 20px; border-top: 2.5px solid var(--ink-2); }
.cl-line.dashed { border-top: 2px dashed var(--ink-2); }
.chart-body { width: 100%; }
.chart-svg { width: 100%; height: auto; display: block; color: var(--accent); overflow: visible; }
.chart-svg.up { color: var(--gain); }
.chart-svg.down { color: var(--loss); }
/* Achsen-Gitter + Beschriftung (neutral, nicht in der Trendfarbe) */
.chart-axis { stroke: var(--grid); stroke-width: 1; }
.chart-axis-txt { fill: var(--ink-3); font-size: 10.5px; }
.chart-dock-label { fill: currentColor; font-size: 11px; font-weight: 700; }
/* Das SVG skaliert über seine viewBox mit der Panelbreite: auf dem Handy wird aus 10,5px effektiv
   unter 5px. Die Angaben gelten im SVG-Koordinatensystem (720 breit) — nach der Skalierung auf
   288-528px ergeben 20px wieder rund 8-15px auf dem Schirm (Senior-Review 2026-08-01). */
@media (max-width: 560px) {
  .chart-axis-txt { font-size: 20px; }
  .chart-dock-label { font-size: 21px; }
}
/* Hover: Fadenkreuz + Punkt + Werte-Kaestchen */
.chart-hover-line { stroke: var(--ink-3); stroke-width: 1; stroke-dasharray: 3 3; opacity: 0; }
.chart-hover-dot { fill: var(--surface); stroke: currentColor; stroke-width: 2.5; opacity: 0; }
.chart-tip { position: absolute; pointer-events: none; z-index: 3; background: var(--surface-2); border: 1px solid var(--line);
  border-radius: 9px; padding: 7px 10px; font-size: 12px; box-shadow: var(--shadow); min-width: 132px; opacity: 0; transition: opacity .08s; }
.chart-tip { max-width: 260px; }
.chart-tip .tt-d { color: var(--ink-3); font-size: 11px; margin-bottom: 3px; }
.chart-tip .tt-r { display: flex; justify-content: space-between; gap: 12px; margin-top: 1px; }
.chart-tip .tt-r span { color: var(--ink-2); flex: 1; min-width: 0; }
.chart-tip .tt-r b { font-weight: 680; color: var(--ink); flex: none; white-space: nowrap; }
.chart-tip .tt-r.up b { color: var(--gain); }
.chart-tip .tt-r.down b { color: var(--loss); }

/* ===== Dashboard-Oberteil: Chart links, News-Feld rechts (auf schmalem Schirm untereinander) ===== */
.dash-grid { display: grid; grid-template-columns: 1.55fr 1fr; gap: clamp(12px, 2vw, 16px); align-items: start; margin-bottom: clamp(12px, 2vw, 16px); }
@media (max-width: 900px) { .dash-grid { grid-template-columns: 1fr; } }
.news { padding: 6px 8px 10px; }
.news-empty { padding: 22px 14px; color: var(--ink-3); font-size: 13px; text-align: center; }
.news-item { display: flex; gap: 11px; padding: 11px 10px; align-items: flex-start; }
.news-item + .news-item { border-top: 1px solid var(--line); }
.news-ico { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; font-size: 15px; flex: none; }
.ic-alert { background: var(--warn-soft); } .ic-jump { background: var(--gain-soft); } .ic-note { background: var(--accent-soft); }
.news-body { min-width: 0; }
.news-title { font-size: 13px; font-weight: 640; margin-bottom: 1px; }
.news-sub { font-size: 12px; color: var(--ink-2); overflow-wrap: anywhere; }
.news-meta { font-size: 11px; color: var(--ink-3); margin-top: 2px; }
.badge { font-weight: 700; }
.badge.g { color: var(--gain); } .badge.l { color: var(--loss); } .badge.w { color: var(--warn); }
/* Anklickbare News-Karten + Logbuch-Zeilen (öffnen die zugehörige Position). */
.news-item.clickable, .activity-item.clickable { cursor: pointer; border-radius: 9px; transition: background .1s; }
.news-item.clickable:hover, .activity-item.clickable:hover { background: var(--surface-2); }
.news-item.clickable:focus-visible, .activity-item.clickable:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

/* Startkapital-Banner (fehlende Einzahlung aus den Käufen übernehmen). */
.cap-banner { display: flex; align-items: center; gap: 13px; background: var(--accent-soft);
  border: 1px solid color-mix(in srgb, var(--accent) 32%, transparent); border-radius: var(--r); padding: 13px 16px; margin-bottom: 14px; }
.cap-banner.warn { background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 34%, transparent); }
.cap-ico { font-size: 22px; flex: none; line-height: 1; }
.cap-body { flex: 1; min-width: 0; }
.cap-title { font-weight: 680; font-size: 14px; color: var(--ink); }
.cap-sub { font-size: 12.5px; color: var(--ink-2); margin-top: 2px; }
.cap-btn { flex: none; border: 0; background: var(--accent); color: var(--on-accent); font-weight: 660; font-size: 13px; padding: 9px 15px; border-radius: 999px; cursor: pointer; box-shadow: var(--shadow); }
.cap-btn:hover { filter: brightness(1.07); }
.cap-btn:disabled { opacity: .6; cursor: default; }
.tablewrap { overflow-x: auto; padding: 6px 4px 10px; }
table { border-collapse: collapse; width: 100%; min-width: 720px; }
th, td { text-align: right; padding: 11px 14px; font-size: 13.5px; white-space: nowrap; }
th { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-3); font-weight: 700; border-bottom: 1px solid var(--line); }
th:first-child, td:first-child { text-align: left; }
tbody tr { border-bottom: 1px solid var(--line); cursor: pointer; }
tbody tr:last-child { border-bottom: 0; }
tbody tr:hover { background: var(--surface-2); }
.asset { display: flex; align-items: center; gap: 11px; }
/* Schrift/Laufweite wie in der Eingabe-Ansicht (`.mini-pos .tk`): sonst stoßen breite Kürzel („WWW",
   „MMM") an den Rand des Quadrats und werden vom `overflow: hidden` abgeschnitten. */
.asset .tk { width: 34px; height: 34px; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--line); display: grid; place-items: center; font-weight: 700; font-size: 11px; letter-spacing: -.06em; color: var(--ink-2); flex: none; overflow: hidden; }
.asset .nm { font-weight: 620; line-height: 1.2; }
.asset .isin { font-size: 11px; color: var(--ink-3); font-variant-numeric: tabular-nums; line-height: 1.1; }
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.pill.up { background: var(--gain-soft); color: var(--gain); }
.pill.down { background: var(--loss-soft); color: var(--loss); }
.dist { font-weight: 700; } .dist.near { color: var(--warn); }
.barcell { min-width: 120px; }
.bar { height: 7px; border-radius: 999px; background: var(--surface-2); overflow: hidden; border: 1px solid var(--line); margin-top: 4px; }
.bar > span { display: block; height: 100%; border-radius: 999px; background: var(--accent); }
.bar > span.warn { background: var(--warn); }
.rowhint { font-size: 12px; color: var(--ink-3); padding: 0 18px 14px; }

/* overlay (analyst edit) */
.overlay { position: fixed; inset: 0; color: var(--ink); background: rgba(8,14,20,.55); display: none; align-items: flex-start; justify-content: center; padding: 5vh 16px; z-index: 60; overflow-y: auto; }
.overlay.on { display: flex; }
.sheet { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; max-width: 580px; width: 100%; box-shadow: var(--shadow-lg); overflow: hidden; }
.sheet .sh { display: flex; align-items: center; gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.sheet .sh .tk { width: 42px; height: 42px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line); display: grid; place-items: center; font-weight: 700; font-size: 12px; color: var(--ink-2); flex: none; }
.sheet .sh .nm { font-weight: 680; font-size: 16px; color: var(--ink); line-height: 1.2; }
.sheet .sh .isin { font-size: 11.5px; color: var(--ink-3); margin-top: 1px; }
.sheet .sh .x { margin-left: auto; border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); width: 32px; height: 32px; border-radius: 8px; font-size: 17px; cursor: pointer; }
.sheet .sb { padding: 16px 18px; }
.editrow { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; margin-bottom: 14px; }
@media (max-width: 520px) { .editrow { grid-template-columns: 1fr 1fr; } }
/* Read-only Detail einer abgeschlossenen Position (#5). */
.closed-badge { display: inline-block; margin-left: 8px; font-size: 11px; font-weight: 700; color: var(--ink-3);
  border: 1px solid var(--line); border-radius: 6px; padding: 1px 7px; vertical-align: 1px; }
.detail-block { margin-bottom: 12px; }
.detail-h { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); font-weight: 700; margin: 2px 2px 8px; }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr 1fr 1fr; gap: 10px; margin-bottom: 8px; }
@media (max-width: 520px) { .detail-grid { grid-template-columns: 1fr 1fr; } }
.detail-grid + .detail-grid { border-top: 1px solid var(--line); padding-top: 8px; }
.detail-result { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 11px 14px; margin: 4px 0 14px; font-size: 13.5px; }
.detail-result b { font-size: 17px; font-weight: 720; }
.detail-result.up b { color: var(--gain); } .detail-result.down b { color: var(--loss); }
.fld label { display: block; font-size: 11px; color: var(--ink-3); font-weight: 620; margin: 0 2px 5px; }
.fld input, .fld .ro { width: 100%; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 9px 11px; font: inherit; font-size: 16px; color: var(--ink); font-variant-numeric: tabular-nums; }
.fld input { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.fld .ro { color: var(--ink-2); background: var(--surface-2); }
.save-row { display: flex; gap: 9px; margin: 4px 0 18px; }
.btn-sm { border: 0; border-radius: 9px; background: var(--accent); color: var(--on-accent); font-weight: 640; font-size: 13px; padding: 9px 14px; cursor: pointer; }
.btn-sm.ghost { background: var(--surface); color: var(--ink); border: 1px solid var(--line); }
.notelog { display: grid; gap: 8px; margin: 8px 0 12px; }
.note-add { display: flex; gap: 8px; }
.note-add input { flex: 1; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 10px 11px; font: inherit; font-size: 16px; color: var(--ink); }

/* ===== Aenderungs-Historie / Logbuch ===== */
.activity-list { display: grid; gap: 0; }
.activity-item { display: flex; gap: 10px; align-items: baseline; padding: 9px 4px; border-bottom: 1px solid var(--line); font-size: 13px; }
.activity-item:last-child { border-bottom: 0; }
/* Feste Label-Breite → die Detail-Texte im Logbuch starten bündig auf einer vertikalen Linie (Diego). */
.act-tag { font-size: 10.5px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); color: var(--ink-2); white-space: nowrap; text-transform: uppercase; letter-spacing: .03em; min-width: 92px; box-sizing: border-box; text-align: center; flex: none; }
.act-body { flex: 1; min-width: 0; }
.act-detail { color: var(--ink); line-height: 1.35; }
.act-meta { font-size: 11.5px; color: var(--ink-3); margin-top: 2px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.act-meta .who-tag { background: var(--accent-soft); color: var(--accent-ink); padding: 1px 7px; border-radius: 999px; font-weight: 700; }
.activity-empty { padding: 14px 4px; color: var(--ink-3); font-size: 12.5px; }
.overlay-history { max-height: 260px; overflow-y: auto; }
.more-btn { background: none; border: 0; color: var(--accent-ink); font: inherit; font-size: 12.5px; font-weight: 640; cursor: pointer; padding: 9px 2px 2px; }
.more-btn:hover { text-decoration: underline; }
/* In der Handy-Eingabe die „… weitere anzeigen"-Knöpfe enger an die Liste rücken (Diego: weniger Leerraum). */
.editor-wrap .more-btn { padding-top: 2px; }
/* Gleicher linker Einzug wie im „Letzte Änderungen"-Panel, damit die „… weitere anzeigen"-Zeilen fluchten. */
.more-wrap { padding: 0 18px; }
.collapsible-head { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 8px; background: none; border: 0; cursor: pointer; padding: 8px 2px; font: inherit; color: var(--ink-3); font-size: 12px; text-transform: uppercase; letter-spacing: .06em; font-weight: 700; }
.collapsible-head:hover { color: var(--ink-2); }
.collapsible-head .tri { color: var(--ink-3); font-size: 13px; }
.collapsible-body { padding-top: 2px; }

/* ===== Login / Registrierung ===== */
.authwrap { min-height: 100vh; display: grid; place-items: center;
  padding: 24px max(16px, env(safe-area-inset-right, 0px)) 24px max(16px, env(safe-area-inset-left, 0px)); }
.authcard { width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); padding: 26px 24px; }
.authcard .logo { margin: 0 auto 14px; }
.authcard h1 { font-size: 21px; margin: 0 0 4px; text-align: center; letter-spacing: -.01em; }
.authcard .sub { color: var(--ink-2); font-size: 13px; text-align: center; margin: 0 0 20px; }
.authtabs { display: flex; background: var(--surface-2); border: 1px solid var(--line); border-radius: 999px; padding: 4px; gap: 4px; margin-bottom: 18px; }
.authtabs button { flex: 1; border: 0; background: transparent; color: var(--ink-2); cursor: pointer; font-weight: 620; font-size: 14px; padding: 9px; border-radius: 999px; }
.authtabs button.on { background: var(--accent); color: var(--on-accent); }
.role-choice { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px; }
.role-opt { border: 1.5px solid var(--line); border-radius: var(--r-sm); padding: 12px; cursor: pointer; text-align: center; font-size: 13px; color: var(--ink-2); }
.role-opt.on { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-ink); font-weight: 640; }
.role-opt .re { font-size: 22px; display: block; margin-bottom: 4px; }
.role-opt.disabled { opacity: .45; cursor: not-allowed; }
.auth-foot { text-align: center; font-size: 12px; color: var(--ink-3); margin-top: 14px; }
/* z-index 72: über dem Auswahlblatt (70). Eine Meldung DARUNTER zu legen hieße, dass eine Fehlermeldung,
   die erst nach dem Öffnen eintrifft, unbemerkt verfällt — deshalb liegt sie oben und rutscht bei
   offenem Blatt stattdessen nach oben weg (siehe `.on-sheet`), wo sie nichts verdeckt. */
/* `width: max-content` ist hier Pflicht, nicht Kosmetik: mit `left:50%` allein deckelt der Browser die
   Breite auf 50 vw, ein max-width kann sie NICHT vergrößern — lange Servermeldungen wurden dadurch
   siebenzeilig (gemessen 195px/163,8px bei 390px Bildbreite, Senior-Review Runde 33). */
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); width: max-content; max-width: min(90vw, 420px); background: var(--ink); color: var(--surface); padding: 11px 18px; border-radius: 999px; font-size: 13.5px; font-weight: 600; box-shadow: var(--shadow-lg); z-index: 72; opacity: 0; transition: opacity .2s, transform .2s; pointer-events: none; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(-4px); }
.toast.err { background: var(--loss); color: var(--on-loss); }
/* Nur solange der schwebende „Erfassen"-Knopf steht (Übersicht), rutscht die Meldung darüber —
   auf Formularen läge sie sonst auf den Speichern-Knöpfen. */
.toast.above-fab { bottom: calc(96px + env(safe-area-inset-bottom, 0px)); }
/* MUSS nach `.above-fab` stehen: gleiche Spezifität, also gewinnt die spätere Regel. Andernfalls
   gelten `top` UND `bottom` gleichzeitig und die Meldung wird über den halben Bildschirm gestreckt. */
.toast.on-sheet { top: calc(66px + env(safe-area-inset-top, 0px)); bottom: auto; }

/* ---- Beleg-Scan (Etappe 5) ---- */
.receipt-scan { margin-bottom: 16px; }
.receipt-btn { width: 100%; border: 2px dashed var(--accent) !important; background: var(--accent-soft) !important; color: var(--accent-ink) !important; font-weight: 760; font-size: 15.5px; padding: 15px 14px; box-shadow: none !important; }
.receipt-btn:hover { background: color-mix(in srgb, var(--accent) 20%, var(--surface)) !important; }
.receipt-status { font-size: 12.5px; color: var(--accent-ink); margin-top: 7px; text-align: center; font-weight: 600; }
.receipt-status.err { color: var(--loss); }
.receipt-status.hidden { display: none; }
.receipt-note { background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 32%, transparent); border-radius: var(--r-sm); padding: 10px 12px; margin-bottom: 12px; }
.receipt-note .rn-h { font-size: 12.5px; font-weight: 680; color: var(--accent-ink); margin-bottom: 4px; line-height: 1.45; }
.receipt-note .rn-w { font-size: 12.5px; color: var(--warn); font-weight: 600; line-height: 1.5; }
.receipt-note .rn-ok { font-size: 12.5px; color: var(--ink-2); }
.field.uncertain input, .field.uncertain select { border-color: var(--loss); background: var(--loss-soft); }
.field.uncertain label { color: var(--loss); }
.receipt-list { display: flex; flex-direction: column; gap: 8px; margin: 2px 0 6px; }
.receipt-item { display: flex; align-items: center; gap: 11px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 10px 12px; text-decoration: none; color: var(--ink); transition: .13s; }
.receipt-item:hover { border-color: var(--accent); }
.receipt-item .ri-ic { font-size: 20px; flex: none; }
.receipt-item .ri-body { flex: 1; min-width: 0; }
.receipt-item .ri-t { font-size: 13.5px; font-weight: 640; }
.receipt-item .ri-m { font-size: 12px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.receipt-item .ri-open { font-size: 12.5px; color: var(--accent-ink); font-weight: 640; white-space: nowrap; flex: none; }
/* Feld-Hinweis (kleiner Erklaertext unter einem Eingabefeld) + gesperrtes Feld (z.B. Gebuehr, wenn der
   Gesamtbetrag die Gebuehr bestimmt). */
.field-hint { font-size: 11.5px; color: var(--ink-3); margin: -6px 2px 13px; line-height: 1.45; }
.field-locked input { opacity: .45; cursor: not-allowed; }
/* (Das frühere „Beleg erkannt: KAUF/VERKAUF"-Etikett entfällt — diese Aussage trägt jetzt der farbige
   Kauf/Verkauf-Umschalter oben im Formular, siehe .seg.) */

/* ---- Position loeschen: dezenter Ausloese-Knopf (Diego: „nicht allzu auffaellig") ganz unten in der
   Detail-Ansicht + eigenes modales Bestaetigungsfenster (Doppel-Bestaetigung vor dem UNWIDERRUFLICHEN
   Loeschen). Der Bestaetigen-Knopf ist rot/auffaellig, der Ausloeser bewusst unauffaellig. ---- */
.danger-zone { margin-top: 20px; padding-top: 13px; border-top: 1px solid var(--line); display: flex; justify-content: center; }
.del-quiet { background: none; border: 0; color: var(--ink-3); font-size: 12.5px; cursor: pointer; padding: 6px 10px; border-radius: 8px; text-decoration: underline; text-underline-offset: 2px; }
.del-quiet:hover, .del-quiet:focus-visible { color: var(--loss); background: var(--loss-soft); text-decoration: none; outline: none; }

.confirm-backdrop { position: fixed; inset: 0; z-index: 90; background: rgba(8,12,16,.6); display: grid; place-items: center; padding: 20px; }
.confirm-box { width: min(440px, 100%); max-height: 90vh; overflow-y: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: 0 18px 50px rgba(0,0,0,.4); padding: 20px 20px 16px; }
.cd-title { font-size: 16px; font-weight: 750; color: var(--ink); margin-bottom: 8px; }
.cd-msg { font-size: 13.5px; line-height: 1.5; color: var(--ink-2); margin-bottom: 18px; }
.cd-msg b { color: var(--ink); }
.cd-row { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }
.cd-btn { border-radius: 9px; padding: 9px 15px; font-size: 13.5px; font-weight: 620; cursor: pointer; border: 1px solid var(--line); }
.cd-cancel { background: var(--surface); color: var(--ink); }
.cd-cancel:hover { border-color: var(--ink-3); }
.cd-danger { background: var(--loss); color: var(--on-loss); border-color: var(--loss); }
.cd-danger:hover { filter: brightness(1.07); }
.cd-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ===== Mitwachsende Schriften an der SPALTENBREITE statt an der Fensterbreite =====
   Dieselben Werte wie oben, nur `vw` → `cqw` (siehe `.editor-wrap { container-type }`). Als eigener
   @supports-Block, damit ältere Browser die vw-Fassung darüber behalten. Nur die Eingabe-Ansicht:
   im Dashboard ist die Fensterbreite das richtige Maß. */
@supports (container-type: inline-size) {
  .balance { padding: 13px clamp(11px, 4cqw, 15px); }
  .balance .split { gap: clamp(8px, 3.6cqw, 14px); }
  .balance .bv { font-size: clamp(16px, 6.6cqw, 26px); }
  .balance .sv { font-size: clamp(9.5px, 3.3cqw, 15px); }
  .profit-card { padding: 12px clamp(9px, 3.4cqw, 13px) 14px; }
  .profit-card .pv2 { font-size: clamp(10px, 3.8cqw, 20px); min-height: calc(clamp(16px, 6.6cqw, 26px) * 1.5 - 9px); }
  .profit-card .pp2 { font-size: clamp(11px, 3.1cqw, 12px); }
  .gcell .gv { font-size: clamp(10px, 3.4cqw, 18px); }
  .mini-pos { gap: clamp(8px, 2.8cqw, 11px); }
  .mini-pos .tk { width: clamp(32px, 9.2cqw, 36px); height: clamp(32px, 9.2cqw, 36px); font-size: clamp(9.5px, 2.8cqw, 11px); }
  .mp-top .nm { font-size: clamp(12.5px, 3.6cqw, 14px); }
  .mp-top .pl { font-size: clamp(10.5px, 3cqw, 11.5px); }
  .mp-sub .qty { font-size: clamp(11px, 3.1cqw, 12px); }
  .mp-sub .pl { font-size: clamp(11.5px, 3.4cqw, 13.5px); }
  .goal-row { gap: clamp(7px, 2.4cqw, 9px); }
  .goal-lbl { font-size: clamp(10.5px, 3cqw, 11.5px); }
  .act .al b { font-size: clamp(13.5px, 3.8cqw, 14.5px); }
  .act .al small { font-size: clamp(11px, 3.1cqw, 11.5px); }
}

/* Sicherheitsnetz gegen den iOS-Auto-Zoom: greift auch für Felder, die später dazukommen. Steht am
   Dateiende, damit es spätere Regeln nicht überschreibt — die müssen ebenfalls >= 16px setzen. */
input, select, textarea { font-size: max(16px, 1em); }
