@font-face { font-family: 'Bricolage Grotesque'; src: url(/fonts/bricolage-grotesque-normal-300-800.woff2) format('woff2'); font-weight: 300 800; font-display: swap; }
@font-face { font-family: 'DM Sans'; src: url(/fonts/dm-sans-latin-wght.woff2) format('woff2'); font-weight: 100 1000; font-display: swap; }
@font-face { font-family: 'JetBrains Mono'; src: url(/fonts/jetbrains-mono-normal-400.woff2) format('woff2'); font-weight: 400; font-display: swap; }

:root {
  --canvas: #0F1B2D;
  --panel: #16243A;
  --panel-2: #1C2D47;
  --line: rgba(169, 180, 198, .16);
  --accent: #3D5AFE;
  --accent-hover: #5A73FF;
  --accent-muted: rgba(61, 90, 254, .18);
  --hielo: #A8B8FF;
  --plata: #C9D0DB;
  --text: #F6F4EE;
  --text-2: #A9B4C6;
  --ok: #4ADE80;
  --bad: #F87171;
  --radius: 14px;
  --font-title: 'Bricolage Grotesque', system-ui, sans-serif;
  --font: 'DM Sans', system-ui, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, monospace;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { background: var(--canvas); color: var(--text); font: 15px/1.5 var(--font); }
[hidden] { display: none !important; }
a { color: inherit; }
h1, h2, h3 { font-family: var(--font-title); font-weight: 800; letter-spacing: -.01em; margin: 0; }
h1 { font-size: 30px; }
h1 b { color: var(--accent-hover); }
h2 { font-size: 20px; font-weight: 600; }
.eyebrow { font: 12px var(--mono); color: var(--text-2); text-transform: uppercase; letter-spacing: .06em; }
.muted { color: var(--text-2); }
.small { font-size: 13px; }
.mono { font-family: var(--mono); font-size: 13px; }
.hint { font-size: 13px; color: var(--hielo); margin: 0; }
.ok-note { color: var(--ok); margin: 0 0 8px; font-size: 14px; }

/* botones y campos */
.btn { appearance: none; border: 1px solid var(--line); background: var(--panel-2); color: var(--text); border-radius: 10px;
  padding: 9px 16px; font: 500 14px var(--font); cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: 8px; justify-content: center; }
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-hover); }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--bad); }
.btn.small { padding: 6px 11px; font-size: 13px; }
.btn.big { padding: 14px 20px; font-size: 16px; font-weight: 600; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .5; cursor: default; }
:focus-visible { outline: 2px solid var(--hielo); outline-offset: 2px; }
label { display: grid; gap: 6px; font-size: 13px; color: var(--text-2); }
label.check { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--text); }
input, select, textarea { background: var(--canvas); color: var(--text); border: 1px solid var(--line); border-radius: 10px;
  padding: 9px 12px; font: 15px var(--font); width: 100%; min-width: 0; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); }
textarea { resize: vertical; min-height: 96px; }
textarea.mono { font: 13px/1.5 var(--mono); }
input[type=checkbox] { width: auto; accent-color: var(--accent); }
.form-error { color: var(--bad) !important; min-height: 1.2em; font-size: 14px; margin: 0; }

/* login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px;
  background: radial-gradient(circle at 30% 20%, var(--accent-muted), transparent 50%), var(--canvas); }
.login-card { width: min(380px, 100%); background: var(--panel); border: 1px solid var(--line); border-radius: 20px; padding: 32px; display: grid; gap: 16px; }
.login-card p { margin: 0; color: var(--text-2); }

/* estructura */
.shell { display: grid; grid-template-columns: 228px 1fr; min-height: 100vh; }
.side { background: var(--panel); border-right: 1px solid var(--line); padding: 20px 16px; display: flex; flex-direction: column; gap: 18px;
  position: sticky; top: 0; height: 100vh; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font: 600 19px var(--font-title); color: var(--plata); }
.brand b { color: var(--text); font-weight: 800; }
#nav { display: grid; gap: 2px; flex: 1; align-content: start; }
#nav a { text-decoration: none; padding: 9px 12px; border-radius: 10px; color: var(--text-2); display: flex; align-items: center; gap: 10px; }
#nav a:hover { background: var(--panel-2); color: var(--text); }
#nav a.active { background: var(--accent-muted); color: var(--text); box-shadow: inset 3px 0 0 var(--accent); }
.ni { width: 18px; text-align: center; font-size: 12px; color: var(--hielo); }
.badge { margin-left: auto; background: var(--accent); color: #fff; font: 600 11px var(--mono); border-radius: 999px; padding: 1px 7px; }
.main { padding: 28px 32px 60px; min-width: 0; outline: none; max-width: 1240px; }
.head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.head p { margin: 4px 0 0; color: var(--text-2); }
.back { color: var(--text-2); text-decoration: none; font-size: 14px; }
.back:hover { color: var(--text); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row > label { flex: 1; min-width: 160px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.grid { display: grid; gap: 14px; }
.empty { border: 1px dashed var(--line); border-radius: var(--radius); padding: 28px; text-align: center; color: var(--text-2); }
.big-empty { padding: 48px 24px; display: grid; gap: 12px; justify-items: center; }
.big-empty p { max-width: 460px; margin: 0; }
.meter { height: 6px; background: var(--panel-2); border-radius: 99px; overflow: hidden; width: min(320px, 100%); margin-top: 8px; }
.meter span { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--hielo)); border-radius: 99px; }
.meter.small { width: 120px; margin: 0 0 2px; }
.progress { height: 8px; background: var(--panel-2); border-radius: 99px; overflow: hidden; }
.progress span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), var(--hielo)); transition: width .2s; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); background: var(--panel-2); border: 1px solid var(--line);
  padding: 10px 16px; border-radius: 12px; opacity: 0; pointer-events: none; transition: .2s; z-index: 50; max-width: calc(100% - 32px); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.bad { border-color: var(--bad); color: var(--bad); }

/* biblioteca */
.filters { margin-bottom: 16px; }
.filters input { flex: 2; min-width: 200px; }
.filters select { flex: 1; min-width: 160px; width: auto; }
.vgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.vcard { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; }
.vcard > .btn { margin: 0 12px 12px; width: auto; }
.thumb { position: relative; display: block; aspect-ratio: 16 / 9; background: #050A14; overflow: hidden; }
.thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb.vertical img { object-fit: contain; }
.nothumb { position: absolute; inset: 0; display: grid; place-items: center; color: var(--hielo); font-size: 28px; }
.dur, .tag { position: absolute; bottom: 8px; right: 8px; background: rgba(5, 10, 20, .8); padding: 2px 7px; border-radius: 6px; font-size: 12px; }
.tag { right: auto; left: 8px; color: var(--hielo); }
.vbody { padding: 12px; display: grid; gap: 3px; flex: 1; }
.vbody p { margin: 0; }
.vtitle { font-weight: 600; text-decoration: none; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.vtitle:hover { color: var(--hielo); }
.stats { display: flex; gap: 12px; color: var(--text-2); }

/* grabar */
.rec-grid { display: grid; grid-template-columns: minmax(280px, 380px) 1fr; gap: 20px; align-items: start; }
.rec-setup { display: grid; gap: 14px; }
.rec-setup.busy { opacity: .45; pointer-events: none; }
.seg { display: flex; gap: 4px; background: var(--canvas); border: 1px solid var(--line); border-radius: 12px; padding: 4px; flex-wrap: wrap; }
.seg button { flex: 1; appearance: none; border: 0; background: transparent; color: var(--text-2); border-radius: 9px; padding: 9px 10px; font: 500 14px var(--font); cursor: pointer; min-width: max-content; }
.seg.small button { font-size: 13px; padding: 7px 8px; }
.seg button[aria-checked=true] { background: var(--accent); color: #fff; }
.file-btn { cursor: pointer; display: inline-flex; }
.rec-stage { position: relative; display: grid; gap: 14px; }
.preview { position: relative; background: #050A14; border: 1px solid var(--line); border-radius: 18px; overflow: hidden; aspect-ratio: 16 / 9; display: grid; place-items: center; }
.preview video { width: 100%; height: 100%; object-fit: contain; display: block; }
.preview video.mirror { transform: scaleX(-1); }
.preview.vertical { aspect-ratio: 9 / 16; height: min(72vh, 680px); width: auto; max-width: 100%; justify-self: center; }
.preview.bubble video { width: 46%; aspect-ratio: 1; height: auto; object-fit: cover; border-radius: 50%; box-shadow: 0 0 0 3px var(--accent), 0 0 0 7px rgba(168, 184, 255, .2); }
.preview-empty { position: absolute; inset: 0; display: grid; place-items: center; color: var(--text-2); text-align: center; padding: 20px; }
.rec-bar { display: flex; align-items: center; gap: 10px; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 10px 14px; flex-wrap: wrap; }
.rec-bar .mono { font-size: 18px; min-width: 56px; }
.rec-dot { width: 12px; height: 12px; border-radius: 3px; background: var(--accent-hover); animation: blink 1.2s infinite; }
@keyframes blink { 50% { opacity: .25; } }
.countdown { position: fixed; inset: 0; display: grid; place-items: center; background: rgba(10, 18, 34, .7); font: 800 140px var(--font-title); color: var(--text); z-index: 40; }
.result { display: grid; gap: 12px; }
.linkbox { display: flex; gap: 8px; }
.linkbox input { font: 13px var(--mono); }

/* detalle */
.detail { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(260px, 1fr); gap: 20px; align-items: start; margin-bottom: 18px; }
.detail.vertical { grid-template-columns: minmax(0, 380px) minmax(260px, 1fr); }
.dplayer { padding: 0; overflow: hidden; background: #050A14; }
.dplayer video { display: block; width: 100%; max-height: 70vh; background: #050A14; }
.dinfo { display: grid; gap: 12px; }
.title-input { font: 800 24px/1.2 var(--font-title); background: transparent; border-color: transparent; padding: 6px 8px; margin-left: -8px; }
.title-input:hover { border-color: var(--line); }
.kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.kpis div { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 12px; display: grid; }
.kpis b { font: 800 20px var(--font-title); }
.kpis span { font-size: 12px; color: var(--text-2); }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 14px; overflow-x: auto; }
.tabs button { appearance: none; border: 0; background: none; color: var(--text-2); padding: 10px 14px; font: 500 14px var(--font); cursor: pointer; border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs button[aria-selected=true] { color: var(--text); border-bottom-color: var(--accent); }
.tabbody { display: grid; gap: 14px; }
.clist { display: grid; gap: 8px; }
.c { display: grid; grid-template-columns: 56px 1fr auto; gap: 10px; align-items: start; padding: 10px 12px; border-radius: 12px; background: var(--panel-2); }
.c.mine { background: var(--accent-muted); }
.c p { margin: 2px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.c .t { appearance: none; border: 0; color: var(--hielo); background: rgba(168, 184, 255, .1); border-radius: 8px; padding: 4px 6px; cursor: pointer; }
.c .t.none { visibility: hidden; }
.reply { display: grid; gap: 10px; }
.reply .row { justify-content: space-between; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font: 12px var(--mono); color: var(--text-2); text-transform: uppercase; letter-spacing: .05em; padding: 8px; border-bottom: 1px solid var(--line); }
.table td { padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.trim { display: grid; gap: 12px; }
.trimbar { position: relative; height: 10px; background: var(--panel-2); border-radius: 99px; }
.trimbar span { position: absolute; top: 0; bottom: 0; background: linear-gradient(90deg, var(--accent), var(--hielo)); border-radius: 99px; }

/* actividad */
.feed { display: grid; gap: 8px; }
.fitem { display: flex; gap: 12px; align-items: flex-start; text-decoration: none; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.fitem:hover { border-color: var(--accent); }
.fitem.new { border-color: rgba(61, 90, 254, .55); box-shadow: inset 3px 0 0 var(--accent); }
.ficon { font-size: 18px; line-height: 1.3; }

/* celular */
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; bottom: 0; top: auto; left: 0; right: 0; height: auto; flex-direction: row; padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
    border-right: 0; border-top: 1px solid var(--line); z-index: 30; gap: 0; }
  .side .brand, .side .rec-cta, #logoutBtn { display: none; }
  #nav { grid-auto-flow: column; grid-auto-columns: 1fr; width: 100%; }
  #nav a { flex-direction: column; gap: 2px; font-size: 12px; padding: 6px; position: relative; }
  #nav a.active { box-shadow: none; }
  .ni { font-size: 16px; }
  .badge { position: absolute; top: 2px; right: 18%; }
  .main { padding: 20px 16px 96px; }
  h1 { font-size: 26px; }
  .rec-grid, .detail, .detail.vertical { grid-template-columns: 1fr; }
  .rec-stage { order: -1; }
  .detail.vertical .dplayer { max-width: 380px; justify-self: center; width: 100%; }
  .preview.vertical { height: min(60vh, 560px); }
  .c { grid-template-columns: 48px 1fr auto; }
}

/* guion en pantalla y reel */
h3 { font-size: 15px; font-weight: 600; margin-top: 6px; }
.guion { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; background: var(--canvas); }
.guion summary { cursor: pointer; font-weight: 600; font-size: 14px; }
.guion[open] summary { margin-bottom: 10px; }
.guion textarea { min-height: 120px; margin-bottom: 8px; }
label.mini { flex: 1; min-width: 110px; }
label.mini input { padding: 0; accent-color: var(--accent); }
.prompter-slot { position: absolute; left: 0; right: 0; top: 0; height: 42%; display: flex; padding: 10px; pointer-events: none; }
.prompter-slot:empty { display: none; }
.prompter-slot .prompter { flex: 1; pointer-events: auto; }
.prompter { position: relative; overflow: hidden; background: linear-gradient(rgba(10, 18, 34, .95), rgba(10, 18, 34, .82)); border-radius: 12px; }
.prompter .txt { padding: 40% 18px 60%; font: 600 var(--ps, 26px)/1.45 var(--font); color: var(--text); white-space: pre-wrap; text-align: center; }
.prompter::before { content: ''; position: absolute; left: 0; right: 0; top: 34%; height: 2px; background: linear-gradient(90deg, transparent, rgba(168, 184, 255, .55), transparent); z-index: 1; }
.prompter .pc { position: absolute; right: 8px; bottom: 8px; display: flex; gap: 6px; z-index: 2; }
.prompter .pc button { border: 0; border-radius: 8px; padding: 5px 9px; font: 600 12px var(--font); cursor: pointer; background: var(--panel-2); color: var(--text); }
.preview.reel { background: linear-gradient(#050A14 0 60.4%, #0A1222 60.4%); }
.preview.reel video { position: absolute; left: 0; right: 0; bottom: 0; height: 39.6%; object-fit: cover; }
.reel-guide { position: absolute; inset: 0; display: grid; grid-template-rows: 60.4% 39.6%; pointer-events: none; }
.reel-guide span { display: grid; place-items: center; font: 12px var(--mono); color: var(--text-2); text-transform: uppercase; letter-spacing: .08em; }
.reel-guide span:first-child { border-bottom: 2px solid rgba(168, 184, 255, .6); box-shadow: 0 2px 12px rgba(90, 115, 255, .5); }
.reel-guide span:last-child { align-items: start; padding-top: 8px; text-shadow: 0 1px 4px #000; }
@media (max-width: 860px) {
  #nav a { font-size: 11px; }
}
.version { font-size: 11px; color: var(--text-2); text-align: center; opacity: .6; }
@media (max-width: 860px) { .version { display: none; } }
.result video.final { width: 100%; max-height: 52vh; border-radius: 12px; background: #050A14; }

/* borrar videos desde la biblioteca */
.vactions { display: flex; gap: 6px; margin: 0 12px 12px; }
.vactions .btn:first-child { flex: 1; }
.pick { position: absolute; top: 8px; right: 8px; width: 26px; height: 26px; border-radius: 50%; display: none; place-items: center;
  font: 700 14px var(--font); background: rgba(5, 10, 20, .7); border: 2px solid var(--plata); color: transparent; }
.vgrid.selecting .pick { display: grid; }
.vgrid.selecting .vcard { cursor: pointer; }
.vgrid.selecting .vactions { display: none; }
.vcard.picked { border-color: var(--bad); box-shadow: 0 0 0 1px var(--bad); }
.vcard.picked .pick { background: var(--bad); border-color: var(--bad); color: #fff; }
.bulkbar { position: sticky; bottom: 16px; margin-top: 16px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 14px; padding: 10px 14px; box-shadow: 0 10px 30px rgba(0, 0, 0, .4); z-index: 20; }
.bulkbar span { flex: 1; min-width: 180px; font-size: 14px; }
@media (max-width: 860px) { .bulkbar { bottom: 84px; } }
.clip .row > label { flex: 0 1 auto; min-width: 0; }

/* editor: reels, música y portada */
.clips { display: grid; gap: 12px; }
.clip { display: grid; gap: 10px; background: var(--panel-2); }
.clip-title { font: 700 17px var(--font-title); }
.mlist { display: grid; gap: 6px; margin: 8px 0; }
.mlist .row span:first-child { flex: 1; }
.cover-prev { height: 64px; border-radius: 8px; border: 1px solid var(--line); }
