@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

/* ── Paleta G&A ───────────────────────────────────────────────────────────
   Guinda y gris, tomados del logo de G&A Servicios Administrativos: las
   letras van en vino profundo y el ampersand en gris.

   Los nombres --green* se conservan como ALIAS del guinda a propósito: están
   usados en cientos de sitios de las plantillas y renombrarlos uno a uno solo
   invitaba a romper algo. La fuente de la verdad son las variables --vino*.
   Para cambiar toda la identidad basta tocar este bloque.                    */
:root {
  --alto-barra-sup: 56px;
  --alto-barra-inf: 60px;
  --vino: #7B1220;
  --vino-hover: #99182A;
  --vino-oscuro: #4E0B15;
  --vino-light: #F9EDEF;
  --gris-marca: #9A9A9A;

  --bg: #F8F6F6;
  --white: #ffffff;
  --card-radius: 18px;
  --text: #241417;
  --text-muted: #7C6A6D;
  --border: #EDDFE1;
  --shadow: 0 2px 16px rgba(123,18,32,0.07);
  --shadow-md: 0 6px 28px rgba(123,18,32,0.14);
  --success-bg: #F0F7EC;
  --success: #2F7D32;
  --warning-bg: #FFF8E6;
  --error-bg: #FDEDEE;
  --error: #B3261E;
  --warning: #A16207;

  /* Alias heredados — apuntan al guinda para no tocar cada plantilla. */
  --green: var(--vino);
  --green-hover: var(--vino-hover);
  --green-light: var(--vino-light);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { overflow-x: clip; }
button, a, input, select, textarea { -webkit-tap-highlight-color: transparent; }

body {
  background: var(--bg);
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ── NAVBAR ── */
.navbar {
  position: fixed;
  top: max(16px, env(safe-area-inset-top));
  left: 50%;
  transform: translateX(-50%);
  width: calc(100% - 32px);
  max-width: 1280px;
  background: var(--green);
  border-radius: 28px;
  padding: 10px 16px 10px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  z-index: 100;
  box-shadow: 0 4px 24px rgba(123,18,32,0.30);
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: white;
  text-decoration: none;
  flex-shrink: 0;
}

.nav-brand-icon {
  width: 34px;
  height: 34px;
  background: rgba(255,255,255,0.18);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
}

/* Logo de G&A. El PNG tiene mucho margen blanco alrededor del monograma, así
   que se escala y se recorta con object-fit para que las letras llenen el
   recuadro; sobre fondo blanco el guinda del logo se lee bien. */
.nav-brand-logo {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  background: #fff;
  object-fit: cover;
  object-position: center 42%;
  padding: 2px;
  flex-shrink: 0;
}

.nav-brand-name {
  font-weight: 800;
  font-size: 0.98rem;
  letter-spacing: -0.01em;
  line-height: 1.1;
}

.nav-brand-sub {
  font-size: 0.68rem;
  opacity: 0.7;
  font-weight: 400;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
}

.nav-link, .nav-trigger {
  color: rgba(255,255,255,0.88);
  text-decoration: none;
  padding: 7px 12px;
  border-radius: 20px;
  font-size: 0.82rem;
  font-weight: 500;
  transition: all 0.18s;
  white-space: nowrap;
  background: transparent;
  border: none;
  font-family: inherit;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.nav-link:hover, .nav-trigger:hover, .nav-group.open > .nav-trigger { background: rgba(255,255,255,0.16); color: white; }
.nav-link.active, .nav-trigger.active { background: rgba(255,255,255,0.24); color: white; font-weight: 600; }

.nav-group { position: relative; display: inline-flex; align-items: center; }
.nav-caret { font-size: 0.65rem; opacity: 0.78; transition: transform 0.15s; }
.nav-group.open .nav-caret { transform: rotate(180deg); }

.nav-menu {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  min-width: 215px;
  background: #fff;
  border: 1px solid var(--border, #e7cdd1);
  border-radius: 14px;
  padding: 6px;
  box-shadow: 0 12px 34px rgba(36,20,23,0.18);
  flex-direction: column;
  gap: 2px;
  z-index: 300;
}
/* Puente invisible para que no se cierre al mover el mouse del botón al menú */
.nav-group::after {
  content: '';
  position: absolute;
  left: 0; right: 0; top: 100%;
  height: 10px;
}
@media (hover: hover) {
  .nav-group:hover .nav-menu { display: flex; }
}
.nav-group.open .nav-menu { display: flex; }

.nav-menu-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 12px;
  border-radius: 9px;
  color: var(--text, #241417);
  text-decoration: none;
  font-size: 0.83rem;
  font-weight: 500;
  white-space: nowrap;
}
.nav-menu-item:hover { background: var(--vino-light, #F9EDEF); color: var(--vino, #7B1220); }
.nav-menu-item.active { background: var(--vino-light, #F9EDEF); color: var(--vino, #7B1220); font-weight: 700; }

.nav-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.nav-avatar {
  width: 32px;
  height: 32px;
  background: rgba(255,255,255,0.25);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.78rem;
  color: white;
  flex-shrink: 0;
}

.nav-name {
  color: rgba(255,255,255,0.9);
  font-size: 0.81rem;
  font-weight: 500;
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-logout {
  color: rgba(255,255,255,0.6);
  text-decoration: none;
  font-size: 0.78rem;
  padding: 5px 11px;
  border-radius: 16px;
  transition: all 0.18s;
  border: 1px solid transparent;
}
.nav-logout:hover { background: rgba(255,255,255,0.1); color: rgba(255,255,255,0.9); }

/* ── CONTAINER ── */
.container {
  max-width: 1120px;
  margin: 0 auto;
  padding: calc(var(--alto-barra-sup) + env(safe-area-inset-top) + 28px) 24px calc(48px + var(--alto-barra-inf) + env(safe-area-inset-bottom));
}

html { scroll-padding-top: calc(var(--alto-barra-sup) + env(safe-area-inset-top) + 24px); }
:is([id], [name]) { scroll-margin-top: calc(var(--alto-barra-sup) + env(safe-area-inset-top) + 24px); }

/* ── PAGE HEADER ── */
.page-header { margin-bottom: 28px; }

.page-title {
  font-size: 1.55rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.025em;
}

.page-subtitle {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-top: 5px;
}

/* ── CARDS ── */
.card {
  background: white;
  border-radius: var(--card-radius);
  padding: 24px;
  box-shadow: var(--shadow);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.card-title {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

/* ── STAT CARDS ── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: white;
  border-radius: var(--card-radius);
  padding: 22px 22px 20px;
  box-shadow: var(--shadow);
  transition: box-shadow 0.2s, transform 0.2s;
}
.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }

.stat-icon {
  width: 42px;
  height: 42px;
  border-radius: 13px;
  background: var(--green-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 19px;
  margin-bottom: 14px;
}

.stat-value {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.035em;
  line-height: 1;
  margin-bottom: 5px;
}

.stat-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 500;
}

.stat-sub {
  font-size: 0.74rem;
  color: var(--green);
  font-weight: 600;
  margin-top: 7px;
}

/* ── BUTTONS ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 11px 22px;
  border-radius: 12px;
  border: none;
  font-weight: 600;
  font-size: 0.875rem;
  cursor: pointer;
  transition: all 0.18s;
  text-decoration: none;
  font-family: inherit;
  white-space: nowrap;
}

.btn-primary { background: var(--green); color: white; }
.btn-primary:hover {
  background: var(--green-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(123,18,32,0.32);
}
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; transform: none; box-shadow: none; }

.btn-outline {
  background: transparent;
  color: var(--green);
  border: 1.5px solid var(--border);
}
.btn-outline:hover { border-color: var(--green); background: var(--green-light); }

.btn-sm { padding: 7px 14px; font-size: 0.8rem; border-radius: 9px; }
.btn-full { width: 100%; justify-content: center; }

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1.5px solid var(--border);
}
.btn-ghost:hover { background: var(--bg); color: var(--text); }

/* ── INPUTS ── */
.form-group { margin-bottom: 18px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

.label {
  display: block;
  font-size: 0.81rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}

.input {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid var(--border);
  border-radius: 11px;
  font-size: 0.9rem;
  background: #FCFAFA;
  color: var(--text);
  transition: border-color 0.18s, box-shadow 0.18s;
  font-family: inherit;
}

.input:focus {
  outline: none;
  border-color: var(--green);
  background: white;
  box-shadow: 0 0 0 3px rgba(123,18,32,0.10);
}

select.input { cursor: pointer; }

/* ── BADGES ── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 11px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
}
.badge-pending { background: var(--warning-bg); color: var(--warning); }
.badge-success { background: var(--success-bg); color: var(--green); }
.badge-error { background: var(--error-bg); color: var(--error); }
.badge-processing { background: #e8f0fe; color: #1a6ae0; }

/* ── TABLE ── */
.table-wrap { overflow-x: auto; border-radius: var(--card-radius); }

table {
  width: 100%;
  border-collapse: collapse;
  background: white;
  border-radius: var(--card-radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

thead th {
  background: var(--green-light);
  color: var(--green);
  padding: 13px 18px;
  text-align: left;
  font-size: 0.77rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-bottom: 1.5px solid var(--border);
}

tbody tr { border-bottom: 1px solid #F3ECED; transition: background 0.15s; }
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: #FCFAFA; }

tbody td { padding: 14px 18px; font-size: 0.875rem; color: var(--text); }

/* ── EMPTY STATE ── */
.empty-state { text-align: center; padding: 56px 24px; }
.empty-icon { font-size: 44px; margin-bottom: 14px; }
.empty-title { font-size: 1rem; font-weight: 600; color: var(--text); margin-bottom: 6px; }
.empty-desc { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 20px; }

/* ── ALERTS ── */
.alert {
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 0.86rem;
  font-weight: 500;
  margin-bottom: 16px;
  display: none;
}
.alert-error { background: var(--error-bg); color: var(--error); border: 1px solid #fad7d5; }
.alert-success { background: var(--success-bg); color: var(--green); border: 1px solid #c6dda8; }
.alert-info { background: #e8f0fe; color: #1a6ae0; border: 1px solid #c2d4f8; }

/* ── UPLOAD ZONE ── */
.upload-zone {
  border: 2px dashed var(--border);
  border-radius: 16px;
  padding: 36px 24px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  background: #FCFAFA;
}
.upload-zone:hover, .upload-zone.drag-over { border-color: var(--green); background: var(--green-light); }
.upload-zone .upload-icon { font-size: 38px; margin-bottom: 12px; }
.upload-zone .upload-text { font-weight: 600; font-size: 0.92rem; color: var(--text); margin-bottom: 4px; }
.upload-zone .upload-sub { font-size: 0.8rem; color: var(--text-muted); }

/* ── SECTION DIVIDER ── */
.section-gap { margin-bottom: 24px; }

/* ── GRID LAYOUTS ── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }

/* ── SPINNER ── */
.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,0.4);
  border-radius: 50%;
  border-top-color: white;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── RESIDENTE SELECTOR (navbar) ── */
.residente-selector { position: relative; }

.residente-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255,255,255,0.15);
  color: white;
  padding: 7px 14px;
  border-radius: 20px;
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 600;
  transition: background 0.18s;
  white-space: nowrap;
  user-select: none;
}
.residente-pill:hover { background: rgba(255,255,255,0.24); }
.residente-pill svg { opacity: 0.75; flex-shrink: 0; }

.residente-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  background: white;
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.14);
  min-width: 210px;
  z-index: 300;
  overflow: hidden;
}
.residente-dropdown.open { display: block; }
.residente-dropdown-header {
  padding: 10px 16px 8px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  border-bottom: 1px solid #F3ECED;
}
.residente-option {
  padding: 11px 16px;
  font-size: 0.875rem;
  color: var(--text);
  cursor: pointer;
  transition: background 0.15s;
  border-bottom: 1px solid #f8faf6;
  display: flex;
  align-items: center;
  gap: 8px;
}
.residente-option:last-child { border-bottom: none; }
.residente-option:hover { background: var(--green-light); }
.residente-option.active { background: var(--green-light); color: var(--green); font-weight: 600; }
.residente-option .r-dot {
  width: 8px; height: 8px; border-radius: 50%; background: var(--border); flex-shrink: 0;
}
.residente-option.active .r-dot { background: var(--green); }

/* ── RESPONSIVE ── */
@media (max-width: 900px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 767px) {
  button, .btn, [role="button"] { min-height: 44px; }
  .grid-2 { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
  /* ⚠️ SIN `transform` EN MÓVIL, Y ES IMPRESCINDIBLE.
     En escritorio la barra se centra con `left:50%` + `translateX(-50%)`. Pero
     un ancestro con transform crea un bloque contenedor, así que el
     `position:fixed` de la barra inferior deja de anclarse a la pantalla y se
     ancla a la navbar: comprobado en vivo, la barra salía arriba (top 15px)
     pese a tener `bottom:0`. En móvil se centra con left/right, que no crea
     contexto. */
  .navbar {
    width: auto;
    top: max(12px, env(safe-area-inset-top));
    left: max(12px, env(safe-area-inset-left));
    right: max(12px, env(safe-area-inset-right));
    transform: none;
    padding: 10px 14px;
    border-radius: 20px;
  }
  .nav-name { display: none; }
  .stats-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
  .page-title { font-size: 1.25rem; }

  /* ⚠️ ANTES AQUÍ HABÍA `.nav-links { display: none }` Y NADA QUE LO
     SUSTITUYERA. Comprobado en un viewport de 375px: desde un teléfono se podía
     entrar, pero NO llegar a Mis Tickets, Mis Facturas ni Mi Perfil — la barra
     solo dejaba el logo y "Salir". No era un problema de estética: la mitad del
     portal era inalcanzable justo en el aparato con el que la gente fotografía
     los tickets.

     La solución es la barra inferior de siempre en móvil. Se reutilizan los
     MISMOS enlaces del escritorio, así que añadir una sección al menú aparece
     automáticamente en el teléfono, sin markup duplicado que se desincronice. */
  .nav-links {
    display: flex;
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 60;
    justify-content: space-around;
    align-items: stretch;
    gap: 0;
    min-height: calc(var(--alto-barra-inf) + env(safe-area-inset-bottom));
    padding: 6px max(4px, env(safe-area-inset-right)) calc(6px + env(safe-area-inset-bottom)) max(4px, env(safe-area-inset-left));
    background: var(--card, #fff);
    border-top: 1px solid var(--border, #e6e6e6);
    box-shadow: 0 -6px 20px rgba(0, 0, 0, .08);
  }
  .nav-links .nav-link, .nav-links .nav-trigger {
    color: var(--text-muted, #7C6A6D);
    flex: 1;
    width: 100%;
    text-align: center;
    font-size: .72rem;
    line-height: 1.15;
    padding: 8px 2px;
    border-radius: 10px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  .nav-group { flex: 1; justify-content: center; }
  .nav-group::after { display: none; }
  .nav-menu {
    position: fixed;
    top: auto;
    bottom: calc(var(--alto-barra-inf) + env(safe-area-inset-bottom) + 8px);
    left: 12px;
    right: 12px;
    width: auto;
    min-width: 0;
    max-height: min(60dvh, 420px);
    overflow-y: auto;
    overscroll-behavior: contain;
    transform: none;
    padding: 8px;
    border-radius: 18px;
    background: #fff;
    box-shadow: 0 14px 40px rgba(36,20,23,.24);
    z-index: 1002;
  }
  .nav-menu-item { min-height: 48px; white-space: normal; }
  /* El fondo va POR DEBAJO de la barra inferior (z-index 60): la barra forma su propia capa y el menu vive
     dentro de ella; si el fondo estuviera por encima (70) taparia el menu y se comeria los toques. */
  .nav-mobile-backdrop { position: fixed; inset: 0; background: rgba(20, 12, 14, .34); z-index: 55; }
  body.nav-menu-abierto .wa-bubble,
  body.notif-abierta .wa-bubble { display: none !important; }
  .nav-links .nav-link.active, .nav-links .nav-trigger.active {
    background: var(--vino-suave, rgba(123, 18, 32, .10));
    color: var(--vino, #7B1220);
    font-weight: 600;
  }

  /* Hueco arriba para la barra flotante y abajo para la barra inferior, para
     que el último botón de cada página no quede tapado. */
  .container { padding: calc(var(--alto-barra-sup) + env(safe-area-inset-top) + 24px) 16px calc(24px + var(--alto-barra-inf) + env(safe-area-inset-bottom)); }

  /* En movil, prioriza las acciones de subir ticket al abrir el panel. */
  .dashboard-container { display: flex; flex-direction: column; }
  .dashboard-container > .two-col { order: 0; }
  .dashboard-container > .greeting-card,
  .dashboard-container > .stats-grid,
  .dashboard-container > #residente-resumen { order: 1; }
  .dashboard-quick-help { font-size: .72rem !important; line-height: 1.3; margin-bottom: 8px !important; }
  .dashboard-shortcuts { gap: 6px !important; }

  /* ⚠️ El botón de WhatsApp tapaba el último enlace de la barra ("Admin").
     Dos detalles que costaron el fallo: la clase real es .wa-bubble —no
     .wa-float, que fue lo primero que probé— y está definida en un <style>
     DENTRO de cada .html, que va después de esta hoja y por tanto gana. De ahí
     el !important, que aquí no es pereza sino la única forma de ganarle a un
     estilo declarado más abajo en el documento. */
  .nav-logout { min-height: 44px; display: inline-flex; align-items: center; }
  .modal-close { min-width: 44px; }
  .facturas-filtros { flex-wrap: wrap; }
  .facturas-filtros select { flex: 1 1 135px; min-width: 0; min-height: 44px; }
  .facturas-filtros #btn-descargar-zip { flex: 1 1 180px; min-height: 44px; }
  .factura-row > label { min-width: 44px; min-height: 44px; justify-content: center; }

  .wa-bubble { bottom: calc(var(--alto-barra-inf) + env(safe-area-inset-bottom) + 12px) !important; right: 14px !important; z-index: 59 !important; }
  .wa-btn { width: 48px !important; height: 48px !important; }
  .wa-tooltip { display: none !important; }   /* no hay hover en un teléfono */

  /* Las tablas anchas se desplazan dentro de su caja en vez de romper el ancho
     de la página, que es lo que provoca el zoom-out horizontal en móvil. */
  .table-wrap, .tabla-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  table { min-width: 520px; }

  /* iOS hace zoom automático al enfocar un input de menos de 16px. */
  input, select, textarea { font-size: 16px; }

  /* Los modales ocupaban ancho fijo y se salían de la pantalla. */
  .modal, .modal-card, .modal-content { width: calc(100vw - 32px); max-width: 100%; max-height: 88vh; overflow-y: auto; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .nav-links .nav-link { font-size: .68rem; }
  .nav-brand-sub { display: none; }
}

/* ── NOTIFICACIONES ── */
.notif-wrapper {
  position: relative;
}

.notif-bell {
  position: relative;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  background: transparent;
  border: none;
  font-size: 1.1rem;
  color: var(--text-muted);
  transition: background 0.15s, color 0.15s;
}
.notif-bell:hover { background: var(--bg); color: var(--green); }

.notif-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  min-width: 17px;
  height: 17px;
  background: #e53935;
  color: white;
  border-radius: 99px;
  font-size: 0.65rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 3px;
  border: 2px solid white;
  line-height: 1;
}

.notif-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: 320px;
  background: white;
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.13);
  border: 1px solid var(--border);
  z-index: 1002;
  overflow: hidden;
}
.notif-dropdown.open { display: block; }

.notif-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px 12px;
  border-bottom: 1px solid var(--border);
}
.notif-header-title {
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--text);
}
.notif-leer-todas {
  font-size: 0.75rem;
  color: var(--green);
  font-weight: 600;
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
}
.notif-leer-todas:hover { text-decoration: underline; }

.notif-lista {
  max-height: 320px;
  overflow-y: auto;
}

.notif-item {
  padding: 12px 16px;
  border-bottom: 1px solid #f5f7f3;
  cursor: pointer;
  transition: background 0.12s;
  background: #f0f7e8;
}
.notif-item:last-child { border-bottom: none; }
.notif-item:hover { background: #e8f3dc; }
.notif-item.leida { background: white; }
.notif-item.leida:hover { background: #FCFAFA; }

.notif-msg {
  font-size: 0.8rem;
  color: var(--text);
  line-height: 1.45;
  margin-bottom: 4px;
}

.notif-time {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.notif-empty {
  padding: 28px 16px;
  text-align: center;
  font-size: 0.82rem;
  color: var(--text-muted);
}

/* ── RESIDENTE TABS ── */
.residente-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.residente-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.18s;
  border: 1.5px solid var(--border);
  background: white;
  color: var(--text-muted);
  font-family: inherit;
}
.residente-tab:hover { border-color: var(--green); color: var(--green); background: var(--green-light); }
.residente-tab.active { background: var(--green); color: white; border-color: var(--green); }

.tab-badge {
  padding: 1px 7px;
  border-radius: 10px;
  font-size: 0.72rem;
  font-weight: 700;
  background: var(--bg);
  color: var(--text-muted);
}
.residente-tab.active .tab-badge { background: rgba(255,255,255,0.25); color: white; }

/* ── RESIDENTE MINI-CARDS ── */
.residente-mini-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.residente-mini-card {
  background: white;
  border-radius: 12px;
  padding: 14px 16px;
  box-shadow: var(--shadow);
}
.rmc-icon { font-size: 20px; margin-bottom: 7px; }
.rmc-name { font-size: 0.82rem; font-weight: 700; color: var(--text); margin-bottom: 4px; }
.rmc-tickets { font-size: 1.15rem; font-weight: 800; color: var(--text); letter-spacing: -0.02em; line-height: 1; margin-bottom: 3px; }
.rmc-label { font-size: 0.7rem; color: var(--text-muted); font-weight: 500; margin-bottom: 6px; }
.rmc-gasto { font-size: 0.78rem; font-weight: 700; color: var(--green); }
.rmc-facturas { font-size: 0.68rem; color: var(--text-muted); margin-top: 2px; }

/* ── MODAL ── */
.modal-overlay {
  display: none;
  padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 2000;
  align-items: center;
  justify-content: center;
}
.modal-overlay.open { display: flex; }

.modal-card {
  background: white;
  border-radius: 20px;
  box-shadow: 0 16px 48px rgba(0,0,0,0.18);
  width: 100%;
  max-width: 480px;
  margin: 20px;
  overflow: hidden;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border);
}
.modal-title {
  font-weight: 700;
  font-size: 1rem;
  color: var(--text);
}
.modal-close {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: none;
  background: var(--bg);
  cursor: pointer;
  font-size: 1rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}
.modal-close:hover { background: var(--border); }

.modal-body {
  padding: 20px 24px;
}

.modal-footer {
  padding: 16px 24px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

/* ═══════════════════════════════════════════════════════════════════════════
   CAPA FUTURISTA — minimalista, sobre el mismo guinda
   ───────────────────────────────────────────────────────────────────────────
   Va al FINAL y solo re-declara propiedades: no toca ni un selector existente.
   Para volver al diseño anterior basta con borrar este bloque — nada más
   depende de él. Es a propósito: es una propuesta, y tiene que poder deshacerse
   sin cirugía.

   La idea no es "añadir efectos" sino quitar peso visual: menos sombra difusa,
   bordes de 1px que sí se ven, superficies planas y una línea de acento que
   aparece solo al pasar por encima. El color no cambia; cambia cómo respira.
   ═══════════════════════════════════════════════════════════════════════════ */
:root {
  --card-radius: 14px;              /* menos redondeado = más técnico */
  --shadow: 0 1px 2px rgba(36, 20, 23, .05);
  --shadow-md: 0 8px 32px rgba(123, 18, 32, .10);
  --linea: rgba(123, 18, 32, .14);  /* el borde de acento, discreto */
}

body { letter-spacing: -0.011em; }

/* Superficies: borde nítido en vez de sombra difusa. */
.card, .stat-card, .residente-mini-card, .modal, .modal-card {
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  transition: border-color .18s ease, transform .18s ease, box-shadow .18s ease;
}
.card:hover, .stat-card:hover {
  border-color: var(--linea);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

/* Las cifras son el contenido real de la tarjeta: que pesen. */
.stat-value {
  font-weight: 800;
  letter-spacing: -0.035em;
  font-variant-numeric: tabular-nums;   /* los números no bailan al actualizarse */
}
.stat-label {
  text-transform: uppercase;
  letter-spacing: .07em;
  font-size: .68rem;
  font-weight: 600;
  color: var(--text-muted);
}

/* Filo superior de acento que solo aparece al pasar por encima. */
.stat-card { position: relative; overflow: hidden; }
.stat-card::before {
  content: '';
  position: absolute; inset: 0 0 auto 0; height: 2px;
  background: linear-gradient(90deg, var(--vino), var(--gris-marca));
  transform: scaleX(0); transform-origin: left;
  transition: transform .25s ease;
}
.stat-card:hover::before { transform: scaleX(1); }

/* La barra deja de ser un bloque sólido: cristal sobre el fondo. */
.navbar {
  background: linear-gradient(135deg, var(--vino) 0%, var(--vino-oscuro) 100%);
  box-shadow: 0 8px 32px rgba(123, 18, 32, .22);
  /* ⚠️ NADA DE backdrop-filter AQUÍ.
     Lo tenía y volvió a romper la barra inferior del móvil: backdrop-filter
     crea bloque contenedor para los hijos `position: fixed`, exactamente igual
     que el `transform` que ya se había quitado por este mismo motivo. La barra
     dejaba de anclarse a la pantalla y volvía a dibujarse arriba.
     El efecto no aportaba nada —la barra es opaca— y costaba la navegación. */
}
.nav-link { transition: background .18s ease, color .18s ease; }

/* Tarjeta de saludo: sin el icono decorativo, el texto ocupa todo el ancho. */
.greeting-card {
  background: linear-gradient(135deg, var(--vino) 0%, var(--vino-oscuro) 100%);
  border: none;
  position: relative; overflow: hidden;
}
/* Una sola forma geométrica muy tenue, en vez de un emoji. */
.greeting-card::after {
  content: '';
  position: absolute; right: -60px; top: -60px;
  width: 220px; height: 220px; border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, .10);
}

/* Botones más planos y con foco visible (accesibilidad, no adorno). */
.btn, button { transition: transform .12s ease, filter .18s ease; }
.btn:active, button:active { transform: translateY(1px); }
:focus-visible { outline: 2px solid var(--vino) !important; outline-offset: 2px; }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

@media (max-width: 767px) {
  .notif-bell { flex: 0 0 36px; width: 36px; min-width: 36px; background: transparent !important; color: #fff !important; }
  .notif-bell:hover { background: transparent !important; color: #fff !important; }
  .notif-dropdown {
    position: fixed;
    top: calc(var(--alto-barra-sup) + env(safe-area-inset-top) + 24px);
    left: 12px;
    right: 12px;
    width: auto;
    max-height: calc(100dvh - var(--alto-barra-sup) - var(--alto-barra-inf) - env(safe-area-inset-top) - env(safe-area-inset-bottom) - 48px);
    overflow-y: auto;
    overscroll-behavior: contain;
    z-index: 1002;
    background: #fff;
  }
  .notif-lista { max-height: none; overflow: visible; }
  .notif-msg { overflow-wrap: anywhere; word-break: normal; }
}
