:root {
  --bg: #0f172a; --card: #1e293b; --muted: #94a3b8; --fg: #e2e8f0;
  --accent: #38bdf8; --ok: #22c55e; --warn: #f59e0b; --bad: #ef4444;
  --media: #eab308; --baja: #f97316;
}
* { box-sizing: border-box; }
body {
  margin: 0; font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  background: var(--bg); color: var(--fg); line-height: 1.5;
}
header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 24px; background: #0b1220; border-bottom: 1px solid #1e293b;
  position: sticky; top: 0; z-index: 500;
}
header h1 { font-size: 18px; margin: 0; }
main { max-width: 1000px; margin: 0 auto; padding: 20px; }
.card {
  background: var(--card); border: 1px solid #334155; border-radius: 10px;
  padding: 18px 20px; margin-bottom: 18px;
}
.card h2 { font-size: 15px; margin: 0 0 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--accent); }
.muted { color: var(--muted); font-size: 13px; }
.hidden { display: none !important; }
code { background: #0b1220; padding: 1px 5px; border-radius: 4px; color: #7dd3fc; }

.dropzone {
  border: 2px dashed #475569; border-radius: 8px; padding: 30px; text-align: center;
  transition: .15s; cursor: pointer;
}
.dropzone.drag { border-color: var(--accent); background: #0b1220; }
.link { color: var(--accent); cursor: pointer; text-decoration: underline; }

.status { margin-top: 10px; font-size: 13px; }
.status.err { color: var(--bad); }
.status.ok { color: var(--ok); }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.grid .cell { background: #0b1220; border-radius: 8px; padding: 10px 12px; }
.grid .cell .k { font-size: 11px; color: var(--muted); text-transform: uppercase; }
.grid .cell .v { font-size: 20px; font-weight: 600; }

.errors { color: var(--bad); font-size: 13px; margin: 8px 0; white-space: pre-line; }

table.preview { width: 100%; border-collapse: collapse; font-size: 13px; margin-top: 10px; }
table.preview th, table.preview td { text-align: left; padding: 6px 8px; border-bottom: 1px solid #334155; }
table.preview th { color: var(--muted); font-weight: 500; }

.actions { display: flex; gap: 10px; margin-top: 14px; flex-wrap: wrap; align-items: center; }
button, .btn {
  font: inherit; border: 1px solid #475569; background: #334155; color: var(--fg);
  padding: 8px 14px; border-radius: 7px; cursor: pointer; text-decoration: none; font-size: 13px;
}
button:hover, .btn:hover { border-color: var(--accent); }
button.primary, .btn.primary { background: var(--accent); color: #08131f; border-color: var(--accent); font-weight: 600; }
button.danger { background: #7f1d1d; border-color: #b91c1c; }
button.ghost { background: transparent; }
button.small { padding: 3px 8px; font-size: 12px; }

.stageline { display: flex; gap: 20px; flex-wrap: wrap; font-size: 13px; margin-bottom: 12px; }
.progress { position: relative; background: #0b1220; border-radius: 20px; height: 26px; overflow: hidden; }
.progress-bar { background: linear-gradient(90deg,#0ea5e9,#22c55e); height: 100%; width: 0%; transition: width .4s; }
.progress span { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 600; }

.counters { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px,1fr)); gap: 8px; margin-top: 14px; }
.counters .c { background: #0b1220; border-radius: 8px; padding: 8px 10px; text-align: center; }
.counters .c .n { font-size: 18px; font-weight: 700; }
.counters .c .l { font-size: 10px; color: var(--muted); text-transform: uppercase; }
.c.alta .n { color: var(--ok); } .c.media .n { color: var(--media); }
.c.baja .n { color: var(--baja); } .c.nula .n, .c.err .n { color: var(--bad); }
.c.cache .n { color: var(--accent); }

#map { height: 460px; border-radius: 8px; margin-top: 10px; }
.legend { display: flex; gap: 16px; font-size: 12px; flex-wrap: wrap; }
.legend .dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 5px; }

.tabs { display: flex; gap: 8px; margin-bottom: 10px; }
.tab { background: transparent; }
.tab.active { background: #334155; border-color: var(--accent); }
.pane { max-height: 320px; overflow: auto; }
.pane table { width: 100%; border-collapse: collapse; font-size: 12px; }
.pane td, .pane th { padding: 5px 8px; border-bottom: 1px solid #334155; text-align: left; vertical-align: top; }
.badge { padding: 1px 6px; border-radius: 10px; font-size: 11px; }
.badge.alta { background:#14532d; } .badge.media { background:#713f12; }
.badge.baja { background:#7c2d12; } .badge.nula { background:#7f1d1d; }
.cache-pill { font-size: 12px; color: var(--muted); }
