/* ============================================================
   Alpaca Autopilot — Dark Financial Control Room
   Tokens first. Inline-light, layered depth, semantic color.
   Auf Basis des FX-Cockpit-Designsystems, auf Aktien/Alpaca
   adaptiert (Scanner, Sektor-Exposure, Risikobudget-Gauge).
   ============================================================ */
:root {
  /* Flaechen — sehr dunkles Blau-Schwarz, geschichtet */
  --ink-base:  oklch(16% 0.018 254);   /* Grund */
  --ink-1:     oklch(19.5% 0.020 254);  /* Card */
  --ink-2:     oklch(23% 0.022 254);    /* erhoeht / Row-Hover */
  --ink-3:     oklch(27% 0.024 254);    /* Control rest */
  --line:      oklch(100% 0 0 / 0.08);
  --line-soft: oklch(100% 0 0 / 0.045);
  --line-strong: oklch(100% 0 0 / 0.14);

  /* Text */
  --tx-hi:  oklch(97% 0.004 254);
  --tx-mid: oklch(72% 0.012 254);
  --tx-lo:  oklch(56% 0.014 254);
  --tx-dim: oklch(44% 0.014 254);

  /* Semantik */
  --green:      oklch(70% 0.15 165);
  --green-soft: oklch(70% 0.15 165 / 0.14);
  --green-dim:  oklch(62% 0.12 165);
  --amber:      oklch(80% 0.13 78);
  --amber-soft: oklch(80% 0.13 78 / 0.14);
  --red:        oklch(66% 0.20 24);
  --red-soft:   oklch(66% 0.20 24 / 0.15);
  --blue:       oklch(60% 0.13 200);

  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;

  --ff-display: "Space Grotesk", system-ui, sans-serif;
  --ff-ui: "Inter", system-ui, sans-serif;
  --ff-mono: "JetBrains Mono", ui-monospace, monospace;

  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --shadow-card: 0 1px 0 oklch(100% 0 0 / 0.04) inset, 0 12px 32px -18px oklch(0% 0 0 / 0.7);
}

* { box-sizing: border-box; margin: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--ff-ui);
  background: var(--ink-base);
  color: var(--tx-hi);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  /* dezentes vertikales Licht von oben — Tiefe ohne Dekoration */
  background-image:
    radial-gradient(120% 80% at 50% -10%, oklch(24% 0.03 254 / 0.55), transparent 60%);
  background-attachment: fixed;
}
.mono { font-family: var(--ff-mono); font-variant-numeric: tabular-nums; font-feature-settings: "tnum" 1; }

.shell { max-width: 1440px; margin: 0 auto; padding: 22px clamp(16px, 3vw, 36px) 48px; }

/* ---------- TOPBAR ---------- */
.topbar {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 20px;
  padding: 10px 4px 22px;
  border-bottom: 1px solid var(--line-soft);
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand__mark {
  width: 26px; height: 26px; border-radius: 7px;
  background: linear-gradient(150deg, var(--green), oklch(60% 0.13 200));
  box-shadow: 0 0 0 1px var(--line-strong), 0 0 18px -4px var(--green);
  position: relative;
}
.brand__mark::after {
  content: ""; position: absolute; inset: 7px;
  border-radius: 3px; background: var(--ink-base);
}
.brand__name { font-family: var(--ff-display); font-size: 18px; letter-spacing: -0.01em; color: var(--tx-mid); }
.brand__name strong { color: var(--tx-hi); font-weight: 600; }
.brand__tag {
  font-size: 10px; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--tx-dim); padding: 3px 8px; border: 1px solid var(--line);
  border-radius: 100px; margin-left: 4px; white-space: nowrap;
}
.topbar__status { display: flex; gap: 10px; align-items: center; }

.pill {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 7px 12px; border-radius: 100px;
  background: var(--ink-1); border: 1px solid var(--line);
  font-size: 12px; color: var(--tx-mid); white-space: nowrap;
}
.pill--ghost { background: transparent; }
.pill__dot { width: 7px; height: 7px; border-radius: 50%; background: var(--tx-dim); }
.pill[data-state="connected"] .pill__dot { background: var(--green); box-shadow: 0 0 0 3px var(--green-soft); animation: pulse 2.4s var(--ease) infinite; }
.pill[data-state="disconnected"] .pill__dot { background: var(--red); box-shadow: 0 0 0 3px var(--red-soft); }
.pill[data-state="disconnected"] .pill__label { color: var(--tx-mid); }
.pill__value { color: var(--tx-hi); }
@keyframes pulse { 0%,100% { box-shadow: 0 0 0 3px var(--green-soft); } 50% { box-shadow: 0 0 0 5px transparent; } }

/* ---------- AUTOPILOT SWITCH ---------- */
.autopilot {
  display: flex; align-items: center; gap: 16px;
  padding: 9px 12px 9px 16px; border-radius: 100px;
  background: var(--ink-1); border: 1px solid var(--line);
  cursor: pointer; user-select: none;
  transition: border-color .25s var(--ease), background .25s var(--ease);
}
.autopilot:hover { border-color: var(--line-strong); }
.autopilot:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }
.autopilot__copy { display: flex; flex-direction: column; line-height: 1.15; text-align: right; }
.autopilot__label { font-size: 10px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--tx-lo); }
.autopilot__state { font-family: var(--ff-display); font-size: 15px; font-weight: 600; color: var(--tx-mid); }
.autopilot__track {
  width: 50px; height: 28px; border-radius: 100px; position: relative;
  background: var(--ink-3); border: 1px solid var(--line-strong);
  transition: background .3s var(--ease);
}
.autopilot__thumb {
  position: absolute; top: 2px; left: 2px; width: 22px; height: 22px;
  border-radius: 50%; background: var(--tx-lo);
  transition: transform .32s var(--ease), background .3s var(--ease);
}
.autopilot[aria-checked="true"] { background: var(--green-soft); border-color: oklch(70% 0.15 165 / 0.4); }
.autopilot[aria-checked="true"] .autopilot__state { color: var(--green); }
.autopilot[aria-checked="true"] .autopilot__track { background: var(--green); border-color: var(--green); }
.autopilot[aria-checked="true"] .autopilot__thumb { transform: translateX(22px); background: var(--ink-base); }

/* ---------- CIRCUIT BREAKER ---------- */
.cb-banner {
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 16px;
  margin-top: 20px; padding: 16px 18px; border-radius: var(--r-md);
  background: linear-gradient(180deg, var(--red-soft), oklch(20% 0.03 254));
  border: 1px solid oklch(66% 0.20 24 / 0.45);
  box-shadow: var(--shadow-card), 0 0 40px -22px var(--red);
}
.cb-banner[hidden] { display: none; }
.cb-banner__icon { color: var(--red); display: grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; background: var(--red-soft); }
.cb-banner__title { font-family: var(--ff-display); font-weight: 600; font-size: 15px; color: var(--tx-hi); }
.cb-banner__text { font-size: 13px; color: var(--tx-mid); margin-top: 2px; max-width: 64ch; }

/* ---------- MAIN ---------- */
.main { display: flex; flex-direction: column; gap: 18px; margin-top: 22px; }

.card {
  background: var(--ink-1); border: 1px solid var(--line);
  border-radius: var(--r-md); padding: 18px 20px; box-shadow: var(--shadow-card);
  min-width: 0;
}
.card__head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.card__head--tight { margin-bottom: 12px; }
.card__title { font-family: var(--ff-display); font-size: 16px; font-weight: 600; letter-spacing: -0.01em; white-space: nowrap; }
.card__hint { font-size: 11.5px; color: var(--tx-lo); margin-top: 1px; }

.section-head { display: flex; align-items: baseline; gap: 12px; margin: 4px 2px 12px; }
.section-head__title { font-family: var(--ff-display); font-size: 13px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--tx-lo); }
.section-head__hint { font-size: 12px; color: var(--tx-dim); }

/* ---------- KONTO-HEADER ---------- */
.acct-row { display: grid; grid-template-columns: 1.55fr 1fr; gap: 14px; }
.acct-card { display: grid; grid-template-columns: auto 1fr; gap: 22px; align-items: center; }
.acct__id { display: flex; flex-direction: column; gap: 12px; padding-right: 22px; border-right: 1px solid var(--line); }
.mode-badge {
  align-self: flex-start; font-family: var(--ff-display); font-weight: 700; font-size: 13px;
  letter-spacing: 0.16em; padding: 7px 14px; border-radius: var(--r-sm);
}
.mode-badge[data-mode="paper"] { color: var(--tx-mid); background: var(--ink-3); border: 1px solid var(--line-strong); }
.mode-badge[data-mode="live"] { color: oklch(18% 0.04 24); background: var(--red); border: 1px solid var(--red); box-shadow: 0 0 28px -8px var(--red); animation: liveGlow 2.6s var(--ease) infinite; }
@keyframes liveGlow { 0%,100% { box-shadow: 0 0 28px -8px var(--red); } 50% { box-shadow: 0 0 36px -4px var(--red); } }
.acct__broker { display: flex; flex-direction: column; gap: 2px; }
.acct__broker-name { font-family: var(--ff-display); font-weight: 600; font-size: 15px; color: var(--tx-hi); }
.acct__server { font-size: 11.5px; color: var(--tx-lo); }
.acct__metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(168px, 1fr)); gap: 18px 16px; min-width: 0; }
.metric { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.metric__label { font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--tx-lo); white-space: nowrap; }
.metric__val { font-family: var(--ff-mono); font-variant-numeric: tabular-nums; font-size: clamp(14px, 1.5vw, 18px); color: var(--tx-hi); letter-spacing: -0.01em; white-space: nowrap; }
.metric--lead .metric__val { font-size: clamp(19px, 2.2vw, 24px); }
.metric--lead .metric__label { color: var(--green); }
.metric.is-pos .metric__val { color: var(--green); }
.metric.is-neg .metric__val { color: var(--red); }
.metric--gauge { grid-column: span 1; }
.metric__bar { height: 4px; border-radius: 3px; background: var(--ink-3); overflow: hidden; margin-top: 1px; }
.metric__bar span { display: block; height: 100%; width: 0; background: var(--green); border-radius: 3px; transition: width .7s var(--ease), background .4s var(--ease); }
.metric--gauge.is-warn .metric__bar span { background: var(--amber); }
.metric--gauge.is-danger .metric__bar span { background: var(--red); }
.metric--gauge.is-warn .metric__val { color: var(--amber); }
.metric--gauge.is-danger .metric__val { color: var(--red); }

/* ---------- MARKT & REGIME ---------- */
.sessions-card { display: flex; flex-direction: column; }
.sessions { list-style: none; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; flex: 1; }
.session { padding: 11px 13px; border-radius: var(--r-sm); background: var(--ink-base); border: 1px solid var(--line-soft); position: relative; transition: border-color .3s var(--ease), background .3s var(--ease); }
.session__name { font-family: var(--ff-display); font-weight: 600; font-size: 13px; color: var(--tx-mid); }
.session__hours { font-family: var(--ff-mono); font-size: 10.5px; color: var(--tx-dim); margin-top: 2px; }
.session__dot { position: absolute; top: 11px; right: 13px; width: 7px; height: 7px; border-radius: 50%; background: var(--ink-3); }
.session.is-active { background: var(--green-soft); border-color: oklch(70% 0.15 165 / 0.35); }
.session.is-active .session__name { color: var(--green); }
.session.is-active .session__dot { background: var(--green); box-shadow: 0 0 0 3px var(--green-soft); animation: pulse 2.4s var(--ease) infinite; }
/* Regime-Hervorhebung */
.session.regime-bullish { background: var(--green-soft); border-color: oklch(70% 0.15 165 / 0.4); }
.session.regime-bullish .session__name { color: var(--green); }
.session.regime-bullish .session__dot { background: var(--green); box-shadow: 0 0 0 3px var(--green-soft); }
.session.regime-bearish { background: var(--red-soft); border-color: oklch(66% 0.20 24 / 0.4); }
.session.regime-bearish .session__name { color: var(--red); }
.session.regime-bearish .session__dot { background: var(--red); box-shadow: 0 0 0 3px var(--red-soft); }
.session.regime-neutral .session__dot { background: var(--amber); box-shadow: 0 0 0 3px var(--amber-soft); }
.session.regime-neutral .session__name { color: var(--amber); }

/* ---------- SCANNER-WATCHLIST + FOKUS ---------- */
.cockpit-top { display: grid; grid-template-columns: 0.95fr 1.9fr; gap: 14px; }
.watch-card { display: flex; flex-direction: column; }
.watch { list-style: none; display: flex; flex-direction: column; gap: 4px; }
.watch__row { display: grid; grid-template-columns: minmax(0,1fr) auto auto auto; gap: 10px; align-items: center; padding: 9px 8px; border-radius: var(--r-sm); transition: background .18s var(--ease); cursor: pointer; }
.watch__row:hover { background: var(--ink-2); }
.watch__row.is-selected { background: var(--ink-2); box-shadow: inset 2px 0 0 var(--green); }
.watch__sym { font-family: var(--ff-display); font-weight: 600; font-size: 13.5px; color: var(--tx-hi); }
.watch__score { font-family: var(--ff-mono); font-variant-numeric: tabular-nums; font-size: 13px; color: var(--tx-mid); text-align: right; }
.watch__trend { font-family: var(--ff-mono); font-size: 10px; letter-spacing: 0.05em; text-transform: uppercase; white-space: nowrap; padding: 2px 7px; border-radius: 100px; border: 1px solid var(--line); }
.watch__trend.ok { color: var(--green); border-color: oklch(70% 0.15 165 / 0.4); }
.watch__trend.no { color: var(--tx-dim); }
.watch__setup { font-family: var(--ff-mono); font-size: 11px; color: var(--tx-lo); white-space: nowrap; }
.watch-empty { padding: 24px 8px; color: var(--tx-lo); font-size: 12.5px; text-align: center; }

.focus-card { display: flex; flex-direction: column; }
.focus-legend { display: flex; gap: 8px; }
.leg { font-family: var(--ff-mono); font-size: 10px; letter-spacing: 0.08em; padding: 3px 8px; border-radius: 100px; border: 1px solid var(--line); }
.leg--sl { color: var(--red); border-color: oklch(66% 0.2 24 / 0.4); }
.leg--tp { color: var(--amber); border-color: oklch(80% 0.13 78 / 0.4); }
.chart { position: relative; flex: 1; min-height: 270px; }
.chart__svg { width: 100%; height: 100%; display: block; overflow: visible; }
.chart__cursor { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--line-strong); pointer-events: none; }
.chart__cursor::after { content: ""; position: absolute; top: var(--cy, 50%); left: 50%; transform: translate(-50%,-50%); width: 9px; height: 9px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 3px var(--ink-1), 0 0 12px var(--green); }
.chart__tip { position: absolute; top: 4px; transform: translateX(-50%); background: var(--ink-3); border: 1px solid var(--line-strong); padding: 5px 9px; border-radius: 7px; font-size: 12px; color: var(--tx-hi); white-space: nowrap; }

/* ---------- CONTROLS ---------- */
.controls {
  display: grid; grid-template-columns: 1fr auto; gap: 16px; align-items: center;
  padding: 16px 20px; border-radius: var(--r-md);
  background: var(--ink-1); border: 1px solid var(--line); box-shadow: var(--shadow-card);
}
.controls__primary { display: flex; align-items: center; gap: 16px; }
.controls__note { font-size: 12px; color: var(--tx-lo); max-width: 30ch; }
.controls__secondary { display: flex; flex-wrap: wrap; gap: 10px; justify-content: flex-end; }

.btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  font-family: var(--ff-ui); font-size: 13.5px; font-weight: 500; color: var(--tx-hi);
  padding: 11px 18px; border-radius: var(--r-sm); cursor: pointer;
  background: var(--ink-3); border: 1px solid var(--line-strong);
  transition: transform .12s var(--ease), background .2s var(--ease), border-color .2s var(--ease), box-shadow .2s var(--ease), opacity .2s;
}
.btn:hover { background: var(--ink-2); border-color: oklch(100% 0 0 / 0.22); }
.btn:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }
.btn:active { transform: translateY(1px) scale(0.99); }
.btn--primary {
  background: linear-gradient(180deg, var(--green), var(--green-dim));
  color: oklch(15% 0.02 165); border-color: var(--green); font-weight: 600;
  box-shadow: 0 8px 22px -12px var(--green), 0 1px 0 oklch(100% 0 0 / 0.25) inset;
  padding: 13px 22px; font-size: 14.5px;
}
.btn--primary:hover { background: linear-gradient(180deg, oklch(74% 0.15 165), var(--green)); border-color: oklch(74% 0.15 165); }
.btn--warn { color: var(--amber); border-color: oklch(80% 0.13 78 / 0.4); }
.btn--warn:hover { background: var(--amber-soft); border-color: var(--amber); }
.btn--ghost { background: transparent; }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; pointer-events: none; }
.btn--danger { background: linear-gradient(180deg, var(--red), oklch(58% 0.2 24)); color: oklch(96% 0.02 24); border-color: var(--red); font-weight: 600; box-shadow: 0 8px 22px -12px var(--red), 0 1px 0 oklch(100% 0 0 / 0.2) inset; padding: 13px 22px; font-size: 14.5px; }
.btn--danger:hover { background: linear-gradient(180deg, oklch(70% 0.2 24), var(--red)); }
.btn--xs { padding: 7px 12px; font-size: 12px; flex: 1; }

.btn__spinner { display: none; width: 14px; height: 14px; border-radius: 50%; border: 2px solid currentColor; border-top-color: transparent; opacity: 0.8; }
.btn.is-busy .btn__spinner { display: inline-block; animation: spin .7s linear infinite; }
.btn.is-busy { pointer-events: none; opacity: 0.85; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- POSITIONS-KARTEN ---------- */
.pairs { display: grid; grid-template-columns: repeat(auto-fill, minmax(268px, 1fr)); gap: 14px; }
.pairs-empty { padding: 30px; text-align: center; color: var(--tx-lo); font-size: 13px; border: 1px dashed var(--line); border-radius: var(--r-md); }
.pair {
  background: var(--ink-1); border: 1px solid var(--line); border-radius: var(--r-md);
  padding: 16px; box-shadow: var(--shadow-card); cursor: pointer; min-width: 0;
  transition: border-color .2s var(--ease), transform .12s var(--ease), background .2s;
}
.pair:hover { border-color: var(--line-strong); }
.pair.is-selected { border-color: oklch(70% 0.15 165 / 0.55); background: linear-gradient(165deg, var(--ink-2), var(--ink-1)); }
.pair:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }
.pair__head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.pair__sym { font-family: var(--ff-display); font-weight: 600; font-size: 16px; letter-spacing: 0.01em; }
.pair__sym small { font-weight: 400; color: var(--tx-dim); font-size: 11px; }
.signal { font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase; padding: 4px 9px; border-radius: 100px; border: 1px solid var(--line); color: var(--tx-lo); white-space: nowrap; }
.signal[data-sig="long"] { color: var(--green); border-color: oklch(70% 0.15 165 / 0.4); background: var(--green-soft); }
.pair__px { display: flex; align-items: baseline; gap: 10px; margin-bottom: 12px; }
.pair__bid { font-family: var(--ff-mono); font-variant-numeric: tabular-nums; font-size: clamp(22px, 5.5vw, 28px); font-weight: 500; letter-spacing: -0.02em; color: var(--tx-hi); line-height: 1; white-space: nowrap; }
.pair__chg { font-family: var(--ff-mono); font-size: 13px; font-weight: 600; white-space: nowrap; }
.pair__chg.pos { color: var(--green); } .pair__chg.neg { color: var(--red); }
.pair__quote { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; padding: 10px 0; border-top: 1px solid var(--line-soft); border-bottom: 1px solid var(--line-soft); }
.qcell { display: flex; flex-direction: column; gap: 3px; }
.qcell__l { font-size: 9.5px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--tx-dim); }
.qcell__v { font-family: var(--ff-mono); font-variant-numeric: tabular-nums; font-size: 13px; color: var(--tx-mid); }
.pair__pos { margin-top: 12px; display: flex; flex-direction: column; gap: 9px; }
.pos-line { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.side-badge { font-family: var(--ff-display); font-weight: 600; font-size: 11px; letter-spacing: 0.06em; padding: 4px 10px; border-radius: var(--r-sm); }
.side-badge[data-side="long"] { color: var(--green); background: var(--green-soft); }
.side-badge[data-side="flat"] { color: var(--tx-lo); background: var(--ink-3); }
.pos-lots { font-family: var(--ff-mono); font-size: 12.5px; color: var(--tx-mid); white-space: nowrap; }
.pos-float { font-family: var(--ff-mono); font-variant-numeric: tabular-nums; font-size: 16px; font-weight: 600; white-space: nowrap; }
.pos-float.pos { color: var(--green); } .pos-float.neg { color: var(--red); }
.pos-sltp { display: flex; flex-wrap: wrap; gap: 8px 14px; font-family: var(--ff-mono); font-size: 11px; color: var(--tx-lo); }
.pos-sltp .sl b { color: var(--red); font-weight: 600; }
.pos-sltp .risk b { color: var(--amber); font-weight: 600; }
.pair__actions { display: flex; gap: 8px; margin-top: 12px; }

/* ---------- SEKTOR-EXPOSURE + RISIKOBUDGET ---------- */
.exp-budget { display: flex; gap: 24px; }
.exp-budget__item { display: flex; flex-direction: column; gap: 2px; text-align: right; }
.exp-budget__label { font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--tx-lo); }
.exp-budget__val { font-size: 18px; color: var(--tx-hi); }
.exp-budget__limit { font-size: 11px; color: var(--tx-dim); }

.riskbudget { margin-bottom: 18px; padding: 14px 16px; border-radius: var(--r-sm); background: var(--ink-base); border: 1px solid var(--line-soft); }
.riskbudget__top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 9px; }
.riskbudget__label { font-size: 11px; color: var(--tx-lo); }
.riskbudget__val { font-size: 14px; color: var(--tx-hi); }
.riskbudget__bar { position: relative; height: 9px; border-radius: 5px; background: var(--ink-3); overflow: visible; }
.riskbudget__bar span#riskGaugeFill { display: block; height: 100%; width: 0; border-radius: 5px; background: linear-gradient(90deg, var(--green-dim), var(--green)); transition: width .8s var(--ease), background .4s; }
.riskbudget.is-warn span#riskGaugeFill { background: var(--amber); }
.riskbudget.is-danger span#riskGaugeFill { background: var(--red); }
.riskbudget__limit { position: absolute; top: -3px; bottom: -3px; right: 0; width: 2px; background: var(--tx-mid); }

.exposure { list-style: none; display: flex; flex-direction: column; gap: 12px; }
.exp-row { display: grid; grid-template-columns: 150px 1fr 78px; gap: 14px; align-items: center; }
.exp-cur { font-family: var(--ff-display); font-weight: 600; font-size: 13px; color: var(--tx-hi); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.exp-track { position: relative; height: 16px; background: var(--ink-base); border-radius: 4px; border: 1px solid var(--line-soft); }
.exp-cap { position: absolute; top: -3px; bottom: -3px; width: 1px; background: var(--amber); opacity: 0.6; }
.exp-fill { position: absolute; top: 2px; bottom: 2px; left: 2px; border-radius: 3px; background: linear-gradient(90deg, var(--green-dim), var(--green)); transition: width .8s var(--ease), background .4s; }
.exp-fill.over { background: linear-gradient(90deg, var(--amber), var(--red)); }
.exp-val { font-family: var(--ff-mono); font-variant-numeric: tabular-nums; font-size: 13px; text-align: right; color: var(--tx-mid); }
.exp-empty { color: var(--tx-lo); font-size: 13px; }

/* ---------- RISK PANEL ---------- */
.risk-card { display: flex; flex-direction: column; }
.risk-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 16px; }
.risk-item { padding: 13px 14px; border-radius: var(--r-sm); background: var(--ink-base); border: 1px solid var(--line-soft); }
.risk-item__top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.risk-item__label { font-size: 11px; color: var(--tx-lo); }
.risk-item__val { font-family: var(--ff-mono); font-variant-numeric: tabular-nums; font-size: 15px; color: var(--tx-hi); }
.risk-item__bar { height: 5px; border-radius: 3px; background: var(--ink-3); overflow: hidden; margin-top: 9px; }
.risk-item__bar span { display: block; height: 100%; width: 0; border-radius: 3px; background: var(--green); transition: width .7s var(--ease), background .4s; }
.risk-item.is-warn .risk-item__bar span { background: var(--amber); }
.risk-item.is-danger .risk-item__bar span { background: var(--red); }
.risk-item.is-warn .risk-item__val { color: var(--amber); }
.risk-item.is-danger .risk-item__val { color: var(--red); }

.lotcalc { border-top: 1px solid var(--line); padding-top: 14px; margin-top: auto; }
.lotcalc__head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 12px; }
.lotcalc__inputs { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }
.field { display: flex; flex-direction: column; gap: 5px; font-size: 11px; color: var(--tx-lo); }
.field__wrap { display: flex; align-items: center; gap: 6px; background: var(--ink-base); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 0 10px; transition: border-color .2s var(--ease); }
.field__wrap:focus-within { border-color: var(--green); }
.field input { background: transparent; border: 0; color: var(--tx-hi); font-family: var(--ff-mono); font-size: 14px; padding: 9px 0; width: 100%; outline: none; }
.field__unit { font-size: 11px; color: var(--tx-dim); }
.lotcalc__out { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 14px; }
.lotcalc__out > div { display: flex; flex-direction: column; gap: 4px; padding: 12px 14px; border-radius: var(--r-sm); background: var(--ink-2); border: 1px solid var(--line); }
.lotcalc__amt { font-size: 18px; color: var(--tx-hi); }
.lotcalc__lots { font-size: 22px; font-weight: 600; color: var(--green); }

/* ---------- TRADE LOG ---------- */
.log-filter { background: var(--ink-3); border: 1px solid var(--line-strong); color: var(--tx-mid); border-radius: var(--r-sm); padding: 6px 10px; font-size: 12px; cursor: pointer; }
.log-filter option { background: var(--ink-2); }
.card--log { display: flex; flex-direction: column; }
.tradelog-card { display: flex; flex-direction: column; }
.log { list-style: none; display: flex; flex-direction: column; gap: 0; max-height: 340px; overflow-y: auto; margin: 0 -4px; }
.log__item { display: grid; grid-template-columns: auto 1fr; gap: 12px; padding: 11px 6px; border-bottom: 1px solid var(--line-soft); }
.log__item:last-child { border-bottom: 0; }
.log__time { font-family: var(--ff-mono); font-size: 11px; color: var(--tx-dim); white-space: nowrap; padding-top: 1px; }
.log__rail { position: relative; padding-left: 14px; }
.log__rail::before { content: ""; position: absolute; left: 0; top: 6px; width: 6px; height: 6px; border-radius: 50%; background: var(--tx-lo); }
.log__item[data-kind="open"] .log__rail::before { background: var(--green); }
.log__item[data-kind="close"] .log__rail::before { background: var(--blue); }
.log__item[data-kind="trail"] .log__rail::before { background: var(--amber); }
.log__item[data-kind="warn"] .log__rail::before { background: var(--amber); }
.log__item[data-kind="alert"] .log__rail::before { background: var(--red); }
.log__text { font-size: 13px; color: var(--tx-mid); line-height: 1.45; }
.log__text strong { color: var(--tx-hi); font-weight: 600; }
.log__pair { font-family: var(--ff-mono); font-size: 11px; color: var(--tx-lo); margin-right: 6px; }

.log::-webkit-scrollbar { width: 8px; height: 8px; }
.log::-webkit-scrollbar-thumb { background: var(--ink-3); border-radius: 100px; }

/* ---------- LOWER GRID ---------- */
.lower { display: grid; grid-template-columns: 1.5fr 1fr; gap: 14px; }

/* ---------- BACKTEST ---------- */
.bt-grid { display: grid; gap: 12px; }
.bt-row {
  display: grid; grid-template-columns: 1.3fr 1fr 1fr 1fr; gap: 8px; align-items: center;
  padding: 13px 14px; border-radius: var(--r-sm); background: var(--ink-base); border: 1px solid var(--line-soft);
}
.bt-row--head { background: transparent; border: 0; padding: 0 14px; }
.bt-row--head span { font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--tx-dim); }
.bt-row--feature { background: linear-gradient(120deg, var(--green-soft), var(--ink-2)); border-color: oklch(70% 0.15 165 / 0.3); }
.bt-name { display: flex; flex-direction: column; }
.bt-name strong { font-family: var(--ff-display); font-size: 14px; font-weight: 600; }
.bt-name span { font-size: 11px; color: var(--tx-lo); }
.bt-metric { font-family: var(--ff-mono); font-variant-numeric: tabular-nums; font-size: 15px; text-align: right; color: var(--tx-hi); }
.bt-row--head span:not(:first-child), .bt-metric { text-align: right; }
.bt-metric small { display: block; font-family: var(--ff-ui); font-size: 9.5px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--tx-dim); margin-top: 2px; }
.bt-disclaimer { margin-top: 14px; padding: 12px 14px; border-radius: var(--r-sm); background: var(--amber-soft); border: 1px solid oklch(80% 0.13 78 / 0.35); font-size: 12px; color: var(--amber); line-height: 1.5; }
.bt-disclaimer[hidden] { display: none; }

/* ---------- FOOTER ---------- */
.foot { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 28px; padding-top: 18px; border-top: 1px solid var(--line-soft); font-size: 12px; color: var(--tx-dim); }
.foot .mono { color: var(--tx-lo); }
.foot__sep { width: 4px; height: 4px; border-radius: 50%; background: var(--tx-dim); }
.badge { margin-left: auto; font-family: var(--ff-mono); font-size: 11px; color: var(--tx-lo); padding: 3px 9px; border: 1px solid var(--line); border-radius: 100px; }

/* ---------- TOASTS ---------- */
.toasts { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 10px; z-index: 100; max-width: min(360px, calc(100vw - 32px)); }
.toast {
  display: grid; grid-template-columns: auto 1fr; gap: 11px; align-items: start;
  padding: 13px 15px; border-radius: var(--r-sm); background: var(--ink-2);
  border: 1px solid var(--line-strong); box-shadow: 0 18px 40px -18px oklch(0% 0 0 / 0.8);
  transform: translateY(8px); opacity: 0; transition: transform .3s var(--ease), opacity .3s var(--ease);
}
.toast.is-in { transform: none; opacity: 1; }
.toast__bar { width: 3px; align-self: stretch; border-radius: 3px; background: var(--tx-lo); }
.toast--success .toast__bar { background: var(--green); }
.toast--error .toast__bar { background: var(--red); }
.toast--warn .toast__bar { background: var(--amber); }
.toast--info .toast__bar { background: var(--blue); }
.toast__title { font-size: 13.5px; font-weight: 600; color: var(--tx-hi); }
.toast__msg { font-size: 12.5px; color: var(--tx-mid); margin-top: 2px; }

/* ---------- MODAL ---------- */
.modal-overlay { position: fixed; inset: 0; background: oklch(8% 0.02 254 / 0.7); backdrop-filter: blur(3px); display: grid; place-items: center; z-index: 200; padding: 20px; opacity: 0; transition: opacity .2s var(--ease); }
.modal-overlay[hidden] { display: none; }
.modal-overlay.is-in { opacity: 1; }
.modal { width: min(440px, 100%); background: var(--ink-2); border: 1px solid var(--line-strong); border-radius: var(--r-lg); padding: 26px; box-shadow: 0 30px 80px -20px oklch(0% 0 0 / 0.8); transform: translateY(10px) scale(0.98); transition: transform .25s var(--ease); }
.modal-overlay.is-in .modal { transform: none; }
.modal__icon { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--red-soft); color: var(--red); margin-bottom: 16px; }
.modal__icon svg { width: 24px; height: 24px; }
.modal__icon[data-tone="warn"] { background: var(--amber-soft); color: var(--amber); }
.modal__title { font-family: var(--ff-display); font-size: 19px; font-weight: 600; }
.modal__text { font-size: 13.5px; color: var(--tx-mid); margin-top: 8px; line-height: 1.55; }
.modal__actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 22px; }

/* ---------- RESPONSIVE ---------- */
@media (max-width: 1180px) {
  .acct-row { grid-template-columns: 1fr; }
  .cockpit-top { grid-template-columns: 1fr; }
  .lower { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .topbar { grid-template-columns: 1fr auto; grid-template-areas: "brand switch" "status status"; row-gap: 14px; }
  .brand { grid-area: brand; } .topbar__switch { grid-area: switch; justify-self: end; } .topbar__status { grid-area: status; flex-wrap: wrap; }
  .acct-card { grid-template-columns: 1fr; gap: 16px; }
  .acct__id { flex-direction: row; align-items: center; padding-right: 0; padding-bottom: 14px; border-right: 0; border-bottom: 1px solid var(--line); gap: 14px; }
  .sessions { grid-template-columns: 1fr 1fr; }
  .risk-grid, .lotcalc__inputs, .lotcalc__out { grid-template-columns: 1fr; }
  .pairs { grid-template-columns: 1fr; }
  .controls { grid-template-columns: 1fr; }
  .controls__secondary { justify-content: stretch; }
  .controls__secondary .btn { flex: 1 1 calc(50% - 5px); }
  .exp-budget { gap: 16px; }
  .exp-row { grid-template-columns: 110px 1fr 64px; gap: 10px; }
  .cb-banner { grid-template-columns: auto 1fr; }
  .cb-banner .btn { grid-column: 1 / -1; }
}
@media (max-width: 560px) {
  .shell { padding: 14px 14px 36px; }
  .brand__tag { display: none; }
  .sessions { grid-template-columns: 1fr; }
  .pair__quote { grid-template-columns: 1fr 1fr; row-gap: 10px; }
  .pos-line { flex-wrap: wrap; gap: 6px 10px; }
  .card__head { flex-direction: column; }
  .exp-budget { width: 100%; justify-content: space-between; }
  .modal__actions { flex-direction: column-reverse; }
  .modal__actions .btn { width: 100%; }
  .bt-row, .bt-row--head { grid-template-columns: 1fr 0.7fr 0.7fr 0.7fr; }
}
@media (max-width: 380px) {
  .controls__secondary .btn { flex: 1 1 100%; }
  .pair__quote { grid-template-columns: 1fr 1fr 1fr; }
  /* Topbar bei sehr schmalen Viewports vertikal stapeln, kein Overflow durch die feste Switch-Breite */
  .topbar { grid-template-columns: 1fr; grid-template-areas: "brand" "switch" "status"; row-gap: 12px; }
  .topbar__switch { justify-self: stretch; }
  .autopilot { justify-content: space-between; padding-left: 14px; }
  .topbar__status { width: 100%; }
  .topbar__status .pill { flex: 1 1 auto; min-width: 0; }
  .topbar__status .pill__label { overflow: hidden; text-overflow: ellipsis; }
}

/* ---------- MOTION ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
}

/* ============================================================
   Login-Overlay (UI-seitige Session-Auth, kein Browser-Dialog)
   ============================================================ */
.login-screen {
  position: fixed;
  inset: 0;
  z-index: 9000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: radial-gradient(120% 120% at 50% 0%, rgba(0, 184, 132, 0.10), rgba(7, 9, 13, 0.92) 60%);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}
.login-screen[hidden] { display: none; }

.login-card {
  width: min(380px, 100%);
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 32px 30px 26px;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(22, 28, 38, 0.96), rgba(14, 18, 25, 0.96));
  border: 1px solid rgba(255, 255, 255, 0.09);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}
.login-brand { display: flex; align-items: center; gap: 10px; font-family: "Space Grotesk", system-ui, sans-serif; font-size: 19px; }
.login-brand .brand__name { letter-spacing: -0.01em; }
.login-sub { margin: -4px 0 6px; font-size: 12.5px; letter-spacing: 0.14em; text-transform: uppercase; color: #7c8696; }

.login-field { display: flex; flex-direction: column; gap: 7px; }
.login-field > span { font-size: 12px; color: #97a1b1; }
.login-field input {
  width: 100%;
  padding: 12px 14px;
  border-radius: 11px;
  border: 1px solid rgba(255, 255, 255, 0.10);
  background: rgba(8, 11, 16, 0.85);
  color: #eef2f7;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 15px;
  letter-spacing: 0.04em;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}
.login-field input:focus {
  outline: none;
  border-color: rgba(0, 184, 132, 0.6);
  box-shadow: 0 0 0 3px rgba(0, 184, 132, 0.16);
}
.login-error { margin: 0; font-size: 12.5px; color: #ff6b6b; }
.login-error[hidden] { display: none; }

.login-btn { justify-content: center; width: 100%; padding: 12px; font-size: 14px; }
.login-foot { margin: 2px 0 0; text-align: center; font-size: 11px; letter-spacing: 0.08em; color: #69727f; }

.logout-btn { cursor: pointer; border: 1px solid rgba(255, 255, 255, 0.10); }
.logout-btn:hover { border-color: rgba(255, 120, 120, 0.45); color: #ffb4b4; }
.logout-btn[hidden] { display: none; }
