@font-face { font-family: "Poppins"; font-weight: 500; font-display: swap; src: url("/static/fonts/poppins-latin-500.woff2") format("woff2"); }
@font-face { font-family: "Poppins"; font-weight: 600; font-display: swap; src: url("/static/fonts/poppins-latin-600.woff2") format("woff2"); }
@font-face { font-family: "Poppins"; font-weight: 700; font-display: swap; src: url("/static/fonts/poppins-latin-700.woff2") format("woff2"); }

:root {
  --bg: #F4F6FB;
  --surface: #FFFFFF;
  --line: #E4E7F0;
  --line-strong: #8A90AB;
  --ink: #1B2140;
  --ink-2: #4E5677;
  --ink-3: #5F6688;
  --accent: #5B61C9;
  --accent-deep: #4A50B8;
  --accent-soft: #E8E9FA;
  --mint: #DDF4E7;   --peach: #FDEBDD;   --lavender: #ECE6FB;   --sky: #E1EEFC;   --rose: #FBE5E5;
  --good: #17683A;   --warn: #8A5300;    --bad: #A32F2F;
  --radius: 18px;
  --radius-sm: 12px;
  --gap: 20px;
  font-family: "Poppins", "Segoe UI", system-ui, sans-serif;
  font-weight: 500;
  font-style: normal;
  color: var(--ink);
  font-size: 15px;
  line-height: 1.45;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); }
button, input, select { font: inherit; color: inherit; }
h1, h2, h3, p { margin: 0; }
em, i { font-style: normal; }
[hidden] { display: none !important; }


/* ---------- Contenido ---------- */
.demo-banner { display: flex; gap: 12px; align-items: flex-start; background: var(--peach); color: var(--warn); border: 2px solid var(--warn); border-radius: var(--radius-sm); padding: 12px 16px; margin-bottom: var(--gap); font-weight: 600; font-size: 14.5px; position: sticky; top: 12px; z-index: 10; max-width: 1500px; }
.demo-banner strong { font-weight: 700; display: block; font-size: 15.5px; }
.demo-banner svg { width: 22px; height: 22px; flex: none; margin-top: 1px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.main { padding: 28px 32px 56px; min-width: 0; }
.tab { display: flex; flex-direction: column; gap: var(--gap); max-width: 1500px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.page-head h1 { font-size: 26px; font-weight: 700; letter-spacing: -0.01em; }
.page-head p { color: var(--ink-2); font-weight: 600; margin-top: 2px; }
.section-title { font-size: 18px; font-weight: 700; margin-top: 8px; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 22px; min-width: 0; }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.card-title { font-size: 16.5px; font-weight: 700; }
.card-sub { font-size: 13px; color: var(--ink-3); font-weight: 600; }
/* Tarjeta en columna cuyo cierre (.card-foot) va al fondo: queda a la misma altura que en las vecinas de la fila */
.card.stack-card { display: flex; flex-direction: column; }
.card-foot { margin-top: auto; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--gap); }
.muted { color: var(--ink-3); }
.note { font-size: 13px; color: var(--ink-2); font-weight: 500; }
.num { font-variant-numeric: tabular-nums; }

/* ---------- Botones y controles ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1.5px solid transparent; border-radius: var(--radius-sm); padding: 11px 20px; font-weight: 700; font-size: 15px; cursor: pointer; background: var(--bg); color: var(--ink); }
.btn:hover { background: var(--line); }
.btn.primary { background: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-deep); }
.btn.big { padding: 15px 34px; font-size: 17px; }
.btn.quiet { background: transparent; border-color: var(--line-strong); color: var(--ink-2); }
.btn.quiet:hover { background: var(--bg); color: var(--ink); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.btn.primary:focus-visible { outline-color: var(--ink); }

.filters { display: flex; flex-wrap: wrap; gap: 14px 22px; align-items: center; }
.field { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 14px; color: var(--ink-2); }
.segmented { display: inline-flex; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 4px; gap: 2px; }
.segmented button { border: 0; background: transparent; padding: 7px 14px; border-radius: 9px; font-weight: 600; font-size: 14px; color: var(--ink-2); cursor: pointer; }
.segmented button[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent-deep); font-weight: 700; }
.check { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; font-size: 14px; color: var(--ink-2); cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); margin: 0; }
select { border: 1px solid var(--line-strong); border-radius: 10px; padding: 8px 12px; background: var(--surface); font-weight: 600; font-size: 14px; }

/* ---------- Medir ---------- */
.medir { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: var(--gap); align-items: start; }
.col { display: flex; flex-direction: column; gap: var(--gap); min-width: 0; }
/* Medir: las dos columnas terminan a la misma altura (la última tarjeta de la más corta se estira) */
.medir.even-cols { align-items: stretch; }
.medir.even-cols > .col > :last-child { flex: 1; }
.robots { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.robot { border: 2px solid transparent; border-radius: var(--radius); padding: 16px; text-align: left; cursor: pointer; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
/* El fondo pastel de cada Sphero sale de su color en el catálogo (--robot-soft en la tarjeta) */
.robot[data-robot] { background: var(--robot-soft, #F1F2F8); }
.robot:hover:not(:disabled) { border-color: var(--line-strong); }
.robot[aria-pressed="true"] { border-color: var(--ink); cursor: default; }
.robot:disabled { cursor: not-allowed; }
.robot-top { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.robot-mark { width: 34px; height: 34px; border-radius: 50%; background: var(--surface); display: grid; place-items: center; flex: none; }
.robot-name { font-size: 19px; font-weight: 700; line-height: 1.1; }
.robot-id { font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.robot-meta { font-size: 13px; font-weight: 600; color: var(--ink-2); }
/* El estado y lo que sigue (botón, candado) van al fondo de la tarjeta: así quedan a la misma altura
   en todas las Spheros de la fila aunque el texto de arriba ocupe más líneas en una */
.robot-state { margin-top: auto; padding-top: 10px; font-size: 13.5px; font-weight: 700; display: inline-flex; align-items: center; gap: 7px; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--line-strong); flex: none; }
.dot.on { background: var(--good); }
.dot.busy { background: var(--warn); animation: pulse 1s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.35; } }

.step { min-height: 300px; display: flex; flex-direction: column; gap: 18px; }
.step-label { font-size: 13px; font-weight: 700; color: var(--ink-3); text-transform: uppercase; letter-spacing: 0.06em; }
.hero { font-size: 60px; font-weight: 700; line-height: 1; letter-spacing: -0.02em; }
.hero small { font-size: 26px; font-weight: 700; color: var(--ink-2); margin-left: 6px; letter-spacing: 0; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 999px; background: var(--bg); font-size: 13px; font-weight: 600; color: var(--ink-2); }
.chip.accent { background: var(--accent-soft); color: var(--accent-deep); font-weight: 700; }
.chip.good { background: var(--mint); color: var(--good); font-weight: 700; }
.chip.warn { background: var(--peach); color: var(--warn); font-weight: 700; }
.tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.tiles.six { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.tile { border-radius: var(--radius-sm); padding: 14px 16px; min-width: 0; }
.tile.sky { background: var(--sky); } .tile.mint { background: var(--mint); } .tile.peach { background: var(--peach); }
.tile.lavender { background: var(--lavender); } .tile.rose { background: var(--rose); } .tile.plain { background: var(--bg); }
.tile-label { font-size: 12.5px; font-weight: 700; color: var(--ink-2); }
.tile-value { font-size: 24px; font-weight: 700; line-height: 1.2; margin-top: 2px; }
.tile-value small { font-size: 14px; font-weight: 700; color: var(--ink-2); margin-left: 3px; }
.tile-foot { font-size: 12.5px; font-weight: 600; color: var(--ink-2); margin-top: 2px; }
.actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-top: auto; }
.empty { display: flex; flex-direction: column; gap: 6px; justify-content: center; flex: 1; color: var(--ink-2); }
.empty strong { font-size: 19px; color: var(--ink); font-weight: 700; }
.alert { border-radius: var(--radius-sm); padding: 12px 16px; font-weight: 600; font-size: 14px; display: flex; gap: 10px; align-items: flex-start; }
.alert.bad { background: var(--rose); color: var(--bad); }
.alert.info { background: var(--sky); color: var(--ink); }
.alert svg { width: 18px; height: 18px; flex: none; margin-top: 2px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.progress { height: 10px; border-radius: 999px; background: var(--accent-soft); overflow: hidden; }
.progress > div { height: 100%; width: 0; background: var(--accent); border-radius: 999px; }
.progress.wait > div { width: 35%; animation: slide 1.3s ease-in-out infinite; }
@keyframes slide { 0% { margin-left: -35%; } 100% { margin-left: 100%; } }
.tape-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.tape-field { display: flex; flex-direction: column; gap: 6px; font-weight: 700; font-size: 14px; }
.tape-field input { width: 190px; font-size: 28px; font-weight: 700; padding: 8px 14px; border: 2px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--surface); }
.tape-field input:focus { border-color: var(--accent); outline: none; }
.tape-field input[aria-invalid="true"] { border-color: var(--bad); }
.field-error { color: var(--bad); font-size: 13px; font-weight: 600; min-height: 19px; }
.badges { display: flex; flex-wrap: wrap; gap: 8px; }
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 4px 11px; border-radius: 999px; font-size: 12.5px; font-weight: 700; }
.badge svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.badge.effect { background: var(--mint); color: var(--good); }
.badge.none { background: var(--bg); color: var(--ink-2); }
.badge.insufficient { background: var(--peach); color: var(--warn); }
.badge.bad { background: var(--rose); color: var(--bad); }
.badge.estimate { background: var(--lavender); color: var(--accent-deep); }

/* Alineación: anillo tipo Sphero Edu */
.aim { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 24px; align-items: center; }
.aim-side { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.aim-turn { font-size: 15px; font-weight: 700; color: var(--ink-2); margin-top: -6px; }
.ring { width: 260px; height: 260px; touch-action: none; cursor: grab; user-select: none; border-radius: 50%; }
.ring:active { cursor: grabbing; }
.ring.closing { opacity: 0.55; cursor: default; }
.ring-track { fill: none; stroke: var(--accent-soft); stroke-width: 22; }
.ring-arc { fill: none; stroke: var(--accent); stroke-width: 6; stroke-linecap: round; }
.ring-tick { stroke: var(--line-strong); stroke-width: 1.5; stroke-linecap: round; }
.ring-tick.major { stroke: var(--ink-2); stroke-width: 2.5; }
.ring-label { font-size: 12px; font-weight: 700; fill: var(--ink-3); text-anchor: middle; dominant-baseline: middle; }
.ring-zero { fill: var(--ink); }
.ring-body { fill: var(--surface); stroke: var(--ink-2); stroke-width: 2.5; }
.ring-arrow { fill: var(--ink); }
.ring-tail { fill: #2F6FE0; }
.ring-knob { fill: var(--accent); stroke: #fff; stroke-width: 4; }
.nudges { display: flex; flex-wrap: wrap; gap: 8px; }
.btn.nudge { padding: 8px 10px; font-size: 14px; min-width: 52px; }

.sensors { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.sensor { background: var(--bg); border-radius: var(--radius-sm); padding: 12px 14px; min-width: 0; }
.sensor.wide { grid-column: span 2; display: flex; gap: 14px; align-items: center; }
.sensor-label { font-size: 12px; font-weight: 700; color: var(--ink-2); }
.sensor-value { font-size: 19px; font-weight: 700; font-variant-numeric: tabular-nums; }
.sensor-value small { font-size: 12px; color: var(--ink-2); margin-left: 3px; }
.triple { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; font-size: 14.5px; font-weight: 700; font-variant-numeric: tabular-nums; }
.triple span::before { content: attr(data-axis); display: block; font-size: 11px; color: var(--ink-3); font-weight: 600; }
.spark { flex: 1; height: 44px; min-width: 0; }

.bands { display: grid; grid-template-columns: repeat(10, minmax(0, 1fr)); gap: 6px; }
.band { border-radius: 10px; background: var(--bg); padding: 8px 2px 6px; text-align: center; border: 2px solid transparent; }
.band.pending { background: var(--accent-soft); }
.band.next { border-color: var(--accent); }
.band-count { font-size: 18px; font-weight: 700; line-height: 1.1; }
.band-range { font-size: 10.5px; font-weight: 600; color: var(--ink-2); line-height: 1.25; margin-top: 2px; }
.band-anchor { font-size: 10px; font-weight: 700; color: var(--accent-deep); }
.legend { display: flex; flex-wrap: wrap; gap: 8px 18px; font-size: 13px; font-weight: 600; color: var(--ink-2); margin-top: 10px; align-items: center; }
.legend span { display: inline-flex; align-items: center; gap: 7px; }
.swatch { width: 14px; height: 14px; border-radius: 4px; flex: none; }
.line-key { width: 22px; height: 0; border-top: 2px solid var(--ink-2); flex: none; }
.line-key.dash { border-top-style: dashed; }
.line-key.dots { border-top-style: dotted; border-top-width: 3px; }

/* ---------- Gráficos y fórmulas ---------- */
.chart { width: 100%; height: 300px; }
.chart.small { height: 230px; }
.chart.tall { height: 340px; }
.chart.strip { height: 140px; }
.formula { margin-top: 12px; padding: 12px 16px; border-radius: var(--radius-sm); background: var(--bg); }
.formula-main { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: 0.01em; overflow-wrap: anywhere; }
.formula-main sup { font-size: 0.62em; font-weight: 700; }
.formula-meta { font-size: 13px; font-weight: 600; color: var(--ink-2); margin-top: 4px; }
.formula.alt { background: transparent; border: 1px solid var(--line); margin-top: 8px; }
.formula.alt .formula-main { font-size: 15.5px; }
.formula-name { font-size: 12px; font-weight: 700; color: var(--ink-3); text-transform: uppercase; letter-spacing: 0.05em; display: flex; align-items: center; gap: 8px; }
.placeholder { height: 300px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 6px; color: var(--ink-2); background: var(--bg); border-radius: var(--radius-sm); padding: 20px; font-weight: 600; }
.placeholder strong { color: var(--ink); font-weight: 700; font-size: 16px; }
.placeholder.small { height: 230px; }

table { border-collapse: collapse; width: 100%; font-size: 14px; }
th, td { text-align: right; padding: 9px 12px; border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; white-space: nowrap; }
th { font-weight: 700; color: var(--ink-2); font-size: 13px; }
td { font-weight: 600; }
th:first-child, td:first-child { text-align: left; }
tbody tr:last-child td { border-bottom: 0; }
table.compact th, table.compact td { padding: 7px 10px; font-size: 13px; }
.question table.compact td { white-space: pre-line; line-height: 1.3; }
.table-wrap { overflow-x: auto; }
.name-cell { display: inline-flex; align-items: center; gap: 8px; }
details > summary { cursor: pointer; font-weight: 700; font-size: 15px; list-style-position: inside; }
details[open] > summary { margin-bottom: 14px; }

.coverage { display: grid; grid-template-columns: auto repeat(10, minmax(0, 1fr)); gap: 6px; align-items: center; font-size: 13px; font-weight: 600; }
.coverage .cell { border-radius: 8px; padding: 9px 0; text-align: center; font-weight: 700; font-variant-numeric: tabular-nums; }
.coverage .head { font-size: 10.5px; color: var(--ink-2); text-align: center; line-height: 1.2; }

/* ---------- Simulador ---------- */
.sim-input { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; color: var(--ink-2); }
.sim-input input { width: 120px; font-size: 22px; font-weight: 700; padding: 6px 12px; border: 2px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--surface); }
.sim-input input:focus { border-color: var(--accent); outline: none; }
.sim-clock { margin-left: auto; font-size: 18px; font-weight: 700; color: var(--ink); }
.stack { display: flex; flex-direction: column; gap: 8px; }
.stack .formula { margin-top: 0; }
.track { width: 100%; height: auto; display: block; margin-top: 14px; }
.track-tick { stroke: var(--line-strong); stroke-width: 1.5; }
.track-label { font-size: 13px; font-weight: 700; fill: var(--ink-2); text-anchor: middle; }
.track-label.end { text-anchor: end; }
.track-name { font-size: 16px; font-weight: 700; fill: var(--ink); }
.track-small { font-size: 12.5px; font-weight: 700; fill: var(--ink-2); }
.track-final { font-size: 14px; font-weight: 700; fill: var(--ink); paint-order: stroke; stroke: #fff; stroke-width: 4px; stroke-linejoin: round; }
.track-target { stroke: var(--ink); stroke-width: 2; stroke-dasharray: 6 5; }
.swatch.range { background: var(--accent); opacity: 0.25; }
.swatch.tick { width: 3px; height: 16px; border-radius: 1px; background: var(--ink-2); }
.swatch.flag { width: 3px; height: 16px; border-radius: 1px; background: var(--ink); }
.track-flag { stroke: var(--ink); stroke-width: 3; }
.lanes { display: flex; flex-direction: column; gap: 10px; }
.lane-row { display: grid; grid-template-columns: 190px auto minmax(0, 1fr); gap: 14px; align-items: center; }
.lane-row select { max-width: 100%; }
.lane-check { font-size: 15px; color: var(--ink); font-weight: 700; }
@media (max-width: 820px) { .lane-row { grid-template-columns: minmax(0, 1fr); gap: 6px; } }

/* ---------- Preguntas ---------- */
.question { display: flex; flex-direction: column; gap: 12px; }
.question h3 { font-size: 16.5px; font-weight: 700; }
/* "Cómo se calculó" al fondo, a la misma altura en las dos tarjetas de la fila */
.question > .method { margin-top: auto; }
.question-answer { font-size: 19px; font-weight: 700; line-height: 1.3; }
.facts { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 5px; font-size: 14px; color: var(--ink-2); font-weight: 500; }
.method { font-size: 13px; color: var(--ink-2); }
.method summary { font-size: 13px; font-weight: 700; color: var(--ink-2); }

.toast { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 12px 20px; border-radius: var(--radius-sm); font-weight: 600; font-size: 14px; max-width: min(560px, 90vw); z-index: 20; }

@media (max-width: 1180px) {
  .medir { grid-template-columns: minmax(0, 1fr); }
  .grid-2 { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 820px) {
  .main { padding: 18px 16px 40px; }
  .sensors { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .bands { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .hero { font-size: 46px; }
}
@media (max-width: 600px) {
  .robots, .tiles, .tiles.six { grid-template-columns: minmax(0, 1fr); }
  .aim { grid-template-columns: minmax(0, 1fr); justify-items: center; }
}
@media (prefers-reduced-motion: reduce) {
  .dot.busy, .progress.wait > div { animation: none; }
}
