/* 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;
  --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;
}
@media (prefers-color-scheme: dark) {
  :root {
    --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;
    --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) ===== */
.appbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 9px;
  padding: 10px 16px; 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; } }
.avatar { width: 34px; height: 34px; border-radius: 999px; background: var(--accent); color: #fff; display: grid; place-items: center; font-size: 13px; font-weight: 700; flex: none; }
.logout-link { background: none; border: 0; color: var(--ink-3); cursor: pointer; font-size: 12.5px; text-decoration: underline; }

/* ===== Editor (Handy) ===== */
.editor-wrap { max-width: 520px; margin: 0 auto; }
.scroll { padding: 15px 16px 40px; }
.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), color-mix(in srgb, var(--accent) 55%, #0a2a30)); color: #fff; border-radius: var(--r); padding: 15px 17px; margin-bottom: 14px; box-shadow: var(--shadow); }
.balance .bl { font-size: 11.5px; opacity: .85; }
.balance .bv { font-size: 30px; font-weight: 680; margin-top: 3px; letter-spacing: -.015em; }
.balance .split { display: flex; gap: 14px; margin-top: 14px; padding-top: 12px; 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: 15.5px; font-weight: 680; margin-top: 2px; }
.profit-row { display: flex; align-items: center; gap: 12px; background: var(--gain-soft); border: 1px solid color-mix(in srgb, var(--gain) 30%, transparent); border-radius: var(--r); padding: 11px 14px; margin-bottom: 16px; }
.profit-row.neg { background: var(--loss-soft); border-color: color-mix(in srgb, var(--loss) 30%, transparent); }
.profit-row .pi { font-size: 20px; }
.profit-row .pv { font-weight: 720; color: var(--gain); font-size: 20px; line-height: 1.05; }
.profit-row.neg .pv { color: var(--loss); }
.profit-row .pd { font-size: 11.5px; color: var(--ink-2); margin-top: 1px; }
.act-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; margin-bottom: 18px; }
.act { display: flex; flex-direction: column; align-items: center; gap: 7px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 13px 6px; cursor: pointer; color: var(--ink); box-shadow: var(--shadow); transition: .15s; }
.act:hover { border-color: var(--accent); transform: translateY(-1px); }
.act .aic { width: 42px; height: 42px; border-radius: 11px; display: grid; place-items: center; font-size: 21px; }
.act .aic.buy { background: var(--gain-soft); color: var(--gain); }
.act .aic.sell { background: var(--warn-soft); color: var(--warn); }
.act .aic.cash { background: var(--accent-soft); color: var(--accent-ink); }
.act .al { font-size: 12px; font-weight: 620; line-height: 1.2; text-align: center; }
.mini-h { font-size: 12px; text-transform: uppercase; letter-spacing: .07em; color: var(--ink-3); font-weight: 700; margin: 6px 4px 10px; }
.mini-pos { display: flex; align-items: center; gap: 11px; width: 100%; text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 11px 12px; margin-bottom: 8px; cursor: pointer; color: var(--ink); transition: .13s; }
.mini-pos:hover { border-color: var(--accent); }
.mini-pos .tk { width: 36px; height: 36px; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--line); display: grid; place-items: center; font-weight: 700; font-size: 11.5px; 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: 14px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mp-top .pl { font-size: 12.5px; font-weight: 700; 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: 12px; color: var(--ink-3); }
.mp-goal-inline { font-size: 11px; color: #fff; background: color-mix(in srgb, var(--accent) 72%, #0a1620); font-weight: 700; white-space: nowrap; padding: 2px 7px; border-radius: 6px; }
.chev { color: var(--ink-3); font-size: 20px; flex: none; }
.list-hint, .empty-hint { font-size: 12.5px; color: var(--ink-3); text-align: center; margin-top: 10px; }
.empty-hint { padding: 24px 12px; }

/* 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; }
.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: 15px; 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; }
.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: #fff; 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) clamp(16px, 4vw, 36px) clamp(24px, 4vw, 40px); }
.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), color-mix(in srgb, var(--accent) 60%, #16202a)); 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); }
.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; }
.kpi .kd { font-size: 12.5px; font-weight: 660; margin-top: 4px; }
.kpi.accent { background: linear-gradient(155deg, var(--accent), color-mix(in srgb, var(--accent) 58%, #0a2a30)); border-color: transparent; color: #fff; }
.kpi.accent .kl, .kpi.accent .kd { color: rgba(255,255,255,.85); }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); }
.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; }
.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; }
.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: 11.5px; color: var(--ink-2); flex: none; }
.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; } }
.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: 14px; 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: #fff; 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: 13.5px; color: var(--ink); }
.sign-hint { font-size: 11.5px; color: var(--ink-3); margin-top: 8px; display: flex; gap: 6px; align-items: center; }

/* ===== 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; }
.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; }
.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; }
.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; transition: transform .15s; }
.collapsible-body { padding-top: 2px; }

/* ===== Login / Registrierung ===== */
.authwrap { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.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: #fff; }
.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; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); 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: 80; 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: #fff; }
