:root {
  --bg: #0b0e14; --panel: #141926; --field: #0e1320; --deep: #0a0d15;
  --line: rgba(255,255,255,.07); --line-2: rgba(255,255,255,.12);
  --ink: #e8eaf0; --dim: #8a93a6; --dim-2: #5c6478;
  --accent: #0f9d6c; --accent-2: #3fc596; --accent-soft: rgba(15,157,108,.15);
  --ok: #35c48b; --warn: #f0b429; --err: #ef5a5a;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --tabs-h: 60px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink); min-height: 100dvh;
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif;
  padding-bottom: calc(var(--tabs-h) + var(--safe-b));
}
h1 { font-size: 17px; margin: 0; letter-spacing: -.2px; font-weight: 600; }
h2 { font-size: 16px; margin: 0 0 12px; font-weight: 600; line-height: 1.3; }
h3 { font-size: 13px; margin: 18px 0 8px; color: var(--dim); text-transform: uppercase; letter-spacing: .06em; font-weight: 600; }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-2); }
p { margin: 0 0 10px; }
[hidden] { display: none !important; }
.hint { color: var(--dim); font-size: 13px; margin: 0; }
.hint--error { color: var(--err); }
.eyebrow { font-size: 12px; color: var(--dim); text-transform: uppercase; letter-spacing: .06em; }
.mono { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12px; }

/* ── Cabecera ── */
.top {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 16px; padding-top: calc(12px + env(safe-area-inset-top, 0px));
  background: rgba(11,14,20,.92); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand__mark {
  width: 28px; height: 28px; border-radius: 9px; background: var(--accent); color: #fff; font-size: 12px;
  display: inline-flex; align-items: center; justify-content: center; flex: none;
}
.brand--big { justify-content: center; margin-bottom: 22px; }
.brand--big .brand__mark { width: 40px; height: 40px; border-radius: 13px; font-size: 16px; }
.brand--big h1 { font-size: 22px; }
.top__right { display: flex; align-items: center; gap: 8px; }

/* ── Pestañas (abajo en el celular, arriba en el PC) ── */
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: grid; grid-template-columns: repeat(4, 1fr);
  height: calc(var(--tabs-h) + var(--safe-b)); padding-bottom: var(--safe-b);
  background: rgba(14,19,32,.96); backdrop-filter: blur(10px); border-top: 1px solid var(--line);
}
.tab {
  background: none; border: 0; color: var(--dim); font: inherit; font-size: 11px; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
}
.tab__ico { font-size: 18px; line-height: 1; }
.tab.is-active { color: var(--accent-2); }

/* ── Contenido ── */
.vista { padding: 16px; max-width: 1100px; margin: 0 auto; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 16px; }
.card + .card { margin-top: 12px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.row--between { justify-content: space-between; }
.grow { flex: 1 1 auto; min-width: 0; }
.vacio { text-align: center; color: var(--dim); padding: 40px 12px; }

/* ── Píldoras ── */
.pill {
  display: inline-flex; align-items: center; gap: 6px; font: inherit; font-size: 12px; font-weight: 500; white-space: nowrap;
  padding: 4px 10px; border-radius: 999px; border: 0; background: var(--accent-soft); color: var(--accent-2);
}
.pill--muted { background: rgba(255,255,255,.06); color: var(--dim); }
.pill--ok { background: rgba(53,196,139,.15); color: var(--ok); }
.pill--warn { background: rgba(240,180,41,.15); color: var(--warn); }
.pill--err { background: rgba(239,90,90,.15); color: var(--err); }
.pill--run::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: currentColor; animation: late 1.2s infinite; }
@keyframes late { 0%, 100% { opacity: .35; } 50% { opacity: 1; } }

/* ── Botones ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; font: inherit; font-size: 14px; font-weight: 500;
  padding: 10px 16px; border-radius: 12px; border: 1px solid var(--line-2); background: rgba(255,255,255,.05); color: var(--ink);
  cursor: pointer; min-height: 42px;
}
.btn:hover { background: rgba(255,255,255,.09); }
.btn:disabled { opacity: .5; cursor: default; }
.btn--primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn--primary:hover { background: var(--accent-2); border-color: var(--accent-2); }
.btn--danger { color: var(--err); border-color: rgba(239,90,90,.35); }
.btn--danger:hover { background: rgba(239,90,90,.12); }
.btn--ghost { border-color: transparent; background: none; color: var(--dim); }
.btn--icon { width: 40px; padding: 0; font-size: 18px; }
.btn--sm { min-height: 34px; padding: 6px 12px; font-size: 13px; border-radius: 10px; }
.btn--block { width: 100%; }

/* ── Formularios ── */
.field { display: flex; flex-direction: column; gap: 6px; margin: 0; }
.field__label { font-size: 13px; color: var(--dim); }
.field__label small { color: var(--dim-2); }
input, select, textarea {
  background: var(--field); border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 12px; color: var(--ink); font: inherit; font-size: 16px; width: 100%;
}
textarea { resize: vertical; min-height: 84px; line-height: 1.5; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.check { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--ink); cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--accent); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
details.mas { border-top: 1px solid var(--line); padding-top: 12px; }
details.mas summary { cursor: pointer; color: var(--dim); font-size: 13px; margin-bottom: 12px; }

/* ── Filtros y buscador ── */
.filtros { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 12px; scrollbar-width: none; }
.filtros::-webkit-scrollbar { display: none; }
.chip { flex: none; border: 1px solid var(--line-2); background: none; color: var(--dim); font: inherit; font-size: 13px; padding: 6px 12px; border-radius: 999px; cursor: pointer; }
.chip.is-active { background: var(--accent-soft); color: var(--accent-2); border-color: transparent; }
.buscar { margin-bottom: 12px; }

/* ── Lista de videos ── */
.vlist { display: grid; gap: 10px; }
.vcard {
  display: grid; grid-template-columns: 72px 1fr; gap: 12px; align-items: center; text-align: left;
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 10px; color: inherit; font: inherit; cursor: pointer;
}
.vcard:hover { border-color: var(--line-2); }
.vcard__thumb { width: 72px; height: 128px; border-radius: 10px; object-fit: cover; background: var(--deep); display: block; }
.vcard__thumb--vacio { display: flex; align-items: center; justify-content: center; color: var(--dim-2); font-size: 22px; }
.vcard__title { font-weight: 600; line-height: 1.3; margin-bottom: 6px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.vcard__sub { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 12px; color: var(--dim); }

/* ── Hoja de detalle: pantalla completa en el celular, cajón a la derecha en el PC ── */
.velo { position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 30; }
.hoja {
  position: fixed; inset: 0; z-index: 31; background: var(--bg); overflow-y: auto; -webkit-overflow-scrolling: touch;
  padding-bottom: calc(24px + var(--safe-b));
}
.hoja__top {
  position: sticky; top: 0; z-index: 2; display: flex; align-items: flex-start; gap: 10px; padding: 12px 16px;
  padding-top: calc(12px + env(safe-area-inset-top, 0px)); background: rgba(11,14,20,.95); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line);
}
.hoja__top h2 { margin: 2px 0 0; }
.hoja__body { padding: 16px; display: flex; flex-direction: column; gap: 14px; }
.player { width: 100%; max-height: 62dvh; background: #000; border-radius: 14px; aspect-ratio: 9 / 16; object-fit: contain; }
.meta { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; margin: 0; }
.meta div { min-width: 0; }
.meta dt { font-size: 11px; color: var(--dim); text-transform: uppercase; letter-spacing: .06em; }
.meta dd { margin: 2px 0 0; font-size: 14px; overflow-wrap: anywhere; }
.escenas { margin: 0; padding-left: 22px; display: flex; flex-direction: column; gap: 8px; font-size: 14px; }
.log { list-style: none; margin: 0; padding: 0; font-size: 12px; display: flex; flex-direction: column; gap: 4px; }
.log li { display: grid; grid-template-columns: 44px 1fr; gap: 8px; color: var(--dim); }
.log li.warn { color: var(--warn); }
.log li.error { color: var(--err); }
details.bloque { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; }
details.bloque summary { cursor: pointer; font-weight: 600; font-size: 14px; }
details.bloque[open] summary { margin-bottom: 10px; }

/* ── Estado ── */
.runs { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.runs li { display: grid; grid-template-columns: 24px 1fr auto; gap: 10px; align-items: center; font-size: 14px; }
.runs .ico { font-size: 16px; text-align: center; }
.runs .ico.ok { color: var(--ok); } .runs .ico.err { color: var(--err); } .runs .ico.run { color: var(--warn); }
.jobs { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.jobs li { display: flex; gap: 10px; align-items: center; justify-content: space-between; font-size: 14px; background: var(--deep); border-radius: 10px; padding: 8px 12px; }
.jobs li .grow { overflow: hidden; text-overflow: ellipsis; }

/* ── Aviso ── */
.toast {
  position: fixed; left: 50%; bottom: calc(var(--tabs-h) + var(--safe-b) + 14px); transform: translateX(-50%); z-index: 40;
  background: #1d2436; color: var(--ink); border: 1px solid var(--line-2); border-radius: 12px; padding: 10px 16px; font-size: 14px;
  max-width: min(92vw, 520px); box-shadow: 0 10px 30px rgba(0,0,0,.4);
}
.toast--err { border-color: rgba(239,90,90,.5); }

/* ── Login ── */
.login-body { padding: 0; display: flex; align-items: center; justify-content: center; }
.login { width: min(92vw, 380px); padding: 24px 0; }
.login__card { display: flex; flex-direction: column; gap: 14px; }

/* ── PC / tablet ── */
@media (min-width: 900px) {
  body { padding-bottom: 0; }
  .tabs {
    position: sticky; top: 53px; bottom: auto; height: auto; display: flex; gap: 4px; padding: 6px 16px; justify-content: flex-start;
    border-top: 0; border-bottom: 1px solid var(--line);
  }
  .tab { flex-direction: row; gap: 8px; font-size: 14px; padding: 8px 14px; border-radius: 10px; }
  .tab.is-active { background: var(--accent-soft); }
  .tab__ico { font-size: 15px; }
  .vista { padding: 24px; }
  .vlist { grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); }
  .hoja { left: auto; width: min(560px, 100vw); border-left: 1px solid var(--line); box-shadow: -20px 0 60px rgba(0,0,0,.45); }
  .player { max-height: 56dvh; }
  .toast { bottom: 24px; }
  .form-grid { grid-template-columns: 1fr 1fr 1fr; }
}
