/* PulseRadar – Stylesheet
   Alle Werte stammen aus DESIGN.md. Regeln benutzen die Tokens, nie rohe Werte. */

/* ---------- Tokens: Hell ---------- */

:root {
  color-scheme: light;

  /* Flächen und Text */
  --surface: #ffffff;
  --sunken: #f3f5f4;
  --raised: #ffffff;
  --ink: #101b1c;
  --ink-2: #566365;
  --line: #e1e6e5;
  --line-strong: #869292;

  /* Marke und Aktionen */
  --primary: #0f4c52;
  --primary-hover: #0a3a3f;
  --on-primary: #ffffff;
  --primary-soft: #e3eeed;

  /* Daten (nur in Diagrammen und Balken) */
  --pos: #257de0;
  --neg: #ec4647;
  --pos-wash: rgba(37, 125, 224, 0.12);
  --neg-wash: rgba(236, 70, 71, 0.12);
  --band: rgba(86, 99, 101, 0.10);

  /* Status */
  --warn-bg: #fff5d9;
  --warn-ink: #5e4200;
  --success: #0b7a1e;
  --error: #c22f30;

  /* Typografie */
  --font-display: "Sitka Display", "Sitka Heading", "Sitka Text", "Iowan Old Style", "Charter", Georgia, serif;
  --font-ui: "Bahnschrift", "DIN Alternate", "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, sans-serif;
  --text-xs: 13px;
  --text-sm: 14px;
  --text-md: 16px;
  --text-lg: 19px;
  --text-xl: 24px;
  --text-2xl: 36px;
  --text-hero: 76px;
  --lh-tight: 1.12;
  --lh-snug: 1.3;
  --lh-body: 1.5;
  --w-light: 300;
  --w-regular: 400;
  --w-strong: 600;

  /* Abstände */
  --s-1: 4px;
  --s-2: 8px;
  --s-3: 12px;
  --s-4: 16px;
  --s-5: 24px;
  --s-6: 32px;
  --s-7: 48px;
  --s-8: 64px;
  --s-9: 96px;

  /* Form und Tiefe */
  --r-1: 2px;
  --r-2: 6px;
  --r-3: 12px;
  --hairline: 1px;
  --shadow-float: 0 8px 24px rgba(8, 20, 22, 0.14);
  --scrim: rgba(8, 20, 22, 0.45);

  /* Maße */
  --control-h: 36px;
  --measure: 68ch;
  --app-max: 1560px;
  --row-cols: minmax(0, 1fr) 92px minmax(96px, 160px) 48px;
  --bar-h: 12px;
  --mark-w: 3px;
}

/* ---------- Tokens: Dunkel (Geräteeinstellung oder Schalter) ---------- */

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --surface: #101718;
    --sunken: #0b1011;
    --raised: #182122;
    --ink: #ecf0ef;
    --ink-2: #9aa7a7;
    --line: #232d2e;
    --line-strong: #6a7778;
    --primary: #7ccbcd;
    --primary-hover: #9ad9da;
    --on-primary: #071314;
    --primary-soft: #17302f;
    --pos: #338ced;
    --neg: #eb6263;
    --pos-wash: rgba(51, 140, 237, 0.16);
    --neg-wash: rgba(235, 98, 99, 0.16);
    --band: rgba(154, 167, 167, 0.12);
    --warn-bg: #33290c;
    --warn-ink: #f7d98a;
    --success: #3fc455;
    --error: #f07f80;
    --shadow-float: 0 8px 24px rgba(0, 0, 0, 0.5);
    --scrim: rgba(0, 0, 0, 0.6);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --surface: #101718;
  --sunken: #0b1011;
  --raised: #182122;
  --ink: #ecf0ef;
  --ink-2: #9aa7a7;
  --line: #232d2e;
  --line-strong: #6a7778;
  --primary: #7ccbcd;
  --primary-hover: #9ad9da;
  --on-primary: #071314;
  --primary-soft: #17302f;
  --pos: #338ced;
  --neg: #eb6263;
  --pos-wash: rgba(51, 140, 237, 0.16);
  --neg-wash: rgba(235, 98, 99, 0.16);
  --band: rgba(154, 167, 167, 0.12);
  --warn-bg: #33290c;
  --warn-ink: #f7d98a;
  --success: #3fc455;
  --error: #f07f80;
  --shadow-float: 0 8px 24px rgba(0, 0, 0, 0.5);
  --scrim: rgba(0, 0, 0, 0.6);
}

/* ---------- Grundlagen ---------- */

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--surface);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: var(--text-md);
  font-weight: var(--w-regular);
  line-height: var(--lh-body);
}

h1, h2, h3, p, ul, dl, dd { margin: 0; }
ul { padding: 0; list-style: none; }
button, select { font: inherit; color: inherit; }

h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: var(--w-regular);
  line-height: var(--lh-tight);
  letter-spacing: -0.01em;
}

a { color: var(--primary); text-underline-offset: 3px; }

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

/* ---------- Knöpfe ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
  height: var(--control-h);
  padding: 0 var(--s-4);
  border: var(--hairline) solid transparent;
  border-radius: var(--r-2);
  background: transparent;
  font-size: var(--text-sm);
  white-space: nowrap;
  cursor: pointer;
}
.btn-primary { background: var(--primary); color: var(--on-primary); font-weight: var(--w-strong); }
.btn-primary:hover { background: var(--primary-hover); }
.btn-secondary { border-color: var(--line-strong); }
.btn-secondary:hover { background: var(--sunken); }
.btn-quiet { padding: 0; color: var(--primary); }
.btn-quiet:hover { text-decoration: underline; text-underline-offset: 3px; }
.btn:disabled { background: var(--sunken); border-color: transparent; color: var(--ink-2); cursor: not-allowed; }

/* ---------- Kopfzeile ---------- */

.top {
  display: flex;
  align-items: center;
  gap: var(--s-4);
  padding: var(--s-3) var(--s-6);
  border-bottom: var(--hairline) solid var(--line);
}
.brand { display: flex; align-items: center; gap: var(--s-3); }
.brand-mark { color: var(--primary); flex: none; }
.brand-name {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  line-height: var(--lh-tight);
  letter-spacing: -0.01em;
}
.status {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  margin-right: auto;
  padding: var(--s-1) var(--s-3);
  border: var(--hairline) solid var(--line);
  border-radius: var(--r-2);
  font-size: var(--text-xs);
  line-height: var(--lh-snug);
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
}
.status-dot { flex: none; width: var(--s-2); height: var(--s-2); border-radius: 50%; background: var(--line-strong); }
.status.is-live .status-dot { background: var(--success); }
.status.is-down .status-dot { background: var(--error); }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* ---------- Raster ---------- */

.layout {
  display: grid;
  grid-template-columns: minmax(440px, 600px) minmax(0, 1fr);
  align-items: start;
  max-width: var(--app-max);
  margin: 0 auto;
}
.foot {
  padding: var(--s-5) var(--s-6) var(--s-6);
  border-top: var(--hairline) solid var(--line);
  background: var(--sunken);
  font-size: var(--text-xs);
  line-height: var(--lh-body);
  color: var(--ink-2);
}
.foot p { max-width: var(--measure); }

/* ---------- Watchlist ---------- */

.radar {
  padding: var(--s-6) 0 var(--s-5);
  border-right: var(--hairline) solid var(--line);
}
.radar-head { padding: 0 var(--s-6); }
.radar-head h1 { font-size: var(--text-2xl); }
.sub { margin-top: var(--s-2); font-size: var(--text-sm); color: var(--ink-2); }

.controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3) var(--s-4);
  padding: var(--s-5) var(--s-6) var(--s-4);
}
.seg {
  display: inline-flex;
  border: var(--hairline) solid var(--line-strong);
  border-radius: var(--r-2);
  overflow: hidden;
}
.seg button {
  height: calc(var(--control-h) - 2 * var(--hairline));
  padding: 0 var(--s-3);
  border: 0;
  border-left: var(--hairline) solid var(--line-strong);
  background: transparent;
  font-size: var(--text-sm);
  white-space: nowrap;
  cursor: pointer;
}
.seg button:first-child { border-left: 0; }
.seg button:hover { background: var(--sunken); }
.seg button[aria-pressed="true"] { background: var(--primary); color: var(--on-primary); }
.seg button:focus-visible { outline-offset: -2px; }

.sort { display: flex; align-items: center; gap: var(--s-2); font-size: var(--text-sm); color: var(--ink-2); }
.sort select {
  height: var(--control-h);
  padding: 0 var(--s-2);
  border: var(--hairline) solid var(--line-strong);
  border-radius: var(--r-2);
  background: var(--surface);
  color: var(--ink);
  font-size: var(--text-sm);
}

.axis-row {
  display: grid;
  grid-template-columns: var(--row-cols);
  gap: 0 var(--s-3);
  padding: 0 var(--s-6) var(--s-1);
  font-size: var(--text-xs);
  line-height: var(--lh-snug);
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
}
.axis { display: flex; justify-content: space-between; }
.axis span { width: 0; display: flex; justify-content: center; white-space: nowrap; }

.rows { border-top: var(--hairline) solid var(--line); }
.rows li { border-bottom: var(--hairline) solid var(--line); }
.rows .empty { padding: var(--s-6); color: var(--ink-2); }

.row {
  display: grid;
  grid-template-columns: var(--row-cols);
  gap: 0 var(--s-3);
  align-items: stretch;
  width: 100%;
  padding: 0 var(--s-6);
  border: 0;
  background: transparent;
  text-align: left;
  cursor: pointer;
}
.row:hover { background: var(--sunken); }
.row.is-selected { background: var(--primary-soft); box-shadow: inset var(--mark-w) 0 0 var(--primary); }
.row:focus-visible { outline-offset: -2px; }

.cell { display: flex; flex-direction: column; justify-content: center; min-width: 0; padding: var(--s-3) 0; }
.cell-name .name { font-weight: var(--w-strong); line-height: var(--lh-snug); overflow-wrap: anywhere; }
.cell-name .meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0 var(--s-2);
  margin-top: var(--s-1);
  font-size: var(--text-xs);
  line-height: var(--lh-snug);
  color: var(--ink-2);
}
.cell-name .meta > span { white-space: nowrap; }
.cell-price { align-items: flex-end; font-variant-numeric: tabular-nums; }
.cell-price .price { font-size: var(--text-sm); }
.cell-price .chg { font-size: var(--text-xs); color: var(--ink-2); }
.cell-score {
  align-items: flex-end;
  font-size: var(--text-lg);
  font-weight: var(--w-strong);
  font-variant-numeric: tabular-nums;
}

.flag {
  display: inline-flex;
  align-items: center;
  gap: var(--s-1);
  padding: 0 var(--s-2) 0 var(--s-1);
  border-radius: var(--r-1);
  background: var(--warn-bg);
  color: var(--warn-ink);
}
.flag svg { flex: none; }
.flag-quiet { padding: 0; background: transparent; color: var(--ink-2); }
.flag-alert { padding: 0; background: transparent; color: var(--primary); }

/* Balken mit gemeinsamer Nulllinie */
.barcell {
  position: relative;
  align-self: stretch;
  min-height: var(--s-8);
  background-image: linear-gradient(var(--line), var(--line)), linear-gradient(var(--line), var(--line));
  background-size: var(--hairline) 100%;
  background-position: 25% 0, 75% 0;
  background-repeat: no-repeat;
}
.barcell::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 0;
  bottom: calc(-1 * var(--hairline));
  width: var(--hairline);
  background: var(--line-strong);
}
.bar {
  position: absolute;
  top: 50%;
  height: var(--bar-h);
  margin-top: calc(var(--bar-h) / -2);
}
.bar.pos { left: 50%; background: var(--pos); border-radius: 0 var(--s-1) var(--s-1) 0; }
.bar.neg { right: 50%; background: var(--neg); border-radius: var(--s-1) 0 0 var(--s-1); }
.prev {
  position: absolute;
  top: 50%;
  width: var(--r-1);
  height: var(--s-5);
  margin: calc(var(--s-5) / -2) 0 0 calc(var(--r-1) / -2);
  background: var(--ink);
  box-shadow: 0 0 0 1.5px var(--surface);
}
.row:hover .prev { box-shadow: 0 0 0 1.5px var(--sunken); }
.row.is-selected .prev { box-shadow: 0 0 0 1.5px var(--primary-soft); }

.key-note {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  padding: var(--s-4) var(--s-6) 0;
  font-size: var(--text-xs);
  color: var(--ink-2);
}
.prev-key { width: var(--r-1); height: var(--s-4); background: var(--ink); }

/* ---------- Detail ---------- */

.detail { min-width: 0; padding: var(--s-6) var(--s-7) var(--s-7); }

.d-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--s-3) var(--s-5);
  padding-bottom: var(--s-5);
  border-bottom: var(--hairline) solid var(--line);
}
.d-head h2 { font-size: var(--text-2xl); }
.d-meta { margin-top: var(--s-2); font-size: var(--text-sm); color: var(--ink-2); }
.d-side { display: flex; align-items: flex-end; gap: var(--s-5); }
.d-price { text-align: right; font-variant-numeric: tabular-nums; }
.d-price-val { display: block; font-size: var(--text-xl); font-weight: var(--w-strong); line-height: var(--lh-snug); }
.d-price-chg { font-size: var(--text-xs); color: var(--ink-2); }
.alert-note {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  padding-top: var(--s-3);
  font-size: var(--text-sm);
  color: var(--ink-2);
}
.alert-note svg { flex: none; color: var(--success); }

.block { padding: var(--s-6) 0; border-bottom: var(--hairline) solid var(--line); }
.block h3 { font-size: var(--text-xl); }
.block .sub { max-width: var(--measure); }

.score-block {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: var(--s-2) var(--s-6);
  align-items: start;
}
.score-label { font-size: var(--text-sm); color: var(--ink-2); }
.hero {
  margin: var(--s-2) 0 var(--s-3);
  font-size: var(--text-hero);
  font-weight: var(--w-light);
  line-height: 1;
  letter-spacing: -0.02em;
}
.score-qual { font-size: var(--text-sm); }
.score-qual .swatch {
  display: inline-block;
  width: var(--s-3);
  height: var(--s-3);
  margin-right: var(--s-2);
  border-radius: var(--r-1);
  vertical-align: -1px;
}
.swatch.pos { background: var(--pos); }
.swatch.neg { background: var(--neg); }
.swatch.mid { background: var(--line-strong); }
.score-delta { margin-top: var(--s-1); font-size: var(--text-sm); color: var(--ink-2); }

.chart-title { font-size: var(--text-sm); color: var(--ink-2); }
.chart { position: relative; margin-top: var(--s-1); }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }

details.table-view { margin-top: var(--s-2); font-size: var(--text-xs); }
details.table-view summary { width: fit-content; color: var(--ink-2); cursor: pointer; }
details.table-view table { margin-top: var(--s-2); border-collapse: collapse; font-variant-numeric: tabular-nums; }
details.table-view th, details.table-view td { padding: var(--s-1) var(--s-5) var(--s-1) 0; text-align: left; font-weight: var(--w-regular); }
details.table-view th { color: var(--ink-2); }
details.table-view td:last-child { padding-right: 0; text-align: right; }

/* Divergenz */
.div-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: var(--s-1) var(--s-4);
  padding: var(--s-5);
  border-radius: var(--r-3);
  background: var(--warn-bg);
  color: var(--warn-ink);
}
.div-card .icon { grid-row: span 3; margin-top: var(--s-1); }
.div-card h3 { color: inherit; }
.div-facts { display: flex; flex-wrap: wrap; gap: var(--s-1) var(--s-6); margin: var(--s-3) 0 var(--s-2); font-variant-numeric: tabular-nums; }
.div-facts strong { margin-right: var(--s-2); font-size: var(--text-xl); font-weight: var(--w-strong); }
.div-card .why-text { max-width: var(--measure); font-size: var(--text-sm); }
.div-card .hint { margin-top: var(--s-2); font-size: var(--text-xs); }
.div-none { font-size: var(--text-sm); color: var(--ink-2); }

/* Korridor */
.sec-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-2) var(--s-4);
}
.legend { display: flex; flex-wrap: wrap; gap: var(--s-1) var(--s-5); margin-top: var(--s-4); font-size: var(--text-xs); color: var(--ink-2); }
.legend span { display: inline-flex; align-items: center; gap: var(--s-2); }
.key { display: inline-block; flex: none; width: var(--s-4); height: 0; border-top: 2px solid var(--ink); border-radius: var(--r-1); }
.key.k-bull { border-color: var(--pos); }
.key.k-bear { border-color: var(--neg); }
.key.k-base { border-color: var(--ink-2); }
.key.k-band { height: var(--s-3); border: 0; background: var(--band); }

.scenarios {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0 var(--s-5);
  margin-top: var(--s-4);
  font-variant-numeric: tabular-nums;
}
.scenarios div { padding-left: var(--s-3); border-left: var(--mark-w) solid var(--ink-2); }
.scenarios .s-bull { border-color: var(--pos); }
.scenarios .s-bear { border-color: var(--neg); }
.scenarios dt { font-size: var(--text-xs); color: var(--ink-2); }
.scenarios dd { font-size: var(--text-lg); font-weight: var(--w-strong); line-height: var(--lh-snug); }
.scenarios dd span { display: block; font-size: var(--text-xs); font-weight: var(--w-regular); color: var(--ink-2); }
.backtest { max-width: var(--measure); margin-top: var(--s-4); font-size: var(--text-sm); color: var(--ink-2); }
.backtest strong { color: var(--ink); font-weight: var(--w-strong); }

/* Belege */
.evidence { margin-top: var(--s-4); }
.evidence li {
  display: grid;
  grid-template-columns: var(--s-8) minmax(0, 1fr);
  gap: 0 var(--s-4);
  padding: var(--s-3) 0;
  border-top: var(--hairline) solid var(--line);
}
.evidence li:first-child { border-top: 0; }
.impact {
  padding-left: var(--s-3);
  border-left: var(--mark-w) solid var(--ink-2);
  font-size: var(--text-lg);
  font-weight: var(--w-strong);
  font-variant-numeric: tabular-nums;
  line-height: var(--lh-snug);
}
.impact.pos { border-color: var(--pos); }
.impact.neg { border-color: var(--neg); }
.ev-title { max-width: var(--measure); }
.ev-meta { margin-top: var(--s-1); font-size: var(--text-xs); color: var(--ink-2); }
.rest { padding-top: var(--s-3); border-top: var(--hairline) solid var(--line); font-size: var(--text-sm); color: var(--ink-2); }

.disclaimer { max-width: var(--measure); padding-top: var(--s-5); font-size: var(--text-xs); color: var(--ink-2); }

/* ---------- Diagramme ---------- */

.grid-line { stroke: var(--line); stroke-width: 1; }
.zero-line, .today-line { stroke: var(--line-strong); stroke-width: 1; }
.tick-text { fill: var(--ink-2); font-size: var(--text-xs); font-variant-numeric: tabular-nums; }
.tick-text.strong { fill: var(--ink); font-weight: var(--w-strong); }
.line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.line-price { stroke: var(--ink); }
.line-base { stroke: var(--ink-2); }
.line-bull { stroke: var(--pos); }
.line-bear { stroke: var(--neg); }
.band { fill: var(--band); }
.wash-pos { fill: var(--pos-wash); }
.wash-neg { fill: var(--neg-wash); }
.dot { stroke: var(--surface); stroke-width: 2; }
.dot-price { fill: var(--ink); }
.dot-base { fill: var(--ink-2); }
.dot-bull, .dot-pos { fill: var(--pos); }
.dot-bear, .dot-neg { fill: var(--neg); }
.leader { fill: none; stroke: var(--line-strong); stroke-width: 1; }
.end-label { fill: var(--ink); font-size: var(--text-xs); font-variant-numeric: tabular-nums; }
.end-label .name { fill: var(--ink-2); }
.end-label .val { font-weight: var(--w-strong); }
.crosshair { stroke: var(--ink-2); stroke-width: 1; pointer-events: none; }
.hit { fill: transparent; }

.tooltip {
  position: fixed;
  z-index: 10;
  min-width: 140px;
  padding: var(--s-2) var(--s-3);
  border: var(--hairline) solid var(--line);
  border-radius: var(--r-2);
  background: var(--raised);
  box-shadow: var(--shadow-float);
  font-size: var(--text-xs);
  pointer-events: none;
}
.tooltip[hidden] { display: none; }
.tip-title { margin-bottom: var(--s-1); color: var(--ink-2); }
.tip-row { display: flex; align-items: center; gap: var(--s-2); font-variant-numeric: tabular-nums; }
.tip-row strong { font-weight: var(--w-strong); }
.tip-name { color: var(--ink-2); }

/* ---------- Live-Modus ---------- */

/* Ticker hinzufügen */
.add {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2);
  padding: var(--s-5) var(--s-6) var(--s-2);
}
.add select, .add input, .field input {
  height: var(--control-h);
  padding: 0 var(--s-3);
  border: var(--hairline) solid var(--line-strong);
  border-radius: var(--r-2);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: var(--text-sm);
}
.add input { flex: 1 1 140px; min-width: 0; }
.form-note {
  min-height: calc(var(--text-xs) * var(--lh-body));
  padding: 0 var(--s-6) var(--s-3);
  font-size: var(--text-xs);
  color: var(--ink-2);
}
.form-note-flush { padding-left: 0; padding-right: 0; }

/* Zeilen mit Mini-Chart */
.lrow-wrap { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: stretch; }
.lrow-wrap.is-selected { background: var(--primary-soft); box-shadow: inset var(--mark-w) 0 0 var(--primary); }
.lrow-wrap.is-selected .row:hover { background: transparent; }
.lrow { grid-template-columns: minmax(0, 1fr) 96px 116px; padding-right: var(--s-2); }
.spark { display: flex; align-items: center; }
.spark svg { display: block; width: 100%; height: var(--s-6); }
.spark-line { fill: none; stroke-width: 1.5; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.spark-up { stroke: var(--pos); }
.spark-down { stroke: var(--neg); }
.dir { vertical-align: 0; }
.dir-up { color: var(--pos); }
.dir-down { color: var(--neg); }
.flag-slot:empty { display: none; }
.row-remove {
  display: flex;
  align-items: center;
  justify-content: center;
  width: var(--s-7);
  border: 0;
  background: transparent;
  color: var(--ink-2);
  cursor: pointer;
}
.row-remove:hover { background: var(--sunken); color: var(--ink); }
.row-remove:focus-visible { outline-offset: -2px; }

.d-tick { display: block; font-size: var(--text-xs); color: var(--ink-2); }

/* Kerzen */
.candle-up { fill: var(--pos); stroke: var(--pos); }
.candle-down { fill: var(--neg); stroke: var(--neg); }
.wick { stroke-width: 1; }
rect.candle-up, rect.candle-down { stroke: none; }
.last-line { stroke: var(--ink-2); stroke-width: 1; }
.last-tag { fill: var(--ink); }
.last-tag-text { fill: var(--surface); font-size: var(--text-xs); font-weight: var(--w-strong); font-variant-numeric: tabular-nums; }
.key.k-up, .key.k-down { width: var(--s-2); height: var(--s-3); border: 0; border-radius: var(--r-1); }
.key.k-up { background: var(--pos); }
.key.k-down { background: var(--neg); }
.key.k-none { display: none; }
.chart-empty { padding: var(--s-7) 0 var(--s-5); font-size: var(--text-sm); color: var(--ink-2); }

.empty-state p { max-width: var(--measure); margin-top: var(--s-3); font-size: var(--text-sm); color: var(--ink-2); }
.empty-state .btn { margin-top: var(--s-4); }

/* Dialog */
dialog.sheet {
  width: min(480px, calc(100vw - 2 * var(--s-5)));
  padding: var(--s-6);
  border: var(--hairline) solid var(--line);
  border-radius: var(--r-3);
  background: var(--raised);
  color: var(--ink);
  box-shadow: var(--shadow-float);
}
dialog.sheet::backdrop { background: var(--scrim); }
dialog.sheet h3 { font-size: var(--text-xl); }
.sheet-text { margin-top: var(--s-3); font-size: var(--text-sm); color: var(--ink-2); }
.field { display: grid; gap: var(--s-2); margin-top: var(--s-5); font-size: var(--text-sm); }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-3) var(--s-4); margin-top: var(--s-4); }

/* ---------- Breite Bildschirme: Watchlist bleibt stehen ---------- */

@media (min-width: 1041px) {
  .radar {
    position: sticky;
    top: 0;
    max-height: 100vh;
    overflow-y: auto;
  }
}

/* ---------- Schmale Bildschirme ---------- */

@media (max-width: 1040px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .radar { border-right: 0; border-bottom: var(--hairline) solid var(--line); }
  .detail { padding: var(--s-6); }
}
@media (max-width: 640px) {
  :root {
    --row-cols: minmax(0, 1fr) 80px 80px 44px;
    --text-2xl: 30px;
    --text-hero: 64px;
  }
  .top { flex-wrap: wrap; padding: var(--s-3) var(--s-4); }
  .foot { padding: var(--s-4); }
  .radar-head, .controls, .key-note, .add, .form-note { padding-left: var(--s-4); padding-right: var(--s-4); }
  .form-note-flush { padding-left: 0; padding-right: 0; }
  .lrow { grid-template-columns: minmax(0, 1fr) 64px 104px; }
  .row-remove { width: var(--s-6); }
  .axis-row, .row { gap: 0 var(--s-2); padding-left: var(--s-4); padding-right: var(--s-4); }
  .detail { padding: var(--s-5) var(--s-4) var(--s-6); }
  .d-side { flex-wrap: wrap; align-items: center; gap: var(--s-3) var(--s-4); }
  .d-price { text-align: left; }
  .score-block { grid-template-columns: minmax(0, 1fr); }
  .scenarios { gap: 0 var(--s-3); }
}

@media (prefers-reduced-motion: no-preference) {
  .row, .seg button, .btn { transition: background-color 120ms ease; }
}
