:root {
  --bg:         #0f172a;
  --surface:    #1e293b;
  --surface-2:  #334155;
  --border:     #334155;
  --text:       #e2e8f0;
  --text-muted: #64748b;
  --text-sub:   #94a3b8;
  --green:      #22c55e;
  --red:        #ef4444;
  --blue:       #38bdf8;
  --purple:     #a78bfa;
  --orange:     #fb923c;
  --yellow:     #f59e0b;
  --accent:     #0ea5e9;
}

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'SF Mono', 'Cascadia Code', 'Fira Code', ui-monospace, monospace;
  font-size: 13px;
  line-height: 1.5;
  min-height: 100vh;
}

/* ── HEADER ── */
header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  padding: 0 24px;
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 24px;
  height: 52px;
  max-width: 1200px;
  margin: 0 auto;
}

.logo {
  font-size: 14px;
  font-weight: 700;
  color: var(--blue);
  white-space: nowrap;
  letter-spacing: -0.02em;
}

.tabs { display: flex; gap: 2px; }

.tab {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-family: inherit;
  font-size: 12px;
  font-weight: 500;
  padding: 6px 14px;
  border-radius: 20px;
  transition: background 0.12s, color 0.12s;
  white-space: nowrap;
}

.tab:hover { background: var(--surface-2); color: var(--text); }
.tab.active { background: var(--accent); color: #fff; }

.last-update {
  margin-left: auto;
  font-size: 10px;
  color: var(--text-muted);
  white-space: nowrap;
}

/* ── LAYOUT ── */
main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px;
}

.tab-content { display: none; }
.tab-content.active { display: block; }

/* ── METRIC CARDS ── */
.metrics-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.metric-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px 12px;
  text-align: center;
}

.metric-value {
  font-size: 21px;
  font-weight: 700;
  margin-bottom: 4px;
}

.metric-value.neutral  { color: var(--text); }
.metric-value.positive { color: var(--green); }
.metric-value.negative { color: var(--red); }
.metric-value.green    { color: var(--green); }
.metric-value.blue     { color: var(--blue); }
.metric-value.purple   { color: var(--purple); }
.metric-value.orange   { color: var(--orange); }

.metric-label {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ── CARDS GRID ── */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

/* ── BASE CARD ── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 16px;
}

.card-header {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 12px 16px 8px;
  border-bottom: 1px solid var(--border);
}

/* ── POSITION / ORDER CARDS ── */
.pos-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px;
}

.pos-card.open    { border-left: 3px solid var(--green); }
.pos-card.pending { border-left: 3px solid var(--yellow); }
.pos-card.section-label {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 8px 0 4px;
  grid-column: 1/-1;
}

.pos-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.ticker-name {
  font-weight: 700;
  color: var(--blue);
  font-size: 14px;
}

.score-badge {
  background: rgba(124, 58, 237, 0.25);
  color: var(--purple);
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 600;
}

.score-badge.low {
  background: rgba(51, 65, 85, 0.5);
  color: var(--text-muted);
}

.pos-meta {
  font-size: 11px;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.pnl-inline { font-weight: 700; }
.pnl-inline.positive { color: var(--green); }
.pnl-inline.negative { color: var(--red); }

/* ── EQUITY CHART ── */
.chart-wrap {
  padding: 16px 16px 8px;
  width: 100%;
  overflow: hidden;
}

#equity-curve { display: block; width: 100%; height: 110px; }

/* ── DATA TABLE ── */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.data-table th {
  text-align: left;
  padding: 10px 16px;
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.data-table td {
  padding: 9px 16px;
  border-bottom: 1px solid rgba(51, 65, 85, 0.4);
  color: var(--text-sub);
}

.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: rgba(255, 255, 255, 0.02); }

/* ── BADGES ── */
.result-badge {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.03em;
}

.result-badge.win  { background: rgba(34,197,94,0.15);  color: var(--green); }
.result-badge.loss { background: rgba(239,68,68,0.15);  color: var(--red); }
.result-badge.time { background: rgba(245,158,11,0.15); color: var(--yellow); }

.tier-badge {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
}

.tier-badge.muy_alto { background: rgba(124,58,237,0.2); color: #a78bfa; }
.tier-badge.alto     { background: rgba(3,105,161,0.2);  color: var(--blue); }
.tier-badge.medio    { background: rgba(234,179,8,0.15); color: var(--yellow); }

/* ── SEÑALES ── */
.senal-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 16px;
  margin-bottom: 10px;
}

.senal-card.aprobada { border-left: 3px solid var(--green); }
.senal-card.pendiente { border-left: 3px solid var(--yellow); }
.senal-card.rechazada { border-left: 3px solid var(--surface-2); opacity: 0.65; }

.senal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.senal-levels { font-size: 11px; color: var(--text-muted); }
.senal-status { font-size: 11px; color: var(--text-muted); margin-top: 4px; }

/* ── DIRECTION ── */
.dir-long  { color: var(--blue);  font-weight: 600; }
.dir-short { color: #f87171;      font-weight: 600; }

/* ── EMPTY STATE ── */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-muted);
  font-size: 12px;
}

/* ── RESPONSIVE ── */
@media (max-width: 640px) {
  main { padding: 16px 12px; }
  .header-inner { gap: 12px; padding: 0; }
  .logo { font-size: 13px; }
  .tab { padding: 5px 10px; font-size: 11px; }
  .metric-value { font-size: 18px; }
  .data-table { font-size: 11px; }
  .data-table th, .data-table td { padding: 8px 10px; }
}
