:root {
  --bg: #080a11;
  --bg-2: #0d111c;
  --panel: #121726;
  --panel-2: #171d30;
  --panel-3: #1d2440;
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.14);
  --text: #eef2ff;
  --muted: #8d97b8;
  --muted-2: #6f7897;
  --pink: #ff5c9d;
  --pink-2: #ff3d7f;
  --violet: #8b5cf6;
  --cyan: #59d2ff;
  --green: #3ddc97;
  --amber: #ffc857;
  --red: #ff5c6c;
  --radius: 16px;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
}

* {
  box-sizing: border-box;
}

html {
  color-scheme: dark;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

body.modal-open {
  overflow: hidden;
}

a {
  color: var(--cyan);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

code {
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 1px 6px;
  font-size: 0.92em;
}

.hidden {
  display: none !important;
}

.muted {
  color: var(--muted);
}

.small {
  font-size: 12px;
}

.center {
  text-align: center;
}

.right {
  text-align: right;
}

.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11.5px;
}

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
::-webkit-scrollbar-track {
  background: var(--bg);
}
::-webkit-scrollbar-thumb {
  background: #252c45;
  border-radius: 20px;
  border: 2px solid var(--bg);
}
::-webkit-scrollbar-thumb:hover {
  background: #333d60;
}

/* ---------------------------------------------------------------- */
/* Fondo                                                             */
/* ---------------------------------------------------------------- */

.bg-orbs {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}

.bg-orbs span {
  position: absolute;
  display: block;
  width: 48vw;
  height: 48vw;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.13;
}

.bg-orbs span:nth-child(1) {
  top: -20vw;
  left: -12vw;
  background: var(--pink);
}

.bg-orbs span:nth-child(2) {
  top: 20vh;
  right: -22vw;
  background: var(--cyan);
  opacity: 0.1;
}

.bg-orbs span:nth-child(3) {
  bottom: -30vw;
  left: 22vw;
  background: var(--violet);
  opacity: 0.1;
}

/* ---------------------------------------------------------------- */
/* Cabecera                                                          */
/* ---------------------------------------------------------------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  height: 74px;
  padding: 0 32px;
  background: rgba(8, 10, 17, 0.82);
  backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 13px;
  min-width: 0;
}

.brand-mark {
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  filter: drop-shadow(0 0 16px rgba(255, 92, 157, 0.28));
}

.brand-mark svg {
  width: 100%;
  height: 100%;
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}

.brand-text h1 {
  margin: 0;
  font-size: 21px;
  letter-spacing: -0.4px;
  font-weight: 800;
  background: linear-gradient(100deg, #fff 10%, #ffb8d4 45%, #9fe6ff 90%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.brand-text span {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1.6px;
  color: var(--muted-2);
  margin-top: 3px;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.mini-storage {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 36px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--muted);
  font-size: 12px;
  transition: border-color 0.2s, color 0.2s;
}

.mini-storage:hover {
  border-color: rgba(89, 210, 255, 0.4);
  color: var(--text);
}

.mini-storage-bar {
  width: 54px;
  height: 5px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.1);
  overflow: hidden;
}

.mini-storage-bar i {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 10px;
  background: linear-gradient(90deg, var(--cyan), var(--pink));
  transition: width 0.4s ease;
}

.ghost-btn,
.primary-btn,
.danger-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 36px;
  padding: 0 14px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  transition: transform 0.15s, background 0.2s, border-color 0.2s, color 0.2s, filter 0.2s;
}

.ghost-btn {
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
}

.ghost-btn:hover {
  background: rgba(255, 255, 255, 0.07);
  border-color: rgba(255, 255, 255, 0.22);
}

.primary-btn {
  border: 0;
  background: linear-gradient(120deg, var(--pink-2), var(--violet));
  color: #fff;
  box-shadow: 0 8px 24px rgba(255, 61, 127, 0.24);
}

.primary-btn:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
}

.danger-btn {
  border: 1px solid rgba(255, 92, 108, 0.35);
  background: rgba(255, 92, 108, 0.12);
  color: #ffb3ba;
}

.danger-btn:hover {
  background: rgba(255, 92, 108, 0.2);
  border-color: rgba(255, 92, 108, 0.6);
}

.ghost-btn svg,
.primary-btn svg {
  width: 17px;
  height: 17px;
}

.ghost-btn.small,
.primary-btn.small,
.danger-btn.small {
  height: 30px;
  padding: 0 11px;
  font-size: 12px;
  border-radius: 8px;
}

.ghost-btn.loading svg {
  animation: spin 0.9s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ---------------------------------------------------------------- */
/* Pestañas                                                          */
/* ---------------------------------------------------------------- */

.tabs {
  position: sticky;
  top: 74px;
  z-index: 30;
  display: flex;
  gap: 4px;
  padding: 0 32px;
  overflow-x: auto;
  background: rgba(8, 10, 17, 0.78);
  backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--line);
  scrollbar-width: none;
}

.tabs::-webkit-scrollbar {
  display: none;
}

.tab {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 52px;
  padding: 0 16px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}

.tab:hover {
  color: var(--text);
}

.tab.active {
  color: var(--text);
}

.tab.active::after {
  content: '';
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: -1px;
  height: 2px;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--pink), var(--cyan));
  box-shadow: 0 0 14px rgba(255, 92, 157, 0.55);
}

.tab-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--red);
  box-shadow: 0 0 0 4px rgba(255, 92, 108, 0.16);
  animation: pulse-dot 1.8s ease-in-out infinite;
}

@keyframes pulse-dot {
  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.55;
    transform: scale(0.82);
  }
}

.tab-count {
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--muted);
  font-size: 11px;
  line-height: 20px;
  text-align: center;
}

/* ---------------------------------------------------------------- */
/* Contenedor / secciones                                            */
/* ---------------------------------------------------------------- */

.container {
  max-width: 1500px;
  margin: 0 auto;
  padding: 30px 32px 90px;
}

.section {
  display: none;
}

.section.active {
  display: block;
  animation: fade-up 0.35s ease both;
}

@keyframes fade-up {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
}

.section-head h2 {
  margin: 0 0 5px;
  font-size: 26px;
  letter-spacing: -0.6px;
  font-weight: 800;
}

.section-head p {
  margin: 0;
  max-width: 680px;
  font-size: 13px;
}

.head-actions {
  display: flex;
  gap: 8px;
}

/* ---------------------------------------------------------------- */
/* Tarjetas en vivo                                                  */
/* ---------------------------------------------------------------- */

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 20px;
}

.card {
  background: linear-gradient(170deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.card:hover {
  transform: translateY(-3px);
  border-color: rgba(255, 92, 157, 0.32);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.35);
}

.thumb {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  padding: 0;
  border: 0;
  background: #0a0d15;
  overflow: hidden;
}

.thumb img,
.rec-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.35s ease, opacity 0.2s;
}

.card:hover .thumb img {
  transform: scale(1.035);
}

.thumb::after,
.rec-thumb::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(5, 7, 12, 0.78) 0%, transparent 45%);
  pointer-events: none;
}

.live-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 24px;
  padding: 0 9px;
  border-radius: 6px;
  background: #e11d48;
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 1px;
  box-shadow: 0 4px 16px rgba(225, 29, 72, 0.45);
}

.live-badge i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #fff;
  animation: pulse-dot 1.4s infinite;
}

.viewers {
  position: absolute;
  left: 10px;
  bottom: 9px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 24px;
  padding: 0 8px;
  border-radius: 6px;
  background: rgba(6, 8, 14, 0.72);
  backdrop-filter: blur(8px);
  color: #e7f8ff;
  font-size: 11px;
  font-weight: 700;
}

.viewers svg {
  width: 14px;
  height: 14px;
}

.play-orb {
  position: absolute;
  z-index: 3;
  top: 50%;
  left: 50%;
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  margin: -27px 0 0 -27px;
  border-radius: 50%;
  background: rgba(8, 10, 17, 0.62);
  border: 1px solid rgba(255, 255, 255, 0.28);
  backdrop-filter: blur(8px);
  color: #fff;
  font-size: 17px;
  opacity: 0;
  transform: scale(0.9);
  transition: opacity 0.2s, transform 0.2s;
  pointer-events: none;
}

.card:hover .play-orb,
.play-orb.static {
  opacity: 1;
  transform: scale(1);
}

.play-orb.static {
  position: absolute;
  border: 1px solid rgba(255, 255, 255, 0.3);
}

.card-body {
  padding: 13px 15px 15px;
}

.channel {
  display: block;
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 1.1px;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-title {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin: 5px 0 12px;
  min-height: 42px;
  color: var(--text);
  font-size: 14.5px;
  font-weight: 650;
  line-height: 1.42;
}

.card-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 9px;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.chip.recording {
  color: #ffd3e4;
  border-color: rgba(255, 92, 157, 0.32);
  background: rgba(255, 92, 157, 0.12);
}

.pulse {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--pink);
  animation: pulse-dot 1.4s infinite;
}

/* ---------------------------------------------------------------- */
/* Programados                                                       */
/* ---------------------------------------------------------------- */

.upcoming-list {
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.upcoming-day {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.day-label {
  margin: 0 0 2px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: capitalize;
}

.upcoming-row {
  display: grid;
  grid-template-columns: 86px 136px minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  padding: 10px 14px 10px 10px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 13px;
  transition: border-color 0.2s, background 0.2s, transform 0.2s;
}

.upcoming-row:hover {
  border-color: rgba(89, 210, 255, 0.28);
  background: var(--panel-2);
  transform: translateX(2px);
}

.upcoming-row.soon {
  border-color: rgba(255, 92, 157, 0.3);
}

.up-time {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding-left: 4px;
}

.up-time strong {
  font-size: 19px;
  letter-spacing: -0.4px;
}

.up-time span {
  color: var(--muted);
  font-size: 10.5px;
  white-space: nowrap;
}

.up-thumb {
  width: 136px;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: 8px;
  background: #0a0d15;
}

.up-info {
  min-width: 0;
}

.up-info h4 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin: 4px 0 0;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
}

.up-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ---------------------------------------------------------------- */
/* Biblioteca                                                        */
/* ---------------------------------------------------------------- */

.toolbar {
  display: flex;
  gap: 10px;
  margin-bottom: 18px;
}

.toolbar input,
.toolbar select {
  height: 40px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  padding: 0 13px;
  outline: none;
}

.toolbar input {
  flex: 1;
  max-width: 440px;
}

.toolbar input:focus,
.toolbar select:focus,
.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: rgba(89, 210, 255, 0.55);
  box-shadow: 0 0 0 3px rgba(89, 210, 255, 0.1);
}

.rec-card {
  display: flex;
  flex-direction: column;
}

.rec-thumb {
  position: relative;
  aspect-ratio: 16 / 9;
  background: #0a0d15;
  overflow: hidden;
}

.rec-thumb .status-chip {
  position: absolute;
  top: 9px;
  left: 9px;
  z-index: 2;
}

.rec-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  color: var(--muted-2);
  font-size: 11.5px;
  margin-bottom: 8px;
}

.rec-meta span:not(:last-child)::after {
  content: '·';
  margin-left: 10px;
  color: var(--line-strong);
}

.status-chip {
  display: inline-flex;
  align-items: center;
  height: 23px;
  padding: 0 8px;
  border-radius: 6px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  background: rgba(255, 255, 255, 0.07);
  color: var(--muted);
  border: 1px solid var(--line);
}

.status-chip.completed {
  color: #8ff0c5;
  background: rgba(61, 220, 151, 0.12);
  border-color: rgba(61, 220, 151, 0.28);
}

.status-chip.downloading,
.status-chip.processing,
.status-chip.starting {
  color: #9fe6ff;
  background: rgba(89, 210, 255, 0.12);
  border-color: rgba(89, 210, 255, 0.28);
}

.status-chip.waiting,
.status-chip.queued {
  color: #ffe0a3;
  background: rgba(255, 200, 87, 0.12);
  border-color: rgba(255, 200, 87, 0.26);
}

.status-chip.failed,
.status-chip.cancelled {
  color: #ffb3ba;
  background: rgba(255, 92, 108, 0.12);
  border-color: rgba(255, 92, 108, 0.28);
}

.status-chip.cancelling {
  color: #ffb3ba;
  background: rgba(255, 92, 108, 0.12);
}

.progress {
  height: 6px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
  margin: 3px 0 6px;
}

.progress i {
  display: block;
  height: 100%;
  border-radius: 10px;
  background: linear-gradient(90deg, var(--pink), var(--cyan));
  transition: width 0.5s ease;
}

.progress-meta {
  display: flex;
  gap: 10px;
  min-height: 16px;
  color: var(--muted-2);
  font-size: 11px;
  margin-bottom: 6px;
}

.error-text {
  margin: 6px 0;
  color: #ff9ba5;
  font-size: 11.5px;
  line-height: 1.45;
  word-break: break-word;
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font-size: 14px;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
}

.icon-btn:hover {
  background: rgba(255, 255, 255, 0.09);
  border-color: var(--line-strong);
  text-decoration: none;
}

.icon-btn.danger {
  color: #ff9ba5;
}

.icon-btn.danger:hover {
  background: rgba(255, 92, 108, 0.15);
  border-color: rgba(255, 92, 108, 0.4);
}

/* ---------------------------------------------------------------- */
/* Canales                                                           */
/* ---------------------------------------------------------------- */

.panel {
  background: linear-gradient(170deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
}

.panel h3 {
  margin: 0 0 16px;
  font-size: 16px;
  letter-spacing: -0.2px;
}

.add-channel {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.add-channel .grow {
  flex: 1;
  min-width: 260px;
}

.list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.channel-row {
  display: grid;
  grid-template-columns: 44px 38px minmax(0, 1fr) auto 36px;
  align-items: center;
  gap: 13px;
  padding: 10px 13px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  transition: border-color 0.2s, opacity 0.2s;
}

.channel-row:hover {
  border-color: var(--line-strong);
}

.channel-row.disabled {
  opacity: 0.55;
}

.channel-avatar {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: linear-gradient(140deg, rgba(255, 92, 157, 0.3), rgba(89, 210, 255, 0.22));
  border: 1px solid rgba(255, 255, 255, 0.12);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.5px;
}

.channel-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
  gap: 1px;
}

.channel-info strong {
  font-size: 13.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.channel-info .mono {
  color: var(--muted-2);
}

.group-chip {
  height: 24px;
  font-size: 10px;
}

.switch {
  position: relative;
  display: inline-block;
  width: 38px;
  height: 22px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.switch span {
  position: absolute;
  inset: 0;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid var(--line);
  transition: background 0.2s;
  cursor: pointer;
}

.switch span::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #c8cfff;
  transition: transform 0.2s;
}

.switch input:checked + span {
  background: rgba(255, 92, 157, 0.55);
  border-color: rgba(255, 92, 157, 0.65);
}

.switch input:checked + span::after {
  transform: translateX(16px);
  background: #fff;
}

/* ---------------------------------------------------------------- */
/* Almacenamiento                                                    */
/* ---------------------------------------------------------------- */

.stat-cards {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}

.stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 16px 18px;
  background: linear-gradient(160deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line);
  border-radius: 14px;
}

.stat span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.8px;
  text-transform: uppercase;
}

.stat strong {
  font-size: 25px;
  letter-spacing: -0.8px;
  line-height: 1.3;
}

.stat small {
  color: var(--muted-2);
  font-size: 11px;
}

.quota-panel {
  margin-bottom: 16px;
}

.quota-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 9px;
  font-size: 12px;
  font-weight: 600;
}

.quota-top strong {
  font-size: 15px;
}

.quota-bar {
  height: 14px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.07);
  overflow: hidden;
  border: 1px solid var(--line);
}

.quota-bar i {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 20px;
  background: linear-gradient(90deg, #3ddc97, #59d2ff 55%, #ff5c9d);
  transition: width 0.5s ease, background 0.3s;
}

.quota-bar i.warn {
  background: linear-gradient(90deg, #ffc857, #ff8a5c);
}

.quota-bar i.danger {
  background: linear-gradient(90deg, #ff5c6c, #e11d48);
}

.table-wrap {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}

.data-table th {
  padding: 8px 10px;
  color: var(--muted-2);
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 1px;
  text-transform: uppercase;
  text-align: left;
  border-bottom: 1px solid var(--line);
}

.data-table td {
  padding: 11px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  vertical-align: middle;
}

.data-table tr:last-child td {
  border-bottom: 0;
}

.data-table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

.title-cell {
  max-width: 520px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------------------------------------------------------------- */
/* Ajustes                                                           */
/* ---------------------------------------------------------------- */

.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  align-items: start;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}

.field label {
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.4px;
  text-transform: uppercase;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  height: 40px;
  padding: 0 12px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: rgba(6, 8, 14, 0.45);
  color: var(--text);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.field input[type='file'] {
  height: auto;
  padding: 9px 10px;
  color: var(--muted);
  font-size: 12px;
}

.field small {
  line-height: 1.45;
}

.cookie-status {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 12px 14px;
  margin-bottom: 14px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.025);
}

.cookie-status.ok {
  border-color: rgba(61, 220, 151, 0.28);
  background: rgba(61, 220, 151, 0.06);
}

.cookie-status.warn {
  border-color: rgba(255, 200, 87, 0.28);
  background: rgba(255, 200, 87, 0.06);
}

.dot {
  width: 9px;
  height: 9px;
  flex: 0 0 auto;
  margin-top: 4px;
  border-radius: 50%;
}

.dot.ok {
  background: var(--green);
  box-shadow: 0 0 10px rgba(61, 220, 151, 0.7);
}

.dot.warn {
  background: var(--amber);
  box-shadow: 0 0 10px rgba(255, 200, 87, 0.7);
}

.help {
  margin: 8px 0 14px;
  padding: 10px 12px;
  border: 1px dashed var(--line-strong);
  border-radius: 9px;
  color: var(--muted);
  font-size: 12px;
}

.help summary {
  cursor: pointer;
  color: var(--text);
  font-weight: 600;
}

.help ol {
  margin: 9px 0 0;
  padding-left: 20px;
  line-height: 1.65;
}

.row-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.test-result {
  max-height: 220px;
  overflow: auto;
  margin: 13px 0 0;
  padding: 12px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: #070910;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}

.test-result.ok {
  border-color: rgba(61, 220, 151, 0.3);
  color: #a9f5d0;
}

.test-result.error {
  border-color: rgba(255, 92, 108, 0.3);
  color: #ffb3ba;
}

.about .kv {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 7px 12px;
  margin: 14px 0 0;
  font-size: 12.5px;
}

.about .kv dt {
  color: var(--muted-2);
}

.about .kv dd {
  margin: 0;
}

/* ---------------------------------------------------------------- */
/* Estado vacío / esqueletos                                         */
/* ---------------------------------------------------------------- */

.empty-state {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 300px;
  padding: 40px 20px;
  text-align: center;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.015);
}

.empty-icon {
  display: grid;
  place-items: center;
  width: 62px;
  height: 62px;
  margin-bottom: 14px;
  border-radius: 20px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  font-size: 27px;
}

.empty-state h3 {
  margin: 0 0 6px;
  font-size: 17px;
}

.empty-state p {
  margin: 0 0 18px;
  max-width: 480px;
  color: var(--muted);
  font-size: 13px;
}

.skeleton-card {
  padding: 0;
}

.skeleton {
  position: relative;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.055);
  border-radius: 6px;
}

.skeleton::after {
  content: '';
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.07), transparent);
  animation: shimmer 1.4s infinite;
}

@keyframes shimmer {
  100% {
    transform: translateX(100%);
  }
}

.thumb-skel {
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 0;
}

.skeleton.line {
  height: 13px;
  margin: 14px 15px 0;
}

.skeleton.line.short {
  width: 55%;
  margin-bottom: 18px;
}

/* ---------------------------------------------------------------- */
/* Modal                                                             */
/* ---------------------------------------------------------------- */

.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 24px;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(3, 4, 8, 0.76);
  backdrop-filter: blur(8px);
  animation: fade-in 0.2s both;
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.modal-card {
  position: relative;
  z-index: 1;
  width: min(920px, 100%);
  max-height: 90vh;
  overflow: auto;
  padding: 24px;
  border-radius: 18px;
  border: 1px solid var(--line-strong);
  background: linear-gradient(170deg, #171d30, #0f1422);
  box-shadow: var(--shadow);
  animation: modal-in 0.25s cubic-bezier(0.2, 0.9, 0.3, 1.1) both;
}

@keyframes modal-in {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.modal-card h3 {
  margin: 0 40px 16px 0;
  font-size: 18px;
  letter-spacing: -0.3px;
}

.modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  font-size: 20px;
  line-height: 1;
}

.modal-close:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.09);
}

.modal-message {
  color: var(--muted);
  line-height: 1.6;
  font-size: 13.5px;
}

.modal-message strong {
  color: var(--text);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 9px;
  margin-top: 22px;
}

.player-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 12px;
  overflow: hidden;
  background: #000;
}

.player-wrap iframe,
.player-wrap video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  background: #000;
}

/* ---------------------------------------------------------------- */
/* Toasts                                                            */
/* ---------------------------------------------------------------- */

.toasts {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 9px;
  max-width: min(380px, calc(100vw - 32px));
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 11px;
  border: 1px solid var(--line-strong);
  background: rgba(23, 29, 48, 0.94);
  backdrop-filter: blur(14px);
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.4);
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.22s, transform 0.22s;
}

.toast.show {
  opacity: 1;
  transform: none;
}

.toast p {
  margin: 0;
  font-size: 12.5px;
  line-height: 1.45;
}

.toast-dot {
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  margin-top: 5px;
  border-radius: 50%;
  background: var(--cyan);
}

.toast.success .toast-dot {
  background: var(--green);
  box-shadow: 0 0 9px rgba(61, 220, 151, 0.7);
}

.toast.error .toast-dot {
  background: var(--red);
  box-shadow: 0 0 9px rgba(255, 92, 108, 0.7);
}

.toast.info .toast-dot {
  background: var(--cyan);
  box-shadow: 0 0 9px rgba(89, 210, 255, 0.7);
}

/* ---------------------------------------------------------------- */
/* Login                                                             */
/* ---------------------------------------------------------------- */

.login-body {
  display: grid;
  place-items: center;
  min-height: 100vh;
}

.login-shell {
  width: 100%;
  padding: 24px;
}

.login-card {
  width: min(410px, 100%);
  margin: 0 auto;
  padding: 34px 32px 28px;
  border-radius: 22px;
  border: 1px solid var(--line-strong);
  background: linear-gradient(165deg, rgba(27, 33, 53, 0.96), rgba(15, 20, 34, 0.98));
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.login-brand {
  text-align: center;
  margin-bottom: 28px;
}

.login-brand .brand-mark {
  width: 62px;
  height: 62px;
  margin: 0 auto 12px;
}

.login-brand h1 {
  margin: 0;
  font-size: 30px;
  letter-spacing: -1px;
  background: linear-gradient(100deg, #fff, #ffb8d4 48%, #9fe6ff);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.login-brand p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.3px;
}

.login-form .field {
  margin-bottom: 16px;
}

.login-btn {
  width: 100%;
  height: 44px;
  margin-top: 6px;
  font-size: 14px;
}

.login-foot {
  margin: 20px 0 0;
  text-align: center;
  color: var(--muted-2);
  font-size: 11px;
}

.form-error {
  margin: 0 0 12px;
  padding: 10px 12px;
  border-radius: 9px;
  border: 1px solid rgba(255, 92, 108, 0.3);
  background: rgba(255, 92, 108, 0.1);
  color: #ffb3ba;
  font-size: 12px;
}

/* ---------------------------------------------------------------- */
/* Responsive                                                        */
/* ---------------------------------------------------------------- */

@media (max-width: 1000px) {
  .topbar,
  .tabs {
    padding-left: 20px;
    padding-right: 20px;
  }
  .container {
    padding: 24px 20px 70px;
  }
  .settings-grid {
    grid-template-columns: 1fr;
  }
  .stat-cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .topbar {
    height: 64px;
    padding: 0 14px;
  }
  .tabs {
    top: 64px;
    padding: 0 12px;
  }
  .brand-text span {
    display: none;
  }
  .brand-mark {
    width: 38px;
    height: 38px;
  }
  .brand-text h1 {
    font-size: 19px;
  }
  .mini-storage {
    display: none;
  }
  .container {
    padding: 20px 14px 80px;
  }
  .section-head {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }
  .section-head h2 {
    font-size: 22px;
  }
  .section-head .head-actions .ghost-btn,
  .section-head > .ghost-btn {
    align-self: flex-start;
  }
  .grid {
    grid-template-columns: 1fr;
  }
  .upcoming-row {
    grid-template-columns: 64px minmax(0, 1fr) auto;
    gap: 11px;
  }
  .up-thumb {
    display: none;
  }
  .up-time strong {
    font-size: 16px;
  }
  .up-actions {
    flex-direction: column;
    align-items: stretch;
  }
  .up-actions .ghost-btn {
    display: none;
  }
  .toolbar {
    flex-direction: column;
  }
  .toolbar input {
    max-width: none;
  }
  .stat-cards {
    gap: 9px;
  }
  .stat {
    padding: 13px 14px;
  }
  .stat strong {
    font-size: 20px;
  }
  .channel-row {
    grid-template-columns: 38px 36px minmax(0, 1fr) 32px;
    gap: 10px;
  }
  .channel-row .group-chip {
    display: none;
  }
  .toasts {
    left: 12px;
    right: 12px;
    bottom: 12px;
    max-width: none;
  }
  .modal {
    padding: 12px;
  }
  .modal-card {
    padding: 20px;
  }
}

@media (max-width: 420px) {
  .top-actions .ghost-btn span {
    display: none;
  }
  .stat-cards {
    grid-template-columns: 1fr;
  }
  .login-card {
    padding: 28px 22px 24px;
  }
}

/* ---------------------------------------------------------------- */
/* Vista múltiple                                                    */
/* ---------------------------------------------------------------- */

.inline-check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 34px;
  padding: 0 12px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
}

.inline-check input {
  accent-color: var(--pink);
  width: 15px;
  height: 15px;
  cursor: pointer;
}

.mv-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  padding: 14px 16px;
}

.mv-add {
  display: flex;
  gap: 8px;
  flex: 1 1 300px;
  min-width: 240px;
}

.mv-add select,
.mv-add input {
  flex: 1;
  min-width: 0;
  height: 38px;
  padding: 0 12px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: rgba(6, 8, 14, 0.45);
  color: var(--text);
  outline: none;
}

.mv-add select:focus,
.mv-add input:focus,
.console-toolbar select:focus,
.console-input input:focus {
  border-color: rgba(89, 210, 255, 0.55);
  box-shadow: 0 0 0 3px rgba(89, 210, 255, 0.1);
}

.mv-layouts {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.4px;
  text-transform: uppercase;
}

.mv-layouts button {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.mv-layouts button:hover {
  color: var(--text);
  border-color: var(--line-strong);
}

.mv-layouts button.active {
  color: #fff;
  border-color: rgba(255, 92, 157, 0.6);
  background: rgba(255, 92, 157, 0.22);
}

.mv-grid {
  display: grid;
  gap: 12px;
}

.mv-grid[data-layout='1'] {
  grid-template-columns: 1fr;
  max-width: 1180px;
  margin: 0 auto;
}

.mv-grid[data-layout='2'],
.mv-grid[data-layout='4'] {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.mv-grid[data-layout='6'],
.mv-grid[data-layout='9'] {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.mv-tile {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: #000;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35);
}

.mv-frame {
  position: relative;
  aspect-ratio: 16 / 9;
  background: #000;
}

.mv-frame iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  background: #000;
}

.mv-bar {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 10px;
  background: var(--panel);
  border-top: 1px solid var(--line);
}

.mv-bar .mv-title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
}

.mv-bar .mv-channel {
  color: var(--muted-2);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.7px;
  text-transform: uppercase;
  white-space: nowrap;
}

.mv-bar .icon-btn {
  width: 27px;
  height: 27px;
  font-size: 12px;
}

.mv-empty {
  grid-column: 1 / -1;
}

/* ---------------------------------------------------------------- */
/* Consola yt-dlp                                                    */
/* ---------------------------------------------------------------- */

.console-panel {
  padding: 16px;
}

.console-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.console-toolbar select {
  height: 34px;
  max-width: 360px;
  min-width: 200px;
  padding: 0 10px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: rgba(6, 8, 14, 0.45);
  color: var(--text);
  outline: none;
}

.console-spacer {
  flex: 1;
}

.console-output {
  margin: 0;
  padding: 14px 16px;
  min-height: 320px;
  max-height: 56vh;
  overflow: auto;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #05070c;
  color: #cfe6ff;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}

.console-input {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
}

.console-prompt {
  color: var(--green);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  white-space: nowrap;
}

.console-input input {
  flex: 1;
  min-width: 0;
  height: 40px;
  padding: 0 12px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: rgba(6, 8, 14, 0.6);
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12.5px;
  outline: none;
}

@media (max-width: 1000px) {
  .mv-grid[data-layout='6'],
  .mv-grid[data-layout='9'] {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .mv-grid[data-layout='1'],
  .mv-grid[data-layout='2'],
  .mv-grid[data-layout='4'],
  .mv-grid[data-layout='6'],
  .mv-grid[data-layout='9'] {
    grid-template-columns: 1fr;
  }
  .mv-controls {
    padding: 12px;
  }
  .mv-layouts {
    width: 100%;
    justify-content: flex-start;
  }
  .console-toolbar select {
    max-width: none;
    width: 100%;
  }
  .console-spacer {
    display: none;
  }
  .console-prompt {
    display: none;
  }
  .console-input {
    flex-direction: column;
    align-items: stretch;
  }
  .console-output {
    min-height: 260px;
    font-size: 11.5px;
  }
}
