﻿:root {
  color-scheme: dark;
  --noche: #161320; --noche-2: #1F1B2C; --noche-3: #2A2539; --linea: #3B3550;
  --papel: #F4EAD9; --papel-2: #BDB3C4; --ambar: #FFB454; --ambar-t: #241703; --rojo: #FF8F7D;
  --sans: "Bricolage Grotesque", system-ui, sans-serif; --mono: "JetBrains Mono", ui-monospace, monospace;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; background: var(--noche); color: var(--papel); font: 400 15px/1.5 var(--sans); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--ambar); outline-offset: 2px; }

.boton { background: var(--ambar); color: var(--ambar-t); border: 0; border-radius: 999px; padding: 9px 20px; font-weight: 600; transition: transform .15s, background .15s; white-space: nowrap; }
.boton:hover { background: #FFC67A; transform: translateY(-1px); }
.boton:disabled { opacity: .55; cursor: default; transform: none; }
.boton.suave { background: var(--noche-3); color: var(--papel); }
.boton.suave:hover { background: var(--linea); }
.enlace { background: none; border: 0; color: var(--papel-2); text-decoration: underline; text-underline-offset: 3px; padding: 4px; }
.enlace:hover { color: var(--papel); }
.error { color: var(--rojo); margin: 0; font-size: 13px; min-height: 1em; }
.ayuda { color: var(--papel-2); font-size: 13px; margin: 0; }
input, select, textarea { background: var(--noche); border: 1px solid var(--linea); border-radius: 12px; padding: 9px 12px; width: 100%; }
textarea { resize: vertical; display: block; }

/* Puerta */
.puerta { min-height: 100%; display: grid; place-items: center; padding: 24px 16px; }
.puerta-caja { width: min(380px, 100%); position: relative; display: grid; gap: 10px; }
.puerta-luz { position: absolute; width: 340px; height: 340px; top: -215px; left: -150px; pointer-events: none; animation: respira 5s ease-in-out infinite; }
.puerta-caja > :not(svg) { position: relative; }
.puerta h1 { font-size: clamp(38px, 9vw, 52px); line-height: 1.02; font-weight: 800; letter-spacing: -.03em; margin: 0; }
.puerta p { margin: 0; }
.puerta label { font: 600 12px var(--mono); color: var(--papel-2); margin-top: 16px; }
@keyframes respira { 50% { opacity: .65; } }

/* Marco */
.app { height: 100dvh; display: flex; flex-direction: column; }
.cabecera { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 20px; border-bottom: 1px solid var(--linea); }
.marca { font-size: 18px; font-weight: 800; letter-spacing: -.02em; }
.marca em { color: var(--ambar); font-style: normal; font-weight: 400; }
.cabecera-datos { display: flex; align-items: center; gap: 16px; font: 400 12px var(--mono); color: var(--papel-2); }
.dato { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.punto { width: 7px; height: 7px; border-radius: 50%; background: var(--papel-2); }
.en-linea .punto { background: #8FD46A; }
.rejilla { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(380px, 1fr); }
.planta { min-height: 0; display: flex; flex-direction: column; border-right: 1px solid var(--linea); }
.plano { flex: 1; min-height: 0; display: grid; place-items: center; padding: 6px 12px 0; }
.plano svg { width: 100%; height: 100%; max-height: 100%; display: block; }
.encargo { padding: 12px 20px 16px; display: grid; gap: 8px; border-top: 1px solid var(--linea); background: var(--noche-2); }
.encargo-para { display: flex; align-items: center; gap: 10px; }
.encargo-para label { font: 600 12px var(--mono); color: var(--papel-2); }
.encargo-para select { width: auto; padding: 4px 10px; border-radius: 999px; }
.encargo-pie { display: flex; align-items: center; justify-content: space-between; gap: 12px; }

/* Plano */
.mesa { cursor: pointer; outline: none; }
.mesa .sombra-sel { opacity: 0; transition: opacity .2s; }
.mesa:hover .sombra-sel, .mesa:focus-visible .sombra-sel, .mesa.elegida .sombra-sel { opacity: 1; }
.mesa .halo { opacity: 0; transition: opacity .6s; pointer-events: none; }
.mesa .pantalla { fill: #2B2740; transition: fill .4s; }
.mesa.trabajando .halo, .mesa.lista .halo { opacity: 1; animation: respira 2.6s ease-in-out infinite; }
.mesa.esperando_equipo .halo { opacity: .45; }
.mesa.esperando_ok .halo { opacity: .8; }
.mesa.trabajando .pantalla, .mesa.lista .pantalla { fill: var(--c); animation: parpadeo 1.1s steps(3) infinite; }
.mesa.trabajando .cuerpo, .mesa.lista .cuerpo { animation: teclea .55s ease-in-out infinite alternate; }
.mesa .aviso { display: none; }
.mesa.esperando_ok .aviso { display: block; animation: salta 1s ease-in-out infinite alternate; }
.rotulos { pointer-events: none; paint-order: stroke; stroke: var(--noche); stroke-width: 3px; stroke-linejoin: round; }
.t-nombre { fill: var(--papel); font: 600 15px var(--sans); }
.t-puesto { fill: var(--papel-2); font: 400 10.5px var(--mono); }
.persona-ausente { opacity: .32; }
.t-persona { fill: var(--papel); font: 600 11px var(--sans); }
@keyframes parpadeo { 50% { opacity: .72; } }
@keyframes teclea { to { transform: translateY(-1.6px); } }
@keyframes salta { to { transform: translateY(-4px); } }

/* Panel */
.panel { position: relative; min-height: 0; display: flex; flex-direction: column; background: var(--noche-2); }
.pestanas { display: flex; gap: 2px; padding: 8px 12px 0; border-bottom: 1px solid var(--linea); overflow-x: auto; }
.pestanas button { background: none; border: 0; border-bottom: 2px solid transparent; padding: 8px 12px; color: var(--papel-2); font-weight: 600; }
.pestanas button[aria-selected="true"] { color: var(--papel); border-color: var(--ambar); }
.pagina { flex: 1; min-height: 0; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 8px; }
#p-manual textarea { flex: 1; min-height: 240px; font: 400 13px/1.6 var(--mono); }

.ficha { width: 100%; text-align: left; background: var(--noche); border: 1px solid var(--linea); border-radius: 14px; padding: 10px 14px; display: grid; gap: 4px; transition: border-color .15s; color: var(--papel); }
button.ficha:hover { border-color: var(--papel-2); }
.ficha.hija { margin-left: 18px; width: calc(100% - 18px); }
.ficha-arriba { display: flex; justify-content: space-between; align-items: center; gap: 8px; font: 400 11.5px var(--mono); color: var(--papel-2); }
.ficha-titulo { overflow-wrap: anywhere; }
.quien { color: var(--c, var(--papel)); font-weight: 600; }
.sello { font: 600 11px var(--mono); padding: 2px 8px; border-radius: 999px; background: var(--noche-3); color: var(--papel-2); white-space: nowrap; }
.sello.trabajando, .sello.lista { color: var(--ambar); }
.sello.esperando_ok { background: var(--ambar); color: var(--ambar-t); }
.sello.fallida { color: var(--rojo); }
.sello.terminada { color: #8FD46A; }
.vacio { margin: auto; max-width: 300px; text-align: center; color: var(--papel-2); padding: 24px 8px; }
.vacio strong { display: block; color: var(--papel); font-size: 19px; margin-bottom: 4px; }
.nota { display: flex; gap: 8px; justify-content: space-between; align-items: flex-start; }

/* Detalle */
.detalle { position: absolute; inset: 0; background: var(--noche-2); display: flex; flex-direction: column; z-index: 2; }
.detalle-cab { display: flex; gap: 10px; align-items: center; justify-content: space-between; padding: 10px 14px; border-bottom: 1px solid var(--linea); }
.detalle-hilo { flex: 1; min-height: 0; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 12px; }
.detalle-pie { padding: 10px 14px 14px; border-top: 1px solid var(--linea); display: grid; gap: 8px; }
.detalle-pie .botones { display: flex; justify-content: flex-end; gap: 8px; }
.detalle-pie .pregunta { background: var(--ambar); color: var(--ambar-t); padding: 10px 14px; border-radius: 12px; font-weight: 600; overflow-wrap: anywhere; }
.ev { overflow-wrap: anywhere; }
.ev-autor { font: 600 11.5px var(--mono); color: var(--papel-2); margin-bottom: 2px; }
.ev.usuario .ev-cuerpo { background: var(--noche-3); padding: 8px 12px; border-radius: 12px; white-space: pre-wrap; }
.ev.aviso, .ev.herramienta { font: 400 12px var(--mono); color: var(--papel-2); border-left: 2px solid var(--linea); padding-left: 10px; }
.pensando { font-size: 13px; color: var(--papel-2); font-style: italic; border-left: 2px solid var(--ambar); padding-left: 10px; max-height: 110px; overflow: hidden; white-space: pre-wrap; }
.en-vivo { white-space: pre-wrap; overflow-wrap: anywhere; }

.md > :first-child { margin-top: 0; } .md > :last-child { margin-bottom: 0; }
.md h1, .md h2, .md h3 { font-size: 16px; line-height: 1.3; margin: 14px 0 4px; }
.md p, .md ul, .md ol { margin: 6px 0; } .md ul, .md ol { padding-left: 20px; }
.md a { color: var(--ambar); }
.md code { font: 400 12.5px var(--mono); background: var(--noche-3); padding: 1px 5px; border-radius: 5px; }
.md pre { background: var(--noche); border: 1px solid var(--linea); border-radius: 10px; padding: 10px; overflow-x: auto; }
.md pre code { background: none; padding: 0; }
.acciones { display: flex; gap: 8px; margin-top: 8px; }
details.ficha summary { cursor: pointer; list-style: none; display: grid; gap: 4px; }
details.ficha summary::-webkit-details-marker { display: none; }

@media (max-width: 980px) {
  .app { height: auto; min-height: 100dvh; }
  .rejilla { display: block; }
  .planta { border-right: 0; }
  .plano { padding: 4px 4px 0; }
  .plano svg { height: auto; }
  .t-nombre { font-size: 25px; }
  .t-puesto { display: none; }
  .encargo { padding: 12px 16px 14px; }
  .cabecera { padding: 10px 16px; }
  .cabecera-datos { gap: 10px; }
  #directo span { display: none; }
  .panel { min-height: 60vh; }
  .pagina { overflow: visible; }
  .detalle { position: fixed; z-index: 10; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
