/* Ultimate Trader Dashboard */

:root {
  --bg: #0f1117;
  --bg2: #1a1d27;
  --bg3: #22263a;
  --border: #2e3248;
  --text: #e2e8f0;
  --text-muted: #8892a4;
  --green: #22c55e;
  --red: #ef4444;
  --yellow: #f59e0b;
  --blue: #3b82f6;
  --purple: #a855f7;
  --accent: #6366f1;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
}

a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Layout ── */
.navbar {
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 32px;
  height: 52px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.navbar-brand {
  font-weight: 700;
  font-size: 16px;
  color: var(--accent);
  letter-spacing: 0.5px;
}

.navbar a {
  color: var(--text-muted);
  font-size: 13px;
  padding: 4px 0;
  border-bottom: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s;
}

.navbar a:hover, .navbar a.active {
  color: var(--text);
  text-decoration: none;
  border-bottom-color: var(--accent);
}

.container { max-width: 1400px; margin: 0 auto; padding: 24px; }

/* ── Grid ── */
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 24px; }

@media (max-width: 900px) {
  .grid-4 { grid-template-columns: 1fr 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
}

/* ── Cards ── */
.card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 20px;
}

.card-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

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

.card-sub {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ── Section ── */
.section { background: var(--bg2); border: 1px solid var(--border); border-radius: 8px; margin-bottom: 24px; }
.section-header {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ── Table ── */
table { width: 100%; border-collapse: collapse; }
th {
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--bg3); }

/* ── Colors ── */
.pos { color: var(--green); }
.neg { color: var(--red); }
.muted { color: var(--text-muted); }
.bold { font-weight: 700; }

/* ── Traffic Lights ── */
.tl {
  display: inline-block;
  width: 10px; height: 10px;
  border-radius: 50%;
  margin-right: 6px;
  flex-shrink: 0;
}
.tl-green { background: var(--green); box-shadow: 0 0 6px var(--green); }
.tl-yellow { background: var(--yellow); box-shadow: 0 0 6px var(--yellow); }
.tl-red { background: var(--red); box-shadow: 0 0 6px var(--red); }

.ticker-cell { display: flex; align-items: center; }

/* ── Badges ── */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.5px;
}
.badge-hold { background: #1e293b; color: #94a3b8; border: 1px solid #334155; }
.badge-trim { background: #2d1e00; color: var(--yellow); border: 1px solid #78350f; }
.badge-sell { background: #2d0000; color: var(--red); border: 1px solid #7f1d1d; }
.badge-buy  { background: #0d2d1e; color: var(--green); border: 1px solid #14532d; }

/* ── Conviction Bar ── */
.conv-bar {
  display: flex;
  gap: 2px;
  align-items: center;
}
.conv-pip {
  width: 6px; height: 14px;
  border-radius: 2px;
  background: var(--border);
}
.conv-pip.filled { background: var(--accent); }

/* ── Sector Bar ── */
.sector-bar-wrap { display: flex; align-items: center; gap: 8px; }
.sector-bar { height: 6px; border-radius: 3px; min-width: 2px; }
.sector-bar.pos-bar { background: var(--green); }
.sector-bar.neg-bar { background: var(--red); }

/* ── Alerts ── */
.alert {
  padding: 12px 16px;
  border-radius: 6px;
  margin-bottom: 16px;
  font-size: 13px;
}
.alert-warning { background: #2d1e00; border: 1px solid #78350f; color: var(--yellow); }
.alert-info    { background: #0c1a2e; border: 1px solid #1e3a5f; color: var(--blue); }
.alert-danger  { background: #2d0000; border: 1px solid #7f1d1d; color: var(--red); }
.alert-success { background: #0d2d1e; border: 1px solid #14532d; color: var(--green); }

/* ── Buttons ── */
.btn {
  display: inline-block;
  padding: 7px 16px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  font-family: inherit;
  transition: opacity 0.15s;
}
.btn:hover { opacity: 0.85; }
.btn-primary { background: var(--accent); color: white; }
.btn-warning { background: #78350f; color: var(--yellow); }
.btn-danger  { background: #7f1d1d; color: var(--red); }
.btn-ghost   { background: var(--bg3); color: var(--text-muted); border: 1px solid var(--border); }
.btn-sm      { padding: 4px 10px; font-size: 11px; }

/* ── Run panel ── */
.run-panel { display: flex; align-items: center; gap: 12px; margin-bottom: 24px; }
#run-result { font-size: 13px; }

/* ── Report ── */
.report-body {
  padding: 24px 32px;
  max-width: 900px;
  line-height: 1.8;
}
.report-body h1 { font-size: 22px; margin-bottom: 8px; color: var(--accent); }
.report-body h2 { font-size: 16px; margin: 24px 0 12px; color: var(--text); border-bottom: 1px solid var(--border); padding-bottom: 6px; }
.report-body h3 { font-size: 14px; margin: 16px 0 8px; color: var(--text-muted); }
.report-body table { margin: 12px 0; font-size: 13px; }
.report-body th { background: var(--bg3); }
.report-body p { margin: 8px 0; color: var(--text-muted); }
.report-body ul { padding-left: 20px; }
.report-body li { margin: 4px 0; color: var(--text-muted); }
.report-body hr { border: none; border-top: 1px solid var(--border); margin: 20px 0; }
.report-body blockquote { border-left: 3px solid var(--yellow); padding-left: 12px; color: var(--yellow); }
.report-body code { background: var(--bg3); padding: 1px 5px; border-radius: 3px; font-size: 12px; }

/* ── Watchlist ── */
.wl-score { font-variant-numeric: tabular-nums; }

/* ── HTMX loading ── */
.htmx-indicator { opacity: 0; transition: opacity 0.2s; }
.htmx-request .htmx-indicator { opacity: 1; }

/* ── Spinner ── */
@keyframes spin { to { transform: rotate(360deg); } }
.spinner {
  display: inline-block;
  width: 14px; height: 14px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}
