/* Tipografías de la marca, servidas desde el propio servidor (licencia SIL OFL) */
@font-face { font-family: "Syne"; font-style: normal; font-weight: 600; font-display: swap; src: url("/static/fonts/syne-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Syne"; font-style: normal; font-weight: 700; font-display: swap; src: url("/static/fonts/syne-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "DM Sans"; font-style: normal; font-weight: 400; font-display: swap; src: url("/static/fonts/dm-sans-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "DM Sans"; font-style: normal; font-weight: 500; font-display: swap; src: url("/static/fonts/dm-sans-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "DM Sans"; font-style: normal; font-weight: 600; font-display: swap; src: url("/static/fonts/dm-sans-latin-600-normal.woff2") format("woff2"); }

:root {
  /* Identidad Prime Media (landing corporativa) */
  --bg: #0A0A0A;
  --panel: #111111;
  --panel-2: #181818;
  --line: #26262c;
  --text: #FFFFFF;
  --muted: #8A8A9A;
  --amber: #F5A623;
  --coral: #F03C6E;
  --magenta: #D4168A;
  --purple: #7B1FA2;
  --accent: var(--magenta);
  --accent-2: var(--coral);
  --gradient: linear-gradient(135deg, #F5A623 0%, #F03C6E 35%, #D4168A 65%, #7B1FA2 100%);
  --gradient-h: linear-gradient(135deg, #FFB93E 0%, #FF5585 35%, #E8289E 65%, #9C27B0 100%);
  --fill: var(--gradient);      /* relleno de botones; en salas de cliente, su color */
  --on-fill: #ffffff;
  --live: var(--coral);
  --ok: #33c27f;
  --warn: #F5A623;
  --radius: 10px;
  --font: "DM Sans", "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  --font-display: "Syne", "DM Sans", "Segoe UI", system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--font); font-size: 15px; line-height: 1.45; }
a { color: var(--accent-2); }
button, input, select, textarea { font: inherit; color: inherit; }
a.btn { color: inherit; text-decoration: none; }

.brand { display: flex; align-items: center; gap: 10px; }
.brand img { display: block; width: auto; }
.live-tag { font-size: 10px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; padding: 2px 7px; border-radius: 4px; color: var(--on-fill); background: var(--fill); }
h1, h2, h3, .overlay h2 { font-family: var(--font-display); letter-spacing: -.01em; }
.logo-card { display: block; width: 180px; height: auto; margin: 0 auto 6px; }
.logo-card.client { width: auto; max-width: 240px; max-height: 120px; object-fit: contain; }
.brand img.client { max-width: 220px; height: 34px; object-fit: contain; object-position: left center; }
.ov-logo.client { width: auto; max-width: 260px; max-height: 120px; object-fit: contain; }
.login-stack { width: 100%; max-width: 380px; display: flex; flex-direction: column; align-items: center; gap: 18px; }
.branding-pending .card { visibility: hidden; }
.powered { display: inline-flex; align-items: center; gap: 8px; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); text-decoration: none; opacity: .75; transition: opacity .15s; }
.powered:hover { opacity: 1; }
.powered img { height: 18px; width: auto; display: block; }
.player-wrap .powered { display: flex; width: max-content; margin: 28px auto 0; }
.player-wrap .powered.hidden { display: none !important; }
.ov-logo { width: 150px; height: auto; opacity: .95; margin-bottom: 4px; }
.ov-logo.small { width: 48px; opacity: .6; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--line); background: var(--panel-2); padding: 9px 16px; border-radius: 8px; cursor: pointer; transition: background .15s, border-color .15s; white-space: nowrap; }
.btn:hover { border-color: #3a3a42; background: #222226; }
.btn.primary { background: var(--fill); border-color: transparent; color: var(--on-fill); font-weight: 600; }
.btn.primary:hover { filter: brightness(1.12); border-color: transparent; }
.btn.small { padding: 5px 10px; font-size: 13px; }
.btn.danger { color: #ff8a80; }
.btn:disabled { opacity: .5; cursor: default; }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 13px; color: var(--muted); }
.input, select.input { background: #0c0c0d; border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; width: 100%; outline: none; }
.input:focus { border-color: var(--accent); }
.error { color: #ff8a80; font-size: 14px; min-height: 20px; }
.muted { color: var(--muted); }
.hidden { display: none !important; }

/* ---------- Login ---------- */
.center-page { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.card { position: relative; overflow: hidden; width: 100%; max-width: 380px; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 28px; }
.card::before { content: ""; position: absolute; top: 0; left: 0; right: 0; height: 3px; background: var(--fill); }
.card h1 { font-size: 22px; margin: 18px 0 4px; text-align: center; }
.card p.sub { margin: 0 0 22px; color: var(--muted); font-size: 14px; text-align: center; }
.card .btn.primary { width: 100%; padding: 12px; margin-top: 4px; }

/* ---------- Player ---------- */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 20px; border-bottom: 1px solid var(--line); }
.topbar .right { display: flex; align-items: center; gap: 12px; font-size: 13px; color: var(--muted); }
.player-wrap { max-width: 1280px; margin: 0 auto; padding: 20px 16px 40px; }
.event-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.event-head h1 { margin: 0; font-size: 20px; font-weight: 600; }
.badge { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; padding: 4px 10px; border-radius: 999px; background: var(--panel-2); color: var(--muted); border: 1px solid var(--line); }
.badge.live { background: var(--live); color: var(--on-fill); border-color: var(--live); }
.badge.live::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #fff; animation: pulse 1.4s infinite; }
@keyframes pulse { 50% { opacity: .3; } }

.video-box { position: relative; aspect-ratio: 16 / 9; background: #000; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); }
.player-wrap .video-box { width: min(100%, calc((100vh - 190px) * 16 / 9)); min-width: min(100%, 320px); margin: 0 auto; }
.video-box video { width: 100%; height: 100%; display: block; background: #000; }
.overlay { position: absolute; inset: 0; z-index: 4; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; text-align: center; padding: 24px; background: radial-gradient(ellipse at center, rgba(24,18,30,.9), rgba(0,0,0,.97)); }
.overlay h2 { margin: 0; font-size: 20px; font-weight: 600; }
.overlay p { margin: 0; color: var(--muted); max-width: 440px; }
.play-big { width: 76px; height: 76px; border-radius: 50%; border: none; background: var(--fill); cursor: pointer; display: grid; place-items: center; box-shadow: 0 10px 30px rgba(0,0,0,.45); }
.play-big:hover { filter: brightness(1.12); }
.play-big svg { fill: var(--on-fill) !important; }
.play-big svg { width: 30px; height: 30px; fill: #fff; margin-left: 4px; }
.spinner { width: 34px; height: 34px; border: 3px solid rgba(255,255,255,.15); border-top-color: var(--accent); border-radius: 50%; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.controls-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 12px; flex-wrap: wrap; font-size: 13px; color: var(--muted); }
.controls-row select { background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; }

/* ---------- Admin ---------- */
.admin { display: grid; grid-template-columns: 220px 1fr; min-height: 100vh; }
.side { border-right: 1px solid var(--line); padding: 20px 14px; display: flex; flex-direction: column; gap: 24px; background: #0d0d0d; }
.side nav { display: flex; flex-direction: column; gap: 4px; }
.side nav button { text-align: left; background: none; border: none; padding: 10px 12px; border-radius: 8px; cursor: pointer; color: var(--muted); }
.side nav button.active, .side nav button:hover { background: var(--panel-2); color: var(--text); }
.side .bottom { margin-top: auto; }
.main { padding: 28px 32px 60px; max-width: 1200px; width: 100%; }
.main h2 { margin: 0 0 18px; font-size: 22px; }
.main h3 { margin: 26px 0 12px; font-size: 16px; }
.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.stat .k { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.stat .v { font-size: 24px; font-weight: 650; margin-top: 6px; }
.stat .v.small { font-size: 15px; font-weight: 500; word-break: break-all; }
.box { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.state-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 8px; background: var(--muted); }
.state-dot.en_directo { background: var(--ok); box-shadow: 0 0 0 4px rgba(51,194,127,.18); }
.state-dot.conectando { background: var(--warn); }
pre.log { background: #0c0c0d; border: 1px solid var(--line); border-radius: 8px; padding: 10px; font-size: 12px; color: var(--muted); white-space: pre-wrap; word-break: break-all; max-height: 160px; overflow: auto; margin: 12px 0 0; }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-weight: 500; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .06em; padding: 8px 10px; border-bottom: 1px solid var(--line); }
td { padding: 10px; border-bottom: 1px solid #1e1e22; vertical-align: middle; }
tr.click { cursor: pointer; }
tr.click:hover td { background: #161618; }
.pill { display: inline-block; font-size: 12px; padding: 2px 8px; border-radius: 999px; background: var(--panel-2); color: var(--muted); border: 1px solid var(--line); }
.pill.ok { color: var(--ok); border-color: rgba(51,194,127,.4); }
.pill.off { color: #ff8a80; border-color: rgba(255,138,128,.35); }
.mono { font-family: Consolas, "Cascadia Mono", Menlo, monospace; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0 14px; }

.modal-back { position: fixed; inset: 0; background: rgba(0,0,0,.6); display: grid; place-items: center; padding: 16px; z-index: 10; }
.modal { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 22px; width: 100%; max-width: 640px; max-height: 90vh; overflow: auto; }
.modal h3 { margin-top: 0; }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--panel-2); border: 1px solid var(--line); padding: 10px 16px; border-radius: 8px; z-index: 20; }

@media (max-width: 820px) {
  .admin { grid-template-columns: 1fr; }
  .side { border-right: none; border-bottom: 1px solid var(--line); flex-direction: row; align-items: center; gap: 12px; overflow-x: auto; }
  .side nav { flex-direction: row; }
  .side .bottom { margin-top: 0; margin-left: auto; }
  .main { padding: 20px 16px 48px; }
  .table-wrap { overflow-x: auto; }
}

@media (max-width: 600px) {
  .ov-logo { width: 96px; }
  .overlay h2 { font-size: 17px; }
  .topbar { padding: 12px 16px; }
  .topbar .brand img { height: 24px; }
}

/* Editor de sala del cliente */
.brand-grid { display: grid; grid-template-columns: 300px 1fr; gap: 24px; }
textarea.input { resize: vertical; font: inherit; }
.slug-prefix { width: auto; white-space: nowrap; color: var(--muted); border-right: none; border-top-right-radius: 0; border-bottom-right-radius: 0; background: var(--panel-2); }
.logo-drop { height: 120px; border: 1px dashed var(--line); border-radius: 8px; display: grid; place-items: center; background: #0A0A0A; padding: 12px; text-align: center; font-size: 13px; }
.logo-drop img { max-width: 100%; max-height: 96px; object-fit: contain; display: none; }
.logo-drop.has img { display: block; }
.logo-drop.has span { display: none; }
.logo-drop.drag { border-color: var(--accent); }
.hint { font-size: 12px; color: var(--muted); margin: 6px 0 0; }
.color-input { width: 44px; height: 30px; padding: 0; border: 1px solid var(--line); border-radius: 6px; background: none; cursor: pointer; }
@media (max-width: 820px) { .brand-grid { grid-template-columns: 1fr; } }

/* Avisos de la emisión en el panel */
.notice { display: flex; gap: 10px; align-items: flex-start; margin-top: 14px; padding: 12px 14px; border-radius: 8px; font-size: 14px; line-height: 1.45; border: 1px solid var(--line); background: var(--panel-2); }
.notice.warn { border-color: rgba(245,166,35,.35); background: rgba(245,166,35,.07); }
.notice.error { border-color: rgba(240,60,110,.4); background: rgba(240,60,110,.08); }
.notice-icon { flex: none; }
details.tech { margin-top: 10px; }
details.tech summary { cursor: pointer; font-size: 12px; color: var(--muted); }

.state-dot.previo { background: #4aa3ff; box-shadow: 0 0 0 4px rgba(74,163,255,.18); }
.pv-tag { font-family: var(--font); font-size: 12px; font-weight: 500; padding: 3px 10px; border-radius: 999px; background: var(--panel-2); color: var(--muted); border: 1px solid var(--line); }
.pv-tag.on { background: var(--coral); color: #fff; border-color: var(--coral); }

/* ===================================================== Sala del espectador: ampliaciones */
body.has-bg { background: linear-gradient(rgba(10,10,10,.78), rgba(10,10,10,.92)), var(--bg-image) center / cover fixed no-repeat, var(--bg); }
.small-link { display: block; text-align: center; margin-top: 14px; font-size: 13px; color: var(--muted); }
.legal-link { font-size: 12px; color: var(--muted); text-decoration: none; opacity: .8; }
.legal-link:hover { text-decoration: underline; }
.center { text-align: center; }
.small { font-size: 12px; }
.ok-msg { background: rgba(51,194,127,.12); border: 1px solid rgba(51,194,127,.4); color: #9be7c3; padding: 10px 12px; border-radius: 8px; font-size: 14px; margin-bottom: 12px; }
.error.ok { color: #9be7c3; }
.badge.replay { background: var(--panel-2); color: var(--text); border-color: var(--line); }

.stage { display: block; }
.stage.with-side { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; align-items: start; }
.stage.with-side .video-box { width: 100%; }
.side-panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; gap: 18px; max-height: calc(100vh - 140px); overflow: auto; }
.side-panel h3 { margin: 0 0 10px; font-size: 15px; }
.side-panel h4 { margin: 16px 0 8px; font-size: 13px; color: var(--muted); font-weight: 500; }
.qa form { display: flex; flex-direction: column; gap: 8px; }
.qa textarea { resize: vertical; min-height: 70px; }
.q-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; font-size: 14px; }
.q-list li { background: var(--panel-2); border-radius: 8px; padding: 8px 10px; }
.pill.q-approved, .pill.q-answered { color: var(--ok); border-color: rgba(51,194,127,.4); }
.pill.q-hidden { opacity: .6; }
.poll-card { background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; padding: 14px; margin-bottom: 12px; }
.poll-card h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 0 0 6px; }
.poll-q { font-weight: 600; margin: 0 0 10px; }
.poll-opt { display: block; width: 100%; text-align: left; margin-bottom: 6px; white-space: normal; }
.poll-res { position: relative; display: flex; justify-content: space-between; gap: 10px; padding: 7px 10px; margin-bottom: 6px; border-radius: 6px; background: #0f0f11; overflow: hidden; font-size: 14px; }
.poll-res .bar { position: absolute; inset: 0 auto 0 0; background: var(--fill); opacity: .35; }
.poll-res .lbl, .poll-res .pct { position: relative; }
.poll-res.mine { outline: 1px solid var(--accent); }
.agenda { margin-top: 18px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 18px; }
.agenda h3 { margin: 0 0 8px; font-size: 15px; }
.agenda ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 6px; }
.agenda strong { display: inline-block; min-width: 56px; color: var(--accent); }
.countdown { font-family: var(--font-display); font-size: 26px; letter-spacing: .02em; font-variant-numeric: tabular-nums; }
.watermark { position: absolute; z-index: 2; pointer-events: none; color: #fff; opacity: .18; font-size: clamp(12px, 1.6vw, 20px); font-weight: 600; text-shadow: 0 0 4px #000; transition: top 1s, left 1s; white-space: nowrap; }
.fs-btn { position: absolute; right: 10px; top: 10px; z-index: 3; width: 34px; height: 34px; border-radius: 8px; border: none; background: rgba(0,0,0,.45); cursor: pointer; display: grid; place-items: center; opacity: 0; transition: opacity .2s; }
.video-box:hover .fs-btn, .fs-btn:focus { opacity: 1; }
.fs-btn svg { width: 18px; height: 18px; fill: none; stroke: #fff; stroke-width: 2; }
.video-box:fullscreen { border-radius: 0; border: none; width: 100% !important; max-height: none; }
.video-box:-webkit-full-screen { width: 100% !important; }
@media (hover: none) { .fs-btn { opacity: .8; } }
@media (max-width: 980px) {
  .stage.with-side { grid-template-columns: 1fr; }
  .side-panel { max-height: none; }
}

/* Páginas legales */
.legal { max-width: 760px; margin: 0 auto; padding: 40px 20px 60px; line-height: 1.6; }
.legal h1 { font-size: 26px; }

/* Pantalla del ponente */
body.speaker { background: #000; }
.speaker-head { display: flex; align-items: center; gap: 18px; padding: 18px 28px; border-bottom: 1px solid #222; position: sticky; top: 0; background: #000; font-family: var(--font-display); font-size: 20px; }
.speaker-head img { max-width: 200px; object-fit: contain; }
.speaker-list { padding: 24px 28px 60px; display: flex; flex-direction: column; gap: 22px; }
.speaker-list article { border-left: 4px solid var(--accent); padding: 6px 0 6px 20px; }
.speaker-list p { font-size: clamp(22px, 3.2vw, 44px); line-height: 1.3; margin: 0 0 6px; }
.speaker-list span { color: var(--muted); font-size: clamp(14px, 1.6vw, 22px); }
.speaker-empty { text-align: center; color: var(--muted); font-size: 22px; padding: 60px; }

/* Lista de preguntas para moderar (panel y cliente) */
.q-admin { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.q-admin li { border-bottom: 1px solid #1e1e22; padding-bottom: 10px; }
.q-admin p { margin: 6px 0 8px; }
.q-head { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; font-size: 13px; }

/* Informe imprimible */
body.report { background: #e9e9ec; color: #111; }
.report-actions { display: flex; gap: 10px; justify-content: center; padding: 16px; }
.report-page { background: #fff; max-width: 900px; margin: 0 auto 40px; padding: 40px 48px; border-radius: 6px; }
.report-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; }
.report-page h1 { font-size: 24px; margin: 0 0 4px; color: #111; }
.report-page h2 { font-size: 16px; margin: 28px 0 10px; color: #111; }
.report-page .muted { color: #666; }
.report-kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-top: 18px; }
.report-kpis div { border: 1px solid #e3e3e8; border-radius: 8px; padding: 14px; }
.report-kpis span { display: block; font-size: 26px; font-weight: 700; font-family: var(--font-display); }
.report-kpis small { color: #666; }
.report-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.report-table th { color: #666; border-bottom: 1px solid #ddd; }
.report-table td { border-bottom: 1px solid #eee; padding: 6px 8px; }
@media print {
  .no-print { display: none !important; }
  body.report { background: #fff; }
  .report-page { margin: 0; padding: 0; max-width: none; }
}

/* ===================================================== Panel: ampliaciones */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: 6px 0 16px; overflow-x: auto; }
.tabs button { background: none; border: none; border-bottom: 2px solid transparent; padding: 10px 14px; cursor: pointer; color: var(--muted); white-space: nowrap; }
.tabs button.active { color: var(--text); border-bottom-color: var(--accent); }
.meter { height: 4px; background: var(--panel-2); border-radius: 4px; margin-top: 10px; overflow: hidden; }
.meter span { display: block; height: 100%; width: 0; background: var(--ok); transition: width .5s; }
.meter span.hot { background: var(--coral); }
.air-line { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.on-air-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--coral); box-shadow: 0 0 0 4px rgba(240,60,110,.2); animation: pulse 1.4s infinite; }
.chip { display: inline-flex; align-items: center; gap: 6px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 999px; padding: 3px 4px 3px 10px; font-size: 13px; }
.chip-x { border: none; background: none; color: var(--muted); cursor: pointer; font-size: 16px; line-height: 1; padding: 0 6px; }
.chip-x:hover { color: var(--text); }
.state-dot.rec { background: var(--coral); animation: pulse 1.4s infinite; }
.state-dot.rec-idle { background: var(--coral); }
.stop-square { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 8px; background: currentColor; }
.pill.live { background: var(--coral); color: #fff; border-color: var(--coral); }
.check-list { display: flex; flex-direction: column; gap: 10px; max-height: 50vh; overflow: auto; padding: 4px; }
.check-list label { align-items: flex-start; flex-wrap: nowrap; }
.links-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 12px; }
.links-grid .k { font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.links-grid .row { flex-wrap: nowrap; }
.box.settings { margin-bottom: 14px; }
.box.settings h3 { margin-top: 0; }
.box.settings > label.row { margin-bottom: 10px; }
.box.settings h4 { margin: 20px 0 8px; font-size: 14px; }
.notice.warn strong { color: var(--text); }
body.report { min-height: 100vh; }
body.report .btn:not(.primary) { color: var(--text); }
.report-logo-chip { display: inline-block; background: #0A0A0A; padding: 10px 14px; border-radius: 8px; }
