:root {
  --bg: #0f1115;
  --bg2: #161a22;
  --bg3: #1d232e;
  --border: #2a3140;
  --text: #e6eaf2;
  --muted: #8b93a7;
  --accent: #f0b90b;
  --accent-2: #2ecd71;
  --danger: #e05252;
  --warn: #e8a13c;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", -apple-system, "Segoe UI", Roboto, sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding-bottom: 64px;   /* Platz für den fixierten Footer — Inhalt endet immer davor */
}

a { color: var(--accent); text-decoration: none; }
.pair-link { text-decoration: none; }
.pair-link:hover { text-decoration: underline; filter: brightness(1.2); }
a:hover { text-decoration: underline; }

/* ---------------------------------------------------------------- Footer */
.footer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  text-align: center;
  padding: 12px 16px 14px;
  color: var(--text);              /* Versionsnummer gut lesbar (vorher muted + 85 %-Opacity) */
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
  pointer-events: none;
  background: var(--bg2);          /* gleiche Farbe wie Kopfzeile (nav) — kein Transparent-Gradient */
  border-top: 1px solid var(--border);
}

/* Test-Statuszeilen neben den Verbindung-testen-Buttons */
.test-status {
  margin-top: 10px;
  font-size: 13px;
  color: var(--muted);
  min-height: 18px;
}
.test-status.ok { color: var(--accent-2); }
.test-status.err { color: var(--danger); }

/* ---------------------------------------------------------------- Navbar */

/* Nummernfelder (z. B. SMTP-Port) ohne native Spinner-Pfeile */
input[type="number"] {
  -moz-appearance: textfield;
  appearance: textfield;
}
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.nav {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 12px 24px;
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}
.nav .logo {
  font-weight: 800;
  font-size: 17px;
  letter-spacing: 0.3px;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}
.nav .logo svg { color: var(--accent); }
.nav .spacer { flex: 1; }
.nav a.nav-link {
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
  padding: 7px 12px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  gap: 7px;
}
.nav a.nav-link:hover { color: var(--text); background: var(--bg3); text-decoration: none; }
.nav .user-chip {
  font-size: 13px;
  color: var(--muted);
  background: var(--bg3);
  padding: 6px 12px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  gap: 7px;
}
.nav .user-chip .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent-2); }
.nav .logout-btn svg { color: var(--danger); }
/* v0.0.57: Navigations-Container (Desktop: wie bisher; Mobile: zweite Zeile mit Tabs) */
.nav-links { display: flex; align-items: center; gap: 14px; flex: 1; min-width: 0; }
.nav-links .spacer { flex: 1; }

/* v0.0.80: Börsen-Switcher — eigene Übersichts-/Einstellungsseiten je Börse */
.ex-switch { display: flex; gap: 6px; padding: 3px; background: var(--bg2);
  border: 1px solid var(--border); border-radius: 10px; flex-shrink: 0; }
.ex-tab { padding: 5px 13px; border-radius: 8px; font-size: 13px; font-weight: 600;
  color: var(--muted); border: 1px solid transparent; text-decoration: none; white-space: nowrap; }
.ex-tab:hover { border-color: var(--accent-2); color: var(--text); text-decoration: none; }
.ex-tab.active { background: var(--bg3); color: #fff; }
@media (max-width: 760px) {
  /* v0.0.83: ex-switch liegt jetzt IN .nav-links → Umbruch braucht flex-wrap
     (behebt zugleich das v0.0.80-Risiko: 100%-Breite ohne wrap = Overflow 641–760 px) */
  .nav { flex-wrap: wrap; }
  .nav .nav-links { flex-wrap: wrap; }
  .ex-switch { width: 100%; justify-content: stretch; }
  .ex-tab { flex: 1; text-align: center; }
  /* v0.0.83: Touch-Ziele auf Handy/Tablet ≥ 44 px (wie nav-link-Tabs) */
  .ex-tab { min-height: 44px; display: flex; align-items: center; justify-content: center; }
}

/* ---------------------------------------------------------------- Layout */
/* v0.0.102: 1080px → 1440px — Tabellen (Ranking/Trades/Bars) brauchen auf
   Desktop-Displays die volle Breite statt horizontaler Scrollbar. */
.wrap { width: 100%; max-width: 1440px; margin: 0 auto; padding: 28px 24px 60px; flex: 1; }
.center-wrap {
  width: 100%;
  max-width: 1440px;
  margin: 0 auto;
  padding: 28px 24px 60px;
  flex: 1;
}

/* ---------------------------------------------------------------- Karten */
.card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 22px;
  margin-bottom: 20px;
}
.card h2 {
  font-size: 16px;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 9px;
}
.card h3 { font-size: 13px; color: var(--muted); font-weight: 500; margin-bottom: 16px; }
.card .desc { color: var(--muted); font-size: 13px; margin-bottom: 14px; }
.card .badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--bg3);
  color: var(--muted);
  margin-left: 8px;
}
.badge.ok { color: var(--accent-2); background: rgba(46, 205, 113, 0.12); }
.badge.off { color: var(--warn); background: rgba(232, 161, 60, 0.12); }
.badge.on { color: var(--danger); background: rgba(224, 82, 82, 0.12); }
/* v0.0.189: Burst-Trade-Badge (lila-akzentuiert, gedimmt-auffällig) */
.badge.burst-badge { color: #d2a8ff; background: rgba(188, 108, 255, 0.14); font-size: 10px; margin-left: 5px; vertical-align: 1px; }
/* v0.0.190: Eröffnungs-Grund in der Offene-Positionen-Liste — Signal (grün) vs. BURST (lila) */
.badge.signal-badge { color: var(--accent-2); background: rgba(46, 205, 113, 0.12); font-size: 10px; margin-left: 5px; vertical-align: 1px; }

/* ---------------------------------------------------------------- Phase 3: Statistik & Fortschritt */
.stat {
  font-size: 26px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 6px;
  letter-spacing: -0.5px;
}
.stat.sub { font-size: 15px; color: var(--muted); font-weight: 500; }
.bar {
  height: 10px;
  border-radius: 6px;
  background: var(--bg3);
  border: 1px solid var(--border);
  overflow: hidden;
  margin: 6px 0 8px;
}
.bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-2), var(--accent));
  border-radius: 6px;
  transition: width 0.6s ease;
}
.bar-fill.over { background: linear-gradient(90deg, var(--warn), var(--danger)); }

/* ---------------------------------------------------------------- Formulare */
label { display: block; font-size: 13px; font-weight: 600; color: var(--muted); margin: 12px 0 6px; }
input[type="text"], input[type="password"], input[type="number"], input[type="email"], select {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 9px;
  padding: 10px 13px;
  font-size: 14px;
  outline: none;
}
input:focus, select:focus { border-color: var(--accent); }
.hint { font-size: 12px; color: var(--muted); margin-top: 5px; }

/* ---------------------------------------------------------------- Buttons (rund, SVG-Icons, nie disabled) */
.btn {
  display: inline-flex;
  position: relative;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid var(--border);
  background: var(--bg3);
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
  padding: 10px 20px;
  border-radius: 999px;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.2s ease, border-color 0.2s ease,
              background 0.2s ease, filter 0.2s ease, opacity 0.2s ease;
}
.btn:hover {
  border-color: var(--accent);       /* Rahmen erscheint — kein Anheben, keine Vergrößerung */
  filter: brightness(1.15);
}
.btn:active {
  transform: translateY(2px);        /* Drücken: leicht nach unten (nie verbreitert) */
  filter: brightness(0.88);
  box-shadow: none;
  transition-duration: 0.05s;        /* Press spürbar sofort */
}
/* Nur-Optik „läuft“ — Button bleibt klickbar (nie disabled), Größe bleibt konstant */
.btn.busy { opacity: 0.75; cursor: progress; }
.btn.busy > * { visibility: hidden; }      /* Inhalt ausblenden, Breite bleibt */
.btn.busy::after {
  content: '';
  position: absolute;                      /* überlagert: kein Breiten-Sprung */
  top: 50%;
  left: 50%;
  width: 15px;
  height: 15px;
  margin: -7.5px 0 0 -7.5px;
  border: 2px solid rgba(140, 140, 140, 0.4);
  border-top-color: currentColor;
  border-radius: 50%;
  animation: btnspin 0.7s linear infinite;
}
@keyframes btnspin { to { transform: rotate(360deg); } }
.btn svg { flex-shrink: 0; }
.btn.primary { background: var(--bg3); color: #fff; border-color: var(--border); }
/* Primary-Hover: NUR grüner Rahmen (var(--accent-2) — „ansprechendes Grün“, Nutzer 01.09.); kein Aufhellen, kein Anheben/Vergrößern; Background wie Test-/Lösch-Buttons (--bg3), Schrift weiß */
.btn.primary:hover { border-color: var(--accent-2); filter: none; }
/* Nur-Optik-Zustand (Button bleibt klickbar — nie disabled) */
.btn.btn-muted { opacity: 0.55; }
.btn.btn-muted:hover { opacity: 0.85; }
.btn.danger { color: var(--danger); }
.btn.danger:hover { border-color: var(--danger); }
.btn.small { padding: 6px 14px; font-size: 13px; }
.btn.block { width: 100%; }
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  background: var(--bg3);
  color: var(--muted);
  width: 42px;
  height: 42px;
  border-radius: 50%;
  cursor: pointer;
  transition: transform 0.12s ease, color 0.15s ease, border-color 0.15s ease,
              background 0.15s ease, box-shadow 0.2s ease;
}
.icon-btn:hover {
  color: var(--text);
  border-color: var(--accent);
  background: var(--bg2);
}
.icon-btn:active { transform: translateY(2px); }

.row { display: flex; gap: 12px; align-items: center; }
.row .grow { flex: 1; }
.mt { margin-top: 14px; }
.mt2 { margin-top: 24px; }

/* ---------------------------------------------------------------- Status/Toast (mit OK-Button) */
.msg { display: none; flex-wrap: wrap; align-items: center; gap: 8px 16px; padding: 11px 15px; border-radius: 10px; font-size: 13.5px; font-weight: 600; margin-bottom: 14px; }
.msg.show { display: flex; justify-content: space-between; }
.msg-text { flex: 1; min-width: 0; }
.msg-close {
  flex-shrink: 0;
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: 12.5px;
  font-weight: 700;
  padding: 4px 14px;
  border-radius: 999px;
  cursor: pointer;
  transition: border-color 0.2s ease, filter 0.2s ease, transform 0.12s ease;
}
.msg-close:hover { border-color: currentColor; filter: brightness(1.25); }
.msg-close:active { transform: translateY(1px); transition-duration: 0.05s; }
.msg.ok { background: rgba(46, 205, 113, 0.12); color: var(--accent-2); border: 1px solid rgba(46, 205, 113, 0.3); }
.msg.err { background: rgba(224, 82, 82, 0.12); color: var(--danger); border: 1px solid rgba(224, 82, 82, 0.3); }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
/* v0.0.82: Sektionen in der Bot-Konfiguration — Überschrift + Trennlinie, erste ohne Linie */
.sec-title { font-size: 13px; color: var(--muted); font-weight: 500; margin: 20px 0 12px; padding-top: 16px; border-top: 1px solid var(--border); }
.sec-title:first-of-type { border-top: 0; margin-top: 0; padding-top: 0; }
@media (max-width: 800px) {
  .grid2 { grid-template-columns: 1fr; }
  .hide-mobile { display: none !important; }
}

/* ---------------------------------------------------------------- Login-Spezifisch */
.auth-shell {
  max-width: 420px;
  margin: 7vh auto 0;
  padding: 0 20px 52px;
}
.auth-card { text-align: center; padding: 36px 30px; }
.auth-card h1 { font-size: 22px; margin-bottom: 6px; display: flex; align-items: center; justify-content: center; gap: 10px; }
.auth-card .subtitle { color: var(--muted); font-size: 14px; margin-bottom: 20px; }
.auth-card form { text-align: left; }
.auth-card .btn.block { margin-top: 18px; }
.passkey-divider {
  display: flex; align-items: center; gap: 12px; color: var(--muted);
  font-size: 12px; font-weight: 700; margin: 20px 0 14px;
}
.passkey-divider::before, .passkey-divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.passkey-btn { width: 100%; }

/* ---------------------------------------------------------------- Setup-Wizard */
.steps { display: flex; gap: 8px; margin-bottom: 24px; }
.step-dot {
  flex: 1; height: 6px; border-radius: 999px; background: var(--bg3);
}
.step-dot.active { background: var(--accent); }
.step-dot.done { background: var(--accent-2); }
.step-num {
  width: 30px; height: 30px; border-radius: 50%; background: var(--bg3);
  border: 1px solid var(--border); display: inline-flex; align-items: center;
  justify-content: center; font-size: 13px; font-weight: 800; color: var(--muted);
}
.step-num.done { background: var(--accent-2); border-color: var(--accent-2); color: #1a1a1a; }
.step-num.active { background: var(--accent); border-color: var(--accent); color: #1a1a1a; }

/* ---------------------------------------------------------------- Passkey-Liste */
.pk-item {
  display: flex; align-items: center; gap: 12px; padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.pk-item:last-child { border-bottom: none; }
.pk-item .pk-name { font-weight: 600; font-size: 14px; }
.pk-item .pk-meta { color: var(--muted); font-size: 12px; margin-top: 2px; }
.secret-box {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 13px; background: var(--bg); border: 1px dashed var(--border);
  border-radius: 9px; padding: 10px 13px; word-break: break-all; user-select: all;
}
.qr-wrap { display: flex; justify-content: center; padding: 14px 0 4px; }
.qr-wrap svg { width: 200px; height: 200px; background: #fff; border-radius: 12px; padding: 8px; }

/* ================================================================ v0.0.57: Mobile + PWA */
/* Tabellen: zentrale Klassen statt Inline-Styles — Container scrollt intern,
   die Seite selbst rutscht nie mehr horizontal. */
.tbl-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: 10px; }
/* v0.0.123: „Letzte Trades“ — 100 Zeilen geladen, ~10 sichtbar, vertikal scrollbar;
   Header bleibt beim Scrollen sichtbar (sticky, Karten-Hintergrund var(--bg2)). */
.tbl-scroll-v { max-height: 412px; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.tbl-scroll-v thead th { position: sticky; top: 0; background: var(--bg2); z-index: 1; }
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 0; }
.t-th {
  padding: 8px 12px; border-bottom: 1px solid var(--border);
  color: var(--muted); text-align: left; font-weight: 600; white-space: nowrap;
}
.t-d { padding: 10px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.t-r:last-child .t-d { border-bottom: none; }
.hide-sm { display: table-cell; }

/* v0.0.111: Mobile-Kacheln — auf Handys wird jede Tabellen-Zeile eine Karte
   (Axel: „Alle Tabellen für Handys umbauen in Kachelanzeige pro Zeile“).
   Desktop: Container unsichtbar (JS rendert nur den aktiven Viewport). */
.tiles { display: none; }
.tile {
  background: var(--bg3, #161b22);
  border: 1px solid var(--border, #30363d);
  border-radius: 12px;
  padding: 10px 12px;
}
.tile + .tile { margin-top: 10px; }
.tile-head {
  display: flex; align-items: baseline; gap: 8px;
  margin-bottom: 6px; font-size: 14px; flex-wrap: wrap;
}
.tile-rank { color: var(--muted); font-weight: 700; }
.tile-time { color: var(--muted); font-size: 12px; font-weight: 400; }
.tile-row {
  display: flex; justify-content: space-between; gap: 12px;
  font-size: 13px; line-height: 1.75; align-items: baseline;
}
.tile-row .t-lbl { color: var(--muted); flex: 0 0 auto; }
.tile-row .t-val { font-weight: 600; text-align: right; word-break: break-word; }

/* Safe-Areas (Notch / Home-Indicator) — wichtig im standalone-PWA-Modus */
.nav { padding-top: max(12px, env(safe-area-inset-top)); }
.footer { padding-bottom: max(14px, env(safe-area-inset-bottom)); }
body { padding-bottom: max(64px, calc(env(safe-area-inset-bottom) + 50px)); }

/* Guard: NICHTS schiebt die Seite jemals horizontal raus */
html, body { overflow-x: hidden; }

/* v0.0.102: Scrollbar ins Seiten-Design — war nativer Browser-Look (hell/Grau
   im Dark-Theme). Dünn, Track transparent, Thumb = --bg3 (Hover = --accent-2,
   konsistent zu den Hover-Rahmen der Buttons). */
* { scrollbar-width: thin; scrollbar-color: var(--bg3) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--bg3);
  border: 2px solid var(--bg);
  border-radius: 8px;
}
::-webkit-scrollbar-thumb:hover { background: var(--accent-2); }
::-webkit-scrollbar-corner { background: transparent; }

@media (max-width: 640px) {
  .hide-sm { display: none !important; }   /* unwichtige Tabellen-Spalten ausblenden */
  /* v0.0.111: Mobile-Kacheln — Ranking & Trades rendern jede Zeile als Karte
     mit Label/Wert (keine Spalte geht verloren); die Tabellen selbst sind
     auf Handys ausgeblendet (JS befüllt die Kachel-Container).
     v0.0.146: + Offene Positionen (open-table/open-tiles, v0.0.115-Karte) —
     ohne die Regel blieb auf dem Handy die 11-spaltige Desktop-Tabelle
     sichtbar (Axel-Befund 23.09.: „offene Positionen als Kachel“). */
  #open-table, #trade-table, #ranking-table { display: none; }
  #open-tiles, #trade-tiles, #ranking-tiles { display: block; }
  .wrap, .center-wrap { padding: 16px 14px 76px; }
  .card { padding: 16px 14px; border-radius: 12px; }
  .card h2 { flex-wrap: wrap; }
  .stat { font-size: 24px; }
  .grid2 { gap: 14px; }
  .row { flex-wrap: wrap; }

  /* Nav: Zeile 1 = Logo (nur Icon) + Chip + Logout, Zeile 2 = große Tabs */
  .nav { flex-wrap: wrap; gap: 8px; padding-left: 14px; padding-right: 14px; }
  .nav .logo-txt { display: none; }
  .nav .nav-links { display: flex; width: 100%; gap: 8px; align-items: center; }
  .nav .nav-links a.nav-link {
    flex: 1; justify-content: center; min-height: 44px;
    padding: 12px 8px; font-size: 14px;
    border: 1px solid var(--border); border-radius: 10px;
  }
  .nav .nav-links .spacer { display: none; }
  .nav .nav-links .user-chip { margin-left: auto; }
  /* v0.0.58: Mobile nur Status-Punkt — Chip-Pille (Hintergrund + Name) entfällt,
     Logout-Button steht direkt neben dem Punkt */
  .nav .user-chip { background: none; padding: 0; min-width: 0; }
  .nav .user-chip .chip-txt { display: none; }
  .nav .logout-btn { width: 44px; height: 44px; }

  /* Touch-Targets mindestens 44 px */
  .btn { min-height: 46px; padding: 12px 18px; }
  .icon-btn { width: 44px; height: 44px; }

  /* iOS: Inputs ≥ 16 px, sonst zoomt Safari beim Fokussieren */
  input[type="text"], input[type="password"], input[type="number"],
  input[type="email"], select { font-size: 16px; padding: 12px 13px; }
}

/* v0.0.161: Paar-Suchfelder (Signal-Ranking + Letzte Trades, Axel 24.09.) */
.tbl-filter{display:flex;align-items:center;gap:8px;margin:10px 0 12px;flex-wrap:wrap;}
.tbl-filter input{flex:1;max-width:340px;min-width:180px;background:var(--bg2,#161b22);color:var(--text,#e6edf3);border:1px solid var(--border,#30363d);border-radius:6px;padding:6px 10px;}
.tbl-filter input:focus{outline:none;border-color:var(--accent-2,#3fb950);}
.tbl-filter .filter-clear{background:none;border:1px solid var(--border,#30363d);color:var(--muted,#8b949e);border-radius:6px;padding:4px 10px;cursor:pointer;font-size:12px;line-height:1.4;}
.tbl-filter .filter-clear:hover{border-color:var(--accent-2,#3fb950);color:var(--text,#e6edf3);}
.tbl-filter .filter-note{font-size:12px;color:var(--accent-2,#3fb950);white-space:nowrap;}
