:root {
  --bg: #0d0f1a;
  --bg2: #151827;
  --card: #1b1f30;
  --card2: #232840;
  --line: #2c3250;
  --txt: #e8eaf2;
  --muted: #8b91ac;
  --brand: #6c5ce7;
  --brand2: #a29bfe;
  --ok: #21c08b;
  --warn: #f0a020;
  --err: #ff6b6b;
  --info: #4aa3ff;
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--txt);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 14px;
}
a { color: var(--brand2); text-decoration: none; }
button {
  font: inherit; cursor: pointer; border: none; border-radius: 8px;
  padding: 9px 16px; background: var(--brand); color: #fff; font-weight: 600;
  transition: filter .15s, transform .05s;
}
button:hover { filter: brightness(1.1); }
button:active { transform: translateY(1px); }
button.ghost { background: var(--card2); color: var(--txt); }
button.sm { padding: 6px 11px; font-size: 12.5px; }
button:disabled { opacity: .5; cursor: not-allowed; }
button.loading { display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
button.loading::before {
  content: "";
  width: 13px; height: 13px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,.35); border-top-color: #fff;
  animation: spin .75s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
input, select {
  font: inherit; background: var(--bg2); color: var(--txt);
  border: 1px solid var(--line); border-radius: 8px; padding: 9px 11px; width: 100%;
}
label { display: block; color: var(--muted); font-size: 12.5px; margin: 0 0 5px; }

/* ---- login ---- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; }
.login-card {
  background: var(--card); border: 1px solid var(--line); border-radius: 16px;
  padding: 34px; width: 340px; box-shadow: 0 20px 60px rgba(0,0,0,.4);
}
.login-card h1 { margin: 0 0 4px; font-size: 22px; }
.login-card p { margin: 0 0 22px; color: var(--muted); }
.login-card .field { margin-bottom: 14px; }
.brand-dot { color: var(--brand2); }
.err-msg { color: var(--err); font-size: 13px; min-height: 18px; margin-top: 8px; }

/* ---- layout ---- */
.topbar {
  display: flex; align-items: center; gap: 16px; padding: 14px 24px;
  background: var(--bg2); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5;
}
.topbar .logo { font-weight: 800; font-size: 18px; }
.topbar .spacer { flex: 1; }
.topbar .who { color: var(--muted); }
.container { max-width: 1180px; margin: 0 auto; padding: 22px 24px 60px; }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(104px, 1fr)); gap: 9px; }
.stat {
  background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px;
}
.stat .n { font-size: 19px; font-weight: 800; }
.stat .l { color: var(--muted); font-size: 11px; margin-top: 1px; }

/* listas (canales / urls usadas) */
.lrow { display: flex; align-items: center; gap: 10px; padding: 9px 2px; border-bottom: 1px solid var(--line); }
.lrow .grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lrow:last-child { border-bottom: none; }

.toolbar { display: flex; gap: 10px; flex-wrap: wrap; margin: 22px 0 10px; align-items: center; }
.countdown { font-weight: 700; font-size: 13.5px; color: var(--muted); background: var(--card); border: 1px solid var(--line); padding: 8px 14px; border-radius: 8px; white-space: nowrap; }
.countdown.live { color: var(--brand2); border-color: var(--brand); }
.tabs { display: flex; gap: 6px; margin: 26px 0 16px; border-bottom: 1px solid var(--line); }
.tab { padding: 10px 16px; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; font-weight: 600; }
.tab.active { color: var(--txt); border-bottom-color: var(--brand); }

/* ---- video grid (compacto) ---- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 10px; }
.vcard { background: var(--card); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; display: flex; flex-direction: column; }
.vthumb { aspect-ratio: 9/16; background: #000 center/cover; position: relative; cursor: pointer; }
.vthumb .play { position: absolute; inset: 0; display: grid; place-items: center; font-size: 26px; color: #fff; opacity: .8; }
.vthumb .badge { position: absolute; top: 6px; left: 6px; }
.vbody { padding: 7px 8px 9px; display: flex; flex-direction: column; gap: 5px; flex: 1; }
.vtitle { font-weight: 600; font-size: 11.5px; line-height: 1.3; max-height: 3.9em; overflow: hidden; }
.vmeta { color: var(--muted); font-size: 10.5px; }
.vstats { display: flex; gap: 8px; color: var(--muted); font-size: 11px; flex-wrap: wrap; }
.vactions { display: flex; gap: 6px; margin-top: auto; align-items: center; flex-wrap: wrap; }
.vactions a { font-size: 11px; }
.badge { display: inline-block; padding: 2px 7px; border-radius: 20px; font-size: 10px; font-weight: 700; }
.pager { display: flex; justify-content: center; align-items: center; gap: 14px; margin: 22px 0 4px; color: var(--muted); }
.pager button:disabled { opacity: .4; }
.b-ready { background: rgba(74,163,255,.16); color: var(--info); }
.b-uploaded { background: rgba(33,192,139,.16); color: var(--ok); }
.b-generating { background: rgba(240,160,32,.16); color: var(--warn); }
.b-failed { background: rgba(255,107,107,.16); color: var(--err); }
.b-pending { background: var(--card2); color: var(--muted); }

/* ---- settings ---- */
.settings { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px,1fr)); gap: 18px; }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 18px 20px; }
.panel h3 { margin: 0 0 14px; font-size: 15px; }
.panel .field { margin-bottom: 13px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.hint { color: var(--muted); font-size: 12px; margin-top: 5px; }
.switch { display: flex; align-items: center; gap: 10px; }
.switch input { width: auto; }
.pill { font-size: 12px; padding: 3px 10px; border-radius: 20px; }
.pill.on { background: rgba(33,192,139,.16); color: var(--ok); }
.pill.off { background: var(--card2); color: var(--muted); }

/* ---- modal ---- */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.7); display: none; place-items: center; z-index: 20; }
.modal.open { display: grid; }
.modal video, .modal iframe { max-height: 86vh; max-width: 92vw; border-radius: 12px; }
.modal iframe { width: min(92vw, 420px); aspect-ratio: 9/16; border: 0; background: #000; }
.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: var(--card2); border: 1px solid var(--line); padding: 12px 18px; border-radius: 10px; opacity: 0; transition: opacity .25s; z-index: 30; }
.toast.show { opacity: 1; }
.empty { color: var(--muted); padding: 40px; text-align: center; }
