/* ============================================================
   Producción de TV — mesa de control broadcast
   Paleta: grafito cálido + tira de colores apagados de switcher
   + rojo tally funcional. Tipos: Barlow Condensed (rotulación)
   y Barlow (cuerpo).
   ============================================================ */

:root {
  --fondo: #1b1d21;
  --panel: #232529;
  --panel-2: #2a2d32;
  --panel-3: #303338;
  --linea: #3b3e45;
  --linea-2: #33363c;
  --texto: #eae6dc;
  --texto-2: #a6a399;
  --texto-3: #7c7a72;

  --tally: #d33a3f;
  --lampara: #e5484d;
  --lampara-glow: rgba(229, 72, 77, 0.4);

  --area-produ: #e3b341;
  --area-redac: #56a3a6;
  --area-presa: #c4589c;
  --area-tec: #6c8fd4;
  --area-post: #77a656;
  --area-dist: #d08770;

  --radio-tira: 12px;
  --radio-puesto: 9px;
  --radio-boton: 8px;

  --f-cond: "Barlow Condensed", "Arial Narrow", sans-serif;
  --f-base: "Barlow", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html { color-scheme: dark; }

body {
  margin: 0;
  background: var(--fondo);
  color: var(--texto);
  font-family: var(--f-base);
  font-size: 15px;
  line-height: 1.5;
  min-height: 100vh;
}

h1, h2, h3, h4 { margin: 0; font-weight: 600; }
p { margin: 0; }
ul { margin: 0; padding: 0; list-style: none; }
button { font-family: inherit; }
input, select { font-family: inherit; }

.cond {
  font-family: var(--f-cond);
  font-weight: 600;
  letter-spacing: 0.01em;
}

:focus-visible {
  outline: 2px solid var(--area-produ);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ---------- botones ---------- */

.boton {
  appearance: none;
  border: 1px solid transparent;
  border-radius: var(--radio-boton);
  padding: 9px 18px;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
  background: var(--panel-3);
  color: var(--texto);
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
}
.boton:active:not(:disabled) { transform: scale(0.97); }

.boton--primario { background: var(--tally); color: #fff; }
.boton--primario:hover:not(:disabled) { background: #e0484d; }

.boton--fantasma {
  background: transparent;
  border-color: var(--linea);
  color: var(--texto-2);
}
.boton--fantasma:hover:not(:disabled) { color: var(--texto); border-color: var(--texto-3); }

.boton--peque { padding: 5px 12px; font-size: 13px; }

.boton:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.boton--peligro {
  background: transparent;
  border-color: var(--tally);
  color: #ef8388;
}
.boton--peligro:hover:not(:disabled) {
  background: var(--tally);
  color: #fff;
}

/* ---------- lámparas tally ---------- */

.lampara {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 1px solid var(--linea);
  background: transparent;
  flex: none;
  transition: background 0.25s ease, box-shadow 0.25s ease;
}
.lampara--on {
  background: var(--lampara);
  border-color: var(--lampara);
  box-shadow: 0 0 8px var(--lampara-glow);
  animation: encender 0.35s ease;
}
@keyframes encender {
  0% { transform: scale(0.5); }
  60% { transform: scale(1.35); }
  100% { transform: scale(1); }
}

.tally {
  display: inline-flex;
  gap: 4px;
  align-items: center;
}

/* ---------- iniciales / chips ---------- */

.chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1px solid var(--linea);
  background: var(--panel-2);
  color: var(--texto-2);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.02em;
  flex: none;
}
.chip--mio {
  border-color: var(--tally);
  color: var(--texto);
  background: var(--panel-3);
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: 20px;
  border: 1px solid var(--linea);
  background: var(--panel-2);
  color: var(--texto-2);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.4;
  white-space: nowrap;
}
.badge--mio {
  border-color: var(--tally);
  color: var(--texto);
  background: var(--panel-3);
}

/* ---------- barra maestra ---------- */

.master {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--panel);
  border-bottom: 1px solid var(--linea-2);
  padding: 10px 22px;
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}

.master__marca {
  display: flex;
  align-items: center;
  gap: 12px;
}

.vivo {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--texto-2);
  font-size: 13px;
}
.vivo i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--lampara);
  box-shadow: 0 0 6px var(--lampara-glow);
  animation: latir 2.4s ease-in-out infinite;
}
@keyframes latir {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

.master__titulo {
  font-family: var(--f-cond);
  font-size: 24px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.master__yo {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--texto-2);
  font-size: 14px;
  min-width: 0;
}
.master__yo strong {
  color: var(--texto);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 180px;
}

.insignia {
  font-size: 12px;
  font-weight: 600;
  color: var(--area-produ);
  border: 1px solid var(--area-produ);
  border-radius: 20px;
  padding: 1px 9px;
  flex: none;
}

.credito {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--texto-2);
  font-size: 13px;
}
.credito__puntos { display: inline-flex; gap: 4px; }
.credito__puntos .lampara { width: 12px; height: 12px; }

.master__medidor {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}

.vu { display: flex; gap: 2px; align-items: flex-end; }
.vu span {
  width: 4px;
  height: 16px;
  border-radius: 1px;
  background: #2e3136;
}
.vu span.vu--lit-verde { background: var(--area-redac); }
.vu span.vu--lit-ambar { background: var(--area-produ); }
.vu span.vu--lit-rojo { background: var(--lampara); }

.vu__num {
  font-family: var(--f-cond);
  font-size: 24px;
  font-weight: 700;
  line-height: 1;
  min-width: 58px;
}
.vu__num small {
  font-size: 13px;
  font-weight: 600;
  color: var(--texto-3);
}

.master__nav { display: flex; gap: 8px; align-items: center; }

/* ---------- escena / tiras de área ---------- */

.escena {
  max-width: 1100px;
  margin: 0 auto;
  padding: 26px 22px 80px;
}

.tiras {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.tira {
  background: var(--panel);
  border: 1px solid var(--linea-2);
  border-radius: var(--radio-tira);
  overflow: hidden;
}

.tira__cab {
  width: 100%;
  display: grid;
  grid-template-columns: 14px 1fr auto minmax(90px, 160px) 18px;
  align-items: center;
  gap: 14px;
  padding: 15px 18px;
  background: none;
  border: 0;
  color: inherit;
  text-align: left;
  cursor: pointer;
}
.tira__cab:hover .tira__nombre { color: var(--texto); }

.tira__chip {
  width: 10px;
  height: 22px;
  border-radius: 3px;
  background: var(--area);
  opacity: 0.9;
}

.tira__nombre {
  font-family: var(--f-cond);
  font-size: 21px;
  font-weight: 600;
  color: var(--texto);
  transition: color 0.15s ease;
}

.tira__cuenta {
  font-family: var(--f-cond);
  font-size: 21px;
  font-weight: 700;
  color: var(--texto-2);
  white-space: nowrap;
}
.tira__cuenta small {
  font-size: 14px;
  font-weight: 600;
  color: var(--texto-3);
}
.tira__cuenta--llena { color: var(--texto); }

.tira__barra {
  height: 3px;
  border-radius: 2px;
  background: #2e3136;
  overflow: hidden;
}
.tira__barra i {
  display: block;
  height: 100%;
  background: var(--area);
  transition: width 0.5s ease;
}

.tira__flecha {
  color: var(--texto-3);
  font-size: 12px;
  transition: transform 0.25s ease;
  justify-self: end;
}
.tira--abierta .tira__flecha { transform: rotate(180deg); }

.tira__cuerpo {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.3s ease;
}
.tira--abierta .tira__cuerpo { grid-template-rows: 1fr; }
.tira__lista {
  overflow: hidden;
  min-height: 0;
  border-top: 1px solid var(--linea-2);
}

/* ---------- puestos (filas de rol) ---------- */

.puesto {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(84px, auto) 1fr auto auto;
  align-items: center;
  gap: 16px;
  padding: 13px 18px 13px 24px;
  background: none;
  border: 0;
  border-top: 1px solid var(--linea-2);
  color: inherit;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s ease;
}
.puesto:hover { background: var(--panel-2); }
.puesto--mio {
  box-shadow: inset 3px 0 0 var(--tally);
}

.puesto__nombre {
  font-weight: 600;
  font-size: 16px;
  color: var(--texto);
}

.puesto__chips {
  display: flex;
  gap: 5px;
  justify-self: end;
  align-items: center;
  color: var(--texto-3);
  font-size: 13px;
}

.puesto__cuenta {
  font-family: var(--f-cond);
  font-size: 21px;
  font-weight: 700;
  justify-self: end;
  min-width: 52px;
  text-align: right;
}
.puesto__cuenta small {
  font-size: 14px;
  font-weight: 600;
  color: var(--texto-3);
}
.puesto__cuenta--llena small { color: var(--texto-2); }

/* ---------- ficha de puesto (modal) ---------- */

.velo {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(12, 13, 15, 0.62);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: aparecer 0.2s ease;
}
@keyframes aparecer { from { opacity: 0; } }

.ficha {
  width: 100%;
  max-width: 560px;
  max-height: calc(100vh - 40px);
  overflow: auto;
  background: var(--panel);
  border: 1px solid var(--linea);
  border-radius: 14px;
  padding: 24px 26px;
  animation: desplegar 0.22s ease;
}
@keyframes desplegar {
  from { transform: scale(0.96) translateY(6px); opacity: 0; }
}

.ficha__cab {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 14px;
}
.ficha__titulo {
  font-family: var(--f-cond);
  font-size: 30px;
  font-weight: 700;
  line-height: 1.05;
}

.area-etiq {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--texto-2);
  font-size: 13px;
  margin-top: 4px;
}
.area-etiq i {
  width: 8px;
  height: 8px;
  border-radius: 2px;
  background: var(--area);
}

.cerrar {
  margin-left: auto;
  width: 34px;
  height: 34px;
  flex: none;
  border-radius: 50%;
  border: 1px solid var(--linea);
  background: none;
  color: var(--texto-2);
  font-size: 16px;
  cursor: pointer;
  line-height: 1;
}
.cerrar:hover { color: var(--texto); border-color: var(--texto-3); }

.ficha__desc {
  color: var(--texto-2);
  font-size: 15.5px;
  line-height: 1.65;
  margin-bottom: 20px;
}

.ficha__cupos {
  border-top: 1px solid var(--linea-2);
  padding-top: 16px;
  margin-bottom: 20px;
}

.ficha__cuenta {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}
.ficha__cuenta .cond { font-size: 22px; }
.ficha__cuenta .cond small {
  font-size: 14px;
  color: var(--texto-3);
  font-weight: 600;
}

.ocupantes {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ocupante {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: var(--panel-2);
  border-radius: var(--radio-puesto);
  font-size: 14px;
}
.ocupante__modo { color: var(--texto-3); font-size: 12.5px; margin-left: auto; }
.ocupante--vacio {
  color: var(--texto-3);
  background: none;
  border: 1px dashed var(--linea);
  justify-content: center;
}

.ficha__pie {
  border-top: 1px solid var(--linea-2);
  padding-top: 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.ficha__estado { color: var(--texto-2); font-size: 14px; flex: 1 1 auto; min-width: 200px; }
.ficha__pie .boton { margin-left: auto; }
.ficha__estado--mio { color: var(--texto); }

/* ---------- entrada (bienvenida) ---------- */

.entrada {
  max-width: 980px;
  margin: 0 auto;
  padding: 64px 22px 90px;
}

.entrada__hero { margin-bottom: 40px; }

.entrada__chips {
  display: flex;
  gap: 8px;
  margin-bottom: 26px;
}
.entrada__chips i {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  background: #2e3136;
  animation: encender-area 0.3s ease forwards;
  animation-play-state: paused;
}
.entrada__chips i:nth-child(1) { animation-delay: 0.1s; background-color: var(--area-produ); }
.entrada__chips i:nth-child(2) { animation-delay: 0.25s; background-color: var(--area-redac); }
.entrada__chips i:nth-child(3) { animation-delay: 0.4s; background-color: var(--area-presa); }
.entrada__chips i:nth-child(4) { animation-delay: 0.55s; background-color: var(--area-tec); }
.entrada__chips i:nth-child(5) { animation-delay: 0.7s; background-color: var(--area-post); }
.entrada__chips i:nth-child(6) { animation-delay: 0.85s; background-color: var(--area-dist); }
@keyframes encender-area {
  from { background: #2e3136; }
  to { opacity: 1; }
}

.entrada__titulo {
  font-family: var(--f-cond);
  font-size: clamp(52px, 9vw, 88px);
  font-weight: 700;
  line-height: 0.95;
  letter-spacing: 0.005em;
  text-transform: uppercase;
  max-width: 12ch;
}

.entrada__tag {
  color: var(--texto-2);
  font-size: 16px;
  margin-top: 14px;
}

/* ---------- buscador de entrada ---------- */

.buscador {
  max-width: 480px;
  margin-bottom: 12px;
}
.buscador .campo {
  font-size: 16.5px;
  padding: 13px 16px;
}
.buscador__cuenta {
  color: var(--texto-3);
  font-size: 13px;
  margin: 8px 2px 12px;
}

.lista-desplegable {
  max-width: 480px;
  background: var(--panel);
  border: 1px solid var(--linea-2);
  border-radius: var(--radio-puesto);
  max-height: 420px;
  overflow: auto;
}
.lista-desplegable .usuario {
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--linea-2);
  border-radius: 0;
  background: none;
}
.lista-desplegable li:last-child .usuario { border-bottom: 0; }
.lista-desplegable .usuario:hover,
.lista-desplegable .usuario:focus-visible { background: var(--panel-2); }
.buscador__vacio {
  padding: 18px 16px;
  color: var(--texto-2);
  font-size: 14.5px;
}

.usuario {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 13px 15px;
  background: var(--panel);
  border: 1px solid var(--linea-2);
  border-radius: var(--radio-puesto);
  color: inherit;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.usuario:hover { background: var(--panel-2); border-color: var(--linea); }
.usuario__iniciales {
  width: 38px;
  height: 38px;
  flex: none;
  border-radius: 8px;
  background: var(--panel-3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--f-cond);
  font-size: 17px;
  font-weight: 700;
  color: var(--texto-2);
}
.usuario--admin .usuario__iniciales { color: var(--area-produ); }
.usuario__nombre {
  font-weight: 500;
  font-size: 14.5px;
  line-height: 1.3;
}
.usuario__nota {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--texto-3);
  font-size: 12px;
  margin-top: 2px;
}
.usuario__nota i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--area-produ);
}

/* ---------- formularios ---------- */

.campo {
  display: block;
  width: 100%;
  background: var(--panel-2);
  border: 1px solid var(--linea);
  border-radius: var(--radio-boton);
  color: var(--texto);
  padding: 10px 14px;
  font-size: 15px;
}
.campo::placeholder { color: var(--texto-3); }
.campo:focus { outline: none; border-color: var(--area-produ); }

.modal-forma {
  display: flex;
  gap: 10px;
  margin-top: 18px;
}
.modal-forma .campo { flex: 1; }

/* ---------- administración ---------- */

.admin__cab {
  display: flex;
  align-items: baseline;
  gap: 16px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.admin__titulo {
  font-family: var(--f-cond);
  font-size: 34px;
  font-weight: 700;
}

.tabs { display: flex; gap: 6px; margin-left: auto; }
.tabs button {
  border: 1px solid var(--linea-2);
  background: none;
  color: var(--texto-2);
  border-radius: 20px;
  padding: 6px 16px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.tabs button:hover { color: var(--texto); }
.tabs .tabs--activa {
  background: var(--panel-3);
  border-color: var(--linea);
  color: var(--texto);
}

.panel-admin {
  background: var(--panel);
  border: 1px solid var(--linea-2);
  border-radius: var(--radio-tira);
  padding: 20px 22px;
}
.panel-admin + .panel-admin { margin-top: 14px; }

.panel-admin__titulo {
  font-family: var(--f-cond);
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 14px;
}

.fila-usuario {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 4px;
  border-top: 1px solid var(--linea-2);
  flex-wrap: wrap;
  row-gap: 6px;
}
.fila-usuario:first-of-type { border-top: 0; }
.fila-usuario--apagado .fila-usuario__nombre { color: var(--texto-3); text-decoration: line-through; }
.fila-usuario__nombre { font-weight: 500; flex: 1; min-width: 180px; }
.fila-usuario__acciones { display: flex; gap: 8px; flex: none; }

.fila-usuario__puestos {
  flex-basis: 100%;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding-left: 2px;
  color: var(--texto-2);
  font-size: 13.5px;
}

.puesto-mini {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--panel-2);
  border: 1px solid var(--linea-2);
  border-radius: 6px;
  padding: 3px 6px 3px 10px;
  font-size: 13px;
}

.fila-editar {
  display: flex;
  gap: 8px;
  align-items: center;
  flex: 1;
}
.fila-editar .campo { max-width: 340px; }

.mover-forma {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-basis: 100%;
}
.mover-forma select.campo { max-width: 360px; }

.fila-puesto { padding: 13px 4px; border-top: 1px solid var(--linea-2); }
.fila-puesto:first-of-type { border-top: 0; }
.fila-puesto__cab {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}
.fila-puesto__nombre { font-weight: 600; flex: 1; }
.fila-puesto__cuenta { font-family: var(--f-cond); font-weight: 700; font-size: 18px; color: var(--texto-2); }
.fila-puesto__acciones { display: flex; gap: 8px; align-items: center; }
.fila-puesto__acciones select { max-width: 210px; }

.bitacora { display: flex; flex-direction: column; gap: 6px; }
.bitacora li {
  display: flex;
  gap: 14px;
  align-items: baseline;
  padding: 8px 4px;
  border-top: 1px solid var(--linea-2);
  font-size: 14px;
}
.bitacora li:first-child { border-top: 0; }
.bitacora time {
  color: var(--texto-3);
  font-size: 12.5px;
  flex: none;
  font-variant-numeric: tabular-nums;
}

/* ---------- toasts ---------- */

#toasts {
  position: fixed;
  left: 18px;
  bottom: 18px;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: min(380px, calc(100vw - 36px));
}

.toast {
  background: var(--panel-2);
  border: 1px solid var(--linea);
  border-left: 3px solid var(--area-produ);
  border-radius: var(--radio-puesto);
  padding: 11px 15px;
  font-size: 14px;
  color: var(--texto);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  animation: entrar-toast 0.25s ease;
}
.toast--error { border-left-color: var(--lampara); }
.toast--fuera { opacity: 0; transition: opacity 0.3s ease; }

@keyframes entrar-toast {
  from { transform: translateX(-14px); opacity: 0; }
}

/* ---------- estado vacío ---------- */

.vacio {
  border: 1px dashed var(--linea);
  border-radius: var(--radio-tira);
  padding: 40px 20px;
  text-align: center;
  color: var(--texto-2);
}

/* ---------- responsive ---------- */

@media (max-width: 860px) {
  .master { padding: 10px 16px; gap: 12px; }
  .master__medidor { margin-left: 0; order: 10; width: 100%; }
  .escena { padding: 20px 16px 70px; }
  .tira__cab {
    grid-template-columns: 12px 1fr auto 18px;
    padding: 13px 14px;
    gap: 10px;
  }
  .tira__barra { display: none; }
  .puesto {
    grid-template-columns: minmax(64px, auto) 1fr auto;
    padding: 12px 14px 12px 18px;
    gap: 10px;
  }
  .puesto__chips { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
