/* Trazo — interfaz con el sistema visual Tritic («plano de taller»):
   filetes en lugar de sombras, esquinas de 0–2 px, IBM Plex, un solo acento verde por vista. */

@font-face { font-family: "IBM Plex Sans"; font-weight: 400; font-display: swap; src: url(fonts/ibm-plex-sans-latin-400-normal.woff2) format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-weight: 500; font-display: swap; src: url(fonts/ibm-plex-sans-latin-500-normal.woff2) format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-weight: 600; font-display: swap; src: url(fonts/ibm-plex-sans-latin-600-normal.woff2) format("woff2"); }
@font-face { font-family: "IBM Plex Mono"; font-weight: 400; font-display: swap; src: url(fonts/ibm-plex-mono-latin-400-normal.woff2) format("woff2"); }
@font-face { font-family: "IBM Plex Mono"; font-weight: 500; font-display: swap; src: url(fonts/ibm-plex-mono-latin-500-normal.woff2) format("woff2"); }
@font-face { font-family: "Syncopate"; font-weight: 700; font-display: swap; src: url(fonts/syncopate-latin-700-normal.woff2) format("woff2"); }

:root {
  /* paleta Tritic */
  --azul-950: #04202F; --azul-900: #002F47; --azul-700: #00476A; --azul-600: #0A6E9C;
  --azul-400: #5B9BBF; --azul-200: #B7CCD8; --azul-100: #D6E6EE; --azul-50: #EEF5F8;
  --verde-500: #00FFC7; --verde-700: #006B53; --verde-100: #CCFFF3;
  --info: #0A6E9C; --info-bg: #E6F0F5; --ok: #006B53; --ok-bg: #E0FBF4;
  --warn: #A15300; --warn-bg: #FFF4E0; --err: #B3261E; --err-bg: #FDECEA;
  /* tema claro (documento) */
  --fondo: #FFFFFF; --fondo-alt: #F4F7F8; --fondo-3: #E9EEF1;
  --tinta: #0E1B24; --tinta-2: #3A4A55; --tinta-3: #5A6973; --tinta-4: #9FB1BC;
  --titulo: #00476A; --linea: #D5DDE1; --linea-f: #5A6973; --acento-t: #006B53;
  --sel: #00476A; --sel-t: #FFFFFF; --hover: #EEF5F8;
  /* lienzo */
  --cv-fondo: #F4F7F8; --cv-cama: #E9EEF1; --cv-reja: #D5DDE1; --cv-reja2: #B7CCD8;
  --cv-borde: #5A6973; --cv-hoja: #FFFFFF; --cv-texto: #5A6973; --cv-cota: #0A6E9C; --cv-viaje: #5B9BBF;

  --sans: "IBM Plex Sans", Arial, sans-serif;
  --mono: "IBM Plex Mono", Consolas, monospace;
  --marca: Syncopate, "Arial Black", sans-serif;
  font-family: var(--sans); font-size: 13px; line-height: 1.45; color: var(--tinta);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --fondo: #04202F; --fondo-alt: #0A2C3E; --fondo-3: #103548;
    --tinta: #E9EEF1; --tinta-2: #B7C6CF; --tinta-3: #8FA4B0; --tinta-4: #5E7A8A;
    --titulo: #FFFFFF; --linea: #1E4458; --linea-f: #7F97A5; --acento-t: #00FFC7;
    --sel: #0A6E9C; --sel-t: #FFFFFF; --hover: #0F3A50;
    --info-bg: #0B3347; --ok-bg: #08372E; --warn-bg: #3A2A0D; --err-bg: #3D1714;
    --info: #7CC4E8; --ok: #00FFC7; --warn: #F2B866; --err: #F4A29C;
    --cv-fondo: #0A2C3E; --cv-cama: #0F3548; --cv-reja: #1A4559; --cv-reja2: #275A72;
    --cv-borde: #7F97A5; --cv-hoja: #FFFFFF; --cv-texto: #8FA4B0; --cv-cota: #7CC4E8; --cv-viaje: #5B9BBF;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] { color-scheme: dark; }

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; background: var(--fondo); }
body { display: grid; grid-template-rows: 48px 1fr 26px; height: 100vh; overflow: hidden; }
button, input, select, textarea { font: inherit; color: inherit; }
b { font-weight: 600; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--tinta-3); }
.grow { flex: 1; }
.icn { display: block; flex: none; }
i[data-icon] { display: inline-flex; }

/* ---------- barra superior (azul noche) ---------- */
.top { display: flex; align-items: center; gap: 6px; padding: 0 10px 0 12px; background: var(--azul-950); color: #E9EEF1; border-bottom: 1px solid #1E4458; }
.brand { display: flex; align-items: center; gap: 10px; padding-right: 6px; }
.brand img { display: block; }
.tsep { width: 1px; height: 24px; background: #1E4458; margin: 0 6px; }
.tsep.l { height: 20px; background: var(--linea); margin: 0 2px; }
.tbtn { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 10px; border: 1px solid transparent; border-radius: 2px; background: transparent; color: #E9EEF1; cursor: pointer; }
.tbtn:hover { background: var(--azul-900); border-color: #1E4458; }
.tbtn.icon { padding: 0 7px; }
.tbtn:focus-visible, .cta:focus-visible { outline: 2px solid var(--azul-400); outline-offset: 1px; }
.docname { display: flex; align-items: baseline; gap: 8px; min-width: 0; margin-left: 4px; }
.docname .n { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 32vw; }
.docname .t { font-family: var(--mono); font-size: 11px; font-weight: 500; letter-spacing: .06em; color: var(--azul-200); border: 1px solid #1E4458; padding: 0 5px; }
.docname .d { font-family: var(--mono); font-size: 12px; color: #8FA4B0; white-space: nowrap; }
.muted-d { color: #8FA4B0; }
/* el acento verde de la vista: la acción principal */
.cta { display: inline-flex; align-items: center; gap: 8px; height: 32px; padding: 0 14px; margin-left: 6px; border: 0; border-radius: 2px; background: var(--verde-500); color: var(--azul-950); font-weight: 600; cursor: pointer; }
.cta:hover { background: #5CFFDB; }
.cta:disabled { background: #1E4458; color: #8FA4B0; cursor: default; }

/* ---------- distribución ---------- */
.layout { display: grid; grid-template-columns: 344px minmax(0, 1fr) 292px; min-height: 0; }
.layout.no-insp { grid-template-columns: 344px minmax(0, 1fr) 0; }
.layout.no-insp .insp { display: none; }

/* ---------- panel de flujo ---------- */
.side { overflow-y: auto; background: var(--fondo); border-right: 1px solid var(--linea); scrollbar-width: thin; }
.sec { border-bottom: 1px solid var(--linea); }
.sec-h { display: flex; align-items: center; gap: 10px; height: 44px; padding: 0 12px 0 14px; cursor: pointer; user-select: none; }
.sec-h:hover { background: var(--hover); }
.sec-h h2 { margin: 0; font-size: 13.5px; font-weight: 600; color: var(--titulo); white-space: nowrap; }
.sec-h .sum { flex: 1; min-width: 0; text-align: right; font-family: var(--mono); font-size: 11px; color: var(--tinta-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sec-h .chev { color: var(--tinta-3); transition: transform .12s; }
.sec.closed .chev { transform: rotate(-90deg); }
.sec.closed .sec-b { display: none; }
.sec-b { padding: 2px 14px 16px; }
.sec:not(.closed) .sum { visibility: hidden; }

/* chip Tritic: cuadrado azul con índice en mono verde */
.chip { display: inline-grid; place-items: center; flex: none; width: 22px; height: 22px; background: var(--azul-700); color: var(--verde-500); font-family: var(--mono); font-weight: 500; font-size: 11px; line-height: 1; }
.chip.lg { width: 44px; height: 44px; font-size: 18px; }
.chip.sm { width: 18px; height: 18px; font-size: 10px; }

h3.sub { margin: 16px 0 6px; padding-top: 12px; border-top: 1px solid var(--linea); font-size: 12px; font-weight: 600; color: var(--tinta); display: flex; align-items: baseline; gap: 8px; }
h3.sub:first-child { margin-top: 6px; }
.mono-t { font-family: var(--mono); font-weight: 400; font-size: 10.5px; color: var(--tinta-3); }

/* campos */
.f { display: grid; grid-template-columns: 116px minmax(0, 1fr); align-items: center; gap: 4px 10px; margin: 7px 0; min-height: 28px; }
.f.at { align-items: start; }
.f.at > label:first-child { padding-top: 6px; }
.f > label:first-child, .f > span:first-child { font-size: 12px; color: var(--tinta-2); line-height: 1.25; }
.f > .ck { grid-column: 2; }
.f > :nth-child(3) { grid-column: 2; }
select, .num, input[type=text], textarea { height: 28px; border: 1px solid var(--linea); border-radius: 2px; background: var(--fondo); }
select { width: 100%; min-width: 0; padding: 0 24px 0 8px; appearance: none; cursor: pointer;
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="10" height="6"><path d="M1 1l4 4 4-4" fill="none" stroke="%235A6973" stroke-width="1.5"/></svg>');
  background-repeat: no-repeat; background-position: right 8px center; }
select:hover, .num:hover, input[type=text]:hover { border-color: var(--azul-200); }
select:focus, .num:focus-within, input[type=text]:focus, textarea:focus { outline: 1px solid var(--azul-600); border-color: var(--azul-600); }
.num { display: flex; align-items: center; min-width: 0; }
.num input { flex: 1; min-width: 0; height: 100%; border: 0; outline: 0; background: transparent; padding: 0 6px 0 8px; font-family: var(--mono); font-size: 12.5px; }
.num .u { padding-right: 8px; font-family: var(--mono); font-size: 11px; color: var(--tinta-3); white-space: nowrap; }
.num .p { padding-left: 8px; font-family: var(--mono); font-size: 11px; font-weight: 500; color: var(--tinta-3); }
.num.sm { max-width: 120px; }
.num input { -moz-appearance: textfield; appearance: textfield; }
.num input::-webkit-inner-spin-button, .num input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
input::placeholder { color: var(--tinta-4); }
.inline { display: flex; gap: 6px; align-items: center; min-width: 0; }
.inline .num { flex: 1; }
.pick { display: flex; gap: 4px; min-width: 0; }
.rng { display: flex; align-items: center; gap: 8px; }
.rng input { flex: 1; min-width: 0; }
output { min-width: 32px; text-align: right; font-family: var(--mono); font-size: 11.5px; color: var(--tinta-2); }
input[type=range] { accent-color: var(--azul-600); height: 18px; }
input[type=checkbox] { accent-color: var(--azul-700); width: 14px; height: 14px; margin: 0; }
.ck { display: inline-flex; align-items: flex-start; gap: 7px; font-size: 12.5px; line-height: 1.35; color: var(--tinta); cursor: pointer; }
.ck input { margin-top: 2px; flex: none; }
.help { margin: 6px 0 2px; font-size: 11.5px; line-height: 1.45; color: var(--tinta-3); }
.help b { color: var(--tinta-2); }

/* segmentados */
.seg { display: inline-flex; border: 1px solid var(--linea); border-radius: 2px; overflow: hidden; height: 28px; max-width: 100%; }
.seg.wide { display: flex; }
.seg button { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 4px; padding: 0 9px; border: 0; border-left: 1px solid var(--linea); background: var(--fondo); color: var(--tinta-2); font-size: 12px; cursor: pointer; white-space: nowrap; }
.seg button:first-child { border-left: 0; }
.seg button:hover { background: var(--hover); }
.seg button.on { background: var(--sel); color: var(--sel-t); }
.seg.pat button { padding: 0 6px; }
.seg.wide button { padding: 0 4px; font-size: 11.5px; }

/* alineación 3×3 */
.alignbox { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.align { display: grid; grid-template-columns: repeat(3, 18px); gap: 3px; padding: 4px; border: 1px solid var(--linea); border-radius: 2px; }
.align button { width: 18px; height: 18px; padding: 0; border: 1px solid var(--linea-f); background: var(--fondo); cursor: pointer; border-radius: 0; }
.align button:hover { background: var(--azul-100); }
.align button.on { background: var(--azul-700); border-color: var(--azul-700); }

/* botones */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 30px; padding: 0 12px; border: 1px solid var(--linea); border-radius: 2px; background: var(--fondo); color: var(--tinta); cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: var(--linea-f); background: var(--hover); }
.btn.primary { background: var(--azul-700); border-color: var(--azul-700); color: #fff; }
.btn.primary:hover { background: var(--azul-900); }
.btn.sm { height: 26px; padding: 0 9px; font-size: 12px; }
.btn:disabled { opacity: .45; cursor: default; }
.btn:focus-visible, .ib:focus-visible, .seg button:focus-visible { outline: 2px solid var(--azul-600); outline-offset: 1px; }
.ib { display: inline-grid; place-items: center; width: 28px; height: 28px; padding: 0; border: 1px solid transparent; border-radius: 2px; background: transparent; color: var(--tinta-2); cursor: pointer; flex: none; }
.ib:hover { background: var(--hover); color: var(--tinta); }
.ib.b { border-color: var(--linea); }
.ib.tog.on { background: var(--sel); color: var(--sel-t); border-color: var(--sel); }
.ib:disabled { opacity: .3; cursor: default; }
.ib.inv { color: #E9EEF1; }
.ib.inv:hover { background: rgba(255,255,255,.1); color: #fff; }
.bulk { display: flex; gap: 6px; flex-wrap: wrap; margin: 10px 0; }

/* archivo */
.filecard { border: 1px solid var(--linea); border-radius: 2px; padding: 10px 12px; background: var(--fondo-alt); display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.filecard p { margin: 0; }
.filecard .fc-n { font-weight: 600; word-break: break-all; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 2px 12px; width: 100%; font-size: 12px; }
.kv dt { color: var(--tinta-3); }
.kv dd { margin: 0; font-family: var(--mono); font-size: 12px; text-align: right; }

/* grupos (tabla de filetes horizontales) */
.groups { border-top: 1px solid var(--linea-f); border-bottom: 1px solid var(--linea-f); }
.grp { padding: 8px 0; border-top: 1px solid var(--linea); }
.grp:first-child { border-top: 0; }
.grp.off { opacity: .5; }
.grp-h { display: flex; align-items: center; gap: 7px; }
.grp-h .k { flex: 1; min-width: 0; }
.grp-h .k b { display: block; font-family: var(--mono); font-weight: 500; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.grp-h .k small { display: block; color: var(--tinta-3); font-size: 11px; }
.sw { width: 16px; height: 16px; flex: none; border: 1px solid rgba(14,27,36,.25); }
.sw.ink { position: relative; background: #fff; overflow: hidden; }
.sw.ink i { position: absolute; inset: 0; }
.grp-h .to { color: var(--tinta-4); font-family: var(--mono); font-size: 11px; }
.grp-c { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr); gap: 6px; margin-top: 6px; }
.grp-c select { height: 26px; font-size: 12px; }

/* nota (callout Tritic) */
.note, .callout { position: relative; margin: 12px 0 4px; padding: 14px 10px 8px; border: 1px solid var(--linea); border-radius: 2px; background: var(--info-bg); font-size: 12px; line-height: 1.45; }
.note::before, .callout::before { content: attr(data-tab); position: absolute; top: -8px; left: 8px; padding: 0 6px 0 14px; background: var(--fondo); font-family: var(--mono); font-size: 10px; font-weight: 500; letter-spacing: .06em; color: var(--info);
  background-image: linear-gradient(var(--info), var(--info)); background-size: 7px 7px; background-repeat: no-repeat; background-position: 3px 50%; line-height: 16px; }
.callout.warn { background: var(--warn-bg); }
.callout.warn::before { color: var(--warn); background-image: linear-gradient(var(--warn), var(--warn)); }
.callout.err { background: var(--err-bg); }
.callout.err::before { color: var(--err); background-image: linear-gradient(var(--err), var(--err)); }
.callout.ok { background: var(--ok-bg); }
.callout.ok::before { color: var(--ok); background-image: linear-gradient(var(--ok), var(--ok)); }
.note b, .callout b { font-weight: 600; }

/* ---------- lienzo ---------- */
.view { position: relative; min-width: 0; min-height: 0; background: var(--cv-fondo); overflow: hidden; }
#cv { position: absolute; inset: 0; width: 100%; height: 100%; cursor: grab; touch-action: none; }
.tb { position: absolute; z-index: 2; display: flex; align-items: center; gap: 2px; padding: 3px; background: var(--fondo); border: 1px solid var(--linea); border-radius: 2px; }
.tb-top { top: 30px; right: 12px; }
.tb-calc { top: 30px; left: 32px; gap: 6px; padding: 3px 4px; flex-wrap: wrap; max-width: calc(100% - 260px); }
.tb-calc .seg { height: 26px; }
.tb-calc .seg button { font-size: 11.5px; }
.calc-chip { font-family: var(--mono, "IBM Plex Mono", monospace); font-size: 11px; letter-spacing: .04em; text-transform: uppercase; color: var(--tinta-2); padding: 0 4px; white-space: nowrap; }
.calc-chip.warn { color: var(--azul-600); }
#cv.dim { opacity: .55; transition: opacity .15s; }
@media (max-width: 760px) { .tb-calc { top: 58px; max-width: calc(100% - 24px); } }
.tb-play { bottom: 12px; left: 50%; transform: translateX(-50%); gap: 8px; padding: 3px 12px 3px 3px; max-width: calc(100% - 24px); }
.tb-play #progress { width: min(360px, 28vw); min-width: 80px; }
.tb-play .mono { font-size: 11.5px; color: var(--tinta-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.zoomv { height: 28px; min-width: 54px; padding: 0 6px; border: 0; background: transparent; font-family: var(--mono); font-size: 11.5px; color: var(--tinta-2); cursor: pointer; border-radius: 2px; }
.zoomv:hover { background: var(--hover); }
.loadbar { position: absolute; z-index: 3; top: 0; left: 0; right: 0; height: 2px; overflow: hidden; background: var(--azul-100); }
.loadbar::after { content: ""; position: absolute; top: 0; bottom: 0; width: 30%; background: var(--azul-600); animation: load 1s linear infinite; }
@keyframes load { from { left: -30%; } to { left: 100%; } }
.empty { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; }
.empty-in { pointer-events: auto; width: 420px; max-width: 90%; padding: 28px 30px 24px; background: var(--fondo); border: 1px solid var(--linea-f); border-radius: 2px; }
.empty-in h3 { margin: 16px 0 4px; font-size: 18px; font-weight: 600; color: var(--titulo); }
.empty-in p { margin: 0 0 4px; color: var(--tinta-2); }
.empty-in .fmt { margin: 10px 0 16px; font-size: 12px; letter-spacing: .06em; color: var(--tinta-3); }
.keys { margin-top: 20px; width: 100%; border-collapse: collapse; border-top: 1px solid var(--linea); font-size: 12px; }
.keys td { padding: 6px 4px 0; color: var(--tinta-2); }
.keys td:nth-child(odd) { font-family: var(--mono); font-size: 11px; color: var(--tinta-3); white-space: nowrap; }
.drop { position: absolute; inset: 10px; z-index: 5; display: grid; place-items: center; border: 2px dashed var(--azul-600); background: color-mix(in srgb, var(--azul-50) 85%, transparent); color: var(--azul-700); font-weight: 600; font-size: 15px; pointer-events: none; }
.toast { position: absolute; z-index: 6; right: 12px; top: 84px; max-width: 380px; margin: 0; box-shadow: none; }

/* ---------- inspector (cajetín) ---------- */
.insp { display: flex; flex-direction: column; min-height: 0; overflow-y: auto; background: var(--fondo); border-left: 1px solid var(--linea); scrollbar-width: thin; }
.insp-sec { padding: 14px 14px 12px; border-bottom: 1px solid var(--linea); }
.insp-sec.grow { flex: 1; border-bottom: 0; }
.lbl { margin-bottom: 8px; font-family: var(--mono); font-size: 10.5px; font-weight: 500; letter-spacing: .06em; text-transform: uppercase; color: var(--tinta-3); }
.cajetin { display: grid; grid-template-columns: 1fr 1fr; border: 1px solid var(--linea-f); }
.cajetin > div { padding: 6px 8px 7px; border-right: 1px solid var(--linea); border-bottom: 1px solid var(--linea); min-width: 0; }
.cajetin > div:nth-child(2n) { border-right: 0; }
.cajetin > div.full { grid-column: 1 / -1; border-right: 0; }
.cajetin > div:nth-last-child(-n+2):not(.full) { border-bottom: 0; }
.cajetin .k { display: block; font-family: var(--mono); font-size: 9.5px; font-weight: 500; letter-spacing: .06em; text-transform: uppercase; color: var(--tinta-3); }
.cajetin .v { display: block; font-family: var(--mono); font-size: 13px; color: var(--tinta); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cajetin .full .v { font-size: 22px; line-height: 1.2; color: var(--titulo); }
.cajetin .empty-v { color: var(--tinta-4); }
.seq { list-style: none; margin: 0; padding: 0; }
.seq li { display: grid; grid-template-columns: 18px 1fr auto; gap: 8px; align-items: center; padding: 6px 0; border-top: 1px solid var(--linea); font-size: 12px; }
.seq li:first-child { border-top: 0; padding-top: 0; }
.seq li.muted { display: block; }
.seq .pn { min-width: 0; }
.seq .pn b { display: block; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.seq .pn small { display: flex; align-items: center; gap: 6px; color: var(--tinta-3); font-family: var(--mono); font-size: 10.5px; }
.seq .smp { display: inline-flex; align-items: center; width: 30px; height: 12px; padding: 0 4px; background: #fff; border: 1px solid var(--linea); }
.seq .smp i { display: block; width: 100%; }
.seq .t { font-family: var(--mono); font-size: 11.5px; color: var(--tinta-2); }
.seq .chg { grid-column: 2 / -1; font-family: var(--mono); font-size: 10.5px; color: var(--warn); }
#warnings .callout { margin: 14px 0 0; }
#warnings .callout:first-child { margin-top: 10px; }
.sign { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-top: 1px solid var(--linea); font-size: 11px; color: var(--tinta-3); }

/* ---------- barra de estado ---------- */
.status { display: flex; align-items: center; gap: 12px; padding: 0 12px; border-top: 1px solid var(--linea); background: var(--fondo-alt); font-size: 11.5px; color: var(--tinta-2); white-space: nowrap; overflow: hidden; }
.status .mono { font-size: 11px; }
.ssep { width: 1px; height: 12px; background: var(--linea); }
#state.busy { color: var(--azul-600); }

/* ---------- diálogos: ficha técnica ---------- */
dialog { padding: 0; border: 1px solid var(--linea-f); border-radius: 2px; background: var(--fondo); color: var(--tinta); box-shadow: none; }
dialog::backdrop { background: rgba(4, 32, 47, .55); }
.ficha { width: min(820px, 96vw); max-height: 88vh; }
.ficha.sm { width: min(520px, 96vw); }
.ficha[open], .about[open] { display: flex; flex-direction: column; }
.fh { display: flex; align-items: center; gap: 12px; padding: 10px 10px 10px 16px; background: var(--azul-700); color: #fff; }
.fh-k { font-size: 10.5px; font-weight: 500; letter-spacing: .06em; color: var(--azul-200); }
.fh-t { font-size: 15px; font-weight: 600; }
.fbody { display: grid; grid-template-columns: 220px 1fr; min-height: 0; flex: 1; overflow: hidden; }
.plist { overflow-y: auto; border-right: 1px solid var(--linea); background: var(--fondo-alt); padding: 6px 0; }
.plist button { display: flex; align-items: center; gap: 8px; width: 100%; padding: 7px 12px; border: 0; background: transparent; text-align: left; cursor: pointer; font-size: 12.5px; color: var(--tinta); }
.plist button:hover { background: var(--hover); }
.plist button.on { background: var(--fondo); box-shadow: inset 2px 0 0 var(--azul-700); font-weight: 600; }
.plist .tag { margin-left: auto; font-family: var(--mono); font-size: 9.5px; letter-spacing: .06em; color: var(--tinta-3); }
.plist .sw { width: 12px; height: 12px; }
.pform { overflow-y: auto; padding: 6px 18px 14px; background: var(--fondo); }
.pform h4 { margin: 14px 0 4px; padding-bottom: 4px; border-bottom: 1px solid var(--linea-f); font-family: var(--mono); font-size: 10.5px; font-weight: 500; letter-spacing: .06em; text-transform: uppercase; color: var(--tinta-3); }
.pform .f { grid-template-columns: 170px minmax(0, 1fr); }
.pform .f .help { grid-column: 2; margin: -2px 0 2px; }
.pform textarea { width: 100%; height: 64px; padding: 6px 8px; font-family: var(--mono); font-size: 12px; resize: vertical; }
.pform input[type=text] { width: 100%; padding: 0 8px; }
.pform input[type=color] { width: 56px; height: 28px; padding: 2px; border: 1px solid var(--linea); border-radius: 2px; background: var(--fondo); }
.ffoot { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-top: 1px solid var(--linea); background: var(--fondo-alt); }
.fpad { padding: 14px 18px 8px; overflow-y: auto; }
.fpad p { margin: 0 0 10px; }
.steps { list-style: none; margin: 8px 0 14px; padding: 0; position: relative; }
.steps li { position: relative; display: flex; gap: 12px; padding-bottom: 12px; }
.steps li:not(:last-child)::before { content: ""; position: absolute; left: 10.5px; top: 24px; bottom: 0; width: 1px; background: var(--linea); }
.steps b { display: block; font-size: 13px; }
.steps p { margin: 2px 0 0; font-size: 12px; color: var(--tinta-2); }

/* acerca de */
.about { width: min(560px, 96vw); }
.ab-cover { position: relative; display: flex; align-items: center; gap: 18px; padding: 30px 26px 26px; background: var(--azul-700);
  background-image: radial-gradient(circle, var(--azul-900) 1.1px, transparent 1.3px); background-size: 19px 19px; background-position: 6px 6px; color: #fff; }
.ab-sub { margin-top: 8px; font-size: 13px; color: var(--azul-200); }
.ab-ver { margin-top: 4px; font-size: 11.5px; color: var(--azul-200); }
.ab-x { position: absolute; top: 8px; right: 8px; }
.ab-sign { display: flex; align-items: center; justify-content: flex-end; gap: 12px; padding: 14px 20px; background: var(--azul-700); color: var(--azul-200); font-size: 11.5px; }
.tbl { width: 100%; border-collapse: collapse; margin: 4px 0 12px; font-size: 12.5px; }
.tbl th { text-align: left; font-weight: 600; padding: 6px 8px; border-top: 1px solid var(--linea-f); border-bottom: 1px solid var(--linea-f); }
.tbl td { padding: 5px 8px; border-bottom: 1px solid var(--linea); }
.tbl tr:last-child td { border-bottom: 1px solid var(--linea-f); }
.tbl td.mono { font-size: 11.5px; color: var(--tinta-2); white-space: nowrap; }
.caption { font-size: 11px; color: var(--tinta-3); }

/* ---------- pantallas angostas ---------- */
@media (max-width: 1180px) {
  .layout, .layout.no-insp { grid-template-columns: 320px minmax(0, 1fr) 0; }
  .insp { display: none; }
  .layout.show-insp { grid-template-columns: 320px minmax(0, 1fr) 280px; }
  .layout.show-insp .insp { display: flex; }
  .docname .d { display: none; }
}
@media (max-width: 760px) {
  body { grid-template-rows: 48px 1fr 26px; overflow: auto; height: auto; min-height: 100vh; }
  .layout, .layout.no-insp, .layout.show-insp { grid-template-columns: 1fr; grid-template-rows: 60vh auto auto; }
  .view { order: 1; min-height: 60vh; }
  .side { order: 2; border-right: 0; }
  .layout.show-insp .insp { order: 3; display: flex; border-left: 0; }
  .top .tbtn span, .brand .wordmark, .docname .t, .cta span { display: none; }
  .tb-top { right: 8px; top: 26px; }
  .fbody { grid-template-columns: 1fr; }
  .plist { max-height: 140px; border-right: 0; border-bottom: 1px solid var(--linea); }
}

/* ---------- estado del motor (Pyodide) ---------- */
body.booting .side, body.booting .insp { opacity: .45; pointer-events: none; }
body.booting [data-scale], body.booting [data-show], body.booting [data-stroke] { display: none; }
.note:empty { display: none; }
.engine { margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--linea); }
.engine .mono { margin: 6px 0 4px; font-size: 11.5px; color: var(--tinta-2); }
.engine-bar { height: 3px; background: var(--azul-100); overflow: hidden; }
.engine-bar i { display: block; height: 100%; width: 0; background: var(--azul-600); transition: width .3s; }
.engine.done .engine-bar { display: none; }
.engine.done .mono { color: var(--ok); }
.engine.fail .mono { color: var(--err); }
