:root {
  --azul: #1f4e79;
  --azul-claro: #2e75b6;
  --azul-vivo: #2563eb;
  --verde: #16a34a;
  --verde-claro: #22c55e;
  --rojo: #dc2626;
  --gris: #64748b;
  --gris-claro: #94a3b8;
  --fondo: #eef2f7;
  --tarjeta: #ffffff;
  --borde: #e2e8f0;
  --texto: #0f172a;
  --sombra: 0 10px 30px rgba(15, 23, 42, 0.08);
  --sombra-sm: 0 1px 3px rgba(15, 23, 42, 0.06);
  --radio: 18px;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background:
    radial-gradient(1200px 600px at 50% -10%, rgba(37, 99, 235, 0.10), transparent 60%),
    var(--fondo);
  color: var(--texto);
  -webkit-font-smoothing: antialiased;
  min-height: 100%;
}

/* ── Header ── */
header {
  background: linear-gradient(135deg, var(--azul) 0%, var(--azul-vivo) 100%);
  color: #fff;
  padding: 18px 22px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 4px 18px rgba(31, 78, 121, 0.25);
}
header::before {
  content: "";
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.18);
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M23 7l-7 5 7 5V7z'/><rect x='1' y='5' width='15' height='14' rx='2' ry='2'/></svg>");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 20px;
  flex-shrink: 0;
}
header h1 { font-size: 18px; margin: 0; font-weight: 700; letter-spacing: -0.2px; }
header .tag {
  margin-left: auto;
  font-size: 12px;
  font-weight: 600;
  opacity: .92;
  background: rgba(255, 255, 255, 0.16);
  padding: 5px 12px;
  border-radius: 999px;
}

/* ── Layout ── */
.wrap {
  max-width: 540px;
  margin: 26px auto;
  padding: 0 16px 40px;
}

.card {
  background: var(--tarjeta);
  border: 1px solid var(--borde);
  border-radius: var(--radio);
  padding: 26px 24px;
  margin-bottom: 18px;
  box-shadow: var(--sombra);
}

h2 {
  font-size: 19px;
  color: var(--texto);
  margin: 0 0 12px;
  font-weight: 700;
  letter-spacing: -0.3px;
}
p.help { color: var(--gris); font-size: 14.5px; line-height: 1.6; margin: 6px 0 18px; }
p.help b { color: var(--texto); }

/* ── Buttons ── */
button {
  font-size: 16px;
  font-weight: 700;
  border: none;
  border-radius: 12px;
  padding: 15px 22px;
  cursor: pointer;
  transition: transform .12s ease, box-shadow .15s ease, filter .15s ease;
  font-family: inherit;
}
button:hover { filter: brightness(1.04); }
button:active { transform: translateY(1px); }
button:disabled { opacity: .55; cursor: not-allowed; transform: none; }

.btn-primary { background: var(--azul-vivo); color: #fff; box-shadow: 0 6px 18px rgba(37, 99, 235, .28); }
.btn-success {
  background: linear-gradient(135deg, var(--verde-claro), var(--verde));
  color: #fff;
  width: 100%;
  font-size: 17px;
  box-shadow: 0 8px 22px rgba(22, 163, 74, .30);
}
.btn-danger { background: var(--rojo); color: #fff; width: 100%; box-shadow: 0 6px 18px rgba(220, 38, 38, .25); }
.btn-ghost { background: #eef3f8; color: var(--azul); }

/* ── Link box (panel del agente) ── */
.link-box { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.link-box input {
  flex: 1; min-width: 220px;
  padding: 13px 14px; font-size: 14px;
  border: 1px solid var(--borde); border-radius: 12px;
  background: #f8fafc; color: var(--texto);
}

.meta { font-size: 13px; color: var(--gris); margin-top: 12px; }
.meta b { color: var(--texto); }

/* ── Video ── */
.video-stage { position: relative; margin-top: 4px; }
video {
  width: 100%;
  background: #0b1120;
  border-radius: 16px;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}
.video-small {
  position: absolute; right: 14px; bottom: 14px;
  width: 120px; aspect-ratio: 3/4; border: 2px solid #fff;
  border-radius: 10px; box-shadow: 0 2px 8px rgba(0,0,0,.3);
}

/* ── Status pill ── */
.status {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 13.5px; font-weight: 700; padding: 8px 15px;
  border-radius: 999px; margin-bottom: 14px;
}
.status .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--gris); }
.status.live { background: #fee2e2; color: var(--rojo); }
.status.live .dot { background: var(--rojo); animation: pulse 1.2s infinite; }
.status.wait { background: #fef3c7; color: #b45309; }
.status.wait .dot { background: #d97706; animation: pulse 1.4s infinite; }
.status.ok { background: #dcfce7; color: var(--verde); }
.status.ok .dot { background: var(--verde); }

@keyframes pulse { 0%,100% { opacity: 1; transform: scale(1); } 50% { opacity: .35; transform: scale(.85); } }

.controls { display: flex; gap: 12px; margin-top: 18px; flex-wrap: wrap; }
.countdown { font-variant-numeric: tabular-nums; font-weight: 800; color: var(--azul-vivo); }

/* ── Estados centrados ── */
.center { text-align: center; }
.big-icon {
  font-size: 30px;
  width: 76px; height: 76px;
  margin: 4px auto 14px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  background: #dcfce7;
}
.hidden { display: none !important; }

/* ── Loader ── */
.loader {
  width: 40px; height: 40px;
  margin: 6px auto 16px;
  border: 4px solid #e2e8f0;
  border-top-color: var(--azul-vivo);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.secure-note {
  margin-top: 16px;
  font-size: 12.5px;
  color: var(--gris);
  text-align: center;
}
.secure-note b { color: var(--texto); }

/* ── Avisos ── */
.notice {
  padding: 16px 18px; border-radius: 14px; font-size: 14.5px; line-height: 1.5;
  background: #fef3c7; color: #92400e; border: 1px solid #fde68a;
}
.notice.error { background: #fee2e2; color: #991b1b; border-color: #fecaca; }

@media (max-width: 600px) {
  .wrap { margin: 16px auto; }
  .card { padding: 22px 18px; border-radius: 16px; }
  header { padding: 16px 18px; }
}
