/* Copiado tal cual del bloque <style> de ..\box_de_ingenieria.html (la demo). No rediseñar: los agregados van al final, con las mismas variables. */
:root {
  /* Pared de boxes: grafito frío, datos en cian (vuelta A) y naranja (vuelta B), amarillo de cronometraje para lo activo.
     Layout: barra fija con perfil de categoría + pestañas; cada pestaña es una herramienta, resumen arriba y detalle abajo. */
  --bg: #11151b;
  --panel: #181e26;
  --panel-2: #1f2731;
  --line: #2b3542;
  --ink: #e7ecf3;
  --muted: #8e9aab;
  --accent: #ffd23f;
  --lap-a: #46c2f0;
  --lap-b: #ff8c42;
  --good: #3ecf8e;
  --warn: #f5b942;
  --bad: #ff5d5d;
  --font-display: "Barlow Condensed", "Arial Narrow", sans-serif;
  --font-body: "IBM Plex Sans", "Segoe UI", Roboto, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, Consolas, monospace;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font-body); font-size: 15px; line-height: 1.45; }
h1, h2, h3 { font-family: var(--font-display); font-weight: 600; letter-spacing: 0.01em; margin: 0; text-wrap: balance; }
h2 { font-size: 1.55rem; }
h3 { font-size: 1.15rem; color: var(--ink); }
p { margin: 0; }
.num, td.n, .tile .v { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
button, select, input { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* barra superior */
header.top { position: sticky; top: 0; z-index: 20; background: rgba(17,21,27,0.96); backdrop-filter: blur(6px); border-bottom: 1px solid var(--line); }
.top-row { display: flex; align-items: center; gap: 16px; padding: 10px 20px; flex-wrap: wrap; }
.brand { display: flex; align-items: baseline; gap: 10px; }
.brand h1 { font-size: 1.7rem; font-weight: 700; text-transform: uppercase; }
.brand h1 b { color: var(--accent); font-weight: 700; }
.brand span { color: var(--muted); font-size: 0.85rem; }
.profile { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.profile label { color: var(--muted); font-size: 0.85rem; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.seg button { background: transparent; border: 0; padding: 6px 12px; cursor: pointer; color: var(--muted); font-weight: 500; }
.seg button[aria-pressed="true"] { background: var(--accent); color: #1a1600; }
nav.tabs { display: flex; gap: 2px; padding: 0 12px; overflow-x: auto; }
nav.tabs a { padding: 9px 12px 10px; color: var(--muted); text-decoration: none; white-space: nowrap; border-bottom: 2px solid transparent; font-weight: 500; }
nav.tabs a:hover { color: var(--ink); }
nav.tabs a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--accent); }

main { padding: 18px 20px 40px; max-width: 1400px; margin: 0 auto; }
section.view { display: none; }
section.view.on { display: grid; gap: 16px; }
.lead { color: var(--muted); max-width: 75ch; }
.lead b { color: var(--accent); font-weight: 600; }
.key { color: var(--accent); font-weight: 600; }
.hint .key { font-weight: 500; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; min-width: 0; }
.card > h3 { margin-bottom: 10px; }
.card .hint { color: var(--muted); font-size: 0.82rem; margin-top: 8px; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.split { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 16px; }
@media (max-width: 980px) { .grid2, .grid3, .split { grid-template-columns: minmax(0, 1fr); } }

/* resumen */
.summary { border-left: 3px solid var(--accent); }
.summary ul { margin: 0; padding-left: 18px; display: grid; gap: 6px; }
.summary li::marker { color: var(--accent); }
.summary li.go { cursor: pointer; }
.summary li.go:hover, .summary li.go:focus-visible { color: var(--accent); }
.go-hint { font-size: 0.75rem; color: var(--muted); border: 1px solid var(--line); border-radius: 4px; padding: 0 5px; margin-left: 4px; white-space: nowrap; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
#map { cursor: pointer; }

/* tiles */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.tile { background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; }
.tile .k { color: var(--muted); font-size: 0.8rem; }
.tile .v { font-size: 1.35rem; margin-top: 2px; }
.tile .s { color: var(--muted); font-size: 0.8rem; margin-top: 2px; }

/* chips */
.chip { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 0.8rem; font-weight: 600; border: 1px solid currentColor; white-space: nowrap; }
.chip.good { color: var(--good); } .chip.warn { color: var(--warn); } .chip.bad { color: var(--bad); } .chip.muted { color: var(--muted); }
.tag-ej { font-size: 0.7rem; color: var(--warn); border: 1px solid var(--warn); border-radius: 4px; padding: 0 4px; margin-left: 4px; vertical-align: 1px; }

/* tablas */
.tbl-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 0.9rem; }
th, td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { color: var(--muted); font-weight: 500; font-size: 0.8rem; }
td.n, th.n { text-align: right; }
tr.sel td { background: rgba(255,210,63,0.06); }
.a { color: var(--lap-a); } .b { color: var(--lap-b); }
.pos { color: var(--bad); } .neg { color: var(--good); }
tr.click { cursor: pointer; } tr.click:hover td { background: rgba(255,255,255,0.03); }

/* formularios */
.form { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px 12px; }
.field { display: grid; gap: 3px; }
.field label { font-size: 0.78rem; color: var(--muted); }
.field input, .field select { background: var(--panel-2); border: 1px solid var(--line); border-radius: 6px; padding: 6px 8px; width: 100%; font-family: var(--font-mono); }
.field select { font-family: var(--font-body); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.btn { background: var(--panel-2); border: 1px solid var(--line); border-radius: 6px; padding: 7px 12px; cursor: pointer; font-weight: 500; }
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--accent); color: #1a1600; border-color: var(--accent); }
.err { color: var(--bad); font-size: 0.88rem; }

/* gráficos */
.chart { width: 100%; }
.chart-title { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin: 4px 0 2px; }
.chart-title span { color: var(--muted); font-size: 0.8rem; }
svg.map { width: 100%; height: 340px; display: block; }
svg.map text { user-select: none; }
canvas.gg { width: 100%; height: 260px; display: block; }
.legend-inline { display: flex; gap: 14px; font-size: 0.85rem; color: var(--muted); flex-wrap: wrap; }
.brk-board { display: block; }
.brk-tip { position: absolute; z-index: 5; width: 240px; pointer-events: none; background: rgba(24,30,38,0.97); border: 1px solid var(--line); border-radius: 6px; padding: 6px 10px; font-size: 12px; line-height: 1.4; color: var(--ink); box-shadow: 0 6px 18px rgba(0,0,0,0.35); }
.cmp-box { margin-top: 14px; padding: 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel-2); }
#cmp-out { margin-top: 10px; }
#cmp-out .v { font-size: 1.05rem; color: var(--ink); }
#cmp-out p { margin: 4px 0 0; color: var(--muted); }
.run-link { background: none; border: 0; padding: 0; color: var(--lap-a); cursor: pointer; font: inherit; text-decoration: underline; text-underline-offset: 2px; }
.hotline { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 6px; font-size: 0.78rem; color: var(--muted); }
.set-map { display: block; width: 100%; height: 260px; margin-top: 12px; }
.mixbar { display: flex; height: 18px; border-radius: 4px; overflow: hidden; gap: 2px; }
.mixbar span { display: block; height: 100%; }
.plan { margin: 0; padding-left: 22px; line-height: 1.55; }
.plan li { margin-bottom: 6px; }
.legend-inline i { display: inline-block; width: 14px; height: 3px; vertical-align: middle; margin-right: 5px; border-radius: 2px; }
.u-legend { color: var(--muted); font-size: 0.8rem; font-family: var(--font-body); }
.u-legend .u-value { font-family: var(--font-mono); color: var(--ink); }
.u-select { background: rgba(255,210,63,0.12); }

/* auto visto desde arriba */
.car { display: grid; grid-template-columns: 1fr 120px 1fr; grid-template-rows: auto 1fr auto; gap: 8px; align-items: center; }
.car .body { grid-column: 2; grid-row: 1 / span 3; height: 100%; min-height: 230px; border: 2px solid var(--line); border-radius: 40px 40px 26px 26px; position: relative; background: linear-gradient(180deg, rgba(255,255,255,0.03), transparent); }
.car .body .front { position: absolute; top: 6px; width: 100%; text-align: center; font-size: 0.7rem; color: var(--muted); letter-spacing: 0.1em; }
.car .cg { position: absolute; width: 14px; height: 14px; border-radius: 50%; background: var(--accent); transform: translate(-50%, -50%); box-shadow: 0 0 0 4px rgba(255,210,63,0.2); }
.car .bal { position: absolute; width: 10px; height: 10px; background: var(--lap-b); transform: translate(-50%, -50%) rotate(45deg); }
.wheel { background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; padding: 8px; }
.wheel .field input { text-align: right; }
.wheel .pct { font-family: var(--font-mono); color: var(--muted); font-size: 0.8rem; margin-top: 4px; }

/* gomas */
.tyre { background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; padding: 10px; display: grid; gap: 8px; }
.heat { display: grid; grid-template-columns: repeat(3, 1fr); gap: 3px; height: 34px; }
.heat div { border-radius: 4px; display: flex; align-items: center; justify-content: center; font-family: var(--font-mono); font-size: 0.8rem; color: #111; font-weight: 500; }
.temps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
.temps input { background: var(--panel); border: 1px solid var(--line); border-radius: 5px; padding: 4px; width: 100%; text-align: center; font-family: var(--font-mono); }
.verdict { display: flex; gap: 6px; flex-wrap: wrap; }

/* checklist */
.check { display: grid; grid-template-columns: 28px minmax(0, 1fr) 150px; gap: 8px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }
.check input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--accent); }
.check.done .txt { color: var(--muted); text-decoration: line-through; }
.check select { background: var(--panel-2); border: 1px solid var(--line); border-radius: 6px; padding: 4px 6px; }
.bar { height: 8px; background: var(--panel-2); border-radius: 99px; overflow: hidden; border: 1px solid var(--line); }
.bar > div { height: 100%; background: var(--accent); width: 0; transition: width 0.25s; }
.diff td.changed { color: var(--accent); }
.consigna { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; gap: 10px; align-items: start; padding: 10px 0; border-bottom: 1px solid var(--line); }
.consigna:last-child { border-bottom: 0; }
.consigna .nro { font-family: var(--font-display); font-size: 1.8rem; line-height: 1; color: var(--accent); font-weight: 700; }
.consigna .what { font-weight: 600; }
.consigna .why { color: var(--muted); font-size: 0.88rem; margin-top: 2px; }
#pil-narr li.on { color: var(--accent); }
#pil-narr li[contenteditable] { border-radius: 4px; padding: 1px 4px; margin-left: -4px; }
#pil-narr li[contenteditable]:hover { background: rgba(255,255,255,0.04); }
#pil-narr li[contenteditable]:focus { outline: 1px solid var(--accent); background: rgba(255,210,63,0.06); }
.ref-in { background: var(--panel-2); border: 1px solid var(--line); border-radius: 6px; padding: 5px 8px; width: 100%; min-width: 180px; color: var(--ink); }
#pil-refs td { vertical-align: middle; }
footer { color: var(--muted); font-size: 0.82rem; padding: 0 20px 30px; max-width: 1400px; margin: 0 auto; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* ---------- agregados del Box de Ingeniería (mismas variables) ---------- */
td.wrap { white-space: normal; min-width: 260px; }

/* Navegación entre páginas (agregado): la marca y «← Inicio» llevan a index.html */
a.brand { color: inherit; text-decoration: none; }
nav.tabs a.inicio { color: var(--accent); border-right: 1px solid var(--line); margin-right: 6px; }
.etapa-n { font-family: var(--font-mono); color: var(--accent); font-size: 0.8rem; }
.enlaces { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.enlaces a { color: var(--ink); text-decoration: none; border: 1px solid var(--line); border-radius: 6px; padding: 4px 9px; font-size: 0.85rem; background: var(--panel-2); }
.enlaces a:hover { border-color: var(--accent); }
.enlaces a.principal { border-color: var(--accent); color: var(--accent); font-weight: 600; }

/* Página de informe adentro de una pestaña de la app (iframe): sin la barra de arriba ni el pie */
html.incrustado header.top { position: static; padding-top: 0; }
html.incrustado header.top .top-row, html.incrustado nav.tabs a.inicio, html.incrustado footer { display: none; }
html.incrustado main { padding-top: 8px; }
