/* Home Finance — la interfaz toma prestado el lenguaje del ticket de papel:
   monoespaciada en los números, guías punteadas, bordes troquelados en los cierres. */

@import url('https://fonts.googleapis.com/css2?family=Bricolage+Grotesque:opsz,wght@12..96,500;12..96,700;12..96,800&family=IBM+Plex+Mono:wght@400;500;600&family=Inter:wght@400;500;600&display=swap');

:root {
  color-scheme: light;
  --paper: #e9eae3;
  --card: #fbfbf8;
  --ink: #16181a;
  --muted: #6e7268;
  --line: #d2d5c9;
  --line-soft: #e2e4da;
  --tinta: #2f5d50;
  --tinta-claro: #eaf1ed;
  --sello: #a8352a;
  --sello-claro: #f7e9e6;
  --ocre: #b4801e;
  --ocre-claro: #fbf1dd;
  --meta-color: #5a4b9c;
  --meta-claro: #eeecf8;

  --display: 'Bricolage Grotesque', system-ui, sans-serif;
  --body: 'Inter', system-ui, sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, monospace;

  --r: 4px;
  --shadow: 0 1px 0 rgba(22, 24, 26, .04), 0 2px 10px rgba(22, 24, 26, .05);
}

/* Modo oscuro. Sigue al sistema salvo que el usuario fuerce un tema. */


:root[data-tema="oscuro"] {
  color-scheme: dark;
  --paper: #14161a;
  --card: #1c1f24;
  --ink: #e8eae4;
  --muted: #969c96;
  --line: #2e3238;
  --line-soft: #24272c;
  --tinta: #6fbfa4;
  --tinta-claro: #1e2b28;
  --sello: #e07a6c;
  --sello-claro: #2e211f;
  --ocre: #d9a441;
  --ocre-claro: #2c2519;
  --meta-color: #9b8fe0;
  --meta-claro: #232134;
  --shadow: 0 1px 0 rgba(0, 0, 0, .3), 0 2px 12px rgba(0, 0, 0, .35);
}

:root[data-tema="claro"] { color-scheme: light; }

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--body);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--tinta); }

.num { font-family: var(--mono); font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.hidden { display: none !important; }

/* ---------------------------------------------------------------- login */
.login-wrap {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 32px 28px;
  box-shadow: var(--shadow);
}
.brand {
  font-family: var(--display);
  font-weight: 800;
  font-size: 30px;
  letter-spacing: -.03em;
  margin: 0;
}
.brand span { color: var(--tinta); }
.login-card p.sub { color: var(--muted); margin: 4px 0 24px; font-size: 14px; }

/* ---------------------------------------------------------------- shell */
.shell { display: grid; grid-template-columns: 210px minmax(0, 1fr); min-height: 100dvh; }

.rail {
  border-right: 1px solid var(--line);
  padding: 22px 14px;
  position: sticky;
  top: 0;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.rail .brand { font-size: 22px; padding: 0 10px 18px; }
.rail button {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 9px 10px;
  background: none;
  border: 0;
  border-radius: var(--r);
  text-align: left;
  cursor: pointer;
  color: var(--muted);
  font-weight: 500;
}
.rail button:hover { background: var(--line-soft); color: var(--ink); }
.rail button[aria-current="true"] { background: var(--tinta); color: var(--card); }
.rail .spacer { flex: 1; }
.rail .whoami {
  padding: 10px;
  border-top: 1px solid var(--line);
  font-size: 13px;
  color: var(--muted);
}
.rail .whoami strong { display: block; color: var(--ink); font-size: 14px; }

main { padding: 24px 28px 80px; max-width: 1500px; width: 100%; }

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
h1 {
  font-family: var(--display);
  font-weight: 800;
  font-size: 27px;
  letter-spacing: -.03em;
  margin: 0;
}
h2 {
  font-family: var(--display);
  font-weight: 700;
  font-size: 17px;
  letter-spacing: -.02em;
  margin: 0 0 12px;
}
.eyebrow {
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .11em;
  color: var(--muted);
}

/* ---------------------------------------------------------------- piezas */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 18px;
  box-shadow: var(--shadow);
  margin-bottom: 16px;
}
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, 1fr); }
.g3 { grid-template-columns: repeat(3, 1fr); }
.g4 { grid-template-columns: repeat(4, 1fr); }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

label.field { display: block; margin-bottom: 12px; }
label.field > span {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 4px;
  font-weight: 500;
}
input, select, textarea {
  width: 100%;
  padding: 9px 11px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r);
  outline: 0;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--tinta);
  box-shadow: 0 0 0 3px var(--tinta-claro);
}
input[type="number"], input[type="date"] { font-family: var(--mono); }
textarea { resize: vertical; min-height: 84px; }

.btn {
  padding: 9px 16px;
  border: 1px solid var(--tinta);
  background: var(--tinta);
  color: var(--card);
  border-radius: var(--r);
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
}
.btn:hover { filter: brightness(1.12); }
.btn:disabled { opacity: .5; cursor: not-allowed; filter: none; }
.btn.quiet {
  background: transparent;
  border-color: var(--line);
  color: var(--muted);
  font-weight: 500;
}
.btn.quiet:hover { color: var(--ink); border-color: var(--muted); filter: none; }
.btn.danger { background: var(--sello); border-color: var(--sello); color: var(--card); }
.btn.sm { padding: 5px 10px; font-size: 13px; }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 9px;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 500;
  background: var(--line-soft);
  color: var(--muted);
}
.pill.ok { background: var(--tinta-claro); color: var(--tinta); }
.pill.warn { background: var(--ocre-claro); color: var(--ocre); }
.pill.bad { background: var(--sello-claro); color: var(--sello); }

/* ------------------------------------------------ la tira: pieza central */
.tira {
  background: var(--card);
  border: 1px solid var(--line);
  border-bottom: 0;
  border-radius: var(--r) var(--r) 0 0;
  padding: 22px 24px 30px;
  box-shadow: var(--shadow);
  position: relative;
  /* el borde inferior queda troquelado, como un ticket recién cortado */
  -webkit-mask: radial-gradient(circle at 7px 100%, transparent 6px, #000 6.5px) 0 100% / 14px 100% repeat-x;
  mask: radial-gradient(circle at 7px 100%, transparent 6px, #000 6.5px) 0 100% / 14px 100% repeat-x;
}

.ritmo-bar {
  position: relative;
  height: 12px;
  background: var(--line-soft);
  border-radius: 2px;
  overflow: visible;
}
.ritmo-fill {
  height: 100%;
  background: var(--tinta);
  border-radius: 2px 0 0 2px;
  transition: width .5s cubic-bezier(.2, .7, .3, 1);
}
.ritmo-fill.over { background: var(--sello); }
.ritmo-hoy {
  position: absolute;
  top: -5px;
  bottom: -5px;
  width: 2px;
  background: var(--ink);
}
.ritmo-hoy::after {
  content: attr(data-label);
  position: absolute;
  top: -17px;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink);
  white-space: nowrap;
}
.ritmo-legend {
  display: flex;
  justify-content: space-between;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  margin-top: 7px;
}

/* --------------------------------------------- renglones tipo ticket */
.renglones { list-style: none; margin: 0; padding: 0; }
.renglon {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line-soft);
}
.renglon:last-child { border-bottom: 0; }
.renglon .emoji { font-size: 15px; }
.renglon .txt { flex: 0 1 auto; }
.renglon .txt b { font-weight: 600; }
.renglon .txt i {
  font-style: normal;
  color: var(--muted);
  font-size: 13px;
  display: block;
}
/* la guía punteada que lleva el ojo del concepto al monto */
.renglon .guia {
  flex: 1 1 auto;
  min-width: 18px;
  border-bottom: 1px dotted var(--line);
  transform: translateY(-4px);
}
.renglon .monto { font-family: var(--mono); font-weight: 500; white-space: nowrap; }
.renglon .acciones { display: flex; gap: 4px; opacity: 0; transition: opacity .15s; }
.renglon:hover .acciones, .renglon:focus-within .acciones { opacity: 1; }
.icon-btn {
  border: 0;
  background: none;
  cursor: pointer;
  color: var(--muted);
  padding: 2px 5px;
  border-radius: var(--r);
  font-size: 13px;
}
.icon-btn:hover { background: var(--line-soft); color: var(--ink); }
.icon-btn.del:hover { background: var(--sello-claro); color: var(--sello); }

/* --------------------------------------------- barras por rubro */
.rubro { padding: 10px 0; border-bottom: 1px solid var(--line-soft); }
.rubro:last-child { border-bottom: 0; }
.rubro-top {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 6px;
}
.rubro-top .nombre { font-weight: 500; }
.rubro-top .guia { flex: 1; border-bottom: 1px dotted var(--line); transform: translateY(-4px); }
.rubro-bar { height: 7px; background: var(--line-soft); border-radius: 2px; overflow: hidden; }
.rubro-bar > i { display: block; height: 100%; background: var(--tinta); border-radius: 2px; }
.rubro-bar > i.warn { background: var(--ocre); }
.rubro-bar > i.bad { background: var(--sello); }
.rubro-sub {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--muted);
  margin-top: 5px;
  display: flex;
  justify-content: space-between;
}

/* --------------------------------------------- objetivos */
.meta-card { border-left: 3px solid var(--ocre); }
.meta-card.en_curso { border-left-color: var(--tinta); }
.meta-card.atrasado { border-left-color: var(--sello); }
.meta-card.cumplido { border-left-color: var(--ocre); }
.meta-bar { height: 10px; background: var(--line-soft); border-radius: 2px; overflow: hidden; margin: 12px 0 8px; }
.meta-bar > i { display: block; height: 100%; background: var(--ocre); }
.meta-datos {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed var(--line);
}

/* --------------------------------------------- gráfico de barras */
.chart { width: 100%; height: auto; display: block; }
.chart .bar-g { fill: var(--tinta); }
.chart .bar-i { fill: var(--line); }
.chart text { font-family: var(--mono); font-size: 11px; fill: var(--muted); }

/* --------------------------------------------- asesor */
.consejo { border-left: 3px solid var(--tinta); padding-left: 14px; margin: 14px 0; }
.consejo h3 {
  font-family: var(--display);
  font-size: 15px;
  margin: 0 0 4px;
}
.impacto {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--tinta);
  font-weight: 600;
}
.cuota-dots { display: flex; gap: 5px; align-items: center; }
.cuota-dots i {
  width: 10px; height: 10px;
  border-radius: 999px;
  background: var(--tinta);
  display: block;
}
.cuota-dots i.usada { background: var(--line); }

/* --------------------------------------------- tablas y avisos */
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th {
  text-align: left;
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .09em;
  color: var(--muted);
  font-weight: 500;
  padding: 6px 8px;
  border-bottom: 1px solid var(--line);
}
td { padding: 9px 8px; border-bottom: 1px solid var(--line-soft); }
td.num, th.num { text-align: right; font-family: var(--mono); }

.aviso {
  padding: 10px 13px;
  border-radius: var(--r);
  font-size: 13.5px;
  margin-bottom: 8px;
  border-left: 3px solid;
}
.aviso.alto { background: var(--sello-claro); border-color: var(--sello); }
.aviso.medio { background: var(--ocre-claro); border-color: var(--ocre); }
.aviso.info { background: var(--tinta-claro); border-color: var(--tinta); }

.vacio {
  text-align: center;
  padding: 34px 20px;
  color: var(--muted);
  font-size: 14px;
}
.vacio b { display: block; color: var(--ink); font-family: var(--display); font-size: 16px; margin-bottom: 4px; }

/* sello de mes cerrado */
.sello-cerrado {
  display: inline-block;
  border: 2px solid var(--sello);
  color: var(--sello);
  font-family: var(--display);
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
  font-size: 12px;
  padding: 3px 10px;
  border-radius: 3px;
  transform: rotate(-3deg);
}

/* modal */
.modal-bg {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100dvh;
  background: rgba(22, 24, 26, .38);
  display: grid;
  place-items: center;
  padding: 20px;
  overflow-y: auto;
  z-index: 50;
}
.modal {
  background: var(--card);
  border-radius: var(--r);
  padding: 22px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, .2);
  /* Sin esto, un formulario largo se sale de la pantalla y los botones de
     guardar quedan fuera de la ventana, sin forma de alcanzarlos. */
  max-height: calc(100dvh - 40px);
  overflow-y: auto;
  overscroll-behavior: contain;
}
/* Los formularios de dos columnas pasan a una sola cuando no hay ancho. */
@media (max-width: 560px) {
  .modal .grid.g2,
  .modal .grid.g3,
  .modal .grid.g4 { grid-template-columns: 1fr; }
}

.toast {
  position: fixed;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: var(--paper);
  padding: 11px 20px;
  border-radius: var(--r);
  z-index: 100;
  font-size: 14px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .25);
  animation: sube .25s ease;
}
.toast.err { background: var(--sello); }
@keyframes sube { from { opacity: 0; transform: translate(-50%, 10px); } }

/* --------------------------------------------- mobile */




:focus-visible { outline: 2px solid var(--tinta); outline-offset: 2px; }


/* ------------------------------------------------ barra de cotización */
.fx-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 4px 4px 4px 10px;
}
.fx-rate {
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--muted);
  white-space: nowrap;
}
.fx-rate b { color: var(--ink); font-weight: 600; }
.fx-rate.stale b { color: var(--ocre); }
.fx-select {
  width: auto;
  padding: 4px 6px;
  font-size: 12.5px;
  border-color: transparent;
  background: var(--line-soft);
}
.seg { display: flex; border: 1px solid var(--line); border-radius: 3px; overflow: hidden; }
.seg button {
  border: 0;
  background: var(--card);
  padding: 4px 9px;
  cursor: pointer;
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--muted);
  border-left: 1px solid var(--line);
}
.seg button:first-child { border-left: 0; }
.seg button.on { background: var(--tinta); color: var(--card); }
.seg button:hover:not(.on) { background: var(--line-soft); color: var(--ink); }

/* ------------------------------------------------ montos en dos monedas */
.dual { line-height: 1.25; }
.dual-main {
  display: block;
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  letter-spacing: -.02em;
}
.dual-alt {
  display: block;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  letter-spacing: -.01em;
}
.dual.ok .dual-main { color: var(--tinta); }
.dual.bad .dual-main { color: var(--sello); }
span.dual { display: inline-block; text-align: right; white-space: nowrap; }
.alt { font-family: var(--mono); font-size: 11.5px; color: var(--muted); margin-left: 6px; }

/* ------------------------------------------------ tira reorganizada */
.tira-grid {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) 1.4fr;
  gap: 28px;
  align-items: start;
}
.tira-hero { min-width: 0; }
.tira-total {
  font-family: var(--mono);
  font-weight: 600;
  font-size: 40px;
  letter-spacing: -.045em;
  line-height: 1.05;
  margin-top: 2px;
}
.tira-alt {
  font-family: var(--mono);
  font-size: 14px;
  color: var(--muted);
  margin-top: 2px;
}
.tira-meta { font-size: 12.5px; color: var(--muted); margin-top: 8px; }
.peor { color: var(--sello); font-weight: 500; }
.tira-metrics {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px 22px;
  padding-top: 4px;
  padding-left: 24px;
  border-left: 1px dashed var(--line);
}
.ritmo { margin-top: 18px; padding-top: 16px; border-top: 1px dashed var(--line); }
.ritmo-fill.warn { background: var(--ocre); }
.ritmo-vacio {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px dashed var(--line);
  font-size: 13px;
  color: var(--muted);
}



/* montos destacados de los paneles de objetivos y deudas */
.dual.grande { margin-top: 6px; }
.dual.grande .dual-main { font-size: 23px; font-weight: 600; letter-spacing: -.035em; }
.dual.grande .dual-alt { font-size: 12px; margin-top: 1px; }

/* enlace en línea con aspecto de texto, no de botón */
.enlace {
  border: 0;
  background: none;
  padding: 0;
  color: var(--tinta);
  cursor: pointer;
  text-decoration: underline;
  font: inherit;
}

/* el reporte que recibe el asesor, para poder revisarlo */
pre.contexto {
  font-family: var(--mono);
  font-size: 11.5px;
  line-height: 1.45;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 12px;
  max-height: 460px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  margin: 0;
}


/* ------------------------------------------------ interruptor de tema */
.tema {
  display: flex;
  gap: 2px;
  padding: 8px 10px;
  border-top: 1px solid var(--line);
}
.tema button {
  flex: 1;
  border: 1px solid var(--line);
  background: none;
  border-radius: 3px;
  padding: 5px 0;
  cursor: pointer;
  font-size: 13px;
  color: var(--muted);
}
.tema button.on { background: var(--line-soft); color: var(--ink); border-color: var(--muted); }


/* ------------------------------------------------ rejilla del resumen */

/* En pantallas angostas las dos columnas se apilan */



/* el formulario de carga, más compacto */

/* ------------------------------------------------ barra inferior en el teléfono */




/* el botón "Más" sólo existe en el teléfono */
.solo-movil { display: none; }


/* subcategorías dentro de cada categoría principal */
.subrubros {
  margin: 8px 0 0 14px;
  padding-left: 10px;
  border-left: 1px solid var(--line-soft);
}
.subrubro {
  display: flex;
  align-items: baseline;
  gap: 6px;
  font-size: 12.5px;
  color: var(--muted);
  padding: 2px 0;
}
.subrubro .guia { flex: 1; border-bottom: 1px dotted var(--line); transform: translateY(-3px); }
.subrubro .num { font-family: var(--mono); font-size: 12px; }

/* ------------------------------------------------ panel lateral derecho */
.panel-lateral { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.panel-lateral .card { margin-bottom: 0; padding: 14px; }
.panel-lateral h2 { font-size: 14px; margin-bottom: 8px; }
.panel-lateral .rubro { padding: 7px 0; }

/* Abajo de 1200px el panel pasa debajo, para no comprimir el contenido */

/* Las tarjetas de una misma fila igualan su altura */
.col-principal .grid > .card > .renglones,

/* puntos de avance de la guía inicial */
.guia-puntos { display: flex; gap: 5px; justify-content: center; margin-top: 16px; }
.guia-puntos i { width: 7px; height: 7px; border-radius: 50%; background: var(--line); display: block; }
.guia-puntos i.on { background: var(--tinta); width: 18px; border-radius: 4px; }

/* ------------------------------------------------------------- calendario */
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 5px;
}
.cal-cabecera { margin-bottom: 7px; gap: 5px; }
.cal-dow {
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .09em;
  color: var(--muted);
  text-align: left;
  padding: 0 4px 4px;
}
.cal-dia {
  min-height: 96px;
  border: 1px solid var(--line-soft);
  background: var(--card);
  border-radius: var(--r);
  padding: 5px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 3px;
  overflow: hidden;
  transition: border-color .12s, box-shadow .12s;
}
.cal-dia:hover { border-color: var(--muted); box-shadow: var(--shadow); }
.cal-dia:focus-visible { outline: 2px solid var(--tinta); outline-offset: 1px; }
.cal-dia.fuera { background: transparent; opacity: .45; }
.cal-dia.hoy { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.cal-dia.hoy .cal-num { background: var(--ink); color: var(--card); }

.cal-num {
  font-family: var(--mono);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  width: 21px;
  height: 21px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
}
.cal-dia.tiene .cal-num { color: var(--ink); font-weight: 600; }

.cal-eventos { display: flex; flex-direction: column; gap: 2px; min-height: 0; }
.cal-chip {
  display: flex;
  align-items: center;
  gap: 3px;
  font-size: 11px;
  line-height: 1.35;
  padding: 2px 4px;
  border-radius: 3px;
  border-left: 2px solid;
  background: var(--line-soft);
  border-color: var(--muted);
  overflow: hidden;
}
.cal-chip i { font-style: normal; font-size: 11px; flex: none; }
.cal-chip b {
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
  flex: 1;
}
.cal-chip u {
  text-decoration: none;
  font-family: var(--mono);
  font-size: 11px;
  opacity: .8;
  flex: none;
}
.cal-chip.e-vencido { background: var(--sello-claro); border-color: var(--sello); color: var(--sello); }
.cal-chip.e-proximo { background: var(--ocre-claro); border-color: var(--ocre); color: var(--ocre); }
.cal-chip.e-pagado { background: var(--tinta-claro); border-color: var(--tinta); color: var(--tinta); }
.cal-chip.e-meta { background: var(--meta-claro); border-color: var(--meta-color); color: var(--meta-color); }
.cal-chip.e-info { background: var(--line-soft); border-color: var(--line); color: var(--muted); }
.cal-mas { font-size: 11px; color: var(--muted); padding-left: 4px; }

.cal-leyenda {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-top: 14px;
  padding-top: 11px;
  border-top: 1px dashed var(--line);
  font-size: 11.5px;
  color: var(--muted);
}
.cal-leyenda span { display: inline-flex; align-items: center; gap: 6px; }
.cal-leyenda i {
  width: 11px; height: 11px; border-radius: 2px; display: inline-block;
  border: 1px solid; flex: none;
}
.cal-leyenda i.e-vencido { background: var(--sello-claro); border-color: var(--sello); }
.cal-leyenda i.e-proximo { background: var(--ocre-claro); border-color: var(--ocre); }
.cal-leyenda i.e-pagado { background: var(--tinta-claro); border-color: var(--tinta); }
.cal-leyenda i.e-meta { background: var(--meta-claro); border-color: var(--meta-color); }
.cal-leyenda i.e-info { background: var(--line-soft); border-color: var(--line); }



/* ------------------------------------------- contexto bajo cada métrica */
.metric .ctx { font-size: 11px; color: var(--muted); margin-top: 3px; line-height: 1.35; }

/* ------------------------------------------- gráfico chico de seis meses */
.mini-chart {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  height: 128px;
  position: relative;
  padding-bottom: 16px;
}
.mini-col { flex: 1; display: flex; flex-direction: column; align-items: center; height: 100%; justify-content: flex-end; }
.mini-col i { display: block; width: 100%; background: var(--line); border-radius: 2px 2px 0 0; }
.mini-col i.on { background: var(--tinta); }
.mini-val { font-family: var(--mono); font-size: 11px; color: var(--muted); margin-bottom: 3px; }
.mini-lab { font-family: var(--mono); font-size: 11px; color: var(--muted); position: absolute; bottom: 0; }
.mini-tope { position: absolute; left: 0; right: 0; border-top: 1px dashed var(--sello); z-index: 1; }

/* ------------------------------------------- composición del mes */
.comp-barra { display: flex; height: 12px; border-radius: 2px; overflow: hidden; gap: 1px; }
.comp-barra i { display: block; background: var(--tinta); }
.comp-lista { display: grid; grid-template-columns: 1fr 1fr; gap: 3px 14px; margin-top: 12px; }
.comp-item { display: flex; align-items: center; gap: 6px; font-size: 12px; }
.comp-item i { width: 9px; height: 9px; border-radius: 2px; background: var(--tinta); display: block; flex: none; }
.comp-item span:nth-child(2) { flex: 1; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.comp-item .num { font-family: var(--mono); font-size: 11.5px; }

/* ------------------------------------------- carga rápida del panel */
.rapido input, .rapido select { margin-bottom: 7px; }
.rapido .row input { margin-bottom: 0; }
.cat-chips { display: flex; flex-wrap: wrap; gap: 4px; margin: 7px 0; }
.chip input, .moneda-op input { position: absolute; opacity: 0; pointer-events: none; }
.chip span, .moneda-op span {
  display: block;
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 5px 8px;
  font-size: 11.5px;
  cursor: pointer;
  white-space: nowrap;
}
.chip input:checked + span, .moneda-op input:checked + span {
  background: var(--tinta); color: var(--card); border-color: var(--tinta);
}
.moneda-op span { font-family: var(--mono); font-size: 11px; padding: 8px 7px; }

/* los ingresos, en verde y con signo más */
.renglon.ingreso .monto.verde { color: var(--tinta); font-weight: 600; }

/* ------------------------------------------ botón flotante de carga rápida */
.fab {
  position: fixed;
  right: 22px;
  bottom: 22px;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: 1px solid var(--tinta);
  background: var(--tinta);
  color: var(--card);
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(0, 0, 0, .22);
  z-index: 42;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform .12s;
}
.fab:hover { transform: scale(1.06); }
.fab span { transform: translateY(-1px); }


/* ------------------------------------------------ menú de qué agregar */
.menu-agregar { display: flex; flex-direction: column; gap: 6px; margin-top: 12px; }
.menu-agregar button {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--card);
  cursor: pointer;
  text-align: left;
}
.menu-agregar button:hover { border-color: var(--tinta); background: var(--tinta-claro); }
.menu-agregar .ico { font-size: 20px; flex: none; }
.menu-agregar b { display: block; font-size: 14px; font-weight: 600; }
.menu-agregar i { display: block; font-style: normal; font-size: 12px; color: var(--muted); }

/* el botón flotante ahora se explica */
.fab {
  width: auto;
  height: 46px;
  border-radius: 23px;
  padding: 0 18px 0 14px;
  gap: 7px;
  font-size: 15px;
}
.fab span { font-size: 22px; }
.fab b { font-weight: 600; font-size: 14px; }



/* ------------------------------------------- rejilla unificada del resumen */
.resumen-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  margin-top: 20px;
  align-items: stretch;   /* las tarjetas de una fila igualan su altura */
}




.panel {
  margin-bottom: 0;
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.panel-cab {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}
.panel-cab .btn { margin-left: auto; }
.panel-cab h2 { margin: 0; }
.panel-cuerpo { flex: 1; min-width: 0; }
.panel .agarre {
  color: var(--line);
  font-size: 15px;
  cursor: grab;
  opacity: 0;
  transition: opacity .12s;
  user-select: none;
}
.panel:hover .agarre { opacity: 1; }

.resumen-grid.ordenando .panel {
  cursor: grab;
  border-style: dashed;
  border-color: var(--tinta);
}
.resumen-grid.ordenando .agarre { opacity: 1; color: var(--tinta); }
.panel.arrastrando { opacity: .45; }


/* =====================================================================
   TELÉFONO Y TABLETA
   Un solo punto de quiebre en 900 px. Los teléfonos grandes reportan
   entre 700 y 820 px de ancho, así que un corte en 700 no los alcanza.
   ===================================================================== */


/* Pantallas realmente chicas */

@media (prefers-color-scheme: dark) {
  :root:not([data-tema="claro"]) {
    color-scheme: dark;
    --paper: #14161a;
    --card: #1c1f24;
    --ink: #e8eae4;
    --muted: #969c96;
    --line: #2e3238;
    --line-soft: #24272c;
    --tinta: #6fbfa4;
    --tinta-claro: #1e2b28;
    --sello: #e07a6c;
    --sello-claro: #2e211f;
    --ocre: #d9a441;
    --ocre-claro: #2c2519;
    --meta-color: #9b8fe0;
    --meta-claro: #232134;
    --shadow: 0 1px 0 rgba(0, 0, 0, .3), 0 2px 12px rgba(0, 0, 0, .35);
  }
}

@media (max-width: 719px) {
  /* --- Áreas táctiles ---------------------------------------------------
     La recomendación para el dedo son 44 px. Por debajo de eso hay que
     apuntar, y en una lista de gastos es fácil tocar el renglón de al lado. */
  .btn { min-height: 44px; padding: 11px 18px; font-size: 15px; }
  .btn.sm { min-height: 40px; padding: 9px 14px; font-size: 14px; }
  .icon-btn { min-width: 40px; min-height: 40px; font-size: 16px; }
  .chip span, .moneda-op span { min-height: 42px; display: flex; align-items: center; }
  .seg button { min-height: 40px; padding: 0 14px; }
  .rail button { min-height: 52px; }
  .menu-agregar button { min-height: 56px; }
  select, input[type="date"] { min-height: 44px; }
  summary { min-height: 40px; display: flex; align-items: center; }
  .renglon .acciones { gap: 2px; }

  /* --- Legibilidad ------------------------------------------------------ */
  body { font-size: 15px; }
  .eyebrow, .rubro-sub, .metric .ctx, .dual-alt { font-size: 12px; }
  .renglon .txt i { font-size: 12.5px; }

  .solo-movil {
    display: flex;
    flex-direction: column;
    gap: 2px;
    align-items: center;
    border: 0;
    background: none;
    cursor: pointer;
    color: var(--muted);
    font-size: 11px;
    padding: 8px 2px;
    flex: 1;
  }
  .solo-movil.on { color: var(--tinta); }
  /* nada puede desbordar a lo ancho */
  /* El desplazamiento vive en `main`, no en la página. Por eso no hace falta
     recortar el body, que era lo que despegaba la barra al desplazar.
     `position: relative` en el body es deliberado: como mide exactamente la
     pantalla, las ventanas emergentes quedan bien ubicadas aunque el navegador
     resuelva su capa como absoluta en vez de fija. */
  html, body { height: 100%; overflow: hidden; }
  body { position: relative; }

  /* la capa de las ventanas cubre la pantalla y se apoya abajo, al alcance del pulgar */
  .modal-bg {
    position: absolute;
    inset: 0;
    height: 100%;
    align-items: end;
    padding: 12px 10px calc(12px + env(safe-area-inset-bottom, 0px));
  }
  .modal { width: 100%; max-width: 100% !important; max-height: 82dvh; overflow-y: auto; }

  /* la pantalla de acceso y la de registro sí necesitan desplazarse enteras */
  #login { height: 100dvh; overflow-y: auto; align-items: flex-start; padding: 24px 14px 40px; }
  /* la barra de escritorio no se usa en el teléfono */
  .rail { display: none; }

  /* una sola columna: en un teléfono dos columnas no se leen */
  .grid.g2, .grid.g3, .grid.g4,
  .resumen-grid { grid-template-columns: 1fr; }
  /* El formulario de deudas conserva dos columnas: son campos cortos */
  .form-deuda .grid.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .form-deuda .grid.g3 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .form-deuda .grid.g2 > .campo-tarjeta.field:only-of-type,
  .form-deuda .grid.g2 > label.row { grid-column: 1 / -1; }
  .tira-grid { grid-template-columns: 1fr; gap: 14px; }
  .tira-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    border-left: 0;
    padding-left: 0;
    padding-top: 14px;
    border-top: 1px dashed var(--line);
    gap: 12px 14px;
  }
  .meta-datos { grid-template-columns: repeat(2, minmax(0, 1fr)); }

  /* tipografía más contenida */
  h1 { font-size: 19px; }
  h2 { font-size: 14.5px; }
  .tira-total { font-size: 28px; }
  .dual.grande .dual-main { font-size: 19px; }
  .card, .panel { padding: 13px; }
  .eyebrow { font-size: 11px; }

  /* los selectores de la cabecera ocupan todo el ancho y se reparten */
  .page-head { gap: 8px; }
  .page-head > .row { width: 100%; flex-wrap: wrap; }
  .page-head select { flex: 1 1 44%; min-width: 0; }
  .fx-bar { width: 100%; flex-wrap: wrap; justify-content: space-between; }
  .fx-select { flex: 1 1 auto; min-width: 0; }

  /* las tablas se desplazan solas en vez de romper la pantalla */
  .card table, .panel table { display: block; overflow-x: auto; white-space: nowrap; }

  /* los renglones respiran y el monto no se corta */
  .renglon { flex-wrap: wrap; row-gap: 2px; }
  .renglon .txt { flex: 1 1 60%; min-width: 0; }
  .renglon .txt i { font-size: 11.5px; }
  .renglon .guia { display: none; }
  .renglon .monto, .renglon span.dual { margin-left: auto; text-align: right; }
  .renglon .acciones { opacity: 1; }

  /* --- calendario compacto ---------------------------------------------
     La cuadrícula se conserva, pero cada día muestra sólo su número y un punto
     de color. El detalle de cada día va debajo, en la lista de compromisos. */
  .cal-grid { gap: 3px; }
  .cal-cabecera { gap: 3px; margin-bottom: 4px; }
  .cal-dow { font-size: 11px; text-align: center; padding: 0 0 2px; letter-spacing: .04em; }
  .cal-dia {
    min-height: 0;
    aspect-ratio: 1;
    padding: 2px;
    align-items: center;
    justify-content: center;
    gap: 2px;
  }
  .cal-num { width: auto; height: auto; font-size: 13px; border-radius: 0; }
  .cal-dia.hoy .cal-num {
    background: var(--ink);
    color: var(--card);
    width: 22px;
    height: 22px;
    border-radius: 50%;
  }
  /* los eventos se reducen a un punto por tipo */
  .cal-eventos { flex-direction: row; gap: 2px; justify-content: center; }
  .cal-chip {
    width: 5px;
    height: 5px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: var(--muted);
  }
  .cal-chip i, .cal-chip b, .cal-chip u { display: none; }
  .cal-chip.e-vencido { background: var(--sello); }
  .cal-chip.e-proximo { background: var(--ocre); }
  .cal-chip.e-pagado { background: var(--tinta); }
  .cal-chip.e-meta { background: var(--meta-color); }
  .cal-chip.e-info { background: var(--line); }
  .cal-mas { display: none; }
  .cal-leyenda { gap: 10px 14px; font-size: 11px; margin-top: 10px; padding-top: 8px; }

  /* el botón de agregar, redondo y por encima de la barra */
  .fab {
    bottom: 72px;
    right: 14px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    padding: 0;
  }
  .fab b { display: none; }

  /* formularios de una columna */
  .cat-chips { gap: 5px; }
  .chip span { padding: 7px 10px; font-size: 12.5px; }
  .menu-agregar button { padding: 13px 12px; }
}

@media (max-width: 400px) {
  .tira-metrics { grid-template-columns: 1fr; }
  .rail button { font-size: 11px; }
  .tira-total { font-size: 25px; }
}

@media (min-width: 720px) {

  .resumen-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (min-width: 1100px) {
  .tira-grid { grid-template-columns: minmax(280px, 1fr) 1.6fr; }
  .tira-metrics { grid-template-columns: repeat(4, 1fr); }
  .panel-lateral { position: sticky; top: 20px; }
  .resumen-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (min-width: 1500px) {
  .resumen-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* ------------------------------------------------------------ utilidades
   Clases con nombre para lo que antes iba suelto en cada elemento. Además
   de leerse mejor, responden a los ajustes de teléfono y de modo oscuro. */
.sin-margen { margin: 0; }
.sin-margen-abajo { margin-bottom: 0; }
.crece { width: auto; flex: 1; min-width: 0; }
.auto { width: auto; }
.gap-s { gap: 6px; }
.entre { justify-content: space-between; }
.al-final { justify-content: flex-end; }
.mt-s { margin-top: 8px; }
.mt-m { margin-top: 12px; }
.mt-l { margin-top: 16px; }
.mt-xl { margin-top: 20px; }

@media (max-width: 719px) {
  .mt-l, .mt-xl { margin-top: 12px; }
}

/* ------------------------------------------------ métricas de la tira
   Se habían perdido al reorganizar el resumen: las etiquetas quedaban
   sin el tratamiento monoespaciado y los valores sin tamaño propio. */
.metric { min-width: 0; }
.metric .k {
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--muted);
  line-height: 1.3;
}
.metric .v {
  font-family: var(--mono);
  font-size: 17px;
  font-weight: 500;
  letter-spacing: -.03em;
  margin-top: 2px;
}
.metric .v.bad, .metric .dual.bad .dual-main { color: var(--sello); }
.metric .v.ok, .metric .dual.ok .dual-main { color: var(--tinta); }

/* estado intermedio de una meta o deuda: faltaba el color ámbar */
.meta-card.atencion { border-left-color: var(--ocre); }

/* campos que aparecen o se ocultan según el tipo de deuda */
.campo-tarjeta, .campo-prestamo { min-width: 0; }

/* la lista de compromisos del calendario, que en el teléfono es lo único visible */
.lista-cal { margin-top: 0; }

/* enlace para cambiar entre iniciar sesión y registrarse */
.cambiar-modo { text-align: center; margin: 14px 0 0; }
.cambiar-modo button {
  border: 0;
  background: none;
  color: var(--tinta);
  cursor: pointer;
  font: inherit;
  font-size: 13.5px;
  text-decoration: underline;
  padding: 8px;
}
#reg-modo { width: 100%; }
#reg-modo button { flex: 1; padding: 9px 6px; font-family: var(--body); font-size: 13px; }

/* =====================================================================
   NAVEGACIÓN DEL TELÉFONO
   Elementos propios, no adaptaciones de la barra de escritorio.
   ===================================================================== */
.cabecera-movil { display: none; }
.barra-movil { display: none; }

@media (max-width: 719px) {
  /* --- Estructura de tres franjas ---------------------------------------
     Nada usa position: fixed. La pantalla se divide en cabecera, contenido y
     barra; sólo el contenido se desplaza. Así la barra queda abajo por
     estructura, y ninguna regla de desbordamiento puede despegarla. */
  .shell {
    display: flex;
    flex-direction: column;
    height: 100dvh;
    max-height: 100dvh;
    overflow: hidden;
  }

  .cabecera-movil {
    display: block;
    flex: none;
    background: var(--card);
    border-bottom: 1px solid var(--line);
    padding: 9px 12px 8px;
  }
  .cm-fila { display: flex; align-items: center; justify-content: space-between; gap: 10px; }

  /* el nombre de la aplicación, no el del hogar: el hogar va debajo */
  .cm-marca {
    font-family: var(--display);
    font-size: 17px;
    font-weight: 600;
    letter-spacing: -.02em;
    white-space: nowrap;
  }
  .cm-marca span { color: var(--tinta); }

  .cm-acciones { display: flex; gap: 6px; flex: none; }
  .cm-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid var(--line);
    background: none;
    color: var(--muted);
    font-size: 17px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
  }
  .cm-btn.cm-primario {
    background: var(--tinta);
    border-color: var(--tinta);
    color: var(--card);
    font-size: 24px;
    font-weight: 400;
  }
  /* el signo se centra a ojo: la caja tipográfica del "+" no está centrada */
  .cm-btn.cm-primario { line-height: 36px; }

  .cm-sub {
    font-family: var(--mono);
    font-size: 10.5px;
    letter-spacing: .07em;
    text-transform: uppercase;
    color: var(--muted);
    margin-top: 3px;
    display: flex;
    gap: 6px;
    overflow: hidden;
    white-space: nowrap;
  }
  .cm-sub span + span::before { content: "· "; }
  .cm-sub span:last-child { color: var(--tinta); }

  /* sólo esta franja se desplaza */
  main {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    padding: 14px 12px 20px;
  }
  .page-head > h1 { display: none; }
  .page-head { margin-bottom: 12px; }

  /* --- barra inferior: cinco accesos, abajo por estructura --- */
  .barra-movil {
    display: flex;
    flex: none;
    background: var(--card);
    border-top: 1px solid var(--line);
    padding: 4px 2px calc(4px + env(safe-area-inset-bottom, 0px));
  }
  .barra-movil button {
    flex: 1;
    min-width: 0;
    min-height: 50px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    border: 0;
    background: none;
    border-radius: var(--r);
    cursor: pointer;
    color: var(--muted);
    padding: 5px 2px;
  }
  .barra-movil button[aria-current="true"] { color: var(--tinta); background: var(--tinta-claro); }
  .barra-movil button.on { color: var(--tinta); }
  .bm-ico { font-size: 19px; line-height: 1; }
  .bm-txt {
    font-size: 11px;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  /* el botón flotante sobra: ya está en la cabecera */
  .fab { display: none; }

}

/* detalle de los días con compromiso, debajo de la cuadrícula */
.cal-detalle {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px dashed var(--line);
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.cal-fila {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 5px 0;
  font-size: 13px;
}
.cal-fecha {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--muted);
  min-width: 40px;
}
.cal-punto { width: 7px; height: 7px; border-radius: 50%; flex: none; background: var(--muted); }
.cal-punto.e-vencido { background: var(--sello); }
.cal-punto.e-proximo { background: var(--ocre); }
.cal-punto.e-pagado { background: var(--tinta); }
.cal-punto.e-meta { background: var(--meta-color); }
.cal-punto.e-info { background: var(--line); }
.cal-nombre { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-fila .guia { flex: 1; border-bottom: 1px dotted var(--line); transform: translateY(-3px); }
.cal-monto { font-family: var(--mono); font-size: 12.5px; }

@media (max-width: 719px) {
  .cal-fila { font-size: 12.5px; gap: 6px; }
  .cal-fecha { min-width: 36px; }
}

/* el nombre del hogar, bajo el logo */
.rail .hogar-nombre {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 0 10px 14px;
  margin-top: -12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}


/* ------------------------------------------- rejilla de accesos de "Más" */
.rejilla-mas {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 7px;
  margin-top: 12px;
}
.rejilla-mas button {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-height: 76px;
  padding: 10px 6px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--card);
  cursor: pointer;
  color: var(--ink);
}
.rejilla-mas button:hover { border-color: var(--tinta); background: var(--tinta-claro); }
.rejilla-mas button.on { border-color: var(--tinta); background: var(--tinta-claro); color: var(--tinta); }
.rm-ico { font-size: 21px; line-height: 1; }
.rm-txt {
  font-size: 11.5px;
  text-align: center;
  line-height: 1.25;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* =====================================================================
   RESUMEN DEL TELÉFONO
   Bloques compactos en una columna, en orden fijo. Sólo se muestran en
   pantallas angostas: en escritorio manda la rejilla reordenable.
   ===================================================================== */
.mv-tira,
.mv-card,
.mv-aviso,
.mv-mini {
  background: var(--card);
  border: 1px solid var(--line-soft);
  border-radius: var(--r);
  padding: 11px 12px;
  margin-bottom: 8px;
}

.mv-top {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 3px;
  /* Los dos selectores se pasaban del ancho y empujaban la tarjeta fuera de
     la pantalla. Ahora se encogen y recortan el texto si hace falta. */
  min-width: 0;
}
.mv-top .mv-dia { flex: none; }
.mv-top .mv-select { flex: 1; min-width: 0; justify-content: flex-end; }
.mv-top .mv-select .falso-select {
  flex: 0 1 auto;
  min-width: 0;
  max-width: 100%;
  /* discretos, como eran antes: dentro de la tarjeta no deben competir con
     el monto, que es lo que se viene a mirar */
  min-height: 32px;
  padding: 4px 6px;
  font-size: 12.5px;
  background: none;
  border-color: transparent;
  gap: 3px;
}
.mv-top .mv-select .falso-select:hover { border-color: var(--line); }
.mv-dia {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
}
.mv-select { display: flex; gap: 4px; flex: none; }
.mv-select select {
  width: auto;
  min-height: 30px;
  padding: 3px 5px;
  font-size: 12px;
  border-color: transparent;
  background: none;
  color: var(--ink);
  font-weight: 500;
}

.mv-total { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.mv-num {
  font-family: var(--mono);
  font-size: 27px;
  font-weight: 500;
  letter-spacing: -.03em;
}
.mv-alt { font-family: var(--mono); font-size: 12.5px; color: var(--muted); }

.mv-metricas {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 10px;
  padding-top: 9px;
  border-top: 1px dashed var(--line);
}
.mv-metricas .k {
  display: block;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--muted);
}
.mv-metricas .v { display: block; font-family: var(--mono); font-size: 15px; margin-top: 1px; }
.mv-metricas .v.bad { color: var(--sello); }
.mv-metricas .v.ok { color: var(--tinta); }

.mv-presu { margin-top: 10px; }
.mv-barra {
  height: 6px;
  background: var(--line-soft);
  border-radius: 3px;
  overflow: hidden;
}
.mv-barra.chica { height: 5px; margin: 4px 0 9px; }
.mv-barra i { display: block; height: 100%; background: var(--tinta); border-radius: 3px; }
.mv-barra i.over { background: var(--sello); }
.mv-presu-txt {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 11.5px;
  color: var(--muted);
  margin-top: 4px;
}

/* aviso de lo que vence: sólo aparece si hay algo */
.mv-aviso {
  background: var(--sello-claro);
  border: 0;
  border-left: 2px solid var(--sello);
  border-radius: 0 var(--r) var(--r) 0;
}
.mv-aviso-tit {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--sello);
  margin-bottom: 5px;
}

.mv-card-cab {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 7px;
  font-size: 13.5px;
  font-weight: 600;
}
.mv-card-cab .enlace { font-size: 12px; font-weight: 400; }

.mv-fila {
  display: flex;
  align-items: baseline;
  gap: 6px;
  font-size: 13px;
  padding: 2px 0;
}
.mv-nom { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mv-fila .guia { flex: 1; border-bottom: 1px dotted var(--line); transform: translateY(-3px); }
.mv-fila .num { font-family: var(--mono); font-size: 13px; }

.mv-mov {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  font-size: 13px;
}
.mv-mov + .mv-mov { border-top: 1px solid var(--line-soft); }
.mv-ico { font-size: 15px; flex: none; }
.mv-ico.verde, .mv-mov .num.verde { color: var(--tinta); }
.mv-txt { flex: 1; min-width: 0; overflow: hidden; }
.mv-txt i {
  display: block;
  font-style: normal;
  font-size: 11.5px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mv-mov .num { font-family: var(--mono); font-size: 13px; flex: none; }

.mv-duo { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.mv-mini { margin-bottom: 8px; }
.mv-mini .k {
  display: block;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mv-mini .v { display: block; font-family: var(--mono); font-size: 19px; margin-top: 3px; }
.mv-mini .v i { font-style: normal; font-size: 11px; color: var(--muted); }

/* tabla de consumo por persona, en el panel del servidor */
.tabla-personas { width: 100%; font-size: 13px; }
.tabla-personas th {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 400;
  padding: 4px 6px;
  border-bottom: 1px solid var(--line);
}
.tabla-personas td { padding: 7px 6px; border-bottom: 1px solid var(--line-soft); }
.tabla-personas tr:last-child td { border-bottom: 0; }
.tabla-personas .num { font-family: var(--mono); text-align: right; }
.tabla-personas i.sub {
  display: block;
  font-style: normal;
  font-size: 11px;
  color: var(--muted);
}

/* selección de hojas al exportar */
.hojas-lista { display: flex; flex-direction: column; gap: 5px; }
.hoja {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  cursor: pointer;
}
.hoja:hover { border-color: var(--tinta); }
.hoja input { width: auto; margin: 0; flex: none; }
.hoja b { display: block; font-size: 13.5px; font-weight: 500; }
.hoja i { display: block; font-style: normal; font-size: 11.5px; color: var(--muted); }
.hoja.vacia { opacity: .6; }

/* ---------------------------------------------------- selector propio
   Reemplaza al <select> nativo en las listas largas. La ventana nativa del
   sistema no se puede estilar: en el teléfono sale blanca, con la letra del
   sistema y sin relación con el tema de la aplicación. */
.falso-select {
  width: 100%;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--card);
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  cursor: pointer;
  text-align: left;
}
.falso-select:hover { border-color: var(--muted); }
.falso-select span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.falso-select i { font-style: normal; color: var(--muted); flex: none; }

.selector { max-width: 420px; width: 100%; padding: 0; overflow: hidden; }
.sel-cab {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px 10px;
  border-bottom: 1px solid var(--line);
}
.sel-cab h2 { margin: 0; }
.sel-buscar {
  margin: 10px 14px;
  width: calc(100% - 28px);
}
.sel-lista { max-height: 58dvh; overflow-y: auto; padding: 6px; }
.sel-grupo {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 10px 10px 4px;
}
.sel-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 46px;
  padding: 8px 10px;
  border: 0;
  border-radius: var(--r);
  background: none;
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  cursor: pointer;
  text-align: left;
}
.sel-item:hover { background: var(--line-soft); }
.sel-item.on { background: var(--tinta-claro); color: var(--tinta); font-weight: 600; }
.sel-ico { font-size: 18px; flex: none; width: 24px; text-align: center; }
.sel-txt { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.sel-txt i { display: block; font-style: normal; font-size: 11.5px; color: var(--muted); }
.sel-tick { color: var(--tinta); flex: none; }

@media (max-width: 719px) {
  .selector { max-height: 88dvh; }
  .sel-lista { max-height: 62dvh; }
}

/* pagos fijos por confirmar */
.fijo-pend,
.fijo-fila {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line-soft);
}
.fijo-pend:last-child, .fijo-fila:last-child { border-bottom: 0; }
.fijo-pend.vencido .fijo-datos b { color: var(--sello); }
.fijo-fila.pausado { opacity: .55; }
.fijo-ico { font-size: 19px; flex: none; width: 26px; text-align: center; }
.fijo-datos { flex: 1; min-width: 0; }
.fijo-datos b { display: block; font-size: 14px; font-weight: 500; }
.fijo-datos i {
  display: block;
  font-style: normal;
  font-size: 11.5px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.fijo-monto {
  width: 118px;
  min-height: 38px;
  flex: none;
  text-align: right;
  font-family: var(--mono);
}

/* el título del aviso, con su acción a la derecha */
.mv-aviso-tit {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

@media (max-width: 719px) {
  .fijo-pend { flex-wrap: wrap; }
  .fijo-pend .fijo-datos { flex: 1 1 100%; order: -1; }
  .fijo-monto { width: 100px; }
}

/* deudas entre personas */
.pd-item {
  padding: 11px 0;
  border-bottom: 1px solid var(--line-soft);
}
.pd-item:last-child { border-bottom: 0; }
.pd-item.saldada { opacity: .6; }
.pd-item .rubro-bar { margin-top: 6px; }
.g-full { grid-column: 1 / -1; }

/* El <select> real queda en el documento pero fuera de la vista: conserva el
   envío del formulario y sus manejadores, sin mostrar la ventana del sistema. */
.select-oculto {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}
.falso-select.auto {
  width: auto;
  min-height: 36px;
  padding: 5px 9px;
  font-size: 13px;
  background: none;
  border-color: transparent;
  color: var(--ink);
}
.falso-select.auto:hover { border-color: var(--line); }
.falso-select:disabled { opacity: .5; cursor: default; }

/* el enlace de "ver" junto al título de una métrica */
.metric .k .enlace { margin-left: 7px; font-size: 11px; }

/* Las cifras del calendario en una sola tira: el calendario es lo que importa,
   antes ocupaban cuatro tarjetas altas y lo empujaban fuera de la pantalla. */
.cal-cifras {
  display: flex;
  gap: 6px;
  margin-bottom: 12px;
}
.cal-cifras span {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--card);
}
.cal-cifras i {
  font-style: normal;
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cal-cifras b {
  font-size: 15px;
  font-weight: 600;
  font-family: var(--mono);
}
.cal-cifras .alerta b { color: var(--sello); }

@media (max-width: 719px) {
  .cal-cifras { flex-wrap: wrap; gap: 5px; }
  .cal-cifras span { flex: 1 1 calc(50% - 3px); padding: 6px 8px; }
  .cal-cifras b { font-size: 14px; }
}

/* El botón de agregar en la barra inferior, al alcance del pulgar.
   Va con el selector completo (.barra-movil .bm-agregar) porque la regla
   general de los botones de la barra, más específica, le quitaba el fondo. */
.barra-movil .bm-agregar {
  /* Pequeño y al extremo derecho: no es navegación, es una acción. */
  flex: none;
  width: 40px;
  min-width: 40px;
  height: 40px;
  min-height: 40px;
  align-self: center;
  margin: 0 6px 0 2px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  /* Ocre y no el verde de la aplicación: ese verde es el de los enlaces y el
     del acceso activo, y el botón se confundía con la navegación. */
  background: var(--ocre);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .25);
}
.barra-movil .bm-agregar .ico { width: 22px; height: 22px; stroke-width: 2.25; }
.barra-movil .bm-agregar:active { transform: scale(.94); }
/* En oscuro el ocre es más claro, y el trazo blanco encima se leía mal. */
[data-tema="oscuro"] .barra-movil .bm-agregar,
[data-tema="oscuro"] .barra-movil .bm-agregar:hover { color: #2a1f08; }
@media (prefers-color-scheme: dark) {
  html:not([data-tema="claro"]) .barra-movil .bm-agregar { color: #2a1f08; }
}

/* ------------------------------------------------- íconos (Tabler) y banderas
   Los íconos son SVG en línea y toman el color del texto que los rodea. */
.ico {
  width: 1.15em;
  height: 1.15em;
  vertical-align: -.22em;
  flex: none;
  display: inline-block;
}
.bm-ico .ico { width: 22px; height: 22px; vertical-align: 0; }
.rm-ico .ico { width: 24px; height: 24px; vertical-align: 0; }
.rail button .ico { width: 18px; height: 18px; margin-right: 6px; }
.cm-btn .ico, .tema button .ico { width: 18px; height: 18px; vertical-align: 0; }
.mv-ico .ico, .fijo-ico .ico, .renglon .emoji .ico, .sel-ico .ico { width: 20px; height: 20px; vertical-align: 0; }
.rubro-ico { display: inline-flex; color: var(--muted); }
.rubro-ico .ico { width: 18px; height: 18px; }
.menu-agregar .ico { width: 22px; height: 22px; }
.emoji-cat { font-size: 15px; }
h2 .ico, .panel-cab .ico, .k .ico { color: var(--muted); }
.btn .ico { vertical-align: -.2em; }
.icon-btn .ico { width: 16px; height: 16px; vertical-align: 0; }

.bandera {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  object-fit: cover;
  vertical-align: -.3em;
  flex: none;
  box-shadow: 0 0 0 1px var(--line);
  background: var(--line-soft);
}
.sel-ico .bandera { width: 24px; height: 24px; vertical-align: 0; }
.falso-select .bandera { vertical-align: -.35em; margin-right: 2px; }

/* Botón de ícono en el editor de categorías */
.ico-cat {
  width: 34px;
  height: 34px;
  flex: none;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
  color: var(--ink);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.ico-cat:hover { border-color: var(--tinta); color: var(--tinta); }
.ico-cat .ico { width: 18px; height: 18px; vertical-align: 0; }

/* Selector en rejilla, para elegir un ícono */
.sel-rejilla { display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 6px; }
.sel-rejilla .sel-item { flex-direction: column; justify-content: center; padding: 10px 4px; gap: 4px; text-align: center; }
.sel-rejilla .sel-ico { width: auto; }
.sel-rejilla .sel-ico .ico { width: 24px; height: 24px; }
.sel-rejilla .sel-txt { font-size: 10.5px; color: var(--muted); }
.sel-rejilla .sel-tick { display: none; }

/* Formulario de deudas: corto, con lo demás plegado */
.form-deuda .seg { margin-bottom: 14px; }
.form-deuda .seg button { flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px; }
.form-deuda .seg button .ico { width: 16px; height: 16px; vertical-align: 0; }
.mas-opciones { border-top: 1px dashed var(--line); padding-top: 10px; margin: 4px 0 14px; }
.mas-opciones > summary {
  cursor: pointer;
  list-style: none;
  font-size: 13px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 0;
}
.mas-opciones > summary::-webkit-details-marker { display: none; }
.mas-opciones > summary .ico { transition: transform .15s; }
.mas-opciones[open] > summary .ico { transform: rotate(180deg); }

/* El monto y su moneda van siempre en el mismo renglón: al permitir el salto,
   la segunda moneda caía sola a la línea de abajo. */
.fila-monto { flex-wrap: nowrap; }
.fila-monto .moneda-op { flex: none; }

/* Los campos de una rejilla no se encogen por sí solos: su ancho mínimo es el
   de su contenido, así que un texto largo ensancha la columna y la ventana
   termina con desplazamiento horizontal. */
.modal .grid > *,
.modal label.field,
.modal .falso-select { min-width: 0; }
.modal { overflow-x: hidden; }

/* ------------------------------------------------- pantalla de entrada
   Detrás del formulario se ve una muestra de la aplicación, borrosa y quieta,
   para que quien llega por primera vez entienda de qué se trata antes de
   crear la cuenta. Es decorativa: no lleva datos reales. */
.login-wrap { position: relative; overflow: hidden; }

.login-fondo {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  filter: blur(2.5px);
  opacity: .32;
  overflow: hidden;
}
.lf-panel {
  position: absolute;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 16px 18px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.lf-a { top: 8%; left: 4%; width: 300px; }
.lf-b { bottom: 10%; left: 8%; width: 320px; }
.lf-c { top: 22%; right: 5%; width: 290px; }

.lf-eyebrow {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
}
.lf-num { font-family: var(--display); font-size: 30px; letter-spacing: -.02em; }
.lf-barras { display: flex; align-items: flex-end; gap: 6px; height: 64px; }
.lf-barras i { flex: 1; background: var(--tinta); opacity: .55; border-radius: 2px 2px 0 0; }
.lf-fila { display: flex; align-items: baseline; gap: 8px; font-size: 13px; }
.lf-fila i { flex: 1; border-bottom: 1px dotted var(--line); }
.lf-fila b { font-family: var(--mono); font-size: 12.5px; font-weight: 500; }

.login-idioma {
  position: absolute;
  top: 18px;
  right: 18px;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 38px;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}
.login-idioma:hover { border-color: var(--muted); }

/* El formulario, por encima del fondo y más ancho: el registro tiene dos
   columnas de campos y a 420px quedaban apretadas. */
.login-card { position: relative; z-index: 2; }
#registro-form { max-width: 570px; }

@media (max-width: 719px) {
  .login-fondo { display: none; }
  .login-idioma { top: 12px; right: 12px; }
}
