/* PH Suite — panel. Diseño pensado primero para el móvil (mobile-first). */
:root {
  --azul: #14213d; --amarillo: #ffd400; --fondo: #f4f5f7; --tarjeta: #fff; --texto: #1d2433; --suave: #667085;
  --borde: #e2e5ea; --rojo: #d92d20; --verde: #12805c; --naranja: #b54708; --radio: 14px;
  --barra: calc(64px + env(safe-area-inset-bottom));
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--texto);
  background: var(--fondo); padding-bottom: var(--barra); }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .6em; }
h1 { font-size: 1.35rem; } h2 { font-size: 1.15rem; } h3 { font-size: 1rem; }
a { color: var(--azul); }
.oculto { display: none !important; }
.suave { color: var(--suave); font-size: .9rem; }
.error { color: var(--rojo); min-height: 1.2em; }
.ok { color: var(--verde); }

/* barra superior */
.cabecera { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: .6rem;
  padding: calc(.6rem + env(safe-area-inset-top)) 1rem .6rem; background: var(--azul); color: #fff; }
.cabecera h1 { flex: 1; margin: 0; font-size: 1.1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.boton-panico { background: var(--rojo); color: #fff; border: 0; border-radius: 999px; padding: .55rem .9rem;
  font-weight: 700; font-size: .9rem; min-height: 44px; }
.boton-panico.activo { background: var(--amarillo); color: var(--azul); }
.aviso-pausa { background: var(--rojo); color: #fff; padding: .7rem 1rem; font-weight: 600; }

main#vista { padding: 1rem; max-width: 900px; margin: 0 auto; }

/* barra de navegación inferior */
.navegacion { position: fixed; bottom: 0; left: 0; right: 0; z-index: 10; display: flex; background: #fff;
  border-top: 1px solid var(--borde); padding-bottom: env(safe-area-inset-bottom); }
.navegacion a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; min-height: 64px; text-decoration: none; color: var(--suave); font-size: .75rem; position: relative; }
.navegacion a .icono { font-size: 1.35rem; line-height: 1; }
.navegacion a.activa { color: var(--azul); font-weight: 700; }
.insignia { position: absolute; top: 6px; right: calc(50% - 22px); background: var(--rojo); color: #fff;
  border-radius: 999px; font-size: .7rem; padding: 0 6px; min-width: 18px; text-align: center; }

/* tarjetas y listas */
.tarjeta { background: var(--tarjeta); border-radius: var(--radio); padding: 1rem; margin-bottom: 1rem;
  box-shadow: 0 1px 2px rgba(16,24,40,.06); border: 1px solid var(--borde); }
.rejilla { display: grid; grid-template-columns: repeat(2, 1fr); gap: .75rem; }
.dato { background: var(--fondo); border-radius: 10px; padding: .7rem; }
.dato b { display: block; font-size: 1.3rem; }
.lista { list-style: none; margin: 0; padding: 0; }
.lista > li { border-bottom: 1px solid var(--borde); padding: .8rem 0; }
.lista > li:last-child { border-bottom: 0; }
.fila-video { display: flex; gap: .75rem; align-items: center; text-decoration: none; color: inherit; }
.fila-video .info { flex: 1; min-width: 0; }
.fila-video .titulo { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.estado { display: inline-block; border-radius: 999px; padding: .1rem .6rem; font-size: .8rem; font-weight: 600;
  background: #eef0f3; color: var(--texto); white-space: nowrap; }
.estado.Terminado, .estado.Publicado { background: #dcfae6; color: var(--verde); }
.estado.Fallido { background: #fee4e2; color: var(--rojo); }
.estado.Retenido, .estado.Reintentar { background: #fef0c7; color: var(--naranja); }
.estado.Procesando { background: #d1e9ff; color: #175cd3; }
.barra-progreso { height: 8px; background: var(--fondo); border-radius: 99px; overflow: hidden; margin: .3rem 0; }
.barra-progreso > span { display: block; height: 100%; background: var(--verde); width: 0; }
.barra-progreso > span.alto { background: var(--naranja); } .barra-progreso > span.lleno { background: var(--rojo); }

/* botones y formularios */
.boton { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; min-height: 44px;
  padding: .6rem 1rem; border-radius: 10px; border: 1px solid var(--borde); background: #fff; color: var(--texto);
  font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; }
.boton.principal { background: var(--azul); border-color: var(--azul); color: #fff; }
.boton.peligro { background: var(--rojo); border-color: var(--rojo); color: #fff; }
.boton.grande { width: 100%; min-height: 52px; font-size: 1.05rem; }
.boton:disabled { opacity: .5; }
.botones { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .75rem; }
.botones .boton { flex: 1 1 auto; }
label { display: block; font-weight: 600; margin: .8rem 0 .3rem; }
.ayudas .ayuda { display: block; color: var(--suave); font-size: .85rem; }
label .ayuda { display: block; font-weight: 400; color: var(--suave); font-size: .85rem; }
input, select, textarea { width: 100%; font: inherit; font-size: 16px; padding: .65rem .75rem; border: 1px solid var(--borde);
  border-radius: 10px; background: #fff; color: var(--texto); min-height: 44px; }
textarea { min-height: 7rem; resize: vertical; }
input[type=checkbox] { width: 26px; height: 26px; min-height: 0; vertical-align: middle; margin-right: .5rem; }
input[type=color] { padding: .2rem; height: 44px; }
.campo { border-bottom: 1px solid var(--borde); padding-bottom: .6rem; }
.campo.cambiado > label::after { content: " · cambiado"; color: var(--naranja); font-weight: 400; font-size: .8rem; }
.campo .restablecer { font-size: .8rem; margin-top: .3rem; background: none; border: 0; color: var(--azul);
  text-decoration: underline; padding: .3rem 0; min-height: 32px; }
.interruptor { display: flex; align-items: center; gap: .5rem; font-weight: 600; margin: .8rem 0 .3rem; }
details.seccion { background: #fff; border: 1px solid var(--borde); border-radius: var(--radio); margin-bottom: .75rem; }
details.seccion > summary { padding: 1rem; font-weight: 700; cursor: pointer; list-style: none; min-height: 52px; }
details.seccion > summary::after { content: "▸"; float: right; }
details.seccion[open] > summary::after { content: "▾"; }
details.seccion > .contenido { padding: 0 1rem 1rem; }
.fija-abajo { position: sticky; bottom: calc(var(--barra) + .5rem); z-index: 5; }
.mensaje { padding: .75rem 1rem; border-radius: 10px; margin: .75rem 0; background: #eef4ff; }
.mensaje.error { background: #fee4e2; color: var(--rojo); }
.mensaje.ok { background: #dcfae6; color: var(--verde); }

/* vídeo y textos */
video { width: 100%; max-height: 70vh; background: #000; border-radius: var(--radio); }
.texto-copiar { background: var(--fondo); border-radius: 10px; padding: .7rem; white-space: pre-wrap; word-break: break-word;
  margin: .3rem 0; font-size: .95rem; }
.planos { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; }
.plano { position: relative; border-radius: 10px; overflow: hidden; border: 3px solid transparent; background: #000; }
.plano img { width: 100%; display: block; aspect-ratio: 9/16; object-fit: cover; }
.plano.quitado { opacity: .35; border-color: var(--rojo); }
.plano .num { position: absolute; top: 4px; left: 4px; background: rgba(0,0,0,.7); color: #fff; border-radius: 6px;
  padding: 0 6px; font-size: .8rem; }
.plano .controles { display: flex; }
.plano .controles button { flex: 1; min-height: 40px; border: 0; background: rgba(255,255,255,.92); font-size: 1rem; }
.tabla { width: 100%; border-collapse: collapse; font-size: .9rem; table-layout: auto; }
.tabla th, .tabla td { word-break: break-word; }
.tabla td, .tabla th { padding: .5rem .3rem; border-bottom: 1px solid var(--borde); text-align: left; }
.tabla td.num, .tabla th.num { text-align: right; white-space: nowrap; }
.barras { display: flex; align-items: flex-end; gap: 3px; height: 90px; }
.barras span { flex: 1; background: var(--azul); border-radius: 3px 3px 0 0; min-height: 2px; }
.aviso-toast { position: fixed; left: 1rem; right: 1rem; bottom: calc(var(--barra) + 1rem); z-index: 20; background: var(--azul);
  color: #fff; padding: .9rem 1rem; border-radius: 12px; box-shadow: 0 4px 16px rgba(0,0,0,.2); }

/* inicio de sesión */
.pantalla-login { display: flex; min-height: 100vh; align-items: center; justify-content: center; padding: 1rem; }
.caja-login { width: 100%; max-width: 380px; background: #fff; border-radius: var(--radio); padding: 2rem 1.5rem;
  box-shadow: 0 4px 24px rgba(16,24,40,.08); text-align: center; }
.caja-login form { text-align: left; }
.logo-login { width: 72px; height: 72px; border-radius: 16px; }

@media (min-width: 720px) {
  .rejilla { grid-template-columns: repeat(4, 1fr); }
  .planos { grid-template-columns: repeat(6, 1fr); }
}
