/* KONEXA LIVE TV · Corresponsal — superficie de operación en campo (móvil primero) */
:root {
  --g-bg: #1b1e24;
  --g-surface: #242830;
  --g-surface-2: #2d323b;
  --g-line: #3a404a;
  --g-text: #eef0f3;
  --g-muted: #aab2bf;
  --g-brand: #6b35ee;
  --g-brand-ink: #d9ccff;
  --g-air: #d4232c;
  --g-air-ink: #ffd9db;
  --g-pre: #e8891b;
  --g-pre-ink: #1b1308;
  --g-ok: #27c457;
  --g-focus: #a9c7f8;
  --g-radius: 10px;
  --g-shadow: 0 10px 30px -12px rgba(0, 0, 0, .7), 0 2px 6px -2px rgba(0, 0, 0, .5);
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body.guest {
  background: var(--g-bg); color: var(--g-text);
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif; font-size: 15px; line-height: 1.45;
  -webkit-font-smoothing: antialiased; font-variant-numeric: tabular-nums;
}
::selection { background: var(--g-brand); color: #fff; }
:focus-visible { outline: 2px solid var(--g-focus); outline-offset: 2px; border-radius: 6px; }
button, select, input { font: inherit; color: inherit; }
.ico { width: 18px; height: 18px; flex: 0 0 18px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ---- barra superior: marca + tally + conexión ---- */
.g-top {
  position: sticky; top: 0; z-index: 10; height: 56px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 0 16px; background: rgba(27, 30, 36, .92); backdrop-filter: blur(10px); border-bottom: 1px solid var(--g-line);
}
.g-brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.g-brand img { height: 30px; width: auto; display: block; }
.g-brand .wm { font-weight: 700; letter-spacing: .3px; white-space: nowrap; }
.g-brand .role { color: var(--g-muted); font-size: 13px; white-space: nowrap; }
.g-brand .wm { overflow: hidden; text-overflow: ellipsis; }
.tally {
  display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 999px; white-space: nowrap; flex: 0 0 auto; line-height: 1.2;
  font-weight: 800; font-size: 13px; letter-spacing: 1.2px; text-transform: uppercase;
  background: var(--g-surface-2); color: var(--g-muted); border: 1px solid var(--g-line);
  transition: background .2s ease-out, color .2s ease-out, border-color .2s ease-out;
}
.tally .dot { width: 9px; height: 9px; border-radius: 50%; background: currentColor; opacity: .5; }
.tally.preview { background: var(--g-pre); color: var(--g-pre-ink); border-color: transparent; }
.tally.preview .dot { opacity: 1; }
.tally.program { background: var(--g-air); color: #fff; border-color: transparent; }
.tally.program .dot { opacity: 1; animation: g-pulse 1.1s ease-in-out infinite; }
@keyframes g-pulse { 50% { opacity: .35; } }

/* ---- disposición ---- */
.g-wrap { width: 100%; max-width: 1180px; margin: 0 auto; padding: 16px 16px 48px; display: grid; gap: 16px; grid-template-columns: 1fr; }
@media (min-width: 900px) { .g-wrap { grid-template-columns: minmax(0, 1.6fr) minmax(320px, 1fr); align-items: start; padding-top: 24px; } .g-side { position: sticky; top: 72px; } }

/* ---- escenario: retorno grande + cámara propia en PiP ---- */
.stage {
  position: relative; aspect-ratio: 16/9; background: #000; border-radius: var(--g-radius); overflow: hidden;
  box-shadow: var(--g-shadow); outline: 3px solid transparent; outline-offset: -3px; transition: outline-color .2s ease-out;
}
.stage.preview { outline-color: var(--g-pre); }
.stage.program { outline-color: var(--g-air); }
.stage video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; background: #000; transition: inset .25s cubic-bezier(.2, .8, .2, 1), width .25s, height .25s, border-radius .25s; }
.stage video.mirror { transform: scaleX(-1); }
.stage video.is-pip { inset: auto 12px 12px auto; width: 32%; height: auto; aspect-ratio: 16/9; border-radius: 8px; box-shadow: 0 6px 16px -6px rgba(0,0,0,.8); border: 1px solid rgba(255,255,255,.18); cursor: pointer; z-index: 2; }
.stage video.is-hidden { display: none; }
.stage-label {
  position: absolute; top: 12px; left: 12px; z-index: 3; display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 10px; border-radius: 6px; background: rgba(0, 0, 0, .55); color: #fff; font-size: 12px; font-weight: 600; letter-spacing: .4px;
}
.stage-label .ico { width: 15px; height: 15px; flex-basis: 15px; }
.stage-empty {
  position: absolute; inset: 0; z-index: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  color: var(--g-muted); text-align: center; padding: 24px; background: linear-gradient(180deg, #15181d, #0d0f12);
}
.stage-empty .ico { width: 36px; height: 36px; flex-basis: 36px; opacity: .6; }
.stage-empty b { color: var(--g-text); font-weight: 600; }
.stage-empty small { font-size: 13px; }
.stage-tools { position: absolute; right: 12px; top: 12px; z-index: 3; display: flex; gap: 6px; }
.stage-tools button, .tap {
  height: 34px; padding: 0 10px; border-radius: 6px; border: 1px solid rgba(255,255,255,.18); background: rgba(0,0,0,.55); color: #fff;
  display: inline-flex; align-items: center; gap: 6px; font-size: 13px; cursor: pointer;
}
.stage-tools button:hover { background: rgba(0,0,0,.75); }
.stage-tools button[aria-pressed="true"] { background: var(--g-brand); border-color: transparent; }
.tap { position: absolute; inset: 0; z-index: 4; height: auto; border: 0; border-radius: 0; background: rgba(0,0,0,.72); justify-content: center; font-size: 16px; font-weight: 600; }
.hidden { display: none !important; }

/* ---- acción principal ---- */
.g-action { display: grid; gap: 8px; margin-top: 14px; }
.btn-main {
  height: 56px; border: 0; border-radius: var(--g-radius); background: var(--g-brand); color: #fff;
  font-size: 17px; font-weight: 700; letter-spacing: .4px; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 10px;
  box-shadow: 0 8px 20px -10px rgba(0, 0, 0, .7); transition: transform .12s ease-out, background .2s;
}
.btn-main:hover { background: #7a48f5; }
.btn-main:active { transform: translateY(1px); }
.btn-main.stop { background: var(--g-surface-2); border: 1px solid var(--g-line); box-shadow: none; color: var(--g-text); }
.btn-main.stop:hover { background: #3a2a2c; border-color: var(--g-air); }
.btn-main:disabled { opacity: .55; cursor: progress; }
.g-status { display: flex; align-items: center; gap: 8px; min-height: 20px; font-size: 13px; color: var(--g-muted); }
.g-status .conn { width: 8px; height: 8px; border-radius: 50%; background: #6a7280; flex: 0 0 8px; }
.g-status.ok .conn { background: var(--g-ok); }
.g-status.err { color: #ffb3b3; } .g-status.err .conn { background: var(--g-air); }

/* ---- paneles laterales ---- */
.panel { background: var(--g-surface); border: 1px solid var(--g-line); border-radius: var(--g-radius); overflow: hidden; }
.panel + .panel { margin-top: 12px; }
.panel-h { display: flex; align-items: center; gap: 10px; padding: 12px 14px; font-weight: 600; }
.panel-h .spacer { flex: 1; }
.panel-h .badge { min-width: 22px; height: 22px; padding: 0 7px; border-radius: 999px; background: var(--g-air); color: #fff; font-size: 12px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }
.panel-h .badge:empty { display: none; }
.panel-b { padding: 0 14px 14px; }
details.panel > summary { list-style: none; cursor: pointer; }
details.panel > summary::-webkit-details-marker { display: none; }
details.panel > summary .chev { transition: transform .2s ease-out; }
details.panel[open] > summary .chev { transform: rotate(180deg); }

/* chat */
.chat-log {
  height: 220px; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; padding: 10px 12px;
  background: var(--g-bg); border: 1px solid var(--g-line); border-radius: 8px; scrollbar-width: thin; scrollbar-color: var(--g-line) transparent;
}
.chat-log::-webkit-scrollbar { width: 8px; } .chat-log::-webkit-scrollbar-thumb { background: var(--g-line); border-radius: 8px; }
.msg { max-width: 88%; padding: 8px 12px; border-radius: 12px 12px 12px 4px; background: var(--g-surface-2); font-size: 14px; }
.msg.me { align-self: flex-end; background: var(--g-brand); color: #fff; border-radius: 12px 12px 4px 12px; }
.msg .who { display: block; font-size: 11px; font-weight: 700; letter-spacing: .3px; opacity: .75; margin-bottom: 2px; }
.chat-empty { margin: auto; color: var(--g-muted); font-size: 13px; text-align: center; }
.chat-row { display: flex; gap: 8px; margin-top: 10px; }
.chat-row input { flex: 1; }
@media (min-width: 900px) { .chat-log { height: 300px; } }

/* formularios */
.field { display: grid; gap: 6px; margin-top: 12px; }
.field > span { font-size: 13px; color: var(--g-muted); font-weight: 600; }
.row { display: flex; gap: 8px; align-items: center; }
.row > select, .row > input { flex: 1; }
select, input[type=text], input[type=password] {
  width: 100%; height: 42px; padding: 0 12px; border-radius: 8px; border: 1px solid var(--g-line); background: var(--g-bg); color: var(--g-text);
}
select { appearance: none; background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23aab2bf' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 36px; }
input::placeholder { color: #8b94a3; }
.btn { height: 42px; padding: 0 14px; border-radius: 8px; border: 1px solid var(--g-line); background: var(--g-surface-2); color: var(--g-text); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px; white-space: nowrap; }
.btn:hover { border-color: #566070; background: #353b45; }
.btn.icon { width: 42px; padding: 0; }
.btn.primary { background: var(--g-brand); border-color: transparent; color: #fff; }
.seg { display: inline-flex; background: var(--g-bg); border: 1px solid var(--g-line); border-radius: 8px; padding: 3px; gap: 2px; }
.seg button { height: 34px; padding: 0 12px; border: 0; border-radius: 6px; background: transparent; color: var(--g-muted); cursor: pointer; font-size: 13px; font-weight: 600; }
.seg button[aria-pressed="true"] { background: var(--g-surface-2); color: var(--g-text); box-shadow: 0 1px 2px rgba(0,0,0,.4); }
.level { height: 6px; border-radius: 4px; background: var(--g-bg); border: 1px solid var(--g-line); overflow: hidden; }
.level span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--g-ok) 0 70%, #f5c518 70% 90%, var(--g-air) 90%); transition: width .08s linear; }
.g-foot { grid-column: 1 / -1; color: var(--g-muted); font-size: 13px; }
.g-foot a { color: var(--g-brand-ink); }
.notice { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: 8px; background: #3a2a2c; color: #ffd9db; font-size: 13px; }

@media (max-width: 480px) {
  .g-top { padding: 0 12px; }
  .g-brand .role { display: none; }
  .g-brand .wm { font-size: 14px; }
  .tally { padding: 7px 12px; font-size: 12px; }
  .stage-label { font-size: 11px; padding: 5px 8px; top: 10px; left: 10px; }
  .stage-tools { right: 10px; top: 10px; }
  .stage-tools button { height: 30px; padding: 0 8px; }
  .stage-tools button span { display: none; }
  .stage video.is-pip { width: 36%; inset: auto 10px 10px auto; }
  .g-wrap { padding: 12px 12px 40px; }
}
