:root {
  --bg: #0a0d12;
  --surface: #11161e;
  --surface-2: #171e29;
  --surface-3: #1e2734;
  --line: #232c3a;
  --line-strong: #2e3a4c;
  --text: #e9eef6;
  --text-2: #b4bfd0;
  --muted: #7b889d;
  --accent: #3fd0c0;
  --accent-soft: rgba(63, 208, 192, .14);
  --gain: #35d68a;
  --gain-soft: rgba(53, 214, 138, .13);
  --loss: #ff5f6d;
  --loss-soft: rgba(255, 95, 109, .13);
  --gold: #e7b649;
  --gold-soft: rgba(231, 182, 73, .14);
  --warn: #f5a524;
  --violet: #9b8cff;
  --radius: 16px;
  --radius-sm: 10px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", "Roboto Mono", Menlo, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text); }
body {
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.45;
  min-height: 100dvh;
  overscroll-behavior-y: contain;
  background:
    radial-gradient(1200px 500px at 85% -10%, rgba(63, 208, 192, .07), transparent 60%),
    radial-gradient(900px 400px at -10% 0%, rgba(155, 140, 255, .05), transparent 60%),
    var(--bg);
}
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
input { font: inherit; color: inherit; }
.num { font-family: var(--sans); font-feature-settings: "tnum" 1; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.gain { color: var(--gain); }
.loss { color: var(--loss); }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.hidden { display: none !important; }

/* ---------- Kopfzeile ---------- */
.top {
  position: sticky; top: 0; z-index: 20;
  padding: calc(var(--safe-t) + 12px) 16px 10px;
  background: linear-gradient(var(--bg) 70%, rgba(10, 13, 18, 0));
  display: flex; align-items: center; gap: 10px;
}
.brand { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.logo {
  width: 32px; height: 32px; border-radius: 9px; flex: none;
  background: conic-gradient(from 220deg, var(--accent), var(--violet), var(--gold), var(--accent));
  display: grid; place-items: center;
}
.logo::after { content: ""; width: 14px; height: 14px; border-radius: 4px; background: var(--bg); }
.brand-name { font-weight: 800; letter-spacing: .14em; font-size: 12.5px; }
.brand-sub { font-size: 11px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--gain); box-shadow: 0 0 0 3px var(--gain-soft); }
.dot.off { background: var(--warn); box-shadow: 0 0 0 3px rgba(245, 165, 36, .15); }
.badge {
  font-size: 10.5px; font-weight: 800; letter-spacing: .14em;
  padding: 5px 9px; border-radius: 999px;
  color: var(--accent); background: var(--accent-soft); border: 1px solid rgba(63, 208, 192, .35);
}

/* ---------- Seiten ---------- */
main { padding: 0 16px calc(96px + var(--safe-b)); max-width: 640px; margin: 0 auto; }
.page { display: none; animation: fade .25s ease; }
.page.active { display: block; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.hero { padding: 8px 2px 18px; }
.hero-label { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .12em; font-weight: 600; }
.hero-value { font-size: 40px; font-weight: 700; line-height: 1.1; margin: 4px 0 8px; font-family: var(--sans); font-feature-settings: "tnum" 1; letter-spacing: -.035em; }
.hero-value .cents { font-size: 24px; color: var(--text-2); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 600;
  background: var(--surface-2); border: 1px solid var(--line);
}
.chip.gain { background: var(--gain-soft); border-color: transparent; }
.chip.loss { background: var(--loss-soft); border-color: transparent; }
.chip b { font-weight: 500; color: var(--muted); }

.card {
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 14px;
}
.card-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.card-t { font-size: 13px; font-weight: 700; letter-spacing: .02em; }
.card-s { font-size: 12px; color: var(--muted); }
.section-t { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .12em; font-weight: 700; margin: 22px 2px 10px; }

/* Konto-Karten */
.acc-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.acc {
  position: relative; overflow: hidden;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px;
  text-align: left; width: 100%;
}
.acc.wide { grid-column: span 2; }
.acc::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 3px; background: var(--c, var(--accent)); }
.acc-n { font-size: 12px; color: var(--muted); font-weight: 600; display: flex; gap: 6px; align-items: center; }
.acc-v { font-family: var(--sans); font-feature-settings: "tnum" 1; font-size: 20px; font-weight: 700; margin: 4px 0 2px; }
.acc-p { font-family: var(--sans); font-feature-settings: "tnum" 1; font-size: 12.5px; font-weight: 600; }
.acc .spark { position: absolute; right: 10px; bottom: 10px; width: 70px; height: 26px; opacity: .9; }

/* Segment-Schalter */
.seg {
  display: flex; padding: 4px; gap: 4px; border-radius: 12px;
  background: var(--surface); border: 1px solid var(--line); margin-bottom: 14px;
}
.seg button {
  flex: 1; padding: 8px 6px; border-radius: 9px; font-size: 13px; font-weight: 600; color: var(--muted);
}
.seg button.on { background: var(--surface-3); color: var(--text); box-shadow: inset 0 0 0 1px var(--line-strong); }
.seg.sm { margin: 0; padding: 3px; border-radius: 10px; }
.seg.sm button { padding: 4px 9px; font-size: 11.5px; border-radius: 7px; flex: none; }

/* Diagramme */
.chart { position: relative; width: 100%; height: 190px; touch-action: pan-y; }
.chart svg { width: 100%; height: 100%; display: block; overflow: visible; }
.chart.tall { height: 220px; }
.chart.bars { height: 140px; }
.tip {
  position: absolute; top: 0; pointer-events: none; transform: translateX(-50%);
  background: var(--surface-3); border: 1px solid var(--line-strong); border-radius: 8px;
  padding: 6px 9px; font-size: 12px; white-space: nowrap; opacity: 0; transition: opacity .12s;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .4); z-index: 3;
}
.tip.show { opacity: 1; }
.tip .t { color: var(--muted); font-size: 11px; }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--text-2); margin-top: 8px; }
.legend i { display: inline-block; width: 14px; height: 2px; border-radius: 2px; vertical-align: middle; margin-right: 6px; }
.legend i.dash { background: repeating-linear-gradient(90deg, var(--muted) 0 4px, transparent 4px 7px) !important; }

/* Kennzahlen */
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 11px 12px; }
.stat-l { font-size: 11.5px; color: var(--muted); }
.stat-v { font-family: var(--sans); font-feature-settings: "tnum" 1; font-size: 16px; font-weight: 700; margin-top: 2px; }
.stat-h { font-size: 11px; color: var(--muted); margin-top: 2px; }

/* Risiko-Balken */
.meter { height: 8px; border-radius: 99px; background: var(--surface-3); overflow: hidden; margin-top: 8px; }
.meter > span { display: block; height: 100%; border-radius: 99px; background: var(--gain); transition: width .4s; }
.risk-row { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--text-2); }

/* Listen */
.list { display: flex; flex-direction: column; }
.row {
  display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line);
}
.row:first-child { border-top: 0; padding-top: 2px; }
.ico {
  width: 38px; height: 38px; border-radius: 11px; flex: none; display: grid; place-items: center;
  font-weight: 800; font-size: 11.5px; letter-spacing: .02em; background: var(--surface-3); color: var(--text-2);
}
.ico.long { background: var(--gain-soft); color: var(--gain); }
.ico.short { background: var(--loss-soft); color: var(--loss); }
.ico.gold { background: var(--gold-soft); color: var(--gold); }
.row-m { flex: 1; min-width: 0; }
.row-t { font-weight: 600; font-size: 14px; display: flex; gap: 6px; align-items: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-s { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-r { text-align: right; flex: none; }
.row-r .num { font-weight: 700; font-size: 14px; }
.tag { font-size: 10.5px; font-weight: 700; padding: 2px 6px; border-radius: 6px; background: var(--surface-3); color: var(--text-2); }
.tag.long { background: var(--gain-soft); color: var(--gain); }
.tag.short { background: var(--loss-soft); color: var(--loss); }
.empty { text-align: center; color: var(--muted); padding: 26px 10px; font-size: 13.5px; }

/* Schalter */
.switch { position: relative; width: 44px; height: 26px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch span { position: absolute; inset: 0; border-radius: 99px; background: var(--surface-3); border: 1px solid var(--line-strong); transition: .2s; }
.switch span::after { content: ""; position: absolute; width: 20px; height: 20px; left: 2px; top: 2px; border-radius: 50%; background: var(--muted); transition: .2s; }
.switch input:checked + span { background: var(--accent-soft); border-color: rgba(63, 208, 192, .5); }
.switch input:checked + span::after { transform: translateX(18px); background: var(--accent); }

/* Steuerung */
.ctl { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.ctl:first-of-type { border-top: 0; }
.ctl-t { font-weight: 600; font-size: 14px; }
.ctl-s { font-size: 12px; color: var(--muted); }
input[type=range] { width: 100%; accent-color: var(--accent); }
.stepper { display: flex; align-items: center; gap: 4px; background: var(--surface-3); border-radius: 10px; padding: 3px; }
.stepper button { width: 32px; height: 30px; border-radius: 8px; font-size: 18px; font-weight: 700; }
.stepper button:active { background: var(--line-strong); }
.stepper .num { min-width: 46px; text-align: center; font-weight: 700; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 13px 16px; border-radius: 12px; font-weight: 700; width: 100%;
  background: var(--accent); color: #04221f;
}
.btn:disabled { opacity: .4; }
.btn.ghost { background: var(--surface-3); color: var(--text); border: 1px solid var(--line-strong); }
.btn.danger { background: var(--loss-soft); color: var(--loss); border: 1px solid rgba(255, 95, 109, .35); }

/* Aktien: Entscheidung */
.decide {
  border: 1px solid rgba(63, 208, 192, .4);
  background: linear-gradient(160deg, rgba(63, 208, 192, .12), rgba(155, 140, 255, .06) 60%, var(--surface));
}
.decide-amt { font-family: var(--sans); font-feature-settings: "tnum" 1; font-size: 30px; font-weight: 700; }
.opts { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; }
.opt {
  background: var(--surface); border: 1px solid var(--line); border-radius: 13px; padding: 12px; text-align: left;
  transition: border-color .15s, background .15s;
}
.opt.on { border-color: var(--accent); background: rgba(63, 208, 192, .07); }
.opt-h { display: flex; align-items: center; gap: 10px; }
.opt-i { font-size: 22px; width: 30px; text-align: center; flex: none; }
.opt-n { font-weight: 700; font-size: 14px; }
.opt-s { font-size: 12.5px; color: var(--text-2); }
.opt-help { font-size: 12.5px; color: var(--text-2); margin-top: 8px; padding: 10px; border-radius: 9px; background: var(--surface-2); display: none; }
.opt.open .opt-help { display: block; }
.qbtn { width: 26px; height: 26px; border-radius: 50%; background: var(--surface-3); font-size: 13px; font-weight: 700; color: var(--text-2); flex: none; }
.risk { display: inline-flex; gap: 3px; margin-left: 6px; vertical-align: middle; }
.risk i { width: 6px; height: 6px; border-radius: 2px; background: var(--surface-3); }
.risk i.on { background: var(--warn); }
.opt-pct { display: none; align-items: center; gap: 10px; margin-top: 10px; }
.opt.on .opt-pct { display: flex; }
.opt-pct .num { min-width: 120px; text-align: right; font-weight: 700; font-size: 13px; }
.check { display: flex; gap: 10px; align-items: center; margin: 14px 2px; font-size: 13.5px; color: var(--text-2); }
.check input { width: 20px; height: 20px; accent-color: var(--accent); }

.hbar { display: flex; align-items: center; gap: 10px; padding: 8px 0; }
.hbar-n { width: 46%; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hbar-b { flex: 1; height: 10px; background: var(--surface-3); border-radius: 99px; overflow: hidden; }
.hbar-b span { display: block; height: 100%; border-radius: 99px; background: var(--accent); }
.hbar-v { width: 92px; text-align: right; font-size: 12.5px; font-weight: 700; }

.note { font-size: 12px; color: var(--muted); padding: 4px 4px 0; }

/* Untere Navigation */
nav.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: flex; justify-content: center;
  padding: 8px 10px calc(8px + var(--safe-b));
  background: rgba(13, 17, 23, .86); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--line);
}
nav.tabs .in { display: flex; width: 100%; max-width: 640px; }
nav.tabs button {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px;
  font-size: 10.5px; font-weight: 600; color: var(--muted); padding: 4px 0;
}
nav.tabs button svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
nav.tabs button.on { color: var(--accent); }

/* PIN */
.lock { position: fixed; inset: 0; z-index: 50; background: var(--bg); display: grid; place-items: center; padding: 24px; }
.lock-box { width: 100%; max-width: 320px; text-align: center; }
.lock .logo { width: 56px; height: 56px; border-radius: 16px; margin: 0 auto 16px; }
.lock .logo::after { width: 24px; height: 24px; border-radius: 7px; }
.pin-in {
  width: 100%; text-align: center; font-family: var(--sans); font-feature-settings: "tnum" 1; font-size: 28px; letter-spacing: .5em;
  padding: 14px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line-strong); margin: 18px 0 12px;
}
.pin-in:focus { outline: none; border-color: var(--accent); }

.toast {
  position: fixed; left: 50%; bottom: calc(86px + var(--safe-b)); transform: translateX(-50%) translateY(20px);
  background: var(--surface-3); border: 1px solid var(--line-strong); padding: 10px 16px; border-radius: 12px;
  font-size: 13.5px; opacity: 0; transition: .25s; z-index: 60; max-width: 90vw; text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%); }

.pull { text-align: center; font-size: 11.5px; color: var(--muted); padding: 4px 0 10px; }

/* Hilfe */
.help details { border-top: 1px solid var(--line); }
.help summary {
  list-style: none; cursor: pointer; padding: 13px 0; font-weight: 600; font-size: 14px;
  display: flex; align-items: center; gap: 10px;
}
.help summary::-webkit-details-marker { display: none; }
.help summary span { width: 24px; text-align: center; }
.help summary::after { content: "›"; margin-left: auto; color: var(--muted); font-size: 20px; transition: transform .2s; }
.help details[open] summary::after { transform: rotate(90deg); }
.help-b { padding: 0 0 12px 34px; font-size: 13.5px; color: var(--text-2); }
.help-b p { margin: 0 0 8px; }
.help-b b { color: var(--text); }
