:root {
  --p:    #16A34A;
  --pd:   #15803D;
  --accent: #D4A017;
  --bg:   #FAFAFA;
  --card: #FFFFFF;
  --tx:   #18181B;
  --txl:  #52525B;
  --ok:   #15803D;
  --warn: #C97F1E;
  --err:  #B91C1C;
  --bdr:  #E4E4E7;
  --st:   env(safe-area-inset-top, 0px);
  --sb:   env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

html, body {
  height: 100%; height: 100dvh;
  font-family: 'Space Grotesk', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg); color: var(--tx);
  overflow: hidden; -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
}

.hidden  { display: none !important; }
.flex    { display: flex; }

/* ── Login ─────────────────────────────────────────────────────── */
#screen-login {
  height: 100dvh; display: flex;
  background: linear-gradient(160deg, #14532D 0%, var(--p) 100%);
  align-items: center; justify-content: center; padding: 24px;
}
.login-card {
  background: #fff; border-radius: 24px; padding: 36px 28px;
  width: 100%; max-width: 380px;
  box-shadow: 0 20px 60px rgba(0,0,0,.18);
}
.login-logo {
  width: 64px; height: 64px; background: var(--p); border-radius: 18px;
  display: flex; align-items: center; justify-content: center;
  font-size: 32px; font-weight: 900; color: #fff; margin: 0 auto 16px;
}
.login-title { text-align: center; font-size: 26px; font-weight: 800; color: var(--tx); letter-spacing: -.4px; }
.login-sub   { text-align: center; color: var(--txl); font-size: 14px; margin-bottom: 32px; margin-top: 4px; }

/* ── Fields ─────────────────────────────────────────────────────── */
.field { margin-bottom: 14px; }
.field label {
  display: block; font-size: 12px; font-weight: 600; color: var(--txl);
  text-transform: uppercase; letter-spacing: .6px; margin-bottom: 6px;
}
.field input, .field select {
  width: 100%; padding: 13px 16px; border: 1.5px solid var(--bdr); border-radius: 12px;
  font-size: 16px; color: var(--tx); background: #fff; outline: none;
  font-family: inherit;
  -webkit-appearance: none; appearance: none; transition: border-color .15s;
}
.field input:focus { border-color: var(--p); }

/* ── Buttons ────────────────────────────────────────────────────── */
.btn-primary {
  width: 100%; padding: 15px; background: var(--p); color: #fff; border: none;
  border-radius: 14px; font-size: 16px; font-weight: 700; cursor: pointer; margin-top: 6px;
  font-family: inherit; letter-spacing: -.1px;
  transition: background .15s, transform .1s;
}
.btn-primary:active  { background: var(--pd); transform: scale(.98); }
.btn-primary:disabled { opacity: .6; pointer-events: none; }

/* ── Error msg ──────────────────────────────────────────────────── */
.err-msg {
  background: #FEF2F2; color: var(--err); border-radius: 10px;
  padding: 10px 14px; font-size: 13px; margin-bottom: 14px;
}

/* ── Toast (sin Materialize) ───────────────────────────────────── */
.pwa-toast {
  position: fixed; left: 50%; bottom: 90px; transform: translate(-50%, 20px);
  max-width: calc(100% - 32px); padding: 12px 18px; border-radius: 10px;
  color: #fff; font-size: 13.5px; font-weight: 500; text-align: center;
  box-shadow: 0 6px 20px rgba(0,0,0,.25); z-index: 9999;
  opacity: 0; transition: opacity .25s ease, transform .25s ease; pointer-events: none;
}
.pwa-toast.ok  { background: var(--p, #16A34A); }
.pwa-toast.err { background: var(--err, #c62828); }
.pwa-toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ── App Shell ──────────────────────────────────────────────────── */
#app-shell { height: 100dvh; display: flex; flex-direction: column; }

#app-header {
  background: linear-gradient(135deg, #14532D 0%, var(--p) 100%);
  color: #fff; flex-shrink: 0;
  padding: calc(var(--st) + 14px) 16px 14px;
  display: flex; justify-content: space-between; align-items: center;
  box-shadow: 0 2px 12px rgba(30,132,73,.25);
}
#header-title { font-size: 18px; font-weight: 700; letter-spacing: -.3px; }
#btn-logout {
  background: rgba(255,255,255,.15); border: 1px solid rgba(255,255,255,.2); color: #fff;
  padding: 7px 14px; border-radius: 20px; font-size: 13px; font-weight: 600; cursor: pointer;
  font-family: inherit; transition: background .15s;
}
#btn-logout:active { background: rgba(255,255,255,.25); }

.screen-content { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; }

/* ── Bottom Nav — recorte flotante con ícono activo elevado ──────────
   El tab activo "salta" fuera de la barra dentro de un círculo blanco que
   se asienta sobre un recorte (#nav-notch, mismo color que el fondo de la
   página) — el recorte y el ícono se mueven juntos con easing tipo resorte
   al cambiar de tab. */
#bottom-nav {
  position: relative;
  background: linear-gradient(135deg, #14532D 0%, var(--p) 100%);
  border-radius: 24px 24px 0 0;
  flex-shrink: 0;
  display: flex;
  padding: 16px 0 var(--sb);
  box-shadow: 0 -8px 28px rgba(0,0,0,.18);
  overflow: visible;
}
#nav-notch {
  position: absolute;
  top: -20px; left: 10%;
  width: 58px; height: 58px;
  transform: translateX(-50%);
  border-radius: 50%;
  background: var(--bg);
  transition: left .5s cubic-bezier(.34, 1.56, .64, 1);
  opacity: 0;
  z-index: 1;
}
.nav-btn {
  position: relative; z-index: 2;
  flex: 1; background: none; border: none; padding: 0 4px;
  display: flex; flex-direction: column; align-items: center; gap: 5px; cursor: pointer;
  transition: opacity .15s;
}
.nav-btn:active { opacity: .7; }
.nav-icon-frame {
  width: 34px; height: 34px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: rgba(255,255,255,.7);
  transition: transform .5s cubic-bezier(.34, 1.56, .64, 1), background .3s ease, color .3s ease, box-shadow .3s ease;
}
.nav-icon { width: 19px; height: 19px; display: block; }
.nav-label {
  font-size: 10px; font-weight: 600; color: rgba(255,255,255,.68); letter-spacing: .2px;
  transition: opacity .2s ease;
}
.nav-btn.active .nav-icon-frame {
  background: #fff;
  color: var(--p);
  transform: translateY(-30px) scale(1.08);
  box-shadow: 0 8px 18px rgba(0,0,0,.28);
}
.nav-btn.active .nav-label { opacity: 0; }
/* Modo oscuro: el círculo blanco puro del ícono activo desentona con el resto de la UI
   (todo oscuro) — usa la superficie "card" del tema en vez de blanco fijo. */
body.pwa-dark .nav-btn.active .nav-icon-frame { background: var(--card); color: var(--p); }

/* ── Center loader ───────────────────────────────────────────────── */
.center-msg {
  display: flex; align-items: center; justify-content: center;
  min-height: 140px; color: var(--txl); font-size: 15px;
}

/* ── Skeleton shimmer (paridad con móvil — SkeletonList/SkeletonDashboard) ── */
.skel-wrap { padding: 16px; }
.skel-card {
  height: 76px; border-radius: 16px; margin-bottom: 12px;
  background: linear-gradient(90deg, var(--bdr) 25%, rgba(255,255,255,.7) 50%, var(--bdr) 75%);
  background-size: 200% 100%;
  animation: skelShimmer 1.3s ease-in-out infinite;
}
body.pwa-dark .skel-card {
  background: linear-gradient(90deg, #2A2A2D 25%, #3A3F52 50%, #2A2A2D 75%);
  background-size: 200% 100%;
}
@keyframes skelShimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* ── Dashboard ───────────────────────────────────────────────────── */
.dash-welcome { padding: 16px 16px 4px; font-size: 14px; color: var(--txl); font-weight: 500; }
.dash-period  { padding: 0 16px 12px; font-size: 12px; color: var(--txl); text-transform: capitalize; }

.stats-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
  padding: 4px 14px 10px;
}
.stat-card {
  border-radius: 16px; padding: 18px;
  box-shadow: 0 4px 16px rgba(0,0,0,.12);
}
.stat-card.full { grid-column: 1 / -1; }
.stat-lbl { font-size: 11px; font-weight: 700; color: rgba(255,255,255,.8); text-transform: uppercase; letter-spacing: .6px; }
.stat-val { font-size: 22px; font-family: 'Fraunces', serif; font-weight: 700; color: #fff; margin-top: 6px; letter-spacing: -.3px; }
.stat-sub { font-size: 11px; color: rgba(255,255,255,.7); margin-top: 3px; }

/* ── Insights + Puntaje + Tendencia (dashboard) ──────────────────── */
.insight-row { display: flex; gap: 8px; padding: 0 14px 10px; overflow-x: auto; }
.insight-pill {
  flex: 1; min-width: 100px; display: flex; align-items: center; gap: 8px;
  background: var(--card); border: 1px solid; border-radius: 14px; padding: 10px 12px;
  box-shadow: 0 2px 10px rgba(0,0,0,.05);
}
.insight-icon { font-size: 18px; }
.insight-val { font-size: 15px; font-weight: 800; }
.insight-lbl { font-size: 10.5px; color: var(--txl); }

.puntaje-card {
  background: var(--card); border-radius: 16px; padding: 16px 18px;
  margin: 0 14px 10px; box-shadow: 0 2px 12px rgba(0,0,0,.06);
}
.puntaje-hd { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.puntaje-title { font-size: 14px; font-weight: 700; color: var(--tx); }
.puntaje-badge { font-size: 11px; font-weight: 700; padding: 3px 10px; border-radius: 20px; }
.puntaje-body { display: flex; align-items: center; gap: 16px; }
.puntaje-bars { flex: 1; display: flex; flex-direction: column; gap: 8px; }
.puntaje-bar-row { display: flex; align-items: center; gap: 6px; }
.puntaje-bar-lbl { font-size: 11px; color: var(--txl); width: 42px; flex-shrink: 0; }
.puntaje-bar-track { flex: 1; height: 6px; border-radius: 4px; background: var(--bg); overflow: hidden; }
.puntaje-bar-fill { height: 100%; background: var(--p); border-radius: 4px; }
.puntaje-bar-val { font-size: 10.5px; color: var(--txl); width: 36px; text-align: right; flex-shrink: 0; }

.tendencia-card {
  background: var(--card); border-radius: 16px; padding: 16px 18px 12px;
  margin: 0 14px 10px; box-shadow: 0 2px 12px rgba(0,0,0,.06);
}
.tendencia-title { font-size: 13px; font-weight: 700; color: var(--tx); margin-bottom: 8px; }
.tendencia-labels { display: flex; justify-content: space-between; font-size: 10.5px; color: var(--txl); margin-top: 4px; text-transform: capitalize; }
body.pwa-dark .insight-pill, body.pwa-dark .puntaje-card, body.pwa-dark .tendencia-card { background: #131313; }
body.pwa-dark .puntaje-bar-track { background: #0A0A0A; }

.formula-card {
  background: #fff; border-radius: 16px; padding: 18px;
  margin: 0 14px 10px;
  box-shadow: 0 2px 12px rgba(0,0,0,.06);
}
.formula-title { font-size: 14px; font-weight: 700; color: var(--tx); margin-bottom: 12px; letter-spacing: -.2px; }
.formula-row   { display: flex; justify-content: space-between; padding: 5px 0; }
.formula-lbl   { font-size: 13px; color: var(--txl); }
.formula-val   { font-size: 13px; font-weight: 600; }
.formula-val.bold { font-weight: 800; font-size: 14px; }
.formula-div   { border-top: 1px solid var(--bdr); margin: 8px 0; }

.fondos-section { padding: 4px 14px 16px; }
.fondos-title   { font-size: 15px; font-weight: 700; color: var(--tx); margin-bottom: 10px; letter-spacing: -.2px; }
.fondo-item {
  background: #fff; border-radius: 14px; padding: 14px 14px 14px 18px;
  margin-bottom: 8px; display: flex; align-items: center;
  border-left: 4px solid var(--ok);
  box-shadow: 0 2px 8px rgba(0,0,0,.06);
}
.fondo-item.neg { border-left-color: var(--err); }
.fondo-body { flex: 1; }
.fondo-name { font-size: 14px; font-weight: 600; color: var(--tx); }
.fondo-sub  { font-size: 11px; color: var(--txl); margin-top: 1px; }
.fondo-meta { font-size: 11px; color: var(--txl); margin-top: 3px; }
.fondo-saldo { font-size: 16px; font-weight: 800; margin-left: 10px; }
.fondo-saldo.ok  { color: var(--ok); }
.fondo-saldo.neg { color: var(--err); }
.fondo-meta-bar { height: 5px; border-radius: 3px; background: var(--bdr); margin-top: 6px; overflow: hidden; }
.fondo-meta-bar-fill { height: 100%; border-radius: 3px; transition: width .3s; }

.banco-icon-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; padding: 6px 0; }
.banco-icon-btn {
  display: flex; align-items: center; justify-content: center;
  background: #fff; border: 2px solid var(--bdr); border-radius: 12px;
  padding: 8px; cursor: pointer; aspect-ratio: 1;
}
.banco-icon-btn.active { border-color: var(--p); background: rgba(30,132,73,.08); }
body.pwa-dark .banco-icon-btn { background: var(--card); }

/* ── Gastos ──────────────────────────────────────────────────────── */
#gastos-toolbar {
  background: #fff; padding: 10px 14px; border-bottom: 1px solid var(--bdr);
  display: flex; align-items: center; gap: 8px;
  position: sticky; top: 0; z-index: 10;
}
#gastos-filters { display: flex; gap: 6px; flex: 1; overflow-x: auto; padding-bottom: 2px; }
.filter-btn {
  padding: 7px 16px; border-radius: 20px; border: none;
  background: var(--bg); font-size: 13px; font-weight: 600;
  color: var(--txl); cursor: pointer; white-space: nowrap; font-family: inherit;
  transition: background .15s, color .15s;
}
.filter-btn.active { background: var(--p); color: #fff; }
.fab {
  width: 40px; height: 40px; background: var(--p); color: #fff; border: none;
  border-radius: 50%; font-size: 24px; line-height: 1; cursor: pointer; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 14px rgba(30,132,73,.4);
  transition: transform .15s, box-shadow .15s;
}
.fab:active { transform: scale(.92); box-shadow: 0 2px 8px rgba(30,132,73,.3); }
.btn-icon-sm {
  width: 40px; height: 40px; background: var(--bg); color: var(--tx); border: 1px solid var(--bdr);
  border-radius: 50%; font-size: 17px; line-height: 1; cursor: pointer; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  transition: transform .15s;
}
.btn-icon-sm:active { transform: scale(.92); }
body.pwa-dark .btn-icon-sm { background: var(--card); }

#gastos-summary, #deudas-summary, #ingresos-summary {
  background: #fff; display: flex;
  border-bottom: 1px solid var(--bdr); padding: 10px 0;
}
.summ-item { flex: 1; text-align: center; }
.summ-item + .summ-item { border-left: 1px solid var(--bdr); }
.summ-val { font-size: 18px; font-weight: 900; color: var(--tx); letter-spacing: -.4px; }
.summ-val.warn { color: var(--warn); }
.summ-lbl { font-size: 11px; color: var(--txl); margin-top: 2px; }

.gastos-list  { padding: 12px; }
.gasto-item {
  background: #fff; border-radius: 14px; display: flex; margin-bottom: 8px; overflow: hidden;
  box-shadow: 0 2px 8px rgba(0,0,0,.07);
}
.gasto-bar { width: 4px; flex-shrink: 0; }
.gasto-bar.ok   { background: var(--ok); }
.gasto-bar.warn { background: var(--warn); }
.gasto-body { flex: 1; padding: 12px; cursor: pointer; }
.gasto-top  { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; margin-bottom: 4px; }
.gasto-desc { font-size: 14px; font-weight: 600; color: var(--tx); }
.badge      { border-radius: 20px; padding: 3px 10px; font-size: 11px; font-weight: 700; flex-shrink: 0; }
.badge.ok   { background: #F0FDF4; color: #15803D; }
.badge.warn { background: #FFFBEB; color: #D97706; }
.gasto-bot  { display: flex; justify-content: space-between; align-items: center; }
.gasto-monto { font-size: 16px; font-weight: 800; color: var(--tx); letter-spacing: -.3px; }
.gasto-fecha { font-size: 12px; color: var(--txl); }
.gasto-cuota { font-size: 11px; color: var(--p); font-weight: 600; margin-top: 3px; }
.gasto-del  {
  padding: 0 14px; display: flex; align-items: center;
  background: none; border: none; color: var(--err); font-size: 18px; font-weight: 700; cursor: pointer;
}

.empty-msg { text-align: center; padding: 48px 24px; color: var(--txl); font-size: 15px; }

/* ── "Cargar más" (paginación de listas largas) ─────────────────── */
.btn-cargar-mas {
  display: block; width: calc(100% - 24px); margin: 4px 12px 16px;
  padding: 12px; border-radius: 14px; border: 1.5px dashed var(--bdr);
  background: none; color: var(--p); font-size: 13px; font-weight: 700;
  font-family: inherit; cursor: pointer; transition: background .15s;
}
.btn-cargar-mas:active { background: rgba(30,132,73,.08); }
body.pwa-dark .btn-cargar-mas:active { background: rgba(86,179,120,.1); }

/* ── Modal nuevo gasto ───────────────────────────────────────────── */
#modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 200;
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
  display: none; align-items: flex-end; justify-content: center;
}
#modal-overlay.open { display: flex; }

#modal-box { /* alias — heredado por .modal-box */ }
@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }

.modal-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 18px 16px; background: #fff; border-radius: 22px 22px 0 0;
  border-bottom: 1px solid var(--bdr);
}
.modal-header h3 { font-size: 17px; font-weight: 700; letter-spacing: -.2px; }
.modal-hbtn { background: none; border: none; font-size: 15px; padding: 6px 10px; cursor: pointer; color: var(--txl); font-family: inherit; }
.modal-hbtn.save { color: var(--p); font-weight: 700; }
.modal-hbtn:disabled { opacity: .5; pointer-events: none; }

.modal-body { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 20px 16px; }

.tipo-row { display: flex; flex-wrap: wrap; gap: 8px; }
.tipo-btn {
  padding: 8px 18px; border-radius: 20px; border: 1.5px solid var(--bdr);
  background: #fff; font-size: 13px; font-weight: 600; color: var(--txl); cursor: pointer;
  font-family: inherit; transition: background .15s, border-color .15s, color .15s;
}
.tipo-btn.active { background: var(--p); border-color: var(--p); color: #fff; }

/* ── Offline bar ─────────────────────────────────────────────────── */
#offline-bar {
  background: #374151; color: #fff; flex-shrink: 0;
  text-align: center; padding: 5px 12px;
  font-size: 12px; font-weight: 600; letter-spacing: .2px;
  animation: pwaSlideDown .25s ease;
}

/* ── Update banner ───────────────────────────────────────────────── */
#update-banner {
  position: fixed; top: 0; left: 0; right: 0; z-index: 9999;
  background: #14532D; color: #fff; padding: 10px 14px;
  display: flex; align-items: center; gap: 8px;
  box-shadow: 0 2px 10px rgba(0,0,0,.25);
  animation: pwaSlideDown .3s ease;
}
@keyframes pwaSlideDown { from { transform: translateY(-100%); } }
#update-banner span { flex: 1; font-size: 13px; font-weight: 600; }
#btn-update {
  background: #fff; color: var(--p); border: none;
  padding: 6px 14px; border-radius: 16px; font-size: 13px; font-weight: 700; cursor: pointer;
  font-family: inherit;
}
#btn-update-close {
  background: none; border: none; color: rgba(255,255,255,.7);
  font-size: 18px; cursor: pointer; padding: 4px; flex-shrink: 0;
}

/* ── Banner: sugerir instalar ───────────────────────────────────── */
#install-banner {
  position: fixed; left: 12px; right: 12px; bottom: calc(var(--sb, 0px) + 72px); z-index: 250;
  background: #14532D; color: #fff; padding: 12px 14px; border-radius: 16px;
  display: flex; align-items: center; gap: 10px;
  box-shadow: 0 6px 20px rgba(0,0,0,.3);
  animation: pwaSlideDown .3s ease;
}
#install-banner-text { flex: 1; font-size: 13px; font-weight: 600; }
#btn-install {
  background: #fff; color: var(--p); border: none;
  padding: 7px 14px; border-radius: 16px; font-size: 13px; font-weight: 700; cursor: pointer;
  font-family: inherit; flex-shrink: 0;
}
#btn-install-close {
  background: none; border: none; color: rgba(255,255,255,.7);
  font-size: 16px; cursor: pointer; padding: 4px; flex-shrink: 0;
}

#modal-install-ios-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 200;
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
  display: none; align-items: flex-end; justify-content: center;
}
#modal-install-ios-overlay.open { display: flex; }

/* ── Scan boleta ─────────────────────────────────────────────────── */
#scan-area {
  margin-bottom: 16px; padding: 12px 0; border-bottom: 1px dashed var(--bdr);
}
.btn-scan {
  width: 100%; padding: 12px; background: #F0FDF4; color: #052e16; border: 1.5px solid #8FB596;
  border-radius: 12px; font-size: 15px; font-weight: 700; cursor: pointer;
  font-family: inherit; transition: background .15s;
}
.btn-scan:active  { background: #D1FAE5; }
.btn-scan:disabled { opacity: .6; pointer-events: none; }

.scan-status {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  margin-top: 10px; font-size: 13px; color: var(--txl);
}
.scan-status::before {
  content: ''; display: inline-block; width: 16px; height: 16px;
  border: 2px solid var(--bdr); border-top-color: var(--p);
  border-radius: 50%; animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Nota post-scan */
.ng-nota {
  border-radius: 10px; padding: 10px 14px; font-size: 13px; margin-bottom: 12px;
  background: #FFFBEB; color: #92400E; border-left: 3px solid #D9A15C;
}

/* Campos con datos extraídos vs campos que faltan */
.field input.extracted { border-color: #8FB596; background: #F0FDF4; }
.field input.needed    { border-color: #D9A15C; background: #FFFBEB; }
.field input.extracted:focus { border-color: var(--ok); }
.field input.needed:focus    { border-color: var(--warn); }

/* ── Calendario ──────────────────────────────────────────────────── */
#cal-toolbar {
  background: #fff; padding: 10px 14px; border-bottom: 1px solid var(--bdr);
  display: flex; align-items: center; gap: 8px;
  position: sticky; top: 0; z-index: 10;
}
#cal-mes-label { flex: 1; text-align: center; font-size: 14px; font-weight: 600; color: var(--tx); text-transform: capitalize; }
.cal-day-group { padding: 10px 14px 2px; font-size: 12px; font-weight: 700; color: var(--txl); text-transform: uppercase; }
.cal-event {
  display: flex; align-items: center; gap: 10px; padding: 10px 14px;
  border-bottom: 1px solid var(--bdr); background: #fff;
}
.cal-event.is-nota { cursor: pointer; }
.cal-event-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.cal-event-dot.gasto  { background: var(--warn); }
.cal-event-dot.deuda  { background: var(--err); }
.cal-event-dot.ingreso{ background: var(--ok); }
.cal-event-dot.nota   { background: #8E44AD; }
.cal-event-body { flex: 1; min-width: 0; }
.cal-event-desc { font-size: 13.5px; font-weight: 500; color: var(--tx); }
.cal-event-tipo { font-size: 11px; color: var(--txl); }
.cal-event-monto { font-size: 13px; font-weight: 600; color: var(--tx); }
.cal-event-del { background: none; border: none; color: var(--txl); font-size: 16px; cursor: pointer; padding: 4px 6px; }

.hist-ing-row { border-bottom: 1px solid var(--bdr); padding: 10px 0; display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.hist-ing-row:last-child { border-bottom: none; }
.hist-ing-valor { font-size: 15px; font-weight: 700; color: var(--tx); }
.hist-ing-meta { font-size: 11.5px; color: var(--txl); margin-top: 2px; }
body.pwa-dark #cal-toolbar, body.pwa-dark .cal-event { background: #0A0A0A; border-color: #2A2A2D; }

/* ── Proyección ──────────────────────────────────────────────────── */
#proy-body { padding: 14px; }
.proy-section { background: #fff; border-radius: 12px; padding: 14px; border: 1px solid var(--bdr); }
.proy-section-hd { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
#proy-sel-meses {
  height: 32px; font-size: 13px; padding: 0 8px; border-radius: 6px; border: 1px solid var(--bdr);
  background: #fff; color: var(--tx);
}
.proy-row { border-bottom: 1px solid var(--bdr); padding: 10px 0; }
.proy-row:last-child { border-bottom: none; }
.proy-row-hd { display: flex; align-items: center; justify-content: space-between; gap: 8px; cursor: pointer; }
.proy-row-mes { font-size: 13.5px; font-weight: 700; color: var(--tx); }
.proy-row-mes.actual { color: var(--p); }
.proy-row-nums { display: flex; gap: 12px; font-size: 12.5px; margin-top: 4px; flex-wrap: wrap; }
.proy-row-detalle { margin-top: 8px; font-size: 12px; color: var(--txl); display: none; }
.proy-row-detalle.open { display: block; }
.proy-row-detalle div { margin-bottom: 2px; }
.tl-row { display: flex; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--bdr); }
.tl-row.actual { background: rgba(30,132,73,.06); border-radius: 8px; padding-left: 6px; }
.tl-mes { min-width: 60px; font-size: 12.5px; font-weight: 600; color: var(--txl); }
.tl-mes.actual { color: var(--p); }
.tl-nums { flex: 1; font-size: 12px; display: flex; gap: 12px; flex-wrap: wrap; }
body.pwa-dark .proy-section { background: #131313; border-color: #2A2A2D; }
body.pwa-dark #proy-sel-meses { background: #131313; border-color: #2A2A2D; color: var(--tx); }

/* ── Deudas ──────────────────────────────────────────────────────── */
#deudas-toolbar, #ingresos-toolbar, #fondos-toolbar {
  background: #fff; padding: 10px 14px; border-bottom: 1px solid var(--bdr);
  display: flex; align-items: center; gap: 8px;
  position: sticky; top: 0; z-index: 10;
}
#deudas-filters { display: flex; gap: 6px; flex: 1; }
.toolbar-title { flex: 1; font-size: 14px; font-weight: 600; color: var(--tx); }

/* Modales secundarios reutilizan los mismos estilos del gasto.
   IMPORTANTE: todo nuevo #modal-X-overlay debe agregarse a ESTOS DOS selectores — sin esto
   el overlay no tiene position:fixed ni display:none por defecto, queda siempre visible
   pegado en el flujo normal de la página en vez de comportarse como modal (bug real
   encontrado 2026-07-18: modal-fondo-overlay y modal-cierre-fondos-overlay llevaban así
   desde que se crearon). */
#modal-deuda-overlay, #modal-ingreso-overlay, #modal-cmr-overlay, #modal-nota-overlay, #modal-historial-ing-overlay,
#modal-adoptar-overlay, #modal-banco-overlay, #modal-categoria-overlay, #modal-ciclo-detalle-overlay,
#modal-cierre-fondos-overlay, #modal-fondo-overlay, #modal-historial-cat-overlay, #modal-meta-overlay,
#modal-password-overlay, #modal-pendientes-overlay, #modal-progreso-meta-overlay, #modal-tarjeta-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 200;
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
  display: none; align-items: flex-end; justify-content: center;
}
#modal-deuda-overlay.open, #modal-ingreso-overlay.open, #modal-cmr-overlay.open, #modal-nota-overlay.open, #modal-historial-ing-overlay.open,
#modal-adoptar-overlay.open, #modal-banco-overlay.open, #modal-categoria-overlay.open, #modal-ciclo-detalle-overlay.open,
#modal-cierre-fondos-overlay.open, #modal-fondo-overlay.open, #modal-historial-cat-overlay.open, #modal-meta-overlay.open,
#modal-password-overlay.open, #modal-pendientes-overlay.open, #modal-progreso-meta-overlay.open, #modal-tarjeta-overlay.open { display: flex; }
.modal-box {
  background: var(--bg); border-radius: 22px 22px 0 0; width: 100%;
  max-height: 90dvh; display: flex; flex-direction: column;
  padding-bottom: calc(var(--sb) + 8px);
  animation: slideUp .25s ease;
}

.deuda-item {
  background: #fff; border-radius: 14px; display: flex; margin-bottom: 8px; overflow: hidden;
  box-shadow: 0 2px 8px rgba(0,0,0,.07);
}
.deuda-bar      { width: 4px; flex-shrink: 0; }
.deuda-bar.act  { background: var(--err); }
.deuda-bar.inac { background: var(--txl); }
.deuda-body     { flex: 1; padding: 12px; cursor: pointer; }
.deuda-top      { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; margin-bottom: 4px; }
.deuda-desc     { font-size: 14px; font-weight: 600; color: var(--tx); }
.deuda-bot      { display: flex; justify-content: space-between; align-items: center; margin-top: 4px; }
.deuda-monto    { font-size: 18px; font-weight: 900; color: var(--err); letter-spacing: -.4px; }
.deuda-meta     { font-size: 11px; color: var(--txl); }
.deuda-chips    { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 5px; }
.chip-small {
  padding: 2px 8px; border-radius: 10px; font-size: 11px; font-weight: 700;
  background: var(--bg); color: var(--txl);
}
.chip-small.oblig      { background: #FFFBEB; color: #D97706; }
.chip-small.inac       { background: #F3F4F6; color: var(--txl); }
.chip-small.ingreso-chip { background: #F0FDF4; color: #15803D; }
.chip-small.salida-chip  { background: #FFFBEB; color: #D97706; }

/* ── Ingresos ────────────────────────────────────────────────────── */
.ingreso-item {
  background: #fff; border-radius: 14px; display: flex; margin-bottom: 8px; overflow: hidden;
  box-shadow: 0 2px 8px rgba(0,0,0,.07);
}
.ingreso-bar      { width: 4px; flex-shrink: 0; }
.ingreso-bar.disp { background: var(--ok); }
.ingreso-bar.nodp { background: var(--txl); }
.ingreso-body     { flex: 1; padding: 12px; cursor: pointer; }
.ingreso-top      { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; margin-bottom: 4px; }
.ingreso-desc     { font-size: 14px; font-weight: 600; color: var(--tx); }
.ingreso-valor    { font-size: 18px; font-weight: 900; color: var(--ok); letter-spacing: -.4px; }
.ingreso-meta     { font-size: 11px; color: var(--txl); margin-top: 3px; }

/* ── Notificaciones ─────────────────────────────────────────────── */
#btn-notif { position: relative; display: none; }
.notif-badge {
  position: absolute; top: -2px; right: -2px;
  background: #B91C1C; color: #fff; border-radius: 10px;
  font-size: 10px; font-weight: 800; padding: 1px 5px; min-width: 16px;
  text-align: center; line-height: 14px; border: 2px solid var(--pd, #15803D);
}

.notif-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 300;
  backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px);
}
.notif-panel {
  position: fixed; top: calc(var(--st) + 58px); left: 0; right: 0;
  background: rgba(255,255,255,.92); z-index: 301; max-height: 70dvh;
  display: flex; flex-direction: column;
  box-shadow: 0 8px 32px rgba(0,0,0,.16);
  animation: slideDown .2s ease;
  backdrop-filter: blur(20px) saturate(180%); -webkit-backdrop-filter: blur(20px) saturate(180%);
}
body.pwa-dark .notif-panel { background: rgba(28,31,43,.92); }
@keyframes slideDown { from { transform: translateY(-16px); opacity: 0; } to { transform: none; opacity: 1; } }
.notif-panel-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px; border-bottom: 1px solid var(--bdr);
  font-size: 15px; font-weight: 700; flex-shrink: 0;
}
#btn-notif-close {
  background: none; border: none; font-size: 18px; color: var(--txl); cursor: pointer; padding: 2px 6px;
}
.notif-list { flex: 1; overflow-y: auto; }
.notif-empty { padding: 32px 16px; text-align: center; color: var(--txl); font-size: 14px; }
.notif-item {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 14px 16px; border-bottom: 1px solid var(--bdr); position: relative;
}
.notif-item.unread { background: #F0FDF4; }
.notif-item.unread::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0;
  width: 4px; background: var(--p);
}
.notif-item-icon {
  flex-shrink: 0; width: 34px; height: 34px; border-radius: 10px;
  background: rgba(30,132,73,.10);
  display: flex; align-items: center; justify-content: center;
  font-size: 17px; line-height: 1; margin-top: 1px;
}
.notif-item-body { flex: 1; min-width: 0; }
.notif-titulo-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.notif-titulo  { font-size: 14px; font-weight: 700; color: var(--tx); margin-bottom: 3px; }
.notif-cuerpo  { font-size: 13px; color: var(--tx); line-height: 1.45; }
.notif-footer  { font-size: 11px; color: var(--txl); margin-top: 5px; }
.notif-perfil-badge {
  display: inline-block; font-size: 10px; font-weight: 700;
  color: var(--pd); background: rgba(30,132,73,.12);
  border-radius: 20px; padding: 2px 9px; letter-spacing: .02em;
  margin-bottom: 3px; white-space: nowrap;
}
body.pwa-dark .notif-item-icon { background: rgba(86,179,120,.14); }
body.pwa-dark .notif-perfil-badge { background: rgba(86,179,120,.16); color: #22C55E; }

/* ── Header back button ─────────────────────────────────────────── */
#btn-back {
  display: flex; align-items: center; justify-content: center;
  background: none; border: none; color: #fff; font-size: 28px; font-weight: 300;
  line-height: 1; padding: 0 8px 0 0; cursor: pointer; flex-shrink: 0;
}

/* ── Más (hub) ───────────────────────────────────────────────────── */
.mas-menu { padding: 16px 16px 8px; }
.mas-card {
  display: flex; align-items: center; gap: 16px;
  background: var(--card); border: none; border-radius: 16px; padding: 18px 16px;
  width: 100%; margin-bottom: 10px; cursor: pointer; text-align: left;
  box-shadow: 0 2px 8px rgba(0,0,0,.06); transition: opacity .15s;
}
.mas-card:active { opacity: .75; }
.mas-icon  { font-size: 28px; flex-shrink: 0; }
.mas-info  { flex: 1; }
.mas-title { font-size: 15px; font-weight: 700; color: var(--tx); letter-spacing: -.2px; }
.mas-sub   { font-size: 12px; color: var(--txl); margin-top: 2px; }
.mas-arrow { font-size: 24px; color: var(--txl); flex-shrink: 0; }

/* ── Sugerencias ─────────────────────────────────────────────────── */
#sug-toolbar { display: flex; align-items: center; padding: 12px 16px 8px; }
#sug-toolbar .toolbar-title { flex: 1; font-size: 14px; font-weight: 600; }
.sug-item {
  background: #fff; border-radius: 14px; padding: 14px; margin-bottom: 10px;
  box-shadow: 0 2px 8px rgba(0,0,0,.06);
}
.sug-top    { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; margin-bottom: 5px; }
.sug-titulo { font-size: 14px; font-weight: 700; color: var(--tx); flex: 1; }
.sug-cat    { font-size: 11px; color: var(--txl); margin-bottom: 6px; }
.sug-cat-icon { margin-right: 2px; }
.sug-body   { font-size: 13px; color: var(--tx); line-height: 1.45; }
.sug-respuesta {
  margin-top: 10px; padding: 10px 12px; background: #F0FDF4;
  border-left: 3px solid #8FB596; border-radius: 0 8px 8px 0; font-size: 12px; color: #052e16;
}
.sug-resp-label { display: block; font-weight: 700; margin-bottom: 4px; font-size: 11px; }

/* Modal sugerencia */
#modal-sug-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 200;
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
  display: none; align-items: flex-end; justify-content: center;
}
#modal-sug-overlay.open { display: flex; }
.field textarea {
  width: 100%; padding: 13px 14px; border: 1.5px solid var(--bdr); border-radius: 12px;
  font-size: 15px; color: var(--tx); background: #fff; outline: none;
  resize: vertical; font-family: inherit; transition: border-color .15s;
}
.field textarea:focus { border-color: var(--p); }
.field select { cursor: pointer; }

/* ── Chat ────────────────────────────────────────────────────────── */
#tab-chat { flex-direction: column; overflow: hidden; }

#chat-messages {
  flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch;
  padding: 16px 14px; display: flex; flex-direction: column; gap: 10px;
}
.chat-bubble {
  max-width: 82%; padding: 11px 14px; border-radius: 18px;
  font-size: 14px; line-height: 1.5; word-break: break-word;
}
.chat-bubble.user {
  background: var(--p); color: #fff;
  align-self: flex-end; border-bottom-right-radius: 4px;
}
.chat-bubble.assistant {
  background: #fff; color: var(--tx);
  align-self: flex-start; border-bottom-left-radius: 4px;
  box-shadow: 0 2px 8px rgba(0,0,0,.08);
}
.typing-dots { display: flex; gap: 5px; align-items: center; padding: 2px 0; }
.typing-dots span {
  width: 7px; height: 7px; background: var(--txl); border-radius: 50%;
  animation: typingBounce .9s infinite ease-in-out;
}
.typing-dots span:nth-child(2) { animation-delay: .15s; }
.typing-dots span:nth-child(3) { animation-delay: .3s; }
@keyframes typingBounce { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }

#chat-input-bar {
  flex-shrink: 0; display: flex; align-items: flex-end; gap: 10px;
  padding: 10px 12px calc(var(--sb) + 10px);
  background: #fff; border-top: 1px solid var(--bdr);
}
#chat-inp {
  flex: 1; border: 1.5px solid var(--bdr); border-radius: 22px;
  padding: 10px 16px; font-size: 15px; color: var(--tx); background: var(--bg);
  resize: none; outline: none; font-family: inherit; max-height: 120px;
  line-height: 1.4; transition: border-color .15s;
}
#chat-inp:focus { border-color: var(--p); }
#btn-chat-send {
  width: 44px; height: 44px; flex-shrink: 0; border-radius: 50%;
  background: var(--p); color: #fff; border: none; font-size: 18px;
  display: flex; align-items: center; justify-content: center; cursor: pointer;
  transition: background .15s; flex-shrink: 0;
}
#btn-chat-send:disabled { opacity: .5; pointer-events: none; }
#btn-chat-send:active { background: var(--pd); }

/* ── Header actions ─────────────────────────────────────────────── */
.header-actions {
  display: flex; align-items: center; gap: 4px;
}
#btn-ocultar, #btn-darkmode, #btn-notif {
  background: rgba(255,255,255,.22); border: 1px solid rgba(255,255,255,.18); color: #fff;
  width: 34px; height: 34px; border-radius: 50%; font-size: 16px;
  align-items: center; justify-content: center;
  cursor: pointer; transition: background .15s;
}
#btn-ocultar, #btn-darkmode { display: flex; }
#btn-ocultar:active, #btn-darkmode:active, #btn-notif:active { background: rgba(255,255,255,.34); }
#btn-ocultar svg, #btn-darkmode svg, #btn-notif svg { width: 17px; height: 17px; display: block; }

/* ── Ocultar valores ─────────────────────────────────────────────── */
.privacy-val { transition: filter .25s ease; }
body.pwa-hidden .privacy-val { filter: blur(6px); user-select: none; }

/* ── Modo oscuro ─────────────────────────────────────────────────── */
body.pwa-dark {
  --p:    #22C55E;
  --pd:   #16A34A;
  --accent: #E6BC59;
  --bg:   #0A0A0A;
  --card: #131313;
  --tx:   #FAFAFA;
  --txl:  #A1A1AA;
  --bdr:  #2A2A2D;
  --ok:   #4ADE80;
  --warn: #E8A94A;
  --err:  #F87171;
}
body.pwa-dark #app-header { background: linear-gradient(135deg, #16A34A 0%, #22C55E 100%); box-shadow: 0 2px 12px rgba(0,0,0,.4); }
body.pwa-dark #bottom-nav { background: linear-gradient(135deg, #16A34A 0%, #22C55E 100%); box-shadow: 0 -8px 28px rgba(0,0,0,.4); }
body.pwa-dark .formula-card,
body.pwa-dark .item-card,
body.pwa-dark .mas-card,
body.pwa-dark .section-card,
body.pwa-dark .resumen-card,
body.pwa-dark .chat-bubble.assistant,
body.pwa-dark #chat-input-bar,
body.pwa-dark #chat-inp,
body.pwa-dark .modal-overlay .modal-box { background: #131313; border-color: #2A2A2D; }
body.pwa-dark .chat-bubble.assistant { box-shadow: none; color: var(--tx); }
body.pwa-dark .chat-bubble.user { background: #14532D; }
body.pwa-dark .login-card { background: #131313; }
body.pwa-dark .err-msg { background: #450A0A; color: var(--err); }
body.pwa-dark .field input,
body.pwa-dark .field select,
body.pwa-dark .field textarea,
body.pwa-dark #chat-inp { background: #0A0A0A; color: var(--tx); border-color: #2A2A2D; }
body.pwa-dark .field input:focus,
body.pwa-dark .field select:focus,
body.pwa-dark .field textarea:focus { border-color: var(--p); }
body.pwa-dark .btn-primary { background: var(--p); color: #0A0A0A; }
body.pwa-dark .btn-primary:active { background: var(--pd); }
body.pwa-dark #bottom-nav a { color: #A1A1AA; }
body.pwa-dark #bottom-nav a.active { color: var(--p); }
body.pwa-dark .chip,
body.pwa-dark .badge { background: #0A0A0A; color: var(--tx); }
body.pwa-dark hr,
body.pwa-dark .divider { border-color: #2A2A2D; }
body.pwa-dark .gasto-item,
body.pwa-dark .deuda-item,
body.pwa-dark .ingreso-item,
body.pwa-dark .sug-item,
body.pwa-dark .fondo-item { background: #131313; box-shadow: none; }
body.pwa-dark #gastos-toolbar,
body.pwa-dark #gastos-summary,
body.pwa-dark #deudas-toolbar,
body.pwa-dark #deudas-summary,
body.pwa-dark #ingresos-toolbar,
body.pwa-dark #ingresos-summary,
body.pwa-dark #fondos-toolbar,
body.pwa-dark #sug-toolbar { background: #0A0A0A; border-color: #2A2A2D; }
body.pwa-dark .summ-item + .summ-item { border-left-color: #2A2A2D; }
body.pwa-dark .modal-header { background: #131313; border-bottom-color: #2A2A2D; }
body.pwa-dark .tipo-btn { background: #0A0A0A; border-color: #2A2A2D; color: var(--tx); }
body.pwa-dark .notif-item.unread { background: #0C2A26; }
body.pwa-dark .notif-item { border-bottom-color: #2A2A2D; }
body.pwa-dark .badge.ok  { background: #064E3B; color: var(--ok); }
body.pwa-dark .badge.warn { background: #3B2A00; color: var(--warn); }
body.pwa-dark .chip-small.oblig       { background: #3B2A00; color: var(--warn); }
body.pwa-dark .chip-small.inac        { background: #0A0A0A; color: var(--txl); }
body.pwa-dark .chip-small.ingreso-chip { background: #064E3B; color: var(--ok); }
body.pwa-dark .chip-small.salida-chip  { background: #3B2A00; color: var(--warn); }
body.pwa-dark .sug-respuesta { background: #064E3B; border-left-color: var(--ok); color: var(--ok); }
body.pwa-dark .ng-nota { background: #2A1E00; color: var(--warn); border-left-color: var(--warn); }
body.pwa-dark .btn-scan { background: #064E3B; color: var(--ok); border-color: var(--ok); }
body.pwa-dark .btn-scan:active { background: #052e16; }
body.pwa-dark .field input.extracted { background: #064E3B; border-color: var(--ok); }
body.pwa-dark .field input.needed    { background: #2A1E00; border-color: var(--warn); }
body.pwa-dark .notif-panel-header { border-bottom-color: #2A2A2D; }
body.pwa-dark .don-banner { background: #0C1E35; border-left-color: var(--p); }
body.pwa-dark .don-banner-title { color: var(--p); }
body.pwa-dark .don-banner-sub   { color: var(--txl); }
body.pwa-dark .ppwa-perfil-btn.activo { background: #0C2A26; border-color: var(--p); }
body.pwa-dark .ppwa-card { background: var(--card); }
body.pwa-dark .don-unica { background: #131313; }
body.pwa-dark #sug-toolbar { background: #0A0A0A; border-color: #2A2A2D; }
body.pwa-dark .modal-box { background: #131313; }
body.pwa-dark .screen-content { background: var(--bg); }
body.pwa-dark .cuota-item,
body.pwa-dark .pago-item,
body.pwa-dark .tarjeta-item { background: #131313; box-shadow: none; }
body.pwa-dark select.browser-default { background: #0A0A0A; color: var(--tx); border-color: #2A2A2D; }
body.pwa-dark .modal-box .field input,
body.pwa-dark .modal-box .field select,
body.pwa-dark .modal-box .field textarea { background: #0A0A0A; color: var(--tx); border-color: #2A2A2D; }
body.pwa-dark .logro-row { background: #131313; box-shadow: none; }
body.pwa-dark .ppwa-notif-row { border-bottom-color: #2A2A2D; }
body.pwa-dark .don-unica-card { background: #131313; }

/* ── Donaciones ──────────────────────────────────────────────────── */
#tab-donaciones { padding-bottom: 32px; }
.don-banner {
  display: flex; align-items: flex-start; gap: 12px;
  background: #EFF6FF; border-left: 4px solid #2563EB;
  padding: 14px 16px; margin: 0 0 4px;
}
.don-banner-icon { font-size: 20px; flex-shrink: 0; margin-top: 1px; }
.don-banner-title { font-size: 13px; font-weight: 700; color: #1D4ED8; }
.don-banner-sub   { font-size: 12px; color: #3B82F6; margin-top: 2px; }
.don-hero {
  background: linear-gradient(135deg, #14532D 0%, var(--p) 100%);
  color: #fff; padding: 32px 20px; text-align: center; margin-bottom: 16px;
}
.don-hero-icon  { font-size: 48px; margin-bottom: 10px; }
.don-hero-title { font-size: 18px; font-weight: 800; margin-bottom: 8px; letter-spacing: -.3px; }
.don-hero-sub   { font-size: 13px; opacity: .85; max-width: 280px; margin: 0 auto; line-height: 1.5; }
.don-tiers { display: flex; flex-direction: column; gap: 12px; padding: 0 16px; }
.don-tier {
  background: var(--card); border-radius: 16px; padding: 20px;
  border-top: 4px solid var(--bdr); position: relative;
  box-shadow: 0 2px 8px rgba(0,0,0,.07);
}
.don-tier.popular  { border-top-color: var(--p); }
.don-tier.mecenas  { border-top-color: #7C3AED; }
.don-tier-badge {
  position: absolute; top: -1px; left: 50%; transform: translateX(-50%);
  background: var(--p); color: #fff; font-size: 10px; font-weight: 900;
  padding: 2px 10px; border-radius: 0 0 8px 8px; letter-spacing: .5px;
}
.don-tier-icon  { font-size: 32px; margin-bottom: 6px; }
.don-tier-name  { font-size: 16px; font-weight: 800; color: var(--tx); margin-bottom: 4px; }
.don-tier-price { font-size: 26px; font-weight: 900; color: var(--p); letter-spacing: -.5px; }
.don-tier.mecenas .don-tier-price { color: #7C3AED; }
.don-tier-price span { font-size: 13px; font-weight: 400; color: var(--txl); }
.don-tier-features {
  list-style: none; margin: 14px 0; padding: 0;
  font-size: 13px; color: var(--tx); line-height: 2;
}
.don-tier-features .dim { color: var(--txl); }
.don-btn {
  width: 100%; padding: 12px; border: none; border-radius: 12px;
  background: var(--p); color: #fff; font-size: 14px; font-weight: 700;
  font-family: inherit; cursor: not-allowed; opacity: .55;
}
.don-btn.popular  { background: var(--p); }
.don-btn.mecenas  { background: #7C3AED; }
.don-unica {
  background: var(--card); border-radius: 16px; padding: 20px; margin: 16px 16px 0;
  text-align: center; box-shadow: 0 2px 8px rgba(0,0,0,.07);
}
.don-unica-title { font-size: 16px; font-weight: 700; margin-bottom: 6px; }
.don-unica-sub   { font-size: 13px; color: var(--txl); margin-bottom: 16px; }

/* ── Logros ─────────────────────────────────── */
.logros-header {
  background: linear-gradient(135deg, #14532D 0%, var(--p) 100%);
  color: #fff; border-radius: 16px;
  margin: 16px 16px 12px; padding: 20px; text-align: center;
  box-shadow: 0 6px 20px rgba(30,132,73,.3);
}
.logros-puntaje { font-size: 3.2rem; font-weight: 800; line-height: 1.1; letter-spacing: -1px; }
.logros-nivel   { font-size: 1rem; font-weight: 600; opacity: .85; margin-top: 4px; }
.logro-row {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px; margin: 0 12px 8px; border-radius: 14px;
  background: var(--card); box-shadow: 0 2px 8px rgba(0,0,0,.06);
  border-left: 4px solid var(--border); opacity: .5;
  transition: 180ms ease;
}
.logro-row.ok { border-left-color: var(--p); opacity: 1; }
.logro-ico  { font-size: 1.8rem; flex-shrink: 0; }
.logro-info { flex: 1; min-width: 0; }
.logro-nom  { font-size: .92rem; font-weight: 700; margin-bottom: 2px; color: var(--tx); }
.logro-desc { font-size: .78rem; color: var(--txl); }
.logro-pts  { font-size: .75rem; font-weight: 700; color: var(--txl); flex-shrink: 0; }
.logro-pts.ok { color: var(--p); }

/* ── Perfil PWA ─────────────────────────────────────────────────── */
.ppwa-card {
  background: var(--card); border-radius: 20px; margin: 16px 16px 12px;
  padding: 24px 20px; text-align: center;
  box-shadow: 0 4px 16px rgba(0,0,0,.08);
}
.ppwa-avatar { font-size: 3rem; margin-bottom: 10px; }
.ppwa-nombre { font-size: 1.1rem; font-weight: 700; color: var(--tx); margin-bottom: 2px; letter-spacing: -.2px; }
.ppwa-email  { font-size: .82rem; color: var(--txl); margin-bottom: 10px; }
.ppwa-chip   {
  display: inline-block; background: var(--p); color: #fff;
  border-radius: 20px; padding: 4px 16px; font-size: .8rem; font-weight: 600;
}
.ppwa-section-title {
  font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em;
  color: var(--txl); margin: 16px 16px 8px; display: flex; align-items: center; gap: 8px;
}
.ppwa-section-title::after { content:''; flex:1; height:1px; background:var(--bdr); }
.ppwa-perfiles { padding: 0 16px 24px; display: flex; flex-direction: column; gap: 8px; }
.ppwa-perfil-btn {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--card); border: 1.5px solid var(--bdr); border-radius: 14px;
  padding: 14px 16px; cursor: pointer; transition: 120ms ease;
  color: var(--tx); font-size: .92rem; text-align: left; font-family: inherit;
}
.ppwa-perfil-btn.activo { border-color: var(--p); background: rgba(30,132,73,.07); }
.ppwa-perfil-btn:not(.activo):active { background: var(--bg); }
.ppwa-perfil-nombre { font-weight: 600; flex: 1; }
.ppwa-activo-badge  { font-size: .75rem; color: var(--p); font-weight: 700; flex-shrink: 0; }
.ppwa-switch-hint   { font-size: .75rem; color: var(--txl); flex-shrink: 0; }

/* ── Notificaciones en perfil ────────────────────────────────── */
.ppwa-notif-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px; gap: 12px; border-bottom: 1px solid var(--bdr);
}
.ppwa-notif-row:last-child { border-bottom: none; }
.ppwa-notif-info { flex: 1; }
.ppwa-notif-nombre { font-size: .88rem; font-weight: 500; color: var(--tx); }
.ppwa-notif-desc { font-size: .75rem; color: var(--txl); margin-top: 2px; }
.ppwa-toggle-wrap {
  position: relative; width: 44px; height: 24px; flex-shrink: 0; cursor: pointer;
}
.ppwa-toggle-wrap input { opacity: 0; width: 0; height: 0; position: absolute; }
.ppwa-toggle-slider {
  position: absolute; inset: 0;
  background: var(--bdr); border-radius: 24px; transition: .2s;
}
.ppwa-toggle-slider::before {
  content: ''; position: absolute;
  width: 18px; height: 18px; border-radius: 50%;
  left: 3px; bottom: 3px; background: white;
  transition: .2s; box-shadow: 0 1px 3px rgba(0,0,0,.25);
}
.ppwa-toggle-wrap input:checked + .ppwa-toggle-slider { background: var(--p); }
.ppwa-toggle-wrap input:checked + .ppwa-toggle-slider::before { transform: translateX(20px); }

/* ── Admin PWA ────────────────────────────────────────────────────── */
.admin-list { padding: 8px 0; }
.admin-item { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--bdr); }
.admin-item-ico { font-size: 20px; flex-shrink: 0; }
.admin-item-info { flex: 1; min-width: 0; }
.admin-item-name { font-weight: 600; font-size: .9rem; color: var(--tx); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.admin-item-desc { font-size: .78rem; color: var(--txl); margin-top: 2px; }
.mas-card-admin { border-top: 2px solid #B8813A; }

/* ── Dashboard Admin PWA ─────────────────────────────────────────── */
.dash-admin-header { padding: 16px 16px 8px; }
.dash-admin-title { display: block; font-size: 1rem; font-weight: 700; color: var(--p); }
.dash-admin-sub { display: block; font-size: .78rem; color: var(--txl); margin-top: 2px; }
.dash-admin-alert { margin: 0 12px 8px; padding: 10px 14px; background: #FFFBEB; border-left: 3px solid #B8813A; border-radius: 4px; font-size: .85rem; color: #D97706; font-weight: 600; }
.dash-admin-nav { padding: 8px 12px; }
.dash-admin-nav-title { font-size: .75rem; font-weight: 700; color: var(--txl); text-transform: uppercase; letter-spacing: .06em; margin-bottom: 8px; padding: 0 4px; }
.dash-admin-btn { display: block; width: 100%; padding: 13px 16px; margin-bottom: 8px; background: rgba(30,132,73,.08); color: var(--p); border: none; border-radius: 12px; font-size: .9rem; font-weight: 600; text-align: left; cursor: pointer; font-family: inherit; }
.dash-admin-info { padding: 4px 16px 20px; font-size: .78rem; color: var(--txl); }
body.pwa-dark .dash-admin-alert { background: #2A1E00; color: #D9A15C; }
body.pwa-dark .dash-admin-btn { background: #0C2A26; color: #22C55E; }

/* ── Admin: Catálogos ────────────────────────────────────────────── */
.fab-mini {
  width: 30px; height: 30px; background: var(--p); color: #fff; border: none;
  border-radius: 50%; font-size: 20px; line-height: 1; cursor: pointer; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 8px rgba(30,132,73,.35);
}
.btn-item-del {
  background: none; border: none; color: #B91C1C; font-size: 14px; font-weight: 700;
  cursor: pointer; padding: 4px 8px; border-radius: 50%; flex-shrink: 0; opacity: .7;
  line-height: 1; display: flex; align-items: center; justify-content: center;
}
.btn-item-del:hover { opacity: 1; background: #FEF2F2; }
.btn-pwa-action {
  background: var(--p); color: #fff; border: none; border-radius: 12px;
  padding: 12px 16px; font-size: .9rem; font-weight: 600; cursor: pointer;
  font-family: inherit;
}
.btn-pwa-action:active { opacity: .85; }

/* Modales catálogos admin — overlay con clase .active */
#modal-ntg-overlay, #modal-nmp-overlay, #modal-ntd-overlay,
#modal-nti-overlay, #modal-ntf-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 200;
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
  display: none; align-items: flex-end; justify-content: center;
}
#modal-ntg-overlay.active, #modal-nmp-overlay.active, #modal-ntd-overlay.active,
#modal-nti-overlay.active, #modal-ntf-overlay.active { display: flex; }

body.pwa-dark .btn-item-del:hover { background: #450A0A; }
body.pwa-dark .btn-pwa-action { background: var(--p); color: #0A0A0A; }
body.pwa-dark .admin-item { border-bottom-color: #2A2A2D; }
