@layer theme, base, components, utilities;

@layer theme {
  :root {
    --bg: #000;
    --s1: #0d0d0d;
    --s2: #161616;
    --s3: #1f1f1f;
    --line: #232323;
    --line-2: #333;
    --text: #fff;
    --text-2: #a1a1a1;
    --text-3: #6b6b6b;
    --gold: #f5a524;
    --gold-2: #fbbf24;
    --gold-dim: rgba(245, 165, 36, 0.12);
    --pos: #22d07a;
    --pos-dim: rgba(34, 208, 122, 0.12);
    --neg: #ff5a5a;
    --neg-dim: rgba(255, 90, 90, 0.12);
    --font: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --r-sm: 8px;
    --r-md: 14px;
    --r-lg: 20px;
    --sidebar-w: 248px;
    --tabbar-h: 64px;
    --safe-b: env(safe-area-inset-bottom, 0px);
    --safe-t: env(safe-area-inset-top, 0px);
  }
}

@layer base {
  *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

  html {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.45;
    -webkit-font-smoothing: antialiased;
    -webkit-tap-highlight-color: transparent;
    color-scheme: dark;
  }

  body {
    height: 100dvh;
    overflow: hidden;
    overscroll-behavior: none;
  }

  a { color: var(--gold); text-decoration: none; }
  a:hover { color: var(--gold-2); }

  button, input, select, textarea { font: inherit; color: inherit; }
  button { cursor: pointer; background: none; border: 0; }

  :focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

  [hidden] { display: none !important; }

  .tabular { font-variant-numeric: tabular-nums; }
  .muted { color: var(--text-2); font-size: 0.8125rem; }
  .pos { color: var(--pos) !important; }
  .neg { color: var(--neg) !important; }

  .visually-hidden {
    position: absolute; width: 1px; height: 1px; overflow: hidden;
    clip: rect(0 0 0 0); white-space: nowrap; border: 0;
  }
}

@layer components {
  /* ---------- App-Shell ---------- */
  .app {
    display: grid;
    grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
    height: 100dvh;
  }

  .app-main {
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
  }

  /* ---------- Sidebar (Desktop) ---------- */
  .sidebar {
    background: var(--s1);
    border-right: 1px solid var(--line);
    display: flex;
    flex-direction: column;
    padding: 1.25rem 0.875rem;
    gap: 1.5rem;
    overflow-y: auto;
  }

  .brand {
    display: flex; align-items: center; gap: 0.625rem;
    color: var(--text); font-weight: 900; letter-spacing: -0.02em; font-size: 1.125rem;
    padding: 0 0.5rem;
  }
  .brand:hover { color: var(--text); }

  .brand-emblem {
    display: inline-grid; place-items: center;
    width: 32px; height: 32px; border-radius: 9px;
    background: linear-gradient(135deg, #f5a524, #b45309);
    color: #000; font-weight: 900; font-size: 0.95rem;
    flex-shrink: 0;
  }

  .side-nav { display: flex; flex-direction: column; gap: 2px; }

  .side-link {
    display: flex; align-items: center; gap: 0.75rem;
    padding: 0.6rem 0.75rem; border-radius: var(--r-sm);
    color: var(--text-2); font-weight: 600; font-size: 0.9rem;
    transition: background-color 0.15s, color 0.15s;
  }
  .side-link .ico { width: 1.1rem; text-align: center; color: var(--text-3); }
  .side-link:hover { background: var(--s2); color: var(--text); }
  .side-link.active { background: var(--s3); color: var(--text); }
  .side-link.active .ico { color: var(--gold); }

  .count-badge {
    margin-left: auto; font-size: 0.7rem; font-weight: 700;
    background: var(--s3); color: var(--text-2);
    padding: 0.05rem 0.45rem; border-radius: 99px;
  }
  .count-badge.score { color: var(--pos); background: var(--pos-dim); }

  .side-section { display: flex; flex-direction: column; gap: 0.5rem; }
  .side-label {
    font-size: 0.6875rem; font-weight: 700; letter-spacing: 0.08em;
    text-transform: uppercase; color: var(--text-3); padding: 0 0.75rem;
  }
  .side-add {
    text-align: left; padding: 0.55rem 0.75rem; border-radius: var(--r-sm);
    color: var(--gold); font-size: 0.85rem; font-weight: 600;
  }
  .side-add:hover { background: var(--gold-dim); }

  .side-foot {
    margin-top: auto; display: flex; flex-wrap: wrap; gap: 0.25rem 0.75rem;
    padding: 0 0.75rem; font-size: 0.75rem;
  }
  .side-foot a { color: var(--text-3); }
  .side-foot a:hover { color: var(--text-2); }

  /* Account-Liste (Sidebar + Sheet) */
  .account-list { display: flex; flex-direction: column; gap: 2px; }

  .acc-row {
    display: flex; align-items: center; gap: 0.7rem; width: 100%;
    padding: 0.55rem 0.75rem; border-radius: var(--r-sm);
    text-align: left; color: var(--text-2); font-size: 0.875rem;
    transition: background-color 0.15s;
  }
  .acc-row:hover { background: var(--s2); color: var(--text); }
  .acc-row.active { background: var(--gold-dim); color: var(--text); }
  .acc-row .avatar { width: 28px; height: 28px; font-size: 0.75rem; }
  .acc-row .acc-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
  .acc-row .acc-meta { font-size: 0.7rem; color: var(--text-3); }
  .acc-row .check { color: var(--gold); font-weight: 900; }

  .avatar {
    display: inline-grid; place-items: center; flex-shrink: 0;
    width: 30px; height: 30px; border-radius: 50%;
    background: var(--s3); border: 1px solid var(--line-2);
    color: var(--gold); font-weight: 800; font-size: 0.8rem;
  }
  .active > .avatar { background: var(--gold); color: #000; border-color: var(--gold); }

  /* ---------- Top-App-Bar ---------- */
  .topbar {
    display: flex; align-items: center; gap: 0.75rem;
    padding: calc(0.75rem + var(--safe-t)) 1.5rem 0.75rem;
    border-bottom: 1px solid var(--line);
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(14px);
    flex-shrink: 0;
  }
  .topbar-emblem { display: none; }

  .topbar-title { display: flex; align-items: center; gap: 0.75rem; flex: 1; min-width: 0; }
  .topbar-title h2 {
    font-size: 1.375rem; font-weight: 800; letter-spacing: -0.02em;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    view-transition-name: view-title;
  }
  .topbar-title h2:focus { outline: none; }

  .live-pill {
    display: inline-flex; align-items: center; gap: 0.35rem; flex-shrink: 0;
    font-size: 0.6875rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase;
    color: var(--pos); background: var(--pos-dim);
    padding: 0.2rem 0.55rem; border-radius: 99px;
  }
  .live-pill.weekend { color: var(--gold); background: var(--gold-dim); }

  .live-dot {
    width: 6px; height: 6px; border-radius: 50%; background: currentColor;
    animation: pulse 2s infinite;
  }
  @keyframes pulse { 50% { opacity: 0.35; } }

  .account-chip {
    display: inline-flex; align-items: center; gap: 0.5rem;
    padding: 0.25rem 0.65rem 0.25rem 0.25rem;
    border: 1px solid var(--line-2); border-radius: 99px;
    background: var(--s1); max-width: 220px;
    transition: border-color 0.15s;
  }
  .account-chip:hover { border-color: var(--gold); }
  .account-chip .avatar { width: 28px; height: 28px; background: var(--gold); color: #000; border: 0; }
  .account-chip-name { font-size: 0.8125rem; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .chev { color: var(--text-3); font-size: 0.7rem; }

  /* ---------- Ticker ---------- */
  .ticker {
    display: flex; gap: 1.5rem; overflow-x: auto; scrollbar-width: none;
    padding: 0.5rem 1.5rem; border-bottom: 1px solid var(--line);
    font-size: 0.75rem; white-space: nowrap; color: var(--text-2);
    flex-shrink: 0;
  }
  .ticker::-webkit-scrollbar { display: none; }
  .tick b { color: var(--text-3); font-weight: 700; margin-right: 0.3rem; }
  .tick span { color: var(--text); font-weight: 600; }

  /* ---------- Stage & Views ---------- */
  .stage {
    flex: 1; min-height: 0; overflow-y: auto;
    overscroll-behavior: contain;
    padding: 1.25rem 1.5rem 2rem;
    scrollbar-width: thin; scrollbar-color: #2a2a2a transparent;
  }

  .view {
    max-width: 1080px; margin: 0 auto;
    display: grid; gap: 1rem;
    view-transition-name: app-view;
  }
  .view[data-view="cockpit"] { grid-template-columns: 1.4fr 1fr; align-items: start; }
  .view[data-view="cockpit"] .hero { grid-row: span 2; }
  .view[data-view="markt"] { grid-template-columns: 1fr; }

  .card {
    background: var(--s1); border: 1px solid var(--line);
    border-radius: var(--r-lg); padding: 1.25rem;
  }
  .card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.875rem; }
  .card-head h3 { font-size: 1rem; font-weight: 800; }

  .link-btn { color: var(--gold); font-size: 0.8125rem; font-weight: 700; padding: 0.25rem; }

  .section-label {
    font-size: 0.6875rem; font-weight: 700; letter-spacing: 0.08em;
    text-transform: uppercase; color: var(--text-3); margin-top: 0.5rem;
  }
  .view-hint { color: var(--text-2); font-size: 0.8125rem; }

  /* ---------- Hero ---------- */
  .hero-label { font-size: 0.75rem; color: var(--text-2); font-weight: 600; margin-bottom: 0.25rem; }
  .hero-value {
    font-size: clamp(2.25rem, 5vw, 3.25rem); font-weight: 900;
    letter-spacing: -0.035em; line-height: 1.05;
  }

  .pnl-chip {
    display: inline-block; margin-top: 0.5rem;
    font-size: 0.875rem; font-weight: 700;
    padding: 0.2rem 0.6rem; border-radius: 99px;
  }
  .pnl-chip.positive { color: var(--pos); background: var(--pos-dim); }
  .pnl-chip.negative { color: var(--neg); background: var(--neg-dim); }

  .stat-row {
    display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.5rem; margin: 1.25rem 0 0.75rem;
  }
  .stat { background: var(--s2); border-radius: var(--r-md); padding: 0.65rem 0.75rem; min-width: 0; }
  .stat small { display: block; font-size: 0.6875rem; color: var(--text-3); font-weight: 600; }
  .stat strong { display: block; font-size: 0.9375rem; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

  .chart-box { margin-top: 0.5rem; }
  .chart-svg { width: 100%; height: 150px; display: block; }
  .chart-legend { display: flex; gap: 1rem; font-size: 0.6875rem; color: var(--text-3); margin-top: 0.5rem; }
  .legend-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 0.3rem; vertical-align: middle; }

  /* ---------- Allokation ---------- */
  .alloc-bar { height: 10px; border-radius: 99px; overflow: hidden; display: flex; background: var(--s3); margin-bottom: 0.875rem; }
  .alloc-seg { height: 100%; transition: width 0.3s ease; }
  .alloc-list { display: flex; flex-direction: column; gap: 0.5rem; font-size: 0.8125rem; }
  .alloc-item { display: flex; align-items: center; gap: 0.6rem; }
  .alloc-item .lbl { flex: 1; color: var(--text-2); }
  .alloc-item .val { font-weight: 700; }
  .alloc-dot { width: 10px; height: 10px; border-radius: 3px; flex-shrink: 0; }

  /* ---------- Listen (Positionen, News) ---------- */
  .list { display: flex; flex-direction: column; }
  .list-card { background: var(--s1); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; }

  .row {
    display: flex; align-items: center; gap: 0.875rem;
    padding: 0.8rem 0.25rem; border-bottom: 1px solid var(--line);
    min-height: 60px;
  }
  .list-card .row { padding: 0.85rem 1.1rem; }
  .row:last-child { border-bottom: 0; }

  .punze {
    display: inline-grid; place-items: center; flex-shrink: 0;
    width: 46px; height: 46px; border-radius: 12px;
    background: #fff; color: #000; font-weight: 900; font-size: 0.8rem; line-height: 1.05; text-align: center;
  }
  .punze small { display: block; font-size: 0.6rem; color: #666; font-weight: 700; }

  .row-main { flex: 1; min-width: 0; }
  .row-title { font-weight: 700; font-size: 0.9375rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .row-sub { font-size: 0.75rem; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .row-end { text-align: right; flex-shrink: 0; }
  .row-val { font-weight: 800; font-size: 0.9375rem; }
  .row-delta { font-size: 0.75rem; font-weight: 700; }

  .tag {
    display: inline-block; font-size: 0.65rem; font-weight: 700;
    padding: 0.05rem 0.4rem; border-radius: 99px; margin-left: 0.35rem; vertical-align: 1px;
  }
  .tag.free { color: var(--pos); background: var(--pos-dim); }
  .tag.pending { color: var(--gold); background: var(--gold-dim); }

  .row-del {
    width: 36px; height: 36px; border-radius: 50%; color: var(--text-3); flex-shrink: 0;
  }
  .row-del:hover { color: var(--neg); background: var(--neg-dim); }

  .news-row { display: block; color: inherit; }
  .news-row:hover { color: inherit; background: var(--s1); }
  .news-src { font-size: 0.6875rem; color: var(--gold); font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; }
  .news-title { font-size: 0.875rem; font-weight: 600; line-height: 1.35; margin-top: 0.15rem; }

  .empty { text-align: center; padding: 3rem 1rem; color: var(--text-2); display: grid; gap: 1rem; justify-items: center; }

  /* ---------- Toolbar & Chips ---------- */
  .view-toolbar { display: flex; align-items: center; gap: 0.75rem; min-width: 0; }
  .chips { display: flex; gap: 0.4rem; overflow-x: auto; scrollbar-width: none; flex: 1; min-width: 0; }
  .chips::-webkit-scrollbar { display: none; }
  .chip {
    flex-shrink: 0; padding: 0.4rem 0.85rem; border-radius: 99px;
    border: 1px solid var(--line-2); color: var(--text-2);
    font-size: 0.8125rem; font-weight: 600; white-space: nowrap;
  }
  .chip:hover { color: var(--text); }
  .chip.active { background: var(--text); color: #000; border-color: var(--text); }
  .toolbar-actions { display: flex; gap: 0.4rem; flex-shrink: 0; }

  .icon-btn {
    display: inline-grid; place-items: center; min-width: 36px; height: 36px;
    padding: 0 0.7rem; border-radius: 99px; border: 1px solid var(--line-2);
    color: var(--text-2); font-size: 0.75rem; font-weight: 700;
  }
  .icon-btn:hover { color: var(--text); border-color: var(--gold); }

  /* ---------- Goldproben ---------- */
  .proben-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 0.75rem; }
  .probe {
    background: var(--s1); border: 1px solid var(--line); border-radius: var(--r-md);
    padding: 0.875rem; text-align: left; display: flex; flex-direction: column; gap: 0.4rem;
    transition: border-color 0.15s, transform 0.1s;
  }
  .probe:hover { border-color: var(--gold); }
  .probe:active { transform: scale(0.97); }
  .probe.inv { border-color: rgba(245, 165, 36, 0.35); background: linear-gradient(180deg, #17120a, var(--s1)); }
  .probe-top { display: flex; justify-content: space-between; align-items: center; }
  .probe-badge { background: #fff; color: #000; font-weight: 900; font-size: 0.95rem; padding: 0.05rem 0.45rem; border-radius: 6px; }
  .probe-karat { font-size: 0.7rem; color: var(--gold-2); font-weight: 700; }
  .probe-price { font-size: 1.2rem; font-weight: 900; }
  .probe-sub { font-size: 0.7rem; color: var(--text-3); }

  /* ---------- Rechner ---------- */
  .calc-sticky {
    position: sticky; top: -1.25rem; z-index: 2;
    background: rgba(13, 13, 13, 0.92); backdrop-filter: blur(12px);
  }
  .calc-res { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.75rem; }
  .calc-res small { display: block; font-size: 0.6875rem; color: var(--text-3); font-weight: 600; }
  .calc-res strong { display: block; font-size: 1.05rem; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .calc-verdict { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 1rem; margin-top: 0.75rem; }
  .calc-verdict small { font-size: 0.75rem; color: var(--text-2); }

  .ampel { display: inline-flex; gap: 0.35rem; align-items: center; font-size: 0.8125rem; font-weight: 700; padding: 0.25rem 0.65rem; border-radius: 99px; }
  .ampel.green { color: var(--pos); background: var(--pos-dim); }
  .ampel.yellow { color: var(--gold); background: var(--gold-dim); }
  .ampel.red { color: var(--neg); background: var(--neg-dim); }

  .form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.875rem; }
  .full { grid-column: 1 / -1; }
  .field { display: flex; flex-direction: column; gap: 0.3rem; min-width: 0; }
  .field label { font-size: 0.75rem; font-weight: 600; color: var(--text-2); }
  .field input, .field select {
    width: 100%; min-height: 46px;
    background: var(--s2); border: 1px solid var(--line-2); border-radius: var(--r-sm);
    padding: 0.6rem 0.8rem; font-size: 1rem; /* 16px verhindert iOS-Zoom */
    transition: border-color 0.15s;
  }
  .field input:focus, .field select:focus { outline: none; border-color: var(--gold); background: var(--s3); }
  .form-error { color: var(--neg); font-size: 0.8125rem; min-height: 1em; }

  .btn-primary {
    display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
    min-height: 50px; padding: 0 1.5rem; border-radius: var(--r-md);
    background: var(--gold); color: #000; font-weight: 800; font-size: 1rem;
    transition: transform 0.1s, opacity 0.15s;
  }
  .btn-primary:hover { opacity: 0.92; }
  .btn-primary:active { transform: scale(0.98); }

  .btn-secondary {
    display: inline-flex; align-items: center; justify-content: center;
    min-height: 48px; padding: 0 1.25rem; border-radius: var(--r-md);
    border: 1px solid var(--line-2); color: var(--text); font-weight: 700;
  }
  .btn-secondary:hover { border-color: var(--gold); }

  /* ---------- Markt ---------- */
  .score-card { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
  .score-row { display: flex; align-items: baseline; gap: 0.6rem; }
  .score-number { font-size: 2.5rem; font-weight: 900; letter-spacing: -0.03em; color: var(--pos); }
  .score-signal { font-size: 0.875rem; font-weight: 800; text-transform: uppercase; }
  .score-ring {
    --p: 0;
    width: 72px; height: 72px; border-radius: 50%; flex-shrink: 0;
    background: conic-gradient(var(--pos) calc(var(--p) * 1%), var(--s3) 0);
    mask: radial-gradient(farthest-side, transparent 72%, #000 73%);
  }

  .pillars { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.75rem; }
  .pillar { background: var(--s1); border: 1px solid var(--line); border-radius: var(--r-md); padding: 0.875rem; }
  .pillar-top { display: flex; justify-content: space-between; font-size: 0.6875rem; color: var(--text-3); font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em; }
  .pillar-val { font-size: 1.2rem; font-weight: 900; margin: 0.2rem 0; }
  .pillar-sig { font-size: 0.7rem; font-weight: 700; color: var(--pos); }
  .pillar-sig.neutral { color: var(--gold); }
  .pillar-desc { font-size: 0.72rem; color: var(--text-3); margin-top: 0.35rem; line-height: 1.35; }

  .legal { font-size: 0.72rem; color: var(--text-3); text-align: center; padding: 1.5rem 0 0.5rem; }
  .legal a { color: var(--text-2); }
  .legal p { margin-top: 0.35rem; }

  /* ---------- Bottom-Tab-Bar (Mobile) ---------- */
  .tabbar { display: none; }

  /* ---------- Sheets / Dialoge ---------- */
  .sheet {
    margin: auto; width: min(440px, calc(100% - 2rem));
    background: var(--s1); color: var(--text);
    border: 1px solid var(--line-2); border-radius: var(--r-lg);
    padding: 1.25rem; box-shadow: 0 30px 60px rgba(0, 0, 0, 0.6);
    max-height: 85dvh; overflow-y: auto; overscroll-behavior: contain;
  }
  .sheet[open] { display: flex; flex-direction: column; gap: 1rem; animation: sheet-in 0.22s ease-out; }
  .sheet::backdrop { background: rgba(0, 0, 0, 0.6); backdrop-filter: blur(4px); }
  @keyframes sheet-in { from { opacity: 0; transform: translateY(16px); } }
  .sheet-grip { display: none; }
  .sheet-head { display: flex; align-items: center; justify-content: space-between; }
  .sheet-head h2 { font-size: 1.125rem; font-weight: 800; }
  .sheet .acc-row { padding: 0.75rem; min-height: 52px; }
  .sheet .acc-row .avatar { width: 34px; height: 34px; }
  .sheet-legal { font-size: 0.75rem; color: var(--text-3); text-align: center; }
  .sheet-legal a { color: var(--text-2); }

  /* ---------- Toast ---------- */
  .toast {
    position: fixed; left: 50%; bottom: 1.5rem; z-index: 200;
    transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
    background: var(--text); color: #000; font-weight: 700; font-size: 0.875rem;
    padding: 0.65rem 1.1rem; border-radius: 99px;
    transition: opacity 0.2s, transform 0.2s;
  }
  .toast.show { opacity: 1; transform: translate(-50%, 0); }
  .toast.error { background: var(--neg); color: #fff; }

  /* ---------- View Transitions ---------- */
  ::view-transition-old(app-view) { animation: vt-out 0.14s ease-in both; }
  ::view-transition-new(app-view) { animation: vt-in 0.2s ease-out both; }
  @keyframes vt-out { to { opacity: 0; transform: translateY(-6px); } }
  @keyframes vt-in { from { opacity: 0; transform: translateY(8px); } }
}

@layer utilities {
  @media (max-width: 1100px) {
    .proben-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .pillars { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  }

  @media (max-width: 960px) {
    .view[data-view="cockpit"] { grid-template-columns: 1fr; }
    .view[data-view="cockpit"] .hero { grid-row: auto; }
  }

  /* Mobile: native App-Layout */
  @media (max-width: 820px) {
    .app { grid-template-columns: 1fr; }
    .sidebar { display: none; }

    .topbar { padding: calc(0.6rem + var(--safe-t)) 1rem 0.6rem; gap: 0.6rem; border-bottom: 0; }
    .topbar-emblem { display: inline-grid; width: 30px; height: 30px; }
    .topbar-title { flex-direction: column; align-items: flex-start; gap: 0.1rem; }
    .topbar-title h2 { font-size: 1.125rem; }
    .live-pill { padding: 0; background: none !important; font-size: 0.625rem; }
    .account-chip { max-width: 150px; }

    .ticker { padding: 0.45rem 1rem; gap: 1.1rem; }

    .stage { padding: 0.875rem 1rem calc(var(--tabbar-h) + var(--safe-b) + 1.25rem); }

    .card { padding: 1rem; border-radius: var(--r-md); }
    .hero { background: radial-gradient(120% 90% at 0% 0%, #1d1608 0%, var(--s1) 60%); }
    .stat strong { font-size: 0.8125rem; }
    .chart-svg { height: 110px; }

    .proben-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.6rem; }
    .pillars { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.6rem; }
    .pillar-desc { display: none; }
    .form { grid-template-columns: 1fr 1fr; gap: 0.75rem; }
    .calc-sticky { top: -0.875rem; }

    .view-toolbar { flex-direction: column; align-items: stretch; }
    .toolbar-actions { justify-content: flex-end; }

    .tabbar {
      display: grid; grid-template-columns: repeat(5, 1fr); align-items: center;
      position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
      height: calc(var(--tabbar-h) + var(--safe-b));
      padding: 0 0.25rem var(--safe-b);
      background: rgba(10, 10, 10, 0.9); backdrop-filter: blur(20px);
      border-top: 1px solid var(--line);
    }
    .tab {
      display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.15rem;
      min-height: 48px; color: var(--text-3); font-size: 0.625rem; font-weight: 700;
    }
    .tab .ico { font-size: 1.15rem; line-height: 1; transition: transform 0.15s; }
    .tab.active { color: var(--gold); }
    .tab.active .ico { transform: translateY(-1px) scale(1.08); }
    .tab:hover { color: var(--text); }
    .tab.active:hover { color: var(--gold); }

    .fab {
      display: grid; place-items: center; width: 52px; height: 52px; margin-top: -22px;
      border-radius: 50%; background: var(--gold); color: #000;
      font-size: 1.6rem; font-weight: 900;
      box-shadow: 0 8px 24px rgba(245, 165, 36, 0.35), 0 0 0 5px #000;
      transition: transform 0.15s;
    }
    .tab-fab.active .fab { transform: rotate(45deg); }

    /* Dialoge als Bottom-Sheets */
    .sheet {
      margin: auto 0 0; width: 100%; max-width: 100%;
      border-radius: 22px 22px 0 0; border-bottom: 0;
      padding: 0.5rem 1rem calc(1.25rem + var(--safe-b));
    }
    .sheet[open] { animation: sheet-up 0.26s cubic-bezier(0.2, 0.8, 0.2, 1); }
    @keyframes sheet-up { from { transform: translateY(100%); } }
    .sheet-grip { display: block; width: 40px; height: 5px; border-radius: 99px; background: var(--line-2); margin: 0.25rem auto 0; }

    .toast { bottom: calc(var(--tabbar-h) + var(--safe-b) + 0.75rem); }
  }

  @media (max-width: 380px) {
    .account-chip-name { display: none; }
    .account-chip { padding-right: 0.5rem; }
  }

  @media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; }
    ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation: none !important; }
  }
}

/* ---------- Eingabe ohne Formular (GOLD-INPUT A, Wireframe input/*) ---------- */
@layer components {
  .buy h3 { font-size: 1rem; font-weight: 800; margin-bottom: 0.6rem; }
  .buy-field {
    width: 100%; min-height: 56px;
    background: var(--s2); border: 2px solid var(--gold); border-radius: var(--r-md);
    padding: 0.75rem 1rem; font-size: 1.05rem; font-weight: 500; /* ≥ 16px verhindert iOS-Zoom */
  }
  .buy-field:focus { outline: none; background: var(--s3); box-shadow: 0 0 0 3px var(--gold-dim); }
  .buy-field[aria-invalid="true"] { border-color: var(--neg); }
  .buy-hint { font-size: 0.8rem; color: var(--text-2); margin: 0.4rem 0 0.25rem; }
  .buy-label { display: block; font-size: 0.8rem; font-weight: 600; color: var(--text-2); margin: 0.9rem 0 0.35rem; }
  .buy-group { min-width: 0; }
  .buy-note { font-size: 0.85rem; color: var(--text-2); margin-top: 0.9rem; min-height: 1.2em; }
  .buy-note:empty { display: none; }
  .buy-actions { display: grid; grid-template-columns: 2fr 1fr; gap: 0.6rem; margin-top: 1rem; }

  .pick { display: flex; flex-wrap: wrap; gap: 0.5rem; }
  .pick-chip {
    display: inline-flex; flex-direction: column; align-items: center; justify-content: center;
    min-height: 44px; padding: 0 1rem; border-radius: 99px;
    border: 1px solid var(--line-2); background: var(--s2); color: var(--text);
    font-size: 0.95rem; font-weight: 500; line-height: 1.15; text-align: center;
  }
  .pick-chip small { font-size: 0.7rem; color: var(--text-3); }
  .pick-chip:hover { border-color: var(--gold); }
  .pick-chip--lg { border-radius: var(--r-md); min-width: 84px; }
  .pick-chip.is-on { background: var(--gold); border-color: var(--gold); color: #000; font-weight: 700; }
  .pick-chip.is-on small { color: #3a2a06; }
  .pick-chip.is-sugg { border-style: dashed; border-color: var(--gold); }
  .pick-chip:disabled { opacity: 0.45; cursor: not-allowed; }

  /* V2 Schritt-Sheet */
  .steps h2 { font-size: 1.2rem; font-weight: 800; }
  .step-count { font-size: 0.75rem; font-weight: 700; color: var(--text-2); }
  .step-prog { height: 6px; border-radius: 3px; background: var(--s3); }
  .step-prog i { display: block; height: 100%; border-radius: 3px; background: var(--gold); transition: width 0.2s; }
  .step-body { display: flex; flex-direction: column; gap: 0.25rem; }
  .step-actions { display: grid; gap: 0.5rem; }
  .step-num { display: flex; align-items: center; gap: 0.5rem; margin-top: 0.75rem; }
  .step-num .step-input { flex: 1; min-width: 0; text-align: center; font-size: 1.5rem; font-weight: 800; }
  .step-unit { font-weight: 800; color: var(--text-2); }
  .step-btn {
    flex: none; width: 56px; height: 56px; border-radius: 99px;
    border: 1px solid var(--line-2); background: var(--s2); font-size: 1.5rem;
  }
  .step-btn:hover { border-color: var(--gold); }
  .sum { display: flex; flex-direction: column; }
  .sum-row {
    display: flex; justify-content: space-between; align-items: center; gap: 1rem;
    min-height: 44px; padding: 0.6rem 0.25rem; border-bottom: 1px solid var(--line); text-align: left;
  }
  .sum-row:hover { background: var(--s2); }
  .sum-dt { color: var(--text-2); font-size: 0.85rem; }
  .sum-dd { font-weight: 600; text-align: right; }

  /* Login: PIN-Pad */
  .auth-step { display: flex; flex-direction: column; gap: 0.5rem; }
  .auth-step[hidden] { display: none; }
  .pin-title { font-size: 1.05rem; font-weight: 800; }
  .pin-wrap { position: relative; align-self: flex-start; }
  .pin-input {
    position: absolute; inset: 0; width: 100%; height: 100%;
    opacity: 0; border: 0; background: transparent; color: transparent; caret-color: transparent;
  }
  .pin-boxes { display: flex; gap: 0.6rem; flex-wrap: wrap; }
  .pin-boxes span {
    position: relative; width: 52px; height: 60px;
    border: 2px solid var(--line-2); border-radius: var(--r-md); background: var(--s2);
  }
  .pin-boxes span.is-filled::after {
    content: ""; position: absolute; inset: 0; margin: auto;
    width: 14px; height: 14px; border-radius: 50%; background: var(--text);
  }
  .pin-wrap:focus-within .pin-boxes span.is-cur { border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-dim); }
  .pin-boxes.shake { animation: pin-shake 0.35s; }
  .pin-boxes.shake span { border-color: var(--neg); }
  @keyframes pin-shake { 25% { transform: translateX(-6px); } 50% { transform: translateX(6px); } 75% { transform: translateX(-4px); } }
  .pin-pad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.5rem; margin-top: 0.5rem; }
  .pin-pad button {
    min-height: 56px; border: 1px solid var(--line-2); border-radius: var(--r-md);
    background: var(--s2); font-size: 1.25rem; font-weight: 600;
  }
  .pin-pad button:hover { border-color: var(--gold); }
  .pin-pad button:active { background: var(--s3); }
  .pin-pad button[data-key="ok"] { font-size: 0.95rem; font-weight: 800; color: var(--gold); }

  @media (max-width: 820px) {
    .buy-actions { grid-template-columns: 1fr; }
  }
}
@layer components {
  .auth-step .link-btn, .step-body .link-btn { min-height: 44px; align-self: flex-start; }
}
