/* ============================================================
   LIBRETA · components.css — tarjetas, tablas, timbres, formas
   ============================================================ */

/* ---------- Tarjetas ---------- */
.card {
  background: var(--card);
  border: 1.5px solid var(--ink);
  border-radius: var(--radio);
  box-shadow: var(--sombra);
  padding: 1.1rem 1.2rem;
  margin-bottom: 0.9rem;
}
.card-titulo {
  font-size: 1.02rem;
  font-style: italic;
  margin-bottom: 0.7rem;
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.card-titulo small { font-family: var(--f-body); font-style: normal; color: var(--ink-soft); font-size: 0.78rem; }

/* ---------- Tarjetas de estadística ---------- */
.stat { display: flex; flex-direction: column; gap: 0.3rem; }
.stat-label {
  font-family: var(--f-mono);
  font-size: 0.64rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--ink-soft);
}
.stat-num { font-size: 1.45rem; font-weight: 600; }
.stat-pie { font-size: 0.72rem; color: var(--ink-soft); }
.stat.destacada { background: linear-gradient(160deg, var(--card), var(--card-suave)); border-width: 2px; }

.verde { color: var(--verde-fuerte); }
.rojo { color: var(--rojo); }
.azul { color: var(--azul); }
.mostaza-t { color: var(--mostaza); }
.grande { font-size: 1.5rem; font-weight: 600; margin: 0.2rem 0; }
.pie { font-size: 0.78rem; color: var(--ink-soft); margin: 0; }

/* ---------- Timbres de goma ---------- */
.stamp {
  display: inline-block;
  padding: 0.12em 0.55em;
  border: 2px solid currentColor;
  border-radius: 0.45em;
  font-family: var(--f-mono);
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  transform: rotate(-4deg);
  opacity: 0.9;
}
.stamp.rojo { color: var(--rojo); }
.stamp.verde { color: var(--verde); }
.stamp.mostaza { color: var(--mostaza); }

.stamp-btn {
  font-family: var(--f-mono);
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 0.25em 0.7em;
  border: 2px solid currentColor;
  border-radius: 0.5em;
  background: transparent;
  cursor: pointer;
  transform: rotate(-2deg);
  transition: transform 0.1s ease, background 0.1s ease;
}
.stamp-btn.rojo { color: var(--rojo); }
.stamp-btn.verde { color: var(--verde); }
.stamp-btn:hover { transform: rotate(0deg) scale(1.06); background: rgba(var(--sombra-rgb), 0.06); }

/* ---------- Botones ---------- */
.btn {
  font-family: var(--f-body);
  font-weight: 600;
  font-size: 0.88rem;
  padding: 0.55rem 1.1rem;
  border: 1.5px solid var(--ink);
  border-radius: 8px;
  background: var(--paper-2);
  color: var(--ink);
  cursor: pointer;
  box-shadow: 3px 3px 0 rgba(var(--sombra-rgb), 0.15);
  transition: transform 0.1s ease, box-shadow 0.1s ease;
}
.btn:hover { transform: translate(-1px, -1px); box-shadow: 4px 4px 0 rgba(var(--sombra-rgb), 0.18); }
.btn:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 rgba(var(--sombra-rgb), 0.15); }
.btn.primario { background: var(--verde-fuerte); color: var(--paper-2); border-color: var(--verde-fuerte); }
.btn.chico { font-size: 0.72rem; padding: 0.3rem 0.7rem; }
.btn.fantasma { background: transparent; box-shadow: none; border-style: dashed; font-weight: 400; font-size: 0.72rem; padding: 0.2rem 0.6rem; }

.btn-icono {
  font-size: 0.95rem;
  width: 32px;
  height: 32px;
  border: 1.5px solid var(--line);
  border-radius: 6px;
  background: transparent;
  color: var(--ink-soft);
  cursor: pointer;
  line-height: 1;
}
.btn-icono:hover { border-color: var(--ink); color: var(--ink); }
.btn-icono.peligro:hover { border-color: var(--rojo); color: var(--rojo); }
.btn-icono:disabled { opacity: 0.3; cursor: default; }

/* ---------- Inputs ---------- */
.input {
  font-family: var(--f-body);
  /* 16px en móvil evita el zoom automático de iOS al hacer focus */
  font-size: 16px;
  padding: 0.55rem 0.7rem;
  border: 1.5px solid var(--line);
  border-radius: 7px;
  background: var(--paper-2);
  color: var(--ink);
  width: 100%;
  min-height: 44px; /* touch target accesible */
}
@media (min-width: 980px) {
  .input { font-size: 0.9rem; min-height: 0; }
}
.input:focus {
  outline: 2px solid var(--verde);
  outline-offset: 1px;
  border-color: var(--verde);
  background: var(--input-focus);
}
[data-perfil="isa"] .input:focus { outline-color: #ad3b72; border-color: #ad3b72; }
select.input { cursor: pointer; }
input.num { font-family: var(--f-mono); }

label { display: flex; flex-direction: column; gap: 0.25rem; font-size: 0.78rem; font-weight: 600; color: var(--ink-soft); text-transform: uppercase; letter-spacing: 0.07em; }
label small { font-weight: 400; text-transform: none; letter-spacing: 0; }

/* ---------- Formulario tipo boleta/ticket ---------- */
.ticket { position: relative; }
.ticket::before, .ticket::after {
  content: "";
  position: absolute;
  top: 52px;
  width: 18px;
  height: 18px;
  background: var(--paper);
  border: 1.5px solid var(--ink);
  border-radius: 50%;
}
.ticket::before { left: -10px; }
.ticket::after { right: -10px; }
.ticket-titulo {
  font-family: var(--f-mono);
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  padding-bottom: 0.8rem;
  margin-bottom: 1rem;
  border-bottom: 2px dashed var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.form-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.8rem;
  align-items: end;
}
.form-grid .span2 { grid-column: span 2; }
.form-grid .btn { justify-self: start; }
@media (max-width: 700px) {
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .span2 { grid-column: span 1; }
}

/* ---------- Tablas tipo libro contable ---------- */
.tabla { width: 100%; border-collapse: collapse; font-size: 0.86rem; }
.tabla th {
  font-family: var(--f-mono);
  font-size: 0.62rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.13em;
  color: var(--ink-soft);
  text-align: left;
  padding: 0.4rem 0.55rem;
  border-bottom: 2px solid var(--ink);
}
.tabla td {
  padding: 0.45rem 0.55rem;
  border-bottom: 1px dotted var(--line);
  vertical-align: top;
}
.tabla td.num, .tabla th.num { text-align: right; white-space: nowrap; }
.tabla .fecha-col { white-space: nowrap; color: var(--ink-soft); font-size: 0.78rem; }
.tabla tfoot td {
  font-weight: 700;
  border-top: 2px solid var(--ink);
  border-bottom: none;
  font-family: var(--f-mono);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.tabla .nota { color: var(--ink-soft); }
.tabla .acciones { white-space: nowrap; text-align: right; }
.tabla tr.editando td { background: rgba(51, 86, 127, 0.08); }
.tabla tr.cobrado td { opacity: 0.5; text-decoration: line-through; }
.tabla tr.cobrado td.estado-col { text-decoration: none; opacity: 1; }
.tabla.compacta td { padding: 0.35rem 0.45rem; font-size: 0.82rem; }
.estado-col { white-space: nowrap; }

/* libro mayor del presupuesto */
.scroll-x { overflow-x: auto; }
.tabla.ledger { min-width: 760px; }
.tabla.ledger td:first-child { max-width: 290px; }
.fila-seccion td {
  font-family: var(--f-mono);
  font-size: 0.66rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  background: rgba(34, 48, 42, 0.05);
  border-bottom: 1.5px solid var(--ink);
  padding-top: 0.7rem;
}
.fila-seccion.verde td { background: rgba(47, 125, 91, 0.1); }
.fila-seccion.roja td { background: rgba(190, 61, 42, 0.08); }
.fila-seccion.amarilla td { background: rgba(176, 124, 32, 0.1); }
.fila-seccion.azul td { background: rgba(51, 86, 127, 0.08); }
.fila-total td { font-weight: 700; border-top: 1.5px solid var(--line); }
.fila-total.verde td { color: var(--verde-fuerte); }
.fila-total.verde-fuerte td { color: var(--verde-fuerte); background: rgba(47, 125, 91, 0.12); font-size: 0.9rem; }
.fila-total.roja td { color: var(--rojo); }
.fila-total.amarilla td { color: var(--mostaza); }
.fila-total.azul td { color: var(--azul); background: rgba(51, 86, 127, 0.07); }
.col-actual { background: rgba(47, 125, 91, 0.07); }
.cero { color: var(--line); }

/* ---------- Celdas editables del libro mayor ---------- */
.tabla td.editable {
  cursor: pointer;
  position: relative;
  transition: background 0.15s ease;
}
.tabla td.editable:hover {
  background: rgba(47, 125, 91, 0.12);
  outline: 1.5px dashed var(--verde-fuerte);
  outline-offset: -2px;
}
.tabla td.editable:hover::after {
  content: "✎";
  position: absolute;
  top: 2px;
  right: 4px;
  font-size: 0.7rem;
  color: var(--verde-fuerte);
  opacity: 0.6;
}
.editor-celda {
  width: 100%;
  padding: 0.2rem 0.35rem !important;
  font-size: 0.85rem !important;
  text-align: right;
  background: var(--input-focus) !important;
}

/* ---------- Chips de categoría ---------- */
.chip {
  --chip: var(--ink-soft);
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--chip);
  border: 1.5px solid var(--chip);
  border-radius: 999px;
  padding: 0.05em 0.6em;
  white-space: nowrap;
}
.chip.mini { font-size: 0.6rem; padding: 0 0.45em; opacity: 0.8; }
.chip.total { background: var(--ink); border-color: var(--ink); color: var(--paper-2); font-family: var(--f-mono); }

/* ---------- Filtros ---------- */
.filtros-fila { display: flex; gap: 0.7rem; flex-wrap: wrap; }
.filtros-fila label { flex: 0 1 150px; }
.filtros-fila .crece { flex: 1 1 200px; }
.resumen-cat { display: flex; gap: 0.45rem; flex-wrap: wrap; margin-top: 0.8rem; padding-top: 0.8rem; border-top: 1px dotted var(--line); }

/* ---------- Gráficos ---------- */
.dona-wrap { display: flex; align-items: center; gap: 1.2rem; flex-wrap: wrap; }
.chart-dona { width: 190px; height: 190px; flex-shrink: 0; }
.dona-total { font-family: var(--f-mono); font-size: 17px; font-weight: 600; fill: var(--ink); }
.dona-sub { font-family: var(--f-mono); font-size: 10px; text-transform: uppercase; letter-spacing: 0.14em; fill: var(--ink-soft); }

.leyenda { list-style: none; margin: 0; padding: 0; flex: 1; min-width: 180px; }
.leyenda li { display: flex; align-items: center; gap: 0.5rem; padding: 0.22rem 0; border-bottom: 1px dotted var(--line-suave); font-size: 0.8rem; }
.leyenda .punto { width: 10px; height: 10px; border-radius: 3px; flex-shrink: 0; }
.leyenda-label { flex: 1; }
.leyenda-monto { color: var(--ink); }
.leyenda-pct { font-family: var(--f-mono); font-size: 0.68rem; color: var(--ink-soft); width: 34px; text-align: right; }

.chart-columnas { width: 100%; height: auto; }
.chart-columnas .barra { fill: var(--verde); opacity: 0.85; }
.chart-columnas .barra:hover { fill: var(--verde-fuerte); opacity: 1; }
.chart-columnas .eje { font-family: var(--f-mono); font-size: 9px; fill: var(--ink-soft); }
.chart-columnas .eje-linea { stroke: var(--ink); stroke-width: 1.5; }

/* panorama del semestre */
.chart-columnas.meses .eje { font-size: 11px; }
.chart-columnas.meses .eje.actual { fill: var(--verde-fuerte); font-weight: 700; }
.chart-columnas.meses .barra { opacity: 0.55; }
.chart-columnas.meses .barra.actual { fill: var(--verde-fuerte); opacity: 1; }
.chart-columnas.meses .valor { font-size: 10.5px; fill: var(--ink); font-weight: 600; }
.chart-columnas.meses .ref-linea { stroke: var(--mostaza); stroke-width: 1.5; stroke-dasharray: 5 5; }
.chart-columnas.meses .ref-texto { fill: var(--mostaza); font-size: 10px; }

.progreso {
  height: 10px;
  border: 1.5px solid var(--ink);
  border-radius: 999px;
  background: var(--paper-2);
  overflow: hidden;
  margin: 0.3rem 0;
}
.progreso-fill {
  height: 100%;
  background: var(--verde);
  border-radius: 999px;
  transition: width 0.5s ease;
  background-image: repeating-linear-gradient(-45deg, transparent 0 6px, rgba(255, 255, 255, 0.25) 6px 12px);
}

/* ---------- Fondos de ahorro ---------- */
.fondo { display: flex; flex-direction: column; }
.fondo-cab { display: flex; gap: 0.6rem; align-items: flex-start; margin-bottom: 0.4rem; }
.fondo-emoji { font-size: 1.7rem; line-height: 1; }
.fondo-cab h3 { font-size: 0.95rem; line-height: 1.25; }
.fondo-prio { font-size: 0.6rem; text-transform: uppercase; letter-spacing: 0.14em; color: var(--rojo); }
.fondo-pie { display: flex; justify-content: space-between; align-items: center; margin-top: auto; padding-top: 0.6rem; }
.fondo-pie small { color: var(--ink-soft); }

/* ---------- Avisos ---------- */
.aviso {
  border: 1.5px dashed var(--rojo);
  border-radius: var(--radio);
  background: rgba(190, 61, 42, 0.05);
  padding: 0.7rem 1rem;
  font-size: 0.85rem;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.7rem;
  flex-wrap: wrap;
}
.aviso.suave { border-color: var(--mostaza); background: rgba(176, 124, 32, 0.06); display: block; }

/* ---------- Estados vacíos ---------- */
.vacio {
  color: var(--ink-soft);
  font-size: 0.92rem;
  text-align: center;
  padding: 1.6rem 1rem;
  font-style: italic;
  background: rgba(var(--sombra-rgb), 0.025);
  border: 1px dashed var(--line);
  border-radius: 10px;
  line-height: 1.55;
}
.vacio small { font-style: normal; display: block; margin-top: 0.4rem; font-size: 0.82rem; opacity: 0.85; }
.grande-vacio { padding: 2.4rem 1rem; font-size: 1rem; }
.grande-vacio { font-size: 1.05rem; padding: 2.2rem 1rem; }
.grande-vacio small { font-style: normal; font-size: 0.8rem; }

/* ---------- Toast ---------- */
#toast {
  position: fixed;
  bottom: 22px;
  left: 50%;
  transform: translate(-50%, 80px);
  background: var(--ink);
  color: var(--paper-2);
  font-family: var(--f-mono);
  font-size: 0.78rem;
  padding: 0.6rem 1.2rem;
  border-radius: 8px;
  box-shadow: 4px 4px 0 rgba(var(--sombra-rgb), 0.25);
  opacity: 0;
  transition: transform 0.25s ease, opacity 0.25s ease;
  z-index: 1000;
  pointer-events: none;
}
#toast.visible { transform: translate(-50%, 0); opacity: 1; }

/* ---------- Guía ---------- */
.lista-guia { margin: 0; padding-left: 1.1rem; font-size: 0.84rem; }
.lista-guia li { margin-bottom: 0.45rem; }

.oculto { display: none !important; }

.mes-nav { display: flex; align-items: center; gap: 0.4rem; }
.mes-select { width: auto; font-family: var(--f-mono); font-size: 0.8rem; }

/* ---------- Portada de acceso (nube) ---------- */
.login-tapa {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background:
    radial-gradient(var(--trama) 1px, transparent 1px) 0 0 / 22px 22px,
    var(--paper);
}
.login-card {
  width: min(380px, 100%);
  text-align: center;
  padding: 2rem 1.8rem;
  border-width: 2px;
}
.login-logo { width: 64px; height: 64px; margin-bottom: 0.4rem; }
.login-card h2 { font-size: 1.5rem; }
.login-card h2 em { color: var(--verde-fuerte); }
.login-sub {
  font-family: var(--f-mono);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--ink-soft);
  margin: 0.2rem 0 1.2rem;
}
.login-card form { display: flex; flex-direction: column; gap: 0.8rem; text-align: left; }
.login-botones { display: flex; gap: 0.6rem; justify-content: center; margin-top: 0.4rem; }
.login-msg {
  font-size: 0.8rem;
  color: var(--rojo);
  border: 1.5px dashed var(--rojo);
  border-radius: 8px;
  padding: 0.5rem 0.7rem;
  margin: 0 0 1rem;
}
.login-local { margin-top: 1.1rem; }

/* ---------- Indicador de nube en el lomo ---------- */
.nube-estado { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 0.3rem; }
.nube {
  font-family: var(--f-mono);
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}
.nube.on { color: var(--verde-fuerte); }
.nube.off { color: var(--mostaza); }

/* ---------- Abonos: pagos parciales de un cobro ---------- */
.fila-abonos td {
  background: rgba(176, 124, 32, 0.05);
  border-bottom: 1px dotted var(--line);
  padding-top: 0.3rem;
  padding-bottom: 0.45rem;
}
.chip.abono {
  --chip: var(--mostaza);
  font-family: var(--f-mono);
  font-weight: 500;
  margin: 0.1rem 0.2rem 0.1rem 0;
}
.abono-x {
  border: none;
  background: transparent;
  color: var(--mostaza);
  font-size: 0.85rem;
  cursor: pointer;
  padding: 0 0.1em;
  line-height: 1;
}
.abono-x:hover { color: var(--rojo); }
.abono-form {
  display: inline-flex;
  gap: 0.4rem;
  align-items: center;
  margin-top: 0.25rem;
}
.abono-form .input { width: 160px; padding: 0.3rem 0.5rem; font-size: 0.82rem; }
.btn-icono.abonar { border-color: var(--mostaza); color: var(--mostaza); margin-right: 0.3rem; }
.btn-icono.abonar:hover { background: rgba(176, 124, 32, 0.12); }

/* ---------- Cierre de mes ---------- */
.cierre-mes {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  flex-wrap: wrap;
  margin-top: 0.9rem;
  padding-top: 0.8rem;
  border-top: 2px dashed var(--line);
}
.cierre-mes .cierre-texto { font-size: 0.78rem; color: var(--ink-soft); flex: 1; min-width: 220px; }

/* ---------- Josefa IA ---------- */
.josefa-ia .josefa-fila { display: flex; gap: 0.5rem; align-items: flex-end; }
.josefa-ia .josefa-fila .input { flex: 1; }
.josefa-input {
  resize: none;
  overflow: hidden;
  min-height: 2.4rem;
  line-height: 1.45;
  padding-top: 0.55rem;
  padding-bottom: 0.55rem;
}
.josefa-burbuja {
  margin-top: 0.9rem;
  background: var(--papel-alt, rgba(0,0,0,0.04));
  border-radius: 0 12px 12px 12px;
  padding: 0.85rem 1rem;
  font-size: 0.88rem;
  line-height: 1.55;
  white-space: pre-wrap;
  border: 1px solid var(--line);
}
.josefa-burbuja.cargando { opacity: 0.55; font-style: italic; }
[data-perfil="isa"] .josefa-burbuja { background: rgba(173, 59, 114, 0.07); border-color: rgba(173, 59, 114, 0.25); }
.josefa-firma { font-size: 0.76rem; color: var(--ink-soft); margin-top: 0.35rem; font-style: italic; }

/* ---------- Conciliación bancaria ---------- */
.card.banco { background: linear-gradient(160deg, var(--card), var(--card-banco)); border-width: 2px; }
.stat.destacada-hero {
  border: 2px solid var(--verde-fuerte);
  border-radius: 8px;
  padding: 0.5rem 0.9rem;
  background: rgba(47, 125, 91, 0.08);
}
.stat.destacada-hero .stat-num { font-size: 1.7rem; }
.banco-grid { display: flex; gap: 2rem; align-items: flex-end; flex-wrap: wrap; }
.banco-grid .stat { flex: 0 1 auto; }
.saldo-form { display: flex; gap: 0.45rem; align-items: flex-end; margin-left: auto; }
.saldo-form .input { width: 150px; }
@media (max-width: 700px) {
  .banco-grid { gap: 1rem; }
  .saldo-form { margin-left: 0; }
}

/* ============================================================
   FEATURES NUEVAS
   ============================================================ */

/* ---------- Proyección de fondos ---------- */
.proyeccion {
  font-size: 0.74rem;
  color: var(--verde-fuerte);
  font-weight: 500;
  margin-top: 0.35rem !important;
  padding: 0.3rem 0.5rem;
  background: rgba(47, 125, 91, 0.08);
  border-radius: 6px;
  border-left: 2px solid var(--verde-fuerte);
}
[data-perfil="isa"] .proyeccion {
  color: #ad3b72;
  background: rgba(173, 59, 114, 0.08);
  border-left-color: #ad3b72;
}

/* ---------- FAB: atajo rápido para gasto ---------- */
.fab {
  position: fixed;
  right: max(1rem, env(safe-area-inset-right));
  bottom: calc(78px + env(safe-area-inset-bottom, 0px));
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--verde-fuerte);
  color: #fff;
  border: none;
  font-size: 28px;
  font-weight: 300;
  display: none;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 20px rgba(var(--sombra-rgb), 0.28), 0 2px 6px rgba(var(--sombra-rgb), 0.15);
  cursor: pointer;
  z-index: 150;
  -webkit-tap-highlight-color: transparent;
  transition: transform var(--dur-sm, 180ms) cubic-bezier(0.34, 1.4, 0.64, 1),
              box-shadow var(--dur-sm, 180ms) ease;
}
.fab:active {
  transform: scale(0.92);
  box-shadow: 0 3px 10px rgba(var(--sombra-rgb), 0.25);
}
[data-perfil="isa"] .fab { background: #ad3b72; }

.fab-voz {
  bottom: calc(146px + env(safe-area-inset-bottom, 0px));
  background: var(--azul, #33567f);
}
.fab-voz svg { width: 26px; height: 26px; }
[data-perfil="isa"] .fab-voz { background: #6b3b88; }

/* ---------- Sheet de voz ---------- */
.voz-sheet { padding-bottom: calc(2rem + env(safe-area-inset-bottom, 0px)); }
.voz-cab { text-align: center; margin: 0.4rem 0 1.2rem; }
.voz-cab h3 { font-family: var(--f-display); font-size: 1.3rem; margin: 0 0 0.3rem; }
.voz-pista { color: var(--ink-soft); font-size: 0.86rem; margin: 0; min-height: 1.2em; }
.voz-mic-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  margin: 0.4rem 0 1.4rem;
  height: 110px;
}
.voz-mic {
  width: 84px; height: 84px;
  border-radius: 50%;
  border: none;
  background: var(--verde-fuerte);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
  z-index: 2;
  box-shadow: 0 6px 20px rgba(var(--sombra-rgb), 0.28);
  transition: transform 0.15s var(--ease-spring, ease), background 0.2s ease;
}
.voz-mic:active { transform: scale(0.95); }
.voz-mic svg { width: 36px; height: 36px; }
.voz-mic.grabando { background: var(--rojo); }
.voz-mic.procesando { background: var(--ink-soft); pointer-events: none; opacity: 0.7; }
[data-perfil="isa"] .voz-mic { background: #ad3b72; }
[data-perfil="isa"] .voz-mic.grabando { background: #c83b6c; }

.voz-pulso {
  position: absolute;
  width: 84px; height: 84px;
  border-radius: 50%;
  background: var(--verde-fuerte);
  opacity: 0;
  z-index: 1;
}
.voz-mic.grabando + .voz-pulso {
  background: var(--rojo);
  animation: voz-pulso 1.4s ease-out infinite;
}
[data-perfil="isa"] .voz-mic.grabando + .voz-pulso { background: #c83b6c; }
@keyframes voz-pulso {
  0% { opacity: 0.45; transform: scale(1); }
  100% { opacity: 0; transform: scale(2.2); }
}

.voz-modo {
  display: flex;
  gap: 0.4rem;
  justify-content: center;
  margin-bottom: 0.8rem;
}
.voz-tab {
  border: none;
  background: transparent;
  padding: 0.4rem 0.9rem;
  border-radius: 999px;
  font-size: 0.8rem;
  color: var(--ink-soft);
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease;
}
.voz-tab.activa { background: rgba(var(--sombra-rgb), 0.1); color: var(--ink); font-weight: 600; }

.voz-texto-form { display: flex; gap: 0.5rem; flex-direction: column; margin-bottom: 0.8rem; }
.voz-input { resize: none; min-height: 2.6rem; }

.voz-resultado:empty { display: none; }
.voz-resultado {
  background: rgba(var(--sombra-rgb), 0.04);
  border-radius: 12px;
  padding: 0.9rem 1rem;
  margin-top: 0.6rem;
  border: 1px solid var(--line);
  font-size: 0.9rem;
  line-height: 1.55;
  white-space: pre-wrap;
  animation: lb-rise var(--dur-md, 240ms) var(--ease-spring, ease) both;
}
.voz-resultado.cargando { opacity: 0.6; font-style: italic; }
.voz-resultado .voz-accion {
  margin-top: 0.7rem;
  padding-top: 0.7rem;
  border-top: 1px dashed var(--line);
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.voz-resultado .voz-tx {
  display: block;
  font-size: 0.78rem;
  color: var(--ink-soft);
  margin-bottom: 0.4rem;
  font-style: italic;
}
.voz-resultado .voz-tx::before { content: '🎤 '; }

@media (max-width: 560px) {
  .fab { display: flex; }
}

/* ---------- Sheet del gasto rápido (modal estilo iOS) ---------- */
.sheet-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 300;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--dur-md, 240ms) ease;
}
.sheet-overlay.abierta {
  opacity: 1;
  pointer-events: auto;
}
.sheet {
  width: 100%;
  max-width: 560px;
  background: var(--card);
  border-radius: 18px 18px 0 0;
  padding: 0.6rem 1.1rem calc(1.4rem + env(safe-area-inset-bottom, 0px));
  transform: translateY(100%);
  transition: transform var(--dur-md, 240ms) cubic-bezier(0.34, 1.4, 0.64, 1);
  box-shadow: 0 -8px 30px rgba(0,0,0,0.18);
  max-height: 90vh;
  overflow-y: auto;
}
.sheet-overlay.abierta .sheet { transform: translateY(0); }
.sheet-grip {
  width: 36px;
  height: 4px;
  background: var(--line);
  border-radius: 2px;
  margin: 0 auto 0.8rem;
}
.sheet h3 {
  margin: 0 0 0.9rem;
  font-family: var(--f-display);
  font-size: 1.15rem;
}
.sheet-cerrar {
  position: absolute;
  top: 0.6rem;
  right: 0.9rem;
  border: none;
  background: var(--paper-2);
  width: 30px;
  height: 30px;
  border-radius: 50%;
  font-size: 1rem;
  cursor: pointer;
  color: var(--ink-soft);
}

/* ---------- Pull-to-refresh ---------- */
.ptr {
  position: fixed;
  top: 0; left: 50%;
  transform: translate(-50%, -52px);
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--card);
  border: 1.5px solid var(--ink);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 250;
  transition: transform var(--dur-md, 240ms) cubic-bezier(0.34, 1.4, 0.64, 1);
  pointer-events: none;
  box-shadow: 0 4px 12px rgba(0,0,0,0.12);
}
.ptr.visible { transform: translate(-50%, 12px); }
.ptr.cargando svg { animation: ptr-spin 0.9s linear infinite; }
.ptr svg { width: 18px; height: 18px; color: var(--verde-fuerte); transition: transform 100ms linear; }
[data-perfil="isa"] .ptr svg { color: #ad3b72; }
@keyframes ptr-spin {
  to { transform: rotate(360deg); }
}

/* ---------- Confetti al cerrar mes ---------- */
.confetti {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 500;
  overflow: hidden;
}
.confetti span {
  position: absolute;
  top: -20px;
  width: 10px;
  height: 14px;
  opacity: 0;
  animation: confetti-fall 2.6s ease-out forwards;
}
@keyframes confetti-fall {
  0%   { opacity: 0; transform: translateY(0) rotate(0deg); }
  10%  { opacity: 1; }
  100% { opacity: 0; transform: translateY(110vh) rotate(720deg); }
}

.cierre-celebracion {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 600;
  pointer-events: none;
  opacity: 0;
  animation: celebracion-in 2.2s ease-out forwards;
}
.cierre-celebracion .stamp {
  font-size: 2.4rem;
  padding: 1rem 2rem;
  background: var(--card);
  border: 3px solid var(--verde-fuerte);
  border-radius: 14px;
  transform: rotate(-6deg) scale(0.5);
  animation: stamp-in 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
  box-shadow: 0 12px 40px rgba(0,0,0,0.2);
  color: var(--verde-fuerte);
  font-family: var(--f-display);
}
[data-perfil="isa"] .cierre-celebracion .stamp { color: #ad3b72; border-color: #ad3b72; }
@keyframes celebracion-in {
  0%   { opacity: 0; }
  20%  { opacity: 1; }
  80%  { opacity: 1; }
  100% { opacity: 0; }
}
@keyframes stamp-in {
  to { transform: rotate(-6deg) scale(1); }
}

/* Subir el toast por encima del tab bar */
@media (max-width: 560px) {
  #toast { bottom: calc(78px + env(safe-area-inset-bottom, 0px)); }
}

@media (prefers-reduced-motion: reduce) {
  .confetti, .cierre-celebracion { display: none; }
  .ptr, .sheet, .sheet-overlay { transition: none !important; }
}

/* ---------- DAPs activos ---------- */
.daps-cab {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.8rem;
  margin-bottom: 0.6rem;
  flex-wrap: wrap;
}
.daps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 0.7rem;
}
.dap {
  background: var(--card);
  border: 1.5px solid var(--line);
  border-radius: 10px;
  padding: 0.8rem 0.9rem;
  position: relative;
  transition: transform var(--dur-sm, 180ms) var(--ease-out), border-color var(--dur-sm, 180ms);
}
.dap.urgente { border-color: var(--mostaza); background: rgba(176, 124, 32, 0.04); }
.dap.vencido { border-color: var(--rojo); background: rgba(190, 61, 42, 0.06); animation: dap-pulse 2.4s ease-in-out infinite; }
.dap.pronto { border-color: var(--azul); }
@keyframes dap-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(190, 61, 42, 0); }
  50% { box-shadow: 0 0 0 4px rgba(190, 61, 42, 0.18); }
}
.dap-cab {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.5rem;
  margin-bottom: 0.3rem;
}
.dap-fondo {
  font-size: 0.86rem;
  font-weight: 500;
}
.dap-plazo {
  font-size: 0.72rem;
  background: rgba(var(--sombra-rgb), 0.08);
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  color: var(--ink-soft);
  font-weight: 600;
}
.dap-monto {
  font-size: 1.3rem;
  font-weight: 700;
  margin: 0.1rem 0 0.5rem;
}
.dap-contador {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 0.4rem;
  gap: 0.4rem;
  flex-wrap: wrap;
}
.dap-cuenta {
  font-size: 0.88rem;
  font-weight: 500;
}
.dap-cuenta strong { font-size: 1.05rem; color: var(--verde-fuerte); }
.dap.urgente .dap-cuenta strong { color: var(--mostaza); }
.dap.vencido .dap-cuenta.vencido { color: var(--rojo); font-weight: 600; }
.dap-fecha {
  font-family: var(--f-mono);
  font-size: 0.72rem;
  color: var(--ink-soft);
}
.dap-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.72rem;
  color: var(--ink-soft);
  margin-bottom: 0.5rem;
  gap: 0.4rem;
  flex-wrap: wrap;
}
.dap-gain { color: var(--verde-fuerte); }
.dap-chip {
  display: inline-block;
  font-size: 0.62rem;
  background: rgba(47, 125, 91, 0.12);
  color: var(--verde-fuerte);
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  margin-bottom: 0.4rem;
}
.dap-acciones {
  display: flex;
  gap: 0.4rem;
  justify-content: flex-end;
  align-items: center;
}
[data-perfil="isa"] .dap.urgente { border-color: #ad3b72; background: rgba(173, 59, 114, 0.05); }
[data-perfil="isa"] .dap.urgente .dap-cuenta strong { color: #ad3b72; }

.check-fila {
  display: flex !important;
  flex-direction: row !important;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.88rem;
}
.check-fila input[type="checkbox"] { width: 18px; height: 18px; margin: 0; }

/* ---------- Guía del plan de ahorro (details/summary) ---------- */
.guia-plan summary {
  cursor: pointer;
  list-style: none;
  user-select: none;
  padding: 0.2rem 0;
}
.guia-plan summary::-webkit-details-marker { display: none; }
.guia-plan summary::after {
  content: '▾';
  float: right;
  font-size: 0.9rem;
  transition: transform var(--dur-sm, 180ms) ease;
  color: var(--ink-soft);
}
.guia-plan details[open] summary::after { transform: rotate(180deg); }
.guia-cuerpo {
  margin-top: 0.8rem;
  padding-top: 0.8rem;
  border-top: 1px dashed var(--line);
  animation: lb-rise var(--dur-md, 240ms) var(--ease-out, ease-out) both;
}
.guia-resumen {
  background: rgba(47, 125, 91, 0.07);
  border-left: 3px solid var(--verde-fuerte);
  padding: 0.6rem 0.8rem;
  border-radius: 6px;
  font-size: 0.9rem;
  margin: 0 0 1rem;
}
[data-perfil="isa"] .guia-resumen {
  background: rgba(173, 59, 114, 0.07);
  border-left-color: #ad3b72;
}
.guia-h {
  margin: 1.1rem 0 0.4rem;
  font-family: var(--f-display);
  font-size: 0.96rem;
  font-weight: 600;
}
.guia-p { font-size: 0.86rem; margin: 0 0 0.5rem; }
.guia-list { margin: 0 0 0.5rem; padding-left: 1.2rem; font-size: 0.86rem; }
.guia-list li { margin-bottom: 0.3rem; }
.guia-tabla { margin: 0.4rem 0 0.5rem; font-size: 0.84rem; }
.guia-pie {
  margin-top: 1rem;
  padding-top: 0.6rem;
  border-top: 1px dashed var(--line);
  font-size: 0.78rem;
  color: var(--ink-soft);
}
.guia-pie a { color: var(--verde-fuerte); }
[data-perfil="isa"] .guia-pie a { color: #ad3b72; }

/* ---------- Tarjetas de crédito (§01) ---------- */
.tarjetas-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 0.7rem;
}
.tarjeta-item {
  border: 1.5px solid var(--line);
  border-left: 4px solid var(--tj, var(--azul));
  border-radius: 10px;
  padding: 0.75rem 0.9rem;
  background: var(--paper-2);
}
.tarjeta-cab {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.2rem;
}
.tarjeta-nombre { font-size: 0.86rem; font-weight: 600; }
.tarjeta-monto { font-size: 1.4rem; font-weight: 700; line-height: 1.1; margin-bottom: 0.35rem; }
.tarjeta-desglose {
  display: flex;
  gap: 0.9rem;
  flex-wrap: wrap;
  font-size: 0.74rem;
  color: var(--ink-soft);
  margin-bottom: 0.5rem;
}
.tarjeta-cupo {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  font-size: 0.72rem;
  color: var(--ink-soft);
  margin-top: 0.25rem;
}
.tarjeta-cupo .rojo { color: var(--rojo); font-weight: 600; }
.tarjeta-sin-cupo { font-size: 0.72rem; color: var(--ink-soft); font-style: italic; margin: 0.3rem 0 0; display: flex; align-items: center; gap: 0.4rem; }
.tarjeta-pie {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.68rem;
  color: var(--ink-soft);
  margin-top: 0.15rem;
}
.tarjeta-pie .btn-icono { min-width: 28px; min-height: 28px; padding: 0; font-size: 0.75rem; }
.tarjeta-usd {
  font-size: 0.68rem;
  color: var(--ink-soft);
  margin-top: 0.35rem;
  padding-top: 0.35rem;
  border-top: 1px dashed var(--line);
}
.chip.mini.tarjeta { background: rgba(51, 86, 127, 0.14); color: var(--azul); }

/* ---------- Seguimiento de cuotas (§04) ---------- */
.cuotas-seg-lista {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}
.cuota-seg {
  display: grid;
  grid-template-columns: 1fr 150px auto;
  gap: 0.8rem;
  align-items: center;
  padding: 0.55rem 0.7rem;
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: 9px;
}
.cuota-seg.futura { border-style: dashed; opacity: 0.75; }
.cuota-seg.terminada { opacity: 0.6; }
.cuota-seg-info { display: flex; flex-direction: column; gap: 0.15rem; min-width: 0; }
.cuota-seg-nombre { font-size: 0.88rem; font-weight: 500; }
.cuota-seg-detalle { font-size: 0.72rem; color: var(--ink-soft); }
.cuota-seg-prog { display: flex; flex-direction: column; gap: 0.2rem; }
.cuota-seg-num { font-size: 0.74rem; color: var(--ink-soft); text-align: center; }
.cuota-seg-num strong { font-size: 0.92rem; color: var(--verde-fuerte); }
[data-perfil="isa"] .cuota-seg-num strong { color: #ad3b72; }
.cuota-seg-resta {
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
  text-align: right;
}
.cuota-seg.terminada .cuota-seg-resta { color: var(--verde-fuerte); }
.cuota-mes-ok { color: var(--verde-fuerte); font-weight: 600; }
[data-perfil="isa"] .cuota-mes-ok { color: #ad3b72; }
.cuotas-seg-sub {
  font-family: var(--f-mono);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--ink-soft);
  margin: 0.9rem 0 0.4rem;
}
.cuotas-seg-footer {
  margin: 0.9rem 0 0;
  padding: 0.55rem 0.8rem;
  background: rgba(176, 124, 32, 0.08);
  border-left: 3px solid var(--mostaza);
  border-radius: 6px;
  font-size: 0.84rem;
}
.cuotas-seg-term { margin-top: 0.8rem; }
.cuotas-seg-term summary {
  cursor: pointer;
  font-size: 0.8rem;
  color: var(--ink-soft);
  padding: 0.3rem 0;
  list-style: none;
}
.cuotas-seg-term summary::-webkit-details-marker { display: none; }
.cuotas-seg-term[open] summary { margin-bottom: 0.4rem; }
@media (max-width: 560px) {
  .cuota-seg { grid-template-columns: 1fr auto; }
  .cuota-seg-prog { grid-column: 1; }
  .cuota-seg-resta { grid-column: 2; grid-row: 1 / span 2; align-self: center; }
}

/* ---------- Fondo común: registro de retiros ---------- */
.fondo-comun-card { background: linear-gradient(160deg, var(--card), rgba(51, 86, 127, 0.04)); }
.fondo-comun-cab {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.8rem;
  margin-bottom: 0.6rem;
  flex-wrap: wrap;
}
.fondo-comun-saldo { font-size: 1.3rem; font-weight: 700; }
.fondo-pendiente-banner {
  background: rgba(190, 61, 42, 0.06);
  border-left: 3px solid var(--rojo);
  padding: 0.6rem 0.8rem;
  border-radius: 6px;
  margin-bottom: 0.8rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}
.fondo-pendiente-label {
  font-size: 0.78rem;
  color: var(--ink-soft);
  font-weight: 500;
}
.chip-deuda {
  background: var(--rojo);
  color: #fff;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.76rem;
  font-family: var(--f-mono);
}
.chip-deuda strong { font-weight: 600; margin-right: 0.2rem; }

.fondo-acciones {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin: 0.5rem 0 1rem;
}
.fondo-acciones .fondo-form-toggle { margin: 0; flex: 1; min-width: 140px; }
.fondo-acciones .fondo-form-toggle summary .btn { width: 100%; text-align: center; }
.btn.verde-suave {
  background: rgba(47, 125, 91, 0.12);
  color: var(--verde-fuerte);
  border-color: rgba(47, 125, 91, 0.3);
}
[data-perfil="isa"] .btn.verde-suave {
  background: rgba(173, 59, 114, 0.12);
  color: #ad3b72;
  border-color: rgba(173, 59, 114, 0.3);
}
.aporte-fila { border-left: 3px solid var(--verde-fuerte); }
[data-perfil="isa"] .aporte-fila { border-left-color: #ad3b72; }
.fondo-aporte-form {
  margin-top: 0.8rem;
  padding-top: 0.8rem;
  border-top: 1px dashed var(--line);
  animation: lb-rise var(--dur-md, 240ms) var(--ease-out, ease-out) both;
}

.fondo-form-toggle { margin: 0.5rem 0 1rem; }
.fondo-form-toggle summary {
  list-style: none;
  cursor: pointer;
  display: inline-block;
}
.fondo-form-toggle summary::-webkit-details-marker { display: none; }
.fondo-retiro-form {
  margin-top: 0.8rem;
  padding-top: 0.8rem;
  border-top: 1px dashed var(--line);
  animation: lb-rise var(--dur-md, 240ms) var(--ease-out, ease-out) both;
}

.retiros-titulo {
  font-family: var(--f-mono);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--ink-soft);
  margin: 1rem 0 0.5rem;
}
.retiros-lista {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}
.retiro {
  background: var(--paper-2);
  border: 1.5px solid var(--line);
  border-radius: 10px;
  padding: 0.7rem 0.85rem;
  transition: border-color var(--dur-sm, 180ms);
}
.retiro.saldado { border-color: rgba(47, 125, 91, 0.4); background: rgba(47, 125, 91, 0.04); }
.retiro.fondo-perdido { border-style: dashed; opacity: 0.85; }
.retiro-cab {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.3rem;
  font-size: 0.72rem;
  color: var(--ink-soft);
}
.retiro-fecha { font-family: var(--f-mono); }
.retiro-autor { font-style: italic; flex: 1; }
.retiro-cuerpo {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.6rem;
  margin-bottom: 0.4rem;
}
.retiro-motivo { font-size: 0.95rem; font-weight: 500; }
.retiro-monto { font-size: 1.05rem; color: var(--rojo); font-weight: 600; }
.retiro-meta {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  margin-bottom: 0.5rem;
}
.fondo-perdido-chip { background: rgba(176, 124, 32, 0.15); color: var(--mostaza); }
.chip.mini.ok { background: rgba(47, 125, 91, 0.15); color: var(--verde-fuerte); font-weight: 600; }
.retiro-estados {
  padding-top: 0.5rem;
  border-top: 1px dashed var(--line);
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.retiro-persona {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 0.6rem;
  align-items: center;
  padding: 0.35rem 0;
  font-size: 0.86rem;
}
.retiro-persona.ok { opacity: 0.7; }
.retiro-persona-nombre { font-weight: 500; }
.retiro-persona-monto { font-family: var(--f-mono); }
.retiro-persona-monto small { color: var(--ink-soft); font-size: 0.7rem; }
.stamp-mini {
  font-family: var(--f-mono);
  font-size: 0.72rem;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  font-weight: 600;
}
.stamp-mini.verde { background: rgba(47, 125, 91, 0.15); color: var(--verde-fuerte); }

@media (max-width: 560px) {
  .retiro-persona { grid-template-columns: 1fr; gap: 0.25rem; }
  .retiro-persona button { justify-self: start; }
}

/* ---------- Botón de búsqueda en masthead ---------- */
.masthead-acciones {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}
.btn-buscar {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.7rem;
  border: 1.5px solid var(--line);
  background: var(--paper-2);
  color: var(--ink-soft);
  border-radius: 8px;
  font-family: var(--f-body);
  font-size: 0.78rem;
  cursor: pointer;
  transition: border-color var(--dur-sm, 180ms), color var(--dur-sm, 180ms);
  min-height: 36px;
}
.btn-buscar:hover { border-color: var(--ink); color: var(--ink); }
.btn-buscar-kbd {
  font-family: var(--f-mono);
  font-size: 0.66rem;
  padding: 0.1rem 0.35rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--ink-soft);
}
@media (max-width: 560px) {
  .btn-buscar-texto, .btn-buscar-kbd { display: none; }
  .btn-buscar { padding: 0.5rem; min-width: 40px; justify-content: center; }
}

/* ---------- Modal de búsqueda ---------- */
.buscar-overlay { align-items: flex-start; padding-top: max(10vh, 1rem); }
.buscar-caja {
  background: var(--card);
  width: 100%;
  max-width: 560px;
  border-radius: 14px;
  border: 1px solid var(--line);
  overflow: hidden;
  box-shadow: 0 20px 50px rgba(0,0,0,0.25);
  transform: scale(0.94) translateY(-8px);
  opacity: 0;
  transition: transform var(--dur-md, 240ms) cubic-bezier(0.34, 1.4, 0.64, 1),
              opacity var(--dur-sm, 180ms) ease;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
}
.buscar-overlay.abierta .buscar-caja {
  transform: scale(1) translateY(0);
  opacity: 1;
}
.buscar-cab {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.8rem 1rem;
  border-bottom: 1px solid var(--line);
}
.buscar-cab svg { color: var(--ink-soft); flex-shrink: 0; }
.buscar-input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font-family: var(--f-body);
  font-size: 16px;
  color: var(--ink);
  padding: 0.3rem 0;
  min-height: 32px;
}
.buscar-cerrar {
  border: none;
  background: var(--paper-2);
  color: var(--ink-soft);
  width: 28px;
  height: 28px;
  border-radius: 50%;
  font-size: 0.85rem;
  cursor: pointer;
}
.buscar-resultados {
  overflow-y: auto;
  padding: 0.5rem 0;
  max-height: calc(80vh - 60px);
}
.buscar-vacio {
  padding: 2rem 1.4rem;
  text-align: center;
  color: var(--ink-soft);
  font-size: 0.88rem;
  font-style: italic;
}
.buscar-grupo { padding: 0.4rem 0; }
.buscar-grupo-titulo {
  font-family: var(--f-mono);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--ink-soft);
  padding: 0.2rem 1rem;
  margin: 0.4rem 0 0.25rem;
}
.buscar-lista { list-style: none; padding: 0; margin: 0; }
.buscar-item {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0.6rem 1rem;
  text-decoration: none;
  color: var(--ink);
  border-left: 2px solid transparent;
  transition: background var(--dur-xs, 120ms), border-color var(--dur-xs, 120ms);
}
.buscar-item:hover, .buscar-item:focus-visible {
  background: rgba(var(--sombra-rgb), 0.04);
  border-left-color: var(--verde-fuerte);
  outline: none;
}
[data-perfil="isa"] .buscar-item:hover, [data-perfil="isa"] .buscar-item:focus-visible {
  border-left-color: #ad3b72;
}
.buscar-item-cuerpo { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 0.1rem; }
.buscar-item-principal { font-size: 0.9rem; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.buscar-item-secundario { font-size: 0.74rem; color: var(--ink-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.buscar-item-monto { font-size: 0.88rem; font-weight: 600; white-space: nowrap; }
.buscar-item-monto.verde { color: var(--verde-fuerte); }
@media (max-width: 560px) {
  .buscar-overlay { padding-top: max(env(safe-area-inset-top, 0px), 4vh); }
  .buscar-caja { max-height: 90vh; }
}

/* ---------- Mini-modal de input (reemplazo de prompt para PWA) ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.2rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--dur-md, 240ms) ease;
}
.modal-overlay.abierta {
  opacity: 1;
  pointer-events: auto;
}
.modal-input-box {
  background: var(--card);
  border-radius: 14px;
  padding: 1.2rem 1.2rem 1rem;
  width: 100%;
  max-width: 360px;
  border: 1px solid var(--line);
  transform: scale(0.92);
  opacity: 0;
  transition: transform var(--dur-md, 240ms) cubic-bezier(0.34, 1.4, 0.64, 1),
              opacity var(--dur-sm, 180ms) ease;
}
.modal-overlay.abierta .modal-input-box {
  transform: scale(1);
  opacity: 1;
}
.modal-input-box h4 {
  margin: 0 0 0.4rem;
  font-family: var(--f-display);
  font-size: 1.1rem;
}
.modal-input-msg {
  margin: 0 0 0.9rem;
  font-size: 0.85rem;
  color: var(--ink-soft);
}
.modal-input-box .input {
  width: 100%;
  font-size: 16px;
}
.modal-input-acciones {
  display: flex;
  gap: 0.6rem;
  justify-content: flex-end;
  margin-top: 1rem;
}

/* ---------- Chip de comparación entre meses ---------- */
.chip-delta {
  display: inline-block;
  font-family: var(--f-mono);
  font-size: 0.62rem;
  font-weight: 600;
  padding: 0.12rem 0.42rem;
  border-radius: 999px;
  margin-left: 0.4rem;
  vertical-align: middle;
  letter-spacing: 0.01em;
}
.chip-delta.verde { background: rgba(47, 125, 91, 0.14); color: var(--verde-fuerte); }
.chip-delta.rojo  { background: rgba(190, 61, 42, 0.14); color: var(--rojo); }

/* ---------- Tendencia del saldo (sparkline) ---------- */
.tendencia-saldo {
  margin-top: 0.9rem;
  padding-top: 0.7rem;
  border-top: 1px dashed var(--line);
}
.tendencia-cab {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 0.25rem;
}
.tendencia-titulo {
  font-family: var(--f-mono);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--ink-soft);
}
.tendencia-rango {
  font-family: var(--f-mono);
  font-size: 0.7rem;
  color: var(--ink-soft);
}
.sparkline { display: block; max-width: 100%; }
