:root {
  color-scheme: dark;
  --bg: #1e1e1e;
  --panel: #2b2b2b;
  --panel2: #111827;
  --card: #252525;
  --card2: #1b2230;
  --text: #ffffff;
  --muted: #d3d3d3;
  --muted2: #a8b3c7;
  --line: rgba(255, 255, 255, .09);
  --blue: #3b82f6;
  --accent: #38bdf8;
  --accent2: #22c55e;
  --danger-soft: #fca5a5;
  --shadow: 0 18px 70px rgba(0, 0, 0, .35);
  --radius: 18px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: "Segoe UI", Arial, sans-serif;
  background:
    radial-gradient(circle at 20% 0%, rgba(56, 189, 248, .08), transparent 28%),
    var(--bg);
  color: var(--text);
}

button,
input,
select {
  font: inherit;
}

/* Hauptseite index.html */
.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 210px 1fr;
  grid-template-rows: 1fr auto;
}

.sidebar {
  grid-row: 1 / 3;
  min-height: 100vh;
  background: var(--panel);
  border-right: 1px solid var(--line);
  display: grid;
  grid-template-rows: 170px 1fr auto;
}

.logo-box {
  margin: 10px 10px 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(56, 189, 248, .10), rgba(34, 197, 94, .06));
}

.logo-box.logo-only {
  min-height: 140px;
  padding: 8px 0;
}

.logo-mark {
  width: 125px;
  height: 125px;
  border-radius: 26px;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: #0f172a;
  border: 1px solid rgba(56, 189, 248, .25);
  box-shadow: inset 0 0 18px rgba(56, 189, 248, .12);
}

.logo-img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  padding: 4px;
}

.menu {
  padding-top: 5px;
}

.menu-item {
  width: calc(100% - 20px);
  margin: 5px 10px;
  padding: 11px 12px;
  text-align: left;
  border: 1px solid transparent;
  border-radius: 12px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  transition: background .16s ease, border-color .16s ease, transform .16s ease, opacity .16s ease;
}

.menu-item:hover:not(:disabled),
.menu-item.active {
  background: rgba(56, 189, 248, .12);
  border-color: rgba(56, 189, 248, .25);
}

.menu-item:active:not(:disabled) {
  transform: translateY(1px);
}

.menu-item:disabled {
  color: #6b7280;
  cursor: not-allowed;
  opacity: .62;
}

.menu-item.muted {
  color: #d1d5db;
}

.sidebar-bottom {
  padding-bottom: 10px;
}

.content {
  grid-column: 2;
  min-width: 0;
  outline: none;
}

.frame-host {
  padding: 0;
  overflow: hidden;
}

.page-frame {
  width: 100%;
  height: calc(100vh - 34px);
  display: block;
  border: 0;
  background: var(--bg);
}

.statusbar {
  grid-column: 2;
  min-height: 34px;
  background: var(--panel2);
  color: white;
  border-top: 1px solid var(--line);
  padding: 6px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.status-left {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: #dbeafe;
}

.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: var(--accent2);
  box-shadow: 0 0 16px rgba(34, 197, 94, .8);
}

.progress {
  width: 200px;
  height: 16px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255,255,255,.10);
  border: 1px solid rgba(255,255,255,.08);
}

.progress span {
  display: block;
  width: 42%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  animation: load 1.1s infinite linear;
}

@keyframes load {
  from { transform: translateX(-100%); }
  to { transform: translateX(260%); }
}

/* iframe-Seiten allgemein */
.iframe-body {
  min-height: 100vh;
  background: #1e1e1e;
}

.iframe-demo-page {
  min-height: 100vh;
  padding: 30px;
  background:
    radial-gradient(circle at 20% 0%, rgba(56, 189, 248, .08), transparent 28%),
    var(--bg);
}

.demo-card {
  max-width: 1180px;
  margin: 0 auto;
  border: 1px solid var(--line);
  background: linear-gradient(145deg, rgba(37,43,54,.96), rgba(17,24,39,.96));
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px;
}

.demo-card h1 {
  margin: 0 0 14px;
  color: white;
  font-size: clamp(30px, 3vw, 48px);
  line-height: 1.05;
}

.demo-card p {
  margin: 0 0 14px;
  color: #c7d2fe;
  line-height: 1.65;
  font-size: 16px;
}

.demo-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-top: 22px;
}

.demo-box {
  min-height: 130px;
  border: 1px solid rgba(59, 130, 246, .22);
  border-radius: 16px;
  padding: 18px;
  background: rgba(15, 23, 42, .60);
}

.demo-box strong {
  display: block;
  margin-bottom: 8px;
  color: white;
}

/* legal.html im iframe */
.legal-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px 18px;
  background: #1e1e1e;
}

.legal-panel {
  width: min(820px, 100%);
  max-width: 900px;
  padding: 40px;
  background: #252525;
  border: 1px solid var(--blue);
  border-radius: 12px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, .38);
  text-align: center;
}

.legal-panel h1 {
  margin: 0 0 22px;
  color: white;
  font-size: 30px;
  line-height: 1.15;
  font-weight: 800;
}

.legal-panel p {
  margin: 0 0 14px;
  color: lightgray;
  font-size: 17px;
  line-height: 25px;
}

.legal-panel .risk-text {
  color: var(--danger-soft);
  font-size: 18px;
  font-weight: 600;
  line-height: 27px;
}

.accept-button {
  width: min(390px, 100%);
  height: 44px;
  margin-top: 12px;
  border: 0;
  border-radius: 8px;
  background: #2563eb;
  color: white;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: background .18s ease, transform .18s ease;
}

.accept-button:hover {
  background: #1d4ed8;
}

.accept-button:active {
  transform: translateY(1px);
}

.accept-button.accepted {
  background: #16a34a;
}

@media (max-width: 920px) {
  .app-shell {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr auto;
  }

  .sidebar {
    grid-row: 1;
    min-height: auto;
    grid-template-rows: auto auto auto;
  }

  .logo-box.logo-only {
    min-height: 110px;
  }

  .logo-mark {
    width: 96px;
    height: 96px;
    border-radius: 22px;
  }

  .menu,
  .sidebar-bottom {
    display: flex;
    overflow-x: auto;
    padding: 0 8px 10px;
  }

  .menu-item {
    width: auto;
    white-space: nowrap;
    margin: 4px;
  }

  .content,
  .statusbar {
    grid-column: 1;
  }

  .page-frame {
    height: calc(100vh - 190px);
    min-height: 520px;
  }

  .demo-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .legal-panel {
    padding: 26px 18px;
  }

  .legal-panel h1 {
    font-size: 26px;
  }

  .legal-panel p,
  .legal-panel .risk-text {
    font-size: 16px;
    line-height: 24px;
  }

  .iframe-demo-page {
    padding: 18px;
  }
}

/* =========================================================
   Gemeinsame iframe-Seiten
   ========================================================= */

.iframe-demo-page {
  min-height: 100vh;
  padding: 30px;
  background: #1e1e1e;
}

.demo-card {
  max-width: 1180px;
  margin: 0 auto;
  border: 1px solid rgba(255,255,255,.09);
  background: linear-gradient(145deg, rgba(37,43,54,.96), rgba(17,24,39,.96));
  border-radius: 18px;
  box-shadow: 0 18px 70px rgba(0,0,0,.35);
  padding: 28px;
}

.demo-card h1 {
  margin: 0 0 14px;
  color: white;
  font-size: clamp(30px, 3vw, 48px);
  line-height: 1.05;
}

.demo-card p {
  margin: 0 0 14px;
  color: #c7d2fe;
  line-height: 1.65;
  font-size: 16px;
}

/* =========================================================
   Marktübersicht und Handelsoptionen im iframe
   ========================================================= */

.sql-page {
  min-height: 100vh;
  padding: 10px;
  background: #1e1e1e;
  color: white;
  display: grid;
  grid-template-rows: auto auto auto auto 1fr auto;
  gap: 8px;
}

.sql-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.sql-header h1 {
  margin: 0;
  color: white;
  font-size: 24px;
  line-height: 1.2;
}

.sql-header p {
  margin: 4px 0 0;
  color: #e5e7eb;
  font-size: 14px;
}

.sql-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.sql-toolbar {
  min-height: 30px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
}

.sql-toolbar label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: white;
  font-size: 12px;
  font-weight: 700;
}

.sql-toolbar select,
.sql-toolbar input[type="search"] {
  height: 27px;
  border: 1px solid #d1d5db;
  border-radius: 4px;
  background: white;
  color: #111827;
  padding: 2px 7px;
  font-size: 12px;
}

.sql-toolbar input[type="search"] {
  min-width: min(360px, 60vw);
}

.small-btn,
.icon-btn {
  height: 27px;
  border: 1px solid #9ca3af;
  border-radius: 4px;
  background: #f3f4f6;
  color: #111827;
  padding: 0 10px;
  font-size: 12px;
  cursor: pointer;
}

.small-btn:hover,
.icon-btn:hover {
  background: #e5e7eb;
}

.small-btn.primary {
  background: #2563eb;
  color: white;
  border-color: #2563eb;
}

.small-btn.cyan {
  background: #0891b2;
  color: white;
  border-color: #0891b2;
}

.small-btn.orange {
  background: #d97706;
  color: white;
  border-color: #d97706;
}

.small-btn.green {
  background: #16a34a;
  color: white;
  border-color: #16a34a;
}

.small-btn.purple {
  background: #7c3aed;
  color: white;
  border-color: #7c3aed;
}

.sql-status {
  min-height: 38px;
  padding: 10px 8px;
  background: #0f2748;
  border: 1px solid #274c77;
  border-radius: 4px;
  color: white;
  font-size: 13px;
  display: flex;
  align-items: center;
}

.sql-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.tab-btn {
  min-height: 30px;
  border: 1px solid #374151;
  border-bottom-color: #6b7280;
  border-radius: 6px 6px 0 0;
  background: #111827;
  color: #dbeafe;
  padding: 5px 12px;
  cursor: pointer;
  font-size: 12px;
}

.tab-btn.active {
  background: white;
  color: #111827;
  font-weight: 800;
}

.sql-table-wrap {
  min-height: 0;
  overflow: auto;
  border: 1px solid #d1d5db;
  background: white;
}

.sql-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  background: white;
  color: #111827;
}

.sql-table th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #f3f4f6;
  color: #111827;
  border: 1px solid #d1d5db;
  padding: 4px;
  text-align: left;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.sql-table td {
  border: 1px solid #d1d5db;
  padding: 4px;
  color: #111827;
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sql-table tbody tr:nth-child(even) {
  background: #f9fafb;
}

.sql-table tbody tr:hover {
  background: #dbeafe;
}

.market-table {
  min-width: 1480px;
}

.options-table {
  min-width: 1420px;
}

.symbol-cell {
  font-weight: 800;
}

.number-cell {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.quote-cell {
  color: #075985 !important;
  font-weight: 800;
}

.trend-up {
  color: #15803d !important;
  font-weight: 900;
}

.trend-down {
  color: #b91c1c !important;
  font-weight: 900;
}

.trend-neutral {
  color: #6b7280 !important;
  font-weight: 800;
}

.good-cell {
  color: #15803d !important;
  font-weight: 800;
}

.warn-cell {
  color: #b45309 !important;
  font-weight: 800;
}

.bad-cell {
  color: #b91c1c !important;
  font-weight: 800;
}

.empty-cell {
  height: 80px;
  text-align: center !important;
  color: #6b7280 !important;
  font-weight: 700;
}

.sql-footer {
  min-height: 28px;
  display: grid;
  grid-template-columns: 1.4fr repeat(5, auto);
  gap: 10px;
  align-items: center;
  color: #dbeafe;
  font-size: 12px;
}

.sql-footer span {
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(15,23,42,.8);
  border: 1px solid rgba(255,255,255,.08);
}

.table-checkbox {
  width: 16px;
  height: 16px;
  margin: 0 auto;
  display: block;
}

.options-table th:nth-child(1),
.options-table td:nth-child(1) { width: 120px; }
.options-table th:nth-child(2),
.options-table td:nth-child(2) { width: 90px; }
.options-table th:nth-child(3),
.options-table td:nth-child(3) { width: 110px; }
.options-table th:nth-child(4),
.options-table td:nth-child(4) { width: 175px; }
.options-table th:nth-child(5),
.options-table td:nth-child(5),
.options-table th:nth-child(6),
.options-table td:nth-child(6) { width: 62px; text-align: center; }
.options-table th:nth-child(7),
.options-table td:nth-child(7) { width: 95px; }
.options-table th:nth-child(8),
.options-table td:nth-child(8) { width: 145px; }
.options-table th:nth-child(9),
.options-table td:nth-child(9) { width: 190px; }
.options-table th:nth-child(10),
.options-table td:nth-child(10),
.options-table th:nth-child(11),
.options-table td:nth-child(11),
.options-table th:nth-child(12),
.options-table td:nth-child(12) { width: 105px; }
.options-table th:nth-child(13),
.options-table td:nth-child(13),
.options-table th:nth-child(14),
.options-table td:nth-child(14),
.options-table th:nth-child(15),
.options-table td:nth-child(15),
.options-table th:nth-child(16),
.options-table td:nth-child(16),
.options-table th:nth-child(17),
.options-table td:nth-child(17) { width: 62px; text-align: center; }
.options-table th:nth-child(18),
.options-table td:nth-child(18) { width: 170px; }

@media (max-width: 920px) {
  .sql-header {
    flex-direction: column;
  }

  .sql-actions {
    justify-content: flex-start;
  }

  .sql-footer {
    grid-template-columns: 1fr;
  }
}

/* =========================================================
   Handelskonten
   ========================================================= */

.accounts-table {
  min-width: 1850px;
}

.accounts-table th:nth-child(1),
.accounts-table td:nth-child(1) { width: 82px; }

.accounts-table th:nth-child(2),
.accounts-table td:nth-child(2) { width: 165px; }

.accounts-table th:nth-child(3),
.accounts-table td:nth-child(3) { width: 170px; }

.accounts-table th:nth-child(4),
.accounts-table td:nth-child(4) { width: 90px; }

.accounts-table th:nth-child(5),
.accounts-table td:nth-child(5) { width: 80px; }

.accounts-table th:nth-child(6),
.accounts-table td:nth-child(6) { width: 80px; }

.accounts-table th:nth-child(7),
.accounts-table td:nth-child(7),
.accounts-table th:nth-child(8),
.accounts-table td:nth-child(8),
.accounts-table th:nth-child(9),
.accounts-table td:nth-child(9),
.accounts-table th:nth-child(10),
.accounts-table td:nth-child(10),
.accounts-table th:nth-child(11),
.accounts-table td:nth-child(11),
.accounts-table th:nth-child(13),
.accounts-table td:nth-child(13) {
  width: 115px;
}

.accounts-table th:nth-child(12),
.accounts-table td:nth-child(12) { width: 150px; }

.accounts-table th:nth-child(14),
.accounts-table td:nth-child(14),
.accounts-table th:nth-child(16),
.accounts-table td:nth-child(16) { width: 125px; }

.accounts-table th:nth-child(15),
.accounts-table td:nth-child(15),
.accounts-table th:nth-child(17),
.accounts-table td:nth-child(17) { width: 180px; }

.accounts-table th:nth-child(18),
.accounts-table td:nth-child(18) { width: 230px; }

.accounts-table th:nth-child(19),
.accounts-table td:nth-child(19) {
  width: 80px;
  text-align: center;
}

.account-status-ok {
  color: #15803d !important;
  font-weight: 800;
}

.account-status-warn {
  color: #b45309 !important;
  font-weight: 800;
}

.account-status-bad {
  color: #b91c1c !important;
  font-weight: 800;
}

.account-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: none;
  place-items: center;
  background: rgba(0, 0, 0, .58);
  padding: 24px;
}

.account-modal-backdrop.open {
  display: grid;
}

.account-modal {
  width: min(860px, 96vw);
  max-height: 90vh;
  overflow: auto;
  border: 1px solid rgba(59, 130, 246, .45);
  border-radius: 14px;
  background: #111827;
  color: white;
  box-shadow: 0 24px 80px rgba(0, 0, 0, .55);
}

.account-modal-header {
  position: sticky;
  top: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, .10);
  background: #0f172a;
}

.account-modal-header h2 {
  margin: 0;
  font-size: 22px;
}

.account-modal-body {
  padding: 18px;
}

.account-section-title {
  margin: 18px 0 10px;
  color: #bfdbfe;
  font-size: 16px;
  font-weight: 800;
  border-bottom: 1px solid rgba(255, 255, 255, .10);
  padding-bottom: 6px;
}

.account-detail-grid {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 8px 12px;
  align-items: center;
}

.account-detail-grid label {
  color: #cbd5e1;
  font-weight: 700;
  font-size: 13px;
}

.account-detail-grid input,
.account-detail-grid textarea {
  width: 100%;
  min-height: 30px;
  border: 1px solid #4b5563;
  border-radius: 6px;
  background: #0b1220;
  color: white;
  padding: 6px 8px;
}

.account-detail-grid textarea {
  min-height: 78px;
  resize: vertical;
}

.account-check-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 8px;
}

.account-check-grid label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #e5e7eb;
}

.account-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 18px;
  border-top: 1px solid rgba(255, 255, 255, .10);
  background: #0f172a;
}

/* =========================================================
   Handel
   ========================================================= */

.trade-table {
  min-width: 1900px;
}

.trade-table th:nth-child(1),
.trade-table td:nth-child(1) { width: 150px; }

.trade-table th:nth-child(2),
.trade-table td:nth-child(2) { width: 90px; }

.trade-table th:nth-child(3),
.trade-table td:nth-child(3) { width: 105px; }

.trade-table th:nth-child(4),
.trade-table td:nth-child(4) { width: 82px; }

.trade-table th:nth-child(5),
.trade-table td:nth-child(5) { width: 95px; }

.trade-table th:nth-child(6),
.trade-table td:nth-child(6) { width: 145px; }

.trade-table th:nth-child(7),
.trade-table td:nth-child(7),
.trade-table th:nth-child(8),
.trade-table td:nth-child(8) {
  width: 58px;
  text-align: center;
}

.trade-table th:nth-child(9),
.trade-table td:nth-child(9) { width: 65px; }

.trade-table th:nth-child(10),
.trade-table td:nth-child(10),
.trade-table th:nth-child(11),
.trade-table td:nth-child(11),
.trade-table th:nth-child(12),
.trade-table td:nth-child(12),
.trade-table th:nth-child(13),
.trade-table td:nth-child(13) { width: 95px; }

.trade-table th:nth-child(14),
.trade-table td:nth-child(14),
.trade-table th:nth-child(15),
.trade-table td:nth-child(15),
.trade-table th:nth-child(17),
.trade-table td:nth-child(17),
.trade-table th:nth-child(21),
.trade-table td:nth-child(21),
.trade-table th:nth-child(22),
.trade-table td:nth-child(22) {
  width: 82px;
  text-align: center;
}

.trade-table th:nth-child(16),
.trade-table td:nth-child(16),
.trade-table th:nth-child(18),
.trade-table td:nth-child(18),
.trade-table th:nth-child(19),
.trade-table td:nth-child(19) { width: 95px; }

.trade-table th:nth-child(20),
.trade-table td:nth-child(20) { width: 120px; }

.trade-row-selected {
  outline: 2px solid #38bdf8;
  outline-offset: -2px;
}

.trade-panel-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(120px, 1fr));
  gap: 8px;
}

.trade-metric {
  border: 1px solid rgba(255,255,255,.09);
  border-radius: 10px;
  background: rgba(15,23,42,.78);
  padding: 8px 10px;
}

.trade-metric strong {
  display: block;
  color: #bfdbfe;
  font-size: 12px;
  margin-bottom: 3px;
}

.trade-metric span {
  color: white;
  font-weight: 800;
  font-size: 15px;
}

.trade-status-running {
  color: #15803d !important;
  font-weight: 900;
}

.trade-status-waiting {
  color: #b45309 !important;
  font-weight: 900;
}

.trade-status-ended {
  color: #6b7280 !important;
  font-weight: 900;
}

/* =========================================================
   Charts
   ========================================================= */

.charts-page {
  min-height: 100vh;
  padding: 10px;
  background: #07111f;
  color: white;
  display: grid;
  grid-template-rows: auto auto auto 1fr auto;
  gap: 8px;
}

.charts-grid {
  min-height: 0;
  overflow: auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(255px, 1fr));
  gap: 8px;
  align-content: start;
  padding: 2px;
}

.chart-card {
  min-height: 226px;
  border: 1px solid #243650;
  border-radius: 8px;
  background: #050b16;
  padding: 7px;
  cursor: pointer;
  box-shadow: 0 10px 30px rgba(0,0,0,.24);
}

.chart-card:hover {
  border-color: #38bdf8;
  background: #081222;
}

.chart-card-header,
.chart-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.chart-card-title {
  min-width: 0;
  color: white;
  font-size: 12px;
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chart-card-profit {
  color: #22c55e;
  font-size: 11px;
  font-weight: 900;
  white-space: nowrap;
}

.chart-card-profit.loss {
  color: #f97316;
}

.chart-svg {
  width: 100%;
  height: 138px;
  margin-top: 5px;
  border: 1px solid rgba(255,255,255,.08);
  background: #030812;
  display: block;
}

.chart-card-footer {
  margin-top: 5px;
  color: #c7d2fe;
  font-size: 10px;
}

.chart-footer-left,
.chart-footer-right {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chart-footer-right {
  color: white;
  font-weight: 800;
}

.chart-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: none;
  place-items: center;
  padding: 22px;
  background: rgba(0,0,0,.66);
}

.chart-modal-backdrop.open {
  display: grid;
}

.chart-modal {
  width: min(1140px, 97vw);
  max-height: 94vh;
  overflow: auto;
  border: 1px solid rgba(56,189,248,.42);
  border-radius: 14px;
  background: #07111f;
  box-shadow: 0 28px 90px rgba(0,0,0,.58);
}

.chart-modal-header,
.chart-modal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 14px;
  background: #0d1728;
  border-bottom: 1px solid rgba(255,255,255,.09);
}

.chart-modal-header h2 {
  margin: 0;
  font-size: 19px;
}

.chart-modal-body {
  padding: 12px;
}

.chart-large-svg {
  width: 100%;
  height: min(560px, 62vh);
  border: 1px solid #243650;
  background: #030812;
  display: block;
}

.chart-modal-footer {
  border-top: 1px solid rgba(255,255,255,.09);
  border-bottom: 0;
  color: #c7d2fe;
  font-size: 12px;
}

.chart-line-current {
  stroke: #38bdf8;
  stroke-width: 1.4;
}

.chart-line-entry {
  stroke: #f59e0b;
  stroke-width: 1.1;
  stroke-dasharray: 5 4;
}

.chart-line-stop {
  stroke: #fb923c;
  stroke-width: 1.1;
  stroke-dasharray: 4 4;
}

.chart-line-sl {
  stroke: #ef4444;
  stroke-width: 1.1;
  stroke-dasharray: 4 3;
}

.chart-line-tp {
  stroke: #22c55e;
  stroke-width: 1.1;
  stroke-dasharray: 4 3;
}

.chart-empty {
  height: 120px;
  display: grid;
  place-items: center;
  color: #64748b;
  font-size: 12px;
}

@media (max-width: 920px) {
  .charts-grid {
    grid-template-columns: 1fr;
  }
}

/* =========================================================
   Kalender
   ========================================================= */

.calendar-table {
  min-width: 1680px;
}

.calendar-table th:nth-child(1),
.calendar-table td:nth-child(1) { width: 145px; }

.calendar-table th:nth-child(2),
.calendar-table td:nth-child(2) { width: 85px; }

.calendar-table th:nth-child(3),
.calendar-table td:nth-child(3) { width: 90px; }

.calendar-table th:nth-child(4),
.calendar-table td:nth-child(4) { width: 65px; }

.calendar-table th:nth-child(5),
.calendar-table td:nth-child(5) { width: 330px; }

.calendar-table th:nth-child(6),
.calendar-table td:nth-child(6) { width: 105px; }

.calendar-table th:nth-child(7),
.calendar-table td:nth-child(7),
.calendar-table th:nth-child(8),
.calendar-table td:nth-child(8),
.calendar-table th:nth-child(9),
.calendar-table td:nth-child(9) { width: 90px; }

.calendar-table th:nth-child(10),
.calendar-table td:nth-child(10) { width: 180px; }

.calendar-table th:nth-child(11),
.calendar-table td:nth-child(11) { width: 82px; text-align: center; }

.calendar-table th:nth-child(12),
.calendar-table td:nth-child(12) { width: 320px; }

.calendar-table th:nth-child(13),
.calendar-table td:nth-child(13),
.calendar-table th:nth-child(14),
.calendar-table td:nth-child(14) { width: 70px; text-align: center; }

.calendar-row-high {
  background: #2a1115 !important;
}

.calendar-row-high td {
  color: #f8fafc !important;
}

.calendar-row-high td.calendar-importance-high {
  color: #fb7185 !important;
}

.calendar-row-high td a {
  color: #93e8ff !important;
}

.calendar-row-risk {
  background: #2a1812 !important;
}

.calendar-row-risk td {
  color: #fff7ed !important;
}

.calendar-row-inactive {
  background: #141821 !important;
  opacity: .72;
}

.calendar-importance-high {
  color: #fb7185 !important;
  font-weight: 900;
}

.calendar-importance-medium {
  color: #facc15 !important;
  font-weight: 900;
}

.calendar-importance-low {
  color: #7dd3fc !important;
  font-weight: 800;
}

.calendar-risk-high {
  color: #fb7185 !important;
  font-weight: 900;
}

.calendar-risk-medium {
  color: #facc15 !important;
  font-weight: 900;
}

.calendar-risk-low {
  color: #7dd3fc !important;
  font-weight: 800;
}

.calendar-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: none;
  place-items: center;
  padding: 22px;
  background: rgba(0,0,0,.66);
}

.calendar-modal-backdrop.open {
  display: grid;
}

.calendar-modal {
  width: min(980px, 97vw);
  max-height: 92vh;
  overflow: auto;
  border: 1px solid rgba(56,189,248,.42);
  border-radius: 14px;
  background: #07111f;
  box-shadow: 0 28px 90px rgba(0,0,0,.58);
  color: white;
}

.calendar-modal-header,
.calendar-modal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 14px;
  background: #0d1728;
  border-bottom: 1px solid rgba(255,255,255,.09);
}

.calendar-modal-header h2 {
  margin: 0;
  font-size: 19px;
}

.calendar-modal-body {
  padding: 14px;
}

.calendar-detail-grid {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 8px 12px;
  align-items: start;
}

.calendar-detail-grid strong {
  color: #bfdbfe;
}

.calendar-detail-box {
  background: #0b1220;
  border: 1px solid #243650;
  border-radius: 8px;
  padding: 8px;
  min-height: 32px;
  white-space: pre-wrap;
}

.calendar-modal-footer {
  border-top: 1px solid rgba(255,255,255,.09);
  border-bottom: 0;
  color: #c7d2fe;
  font-size: 12px;
}

@media (max-width: 920px) {
  .calendar-detail-grid {
    grid-template-columns: 1fr;
  }
}

/* =========================================================
   Info
   ========================================================= */

.info-page {
  min-height: 100vh;
  padding: 10px;
  background: #07111f;
  color: white;
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  gap: 10px;
}

.info-cards {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 8px;
}

.info-card {
  background: #050b16;
  border: 1px solid #243650;
  border-radius: 8px;
  padding: 10px;
}

.info-card-label {
  color: #b9cae2;
  font-size: 12px;
}

.info-card-value {
  color: white;
  font-size: 18px;
  font-weight: 900;
  margin-top: 3px;
}

.info-card-detail {
  color: #64748b;
  font-size: 11px;
  margin-top: 2px;
}

.info-grid {
  min-height: 0;
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: 10px;
}

.info-left,
.info-right {
  min-width: 0;
  min-height: 0;
  display: grid;
  gap: 10px;
}

.info-left {
  grid-template-rows: 1.1fr .9fr;
}

.info-right {
  grid-template-rows: 1fr 1fr;
}

.info-panel {
  min-height: 0;
  overflow: hidden;
  background: #0d1728;
  border: 1px solid #243650;
  border-radius: 8px;
  padding: 8px;
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 8px;
}

.info-panel h2 {
  margin: 0;
  color: white;
  font-size: 16px;
}

.info-scroll {
  min-height: 0;
  overflow: auto;
  color: #b9cae2;
  font-size: 13px;
  line-height: 1.55;
}

.info-text-box {
  min-height: 0;
  overflow: auto;
  white-space: pre-wrap;
  color: #b9cae2;
  background: #050b16;
  border: 1px solid #243650;
  border-radius: 6px;
  padding: 10px;
  font-size: 12px;
  line-height: 1.5;
}

.info-table {
  min-width: 700px;
}

.info-system-table {
  min-width: 640px;
}

.info-table th:nth-child(1),
.info-table td:nth-child(1) { width: 130px; }

.info-table th:nth-child(2),
.info-table td:nth-child(2) { width: 190px; }

.info-table th:nth-child(3),
.info-table td:nth-child(3) { width: 90px; text-align: right; }

.info-table th:nth-child(4),
.info-table td:nth-child(4) { width: 90px; text-align: right; }

.info-table th:nth-child(5),
.info-table td:nth-child(5) { width: 260px; }

.info-ok {
  color: #22c55e !important;
  font-weight: 900;
}

.info-warn {
  color: #facc15 !important;
  font-weight: 900;
}

.info-bad {
  color: #fb7185 !important;
  font-weight: 900;
}

@media (max-width: 1100px) {
  .info-grid {
    grid-template-columns: 1fr;
  }

  .info-left,
  .info-right {
    grid-template-rows: auto auto;
  }

  .info-cards {
    grid-template-columns: repeat(2, minmax(160px, 1fr));
  }
}

@media (max-width: 640px) {
  .info-cards {
    grid-template-columns: 1fr;
  }
}

/* =========================================================
   Einstellungen / Settings
   ========================================================= */

.settings-page {
  min-height: 100vh;
  padding: 10px;
  background: #07111f;
  color: white;
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  gap: 10px;
}

.settings-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.settings-tab {
  min-height: 30px;
  border: 1px solid #374151;
  border-radius: 6px;
  background: #111827;
  color: #dbeafe;
  padding: 5px 11px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
}

.settings-tab.active {
  background: white;
  color: #111827;
}

.settings-content {
  min-height: 0;
  overflow: auto;
  background: #0d1728;
  border: 1px solid #243650;
  border-radius: 8px;
  padding: 10px;
}

.settings-section {
  display: none;
  min-height: 0;
}

.settings-section.active {
  display: block;
}

.settings-grid {
  display: grid;
  grid-template-columns: minmax(300px, .9fr) minmax(420px, 1.2fr);
  gap: 12px;
  align-items: start;
}

.settings-panel {
  background: #050b16;
  border: 1px solid #243650;
  border-radius: 8px;
  padding: 10px;
}

.settings-panel h2,
.settings-panel h3 {
  margin: 0 0 10px;
  color: white;
}

.settings-form-grid {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  gap: 8px 10px;
  align-items: center;
}

.settings-form-grid label {
  color: #b9cae2;
  font-size: 12px;
  font-weight: 700;
}

.settings-form-grid input,
.settings-form-grid select,
.settings-form-grid textarea {
  width: 100%;
  min-height: 30px;
  border: 1px solid #4b5563;
  border-radius: 5px;
  background: white;
  color: #111827;
  padding: 5px 8px;
  font-size: 12px;
}

.settings-form-grid textarea {
  min-height: 86px;
  resize: vertical;
}

.settings-check-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(130px, 1fr));
  gap: 8px;
}

.settings-check-grid label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: #e5e7eb;
  font-size: 12px;
}

.settings-table {
  min-width: 980px;
}

.settings-table.small {
  min-width: 620px;
}

.settings-table th,
.settings-table td {
  white-space: nowrap;
}

.settings-table td.long-cell {
  max-width: 360px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.settings-muted {
  color: #94a3b8;
  font-size: 12px;
  line-height: 1.55;
}

.settings-warning {
  margin-top: 8px;
  color: #facc15;
  font-size: 12px;
  line-height: 1.45;
}

.settings-badge {
  display: inline-block;
  min-width: 52px;
  text-align: center;
  border-radius: 999px;
  padding: 2px 8px;
  border: 1px solid rgba(255,255,255,.14);
  background: #111827;
  font-size: 11px;
  font-weight: 800;
}

.settings-badge.ok {
  color: #22c55e;
}

.settings-badge.warn {
  color: #facc15;
}

.settings-badge.bad {
  color: #fb7185;
}

@media (max-width: 1100px) {
  .settings-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 700px) {
  .settings-form-grid {
    grid-template-columns: 1fr;
  }

  .settings-check-grid {
    grid-template-columns: 1fr;
  }
}

.legal-panel .demo-version-text,
.legal-card .demo-version-text {
  color: #dbeafe;
  background: rgba(37, 99, 235, .12);
  border: 1px solid rgba(59, 130, 246, .35);
  border-radius: 8px;
  padding: 12px 14px;
  font-weight: 700;
}

.info-purchase-notice {
  color: #dbeafe;
  background: rgba(37, 99, 235, .12);
  border: 1px solid rgba(59, 130, 246, .35);
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 10px;
  line-height: 1.55;
}

/* Original desktop application alignment — X:\Final\All Trading */
.app-shell {
  grid-template-columns: 210px minmax(0, 1fr);
  background: #1e1e1e;
}

.sidebar {
  grid-template-rows: 140px 1fr 70px;
  background: #2b2b2b;
  border-right: 0;
}

.logo-box,
.logo-box.logo-only {
  min-height: 0;
  height: auto;
  margin: 10px 10px 15px;
  padding: 5px;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.logo-mark {
  width: 180px;
  height: 110px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  overflow: visible;
}

.logo-img {
  width: 180px;
  height: 110px;
  padding: 0;
  object-fit: contain;
}

.menu { padding-top: 5px; }

.menu-item {
  width: calc(100% - 20px);
  min-height: 30px;
  margin: 5px 10px;
  padding: 5px 8px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #fff;
  font-size: 14px;
  line-height: 20px;
}

.menu-item:hover:not(:disabled),
.menu-item.active {
  background: #374151;
  border-color: transparent;
}

.menu-item:disabled {
  color: #6b7280;
  opacity: .62;
}

.sidebar-bottom { padding: 0 0 10px; }
.content, .frame-host { background: #1e1e1e; }
.page-frame { background: #1e1e1e; }

.statusbar {
  min-height: 34px;
  background: #111827;
  border-top: 0;
  padding: 6px 10px;
}

.status-left { color: #fff; }
.status-dot { display: none; }
.progress { border-radius: 0; }

@media (max-width: 920px) {
  .sidebar { grid-template-rows: auto auto auto; }
  .logo-box.logo-only { min-height: 110px; }
  .logo-mark, .logo-img { width: 180px; height: 100px; }
  .menu-item { border-radius: 0; }
}

/* Mobile iframe correction — must remain after desktop alignment */
@media (max-width: 920px) {
  html, body {
    width: 100%;
    height: 100%;
    min-height: 0;
    overflow: hidden;
  }

  .app-shell {
    width: 100%;
    height: 100dvh;
    min-height: 0;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: 92px minmax(0, 1fr) 32px;
    overflow: hidden;
  }

  .sidebar {
    grid-column: 1;
    grid-row: 1;
    width: 100%;
    height: 92px;
    min-height: 0;
    display: flex;
    align-items: center;
    overflow: hidden;
    border-bottom: 1px solid #3f3f46;
  }

  .logo-box,
  .logo-box.logo-only {
    flex: 0 0 118px;
    width: 118px;
    height: 82px;
    min-height: 0;
    margin: 5px 8px;
    padding: 2px;
  }

  .logo-mark,
  .logo-img {
    width: 108px;
    height: 72px;
  }

  .menu {
    min-width: 0;
    flex: 1 1 auto;
    display: flex;
    align-items: center;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 4px 8px;
    scrollbar-width: thin;
    -webkit-overflow-scrolling: touch;
  }

  .menu-item {
    flex: 0 0 auto;
    width: auto;
    min-height: 42px;
    margin: 3px;
    padding: 9px 11px;
    white-space: nowrap;
  }

  .sidebar-bottom { display: none; }

  .content,
  .frame-host {
    grid-column: 1;
    grid-row: 2;
    width: 100%;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
  }

  .page-frame {
    width: 100%;
    height: 100%;
    min-height: 0;
  }

  .statusbar {
    grid-column: 1;
    grid-row: 3;
    min-width: 0;
    min-height: 32px;
    padding: 5px 8px;
    font-size: 12px;
  }

  .status-left {
    min-width: 0;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
  }

  .progress { width: 90px; flex: 0 0 90px; }

  body.iframe-body { overflow: auto; -webkit-overflow-scrolling: touch; }
  .legal-page { height: 100%; min-height: 100%; overflow-y: auto; }
  .sql-page { min-height: 100%; overflow: auto; }
}

@media (max-width: 520px) {
  .app-shell { grid-template-rows: 78px minmax(0, 1fr) 30px; }
  .sidebar { height: 78px; }
  .logo-box, .logo-box.logo-only { flex-basis: 96px; width: 96px; height: 70px; margin: 4px; }
  .logo-mark, .logo-img { width: 88px; height: 62px; }
  .menu-item { min-height: 38px; padding: 8px 9px; font-size: 13px; }
  .legal-page { padding: 14px 10px; overflow-y: auto; }
  .legal-panel { padding: 22px 14px; }
}

/* Mobile bottom navigation — keep after all earlier responsive rules */
@media (max-width: 920px) {
  .app-shell { grid-template-rows: minmax(0, 1fr) 32px 64px; }
  .sidebar {
    grid-row: 3;
    height: 64px;
    border-top: 1px solid #3f3f46;
    border-bottom: 0;
    background: #292929;
  }
  .logo-box, .logo-box.logo-only { display: none; }
  .menu {
    width: 100%;
    height: 64px;
    padding: 5px 6px max(5px, env(safe-area-inset-bottom));
    scroll-snap-type: x proximity;
    scrollbar-gutter: stable;
  }
  .menu-item { scroll-snap-align: start; touch-action: manipulation; }
  .content, .frame-host { grid-row: 1; }
  .statusbar { grid-row: 2; }
  .sql-table-wrap {
    overflow-x: scroll;
    scrollbar-gutter: stable both-edges;
  }
}
@media (max-width: 520px) {
  .app-shell { grid-template-rows: minmax(0, 1fr) 30px 60px; }
  .sidebar, .menu { height: 60px; }
}
/* Fixed viewport table area: keep the horizontal scrollbar visible at the bottom */
body.iframe-body:has(.sql-page) {
  height: 100dvh;
  min-height: 0;
  overflow: hidden;
}
body.iframe-body:has(.sql-page) .sql-page {
  height: 100dvh;
  min-height: 0;
  overflow: hidden;
}
body.iframe-body:has(.sql-page) .sql-table-wrap {
  min-width: 0;
  min-height: 0;
  overflow-x: scroll;
  overflow-y: auto;
  scrollbar-gutter: stable;
}
/* Permanently visible synchronized horizontal table scrollbar */
.alltrading-hscroll {
  position: fixed;
  z-index: 100;
  left: 10px;
  right: 10px;
  bottom: 4px;
  height: 18px;
  padding: 3px;
  border: 1px solid #64748b;
  border-radius: 9px;
  background: #111827;
  box-shadow: 0 0 0 1px rgba(255,255,255,.12), 0 -2px 10px rgba(0,0,0,.45);
  cursor: pointer;
  touch-action: none;
}
.alltrading-hscroll[hidden] { display: none; }
.alltrading-hscroll-thumb {
  height: 10px;
  min-width: 48px;
  border-radius: 6px;
  background: linear-gradient(90deg, #22d3ee, #3b82f6);
  box-shadow: 0 0 6px rgba(34,211,238,.55);
  cursor: grab;
  will-change: transform;
}
.alltrading-hscroll-thumb:active { cursor: grabbing; }
body.iframe-body:has(.sql-page) .sql-page { padding-bottom: 28px; }

/* Original software inspired chart popup and Ollama panel */
.original-chart-popup { width:min(1240px,97vw); max-height:95dvh; border-radius:6px; background:#171717; }
.original-chart-popup .chart-modal-header { background:#222b38; border-bottom-color:#475569; }
.original-chart-popup .chart-modal-body { background:#0b1220; }
.original-chart-popup .chart-large-svg { height:min(570px,58dvh); }
.ai-chart-button { margin-left:auto; background:#6d28d9; border-color:#8b5cf6; color:#fff; }
.chart-ai-panel { margin:0 12px 12px; padding:10px; border:1px solid #334155; border-radius:5px; background:#111827; }
.chart-ai-title { display:flex; justify-content:space-between; gap:12px; color:#fff; margin-bottom:7px; }
.chart-ai-title span { color:#67e8f9; font-size:12px; }
.chart-ai-panel pre { min-height:90px; max-height:210px; overflow:auto; margin:0; padding:10px; white-space:pre-wrap; font:13px/1.5 Segoe UI,Arial,sans-serif; color:#e5e7eb; background:#0b1220; border:1px solid #334155; }
.account-chart-page { min-height:100dvh; padding:10px; background:#07111f; color:#fff; }
.account-chart-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(320px,1fr)); gap:9px; }
.account-chart-card { padding:9px; border:1px solid #334155; border-radius:6px; background:#0f172a; cursor:pointer; }
.account-chart-card:hover { border-color:#38bdf8; }
.account-chart-card svg { display:block; width:100%; height:180px; margin-top:8px; background:#0b1220; border:1px solid #243650; }
.account-chart-meta { display:flex; justify-content:space-between; gap:8px; color:#cbd5e1; font-size:11px; }

/* Originalsoftware-Anpassung: Handel, Charts und abgeschlossene Nettogewinne */
.closed-profit-summary{margin:10px 0;padding:10px 14px;border:1px solid #28415f;border-radius:7px;background:#0b1728;color:#20e35b;font-size:13px;line-height:1.45}.closed-profit-summary.loss{color:#ff5b3d}.original-chart-summary{margin:8px 0 0;padding:9px 14px;border:1px solid #28415f;border-radius:7px 7px 0 0;background:#0b1728;color:#20bfff;font-size:13px}.trade-table th{background:#1b2c43;color:#fff}.trade-table td{background:#071322;color:#eef6ff;border-color:#29405b}.trade-table tbody tr:hover td,.trade-row-selected td{background:#102744!important}.trade-table .quote-cell{color:#16df62}.charts-page,.sql-page{background:#08111f}.chart-card{min-width:265px;background:#091527;border-color:#29405b}.chart-card-meta{font-size:11px;color:#9fb3cb;margin:4px 0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.chart-metrics{margin-top:8px}
