:root {
  --bg: #0b1220;
  --surface: #111a2e;
  --text: #e8edf7;
  --muted: #94a3b8;
  --border: #1f2b42;
  --green: #16a34a;
  --red: #dc2626;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
}
.container { max-width: 1200px; margin: 0 auto; padding: 24px; }
.page-header p { color: var(--muted); }
.header-topline {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  flex-wrap: wrap;
}
.last-updated-wrap {
  display: grid;
  gap: 6px;
  justify-items: end;
}
.last-updated { color: var(--muted); font-size: 0.88rem; }
.refresh-toggle {
  color: var(--muted);
  font-size: 0.82rem;
  display: inline-flex;
  gap: 6px;
  align-items: center;
}
.cta-strip {
  margin: 16px 0;
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
  flex-wrap: wrap;
}
.cta-strip h3 { margin: 0 0 6px; }
.cta-strip p { margin: 0; color: var(--muted); }
.cta-helper {
  margin-top: 8px !important;
  color: #cbd5e1 !important;
  font-size: 0.9rem;
}
.cta-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.cta-btn {
  text-decoration: none;
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: #dbeafe;
  border: 1px solid #1e40af;
  border-radius: 8px;
  padding: 10px 14px;
  font-weight: 600;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.25);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.cta-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.3);
}
.cta-btn.secondary {
  background: transparent;
  color: var(--text);
  border-color: var(--border);
  box-shadow: none;
}
.cta-strip-bottom {
  margin-top: 18px;
}
.trust-strip {
  margin: 12px 0 16px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  align-items: center;
}
.trust-item {
  min-width: 0;
}
.trust-label {
  color: var(--muted);
  font-size: 0.8rem;
}
.trust-value {
  margin-top: 4px;
  font-size: 1.06rem;
  font-weight: 700;
}
.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin: 20px 0;
}
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
}
.card .label { color: var(--muted); font-size: 0.86rem; }
.card .value { margin-top: 6px; font-size: 1.4rem; font-weight: 700; }
.positive { color: var(--green); }
.negative { color: var(--red); }
.filters {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  margin: 12px 0 20px;
}
.filters div { display: grid; gap: 6px; }
select {
  background: #0f172a;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
}
.chart-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}
.muted-section {
  opacity: 0.6;
}
.chart-box {
  position: relative;
  height: 260px;
  width: 100%;
}
.chart-box canvas {
  width: 100% !important;
  height: 100% !important;
  display: block;
}
.global-state {
  margin-bottom: 16px;
  color: #cbd5e1;
}
.global-state.warning {
  border-color: rgba(220, 38, 38, 0.4);
  color: #fca5a5;
}
.quick-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.quick-tab {
  border: 1px solid var(--border);
  background: #0f172a;
  color: #cbd5e1;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 0.84rem;
}
.quick-tab.active {
  background: rgba(37, 99, 235, 0.2);
  border-color: #1d4ed8;
  color: #dbeafe;
}
.table-controls {
  display: flex;
  align-items: end;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.control {
  display: grid;
  gap: 6px;
  min-width: 180px;
}
.control input {
  background: #0f172a;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
}
.history-range { color: var(--muted); font-size: 0.9rem; margin-left: auto; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
th, td {
  border-bottom: 1px solid var(--border);
  padding: 10px;
  text-align: left;
  white-space: nowrap;
}
thead th {
  position: sticky;
  top: 0;
  background: var(--surface);
  z-index: 1;
}
th[data-sort] { cursor: pointer; user-select: none; }
.sort-indicator { color: var(--muted); font-size: 0.75rem; margin-left: 4px; }
.targets-mobile { display: none; }
.empty-state {
  margin-top: 12px;
  color: var(--muted);
  padding: 12px;
  border: 1px dashed var(--border);
  border-radius: 8px;
  text-align: center;
}
.table-pagination {
  margin-top: 12px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}
.table-pagination button {
  background: #0f172a;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 10px;
}
.table-pagination button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.badge {
  display: inline-block;
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
}
.badge.win { background: rgba(22,163,74,0.2); color: #4ade80; }
.badge.loss { background: rgba(220,38,38,0.25); color: #f87171; }
.badge.open { background: rgba(148,163,184,0.2); color: #cbd5e1; }
.methodology ul {
  margin: 8px 0 0;
  padding-left: 18px;
  color: #cbd5e1;
  display: grid;
  gap: 8px;
}
.page-footer {
  margin: 16px 0 10px;
  color: var(--muted);
  text-align: center;
  font-size: 0.86rem;
}
.hidden { display: none; }

@media (max-width: 640px) {
  .container { padding: 16px; }
  .trust-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }
  .cta-actions {
    width: 100%;
  }
  .cta-actions .cta-btn {
    flex: 1 1 auto;
    text-align: center;
  }
  .targets-full { display: none; }
  .targets-mobile {
    display: inline-block;
    color: #cbd5e1;
  }
  .targets-mobile summary {
    cursor: pointer;
    color: #93c5fd;
  }
  th, td {
    padding: 8px 6px;
    font-size: 0.82rem;
  }
  .history-range { margin-left: 0; }
  .last-updated-wrap { justify-items: start; }
}
