:root {
  --bg: #0e0f13;
  --panel: #16181f;
  --panel-2: #1d2029;
  --line: #2a2e3a;
  --text: #e9eaf0;
  --muted: #8a8fa3;
  --accent: #7c5cff;
  --accent-2: #a58bff;
  --hot: #ff5c8a;
  --ok: #3ddc97;
  --warn: #ffb547;
  --radius: 10px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg); color: var(--text);
  font: 14px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  display: flex; flex-direction: column; overflow: hidden;
}
button, input, select { font: inherit; color: inherit; }
kbd {
  font: 11px ui-monospace, monospace; padding: 1px 5px; border-radius: 4px;
  background: #2b2f3d; border: 1px solid #3a3f50; border-bottom-width: 2px; color: #cfd2e0;
}
.muted { color: var(--muted); }
.small { font-size: 12px; }
em { font-style: normal; }

/* ---------- botones */
.btn {
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px;
  padding: 7px 12px; cursor: pointer; white-space: nowrap; display: inline-flex; align-items: center; gap: 6px;
  transition: background .12s, border-color .12s;
}
.btn:hover { background: #262a36; border-color: #3a3f50; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.btn.primary:hover { background: #6b49ff; }
.btn.accent { border-color: #4d3aa8; background: #241d45; }
.btn.accent:hover { background: #2e2558; }
.btn.ghost { background: transparent; }
.btn.small { padding: 4px 9px; font-size: 12px; }
.btn.wide { width: 100%; justify-content: center; }
.btn.grow { flex: 1; justify-content: center; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn select { background: transparent; border: 0; padding: 0; cursor: pointer; }
.btn select option { background: var(--panel); }
.icon {
  background: transparent; border: 1px solid transparent; border-radius: 8px; cursor: pointer;
  width: 34px; height: 34px; display: inline-grid; place-items: center; font-size: 15px;
}
.icon:hover { background: var(--panel-2); border-color: var(--line); }
.icon.play { background: var(--accent); color: #fff; width: 42px; height: 42px; border-radius: 50%; font-size: 16px; }
.icon.small { width: 28px; height: 28px; font-size: 13px; }
.icon.xs { width: 22px; height: 26px; font-size: 13px; border-radius: 6px; }
.icon.danger:hover { background: #3a1822; border-color: #6b2235; }
.link { background: none; border: 0; color: var(--accent-2); cursor: pointer; padding: 2px 0; font-size: 12px; }
.link:hover { text-decoration: underline; }
select {
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px;
}
input[type=text], input[type=url], input[type=password], input[type=email], input[type=search], input[type=number], .tcin {
  background: #0f1117; border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; width: 100%;
  outline: none; color: var(--text); transition: border-color .12s, box-shadow .12s;
}
input[type=text]:focus, input[type=url]:focus, input[type=password]:focus, input[type=email]:focus,
input[type=search]:focus, input[type=number]:focus, .tcin:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(124, 92, 255, .22); }
input::placeholder { color: #5d6274; }
/* el navegador pinta de azul/gris los campos autorrellenados: lo dejamos con el tema oscuro */
input:-webkit-autofill, input:-webkit-autofill:hover, input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--text); caret-color: var(--text);
  box-shadow: 0 0 0 1000px #0f1117 inset; border: 1px solid var(--line);
  transition: background-color 9999s ease-out 0s;
}
input:disabled { opacity: .5; cursor: not-allowed; }
input[type=range] { accent-color: var(--accent); }
.badge:empty { display: none; }
.badge { background: var(--hot); color: #fff; border-radius: 10px; padding: 0 6px; font-size: 11px; font-weight: 700; }

/* ---------- iconos */
.i { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.icon .i { width: 17px; height: 17px; }
.icon.play .i { width: 18px; height: 18px; }

/* ---------- shell */
.shell { flex: 1; display: grid; grid-template-columns: 76px minmax(0, 1fr); min-height: 0; }
.rail {
  background: #0b0c10; border-right: 1px solid var(--line); display: flex; flex-direction: column;
  align-items: stretch; padding: 12px 8px; gap: 4px;
}
.rail-logo {
  width: 40px; height: 40px; border-radius: 12px; background: linear-gradient(135deg, var(--accent), var(--hot));
  display: grid; place-items: center; color: #fff; margin: 0 auto 14px;
}
.rail-logo .i { width: 20px; height: 20px; }
.nav-item {
  position: relative; background: none; border: 0; border-radius: 10px; color: var(--muted); cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 9px 2px; font-size: 10.5px; font-weight: 600;
}
.nav-item .i { width: 20px; height: 20px; }
.nav-item:hover { background: var(--panel-2); color: var(--text); }
.nav-item.active { background: #221d3d; color: #fff; }
.nav-item.active::before { content: ""; position: absolute; left: -8px; top: 10px; bottom: 10px; width: 3px; border-radius: 0 3px 3px 0; background: var(--accent); }
.nav-item:disabled { opacity: .35; cursor: not-allowed; }
.nav-item .badge { position: absolute; top: 4px; right: 10px; }
.rail-spacer { flex: 1; }
.main-col { display: flex; flex-direction: column; min-width: 0; min-height: 0; }

/* ---------- topbar */
.topbar {
  display: flex; align-items: center; gap: 16px; padding: 10px 16px; min-height: 56px;
  border-bottom: 1px solid var(--line); background: #111319; flex-shrink: 0;
}
.crumbs { flex: 1; display: flex; align-items: baseline; gap: 12px; min-width: 0; }
.view-title { font-weight: 700; font-size: 16px; white-space: nowrap; }
.media-name { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; font-size: 13px; }
.top-actions { display: flex; gap: 8px; }

/* ---------- vistas */
main { flex: 1; min-height: 0; display: flex; }
main.view-dashboard .editor { display: none; }
main.view-editor .dash { display: none; }

/* ---------- panel (dashboard) */
.dash { flex: 1; overflow-y: auto; }
.dash-inner { max-width: 1200px; margin: 0 auto; padding: 20px 24px 40px; display: flex; flex-direction: column; gap: 16px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 18px; }
.dash-top { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 16px; }
.import-card {
  display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; align-items: center;
  border: 1.5px dashed #343949; background: linear-gradient(135deg, #17142b, var(--panel) 60%); transition: border-color .15s, background .15s;
}
body.dragging .import-card, body.dragging .stage { border-color: var(--accent); background: #1a1630; }
.import-icon { grid-row: span 2; width: 52px; height: 52px; border-radius: 14px; background: #241d45; color: var(--accent-2); display: grid; place-items: center; }
.import-icon .i { width: 26px; height: 26px; }
.import-card h1 { font-size: 19px; margin: 0; }
.import-card p { margin: 0; font-size: 13px; }
.import-actions { grid-column: 2; display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.stats-card { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 12px; }
.stat { background: var(--panel-2); border-radius: 10px; padding: 10px 12px; display: grid; grid-template-columns: auto 1fr; column-gap: 10px; align-items: center; }
.stat .i { grid-row: span 2; width: 20px; height: 20px; color: var(--accent-2); }
.stat b { font-size: 20px; line-height: 1.1; }
.stat span { font-size: 11px; color: var(--muted); }

.current-card { display: flex; align-items: center; gap: 16px; padding: 12px; }
.current-card .cover { width: 150px; aspect-ratio: 16/9; border-radius: 8px; background: #000 no-repeat; background-size: auto 100%; flex: none; }
.current-card .cc-info { flex: 1; min-width: 0; }
.current-card .cc-label { font-size: 11px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); font-weight: 700; }
.current-card .cc-name { font-weight: 700; font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.current-card .cc-meta { display: flex; gap: 12px; flex-wrap: wrap; font-size: 12px; color: var(--muted); margin-top: 4px; }
.current-card .cc-meta span { display: inline-flex; align-items: center; gap: 4px; }
.current-card .cc-meta .i { width: 13px; height: 13px; }
.current-card .cc-actions { display: flex; gap: 8px; }
.current-card.empty { color: var(--muted); justify-content: center; font-size: 13px; padding: 16px; }

.dash-actions { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: 16px; }
.action-card { display: flex; flex-direction: column; gap: 14px; }
.ac-head { display: flex; gap: 12px; align-items: center; }
.ac-head h2 { margin: 0; font-size: 16px; }
.ac-head p { margin: 2px 0 0; font-size: 13px; }
.ac-icon { width: 42px; height: 42px; border-radius: 12px; background: #241d45; color: var(--accent-2); display: grid; place-items: center; flex: none; }
.ac-icon.hot { background: #3a1726; color: var(--hot); }
.ac-icon .i { width: 21px; height: 21px; }
.feature-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 9px; flex: 1; font-size: 13px; }
.feature-list li { display: flex; gap: 8px; align-items: flex-start; }
.feature-list .i { color: var(--ok); margin-top: 2px; }
.auto-form { display: flex; flex-direction: column; gap: 4px; }
.auto-form .field { margin-bottom: 8px; }
.auto-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.seg { display: flex; background: #0f1117; border: 1px solid var(--line); border-radius: 9px; padding: 3px; gap: 2px; }
.seg button {
  flex: 1; background: none; border: 0; border-radius: 7px; padding: 6px 6px; cursor: pointer; font-size: 12px; color: var(--muted);
  display: inline-flex; align-items: center; justify-content: center; gap: 5px; white-space: nowrap;
}
.seg button .i { width: 14px; height: 14px; }
.seg button:hover { color: var(--text); }
.seg button.on { background: var(--accent); color: #fff; font-weight: 600; }
.auto-buttons { display: flex; gap: 8px; margin-top: 6px; flex-wrap: wrap; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; margin-top: 8px; }
.section-head h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); margin: 0; }
.recent-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.recent-grid:empty::after, .exp-grid:empty::after { content: attr(data-empty); color: var(--muted); font-size: 13px; }
.exp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.exp-card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.exp-card video { width: 100%; aspect-ratio: 9/12; object-fit: contain; background: #000; display: block; }
.exp-card .info { padding: 7px 9px; display: flex; align-items: center; gap: 6px; }
.exp-card .t { flex: 1; min-width: 0; font-size: 12px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lib-card .acts { display: flex; gap: 6px; padding: 0 10px 10px; }
.lib-card .acts .btn { flex: 1; justify-content: center; }
.lib-card .badges { display: flex; gap: 4px; margin-top: 4px; }
.pill { font-size: 10px; border: 1px solid var(--line); border-radius: 5px; padding: 1px 5px; color: var(--muted); display: inline-flex; gap: 3px; align-items: center; }
.pill .i { width: 11px; height: 11px; }
.head-btns { display: flex; gap: 6px; }
.dlg-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.dlg-head h2 { margin: 0; }

.editor { flex: 1; display: grid; grid-template-columns: minmax(0, 1fr) 360px; min-height: 0; }
.stage-col { display: flex; flex-direction: column; min-width: 0; min-height: 0; padding: 12px; gap: 10px; }
.stage {
  position: relative; flex: 1; min-height: 160px; background: #000; border-radius: var(--radius);
  overflow: hidden; border: 1px solid var(--line);
}
.stage video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.stage-msg {
  position: absolute; left: 50%; top: 14px; transform: translateX(-50%);
  background: rgba(0,0,0,.7); padding: 6px 12px; border-radius: 20px; font-size: 12px;
}

/* marco de recorte */
.crop-layer { position: absolute; pointer-events: none; z-index: 2; }
.stage-msg { z-index: 3; }
.crop-frame {
  position: absolute; border: 2px solid #fff; border-radius: 4px; pointer-events: auto; cursor: grab;
  box-shadow: 0 0 0 9999px rgba(0,0,0,.55);
}
.crop-frame::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background:
    linear-gradient(to right, transparent calc(33.33% - .5px), rgba(255,255,255,.25) 33.33%, transparent calc(33.33% + .5px),
      transparent calc(66.66% - .5px), rgba(255,255,255,.25) 66.66%, transparent calc(66.66% + .5px)),
    linear-gradient(to bottom, transparent calc(33.33% - .5px), rgba(255,255,255,.25) 33.33%, transparent calc(33.33% + .5px),
      transparent calc(66.66% - .5px), rgba(255,255,255,.25) 66.66%, transparent calc(66.66% + .5px));
}
.crop-frame.static::before { display: none; }
.crop-frame.dragging { cursor: grabbing; border-color: var(--accent-2); }
.crop-frame.static { cursor: default; box-shadow: none; border-style: dashed; border-color: rgba(255,255,255,.5); }
.crop-label {
  position: absolute; top: 6px; left: 6px; background: rgba(0,0,0,.65); font-size: 11px; font-weight: 700;
  padding: 2px 7px; border-radius: 6px;
}
.title-preview {
  position: absolute; left: 6%; right: 6%; text-align: center; font-weight: 800; color: #fff;
  white-space: pre-wrap; line-height: 1.25; pointer-events: none;
}
.title-preview span { padding: .2em .45em; -webkit-box-decoration-break: clone; box-decoration-break: clone; }
.title-preview.box span { background: rgba(0,0,0,.6); }
.title-preview.outline span { -webkit-text-stroke: .06em #000; paint-order: stroke fill; }

.cap-preview {
  position: absolute; left: 8%; right: 8%; text-align: center; font-weight: 800; color: #fff; line-height: 1.2;
  pointer-events: none; font-family: "DejaVu Sans", system-ui, sans-serif;
  -webkit-text-stroke: .09em #000; paint-order: stroke fill; text-shadow: 0 .06em .08em rgba(0,0,0,.6);
}
.cap-preview .hl { display: inline-block; transform: scale(1.08); }

/* subtítulos (panel) */
.cap-row { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-bottom: 8px; }
.cap-row select { min-width: 0; font-size: 12px; }
.check.inline { margin: 0 0 0 4px; font-size: 12px; align-items: center; }
.check.inline input { margin-top: 0; }
.cap-hint { margin-top: 10px; }
.words {
  margin-top: 6px; max-height: 150px; overflow-y: auto; background: #0f1117; border: 1px solid var(--line);
  border-radius: 8px; padding: 8px; line-height: 1.9; font-size: 13px;
}
.words:empty::after { content: "No hay palabras dentro de este clip."; color: var(--muted); font-size: 12px; }
.words .w { padding: 1px 3px; border-radius: 4px; cursor: text; }
.words .w:hover { background: #262a36; }
.words .w.now { background: var(--accent); color: #fff; }
.words .w[contenteditable=true] { background: #fff; color: #000; outline: 2px solid var(--accent); }
#bRetranscribe { margin-top: 8px; }

/* transporte */
.transport { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.tc { font: 600 15px ui-monospace, monospace; min-width: 170px; }
.transport-btns { display: flex; align-items: center; gap: 4px; }
.transport-btns select { margin-left: 6px; padding: 4px 6px; }
.mark-btns { display: flex; gap: 6px; margin-left: auto; flex-wrap: wrap; }
.btn.mark.on { border-color: var(--ok); color: var(--ok); }

/* timeline */
.timeline-wrap { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 10px 10px; flex-shrink: 0; }
.timeline-tools { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.timeline-tools input[type=range] { width: 140px; }
.spacer { flex: 1; }
.timeline { overflow-x: auto; overflow-y: hidden; border-radius: 6px; cursor: pointer; user-select: none; scrollbar-width: thin; }
.tl-inner { position: relative; height: 150px; min-width: 100%; overflow: hidden; }
.ruler { position: absolute; left: 0; right: 0; top: 0; height: 18px; border-bottom: 1px solid var(--line); }
.ruler .tick { position: absolute; top: 0; height: 100%; border-left: 1px solid #3a3f50; font: 10px ui-monospace, monospace; color: var(--muted); padding-left: 3px; }
.ruler .tick.minor { height: 5px; top: auto; bottom: 0; }
.track-thumbs { position: absolute; left: 0; right: 0; top: 20px; height: 54px; background: #0b0c10; overflow: hidden; display: flex; }
.track-thumbs .th { flex: none; height: 100%; background-repeat: no-repeat; border-right: 1px solid rgba(0,0,0,.6); opacity: .85; }
.track-wave { position: absolute; left: 0; right: 0; top: 76px; height: 34px; background: #0b0c10 center / 100% 100% no-repeat; opacity: .55; }
.track-clips { position: absolute; left: 0; right: 0; top: 114px; height: 32px; }
.tclip {
  position: absolute; top: 0; height: 100%; border-radius: 6px; background: var(--c, var(--accent));
  opacity: .8; display: flex; align-items: center; overflow: hidden; font-size: 11px; font-weight: 600; color: #fff;
  padding: 0 10px; white-space: nowrap; cursor: pointer; border: 2px solid transparent;
}
.tclip:hover { opacity: 1; }
.tclip.sel { opacity: 1; border-color: #fff; z-index: 2; }
.tclip .h { position: absolute; top: 0; bottom: 0; width: 8px; cursor: ew-resize; background: rgba(255,255,255,.25); }
.tclip .h.l { left: 0; } .tclip .h.r { right: 0; }
.tclip.sel .h { background: rgba(255,255,255,.7); }
.sel-band { position: absolute; top: 20px; bottom: 36px; background: rgba(255,255,255,.07); border-left: 1px solid rgba(255,255,255,.4); border-right: 1px solid rgba(255,255,255,.4); pointer-events: none; }
.draft { position: absolute; top: 20px; bottom: 0; background: rgba(61,220,151,.15); border-left: 2px solid var(--ok); pointer-events: none; }
.draft.closed { border-right: 2px solid var(--ok); }
.playhead { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--hot); pointer-events: none; z-index: 5; }
.ph-knob { position: absolute; top: 0; left: -6px; width: 14px; height: 12px; background: var(--hot); clip-path: polygon(0 0, 100% 0, 50% 100%); }

/* side */
.side { border-left: 1px solid var(--line); background: var(--panel); display: flex; flex-direction: column; min-height: 0; }
.panel { padding: 12px 14px; border-bottom: 1px solid var(--line); }
.panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.panel h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); margin: 0; display: flex; align-items: center; gap: 8px; }
.count { background: var(--panel-2); border-radius: 10px; padding: 0 7px; color: var(--text); font-size: 11px; }
.clips-panel { max-height: 30%; display: flex; flex-direction: column; min-height: 120px; }
.clip-list { overflow-y: auto; display: flex; flex-direction: column; gap: 4px; }
.clip-list:empty::after { content: "Aún no hay clips. Marca entrada (I) y salida (O)."; color: var(--muted); font-size: 12px; padding: 8px 0; }
.citem {
  display: grid; grid-template-columns: 6px 1fr auto; gap: 10px; align-items: center; padding: 7px 8px;
  border-radius: 8px; cursor: pointer; border: 1px solid transparent;
}
.citem:hover { background: var(--panel-2); }
.citem.sel { background: #221d3d; border-color: #4d3aa8; }
.citem .sw { width: 6px; height: 28px; border-radius: 3px; background: var(--c); }
.citem .nm { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.citem .meta { font-size: 11px; color: var(--muted); }
.citem .tag { font-size: 10px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 5px; padding: 1px 5px; color: var(--muted); }

.inspector { flex: 1; overflow-y: auto; min-height: 0; }
.insp-empty { color: var(--muted); font-size: 13px; padding: 10px 0; }
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; }
.field > span { font-size: 12px; color: var(--muted); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.field.tight { margin-bottom: 4px; }
.tcbox { display: flex; gap: 3px; align-items: center; }
.tcin { font: 13px ui-monospace, monospace; text-align: center; padding: 5px 4px; }
.dur-line { display: flex; justify-content: space-between; align-items: center; margin: 4px 0 14px; font: 600 13px ui-monospace, monospace; }
.chips { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; }
.chips button {
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 7px; padding: 5px 10px; cursor: pointer; font-size: 12px;
}
.chips button:hover { border-color: #4a4f63; }
.chips button.on { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.chips.small { margin-top: 6px; }
.chips input[type=color] { width: 34px; height: 28px; border: 1px solid var(--line); border-radius: 7px; background: none; padding: 2px; cursor: pointer; }
.slider { display: grid; grid-template-columns: 80px 1fr 42px; gap: 8px; align-items: center; font-size: 12px; color: var(--muted); margin-top: 6px; }
.slider output { font: 12px ui-monospace, monospace; color: var(--text); text-align: right; }
.slider .link { text-align: right; }
details.more { border-top: 1px solid var(--line); padding: 10px 0; }
details.more summary { cursor: pointer; font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; font-weight: 600; margin-bottom: 4px; }
.check { display: flex; gap: 8px; align-items: flex-start; font-size: 13px; margin: 8px 0; cursor: pointer; }
.check input { accent-color: var(--accent); margin-top: 3px; }
.lossless { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; background: #12141a; }
.lossless em { font-size: 11px; }
.insp-body.lossless-on .lossy { opacity: .35; pointer-events: none; }

.export-panel { border-bottom: 0; border-top: 1px solid var(--line); background: #13151b; }
.export-row { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.export-row select { flex: 1; }
.progress .bar, .upload-overlay .bar { height: 6px; background: #252936; border-radius: 4px; overflow: hidden; margin: 6px 0 4px; }
.progress .bar div, .upload-overlay .bar div { height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), var(--hot)); transition: width .2s; }

/* modales */
.modal {
  background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 14px;
  padding: 20px 22px; width: min(520px, 92vw);
}
.modal.wide { width: min(860px, 94vw); }
.modal::backdrop { background: rgba(5,6,10,.7); backdrop-filter: blur(2px); }
.modal h2 { margin: 0 0 8px; font-size: 18px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.lib-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; max-height: 60vh; overflow-y: auto; }
.lib-card { background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; cursor: pointer; position: relative; }
.lib-card:hover { border-color: var(--accent); }
.lib-card .cover { aspect-ratio: 16/9; background: #000 no-repeat; background-size: auto 100%; }
.lib-card .info { padding: 8px 10px; }
.lib-card .t { font-weight: 600; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lib-card .s { font-size: 11px; color: var(--muted); }
.lib-card .del { position: absolute; top: 6px; right: 6px; background: rgba(0,0,0,.7); opacity: 0; }
.lib-card:hover .del { opacity: 1; }
.exp-list { display: flex; flex-direction: column; gap: 6px; max-height: 60vh; overflow-y: auto; }
.exp-item { display: grid; grid-template-columns: 120px 1fr auto; gap: 12px; align-items: center; background: var(--panel-2); border-radius: 10px; padding: 8px; }
.exp-item video { width: 120px; height: 68px; object-fit: contain; background: #000; border-radius: 6px; }
.exp-item .t { font-weight: 600; word-break: break-all; }
.exp-item .acts { display: flex; gap: 6px; }
.empty-note { color: var(--muted); padding: 20px 0; text-align: center; }
table.keys { width: 100%; border-collapse: collapse; }
table.keys td { padding: 5px 4px; border-bottom: 1px solid var(--line); font-size: 13px; }
table.keys td:first-child { white-space: nowrap; width: 45%; }
#urlForm input { margin-top: 8px; }

.toast {
  position: fixed; bottom: 22px; left: 50%; transform: translate(-50%, 20px); opacity: 0;
  background: #262a36; border: 1px solid #3a3f50; padding: 10px 16px; border-radius: 10px; pointer-events: none;
  transition: all .2s; z-index: 50; max-width: 80vw;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.err { border-color: #8a2a44; background: #2c1720; }
.upload-overlay { position: fixed; inset: 0; background: rgba(5,6,10,.8); display: grid; place-items: center; z-index: 40; text-align: center; }
.upload-overlay > div { width: 320px; }
.spinner { width: 36px; height: 36px; border: 3px solid #333; border-top-color: var(--accent); border-radius: 50%; margin: 0 auto 12px; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 1100px) {
  .dash-top, .dash-actions { grid-template-columns: 1fr; }
}
@media (max-width: 980px) {
  body { overflow: auto; }
  .shell { grid-template-columns: 60px minmax(0, 1fr); }
  .nav-item span:not(.badge) { display: none; }
  .auto-grid { grid-template-columns: 1fr; }
  .current-card { flex-wrap: wrap; }
  .editor { grid-template-columns: 1fr; }
  .stage { min-height: 260px; }
  .stage-row { flex: none; flex-direction: column; align-items: center; }
  .stage-row .stage { width: 100%; flex: none; height: 260px; }
  .preview-pane { flex: none; }
  main.view-editor { display: block; overflow-y: auto; }
  main.view-editor .editor { min-height: 100%; }
  .stage-col { min-height: auto; }
  .side { min-height: auto; }
  .clips-panel { max-height: 260px; }
  .inspector { overflow: visible; }
  .side { border-left: 0; border-top: 1px solid var(--line); }
  .top-actions .btn { padding: 6px 8px; }
  .media-name { display: none; }
}

/* ---------- extras iconos */
.toast { display: flex; align-items: center; gap: 8px; }
.toast .i { color: var(--ok); }
.toast.err .i { color: var(--hot); }
.ok-msg { display: inline-flex; align-items: center; gap: 4px; color: var(--ok); }
.btn .i { width: 15px; height: 15px; }
.btn.small .i { width: 13px; height: 13px; }
#dlgAuto .auto-form { margin-top: 4px; }

/* ---------- fuentes de clips */
@font-face { font-family: "Anton"; src: url(fonts/Anton-Regular.ttf); font-display: block; }
@font-face { font-family: "Montserrat Black"; src: url(fonts/Montserrat-Black.ttf); font-display: block; }
@font-face { font-family: "Montserrat ExtraBold"; src: url(fonts/Montserrat-ExtraBold.ttf); font-display: block; }

/* ---------- escenario: original + resultado */
.stage-row { flex: 1; min-height: 160px; display: flex; gap: 10px; }
.stage-row .stage { flex: 1; min-width: 0; }
.preview-pane {
  position: relative; flex: none; height: 100%; background: #050608; border: 1px solid var(--line);
  border-radius: var(--radius); display: grid; place-items: center; overflow: hidden;
}
.preview-pane canvas { display: block; max-width: 100%; max-height: 100%; cursor: crosshair; }
.pane-label {
  position: absolute; top: 8px; left: 8px; z-index: 4; font-size: 10px; font-weight: 700; letter-spacing: .6px;
  text-transform: uppercase; background: rgba(0,0,0,.6); color: #cfd2e0; padding: 2px 7px; border-radius: 5px; pointer-events: none;
}
.zoom-badge {
  position: absolute; top: 8px; right: 8px; display: inline-flex; gap: 4px; align-items: center; font-size: 11px; font-weight: 700;
  background: var(--hot); color: #fff; padding: 2px 8px; border-radius: 6px; pointer-events: none;
}
.zoom-badge .i { width: 12px; height: 12px; }
.crop-frame.split-frame, .crop-frame.split-top { box-shadow: none; border-width: 2px; }
.crop-frame.split-top { border-color: #4cc3ff; }
.crop-frame.split-frame { border-color: #ffb547; }
.crop-frame.split-top .crop-label { background: #4cc3ff; color: #000; }
.crop-frame.split-frame .crop-label { background: #ffb547; color: #000; }

/* ---------- inspector: piezas nuevas */
.hint { margin: 2px 0 8px; }
.field-inline { display: flex; align-items: center; gap: 8px; margin-top: 8px; font-size: 12px; color: var(--muted); flex-wrap: wrap; }
.field-inline > label:first-child { width: 72px; }
.field-inline select { flex: 1; min-width: 0; font-size: 12px; padding: 5px 6px; }
.field-inline.colors span { display: inline-flex; align-items: center; gap: 4px; }
.field-inline input[type=color] { width: 30px; height: 24px; border: 1px solid var(--line); border-radius: 6px; background: none; padding: 1px; cursor: pointer; }
textarea#fTitle {
  width: 100%; resize: vertical; background: #0f1117; border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px;
  font: inherit; color: inherit; outline: none; margin-bottom: 6px;
}
textarea#fTitle:focus { border-color: var(--accent); }
.zoom-list { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.zoom-item { background: #12141a; border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; }
.zoom-item.now { border-color: var(--hot); }
.zoom-item .zi-head { display: flex; align-items: center; gap: 6px; font-size: 12px; }
.zoom-item .zi-head b { cursor: pointer; font: 600 12px ui-monospace, monospace; }
.zoom-item .zi-head .seg { flex: 1; padding: 2px; }
.zoom-item .zi-head .seg button { padding: 3px 4px; font-size: 11px; }
.zoom-item .slider { margin-top: 4px; grid-template-columns: 62px 1fr 38px; }
.tzoom { position: absolute; top: -4px; width: 8px; height: 8px; background: var(--hot); transform: translateX(-4px) rotate(45deg); border: 1px solid #fff; z-index: 3; pointer-events: none; }
.section-dl { margin-top: 10px; }
.section-dl .field { margin: 0; }

/* ---------- reproductor de vista previa */
.modal.player { width: auto; max-width: 96vw; padding: 16px 18px; }
.pl-head { display: flex; flex-direction: column; min-width: 0; }
.pl-head h2 { font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 60vw; }
.pl-body { display: flex; align-items: center; justify-content: center; gap: 12px; }
.pl-nav { width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line); background: var(--panel-2); }
.pl-nav:disabled { opacity: .3; cursor: default; }
.phone { position: relative; border-radius: 14px; overflow: hidden; background: #000; box-shadow: 0 0 0 1px #2a2e3a, 0 20px 50px rgba(0,0,0,.5); line-height: 0; }
.phone.vertical { border-radius: 26px; box-shadow: 0 0 0 8px #15171e, 0 0 0 9px #2f3342, 0 24px 60px rgba(0,0,0,.6); margin: 10px; }
.phone canvas { display: block; cursor: pointer; }
.guides { position: absolute; inset: 0; pointer-events: none; line-height: 1.3; }
.guides > div { position: absolute; background: repeating-linear-gradient(45deg, rgba(255,92,138,.22) 0 8px, rgba(255,92,138,.08) 8px 16px); outline: 1px dashed rgba(255,92,138,.8); }
.guides .g-top { left: 0; right: 0; top: 0; height: 9%; }
.guides .g-right { right: 0; width: 15%; top: 38%; height: 44%; }
.guides .g-bottom { left: 0; right: 0; bottom: 0; height: 19%; display: flex; align-items: flex-end; justify-content: center; }
.guides .g-bottom span { font-size: 10px; color: #fff; background: rgba(0,0,0,.6); padding: 2px 6px; border-radius: 4px; margin-bottom: 6px; }
.guides:not(.vertical) .g-right { display: none; }
.phone { flex: none; }
.pl-controls { display: flex; align-items: center; gap: 10px 12px; margin-top: 12px; flex-wrap: wrap; }
.pl-controls input[type=range] { flex: 1 1 140px; min-width: 100px; }
.pl-controls .tc { flex: none; min-width: 0; font-size: 13px; white-space: nowrap; }
.pl-controls .icon.play { flex: none; }

/* lista de clips con miniatura reencuadrada */
.citem { grid-template-columns: 4px auto 1fr auto; }
.citem .sw { height: 44px; }
.cthumb { border-radius: 5px; background: #000; display: block; box-shadow: 0 0 0 1px #2a2e3a; }
.citem .cinfo { min-width: 0; display: flex; flex-direction: column; gap: 2px; align-items: flex-start; }
.citem .cinfo .nm { max-width: 100%; }
.cplay { color: var(--accent-2); }
.cplay:hover { background: #221d3d; }

/* ---------- efectos */
.sfx-grid { display: flex; flex-wrap: wrap; gap: 5px; }
.sfx-chip { display: inline-flex; border: 1px solid var(--line); border-radius: 7px; overflow: hidden; background: var(--panel-2); }
.sfx-chip button { background: none; border: 0; padding: 5px 8px; font-size: 12px; cursor: pointer; display: inline-flex; align-items: center; gap: 4px; }
.sfx-chip button:hover { background: #2b2f3d; }
.sfx-chip .listen { border-left: 1px solid var(--line); color: var(--muted); padding: 5px 6px; }
.sfx-chip .i { width: 12px; height: 12px; }
.sfx-list { display: flex; flex-direction: column; gap: 4px; margin-top: 8px; }
.sfx-item { display: grid; grid-template-columns: auto 1fr 70px auto; gap: 8px; align-items: center; font-size: 12px; background: #12141a; border: 1px solid var(--line); border-radius: 7px; padding: 4px 6px; }
.sfx-item b { font: 600 12px ui-monospace, monospace; cursor: pointer; color: var(--accent-2); }
.sfx-item input[type=range] { width: 70px; }
.zi-fx { display: flex; gap: 6px; align-items: center; margin-top: 5px; flex-wrap: wrap; font-size: 11px; }
.zi-fx .tg { background: var(--panel-2); border: 1px solid var(--line); border-radius: 6px; padding: 2px 7px; cursor: pointer; font-size: 11px; color: var(--muted); }
.zi-fx .tg.on { background: var(--hot); border-color: var(--hot); color: #fff; }
.zi-fx select { font-size: 11px; padding: 2px 4px; flex: 1; min-width: 0; }
.tsfx { position: absolute; bottom: -5px; width: 8px; height: 8px; border-radius: 50%; background: var(--warn); border: 1px solid #000; transform: translateX(-4px); z-index: 3; pointer-events: none; }
.tgap { position: absolute; top: 0; bottom: 0; background: repeating-linear-gradient(45deg, rgba(0,0,0,.55) 0 4px, rgba(0,0,0,.25) 4px 8px); z-index: 2; pointer-events: none; }

/* ---------- tour guiado */
.tour-btn {
  background: linear-gradient(135deg, #7c5cff, #ff5c8a); border: 0; color: #fff; font-weight: 700;
  animation: tourPulse 2.2s ease-out infinite;
}
.tour-btn:hover { background: linear-gradient(135deg, #8d70ff, #ff7099); filter: brightness(1.05); }
.tour-btn.seen { animation: none; }
@keyframes tourPulse {
  0% { box-shadow: 0 0 0 0 rgba(255, 92, 138, .6); }
  70% { box-shadow: 0 0 0 12px rgba(255, 92, 138, 0); }
  100% { box-shadow: 0 0 0 0 rgba(255, 92, 138, 0); }
}
.tour-banner {
  display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-radius: 14px;
  background: linear-gradient(120deg, #2a1c55, #3b1730 70%); border: 1px solid #5b3fb5;
}
.tour-banner .tb-icon { width: 42px; height: 42px; border-radius: 12px; background: rgba(255,255,255,.1); display: grid; place-items: center; color: #fff; flex: none; }
.tour-banner .tb-icon .i { width: 22px; height: 22px; }
.tour-banner .tb-text { flex: 1; display: flex; flex-direction: column; gap: 2px; font-size: 13px; color: #d9d4f5; }
.tour-banner .tb-text b { color: #fff; font-size: 15px; }
.tour { position: fixed; inset: 0; z-index: 200; }
.tour-block { position: absolute; inset: 0; }
.tour-spot {
  position: fixed; border-radius: 12px; pointer-events: none;
  box-shadow: 0 0 0 9999px rgba(5, 6, 10, .74), 0 0 0 2px var(--accent-2), 0 0 24px 4px rgba(124, 92, 255, .55);
  transition: left .28s ease, top .28s ease, width .28s ease, height .28s ease;
}
.tour-spot.center { box-shadow: 0 0 0 9999px rgba(5, 6, 10, .74); }
.tour-card {
  position: fixed; width: min(360px, calc(100vw - 24px)); background: var(--panel); border: 1px solid #4d3aa8;
  border-radius: 14px; padding: 14px 16px 12px; box-shadow: 0 20px 50px rgba(0,0,0,.55); transition: left .28s ease, top .28s ease;
}
.tour-progress { height: 4px; background: #252936; border-radius: 3px; overflow: hidden; margin-bottom: 10px; }
.tour-progress div { height: 100%; background: linear-gradient(90deg, var(--accent), var(--hot)); transition: width .25s; }
.tour-meta { display: flex; align-items: center; gap: 8px; font-size: 11px; color: var(--muted); }
.tour-meta #tourClose { margin-left: auto; }
.tour-chapter { background: #221d3d; color: var(--accent-2); border-radius: 5px; padding: 1px 7px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; font-size: 10px; }
.tour-card h3 { margin: 6px 0 6px; font-size: 16px; }
.tour-body { font-size: 13px; line-height: 1.5; color: #d2d5e2; }
.tour-body ul { margin: 6px 0 0; padding-left: 18px; }
.tour-body li { margin: 3px 0; }
.tour-body p { margin: 0 0 6px; }
.tour-actions { display: flex; gap: 8px; align-items: center; margin-top: 12px; }
.tour-keys { margin-right: auto; }
@media (max-width: 980px) {
  .tour-btn span { display: none; }
  .tour-banner { flex-wrap: wrap; }
  .tour-keys { display: none; }
}
.view-title { overflow: hidden; text-overflow: ellipsis; min-width: 0; }

/* ---------- música y seguimiento */
.track-box { margin-top: 10px; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; background: #12141a; }
.track-box .check { margin: 0 0 6px; }
.track-box .progress { margin-top: 6px; }
.crop-frame.tracking { border-color: var(--ok); cursor: not-allowed; }
.crop-frame.tracking .crop-label { background: var(--ok); color: #000; }

/* ---------- cuentas */
main:not(.view-admin) .admin { display: none; }
main.view-admin .dash, main.view-admin .editor { display: none; }
.admin { flex: 1; overflow-y: auto; }
.auth { position: fixed; inset: 0; display: grid; place-items: center; padding: 16px; overflow-y: auto;
  background: radial-gradient(circle at 20% 10%, #2a1c55 0, transparent 45%), radial-gradient(circle at 90% 90%, #3b1730 0, transparent 40%), var(--bg); }
.auth-card { width: min(420px, 100%); background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 24px; box-shadow: 0 30px 70px rgba(0,0,0,.45); }
.auth-brand { display: flex; gap: 12px; align-items: center; margin-bottom: 18px; }
.auth-brand .rail-logo { margin: 0; color: #fff; }
.auth-brand b { display: block; font-size: 20px; }
.auth-brand div > span { font-size: 12px; color: var(--muted); }  /* solo el subtítulo, no el logo */
.auth-tabs { margin-bottom: 14px; }
.auth-form { display: flex; flex-direction: column; gap: 2px; }
.auth-form .field { margin-bottom: 14px; gap: 6px; }
.auth-form .field > span { font-size: 12.5px; }
.auth-form input { width: 100%; height: 42px; padding: 0 12px; font-size: 14px; }
.auth-form input:-webkit-autofill { box-shadow: 0 0 0 1000px #0f1117 inset; }
.auth-form .btn { margin-top: 4px; height: 42px; justify-content: center; font-size: 14px; }
.auth-form p { margin: 12px 0 0; line-height: 1.45; }
@media (max-width: 600px) { .auth-form input { font-size: 16px; } }  /* evita el zoom automático en iOS */
.auth-msg { margin-top: 12px; padding: 10px 12px; border-radius: 8px; font-size: 13px; background: #2c1720; border: 1px solid #8a2a44; }
.auth-msg.ok { background: #13261f; border-color: #2a7a57; }
.user-btn { margin-top: 4px; }
.avatar { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: 13px;
  background: linear-gradient(135deg, var(--accent), var(--hot)); color: #fff; text-transform: uppercase; }
.user-btn > span:not(.avatar):not(.badge) { max-width: 60px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-menu { position: fixed; left: 84px; bottom: 14px; width: 260px; background: var(--panel); border: 1px solid #3a3f50; border-radius: 12px;
  padding: 12px; z-index: 60; box-shadow: 0 18px 40px rgba(0,0,0,.5); display: flex; flex-direction: column; gap: 4px; }
.um-head { display: flex; flex-direction: column; margin-bottom: 6px; }
.um-usage { margin-bottom: 6px; }
.um-item { display: flex; align-items: center; gap: 8px; background: none; border: 0; padding: 8px; border-radius: 8px; cursor: pointer; text-align: left; font-size: 13px; }
.um-item:hover { background: var(--panel-2); }
.ubar { height: 6px; background: #252936; border-radius: 4px; overflow: hidden; margin: 4px 0; }
.ubar div { height: 100%; width: 0; background: var(--accent); border-radius: 4px; }
.ubar.warn div { background: var(--warn); }
.ubar.full div { background: var(--hot); }
.usage-card .uc-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 10px; }
.usage-card h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); margin: 0; }
.usage-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px 18px; }
.uitem { font-size: 12px; }
.uitem .ut { display: flex; justify-content: space-between; color: var(--muted); }
.uitem .ut b { color: var(--text); font-weight: 600; }
.expiring-card { border-color: #7a5a1c; background: linear-gradient(120deg, #2b2312, var(--panel) 70%); }
.ex-head { display: flex; gap: 12px; align-items: center; margin-bottom: 10px; }
.ex-head > .i { width: 26px; height: 26px; color: var(--warn); }
.ex-head b { display: block; font-size: 15px; }
.ex-head span { color: #d8cba8; }
.ex-list { display: flex; flex-direction: column; gap: 6px; max-height: 260px; overflow-y: auto; }
.ex-item { display: grid; grid-template-columns: auto 1fr auto auto; gap: 10px; align-items: center; background: rgba(0,0,0,.25); border-radius: 8px; padding: 6px 10px; font-size: 13px; }
.ex-item .k { font-size: 10px; text-transform: uppercase; letter-spacing: .5px; color: var(--warn); font-weight: 700; }
.ex-item .n { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ex-item .w { font-size: 12px; color: #f0c674; white-space: nowrap; }
.ex-item .a { display: flex; gap: 6px; }
.pill.warn { border-color: #7a5a1c; color: #f0c674; }

/* ---------- administración */
.admin-tabs { max-width: 640px; }
.admin-pane { display: flex; flex-direction: column; gap: 12px; }
.adm-table { width: 100%; border-collapse: collapse; font-size: 13px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.adm-table th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); padding: 10px; border-bottom: 1px solid var(--line); background: #13151b; }
.adm-table td { padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.adm-table tr:last-child td { border-bottom: 0; }
.adm-table .acts { display: flex; gap: 5px; flex-wrap: wrap; }
.st { font-size: 11px; padding: 2px 8px; border-radius: 10px; font-weight: 700; }
.st.active { background: #13261f; color: var(--ok); }
.st.pending { background: #2b2312; color: var(--warn); }
.st.disabled { background: #2c1720; color: var(--hot); }
.limits-form { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px 16px; margin: 10px 0; }
.limits-form label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }

.limits-form .def { font-size: 11px; color: #5d6274; }
.adm-group { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; }
.adm-group h3 { margin: 0 0 4px; font-size: 14px; }
.srv-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.srv-grid .stat b { font-size: 18px; }
.temp-pass { font: 700 20px ui-monospace, monospace; background: #0f1117; border: 1px solid var(--line); border-radius: 8px; padding: 12px; text-align: center; letter-spacing: 1px; user-select: all; }
@media (max-width: 980px) {
  .user-menu { left: 66px; }
  .adm-table { display: block; overflow-x: auto; }
}
