/* Réplica da tela COSMOS (Traintic) — fica escura de propósito, como o equipamento real. */
/* Ocupa a tela inteira (como no app, sem barra de navegação); a saída é pelo botão ✕. */
.cs-root { position: fixed; inset: 0; z-index: 80; background: #0a0a0a; color: #fff;
  display: flex; flex-direction: column; font-family: 'Segoe UI', system-ui, sans-serif; }
.cs-root button { font-family: inherit; }

/* header */
.cs-hdr { flex-shrink: 0; display: flex; align-items: center; gap: 8px; background: #1a1a1a; padding: 6px 8px; border-bottom: 1px solid #333; }
.cs-logo { font-size: 14px; font-weight: 800; color: #4A90E2; margin: 0 8px; white-space: nowrap; }
.cs-icons { flex: 1; display: flex; gap: 4px; overflow-x: auto; align-items: center; scrollbar-width: none; }
.cs-icons::-webkit-scrollbar { display: none; }
.cs-speed { background: #003366; padding: 4px 10px; display: flex; align-items: baseline; gap: 3px; flex-shrink: 0; }
.cs-speed b { font-size: 18px; } .cs-speed small { font-size: 10px; color: #aaa; }
.cs-ic { flex-shrink: 0; border: 1px solid #666; padding: 4px 6px; font-size: 13px; min-width: 28px; text-align: center; }
.cs-ic.red { background: #cc0000; }
.cs-clock { text-align: right; display: flex; flex-direction: column; margin: 0 6px; }
.cs-clock small { font-size: 10px; color: #aaa; } .cs-clock b { font-size: 11px; }

/* tela */
.cs-screen { position: relative; flex: 1; min-height: 0; overflow-y: auto; background: #000; padding-top: 28px; display: flex; flex-direction: column; }
.cs-screen > .cs-pad, .cs-screen > .cs-list, .cs-screen > .cs-laco, .cs-screen > .cs-clim { flex-shrink: 0; }
.cs-screen > .cs-pad.cond { flex: 1; display: flex; flex-direction: column; }
.cs-screen-title { position: absolute; top: 8px; left: 12px; font-size: 13px; font-weight: 700; color: #888; }
.cs-pad { padding: 14px 15px; } .cs-pad.tight { padding: 8px; }

/* sinótico */
.cs-sin { display: flex; justify-content: center; align-items: center; gap: 1px; margin: 10px 0 18px; }
.cs-sin-cab { width: 15px; height: 40px; border-radius: 8px; background: #333; } .cs-sin-cab.head { background: #003366; }
.cs-sin.portas .cs-sin-cab { height: 60px; }
.cs-sin-car { width: 40px; height: 40px; background: #333; border: 1px solid #fff; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; flex-direction: column; justify-content: space-between; }
.cs-sin:not(.portas) .cs-sin-car { justify-content: center; }
.cs-sin.portas .cs-sin-car { height: 60px; padding: 2px 0; }
.cs-sin-car.falha { background: #ff0000; } .cs-sin-car.iso { background: #4488FF; }
.cs-doors { display: flex; gap: 2px; }
.cs-door { display: inline-block; width: 6px; height: 6px; background: #222; border: 1px solid #444; }
.cs-door.aberta { background: #f00; } .cs-door.desbloq { background: #E6D5AC; } .cs-door.condenada { background: #0f0; }
.cs-door.desconhecida { background: #666; } .cs-door.isolada { background: #4488FF; } .cs-door.autorizacao { background: #00BFFF; }
.cs-legend { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; font-size: 8px; margin-bottom: 4px; }
.cs-legend span { display: inline-flex; align-items: center; gap: 3px; } .cs-legend .cs-door { width: 10px; height: 10px; }

/* condução */
.cs-cond { display: grid; grid-template-columns: 1fr 120px; gap: 12px; margin-top: auto; padding-top: 30px; }
.cs-data { display: flex; flex-direction: column; gap: 4px; }
.cs-row { display: grid; grid-template-columns: 110px 1fr; background: #003366; font-size: 12px; }
.cs-row.alt { background: #cc3300; } .cs-row span { padding: 5px 8px; } .cs-row b { background: #000; text-align: center; padding: 5px 8px; }
.cs-inds { display: flex; flex-direction: column; gap: 4px; }
.cs-ind { border: 1px solid #444; padding: 8px; font-size: 12px; font-weight: 700; text-align: center; }
.cs-ind.ok { background: #00AA00; } .cs-ind.falha { background: #cc0000; }

/* incidências */
.cs-errtab { background: #0a0a0a; border: 1px solid #444; border-radius: 4px; margin-top: 12px; }
.cs-errhead, .cs-errrow { display: grid; grid-template-columns: 40px 80px 1fr 50px; gap: 6px; padding: 5px 8px; align-items: center; }
.cs-errhead { background: #222; font-size: 10px; font-weight: 700; color: #888; }
.cs-errrow { background: #111; font-size: 11px; margin-top: 1px; } .cs-errrow small { color: #888; }
.cs-noerr { text-align: center; color: #0f0; padding: 10px; font-size: 12px; }
.cs-tipo { color: #000; font-weight: 800; text-align: center; padding: 2px 0; }
.cs-tipo.cr { background: #f00; } .cs-tipo.an { background: #FF9933; } .cs-tipo.av { background: #FFCC00; }

/* listas de botões */
.cs-list { padding: 10px 15px 20px; display: flex; flex-direction: column; gap: 4px; }
.cs-btn { height: 44px; padding: 0 15px; background: #1a3050; color: #fff; border: 1px solid #4A90E2; font-size: 12px; font-weight: 700; text-align: center; cursor: pointer; }
.cs-btn:hover { background: #24416a; } .cs-btn:active { background: #2d5185; }
.cs-btn.socorro { background: #5a1a1a; } .cs-btn.radio { background: #2a4a1a; }
.cs-sec { font-size: 12px; font-weight: 700; color: #FFD700; background: #1a1a1a; padding: 4px 8px; margin: 12px 0 4px; }

/* BT */
.cs-bt-top { display: grid; grid-template-columns: 1fr 110px; gap: 10px; background: #2a2a2a; border: 1px solid #666; border-radius: 4px; padding: 8px 10px; align-items: center; }
.cs-bt-top p { margin: 0; font-size: 9px; font-weight: 700; color: #ff6666; }
.cs-comut { background: #1a1a1a; border: 1px solid #888; color: #fff; padding: 4px 6px; display: flex; flex-direction: column; align-items: center; cursor: pointer; }
.cs-comut b { font-size: 9px; } .cs-comut span { font-size: 10px; font-weight: 700; } .cs-comut .normal { color: #0f0; } .cs-comut .emerg { color: #f00; }
.cs-hint { text-align: center; font-size: 10px; color: #888; margin: 6px 0; }
.cs-regua-t { font-size: 11px; font-weight: 700; color: #FF9933; background: #1a1a1a; padding: 4px 8px; margin: 8px 0 3px; }
.cs-regua { display: grid; grid-template-columns: repeat(4, 1fr); gap: 3px; }
.cs-disj { background: #1a3050; border: 1px solid #888; padding: 6px 4px; display: flex; flex-direction: column; align-items: center; gap: 1px; color: #fff; cursor: pointer; }
.cs-disj i { font-style: normal; font-size: 14px; font-weight: 700; color: #0f0; } .cs-disj b { font-size: 9px; }
.cs-disj small { font-size: 7px; color: #aac; white-space: pre-line; text-align: center; line-height: 1.15; }
.cs-disj.off { background: #5a0000; border-color: #f00; } .cs-disj.off i { color: #f00; } .cs-disj.off b { color: #ffaaaa; } .cs-disj.off small { color: #ffcccc; }

/* laços */
.cs-laco { display: grid; grid-template-columns: 140px 1fr; gap: 15px; padding: 15px; }
.cs-laco-circ { width: 130px; height: 130px; border-radius: 50%; border: 2px solid #fff; display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: 14px; gap: 1px; }
.cs-laco-circ.ok { background: #00AA00; } .cs-laco-circ.falha { background: #cc0000; } .cs-laco-circ .big { font-size: 16px; margin-top: 5px; }
.cs-laco-list { display: flex; flex-direction: column; gap: 1px; }
.cs-laco-row { display: grid; grid-template-columns: 1fr 60px; gap: 6px; background: #1a1a1a; padding: 6px 10px; font-size: 11px; align-items: center; }
.cs-laco-row em { font-style: normal; font-size: 10px; font-weight: 800; text-align: center; color: #000; padding: 2px 0; }
.cs-laco-row em.ok { background: #00AA00; } .cs-laco-row em.falha { background: #f00; }
.cs-bypass { margin-top: 8px; height: 40px; border-radius: 4px; border: none; background: #cc6600; color: #fff; font-weight: 700; font-size: 12px; cursor: pointer; }
@media (max-width: 480px) { .cs-laco { grid-template-columns: 1fr; justify-items: center; } .cs-laco-list { width: 100%; } .cs-cond { grid-template-columns: 1fr; } }

.cs-clim { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 380px; gap: 8px; }
.cs-clim div { font-size: 60px; } .cs-clim span { font-size: 12px; color: #888; }

/* feedback sobre a tela */
.cs-fb { position: fixed; left: 50%; width: min(520px, calc(100vw - 32px)); top: 50%; transform: translate(-50%, -50%); background: #1a1a1a; border: 2px solid #4A90E2; border-radius: 12px; padding: 16px; z-index: 85; box-shadow: 0 10px 30px rgba(0,0,0,.6); }
.cs-fb.correto { border-color: #00AA00; } .cs-fb.foradeordem { border-color: #FF9933; } .cs-fb.incorreto { border-color: #f00; }
.cs-fb b { font-size: 16px; } .cs-fb p { white-space: pre-line; font-size: 13px; color: #ddd; margin: 8px 0 12px; line-height: 1.45; }
.cs-fb button { width: 100%; height: 38px; border: none; border-radius: 6px; background: #4A90E2; color: #fff; font-weight: 700; cursor: pointer; }

/* abas e status */
.cs-tabs { flex-shrink: 0; display: flex; gap: 2px; overflow-x: auto; padding: 4px; background: #1a1a1a; border-top: 1px solid #333; scrollbar-width: none; }
.cs-tabs::-webkit-scrollbar { display: none; }
.cs-tab { flex: 0 0 80px; height: 50px; background: #333; color: #bbb; border: none; font-size: 10px; font-weight: 700; cursor: pointer; }
.cs-tab.cabine { background: #5a3d1a; color: #FFD700; }
.cs-tab.active { background: #FF9933; color: #000; }
.cs-status { flex-shrink: 0; display: grid; grid-template-columns: 1fr 44px 44px; gap: 10px; background: #0a1929; padding: 8px 12px; align-items: center; }
.cs-status small { display: block; font-size: 9px; font-weight: 700; color: #666; }
.cs-status b { font-size: 12px; color: #ff9933; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cs-round { width: 44px; height: 44px; border-radius: 50%; border: none; color: #fff; font-size: 14px; cursor: pointer; }
.cs-round.help { background: #4A90E2; } .cs-round.exit { background: #cc0000; }

/* diálogos */
.cs-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.65); display: flex; align-items: center; justify-content: center; z-index: 90; padding: 16px; }
.cs-dialog { background: #1a1a1a; color: #fff; border: 1px solid #4A90E2; border-radius: 12px; padding: 20px; width: 100%; max-width: 460px; max-height: 88vh; overflow-y: auto; }
.cs-dialog h3 { margin: 0 0 10px; font-size: 16px; }
.cs-dialog p { white-space: pre-line; font-size: 13.5px; line-height: 1.5; color: #ddd; margin: 0 0 14px; }
.cs-dialog-btns { display: flex; gap: 8px; }
.cs-dialog-btns button, .cs-sheet button { flex: 1; height: 42px; border: none; border-radius: 8px; font-weight: 700; cursor: pointer; }
.cs-dialog-btns .pri { background: #4A90E2; color: #fff; } .cs-dialog-btns .sec, .cs-sheet .sec { background: #333; color: #fff; }
.cs-sheet { display: flex; flex-direction: column; gap: 6px; } .cs-sheet button { flex: none; background: #1a3050; color: #fff; border: 1px solid #4A90E2; }


/* =====================================================================
   IHM-COSMOS — réplica da tela real (medidas tiradas das telas do trem,
   referência 1375 × 1000). 1cqw = 1% da largura da tela.
   ===================================================================== */
.cx-wrap { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; padding: 10px; position: relative; }
.cx-monitor { width: min(100%, calc((100dvh - 96px) * 1.375), 1180px); background: #1b1b1d; border-radius: 14px; padding: 14px;
  box-shadow: inset 0 0 0 2px #2a2a2e, 0 10px 30px rgba(0,0,0,.6); container-type: inline-size; }
.cx-scr { position: relative; aspect-ratio: 1375 / 1000; background: #000; color: #f2f2f2;
  font-family: Arial, Helvetica, sans-serif; border: 2px solid #d8d8d8; display: grid; grid-template-rows: 8.4cqw 1fr 8.7cqw; overflow: hidden; user-select: none; }
.cx-scr button { font-family: inherit; color: inherit; background: none; border: none; padding: 0; cursor: pointer; }

/* cabeçalho */
.cx-hdr { display: grid; grid-template-columns: 9.8cqw 1fr 13cqw 13cqw; grid-template-rows: 3.6cqw 1fr; border-bottom: 2px solid #d8d8d8; }
.cx-speed { grid-row: 1 / 3; background: #0c1f86; display: flex; align-items: center; justify-content: center; font-size: 1.75cqw; border-right: 2px solid #d8d8d8; }
.cx-title, .cx-date, .cx-time { display: flex; align-items: center; font-size: 1.9cqw; border-bottom: 2px solid #d8d8d8; }
.cx-title { padding-left: 0.7cqw; }
.cx-date, .cx-time { justify-content: center; border-left: 2px solid #d8d8d8; }
.cx-icons { grid-column: 2 / 5; display: grid; grid-template-columns: repeat(12, 1fr); }
.cx-ic { border-right: 2px solid #d8d8d8; display: flex; align-items: center; justify-content: center; color: #f2f2f2; }
.cx-ic:last-child { border-right: none; }
.cx-ic svg { width: 72%; height: 78%; }
.cx-ic.red { color: #ff2b2b; background: #3a0000; }

.cx-body { position: relative; min-height: 0; }

/* barra de navegação */
.cx-nav { display: grid; grid-template-columns: repeat(10, 1fr); border-top: 2px solid #d8d8d8; }
.cx-navb { border-right: 2px solid #d8d8d8 !important; display: flex; align-items: flex-start; justify-content: center; text-align: center;
  padding-top: 0.9cqw !important; font-size: 1.7cqw; line-height: 1.3; }
.cx-navb:last-child { border-right: none !important; }
.cx-navb:not(.empty):active { background: #333 !important; }

/* sinótico */
.cx-train { display: flex; align-items: stretch; margin: 0 2.4cqw; }
.cx-nose { width: 5.2cqw; height: 6.6cqw; border: 2px solid #d8d8d8; flex-shrink: 0; }
.cx-nose.left { border-radius: 70% 0 0 0 / 100% 0 0 0; border-right: none; }
.cx-nose.right { border-radius: 0 70% 0 0 / 0 100% 0 0; border-left: none; }
.cx-nose.active { background: #0d4fc0; }
.cx-car { flex: 1; position: relative; border: 2px solid #d8d8d8; margin-left: -2px; display: flex; flex-direction: column; align-items: center; justify-content: center; height: 6.6cqw; }
.cx-car b { font-size: 2.1cqw; }
.cx-pantos { position: absolute; top: -3cqw; left: 0; right: 0; display: flex; justify-content: space-around; color: #f2f2f2; }
.cx-pantos span { width: 2.4cqw; height: 2.2cqw; } .cx-pantos svg { width: 100%; height: 100%; }
.cx-pantos span.up { color: #19b23a; }
.cx-djs { position: absolute; bottom: 0.3cqw; left: 0.4cqw; right: 0.4cqw; display: flex; justify-content: space-between; }
.cx-djs i { width: 3.3cqw; height: 1.1cqw; background: #555; display: block; }
.cx-djs i.on { background: #1a8f2e; }
.cx-bogies { position: absolute; bottom: -2.3cqw; left: 0; right: 0; display: flex; justify-content: space-around; font-size: 1.9cqw; letter-spacing: -0.35cqw; line-height: 1; }
.cx-carfail { position: absolute; bottom: -6cqw; left: 50%; transform: translateX(-50%); background: #e01515; color: #fff; font-style: normal; font-weight: bold;
  font-size: 1.8cqw; padding: 0.2cqw 1.4cqw; white-space: nowrap; }
.cx-carfail.iso { background: #1a5fd6; }

/* CONDUÇÃO */
.cx-cond { position: absolute; inset: 0; }
.cx-cond > .cx-train { position: absolute; top: 8.2cqw; left: 0; right: 0; }
.cx-sep { position: absolute; left: 1cqw; right: 1cqw; top: 32.2cqw; border-top: 0.25cqw solid #e6e6e6; }
.cx-cond-low { position: absolute; left: 5.8cqw; right: 4cqw; top: 34.3cqw; }
.cx-data { display: flex; flex-direction: column; gap: 0.85cqw; width: 27.6cqw; }
.cx-row { display: grid; grid-template-columns: 17cqw 1fr; height: 4.4cqw; border: 2px solid #d8d8d8; font-size: 1.8cqw; }
.cx-row span { background: #0d4fc0; display: flex; align-items: center; padding-left: 1cqw; }
.cx-row b { font-weight: normal; display: flex; align-items: center; justify-content: center; border-left: 2px solid #d8d8d8; }
.cx-row.alt span { background: #c62828; }
.cx-row.km { position: absolute; left: 34.5cqw; top: 10.6cqw; width: 31.4cqw; grid-template-columns: 11.8cqw 1fr; }
.cx-inds { position: absolute; right: 0; top: 0; display: flex; flex-direction: column; gap: 0.85cqw; width: 13.5cqw; }
.cx-ind { height: 4.4cqw; background: #0b5f1e; border: 2px solid #7aa88a; display: flex; align-items: center; justify-content: center; font-size: 1.8cqw; }
.cx-ind.falha { background: #c01717; border-color: #ff8a8a; }

/* INCIDÊNCIAS */
.cx-inc { position: absolute; inset: 0; }
.cx-legend { position: absolute; top: 1.6cqw; left: 12cqw; right: 8cqw; display: grid; grid-template-columns: repeat(3, auto); row-gap: 1cqw; column-gap: 3cqw; font-size: 2cqw; letter-spacing: 0.1cqw; }
.cx-legend span { display: flex; align-items: center; gap: 1.8cqw; }
.cx-legend .cx-door { width: 3.2cqw; height: 1.8cqw; }
.cx-auth { width: 3.8cqw; height: 1.8cqw; position: relative; display: inline-block; }
.cx-auth::before { content: ""; position: absolute; left: 0; top: 0; width: 1.9cqw; height: 1.9cqw; border-radius: 50%; background: #1b4fd6; }
.cx-auth::after { content: ""; position: absolute; left: 1.4cqw; top: 0.6cqw; width: 2.2cqw; height: 0.6cqw; background: #1b4fd6; }
.cx-door { display: inline-block; width: 2cqw; height: 1.4cqw; border: 1.5px solid #e6e6e6; background: #000; }
.cx-door.aberta { background: #d3202a; } .cx-door.desbloq { background: #f0b21c; } .cx-door.condenada { background: #1cbf2a; }
.cx-door.desconhecida { background: #d3202a; animation: cxpisca 1s steps(2) infinite; } .cx-door.isolada { background: #1b4fd6; }
.cx-door.autorizacao { background: #00a0ff; }
@keyframes cxpisca { 50% { background: #000; } }
.cx-train.doors { position: absolute; top: 15.5cqw; left: 0; right: 0; margin: 0 2.4cqw; }
.cx-train.doors .cx-nose, .cx-train.doors .cx-car { height: 7cqw; }
.cx-train.doors .cx-nose { border-radius: 100% 0 0 100% / 50% 0 0 50%; }
.cx-train.doors .cx-nose.right { border-radius: 0 100% 100% 0 / 0 50% 50% 0; }
.cx-train.doors .cx-car { justify-content: space-between; padding: 0.2cqw 0; }
.cx-drow { display: flex; gap: 0.3cqw; }
.cx-alarms { position: absolute; left: 3.6cqw; right: 1.6cqw; top: 28cqw; display: grid; grid-template-columns: 1fr 2.6cqw 5cqw; column-gap: 0.8cqw; }
.cx-alist { border: 2px solid #d8d8d8; }
.cx-arow { display: grid; grid-template-columns: 5.2cqw 49.5cqw 1fr; height: 3.75cqw; border-bottom: 2px solid #d8d8d8; font-size: 1.8cqw; cursor: pointer; }
.cx-arow:last-child { border-bottom: none; }
.cx-arow > span { display: flex; align-items: center; overflow: hidden; white-space: nowrap; }
.cx-atipo { justify-content: center; border-right: 2px solid #d8d8d8; }
.cx-atipo.an { background: #f47b43; } .cx-atipo.av { background: #e2202c; }
.cx-atxt { padding-left: 1.5cqw; border-right: 1.5px dashed #aaa; }
.cx-acar { padding-left: 0.6cqw; font-size: 1.65cqw; letter-spacing: 0.05cqw; }
.cx-arow.sel { background: #6e6e6e; }
.cx-scroll { position: relative; border: 2px solid #d8d8d8; background: #555; margin: 1.2cqw 0; }
.cx-thumb { position: absolute; left: 0; right: 0; top: 0; height: 1.7cqw; background: #888; border: 1px solid #ccc; }
.cx-arrows { display: flex; flex-direction: column; justify-content: space-between; align-items: center; }
.cx-arrows button { width: 4.6cqw; height: 4.9cqw; }
.cx-arrows svg { width: 100%; height: 100%; }
.cx-arrows button:active svg { fill: #9ec2ff; }
.cx-recom { position: absolute; left: 6cqw; right: 12cqw; top: 3cqw; height: 23cqw; background: #f2f2f2; color: #000; border: 0.3cqw solid #0d4fc0; padding: 1.4cqw 2cqw; z-index: 3; }
.cx-recom b { font-size: 2cqw; display: block; margin-bottom: 1cqw; }
.cx-recom p { margin: 0; font-size: 1.8cqw; line-height: 1.4; white-space: pre-line; }

/* COMANDOS */
.cx-cmds { position: absolute; inset: 0.9cqw 1.4cqw 2.4cqw 1.9cqw; display: grid; grid-template-columns: 1fr 2.2cqw 7cqw; column-gap: 1.2cqw; }
.cx-clist { border: 2px solid #d8d8d8; display: grid; grid-template-rows: repeat(8, 1fr); }
.cx-crow { display: grid; grid-template-columns: 14.6cqw 1fr 16.5cqw; border-bottom: 2px solid #9a9a9a; }
.cx-crow:last-child { border-bottom: none; }
.cx-cbtn { margin: 0.4cqw !important; background: #868a92 !important; border: 0.25cqw outset #c9ccd2 !important; }
.cx-cbtn:active { border-style: inset !important; background: #6b6f77 !important; }
.cx-crow.empty .cx-cbtn { background: transparent; border: none; margin: 0; }
.cx-ctxt { display: flex; align-items: center; padding-left: 1.4cqw; font-size: 2.3cqw; border-left: 2px solid #9a9a9a; border-right: 0.3cqw solid #d8d8d8; cursor: pointer; }
.cx-crow.sel .cx-ctxt { background: #0b5bb6; }
.cx-cst { display: block; }
.cx-cst.done { background: #c01717; }

/* LAÇOS */
.cx-laco { position: absolute; inset: 1.6cqw 0.8cqw 1.6cqw 0; display: grid; grid-template-columns: 28cqw 1fr 1.9cqw 6.4cqw; column-gap: 0.6cqw; }
.cx-laco-l { position: relative; border-top: 1.2cqw solid #d8d8d8; }
.cx-circ { position: absolute; left: 7.4cqw; top: 8.7cqw; width: 14.6cqw; height: 14.6cqw; border-radius: 50%; background: #0e6b2e; display: flex; align-items: center; justify-content: center;
  text-align: center; font-size: 2.4cqw; font-weight: bold; line-height: 1.35; }
.cx-circ.falha { background: #c01717; }
.cx-key { position: absolute; left: 1.5cqw; top: 33cqw; width: 5cqw; height: 2.6cqw; }
.cx-key svg { width: 100%; height: 100%; }
.cx-key.small { position: static; width: 4.4cqw; height: 2.2cqw; }
.cx-ltable { border-top: 1.2cqw solid #d8d8d8; display: flex; flex-direction: column; }
.cx-lrow { display: grid; grid-template-columns: 32cqw 8.9cqw 9cqw 1fr; min-height: 4.7cqw; flex: 1; cursor: pointer; }
.cx-ltxt { display: flex; align-items: center; padding-left: 0.6cqw; font-size: 1.7cqw; border: 1.5px solid #d8d8d8; border-top: none; }
.cx-lrow.sel .cx-ltxt { background: #fff; color: #000; }
.cx-lrow.by .cx-ltxt { background: #0d4fc0; color: #fff; }
.cx-lok { display: flex; align-items: center; justify-content: center; background: #0e6b2e; color: #063816; font-size: 1.5cqw; border-bottom: 1.5px solid #0a4d20; }
.cx-lok.falha { background: #d01818; }
.cx-lok.by { background: #0d4fc0; }
.cx-lbyp { display: flex; align-items: center; justify-content: center; border: 1.5px solid #d8d8d8; border-top: none; border-left: none; font-size: 1.4cqw; }
.cx-lbyp.by { background: #0d4fc0; color: #fff; }
.cx-lact { display: flex; align-items: center; justify-content: center; }
.cx-bypass-btn { background: #c9c9c9 !important; color: #222 !important; font-weight: bold; font-size: 1.4cqw; padding: 0.7cqw 0.8cqw !important; border: 0.25cqw outset #eee !important; }
.cx-laco .cx-scroll { margin: 1.2cqw 0 0; }

/* CLIMATIZAÇÃO */
.cx-clim { position: absolute; inset: 0; display: grid; grid-template-columns: 20.4cqw 1fr; }
.cx-clim-l { border-right: 2px solid #d8d8d8; display: grid; grid-template-rows: 1fr auto; }
.cx-clim-sec { display: flex; flex-direction: column; padding: 1cqw 1.8cqw; gap: 0; border-bottom: 2px solid #d8d8d8; }
.cx-clim-sec > span { font-size: 1.75cqw; margin-bottom: 1.2cqw; }
.cx-gbtn { background: #b9bcc2 !important; color: #000 !important; font-weight: bold; font-size: 1.75cqw; height: 5.3cqw; border: 0.3cqw outset #e0e2e6 !important; }
.cx-gbtn.sel { background: #000 !important; color: #fff !important; border: 0.3cqw solid #3d78e0 !important; box-shadow: inset 0 0 0 0.25cqw #000; }
.cx-setp { display: flex; align-items: center; gap: 2cqw; margin-top: 2cqw; }
.cx-box { border: 2px solid #d8d8d8; display: flex; align-items: center; justify-content: center; font-size: 1.85cqw; letter-spacing: 0.15cqw; height: 3.4cqw; padding: 0 0.7cqw; }
.cx-setp .cx-box { width: 9cqw; height: 5.3cqw; }
.cx-updn { display: flex; flex-direction: column; gap: 0.4cqw; }
.cx-updn .cx-gbtn { width: 4.8cqw; height: 4.6cqw; font-size: 2.4cqw; }
.cx-onoff { display: grid; grid-template-columns: 1fr 1fr; gap: 1.4cqw; }
.cx-onoff .cx-gbtn { height: 4.4cqw; }
.cx-clim-r { position: relative; }
.cx-ext { position: absolute; left: 25cqw; top: 3.9cqw; width: 23.4cqw; border: 2px solid #d8d8d8; text-align: center; }
.cx-ext b { display: block; background: #0d4fc0; font-weight: normal; font-size: 1.6cqw; padding: 0.6cqw 0; }
.cx-ext span { display: block; font-size: 1.9cqw; padding: 0.7cqw 0; letter-spacing: 0.2cqw; }
.cx-cabtemps { position: absolute; top: 18.2cqw; left: 0.6cqw; right: 1.6cqw; display: flex; justify-content: space-between; }
.cx-cabtemps .cx-box { width: 7.4cqw; }
.cx-train.clim { position: absolute; top: 22.6cqw; left: 0.6cqw; right: 1.6cqw; margin: 0; }
.cx-train.clim .cx-car, .cx-train.clim .cx-nose { height: 5.9cqw; }
.cx-train.clim .cx-nose { border-bottom: none; }
.cx-cartemps { position: absolute; top: 31.6cqw; left: 3.4cqw; right: 4.4cqw; display: grid; grid-template-columns: repeat(8, 1fr); gap: 0.6cqw; }
.cx-cartemps .cx-box { padding: 0; }

/* MANUTENÇÃO */
.cx-manut { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 0 12cqw; }
.cx-manut b { font-size: 2.6cqw; margin-bottom: 1.4cqw; }
.cx-manut p { font-size: 1.8cqw; margin: 0.4cqw 0; line-height: 1.4; }
.cx-dim { color: #9aa; }

/* ===== fora do monitor: barra do simulador e gavetas ===== */
.cx-sim { flex-shrink: 0; width: 100%; max-width: 1180px; margin: 0 auto; display: grid; grid-template-columns: auto auto 1fr 44px 44px; gap: 8px; align-items: center;
  background: #0a1929; padding: 8px 12px; }
.cx-simbtn { height: 44px; padding: 0 14px; border-radius: 8px; border: none; font-weight: 800; font-size: 12px; cursor: pointer; letter-spacing: .3px; }
.cx-simbtn.cab { background: #5a3d1a; color: #FFD700; }
.cx-simbtn.bt { background: #1a3050; color: #9fc4ff; border: 1px solid #4A90E2; }
.cx-simcen { min-width: 0; }
.cx-simcen small { display: block; font-size: 9px; font-weight: 700; color: #667; }
.cx-simcen b { display: block; font-size: 12px; color: #ff9933; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cx-drawer { position: absolute; left: 0; right: 0; top: 0; bottom: 60px; z-index: 40; background: #0b0b0d; overflow-y: auto; border-bottom: 2px solid #333; }
.cx-drawer > * { max-width: 760px; margin-left: auto; margin-right: auto; }
.cx-drawer-top { position: sticky; top: 0; z-index: 2; display: flex; justify-content: space-between; align-items: center; gap: 10px; background: #1a1a1a; padding: 10px 14px; border-bottom: 1px solid #333; }
.cx-drawer-top b { font-size: 13px; color: #FFD700; }
.cx-drawer-top button { background: #333; color: #fff; border: none; border-radius: 6px; padding: 8px 12px; font-weight: 700; cursor: pointer; font-size: 12px; }

@media (max-width: 560px) {
  .cx-sim { grid-template-columns: 1fr 1fr 44px 44px; }
  .cx-simcen { grid-column: 1 / -1; grid-row: 1; }
  .cx-drawer { bottom: 112px; }
}
@media (orientation: portrait) and (max-width: 700px) {
  .cx-wrap::after { content: "↻ Gire o celular para ver a tela maior"; position: absolute; bottom: 4px; left: 0; right: 0; text-align: center; font-size: 11px; color: #778; }
  .cx-monitor { padding: 6px; border-radius: 8px; }
}
@media (max-height: 520px) {
  .cx-wrap { padding: 4px; }
  .cx-monitor { padding: 4px; border-radius: 6px; width: min(100%, calc((100dvh - 62px) * 1.375)); }
  .cx-sim { padding: 4px 8px; }
  .cx-simbtn, .cx-sim .cs-round { height: 36px; }
  .cx-sim .cs-round { width: 36px; }
  .cx-drawer { bottom: 46px; }
}
