:root {
  --bg: #0d0f12;
  --panel: #14171c;
  --panel-2: #1a1e24;
  --line: #262b33;
  --text: #e6e8eb;
  --muted: #8a919c;
  --accent: #ff6a3d;
  --accent-2: #ffb199;
  --ok: #3ecf8e;
  --warn: #f5b942;
  --bad: #ff5a5f;
  --mono: ui-monospace, "JetBrains Mono", "SFMono-Regular", Menlo, Consolas, monospace;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --r: 10px;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.45 var(--sans); }
code, .mono { font-family: var(--mono); font-size: 12.5px; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.err { color: var(--bad); min-height: 1.2em; margin: 0; }
a { color: var(--accent-2); }

/* brand */
.brand { font: 700 13px/1 var(--mono); letter-spacing: .14em; display: flex; align-items: center; gap: 10px; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--accent); display: inline-block; }
.dot.live { box-shadow: 0 0 0 0 rgba(255,106,61,.6); animation: pulse 2s infinite; }
@keyframes pulse { 70% { box-shadow: 0 0 0 8px rgba(255,106,61,0); } 100% { box-shadow: 0 0 0 0 rgba(255,106,61,0); } }

/* login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-card { width: min(360px, 100%); background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 28px; display: grid; gap: 14px; }

/* top */
.top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 24px; padding: 12px 24px; background: rgba(13,15,18,.92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
#nav { display: flex; gap: 4px; flex: 1; overflow-x: auto; }
#nav button { background: none; border: 0; color: var(--muted); padding: 8px 12px; border-radius: 8px; cursor: pointer; font: 500 13.5px var(--sans); white-space: nowrap; }
#nav button:hover { color: var(--text); background: var(--panel-2); }
#nav button.active { color: var(--text); background: var(--panel-2); box-shadow: inset 0 -2px 0 var(--accent); }
main { padding: 24px; max-width: 1280px; margin: 0 auto; }

/* buttons & inputs */
.btn { background: var(--panel-2); color: var(--text); border: 1px solid var(--line); border-radius: 8px; padding: 8px 14px; cursor: pointer; font: 500 13px var(--sans); }
.btn:hover { border-color: #3a414c; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #1a0d07; font-weight: 600; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: var(--bad); }
.btn.ghost { background: transparent; }
.btn.sm { padding: 5px 10px; font-size: 12.5px; }
.btn.xs { padding: 1px 7px; font-size: 11.5px; margin-left: 4px; }
input, select, textarea { width: 100%; background: var(--bg); color: var(--text); border: 1px solid var(--line); border-radius: 8px; padding: 9px 11px; font: 13.5px var(--sans); }
textarea { font-family: var(--mono); font-size: 12.5px; min-height: 96px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); }
label.chk { display: flex; align-items: center; gap: 8px; cursor: pointer; }
label.chk input { width: auto; accent-color: var(--accent); }

/* layout pieces */
.bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.bar h2 { margin: 0; font-size: 18px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 24px; }
.tile { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; }
.tile .k { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .06em; }
.tile .v { font: 600 24px/1.2 var(--mono); margin-top: 6px; }
.tile .s { color: var(--muted); font-size: 12px; margin-top: 2px; }
.meter { height: 6px; background: var(--panel-2); border-radius: 3px; margin-top: 10px; overflow: hidden; }
.meter > i { display: block; height: 100%; background: var(--accent); }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); margin-bottom: 16px; overflow: hidden; }
.card-h { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.card-h h3 { margin: 0; font-size: 15px; }
.card-b { padding: 12px 16px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { font: 12px var(--mono); color: var(--muted); background: var(--panel-2); border: 1px solid var(--line); border-radius: 999px; padding: 2px 9px; }
.chip.hl { color: var(--accent-2); border-color: rgba(255,106,61,.35); }
.actions { display: flex; gap: 6px; flex-wrap: wrap; }
td .actions { flex-wrap: nowrap; }
.url.short { max-width: 230px; }

.tbl-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; white-space: nowrap; }
th { color: var(--muted); font-weight: 500; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; background: var(--panel-2); }
tr:last-child td { border-bottom: 0; }
td.num { font-family: var(--mono); text-align: right; }
th.num { text-align: right; }
.st { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; }
.st::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.st.ok::before { background: var(--ok); }
.st.warn::before { background: var(--warn); }
.st.bad::before { background: var(--bad); }
.url { font: 12px var(--mono); color: var(--accent-2); max-width: 420px; overflow: hidden; text-overflow: ellipsis; display: inline-block; vertical-align: middle; }
.empty { padding: 28px; text-align: center; color: var(--muted); }

/* dialog */
dialog { background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 14px; padding: 0; width: min(640px, calc(100vw - 32px)); max-height: calc(100vh - 48px); }
dialog::backdrop { background: rgba(0,0,0,.6); }
dialog form { display: flex; flex-direction: column; max-height: calc(100vh - 48px); }
.dlg-h { padding: 16px 20px; border-bottom: 1px solid var(--line); font-weight: 600; }
.dlg-b { padding: 16px 20px; overflow-y: auto; display: grid; gap: 14px; }
.dlg-f { padding: 14px 20px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 8px; }
.field { display: grid; gap: 6px; }
.field > span { font-size: 12.5px; color: var(--muted); }
.field small { color: var(--muted); font-size: 12px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; align-items: start; }
pre.out { background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 12px; font: 12px/1.5 var(--mono); max-height: 320px; overflow: auto; white-space: pre-wrap; word-break: break-all; margin: 0; }
.kv { display: grid; grid-template-columns: 120px 1fr; gap: 6px 12px; font-size: 13px; }
.kv b { color: var(--muted); font-weight: 500; }

.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%) translateY(20px); background: var(--panel-2); border: 1px solid var(--line); padding: 10px 16px; border-radius: 8px; opacity: 0; transition: .2s; pointer-events: none; z-index: 50; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.bad { border-color: var(--bad); color: var(--bad); }

/* tiles destacados y estados */
.tile.hero .v { color: var(--text); font-size: 30px; }
.tile.hero { border-color: rgba(255,106,61,.35); background: linear-gradient(180deg, rgba(255,106,61,.07), transparent 70%), var(--panel); }
.tile .of { color: var(--muted); font-size: 16px; font-weight: 500; }
.t-bad { color: var(--bad); }
.why { color: var(--muted); font-size: 11.5px; margin-top: 3px; white-space: normal; max-width: 260px; line-height: 1.35; }
.why code { font-size: 11px; color: var(--accent-2); }
tr.tot td { font-weight: 600; background: var(--panel-2); }
select.ttl-sel, select.inline-sel { width: auto; padding: 5px 8px; font-size: 12.5px; background: var(--panel-2); }

/* selector de rango */
.seg { display: inline-flex; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 2px; }
.seg button { background: none; border: 0; color: var(--muted); padding: 4px 10px; border-radius: 6px; cursor: pointer; font: 500 12.5px var(--mono); }
.seg button.on { background: var(--panel-2); color: var(--text); box-shadow: inset 0 0 0 1px var(--line); }

/* gráfico */
.chart { position: relative; width: 100%; }
.chart svg { display: block; }
.chart .bar { fill: var(--accent); }
.chart .grid { stroke: var(--line); stroke-width: 1; stroke-dasharray: 2 4; }
.chart .base { stroke: #3a414c; stroke-width: 1; }
.chart .ax { fill: var(--muted); font: 11px var(--mono); }
.chart .hit { fill: transparent; cursor: crosshair; }
.chart .hit.on { fill: rgba(255,255,255,.04); }
.chart .tip { position: absolute; top: 0; background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; font-size: 12.5px; pointer-events: none; min-width: 190px; box-shadow: 0 8px 24px rgba(0,0,0,.4); }
.chart .tip b { display: block; margin-bottom: 4px; }
.chart .tip div { display: flex; justify-content: space-between; gap: 16px; color: var(--muted); }
.chart .tip span { color: var(--text); font-family: var(--mono); }

@media (max-width: 720px) {
  .top { padding: 10px 16px; gap: 12px; }
  main { padding: 16px; }
  .row2 { grid-template-columns: 1fr; }
  .brand { font-size: 0; gap: 0; }
}
