/* Trader bot – Stil «Data terminal» (tasteskill v2, dunkel)
   Die eine Bewegung: Jede Auswahl ist eine 1px-Akzentlinie, so breit wie ihre Beschriftung.
   Gesicht: alle Zahlen in JetBrains Mono, Text in Public Sans; Cyan nur auf Daten.

   Raster bei 1440 px: Leiste 56 + Rand 2 × 32 → Inhalt 1320.
   12 Spalten × 88 + 11 × 24 = 1320.  span-4 = 424, span-8 = 872 → 424 + 24 + 872 = 1320.
   span-7 = 760, span-5 = 536 → 1320.  span-6 = 648 → 648 + 24 + 648 = 1320. */
:root {
  --ground: #171719;
  --surface: #131217;
  --raised: #212023;
  --border: #222224;
  --rule: #1b1a1f;
  --control: #3a3a3e;
  --text: #ffffff;
  --muted: #8a8c92;
  --accent: #4cc9d9;          /* Cyan aus dem Kern: einziger Farbton, nur auf Daten und Auswahl */
  --positive: #44a282;
  --negative: #e5566f;
  --warning: #d9a441;
  --chart-1: #4cc9d9;
  --chart-muted: #3a3a3e;
  --grid: #26252b;
  --axis-ink: #8a8c92;
  --ink: #ffffff;
  --pill-positive-bg: #1b2828; --pill-positive-ink: #5fc39c;
  --pill-negative-bg: #2c1a20; --pill-negative-ink: #e5566f;
  --pill-warning-bg: #2a2416;  --pill-warning-ink: #d9a441;
  --pill-neutral-bg: #212023;  --pill-neutral-ink: #bdbdc0;
  --shadow: 0 12px 28px rgba(0, 0, 0, .2);
  --radius-card: 6px;
  --radius-control: 999px;
  --row-height: 42px;
  --rail: 56px;
  --gap: 24px;
  --pad: 32px;
  --control-height: 34px;
  --font: "Public Sans", Inter, system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --pulse: var(--accent);
  color-scheme: dark;
}
body[data-status="paused"] { --pulse: var(--warning); }
body[data-status="killed"] { --pulse: var(--negative); }

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--ground); color: var(--text); font: 400 13px/20px var(--font); }
a { color: inherit; }
button, input { font: inherit; color: inherit; }
:focus-visible { outline: 1px solid var(--accent); outline-offset: 2px; }
.num, .table td.num, .kpi-value, time { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
[hidden] { display: none !important; }

/* ---------- Gerüst ---------- */
.app { display: grid; grid-template-columns: var(--rail) 1fr; min-height: 100vh; }
.rail {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; align-items: center;
  gap: 4px; padding: 14px 0; border-right: 1px solid var(--border); background: var(--ground);
}
.brand { display: grid; place-items: center; width: 40px; height: 40px; margin-bottom: 14px; }
.brand svg { width: 30px; height: 30px; }
.nav {
  position: relative; display: grid; place-items: center; width: 56px; height: 42px; border: 0; background: none;
  color: var(--muted); text-decoration: none; cursor: pointer;
}
.nav svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.nav span { display: none; }
.nav:hover { color: var(--text); }
.nav[aria-current="page"] { color: var(--text); }
.nav[aria-current="page"]::after { content: ""; position: absolute; right: -1px; top: 10px; bottom: 10px; width: 1px; background: var(--accent); }
.rail-foot { margin-top: auto; }

.canvas { padding: 28px var(--pad) 48px; min-width: 0; }
.title-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px 24px; flex-wrap: wrap; margin-bottom: 24px; }
.title-text { min-width: 0; }
h1 { margin: 0; font-size: 26px; line-height: 32px; font-weight: 700; letter-spacing: -0.01em; }
.finding { margin: 6px 0 0; font-size: 14px; line-height: 20px; color: var(--muted); max-width: 70ch; }
.finding b { color: var(--text); font-weight: 600; }
.title-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.meta { color: var(--muted); font-size: 12px; }

.grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: var(--gap); align-items: stretch; }
.grid-top { align-items: start; }
.self-top { align-self: start; }
.card.flex { display: flex; flex-direction: column; }
.card .foot { margin-top: auto; padding-top: 16px; }
.total { display: grid; grid-template-columns: 1fr auto auto; gap: 24px; align-items: center; border-top: 1px solid var(--rule); padding-top: 12px; margin-top: auto; }
.total:empty { display: none; }
.total span:first-child { color: var(--muted); }
.span-4 { grid-column: span 4; } .span-5 { grid-column: span 5; } .span-6 { grid-column: span 6; }
.span-7 { grid-column: span 7; } .span-8 { grid-column: span 8; } .span-12 { grid-column: span 12; }
.stack { display: grid; gap: var(--gap); }

.card { background: var(--surface); border-radius: var(--radius-card); box-shadow: var(--shadow); padding: 20px 24px; min-width: 0; }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.card-title { margin: 0 0 12px; font-size: 16px; line-height: 24px; font-weight: 600; }
.card-head .card-title { margin: 0; }
.sub { margin: 0 0 6px; font-size: 12px; font-weight: 500; color: var(--muted); }
.link { color: var(--text); font-size: 13px; text-decoration: none; border-bottom: 1px solid var(--control); }
.link:hover { border-color: var(--accent); }
.empty { margin: 8px 0 0; color: var(--muted); font-size: 13px; }
.note { margin: 10px 0; color: var(--muted); font-size: 12px; line-height: 18px; }
.note.err { color: var(--negative); } .note.ok { color: var(--positive); }
.note:empty { display: none; }

/* ---------- Knöpfe und Chips ---------- */
.btn {
  height: var(--control-height); padding: 0 16px; border-radius: var(--radius-control); border: 1px solid var(--control);
  background: transparent; color: var(--text); font-size: 13px; font-weight: 500; cursor: pointer; white-space: nowrap;
}
.btn:hover { border-color: #5a5a60; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--text); color: #000; border-color: var(--text); }
.btn-primary:hover { background: #e6e6e6; }
.btn-danger { color: var(--negative); border-color: #5a2a35; }
.btn-danger:hover { border-color: var(--negative); }
.btn:disabled { opacity: .5; cursor: wait; }
.chip { display: inline-flex; align-items: center; height: 24px; padding: 0 10px; border-radius: 999px; font-size: 12px;
  background: var(--pill-neutral-bg); color: var(--pill-neutral-ink); white-space: nowrap; }
.chip[data-mode="live"] { background: var(--pill-negative-bg); color: var(--pill-negative-ink); }
.tag { display: inline-flex; align-items: center; height: 20px; padding: 0 8px; border-radius: 999px; font-size: 12px; font-weight: 500;
  background: var(--pill-neutral-bg); color: var(--pill-neutral-ink); white-space: nowrap; flex: none; }
.tag.buy { background: var(--pill-positive-bg); color: var(--pill-positive-ink); }
.tag.sell { background: var(--pill-negative-bg); color: var(--pill-negative-ink); }
.tag.block { background: var(--pill-warning-bg); color: var(--pill-warning-ink); }
.pos { color: var(--positive); } .neg { color: var(--negative); }

.alert { margin-bottom: 20px; padding: 10px 14px; border-radius: var(--radius-card); background: var(--pill-negative-bg); color: var(--pill-negative-ink); font-size: 13px; }

/* ---------- Der Kern ---------- */
.core-card { display: flex; flex-direction: column; }
.core { position: relative; width: min(100%, 300px); aspect-ratio: 1; margin: 0 auto; }
.core svg { width: 100%; height: 100%; display: block; }
.core .track { stroke: var(--raised); }
.core .arc { stroke: var(--pulse); transition: stroke-dasharray .9s cubic-bezier(.2,.8,.2,1), stroke .4s; }
.core .kill-mark { stroke: var(--negative); }
.core .base-mark { stroke: var(--muted); }
.core .ecg { fill: none; stroke: var(--pulse); stroke-width: 2.5; stroke-linejoin: round; stroke-dasharray: 520; animation: beat 2.4s linear infinite; }
body[data-status="paused"] .core .ecg { animation-duration: 5s; }
body[data-status="killed"] .core .ecg { animation: none; stroke-dasharray: none; }
@keyframes beat { from { stroke-dashoffset: 1040; } to { stroke-dashoffset: 0; } }
@media (prefers-reduced-motion: reduce) { .core .ecg { animation: none; stroke-dasharray: none; } .core .arc { transition: none; } }
.core-label { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; padding-top: 92px; pointer-events: none; }
.core .state { font-size: 20px; line-height: 24px; font-weight: 600; color: var(--pulse); }
.core .vital { font-size: 13px; color: var(--muted); margin-top: 2px; }
.core-figures { display: grid; grid-template-columns: repeat(3, 1fr); margin: 12px 0 0; border-top: 1px solid var(--rule); }
.core-figures div { padding: 12px 0 0; }
.core-figures div + div { padding-left: 12px; border-left: 1px solid var(--rule); }
.core-figures dt { font-size: 12px; color: var(--muted); }
.core-figures dd { margin: 2px 0 0; font-size: 15px; }

/* ---------- Kapital ---------- */
.kpis { display: grid; grid-template-columns: 1.6fr 1fr 1fr 1fr; margin: -4px 0 16px; }
.kpi { display: flex; flex-direction: column; gap: 4px; padding: 0 16px; border-left: 1px solid var(--rule); }
.kpi:first-child { padding-left: 0; border-left: 0; }
.kpi-label { font-size: 12px; color: var(--muted); }
.kpi-value { font-size: 20px; line-height: 28px; font-weight: 500; }
.kpi.lead .kpi-value { font-size: 32px; line-height: 40px; font-weight: 600; letter-spacing: -0.02em; }
.kpi-value small { font-size: 13px; color: var(--muted); font-weight: 400; margin-left: 6px; letter-spacing: 0; }
.chart { position: relative; min-height: 240px; font-family: var(--mono); }
.chart text { font-family: var(--mono); }

/* ---------- Tabellen ---------- */
.scroll { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th { height: 38px; padding: 0 12px 0 0; text-align: left; font-size: 12px; font-weight: 400; color: var(--muted); white-space: nowrap; }
.table th.num, .table td.num { text-align: right; padding-left: 12px; }
.table th:last-child, .table td:last-child { padding-right: 0; }
.table td { height: var(--row-height); padding: 6px 12px 6px 0; border-top: 1px solid var(--rule); vertical-align: middle; }
.table td.num small, .table td small { display: block; font-size: 12px; line-height: 16px; color: var(--muted); }
.table .id { font-weight: 600; }
.table td.act { width: 1%; text-align: right; }
.table td .rules { color: var(--muted); font-size: 12px; line-height: 16px; display: block; max-width: 46ch; }
.table tr:hover td { background: #16151a; }
.ghost { height: 28px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--control); background: none; color: var(--text); font-size: 12px; cursor: pointer; }
.ghost:hover { border-color: var(--negative); color: var(--negative); }

/* ---------- Listen ---------- */
.log { list-style: none; margin: 0; padding: 0; }
.log li { display: grid; grid-template-columns: 48px 1fr; gap: 12px; padding: 5px 0; line-height: 18px; border-top: 1px solid var(--rule); }
.log.short li span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.log li:first-child { border-top: 0; }
.log time { color: var(--muted); font-size: 12px; }
.log .warn { color: var(--warning); } .log .error, .log .critical { color: var(--negative); }
.log.cols { columns: 2; column-gap: 40px; }
.log.cols li { break-inside: avoid; }
.kv { list-style: none; margin: 0; padding: 0; }
.kv li { display: flex; justify-content: space-between; gap: 12px; height: 28px; align-items: center; border-top: 1px solid var(--rule); }
.kv li:first-child { border-top: 0; }
.kv .id { font-weight: 600; }
.kv .v { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.kv .v small { color: var(--muted); margin-left: 4px; }
.movers { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.pairs { margin: 0; }
.pairs div { display: flex; justify-content: space-between; gap: 12px; height: 32px; align-items: center; border-top: 1px solid var(--rule); }
.pairs div:first-child { border-top: 0; }
.pairs dt { color: var(--muted); }
.pairs dd { margin: 0; text-align: right; }

.headlines { list-style: none; margin: 0; padding: 0; columns: 2; column-gap: 40px; }
.headlines li { break-inside: avoid; display: grid; grid-template-columns: 10px 1fr; gap: 10px; padding: 8px 0; border-top: 1px solid var(--rule); }
.headlines a { color: var(--text); text-decoration: none; }
.headlines a:hover { text-decoration: underline; text-decoration-color: var(--accent); }
.headlines small { display: block; color: var(--muted); font-size: 12px; }
.dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--control); margin-top: 7px; }
.dot.pos { background: var(--positive); } .dot.neg { background: var(--negative); }
.legend-inline { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 4px 6px; font-size: 12px; color: var(--muted); }
.legend-inline .dot { margin: 0 2px 0 8px; }

/* ---------- Konto ---------- */
.cashform { margin: 16px 0 4px; }
.cashform label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.cashform input { width: 100%; height: var(--control-height); padding: 0 12px; border-radius: var(--radius-card); border: 1px solid var(--control); background: var(--ground); font-family: var(--mono); }
.cashrow { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px; }

/* ---------- Familienbaum ---------- */
.famtree .card-head { align-items: center; }
.legend-inline .lg { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin: 0 2px 0 8px; }
.lg-agent { background: var(--accent); }
.lg-live { background: #f2f2f3; }
.lg-pending { border: 1.5px solid var(--warning); }
.lg-dead { background: var(--control); }
.lg-gone { border: 1.5px solid var(--negative); }
.lg-path { width: 16px !important; height: 2px !important; border-radius: 1px !important; background: var(--accent); }
.ft-body { display: grid; grid-template-columns: 1fr 300px; gap: var(--gap); align-items: start; }
.ft-canvas { min-height: 260px; border-radius: var(--radius-card); background: var(--ground); overflow: hidden; }
.ft-canvas svg { display: block; width: 100%; height: auto; }
.ft-node { cursor: pointer; }
.ft-node:focus { outline: none; }
.ft-node:focus-visible .ft-dot, .ft-node.sel .ft-dot { stroke: var(--text); stroke-width: 2; }
.ft-node:hover .ft-dot { opacity: .8; }
.ft-label { font: 500 11px var(--mono); fill: var(--muted); pointer-events: none; }
.ft-label.strong { fill: var(--text); }
.ft-fam { font: 600 13px var(--font); fill: var(--text); }
.ft-famsub { font: 400 11px var(--font); fill: var(--muted); }
.ft-link { fill: none; stroke: #2c2b31; stroke-width: 1; }
.ft-link.path { stroke: var(--accent); stroke-width: 2; }
.ft-ring { fill: none; stroke: var(--accent); stroke-width: 1; }
.ft-pulse { display: none; }
.ft-card { background: var(--raised); border-radius: var(--radius-card); padding: 16px; position: sticky; top: 16px; }
.ft-card h3 { margin: 0 0 2px; font-size: 16px; font-weight: 600; }
.ft-card .ft-fam-line { color: var(--muted); font-size: 12px; margin-bottom: 10px; }
.ft-card dl { margin: 10px 0; }
.ft-card dl div, .ft-card dl > dt { }
.ft-card dl { display: grid; grid-template-columns: auto 1fr; column-gap: 12px; }
.ft-card dt { color: var(--muted); padding: 4px 0; border-top: 1px solid var(--rule); }
.ft-card dd { margin: 0; text-align: right; padding: 4px 0; border-top: 1px solid var(--rule); font-family: var(--mono); font-variant-numeric: tabular-nums; }
.ft-card .ft-rules { font-family: var(--mono); font-size: 12px; line-height: 18px; color: var(--text); background: var(--surface); border-radius: var(--radius-card); padding: 8px 10px; }
.ft-card .ft-links { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.ft-card .ft-links button { height: 26px; padding: 0 10px; border-radius: 999px; border: 1px solid var(--control); background: none; font-size: 12px; cursor: pointer; }
.ft-card .ft-links button:hover { border-color: var(--accent); }
.ft-card .ft-path { margin-top: 10px; font-size: 12px; color: var(--accent); }
.ft-hint { color: var(--muted); margin: 0; }

/* ---------- Dialog ---------- */
dialog { background: var(--raised); color: var(--text); border: 0; border-radius: 8px; padding: 24px; width: min(420px, calc(100% - 32px)); box-shadow: 0 24px 48px rgba(0,0,0,.5); }
dialog::backdrop { background: rgba(0,0,0,.6); }
dialog h2 { margin: 0 0 8px; font-size: 18px; }
dialog p { color: var(--muted); margin: 0 0 16px; }
dialog label { font-size: 12px; color: var(--muted); }
dialog input { display: block; width: 100%; height: var(--control-height); margin: 6px 0 16px; padding: 0 12px; border-radius: var(--radius-card); border: 1px solid var(--control); background: var(--ground); font-family: var(--mono); }
dialog .actions { display: flex; justify-content: flex-end; gap: 8px; }

/* ---------- Login ---------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login { width: min(100%, 340px); }
.login svg { width: 44px; height: 44px; margin-bottom: 20px; }
.login h1 { margin-bottom: 4px; }
.login p { color: var(--muted); margin: 0 0 20px; font-size: 14px; }
.login label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.login input { width: 100%; height: 40px; padding: 0 12px; border-radius: var(--radius-card); border: 1px solid var(--control); background: var(--surface); }
.login .btn { width: 100%; height: 40px; margin-top: 12px; }
.login .err { color: var(--negative); font-size: 13px; margin-top: 12px; }

/* ---------- Tablet und Handy ---------- */
@media (max-width: 1100px) {
  .span-4, .span-5, .span-7, .span-8 { grid-column: span 12; }
  .span-6 { grid-column: span 12; }
  .grid { align-items: start; }
  .core-card { display: grid; grid-template-columns: minmax(200px, 260px) 1fr; column-gap: 24px; align-items: center; }
  .core-card .card-title { grid-column: 1 / -1; }
  .core-figures { grid-template-columns: 1fr; border-top: 0; margin: 0; }
  .core-figures div, .core-figures div + div { padding: 10px 0; border-left: 0; border-top: 1px solid var(--rule); }
  .ft-body { grid-template-columns: 1fr; }
  .ft-card { position: static; }
}
@media (max-width: 720px) {
  :root { --pad: 16px; --gap: 16px; }
  .app { grid-template-columns: 1fr; }
  .rail {
    position: fixed; top: auto; bottom: 0; left: 0; right: 0; height: 60px; z-index: 10; flex-direction: row; justify-content: space-around;
    padding: 0 12px env(safe-area-inset-bottom); border-right: 0; border-top: 1px solid var(--border);
  }
  .brand { display: none; }
  .nav { width: auto; flex: 1; height: 60px; gap: 2px; align-content: center; }
  .nav span { display: block; font-size: 11px; line-height: 14px; }
  .nav[aria-current="page"]::after { left: 30%; right: 30%; top: 0; bottom: auto; width: auto; height: 1px; }
  .rail-foot { margin: 0; flex: 1; display: flex; }
  .rail-foot .nav { flex: 1; }
  .canvas { padding: 20px var(--pad) 88px; }
  h1 { font-size: 22px; line-height: 28px; }
  .title-actions { width: 100%; }
  .title-actions .btn { flex: 1; height: 44px; }
  .core-card { display: flex; }
  .core { width: min(100%, 260px); }
  .core-figures { grid-template-columns: repeat(3, 1fr); border-top: 1px solid var(--rule); margin-top: 8px; }
  .core-figures div, .core-figures div + div { border-top: 0; padding: 10px 0 0; }
  .core-figures div + div { padding-left: 10px; border-left: 1px solid var(--rule); }
  .kpis { grid-template-columns: 1fr 1fr; row-gap: 14px; }
  .kpi.lead { grid-column: 1 / -1; padding: 0; border: 0; }
  .kpi:nth-child(2) { padding-left: 0; border-left: 0; }
  .kpi:nth-child(4) { grid-column: 1 / -1; padding-left: 0; border-left: 0; }
  .movers { grid-template-columns: 1fr; gap: 12px; }
  .log.cols, .headlines { columns: 1; }
  .table thead { display: none; }
  .table tr { display: grid; grid-template-columns: 1fr auto; column-gap: 12px; padding: 8px 0; border-top: 1px solid var(--rule); }
  .table td { height: auto; padding: 0; border: 0; }
  .table td.num { text-align: right; padding: 0; }
  .table td[data-label]::before { content: attr(data-label); display: block; font-family: var(--font); font-size: 11px; line-height: 14px; color: var(--muted); }
  .table td:first-child::before { display: none; }
  .table td.act { grid-column: 1 / -1; text-align: left; padding-top: 8px; }
  .card { padding: 16px; }
}
