/* © 2026 Bakoware · Hermosillo, Sonora, México. Todos los derechos reservados.
   Prohibida su copia, modificación, redistribución u obra derivada sin autorización escrita (LFDA). */
/* Simulador ESTELA — estilos (usa estela-tokens.css) */

html, body { height: 100%; }
body { display: flex; flex-direction: column; overflow: hidden; line-height: 1.45; }
button { font: inherit; color: inherit; }

/* ---------- Barra superior ---------- */
header.top {
  position: relative; flex: none; display: flex; align-items: center; gap: 14px; min-height: 62px; padding: 8px 16px;
  background: var(--header-bg); color: var(--header-text); border-radius: 0 0 var(--r-lg) var(--r-lg); box-shadow: var(--sombra-1);
  overflow: hidden; z-index: 5; flex-wrap: wrap;
}
.traz { position: absolute; left: -20px; right: -20px; top: 32px; height: 3px; pointer-events: none;
  background: linear-gradient(90deg, rgba(255,255,255,0), rgba(255,255,255,.55) 14%, rgba(255,255,255,0) 45%); }
header.top .logo { font-size: 21px; color: inherit; text-decoration: none; position: relative; }
.etq { font: 700 12px var(--font-ui); letter-spacing: .1em; text-transform: uppercase; background: rgba(255,255,255,.18);
  padding: 5px 10px; border-radius: var(--r-pill); position: relative; }
.cifras { display: flex; gap: 18px; margin-left: auto; position: relative; }
.cifras div { display: grid; line-height: 1.1; }
.cifras small { font: 600 11px var(--font-ui); opacity: .82; text-transform: uppercase; letter-spacing: .06em; }
.cifras b { font: 700 17px var(--font-ui); white-space: nowrap; }
.vel { display: flex; gap: 6px; position: relative; }
.icono { min-width: 40px; height: 40px; padding: 0 8px; border-radius: var(--r-pill); border: 0; background: rgba(255,255,255,.18); color: #fff;
  cursor: pointer; font: 700 13px var(--font-ui); transition: transform var(--t-press) var(--ease-out), background-color var(--t-rapido) ease; position: relative; }
.icono:active { transform: scale(.97); }
.icono:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }
.icono[aria-pressed="true"] { background: #fff; color: var(--rojo-texto); }
@media (hover: hover) and (pointer: fine) { .icono:hover { background: rgba(255,255,255,.28); } .icono[aria-pressed="true"]:hover { background: #fff; } }

/* ---------- Área de juego ---------- */
.juego { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) 390px; gap: 14px; padding: 14px; }
.mapa-wrap { position: relative; min-width: 0; min-height: 0; border-radius: var(--r-xl); overflow: hidden; background: var(--surface-2);
  border: 1px solid var(--border); }
#mapa { display: block; width: 100%; height: 100%; touch-action: manipulation; cursor: default; }
.tip { position: absolute; pointer-events: none; background: var(--text); color: var(--bg); font: 600 12.5px var(--font-ui);
  padding: 6px 10px; border-radius: var(--r-sm); white-space: nowrap; z-index: 3; transform: translate(-50%, calc(-100% - 12px)); }
.pausado { position: absolute; left: 50%; top: 14px; transform: translateX(-50%); background: var(--text); color: var(--bg);
  font: 700 12px var(--font-ui); letter-spacing: .12em; text-transform: uppercase; padding: 6px 14px; border-radius: var(--r-pill); }

/* Avisos emergentes */
.toasts { position: absolute; right: 12px; bottom: 12px; display: grid; gap: 8px; width: min(360px, calc(100% - 24px)); z-index: 4; }
.toast { display: flex; gap: 10px; align-items: flex-start; background: var(--surface); color: var(--text); border: 1px solid var(--border);
  border-left: 6px solid var(--gris-500); border-radius: var(--r-md); box-shadow: var(--sombra-2); padding: 10px 12px; font-size: 13.5px;
  cursor: pointer; text-align: left;
  transition: opacity var(--t-panel) var(--ease-out), transform var(--t-panel) var(--ease-out); }
.toast { @starting-style { opacity: 0; transform: translateY(8px) scale(.98); } }
.toast.sale { opacity: 0; transform: translateY(4px); transition-duration: var(--t-salida); }
.toast.ok { border-left-color: var(--ok); } .toast.amarillo { border-left-color: var(--atencion); }
.toast.naranja { border-left-color: var(--excedido); } .toast.critico { border-left-color: var(--critico); }
.toast.info { border-left-color: var(--info); }

/* ---------- Panel ---------- */
.panel { min-height: 0; display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-xl); overflow: hidden; }
.tabs { display: flex; gap: 4px; padding: 8px; border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; flex: none; }
.tabs button { flex: 1 0 auto; min-height: 42px; padding: 0 8px; border: 0; border-radius: var(--r-md); background: transparent; cursor: pointer;
  font: 600 13.5px var(--font-ui); color: var(--text-muted); transition: transform var(--t-press) var(--ease-out); display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.tabs button:active { transform: scale(.97); }
.tabs button[aria-selected="true"] { background: var(--text); color: var(--bg); }
.tabs button:focus-visible { outline: 3px solid var(--info); outline-offset: 1px; }
.cuenta { min-width: 20px; height: 20px; padding: 0 6px; border-radius: var(--r-pill); background: var(--critico); color: #fff; font: 700 11.5px/20px var(--font-ui); }
.panel-cuerpo { flex: 1; overflow-y: auto; padding: 14px; overscroll-behavior: contain; }
.panel-cuerpo h3 { font: 800 15px var(--font-marca); margin: 4px 0 10px; letter-spacing: .01em; }
.panel-cuerpo h3 + p, .ayuda { color: var(--text-muted); font-size: 13.5px; margin: -4px 0 12px; }
.sep { height: 1px; background: var(--border); margin: 18px 0 14px; }

.tarjeta { border: 1px solid var(--border); border-radius: var(--r-lg); padding: 14px; margin-bottom: 10px; background: var(--surface); }
.tarjeta.apagada { opacity: .55; }
.t-cab { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.t-cab b { font-size: 15.5px; }
.t-cab span { color: var(--text-muted); font-size: 13px; white-space: nowrap; }
.t-dato { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 13.5px; color: var(--text-muted); margin: 6px 0 10px; }
.t-dato b { color: var(--text); font-weight: 600; }
.t-acc { display: flex; gap: 8px; flex-wrap: wrap; }
.t-acc .btn { min-height: 42px; padding: 0 14px; font-size: 14px; flex: 1; }
.btn-secundario { background: var(--surface); color: var(--text); border-color: var(--border); }

/* Barra de calidad esperada */
.dist { display: flex; height: 10px; border-radius: var(--r-pill); overflow: hidden; margin: 4px 0 4px; background: var(--gris-150); }
.dist i { display: block; height: 100%; }
.q0 { background: #D9D9DC; } .q1 { background: #9A9AA0; } .q2 { background: #55555B; } .q3 { background: #111; }
:root[data-theme="dark"] .q3 { background: #F2F2F3; } :root[data-theme="dark"] .q2 { background: #B8B8BE; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .q3 { background: #F2F2F3; } :root:not([data-theme="light"]) .q2 { background: #B8B8BE; } }
.dist-ley { display: flex; gap: 10px; font-size: 11.5px; color: var(--text-muted); flex-wrap: wrap; }
.dist-ley .cuad { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 4px; }

/* Listas de personas y avisos */
.fila { width: 100%; display: flex; align-items: center; gap: 10px; min-height: 52px; padding: 8px 10px; border-radius: var(--r-md);
  border: 1px solid transparent; background: transparent; cursor: pointer; text-align: left; transition: transform var(--t-press) var(--ease-out); }
.fila:active { transform: scale(.98); }
.fila:focus-visible { outline: 3px solid var(--info); outline-offset: 1px; }
@media (hover: hover) and (pointer: fine) { .fila:hover { background: var(--surface-2); } }
.av { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; flex: none; font: 800 13px var(--font-marca);
  background: var(--surface-2); border: 1.5px solid var(--text); }
.fila .n { flex: 1; min-width: 0; }
.fila .n b { display: block; font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fila .n span { display: block; font-size: 12.5px; color: var(--text-muted); }
.chips { display: flex; gap: 4px; flex: none; }
.chip { font: 700 11.5px var(--font-ui); padding: 3px 8px; border-radius: var(--r-pill); background: var(--surface-2); color: var(--text-muted); white-space: nowrap; }
.chip.amarillo { background: var(--atencion); color: #111; } .chip.critico { background: var(--critico); color: #fff; }
.chip.naranja { background: var(--excedido); color: #fff; } .chip.ok { background: var(--ok); color: #fff; }
.punto { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.punto.amarillo { background: var(--atencion); } .punto.naranja { background: var(--excedido); } .punto.critico { background: var(--critico); }

table.res { width: 100%; border-collapse: collapse; font-size: 13px; }
table.res th { text-align: left; font: 600 11.5px var(--font-ui); color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; padding: 6px 4px; border-bottom: 1px solid var(--border); }
table.res td { padding: 7px 4px; border-bottom: 1px solid var(--border); }
table.res td.num, table.res th.num { text-align: right; }
.malo { color: var(--critico); font-weight: 700; }
.evs { list-style: none; padding: 0; margin: 0; font-size: 12.5px; }
.evs li { padding: 5px 0; border-bottom: 1px dashed var(--border); display: grid; grid-template-columns: 44px 1fr; gap: 6px; }
.evs time { font-family: var(--font-codigo); color: var(--text-muted); }
.kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 14px; }
.kpis div { background: var(--surface-2); border-radius: var(--r-md); padding: 10px; }
.kpis b { display: block; font: 800 18px var(--font-ui); }
.kpis span { font-size: 11.5px; color: var(--text-muted); }

/* ---------- Diálogos ---------- */
.dlg { border: 0; padding: 0; border-radius: var(--r-xl); background: var(--surface); color: var(--text); width: min(560px, calc(100vw - 32px));
  max-height: calc(100dvh - 32px); box-shadow: var(--sombra-2); }
.dlg[open] { transition: opacity var(--t-panel) var(--ease-out), transform var(--t-panel) var(--ease-out);
  @starting-style { opacity: 0; transform: translateY(8px) scale(.98); } }
.dlg::backdrop { background: rgba(10,10,12,.45); }
.dlg-cab { background: var(--header-bg); color: var(--header-text); padding: 18px 22px; position: relative; overflow: hidden; }
.dlg-cab .logo { font-size: 15px; opacity: .9; }
.dlg-cab h2 { font: 800 24px/1.15 var(--font-marca); margin: 6px 0 0; }
.dlg-cuerpo { padding: 18px 22px 22px; }
.dlg-cuerpo p { margin: 0 0 12px; }
.dlg-acc { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; }
.dlg-acc .btn { flex: 1 1 160px; }
.opcion { display: flex; gap: 10px; align-items: flex-start; border: 1.5px solid var(--border); border-radius: var(--r-md); padding: 12px; margin-bottom: 8px; cursor: pointer; }
.opcion:has(input:checked) { border-color: var(--text); }
.opcion input { margin-top: 3px; accent-color: var(--rojo); }
.opcion span { font-size: 13.5px; color: var(--text-muted); display: block; }
.respuesta { background: var(--surface-2); border-radius: var(--r-md); padding: 12px 14px; font-size: 14.5px; margin: 12px 0 0; }
.respuesta.malo { border-left: 5px solid var(--critico); font-weight: 500; color: var(--text); }
.nota-proto { font-size: 12.5px; color: var(--text-muted); }

/* ---------- Celular ---------- */
@media (max-width: 900px) {
  body { overflow: auto; display: block; }
  .juego { grid-template-columns: minmax(0, 1fr); padding: 10px; gap: 10px; }
  .mapa-wrap { aspect-ratio: 40 / 25; }
  .panel { max-height: none; }
  .panel-cuerpo { overflow: visible; }
  .ocultable { display: none !important; }
  header.top { position: sticky; top: 0; gap: 10px; padding: 8px 12px; }
  .cifras { gap: 12px; order: 3; width: 100%; margin-left: 0; justify-content: space-between; }
  .vel { margin-left: auto; }
  .etq { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .toast, .dlg[open] { transition: opacity var(--t-rapido) ease; }
  .toast, .dlg[open] { @starting-style { transform: none; } }
}

/* v0.3: contratos, detalle y bandeja */
.chip.negro { background: var(--text); color: var(--bg); }
.punto.info { background: var(--info); } .punto.ok { background: var(--ok); }
.band { border-bottom: 1px solid var(--border); padding-bottom: 6px; margin-bottom: 6px; }
.band.leido { opacity: .7; }
.band .t-acc .btn { min-height: 38px; }
.panel-cuerpo h3 .cuenta { vertical-align: 2px; margin-left: 6px; }
.mini { min-height: 34px; padding: 0 10px; border-radius: var(--r-sm); border: 1.5px solid var(--border); background: var(--surface); cursor: pointer;
  font: 600 12.5px var(--font-ui); white-space: nowrap; transition: transform var(--t-press) var(--ease-out); }
.mini:active { transform: scale(.97); }
.mini:disabled { opacity: .45; cursor: not-allowed; }
@media (hover: hover) and (pointer: fine) { .mini:not(:disabled):hover { border-color: var(--text); } }
.kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.kpis span { overflow-wrap: anywhere; }
table.res { table-layout: fixed; }
table.res th:first-child, table.res td:first-child { width: 42%; overflow-wrap: anywhere; }
.evs span { min-width: 0; overflow-wrap: anywhere; }
table.res th { text-transform: none; letter-spacing: 0; font-size: 12px; }
table.res th:first-child, table.res td:first-child { width: 36%; }
table.res th { overflow-wrap: anywhere; white-space: normal; }

/* v0.6: cantidad de canales */
.cantidad { display: flex; align-items: center; gap: 10px; margin: 8px 0 4px; }
.cantidad b { font: 800 20px var(--font-ui); min-width: 22px; text-align: center; }
.cantidad span { color: var(--text-muted); font-size: 13.5px; flex: 1; }
.cantidad .mini { width: 38px; min-height: 38px; font-size: 18px; padding: 0; }

/* v0.5: líneas de pedido */
.lineas { margin: 2px 0 8px; padding-left: 18px; font-size: 13.5px; }
.lineas li { margin: 2px 0; }
.ok-t { color: var(--ok); font-weight: 600; }
