/* GammaDesk – Oberfläche
   Idee: Blau steht für dämpfendes Gamma (über dem Flip), Orange für verstärkendes (darunter).
   Diese Zuordnung gilt überall: Kopfbereich, Level-Leiter, Diagramm. */
:root {
  color-scheme: dark;
  --bg: #0a111f;
  --side: #070d19;
  --panel: #0f1a2e;
  --panel-2: #16233c;
  --line: #22314f;
  --line-2: #30446b;
  --text: #e8eef9;
  --muted: #8c9bb9;
  --call: #58a6ff;
  --put: #ff8c4d;
  --flip: #f5c556;
  --good: #35c98a;
  --bad: #ff6270;
  --r-lg: 14px;
  --r-md: 10px;
  --side-w: 232px;
  /* Alte Namen, die Diagramme und Skripte noch nutzen */
  --series-1: var(--call);
  --series-2: var(--put);
  --series-4: var(--flip);
  --critical: var(--bad);
  --grid: #1d2b47;
  --surface-1: var(--panel);
  --surface-2: var(--panel-2);
  --text-primary: var(--text);
  --text-secondary: var(--muted);
  --radius: var(--r-lg);
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.55 "Segoe UI Variable", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", sans-serif; }
a { color: var(--call); }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .5em; letter-spacing: -.01em; }
h1 { font-size: 1.65rem; font-weight: 700; }
h2 { font-size: 1.05rem; font-weight: 650; }
h3 { font-size: .95rem; font-weight: 650; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.num { font-variant-numeric: tabular-nums; }
.pos { --regime: var(--call); }
.neg { --regime: var(--put); }

/* ---------- Seitenleiste ---------- */
.side { position: fixed; inset: 0 auto 0 0; width: var(--side-w); background: var(--side); border-right: 1px solid var(--line); display: flex; flex-direction: column; padding: 20px 14px 16px; z-index: 10; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.15rem; letter-spacing: -.01em; padding: 0 8px 22px; }
.brand img { width: 28px; height: 28px; }
.side nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.side nav a { display: flex; align-items: center; gap: 12px; color: var(--muted); text-decoration: none; padding: 10px 12px; border-radius: var(--r-md); font-weight: 500; }
.side nav a svg { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.side nav a:hover { background: var(--panel); color: var(--text); }
.side nav a.active { background: var(--panel-2); color: var(--text); box-shadow: inset 3px 0 0 var(--call); }
.userbox { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: var(--muted); font-size: .88rem; padding: 12px 8px 0; border-top: 1px solid var(--line); }
.userbox span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

button, .btn { font: inherit; cursor: pointer; border: 1px solid var(--line-2); background: var(--panel-2); color: var(--text); padding: 7px 14px; border-radius: var(--r-md); }
button:hover { border-color: #46608f; }
button.primary { background: var(--call); border-color: var(--call); color: #06101f; font-weight: 650; }
button.primary:hover { filter: brightness(1.08); }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, summary:focus-visible { outline: 2px solid var(--call); outline-offset: 2px; }

main { margin-left: var(--side-w); max-width: 1320px; padding: 26px 32px 70px; }
.page-head { margin-bottom: 20px; }
.page-head h1 { margin-bottom: 2px; }
.page-head p { margin: 0; color: var(--muted); max-width: 70ch; }

.banner { background: #261f0d; border: 1px solid #5a4510; color: #f0cf7a; padding: 9px 14px; border-radius: var(--r-md); margin-bottom: 14px; font-size: .9rem; }

/* ---------- Symbol-Leiste ---------- */
.rail { display: flex; align-items: center; gap: 8px; overflow-x: auto; padding: 2px 2px 10px; margin-bottom: 8px; scrollbar-width: thin; }
.rail .sep { width: 1px; align-self: stretch; background: var(--line-2); margin: 4px 6px; flex: none; }
.chip { display: inline-flex; align-items: center; gap: 8px; padding: 8px 16px; border-radius: 999px; background: var(--panel); border: 1px solid var(--line); color: var(--muted); font-weight: 650; flex: none; }
.chip:hover { color: var(--text); border-color: var(--line-2); }
.chip[aria-pressed="true"] { background: var(--panel-2); border-color: var(--call); color: var(--text); }
.chip .sigdot { width: 8px; height: 8px; border-radius: 50%; background: var(--flip); box-shadow: 0 0 0 3px #f5c55633; }

/* ---------- Kopfbereich (Kurs und Regime) ---------- */
.hero { display: grid; grid-template-columns: minmax(230px, auto) minmax(0, 1fr); gap: 18px 44px; padding: 24px 28px; margin-bottom: 16px; border-radius: var(--r-lg); background: color-mix(in srgb, var(--regime, var(--call)) 9%, var(--panel)); border: 1px solid color-mix(in srgb, var(--regime, var(--call)) 32%, var(--line)); }
.hero:empty { display: none; }
.hero-price .sym { color: var(--muted); font-size: .92rem; }
.hero-price .sym b { color: var(--text); font-size: 1.05rem; margin-right: 6px; }
.hero-price .spot { font-size: 3.1rem; font-weight: 700; line-height: 1.1; letter-spacing: -.03em; margin: 4px 0 2px; font-variant-numeric: tabular-nums; }
.hero-price .chg { font-size: .9rem; color: var(--muted); }
.hero-price .chg.up { color: var(--good); }
.hero-price .chg.down { color: var(--bad); }
.hero-price .stat { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.hero-regime .rg-title { display: flex; align-items: center; gap: 10px; font-size: 1.45rem; font-weight: 700; letter-spacing: -.02em; color: var(--regime); }
.tri { width: 0; height: 0; border-left: 8px solid transparent; border-right: 8px solid transparent; flex: none; }
.pos .tri { border-bottom: 13px solid var(--regime); }
.neg .tri { border-top: 13px solid var(--regime); }
.hero-regime p { margin: 6px 0 16px; max-width: 62ch; color: #cdd7ea; }
.facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0; border-top: 1px solid color-mix(in srgb, var(--regime, var(--call)) 25%, var(--line)); }
.facts > div { padding: 12px 16px 0 0; }
.facts > div + div { padding-left: 16px; border-left: 1px solid var(--line); }
.facts .k { color: var(--muted); font-size: .82rem; }
.facts .v { font-size: 1.2rem; font-weight: 650; white-space: nowrap; font-variant-numeric: tabular-nums; }
.facts .s { color: var(--muted); font-size: .8rem; }

.pill { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: 999px; font-size: .8rem; border: 1px solid var(--line-2); background: var(--panel-2); white-space: nowrap; }
.pill.ok::before { content: "✓"; color: var(--good); }
.pill.bad::before { content: "✕"; color: var(--bad); }
.pill.neutral::before { content: "–"; color: var(--muted); }
.pill.live::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--good); }
.pill.warn { border-color: #6a5316; color: #f0cf7a; background: #261f0d; }
.pill.test { border-color: #4b3d7a; color: #c9b8ff; background: #1b1633; }
@media (prefers-reduced-motion: no-preference) {
  .pill.live::before { animation: pulse 2.4s ease-in-out infinite; }
  @keyframes pulse { 50% { opacity: .35; } }
}

/* ---------- Übersicht: Raster ---------- */
.overview { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); grid-template-areas: "signal" "ladder" "gex" "hist" "explain"; }
.overview > .panel { margin: 0; min-width: 0; }
.overview > :empty { display: none; }
.a-signal { grid-area: signal; } .a-ladder { grid-area: ladder; align-self: start; } .a-gex { grid-area: gex; }
.a-hist { grid-area: hist; align-self: start; } .a-explain { grid-area: explain; align-self: start; }
@media (min-width: 1180px) {
  .overview { grid-template-columns: minmax(0, 1fr) 350px; grid-template-areas: "signal ladder" "gex ladder" "hist explain"; }
}

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 18px 20px; margin-bottom: 16px; }
.panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.panel-head h2 { margin: 0; }
.legend { display: flex; gap: 16px; align-items: center; color: var(--muted); font-size: .84rem; flex-wrap: wrap; }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.legend i.line { height: 0; border-top: 2px solid; border-radius: 0; width: 18px; vertical-align: 3px; }
.legend i.dash { border-top-style: dashed; }
.legend i.zone-neg { background: #ff8c4d33; border: 1px solid #ff8c4d88; }
.legend i.zone-pos { background: #58a6ff33; border: 1px solid #58a6ff88; }
select, input[type=number], input[type=text], input[type=password] { font: inherit; background: var(--bg); color: var(--text); border: 1px solid var(--line-2); border-radius: var(--r-md); padding: 8px 11px; }

/* ---------- Signal ---------- */
.panel.quiet { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 14px 20px; }
.panel.quiet .q-title { font-weight: 650; }
.panel.quiet p { margin: 0; flex: 1 1 320px; }
.sig-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.sig-head h2 { margin: 0; font-size: 1.15rem; }
.sig-head .right { margin-left: auto; display: flex; gap: 10px; align-items: center; }
.dir { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; padding: 5px 14px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--panel-2); }
.dir .tri { border-left-width: 6px; border-right-width: 6px; }
.dir.long .tri { border-bottom: 10px solid var(--call); }
.dir.short .tri { border-top: 10px solid var(--put); }
.dots { letter-spacing: 3px; color: var(--flip); white-space: nowrap; }

.tband { position: relative; padding-top: 24px; margin-bottom: 10px; }
.tb-spot { position: absolute; top: 0; transform: translateX(-50%); font-size: .78rem; color: var(--text); white-space: nowrap; text-align: center; line-height: 1; }
.tb-spot::after { content: ""; display: block; margin: 4px auto 0; border-left: 5px solid transparent; border-right: 5px solid transparent; border-top: 7px solid var(--text); width: 0; }
.tb-bar { position: relative; height: 14px; background: var(--panel-2); border-radius: 7px; }
.tb-bar .seg { position: absolute; top: 0; bottom: 0; }
.tb-bar .risk { background: #ff627033; border-radius: 7px 0 0 7px; }
.tb-bar .reward { background: #35c98a33; border-radius: 0 7px 7px 0; }
.tb-bar .tick { position: absolute; top: -4px; bottom: -4px; width: 4px; margin-left: -2px; border-radius: 2px; background: var(--text); }
.tick.stop { background: var(--bad); } .tick.target { background: var(--good); } .tick.entry { background: var(--text); }
.tb-vals { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin: 14px 0 6px; }
.tb-vals .k { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: .84rem; }
.tb-vals .k i { width: 9px; height: 9px; border-radius: 2px; }
.tb-vals .v { font-size: 1.55rem; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.tb-vals .s { color: var(--muted); font-size: .82rem; }
.sig-meta { display: flex; gap: 6px 28px; flex-wrap: wrap; color: var(--muted); font-size: .88rem; margin-bottom: 12px; }
.sig-meta b { color: var(--text); font-weight: 650; margin-left: 6px; }
.note { margin: 0 0 14px; padding: 10px 12px; border-radius: var(--r-md); background: var(--panel-2); color: #cdd7ea; font-size: .9rem; }
.note.warn { background: #261f0d; color: #f0cf7a; }
.sig-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 22px; }
.sig-cols ul, .sig-cols ol { margin: 0; padding-left: 20px; }
.sig-cols li { margin: 6px 0; max-width: 62ch; }
.sig-cols ol li::marker { color: var(--call); font-weight: 700; }

/* ---------- Level-Leiter ---------- */
.ladder { list-style: none; margin: 8px 0 0; padding: 0; }
.rung { --zone: var(--line-2); display: grid; grid-template-columns: 24px minmax(0, 1fr) auto; column-gap: 12px; align-items: center; min-height: 48px; position: relative; padding-right: 4px; }
.rung::before { content: ""; position: absolute; left: 11px; top: 0; bottom: 0; width: 2px; background: var(--zone); }
.rung:first-child::before { top: 50%; } .rung:last-child::before { bottom: 50%; }
.rung[data-zone="pos"] { --zone: #58a6ffaa; }
.rung[data-zone="neg"] { --zone: #ff8c4daa; }
.rung[data-zone="flip"]::before { background: linear-gradient(#58a6ffaa 50%, #ff8c4daa 50%); }
.rung .mk { width: 14px; height: 14px; justify-self: center; position: relative; z-index: 1; background: var(--panel); border: 2px solid var(--text); }
.rung .nm { font-weight: 600; line-height: 1.2; }
.rung .ht { color: var(--muted); font-size: .8rem; line-height: 1.25; }
.rung .pr { text-align: right; font-weight: 650; font-variant-numeric: tabular-nums; line-height: 1.2; }
.rung .ds { display: block; color: var(--muted); font-weight: 500; font-size: .8rem; }
.rung[data-kind="wall-c"] .mk { border-color: var(--call); background: var(--call); border-radius: 3px; }
.rung[data-kind="wall-p"] .mk { border-color: var(--put); background: var(--put); border-radius: 3px; }
.rung[data-kind="flip"] .mk { border-color: var(--flip); background: var(--flip); transform: rotate(45deg) scale(.82); }
.rung[data-kind="entry"] .mk { border-radius: 50%; border-color: var(--text); }
.rung[data-kind="stop"] .mk { border-radius: 50%; border-color: var(--bad); }
.rung[data-kind="target"] .mk { border-radius: 50%; border-color: var(--good); }
.rung[data-kind="spot"] { min-height: 62px; background: var(--panel-2); border-radius: var(--r-md); margin: 4px -8px; padding: 0 12px 0 8px; }
.rung[data-kind="spot"]::before { left: 19px; }
.rung[data-kind="spot"] .mk { background: var(--text); border-color: var(--text); border-radius: 50%; width: 16px; height: 16px; box-shadow: 0 0 0 4px #e8eef933; }
.rung[data-kind="spot"] .pr { font-size: 1.25rem; }
.zonekey { margin: 12px 0 0; color: var(--muted); font-size: .82rem; }
.zonekey b.p { color: var(--call); } .zonekey b.n { color: var(--put); }

.explain h2 { margin-bottom: 10px; }
.explain ul { margin: 0; padding-left: 20px; }
.explain li { margin: 8px 0; }
.caution { margin-top: 12px; padding: 10px 12px; border-left: 3px solid var(--flip); background: var(--panel-2); border-radius: 6px; color: var(--muted); font-size: .88rem; }

/* ---------- Diagramme ---------- */
.chart-wrap { position: relative; }
svg.chart { width: 100%; height: auto; display: block; }
svg.chart text { fill: var(--muted); font-size: 11px; font-family: inherit; }
svg.chart .lbl { fill: var(--text); font-size: 11px; font-weight: 600; }
.tooltip { position: absolute; pointer-events: none; background: #060b16; border: 1px solid var(--line-2); border-radius: var(--r-md); padding: 8px 10px; font-size: .82rem; min-width: 150px; display: none; z-index: 3; }
.tooltip b { display: block; margin-bottom: 4px; }
.tooltip .row { display: flex; justify-content: space-between; gap: 14px; }

/* ---------- Kennzahlen-Leiste (Signale, Paper) ---------- */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; margin-bottom: 16px; }
.card { background: var(--panel); padding: 14px 18px; }
.card .label { color: var(--muted); font-size: .84rem; }
.card .value { font-size: 1.3rem; white-space: nowrap; font-weight: 700; margin-top: 2px; letter-spacing: -.01em; }
.card .sub { color: var(--muted); font-size: .8rem; margin-top: 1px; }
.card .value.pos-v { color: var(--good); } .card .value.neg-v { color: var(--bad); }

/* ---------- Tabellen, Details ---------- */
details { margin-top: 12px; }
summary { cursor: pointer; color: var(--muted); }
summary:hover { color: var(--text); }
table { width: 100%; border-collapse: collapse; font-size: .86rem; margin-top: 8px; }
th, td { text-align: right; padding: 8px 10px; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-weight: 600; font-size: .8rem; position: sticky; top: 0; background: var(--panel); }
tbody tr:hover td { background: #131f36; }
th:first-child, td:first-child { text-align: left; }
.scroll { max-height: 340px; overflow: auto; }
td.num, th { white-space: nowrap; }
table.sigtable th:nth-child(-n+4), table.sigtable td:nth-child(-n+4) { text-align: left; }
table.sigtable th:nth-child(8), table.sigtable td:nth-child(8) { text-align: center; }
table.ko tr.unsafe { color: var(--muted); }
table.ko tr.rec td { background: #16304d; }

/* ---------- Formulare ---------- */
form.settings { max-width: 820px; }
form.settings .panel { margin-bottom: 16px; }
.fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px 22px; }
.field { display: grid; gap: 6px; align-content: start; }
.field label { font-weight: 600; }
.field small { color: var(--muted); }
.field input[type=text], .field input[type=password], .field input[type=number], .field select { width: 100%; }
.checks { display: flex; gap: 10px 20px; flex-wrap: wrap; align-items: center; }
.checks label { font-weight: 400; display: flex; gap: 8px; align-items: center; }
.status { color: var(--good); min-height: 1.4em; }
.status.err { color: var(--bad); }
.savebar { position: sticky; bottom: 0; display: flex; align-items: center; gap: 16px; padding: 14px 0; background: linear-gradient(transparent, var(--bg) 40%); }

/* ---------- Lernen ---------- */
.learn { max-width: 860px; }
.learn h2 { margin-top: 1.6em; }
.learn p, .learn li { max-width: 70ch; }
.learn dl { display: grid; gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; margin: 0; }
.learn dt, .learn dd { background: var(--panel); margin: 0; padding: 0 18px; }
.learn dt { font-weight: 650; padding-top: 14px; }
.learn dd { color: #cdd7ea; padding-bottom: 14px; max-width: none; }

/* ---------- Login ---------- */
.login-box { max-width: 390px; margin: 14vh auto 0; padding: 30px; background: var(--panel); border: 1px solid var(--line); border-radius: 18px; }
.login-box .brand { padding: 0 0 6px; }
.login-sub { margin: 0 0 6px; font-size: .9rem; }
.login-box form { display: grid; gap: 14px; margin-top: 18px; }
.login-box input { width: 100%; }

/* ---------- Schmale Bildschirme: Menü unten ---------- */
@media (max-width: 900px) {
  .side { inset: auto 0 0 0; width: auto; flex-direction: row; padding: 0; border-right: 0; border-top: 1px solid var(--line); }
  .side .brand, .side .userbox span { display: none; }
  .side nav { flex-direction: row; justify-content: space-around; }
  .side nav a { flex: 1; flex-direction: column; gap: 3px; padding: 9px 4px 8px; font-size: .68rem; border-radius: 0; text-align: center; }
  .side nav a.active { box-shadow: inset 0 3px 0 var(--call); }
  .userbox { border: 0; padding: 0 10px; }
  .userbox button { padding: 5px 8px; font-size: .78rem; }
  main { margin-left: 0; padding: 16px 14px 96px; }
  .hero { grid-template-columns: minmax(0, 1fr); padding: 18px; gap: 14px; }
  .hero-price .spot { font-size: 2.5rem; }
  .facts { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .facts .v { font-size: 1rem; }
  .facts > div + div { padding-left: 10px; }
  .tb-vals .v { font-size: 1.2rem; }
  .panel { padding: 16px; }
  .chip { padding: 7px 13px; }
  .chart-wrap { overflow-x: auto; }
  svg.chart { min-width: 640px; }
}
