/* Backoffice Kike Bañuls Elite */
:root {
  --bg: #0b0b0d;
  --bg-2: #121216;
  --card: #18181d;
  --input: #0f0f13;
  --text: #f4f1ea;
  --muted: #a39e94;
  --gold: #d4a94f;
  --gold-2: #f0d48a;
  --line: rgba(255, 255, 255, .09);
  --line-gold: rgba(212, 169, 79, .35);
  --ok: #3fb96b;
  --warn: #e8a33a;
  --bad: #e0453a;
  --save: #2f9e57;
  --save-h: #27884a;
  --cancel: #d63c32;
  --cancel-h: #b9322a;
  --radius: 14px;
}
html.day {
  --bg: #f4f1ea;
  --bg-2: #ebe6db;
  --card: #ffffff;
  --input: #faf8f4;
  --text: #19181b;
  --muted: #5e5950;
  --gold: #8e661b;
  --gold-2: #b08534;
  --line: rgba(0, 0, 0, .1);
  --line-gold: rgba(142, 102, 27, .4);
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font: 17px/1.5 Inter, system-ui, sans-serif; }
a { color: var(--gold); }
[hidden] { display: none !important; }
svg { flex: none; }

/* Barra superior */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 20px;
  height: 64px; padding: 0 20px;
  background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); }
.brand b { font: italic 800 22px/1 "Barlow Condensed", sans-serif; text-transform: uppercase; letter-spacing: .02em; }
.brand b span { color: var(--gold); }
.brand small { font-size: 12px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 2px 8px; }
.mainnav { display: flex; gap: 4px; margin-left: 12px; }
.mainnav a { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-radius: 10px; color: var(--muted); text-decoration: none; font-weight: 500; }
.mainnav a svg { width: 20px; height: 20px; }
.mainnav a:hover { color: var(--text); background: var(--card); }
.mainnav a.on { color: var(--gold); background: var(--card); }
.top-actions { margin-left: auto; display: flex; gap: 6px; }
.icon-btn { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 50%; border: 1px solid var(--line); background: transparent; color: var(--muted); cursor: pointer; text-decoration: none; }
.icon-btn:hover { color: var(--gold); border-color: var(--line-gold); }
.icon-btn svg { width: 20px; height: 20px; }

.wrap { max-width: 1240px; margin: 0 auto; padding: 28px 20px 120px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.page-head h1 { font: italic 800 clamp(36px, 5vw, 52px)/1 "Barlow Condensed", sans-serif; text-transform: uppercase; margin: 4px 0 0; }
.page-head .count { font: 600 18px Inter, sans-serif; color: var(--muted); vertical-align: middle; }
.page-head .meta { margin: 10px 0 0; color: var(--muted); font-size: 16px; }
.kicker { margin: 0; font-size: 13px; font-weight: 600; letter-spacing: .22em; text-transform: uppercase; color: var(--gold); }
.kicker a { color: inherit; text-decoration: none; }
.head-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.muted { color: var(--muted); font-weight: 400; }

/* Botones (convención: Guardar verde, Cancelar rojo) */
.btn-save, .btn-cancel, .btn-danger, .btn-ghost {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 0 22px; border-radius: 12px; border: 1px solid transparent;
  font: 600 16px Inter, sans-serif; text-decoration: none; cursor: pointer; white-space: nowrap;
  transition: background .15s, transform .1s;
}
.btn-save { background: var(--save); color: #fff; }
.btn-save:hover { background: var(--save-h); }
.btn-cancel { background: var(--cancel); color: #fff; }
.btn-cancel:hover { background: var(--cancel-h); }
.btn-danger { background: var(--bad); color: #fff; }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--line-gold); color: var(--gold); }
.btn-ghost svg { width: 18px; height: 18px; }
.btn-ghost.small { min-height: 38px; padding: 0 14px; font-size: 15px; }
.btn-save:active, .btn-cancel:active, .btn-ghost:active { transform: scale(.98); }
.btn-save.wide { width: 100%; margin-top: 18px; }
.btn-link { background: none; border: 0; color: var(--muted); font: 600 16px Inter, sans-serif; cursor: pointer; padding: 10px 4px; text-decoration: underline; text-underline-offset: 3px; }
.btn-link.danger { color: var(--bad); }

/* Tarjetas y cifras */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; margin-bottom: 18px; }
.card h2 { font-size: 19px; margin: 0 0 16px; }
.card-head { display: flex; justify-content: space-between; align-items: baseline; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 18px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.stat .n { display: block; font: italic 800 48px/1 "Barlow Condensed", sans-serif; }
.stat .n.gold { color: var(--gold); }
.stat .l { display: block; margin-top: 6px; color: var(--muted); font-size: 15px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.grid-2 .card { margin-bottom: 18px; }
.empty { color: var(--muted); margin: 0; }
.empty-big { text-align: center; padding: 48px 22px; }
.empty-big p { color: var(--muted); font-size: 18px; margin: 0 0 16px; }

.bars { display: grid; gap: 8px; }
.bar-row { display: grid; grid-template-columns: 170px 1fr 36px; align-items: center; gap: 12px; text-decoration: none; color: var(--text); padding: 6px 0; }
.bar-label { display: flex; align-items: center; gap: 8px; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex: none; }
.bar-track { height: 10px; border-radius: 99px; background: var(--bg-2); overflow: hidden; }
.bar-fill { display: block; height: 100%; border-radius: 99px; min-width: 2px; }
.bar-row b { text-align: right; }

.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.list li:first-child { border-top: 0; }
.list li a { text-decoration: none; color: var(--text); min-width: 0; }
.list li a b { display: block; }
.list li a span { color: var(--muted); font-size: 15px; }

/* Insignias */
.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 14px; font-weight: 600; white-space: nowrap; border: 1px solid var(--line); color: var(--text); }
.badge[style*="--c"] { border-color: color-mix(in srgb, var(--c) 60%, transparent); background: color-mix(in srgb, var(--c) 16%, transparent); }
.badge.ok { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 50%, transparent); }
.badge.warn { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 50%, transparent); }
.badge.bad { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 50%, transparent); }
.badge.none { color: var(--muted); }
.state { font-weight: 600; font-size: 15px; }
.st-activo { color: var(--ok); }
.st-pausado { color: var(--warn); }
.st-baja { color: var(--muted); }

/* Filtros */
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding: 14px; }
.f-search { flex: 1 1 320px; position: relative; }
.f-search svg { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); width: 20px; height: 20px; color: var(--muted); }
.f-search input { padding-left: 44px; }

/* Formularios */
input, select, textarea {
  width: 100%; min-height: 46px; padding: 10px 14px;
  background: var(--input); color: var(--text);
  border: 1px solid var(--line); border-radius: 10px;
  font: 17px Inter, sans-serif;
}
textarea { resize: vertical; line-height: 1.45; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px color-mix(in srgb, var(--gold) 22%, transparent); }
input[type="checkbox"] { width: 22px; height: 22px; min-height: 0; accent-color: var(--gold); }
input[type="color"] { padding: 4px; height: 46px; cursor: pointer; }
.filters select { width: auto; flex: 0 1 auto; }
.fields { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px 18px; }
.fields label { display: flex; flex-direction: column; gap: 6px; font-size: 16px; font-weight: 600; color: var(--muted); }
.fields label.check { flex-direction: row; align-items: center; gap: 12px; color: var(--text); font-weight: 500; }
.fields .span-2 { grid-column: span 2; }
.fields .span-3 { grid-column: 1 / -1; }
/* Avatares de clientes */
.avatar { width: var(--s, 44px); height: var(--s, 44px); border-radius: 50%; object-fit: cover; flex: none; display: inline-block; background: var(--bg-2); border: 2px solid var(--line-gold); }
.avatar.ini { display: inline-grid; place-items: center; font: 700 calc(var(--s, 44px) * .38)/1 Inter, sans-serif; color: #fff; background: hsl(var(--h, 40) 45% 38%); border-color: transparent; }
.td-client { display: flex; align-items: center; gap: 12px; }
.li-client { display: flex; align-items: center; gap: 12px; }
.li-client > span b { display: block; }
.li-client > span > span { color: var(--muted); font-size: 15px; }
.head-with-avatar { display: flex; align-items: center; gap: 18px; }
.photo-row { display: flex; align-items: center; gap: 18px; margin-bottom: 18px; }
.photo-row > div { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
.file-btn { cursor: pointer; }
.check-inline { display: inline-flex; align-items: center; gap: 8px; font-size: 15px; color: var(--muted); cursor: pointer; }
.check-inline input { width: 20px; height: 20px; min-height: 0; accent-color: var(--bad); }
.pw-gen { display: flex; gap: 8px; }
.pw-gen input { flex: 1; font-family: ui-monospace, Consolas, monospace; }
input:disabled { opacity: .75; }
.hint { font-weight: 400; font-size: 14px; color: var(--muted); }
.has-error input, .has-error select { border-color: var(--bad); }
.field-error { color: var(--bad); font-size: 14px; font-weight: 600; }
.form-actions { display: flex; align-items: center; gap: 12px; margin-top: 8px; }
.form-actions .grow { flex: 1; }
.form-actions.sticky {
  position: sticky; bottom: 0; z-index: 10;
  background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(10px);
  padding: 14px 0; border-top: 1px solid var(--line);
}

/* Tabla de clientes */
.table-wrap { padding: 0; overflow: hidden; }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 13px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); padding: 14px 16px; border-bottom: 1px solid var(--line); background: var(--bg-2); }
.table td { padding: 14px 16px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table tbody tr { cursor: pointer; }
.table tbody tr:hover { background: color-mix(in srgb, var(--gold) 6%, transparent); }
.table tr:last-child td { border-bottom: 0; }
.table td a { color: var(--text); text-decoration: none; }
.table td small { display: block; color: var(--muted); font-size: 14px; margin-top: 2px; }

/* Membresías */
.m-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.m-card { position: relative; display: flex; flex-direction: column; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; overflow: hidden; }
.m-card::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 4px; background: var(--c); }
.m-card.off { opacity: .6; }
.m-top { display: flex; justify-content: space-between; align-items: center; }
.m-access { font-size: 13px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--c); }
.m-card h3 { font: italic 800 30px/1.05 "Barlow Condensed", sans-serif; text-transform: uppercase; margin: 10px 0 4px; }
.m-price { font-size: 22px; font-weight: 600; margin: 0 0 8px; }
.m-price small { font-size: 16px; color: var(--muted); font-weight: 500; }
.m-perks { margin: 8px 0 0; padding-left: 20px; }
.m-perks li { margin: 4px 0; }
.m-meta { color: var(--muted); font-size: 15px; margin: 12px 0 0; }
.m-foot { margin-top: auto; padding-top: 16px; display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.m-foot a { color: var(--text); text-decoration: none; font-size: 15px; }

/* Popups: cierran con la X roja, con Cancelar o pulsando fuera */
.modal { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 16px; background: rgba(0, 0, 0, .6); backdrop-filter: blur(3px); }
.modal-box { position: relative; width: min(760px, 100%); max-height: calc(100vh - 32px); overflow: auto; background: var(--card); border: 1px solid var(--line-gold); border-radius: 18px; padding: 26px; }
.modal-box.small { width: min(460px, 100%); }
.modal-box h3 { margin: 0 0 16px; font-size: 22px; padding-right: 40px; }
.modal-box .fields { grid-template-columns: repeat(2, 1fr); }
.modal-box .form-actions { margin-top: 22px; }
.modal-x {
  position: absolute; top: 14px; right: 14px; width: 36px; height: 36px;
  border: 0; border-radius: 8px; background: var(--cancel); color: #fff;
  font-size: 26px; line-height: 1; cursor: pointer; display: grid; place-items: center;
}
.modal-x:hover { background: var(--cancel-h); }

/* Avisos */
.toast { position: fixed; top: 76px; left: 50%; transform: translateX(-50%); z-index: 120; padding: 14px 22px; border-radius: 12px; font-weight: 600; box-shadow: 0 10px 30px rgba(0, 0, 0, .35); cursor: pointer; max-width: calc(100% - 32px); }
.toast.ok { background: var(--save); color: #fff; }
.toast.bad { background: var(--bad); color: #fff; }

/* Login */
.login-body { min-height: 100vh; display: grid; place-items: center; padding: 16px; background: radial-gradient(ellipse at top, var(--bg-2), var(--bg) 70%); }
.login-card { width: min(400px, 100%); background: var(--card); border: 1px solid var(--line-gold); border-radius: 20px; padding: 34px 28px; text-align: center; }
.login-card h1 { font: italic 800 34px/1 "Barlow Condensed", sans-serif; text-transform: uppercase; margin: 14px 0 4px; }
.login-card h1 span { color: var(--gold); }
.login-card label { display: block; text-align: left; margin: 22px 0 6px; font-weight: 600; color: var(--muted); }
.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 52px; }
.pw-eye { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); width: 44px; height: 44px; border: 0; background: none; color: var(--muted); cursor: pointer; display: grid; place-items: center; }
.pw-eye svg { width: 20px; height: 20px; }
.login-error { color: var(--bad); font-weight: 600; margin: 12px 0 0; }

/* Barra inferior en móvil */
@media (max-width: 900px) {
  /* Sin backdrop-filter: si no, la barra fija inferior se posiciona dentro de la cabecera */
  .topbar { backdrop-filter: none; background: var(--bg); }
  .mainnav {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; margin: 0;
    display: grid; grid-template-columns: repeat(6, 1fr);
    background: color-mix(in srgb, var(--bg-2) 95%, transparent); backdrop-filter: blur(12px);
    border-top: 1px solid var(--line);
    padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
  }
  .mainnav a { flex-direction: column; gap: 3px; font-size: 13px; padding: 8px 4px; justify-content: center; }
  .mainnav a.on { background: transparent; }
  .brand small { display: none; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .grid-2 { grid-template-columns: 1fr; }
  .fields { grid-template-columns: repeat(2, 1fr); }
  .form-actions.sticky { bottom: 70px; }
}
@media (max-width: 640px) {
  .topbar { padding: 0 12px; gap: 8px; }
  .brand b { font-size: 19px; }
  .wrap { padding: 20px 16px 140px; }
  .fields, .modal-box .fields { grid-template-columns: 1fr; }
  .fields .span-2, .modal-box .fields .span-2 { grid-column: auto; }
  .filters select, .filters .btn-save { flex: 1 1 calc(50% - 5px); }
  .bar-row { grid-template-columns: 120px 1fr 30px; }
  .head-actions { width: 100%; }
  .head-actions > * { flex: 1; }
  /* La tabla pasa a tarjetas */
  .table-wrap { background: transparent; border: 0; }
  .table thead { display: none; }
  .table, .table tbody, .table tr, .table td { display: block; width: 100%; }
  .table tr { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 16px; margin-bottom: 10px; }
  .table td { border: 0; padding: 6px 0; display: flex; justify-content: space-between; gap: 12px; text-align: right; }
  .table td::before { content: attr(data-l); color: var(--muted); font-size: 14px; text-align: left; }
  .table td:first-child { display: block; text-align: left; font-size: 18px; padding-bottom: 8px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
  .table td:first-child::before { display: none; }
  .modal-box { padding: 22px 18px; }
}

@media (max-width: 640px) {
  .table td.td-client { display: flex; }
  .head-with-avatar .avatar { --s: 64px !important; width: 64px; height: 64px; }
}

/* Traducciones en el popup de membresías */
.tr-box { margin-top: 18px; border: 1px solid var(--line); border-radius: 12px; padding: 4px 16px; }
.tr-box summary { cursor: pointer; font-weight: 600; padding: 12px 0; min-height: 44px; }
.tr-box[open] { padding-bottom: 16px; }
.tr-h { margin: 14px 0 10px; font-size: 15px; color: var(--gold); letter-spacing: .08em; text-transform: uppercase; }
.m-tr { display: flex; gap: 6px; margin-top: 10px; }
.m-tr span { font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); }
.m-tr span.ok { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 50%, transparent); }

/* Librerías */
.lib-card h3 { font: italic 800 28px/1.05 "Barlow Condensed", sans-serif; text-transform: uppercase; margin: 12px 0 8px; }
.lib-type { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--gold); }
.lib-type svg { width: 20px; height: 20px; }
.lib-card::before { background: var(--gold); }
.lib-vis-label { margin: 14px 0 8px; font-size: 13px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.lib-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.lib-mems { border: 1px solid var(--line); border-radius: 12px; padding: 12px 16px 16px; margin: 18px 0 0; }
.lib-mems legend { font-weight: 600; padding: 0 6px; }
.lib-mem-actions { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 8px; }
.lib-mem-actions .btn-link { padding: 6px 0; font-size: 15px; }
.lib-mem-list { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.lib-mem { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--line); border-left: 4px solid var(--c); border-radius: 10px; cursor: pointer; min-height: 52px; }
.lib-mem:has(input:checked) { background: color-mix(in srgb, var(--c) 12%, transparent); border-color: color-mix(in srgb, var(--c) 55%, transparent); border-left-color: var(--c); }
.lib-mem input { width: 22px; height: 22px; min-height: 0; accent-color: var(--gold); flex: none; }
.lib-mem b { display: block; font-size: 15px; }
.lib-mem small { color: var(--muted); font-size: 13px; }
.check-row { display: flex; align-items: center; gap: 12px; margin-top: 16px; font-weight: 500; cursor: pointer; }
.check-row input { width: 22px; height: 22px; min-height: 0; accent-color: var(--gold); }
@media (max-width: 640px) { .lib-mem-list { grid-template-columns: 1fr; } }

/* Contenido de librerías */
.lib-content-btn { margin-top: 14px; width: 100%; }
.lib-content-btn svg { width: 18px; height: 18px; }
.items-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.item-card { display: flex; flex-direction: column; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.item-card.off { opacity: .6; }
.item-thumb { position: relative; aspect-ratio: 16 / 9; display: grid; place-items: center; background: var(--bg-2); border: 0; padding: 0; cursor: pointer; color: var(--gold); overflow: hidden; }
.item-thumb img { width: 100%; height: 100%; object-fit: cover; }
.item-thumb > svg { width: 56px; height: 56px; opacity: .8; }
.item-thumb .play { position: absolute; width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; background: rgba(0, 0, 0, .55); color: #fff; border: 2px solid rgba(255, 255, 255, .8); }
.item-thumb .play svg { width: 26px; height: 26px; margin-left: 3px; }
.item-thumb:hover .play { background: var(--gold); color: #16130c; }
.item-body { padding: 16px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.item-kind { font-size: 12px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--gold); }
.item-body h3 { margin: 0; font-size: 18px; }
.item-body p { margin: 0; font-size: 15px; }
.item-foot { margin-top: auto; padding-top: 10px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.item-foot .m-tr { margin: 0; }

.seg { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 14px; }
.seg label { cursor: pointer; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 6px; border: 1px solid var(--line); border-radius: 12px; font-weight: 600; font-size: 15px; color: var(--muted); }
.seg span svg { width: 24px; height: 24px; }
.seg input:checked + span { border-color: var(--gold); color: var(--gold); background: color-mix(in srgb, var(--gold) 10%, transparent); }
.seg input:focus-visible + span { outline: 2px solid var(--gold); }
.src-switch { display: flex; gap: 18px; flex-wrap: wrap; margin-bottom: 12px; }
.src-switch label { display: flex; align-items: center; gap: 8px; cursor: pointer; font-weight: 500; min-height: 36px; }
.src-switch input { width: 20px; height: 20px; min-height: 0; accent-color: var(--gold); }
.drop { border: 2px dashed var(--line-gold); border-radius: 14px; padding: 6px; transition: background .15s; }
.drop.over { background: color-mix(in srgb, var(--gold) 10%, transparent); }
.drop-inner { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 22px 12px; cursor: pointer; text-align: center; }
.drop-inner svg { width: 34px; height: 34px; color: var(--gold); }
.drop-inner small { color: var(--muted); }
.progress { position: relative; height: 26px; margin: 4px 8px 8px; border-radius: 99px; background: var(--bg-2); overflow: hidden; }
.progress i { position: absolute; inset: 0 auto 0 0; width: 0; background: linear-gradient(90deg, var(--save), #49c47a); transition: width .2s; }
.progress span { position: relative; display: block; text-align: center; line-height: 26px; font-size: 14px; font-weight: 600; color: #fff; }
.current-file { margin: 4px 8px 8px; font-size: 14px; color: var(--muted); }
.url-box { display: flex; flex-direction: column; gap: 6px; font-weight: 600; color: var(--muted); }
.form-error { color: var(--bad); font-weight: 600; margin: 14px 0 0; }
.preview-box { width: min(980px, 100%); }
.preview-box video, .preview-box img { width: 100%; max-height: 72vh; border-radius: 12px; background: #000; display: block; object-fit: contain; }
.preview-box .ratio { position: relative; aspect-ratio: 16 / 9; }
.preview-box .ratio iframe, .preview-box iframe.pdf { width: 100%; height: 100%; border: 0; border-radius: 12px; }
.preview-box iframe.pdf { height: 72vh; background: #fff; }
@media (max-width: 640px) { .seg { grid-template-columns: repeat(2, 1fr); } }

/* ---------- Admin: barra lateral izquierda en escritorio ---------- */
.adm .icon-btn .lbl { display: none; }
@media (min-width: 901px) {
  .adm { --side: 250px; }
  .adm .topbar {
    position: fixed; top: 0; bottom: 0; left: 0; width: var(--side); height: auto;
    flex-direction: column; align-items: stretch; gap: 0;
    padding: 22px 14px 18px; overflow-y: auto;
    background: var(--bg-2); backdrop-filter: none;
    border-bottom: 0; border-right: 1px solid var(--line);
  }
  .adm .brand { flex-wrap: wrap; gap: 10px; padding: 0 8px 20px; border-bottom: 1px solid var(--line); }
  .adm .brand b { font-size: 21px; }
  .adm .mainnav { flex-direction: column; gap: 4px; margin: 18px 0 0; }
  .adm .mainnav a { padding: 12px 14px; font-size: 16px; border-radius: 12px; gap: 12px; position: relative; }
  .adm .mainnav a svg { width: 22px; height: 22px; }
  .adm .mainnav a.on { background: color-mix(in srgb, var(--gold) 12%, transparent); color: var(--gold); }
  .adm .mainnav a.on::before { content: ""; position: absolute; left: -14px; top: 8px; bottom: 8px; width: 4px; border-radius: 0 4px 4px 0; background: var(--gold); }
  .adm .top-actions { margin: auto 0 0; padding-top: 16px; border-top: 1px solid var(--line); flex-direction: column; gap: 4px; }
  .adm .topbar .icon-btn { width: 100%; height: auto; min-height: 44px; border: 0; border-radius: 12px; justify-content: flex-start; display: flex; align-items: center; gap: 12px; padding: 0 14px; font: 500 15px Inter, sans-serif; color: var(--muted); }
  .adm .topbar .icon-btn:hover { background: var(--card); color: var(--text); }
  .adm .topbar .icon-btn .lbl { display: inline; }
  .adm main.wrap { margin-left: var(--side); max-width: none; padding: 32px 40px 120px; }
  .adm main.wrap > * { max-width: 1240px; }
  .adm .toast { left: calc(50% + var(--side) / 2); }
  .adm .form-actions.sticky { bottom: 0; }
}

/* Portadas de librerías */
.lib-card .lib-cover { margin: -22px -22px 16px; aspect-ratio: 16 / 9; background: var(--bg-2); overflow: hidden; }
.lib-card .lib-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.lib-cover-empty { height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; color: var(--muted); font-size: 14px; }
.lib-cover-empty svg { width: 40px; height: 40px; opacity: .6; }
.lib-card::before { z-index: 1; }
.cover-pick { display: flex; gap: 16px; align-items: center; margin-bottom: 18px; }
.cover-prev { width: 220px; aspect-ratio: 16 / 9; border-radius: 12px; overflow: hidden; background: var(--bg-2); border: 1px dashed var(--line-gold); display: grid; place-items: center; color: var(--muted); font-size: 14px; flex: none; }
.cover-prev img { width: 100%; height: 100%; object-fit: cover; }
.cover-actions { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
@media (max-width: 640px) { .cover-pick { flex-direction: column; align-items: stretch; } .cover-prev { width: 100%; } }

/* Contador de mensajes sin leer en el menú */
.mainnav a { position: relative; }
.nav-badge { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--gold); color: #16130c; font: 700 12px/20px Inter, sans-serif; font-style: normal; text-align: center; margin-left: auto; }
.nav-badge[hidden] { display: none; }
@media (max-width: 900px) { .nav-badge { position: absolute; top: 2px; left: calc(50% + 6px); margin: 0; min-width: 18px; height: 18px; line-height: 18px; font-size: 11px; } }

/* Chat a pantalla completa (sin márgenes de página) */
main.wrap.chat-wrap { padding: 0; max-width: none; }
main.wrap.chat-wrap > * { max-width: none; }
@media (min-width: 901px) {
  .adm main.wrap.chat-wrap { padding: 0; }
  .adm .wa { height: 100vh; height: 100dvh; }
}
.wa-av.kike { background: #0b0b0d; padding: 4px; }

@media (max-width: 900px) { .mainnav a span { font-size: 11px; white-space: nowrap; } .mainnav a { padding: 8px 2px; } }
