*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; font-family: var(--font-body); background: var(--vg-cream); color: var(--vg-ink); line-height: 1.5; }
h1, h2, h3 { font-family: var(--font-display); font-weight: 600; margin: 0; font-variant-numeric: lining-nums; }
a { color: var(--vg-olive); }

/* Botones y formularios */
.btn { display: inline-block; border: 0; border-radius: 999px; padding: .65rem 1.4rem; font: 500 .95rem var(--font-body); cursor: pointer; text-decoration: none; transition: transform .12s, box-shadow .12s, background .12s; }
.btn:hover { transform: translateY(-1px); }
.btn-primario { background: var(--vg-olive); color: #fff; box-shadow: var(--vg-shadow); }
.btn-primario:hover { background: color-mix(in srgb, var(--vg-olive) 78%, black); }
.btn-suave { background: var(--vg-cream-2); color: var(--vg-ink); }
label { display: block; margin: 1rem 0 .3rem; font-size: .85rem; font-weight: 500; }
input { width: 100%; padding: .7rem .9rem; border: 1.5px solid var(--vg-borde); border-radius: 12px; background: var(--vg-input); color: var(--vg-ink); font: inherit; }
::placeholder { color: var(--vg-placeholder); opacity: 1; }
input:focus { outline: none; border-color: var(--vg-gold); box-shadow: 0 0 0 4px rgba(198,160,122,.25); }
.error { color: #A4402E; font-size: .8rem; }
.aviso { color: var(--vg-ink); padding: .75rem 1rem; border-radius: 12px; background: var(--vg-cream-2); margin: 1rem 0; font-size: .9rem; }
.aviso-ok { background: #E4EAD2; color: #3F4A1C; }
.aviso-error { background: #F6D9D1; color: #7A2E1F; }

/* Login / cambio de clave */
body.cuenta { min-height: 100vh; display: grid; place-items: center; padding: 1rem;
  background: radial-gradient(circle at 20% 10%, var(--vg-cream-2), transparent 55%), var(--vg-cream); }
.tarjeta-cuenta { width: 100%; max-width: 400px; background: var(--vg-surface); border-radius: 24px; padding: 2rem; box-shadow: var(--vg-shadow); }
.tarjeta-cuenta .logo { display: block; width: 130px; margin: 0 auto 1rem; border-radius: 50%; }
.tarjeta-cuenta h2 { text-align: center; font-size: 1.7rem; }
.tarjeta-cuenta .btn-primario { width: 100%; margin-top: 1.5rem; }
.tarjeta-cuenta .btn-suave { width: 100%; margin-top: .6rem; text-align: center; }

/* Shell del portal */
.shell { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.sidebar { background: var(--vg-surface); padding: 1.5rem 1rem; border-right: 1px solid var(--vg-borde); }
.marca { display: flex; flex-direction: column; align-items: center; gap: .5rem; text-decoration: none; margin-bottom: 1.5rem; font-family: var(--font-display); font-size: 1.1rem; color: var(--vg-ink); }
.marca img { width: 96px; border-radius: 50%; }
.sidebar nav { display: flex; flex-direction: column; gap: .25rem; }
.sidebar nav a, .sidebar nav .proximamente { padding: .6rem .9rem; border-radius: 12px; text-decoration: none; color: var(--vg-ink); font-weight: 500; }
.sidebar nav a.activo { background: var(--vg-cream-2); color: var(--vg-olive); }
.sidebar nav .proximamente { opacity: .4; cursor: default; }
.topbar { display: flex; justify-content: space-between; align-items: center; padding: 1.1rem 2rem; background: var(--vg-surface); border-bottom: 1px solid var(--vg-borde); }
.topbar h1 { font-size: 1.8rem; }
.usuario { display: flex; align-items: center; gap: 1rem; font-size: .9rem; }
.usuario form { margin: 0; }
main { padding: 2rem; }
.bienvenida { background: var(--vg-surface); border-radius: var(--vg-radius); padding: 2rem; box-shadow: var(--vg-shadow); }
.bienvenida h2 { font-size: 2rem; }

@media (max-width: 800px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .topbar { padding: 1rem; flex-wrap: wrap; gap: .5rem; }
  main { padding: 1rem; }
}

/* ---- ABM: tablas, filtros, formularios ---- */
.muted { color: var(--vg-ink); opacity: .6; font-size: .85rem; margin: 0; }
.barra-acciones { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.filtros { display: flex; gap: .5rem; flex-wrap: wrap; flex: 1; }
.filtros input[type=search] { max-width: 320px; }
.filtros select { max-width: 220px; }
select, textarea { width: 100%; padding: .7rem .9rem; border: 1.5px solid var(--vg-borde); border-radius: 12px; background: var(--vg-input); color: var(--vg-ink); font: inherit; }
select:focus, textarea:focus { outline: none; border-color: var(--vg-gold); box-shadow: 0 0 0 4px rgba(198,160,122,.25); }
textarea { resize: vertical; }
.btn-chico { padding: .35rem .85rem; font-size: .8rem; }
.btn-peligro { background: #F1D3CB; color: #8A2F1F; }
.btn-peligro:hover { background: #E9BFB3; }

.tabla-wrap { background: var(--vg-surface); border-radius: var(--vg-radius); box-shadow: var(--vg-shadow); overflow-x: auto; }
.tabla { width: 100%; border-collapse: collapse; }
.tabla th { text-align: left; font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; opacity: .6; padding: .9rem 1rem; border-bottom: 1px solid var(--vg-borde); }
.tabla td { padding: .8rem 1rem; border-bottom: 1px solid var(--vg-borde); vertical-align: middle; }
.tabla tr:last-child td { border-bottom: 0; }
.tabla tbody tr:hover { background: color-mix(in srgb, var(--vg-cream) 60%, transparent); }
.tabla .num { text-align: right; white-space: nowrap; }
.tabla .vacio { text-align: center; padding: 2.5rem 1rem; opacity: .6; }
.tabla .acciones { display: flex; gap: .4rem; justify-content: flex-end; align-items: center; }
.tabla .acciones form { margin: 0; }
.sin-stock { color: #A4402E; font-weight: 600; }

.chip { display: inline-block; padding: .15rem .65rem; border-radius: 999px; font-size: .72rem; font-weight: 600; }
.chip-ok { background: #E4EAD2; color: #4F5A24; }
.chip-off { background: var(--vg-cream-2); color: var(--vg-ink); opacity: .75; }
.chip-dest { background: #F3DDD5; color: #8A4B3A; margin-left: .4rem; }

.mini-tapa { width: 40px; height: 56px; object-fit: cover; border-radius: 6px; display: block; box-shadow: 0 2px 6px rgba(74,65,40,.25); }
.sin-tapa { display: grid; place-items: center; background: var(--vg-cream-2); font-family: var(--font-display); font-weight: 700; color: var(--vg-gold); box-shadow: none; }

.paginacion { display: flex; justify-content: center; align-items: center; gap: 1rem; margin-top: 1.25rem; }

.formulario { background: var(--vg-surface); border-radius: var(--vg-radius); box-shadow: var(--vg-shadow); padding: 1.75rem; max-width: 520px; }
.formulario-ancho { max-width: 980px; }
.grilla { display: grid; grid-template-columns: 1fr 280px; gap: 2rem; }
.fila-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.check { display: flex; align-items: center; gap: .55rem; font-weight: 500; margin: 1rem 0 0; cursor: pointer; }
.check input { width: auto; accent-color: var(--vg-olive); }
.tapa-preview { aspect-ratio: 2 / 3; border-radius: 12px; background: var(--vg-cream-2); display: grid; place-items: center; overflow: hidden; margin-bottom: .75rem; color: var(--vg-ink); opacity: .9; }
.tapa-preview img { width: 100%; height: 100%; object-fit: cover; }
.col-tapa input[type=file] { padding: .5rem; font-size: .8rem; }
.botonera { display: flex; gap: .75rem; margin-top: 1.75rem; }

@media (max-width: 800px) {
  .grilla, .fila-2 { grid-template-columns: 1fr; }
  .tabla th:nth-child(3), .tabla td:nth-child(3) { display: none; }
}

/* ---- Panel, usuarios, banners, configuración ---- */
.bienvenida { margin-bottom: 1.25rem; }
.nav-grupo { margin: 1rem .9rem .25rem; font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; opacity: .5; font-weight: 600; }
.metricas { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 1rem; margin-bottom: 1.75rem; }
.metrica { display: flex; flex-direction: column; gap: .15rem; padding: 1.1rem 1.25rem; background: var(--vg-surface); border-radius: var(--vg-radius); box-shadow: var(--vg-shadow); text-decoration: none; color: var(--vg-ink); transition: transform .12s; }
.metrica:hover { transform: translateY(-2px); }
.metrica strong { font-variant-numeric: lining-nums; font-family: var(--font-display); font-size: 2.4rem; line-height: 1; color: var(--vg-olive); }
.metrica span { font-size: .85rem; opacity: .7; }
.metrica-alerta strong { color: #A4402E; }
.dos-col { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }
.dos-col h3, .formulario h3 { font-family: var(--font-display); font-size: 1.35rem; margin: 0 0 .75rem; }
.formulario h3 { margin-top: 1.5rem; padding-bottom: .4rem; border-bottom: 1px solid var(--vg-borde); }
.formulario h3:first-of-type { margin-top: 0; }
.lista-libros { list-style: none; margin: 0; padding: 0; background: var(--vg-surface); border-radius: var(--vg-radius); box-shadow: var(--vg-shadow); }
.lista-libros li { display: flex; align-items: center; gap: .85rem; padding: .7rem 1rem; border-bottom: 1px solid var(--vg-borde); }
.lista-libros li:last-child { border-bottom: 0; }
.lista-libros .info { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.lista-libros .info a { font-weight: 500; text-decoration: none; color: var(--vg-ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tarjeta-vacia { background: var(--vg-surface); border-radius: var(--vg-radius); padding: 1.5rem; text-align: center; opacity: .6; box-shadow: var(--vg-shadow); }
.chip-alerta { background: #F6D9D1; color: #8A2F1F; }
.con-boton { display: flex; gap: .5rem; }
.con-boton .btn { white-space: nowrap; }
input.solo-lectura { background: var(--vg-cream-2); color: var(--vg-ink); opacity: .75; }
.mini-banner { width: 96px; height: 40px; object-fit: cover; border-radius: 6px; display: block; }
.banner-preview { aspect-ratio: 8 / 3; max-width: 560px; border-radius: 12px; background: var(--vg-cream-2); display: grid; place-items: center; overflow: hidden; margin-bottom: .75rem; }
.banner-preview img { width: 100%; height: 100%; object-fit: cover; }
@media (max-width: 800px) { .dos-col { grid-template-columns: 1fr; } }
