:root {
  --fondo: #120d18;
  --fondo-2: #1b1424;
  --panel: #221a2d;
  --borde: #3a2c4a;
  --texto: #f3ecf8;
  --suave: #b9a9c9;
  --naranja: #ff7a1a;
  --naranja-2: #ffa24a;
  --violeta: #9b6bff;
  --verde: #6fe08a;
  --rojo: #ff5a6e;
  --radio: 14px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; scroll-padding-top: 64px; }
body {
  margin: 0;
  background: var(--fondo);
  color: var(--texto);
  font: 16px/1.5 "Nunito", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--naranja-2); }
h1, h2 { font-family: "Creepster", "Nunito", cursive; font-weight: 400; letter-spacing: .04em; }
h2 { font-size: clamp(2rem, 6vw, 2.8rem); margin: 0 0 1rem; color: var(--naranja); }
h3 { margin: 0 0 .6rem; font-size: 1.1rem; }
.sub { margin-top: 1.4rem; }

/* --- navegación --- */
.nav {
  position: sticky; top: 0; z-index: 10;
  display: flex; gap: .25rem; align-items: center; overflow-x: auto;
  padding: .5rem 1rem;
  background: rgb(18 13 24 / .88); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--borde);
}
.nav a {
  color: var(--suave); text-decoration: none; font-weight: 700; white-space: nowrap;
  padding: .35rem .7rem; border-radius: 999px;
}
.nav a:hover { color: var(--texto); background: var(--panel); }
.nav-logo { font-size: 1.4rem; padding: 0 .4rem !important; }

/* --- portada --- */
.hero {
  position: relative; overflow: hidden; text-align: center;
  padding: 4.5rem 1rem 3.5rem;
  background:
    radial-gradient(circle at 50% 120%, rgb(255 122 26 / .35), transparent 60%),
    radial-gradient(circle at 85% 10%, rgb(155 107 255 / .25), transparent 45%),
    var(--fondo-2);
  border-bottom: 1px solid var(--borde);
}
.hero::before {
  content: ""; position: absolute; top: 2rem; left: 8%;
  width: 80px; height: 80px; border-radius: 50%;
  background: #fff3c9; box-shadow: 0 0 60px 10px rgb(255 243 201 / .25);
  opacity: .85;
}
.hero-pre { margin: 0; color: var(--suave); text-transform: uppercase; letter-spacing: .2em; font-size: .8rem; }
.hero h1 {
  position: relative; margin: .3rem 0 .6rem;
  font-size: clamp(2.6rem, 11vw, 5.5rem); line-height: 1;
  color: var(--naranja); text-shadow: 0 0 30px rgb(255 122 26 / .5), 0 4px 0 #6b2a00;
}
.hero-fecha { margin: 0; font-size: 1.25rem; font-weight: 800; }
.hero-lugar { margin: .2rem 0 1.6rem; color: var(--suave); }
.hero-acciones { display: flex; gap: .7rem; justify-content: center; flex-wrap: wrap; margin-top: 1.8rem; }

.cuenta { display: flex; gap: .6rem; justify-content: center; flex-wrap: wrap; }
.cuenta div {
  min-width: 74px; padding: .6rem .5rem;
  background: rgb(0 0 0 / .35); border: 1px solid var(--borde); border-radius: var(--radio);
}
.cuenta b { display: block; font-size: 1.9rem; line-height: 1.1; font-variant-numeric: tabular-nums; }
.cuenta small { color: var(--suave); font-size: .75rem; text-transform: uppercase; letter-spacing: .1em; }
.cuenta .mensaje { min-width: 0; padding: .7rem 1.2rem; font-weight: 800; font-size: 1.1rem; }

.murcielagos span {
  position: absolute; font-size: 1.6rem; opacity: .7;
  animation: volar 9s ease-in-out infinite;
}
.murcielagos span:nth-child(1) { top: 18%; left: -10%; }
.murcielagos span:nth-child(2) { top: 32%; left: -10%; animation-delay: 3s; font-size: 1.1rem; }
.murcielagos span:nth-child(3) { top: 10%; left: -10%; animation-delay: 6s; font-size: 1.3rem; }
@keyframes volar {
  0% { transform: translate(0, 0); }
  50% { transform: translate(60vw, -20px); }
  100% { transform: translate(125vw, 10px); }
}
@media (prefers-reduced-motion: reduce) { .murcielagos { display: none; } html { scroll-behavior: auto; } }

/* --- secciones --- */
main { max-width: 1080px; margin: 0 auto; padding: 0 16px; }
.seccion { padding: 3rem 0 1rem; }
.columnas { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 360px), 1fr)); margin-bottom: 1rem; }
.panel {
  background: var(--panel); border: 1px solid var(--borde); border-radius: var(--radio);
  padding: 1.1rem; min-width: 0;
}
.columnas + .panel { margin-top: 0; }
.panel-cabeza { display: flex; justify-content: space-between; align-items: baseline; gap: .5rem; }
.nota { color: var(--suave); font-size: .9rem; margin: 0 0 .8rem; }
.contador { color: var(--suave); font-weight: 700; white-space: nowrap; }

.tarjetas { display: grid; gap: .8rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); margin-bottom: 1.5rem; }
.tarjeta { background: var(--panel); border: 1px solid var(--borde); border-radius: var(--radio); padding: 1rem; }
.tarjeta .icono { font-size: 1.5rem; }
.tarjeta small { display: block; color: var(--suave); text-transform: uppercase; letter-spacing: .08em; font-size: .72rem; margin-top: .3rem; }
.tarjeta p { margin: .15rem 0 0; font-weight: 800; }
.tarjeta .extra { font-weight: 400; color: var(--suave); font-size: .9rem; }

.chips { list-style: none; padding: 0; margin: 0 0 .8rem; display: flex; flex-wrap: wrap; gap: .5rem; }
.chips li {
  background: var(--fondo-2); border: 1px solid var(--borde); border-radius: 999px;
  padding: .35rem .8rem; font-weight: 600;
}
.chips-borrar li { display: inline-flex; align-items: center; gap: .3rem; padding-right: .3rem; }

/* --- listas --- */
.lista { list-style: none; padding: 0; margin: 0 0 .8rem; }
.lista li {
  display: flex; align-items: center; gap: .6rem;
  padding: .45rem 0; border-bottom: 1px dashed var(--borde);
}
.lista li:last-child { border-bottom: 0; }
.lista label { display: flex; align-items: center; gap: .6rem; flex: 1; min-width: 0; cursor: pointer; }
.lista .hecho span { text-decoration: line-through; color: var(--suave); }
.lista select { max-width: 9.5rem; }
input[type="checkbox"] { width: 1.2rem; height: 1.2rem; accent-color: var(--naranja); flex: none; }

.barra { height: 8px; background: var(--fondo-2); border-radius: 99px; overflow: hidden; margin: .2rem 0 .7rem; }
.barra div { height: 100%; width: 0; background: linear-gradient(90deg, var(--naranja), var(--violeta)); transition: width .3s; }

.lista-gastos { list-style: none; padding: 0; margin: 0; }
.lista-gastos li {
  display: grid; grid-template-columns: 1fr auto auto; gap: .6rem; align-items: center;
  padding: .55rem 0; border-bottom: 1px dashed var(--borde);
}
.lista-gastos li:last-child { border-bottom: 0; }
.lista-gastos .quien { color: var(--suave); font-size: .85rem; }
.monto { font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; }
.vacio { color: var(--suave); font-style: italic; padding: .4rem 0; }

.lista-transferencias { list-style: none; padding: 0; margin: 0; display: grid; gap: .6rem; }
.lista-transferencias li {
  display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .8rem; justify-content: space-between;
  background: var(--fondo-2); border: 1px solid var(--borde); border-radius: 12px; padding: .7rem .9rem;
}
.flecha { color: var(--naranja); font-weight: 800; }

.resumen { display: grid; gap: .8rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 160px), 1fr)); margin-bottom: 1rem; }

.tabla-envoltura { overflow-x: auto; }
.tabla { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.tabla th, .tabla td { padding: .5rem .4rem; text-align: right; border-bottom: 1px dashed var(--borde); white-space: nowrap; }
.tabla th:first-child, .tabla td:first-child { text-align: left; white-space: normal; }
.tabla th { color: var(--suave); font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; }
.positivo { color: var(--verde); }
.negativo { color: var(--rojo); }

/* --- formularios --- */
input, select, button { font: inherit; color: inherit; }
input, select {
  background: var(--fondo); border: 1px solid var(--borde); border-radius: 10px;
  padding: .55rem .7rem; min-width: 0;
}
input:focus, select:focus { outline: 2px solid var(--violeta); outline-offset: 1px; }
.fila-form { display: flex; gap: .5rem; }
.fila-form input { flex: 1; }
.form-gasto { display: grid; gap: .7rem; }
.form-gasto label { display: grid; gap: .25rem; font-weight: 700; font-size: .9rem; color: var(--suave); }
.form-gasto input, .form-gasto select { color: var(--texto); font-weight: 400; font-size: 1rem; }

.boton {
  display: inline-block; cursor: pointer; text-decoration: none; text-align: center;
  background: var(--naranja); color: #1a0d00; font-weight: 800;
  border: 0; border-radius: 10px; padding: .6rem 1.1rem;
  transition: transform .1s, background .15s;
}
.boton:hover { background: var(--naranja-2); }
.boton:active { transform: scale(.97); }
.boton:disabled { opacity: .5; cursor: default; }
.boton-sec { background: transparent; color: var(--texto); border: 1px solid var(--borde); }
.boton-sec:hover { background: var(--panel); }
.boton-chico { padding: .3rem .7rem; font-size: .85rem; }
.boton-verde { background: var(--verde); color: #04210c; }
.boton-verde:hover { background: #8cf0a3; }
.x {
  background: none; border: 0; cursor: pointer; color: var(--suave);
  font-size: 1.1rem; line-height: 1; padding: .25rem .4rem; border-radius: 8px;
}
.x:hover { color: var(--rojo); background: rgb(255 90 110 / .12); }

.pie { text-align: center; color: var(--suave); padding: 3rem 1rem; }

.aviso {
  position: fixed; left: 50%; bottom: 1.2rem; transform: translate(-50%, calc(100% + 2rem)); visibility: hidden;
  max-width: calc(100% - 32px);
  background: var(--texto); color: var(--fondo); font-weight: 700;
  padding: .7rem 1.1rem; border-radius: 12px; box-shadow: 0 8px 30px rgb(0 0 0 / .5);
  transition: transform .25s, visibility .25s; z-index: 20;
}
.aviso.visible { transform: translate(-50%, 0); visibility: visible; }
.aviso.error { background: var(--rojo); color: #fff; }

@media (max-width: 480px) {
  .col-cuota { display: none; }
  .cuenta div { min-width: 64px; }
  .cuenta b { font-size: 1.5rem; }
  .lista li { flex-wrap: wrap; row-gap: .3rem; }
  .lista label { flex-basis: 100%; }
  .lista select { max-width: none; flex: 1; margin-left: 1.8rem; }
  .nav { gap: 0; padding: .45rem .5rem; justify-content: space-between; }
  .nav a { padding: .3rem .35rem; font-size: .85rem; }
  .nav-yo { padding-left: 0; }
  .nav-yo .x { padding: .25rem .3rem; font-size: .8rem; }
  .nav-yo #nav-nombre { display: none; }
  .col-disp { display: none; }
  body.admin .nav a[href="#info"] { display: none; }
  .fila-form-doble { flex-wrap: wrap; }
  .fila-form-doble input { flex-basis: 40%; }
  .hero::before { width: 52px; height: 52px; top: 1rem; left: 5%; }
}

/* --- acceso: qué se ve según la sesión --- */
body.cargando .privado, body.cargando .solo-anonimo,
body.anonimo .privado, body:not(.anonimo) .solo-anonimo,
body:not(.admin) .solo-admin { display: none !important; }

.acceso {
  min-height: 100vh; min-height: 100dvh;
  display: grid; place-items: center; padding: 1.5rem 16px;
  background:
    radial-gradient(circle at 50% 110%, rgb(255 122 26 / .3), transparent 60%),
    radial-gradient(circle at 85% 5%, rgb(155 107 255 / .22), transparent 45%),
    var(--fondo);
}
.acceso-caja {
  width: 100%; max-width: 380px;
  background: var(--panel); border: 1px solid var(--borde); border-radius: 18px;
  padding: 1.6rem 1.3rem; box-shadow: 0 20px 60px rgb(0 0 0 / .45);
}
.acceso-calabaza { font-size: 3rem; text-align: center; line-height: 1; }
.acceso h1 { text-align: center; color: var(--naranja); font-size: 2.6rem; margin: .3rem 0 .2rem; }
.acceso .nota { text-align: center; }
.acceso input { font-size: 1.1rem; }
.pedir { margin-top: 1.3rem; border-top: 1px dashed var(--borde); padding-top: 1rem; }
.pedir summary { cursor: pointer; color: var(--naranja-2); font-weight: 700; text-align: center; list-style: none; }
.pedir summary::-webkit-details-marker { display: none; }
.pedir[open] summary { margin-bottom: .8rem; }

.nav-yo { margin-left: auto; display: inline-flex; align-items: center; gap: .2rem; white-space: nowrap; color: var(--suave); font-weight: 700; padding-left: .4rem; }
.nav-yo .x { font-size: .85rem; font-weight: 700; }

.fila-form-doble input { width: 0; }
.insignia { display: inline-block; min-width: 1.4rem; padding: 0 .4rem; border-radius: 99px; background: var(--naranja); color: #1a0d00; font-size: .8rem; text-align: center; }
.insignia:empty { display: none; }
.acciones { display: inline-flex; gap: .1rem; }
.corona { font-size: .85rem; }

.punto { display: inline-block; width: .55rem; height: .55rem; border-radius: 50%; background: var(--borde); margin-right: .4rem; vertical-align: middle; }
.punto.en-linea { background: var(--verde); box-shadow: 0 0 8px var(--verde); }
.tabla-conexiones td:nth-child(2), .tabla-conexiones td:nth-child(3) { color: var(--suave); }
.tabla-conexiones .tel { display: block; color: var(--suave); font-size: .8rem; }
.actividad { max-height: 460px; overflow-y: auto; }
.actividad li { grid-template-columns: 1fr auto; }
.evento-rechazado { color: var(--rojo); }
.evento-pedido { color: var(--naranja-2); }

.modal {
  position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; padding: 16px;
  background: rgb(10 6 14 / .85); backdrop-filter: blur(4px);
}
.modal-titulo { text-align: center; color: var(--naranja); font-size: 2.4rem; margin: .3rem 0 .2rem; }
.modal .nota { text-align: center; }

.form-gasto label.casilla { display: flex; align-items: center; gap: .6rem; cursor: pointer; color: var(--texto); font-weight: 600; }
.casilla small { display: block; color: var(--suave); font-weight: 400; }
.etiqueta { display: inline-block; font-size: .75rem; font-weight: 700; padding: 0 .45rem; border-radius: 99px; background: rgb(155 107 255 / .2); color: #cdb8ff; margin-left: .3rem; vertical-align: 1px; }
.tarjeta .extra.alerta { color: var(--naranja-2); }
.lista-transferencias .grupo-titulo { background: none; border: 0; padding: .4rem 0 0; color: var(--suave); font-weight: 800; font-size: .85rem; text-transform: uppercase; letter-spacing: .06em; }
.lista-transferencias li:not(.grupo-titulo):not(.vacio) { display: grid; grid-template-columns: minmax(0, 1fr) auto; }
.lista-transferencias li > span:first-child { overflow-wrap: break-word; }
.lista-transferencias li > span:first-child .monto { display: block; font-size: 1.1rem; margin-top: .1rem; }
.solo-movil { display: none; }
@media (max-width: 480px) {
  .col-puso { display: none; }
  .solo-movil { display: block; color: var(--suave); font-size: .8rem; }
}
