/* Insight Analytics — estilos compartidos de las demos (HTML independientes).
   Paleta: azul eléctrico #123BFF (serie destacada), azul profundo #0B1020 (texto),
   neutros para referencias. Tipografía Manrope. */
:root {
  --electric: #123bff;
  --electric-600: #0e2fd6;
  --abyss: #0b1020;
  --slate: #5b6275;
  --muted: #8a91a3;
  --line: #e6e8ef;
  --grid: #eef0f5;
  --mist: #f5f7fb;
  --surface: #ffffff;
  --wash: rgba(18, 59, 255, 0.1);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: "Manrope", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--surface);
  color: var(--abyss);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--electric); outline-offset: 2px; }

.app { max-width: 1120px; margin: 0 auto; padding: 20px; }
.topbar {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px;
  padding-bottom: 16px; border-bottom: 1px solid var(--line); margin-bottom: 20px;
}
.topbar h1 { font-size: 18px; font-weight: 800; letter-spacing: -0.02em; }
.topbar .company { font-size: 13px; color: var(--slate); }
.tag {
  display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: 999px;
  padding: 3px 10px; font-size: 11.5px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--slate);
}
.tag::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--electric); }

.grid { display: grid; gap: 16px; }
@media (min-width: 860px) { .grid-2 { grid-template-columns: 1.35fr 1fr; } .grid-3 { grid-template-columns: repeat(3, 1fr); } }
.card { border: 1px solid var(--line); border-radius: 16px; background: var(--surface); padding: 18px; min-width: 0; }
.card h2 { font-size: 15px; font-weight: 800; letter-spacing: -0.01em; }
.card .sub { font-size: 13px; color: var(--slate); margin-top: 2px; }
.eyebrow { font-size: 11.5px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--slate); }

/* Filtros: una fila, arriba de todo lo que afectan */
.filters { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 16px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; padding: 3px; background: var(--surface); }
.seg button { border: 0; background: none; border-radius: 999px; padding: 8px 14px; min-height: 38px; font-size: 13.5px; font-weight: 700; color: var(--slate); cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--abyss); color: #fff; }
.select { border: 1px solid var(--line); border-radius: 999px; padding: 8px 14px; min-height: 40px; background: var(--surface); font-size: 13.5px; font-weight: 600; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; border-radius: 999px;
  background: var(--electric); color: #fff; font-weight: 700; font-size: 14px; padding: 10px 18px; min-height: 42px; cursor: pointer;
}
.btn:hover { background: var(--electric-600); }
.btn:disabled { opacity: 0.55; cursor: default; }
.btn.ghost { background: var(--surface); color: var(--abyss); border: 1px solid var(--line); }

/* Stat tiles */
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat { border: 1px solid var(--line); border-radius: 14px; padding: 14px; min-width: 0; }
.stat .label { font-size: 12.5px; color: var(--slate); }
.stat .value { font-size: 22px; font-weight: 800; letter-spacing: -0.03em; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat .delta { font-size: 12.5px; font-weight: 700; color: var(--slate); margin-top: 2px; }
@media (max-width: 520px) { .stat .value { font-size: 17px; } }

/* Gráfico */
.chart { position: relative; margin-top: 12px; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart svg:focus-visible { outline: 2px solid var(--electric); outline-offset: 4px; border-radius: 6px; }
.axis text { font-size: 11px; fill: var(--muted); font-variant-numeric: tabular-nums; }
.tooltip {
  position: absolute; pointer-events: none; background: var(--surface); border: 1px solid var(--line); border-radius: 10px;
  padding: 8px 10px; font-size: 12.5px; box-shadow: 0 10px 30px -12px rgba(11, 16, 32, 0.25); white-space: nowrap; opacity: 0; transition: opacity 0.12s;
  z-index: 5;
}
.tooltip .t-date { color: var(--slate); font-size: 11.5px; margin-bottom: 4px; }
.tooltip .t-row { display: flex; align-items: center; gap: 8px; }
.tooltip .t-row strong { font-weight: 800; }
.tooltip .t-row span:last-child { color: var(--slate); }
.key { display: inline-block; width: 14px; height: 0; border-top: 2px solid var(--electric); }
.key.ref { border-top: 2px dashed var(--muted); }
.key.band { height: 10px; border: 0; background: var(--wash); border-radius: 2px; }
.legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 12.5px; color: var(--slate); margin-top: 10px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--electric); box-shadow: 0 0 0 2px #fff, 0 0 0 3px var(--electric); }

details.table { margin-top: 12px; font-size: 13px; }
details.table summary { cursor: pointer; color: var(--slate); font-weight: 600; min-height: 32px; display: flex; align-items: center; }
details.table table { width: 100%; border-collapse: collapse; margin-top: 6px; font-variant-numeric: tabular-nums; }
details.table th, details.table td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); }
details.table .scroll { max-height: 220px; overflow: auto; }

.note { font-size: 12.5px; color: var(--slate); margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }
.muted { color: var(--slate); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
