/* iPhone grouped-list look. Spacing on a 4 px scale; sizes in em so his text-size setting applies. */
:root {
  color-scheme: light dark;  /* native date pickers and selects follow dark mode */
  --accent: #1F3A5F;
  --on-accent: #FFFFFF;
  --ink: #1A1D23;
  --muted: #5B616E;
  --rule: #E3E7ED;
  --bg: #F2F2F7;
  --cell: #FFFFFF;
  --fill: #E8ECF2;
  --danger: #C4001A;
}
@media (prefers-color-scheme: dark) {
  /* deep navy night, not plain black (decided 2026-11-25) */
  :root { --accent: #9DBCE6; --on-accent: #0B1522; --ink: #F2F4F7; --muted: #A3AEC2; --rule: #2A3953; --bg: #0E1726; --cell: #18243A; --fill: #22314B; --danger: #FF7B7B; }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; } /* else display:flex below would show hidden things */
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font: 17px/1.4 system-ui, sans-serif;
  font: -apple-system-body; /* iPhone text size setting */
  color: var(--ink);
  background: var(--bg);
  padding: env(safe-area-inset-top) max(16px, env(safe-area-inset-right)) calc(96px + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
}
main { max-width: 560px; margin: 0 auto; }
h1 { margin: 0; padding: 48px 4px 8px; font-size: 2em; font-weight: 700; letter-spacing: -0.02em; }
.muted { color: var(--muted); }

/* Home header (like the PDF header) and the "Por cobrar" card */
.biz { display: flex; align-items: center; gap: 12px; padding: 48px 4px 8px; }
.biz h1 { padding: 0; }
.biz p { margin: 0; font-size: 0.85em; }
.badge { flex: none; display: grid; place-items: center; width: 44px; height: 44px; border-radius: 10px; background: var(--accent); color: var(--on-accent); font-weight: 600; }
.sum { margin-top: 16px; padding: 12px 16px; background: var(--cell); border-radius: 12px; border-top: 3px solid var(--accent); }
.sum .group-title { margin: 0; }
.sum p { margin: 0; }
.sum-total { font-size: 2em; font-weight: 700; color: var(--accent); font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.actions.split { flex-direction: row; flex-wrap: wrap; }  /* side by side; stacks with big text */
.split > * { flex: 1 1 140px; }

.empty { text-align: center; padding: 40px 16px 32px; }
.empty-icon { width: 48px; height: 48px; fill: none; stroke: var(--muted); stroke-width: 1.25; stroke-linejoin: round; stroke-linecap: round; }
.empty h2 { margin: 12px 0 4px; font-size: 1.2em; font-weight: 600; }
.empty p { margin: 0; }

.group-title { margin: 24px 16px 8px; font-size: 0.8em; font-weight: 400; text-transform: uppercase; letter-spacing: 0.02em; color: var(--muted); }
.group { background: var(--cell); border-radius: 12px; overflow: hidden; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 48px; padding: 12px 16px; }
.group > * + * { border-top: 0.5px solid var(--rule); }
.link { justify-content: flex-start; color: inherit; text-decoration: none; }
.link > :first-child { margin-right: auto; }
.link::after { content: "›"; color: var(--muted); font-size: 1.4em; line-height: 1; }
.group-note { margin: 8px 16px 0; font-size: 0.8em; min-height: 1.4em; }

button, .secondary {
  font: inherit;
  font-weight: 600;
  min-height: 48px;
  padding: 0 20px;
  border-radius: 12px;
  border: 0;
  cursor: pointer;
}
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
button:disabled { opacity: 0.5; }
.actions { display: flex; flex-direction: column; align-items: stretch; gap: 8px; margin-top: 16px; }
.group .actions { margin-top: 0; }
.primary { background: var(--accent); color: var(--on-accent); }
.secondary { display: flex; align-items: center; justify-content: center; text-decoration: none; background: var(--fill); color: var(--accent); }

.update {
  position: fixed; left: 16px; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom));
  max-width: 528px; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 8px 8px 8px 16px; border-radius: 14px; background: var(--ink); color: var(--bg);
}
.update button { background: var(--bg); color: var(--ink); min-height: 44px; }

nav { padding-top: 8px; }
.back { background: none; color: var(--accent); padding: 0 4px; font-weight: 400; min-height: 44px; }
#page h1 { padding-top: 4px; }
.wide { width: 100%; margin-top: 24px; }
.danger { background: none; color: var(--danger); }
.overdue { color: var(--danger); font-weight: 600; }
.paid { color: var(--accent); font-weight: 600; }
.amt { font-weight: 500; font-variant-numeric: tabular-nums; white-space: nowrap; }
/* FADE: a screen appears with a short quiet fade, nothing bounces */
main:not([hidden]) { animation: fade 200ms ease-out; }
@keyframes fade { from { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { main { animation: none !important; } }
.row input[type=checkbox] { margin: 0; accent-color: var(--accent); }  /* the whole row is the tap target */

.field { display: block; padding: 8px 16px 10px; }
.field-label { display: block; font-size: 0.8em; color: var(--muted); }
.field:focus-within .field-label { color: var(--accent); }  /* focus cue instead of an outline */
.field input, .field select { display: block; width: 100%; font: inherit; color: inherit; background: none; border: 0; padding: 4px 0; outline: none; -webkit-appearance: none; appearance: none; }
select.secondary { -webkit-appearance: none; appearance: none; text-align: center; text-align-last: center; }
.pair { display: flex; }
.pair .field { flex: 1; min-width: 0; }
.pair .field + .field { border-left: 0.5px solid var(--rule); }
.field-error, .alert { display: block; margin-top: 6px; padding: 8px 10px; border-radius: 8px; font-size: 0.95em; font-weight: 600;
  color: var(--danger); background: color-mix(in srgb, var(--danger) 15%, transparent); }  /* big enough not to miss */
.field-error::before, .alert::before { content: "⚠︎ "; }
.group + .group, .actions + .group { margin-top: 24px; }
