/* Trading-Desk Dashboard — Scalable-inspiriertes, eigenständiges Design.
   Palette: validierte dataviz-Skill-Standardpalette (brand-neutraler
   Platzhalter, siehe UI.md "Offene Punkte" — bei Bedarf gegen eigene
   Cortex-AI-Markenfarben tauschen und den Validator erneut laufen lassen). */

:root {
  color-scheme: light;
  --page: #f9f9f7;
  --surface: #fcfcfb;
  --surface-raised: #ffffff;
  --text-primary: #0b0b0b;
  --text-secondary: #52514e;
  --text-muted: #898781;
  --gridline: #e1e0d9;
  --border: rgba(11, 11, 11, 0.10);
  --series-1: #2a78d6; /* Portfolio / Moltbook */
  --series-2: #eb6834; /* Benchmark / eToro */
  --series-3: #1baf7a; /* technisch */
  --series-4: #eda100; /* News */
  --good: #006300;
  --critical: #d03b3b;
  --radius: 10px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    color-scheme: dark;
    --page: #0d0d0d;
    --surface: #1a1a19;
    --surface-raised: #201f1e;
    --text-primary: #ffffff;
    --text-secondary: #c3c2b7;
    --text-muted: #898781;
    --gridline: #2c2c2a;
    --border: rgba(255, 255, 255, 0.10);
    --series-1: #3987e5;
    --series-2: #d95926;
    --series-3: #199e70;
    --series-4: #c98500;
    --good: #0ca30c;
    --critical: #e66767;
  }
}

:root[data-theme='dark'] {
  color-scheme: dark;
  --page: #0d0d0d;
  --surface: #1a1a19;
  --surface-raised: #201f1e;
  --text-primary: #ffffff;
  --text-secondary: #c3c2b7;
  --text-muted: #898781;
  --gridline: #2c2c2a;
  --border: rgba(255, 255, 255, 0.10);
  --series-1: #3987e5;
  --series-2: #d95926;
  --series-3: #199e70;
  --series-4: #c98500;
  --good: #0ca30c;
  --critical: #e66767;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--page);
  color: var(--text-primary);
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.5;
}

a { color: inherit; }

/* --- Login --- */

.login-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.login-card {
  width: 100%;
  max-width: 360px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
}

.login-card h1 {
  font-size: 20px;
  margin: 0 0 4px;
}

.login-card p.subtitle {
  color: var(--text-secondary);
  margin: 0 0 24px;
  font-size: 13px;
}

.field { margin-bottom: 16px; }

.field label {
  display: block;
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.field input {
  width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-raised);
  color: var(--text-primary);
  font-size: 14px;
}

.field input:focus {
  outline: 2px solid var(--series-1);
  outline-offset: 1px;
}

button.primary {
  width: 100%;
  padding: 11px;
  border-radius: 8px;
  border: none;
  background: var(--series-1);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

button.primary:hover { filter: brightness(1.08); }

.error-msg {
  color: var(--critical);
  font-size: 13px;
  margin-top: 12px;
  min-height: 1.2em;
}

/* --- Dashboard shell --- */

.app-shell {
  display: grid;
  grid-template-columns: 220px 1fr;
  min-height: 100vh;
}

.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
}

.sidebar .brand {
  font-weight: 700;
  font-size: 16px;
  margin-bottom: 28px;
  padding: 0 8px;
}

.nav-item {
  display: block;
  padding: 10px 12px;
  border-radius: 8px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 14px;
  margin-bottom: 2px;
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  font-family: inherit;
}

.nav-item:hover { background: var(--gridline); color: var(--text-primary); }
.nav-item.active { background: var(--series-1); color: #fff; }

.sidebar .spacer { flex: 1; }

.logout-btn {
  color: var(--text-muted);
  font-size: 13px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  text-align: left;
}

main {
  padding: 32px 40px;
  max-width: 1100px;
  overflow-x: auto;
}

.page { display: none; }
.page.active { display: block; }

h2.page-title {
  font-size: 22px;
  margin: 0 0 24px;
}

/* --- KPI cards --- */

.kpi-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
}

.kpi-card .label {
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 8px;
}

.kpi-card .value {
  font-size: 26px;
  font-weight: 700;
}

.kpi-card .delta { font-size: 13px; margin-top: 4px; }
.kpi-card .delta.up { color: var(--good); }
.kpi-card .delta.down { color: var(--critical); }

/* --- Panels / charts / tables --- */

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
  margin-bottom: 24px;
}

.panel h3 {
  font-size: 15px;
  margin: 0 0 16px;
  font-weight: 600;
}

.chart-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

.legend {
  display: flex;
  gap: 16px;
  margin-bottom: 12px;
  font-size: 12px;
  color: var(--text-secondary);
}

.legend .swatch {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  margin-right: 6px;
  vertical-align: middle;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

th, td {
  text-align: left;
  padding: 10px 8px;
  border-bottom: 1px solid var(--gridline);
}

th {
  color: var(--text-muted);
  font-weight: 500;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

td.num { font-variant-numeric: tabular-nums; text-align: right; }

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
}

.badge.buy { background: color-mix(in srgb, var(--good) 15%, transparent); color: var(--good); }
.badge.sell { background: color-mix(in srgb, var(--critical) 15%, transparent); color: var(--critical); }
.badge.executed { background: color-mix(in srgb, var(--series-1) 15%, transparent); color: var(--series-1); }
.badge.proposed { background: var(--gridline); color: var(--text-secondary); }
.badge.rejected { background: color-mix(in srgb, var(--critical) 15%, transparent); color: var(--critical); }

.tooltip {
  position: absolute;
  pointer-events: none;
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
  display: none;
  white-space: nowrap;
  z-index: 10;
}

.empty-state {
  color: var(--text-muted);
  font-size: 13px;
  padding: 24px 0;
  text-align: center;
}
