/* =========================================================
   YN CRECIENDO VIRAL · Panel de administración
   Morado YN sobre negros tintados
   ========================================================= */
:root {
  --bg: #09070d;
  --surface: #141019;
  --surface-2: #1c1626;
  --surface-3: #251d33;
  --line: #2a2238;
  --purple: #8050ed;
  --purple-hi: #9a73f6;
  --lilac: #b298ff;
  --chart: #9b6bff;
  --text: #f5f1fc;
  --muted: #b5a9c9;
  --dim: #7d7191;
  --danger: #ff7a98;
  --ok: #5fd4a0;
  --warn: #f5c05a;
  --radius: 16px;
  --font-display: "Unbounded", "Manrope", system-ui, sans-serif;
  --font-body: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { min-height: 100%; }
body {
  margin: 0;
  background:
    radial-gradient(60vmax 40vmax at 0% 0%, rgba(128, 80, 237, .14), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font: 500 14.5px/1.5 var(--font-body);
  -webkit-font-smoothing: antialiased;
}
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--lilac); }
code { font: 500 12.5px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
:focus-visible { outline: 2px solid var(--lilac); outline-offset: 2px; }

/* ---------- Marca ---------- */
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); }
.logo {
  display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px;
  background: linear-gradient(135deg, var(--purple), #5b33c4); color: #fff;
  font: 800 13px/1 var(--font-display); letter-spacing: .02em;
}
.brand-text { font: 800 11.5px/1.15 var(--font-display); letter-spacing: .08em; }
.brand-text span { color: var(--lilac); }
.brand-lg .logo { width: 44px; height: 44px; font-size: 16px; border-radius: 13px; }
.brand-lg .brand-text { font-size: 13px; }

/* ---------- Botones y campos ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 18px; border-radius: 12px; border: 1px solid transparent;
  font-weight: 700; text-decoration: none; transition: background .15s, border-color .15s, transform .1s;
}
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .55; cursor: progress; }
.btn-primary { background: var(--purple); color: #fff; }
.btn-primary:hover { background: var(--purple-hi); }
.btn-danger { background: #c23a5c; color: #fff; }
.btn-danger:hover { background: #d84a6e; }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--purple); }
.btn-soft { background: var(--surface-2); color: var(--text); border-color: var(--line); }
.btn-soft:hover { border-color: var(--purple); }
.btn-sm { padding: 7px 12px; font-size: 13px; border-radius: 10px; }
.btn-sm svg { width: 16px; height: 16px; }
.field { display: grid; gap: 6px; text-align: left; }
.field span { color: var(--muted); font-size: 13px; font-weight: 700; }
.field input, .field textarea {
  width: 100%; padding: 12px 14px; border-radius: 12px;
  background: var(--bg); border: 1px solid var(--line); outline: none; resize: vertical;
}
.field input:focus, .field textarea:focus { border-color: var(--purple); }
.form-status { min-height: 1.4em; margin: 0; font-size: 13px; color: var(--muted); }
.form-status.is-error { color: var(--danger); }
.form-status.is-ok { color: var(--ok); }

/* ---------- Acceso ---------- */
.gate { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 24px; }
.gate-card {
  width: 100%; max-width: 420px; padding: 32px 28px; border-radius: 22px;
  background: var(--surface); border: 1px solid var(--line);
  box-shadow: 0 30px 80px -30px rgba(128, 80, 237, .45);
  display: grid; gap: 16px; text-align: center; justify-items: center;
}
.eyebrow { color: var(--lilac); font-size: 12px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
.gate-step { display: grid; gap: 14px; width: 100%; justify-items: center; }
.gate-step h1 { margin: 0; font: 800 20px/1.25 var(--font-display); }
.gate-text { margin: 0; color: var(--muted); }
.gate-form { justify-items: stretch; text-align: left; }
.gate-form h1, .gate-form .gate-text { text-align: center; }
.gate-icon { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 16px; background: rgba(128, 80, 237, .16); color: var(--lilac); }
.gate-icon svg { width: 26px; height: 26px; }
.gate-icon-danger { background: rgba(255, 122, 152, .12); color: var(--danger); }
.gate-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.uid-box { width: 100%; display: grid; gap: 8px; padding: 14px; border-radius: 14px; background: var(--bg); border: 1px solid var(--line); }
.uid-box span { color: var(--dim); font-size: 12px; font-weight: 700; }
.uid-box code { word-break: break-all; color: var(--text); }
.spinner { width: 30px; height: 30px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--purple); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Estructura ---------- */
.shell { display: grid; grid-template-columns: 252px minmax(0, 1fr); min-height: 100vh; }
.side {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 22px;
  padding: 22px 16px; background: rgba(12, 9, 18, .85); border-right: 1px solid var(--line);
  backdrop-filter: blur(12px);
}
.side-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 0 6px; }
.side-out { display: none; margin-left: auto; }
.side-badge {
  padding: 3px 9px; border-radius: 999px; background: rgba(128, 80, 237, .18); color: var(--lilac);
  font-size: 11px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase;
}
.nav { display: grid; gap: 4px; }
.nav-item {
  display: flex; align-items: center; gap: 12px; width: 100%; padding: 11px 12px;
  border: 0; border-radius: 12px; background: transparent; color: var(--muted); font-weight: 700; text-align: left;
}
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item[aria-current="page"] { background: linear-gradient(90deg, rgba(128, 80, 237, .28), rgba(128, 80, 237, .08)); color: var(--text); box-shadow: inset 3px 0 0 var(--purple); }
.nav-item span { flex: 1; }
.nav-count { min-width: 22px; padding: 1px 7px; border-radius: 999px; background: var(--danger); color: #1a0a10; font-size: 12px; text-align: center; }
.side-foot { margin-top: auto; display: grid; gap: 12px; padding: 14px 8px 0; border-top: 1px solid var(--line); }
.me { display: flex; align-items: center; gap: 10px; min-width: 0; }
.me div { display: grid; min-width: 0; }
.me b, .me small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me small { color: var(--dim); font-size: 12px; }
.side-links { display: flex; gap: 14px; font-size: 13px; }
.side-links a, .side-links button { padding: 0; border: 0; background: none; color: var(--muted); font-weight: 700; text-decoration: none; }
.side-links a:hover, .side-links button:hover { color: var(--text); }

.main { padding: 28px clamp(16px, 3vw, 40px) 60px; outline: none; max-width: 1240px; width: 100%; }
.main-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 24px; }
.main-head h1 { margin: 0; font: 800 24px/1.2 var(--font-display); }
.main-head p { margin: 4px 0 0; color: var(--muted); }
.block-title { margin: 32px 0 12px; font: 800 13px/1.2 var(--font-display); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }

/* ---------- Avatares ---------- */
.avatar {
  --h: 260; position: relative; display: grid; place-items: center; flex: none; overflow: hidden;
  width: 36px; height: 36px; border-radius: 50%;
  background: linear-gradient(135deg, hsl(var(--h) 70% 58%), hsl(calc(var(--h) + 30) 60% 38%));
  color: #fff; font-weight: 800; text-transform: uppercase;
}
.avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.avatar-lg { width: 46px; height: 46px; font-size: 17px; }

/* ---------- KPIs ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(178px, 1fr)); gap: 12px; }
.kpi {
  display: grid; gap: 4px; padding: 18px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--line); text-align: left;
}
button.kpi:hover { border-color: var(--purple); }
.kpi-label { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; font-weight: 700; }
.kpi-label svg { width: 17px; height: 17px; color: var(--lilac); }
.kpi-value { font: 800 28px/1.15 var(--font-display); letter-spacing: -.01em; }
.kpi-foot { color: var(--dim); font-size: 12.5px; }
.kpi-alert { border-color: rgba(255, 122, 152, .45); background: linear-gradient(180deg, rgba(255, 122, 152, .08), var(--surface) 70%); }
.kpi-alert .kpi-label svg { color: var(--danger); }

/* ---------- Gráficos ---------- */
.charts { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.chart { padding: 16px 16px 10px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); }
.chart h3 { margin: 0; font-size: 14px; font-weight: 800; }
.chart p { margin: 2px 0 8px; color: var(--dim); font-size: 12.5px; }
.chart-svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart-svg .grid { stroke: #241d30; stroke-width: 1; }
.chart-svg .axis { stroke: #3a3049; stroke-width: 1; }
.chart-svg .tick { fill: var(--dim); font-size: 10px; font-family: var(--font-body); }
.chart-svg .bar { fill: var(--chart); transition: opacity .12s; }
.chart-svg .hit { fill: transparent; outline: none; }
.chart-svg.is-hovering .bar { opacity: .45; }
.chart-svg.is-hovering .bar.is-hot { opacity: 1; }
.tooltip {
  position: fixed; z-index: 50; pointer-events: none; transform: translate(-50%, calc(-100% - 10px));
  padding: 7px 10px; border-radius: 10px; background: #f5f1fc; color: #140f1c;
  font-size: 12.5px; line-height: 1.35; white-space: nowrap; box-shadow: 0 10px 30px -10px #000;
}
.tooltip b { display: block; font-weight: 800; }
.data-table { margin-top: 12px; color: var(--muted); }
.data-table summary { cursor: pointer; font-size: 13px; font-weight: 700; width: max-content; }
.table-scroll { overflow-x: auto; margin-top: 10px; border-radius: 12px; border: 1px solid var(--line); }
.data-table table { width: 100%; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
.data-table th, .data-table td { padding: 8px 12px; text-align: right; border-bottom: 1px solid var(--line); }
.data-table th:first-child, .data-table td:first-child { text-align: left; }
.data-table th { color: var(--text); background: var(--surface-2); }
.data-table tr:last-child td { border-bottom: 0; }

.top-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; counter-reset: top; }
.top-list li {
  counter-increment: top; display: grid; grid-template-columns: 30px minmax(0, 1fr) auto; align-items: center; gap: 12px;
  padding: 12px 16px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line);
}
.top-list li::before { content: counter(top); font: 800 15px/1 var(--font-display); color: var(--lilac); }
.top-list .t-main { display: grid; min-width: 0; }
.top-list .t-main b, .top-list .t-main span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top-list .t-main span { color: var(--muted); font-size: 13px; }
.top-list .t-views { display: flex; align-items: center; gap: 6px; font-weight: 800; font-variant-numeric: tabular-nums; }
.top-list .t-views svg { width: 16px; height: 16px; color: var(--dim); }

/* ---------- Barra de filtros ---------- */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 4px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); }
.chips button { padding: 7px 14px; border: 0; border-radius: 10px; background: transparent; color: var(--muted); font-size: 13px; font-weight: 700; }
.chips button:hover { color: var(--text); }
.chips button[aria-selected="true"] { background: var(--purple); color: #fff; }
.search {
  display: flex; align-items: center; gap: 8px; flex: 1 1 260px; max-width: 380px;
  padding: 0 14px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line);
}
.search:focus-within { border-color: var(--purple); }
.search svg { color: var(--dim); width: 18px; height: 18px; }
.search input { flex: 1; min-width: 0; padding: 11px 0; border: 0; background: none; outline: none; }

/* ---------- Tarjetas ---------- */
.list { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 12px; }
.card {
  display: grid; grid-template-columns: 116px minmax(0, 1fr); gap: 16px; padding: 14px;
  border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line);
}
.card.is-pending { border-color: rgba(255, 122, 152, .35); }
.card-text { grid-template-columns: minmax(0, 1fr); }
.media { position: relative; aspect-ratio: 9 / 16; border-radius: 12px; overflow: hidden; background: #000; align-self: start; }
.media video { width: 100%; height: 100%; object-fit: cover; display: block; }
.media-gone { display: grid; place-items: center; gap: 6px; padding: 10px; text-align: center; color: var(--dim); font-size: 12px; background: repeating-linear-gradient(135deg, #120e18 0 8px, #17121f 8px 16px); }
.media-gone svg { color: var(--danger); }
.card-body { display: grid; gap: 8px; align-content: start; min-width: 0; }
.card-top { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.card-title { margin: 0; font-size: 15px; font-weight: 800; }
.card-desc { margin: 0; color: var(--muted); font-size: 13.5px; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.quote { margin: 0; padding: 8px 12px; border-left: 3px solid var(--purple); border-radius: 0 10px 10px 0; background: var(--surface-2); font-size: 13.5px; overflow-wrap: anywhere; }
.meta { display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 0; color: var(--dim); font-size: 12.5px; }
.meta b { color: var(--muted); font-weight: 700; }
.meta span { display: inline-flex; align-items: center; gap: 5px; }
.meta svg { width: 14px; height: 14px; }
.review { margin: 0; padding: 8px 12px; border-radius: 10px; background: var(--bg); color: var(--muted); font-size: 12.5px; }
.actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.actions .btn-danger-soft { background: rgba(255, 122, 152, .1); color: var(--danger); border-color: rgba(255, 122, 152, .35); }
.actions .btn-danger-soft:hover { background: rgba(255, 122, 152, .18); border-color: var(--danger); }
.actions .btn-ok-soft { background: rgba(95, 212, 160, .1); color: var(--ok); border-color: rgba(95, 212, 160, .35); }
.actions .btn-ok-soft:hover { background: rgba(95, 212, 160, .18); border-color: var(--ok); }
.user-link { padding: 0; border: 0; background: none; color: var(--text); font-weight: 800; }

.badge {
  display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px;
  font-size: 11.5px; font-weight: 800; background: var(--surface-3); color: var(--muted); white-space: nowrap;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-plain::before { display: none; }
.badge-pending { background: rgba(255, 122, 152, .14); color: var(--danger); }
.badge-ok { background: rgba(95, 212, 160, .12); color: var(--ok); }
.badge-muted { background: var(--surface-3); color: var(--dim); }
.badge-warn { background: rgba(245, 192, 90, .12); color: var(--warn); }
.badge-admin { background: rgba(128, 80, 237, .2); color: var(--lilac); }

/* ---------- Usuarios ---------- */
.users { display: grid; gap: 8px; }
.user {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 14px;
  padding: 14px 16px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line);
}
.user.is-suspended { border-color: rgba(255, 122, 152, .35); background: linear-gradient(90deg, rgba(255, 122, 152, .06), var(--surface) 40%); }
.user-main { display: grid; gap: 3px; min-width: 0; }
.user-name { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.user-name b { font-size: 15px; }
.user-mail { color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }
.uid { display: inline-flex; align-items: center; gap: 6px; padding: 0; border: 0; background: none; color: var(--dim); font-size: 11.5px; text-align: left; }
.uid:hover { color: var(--lilac); }
.uid svg { width: 13px; height: 13px; }
.user .actions { margin: 0; justify-content: flex-end; }

/* ---------- Registro ---------- */
.log { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); overflow: hidden; }
.log > li { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.log > li:last-child { border-bottom: 0; }
.log-icon { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: var(--surface-3); color: var(--lilac); }
.log-icon svg { width: 17px; height: 17px; }
.log-icon.is-danger { background: rgba(255, 122, 152, .12); color: var(--danger); }
.log-icon.is-ok { background: rgba(95, 212, 160, .12); color: var(--ok); }
.log-main { display: grid; gap: 3px; min-width: 0; }
.log-main p { margin: 0; overflow-wrap: anywhere; }
.log-main .log-sub { color: var(--dim); font-size: 12.5px; }
.log-time { color: var(--dim); font-size: 12px; white-space: nowrap; }

/* ---------- Estados ---------- */
.sk { min-height: 150px; border-radius: var(--radius); background: linear-gradient(90deg, var(--surface) 0%, var(--surface-2) 50%, var(--surface) 100%); background-size: 200% 100%; animation: sk 1.2s ease-in-out infinite; border: 1px solid var(--line); }
.kpis .sk { min-height: 104px; }
.users .sk, .log .sk { min-height: 72px; border-radius: 0; border-width: 0 0 1px; }
.users .sk { border-radius: var(--radius); border-width: 1px; }
@keyframes sk { from { background-position: 100% 0; } to { background-position: -100% 0; } }
.empty { grid-column: 1 / -1; display: grid; justify-items: center; gap: 6px; padding: 40px 20px; border-radius: var(--radius); border: 1px dashed var(--line); color: var(--muted); text-align: center; }
.empty b { color: var(--text); font-size: 15px; }
.empty.is-error { border-color: rgba(255, 122, 152, .4); }
.empty.is-error b { color: var(--danger); }
.more { display: flex; margin: 16px auto 0; }

/* ---------- Diálogo ---------- */
.modal {
  width: min(460px, calc(100% - 32px)); padding: 0; border: 1px solid var(--line); border-radius: 20px;
  background: var(--surface); color: var(--text); box-shadow: 0 30px 80px -20px #000;
}
.modal::backdrop { background: rgba(5, 3, 8, .72); backdrop-filter: blur(4px); }
.modal-inner { display: grid; gap: 14px; padding: 24px; }
.modal h2 { margin: 0; font: 800 18px/1.3 var(--font-display); }
.modal-text { margin: 0; color: var(--muted); }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; }

.toast {
  position: fixed; left: 50%; bottom: 24px; z-index: 60; transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  max-width: calc(100% - 32px); padding: 12px 18px; border-radius: 14px; background: #f5f1fc; color: #140f1c;
  font-weight: 700; box-shadow: 0 16px 40px -14px #000; transition: opacity .2s, transform .2s;
}
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }
.noscript { padding: 24px; text-align: center; }

/* ---------- Móvil ---------- */
@media (max-width: 880px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: sticky; top: 0; z-index: 20; height: auto; flex-direction: column; gap: 10px; padding: 12px 12px 8px; border-right: 0; border-bottom: 1px solid var(--line); }
  .nav { display: flex; overflow-x: auto; gap: 4px; scrollbar-width: none; }
  .nav::-webkit-scrollbar { display: none; }
  .nav-item { width: auto; flex: none; padding: 8px 12px; }
  .nav-item[aria-current="page"] { box-shadow: inset 0 -2px 0 var(--purple); }
  .side-foot { display: none; }
  .side-out { display: inline-flex; }
  .main { padding-top: 20px; }
  .list { grid-template-columns: 1fr; }
  .user { grid-template-columns: auto minmax(0, 1fr); }
  .user .actions { grid-column: 1 / -1; justify-content: flex-start; }
}
@media (max-width: 420px) {
  .card { grid-template-columns: 92px minmax(0, 1fr); gap: 12px; }
  .main-head h1 { font-size: 20px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
