/* Plus Jakarta Sans (SIL OFL 1.1, see public/fonts/OFL-plus-jakarta-sans.txt), self-hosted: the CSP blocks Google Fonts. */
@font-face {
  font-family: "Plus Jakarta Sans"; font-style: normal; font-weight: 200 800; font-display: swap;
  src: url("/static/fonts/plus-jakarta-sans-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;
}
@font-face {
  font-family: "Plus Jakarta Sans"; font-style: normal; font-weight: 200 800; font-display: swap;
  src: url("/static/fonts/plus-jakarta-sans-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;
}

/* Cuotia — design tokens from the approved mockups. Mobile first; the layout widens from 720px. */
:root {
  --ink: #0b1b2b;
  --lime: #c6f25c;
  --ground: #f3f5f8;
  --surface: #ffffff;
  --text: #0b1b2b;
  --muted: #566274;
  --line: #e3e8ee;
  --link: #1f4fd8;
  --ok-bg: #ddf6e7; --ok-fg: #0b6b43;
  --warn-bg: #fff1d6; --warn-fg: #8a5200;
  --info-bg: #e4ebff; --info-fg: #2342a8;
  --bad-bg: #fde8e8; --bad-fg: #9b1c1c;
  --radius: 20px;
  color-scheme: light only;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--ground);
  color: var(--text);
  font-family: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  line-height: 1.45;
  -webkit-text-size-adjust: 100%;
}
h1, h2 { margin: 0; letter-spacing: -0.025em; font-weight: 800; }
h1 { font-size: clamp(1.5rem, 4vw, 1.9rem); }
h2 { font-size: 1.15rem; }
p { margin: 0 0 .75rem; }
a { color: var(--link); }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
small { display: block; font-size: .8125rem; }

.brand { display: inline-flex; align-items: center; gap: .5rem; font-weight: 800; font-size: 1.3rem; letter-spacing: -0.03em; }
.brand-mark { width: 28px; height: 28px; border-radius: 9px; background: var(--ink); color: var(--lime); display: grid; place-items: center; }

.chip { background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: .4rem .8rem; font-weight: 700; font-size: .85rem; }

.page, .narrow { width: min(100%, 1100px); margin-inline: auto; padding: 0 1.25rem 3rem; display: flex; flex-direction: column; gap: 1rem; }
.narrow { width: min(100%, 480px); }
.heading { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: .25rem 1rem; padding-top: .25rem; }
.center { min-height: 100dvh; display: grid; place-items: center; padding: 1.25rem; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.25rem; display: flex; flex-direction: column; gap: .75rem; }
.card.setup { width: min(100%, 560px); gap: 1rem; padding: 1.75rem; }
fieldset { border: 1px solid var(--line); border-radius: 16px; padding: .5rem 1rem 1rem; margin: 0; display: flex; flex-direction: column; gap: .8rem; min-width: 0; }
legend { font-weight: 800; padding: 0 .4rem; }
.card.login { width: min(100%, 400px); gap: 1rem; padding: 1.75rem; }
label { display: flex; flex-direction: column; gap: .35rem; font-weight: 600; font-size: .9rem; }
input[type="email"], input[type="password"] {
  min-height: 48px; padding: 0 .9rem; font: inherit; color: inherit; background: var(--ground);
  border: 1.5px solid var(--line); border-radius: 12px;
}
input:focus-visible, .btn:focus-visible, a:focus-visible { outline: 3px solid var(--link); outline-offset: 2px; }

.btn {
  min-height: 48px; padding: 0 1.25rem; border: 0; border-radius: 14px; cursor: pointer;
  background: var(--ink); color: #fff; font: 700 .95rem/1 inherit; font-family: inherit;
}
.btn.ghost { background: transparent; color: var(--text); border: 1.5px solid var(--line); min-height: 44px; }
.alert { background: var(--warn-bg); color: var(--warn-fg); border-radius: 12px; padding: .7rem .9rem; font-weight: 600; margin: 0; }

.hero { background: var(--ink); color: #fff; border-radius: 28px; padding: 1.5rem; display: flex; flex-direction: column; gap: .5rem; }
.eyebrow { font-size: .75rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: #b7c2d0; }
.hero-number { font-size: clamp(2.4rem, 11vw, 4rem); line-height: 1; font-weight: 800; letter-spacing: -0.04em; color: var(--lime); }
.hero-sub { color: #b7c2d0; font-size: .95rem; }
.hero-stats { display: flex; gap: 2rem; margin-top: .5rem; }
.hero-stats div { display: flex; flex-direction: column; }
.hero-stats b { font-size: 1.5rem; font-weight: 800; }
.hero-stats span { font-size: .8rem; color: #b7c2d0; }

progress.bar { appearance: none; -webkit-appearance: none; width: 100%; height: 14px; border: 0; border-radius: 7px; background: rgba(255,255,255,.14); overflow: hidden; margin-top: .5rem; }
progress.bar::-webkit-progress-bar { background: rgba(255,255,255,.14); }
progress.bar::-webkit-progress-value { background: var(--lime); border-radius: 7px; }
progress.bar::-moz-progress-bar { background: var(--lime); border-radius: 7px; }

.callout { background: var(--info-bg); color: var(--info-fg); border-radius: var(--radius); padding: 1rem 1.25rem; display: flex; flex-direction: column; gap: .15rem; }

.pill { display: inline-flex; align-items: center; gap: .4rem; padding: .25rem .65rem; border-radius: 999px; font-size: .75rem; font-weight: 700; }
.pill i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.ok { background: var(--ok-bg); color: var(--ok-fg); }
.pill.warn { background: var(--warn-bg); color: var(--warn-fg); }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 480px; }
th { text-align: left; font-size: .72rem; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding: .5rem .5rem; }
td { padding: .8rem .5rem; border-top: 1px solid var(--line); font-size: .9rem; }
.num { text-align: right; }

.list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.list li { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .8rem 0; border-top: 1px solid var(--line); }
.list li:first-child { border-top: 0; }
.key { font-size: 1.35rem; font-weight: 800; letter-spacing: -0.01em; background: var(--ground); border-radius: 12px; padding: .75rem 1rem; margin: 0 0 .5rem; overflow-wrap: break-word; }
.key.secret { font-size: 1.15rem; letter-spacing: .04em; font-variant-numeric: tabular-nums; }
.key.url { font-size: .95rem; font-weight: 700; word-break: break-all; }

@media (prefers-reduced-motion: no-preference) { .btn { transition: transform .08s ease; } .btn:active { transform: scale(.98); } }

/* ---- panel actions, forms ---- */
.flash { border-radius: 14px; padding: .8rem 1rem; margin: 0; font-weight: 600; }
.flash.ok { background: var(--ok-bg); color: var(--ok-fg); }
.flash.info { background: var(--info-bg); color: var(--info-fg); }
.flash.err { background: var(--warn-bg); color: var(--warn-fg); }

select, input[type="text"], input[type="tel"], input[type="number"] {
  min-height: 48px; padding: 0 .9rem; font: inherit; color: inherit; background: var(--ground);
  border: 1.5px solid var(--line); border-radius: 12px; width: 100%;
}
select:focus-visible, input:focus-visible { outline: 3px solid var(--link); outline-offset: 2px; }
input.code { font-size: 1.6rem; letter-spacing: .3em; text-align: center; font-variant-numeric: tabular-nums; }
.btn.small { min-height: 44px; padding: 0 1rem; font-size: .875rem; }
a.btn { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
a.btn.ghost { color: var(--text); }

.row { display: flex; align-items: center; justify-content: space-between; gap: .75rem; }
.row.wrap { flex-wrap: wrap; }
.count { background: var(--info-bg); color: var(--info-fg); border-radius: 999px; padding: .1rem .55rem; font-size: .8rem; vertical-align: middle; }
.list.stack li { flex-direction: column; align-items: stretch; gap: .6rem; }
.assign { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; }
.assign select { flex: 1 1 220px; width: auto; }
.check { flex-direction: row; align-items: center; gap: .5rem; font-weight: 500; min-height: 44px; }
.check input { width: 20px; height: 20px; accent-color: var(--ink); }
.grid-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: .9rem; align-items: end; }
.steps { margin: 0; padding-left: 1.2rem; }
.card .btn + .btn { margin-top: .25rem; }

/* Phones: the houses table becomes one card per house instead of scrolling sideways. */
@media (max-width: 560px) {
  table { min-width: 0; }
  thead { display: none; }
  tbody tr { display: grid; grid-template-columns: 1fr auto; gap: .2rem .75rem; align-items: center; padding: .85rem 0; border-top: 1px solid var(--line); }
  tbody tr:first-child { border-top: 0; }
  td { border: 0; padding: 0; }
  td:nth-child(1)::before { content: "Casa "; font-weight: 500; color: var(--muted); }
  td:nth-child(1) { grid-column: 1; grid-row: 1; }
  td:nth-child(2) { grid-column: 1; grid-row: 2; font-weight: 600; }
  td:nth-child(3) { grid-column: 2; grid-row: 1; justify-self: end; }
  td:nth-child(4) { display: none; }
  td:nth-child(5) { grid-column: 2; grid-row: 2; justify-self: end; }
  td.act { grid-column: 1 / -1; grid-row: 3; padding-top: .35rem; }
  td.act:empty { display: none; }
  td.act .btn { width: 100%; }
}

/* ---- history and house page ---- */
.pill.info { background: var(--info-bg); color: var(--info-fg); }
.amount { display: inline-flex; flex-direction: column; align-items: flex-end; gap: .3rem; }
.actions { display: inline-flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: .9rem; align-items: end; }
.pager { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding-top: .75rem; border-top: 1px solid var(--line); }
details.undo { border: 1px solid var(--line); border-radius: 14px; padding: 0 1rem; background: var(--ground); }
details.undo summary { min-height: 44px; display: flex; align-items: center; cursor: pointer; font-weight: 700; font-size: .875rem; list-style-position: inside; }
details.undo[open] { padding-bottom: .9rem; }
details.undo form { margin-top: .5rem; }
li.pay > a.small { align-self: flex-start; min-height: 44px; display: inline-flex; align-items: center; }

/* ---- two-step setup QR: dark on white always, with its own quiet zone, in light and dark mode ---- */
.qr { width: min(100%, 240px); margin: 0 auto; border-radius: 14px; overflow: hidden; border: 1px solid var(--line); background: #fff; }
.qr svg { display: block; width: 100%; height: auto; }

/* =============================================================================================================
   App shell: dark sidebar on a computer, bottom tab bar on a phone (as in the approved mockups).
   ============================================================================================================= */
.app { display: flex; min-height: 100dvh; }
.stage { flex: 1; min-width: 0; padding-bottom: 88px; }
.page { width: min(100%, 1180px); margin-inline: auto; padding: 0 1.25rem 2rem; display: flex; flex-direction: column; gap: 1rem; }
.narrow { width: min(100%, 480px); margin-inline: auto; padding: 0 1.25rem 3rem; display: flex; flex-direction: column; gap: 1rem; }
.chip { background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: .4rem .8rem; font-weight: 700; font-size: .85rem; }

.side { display: none; }
.mobilebar { display: flex; align-items: center; justify-content: space-between; padding: 1rem 1.25rem; }
.mobilebar .btn { min-height: 40px; }

.tabbar {
  position: fixed; inset: auto 0 0 0; z-index: 10; display: flex; justify-content: space-around; align-items: stretch;
  background: var(--surface); border-top: 1px solid var(--line); padding: .35rem .5rem calc(.35rem + env(safe-area-inset-bottom));
}
.tab { position: relative; flex: 1; min-height: 52px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .1rem; color: var(--muted); text-decoration: none; font-size: .72rem; font-weight: 600; border-radius: 12px; }
.tab[aria-current="page"] { color: var(--text); font-weight: 800; }
.tab .badge { position: absolute; top: 2px; left: calc(50% + 6px); }
.badge { background: var(--lime); color: var(--ink); font-size: .72rem; font-weight: 800; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; display: inline-grid; place-items: center; }
.tab .badge { background: var(--ink); color: var(--lime); }

@media (min-width: 900px) {
  .side {
    display: flex; flex-direction: column; gap: 2rem; flex: 0 0 256px; width: 256px; height: 100dvh; position: sticky; top: 0;
    background: var(--ink); color: #fff; padding: 1.75rem 1.25rem; overflow-y: auto;
  }
  .mobilebar, .tabbar { display: none; }
  .stage { padding-bottom: 0; }
  .page { padding: 2rem 2.5rem 4rem; gap: 1.25rem; }
}
.brand.on-dark { color: #fff; padding: 0 .5rem; }
.brand.on-dark .brand-mark { background: var(--lime); color: var(--ink); width: 32px; height: 32px; border-radius: 10px; }
.side-nav { display: flex; flex-direction: column; gap: .25rem; }
.nav-link { display: flex; align-items: center; gap: .75rem; min-height: 46px; padding: 0 .9rem; border-radius: 12px; color: #b7c2d0; text-decoration: none; font-weight: 600; }
.nav-link span:first-of-type { flex: 1; }
.nav-link:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-link[aria-current="page"] { background: rgba(198,242,92,.14); color: var(--lime); font-weight: 800; }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 1rem; }
.conj { background: rgba(255,255,255,.07); border-radius: 16px; padding: 1rem; display: flex; flex-direction: column; gap: .15rem; }
.conj b { font-size: 1rem; }
.conj small { color: #b7c2d0; }
.me { display: flex; align-items: center; justify-content: space-between; gap: .5rem; color: #b7c2d0; }
.me .small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.btn.on-dark { color: #fff; border-color: rgba(255,255,255,.25); }

/* ---- dashboard ---- */
.head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem; }
.head-text { display: flex; flex-direction: column; gap: .15rem; }
.head-actions { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; }
.monthpill { display: inline-flex; align-items: center; gap: .5rem; min-height: 44px; padding: 0 1rem; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; font-weight: 700; font-size: .875rem; }
.top { display: flex; flex-wrap: wrap; gap: 1rem; }
.top .hero { flex: 2 1 460px; min-width: 0; }
.stats { flex: 1 1 260px; min-width: 0; display: flex; flex-direction: column; gap: 1rem; }
.stat { gap: .35rem; }
.stat-number { font-size: 2.1rem; line-height: 1.1; font-weight: 800; letter-spacing: -0.03em; }
.eyebrow.dim { color: var(--muted); }
.info-card { background: var(--info-bg); color: var(--info-fg); border-radius: var(--radius); padding: 1.25rem; display: flex; flex-direction: column; gap: .35rem; }
.info-card .eyebrow { color: var(--info-fg); }
.info-card .stat-number { color: var(--text); }
.stat-link { font-weight: 800; color: var(--info-fg); text-decoration: none; min-height: 44px; display: inline-flex; align-items: center; }
.chip-lime { background: var(--lime); color: var(--ink); font-size: .8rem; font-weight: 800; padding: .35rem .75rem; border-radius: 999px; }
.hero { padding: 1.5rem; gap: .6rem; }
@media (min-width: 720px) { .hero { padding: 1.75rem 2rem; } }

.cols { display: flex; flex-wrap: wrap; gap: 1rem; align-items: flex-start; }
.table-card { flex: 3 1 560px; min-width: 0; }
.col-side { flex: 1 1 300px; min-width: 0; display: flex; flex-direction: column; gap: 1rem; }
.chips { display: flex; flex-wrap: wrap; gap: .5rem; }
.chip-filter { min-height: 40px; display: inline-flex; align-items: center; padding: 0 .9rem; border-radius: 999px; background: var(--ground); color: var(--text); font-size: .8rem; font-weight: 700; text-decoration: none; }
.chip-filter[aria-current="true"] { background: var(--ink); color: #fff; }
.rowlink { color: inherit; text-decoration: none; }
.regen { padding-top: .25rem; }
.recent { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .9rem; }
.recent li { display: flex; align-items: center; gap: .75rem; }
.recent .who { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.recent .who b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .9rem; }
.tile { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; font-size: .875rem; font-weight: 800; flex: none; }
.tile.ok { background: var(--ok-bg); color: var(--ok-fg); }
.tile.info { background: var(--info-bg); color: var(--info-fg); }

/* ---- resident pages ---- */
.res-top { display: flex; align-items: center; justify-content: space-between; padding: 1.25rem 0 .25rem; }
.res-hello { display: flex; flex-direction: column; gap: .15rem; padding-top: .5rem; }
.btn.lime { background: var(--lime); color: var(--ink); }
.btn.big { min-height: 56px; border-radius: 16px; font-size: 1.05rem; font-weight: 800; display: inline-flex; align-items: center; justify-content: center; gap: .6rem; text-decoration: none; }
.hero .btn.big { margin-top: .75rem; }
.hero .row { align-items: center; }
.due { gap: .75rem; }
.due-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.dot { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; flex: none; }
.dot.ok { background: var(--ok-bg); color: var(--ok-fg); }
.dot.warn { background: var(--warn-bg); }
.strong { font-weight: 800; min-height: 44px; display: inline-flex; align-items: center; }
.backbar { display: flex; align-items: center; gap: .25rem; padding: 1rem 0 .25rem; }
.backbar a { width: 48px; height: 48px; display: grid; place-items: center; color: var(--text); margin-left: -.75rem; }
.backbar h1 { font-size: 1.15rem; }
.center-text { text-align: center; align-items: center; }
.hero.center-text .hero-number { font-size: clamp(2.6rem, 14vw, 3.4rem); }
.waiting { display: flex; align-items: center; gap: .75rem; background: var(--info-bg); color: var(--info-fg); border-radius: 16px; padding: .9rem 1rem; font-weight: 600; font-size: .9rem; margin: 0; }
.pulse { width: 10px; height: 10px; border-radius: 50%; background: currentColor; flex: none; }
@media (prefers-reduced-motion: no-preference) { .pulse { animation: pulse 1.6s ease-in-out infinite; } @keyframes pulse { 50% { opacity: .35; } } }
.steps.small { font-size: .9rem; display: flex; flex-direction: column; gap: .35rem; }

/* ---- receipt: dark page, white card; prints as a clean white receipt ---- */
body.receipt-page { background: var(--ink); }
.receipt { width: min(100%, 480px); margin-inline: auto; padding: 3rem 1.25rem 2.5rem; display: flex; flex-direction: column; align-items: center; gap: .9rem; color: #fff; }
.okring { width: 72px; height: 72px; border-radius: 50%; background: var(--lime); color: var(--ink); display: grid; place-items: center; }
.receipt h1 { color: #fff; }
.receipt-lead { color: #b7c2d0; text-align: center; margin: 0; }
.rcard { width: 100%; background: #fff; color: #0b1b2b; border-radius: 24px; padding: 1.5rem; display: flex; flex-direction: column; gap: 1rem; margin-top: .75rem; }
.rcard .eyebrow { color: #566274; display: block; }
.rtotal { display: block; font-size: 2.5rem; line-height: 1.1; font-weight: 800; letter-spacing: -0.04em; }
.rcard hr { border: 0; border-top: 2px dashed #e3e8ee; margin: 0; width: 100%; }
.rcard dl { margin: 0; display: flex; flex-direction: column; gap: .75rem; }
.rcard dl div { display: flex; justify-content: space-between; gap: 1rem; font-size: .9rem; }
.rcard dt { color: #566274; }
.rcard dd { margin: 0; font-weight: 700; text-align: right; }
.rcard .muted { color: #566274; margin: 0; }
.receipt-actions { width: 100%; display: flex; flex-direction: column; gap: .75rem; margin-top: .5rem; }
.btn.outline { background: transparent; color: #fff; border: 1.5px solid rgba(255,255,255,.3); }
@media print {
  body.receipt-page { background: #fff; }
  .receipt { color: #0b1b2b; padding-top: 1rem; }
  .receipt h1 { color: #0b1b2b; }
  .receipt-lead { color: #566274; }
  .receipt-actions { display: none; }
  .rcard { border: 1px solid #e3e8ee; }
}

/* ---- bulk import ---- */
textarea { width: 100%; padding: .75rem .9rem; font: inherit; color: inherit; background: var(--ground); border: 1.5px solid var(--line); border-radius: 12px; resize: vertical; }
textarea:focus-visible { outline: 3px solid var(--link); outline-offset: 2px; }
pre.example { margin: 0; background: var(--ground); border-radius: 12px; padding: .75rem 1rem; font-size: .85rem; overflow-x: auto; }
.list.stack li .key { margin: 0; font-size: .8rem; }

/* ---- manual payment form ---- */
input[type="date"] { min-height: 48px; padding: 0 .9rem; font: inherit; color: inherit; background: var(--ground); border: 1.5px solid var(--line); border-radius: 12px; width: 100%; }
input[type="date"]:focus-visible { outline: 3px solid var(--link); outline-offset: 2px; }
.stack-form { display: flex; flex-direction: column; gap: 1rem; }
.stack-form fieldset .check { min-height: 44px; }
.due-pick { width: 100%; }
.due-pick span { flex: 1; min-width: 0; }

/* =============================================================================================================
   Who owes what: month navigation, debts, arrears, empty states.
   ============================================================================================================= */
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.pill.bad { background: var(--bad-bg); color: var(--bad-fg); }
.pill.small { font-size: .68rem; padding: .1rem .5rem; margin-left: .35rem; vertical-align: middle; }
.badge.warn { background: #f5a524; color: #3b2600; }
.tab .badge.warn { background: #f5a524; color: #3b2600; }
.nav-link .badge.warn { margin-left: auto; }
.tile.bad { background: var(--bad-bg); color: var(--bad-fg); }
.tile.warn { background: var(--warn-bg); color: var(--warn-fg); }

/* month selector: ‹ noviembre 2026 › */
.monthnav { display: inline-flex; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.mn-btn { width: 44px; min-height: 44px; display: grid; place-items: center; color: var(--text); text-decoration: none; }
.mn-btn:hover { background: var(--ground); }
.mn-btn.off { color: var(--line); pointer-events: none; }
.mn-label { display: inline-flex; align-items: center; gap: .5rem; min-height: 44px; padding: 0 .5rem; font-weight: 700; font-size: .875rem; }

/* cards in the dashboard's right column */
.late-card { background: var(--bad-bg); color: var(--bad-fg); border-radius: var(--radius); padding: 1.25rem; display: flex; flex-direction: column; gap: .35rem; text-decoration: none; }
.late-card .stat-number { color: var(--bad-fg); }
.late-card.calm { background: var(--ok-bg); color: var(--ok-fg); }
.late-card.calm .stat-number { color: var(--ok-fg); }
.late-card .stat-link { font-weight: 800; min-height: 44px; display: inline-flex; align-items: center; }
.stat-number.big { font-size: clamp(2rem, 7vw, 2.8rem); }
.top .grow { flex: 1 1 280px; min-width: 0; }
.card.stat .btn { margin-top: .25rem; }
.card.stat a.btn { text-align: center; }

/* first steps */
.steps-card h2 { margin-bottom: .25rem; }
.checklist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .6rem; }
.checklist li { display: grid; grid-template-columns: 36px 1fr auto; gap: .75rem; align-items: center; }
.checklist .step-text { display: flex; flex-direction: column; min-width: 0; }
.checklist li.done .step-text b { text-decoration: line-through; color: var(--muted); }
@media (max-width: 560px) { .checklist li { grid-template-columns: 36px 1fr; } .checklist li > .btn { grid-column: 1 / -1; } }

/* a house that owes: who, which months, how much, and what to do about it */
.mchip { display: inline-block; padding: .1rem .5rem; border-radius: 8px; font-size: .72rem; font-weight: 800; text-transform: capitalize; background: var(--warn-bg); color: var(--warn-fg); }
.mchip.bad { background: var(--bad-bg); color: var(--bad-fg); }
.list.stack li.debt, .list li.debt { display: grid; grid-template-columns: 44px minmax(0, 1fr) auto auto; gap: .5rem .9rem; align-items: center; }
.debt-main { display: flex; flex-direction: column; gap: .3rem; min-width: 0; }
.debt-main b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.months { display: flex; flex-wrap: wrap; gap: .3rem; }
.debt-total { display: flex; flex-direction: column; align-items: flex-end; }
.debt-actions { display: flex; flex-wrap: wrap; gap: .5rem; justify-content: flex-end; }
.list.compact li.debt { grid-template-columns: 44px minmax(0, 1fr) auto; }
.list.compact .debt-actions { grid-column: 1 / -1; justify-content: stretch; }
.list.compact .debt-actions .btn { flex: 1; }
@media (max-width: 719px) {
  .list.stack li.debt, .list li.debt { grid-template-columns: 44px minmax(0, 1fr) auto; }
  .debt-actions { grid-column: 1 / -1; justify-content: stretch; }
  .debt-actions .btn { flex: 1; }
}
.tile { flex: none; }

/* houses list with their state and the quick action */
.list li.house-row { display: grid; grid-template-columns: 44px minmax(0, 1fr) auto auto; gap: .5rem .9rem; align-items: center; }
.house-main { display: flex; flex-direction: column; min-width: 0; }
.house-main b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.house-state { display: flex; flex-direction: column; align-items: flex-end; gap: .15rem; }
@media (max-width: 719px) {
  .list li.house-row { grid-template-columns: 44px minmax(0, 1fr) auto; }
  .list li.house-row .actions { grid-column: 1 / -1; }
  .list li.house-row .actions .btn { flex: 1; }
}

.searchbar { display: flex; gap: .5rem; align-items: center; }
.searchbar input[type="search"] { min-height: 44px; padding: 0 .9rem; font: inherit; color: inherit; background: var(--ground); border: 1.5px solid var(--line); border-radius: 12px; width: min(100%, 240px); }
.searchbar input[type="search"]:focus-visible { outline: 3px solid var(--link); outline-offset: 2px; }
@media (max-width: 560px) { .searchbar { width: 100%; } .searchbar input[type="search"] { flex: 1; width: auto; } }

.empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: .6rem; padding: 1.5rem 1rem; }
.okring.small { width: 56px; height: 56px; background: var(--ok-bg); color: var(--ok-fg); border-radius: 50%; display: grid; place-items: center; }
.owes { display: inline-flex; align-items: baseline; gap: .4rem; font-size: 1.1rem; }

/* polish */
.top-main { flex: 2 1 460px; min-width: 0; display: flex; flex-direction: column; gap: 1rem; }
.top-main .hero { flex: none; }
.late-card .eyebrow { color: var(--bad-fg); }
.late-card .stat-link, .late-card .small { color: var(--bad-fg); }
.late-card.calm .eyebrow, .late-card.calm .small { color: var(--ok-fg); }
td.act .btn { white-space: nowrap; }

/* live search */
[hidden] { display: none !important; }
.combo { flex: 1 1 280px; display: flex; flex-wrap: wrap; gap: .5rem; min-width: 0; }
.combo .combo-search { flex: 1 1 150px; min-height: 48px; padding: 0 .9rem; font: inherit; color: inherit; background: var(--surface); border: 1.5px solid var(--line); border-radius: 12px; min-width: 0; }
.combo select { flex: 2 1 200px; width: auto; }
.combo-search:focus-visible { outline: 3px solid var(--link); outline-offset: 2px; }
.searchbar.big { flex: 1 1 320px; }
.searchbar.big input[type="search"] { width: 100%; min-height: 52px; font-size: 1.05rem; }
.kbd-hint { color: var(--muted); }

/* adding a month that was never generated */
.addmonths { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .75rem; padding: .75rem 1rem; background: var(--ground); border-radius: 14px; }
.addmonths-buttons { display: inline-flex; flex-wrap: wrap; gap: .4rem; }
details.addmonth-all { margin-bottom: .75rem; }

details.add-house { padding: 0 1.25rem; }
details.add-house summary { min-height: 56px; display: flex; align-items: center; justify-content: space-between; gap: .75rem; cursor: pointer; list-style: none; }
details.add-house summary::-webkit-details-marker { display: none; }
details.add-house[open] { padding-bottom: 1.25rem; }
details.add-house[open] summary { margin-bottom: .5rem; }

.proof { display: grid; gap: .75rem; }
.proof-img { display: block; max-width: 100%; max-height: 22rem; border-radius: 14px; border: 1px solid var(--line); background: var(--ground); object-fit: contain; }
.proof-box { display: grid; gap: .5rem; padding: .9rem; border: 1px solid var(--line); border-radius: 14px; background: var(--ground); }
input[type="file"] { width: 100%; padding: .6rem; border: 1px dashed var(--line); border-radius: 12px; background: var(--ground); font: inherit; }

li.member { display: flex; align-items: center; justify-content: space-between; gap: .75rem; flex-wrap: wrap; }
li.member > span { display: grid; min-width: 0; }

/* Small phones (iPhone 12 mini = 375 px): tighter, nothing wraps awkwardly, controls the same height. */
@media (max-width: 480px) {
  main, .content { --gutter: 1rem; }
  .heading { padding-top: 0; }
  .head-actions { flex-direction: column; align-items: stretch; width: 100%; }
  .head-actions .monthnav { display: flex; justify-content: space-between; width: 100%; }
  .head-actions .monthnav .mn-label { flex: 1; justify-content: center; }
  .head-actions > .btn { width: 100%; }

  /* Casas: header buttons side by side, rows with one tidy action line */
  details.add-house { padding: 0 1rem; }
  details.add-house summary { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; padding: .6rem 0; min-height: 0; }
  details.add-house summary .btn { min-height: 44px; padding: 0 .5rem; white-space: nowrap; font-size: .875rem; width: 100%; }
  .house-main b { white-space: normal; overflow: visible; text-overflow: clip; line-height: 1.25; }
  .list li.house-row { gap: .5rem .75rem; padding: .85rem 0; }
  .list li.house-row .actions { display: flex; flex-wrap: nowrap; gap: .5rem; width: 100%; align-items: stretch; }
  .list li.house-row .actions .btn { flex: 1 1 0; min-height: 42px; padding: 0 .5rem; white-space: nowrap; font-size: .875rem; width: 100%; }
  .list li.house-row .actions .btn:not(.ghost) { flex: 1.6 1 0; }
  .list li.house-row .actions form { display: flex; flex: 1 1 0; margin: 0; }

  /* Pagos: filters in two columns, the history lighter */
  .filters { grid-template-columns: 1fr 1fr; gap: .75rem; }
  .filters .wide { grid-column: 1 / -1; }
  li.pay details.undo { border: 0; background: none; padding: 0; }
  li.pay details.undo summary { min-height: 40px; color: var(--muted); font-weight: 600; }
  li.pay details.undo[open] { padding-bottom: .5rem; }

  /* Registrar pago: month buttons all the same height */
  .addmonths { padding: .75rem; }
  .addmonths-buttons { align-items: stretch; }
  .addmonths-buttons .btn { min-height: 40px; padding: 0 .75rem; }
}

@media (max-width: 480px) {
  details.add-house summary span.btn { display: inline-flex; align-items: center; justify-content: center; }
  .filters select { font-size: .875rem; padding-left: .6rem; padding-right: 1.6rem; text-overflow: ellipsis; }
  .list li.house-row .actions form .btn { min-height: 42px; height: 100%; }
}

@media (max-width: 480px) {
  .debt-main b { white-space: normal; overflow: visible; text-overflow: clip; line-height: 1.25; }
  .debt-actions .btn { min-height: 44px; }
}

.btn.danger { background: var(--bad-fg); color: #fff; border: 0; }
