/* Dark dashboard — Sven */

:root {
  --bg0: #0a0c10;
  --bg1: #12151c;
  --glass: rgba(28, 32, 44, 0.72);
  --border: rgba(120, 140, 180, 0.18);
  --text: #e8eaf0;
  --muted: #8b93a7;
  --accent: #3ee8c7;
  --accent2: #7c5cff;
  --radius: 14px;
  --font: "DM Sans", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  font-family: var(--font);
  background: radial-gradient(1200px 800px at 10% -10%, rgba(124, 92, 255, 0.12), transparent),
              radial-gradient(900px 600px at 90% 0%, rgba(62, 232, 199, 0.08), transparent),
              var(--bg0);
  color: var(--text);
}

.theme-dark a { color: var(--accent); text-decoration: none; }
.theme-dark a:hover { text-decoration: underline; }

.bg-grid {
  pointer-events: none;
  position: fixed;
  inset: 0;
  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;
  mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, black, transparent);
  z-index: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(12px);
  background: rgba(10, 12, 16, 0.75);
}

.brand { display: flex; align-items: baseline; gap: 0.5rem; }
.brand-mark { color: var(--accent); font-size: 1.25rem; }
.brand-text { font-weight: 700; letter-spacing: -0.02em; font-size: 1.15rem; }
.brand-sub { color: var(--muted); font-size: 0.85rem; }

.nav a {
  margin-left: 1rem;
  color: var(--muted);
  font-size: 0.9rem;
}
.nav a:hover { color: var(--accent); }

.main-wrap {
  position: relative;
  z-index: 1;
  max-width: 1480px;
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
}

.hero h1 {
  font-size: 1.75rem;
  margin: 0 0 0.5rem;
  letter-spacing: -0.03em;
}
.lede { color: var(--muted); max-width: 52rem; line-height: 1.55; margin: 0.25rem 0 1rem; }
.muted { color: var(--muted); }
.tiny { font-size: 0.8rem; }

.mono {
  font-family: var(--mono);
  font-size: 0.82rem;
}

.pill {
  display: inline-block;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  background: rgba(62, 232, 199, 0.12);
  color: var(--accent);
  border: 1px solid rgba(62, 232, 199, 0.35);
  font-family: var(--mono);
  font-size: 0.85rem;
}

.panel {
  border-radius: var(--radius);
  padding: 1.25rem;
  border: 1px solid var(--border);
}

.glass {
  background: var(--glass);
  backdrop-filter: blur(16px);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
}

.table-wrap {
  overflow: auto;
  border-radius: 10px;
}

/* Single horizontal scroll — avoids DataTables scrollX/scrollY header/body misalignment */
.table-wrap.dash-table-scroll {
  overflow-x: auto;
  overflow-y: visible;
  -webkit-overflow-scrolling: touch;
  width: 100%;
}

table.dash-data-table {
  width: max-content;
  min-width: 100%;
  border-collapse: collapse;
  table-layout: auto;
}

table.dash-data-table thead th,
table.dash-data-table tbody td {
  white-space: nowrap;
  vertical-align: middle;
  box-sizing: border-box;
}

table.dash-data-table thead th {
  padding: 0.65rem 1.1rem;
  text-align: left;
}

table.dash-data-table tbody td {
  padding: 0.5rem 1.1rem;
}

/* Probabilities: monospace + right-align + room for full value on one line */
/* Numeric prediction columns (per-target slugs + final mean) */
table.dash-data-table th[class^="col-t"],
table.dash-data-table td[class^="col-t"],
table.dash-data-table th.col-mean_all_P,
table.dash-data-table td.col-mean_all_P {
  text-align: right;
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  min-width: 5.75rem;
  padding-left: 0.85rem;
  font-size: 0.82rem;
}

table.dash-data-table th.col-symbol,
table.dash-data-table td.col-symbol {
  min-width: 5.5rem;
}

table.dash-data-table th.col-sector,
table.dash-data-table td.col-sector {
  min-width: 12rem;
}

table.dash-data-table th.col-date,
table.dash-data-table td.col-date {
  min-width: 7.5rem;
  font-family: var(--mono);
}

/* DataTables dark overrides */
.dataTables_wrapper { color: var(--text); font-size: 0.88rem; }
.dataTables_filter input {
  background: var(--bg1) !important;
  border: 1px solid var(--border) !important;
  color: var(--text) !important;
  border-radius: 8px;
  padding: 0.35rem 0.6rem !important;
}
table.dataTable thead th {
  border-bottom: 1px solid var(--border) !important;
  color: var(--muted);
  font-weight: 600;
}
table.dataTable tbody tr { background: transparent !important; }
table.dataTable tbody td { border-color: rgba(255,255,255,0.06) !important; }
table.dataTable.stripe tbody tr.odd { background: rgba(255,255,255,0.02) !important; }

/* Keep DataTables layout from shrinking columns awkwardly */
.dataTables_wrapper .dataTables_scrollHead table,
.dataTables_wrapper .dataTables_scrollBody table {
  width: 100% !important;
}

.sym-link {
  font-weight: 600;
  color: var(--accent) !important;
}

.footer {
  position: relative;
  z-index: 1;
  padding: 1.5rem;
  text-align: center;
  color: var(--muted);
  font-size: 0.8rem;
  border-top: 1px solid var(--border);
}

.crumb { margin: 0 0 0.5rem; }

.section-title {
  margin: 0 0 0.75rem;
  font-size: 1.1rem;
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.65rem;
  margin-top: 1rem;
  max-height: 70vh;
  overflow: auto;
}

.feature-cell {
  padding: 0.5rem 0.65rem;
  border-radius: 8px;
  background: rgba(0,0,0,0.25);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}
.feature-cell .k {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  font-family: var(--mono);
}
.feature-cell .v {
  font-size: 0.88rem;
  word-break: break-word;
}

table.scores-mini {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}
table.scores-mini th,
table.scores-mini td {
  padding: 0.4rem 0.55rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
}
table.scores-mini th { color: var(--muted); font-weight: 600; }
table.scores-mini tbody tr:hover { background: rgba(255,255,255,0.03); }
table.scores-mini tr.scores-combined {
  border-top: 1px solid var(--border);
  background: rgba(62, 232, 199, 0.06);
}
table.scores-mini tr.scores-combined td { color: var(--text); }

/* Symbol page — time series */
.viz-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.75rem 1rem;
  margin: 0.75rem 0 0.5rem;
}
.viz-field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 10rem;
  flex: 1 1 12rem;
}
.viz-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}
.viz-select {
  font-family: var(--mono);
  font-size: 0.78rem;
  padding: 0.45rem 0.55rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg1);
  color: var(--text);
  max-width: 100%;
}
.viz-select:focus {
  outline: none;
  border-color: rgba(62, 232, 199, 0.45);
  box-shadow: 0 0 0 1px rgba(62, 232, 199, 0.2);
}
.viz-btn {
  font-family: var(--font);
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  border: 1px solid rgba(62, 232, 199, 0.35);
  background: rgba(62, 232, 199, 0.12);
  color: var(--accent);
  cursor: pointer;
  align-self: flex-end;
}
.viz-btn:hover {
  background: rgba(62, 232, 199, 0.2);
}
.viz-chart {
  min-height: 420px;
  width: 100%;
}
#viz-msg:empty { display: none; }
