:root {
  --bg: #0b0c0e; --panel: #131519; --panel2: #1a1d22; --line: #262a31;
  --text: #e8e9ec; --muted: #8a8f99; --accent: #ff3b30; --ok: #3ddc84;
  --mono: 'IBM Plex Mono', ui-monospace, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font: 14px/1.4 Inter, system-ui, sans-serif; }
[hidden] { display: none !important; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }

.brand { display: flex; align-items: center; gap: 8px; font-family: var(--mono); font-weight: 600; letter-spacing: .08em; text-transform: uppercase; }
.rec { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 10px var(--accent); }

/* Login */
.login { position: fixed; inset: 0; display: grid; place-items: center; padding: 16px; }
.login-card { width: min(360px, 100%); background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 24px; display: grid; gap: 14px; }
.login-card label { display: grid; gap: 6px; color: var(--muted); font-size: 12px; }
.login-card input { background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 10px; }
.login-card button { background: var(--accent); border: 0; border-radius: 6px; padding: 10px; font-weight: 600; color: #fff; }
.err { color: var(--accent); margin: 0; min-height: 1em; font-size: 12px; }

/* Layout */
.app { display: grid; grid-template-columns: 1fr 340px; grid-template-rows: auto 1fr; height: 100vh; }
.top { grid-column: 1 / -1; display: flex; align-items: center; gap: 16px; padding: 10px 16px; border-bottom: 1px solid var(--line); background: var(--panel); }
.pill { font-family: var(--mono); font-size: 11px; padding: 3px 8px; border-radius: 99px; border: 1px solid var(--line); color: var(--muted); }
.pill.live { color: var(--ok); border-color: var(--ok); }
.users { margin-left: auto; display: flex; gap: 6px; flex-wrap: wrap; }
.user { display: flex; align-items: center; gap: 5px; font-size: 12px; padding: 2px 8px 2px 4px; border-radius: 99px; background: var(--panel2); }
.user i { width: 10px; height: 10px; border-radius: 50%; }

.stage-col { display: flex; flex-direction: column; min-width: 0; min-height: 0; padding: 12px; gap: 10px; }
.stage { flex: 1; min-height: 0; background: #000; border-radius: 6px; position: relative; overflow: hidden; display: grid; place-items: center; }
.stage-inner { position: relative; }
.stage video, .stage img { display: block; width: 100%; height: 100%; }
.draw { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; touch-action: none; }
.draw.on { pointer-events: auto; cursor: crosshair; }
.nosignal { position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--mono); color: #444; letter-spacing: .3em; pointer-events: none; }
.stage:fullscreen { border-radius: 0; }

.toolbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.group { display: flex; align-items: center; gap: 6px; }
.toolbar .group:last-child { margin-left: auto; }
.tool { background: var(--panel2); border: 1px solid var(--line); border-radius: 6px; padding: 7px 12px; white-space: nowrap; }
.tool:hover { border-color: #3a3f48; }
.tool.active { background: #fff; color: #000; }
.tool.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.swatch { width: 18px; height: 18px; border-radius: 50%; border: 2px solid #fff3; }
.cap-title { font-family: var(--mono); color: var(--muted); }
.cap-label { background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 7px 10px; width: 220px; }

.history { background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 8px; }
.history-head { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-bottom: 6px; }
.strip { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; }
.thumb { flex: 0 0 auto; width: 150px; background: var(--panel2); border: 2px solid transparent; border-radius: 4px; overflow: hidden; cursor: pointer; padding: 0; text-align: left; }
.thumb.sel { border-color: #fff; }
.thumb .ti { position: relative; aspect-ratio: 16/9; background: #000; }
.thumb img, .thumb canvas { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.thumb .meta { padding: 4px 6px; font-size: 11px; display: flex; gap: 6px; align-items: center; }
.thumb .meta b { font-family: var(--mono); }
.thumb .meta span { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.muted { color: var(--muted); }

/* Lateral */
.side { border-left: 1px solid var(--line); background: var(--panel); display: flex; flex-direction: column; min-height: 0; }
.tabs { display: flex; border-bottom: 1px solid var(--line); }
.tab { flex: 1; background: none; border: 0; padding: 10px; color: var(--muted); border-bottom: 2px solid transparent; }
.tab.active { color: var(--text); border-color: var(--accent); }
.pane { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.messages { flex: 1; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.msg .who { font-weight: 600; font-size: 12px; }
.msg .when { color: var(--muted); font-size: 11px; margin-left: 6px; font-family: var(--mono); }
.msg .txt { white-space: pre-wrap; word-break: break-word; }
.msg.sys { color: var(--muted); font-size: 12px; font-style: italic; cursor: pointer; }
.chat-form, .clips-head { display: flex; gap: 6px; padding: 10px; border-top: 1px solid var(--line); }
.clips-head { border-top: 0; border-bottom: 1px solid var(--line); }
.chat-form input, .clips-head input { flex: 1; background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px; }
.chat-form button { background: var(--accent); border: 0; border-radius: 6px; padding: 0 14px; color: #fff; }
.clips { flex: 1; overflow-y: auto; }
.clip { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-bottom: 1px solid var(--line); color: inherit; text-decoration: none; }
.clip:hover { background: var(--panel2); }
.clip .n { flex: 1; min-width: 0; }
.clip .n div { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.clip .n small { color: var(--muted); font-family: var(--mono); font-size: 11px; }
.clip .dl { font-size: 18px; }
.empty { padding: 16px; color: var(--muted); font-size: 13px; }

@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; grid-template-rows: auto auto 1fr; height: auto; min-height: 100vh; }
  .stage { min-height: 56vw; }
  .side { border-left: 0; border-top: 1px solid var(--line); min-height: 60vh; }
  .cap-label { width: 140px; }
}

/* Selector de idioma */
.lang { display: inline-flex; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.lang button { background: none; border: 0; padding: 3px 8px; font: 600 11px var(--mono); color: var(--muted); }
.lang button.on { background: var(--text); color: var(--bg); }
.login-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }

/* VTR en el portal */
.vtrb.rec { color: #fff; background: var(--accent); border-color: var(--accent); }
.vtrb.replay { color: #29b6f6; border-color: #29b6f6; }
.tk { display: grid; grid-template-columns: 88px 1fr auto; gap: 8px; padding: 8px 12px; border-bottom: 1px solid var(--line); }
.tk.cur { background: #29b6f612; }
.tk img, .tk .noimg { width: 88px; aspect-ratio: 16/9; object-fit: cover; border-radius: 3px; background: #000; display: block; }
.tk .nm { font: 600 12px var(--mono); }
.tk small { color: var(--muted); font-family: var(--mono); font-size: 11px; }
.tk .nt { font-size: 12px; white-space: pre-wrap; word-break: break-word; color: #c9ccd2; cursor: text; min-height: 1em; }
.tk .nt:empty::before { content: attr(data-ph); color: var(--muted); }
.tk textarea { width: 100%; background: var(--bg); border: 1px solid var(--line); border-radius: 4px; color: inherit; font: inherit; padding: 4px; }
.tk .st { background: none; border: 0; font-size: 16px; color: #555; }
.tk .st.on { color: #ffcc00; }
#takeStar.active { background: #ffcc00; color: #000; }

/* Badge de estado sobre el visor: punto verde = en vivo, triángulo ocre = playback, punto rojo = grabando */
.vtrtag { position: absolute; top: 12px; left: 12px; z-index: 3; pointer-events: none; display: flex; align-items: center; gap: 7px;
  font: 600 clamp(11px, 1vw, 14px)/1.25 var(--mono); letter-spacing: .04em; padding: .5em .75em; border-radius: 5px;
  background: #000; color: #fff; max-width: calc(100% - 24px); }
.vtrtag i { width: .7em; height: .7em; border-radius: 50%; background: var(--ok); flex: none; }
.vtrtag b { display: none; }
.vtrtag span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vtrtag span:empty { display: none; }
.vtrtag.replay i { background: #e0a526; border-radius: 0; width: .65em; height: .75em; clip-path: polygon(0 0, 100% 50%, 0 100%); }
.vtrtag.rec i { background: var(--accent); animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0; } }

/* Modo admin */
.adminwrap { position: relative; }
.adminbtn { background: none; cursor: pointer; font-size: 12px; }
body.admin .adminbtn { color: #000; background: #e0a526; border-color: #e0a526; }
.adminbox { position: absolute; right: 0; top: calc(100% + 8px); z-index: 20; width: 260px; background: var(--panel); border: 1px solid var(--line);
  border-radius: 8px; padding: 12px; box-shadow: 0 8px 24px #0008; display: grid; gap: 8px; }
.adminbox form, .adminbox #adminTools { display: grid; gap: 8px; }
.adminbox label { display: grid; gap: 4px; font-size: 12px; color: var(--muted); }
.adminbox input { background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 8px; }
.adminbox p { margin: 0; font-size: 12px; }
.tool.danger { border-color: var(--accent); color: var(--accent); }
.tool.danger.armed { background: var(--accent); color: #fff; }
.del { display: none; background: none; border: 0; color: var(--muted); cursor: pointer; font-size: 13px; padding: 0 4px; }
.del:hover { color: var(--accent); }
body.admin .del { display: inline-block; }
.msg { position: relative; }
.msg .del { position: absolute; right: 0; top: 0; }
.thumb { position: relative; }
.thumb .del { position: absolute; top: 3px; right: 3px; z-index: 2; background: #000c; border-radius: 4px; color: #fff; }
.user .kick { margin-left: 4px; }

/* Proyecto: cabecera con logos */
.projhead { display: flex; align-items: center; gap: 12px; padding-left: 12px; border-left: 1px solid var(--line); min-width: 0; }
.projhead #projTitle { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 30vw; }
.logos { display: flex; align-items: center; gap: 12px; }
.logos img { height: 28px; max-width: 120px; object-fit: contain; }
.logos img.lg-agency, .logos img.lg-production { height: 14px; max-width: 60px; }
/* Pestaña Docs */
.docs-export { display: flex; gap: 6px; padding: 10px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.docs-export a { text-decoration: none; }
.doc { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-bottom: 1px solid var(--line); color: inherit; text-decoration: none; }
.doc:hover { background: var(--panel2); }
.doc .k { font: 600 10px var(--mono); text-transform: uppercase; letter-spacing: .06em; color: #000; background: #e0a526; padding: 3px 6px; border-radius: 3px; flex: none; }
.doc .k.callsheet { background: #29b6f6; } .doc .k.shotlist { background: #3ddc84; } .doc .k.other { background: #8a8f99; }
.doc .n { flex: 1; min-width: 0; } .doc .n div { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc .n small { color: var(--muted); font-family: var(--mono); font-size: 11px; }
/* Modal de proyecto */
.modal { position: fixed; inset: 0; background: #000a; z-index: 50; display: grid; place-items: center; padding: 16px; }
.modal-card { width: min(620px, 100%); max-height: 90vh; overflow-y: auto; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 16px; display: grid; gap: 16px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; }
.fld { display: grid; gap: 6px; } .fld > span { font-size: 12px; color: var(--muted); }
.row2 { display: flex; gap: 6px; align-items: center; }
.row2 input:not([type=file]), .row2 select { flex: 1; background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 8px; color: inherit; }
.logo-slots { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.slot { background: var(--panel2); border-radius: 6px; padding: 8px; display: grid; gap: 6px; }
.slot .prev { height: 54px; background: repeating-conic-gradient(#2a2d33 0 25%, #1c1e22 0 50%) 0 0 / 12px 12px; border-radius: 4px; display: grid; place-items: center; overflow: hidden; }
.slot .prev img { max-height: 48px; max-width: 90%; object-fit: contain; }
.slot small { color: var(--muted); }
label.tool { cursor: pointer; text-align: center; }
#pmDocs .doc { padding: 6px 4px; }
@media (max-width: 900px) { .projhead { display: none !important; } .logo-slots { grid-template-columns: 1fr; } }

/* Comentarios ligados a toma */
.tkchip { display: inline-block; font: 600 10px var(--mono); padding: 1px 6px; border-radius: 3px; background: #e0a52633; color: #e0a526; margin-right: 6px; white-space: nowrap; }
.tkchip.rec { background: #ff3b3033; color: #ff6b6b; }
.tk .cm { font-size: 11px; color: #c9ccd2; margin-top: 3px; } .tk .cm span { font: 600 10px var(--mono); color: #e0a526; margin-right: 4px; }
/* Plan / shot list */
.admin-only { display: none !important; } body.admin .admin-only { display: inline-block !important; }
.plan-head { display: flex; gap: 8px; align-items: center; padding: 10px; border-bottom: 1px solid var(--line); }
.plan-prog { flex: 1; font-size: 12px; color: var(--muted); }
.plan-prog .bar { height: 6px; background: var(--line); border-radius: 3px; margin-top: 5px; overflow: hidden; display: flex; }
.plan-prog .bar i { display: block; height: 100%; }
.shot { padding: 10px 12px; border-bottom: 1px solid var(--line); }
.shot .top { display: flex; gap: 8px; align-items: baseline; padding: 0; border: 0; background: none; grid-column: auto; }
.shot .id { font: 600 12px var(--mono); white-space: nowrap; }
.shot .ds { flex: 1; font-size: 13px; }
.shot .stt { font: 600 10px var(--mono); text-transform: uppercase; padding: 2px 6px; border-radius: 3px; background: var(--line); color: var(--muted); cursor: default; white-space: nowrap; }
.shot .stt.shooting { background: #29b6f633; color: #29b6f6; } .shot .stt.done { background: #3ddc8433; color: #3ddc84; } .shot .stt.skip { text-decoration: line-through; }
body.admin .shot .stt { cursor: pointer; }
.shot.cur { background: #e0a52614; box-shadow: inset 3px 0 0 #e0a526; }
.shot .tks { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.shot .tks span { font: 11px var(--mono); padding: 2px 6px; border-radius: 3px; background: var(--panel2); color: #c9ccd2; }
.shot .tks span.circle { color: #ffcc00; }
#shotText { width: 100%; background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 8px; color: inherit; font: 12px var(--mono); }
#shotRows .shot { padding: 6px 4px; }

/* timeline del plano */
.shot .top .tw { color: var(--muted); font-size: 10px; width: 10px; }
.shot { cursor: pointer; }
.shot .tks span.appr { background: #3ddc8433; color: #3ddc84; }
.tool.mini { padding: 2px 7px; font-size: 11px; }
.tline { margin: 8px 0 2px 18px; border-left: 2px solid var(--line); padding-left: 10px; display: grid; gap: 4px; cursor: default; }
.tl { display: flex; gap: 8px; align-items: baseline; font-size: 12px; line-height: 1.35; }
.tl .h { font: 11px var(--mono); color: var(--muted); flex: none; width: 38px; }
.tl > span { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.tl.start { color: #29b6f6; } .tl.done { color: #3ddc84; font-weight: 600; }
.tl.take { font-family: var(--mono); } .tl.take small { color: var(--muted); } .tl.take.appr { color: #ffcc00; }
.tl.cap { cursor: pointer; } .tl.cap:hover span { text-decoration: underline; }
.tl .tkchip { font-style: normal; }
/* estadísticas */
.modal-card.wide { width: min(980px, 100%); }
.modal-head .tool + .tool { margin-left: 6px; }
.stats-sum { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.stats-sum .sc { background: var(--panel2); border-radius: 8px; padding: 10px; display: grid; gap: 2px; }
.stats-sum .sc b { font: 600 20px var(--mono); }
.stats-sum .sc span { font-size: 12px; color: #c9ccd2; }
.stats-sum .sc small { font-size: 11px; color: var(--muted); }
.stats-rows { overflow-x: auto; }
.stt-t { width: 100%; border-collapse: collapse; font-size: 12px; }
.stt-t th { text-align: left; font-weight: 600; color: var(--muted); padding: 6px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.stt-t td { padding: 6px; border-bottom: 1px solid var(--line); font-family: var(--mono); vertical-align: top; }
.stt-t td:first-child { font-family: inherit; }
.stt-t small { color: var(--muted); }
.stt-t tr.done td:first-child b { color: #3ddc84; } .stt-t tr.skip { opacity: .5; }

/* logos del proyecto en la pantalla de acceso */
.login-cover { display: grid; gap: 12px; justify-items: center; padding: 6px 0 4px; border-bottom: 1px solid var(--line); padding-bottom: 16px; }
.login-logos { display: flex; flex-wrap: nowrap; gap: 14px; justify-content: center; align-items: center; }
.login-logos img { height: 48px; max-width: 46%; min-width: 0; object-fit: contain; }
.login-logos img.lg-agency, .login-logos img.lg-production { height: 24px; max-width: 23%; }
.login-proj { font-size: 15px; font-weight: 600; text-align: center; color: var(--fg, #fff); }

/* referencias visuales de los planos */
.shot.has-ref { display: grid; grid-template-columns: 112px 1fr; column-gap: 10px; }
.shot.has-ref > :not(.sref) { grid-column: 2; }
.shot .sref { grid-row: 1 / span 3; width: 112px; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 4px; background: #000; cursor: zoom-in; }
.shot.has-ref .tline { grid-column: 1 / -1; }
.shot.drop { outline: 2px dashed var(--accent); outline-offset: -2px; }
.erow { display: flex; gap: 8px; align-items: center; }
.erow .top { flex: 1; }
.refslot { width: 72px; height: 40px; flex: none; border: 1px dashed var(--line); border-radius: 4px; display: grid; place-items: center; overflow: hidden; cursor: pointer; font-size: 12px; color: var(--muted); }
.refslot img { width: 100%; height: 100%; object-fit: cover; }
.refmodal { position: fixed; inset: 0; z-index: 60; background: #000e; display: grid; place-items: center; align-content: center; gap: 10px; padding: 16px; cursor: zoom-out; }
.refmodal img { max-width: 100%; max-height: 85vh; object-fit: contain; }
.refmodal .cap { color: #c9ccd2; font-size: 13px; text-align: center; }
.muted.small { font-size: 12px; }

/* ===== Arranque tipo app: splash, fondo vivo, entrada, carga ===== */
.splash { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; align-content: center; gap: 22px; background: var(--bg); transition: opacity .5s ease, visibility .5s; }
body.ready .splash { opacity: 0; visibility: hidden; }
.sp-mark { position: relative; width: 64px; height: 64px; display: grid; place-items: center; }
.sp-dot { width: 18px; height: 18px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 24px var(--accent); animation: sp-beat 1.2s ease-in-out infinite; }
.sp-ring { position: absolute; inset: 0; border-radius: 50%; border: 2px solid var(--accent); opacity: 0; animation: sp-ring 1.8s cubic-bezier(.2, .6, .3, 1) infinite; }
.sp-ring.r2 { animation-delay: .9s; }
.sp-name { font: 600 15px var(--mono); letter-spacing: .5em; text-transform: uppercase; padding-left: .5em; color: var(--text); animation: sp-track 1s cubic-bezier(.2, .7, .2, 1) both; }
.sp-bar { width: 140px; height: 2px; background: var(--line); border-radius: 2px; overflow: hidden; }
.sp-bar i { display: block; width: 40%; height: 100%; background: var(--accent); animation: sp-sweep 1s ease-in-out infinite; }
@keyframes sp-beat { 50% { transform: scale(.82); box-shadow: 0 0 10px var(--accent); } }
@keyframes sp-ring { 0% { transform: scale(.4); opacity: .9; } 100% { transform: scale(1.6); opacity: 0; } }
@keyframes sp-track { from { letter-spacing: 1.2em; opacity: 0; filter: blur(4px); } }
@keyframes sp-sweep { 0% { transform: translateX(-100%); } 100% { transform: translateX(250%); } }

.bgfx { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; transition: opacity .6s; }
body.in-app .bgfx { opacity: 0; }
.bgfx .glow { position: absolute; width: 70vmax; height: 70vmax; left: 50%; top: 50%; margin: -35vmax 0 0 -35vmax; background: radial-gradient(closest-side, #ff3b3022, transparent 70%); animation: glow-drift 14s ease-in-out infinite alternate; }
.bgfx .grain { position: absolute; inset: -50%; opacity: .07; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"); animation: grain .6s steps(4) infinite; }
.bgfx .hud { position: absolute; left: 16px; right: 16px; bottom: 14px; display: flex; justify-content: space-between; font: 11px var(--mono); letter-spacing: .12em; color: #ffffff44; }
.bgfx .hud-rec { color: #ff3b3088; animation: blink 2s steps(2) infinite; }
@keyframes glow-drift { 0% { transform: translate(-12%, -8%) scale(.9); } 100% { transform: translate(12%, 10%) scale(1.15); } }
@keyframes grain { 0% { transform: translate(0, 0); } 25% { transform: translate(-5%, 3%); } 50% { transform: translate(4%, -4%); } 75% { transform: translate(-3%, -2%); } }

.login { z-index: 1; }
.login-card { position: relative; opacity: 0; transform: translateY(18px) scale(.98); box-shadow: 0 30px 80px #000a, 0 0 0 1px #ffffff08 inset; backdrop-filter: blur(6px); background: color-mix(in srgb, var(--panel) 92%, transparent); }
body.ready .login-card { animation: card-in .7s cubic-bezier(.2, .8, .2, 1) .1s forwards; }
body.ready .login-card > * { animation: rise .6s cubic-bezier(.2, .8, .2, 1) backwards; }
body.ready .login-card > :nth-child(2) { animation-delay: .18s; } body.ready .login-card > :nth-child(3) { animation-delay: .26s; }
body.ready .login-card > :nth-child(4) { animation-delay: .32s; } body.ready .login-card > :nth-child(5) { animation-delay: .38s; } body.ready .login-card > :nth-child(6) { animation-delay: .44s; }
body.ready .login-logos img { animation: logo-in .7s cubic-bezier(.2, .8, .2, 1) both; animation-delay: calc(.3s + var(--i, 0) * .12s); }
@keyframes card-in { to { opacity: 1; transform: none; } }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }
@keyframes logo-in { from { opacity: 0; transform: translateY(6px) scale(.94); filter: blur(3px); } }
.login-card input { transition: border-color .2s, box-shadow .2s; outline: none; }
.login-card input:focus { border-color: #ff3b3099; box-shadow: 0 0 0 3px #ff3b3022; }
.login-card button[type=submit] { position: relative; display: flex; justify-content: center; align-items: center; gap: 8px; overflow: hidden; transition: transform .15s, filter .2s; }
.login-card button[type=submit]:hover { filter: brightness(1.08); } .login-card button[type=submit]:active { transform: scale(.98); }
.login-card .spin { width: 14px; height: 14px; border-radius: 50%; border: 2px solid #fff6; border-top-color: #fff; display: none; animation: spin .7s linear infinite; }
.login-card.busy .spin { display: block; } .login-card.busy button[type=submit] { pointer-events: none; filter: saturate(.8); }
@keyframes spin { to { transform: rotate(360deg); } }
.login-card.shake { animation: shake .4s cubic-bezier(.36, .07, .19, .97) both !important; opacity: 1; transform: none; }
@keyframes shake { 20%, 60% { transform: translateX(-7px); } 40%, 80% { transform: translateX(7px); } }

/* pasos de conexión */
.boot { position: absolute; inset: 0; z-index: 2; border-radius: inherit; background: var(--panel); display: grid; align-content: center; gap: 14px; padding: 32px; animation: fade-in .25s both; }
.boot-step { display: flex; align-items: center; gap: 12px; font-size: 13px; color: var(--muted); opacity: .35; transition: opacity .3s, color .3s; }
.boot-step i { width: 16px; height: 16px; flex: none; border-radius: 50%; border: 2px solid var(--line); border-top-color: var(--accent); animation: spin .8s linear infinite; }
.boot-step:first-child, .boot-step.ok, .boot-step.ok + .boot-step { opacity: 1; }
.boot-step.ok { color: var(--text); }
.boot-step.ok i { animation: tick-pop .35s cubic-bezier(.2, .9, .3, 1.4) both; border: 0; background: var(--ok) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4 8.5l2.5 2.5L12 5.5' fill='none' stroke='%23000' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 100% no-repeat; }
@keyframes tick-pop { from { transform: scale(.2); } }
@keyframes fade-in { from { opacity: 0; } }
.login.out .login-card { animation: card-out .38s cubic-bezier(.6, 0, .8, .4) forwards !important; }
@keyframes card-out { to { opacity: 0; transform: scale(1.04); filter: blur(6px); } }

/* entrada a la app */
.app { position: relative; z-index: 1; }
body.entering .app > * { opacity: 0; }
body.in-app .app > * { animation: app-in .6s cubic-bezier(.2, .8, .2, 1) backwards; }
header.top { position: relative; z-index: 20; }
body.in-app .app > :nth-child(2) { animation-delay: .08s; } body.in-app .app > :nth-child(3) { animation-delay: .16s; } body.in-app .app > :nth-child(4) { animation-delay: .22s; }
@keyframes app-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: reduce) {
  .splash *, .bgfx *, .login-card, .login-card *, .app > * { animation: none !important; transition: none !important; }
  .login-card { opacity: 1; transform: none; }
}
body.ready .login-card > .boot { animation: fade-in .25s both; }
body.booting .login-card > :not(.boot) { opacity: 0 !important; transition: opacity .2s; }
.clip .cth { width: 72px; height: 40px; object-fit: cover; border-radius: 3px; background: #000; flex: none; }

/* votos sobre tomas */
.votebar { position: absolute; right: 12px; bottom: 12px; z-index: 4; display: flex; align-items: center; gap: 6px; background: #000c; backdrop-filter: blur(6px); border: 1px solid #ffffff1a; border-radius: 999px; padding: 5px 6px 5px 12px; font: 600 12px var(--mono); color: #fff; max-width: calc(100% - 24px); }
.votebar .vt-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-right: 4px; opacity: .85; }
.vb { border: 1px solid #ffffff22; background: #ffffff10; color: #fff; border-radius: 999px; padding: 5px 11px; font: 600 13px var(--mono); transition: transform .15s, background .2s, border-color .2s; }
.vb:hover { background: #ffffff22; }
.vb.up.on { background: #3ddc8433; border-color: var(--ok); } .vb.down.on { background: #ff3b3033; border-color: var(--accent); }
.vb.pop { transform: scale(1.18); }
.vb.mini { padding: 2px 8px; font-size: 11px; background: var(--panel2); border-color: var(--line); color: var(--text); }
.tvotes { display: flex; gap: 5px; align-items: center; flex-wrap: wrap; margin: 4px 0; }
.tvotes small { color: var(--muted); font-size: 11px; }
.vc { font: 11px var(--mono); }
a.tool { text-decoration: none; color: inherit; display: inline-flex; align-items: center; }
/* el chip de toma en grabación no debe heredar el punto rojo global .rec */
.tkchip.rec { width: auto; height: auto; border-radius: 3px; box-shadow: none; display: inline-block; }
.shot.has-ref .top { flex-wrap: wrap; row-gap: 2px; }
.shot.has-ref .top .ds { flex-basis: 100%; order: 5; }

/* visor de clips */
.clipbox { position: fixed; inset: 0; z-index: 70; background: #000d; display: grid; place-items: center; padding: 20px; animation: fade-in .2s both; }
.cb-card { width: min(1400px, 100%); max-height: 100%; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; display: grid; grid-template-rows: auto 1fr auto; overflow: hidden; box-shadow: 0 30px 80px #000c; }
.cb-head { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.cb-head b { font: 600 14px var(--mono); } .cb-meta { color: var(--muted); font: 12px var(--mono); }
.cb-body { display: grid; grid-template-columns: 1fr auto; min-height: 0; }
.cb-media { background: #000; display: grid; place-items: center; min-height: 300px; }
.cb-media video, .cb-media img { width: 100%; max-height: calc(100vh - 150px); object-fit: contain; display: block; }
.cb-media iframe { width: 100%; height: calc(100vh - 150px); border: 0; background: #fff; }
.cb-media audio { width: 80%; }
.cb-side { width: 300px; border-left: 1px solid var(--line); overflow-y: auto; max-height: calc(100vh - 150px); padding: 10px; display: grid; align-content: start; gap: 4px; }
.cb-votes { font: 12px var(--mono); color: var(--muted); padding: 2px 4px 8px; }
.cb-cm { text-align: left; background: none; border: 0; border-radius: 6px; padding: 6px; font-size: 12px; color: var(--text); line-height: 1.35; }
.cb-cm:hover { background: var(--panel2); } .cb-cm span { font: 11px var(--mono); color: #e0a526; margin-right: 6px; }
.cb-foot { padding: 6px 12px; font: 11px var(--mono); color: var(--muted); border-top: 1px solid var(--line); min-height: 26px; }
.tk .playc { color: var(--ok); }
.clip { cursor: pointer; }
@media (max-width: 800px) { .cb-body { grid-template-columns: 1fr; } .cb-side { width: auto; border-left: 0; border-top: 1px solid var(--line); max-height: 30vh; } }
.hasclip, [data-takeplay] { cursor: pointer; } .shot .tks span.hasclip:hover, .tl.take.hasclip:hover, .tkchip[data-takeplay]:hover { filter: brightness(1.3); text-decoration: underline; }
#cuList { display: grid; gap: 4px; } .cu { display: flex; gap: 10px; align-items: center; padding: 8px 10px; background: var(--panel2); border-radius: 6px; } .cu small { color: var(--muted); font: 11px var(--mono); }
#cuForm input { flex: 1; min-width: 0; }
body.admin .logoutbtn { background: none; color: inherit; border-color: var(--line); } .logoutbtn { margin-left: 4px; }

/* desplegable de usuarios */
.usersdd { position: relative; }
.usersbtn { border: 1px solid var(--line); cursor: pointer; color: inherit; font: inherit; font-size: 12px; padding: 3px 10px 3px 6px; }
.usersbtn .dots { display: inline-flex; margin-right: 2px; } .usersbtn .dots i { width: 9px; height: 9px; border-radius: 50%; margin-right: -3px; border: 1px solid var(--panel); }
.usersbtn .car { color: var(--muted); margin-left: 4px; transition: transform .2s; } .usersbtn.open .car { transform: rotate(180deg); }
.usersmenu { position: absolute; right: 0; top: calc(100% + 6px); z-index: 25; min-width: 220px; max-height: 60vh; overflow-y: auto; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 6px; display: grid; gap: 4px; box-shadow: 0 12px 30px #0008; }
.usersmenu .user { justify-content: flex-start; } .usersmenu .user .kick { margin-left: auto; }

.videooff { position: absolute; inset: 0; z-index: 2; display: grid; place-items: center; align-content: center; gap: 10px; text-align: center; color: var(--muted); padding: 20px; background: #0b0c0e; }
.videooff svg.i { width: 40px; height: 40px; } .videooff b { color: var(--text); font-size: 16px; } .videooff span { max-width: 420px; font-size: 13px; }
#btnVideo.off { color: #e0a526; border-color: #e0a52666; }
