/* Nunito (variable, pesos 200-1000), servida desde este mismo sitio.
   Nunito: Copyright 2014 The Nunito Project Authors. Licencia SIL Open Font License 1.1. */
@font-face {
  font-family: 'Nunito'; font-style: normal; font-weight: 200 1000; font-display: swap;
  src: url(nunito-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Nunito'; font-style: normal; font-weight: 200 1000; font-display: swap;
  src: url(nunito-latin-ext.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* ---------- Colores (diseño "ciruela y lago", dic. 2026) ---------- */
:root {
  --bg: #F9F1ED;
  --sky: #F9EDE8;            /* el cielo de arriba de la foto: barra de estado y bordes */
  --surface: #FFFCFA;
  --surface-2: #F6EAE5;
  --ink: #2A1D24;
  --muted: #85717B;
  --line: #EFDFD9;
  --accent: #752B49;         /* ciruela: botones y lo elegido */
  --accent-2: #9C4461;
  --accent-ink: #752B49;     /* texto en color de acento */
  --accent-soft: #F7E3E6;
  --on-accent: #FFFFFF;
  --peach-soft: #FAE6D8;
  --fab-1: #EC939C;
  --fab-2: #C9556F;
  --pos: #55701A;
  --pos-soft: #EEF1DC;
  --neg: #B5482F;
  --neg-soft: #F9E2DA;
  --shadow: 0 1px 2px rgba(117, 43, 73, .05), 0 10px 30px rgba(117, 43, 73, .08);
  --shadow-lg: 0 2px 6px rgba(117, 43, 73, .08), 0 18px 40px rgba(117, 43, 73, .14);
  --radius: 22px;
  --tabbar-h: 66px;
  --serif: "Nunito", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --sans: "Nunito", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  /* Integrantes */
  --p-olive: #8F8A34;
  --p-terra: #D9714F;
  --p-ochre: #E5A12E;
  --p-teal: #3E8F98;
  --p-plum: #8E4E86;
  --p-pine: #3D8069;
  --p-rose: #C7577C;
  --p-slate: #6A7F99;
  --p-sky: #4A8FC4;
  /* Categorías (orden fijo, validado para daltonismo) */
  --cat-alojamiento: #8E2F55;
  --cat-comida: #EE7A62;
  --cat-combustible: #1C9CAB;
  --cat-salidas: #E8A81C;
  --cat-otros: #7A64C8;
  --cat-super: #5F9C34;
  --hero-dim: none;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1A1418;
    --sky: #1A1418;
    --surface: #241C21;
    --surface-2: #30262C;
    --ink: #F6ECEF;
    --muted: #B8A5AE;
    --line: #3A2F35;
    --accent: #B04A72;
    --accent-2: #C25A82;
    --accent-ink: #F2A0BE;
    --accent-soft: #3A2430;
    --on-accent: #FFFFFF;
    --peach-soft: #3D2C27;
    --fab-1: #D9708A;
    --fab-2: #A93E62;
    --pos: #AECB6E;
    --pos-soft: #2D3320;
    --neg: #F2937C;
    --neg-soft: #43271F;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 28px rgba(0, 0, 0, .28);
    --shadow-lg: 0 2px 6px rgba(0, 0, 0, .35), 0 18px 40px rgba(0, 0, 0, .4);
    --p-olive: #9C9A48;
    --p-terra: #D9714F;
    --p-ochre: #D29520;
    --p-teal: #3A97A1;
    --p-plum: #9C62A0;
    --p-pine: #3F8C72;
    --p-rose: #C9628A;
    --p-slate: #6F86A2;
    --p-sky: #4C93CC;
    --cat-alojamiento: #DA5FA0;
    --cat-comida: #E87838;
    --cat-combustible: #1C9CAB;
    --cat-salidas: #C99318;
    --cat-otros: #9583E6;
    --cat-super: #3F9F45;
    --hero-dim: brightness(.62) saturate(.9);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: var(--bg); }
body {
  margin: 0;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.45 var(--sans);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
[hidden] { display: none !important; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent-ink); outline-offset: 2px; border-radius: 10px; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
h1, h2, p { margin: 0; }

.muted { color: var(--muted); margin: 0; }
.small { font-size: 14px; }
.center { text-align: center; }
.display { font-family: var(--serif); font-weight: 800; font-size: 32px; letter-spacing: -.01em; margin: 18px 0 6px; line-height: 1.15; }

/* Arranque */
.boot { position: fixed; inset: 0; display: grid; place-items: center; }
.spinner { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--accent-ink); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Pantallas de ingreso / quién sos ---------- */
.screen { position: relative; min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 32px 22px calc(32px + env(safe-area-inset-bottom)); }
.screen-art { /* sólo la parte izquierda de la foto: montañas, lago y lupinos */
  position: absolute; top: 0; left: 50%; transform: translateX(-50%); width: min(100%, 540px); height: min(58vw, 313px); pointer-events: none;
  background: url(paisaje.webp) 0 100% / 175% auto no-repeat; filter: var(--hero-dim);
  -webkit-mask-image: linear-gradient(to bottom, #000 45%, transparent);
  mask-image: linear-gradient(to bottom, #000 45%, transparent);
  opacity: .9;
}
@media (min-width: 560px) { /* en pantallas anchas la foto se funde también a los costados */
  .screen-art {
    -webkit-mask-image: linear-gradient(to bottom, #000 45%, transparent), linear-gradient(to right, transparent, #000 14%, #000 86%, transparent);
    -webkit-mask-composite: source-in;
    mask-image: linear-gradient(to bottom, #000 45%, transparent), linear-gradient(to right, transparent, #000 14%, #000 86%, transparent);
    mask-composite: intersect;
  }
}
.screen-inner { position: relative; width: 100%; max-width: 380px; text-align: center; padding-top: min(30vw, 120px); }
.logo-lg { width: 80px; height: 80px; margin: 0 auto; border-radius: 24px; background: url(icon.svg) center/cover; box-shadow: var(--shadow-lg); }
.login-form { margin-top: 28px; text-align: left; display: grid; gap: 10px; }
.input-code { text-align: center; font-size: 22px; letter-spacing: .12em; font-variant-numeric: tabular-nums; }
.who-list { display: grid; gap: 12px; margin-top: 26px; }
.who-option {
  display: flex; align-items: center; gap: 14px; width: 100%;
  padding: 14px 16px; border-radius: 18px; border: 1px solid var(--line);
  background: var(--surface); box-shadow: var(--shadow); font-size: 18px; font-weight: 700; text-align: left;
  transition: transform .12s ease;
}
.who-option:active { transform: scale(.98); }

/* ---------- Estructura de la app ---------- */
.app { max-width: 540px; margin: 0 auto; padding-bottom: calc(var(--tabbar-h) + 34px + env(safe-area-inset-bottom)); }
.wrap { padding: 0 14px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); min-width: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; min-height: 34px; }
.card-title, .section-title { font-family: var(--serif); font-weight: 800; font-size: 19px; letter-spacing: -.01em; margin: 0 0 10px; display: flex; align-items: center; gap: 8px; min-width: 0; }
.card-head .card-title { margin: 0; }
.card-title svg { width: 22px; height: 22px; color: var(--accent-ink); }

/* ---------- Encabezado con el paisaje ---------- */
.hero { padding-top: env(safe-area-inset-top); background: var(--sky); }
.hero-art {
  position: relative; container-type: inline-size; aspect-ratio: 852 / 284;
  background: url(paisaje.webp) center / 100% 100% no-repeat;
}
.hero-art::before { /* en modo oscuro la foto se apaga un poco */
  content: ""; position: absolute; inset: 0; background: inherit; filter: var(--hero-dim); pointer-events: none;
}
.hero-art::after { /* la foto se funde con el fondo */
  content: ""; position: absolute; inset: auto 0 0; height: 34%; pointer-events: none;
  background: linear-gradient(to bottom, transparent, var(--bg));
}
/* Fila de arriba: marca a la izquierda y la persona a la derecha, sobre la pastilla dibujada en la foto */
.hero-row { position: absolute; z-index: 1; left: 4.9cqw; right: 4.6cqw; top: 4.4cqw; display: flex; align-items: flex-start; gap: 8px; }
.brand { flex: 1; display: flex; align-items: center; gap: 2.8cqw; min-width: 0; }
.logo-sm { width: 10.2cqw; height: 10.2cqw; border-radius: 2.8cqw; background: url(icon.svg) center/cover; flex: none; box-shadow: 0 4px 14px rgba(117, 43, 73, .25); }
.brand-text { min-width: 0; }
.brand-title { font-family: var(--serif); font-weight: 800; font-size: max(19px, 5.2cqw); line-height: 1.1; letter-spacing: -.015em; color: var(--ink); }
.brand-sub { font-size: max(13px, 3.15cqw); color: var(--accent-ink); font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 1px; }
.who-chip {
  flex: none; margin-top: 1.3cqw; height: 7.8cqw; min-height: 36px; min-width: 27.7cqw; max-width: 46cqw;
  display: inline-flex; align-items: center; gap: 2cqw; padding: 0 3cqw 0 .9cqw;
  border-radius: 999px; border: 0; background: var(--surface); box-shadow: 0 6px 18px rgba(117, 43, 73, .14);
  font-weight: 800; font-size: max(14.5px, 3.7cqw);
}
.who-chip > span:not(.avatar) { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: left; }
.who-chip .avatar { width: 6.3cqw; height: 6.3cqw; min-width: 28px; min-height: 28px; font-size: max(13px, 3cqw); }
.who-chip svg { width: 16px; height: 16px; color: var(--ink); stroke-width: 2.2; }
.who-chip:disabled { cursor: default; opacity: 1; }
@supports not (container-type: inline-size) {
  .hero-row { left: 18px; right: 16px; top: 16px; }
  .brand { gap: 10px; }
  .logo-sm { width: 40px; height: 40px; border-radius: 11px; }
  .who-chip { margin-top: 4px; height: 36px; min-width: 110px; padding: 0 12px 0 4px; gap: 8px; }
}
.wrap-home { margin-top: -3.5cqw; position: relative; z-index: 2; }
@supports not (container-type: inline-size) { .wrap-home { margin-top: -14px; } }
.app { container-type: inline-size; }

/* ---------- Página de cada sección ---------- */
.page-head {
  position: relative; padding: calc(env(safe-area-inset-top) + 26px) 20px 18px; margin-bottom: 4px; overflow: hidden;
  background: var(--sky);
}
.page-head::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: url(paisaje.webp) 0 100% / 170% auto no-repeat; filter: var(--hero-dim);
}
/* velo: la foto se ve a la derecha y abajo, y el título queda sobre un fondo calmo */
.page-head::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(to bottom, transparent 50%, var(--bg) 100%),
    linear-gradient(90deg, color-mix(in srgb, var(--sky) 88%, transparent) 0%, color-mix(in srgb, var(--sky) 70%, transparent) 50%, color-mix(in srgb, var(--sky) 15%, transparent) 100%);
}
.page-title { position: relative; z-index: 1; text-shadow: 0 1px 16px var(--sky); font-family: var(--serif); font-weight: 800; font-size: 30px; letter-spacing: -.02em; line-height: 1.15; }
.page-sub { position: relative; z-index: 1; color: var(--accent-ink); font-weight: 650; font-size: 15px; margin-top: 2px; }

/* ---------- Total gastado ---------- */
.total-card {
  position: relative; overflow: hidden; color: #fff; border-radius: 26px; padding: 18px 18px 16px;
  background: linear-gradient(112deg, #6E3A50 0%, #8C5469 34%, #B98494 62%, #E6C2BA 100%);
  box-shadow: 0 14px 34px rgba(117, 43, 73, .26);
  isolation: isolate;
}
.total-card::before {
  content: ""; position: absolute; z-index: -1; right: 0; bottom: 0; width: 64%; height: 100%;
  background: url(paisaje-total.webp) right bottom / cover no-repeat;
  -webkit-mask-image: linear-gradient(to right, transparent 0%, #000 42%);
  mask-image: linear-gradient(to right, transparent 0%, #000 42%);
}
.total-card::after { /* velo para que el texto se lea sobre la foto */
  content: ""; position: absolute; z-index: -1; inset: 0;
  background: linear-gradient(100deg, rgba(90, 40, 62, .35) 0%, rgba(90, 40, 62, .12) 55%, transparent 75%);
}
.total-label { font-weight: 800; font-size: 19px; text-shadow: 0 1px 8px rgba(60, 20, 40, .25); }
.total-amount {
  font-family: var(--serif); font-weight: 900; font-size: clamp(28px, 11.5cqw, 52px); letter-spacing: -.025em; line-height: 1.08;
  margin: 4px 0 12px; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; text-shadow: 0 2px 14px rgba(60, 20, 40, .28);
}
.total-label { padding-right: 52px; }
.total-chip {
  display: inline-flex; align-items: center; gap: 9px; max-width: 100%;
  padding: 7px 14px 7px 11px; border-radius: 999px; font-weight: 700; font-size: 14.5px; font-variant-numeric: tabular-nums;
  background: rgba(255, 255, 255, .2); border: 1px solid rgba(255, 255, 255, .28);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
}
.total-chip span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.total-chip svg { width: 19px; height: 19px; }
.total-report {
  position: absolute; top: 14px; right: 14px; width: 44px; height: 44px; border-radius: 15px; display: grid; place-items: center;
  border: 1px solid rgba(255, 255, 255, .5); background: rgba(255, 255, 255, .55); color: #fff;
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); box-shadow: 0 4px 14px rgba(60, 20, 40, .12);
}
.total-report svg { width: 23px; height: 23px; stroke-width: 2.2; }
.total-report:active { transform: scale(.95); }

/* ---------- Lugar actual + Saldos ---------- */
.duo { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; align-items: stretch; }
@container (max-width: 360px) { .duo { grid-template-columns: minmax(0, 1fr); } }
.duo .card { padding: 13px 12px 10px; }
.duo .card-head { margin-bottom: 10px; }
.duo .card-title { font-size: 16px; gap: 5px; white-space: nowrap; }
.duo .card-title svg { width: 20px; height: 20px; }
.icon-btn.soft { width: 32px; height: 32px; border-radius: 10px; background: var(--peach-soft); color: var(--accent-ink); }
.icon-btn.soft svg { width: 19px; height: 19px; stroke-width: 2.2; }
.place-list { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }
.place-pill {
  display: flex; align-items: center; gap: 6px; width: 100%; min-width: 0; min-height: 40px; padding: 7px 10px;
  border-radius: 20px; border: 1px solid var(--line); background: var(--surface); text-align: left;
  font-weight: 700; font-size: 14px; line-height: 1.2; transition: background .12s ease;
}
.place-pill span { flex: 1; min-width: 0; overflow: hidden; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow-wrap: anywhere; }
.place-pill svg { width: 18px; height: 18px; color: var(--muted); }
.place-pill[aria-pressed="true"] { background: var(--accent); border-color: transparent; color: var(--on-accent); box-shadow: 0 6px 16px color-mix(in srgb, var(--accent) 30%, transparent); }
.place-pill[aria-pressed="true"] svg { color: currentColor; }
.place-pill:active { transform: scale(.98); }
.status-chip {
  flex: none; border: 0; border-radius: 999px; padding: 4px 10px; font-size: 12.5px; font-weight: 800; white-space: nowrap;
  background: var(--peach-soft); color: var(--ink);
}
.status-chip.pending { background: var(--neg-soft); color: var(--neg); }
.bal-mini { list-style: none; margin: 0; padding: 0; }
.bal-mini li + li { border-top: 1px solid var(--line); }
.bal-mini button {
  display: flex; align-items: center; gap: 7px; width: 100%; min-height: 52px; padding: 7px 0; border: 0; background: transparent; text-align: left;
}
.bal-mini button:active { opacity: .7; }
.bal-mini .avatar { width: 32px; height: 32px; font-size: 14px; }
.bm-main { flex: 1; min-width: 0; display: grid; line-height: 1.2; }
.bm-name { font-weight: 800; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bm-amt { font-weight: 800; font-size: 14px; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bm-amt.pos { color: var(--pos); }
.bm-amt.neg { color: var(--neg); }
.bm-amt.zero { color: var(--muted); font-weight: 700; }
.bal-mini .chev { width: 14px; height: 14px; color: var(--muted); stroke-width: 2.4; }
.bm-more { font-size: 13.5px; font-weight: 700; color: var(--accent-ink); justify-content: center; }

/* ---------- Gastos por categoría ---------- */
.cat-card { display: grid; grid-template-columns: 124px minmax(0, 1fr); gap: 14px; align-items: center; padding: 16px 16px 16px 14px; }
@container (max-width: 340px) { .cat-card { grid-template-columns: 1fr; justify-items: center; } .cat-side { width: 100%; } }
.cat-card .card-head { margin-bottom: 6px; }
.cat-card .card-title { font-size: 17px; line-height: 1.2; }
.cat-donut { position: relative; width: 124px; height: 124px; }
.cat-donut svg.ring { width: 124px; height: 124px; stroke: none; }
.cat-donut .slice { stroke: var(--surface); stroke-width: 2; stroke-linejoin: round; }
.cat-donut .ring-empty { fill: var(--surface-2); }
.cat-center { position: absolute; inset: 0; display: grid; place-items: center; color: var(--accent-ink); pointer-events: none; }
.cat-center svg { width: 32px; height: 32px; stroke-width: 1.7; }
.chev-btn { width: 32px; height: 32px; border: 0; border-radius: 10px; background: transparent; color: var(--accent-ink); display: grid; place-items: center; }
.chev-btn svg { stroke-width: 2.3; }
.cat-legend { list-style: none; margin: 0; padding: 0; display: grid; gap: 5px; }
.cat-legend li { display: grid; grid-template-columns: 13px minmax(0, 1fr) auto; align-items: center; column-gap: 9px; font-size: 15px; }
.cat-legend .dot { width: 13px; height: 13px; border-radius: 50%; }
.cat-legend .lg-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
.cat-legend .lg-pct { font-weight: 700; font-variant-numeric: tabular-nums; }
.cat-legend li.cat-empty { display: block; color: var(--muted); font-size: 14.5px; }

/* ---------- Para quedar a mano ---------- */
.settle-card { background: var(--accent-soft); border-radius: var(--radius); padding: 16px; border: 1px solid color-mix(in srgb, var(--accent) 10%, transparent); }
.settle-head { display: flex; align-items: center; gap: 14px; }
.settle-icon { flex: none; color: var(--accent-ink); }
.settle-icon svg { width: 38px; height: 38px; stroke-width: 1.5; }
.settle-text { flex: 1; min-width: 0; }
.settle-title { font-weight: 800; font-size: 19px; letter-spacing: -.01em; }
.settle-sub { color: var(--ink); opacity: .85; font-size: 15px; margin-top: 1px; }
.settle-ok { flex: none; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: var(--accent); color: var(--on-accent); box-shadow: 0 6px 14px color-mix(in srgb, var(--accent) 35%, transparent); }
.settle-ok svg { width: 22px; height: 22px; stroke-width: 2.8; }
.settle-card .transfers:not(:empty) { margin-top: 12px; background: var(--surface); border-radius: 16px; padding: 4px 12px; }

.balances, .transfers { list-style: none; margin: 0; padding: 0; }
.tr { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); }
.tr:first-child { border-top: 0; }
.tr-avs { display: flex; align-items: center; flex: none; }
.tr-avs .avatar { width: 30px; height: 30px; font-size: 13px; box-shadow: 0 0 0 2px var(--surface); }
.tr-avs .avatar + .avatar { margin-left: -8px; }
.tr-text { flex: 1; min-width: 0; display: grid; line-height: 1.25; }
.tr-who { font-size: 13.5px; color: var(--muted); font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tr-text strong { font-variant-numeric: tabular-nums; font-size: 16px; font-weight: 800; }
.tr .btn-sm { min-height: 34px; padding: 6px 12px; font-size: 13.5px; }
.empty { color: var(--muted); font-size: 15px; margin: 2px 0; }

/* Botón grande */
.btn-big {
  display: flex; align-items: center; justify-content: center; gap: 12px; width: calc(100% - 28px); margin: 6px auto 0;
  min-height: 60px; border-radius: 999px; font-size: 19px; font-weight: 800;
  background: linear-gradient(180deg, var(--accent-2), var(--accent)); box-shadow: 0 12px 26px color-mix(in srgb, var(--accent) 34%, transparent);
}
.btn-big svg { width: 26px; height: 26px; stroke-width: 2.4; }

/* ---------- Saldos (sección) ---------- */
.bal { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-top: 1px solid var(--line); }
.bal:first-child { border-top: 0; padding-top: 2px; }
.bal:last-child { padding-bottom: 2px; }
.bal-main { flex: 1; min-width: 0; }
.bal-name { font-weight: 800; font-size: 16px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bal-detail { color: var(--muted); font-size: 13.5px; font-variant-numeric: tabular-nums; }
.bal-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.bal-detail span { white-space: nowrap; }
.badge { font-size: 13.5px; font-weight: 750; padding: 4px 10px; border-radius: 999px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.badge.pos { background: var(--pos-soft); color: var(--pos); }
.badge.neg { background: var(--neg-soft); color: var(--neg); }
.badge.zero { background: var(--surface-2); color: var(--muted); }
.actions-col { display: grid; gap: 10px; }
.actions-col .btn-block { margin-top: 0; }

/* ---------- Ajustes ---------- */
.menu { padding: 6px 6px; }
.menu-label { font-size: 12.5px; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: .07em; padding: 10px 12px 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu-row {
  display: flex; align-items: center; gap: 13px; width: 100%; min-height: 62px; padding: 9px 10px; border: 0; border-radius: 16px;
  background: transparent; text-align: left; color: inherit; text-decoration: none;
}
.menu-row:active { background: var(--surface-2); }
.menu-row + .menu-row { position: relative; }
.menu-row + .menu-row::before { content: ""; position: absolute; top: 0; left: 62px; right: 10px; border-top: 1px solid var(--line); }
.menu-ico { flex: none; width: 40px; height: 40px; border-radius: 13px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-ink); }
.menu-ico svg { width: 21px; height: 21px; }
.menu-ico.plain { background: transparent; }
.menu-ico.plain .avatar { width: 40px; height: 40px; font-size: 17px; }
.menu-text { flex: 1; min-width: 0; display: grid; line-height: 1.25; }
.menu-title { font-weight: 750; font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu-sub { font-size: 13.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu-chev { width: 18px; height: 18px; color: var(--muted); stroke-width: 2.2; }
.menu-row[aria-pressed="true"] .menu-chev { color: var(--accent-ink); }
.btn-quiet { display: flex; align-items: center; justify-content: center; gap: 9px; background: transparent; color: var(--neg); }
.btn-quiet svg { width: 19px; height: 19px; }

/* ---------- Barra de abajo ---------- */
.tabbar {
  position: fixed; z-index: 10; left: 0; right: 0; bottom: 0; margin: 0 auto; max-width: 540px;
  display: grid; grid-template-columns: 1fr 1fr 72px 1fr 1fr; align-items: end;
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); padding: 0 6px env(safe-area-inset-bottom);
  background: color-mix(in srgb, var(--surface) 90%, transparent);
  -webkit-backdrop-filter: saturate(1.5) blur(16px); backdrop-filter: saturate(1.5) blur(16px);
  border-top: 1px solid color-mix(in srgb, var(--line) 80%, transparent);
  box-shadow: 0 -6px 24px rgba(117, 43, 73, .07);
  border-radius: 22px 22px 0 0;
}
.tab-btn {
  height: var(--tabbar-h); border: 0; background: transparent; color: var(--muted);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  font-size: 11.5px; font-weight: 750; letter-spacing: -.005em; min-width: 0; padding: 0 1px;
}
.tab-btn span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.tab-btn svg { width: 25px; height: 25px; stroke-width: 1.8; }
.tab-btn[aria-current="page"] { color: var(--accent-ink); }
.tab-btn[aria-current="page"] svg { stroke-width: 2.2; fill: color-mix(in srgb, var(--accent) 16%, transparent); }
.tab-add {
  justify-self: center; align-self: start; margin-top: -22px; width: 64px; height: 64px; border-radius: 50%; border: 4px solid var(--bg);
  display: grid; place-items: center; color: #fff;
  background: linear-gradient(160deg, var(--fab-1), var(--fab-2));
  box-shadow: 0 10px 22px color-mix(in srgb, var(--fab-2) 42%, transparent);
}
.tab-add svg { width: 28px; height: 28px; stroke-width: 2.6; }
.tab-add:active { transform: scale(.95); }
@media (max-width: 350px) { .tab-btn { font-size: 10px; } .tabbar { grid-template-columns: 1fr 1fr 66px 1fr 1fr; padding-left: 2px; padding-right: 2px; } }

/* ---------- Avatares ---------- */
.avatar {
  width: 34px; height: 34px; border-radius: 50%; display: inline-grid; place-items: center; flex: none;
  font-weight: 800; font-size: 15px; color: #fff; text-shadow: 0 1px 2px rgba(0, 0, 0, .15);
  background: radial-gradient(circle at 32% 26%, rgba(255, 255, 255, .32), transparent 62%), var(--pc, var(--p-olive));
}
.avatar.sm { width: 26px; height: 26px; font-size: 12.5px; }
.avatar.lg { width: 44px; height: 44px; font-size: 18px; }
[data-c="olive"] { --pc: var(--p-olive); }
[data-c="terra"] { --pc: var(--p-terra); }
[data-c="ochre"] { --pc: var(--p-ochre); }
[data-c="teal"] { --pc: var(--p-teal); }
[data-c="plum"] { --pc: var(--p-plum); }
[data-c="pine"] { --pc: var(--p-pine); }
[data-c="rose"] { --pc: var(--p-rose); }
[data-c="slate"] { --pc: var(--p-slate); }
[data-c="sky"] { --pc: var(--p-sky); }

/* ---------- Movimientos ---------- */
.day-list { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.mov-row { display: flex; align-items: stretch; border-top: 1px solid var(--line); }
.mov-row:first-child { border-top: 0; }
.mov {
  display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; text-align: left;
  padding: 12px 6px 12px 14px; border: 0; background: transparent;
}
.mov:active { background: var(--surface-2); }
.mov-del { flex: none; width: 46px; border: 0; background: transparent; color: var(--muted); display: grid; place-items: center; }
.mov-del svg { width: 19px; height: 19px; }
.mov-del:active { color: var(--neg); background: var(--neg-soft); }
.mov-icon { width: 40px; height: 40px; border-radius: 13px; display: grid; place-items: center; flex: none; color: #fff; background: var(--cc, var(--muted)); }
.mov-icon svg { width: 21px; height: 21px; }
.mov-icon.pago { background: var(--pos-soft); color: var(--pos); }
.mov-main { flex: 1; min-width: 0; }
.mov-title { font-weight: 750; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mov-sub { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mov-amt { font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; }
.mov-amt.pago { color: var(--pos); }
.list-empty { text-align: center; padding: 34px 20px; color: var(--muted); background: var(--surface); border: 1px dashed var(--line); border-radius: var(--radius); }
.list-empty p { margin: 4px 0; }
.list-empty strong { color: var(--ink); font-family: var(--serif); font-size: 18px; font-weight: 800; }
[data-cat="alojamiento"] { --cc: var(--cat-alojamiento); }
[data-cat="comida"] { --cc: var(--cat-comida); }
[data-cat="combustible"] { --cc: var(--cat-combustible); }
[data-cat="salidas"] { --cc: var(--cat-salidas); }
[data-cat="otros"] { --cc: var(--cat-otros); }
[data-cat="super"] { --cc: var(--cat-super); }

.movs-place { display: flex; align-items: center; gap: 10px; }
.select {
  flex: 1; min-width: 0; min-height: 44px; padding: 8px 12px; border-radius: 14px; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink); font: inherit; font-size: 15px; font-weight: 650;
}
.movs-day { display: flex; align-items: stretch; gap: 8px; }
.day-nav {
  flex: none; width: 48px; min-height: 54px; border-radius: 16px; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink); display: grid; place-items: center; box-shadow: var(--shadow);
}
.day-nav svg { width: 20px; height: 20px; stroke-width: 2.2; }
.day-nav:active:not(:disabled) { background: var(--surface-2); }
.day-nav:disabled { color: var(--muted); opacity: .4; box-shadow: none; }
.day-pick {
  position: relative; flex: 1; min-width: 0; display: flex; align-items: center; justify-content: center; gap: 10px;
  padding: 7px 12px; border-radius: 16px; border: 1px solid var(--line); background: var(--surface); box-shadow: var(--shadow);
}
.day-pick:focus-within { border-color: var(--accent-ink); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent); }
.day-pick:active { background: var(--surface-2); }
.day-pick > svg { width: 19px; height: 19px; color: var(--accent-ink); }
.day-pick-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; text-align: left; }
.day-pick-title { font-weight: 800; font-size: 15.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.day-pick-sub { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* El campo de fecha real va encima, invisible: tocar en cualquier parte abre el calendario del teléfono. */
.day-pick input {
  position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; padding: 0; border: 0;
  opacity: 0; cursor: pointer; font-size: 16px; background: transparent; color: transparent;
}
.day-pick input::-webkit-calendar-picker-indicator { position: absolute; inset: 0; width: auto; height: auto; margin: 0; padding: 0; cursor: pointer; }
.day-summary { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 0 4px; font-size: 14px; font-weight: 700; font-variant-numeric: tabular-nums; }
.day-summary .link { padding: 4px 2px; font-weight: 700; color: var(--accent-ink); white-space: nowrap; }
.empty-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 12px; }
@media (max-width: 360px) {
  .movs-day { gap: 6px; }
  .day-nav { width: 40px; }
  .day-pick { gap: 7px; padding: 7px 8px; }
  .day-pick > svg { width: 17px; height: 17px; }
}
.link { background: none; border: 0; padding: 6px 2px; color: var(--muted); text-decoration: underline; text-underline-offset: 3px; font-size: 14px; }

/* ---------- Segmentados y chips ---------- */
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; padding: 4px; border-radius: 16px; background: var(--surface-2); }
.seg button { border: 0; background: transparent; padding: 9px 10px; border-radius: 12px; font-weight: 750; font-size: 14.5px; color: var(--muted); }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--accent-ink); box-shadow: 0 1px 3px rgba(117, 43, 73, .14); }
.seg-sm { grid-auto-columns: auto; justify-content: start; max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.seg-sm::-webkit-scrollbar { display: none; }
.seg-sm button { padding: 7px 13px; font-size: 14px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 8px; padding: 8px 13px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface); font-size: 14.5px; font-weight: 650;
  transition: background .12s ease, border-color .12s ease;
}
.chip svg { width: 17px; height: 17px; }
.chips-people .chip { padding: 5px 14px 5px 5px; }
.chip[aria-pressed="true"] { border-color: transparent; background: var(--accent); color: var(--on-accent); }
.chips-people .chip[aria-pressed="true"] { background: var(--pc); color: #fff; }
.chips-people .chip[aria-pressed="true"] .avatar { background: rgba(255, 255, 255, .25); }

/* ---------- Formularios ---------- */
.field-label { display: block; font-size: 12.5px; font-weight: 800; color: var(--muted); margin: 16px 2px 7px; text-transform: uppercase; letter-spacing: .07em; }
.input {
  width: 100%; padding: 12px 14px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface);
  font-size: 16px; outline: none; transition: border-color .12s ease, box-shadow .12s ease; min-height: 48px;
}
.input:focus { border-color: var(--accent-ink); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent); }
.amount-field { display: flex; align-items: center; gap: 8px; padding: 0 14px; border-radius: 16px; border: 1px solid var(--line); background: var(--surface); transition: border-color .12s ease, box-shadow .12s ease; }
.amount-field:focus-within { border-color: var(--accent-ink); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent); }
.amount-field span { font-family: var(--serif); font-size: 28px; color: var(--muted); }
.input-amount { border: 0; box-shadow: none !important; padding: 10px 0; font-family: var(--serif); font-size: 32px; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; background: transparent; min-height: 60px; }
.hint { margin: 8px 2px 0; font-size: 14px; color: var(--muted); font-variant-numeric: tabular-nums; }
.error { margin: 12px 2px 0; color: var(--neg); font-weight: 700; font-size: 14.5px; }

.btn { border: 0; border-radius: 16px; padding: 13px 20px; font-weight: 750; font-size: 16px; min-height: 50px; transition: transform .1s ease, opacity .12s ease; }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .55; }
.btn-primary { background: var(--accent); color: var(--on-accent); }
.btn-block { width: 100%; margin-top: 6px; }
.btn-danger-ghost { background: transparent; color: var(--neg); padding-left: 6px; padding-right: 6px; }
.btn-sm { min-height: 36px; padding: 7px 13px; font-size: 14px; border-radius: 12px; background: var(--surface-2); color: var(--ink); font-weight: 750; border: 0; white-space: nowrap; }
.tr .btn-sm { background: var(--accent-soft); color: var(--accent-ink); }
.btn-secondary { background: var(--surface-2); color: var(--ink); }
.btn-danger { background: var(--neg); color: #fff; }
.btn-outline { display: inline-flex; align-items: center; justify-content: center; gap: 10px; background: var(--surface); color: var(--ink); border: 1px solid var(--line); box-shadow: var(--shadow); }
.btn-outline svg { width: 20px; height: 20px; color: var(--accent-ink); }
.btn-compact { min-height: 40px; padding: 8px 16px; font-size: 15px; }
a.btn { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }

/* ---------- Hoja inferior ---------- */
.backdrop { position: fixed; inset: 0; z-index: 20; background: rgba(40, 14, 26, .38); animation: fade .15s ease; touch-action: none; }
html.locked, html.locked body { overscroll-behavior: none; }
.sheet {
  position: fixed; z-index: 21; left: 0; right: 0; bottom: var(--kb, 0px); margin: 0 auto; max-width: 540px;
  max-height: 92vh; max-height: 92dvh; max-height: calc(var(--vvh, 100dvh) * .92); overflow-y: auto; overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  background: var(--bg); border-radius: 28px 28px 0 0; padding: 8px 18px 0;
  box-shadow: 0 -10px 40px rgba(40, 14, 26, .2); animation: fade .15s ease; /* aparece en su lugar, sin deslizarse */
}
.sheet-grip { width: 40px; height: 5px; border-radius: 3px; background: var(--line); margin: 2px auto 8px; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.sheet-title { font-family: var(--serif); font-weight: 800; font-size: 24px; letter-spacing: -.01em; margin: 0; }
.icon-btn { border: 0; background: var(--surface-2); width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; flex: none; }
.sheet-actions { position: sticky; bottom: 0; display: flex; justify-content: space-between; align-items: center; gap: 12px; margin: 22px -18px 0; padding: 12px 18px calc(14px + env(safe-area-inset-bottom)); background: var(--bg); border-top: 1px solid var(--line); }
.sheet-actions .btn-primary { flex: 1; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

/* Aviso */
.toast {
  position: fixed; z-index: 30; left: 50%; transform: translateX(-50%);
  bottom: calc(var(--tabbar-h) + 22px + env(safe-area-inset-bottom)); max-width: calc(100% - 32px);
  display: flex; align-items: center; gap: 14px; padding: 12px 16px; border-radius: 16px;
  background: var(--ink); color: var(--bg); font-size: 15px; font-weight: 650; box-shadow: 0 8px 24px rgba(0, 0, 0, .2);
  animation: toast-in .2s ease;
}
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 12px); } to { opacity: 1; transform: translate(-50%, 0); } }
.toast button { background: none; border: 0; color: inherit; font-weight: 800; text-decoration: underline; text-underline-offset: 3px; padding: 4px; }

/* Integrantes */
.who-add { margin-top: 22px; text-align: left; }
.sheet-people { padding-bottom: calc(22px + env(safe-area-inset-bottom)); }
.people-list { list-style: none; margin: 0 0 6px; padding: 0; display: grid; gap: 2px; }
.person-row { display: flex; align-items: center; gap: 12px; padding: 10px 2px; border-bottom: 1px solid var(--line); min-height: 60px; }
.person-main { flex: 1; min-width: 0; display: grid; }
.person-name { font-weight: 750; overflow-wrap: anywhere; }
.person-row .icon-btn svg { width: 18px; height: 18px; }
.person-row .icon-btn.danger { color: var(--neg); }
.person-edit { flex: 1; min-width: 0; display: flex; gap: 8px; }
.person-edit .input { flex: 1; min-width: 0; min-height: 44px; padding-top: 8px; padding-bottom: 8px; }
.person-edit .btn { min-height: 44px; padding: 8px 14px; }
.people-sub { margin: -6px 2px 8px; }
.invite-box { margin: 14px 0 4px; }
.invite-box .btn-outline svg { width: 19px; height: 19px; }
.invite-share { margin-top: 10px; }
.invite-off { margin-top: 10px; color: var(--neg); }
.people-add { margin-top: 16px; }
.people-add .place-form { margin-top: 6px; }
.place-form { display: flex; gap: 8px; margin-top: 12px; }
.place-form .input { flex: 1; min-width: 0; }
.place-form .btn { min-height: 48px; padding: 10px 16px; }

/* PDF del informe dentro de la app */
.pdf-view { min-height: 100vh; min-height: 100dvh; background: var(--surface-2); }
.report-bar.pdf-bar { padding-left: 16px; padding-right: 16px; background: var(--bg); }
.pdf-actions { display: flex; align-items: center; gap: 8px; }
.pdf-actions .btn { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; padding-left: 13px; padding-right: 13px; }
.pdf-actions .btn svg { width: 18px; height: 18px; }
.icon-btn[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); }
.pdf-status { text-align: center; margin: 0; padding: 18px 16px 0; }
.pdf-pages { overflow-x: auto; padding: 14px 12px calc(28px + env(safe-area-inset-bottom)); }
.pdf-pages img { display: block; width: 100%; max-width: 820px; height: auto; margin: 0 auto 14px; background: #fff;
  border-radius: 4px; box-shadow: 0 1px 3px rgba(0, 0, 0, .12), 0 8px 24px rgba(0, 0, 0, .08); }
.pdf-pages.zoom img { width: 210%; max-width: none; margin-left: 0; }

/* Confirmación antes de eliminar */
.confirm-backdrop { z-index: 40; }
.confirm {
  position: fixed; z-index: 41; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: min(340px, calc(100% - 40px)); max-height: calc(100% - 40px); overflow-y: auto;
  padding: 22px 20px 18px; border-radius: 24px; background: var(--bg); text-align: center;
  box-shadow: 0 20px 60px rgba(40, 14, 26, .3); animation: pop .18s cubic-bezier(.2, .8, .2, 1);
}
@keyframes pop { from { opacity: 0; transform: translate(-50%, -46%) scale(.96); } to { opacity: 1; transform: translate(-50%, -50%); } }
.confirm-icon { width: 52px; height: 52px; margin: 0 auto 10px; border-radius: 50%; display: grid; place-items: center; background: var(--neg-soft); color: var(--neg); }
.confirm-icon svg { width: 26px; height: 26px; }
.confirm-title { font-family: var(--serif); font-weight: 800; font-size: 22px; margin: 0 0 14px; }
.confirm-item { text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; }
.confirm-main { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.confirm-desc { font-weight: 750; min-width: 0; overflow-wrap: anywhere; }
.confirm-amount { font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; }
.confirm-meta { margin-top: 3px; font-size: 14px; color: var(--muted); }
.confirm-text { margin: 12px 2px 16px; font-size: 14.5px; color: var(--muted); }
.confirm-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

@media (min-width: 600px) {
  .sheet { bottom: auto; top: 50%; transform: translateY(-50%); border-radius: 28px; max-height: 88vh; }
  .sheet-grip { display: none; }
  .app { box-shadow: 0 0 0 1px var(--line); min-height: 100vh; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- Informe ---------- */
.btn-outline.no-print { margin-top: 0; }
.report-actions { display: flex; gap: 8px; min-width: 0; }
.report-actions .btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; white-space: nowrap; padding-left: 13px; padding-right: 13px; }
.report-actions svg { width: 18px; height: 18px; flex: none; }
.report-actions.sharing #reportPdf { background: var(--surface); color: var(--ink); border: 1px solid var(--line); }
.report-actions .pdf-short, .report-actions:not(.sharing) #reportPdf svg, .report-actions.sharing .pdf-long { display: none; }
.report-actions.sharing .pdf-short { display: inline; }
.report { max-width: 760px; margin: 0 auto; padding: 0 16px 40px; }
.report-bar {
  position: sticky; top: 0; z-index: 5; display: flex; justify-content: space-between; align-items: center; gap: 10px;
  padding: calc(10px + env(safe-area-inset-top)) 0 10px; background: var(--bg); border-bottom: 1px solid var(--line);
}
.report-body { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; padding-top: 14px; }
.rp-head .rp-title { margin: 6px 0 4px; }
.rp-head p { margin: 2px 0; }
.rp-filter { display: flex; align-items: center; gap: 10px; }
.kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 12px 14px; }
.kpi:first-child { background: linear-gradient(135deg, var(--accent-2), var(--accent)); border-color: transparent; color: #fff; }
.kpi:first-child .kpi-label { color: rgba(255, 255, 255, .85); }
.kpi-label { margin: 0; font-size: 12px; color: var(--muted); font-weight: 800; text-transform: uppercase; letter-spacing: .06em; }
.kpi-val { margin: 4px 0 0; font-family: var(--serif); font-size: 22px; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.kpi-sub { margin: 2px 0 0; font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chart-wrap { display: grid; grid-template-columns: 150px minmax(0, 1fr); align-items: center; gap: 16px; }
.donut { width: 150px; height: 150px; fill: none; stroke: none; }
.donut .slice { stroke: var(--surface); stroke-width: 2; }
.donut-cap { font-size: 11px; fill: var(--muted); font-family: var(--sans); }
.donut-val { font-size: 13.5px; font-weight: 800; fill: var(--ink); font-family: var(--sans); }
.legend { list-style: none; margin: 0; padding: 0; display: grid; gap: 7px; }
.legend li { display: grid; grid-template-columns: 12px minmax(0, 1fr) auto; column-gap: 8px; align-items: center; font-size: 14px; }
.legend .dot { width: 12px; height: 12px; border-radius: 50%; }
.legend .lg-name { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.legend .lg-val { font-variant-numeric: tabular-nums; text-align: right; }
.legend .lg-pct { grid-column: 2 / 4; font-size: 12.5px; color: var(--muted); margin-top: -4px; }
.bars { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.bars li { display: grid; grid-template-columns: 92px minmax(0, 1fr) auto; align-items: center; gap: 10px; font-size: 13.5px; }
.bar-label { color: var(--muted); text-transform: capitalize; white-space: nowrap; }
.bar-track { height: 12px; border-radius: 6px; background: var(--surface-2); overflow: hidden; }
.bar-fill { display: block; height: 100%; border-radius: 4px; background: var(--accent-2); }
.bar-val { font-variant-numeric: tabular-nums; font-weight: 700; }
.table-wrap { overflow-x: auto; margin: 0 -4px; }
.rp-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.rp-table th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 800; padding: 6px 4px; border-bottom: 1px solid var(--line); }
.rp-table td { padding: 8px 4px; border-bottom: 1px solid var(--line); vertical-align: top; }
.rp-table tfoot td { font-weight: 800; border-bottom: 0; padding-top: 10px; }
.rp-table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.rp-table .pos { color: var(--pos); font-weight: 750; }
.rp-table .neg { color: var(--neg); font-weight: 750; }
.rp-table .nowrap { white-space: nowrap; }
.cell-sub { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.rp-sub { margin: 14px 0 6px; font-weight: 800; }
.rp-transfers { margin: 0; padding-left: 18px; display: grid; gap: 4px; font-size: 14.5px; }
.rp-foot { text-align: center; margin-top: 6px; }
@media (max-width: 420px) {
  .chart-wrap { grid-template-columns: 1fr; justify-items: center; }
  .legend { width: 100%; }
  .rp-table { font-size: 12.5px; }
  .rp-table th, .rp-table td { padding-left: 3px; padding-right: 3px; }
}

@media print {
  :root { --bg: #ffffff; --surface: #ffffff; --surface-2: #f4ecea; --ink: #1f1a1c; --muted: #5f5458; --line: #e2d6d2; color-scheme: light; }
  body { background: #fff; overflow: visible !important; }
  .report-bar, .no-print, .toast, .tabbar, .backdrop, .sheet { display: none !important; }
  .report { max-width: none; padding: 0; }
  .card, .kpi { box-shadow: none; }
  .rp-card, .kpis, .chart-wrap, .rp-table tr { break-inside: avoid; }
  .rp-detail { break-inside: auto; }
  .table-wrap { overflow: visible; }
  .rp-table tfoot { display: table-row-group; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  @page { margin: 14mm; }
}

/* Detalles */
.menu-row:disabled { cursor: default; }
.menu-row:disabled .menu-chev { display: none; }
.mov-icon { background: color-mix(in srgb, var(--cc, var(--muted)) 16%, var(--surface)); color: var(--cc, var(--ink)); }
.chip[data-cat] svg { color: var(--cc); }
.chip[data-cat][aria-pressed="true"] svg { color: currentColor; }
.total-report { color: var(--accent); }
@media (prefers-color-scheme: dark) {
  .total-report { color: #752B49; }
  .brand-sub { color: #F6C9D7; text-shadow: 0 1px 8px rgba(0, 0, 0, .4); }
  .brand-title { text-shadow: 0 1px 10px rgba(0, 0, 0, .35); }
}

/* ---------- Hoja de carga: nada más ancho que la pantalla (iPhone) y más compacta ---------- */
/* En el iPhone el campo del monto y el de la fecha medían más que la hoja y se podía correr de costado. */
.sheet { overflow-x: hidden; overscroll-behavior: none; touch-action: pan-y; padding-top: 6px; }
.sheet > * { max-width: 100%; }
.sheet .input, .sheet .amount-field, .sheet .seg, .sheet .chips { min-width: 0; max-width: 100%; }
.amount-field { min-width: 0; }
.input-amount { flex: 1 1 0; width: 0; min-width: 0; }
input[type="date"].input {
  display: block; min-width: 0; max-width: 100%; -webkit-appearance: none; appearance: none; text-align: left;
}
input[type="date"].input::-webkit-date-and-time-value { text-align: left; margin: 0; }
.seg { grid-auto-columns: minmax(0, 1fr); }
.seg button { min-width: 0; overflow-wrap: anywhere; }
.sheet .sheet-grip { margin: 0 auto 6px; }
.sheet .sheet-head { margin-bottom: 8px; }
.sheet .sheet-title { font-size: 22px; }
.sheet .field-label { margin: 12px 2px 6px; }
.sheet .input { min-height: 46px; padding-top: 10px; padding-bottom: 10px; }
.sheet .input-amount { min-height: 52px; padding: 6px 0; font-size: 30px; }
.sheet .amount-field span { font-size: 26px; }
.sheet .chip { padding: 6px 12px; }
.sheet .chips-people .chip { padding: 4px 13px 4px 4px; }
.sheet .chips { gap: 7px; }
.sheet .hint { margin-top: 6px; }
.sheet-actions { margin-top: 14px; padding-top: 10px; }
/* La hoja no se arrastra: sin la manijita que invitaba a deslizarla, y con un poco más de alto para que entre entera. */
.sheet .sheet-grip { display: none; }
.sheet { padding-top: 14px; max-height: calc(var(--vvh, 100dvh) - 36px); }
.sheet .field-label { margin-top: 10px; }
.sheet-actions { padding-bottom: calc(10px + env(safe-area-inset-bottom)); }
@media (min-width: 600px) { .sheet { max-height: 88vh; } }

/* ---------- Inicio más grande, sin saldos ni torta (06/12) ---------- */
.wrap-home { gap: 16px; }
.total-card { padding: 22px 20px 20px; border-radius: 28px; }
.total-label { font-size: 20px; }
.total-amount { font-size: clamp(40px, 13cqw, 62px); margin: 6px 0 16px; }
.total-chip { font-size: 15.5px; padding: 8px 15px 8px 12px; }
.total-report { width: 50px; height: 50px; border-radius: 16px; top: 16px; right: 16px; }
.total-report svg { width: 25px; height: 25px; }

.place-card { padding: 18px; }
.place-card .card-head { margin-bottom: 14px; }
.place-card .card-title { font-size: 20px; }
.place-card .card-title svg { width: 24px; height: 24px; }
.soft-btn {
  display: inline-flex; align-items: center; gap: 6px; flex: none; min-height: 40px; padding: 8px 14px 8px 11px;
  border: 0; border-radius: 999px; background: var(--peach-soft); color: var(--accent-ink); font-weight: 800; font-size: 15px;
}
.soft-btn svg { width: 18px; height: 18px; stroke-width: 2.4; }
.soft-btn:active { transform: scale(.97); }
.place-list { display: flex; flex-wrap: wrap; gap: 10px; }
.place-pill { flex: 1 1 auto; width: auto; min-height: 56px; padding: 12px 18px; gap: 10px; font-size: 17px; border-radius: 999px; }
.place-pill svg { width: 22px; height: 22px; }
.place-pill span { -webkit-line-clamp: 2; }

.settle-card { padding: 20px 18px; }
.settle-icon svg { width: 46px; height: 46px; }
.settle-title { font-size: 21px; }
.settle-sub { font-size: 16px; }
.settle-ok { width: 46px; height: 46px; }
.settle-ok svg { width: 24px; height: 24px; }
.settle-card .tr-text strong { font-size: 17px; }
.settle-card .tr-who { font-size: 14.5px; }

.btn-big { min-height: 66px; font-size: 20px; margin-top: 4px; }
.btn-big svg { width: 28px; height: 28px; }

/* Integrantes en Inicio (06/12): caritas grandes con el nombre; tocar abre Integrantes */
.people-card { padding: 18px 14px 12px; }
.people-card .card-head { padding: 0 4px; margin-bottom: 8px; }
.people-card .card-title { font-size: 20px; }
.people-card .card-title svg { width: 24px; height: 24px; }
.home-people { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(84px, 1fr)); gap: 4px; }
.hp { display: flex; flex-direction: column; align-items: center; gap: 6px; width: 100%; min-height: 104px; padding: 8px 4px 10px; border: 0; border-radius: 18px; background: transparent; }
.hp:active { background: var(--surface-2); }
.hp .avatar { width: 58px; height: 58px; font-size: 23px; box-shadow: 0 6px 14px rgba(117, 43, 73, .14); }
.hp-name { max-width: 100%; font-weight: 800; font-size: 15.5px; line-height: 1.15; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hp-me { margin-top: -5px; font-size: 12.5px; font-weight: 800; color: var(--accent-ink); }

/* ---------- Año de cada lugar y comparación por año (06/12) ---------- */
:root { --yr-1: #5E1F3D; --yr-2: #8E3A60; --yr-3: #B86E8C; --yr-4: #D9A6B8; }
@media (prefers-color-scheme: dark) { :root { --yr-1: #F0A6C4; --yr-2: #C9719A; --yr-3: #9C4D72; --yr-4: #6E3550; } }
.place-pill .yr { flex: none; padding: 2px 9px; border-radius: 999px; font-size: 13.5px; font-weight: 800; font-variant-numeric: tabular-nums;
  background: var(--surface-2); color: var(--accent-ink); }
.place-pill[aria-pressed="true"] .yr { background: rgba(255, 255, 255, .22); color: inherit; }
.place-name-row { display: grid; grid-template-columns: minmax(0, 1fr) 108px; gap: 10px; align-items: end; }
.place-year { width: 100%; min-height: 46px; font-weight: 750; font-variant-numeric: tabular-nums; }
.yc-sub { margin: -4px 0 10px; }
.yc-table .yc-now td { font-weight: 800; }
.yc-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 7px; vertical-align: 1px; }
.yc-groups { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.yc-cat { display: flex; align-items: center; gap: 8px; font-weight: 750; font-size: 14.5px; margin: 0 0 6px; }
.yc-cat .dot { width: 11px; height: 11px; border-radius: 50%; background: var(--cc); }
.yc-bars li { grid-template-columns: 48px minmax(0, 1fr) auto; }
.yc-bars .bar-label { text-transform: none; font-variant-numeric: tabular-nums; font-weight: 700; color: var(--ink); }
.yc-table td:first-child { white-space: nowrap; }
.yc-table td { vertical-align: middle; }
.yc-table td:nth-child(2) { text-align: right; }
.yc-table td:nth-child(2) .cell-sub { margin-top: 0; }
.num-strong { font-weight: 750; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* Aviso de la dirección nueva (sólo en la dirección vieja, fuera de la app de Xcode) */
.move-banner { background: var(--surface); border: 2px solid var(--accent); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); text-align: left; }
.move-title { font-weight: 800; font-size: 18px; color: var(--accent-ink); }
.move-text { margin-top: 4px; font-size: 15px; color: var(--ink); }
.move-btn { margin-top: 12px; }
.screen .move-banner { margin-top: 18px; }
