/* ============================================================================
   Entre Dos — "sharpened" redesign
   Warm, editorial ledger of trust between two people — pushed to feel premium.
   Drop-in replacement for public/css/styles.css. Same class names as before,
   so no markup is required for ~90% of the look. The signature 1px hairline
   "between two" stays the load-bearing motif; money now leads in big Fraunces
   numerals; the PIN gate and the "Al día" saldo become a dark espresso hero;
   lists read as one connected ledger card. Pairs Fraunces (money/human moments)
   with Hanken Grotesk (ledger data — tabular-nums).
   NOTE: update the Google Fonts <link> in index.html to load Hanken Grotesk
   (see handoff/index-head.html).
   ========================================================================== */

:root {
  --paper: #F1E9DC;
  --surface: #FCF8F1;
  --surface-alt: #EFE6D6;
  --ink: #221C15;
  --muted: #7C715D;            /* AA on paper/surface */
  --line: #E4D9C5;
  --hair: #ECE3D2;             /* softer inner divider */
  --accent: #A8552E;           /* terracotta — primary */
  --accent-strong: #8E431F;
  --accent-soft: #F1E0D2;
  --accent-ink: #FCF8F1;
  --accent-2: #3C6A50;         /* olive-green — settled */
  --partyA: #2F5E86;
  --partyB: #A8466E;
  --partyA-soft: #E6ECF2;
  --partyB-soft: #F5E5EC;
  --cat-soft: #E7EFE8;
  --danger: #9E3B2C;
  --success: #3C6A50;
  /* dark hero (brand + balance moments) */
  --hero-bg: #241E17;
  --hero-ink: #F2EBDC;
  --hero-muted: #B6AB95;
  --hero-line: #3B342A;
  --hero-accent: #D98A5B;
  --chartfill: rgba(217, 138, 91, 0.16);
  --shadow: 0 2px 10px rgba(60, 45, 25, 0.06);
  --card-shadow: 0 1px 2px rgba(60, 45, 25, 0.05), 0 10px 26px -14px rgba(60, 45, 25, 0.22);
  --shadow-fab: 0 14px 30px -10px rgba(168, 85, 46, 0.7);
  --radius: 22px;
  --radius-sm: 14px;
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #17130E;
    --surface: #211B14;
    --surface-alt: #2A231A;
    --ink: #EDE3D0;
    --muted: #A0937C;
    --line: #372F24;
    --hair: #2C251B;
    --accent: #D08A5E;
    --accent-strong: #E0966A;
    --accent-soft: #33271D;
    --accent-ink: #17130E;
    --accent-2: #7FB18C;
    --partyA: #7BA8CF;
    --partyB: #D08AA8;
    --partyA-soft: #22303C;
    --partyB-soft: #36262E;
    --cat-soft: #22302A;
    --danger: #D98473;
    --success: #7FB18C;
    --hero-bg: #0F0C08;
    --hero-ink: #F2EBDC;
    --hero-muted: #9C9079;
    --hero-line: #2C251B;
    --hero-accent: #E0966A;
    --chartfill: rgba(208, 138, 94, 0.18);
    --shadow: 0 2px 12px rgba(0, 0, 0, 0.35);
    --card-shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 12px 28px -16px rgba(0, 0, 0, 0.6);
    --shadow-fab: 0 14px 30px -10px rgba(0, 0, 0, 0.6);
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; padding: 0; }
body {
  font-family: 'Hanken Grotesk', system-ui, sans-serif;
  background: var(--paper);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  line-height: 1.45;
}
h1, h2, h3, .amount, .wordmark, .card .v, .aldia-total, .title, .section-head .total { font-family: 'Fraunces', Georgia, serif; }
.amount, .card .v, .aldia-total, table.aldia td, table.aldia th, .section-head .total { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.error { color: var(--danger); font-size: 0.9rem; }

.ic { display: block; }
.ic * { vector-effect: non-scaling-stroke; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

.btn:focus-visible, .nav-btn:focus-visible, .chip:focus-visible,
.fab:focus-visible, .utm-edit:focus-visible, .sheet-link:focus-visible,
.year-pill:focus-visible, .iconbtn:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}

.eyebrow {
  font-size: 0.7rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.14em; color: var(--muted);
}

/* ---------- PIN overlay — dark espresso brand moment ---------- */
.overlay {
  position: fixed; inset: 0; z-index: 50;
  display: grid; place-items: center; padding: 24px;
  background:
    radial-gradient(130% 90% at 50% -10%, rgba(217, 138, 91, 0.22) 0%, rgba(36, 30, 23, 0) 58%),
    var(--hero-bg);
  color: var(--hero-ink);
}
.pin-card {
  width: 100%; max-width: 340px; text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 14px;
  background: none; border: none; box-shadow: none; padding: 8px;
}
.seal {
  width: 62px; height: 62px; border-radius: 18px; background: var(--accent);
  color: var(--accent-ink); display: grid; place-items: center;
  box-shadow: 0 10px 26px -8px rgba(168, 85, 46, 0.7); position: relative;
}
.seal .ic { width: 32px; height: 32px; }
.wordmark {
  margin: 12px 0 0; font-weight: 600; font-size: 2.4rem; letter-spacing: -0.01em;
  color: var(--hero-ink); font-variation-settings: 'opsz' 110;
  display: inline-flex; align-items: center;
}
.wordmark .wm-rule {
  display: inline-block; width: 0.6em; height: 2px;
  background: var(--accent); margin: 0 0.2em; border-radius: 2px;
}
.pin-sub { margin: 4px 0 0; color: var(--hero-muted); }
.pin-field {
  width: 100%; max-width: 240px; margin: 14px auto 2px; position: relative;
}
#pin-input {
  width: 100%; font-family: 'Fraunces', serif; font-size: 1.9rem; font-weight: 600;
  letter-spacing: 0.5em; text-indent: 0.5em; text-align: center;
  padding: 8px 4px 12px; border: none; border-bottom: 1.5px solid var(--hero-line);
  background: transparent; color: var(--hero-ink); caret-color: var(--accent);
  transition: border-color 0.18s var(--ease);
}
#pin-input::placeholder { color: var(--hero-line); }
#pin-input:focus { outline: none; border-bottom: 2px solid var(--accent); }
.pin-card .btn-primary {
  width: 100%; max-width: 260px; margin-top: 16px;
  box-shadow: 0 10px 24px -10px rgba(168, 85, 46, 0.7);
}
.pin-tagline {
  margin: 22px 0 0; font-family: 'Fraunces', serif; font-style: italic;
  font-size: 0.9rem; color: var(--hero-muted); max-width: 250px;
}
.shake { animation: shake 0.12s var(--ease) 0s 3; }
@keyframes shake { 0%,100% { transform: translateX(0); } 25% { transform: translateX(-2px); } 75% { transform: translateX(2px); } }

/* ---------- buttons ---------- */
.btn {
  font-family: inherit; font-size: 1rem; font-weight: 600;
  padding: 14px 18px; border-radius: 14px; border: 1px solid transparent;
  cursor: pointer; transition: transform 0.05s ease, filter 0.15s ease, background 0.15s ease;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { filter: brightness(1.05); }
.btn-ghost { background: transparent; border-color: var(--line); color: var(--ink); }
.btn-danger { background: transparent; color: var(--danger); border-color: color-mix(in srgb, var(--danger) 35%, transparent); }
.btn-block { width: 100%; }

/* ---------- layout ---------- */
#app { max-width: 520px; margin: 0 auto; min-height: 100vh; padding-bottom: 150px; }
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 22px 8px; background: var(--paper);
}
.topbar .titles { display: flex; flex-direction: column; gap: 2px; }
.title { margin: 0; font-size: 1.55rem; font-weight: 600; font-variation-settings: 'opsz' 72; line-height: 1.1; }
.conn { display: inline-flex; align-items: center; gap: 7px; font-size: 0.7rem; font-weight: 600; letter-spacing: 0.04em; color: var(--muted); white-space: nowrap; }
.conn .ic { width: 12px; height: 12px; }
.topbar-actions { display: flex; align-items: center; gap: 8px; }
.iconbtn {
  background: none; border: none; cursor: pointer; color: var(--muted);
  padding: 6px; display: grid; place-items: center; border-radius: 9px;
  transition: color 0.15s var(--ease), background 0.15s var(--ease);
}
.iconbtn:hover { color: var(--ink); background: var(--surface-alt); }
.iconbtn .ic { width: 22px; height: 22px; }
.view { padding: 8px 20px 8px; }

/* ---------- year filter -> segmented control ---------- */
.yearbar {
  display: flex; gap: 2px; padding: 3px; width: max-content; max-width: 100%;
  background: var(--surface-alt); border-radius: 12px; margin: 0 0 16px;
  overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none;
}
.yearbar::-webkit-scrollbar { display: none; }
.year-pill {
  flex: none; font: inherit; font-size: 0.8rem; font-weight: 600;
  padding: 6px 14px; border-radius: 9px; border: none;
  background: transparent; color: var(--muted); cursor: pointer;
  transition: background 0.15s var(--ease), color 0.15s var(--ease);
}
.year-pill.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(60, 45, 25, 0.12); }

/* ---------- section head -> big "hero" total ---------- */
.section-head {
  display: flex; flex-direction: column; align-items: flex-start; gap: 7px;
  margin: 6px 4px 16px;
}
.section-head .eyebrow { color: var(--accent); }
.section-head .total {
  font-weight: 600; font-size: 2.5rem; line-height: 1.02; letter-spacing: -0.02em;
}

/* ---------- list rows -> one connected ledger card ---------- */
.view .row {
  background: var(--surface); border: 1px solid var(--line); border-bottom: none;
  border-radius: var(--radius) var(--radius) 0 0; margin-bottom: 0; box-shadow: none;
  padding: 16px 18px; display: flex; gap: 13px; align-items: center;
}
/* The first row of the run rounds its top; any row that follows another row
   resets it. (`:first-of-type` can't do this — .section-head / .yearbar are
   <div> siblings ahead of the rows, so it never matches the first .row.) */
.view .row + .row { border-top-left-radius: 0; border-top-right-radius: 0; }
.view .row:last-of-type {
  border-bottom: 1px solid var(--line);
  border-bottom-left-radius: var(--radius); border-bottom-right-radius: var(--radius);
  box-shadow: var(--card-shadow);
}
.row .grow { flex: 1; min-width: 0; }
.row .line1 { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.row .desc { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* payments lead with the month name set in Fraunces */
#view-pension .desc { font-family: 'Fraunces', serif; font-size: 1.08rem; }
#view-pension .row-ico { display: none; }   /* clean ledger — month leads, no icon box */
.row .rowbtn { display: none; }              /* whole row is the tap target */
.amount { font-weight: 600; white-space: nowrap; font-size: 1.05rem; }
.amount.pos { color: var(--ink); }
.row .meta { color: var(--muted); font-size: 0.8rem; margin-top: 4px; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.row-ico {
  width: 46px; height: 46px; flex: none; border-radius: 12px;
  background: var(--accent-soft); color: var(--accent);
  display: grid; place-items: center;
}
.row-ico .ic { width: 20px; height: 20px; }
.tag {
  font-size: 0.7rem; font-weight: 600; letter-spacing: 0.01em;
  padding: 3px 9px; border-radius: 999px; background: var(--surface-alt); color: var(--muted);
  display: inline-flex; align-items: center; gap: 4px;
}
.tag .ic { width: 13px; height: 13px; }
.tag.party-a { background: var(--partyA-soft); color: var(--partyA); }
.tag.party-b { background: var(--partyB-soft); color: var(--partyB); }
.tag.cat { background: var(--cat-soft); color: var(--accent-2); }
.thumb { width: 46px; height: 46px; flex: none; border-radius: 12px; object-fit: cover; border: 1px solid var(--line); cursor: pointer; background: var(--surface-alt); }
.thumb-empty { display: grid; place-items: center; color: var(--accent); background: var(--accent-soft); }
.thumb-empty .ic { width: 20px; height: 20px; }

.empty { text-align: center; color: var(--muted); padding: 56px 16px; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.empty .big { color: var(--muted); margin-bottom: 6px; }
.empty .big .ic { width: 48px; height: 48px; }
.empty strong { color: var(--ink); font-weight: 600; }

/* ---------- summary cards ---------- */
.cards { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 14px; }
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; margin-bottom: 14px; box-shadow: var(--card-shadow);
}
.cards .card { margin-bottom: 0; border-radius: 18px; }
.card.full { grid-column: 1 / -1; }
.card .k { color: var(--muted); font-size: 0.66rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em; }
.card .v { font-size: 1.5rem; font-weight: 600; margin-top: 6px; letter-spacing: -0.01em; font-variation-settings: 'opsz' 48; }
.balance { font-size: 1.05rem; margin-top: 10px; line-height: 1.4; }
.balance strong { font-family: 'Fraunces', serif; color: var(--accent-strong); }
.balance-even { display: inline-flex; align-items: center; gap: 6px; color: var(--success); font-weight: 600; }
.balance-even .ic { width: 20px; height: 20px; }
.conn-label { color: var(--muted); }
.aldia-sub .delta { display: inline-flex; align-items: center; }
.split { display: flex; justify-content: space-between; gap: 16px; margin-top: 14px; }
.split .who .v { font-size: 1.25rem; }

/* par-bar "between two" balance beam */
.parbar { margin: 16px 0 4px; }
.parbar-track {
  position: relative; height: 8px; border-radius: 999px;
  background: linear-gradient(90deg, var(--partyA), var(--partyB)); opacity: 0.95;
  overflow: visible;
}
.parbar-track::before {
  content: ''; position: absolute; inset: 0; border-radius: 999px;
  background: var(--surface-alt); opacity: 0;
}
.parbar-fill { position: absolute; top: 0; height: 8px; border-radius: 999px; transition: width 0.4s var(--ease), left 0.4s var(--ease); }
.parbar-fulcrum {
  position: absolute; left: 50%; top: 50%; width: 11px; height: 11px; border-radius: 50%;
  transform: translate(-50%, -50%); background: var(--ink);
  border: 2px solid var(--surface); box-shadow: 0 0 0 1px var(--line);
}
.parbar.even .parbar-fulcrum { background: var(--success); }
.parbar-ends { display: flex; justify-content: space-between; margin-top: 12px; font-size: 0.8rem; }
.parbar-ends .a { color: var(--partyA); font-weight: 600; }
.parbar-ends .b { color: var(--partyB); font-weight: 600; }

.sheet-link { display: inline-flex; align-items: center; gap: 6px; color: var(--accent); text-decoration: none; font-weight: 600; }
.sheet-link .ic { width: 18px; height: 18px; }
#copy-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; background: var(--ink); color: var(--paper); border-color: transparent; }
#copy-btn .ic { width: 18px; height: 18px; }

/* ---------- FAB + bottom nav ---------- */
.fab {
  position: fixed; right: calc(50% - 244px); bottom: 92px; z-index: 20;
  width: 58px; height: 58px; border-radius: 18px; border: none;
  background: var(--accent); color: var(--accent-ink);
  display: grid; place-items: center;
  box-shadow: var(--shadow-fab); cursor: pointer;
  transition: transform 0.08s ease, filter 0.15s ease;
}
.fab:active { transform: translateY(1px) scale(0.97); }
.fab .ic { width: 26px; height: 26px; }
@media (max-width: 540px) { .fab { right: 22px; } }
.fab.hidden { display: none; }

.bottomnav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 15;
  max-width: 520px; margin: 0 auto;
  display: grid; grid-template-columns: repeat(4, 1fr);
  background: var(--surface); border-top: 1px solid var(--line);
  padding: 10px 12px calc(16px + env(safe-area-inset-bottom));
}
.bottomnav.cols-3 { grid-template-columns: repeat(3, 1fr); }
.nav-btn {
  position: relative;
  background: none; border: none; cursor: pointer; color: var(--muted);
  font: inherit; font-size: 0.68rem; font-weight: 600; display: flex; flex-direction: column;
  align-items: center; gap: 5px; padding: 4px;
  transition: color 0.16s var(--ease);
}
.nav-btn .ico {
  display: grid; place-items: center; width: 42px; height: 28px; border-radius: 9px;
  transition: background 0.16s var(--ease);
}
.nav-btn .ico .ic { width: 20px; height: 20px; }
.nav-btn.active { color: var(--accent); }
.nav-btn.active .ico { background: var(--accent-soft); }

/* ---------- modal / bottom sheet ---------- */
#modal-root:empty { display: none; }
.sheet-backdrop {
  position: fixed; inset: 0; z-index: 40; background: rgba(20, 14, 8, 0.5);
  display: flex; align-items: flex-end; justify-content: center;
}
.sheet {
  width: 100%; max-width: 520px; background: var(--surface);
  border-radius: 24px 24px 0 0; padding: 20px 18px calc(22px + env(safe-area-inset-bottom));
  box-shadow: 0 -6px 28px rgba(40, 30, 20, 0.22); max-height: 92vh; overflow-y: auto;
  animation: slideup 0.22s var(--ease);
}
@keyframes slideup { from { transform: translateY(28px); opacity: 0; } to { transform: none; opacity: 1; } }
.sheet h2 { margin: 4px 0 16px; font-size: 1.35rem; font-weight: 600; font-variation-settings: 'opsz' 48; }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 0.8rem; font-weight: 500; color: var(--muted); margin-bottom: 6px; }
.field input, .field textarea {
  width: 100%; font: inherit; padding: 12px 13px; border: 1px solid var(--line);
  border-radius: var(--radius-sm); background: var(--surface); color: var(--ink);
}
.field input:focus, .field textarea:focus { outline: 2px solid var(--accent); border-color: transparent; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  font: inherit; font-size: 0.9rem; padding: 9px 15px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer;
}
.chip.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.sheet-actions { display: flex; gap: 10px; margin-top: 10px; }
.sheet-actions .btn { flex: 1; }

.receipt-box { margin: 6px 0 12px; }
.receipt-prev { width: 100%; max-height: 180px; object-fit: contain; border-radius: 12px; border: 1px solid var(--line); background: var(--surface-alt); }
.scan-hint { font-size: 0.82rem; color: var(--accent-2); margin-top: 6px; display: inline-flex; align-items: center; gap: 6px; }
.scan-hint .ic { width: 15px; height: 15px; }
.scan-hint.warn { color: var(--accent); }

.modal-img { max-width: 94vw; max-height: 88vh; border-radius: 12px; }
.img-backdrop { position: fixed; inset: 0; z-index: 45; background: rgba(15, 10, 6, 0.88); display: grid; place-items: center; }
.toast {
  position: fixed; left: 50%; bottom: 168px; transform: translateX(-50%); z-index: 60;
  background: var(--ink); color: var(--paper); padding: 11px 19px; border-radius: 999px;
  font-size: 0.9rem; box-shadow: var(--shadow); animation: toastin 0.2s var(--ease);
}
@keyframes toastin { from { transform: translate(-50%, 6px); opacity: 0; } to { transform: translate(-50%, 0); opacity: 1; } }
.spin { display: inline-block; width: 14px; height: 14px; border: 2px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- "Al día" tab — dark espresso saldo hero ---------- */
#aldia-card {
  text-align: left; margin: 6px 0 14px; padding: 22px 22px 20px;
  position: relative; overflow: hidden; border-radius: 24px;
  background:
    radial-gradient(120% 100% at 100% 0%, rgba(217, 138, 91, 0.18) 0%, rgba(36, 30, 23, 0) 60%),
    var(--hero-bg);
  color: var(--hero-ink); box-shadow: 0 18px 40px -18px rgba(30, 20, 8, 0.5);
  display: flex; flex-direction: column; align-items: flex-start; gap: 6px;
}
#aldia-card .eyebrow { color: var(--hero-muted); }
.aldia-total { margin: 6px 0 0; font-size: 3rem; font-weight: 600; line-height: 1; letter-spacing: -0.02em; color: var(--hero-ink); font-variation-settings: 'opsz' 144; }
.aldia-sub { margin: 8px 0 0; color: var(--hero-muted); font-size: 0.84rem; display: inline-flex; align-items: center; gap: 6px; }
.aldia-sub .ic { width: 15px; height: 15px; }
.aldia-sub .delta { color: var(--hero-accent); font-weight: 600; }
.aldia-sub .delta.is-down { color: var(--hero-success); }  /* pending fell — readable green on the espresso hero */
.aldia-utm-clp { margin: 4px 0 0; color: var(--hero-muted); font-size: 0.74rem; opacity: 0.82; }
.aldia-utm-badge {
  position: absolute; top: 20px; right: 22px;
  border: 1px solid var(--hero-line); border-radius: 999px;
  padding: 5px 12px; font-size: 0.68rem; font-variant-numeric: tabular-nums;
  color: var(--hero-muted); white-space: nowrap;
}
/* settled $0 state */
.aldia-even { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 8px 0; width: 100%; }
.aldia-even .glyph { color: var(--success); animation: evenpop 0.32s var(--ease); }
.aldia-even .glyph .ic { width: 56px; height: 56px; }
.aldia-even .label { font-family: 'Fraunces', serif; font-size: 1.5rem; font-weight: 600; color: var(--hero-accent); }
.aldia-even .a-favor { font-size: 0.84rem; color: var(--hero-muted); }
@keyframes evenpop { from { transform: scale(0.9); opacity: 0; } to { transform: scale(1); opacity: 1; } }

#aldia-chart { display: block; width: 100%; height: 80px; margin: 0 0 16px; color: var(--accent); overflow: visible; }
#aldia-chart .area { fill: var(--chartfill); }
#aldia-chart .line { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
#aldia-chart .base { stroke: var(--line); stroke-width: 1; }
#aldia-chart .node { fill: var(--surface); stroke: var(--accent); stroke-width: 2; }

#aldia-table { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.aldia {
  width: 100%; border-collapse: collapse; font-size: 0.82rem; font-weight: 500;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden; box-shadow: var(--card-shadow);
}
table.aldia th, table.aldia td { padding: 11px 12px; text-align: right; white-space: nowrap; }
table.aldia th:first-child, table.aldia td:first-child { text-align: left; }
table.aldia thead th { background: var(--surface-alt); color: var(--muted); font-weight: 700; font-size: 0.64rem; text-transform: uppercase; letter-spacing: 0.06em; }
table.aldia tbody tr { border-top: 1px solid var(--hair); }
table.aldia tbody tr.is-current { background: var(--accent-soft); font-weight: 700; box-shadow: inset 3px 0 0 var(--accent); }
table.aldia tbody tr.is-current td:first-child { color: var(--accent-strong); }
table.aldia em { color: var(--muted); font-style: italic; }
.utm-cell { white-space: nowrap; }
.utm-edit {
  background: none; border: none; cursor: pointer; color: var(--muted);
  padding: 0; min-width: 44px; min-height: 44px; display: inline-grid; place-items: center;
}
.utm-edit .ic { width: 14px; height: 14px; }
.utm-edit:hover { color: var(--accent); }

.aldia-legal { text-align: center; color: var(--muted); font-size: 0.76rem; margin-top: 16px; font-family: 'Fraunces', serif; font-style: italic; }

/* ---------- reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important; animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  .shake { animation: none; }
}

/* ============================================================================
   Handoff refinements — paired with the ui.js / index.html markup changes.
   ========================================================================== */

/* Tokens added by these refinements:
   --muted-strong : a semi-opaque ink that composites over whatever background
     it sits on, so small secondary text clears WCAG AA (4.5:1) on --paper,
     --surface-alt and --accent-soft in BOTH themes — unlike flat --muted, which
     is ~3.9:1 on the light paper. --ink flips per theme, so this adapts too.
   --hero-success : a green that stays legible on the always-dark espresso hero
     (the "down/good" delta arrow), where the page-level --success collapses. */
:root {
  --muted-strong: color-mix(in srgb, var(--ink) 65%, transparent);
  --hero-success: #7FB18C;
}

/* section-head: the count moves out of the eyebrow into a quiet line
   under the big total, so the hero reads eyebrow -> number -> count. */
.section-head .count { color: var(--muted-strong); font-size: 0.82rem; font-weight: 500; margin-top: -1px; }

/* segmented year control: lift the resting (un-selected) pill label to AA on
   the --surface-alt track; the active pill stays dominant via its bg + shadow. */
.year-pill:not(.on) { color: var(--muted-strong); }

/* "Al día": the CTA is lifted out of the dark saldo hero into its own
   light accent-soft chip directly below it. Empty (settled state) collapses. */
#aldia-cta:empty { display: none; }
.aldia-cta-chip {
  background: var(--accent-soft); border-radius: 16px;
  padding: 14px 16px; margin: 6px 0 16px;
  color: var(--ink); font-size: 0.96rem; line-height: 1.45;
}
.aldia-cta-chip strong { font-family: 'Fraunces', serif; color: var(--accent-strong); }
.aldia-cta-chip .aldia-note { margin: 8px 0 0; color: var(--muted-strong); font-size: 0.76rem; }

/* "Al día" table on a phone: 6 columns is too dense. Shed the UTM column and
   the per-month Pendiente, leaving the core "owed vs paid vs running balance"
   story: Mes, Pensión, Pagado, Saldo acum. Tighter cells + slightly smaller
   type keep all four readable without clipping the saldo.
   Tradeoff (per handoff item #4, which suggests "only show UTM column >=420px"):
   UTM auto-ingests from mindicador, and its manual-edit pencil lives in the UTM
   cell, so manual UTM correction is reachable at >=420px (tablet / desktop /
   landscape) only — not on a sub-420px phone. */
@media (max-width: 420px) {
  table.aldia th:nth-child(2), table.aldia td:nth-child(2),
  table.aldia th:nth-child(5), table.aldia td:nth-child(5) { display: none; }
  table.aldia { font-size: 0.78rem; }
  table.aldia th, table.aldia td { padding: 10px 9px; }
}
