/* ============================================================
   Gestor Streaming — estilos
   ============================================================ */
:root {
  --bg: #0a0d13;
  --bg-2: #0d111a;
  --panel: #12161f;
  --panel-2: #161b26;
  --panel-hover: #1b2130;
  --border: rgba(255, 255, 255, 0.07);
  --border-strong: rgba(255, 255, 255, 0.12);
  --text: #e7ebf3;
  --text-muted: #8b93a5;
  --text-dim: #5f6675;
  --accent: #7b61ff;
  --accent-2: #9d7cff;
  --accent-soft: rgba(123, 97, 255, 0.15);
  --green: #22c55e;
  --green-soft: rgba(34, 197, 94, 0.13);
  --amber: #f59e0b;
  --amber-soft: rgba(245, 158, 11, 0.14);
  --red: #ef4444;
  --red-soft: rgba(239, 68, 68, 0.13);
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

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

.hidden { display: none !important; }

/* ---------- Login ---------- */
.login-screen {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(1200px 600px at 50% -10%, rgba(123, 97, 255, 0.12), transparent), var(--bg);
  padding: 20px;
}
.login-card {
  width: 100%; max-width: 380px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 34px 30px;
  box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: 8px;
}
.login-logo { font-size: 44px; text-align: center; }
.login-card h1 { text-align: center; font-size: 22px; margin-top: 4px; }
.login-sub { text-align: center; color: var(--text-muted); margin-bottom: 14px; }
.login-card label { font-size: 12px; color: var(--text-muted); margin-top: 8px; font-weight: 600; }
.login-card input {
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 11px 13px; color: var(--text); font-size: 14px;
}
.login-card input:focus { outline: none; border-color: var(--accent); }
.login-error {
  background: var(--red-soft); color: #fca5a5; border: 1px solid rgba(239,68,68,0.3);
  padding: 9px 12px; border-radius: var(--radius-sm); font-size: 13px; margin-top: 8px;
}
.btn-block { width: 100%; margin-top: 16px; justify-content: center; }

/* ---------- Layout ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: 230px; flex-shrink: 0;
  background: linear-gradient(180deg, var(--bg-2), var(--bg));
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  padding: 18px 14px;
  position: sticky; top: 0; height: 100vh;
}
.sidebar-logo {
  font-size: 30px; text-align: center;
  width: 52px; height: 52px; line-height: 52px; margin: 0 auto 22px;
  background: var(--panel); border: 1px solid var(--border); border-radius: 14px;
}
.nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 14px; border-radius: var(--radius-sm);
  color: var(--text-muted); cursor: pointer; font-weight: 600;
  border: 1px solid transparent; transition: background 0.15s, color 0.15s;
  user-select: none;
}
.nav-item:hover { background: var(--panel); color: var(--text); }
.nav-item.active { background: var(--accent-soft); color: #fff; border-color: rgba(123,97,255,0.3); }
.nav-item .nav-ico { width: 20px; text-align: center; font-size: 16px; }
.nav-item .nav-label { flex: 1; }
.nav-item .nav-count {
  background: var(--panel-2); border: 1px solid var(--border);
  min-width: 22px; height: 20px; padding: 0 6px; border-radius: 8px;
  font-size: 12px; display: flex; align-items: center; justify-content: center; color: var(--text-muted);
}
.nav-item.active .nav-count { background: rgba(255,255,255,0.14); color: #fff; }

.sidebar-bottom { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; }
.session-box {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 10px 12px; display: flex; flex-direction: column; gap: 2px;
}
.session-label { font-size: 10px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-dim); }
.session-email { font-size: 13px; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-btn {
  background: var(--panel); border: 1px solid var(--border); color: var(--text-muted);
  padding: 10px 12px; border-radius: var(--radius-sm); cursor: pointer; font-weight: 600; text-align: left;
  font-size: 13px;
}
.side-btn:hover { background: var(--panel-hover); color: var(--text); }

/* ---------- Main ---------- */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; justify-content: space-between; align-items: flex-start;
  padding: 26px 34px 18px; gap: 16px; flex-wrap: wrap;
}
.hamburger {
  display: none; background: var(--panel); border: 1px solid var(--border);
  color: var(--text); width: 42px; height: 42px; border-radius: 10px; font-size: 20px; cursor: pointer;
  flex-shrink: 0;
}
.sidebar-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 55; }
.topbar-title h1 { font-size: 30px; letter-spacing: -0.5px; }
.topbar-date { color: var(--text-muted); font-size: 14px; margin-top: 2px; text-transform: capitalize; }
.topbar-beta { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.beta-badge {
  background: var(--green-soft); color: var(--green); border: 1px solid rgba(34,197,94,0.3);
  font-size: 10px; font-weight: 700; padding: 2px 8px; border-radius: 6px; letter-spacing: 0.05em;
}
.beta-text { color: var(--text-dim); font-size: 12px; }
.topbar-actions { display: flex; gap: 10px; }

.view { padding: 6px 34px 60px; }

/* ---------- Botones ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 10px 16px; border-radius: var(--radius-sm); border: 1px solid transparent;
  font-weight: 600; font-size: 13.5px; cursor: pointer; white-space: nowrap;
  transition: filter 0.15s, background 0.15s, border-color 0.15s;
}
.btn:hover { filter: brightness(1.08); }
.btn-primary { background: linear-gradient(180deg, var(--accent-2), var(--accent)); color: #fff; box-shadow: 0 4px 14px rgba(123,97,255,0.35); }
.btn-outline { background: var(--panel); border-color: var(--border-strong); color: var(--text); }
.btn-ghost { background: var(--panel-2); border-color: var(--border); color: var(--text); }
.btn-green { background: linear-gradient(180deg, #2ec76a, #16a34a); color: #fff; }
.btn-danger { background: var(--red-soft); border-color: rgba(239,68,68,0.35); color: #fca5a5; }
.btn-sm { padding: 7px 12px; font-size: 12.5px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ---------- Cards / paneles ---------- */
.panel {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 22px;
}
.panel + .panel { margin-top: 18px; }
.panel-head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 6px; gap: 14px; }
.panel-head h2 { font-size: 19px; }
.panel-sub { color: var(--text-muted); font-size: 13px; margin-bottom: 16px; }

/* KPIs */
.kpi-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 18px; }
.kpi {
  border-radius: var(--radius); padding: 20px 22px; border: 1px solid var(--border);
  position: relative; overflow: hidden;
}
.kpi .kpi-num { font-size: 34px; font-weight: 700; line-height: 1; }
.kpi .kpi-label { color: var(--text-muted); margin-top: 8px; font-weight: 600; }
.kpi.red { background: linear-gradient(120deg, rgba(239,68,68,0.14), var(--panel)); }
.kpi.amber { background: linear-gradient(120deg, rgba(245,158,11,0.14), var(--panel)); }
.kpi.green { background: linear-gradient(120deg, rgba(34,197,94,0.14), var(--panel)); }

/* Empty states */
.empty {
  color: var(--text-dim); text-align: center; padding: 28px; font-size: 14px;
  border: 1px dashed var(--border); border-radius: var(--radius);
}

/* Grid de tarjetas */
.cards-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(310px, 1fr)); gap: 16px; }

/* Tarjeta cuenta madre */
.acct-card {
  background: var(--panel-2); border: 1px solid var(--border);
  border-left: 3px solid var(--plat, var(--accent));
  border-radius: var(--radius); padding: 16px;
  display: flex; flex-direction: column; gap: 10px;
}
.acct-badges { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.acct-email { font-weight: 700; font-size: 15px; word-break: break-all; }
.acct-meta { color: var(--text-muted); font-size: 12.5px; }
.acct-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.acct-foot { border-top: 1px solid var(--border); padding-top: 10px; margin-top: 2px; }
.link-btn { background: none; border: none; color: var(--accent-2); cursor: pointer; font-weight: 600; font-size: 13px; padding: 0; }
.link-btn:hover { text-decoration: underline; }

/* Badges */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 9px; border-radius: 8px; font-size: 11.5px; font-weight: 700;
}
.badge-plat { color: #fff; background: var(--plat, var(--accent-soft)); }
.badge-green { background: var(--green-soft); color: var(--green); }
.badge-amber { background: var(--amber-soft); color: var(--amber); }
.badge-red { background: var(--red-soft); color: #fca5a5; }
.badge-gray { background: var(--panel-hover); color: var(--text-muted); }
.badge-blue { background: rgba(96,165,250,0.14); color: #93c5fd; }
.badge-dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }

/* Tabs */
.tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }
.tab {
  background: var(--panel-2); border: 1px solid var(--border); color: var(--text-muted);
  padding: 8px 14px; border-radius: var(--radius-sm); cursor: pointer; font-weight: 600; font-size: 13px;
  display: inline-flex; align-items: center; gap: 7px;
}
.tab:hover { color: var(--text); }
.tab.active { background: var(--accent-soft); color: #fff; border-color: rgba(123,97,255,0.35); }

/* Toolbar (buscadores/filtros) */
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; justify-content: flex-end; }
.input, .select {
  background: var(--bg-2); border: 1px solid var(--border); color: var(--text);
  padding: 9px 12px; border-radius: var(--radius-sm); font-size: 13.5px; min-width: 160px;
}
.input:focus, .select:focus { outline: none; border-color: var(--accent); }

/* Tabla */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; min-width: 780px; }
table.data th {
  text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--text-dim); padding: 10px 12px; border-bottom: 1px solid var(--border); font-weight: 700;
}
table.data td { padding: 13px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.data tr:hover td { background: rgba(255,255,255,0.02); }
.cell-actions { display: flex; gap: 8px; justify-content: flex-end; align-items: center; }

/* Filas "por cobrar" / renovaciones */
.row-item {
  display: flex; justify-content: space-between; align-items: center; gap: 14px;
  padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--panel-2); flex-wrap: wrap;
}
.row-item + .row-item { margin-top: 10px; }
.row-info .row-name { font-weight: 700; font-size: 15px; }
.row-info .row-meta { color: var(--text-muted); font-size: 12.5px; margin-top: 2px; }
.row-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* Venta rápida cards */
.quick-card {
  background: var(--panel-2); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px; cursor: pointer; display: flex; flex-direction: column; gap: 6px; min-width: 200px;
  border-left: 3px solid var(--plat, var(--accent));
}
.quick-card:hover { background: var(--panel-hover); }
.quick-card .qc-title { font-weight: 700; display: flex; align-items: center; gap: 8px; }
.quick-card .qc-meta { color: var(--text-muted); font-size: 12.5px; }

/* Dropdown */
.dropdown { position: relative; display: inline-block; }
.dropdown-menu {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 40;
  background: var(--panel); border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  min-width: 190px; box-shadow: var(--shadow); overflow: hidden; padding: 6px;
}
.dropdown-menu button {
  display: block; width: 100%; text-align: left; background: none; border: none;
  color: var(--text); padding: 10px 12px; border-radius: 8px; cursor: pointer; font-size: 13.5px; font-weight: 600;
}
.dropdown-menu button:hover { background: var(--panel-hover); }
.dropdown-menu button.danger { color: #fca5a5; }
.dropdown-menu button.green { color: var(--green); }

/* ---------- Modales ---------- */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(3, 5, 10, 0.66);
  display: flex; align-items: center; justify-content: center; padding: 20px; z-index: 100;
  backdrop-filter: blur(2px);
}
.modal {
  background: var(--panel); border: 1px solid var(--border-strong); border-radius: 18px;
  width: 100%; max-width: 720px; max-height: 92vh; overflow-y: auto; box-shadow: var(--shadow);
}
.modal.narrow { max-width: 460px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 22px 26px 6px; }
.modal-head h2 { font-size: 22px; }
.modal-close {
  background: var(--panel-2); border: 1px solid var(--border); color: var(--text-muted);
  width: 34px; height: 34px; border-radius: 50%; cursor: pointer; font-size: 16px;
}
.modal-close:hover { background: var(--panel-hover); color: var(--text); }
.modal-body { padding: 14px 26px 26px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 6px 26px 24px; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 18px; }
.form-grid .full { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 12px; color: var(--text-muted); font-weight: 700; }
.field input, .field select, .field textarea {
  background: var(--bg-2); border: 1px solid var(--border); color: var(--text);
  padding: 11px 13px; border-radius: var(--radius-sm); font-size: 14px; font-family: inherit;
}
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--accent); }
.field textarea { resize: vertical; min-height: 74px; }
.field .hint { font-size: 11px; color: var(--text-dim); }
.field.readonly input { color: var(--text-muted); }

/* Date picker */
.datewrap { position: relative; }
.calendar {
  position: absolute; top: calc(100% + 6px); left: 0; z-index: 50; width: 300px;
  background: var(--panel); border: 1px solid var(--border-strong); border-radius: var(--radius);
  padding: 14px; box-shadow: var(--shadow);
}
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.cal-head .cal-title { font-weight: 700; }
.cal-nav { background: var(--panel-2); border: 1px solid var(--border); color: var(--text); width: 30px; height: 30px; border-radius: 8px; cursor: pointer; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; }
.cal-dow { text-align: center; font-size: 10.5px; color: var(--text-dim); padding: 4px 0; font-weight: 700; }
.cal-day {
  text-align: center; padding: 7px 0; border-radius: 8px; cursor: pointer; font-size: 13px;
  border: 1px solid transparent;
}
.cal-day:hover { background: var(--panel-hover); }
.cal-day.other { color: var(--text-dim); }
.cal-day.selected { background: var(--accent); color: #fff; font-weight: 700; }
.cal-day.today { border-color: var(--accent); }

/* Ajustes rows */
.settings-row { display: grid; grid-template-columns: 1fr 1fr 1fr auto; gap: 10px; align-items: end; margin-bottom: 10px; }
.settings-cat-row { display: flex; gap: 10px; align-items: center; margin-bottom: 8px; }
.settings-cat-row input { flex: 1; }
.section-title { font-size: 16px; font-weight: 700; margin: 22px 0 4px; }
.section-sub { color: var(--text-muted); font-size: 12.5px; margin-bottom: 12px; }

/* Avisar clientes */
.notify-item {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 13px 15px; border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 10px; flex-wrap: wrap;
}
.notify-item .ni-name { font-weight: 700; }
.notify-item .ni-meta { color: var(--text-muted); font-size: 12.5px; }

/* Ver datos */
.data-line { display: flex; justify-content: space-between; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--border); }
.data-line:last-child { border-bottom: none; }
.data-line .dl-label { color: var(--text-muted); }
.data-line .dl-value { font-weight: 600; word-break: break-all; text-align: right; }

/* Toasts */
.toast-root { position: fixed; bottom: 22px; right: 22px; z-index: 200; display: flex; flex-direction: column; gap: 10px; }
.toast {
  background: var(--panel); border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  padding: 12px 16px; box-shadow: var(--shadow); font-size: 13.5px; font-weight: 600; min-width: 220px;
  animation: slideIn 0.2s ease;
}
.toast.success { border-left: 3px solid var(--green); }
.toast.error { border-left: 3px solid var(--red); }
.toast.info { border-left: 3px solid var(--accent); }
@keyframes slideIn { from { transform: translateX(30px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

.confirm-text { color: var(--text-muted); margin: 6px 0 4px; line-height: 1.55; }

.libres-block { margin-bottom: 22px; }
.libres-block-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; gap: 10px; }
.libres-block-head .lb-title { font-weight: 700; font-size: 16px; display: flex; align-items: center; gap: 9px; }
.libres-block-head .lb-sub { color: var(--text-muted); font-size: 12.5px; }

/* ---------- Responsive / móvil ---------- */
@media (max-width: 980px) {
  .kpi-row { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .sidebar {
    position: fixed; z-index: 60; left: 0; top: 0; width: 250px;
    transform: translateX(-100%); transition: transform 0.22s ease;
  }
  .sidebar.open { transform: translateX(0); }
  .hamburger { display: inline-flex; align-items: center; justify-content: center; }
  .topbar { padding: 16px 18px 12px; align-items: center; }
  .topbar-title h1 { font-size: 22px; }
  .topbar-date { font-size: 12px; }
  .topbar-beta { display: none; }
  .topbar-actions { width: 100%; }
  .topbar-actions .btn { flex: 1; justify-content: center; }
  .view { padding: 6px 18px 60px; }
  .panel { padding: 16px; }
  .panel-head { flex-direction: column; align-items: stretch; gap: 12px; }
  .panel-head .input { width: 100%; }
  .toolbar { justify-content: stretch; }
  .toolbar .input, .toolbar .select { flex: 1; min-width: 0; width: 100%; }
  .form-grid { grid-template-columns: 1fr; }
  .settings-row { grid-template-columns: 1fr; gap: 6px; }
  .settings-row .pm-action { justify-self: start; }
  .cards-grid { grid-template-columns: 1fr; }
  .row-item { flex-direction: column; align-items: stretch; }
  .row-actions { justify-content: flex-start; }
  .modal { max-width: 100%; border-radius: 16px; }
  .modal-head { padding: 18px 18px 4px; }
  .modal-head h2 { font-size: 19px; }
  .modal-body { padding: 12px 18px 18px; }
  .modal-foot { padding: 6px 18px 20px; }
  .calendar { width: 280px; }
  .data-line { flex-direction: column; gap: 2px; }
  .data-line .dl-value { text-align: left; }
  .toast-root { left: 14px; right: 14px; bottom: 14px; }
  .toast { min-width: 0; }
}
@media (max-width: 460px) {
  .topbar-actions { flex-direction: column; }
  .cal-day { padding: 9px 0; }
}
