:root {
  --bg: #0b0b0c;
  --panel: #131316;
  --panel-2: #1a1a1f;
  --line: #26262d;
  --text: #ececef;
  --muted: #8d8d97;
  --gold: #e8b923;
  --gold-soft: rgba(232, 185, 35, 0.14);
  --green: #2fbf71;
  --red: #ef5350;
  --amber: #f0a23a;
  --radius: 12px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body { font-size: 15px; line-height: 1.45; padding-bottom: env(safe-area-inset-bottom); }
h1, h2 { margin: 0; font-weight: 650; letter-spacing: 0.01em; }
h2 { font-size: 16px; }
a { color: var(--gold); }
.muted { color: var(--muted); }
.pos { color: var(--green); }
.neg { color: var(--red); }

/* Cinturón (marca) */
.belt { display: flex; align-items: center; gap: 10px; background: linear-gradient(180deg, #19191c, #0f0f11); border: 1px solid #2a2a30; border-radius: 6px; padding: 8px 14px; font-family: Georgia, "Times New Roman", serif; color: var(--gold); letter-spacing: 0.18em; font-size: 13px; font-weight: 700; box-shadow: inset 0 1px 0 rgba(255,255,255,0.04); }
.belt i { width: 34px; height: 30px; border: 2px solid var(--gold); border-radius: 4px; background: #0d0d0f; }
.belt.small { font-size: 11px; padding: 6px 10px; }
.belt.small i { width: 24px; height: 22px; }

/* Barra superior */
.topbar { position: sticky; top: 0; z-index: 5; display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: calc(10px + env(safe-area-inset-top)) 18px 10px; background: rgba(11,11,12,0.92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.pills { display: flex; flex-wrap: wrap; gap: 6px; flex: 1; }
.pill { font-size: 12px; padding: 3px 9px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); }
.pill.ok { color: var(--green); border-color: rgba(47,191,113,0.35); }
.pill.warn { color: var(--amber); border-color: rgba(240,162,58,0.4); }
.pill.danger { color: #fff; background: var(--red); border-color: var(--red); }
.top-actions { display: flex; gap: 8px; }

.wrap { max-width: 1180px; margin: 0 auto; padding: 18px; display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); }
.wrap > * { min-width: 0; }
html, body { overflow-x: hidden; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 12px; }
.empty { color: var(--muted); margin: 4px 0; }
.foot { text-align: center; font-size: 12px; }

.banner { border-radius: var(--radius); padding: 10px 14px; border: 1px solid var(--line); }
.banner.warn { border-color: rgba(240,162,58,0.5); color: var(--amber); }
.banner.info { border-color: rgba(232,185,35,0.4); color: var(--gold); }

/* KPIs */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; display: grid; gap: 2px; }
.kpi-label { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
.kpi-value { font-size: 22px; font-variant-numeric: tabular-nums; }
.kpi-sub { font-size: 12px; color: var(--muted); }

/* Tarjetas de señal */
.cards { display: grid; gap: 12px; }
.card { background: var(--panel-2); border: 1px solid var(--line); border-left: 4px solid var(--gold); border-radius: var(--radius); padding: 14px; }
.card.buy { border-left-color: var(--green); }
.card.sell { border-left-color: var(--red); }
.card.focus { box-shadow: 0 0 0 2px var(--gold); }
.card-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 10px; }
.side { font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 6px; }
.side.buy { background: rgba(47,191,113,0.15); color: var(--green); }
.side.sell { background: rgba(239,83,80,0.15); color: var(--red); }
.sym { font-size: 20px; }
.grade { margin-left: auto; background: var(--gold-soft); color: var(--gold); padding: 3px 10px; border-radius: 999px; font-weight: 700; font-size: 13px; }
.levels { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; }
.levels div { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 8px; display: grid; }
.levels span { font-size: 11px; color: var(--muted); }
.levels b { font-variant-numeric: tabular-nums; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0; }
.chip { font-size: 12px; border: 1px solid var(--line); border-radius: 999px; padding: 2px 8px; color: var(--muted); }
.card-actions { display: flex; align-items: center; justify-content: flex-end; gap: 10px; }
.countdown { margin-right: auto; color: var(--muted); font-variant-numeric: tabular-nums; }
.countdown.urgent { color: var(--amber); font-weight: 700; }

/* Botones */
.btn { font: inherit; border-radius: 10px; padding: 9px 16px; border: 1px solid var(--line); background: var(--panel-2); color: var(--text); cursor: pointer; text-decoration: none; display: inline-block; }
.btn:disabled { opacity: 0.5; cursor: default; }
.btn.primary { background: var(--gold); border-color: var(--gold); color: #111; font-weight: 700; }
.btn.danger { background: transparent; border-color: rgba(239,83,80,0.6); color: var(--red); font-weight: 600; }
.btn.ghost { background: transparent; }
.card-actions .btn { min-width: 120px; padding: 12px 18px; }

/* Tablas */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: 12px; white-space: nowrap; }
td { white-space: nowrap; }
td.note { color: var(--muted); max-width: 420px; min-width: 220px; white-space: normal; }

/* Ajustes */
details summary { cursor: pointer; list-style: none; }
details summary::-webkit-details-marker { display: none; }
details summary h2::before { content: "▸ "; color: var(--gold); }
details[open] summary h2::before { content: "▾ "; }
.settings { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; margin-top: 14px; }
fieldset { border: 1px solid var(--line); border-radius: 10px; padding: 12px; display: grid; gap: 10px; margin: 0; }
legend { color: var(--gold); padding: 0 6px; font-weight: 600; }
label { display: grid; gap: 4px; font-size: 13px; color: var(--muted); }
label.check { display: flex; align-items: center; gap: 8px; color: var(--text); }
label.wide { grid-column: 1 / -1; }
input, textarea { font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 9px 10px; }
input:focus, textarea:focus { outline: 2px solid var(--gold-soft); border-color: var(--gold); }
.settings-actions { grid-column: 1 / -1; display: flex; justify-content: flex-end; align-items: center; gap: 12px; }

/* Ingreso */
.login-page { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: radial-gradient(ellipse at top, #1b1810, var(--bg) 60%); }
.login-card { width: min(400px, 100%); background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 28px; display: grid; gap: 14px; }
.login-card .belt { justify-content: center; }
.login-card h1, .login-card p { margin: 0; }
.login-card form { display: grid; gap: 12px; margin-top: 6px; }
.error { color: var(--red); min-height: 1.2em; margin: 0; }

@media (max-width: 820px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .levels { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .topbar { padding-left: 12px; padding-right: 12px; display: grid; grid-template-columns: 1fr auto; }
  .pills { grid-column: 1 / -1; order: 3; }
  .top-actions .btn { padding: 7px 12px; }
  .wrap { padding: 12px; }
  .card-actions { flex-wrap: wrap; }
  .countdown { width: 100%; }
  .card-actions .btn { flex: 1; min-width: 0; }
}
