/* ============ onvista Signale — Design Tokens ============ */
:root {
  --bg: #0E0E10;
  --surface: #1C1C1E;
  --surface-2: #2C2C2E;
  --surface-3: #3A3A3C;
  --text: #FFFFFF;
  --text-muted: #8E8E93;
  --accent: #A78BFA;
  --accent-dim: #6D5BA8;
  --c-warn: #C9C24E;      /* nah / aufmerksam (gelb-oliv) */
  --c-trigger: #C9C24E;   /* ausgelöst */
  --c-negative: #B23A1F;
  --c-positive: #2E9E6A;
  --radius: 16px;
  --radius-sm: 12px;
  --radius-pill: 999px;
  --gap: 16px;
  font-size: 16px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0; padding: 0;
  background: #000;
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Inter, sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* Geräterahmen */
.device {
  position: relative;
  max-width: 440px;
  margin: 0 auto;
  min-height: 100vh;
  background: var(--bg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* ============ Views ============ */
.view { display: none; flex: 1; flex-direction: column; }
.view.is-active { display: flex; }

/* ============ Topbar ============ */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 16px 8px;
}
.topbar__title { font-size: 19px; font-weight: 600; margin: 0; }
.topbar__actions { display: flex; gap: 8px; }

.icon-btn {
  width: 40px; height: 40px; border-radius: var(--radius-pill);
  background: var(--surface-2); color: var(--text);
  border: none; font-size: 20px; line-height: 1; cursor: pointer;
  display: grid; place-items: center; transition: background .15s, transform .1s;
}
.icon-btn:active { transform: scale(.92); }
.icon-btn--accent { color: var(--accent); font-size: 24px; font-weight: 300; }

/* ============ Filter Chips ============ */
.filter-row { display: flex; gap: 8px; padding: 6px 16px 12px; overflow-x: auto; }
.chip {
  border: none; background: var(--surface-2); color: var(--text-muted);
  padding: 7px 14px; border-radius: var(--radius-pill); font-size: 13px; cursor: pointer;
  white-space: nowrap; transition: .15s;
}
.chip.is-active { background: var(--accent); color: #1a1030; font-weight: 600; }

/* ============ Übersicht ============ */
.overview-scroll { flex: 1; overflow-y: auto; padding: 4px 16px 90px; }

.group__head {
  display: flex; align-items: center; gap: 8px;
  margin: 18px 4px 10px; font-size: 13px; color: var(--text-muted);
  text-transform: none; font-weight: 600;
}
.group__head .dot { width: 8px; height: 8px; border-radius: 50%; }
.group__head .count {
  margin-left: auto; background: var(--surface-2); color: var(--text-muted);
  border-radius: var(--radius-pill); padding: 1px 9px; font-size: 12px;
}

.scard {
  background: var(--surface); border-radius: var(--radius);
  padding: 14px 16px; margin-bottom: 10px; cursor: pointer;
  border: 1.5px solid transparent; transition: border-color .15s, transform .1s;
}
.scard:active { transform: scale(.99); }
.scard--trigger { border-color: var(--c-trigger); background: #26240f; }

.scard__row { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.scard__name { font-size: 16px; font-weight: 600; }
.scard__isin { font-size: 12px; color: var(--text-muted); margin-top: 1px; }
.scard__dir { font-size: 14px; color: var(--text-muted); display: flex; align-items: center; gap: 6px; }
.scard__dir .arrow { color: var(--accent); font-weight: 700; }
.scard__thr { font-size: 16px; font-weight: 600; white-space: nowrap; }

/* Proximity-Balken */
.prox { margin-top: 12px; }
.prox__track {
  position: relative; height: 6px; border-radius: 3px;
  background: var(--surface-2); overflow: hidden;
}
.prox__fill { position: absolute; inset: 0 auto 0 0; border-radius: 3px; }
.prox__meta { display: flex; justify-content: space-between; margin-top: 7px; font-size: 12px; }
.prox__status { font-weight: 600; }
.prox__pct { color: var(--text-muted); }

.empty {
  text-align: center; color: var(--text-muted); padding: 60px 24px;
}
.empty__cta { margin-top: 16px; }

/* ============ Sheet ============ */
.view--sheet {
  position: absolute; inset: 0; z-index: 30;
  background: rgba(0,0,0,.5);
  transform: translateY(100%); transition: transform .28s cubic-bezier(.4,0,.2,1);
}
.view--sheet.is-active { display: flex; transform: translateY(0); }
.sheet {
  margin-top: auto; background: var(--bg);
  border-radius: 22px 22px 0 0; max-height: 96%;
  display: flex; flex-direction: column; width: 100%;
}
.sheet__top {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px; border-bottom: 1px solid var(--surface-2);
}
.sheet__title { font-size: 17px; font-weight: 600; margin: 0; }
.sheet__scroll { overflow-y: auto; padding: 4px 16px 28px; }

/* Instrument + Preis */
.instr { padding: 16px 0 18px; border-bottom: 1px solid var(--surface-2); }
.instr__head { margin-bottom: 8px; }
.badge {
  background: var(--surface-2); color: var(--text); border-radius: 8px;
  padding: 4px 10px; font-size: 12px; font-weight: 600;
}
.instr__name { font-size: 24px; font-weight: 700; margin-top: 6px; }
.instr__sub { font-size: 13px; color: var(--text-muted); margin-top: 2px; }
.price { display: flex; align-items: center; gap: 12px; margin-top: 14px; }
.price__value { font-size: 26px; font-weight: 700; }
.price__delta {
  font-size: 14px; font-weight: 600; padding: 4px 10px; border-radius: 8px;
}
.price__delta.is-negative { background: var(--c-negative); color: #fff; }
.price__delta.is-positive { background: var(--c-positive); color: #fff; }
.price__meta { font-size: 12px; color: var(--text-muted); margin-top: 8px; }

/* Felder */
.field { padding: 18px 0; border-bottom: 1px solid var(--surface-2); }
.field:last-of-type { border-bottom: none; }
.field__label {
  display: flex; align-items: center; gap: 6px;
  font-size: 14px; color: var(--text-muted); margin-bottom: 10px; font-weight: 500;
}
.field__hint { font-size: 12px; color: var(--text-muted); margin-top: 8px; }
.info-btn { background: none; border: none; color: var(--accent); cursor: pointer; font-size: 14px; padding: 0; }

.select-wrap { position: relative; }
.select {
  width: 100%; appearance: none; background: var(--surface);
  color: var(--text); border: none; border-radius: var(--radius-sm);
  padding: 14px 40px 14px 14px; font-size: 16px; cursor: pointer;
}
.select-wrap::after {
  content: "⌄"; position: absolute; right: 16px; top: 50%; transform: translateY(-65%);
  color: var(--accent); pointer-events: none; font-size: 18px;
}

/* Segmented control */
.segmented { display: flex; gap: 6px; background: var(--surface); border-radius: var(--radius-sm); padding: 4px; }
.seg {
  flex: 1; border: none; background: transparent; color: var(--text-muted);
  padding: 11px 8px; border-radius: 10px; cursor: pointer; font-size: 14px; font-weight: 600;
  display: flex; flex-direction: column; align-items: center; gap: 1px; transition: .15s;
}
.seg small { font-size: 10px; font-weight: 500; opacity: .7; }
.seg.is-active { background: var(--accent); color: #1a1030; }

.explain {
  margin-top: 10px; background: var(--surface); border-radius: var(--radius-sm);
  padding: 12px 14px; font-size: 13px; color: var(--text-muted); line-height: 1.5;
}
.explain b { color: var(--text); }

/* ===== Preis-Skala (Herzstück) ===== */
.scale { padding: 26px 4px 4px; }
.scale__track {
  position: relative; height: 8px; border-radius: 4px; background: var(--surface-2);
  margin: 26px 8px;
}
.scale__bar { position: absolute; top: 0; bottom: 0; border-radius: 4px; background: var(--accent); opacity: .55; }
.scale__zone {
  position: absolute; top: -6px; bottom: -6px; border-radius: 6px;
  background: rgba(201,194,78,.12); border: 1px dashed rgba(201,194,78,.5);
  pointer-events: none;
}
.scale__anchor {
  position: absolute; top: -7px; bottom: -7px; width: 2px; background: var(--text);
  left: 50%; transform: translateX(-50%);
}
.scale__anchor-label {
  position: absolute; bottom: -24px; left: 50%; transform: translateX(-50%);
  font-size: 11px; color: var(--text-muted); white-space: nowrap;
}
.scale__handle {
  position: absolute; top: 50%; width: 26px; height: 26px; border-radius: 50%;
  background: var(--accent); transform: translate(-50%, -50%);
  cursor: grab; touch-action: none; box-shadow: 0 2px 8px rgba(0,0,0,.5);
  border: 3px solid #1a1030;
}
.scale__handle:active { cursor: grabbing; }
.scale__handle-flag {
  position: absolute; bottom: 30px; left: 50%; transform: translateX(-50%);
  background: var(--accent); color: #1a1030; font-size: 12px; font-weight: 700;
  padding: 3px 9px; border-radius: var(--radius-pill); white-space: nowrap;
}
.scale__handle-flag::after {
  content: ""; position: absolute; top: 100%; left: 50%; transform: translateX(-50%);
  border: 5px solid transparent; border-top-color: var(--accent);
}
.scale__ends { display: flex; justify-content: space-between; font-size: 11px; color: var(--text-muted); margin: 26px 4px 0; }

/* Schwellen-Eingabe */
.threshold { margin-top: 22px; }
.threshold__input {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface); border-radius: var(--radius-sm); padding: 6px 8px;
}
.step {
  width: 38px; height: 38px; border-radius: 10px; border: none;
  background: var(--surface-2); color: var(--accent); font-size: 22px; cursor: pointer;
}
.threshold__field {
  flex: 1; background: none; border: none; color: var(--text);
  font-size: 22px; font-weight: 700; text-align: center; outline: none; min-width: 0;
}
.threshold__cur { color: var(--text-muted); font-size: 14px; font-weight: 600; }
.threshold__dist { display: flex; align-items: baseline; gap: 10px; margin-top: 12px; justify-content: center; }
.dist__pct { font-size: 18px; font-weight: 700; }
.dist__abs { font-size: 13px; color: var(--text-muted); }

.warn {
  margin-top: 12px; background: rgba(178,58,31,.15); border: 1px solid var(--c-negative);
  color: #f3b8a8; border-radius: var(--radius-sm); padding: 11px 14px; font-size: 13px; line-height: 1.45;
}

/* Toggles */
.toggles { display: flex; gap: 10px; }
.toggle {
  flex: 1; display: flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--surface); border: 1.5px solid var(--surface-2); color: var(--text-muted);
  padding: 13px; border-radius: var(--radius-sm); cursor: pointer; font-size: 14px; font-weight: 600;
}
.toggle__dot { width: 10px; height: 10px; border-radius: 50%; background: var(--surface-3); }
.toggle.is-on { border-color: var(--accent); color: var(--text); }
.toggle.is-on .toggle__dot { background: var(--accent); }

/* CTA */
.sheet__cta { margin-top: 22px; display: flex; flex-direction: column; gap: 10px; }
.btn {
  width: 100%; border: none; border-radius: var(--radius-pill);
  padding: 16px; font-size: 16px; font-weight: 700; cursor: pointer; transition: .15s;
}
.btn--primary { background: var(--accent); color: #1a1030; }
.btn--primary:active { transform: scale(.99); }
.btn--danger-ghost { background: transparent; color: var(--c-negative); }

/* Toast */
.toast {
  position: absolute; left: 16px; right: 16px; bottom: 84px; z-index: 50;
  background: var(--surface-3); color: var(--text); border-radius: var(--radius-sm);
  padding: 14px 16px; display: flex; align-items: center; justify-content: space-between;
  box-shadow: 0 6px 24px rgba(0,0,0,.5); font-size: 14px;
}
.toast__action { background: none; border: none; color: var(--accent); font-weight: 700; cursor: pointer; font-size: 14px; }

/* Bottom-Nav */
.botnav {
  display: flex; justify-content: space-around; align-items: center;
  padding: 12px 16px 18px; border-top: 1px solid var(--surface-2); background: var(--bg);
  font-size: 12px; color: var(--text-muted);
}
.botnav__item.is-active { color: var(--accent); font-weight: 600; }

/* Desktop-Hinweis: zentriert auf größeren Screens */
@media (min-width: 600px) {
  body { padding: 24px 0; }
  .device { border-radius: 28px; min-height: calc(100vh - 48px); box-shadow: 0 0 0 10px #1a1a1c, 0 30px 80px rgba(0,0,0,.6); }
}
