:root {
  --surface-1: #12151c;
  --surface-2: #171b24;
  --page: #0a0c10;
  --border: rgba(255,255,255,0.08);
  --border-strong: rgba(255,255,255,0.14);
  --text-primary: #ffffff;
  --text-secondary: #c3c2b7;
  --text-muted: #7c8494;
  --good: #00e6b8;        /* cian neon - mismo que las velas alcistas */
  --critical: #ff4d8d;    /* magenta neon - mismo que las velas bajistas */
  --accent-1: #3987e5;   /* blue  - categorical slot 1 (dark) */
  --accent-2: #9085e9;   /* violet - categorical slot 7 (dark) */
  --accent-grad: linear-gradient(135deg, var(--accent-1), var(--accent-2));
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--page);
  color: var(--text-primary);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  overflow-x: hidden;
}

body { padding-bottom: 48px; position: relative; }

.bg-glow {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(600px 400px at 15% -10%, rgba(57,135,229,0.16), transparent 60%),
    radial-gradient(500px 380px at 100% 10%, rgba(144,133,233,0.14), transparent 60%);
  pointer-events: none;
}

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

.brand { display: flex; align-items: center; gap: 8px; }
.brand-mark {
  width: 26px; height: 26px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 8px;
  background: var(--accent-grad);
  color: #fff;
  font-weight: 700;
  font-size: 14px;
}
.topbar h1 { font-size: 17px; margin: 0; letter-spacing: 0.01em; font-weight: 650; }

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 20px;
  border: 1px solid var(--border);
}
.status-live { background: rgba(0,230,184,0.10); color: var(--good); border-color: rgba(0,230,184,0.25); }
.status-frozen { background: rgba(255,77,141,0.10); color: var(--critical); border-color: rgba(255,77,141,0.3); }
.status-unknown { background: rgba(255,255,255,0.04); color: var(--text-muted); }

.pulse-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 0 0 currentColor;
  animation: pulse 1.8s infinite;
}
@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 rgba(0,230,184,0.5); }
  70%  { box-shadow: 0 0 0 7px rgba(0,230,184,0); }
  100% { box-shadow: 0 0 0 0 rgba(0,230,184,0); }
}

.install-hint {
  margin: 14px 16px 0;
  padding: 12px 14px;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 12px;
  font-size: 13px;
  color: var(--text-secondary);
}

.push-section {
  margin: 14px 16px 0;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.push-status { font-size: 12px; color: var(--text-muted); }

button {
  background: var(--accent-grad);
  color: white;
  border: none;
  padding: 11px 18px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 650;
  box-shadow: 0 4px 20px -6px rgba(57,135,229,0.5);
}
button:disabled { opacity: 0.55; box-shadow: none; }

main { padding: 16px; display: flex; flex-direction: column; gap: 22px; }

h2 {
  font-size: 12px;
  color: var(--text-muted);
  margin: 0 0 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
}

.chart-card {
  background: linear-gradient(180deg, var(--surface-1), var(--surface-2));
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 16px 14px 8px;
  box-shadow: 0 12px 32px -18px rgba(0,0,0,0.6);
}
.chart-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.chart-card-head h2 { margin: 0; font-size: 13px; color: var(--text-secondary); }
.live-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--good);
}
#chart { width: 100%; height: 420px; }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
.stat-tile {
  background: linear-gradient(180deg, var(--surface-1), var(--surface-2));
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.stat-tile.hero {
  grid-column: 1 / -1;
  padding: 18px 18px;
  position: relative;
  overflow: hidden;
}
.stat-tile.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--accent-grad);
  opacity: 0.08;
}
.stat-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 650;
}
.stat-value {
  font-size: 22px;
  font-weight: 650;
  color: var(--text-primary);
}
.stat-tile.hero .stat-value { font-size: 34px; }
.stat-value.pos { color: var(--good); }
.stat-value.neg { color: var(--critical); }

.ea-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
.ea-card {
  background: linear-gradient(180deg, var(--surface-1), var(--surface-2));
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.ea-name {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-secondary);
  letter-spacing: 0.01em;
}
.ea-metric { display: flex; align-items: baseline; justify-content: space-between; }
.ea-metric-value { font-size: 15px; font-weight: 650; font-variant-numeric: tabular-nums; }
.ea-metric-label { font-size: 10.5px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; }

.table-section { display: flex; flex-direction: column; }
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: linear-gradient(180deg, var(--surface-1), var(--surface-2));
}

table { width: 100%; border-collapse: collapse; font-size: 13.5px; font-variant-numeric: tabular-nums; }
th, td { padding: 11px 13px; text-align: left; white-space: nowrap; }
thead th {
  color: var(--text-muted);
  font-weight: 650;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border);
}
tbody tr:not(:last-child) { border-bottom: 1px solid var(--border); }

.dir-chip {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 7px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.dir-buy { background: rgba(57,135,229,0.14); color: #6fabf0; }
.dir-sell { background: rgba(144,133,233,0.16); color: #b4abf3; }

.profit-pos { color: var(--good); font-weight: 650; }
.profit-neg { color: var(--critical); font-weight: 650; }
.stale-row { opacity: 0.4; }

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

.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100vh;
  background: var(--page);
  margin: 0;
  position: relative;
}
.login-card {
  background: linear-gradient(180deg, var(--surface-1), var(--surface-2));
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 30px;
  width: 280px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: 0 20px 60px -20px rgba(0,0,0,0.7);
}
.login-card h1 { color: var(--text-primary); font-size: 18px; margin: 0 0 8px; text-align: center; }
.login-card input {
  background: #0e121a;
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: 11px 12px;
  border-radius: 10px;
  font-size: 14px;
}
.login-error { color: var(--critical); font-size: 13px; margin: 0; text-align: center; }
