/* ---------- Tokens ---------- */
:root {
  color-scheme: light;
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #f0f2f5;
  --surface-3: #e6e9ee;
  --border: #e1e4ea;
  --border-strong: #c9ced7;
  --text: #191d24;
  --muted: #586170;
  --faint: #8790a0;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-soft: #e8effe;
  --on-primary: #ffffff;
  --rec: #e5484d;
  --rec-hover: #cf3a3f;
  --danger: #d92d20;
  --danger-soft: #fdecea;
  --success: #15803d;
  --warn: #9a5b00;
  --warn-soft: #fdf1dc;
  --overlay: rgba(14, 17, 22, 0.55);
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.06);
  --shadow: 0 1px 3px rgba(16, 24, 40, 0.1), 0 1px 2px rgba(16, 24, 40, 0.06);
  --shadow-lg: 0 12px 32px rgba(16, 24, 40, 0.18);
  --radius: 12px;
  --radius-sm: 8px;
  --sidebar-w: 248px;
  --font: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Roboto, Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #111318;
    --surface: #181b22;
    --surface-2: #20242d;
    --surface-3: #2a2f3a;
    --border: #2b303b;
    --border-strong: #3a4150;
    --text: #e8eaee;
    --muted: #a3abb9;
    --faint: #7a8392;
    --primary: #4c82f7;
    --primary-hover: #6a97fa;
    --primary-soft: #1d2a45;
    --danger-soft: #3a1d1c;
    --warn: #f0b45a;
    --warn-soft: #3a2b14;
    --overlay: rgba(0, 0, 0, 0.65);
    --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.5);
  }
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.45;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
img, video { display: block; max-width: 100%; }
h1, h2, h3 { margin: 0; line-height: 1.2; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
svg.icon { flex: none; }

/* ---------- Botones y campos ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 38px; padding: 0 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  font-weight: 600; font-size: 14px; white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s, box-shadow .15s;
}
.btn:hover { background: var(--surface-2); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn-rec { background: var(--rec); border-color: var(--rec); color: #fff; }
.btn-rec:hover { background: var(--rec-hover); border-color: var(--rec-hover); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { filter: brightness(.95); background: var(--danger); }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-ghost:hover { background: var(--surface-2); }
.btn-lg { height: 48px; font-size: 16px; padding: 0 20px; border-radius: 10px; }
.btn-block { width: 100%; }
.icon-btn {
  display: inline-grid; place-items: center; width: 36px; height: 36px; padding: 0;
  border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--muted);
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn.sm { width: 28px; height: 28px; }

.input, .select, .textarea {
  width: 100%; height: 40px; padding: 0 12px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
}
.textarea { height: auto; min-height: 80px; padding: 10px 12px; resize: vertical; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.field { display: grid; gap: 6px; font-size: 13px; font-weight: 600; color: var(--muted); }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; color: var(--text); cursor: pointer; }
.check input { margin-top: 3px; accent-color: var(--primary); }
.hint { margin: 0; font-size: 13px; color: var(--muted); }

/* ---------- Avatar ---------- */
.avatar {
  display: inline-grid; place-items: center; flex: none;
  width: 32px; height: 32px; border-radius: 50%;
  font-size: 12px; font-weight: 700; color: #fff; background: var(--avatar, #64748b);
}
.avatar.sm { width: 26px; height: 26px; font-size: 11px; }

/* ---------- Estructura general ---------- */
.layout { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 8px;
  padding: 16px 12px; background: var(--surface); border-right: 1px solid var(--border); overflow-y: auto;
}
.brand { display: inline-flex; align-items: center; gap: 10px; padding: 4px 8px 12px; font-size: 19px; font-weight: 750; letter-spacing: -.01em; }
.nav { display: grid; gap: 2px; }
.nav-item {
  display: flex; align-items: center; gap: 10px; width: 100%; min-height: 36px; padding: 6px 10px;
  border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--muted);
  font-size: 14px; font-weight: 550; text-align: left;
}
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item[aria-current="page"] { background: var(--primary-soft); color: var(--primary); }
.nav-item .label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-item .count-pill { font-size: 12px; color: var(--faint); }
.nav-section { margin-top: 14px; }
.nav-section-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 4px 6px 10px; font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--faint);
}
.nav-empty { padding: 4px 10px; font-size: 13px; color: var(--faint); }
.sidebar-foot { margin-top: auto; display: grid; gap: 8px; padding-top: 12px; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px;
  height: 64px; padding: 0 24px; background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px); border-bottom: 1px solid var(--border);
}
.topbar .spacer { flex: 1; }
.search {
  flex: 1; max-width: 640px; margin: 0 auto; display: flex; align-items: center; gap: 8px;
  height: 40px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--faint);
}
.search:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--text); }
.mobile-only { display: none; }

.page { width: 100%; max-width: 1480px; margin: 0 auto; padding: 28px 32px 64px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.crumb { font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 4px; }
.page-head h1 { font-size: 30px; font-weight: 750; letter-spacing: -.02em; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.tabs-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-top: 22px; border-bottom: 1px solid var(--border); }
.tabs { display: flex; gap: 4px; overflow-x: auto; }
.tabs button {
  padding: 10px 12px; border: 0; border-bottom: 2px solid transparent;
  background: transparent; color: var(--muted); font-weight: 600; white-space: nowrap;
}
.tabs button:hover { color: var(--text); }
.tabs button[aria-selected="true"] { color: var(--primary); border-bottom-color: var(--primary); }
.count { padding-bottom: 10px; font-size: 13px; color: var(--muted); white-space: nowrap; }
.toolbar { display: flex; justify-content: flex-end; gap: 8px; margin: 16px 0; }
.toolbar .select { width: auto; height: 36px; }

/* ---------- Grilla de videos ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 20px; }
.card {
  position: relative; display: flex; flex-direction: column; min-width: 0;
  border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border);
  box-shadow: var(--shadow-sm); overflow: hidden; transition: box-shadow .15s, transform .15s;
}
.card:hover { box-shadow: var(--shadow); transform: translateY(-1px); }
.thumb { position: relative; display: block; aspect-ratio: 16 / 9; background: var(--surface-3); overflow: hidden; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb-placeholder { display: grid; place-items: center; width: 100%; height: 100%; color: var(--faint); }
.badge {
  position: absolute; right: 8px; bottom: 8px; padding: 2px 7px; border-radius: 6px;
  background: rgba(10, 12, 16, .78); color: #fff; font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums;
}
.status-overlay {
  position: absolute; inset: 0; display: grid; place-items: center; align-content: center; gap: 8px;
  background: var(--overlay); color: #fff; font-size: 13px; font-weight: 600; text-align: center; padding: 12px;
}
.status-overlay.error { background: #9b2c24; }
.card-body { display: grid; gap: 8px; padding: 12px 14px 14px; }
.card-meta { display: flex; align-items: center; gap: 8px; min-width: 0; font-size: 12.5px; color: var(--muted); }
.card-meta .who { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-title {
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  font-size: 15px; font-weight: 650; line-height: 1.35; min-height: 2.7em;
}
.card-title:hover { color: var(--primary); }
.card-match {
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
  margin: 0; font-size: 13px; line-height: 1.45; color: var(--muted);
}
.card-match mark, .transcript-line mark { border-radius: 3px; background: color-mix(in srgb, #f5c400 45%, transparent); color: inherit; }
.stats { display: flex; gap: 14px; font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.stats span { display: inline-flex; align-items: center; gap: 5px; }
.card-menu-btn {
  position: absolute; top: 8px; right: 8px; width: 32px; height: 32px; border-radius: 8px;
  background: rgba(10, 12, 16, .62); color: #fff; opacity: 0; transition: opacity .15s;
}
.card-menu-btn:hover { background: rgba(10, 12, 16, .85); color: #fff; }
.card:hover .card-menu-btn, .card-menu-btn:focus-visible, .card-menu-btn[aria-expanded="true"] { opacity: 1; }
@media (hover: none) { .card-menu-btn { opacity: 1; } }

.empty {
  display: grid; justify-items: center; gap: 10px; padding: 72px 16px; text-align: center; color: var(--muted);
  border: 1.5px dashed var(--border-strong); border-radius: var(--radius); background: var(--surface);
}
.empty h2 { font-size: 18px; color: var(--text); }
.empty p { margin: 0; max-width: 420px; }
.empty .empty-icon { display: grid; place-items: center; width: 56px; height: 56px; border-radius: 16px; background: var(--primary-soft); color: var(--primary); }

.skeleton { border-radius: var(--radius); background: linear-gradient(90deg, var(--surface-2), var(--surface-3), var(--surface-2)); background-size: 200% 100%; animation: shimmer 1.2s infinite linear; aspect-ratio: 4 / 3.4; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------- Menús desplegables ---------- */
.dropdown { position: relative; }
.menu {
  position: absolute; z-index: 50; top: calc(100% + 6px); right: 0; min-width: 230px; padding: 6px;
  border-radius: 10px; border: 1px solid var(--border); background: var(--surface); box-shadow: var(--shadow-lg);
}
.menu.floating { position: fixed; top: auto; right: auto; }
.menu [role="menuitem"] {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border: 0; border-radius: 6px;
  background: transparent; color: var(--text); font-size: 14px; text-align: left;
}
.menu [role="menuitem"]:hover, .menu [role="menuitem"]:focus-visible { background: var(--surface-2); outline: none; }
.menu [role="menuitem"].danger { color: var(--danger); }
.menu hr { margin: 6px 4px; border: 0; border-top: 1px solid var(--border); }

/* ---------- Diálogos ---------- */
dialog.modal {
  width: min(440px, calc(100vw - 32px)); padding: 0; border: 1px solid var(--border); border-radius: 14px;
  background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg);
}
dialog.modal::backdrop { background: var(--overlay); }
.modal form { display: grid; gap: 16px; padding: 22px; }
.modal h2 { font-size: 18px; }
.modal p { margin: 0; color: var(--muted); }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }
.modal .logout { justify-self: start; }
.field .hint { font-weight: 400; }

/* ---------- Avisos ---------- */
.toasts { position: fixed; z-index: 100; left: 50%; bottom: 24px; transform: translateX(-50%); display: grid; gap: 8px; width: min(440px, calc(100vw - 32px)); }
.toast {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 10px;
  background: #1f2430; color: #fff; box-shadow: var(--shadow-lg); font-size: 14px; animation: toast-in .2s ease-out;
}
.toast.error { background: #a3221b; }
.toast .toast-text { flex: 1; }
.toast .progress { flex: 1 0 100%; }
.toast-wrap { flex-wrap: wrap; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

.progress { height: 8px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.toast .progress { background: rgba(255, 255, 255, .2); height: 6px; }
.progress > span { display: block; height: 100%; width: 0; border-radius: inherit; background: var(--primary); transition: width .2s; }

.spinner { width: 22px; height: 22px; border-radius: 50%; border: 3px solid rgba(255, 255, 255, .35); border-top-color: #fff; animation: spin .8s linear infinite; }
.spinner.dark { border-color: var(--surface-3); border-top-color: var(--primary); }
@keyframes spin { to { transform: rotate(360deg); } }

.drop-overlay {
  position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; pointer-events: none;
  background: color-mix(in srgb, var(--primary) 18%, transparent); border: 3px dashed var(--primary);
  font-size: 22px; font-weight: 700; color: var(--primary);
}

/* ---------- Página de video ---------- */
.watch-topbar { padding: 0 20px; }
.watch-topbar .brand { padding: 0 8px 0 0; }
.watch { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 28px; width: 100%; max-width: 1480px; margin: 0 auto; padding: 24px; }
.player {
  position: relative; display: grid; place-items: center; aspect-ratio: 16 / 9; border-radius: var(--radius);
  background: #0b0d11; overflow: hidden; box-shadow: var(--shadow);
}
.player video, .player img { width: 100%; height: 100%; object-fit: contain; background: #0b0d11; }
.player .status-overlay { position: static; background: transparent; font-size: 15px; }
.timeline { position: relative; height: 26px; margin: 10px 4px 0; }
.timeline::before { content: ""; position: absolute; left: 0; right: 0; top: 12px; height: 2px; border-radius: 2px; background: var(--surface-3); }
.timeline .playhead { position: absolute; top: 12px; left: 0; height: 2px; background: var(--primary); border-radius: 2px; }
.marker {
  position: absolute; top: 0; transform: translateX(-50%); display: grid; place-items: center;
  width: 24px; height: 24px; padding: 0; border: 0; border-radius: 50%; background: var(--surface); box-shadow: var(--shadow);
  font-size: 13px; line-height: 1;
}
.marker.is-comment { color: #fff; font-size: 10px; font-weight: 700; background: var(--avatar, #64748b); z-index: 1; }
.marker:hover { transform: translateX(-50%) scale(1.15); z-index: 2; }
.player-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 8px; }
.speeds, .reactions { display: flex; gap: 4px; flex-wrap: wrap; }
.speeds button, .reactions button {
  height: 32px; min-width: 40px; padding: 0 8px; border-radius: 99px; border: 1px solid var(--border); background: var(--surface);
  font-size: 13px; font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums;
}
.speeds button[aria-pressed="true"] { background: var(--primary-soft); color: var(--primary); border-color: transparent; }
.reactions button { font-size: 16px; display: inline-flex; align-items: center; gap: 5px; }
.reactions button .n { font-size: 12px; color: var(--muted); }
.reactions button:hover, .speeds button:hover { border-color: var(--border-strong); }
.title-input {
  display: block; width: calc(100% + 12px); margin: 18px 0 6px -6px; padding: 4px 6px; border: 1px solid transparent; border-radius: 8px;
  background: transparent; font-size: 26px; font-weight: 750; line-height: 1.25; letter-spacing: -.015em;
  resize: none; overflow: hidden;
}
.title-input:hover { border-color: var(--border); }
.title-input:focus { outline: none; border-color: var(--primary); background: var(--surface); }
.watch-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; color: var(--muted); font-size: 14px; }
.watch-meta strong { color: var(--text); }
.pill {
  display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 9px; border-radius: 99px;
  background: var(--surface-2); color: var(--muted); font-size: 13px; font-weight: 600;
}
.pill.warn { background: var(--warn-soft); color: var(--warn); }

/* Editor: recortar y quitar silencios */
.btn-sm { height: 32px; padding: 0 10px; font-size: 13px; }
.btn[aria-pressed="true"] { background: var(--primary-soft); border-color: var(--primary); color: var(--primary); }
.edit-panel {
  display: grid; gap: 14px; margin-top: 14px; padding: 16px 18px; border-radius: var(--radius);
  border: 1px solid var(--border); background: var(--surface); box-shadow: var(--shadow-sm);
}
.edit-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.edit-head h2 { font-size: 17px; margin-bottom: 2px; }
.trim-track {
  position: relative; height: 44px; margin: 4px 10px; border-radius: 8px; cursor: pointer; touch-action: none;
  background: repeating-linear-gradient(135deg, var(--surface-3) 0 6px, var(--surface-2) 6px 12px);
}
.trim-keep { position: absolute; top: 0; bottom: 0; border-radius: 6px; background: var(--primary-soft); border: 2px solid var(--primary); }
.trim-cuts span {
  position: absolute; top: 8px; bottom: 8px; min-width: 2px; border-radius: 3px;
  background: repeating-linear-gradient(135deg, var(--rec) 0 3px, transparent 3px 6px); opacity: .7;
}
.trim-playhead {
  position: absolute; top: -6px; bottom: -6px; width: 3px; margin-left: -1.5px; border-radius: 2px; pointer-events: none;
  background: var(--text); box-shadow: 0 0 0 1.5px var(--surface); z-index: 1;
}
.trim-playhead::before {
  content: ""; position: absolute; top: -5px; left: 50%; width: 11px; height: 11px; margin-left: -5.5px; border-radius: 50%;
  background: var(--text); box-shadow: 0 0 0 1.5px var(--surface);
}
.trim-handle { z-index: 2; }
.trim-handle {
  position: absolute; top: -6px; bottom: -6px; width: 16px; margin-left: -8px; padding: 0; border: 0; border-radius: 6px;
  background: var(--primary); box-shadow: var(--shadow); cursor: ew-resize; touch-action: none;
}
.trim-handle::after { content: ""; position: absolute; inset: 14px 6px; border-left: 2px solid rgba(255, 255, 255, .8); border-right: 2px solid rgba(255, 255, 255, .8); }
.trim-handle:disabled { cursor: default; opacity: .6; }
.trim-fields { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.trim-field { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--muted); }
.trim-field strong { color: var(--text); font-variant-numeric: tabular-nums; }
.edit-option > span, .check-text { display: grid; gap: 2px; }
.edit-status { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); font-size: 14px; }
.edit-status .progress { flex: 1 0 100%; }
.edit-status.error { background: var(--danger-soft); color: var(--danger); }
.edit-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.edit-actions #edit-summary { margin-left: auto; }
.description {
  width: 100%; min-height: 64px; margin-top: 16px; padding: 10px 12px; border-radius: 10px;
  border: 1px solid transparent; background: var(--surface-2); resize: vertical; line-height: 1.5;
}
.description:hover { border-color: var(--border); }
.description:focus { outline: none; border-color: var(--primary); background: var(--surface); }

.side { display: flex; flex-direction: column; min-height: 0; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface); align-self: start; position: sticky; top: 88px; max-height: calc(100vh - 112px); }
.side-tabs { display: flex; gap: 4px; padding: 4px 8px 0; border-bottom: 1px solid var(--border); }
.side-tabs [role="tab"] {
  height: 44px; margin-bottom: -1px; padding: 0 10px; border: 0; border-bottom: 2px solid transparent;
  background: transparent; color: var(--muted); font-size: 14px; font-weight: 650;
}
.side-tabs [role="tab"]:hover { color: var(--text); }
.side-tabs [role="tab"][aria-selected="true"] { color: var(--text); border-bottom-color: var(--primary); }
.side-panel { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.transcript-tools { display: flex; gap: 4px; padding: 10px 10px 4px 12px; }
.transcript-tools .input { flex: 1; height: 36px; }
.transcript { position: relative; list-style: none; margin: 0; padding: 4px 8px 8px; overflow-y: auto; flex: 1; min-height: 0; }
.transcript:empty { display: none; }
.transcript-line {
  display: grid; grid-template-columns: auto 1fr; align-items: baseline; gap: 10px; padding: 7px 8px;
  border-radius: 8px; font-size: 14.5px; line-height: 1.5; cursor: pointer;
}
.transcript-line:hover { background: var(--surface-2); }
.transcript-line.is-current { background: var(--primary-soft); }
.transcript-state { display: grid; justify-items: center; gap: 12px; padding: 28px 18px; text-align: center; color: var(--muted); font-size: 14px; }
.transcript-state p { margin: 0; max-width: 300px; }
.transcript-state .error { color: var(--danger); }
.transcript-state .progress { width: 100%; max-width: 260px; }
.speeds-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.cc-btn {
  height: 32px; padding: 0 10px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface);
  color: var(--muted); font-size: 12px; font-weight: 800; letter-spacing: .04em;
}
.cc-btn:hover { border-color: var(--border-strong); }
.cc-btn[aria-pressed="true"] { background: var(--primary-soft); color: var(--primary); border-color: transparent; }
.comments { list-style: none; margin: 0; padding: 8px; overflow-y: auto; flex: 1; min-height: 120px; }
.comment { position: relative; display: grid; grid-template-columns: auto 1fr; gap: 10px; padding: 10px 8px; border-radius: 8px; }
.comment:hover { background: var(--surface-2); }
.comment-head { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; font-size: 13px; }
.comment-head strong { font-size: 14px; }
.comment-head time { color: var(--faint); }
.comment p { margin: 2px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.chip {
  display: inline-flex; align-items: center; height: 20px; padding: 0 7px; border: 0; border-radius: 99px;
  background: var(--primary-soft); color: var(--primary); font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums;
}
.comment .delete { position: absolute; top: 6px; right: 6px; opacity: 0; }
.comment:hover .delete, .comment .delete:focus-visible { opacity: 1; }
.comments-empty { padding: 24px 12px; text-align: center; color: var(--faint); font-size: 14px; }
.comment-form { display: grid; gap: 8px; padding: 12px; border-top: 1px solid var(--border); }
.comment-form .row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.comment-form .textarea { min-height: 64px; }
.not-found { display: grid; justify-items: center; gap: 14px; padding: 96px 16px; text-align: center; }

/* Lo que ve quien recibió el link: el video, sin nada para organizar ni editar. */
.viewer .owner-only { display: none !important; }
.viewer .title-input:hover, .viewer .title-input:focus { border-color: transparent; background: transparent; }
.viewer .description { resize: none; }
.viewer .description:hover, .viewer .description:focus { border-color: transparent; background: var(--surface-2); }

/* ---------- Entrar ---------- */
.login { display: grid; place-items: center; min-height: 100vh; padding: 24px 16px; }
.login-card {
  display: grid; gap: 16px; width: 100%; max-width: 380px; padding: 28px 24px; border-radius: var(--radius);
  border: 1px solid var(--border); background: var(--surface); box-shadow: var(--shadow);
}
.login-card .brand { margin-bottom: 4px; }
.login-card h1 { font-size: 22px; }
.login-error { margin: 0; padding: 10px 12px; border-radius: 8px; background: var(--danger-soft); color: var(--danger); font-size: 14px; }

/* ---------- Grabador ---------- */
.recorder { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 24px; width: 100%; max-width: 1400px; margin: 0 auto; padding: 24px; }
.stage {
  position: relative; display: grid; place-items: center; aspect-ratio: 16 / 9; border-radius: var(--radius);
  background: #0b0d11; overflow: hidden; color: #c5cad3; box-shadow: var(--shadow);
}
.stage video { width: 100%; height: 100%; object-fit: contain; }
.stage video.mirror { transform: scaleX(-1); }
.stage-empty { display: grid; justify-items: center; gap: 10px; padding: 24px; text-align: center; }
.stage-empty p { margin: 0; max-width: 360px; color: #9aa2af; }
.countdown {
  position: absolute; inset: 0; display: grid; place-items: center; background: rgba(0, 0, 0, .55);
  font-size: 120px; font-weight: 800; color: #fff; font-variant-numeric: tabular-nums;
}
.rec-indicator {
  position: absolute; top: 14px; left: 14px; display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 12px; border-radius: 99px; background: rgba(0, 0, 0, .65); color: #fff; font-weight: 700; font-variant-numeric: tabular-nums;
}
.rec-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--rec); animation: pulse 1.2s infinite; }
.paused .rec-dot { animation: none; background: #f5a524; }
@keyframes pulse { 50% { opacity: .35; } }
.panel { display: grid; gap: 18px; align-content: start; padding: 22px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface); }
.panel h1 { font-size: 22px; }
.segmented { display: grid; gap: 8px; margin: 0; padding: 0; border: 0; }
.segmented legend { margin-bottom: 6px; font-size: 13px; font-weight: 600; color: var(--muted); }
.segmented label {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 10px; border: 1.5px solid var(--border);
  cursor: pointer; font-weight: 600;
}
.segmented label:hover { border-color: var(--border-strong); }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented label:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); color: var(--primary); }
.segmented label:has(input:focus-visible) { outline: 2px solid var(--primary); outline-offset: 2px; }
.meter { height: 6px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.meter span { display: block; height: 100%; width: 0; background: var(--success); transition: width .08s; }
.rec-time { display: flex; align-items: center; justify-content: center; gap: 12px; font-size: 44px; font-weight: 750; font-variant-numeric: tabular-nums; }
.rec-time .rec-dot { width: 16px; height: 16px; }
.rec-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.rec-actions .btn-rec { grid-column: 1 / -1; }
.notice { padding: 10px 12px; border-radius: 8px; background: var(--surface-2); font-size: 13px; color: var(--muted); }
.notice.error { background: var(--danger-soft); color: var(--danger); }

/* ---------- Celular y tablet ---------- */
@media (max-width: 1100px) {
  .watch, .recorder { grid-template-columns: 1fr; }
  .side { position: static; max-height: none; }
  .transcript { max-height: 420px; }
}
@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; z-index: 60; inset: 0 auto 0 0; width: min(300px, 86vw);
    transform: translateX(-100%); transition: transform .2s; box-shadow: var(--shadow-lg);
  }
  .sidebar.open { transform: none; }
  .mobile-only { display: inline-grid; }
  .topbar { padding: 0 16px; }
  .page { padding: 20px 16px 48px; }
  .page-head h1 { font-size: 26px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr)); gap: 14px; }
  .watch, .recorder { padding: 16px; gap: 18px; }
  .watch-topbar .hide-sm { display: none; }
  .title-input { font-size: 21px; }
}
@media (max-width: 520px) {
  .tabs-row .count { display: none; }
  .page-actions { width: 100%; }
  .page-actions > * { flex: 1; }
  .page-actions .btn { width: 100%; }
}
