/* =========================================================
   style.css — Laboratorio Troncales 802.1Q
   Paleta: navy #00396B · deep #002445 · gold #C69C39
           coral #E4572E · teal #2A9D8F · ink #1F2933 · paper #FAFAF7
   ========================================================= */
:root {
  --navy: #00396B; --deep: #002445; --gold: #C69C39; --coral: #E4572E; --teal: #2A9D8F;
  --ink: #1F2933; --paper: #FAFAF7; --line: #E3E1D8; --muted: #5F6B76; --card: #FFFFFF;
  --term-bg: #0D1621; --term-fg: #D9E2EC;
  --ui: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, "Cascadia Mono", "Liberation Mono", monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--paper); color: var(--ink); font: 15px/1.45 var(--ui); overflow: hidden; }
button { font: inherit; cursor: pointer; }
code { font-family: var(--mono); font-size: .92em; background: #EFEDE4; padding: 1px 5px; border-radius: 4px; }

/* ---------- Encabezado ---------- */
.top { height: 60px; display: flex; align-items: center; gap: 14px; padding: 0 16px; background: #fff; border-bottom: 3px solid var(--gold); }
.back { color: var(--navy); text-decoration: none; font-weight: 600; font-size: 13px; padding: 6px 10px; border-radius: 8px; border: 1px solid var(--line); white-space: nowrap; }
.back:hover { background: #F2F0E8; }
.logo { height: 34px; width: auto; }
.titles { flex: 1; min-width: 0; border-left: 1px solid var(--line); padding-left: 14px; }
.titles h1 { margin: 0; font-size: 18px; color: var(--navy); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; letter-spacing: -.01em; }
.titles p { margin: 0; font-size: 12.5px; color: var(--muted); }
.actions { display: flex; gap: 8px; }
.btn { border: 1px solid transparent; border-radius: 9px; padding: 7px 13px; font-weight: 600; font-size: 13.5px; background: var(--navy); color: #fff; transition: filter .15s, background .15s; }
.btn:hover { filter: brightness(1.08); }
.btn.ghost { background: #fff; color: var(--navy); border-color: #CBD3DB; }
.btn.ghost:hover { background: #F1F4F7; }
.btn.coral { background: var(--coral); }
.btn.gold { background: var(--gold); color: #1F2933; }
.btn.navy { background: var(--navy); }
.btn.sm { padding: 4px 10px; font-size: 13px; }
.btn:disabled { opacity: .45; cursor: default; }
.btn.pulse { animation: pls 1.2s infinite; }
@keyframes pls { 0%,100% { box-shadow: 0 0 0 0 rgba(198,156,57,.6); } 50% { box-shadow: 0 0 0 6px rgba(198,156,57,0); } }

/* ---------- Distribución ---------- */
.layout { height: calc(100vh - 60px); display: flex; }
.work { flex: 1 1 auto; display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.side { flex: 0 0 var(--side-w, 350px); width: var(--side-w, 350px); background: #F4F3EE; display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.stage { flex: 1 1 auto; }
.term { flex: 0 0 var(--term-h, 43%); }
body.term-off .term { display: none; }
body.side-off .side { display: none; }

/* ---------- Divisores arrastrables ---------- */
.splitter { position: relative; flex: none; background: #ECEAE1; touch-action: none; user-select: none; z-index: 5; outline: none; }
.splitter::before { content: ""; position: absolute; background: #C9C4B3; border-radius: 2px; }
.splitter:hover, .splitter.drag, .splitter:focus-visible { background: #E9DDB9; }
.splitter.drag::before, .splitter:hover::before { background: var(--gold); }
.hsplit { height: 10px; cursor: row-resize; border-top: 1px solid var(--line); }
.hsplit::before { left: 50%; top: 4px; width: 40px; height: 2px; transform: translateX(-50%); }
.vsplit { width: 10px; cursor: col-resize; border-left: 1px solid var(--line); }
.vsplit::before { top: 50%; left: 4px; height: 40px; width: 2px; transform: translateY(-50%); }
.sbtn { position: absolute; display: flex; align-items: center; gap: 5px; border: 1px solid #CBD3DB; background: #fff; color: var(--navy); border-radius: 999px; font-size: 12.5px; font-weight: 700; padding: 2px 10px 2px 6px; box-shadow: 0 1px 4px rgba(0,36,69,.12); cursor: pointer; }
.sbtn:hover { background: var(--navy); color: #fff; border-color: var(--navy); }
.sbtn .chev { width: 16px; height: 16px; transition: transform .2s; }
.hsplit .sbtn { right: 18px; top: 50%; transform: translateY(-50%); }
.vsplit .sbtn { left: 50%; top: 18px; transform: translateX(-50%); padding: 6px 2px; flex-direction: column; }
.vsplit .sbtn .sl { writing-mode: vertical-rl; }
body.term-off .hsplit { height: 34px; cursor: default; }
body.term-off .hsplit .chev { transform: rotate(180deg); }
body.side-off .vsplit { width: 34px; cursor: default; }
body.side-off .vsplit .chev { transform: rotate(180deg); }
body.side-off .vsplit .sbtn, body.term-off .hsplit .sbtn { background: var(--gold); border-color: var(--gold); color: #1F2933; }
body.dragging, body.dragging * { cursor: inherit !important; user-select: none !important; }
body.dragging-row { cursor: row-resize; } body.dragging-col { cursor: col-resize; }

/* ---------- Zoom ---------- */
.zoombar { position: absolute; right: 10px; top: 50%; transform: translateY(-60%); display: flex; flex-direction: column; align-items: center; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 4px; gap: 2px; box-shadow: 0 2px 8px rgba(0,36,69,.08); z-index: 3; }
.zoombar button { width: 32px; height: 30px; border: 0; background: none; color: var(--navy); border-radius: 8px; display: flex; align-items: center; justify-content: center; }
.zoombar button:hover { background: #EEF2F6; }
.zoombar svg { width: 18px; height: 18px; }
.zoombar span { font: 700 11.5px var(--ui); color: var(--muted); padding: 2px 0; min-width: 36px; text-align: center; }
#topo { touch-action: none; }
#topo.panning { cursor: grabbing; }
.tfont { display: flex; gap: 2px; margin-left: 4px; }
.tfont button { border: 1px solid #2B3A4A; background: #18232F; color: #C9D6E2; border-radius: 6px; font-size: 12px; font-weight: 700; padding: 1px 7px; }
.tfont button:hover { background: #2B3A4A; color: #fff; }

/* ---------- Lienzo ---------- */
.stage { position: relative; min-height: 0; background:
  radial-gradient(circle at 1px 1px, #E2DFD3 1px, transparent 1.2px) 0 0 / 22px 22px, var(--paper); overflow: hidden; }
#topo { position: absolute; inset: 4px 8px 50px 8px; width: calc(100% - 16px); height: calc(100% - 54px); }
.hintline { position: absolute; left: 14px; top: 10px; font-size: 12.5px; color: var(--muted); background: rgba(250,250,247,.85); padding: 2px 8px; border-radius: 6px; }
.dev { cursor: pointer; outline: none; }
.dev .hit { fill: transparent; }
.dev:hover .hit, .dev:focus .hit { fill: rgba(198,156,57,.12); }
.dev.sel .hit { fill: rgba(198,156,57,.18); stroke: var(--gold); stroke-width: 2; stroke-dasharray: 4 4; }
.dev .ico { transition: transform .15s; }
.dev:hover .ico { transform: translateY(-2px); }
.lbl text { font-family: var(--ui); text-anchor: middle; fill: var(--ink); }
.lbl .al { text-anchor: start; } .lbl .ar { text-anchor: end; }
.lbl .dn { font-size: 17px; font-weight: 800; fill: var(--deep); }
.lbl .dsub { font-size: 12px; fill: var(--muted); }
.lbl .dip { font-size: 13.5px; font-family: var(--mono); font-weight: 600; }
.lbl .dgw { font-size: 12px; font-family: var(--mono); fill: var(--muted); }
.lbl .chipt { font-size: 12px; font-weight: 700; fill: #fff; }
.lbl .reto { font-size: 10.5px; font-weight: 800; fill: var(--gold); letter-spacing: .12em; }
.lbl .dsubif { font-size: 12.5px; font-family: var(--mono); fill: var(--ink); }
.plbl rect { fill: #fff; stroke: #CBD3DB; }
.plbl text { font: 600 11.5px var(--mono); fill: var(--deep); text-anchor: middle; }
.tpill rect { fill: var(--deep); }
.tpill text { font: 700 12px var(--ui); fill: #fff; text-anchor: middle; }
.tpill.warn rect { fill: var(--coral); }
.legend-bg { fill: rgba(255,255,255,.88); stroke: var(--line); }
.legend-t { font: 800 12px var(--ui); fill: var(--navy); letter-spacing: .1em; }
.legend-i { font: 12.5px var(--ui); fill: var(--ink); }
.env rect { transition: fill .2s; }
.env.dead > rect { animation: shake .35s 2; }
@keyframes shake { 0%,100% { transform: translateX(0); } 25% { transform: translateX(-3px); } 75% { transform: translateX(3px); } }
.envlbl rect { fill: var(--gold); stroke: #fff; stroke-width: 1.5; }
.envlbl text { font: 800 12px var(--mono); fill: #1F2933; text-anchor: middle; }
.env.dead .envlbl rect { fill: var(--coral); } .env.dead .envlbl text { fill: #fff; }
.pulse-ring { animation: ring .9s ease-out forwards; }
@keyframes ring { from { opacity: .9; r: 26; } to { opacity: 0; r: 56; } }
.rnote rect { fill: var(--gold); }
.rnote text { font: 700 12.5px var(--ui); fill: #1F2933; text-anchor: middle; }

/* Burbujas */
#bubbles { position: absolute; inset: 0; pointer-events: none; }
.bubble { position: absolute; max-width: 340px; background: #fff; border-radius: 12px; padding: 10px 30px 10px 12px; box-shadow: 0 8px 26px rgba(0,36,69,.22); pointer-events: auto; border: 2px solid var(--coral); animation: pop .25s ease-out; }
.bubble.ok { border-color: var(--teal); }
.bubble::after { content: ""; position: absolute; left: var(--tail, 50%); bottom: -9px; width: 14px; height: 14px; background: #fff; border-right: 2px solid var(--coral); border-bottom: 2px solid var(--coral); transform: translateX(-50%) rotate(45deg); }
.bubble.ok::after { border-color: var(--teal); }
.bubble.below::after { bottom: auto; top: -9px; transform: translateX(-50%) rotate(225deg); }
.bubble .bt { font-weight: 800; color: var(--deep); display: flex; align-items: center; gap: 7px; font-size: 14px; }
.bubble .bi { width: 18px; height: 18px; flex: none; }
.bubble .bd { margin-top: 4px; font-size: 14px; line-height: 1.4; }
.bubble .bx { position: absolute; right: 6px; top: 4px; border: 0; background: none; font-size: 18px; color: var(--muted); }
@keyframes pop { from { transform: scale(.9); opacity: 0; } to { transform: none; opacity: 1; } }

/* Barra de simulación */
.simbar { position: absolute; left: 8px; right: 8px; bottom: 8px; display: flex; flex-wrap: wrap; gap: 8px 18px; align-items: center; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 6px 12px; box-shadow: 0 2px 8px rgba(0,36,69,.06); }
.simbar .grp { display: flex; align-items: center; gap: 7px; }
.simbar .lab { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.simbar select { font: inherit; font-size: 13.5px; padding: 3px 6px; border-radius: 7px; border: 1px solid #CBD3DB; background: #fff; color: var(--ink); }
.simbar .arr { color: var(--gold); font-weight: 800; }
.seg { display: inline-flex; border: 1px solid #CBD3DB; border-radius: 8px; overflow: hidden; }
.seg button { border: 0; background: #fff; padding: 3px 9px; font-size: 13px; color: var(--navy); }
.seg button.on { background: var(--navy); color: #fff; }
.sw { font-size: 13.5px; display: flex; align-items: center; gap: 5px; color: var(--ink); }
.status { position: absolute; left: 50%; transform: translateX(-50%); top: 8px; border: 1px solid var(--line); max-width: 80%; font-size: 13.5px; color: var(--deep); background: rgba(255,255,255,.92); border-radius: 8px; padding: 2px 10px; text-align: center; }
.status:empty { display: none; }

/* ---------- Terminal ---------- */
.term { background: var(--term-bg); display: flex; flex-direction: column; min-height: 0; border-top: 3px solid var(--deep); }
.thead { display: flex; align-items: center; background: #091019; min-height: 38px; padding: 0 8px; gap: 8px; }
.tabs { display: flex; gap: 4px; overflow-x: auto; flex: 1; padding-top: 5px; }
.tab { display: flex; align-items: center; gap: 6px; border: 0; background: #18232F; color: #AFC0D0; padding: 5px 8px 6px 8px; border-radius: 8px 8px 0 0; font-size: 13.5px; font-weight: 600; white-space: nowrap; }
.tab.on { background: var(--term-bg); color: #fff; box-shadow: inset 0 2px 0 var(--gold); }
.tab .tico { width: 26px; height: 17px; }
.tab .x { margin-left: 2px; color: #708396; padding: 0 3px; border-radius: 4px; }
.tab .x:hover { background: #2B3A4A; color: #fff; }
.tmode { color: #7F93A8; font-size: 12.5px; white-space: nowrap; }
.screens { position: relative; flex: 1; min-height: 0; }
.screen { position: absolute; inset: 0; overflow-y: auto; padding: 10px 14px 14px; font: var(--term-font, 15px)/1.42 var(--mono); color: var(--term-fg); cursor: text; }
.screen .buf { margin: 0; font: inherit; white-space: pre-wrap; word-break: break-word; }
.screen .pr { color: #F0C869; }
.screen .echo { color: #fff; }
.screen .err { color: #FF8A6B; }
.screen .sys { color: #7CC9BE; }
.screen .warn { color: #F0C869; }
.screen .ok { color: #8FE0B0; }
.screen .note { color: #9FB3C8; font-style: italic; }
.inrow { display: flex; white-space: pre; }
.inrow .cmd { flex: 1; background: transparent; border: 0; outline: none; color: #fff; font: inherit; padding: 0; caret-color: var(--gold); min-width: 40px; }
.empty { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: 18px; color: #AFC0D0; padding: 20px; font-size: 15px; line-height: 1.55; }
.empty code { background: #1B2836; color: #F0C869; }
.screen::-webkit-scrollbar, .pane::-webkit-scrollbar { width: 10px; }
.screen::-webkit-scrollbar-thumb { background: #2B3A4A; border-radius: 6px; }
.pane::-webkit-scrollbar-thumb { background: #D5D2C6; border-radius: 6px; }

/* ---------- Panel lateral ---------- */
.stabs { display: flex; padding: 10px 12px 0; gap: 6px; }
.stabs button { flex: 1; border: 1px solid var(--line); background: #fff; border-radius: 9px 9px 0 0; padding: 7px; font-weight: 700; color: var(--muted); border-bottom: 0; }
.stabs button.on { color: var(--navy); box-shadow: inset 0 3px 0 var(--gold); }
.pane { flex: 1; overflow-y: auto; padding: 12px; background: #fff; margin: 0 12px 12px; border: 1px solid var(--line); border-radius: 0 0 10px 10px; }
.prog { display: grid; grid-template-columns: 1fr auto; gap: 4px; font-size: 13px; color: var(--muted); margin-bottom: 10px; }
.prog b { color: var(--navy); }
.pbar { grid-column: 1 / -1; height: 7px; background: #EEECE4; border-radius: 4px; overflow: hidden; }
.pbar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--teal), var(--gold)); transition: width .4s; }
.mis { border: 1px solid var(--line); border-radius: 10px; padding: 10px 11px; margin-bottom: 9px; background: #fff; transition: border-color .2s; }
.mis.cur { border-color: var(--gold); box-shadow: inset 4px 0 0 var(--gold); }
.mis.done { background: #F3FAF8; border-color: #BFE2DB; }
.mis.skip { background: #FBF7EC; }
.mh { display: flex; gap: 10px; }
.mn { flex: none; width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--navy); color: var(--navy); display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 13.5px; }
.mis.done .mn { background: var(--teal); border-color: var(--teal); }
.mis.skip .mn { border-color: var(--gold); color: var(--gold); }
.mn .ck { width: 17px; height: 17px; }
.mt { font-weight: 800; color: var(--deep); font-size: 14.5px; line-height: 1.3; }
.md { font-size: 13.5px; color: #3E4A55; margin-top: 2px; }
.chk { list-style: none; margin: 7px 0 0 36px; padding: 0; font-size: 13px; color: var(--muted); }
.chk li { display: flex; align-items: center; gap: 7px; padding: 1px 0; }
.chk .dot { width: 10px; height: 10px; border-radius: 50%; border: 2px solid #B9C2CB; flex: none; }
.chk li.y { color: #1E6F66; } .chk li.y .dot { background: var(--teal); border-color: var(--teal); }
.mb { margin: 6px 0 0 36px; display: flex; gap: 12px; }
.lnk { border: 0; background: none; padding: 0; color: var(--navy); font-weight: 700; font-size: 13px; text-decoration: underline; text-decoration-color: var(--gold); text-underline-offset: 3px; }
.hint { margin: 8px 0 0 36px; font-size: 13.5px; background: #FBF6E8; border-left: 3px solid var(--gold); padding: 7px 9px; border-radius: 0 6px 6px 0; }
.skipnote { margin: 6px 0 0 36px; font-size: 12.5px; color: #7A6223; }
.sol { margin: 8px 0 0 0; }
.solb { border: 1px solid var(--line); border-radius: 8px; margin-top: 6px; overflow: hidden; }
.solh { display: flex; justify-content: space-between; align-items: center; background: #F2F0E8; padding: 4px 8px; font-size: 13px; color: var(--deep); }
.solh span { display: flex; gap: 5px; }
.mini { border: 1px solid #CBD3DB; background: #fff; color: var(--navy); border-radius: 6px; font-size: 12px; padding: 1px 8px; font-weight: 700; }
.mini:hover { background: var(--navy); color: #fff; }
.solb pre { margin: 0; padding: 7px 9px; font: 13px/1.45 var(--mono); background: var(--term-bg); color: #E6EDF3; white-space: pre-wrap; }
.reto-sep { display: flex; align-items: center; gap: 8px; margin: 14px 0 8px; color: var(--gold); font-weight: 800; font-size: 12px; letter-spacing: .1em; text-transform: uppercase; }
.reto-sep::before, .reto-sep::after { content: ""; flex: 1; height: 1px; background: #E5D6AE; }
.donebox { display: flex; gap: 10px; align-items: center; background: linear-gradient(135deg, #F3FAF8, #FBF6E8); border: 1px solid #DCCFA6; border-radius: 10px; padding: 8px 10px; margin-bottom: 10px; }
.donebox b { display: block; color: var(--deep); }
.donebox span { font-size: 13px; color: var(--muted); }
.simhelp { margin: 0 0 10px; font-size: 13px; color: var(--muted); }
.simempty { font-size: 13.5px; color: var(--muted); border: 1px dashed #CBD3DB; border-radius: 8px; padding: 12px; }
.logent { border: 1px solid var(--line); border-radius: 9px; margin-bottom: 9px; overflow: hidden; }
.logent .lh { background: #F2F0E8; padding: 5px 9px; font-size: 13.5px; }
.logent ol { margin: 0; padding: 6px 9px 8px 28px; font-size: 13px; }
.logent li { margin: 3px 0; }
.logent li i { display: inline-block; width: 11px; height: 8px; border-radius: 2px; margin-right: 6px; background: var(--navy); vertical-align: middle; }
.logent li i.route { background: var(--gold); border-radius: 50%; width: 9px; height: 9px; }
.logent li i.arrive { background: #3BB273; border-radius: 50%; width: 9px; height: 9px; }
.logent li.rep { color: #35596F; }
.logent li.res { list-style: none; margin-left: -18px; font-weight: 700; margin-top: 6px; }
.logent li.ok { color: #1E6F66; } .logent li.bad { color: #B5401F; }

/* ---------- Introducción ---------- */
.intro { position: fixed; inset: 0; background: rgba(0,36,69,.55); display: none; align-items: center; justify-content: center; z-index: 50; padding: 16px; }
.intro.show { display: flex; }
.ibox { position: relative; width: min(640px, 100%); background: #fff; border-radius: 18px; padding: 40px 30px 20px; box-shadow: 0 20px 60px rgba(0,0,0,.3); border-top: 6px solid var(--gold); }
.iskip { position: absolute; right: 16px; top: 9px; border: 0; background: none; color: var(--muted); font-weight: 600; }
.card { display: none; }
.card.on { display: block; animation: pop .3s ease-out; }
.idiag { width: 100%; height: auto; max-height: 190px; background: var(--paper); border-radius: 12px; border: 1px solid var(--line); }
.card h2 { color: var(--navy); margin: 16px 0 6px; font-size: 23px; }
.card p { margin: 6px 0; font-size: 16px; }
.card .cmd { font-family: var(--mono); font-size: 14px; background: var(--term-bg); color: #F0C869; padding: 7px 11px; border-radius: 8px; display: inline-block; }
.mv1, .mv2, .mv3 { animation: slide 3.2s linear infinite; }
.mv2 { animation-delay: -1.06s; } .mv3 { animation-delay: -2.13s; }
@keyframes slide { 0% { transform: translateX(-16px); opacity: 0; } 15% { opacity: 1; } 85% { opacity: 1; } 100% { transform: translateX(16px); opacity: 0; } }
.inav { display: flex; justify-content: space-between; align-items: center; margin-top: 18px; }
.dots { display: flex; gap: 7px; }
.dots i { width: 9px; height: 9px; border-radius: 50%; background: #D5D2C6; cursor: pointer; }
.dots i.on { background: var(--gold); width: 24px; border-radius: 5px; }

/* ---------- Modal ---------- */
.modal { position: fixed; inset: 0; background: rgba(0,36,69,.5); display: none; align-items: center; justify-content: center; z-index: 60; padding: 16px; }
.modal.show { display: flex; }
.mbox { position: relative; background: #fff; border-radius: 16px; padding: 22px 24px; width: min(560px, 100%); max-height: calc(100vh - 32px); overflow-y: auto; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.modal.wide .mbox { width: min(980px, 100%); }
.mclose { position: absolute; right: 12px; top: 8px; border: 0; background: none; font-size: 26px; color: var(--muted); }
.mbox h2 { margin: 0 0 4px; color: var(--navy); }
.mbox h3 { margin: 16px 0 2px; color: var(--deep); font-size: 15.5px; }
.mbox .sub { margin: 0 0 8px; color: var(--muted); font-size: 14px; }
.exp { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.exp pre { max-height: 52vh; overflow: auto; font-size: 12px; }
.mbtns { display: flex; gap: 10px; justify-content: flex-end; margin-top: 16px; }
.donecard { text-align: center; }
.donecard h2 { font-size: 26px; margin-top: 6px; }
.donecard p { font-size: 15.5px; max-width: 440px; margin: 8px auto; }
.donecard .mbtns { justify-content: center; }
.badge { display: block; margin: 0 auto; }
.donebox .badge { margin: 0; flex: none; }

.toast { position: fixed; left: 50%; bottom: 22px; transform: translate(-50%, 30px); background: var(--deep); color: #fff; padding: 9px 16px; border-radius: 10px; font-size: 14px; opacity: 0; transition: .3s; z-index: 70; pointer-events: none; max-width: 90vw; text-align: center; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
#selftest-out:empty { display: none; }
#selftest-out { position: fixed; inset: 70px 20px 20px; z-index: 80; background: #fff; border: 3px solid var(--navy); border-radius: 12px; padding: 16px; overflow: auto; font: 13px/1.45 var(--mono); white-space: pre-wrap; }

/* ---------- Pantallas medianas y pequeñas ---------- */
@media (max-width: 1280px) {
  .side { --side-w: 310px; }
  .titles h1 { font-size: 16px; }
  .actions .btn { padding: 6px 9px; font-size: 12.5px; }
}
@media (max-width: 1100px) {
  .titles p { display: none; }
  #btn-intro { display: none; }
}
@media (max-width: 900px) {
  body { overflow: auto; }
  .top { height: auto; flex-wrap: wrap; padding: 8px 16px; }
  .titles { border: 0; padding: 0; flex-basis: 100%; order: 3; }
  .titles h1 { white-space: normal; }
  .actions { flex-wrap: wrap; order: 4; }
  html, body { overflow-x: hidden; }
  .actions { max-width: 100%; }
  .actions .btn { flex: 1 1 auto; }
  .layout { height: auto; flex-direction: column; }
  .splitter { display: none; }
  body.term-off .term, body.side-off .side { display: flex; }
  .term { flex: none; }
  .side { flex: none; width: auto; }
  .zoombar { top: 40px; transform: none; }
  .simbar { position: static; margin: 0 8px 8px; }
  .simbar .grp { flex-wrap: wrap; }
  .simbar select { max-width: 150px; }
  .stage { display: flex; flex-direction: column; justify-content: flex-end; }
  #topo { position: relative; inset: auto; margin: 32px 8px 6px; height: auto; flex: none; }
  .status { position: static; transform: none; margin: 0 8px 8px; max-width: none; order: 5; }
  .empty { flex-direction: column; text-align: center; }
  .term { height: 420px; }
  .stage { min-height: 380px; }
  .side { border-left: 0; min-height: 500px; }
  .exp { grid-template-columns: 1fr; }
}

/* =========================================================
   Modo nube: ingreso, registro, usuario, sincronización
   ========================================================= */
.gate { position: fixed; inset: 0; z-index: 90; background: radial-gradient(circle at 20% 10%, #0B4F86 0, #002445 60%); display: none; align-items: flex-start; justify-content: center; padding: 28px 16px; overflow-y: auto; }
.gate.show { display: flex; }
.gbox { width: min(640px, 100%); background: #fff; border-radius: 18px; padding: 26px 28px 22px; box-shadow: 0 24px 60px rgba(0,0,0,.35); border-top: 6px solid var(--gold); margin: auto 0; text-align: center; }
.gbox h2 { color: var(--navy); margin: 10px 0 6px; font-size: 22px; }
.glogo { height: 40px; width: auto; }
.gmsg { color: #3E4A55; margin: 6px 0 14px; font-size: 15px; }
.gfoot { color: var(--muted); font-size: 12.5px; margin-top: 14px; }
.gerr { color: #B5401F; font-weight: 600; min-height: 1.2em; margin: 8px 0 0; font-size: 14px; }
.gbig { display: inline-flex; align-items: center; gap: 10px; font-size: 16px; padding: 11px 20px; }
.gico { width: 22px; height: 22px; flex: none; }
.gbtns { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 14px; }
.gspin { width: 34px; height: 34px; border-radius: 50%; border: 4px solid #E6E2D3; border-top-color: var(--gold); margin: 18px auto 6px; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.pform { text-align: left; }
.pform h2, .pform .gmsg { text-align: center; }
.pform label { display: block; font-size: 13px; font-weight: 700; color: var(--deep); margin-top: 10px; }
.pform label i { font-weight: 400; color: var(--muted); }
.pform input:not([type=checkbox]), .pform select { display: block; width: 100%; margin-top: 4px; font: 15px var(--ui); padding: 8px 10px; border: 1px solid #C9D1DA; border-radius: 9px; background: #fff; color: var(--ink); }
.pform input:disabled { background: #F1F1EC; color: var(--muted); }
.pform input:focus, .pform select:focus { outline: 2px solid rgba(198,156,57,.5); border-color: var(--gold); }
.pform .bad { border-color: var(--coral) !important; background: #FFF6F3; }
.pform small { display: block; color: #B5401F; font-size: 12.5px; font-weight: 600; min-height: 0; margin-top: 3px; }
.pform .grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.pform .tel { display: flex; gap: 8px; margin-top: 4px; }
.pform .tel select { width: 150px; flex: none; margin: 0; }
.pform .tel input { margin: 0; }
.pform .consent { display: flex; gap: 10px; align-items: flex-start; font-weight: 600; font-size: 13.5px; background: #FBF6E8; border-radius: 9px; padding: 10px; margin-top: 14px; color: var(--ink); }
.pform .consent input { width: 18px; height: 18px; margin-top: 1px; flex: none; accent-color: var(--navy); }
.gbtns .btn { padding: 9px 16px; font-size: 14.5px; }
@media (max-width: 560px) { .pform .grid2 { grid-template-columns: 1fr; } .gbox { padding: 20px 16px; } .pform .tel select { width: 120px; } }
body.gated { overflow: hidden; }

.userbox { position: relative; display: flex; align-items: center; gap: 8px; }
.sync { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); white-space: nowrap; }
.sync i { width: 9px; height: 9px; border-radius: 50%; background: #3BB273; }
.sync.pending i { background: var(--gold); animation: pls 1.2s infinite; }
.sync.offline i, .sync.error i { background: var(--coral); }
.uchip { display: inline-flex; align-items: center; gap: 6px; border: 1px solid #CBD3DB; background: #fff; color: var(--navy); border-radius: 999px; padding: 4px 12px 4px 6px; font-weight: 700; font-size: 13.5px; max-width: 220px; }
.uchip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.uchip .gico { width: 20px; height: 20px; }
.umenu { position: absolute; right: 0; top: calc(100% + 6px); background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 12px 30px rgba(0,36,69,.18); min-width: 250px; z-index: 40; overflow: hidden; }
.umenu .uhead { padding: 10px 12px; background: #F4F3EE; display: flex; flex-direction: column; gap: 2px; font-size: 12.5px; color: var(--muted); }
.umenu .uhead b { color: var(--deep); font-size: 14px; }
.umenu button { display: block; width: 100%; text-align: left; border: 0; background: #fff; padding: 9px 12px; font-weight: 600; color: var(--navy); }
.umenu button:hover { background: #EEF2F6; }
@media (max-width: 1280px) { .sync .st { display: none; } }

/* Vista del profesor (solo lectura) */
body.readonly .inrow, body.readonly .simbar, body.readonly #btn-reset, body.readonly #btn-sol, body.readonly #btn-intro,
body.readonly [data-run], body.readonly .back { display: none !important; }
body.readonly #topo { height: calc(100% - 12px); }
body.readonly:not(.embed) .layout { height: calc(100vh - 94px); }
.viewbar { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; background: var(--deep); color: #E6EDF3; padding: 6px 16px; font-size: 13.5px; }
.viewbar b { color: #fff; }
.viewbar .vtag { background: var(--gold); color: #1F2933; font-weight: 800; border-radius: 6px; padding: 1px 8px; font-size: 12px; }
.viewbar .vtime { margin-left: auto; color: #B9C7D6; }
body.embed .top { display: none; }
body.embed .layout { height: calc(100vh - 34px); }
.pform [hidden] { display: none !important; }
