:root {
  --bg: #080b12;
  --bg-soft: #111827;
  --panel: rgba(16, 23, 38, 0.92);
  --text: #d3e0f6;
  --muted: #9aa4b2;
  --accent: #00d2ff;
  --accent-2: #1dd1a1;
  --danger: #ff6b6b;
  --border: rgba(120, 145, 190, 0.2);
}

* {
  box-sizing: border-box;
}

.alert-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  padding: 12px 20px;
  background: var(--danger);
  color: white;
  text-align: center;
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(255, 107, 107, 0.3);
  animation: slideDown 0.3s ease-out;
}

.alert-banner.hidden {
  display: none;
}

@keyframes slideDown {
  from {
    transform: translateY(-100%);
    opacity: 0;
  }

  to {
    transform: translateY(0);
    opacity: 1;
  }
}

body {
  margin: 0;
  color: var(--text);
  font-family: "Space Grotesk", "Segoe UI", sans-serif;
  background: radial-gradient(circle at 10% 10%, #11203d 0%, transparent 35%),
    radial-gradient(circle at 80% 0%, #0f3b35 0%, transparent 40%), var(--bg);
}

.shell-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  background-image: linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: 48px 48px;
}

a {
  color: #85d8ff;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 28px;
  border-bottom: 1px solid var(--border);
  background: rgba(5, 9, 16, 0.85);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 10;
}

.topbar-left {
  display: flex;
  gap: 24px;
  align-items: center;
}

.topbar-left nav {
  display: flex;
  gap: 16px;
  align-items: center;
  flex-wrap: wrap;
}

.topbar-left nav a {
  text-decoration: none;
  color: var(--muted);
}

.topbar-left nav a:hover {
  color: var(--text);
}

.topbar-symbol-picker {
  display: inline-flex;
  align-items: center;
  height: 38px;
  color: var(--muted);
  font-size: 12px;
  margin-left: 4px;
  margin-right: -2px;
  white-space: nowrap;
}

.topbar-symbol-picker-select {
  width: auto;
  min-width: 180px;
  max-width: 240px;
  height: 38px;
  padding: 8px 12px;
  line-height: 1.2;
  font-size: 14px;
  appearance: none;
  -webkit-appearance: none;
}

.brand {
  color: #fff;
  text-decoration: none;
  font-weight: 700;
  letter-spacing: .02em;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.brand-icon {
  width: 20px;
  height: 20px;
  color: var(--accent);
  display: inline-flex;
}

.brand-icon svg {
  width: 100%;
  height: 100%;
}

.status-pill {
  background: rgba(255, 186, 0, 0.12);
  border: 1px solid rgba(255, 186, 0, 0.35);
  color: #ffcf65;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
}

.content-wrap {
  padding: 22px;
}

.grid-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  align-items: start;
}

.stat-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.stat-card-controls {
  justify-content: space-between;
  min-width: 260px;
  grid-column: span 2;
}

.stat-card span {
  color: var(--muted);
  font-size: 12px;
}

.stat-card strong {
  color: #fff;
  font-size: 17px;
}

.dashboard-grid {
  margin-top: 16px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
  gap: 14px;
}

.dashboard-grid-main {
  align-items: stretch;
}

.dashboard-grid-main>.panel {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.dashboard-grid-main>.panel .table-wrap {
  flex: 1;
  min-height: 0;
}

.dashboard-grid-main>.panel .log-box {
  flex: 1;
  min-height: 0;
  height: 290px;
  overflow: auto;
}

.dashboard-holdings-bottom {
  margin-top: 16px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
}

.panel h2,
.page-head h1 {
  margin-top: 0;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.chart-expand-btn {
  border: 1px solid rgba(126, 164, 216, .4);
  background: rgba(12, 24, 40, .75);
  color: #c2d8fb;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  padding: 6px 10px;
  cursor: pointer;
}

.chart-canvas-wrap {
  height: 290px;
}

.equity-insights {
  margin-top: 12px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 8px;
}

.signal-insights {
  margin-top: 12px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px;
}

.equity-metric {
  border: 1px solid rgba(126, 164, 216, .2);
  background: rgba(8, 16, 30, .55);
  border-radius: 8px;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.signal-metric {
  border: 1px solid rgba(126, 164, 216, .2);
  background: rgba(8, 16, 30, .55);
  border-radius: 8px;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.equity-metric span {
  color: var(--muted);
  font-size: 11px;
}

.signal-metric span {
  color: var(--muted);
  font-size: 11px;
}

.equity-metric strong {
  font-size: 13px;
  color: #e5efff;
}

.signal-metric strong {
  font-size: 13px;
  color: #e5efff;
}

.equity-insights-note {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 11px;
}

.signal-insights-note {
  margin: 4px 0 8px;
  color: var(--muted);
  font-size: 12px;
}

.metric-pos {
  color: #39ffa7 !important;
}

.metric-neg {
  color: #ff8d8d !important;
}

.chart-fullscreen-backdrop {
  position: fixed;
  inset: 0;
  z-index: 8999;
  background: rgba(0, 0, 0, .65);
  backdrop-filter: blur(2px);
}

.chart-fullscreen-backdrop.hidden {
  display: none;
}

.chart-panel-fullscreen {
  position: fixed;
  top: 3vh;
  left: 3vw;
  width: 94vw;
  height: 94vh;
  z-index: 9000;
  overflow: hidden;
}

.chart-panel-fullscreen .chart-canvas-wrap {
  height: calc(94vh - 210px);
}

body.no-scroll {
  overflow: hidden;
}

.table-wrap {
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  border-bottom: 1px solid rgba(128, 160, 200, .18);
  padding: 9px;
  text-align: left;
  font-size: 13px;
}

th {
  color: var(--muted);
  font-weight: 600;
}

.profit {
  color: var(--accent-2);
}

.loss {
  color: var(--danger);
}

.log-box {
  height: 290px;
  overflow: auto;
  background: rgba(0, 0, 0, .25);
  border: 1px solid rgba(145, 165, 210, .2);
  border-radius: 10px;
  padding: 10px;
  font-family: "JetBrains Mono", monospace;
  font-size: 12px;
}

.button {
  display: inline-block;
  background: linear-gradient(120deg, #00d2ff, #1dd1a1);
  color: #00121f;
  border: 0;
  padding: 8px 14px;
  border-radius: 9px;
  text-decoration: none;
  font-weight: 600;
}

.button.ghost {
  background: rgba(9, 18, 30, 0.7);
  color: var(--text);
  border: 1px solid rgba(127, 150, 190, .35);
}

.form-panel form {
  display: grid;
  gap: 10px;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid rgba(127, 150, 190, .35);
  background: rgba(7, 12, 20, .8);
  border-radius: 8px;
  color: #fff;
  padding: 10px;
}

input[type="checkbox"],
input[type="radio"] {
  width: auto;
  padding: 0;
  accent-color: var(--accent);
}

.inline {
  display: flex;
  align-items: center;
  gap: 8px;
}

.badge {
  font-size: 11px;
  padding: 4px 8px;
  border-radius: 999px;
}

.badge.ok {
  color: #1dd1a1;
  border: 1px solid rgba(29, 209, 161, .3);
}

.badge.off {
  color: #c4d0de;
  border: 1px solid rgba(147, 170, 202, .3);
}

.token-live-badge {
  transition: transform 0.18s ease, border-color 0.18s ease, color 0.18s ease, background-color 0.18s ease;
}

.token-live-badge.token-live-badge-flash {
  color: #9af1d7;
  border-color: rgba(29, 209, 161, .55);
  background: rgba(29, 209, 161, .12);
  transform: translateY(-1px);
}

.token-live-stream {
  transition: border-color 0.18s ease, color 0.18s ease, background-color 0.18s ease;
}

.token-live-stream.token-stream-connected {
  color: #9af1d7;
  border-color: rgba(29, 209, 161, .5);
  background: rgba(29, 209, 161, .1);
}

.token-live-stream.token-stream-error {
  color: #ffd9a1;
  border-color: rgba(255, 186, 0, .45);
  background: rgba(255, 186, 0, .09);
}

.page-head {
  margin: 10px 0 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.token-switcher {
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.token-switcher-label {
  display: inline-flex;
  align-items: center;
  height: 38px;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.token-switcher-select {
  width: auto;
  min-width: 180px;
  max-width: 260px;
  height: 38px;
  padding: 8px 12px;
  line-height: 1.2;
  font-size: 14px;
  appearance: none;
  -webkit-appearance: none;
}

.token-chart-host {
  width: 100%;
  height: 340px;
}

.token-data-badges {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: -4px 0 14px;
}

.chart-empty {
  color: var(--muted);
  border: 1px dashed rgba(127, 150, 190, 0.35);
  background: rgba(7, 12, 20, 0.35);
  border-radius: 10px;
  padding: 14px 16px;
}

.chart-empty-overlay {
  margin-top: 10px;
}

.chart-help {
  color: var(--muted);
  font-size: 13px;
  margin: -4px 0 10px;
}

.muted {
  color: var(--muted);
}

.button-disabled {
  opacity: .55;
  pointer-events: none;
}

.status-message {
  background: rgba(29, 209, 161, .14);
  border: 1px solid rgba(29, 209, 161, .4);
  color: #9af1d7;
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 14px;
}

.runtime-form {
  display: grid;
  gap: 14px;
}

.runtime-grid {
  display: grid;
  gap: 12px;
}

.runtime-grid.two-cols {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.runtime-grid.three-cols {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.runtime-field {
  display: grid;
  gap: 6px;
}

.runtime-field label {
  color: var(--muted);
  font-size: 13px;
}

.runtime-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid rgba(127, 150, 190, .25);
  border-radius: 8px;
  background: rgba(7, 12, 20, .45);
  min-height: 44px;
}

.runtime-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.admin-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.admin-tab-btn {
  border: 1px solid rgba(127, 150, 190, .35);
  background: rgba(7, 12, 20, .55);
  color: #c6d4e8;
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.admin-tab-btn.active {
  border-color: rgba(0, 210, 255, .6);
  background: rgba(0, 210, 255, .16);
  color: #9deeff;
}

.admin-tab-panel.hidden {
  display: none;
}

.admin-accordion-item {
  border: 1px solid rgba(127, 150, 190, .24);
  border-radius: 10px;
  background: rgba(8, 14, 24, .48);
}

.admin-accordion-item+.admin-accordion-item {
  margin-top: 10px;
}

.admin-accordion-toggle {
  width: 100%;
  border: 0;
  background: transparent;
  color: #d7e4f8;
  font-size: 16px;
  text-align: left;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
}

.admin-chevron {
  display: inline-flex;
  transition: transform .16s ease;
}

.admin-accordion-item.open .admin-chevron {
  transform: rotate(180deg);
}

.admin-accordion-body {
  display: none;
  padding: 2px 14px 14px;
}

.admin-accordion-item.open .admin-accordion-body {
  display: block;
}

.runtime-subsection {
  border: 1px solid rgba(127, 150, 190, .2);
  border-radius: 10px;
  padding: 12px;
  background: rgba(7, 12, 20, .35);
  display: grid;
  gap: 10px;
}

.runtime-subsection h3 {
  margin: 0;
  color: #c7d6ef;
  font-size: 14px;
  letter-spacing: .02em;
}

.assets-form {
  display: grid;
  gap: 14px;
}

.assets-toolbar {
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(260px, 1fr) auto;
  align-items: end;
}

.assets-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 8px;
  max-height: 58vh;
  overflow: auto;
  padding: 4px;
}

.asset-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid rgba(127, 150, 190, .25);
  border-radius: 8px;
  background: rgba(7, 12, 20, .45);
  font-size: 13px;
}

.status-error {
  background: rgba(255, 107, 107, .14);
  border-color: rgba(255, 107, 107, .35);
  color: #ffb7b7;
}

.engine-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  align-items: start;
}

.engine-workflow-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.engine-workflow-step {
  border: 1px solid rgba(127, 150, 190, .2);
  border-radius: 10px;
  background: rgba(7, 12, 20, .4);
  padding: 10px 12px;
  display: grid;
  gap: 4px;
}

.engine-workflow-step strong {
  font-size: 13px;
}

.engine-workflow-step span {
  color: var(--muted);
  font-size: 12px;
}

.engine-section-label {
  grid-column: 1 / -1;
  color: #9deeff;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .08em;
  padding: 2px 2px 0;
}

.engine-section-label.is-collapsible {
  padding: 0;
}

.engine-section-toggle {
  width: 100%;
  border: 1px solid rgba(127, 150, 190, .24);
  border-radius: 10px;
  background: rgba(7, 12, 20, .38);
  color: #9deeff;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .08em;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  cursor: pointer;
}

.engine-section-chevron {
  display: inline-flex;
  transition: transform .16s ease;
}

.engine-section-label:not(.is-collapsed) .engine-section-chevron {
  transform: rotate(180deg);
}

.engine-section-content {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.engine-section-content[hidden] {
  display: none;
}

.engine-card {
  border: 1px solid rgba(127, 150, 190, .18);
  border-top: 2px solid rgba(0, 210, 255, .22);
  border-radius: 10px;
  background: rgba(8, 14, 24, .55);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.engine-inline-note {
  border: 1px solid rgba(0, 210, 255, .22);
  background: rgba(0, 210, 255, .08);
  border-radius: 8px;
  padding: 10px 12px;
  display: grid;
  gap: 5px;
}

.engine-inline-note strong {
  font-size: 12px;
  color: #9deeff;
}

.engine-inline-note span {
  font-size: 12px;
  color: #c8d8f0;
}

.engine-card-hd {
  padding: 13px 16px 11px;
  border-bottom: 1px solid rgba(127, 150, 190, .13);
  background: rgba(255, 255, 255, .025);
}

.engine-card-bd {
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 1;
}

.engine-card h2 {
  margin: 0 0 2px;
  font-size: 16px;
  font-weight: 600;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(127, 150, 190, .13);
}

.engine-card-full {
  grid-column: 1 / -1;
}

.engine-card-span2 {
  grid-column: span 2;
}

.engine-mode-switch {
  display: inline-flex;
  gap: 8px;
  margin-bottom: 10px;
}

.engine-mode-switch .button.active {
  border-color: rgba(0, 210, 255, .7);
  background: rgba(0, 210, 255, .16);
  color: #9deeff;
}

#engineTab[data-engine-mode="basic"] .engine-advanced {
  display: none;
}

.engine-state-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.engine-state-item {
  border: 1px solid rgba(127, 150, 190, .2);
  border-radius: 8px;
  background: rgba(7, 12, 20, .35);
  padding: 10px;
  display: grid;
  grid-template-columns: 12px 1fr;
  gap: 10px;
  align-items: center;
}

.engine-state-item span {
  color: var(--muted);
  font-size: 12px;
}

.engine-state-item strong {
  color: #fff;
  font-size: 15px;
}

.engine-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
  background: rgba(127, 150, 190, .5);
  box-shadow: 0 0 0 3px rgba(127, 150, 190, .12);
}

.engine-dot.ok {
  background: #39ffa7;
  box-shadow: 0 0 0 3px rgba(57, 255, 167, .15);
}

.engine-dot.warn {
  background: #ffc107;
  box-shadow: 0 0 0 3px rgba(255, 193, 7, .15);
}

.engine-dot.danger {
  background: #ff6b6b;
  box-shadow: 0 0 0 3px rgba(255, 107, 107, .15);
}

.engine-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.bt-preset-btn.active {
  border-color: rgba(0, 210, 255, .7);
  color: #9deeff;
  background: rgba(0, 210, 255, .14);
}

.engine-kpis {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.engine-kpis>div {
  border: 1px solid rgba(127, 150, 190, .2);
  border-radius: 8px;
  background: rgba(7, 12, 20, .35);
  padding: 10px;
  display: grid;
  gap: 4px;
}

.engine-kpis span {
  color: var(--muted);
  font-size: 12px;
}

.engine-kpis strong {
  color: #fff;
  font-size: 18px;
}

/* Kontextsensitive Hilfe-Tooltips */
.engine-card h2 {
  display: flex;
  align-items: center;
  gap: 6px;
}

.help-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 400;
  color: var(--muted);
  cursor: help;
  position: relative;
  border: 1px solid rgba(127, 150, 190, .3);
  border-radius: 50%;
  width: 18px;
  height: 18px;
  line-height: 1;
  user-select: none;
  flex-shrink: 0;
  transition: color 0.15s, border-color 0.15s;
}

.help-icon:hover,
.help-icon:focus {
  color: var(--accent);
  border-color: var(--accent);
  outline: none;
}

.help-popup {
  display: none;
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(100% + 8px);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 400;
  color: var(--text);
  white-space: normal;
  width: 280px;
  z-index: 200;
  box-shadow: 0 6px 24px rgba(0, 0, 0, .45);
  line-height: 1.55;
  pointer-events: none;
}

.help-popup::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: var(--border);
}

.help-icon:hover .help-popup,
.help-icon:focus .help-popup {
  display: block;
}

/* In Tabellen nach unten aufklappen, sonst wird der Tooltip oben abgeschnitten. */
.table-wrap .help-popup {
  top: calc(100% + 8px);
  bottom: auto;
}

.table-wrap .help-popup::after {
  top: auto;
  bottom: 100%;
  border-top-color: transparent;
  border-bottom-color: var(--border);
}

/* Globales KI-Hilfe-Widget */
.portal-assistant {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 1200;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
}

.portal-assistant-toggle {
  border: 1px solid rgba(0, 210, 255, .55);
  background: linear-gradient(120deg, rgba(0, 210, 255, .95), rgba(29, 209, 161, .9));
  color: #00121f;
  border-radius: 999px;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 10px 25px rgba(0, 0, 0, .28);
}

.portal-assistant-panel {
  width: min(540px, calc(100vw - 24px));
  min-width: 420px;
  max-width: min(760px, calc(100vw - 24px));
  min-height: 360px;
  max-height: min(80vh, calc(100vh - 110px));
  border: 1px solid rgba(127, 150, 190, .3);
  border-radius: 12px;
  background: rgba(10, 18, 31, .96);
  box-shadow: 0 16px 32px rgba(0, 0, 0, .45);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  resize: both;
}

.portal-assistant-panel.hidden {
  display: none;
}

.portal-assistant-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border-bottom: 1px solid rgba(127, 150, 190, .2);
  padding: 10px 12px;
  background: rgba(255, 255, 255, .03);
}

.portal-assistant-head strong {
  font-size: 13px;
  color: #dfeaff;
}

.portal-assistant-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.portal-assistant-collapse {
  border: 1px solid rgba(127, 150, 190, .35);
  background: rgba(11, 20, 34, .9);
  color: #c7d7f0;
  border-radius: 8px;
  padding: 3px 8px;
  font-size: 12px;
  cursor: pointer;
}

.portal-assistant-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.portal-assistant-messages {
  padding: 12px;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
  flex: 1;
  scrollbar-gutter: stable;
}

.portal-assistant-msg {
  font-size: 13px;
  line-height: 1.55;
  border-radius: 12px;
  padding: 10px 12px;
  border: 1px solid rgba(127, 150, 190, .25);
  white-space: normal;
  word-break: break-word;
}

.portal-assistant-msg.assistant {
  background: rgba(7, 14, 25, .88);
  color: #d6e7ff;
}

.portal-assistant-msg.assistant p {
  margin: 0 0 .65em;
}

.portal-assistant-msg.assistant p:last-child {
  margin-bottom: 0;
}

.portal-assistant-msg.assistant ul,
.portal-assistant-msg.assistant ol {
  margin: .5em 0 .75em 1.25em;
  padding-left: 1.1em;
}

.portal-assistant-msg.assistant li+li {
  margin-top: .25em;
}

.portal-assistant-msg.assistant code {
  background: rgba(0, 210, 255, .08);
  border: 1px solid rgba(0, 210, 255, .18);
  border-radius: 6px;
  padding: .12em .4em;
  color: #a8f5ff;
  font-family: "JetBrains Mono", monospace;
  font-size: .95em;
}

.portal-assistant-msg.assistant pre {
  overflow: auto;
  background: rgba(4, 9, 18, .95);
  border: 1px solid rgba(127, 150, 190, .25);
  border-radius: 10px;
  padding: 12px;
  margin: .75em 0;
}

.portal-assistant-msg.assistant pre code {
  display: block;
  padding: 0;
  border: 0;
  background: transparent;
  color: #d6e7ff;
  white-space: pre;
}

.portal-assistant-msg.assistant blockquote {
  margin: .75em 0;
  padding: .5em .8em;
  border-left: 3px solid rgba(0, 210, 255, .45);
  background: rgba(0, 210, 255, .05);
  border-radius: 0 8px 8px 0;
}

.portal-assistant-msg.assistant a {
  color: #88ddff;
}

.portal-assistant-msg.user {
  align-self: flex-end;
  background: rgba(0, 210, 255, .18);
  border-color: rgba(0, 210, 255, .35);
  color: #e8ffff;
}

.portal-assistant-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  padding: 10px 12px 12px;
  border-top: 1px solid rgba(127, 150, 190, .18);
  flex: none;
}

.portal-assistant-form input {
  margin: 0;
  min-width: 0;
}

.portal-assistant-form .button {
  padding: 9px 12px;
}

.portal-assistant-panel.is-collapsed .portal-assistant-body {
  display: none;
}

.portal-assistant-panel.is-collapsed {
  width: 340px;
  min-width: 280px;
  min-height: 0;
  max-height: none;
  resize: none;
}

.topbar-symbol-picker-select,
.token-switcher-select {
  min-width: 150px;
  max-width: 220px;
}

.engine-kpis {
  grid-template-columns: 1fr;
}

.engine-state-grid {
  grid-template-columns: 1fr;
}

.portal-assistant {
  right: 12px;
  bottom: 12px;
}

.portal-assistant-panel {
  width: calc(100vw - 24px);
  min-width: 0;
  max-height: calc(100vh - 95px);
  max-width: calc(100vw - 24px);
}
}

/* ── Trading-Steuerung & Portfolio-Übersicht ─────────────────── */

.dashboard-controls-row {
  margin-top: 16px;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 14px;
  align-items: start;
}

@media (max-width: 900px) {
  .dashboard-controls-row {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 1200px) {
  .engine-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .engine-section-content {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .engine-card-span2 {
    grid-column: 1 / -1;
  }

  .engine-workflow-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  .engine-grid {
    grid-template-columns: 1fr;
  }

  .engine-section-content {
    grid-template-columns: 1fr;
  }
}

.panel-controls {
  min-width: 280px;
}

.grid-cards .panel-controls {
  min-width: 0;
  padding: 14px;
}

.controls-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.controls-header h2 {
  margin: 0;
}

.trading-status-badge {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .04em;
  padding: 3px 10px;
  border-radius: 20px;
  text-transform: uppercase;
}

.status-active {
  background: rgba(57, 255, 167, .14);
  border: 1px solid rgba(57, 255, 167, .45);
  color: #39ffa7;
}

.status-paused {
  background: rgba(255, 193, 7, .14);
  border: 1px solid rgba(255, 193, 7, .45);
  color: #ffc107;
}

.controls-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.ctrl-btn {
  padding: 7px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: opacity .15s, transform .1s;
}

.ctrl-btn:active {
  transform: scale(.97);
}

.ctrl-pause {
  background: rgba(255, 193, 7, .15);
  border-color: rgba(255, 193, 7, .5);
  color: #ffc107;
}

.ctrl-resume {
  background: rgba(57, 255, 167, .12);
  border-color: rgba(57, 255, 167, .45);
  color: #39ffa7;
}

.ctrl-stop {
  background: rgba(128, 140, 160, .14);
  border-color: rgba(128, 140, 160, .4);
  color: #a8b4c8;
}

.ctrl-allout.danger {
  background: rgba(255, 70, 70, .14);
  border-color: rgba(255, 70, 70, .5);
  color: #ff6b6b;
}

/* ── Holdings-Tabelle ──────────────────────────────────────────── */

.holdings-loading {
  color: var(--muted);
  font-size: 13px;
  padding: 8px 0;
}

.holdings-table {
  width: 100%;
  border-collapse: collapse;
}

.holdings-table th,
.holdings-table td {
  font-size: 12px;
  padding: 7px 8px;
}

.holdings-table th {
  color: var(--muted);
}

.holdings-total td {
  border-top: 1px solid var(--border);
  padding-top: 8px;
}

.holdings-updated {
  font-size: 11px;
  color: var(--muted);
  margin: 6px 0 0;
  text-align: right;
}

.text-right {
  text-align: right;
}

.holding-asset {
  font-weight: 600;
  font-size: 12px;
}

.holding-value-secondary {
  color: var(--muted);
  font-size: 11px;
}

.holding-flag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: 6px;
  padding: 0 6px;
  height: 18px;
  border-radius: 10px;
  border: 1px solid rgba(126, 164, 216, .45);
  background: rgba(126, 164, 216, .12);
  color: #9ec3ff;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .03em;
  vertical-align: middle;
  cursor: help;
}

.holdings-note {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 11px;
}

/* ── Modal-Dialoge ─────────────────────────────────────────────── */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .65);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  backdrop-filter: blur(2px);
}

.modal-overlay.hidden {
  display: none;
}

.modal-box {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 28px 32px;
  max-width: 480px;
  width: 90%;
  box-shadow: 0 8px 40px rgba(0, 0, 0, .55);
}

.modal-box-danger {
  border-color: rgba(255, 70, 70, .5);
}

.modal-box h3 {
  margin-top: 0;
  font-size: 18px;
}

.modal-box p {
  font-size: 14px;
  line-height: 1.55;
  color: #c8d4e8;
  margin: 10px 0;
}

.modal-hint {
  font-size: 12px !important;
  color: var(--muted) !important;
}

.danger-note {
  color: #ff9a9a !important;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
}

.modal-btn {
  padding: 8px 20px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: opacity .15s;
}

.modal-cancel {
  background: rgba(128, 140, 160, .14);
  border-color: rgba(128, 140, 160, .4);
  color: #a8b4c8;
}

.modal-confirm {
  background: rgba(57, 255, 167, .14);
  border-color: rgba(57, 255, 167, .45);
  color: #39ffa7;
}

.modal-confirm-warn {
  background: rgba(255, 193, 7, .14);
  border-color: rgba(255, 193, 7, .45);
  color: #ffc107;
}

.modal-confirm-danger {
  background: rgba(255, 70, 70, .18);
  border-color: rgba(255, 70, 70, .55);
  color: #ff6b6b;
  font-size: 12px;
}