:root {
  --bg: #11161c; --panel: #1a222b; --panel2: #222c37; --line: #2e3a47; --text: #e8edf2; --muted: #93a1b0;
  --accent: #8b7bff; --accent-text: #0f0b2e; --ok: #37c583; --bad: #f0616d; --warn: #e9b949;
  --radius: 12px; --gap: 16px;
  color-scheme: dark;
}
/* Hell: Systemeinstellung (außer explizit „dunkel“ gewählt) oder explizite Wahl „hell“ (theme.js) */
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) { --bg: #f3f5f8; --panel: #ffffff; --panel2: #eef1f5; --line: #d5dce4; --text: #17202a; --muted: #5d6b7a;
    --accent: #5a48e0; --accent-text: #ffffff; --ok: #14804a; --bad: #c62f3b; --warn: #8a6100;
    color-scheme: light; }
}
:root[data-theme="light"] { --bg: #f3f5f8; --panel: #ffffff; --panel2: #eef1f5; --line: #d5dce4; --text: #17202a; --muted: #5d6b7a;
    --accent: #5a48e0; --accent-text: #ffffff; --ok: #14804a; --bad: #c62f3b; --warn: #8a6100;
    color-scheme: light; }
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  padding-bottom: env(safe-area-inset-bottom);
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.5rem; margin: 0; line-height: 1.2; overflow-wrap: anywhere; }
h2 { font-size: 1.1rem; margin: 0 0 8px; }
h3 { font-size: 1rem; margin: 0; }
p { margin: 0 0 10px; }
code, pre { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .9em; }
pre { background: var(--panel2); padding: 10px; border-radius: 8px; overflow-x: auto; margin: 0 0 10px; }
.wrapany { overflow-wrap: anywhere; }
small, .small { font-size: .85rem; }
.muted { color: var(--muted); }
.pos { color: var(--ok); }
.neg { color: var(--bad); }
.center { text-align: center; }
.nowrap { white-space: nowrap; }

.top {
  display: flex; align-items: center; gap: 20px; padding: 10px 16px; background: var(--panel);
  border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5;
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; color: var(--text); font-size: 1.1rem; }
.nav { display: flex; gap: 4px; flex-wrap: wrap; }
.nav a, .tabs a { padding: 8px 12px; border-radius: 8px; color: var(--muted); font-weight: 500; }
.nav a.on, .tabs a.on { background: var(--panel2); color: var(--text); }
.nav a:hover, .tabs a:hover { text-decoration: none; color: var(--text); }
.nav a { display: inline-flex; align-items: center; gap: 7px; }
.nav svg, .themetoggle svg { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8;
  stroke-linecap: round; stroke-linejoin: round; }

/* Hell/Dunkel-Umschalter (theme.js), rechts in der Kopfzeile: zeigt das Ziel – Sonne im dunklen, Mond im hellen Design */
.themetoggle { margin-left: auto; display: inline-flex; align-items: center; gap: 7px; padding: 8px 12px; border: 0;
  border-radius: 8px; background: none; color: var(--muted); font: inherit; font-weight: 500; cursor: pointer; }
.themetoggle:hover { color: var(--text); background: var(--panel2); }
.themetoggle .to-light, .themetoggle .to-dark { display: contents; }
.themetoggle .to-dark { display: none; }
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) .themetoggle .to-light { display: none; }
  :root:not([data-theme="dark"]) .themetoggle .to-dark { display: contents; }
}
:root[data-theme="light"] .themetoggle .to-light { display: none; }
:root[data-theme="light"] .themetoggle .to-dark { display: contents; }
.wrap { max-width: 1100px; margin: 0 auto; padding: 16px; }
.head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin: 4px 0 14px; flex-wrap: wrap; }
.head p { margin: 4px 0 0; }
.tabs { display: flex; gap: 2px; overflow-x: auto; margin: 0 0 14px; padding-bottom: 4px; scrollbar-width: thin; }
.tabs a { white-space: nowrap; }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin: 0 0 var(--gap); }
.card.narrow { max-width: 440px; margin: 24px auto; }
.grid { display: grid; gap: var(--gap); grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.card.bot { color: var(--text); display: block; margin: 0; }
.card.bot:hover { text-decoration: none; border-color: var(--accent); }
.row { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.stack > * + * { margin-top: 12px; }

.badge { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: .78rem; font-weight: 600;
  background: var(--panel2); color: var(--muted); border: 1px solid var(--line); vertical-align: middle; }
.badge.ok { color: var(--ok); border-color: var(--ok); }
.badge.bad { color: var(--bad); border-color: var(--bad); }
.badge.warn { color: var(--warn); border-color: var(--warn); }

.kv { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 14px; margin: 10px 0 0; }
.kv.wide { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); margin: 12px 0; }
.kv div { min-width: 0; }
.kv dt { color: var(--muted); font-size: .8rem; }
.kv dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; min-height: 40px; padding: 8px 14px;
  border-radius: 9px; border: 1px solid var(--line); background: var(--panel2); color: var(--text);
  font: inherit; font-weight: 600; cursor: pointer; text-align: center;
}
.btn:hover { border-color: var(--accent); text-decoration: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.btn.danger { color: var(--bad); border-color: var(--bad); background: transparent; }
.btn.small { min-height: 34px; padding: 4px 10px; font-size: .9rem; }
.btn[disabled] { opacity: .6; cursor: progress; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0; }
.actions form { margin: 0; }

.fields { display: grid; gap: 12px 16px; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); align-items: start; }
.field { min-width: 0; border: 0; padding: 0; margin: 0; }
.field label, .field legend { display: block; font-weight: 600; font-size: .92rem; margin-bottom: 4px; padding: 0; }
.field small { display: block; color: var(--muted); margin-top: 3px; }
.field.check label { font-weight: 500; display: flex; gap: 8px; align-items: flex-start; }
.unit { color: var(--muted); font-weight: 400; }
.option { display: flex !important; gap: 10px; align-items: flex-start; font-weight: 500 !important; padding: 6px 0; }
input[type=text], input[type=password], input[type=date], input[type=file], select, textarea {
  width: 100%; min-height: 40px; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--bg); color: var(--text); font: inherit;
}
input[type=checkbox], input[type=radio] { width: 18px; height: 18px; margin-top: 3px; flex: none; accent-color: var(--accent); }
textarea { resize: vertical; }
form.inline, .inline-forms { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: flex-end; margin: 8px 0; }
form.inline label { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: .92rem; }
form.inline input[type=text], form.inline select, form.inline input[type=file] { width: auto; max-width: 100%; }
form.i { display: inline; }
.sticky { position: sticky; bottom: 0; padding: 10px 0; background: linear-gradient(transparent, var(--bg) 35%); display: flex; gap: 8px; z-index: 2; }

details.section > summary, details.pos > summary, details.more > summary { cursor: pointer; list-style: none; }
details.section > summary::-webkit-details-marker, details.pos > summary::-webkit-details-marker { display: none; }
details.section > summary h2 { display: inline; }
details.section > summary::before, details.pos > summary::before { content: "▸"; display: inline-block; width: 1.1em; color: var(--muted); }
details[open].section > summary::before, details[open].pos > summary::before { content: "▾"; }
details.section[open] > summary { margin-bottom: 10px; }
details.pos { border-top: 1px solid var(--line); padding: 10px 0; }
details.pos > summary { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; font-variant-numeric: tabular-nums; }
details.pos .sym { font-weight: 700; flex: 1 1 auto; }
details.more { border-top: 1px solid var(--line); padding-top: 10px; margin-top: 8px; color: var(--muted); }
.ind { border-top: 1px solid var(--line); padding: 14px 0; }

.scroll { overflow-x: auto; }
.scroll.tall { max-height: 520px; overflow-y: auto; }
table { width: 100%; border-collapse: collapse; font-size: .92rem; font-variant-numeric: tabular-nums; }
th, td { text-align: left; padding: 7px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: .82rem; white-space: nowrap; }
td.r, th.r { text-align: right; }
tbody tr:last-child td { border-bottom: 0; }

.flash { padding: 10px 14px; border-radius: 9px; margin: 0 0 14px; border: 1px solid var(--line); background: var(--panel2); overflow-wrap: anywhere; }
.flash.ok { border-color: var(--ok); }
.flash.error { border-color: var(--bad); color: var(--bad); }
.flash.warn { border-color: var(--warn); color: var(--warn); }
.log { list-style: none; margin: 0; padding: 0; font-size: .9rem; }
.log li { padding: 5px 0; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.log li:last-child { border-bottom: 0; }
.log time { color: var(--muted); margin-right: 6px; font-variant-numeric: tabular-nums; }
.log .warn { color: var(--warn); }
.log .error { color: var(--bad); }
.chart { height: 260px; width: 100%; margin: 8px 0; }
.chart.big { height: 440px; }
.chart .empty { color: var(--muted); padding: 40px 0; text-align: center; }
.qr { background: #fff; border-radius: 10px; padding: 6px; }
[hidden] { display: none !important; }

@media (max-width: 760px) {
  .top { position: static; padding: 10px 12px; }
  .nav {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; background: var(--panel); border-top: 1px solid var(--line);
    justify-content: space-around; flex-wrap: nowrap; padding: 4px 2px calc(4px + env(safe-area-inset-bottom));
  }
  .nav a { padding: 6px 2px; font-size: .72rem; flex: 1 1 0; text-align: center; min-width: 0;
    flex-direction: column; gap: 2px; }
  .nav svg { width: 22px; height: 22px; }
  body { padding-bottom: calc(76px + env(safe-area-inset-bottom)); }
  .wrap { padding: 12px; }
  .card { padding: 13px; }
  .sticky { bottom: calc(68px + env(safe-area-inset-bottom)); }
  .chart.big { height: 340px; }
}

progress { width: 100%; height: 10px; accent-color: var(--accent); }

/* Aufbau und Maße wie in crybot (Klasse .cbl): Seiten „Bots“ und „Steuer“. Farben bleiben die von cryhob. */
.cbl h1 { font-size: 1.6rem; margin: 0 0 .25rem; letter-spacing: -.02em; }
.cbl h2 { font-size: 1.05rem; margin: 0 0 .5rem; }
.cbl p { margin: 0 0 .75rem; }
.cbl a:not(.btn) { color: inherit; text-decoration: underline; }
.cbl .card { padding: 18px; margin: 0 0 16px; border-radius: 14px; }
.cbl .row { align-items: flex-start; gap: 12px; }
.cbl .btn { min-height: 44px; padding: 0 18px; border-radius: 10px; white-space: nowrap; }
.cbl .btn:hover { text-decoration: none; }
.cbl form.inline { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; margin: 0; }
.cbl form.inline label { display: flex; flex-direction: column; align-items: stretch; flex-wrap: nowrap; gap: 6px; flex: 1 1 180px; font-weight: 600; font-size: .92rem; }
.cbl form.inline select { width: 100%; min-height: 46px; padding: 0 12px; border-radius: 10px; }
.cbl form.inline label.check { flex-direction: row; align-items: flex-start; gap: 10px; font-weight: 400; flex: 1 1 260px; align-self: center; }
.cbl input[type=checkbox] { width: 20px; height: 20px; min-height: 20px; margin: 0; }
.cbl .downloads { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.cbl .meta { font-size: .82rem; margin: 0; }
.cbl .downloads + .meta { margin-top: 12px; }
.cbl .flash { padding: 12px 14px; border-radius: 10px; margin: 0 0 14px; border: 1px solid var(--line); border-left: 4px solid var(--ok); background: var(--panel); color: var(--text); }
.cbl .flash.warn { border-left-color: var(--warn); }
.cbl .badge { display: inline; font-size: .72rem; font-weight: 700; padding: 2px 8px; background: none; text-transform: uppercase; letter-spacing: .04em; vertical-align: baseline; }
.cbl .badge.on { color: var(--ok); border-color: var(--ok); }
.tiles { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); margin-bottom: 16px; }
.tile { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 14px; display: flex; flex-direction: column; min-width: 0; }
.tile .label { color: var(--muted); font-size: .8rem; }
.tile .value { font-size: 1.35rem; font-weight: 700; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.tile .sub { font-size: .8rem; color: var(--muted); }
.cbl .scroll { overflow-x: auto; margin: 0 -18px; padding: 0 18px; }
.cbl table { font-size: .9rem; }
.cbl th, .cbl td { padding: 9px 10px 9px 0; white-space: nowrap; vertical-align: baseline; }
.cbl th { font-weight: 500; font-size: .8rem; }
.cbl .r { text-align: right; }
.plist { list-style: none; margin: 0 0 12px; padding: 0; }
.plist li { padding: 12px 0; border-top: 1px solid var(--line); overflow-wrap: anywhere; }
.plist li:first-child { border-top: 0; padding-top: 0; }
.plist .row { align-items: center; flex-wrap: nowrap; margin-bottom: 6px; }
.plist .row > div { min-width: 0; }
.plist p { margin: 0 0 4px; font-size: .92rem; }
.plist .meta { font-size: .82rem; margin: 0; }
.notes { margin: 0; padding-left: 20px; } .notes li { margin: 0 0 8px; font-size: .92rem; }
/* Bots-Übersicht */
.cbl .head { align-items: flex-start; margin: 0 0 16px; }
.cbl .actions { display: flex; gap: 8px; align-items: center; margin: 0; }
.cbl .btn.stop { background: transparent; border-color: var(--bad); color: var(--bad); }
.cbl .btn.small { min-height: 36px; padding: 0 12px; font-size: .9rem; }
.cbl .badge.live { color: #fff; background: var(--bad); border-color: var(--bad); }
.cbl .card.empty { text-align: left; max-width: 640px; }
.cbl .steps { padding-left: 1.2rem; margin: 0 0 1rem; } .cbl .steps li { margin-bottom: .5rem; }
.tile .sub.pos { color: var(--ok); } .tile .sub.neg { color: var(--bad); }
.cbl .grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); margin-bottom: 16px; }
.cbl .card.bot { margin: 0; display: flex; flex-direction: column; gap: 8px; padding: 12px 14px 10px; }
.cbl .card.bot:hover { border-color: var(--line); }
.cbl a.botlink { text-decoration: none; display: block; flex: 1; color: var(--text); }
.cbl .bot h2 { margin: 0; font-size: 1rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.cbl .bot .row { flex-wrap: nowrap; align-items: baseline; gap: 10px; }
.cbl .bot .row > :first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cbl .bot .row > :last-child { flex: none; font-variant-numeric: tabular-nums; }
.cbl .bot .row.sub { font-size: .86rem; color: var(--muted); margin-top: 2px; }
.cbl .bot .row.sub .pos { color: var(--ok); } .cbl .bot .row.sub .neg { color: var(--bad); }
.cbl .sym { color: var(--text); font-weight: 700; }
.cbl .bot .worth { color: var(--text); font-weight: 600; }
.cbl .pnl { font-weight: 700; font-variant-numeric: tabular-nums; }
.cbl .bot .status { color: var(--muted); font-size: .8rem; margin: 6px 0 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cbl .bot .status.error { color: var(--bad); }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--line); margin-right: 7px; vertical-align: 1px; }
.dot.on { background: var(--ok); }
.cbl .bot h2 .badge { font-size: .62rem; padding: 1px 6px; vertical-align: 2px; }
.cbl .botfoot { display: flex; align-items: center; gap: 6px; border-top: 1px solid var(--line); padding-top: 8px; }
.cbl .botfoot form { margin: 0; }
.cbl .botfoot .botmeta { flex: 1; min-width: 0; color: var(--muted); font-size: .74rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cbl .botfoot .btn { width: auto; min-height: 30px; padding: 0 10px; font-size: .8rem; border-radius: 8px; background: transparent; }
.cbl .botfoot .btn.primary { background: var(--accent); }
.cbl .poslist .row > div:first-child { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cbl .poslist a { text-decoration: none; }
.cbl .poslist form { margin: 0; }
.cbl .posnum { font-weight: 700; font-variant-numeric: tabular-nums; flex: none; }
.cbl .meta .pos { color: var(--ok); } .cbl .meta .neg { color: var(--bad); }
.cbl .side { font-weight: 700; } .cbl .side.buy { color: var(--ok); } .cbl .side.sell { color: var(--bad); }
