/*
 * Casa — the household finance dashboard. Everything is recorded by the agent through MCP,
 * so these screens only show: big numbers, soft tiles, pill filters and lists.
 */

:root {
  color-scheme: light;

  --ink: #16241b;
  --muted: #5b665e;
  --faint: #6f7970;
  --surface: #eff1ec;
  --line: #eef0eb;
  --line-strong: #dfe3dc;
  --row-line: #f2f4f0;
  --track: #e6e9e3;
  --mint: #cfeccb;
  --mint-ink: #1c4a2a;
  --green: #1f7a45;
  --amber: #9d5720;
  --peach: #f6e9dd;
  --peach-ink: #8a4a1c;
  --paid: #e6f1ea;
  --paid-ink: #2e5c43;
  --grey-bar: #a7b0a8;
  --grey-light: #cdd3cc;
  --debt-bar: #d98a4e;
  --red: #b3261e;
  --red-soft: #fbe4e1;
  --red-ink: #7a1a14;
  --page: #fff;
  --on-ink: #fff;
  --pill-ink: #3d4a41;
  --scrim: rgb(22 36 27 / 45%);

  --radius-tile: 22px;
  --radius-card: 18px;
  --font: Manrope, system-ui, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --ink: #e8efe9;
    --muted: #a3ada6;
    --faint: #8a948c;
    --surface: #1d2721;
    --line: #243029;
    --line-strong: #33413a;
    --row-line: #212b25;
    --track: #2b362f;
    --mint: #1f4a2e;
    --mint-ink: #cfeccb;
    --green: #6fcf93;
    --amber: #e3a36c;
    --peach: #3a2a1d;
    --peach-ink: #f0c29a;
    --paid: #1f3a2a;
    --paid-ink: #a9dcbb;
    --grey-bar: #5e6a62;
    --grey-light: #414d45;
    --debt-bar: #c47a44;
    --red: #f2837a;
    --red-soft: #3b1f1c;
    --red-ink: #f5bdb6;
    --page: #111814;
    --on-ink: #111814;
    --pill-ink: #c3ccc5;
    --scrim: rgb(0 0 0 / 60%);
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --ink: #e8efe9;
  --muted: #a3ada6;
  --faint: #8a948c;
  --surface: #1d2721;
  --line: #243029;
  --line-strong: #33413a;
  --row-line: #212b25;
  --track: #2b362f;
  --mint: #1f4a2e;
  --mint-ink: #cfeccb;
  --green: #6fcf93;
  --amber: #e3a36c;
  --peach: #3a2a1d;
  --peach-ink: #f0c29a;
  --paid: #1f3a2a;
  --paid-ink: #a9dcbb;
  --grey-bar: #5e6a62;
  --grey-light: #414d45;
  --debt-bar: #c47a44;
  --red: #f2837a;
  --red-soft: #3b1f1c;
  --red-ink: #f5bdb6;
  --page: #111814;
  --on-ink: #111814;
  --pill-ink: #c3ccc5;
  --scrim: rgb(0 0 0 / 60%);
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font: 500 15px/1.4 var(--font);
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--ink); }
a:hover { color: var(--green); }
button, input, select { font: inherit; color: inherit; }
h1, h2, h3, p { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }

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

.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

/* ---------- Shell ---------- */

.app { display: flex; min-height: 100vh; min-height: 100dvh; }

.sidebar {
  position: sticky; top: 0; height: 100vh; height: 100dvh;
  width: 232px; flex: none; padding: 26px 18px;
  display: flex; flex-direction: column; gap: 30px;
  border-right: 1px solid var(--line);
}

.brand { display: flex; align-items: center; gap: 10px; font: 800 17px var(--font); text-decoration: none; }
.logo { width: 34px; height: 34px; flex: none; }

.avatars { display: flex; }
.avatars .avatar + .avatar { margin-left: -10px; }

.avatar {
  width: 34px; height: 34px; flex: none; border-radius: 50%;
  display: grid; place-items: center;
  font: 800 12px var(--font);
  border: 2px solid var(--page);
}
.avatar.is-ink { background: var(--ink); color: var(--on-ink); }
.avatar.is-mint { background: var(--mint); color: var(--mint-ink); }
.avatar.is-large { width: 48px; height: 48px; font-size: 16px; }

.sidebar nav { display: flex; flex-direction: column; gap: 4px; }

.nav-link {
  padding: 10px 14px; border-radius: 999px;
  font: 700 15px var(--font); color: var(--muted); text-decoration: none;
}
.nav-link:hover { color: var(--ink); }
.nav-link.is-active { background: var(--surface); color: var(--ink); }

.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 14px; }

.agent-pill {
  align-self: flex-start; padding: 8px 14px; border-radius: 999px;
  background: var(--mint); color: var(--mint-ink);
  font: 700 13px var(--font); text-decoration: none; white-space: nowrap;
}
.agent-pill:hover { color: var(--mint-ink); }

.account-button {
  border: 0; cursor: pointer; text-align: left;
  background: var(--surface); border-radius: 16px; padding: 10px 12px;
  display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; gap: 10px; align-items: center;
}
.account-who { min-width: 0; }
.account-name { display: block; font: 700 14px var(--font); }
.account-email { display: block; font: 500 12px var(--font); color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-action { font: 700 12px var(--font); color: var(--muted); }

.sidebar-version { padding: 0 8px; font: 600 12px var(--font); color: var(--faint); }

.app-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar { display: none; }
.tabbar { display: none; }

.page {
  flex: 1; display: flex; flex-direction: column; gap: 28px;
  padding: 30px 36px 40px;
}

@media (max-width: 899px) {
  .sidebar { display: none; }

  .topbar {
    display: flex; justify-content: space-between; align-items: center;
    padding: 16px 20px 0;
  }
  .topbar-avatars { border: 0; background: none; padding: 0; cursor: pointer; }
  .topbar .avatar { width: 38px; height: 38px; font-size: 13px; }

  .page { padding: 18px 20px 28px; }

  .tabbar {
    position: sticky; bottom: 0; z-index: 10;
    display: grid; grid-template-columns: repeat(5, 1fr);
    padding: 10px 4px calc(10px + env(safe-area-inset-bottom));
    background: var(--page); border-top: 1px solid var(--line);
  }
  .tab {
    display: flex; flex-direction: column; align-items: center; gap: 4px;
    font: 700 11px var(--font); color: var(--muted); text-decoration: none;
  }
  .tab-icon { width: 52px; height: 30px; border-radius: 999px; display: grid; place-items: center; }
  .tab svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
  .tab.is-active { color: var(--ink); }
  .tab.is-active .tab-icon { background: var(--mint); }
  .tab.is-active svg { stroke-width: 2.25; }
}

/* ---------- Page header ---------- */

.page-header { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.page-header > div { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.page-sub { font: 600 14px var(--font); color: var(--muted); display: flex; align-items: center; gap: 8px; }
.page-header h1 { font: 800 30px/1.1 var(--font); letter-spacing: -.03em; }

.month-step {
  width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center;
  background: var(--surface); color: var(--ink); text-decoration: none; font: 800 14px var(--font);
}

.owner-switch { display: flex; gap: 8px; }

.pill {
  padding: 8px 16px; border-radius: 999px;
  background: var(--surface); color: var(--pill-ink);
  font: 700 14px var(--font); text-decoration: none; white-space: nowrap;
}
.pill[aria-current="page"] { background: var(--mint); color: var(--mint-ink); }
.pill:hover { color: var(--ink); }

.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  padding: 8px 14px; border-radius: 999px; border: 1px solid var(--line-strong);
  background: var(--page); color: var(--ink);
  font: 700 13px var(--font); text-decoration: none; white-space: nowrap;
}
.chip[aria-current="page"] { background: var(--ink); border-color: var(--ink); color: var(--on-ink); }

/* ---------- Building blocks ---------- */

.hero { display: flex; flex-direction: column; gap: 8px; }
.hero-label { font: 600 14px var(--font); color: var(--muted); }
.hero-line { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; }
.hero-amount { font: 800 56px/1 var(--font); letter-spacing: -.035em; white-space: nowrap; }
.badge {
  padding: 6px 12px; border-radius: 999px; background: var(--surface); color: var(--muted);
  font: 700 13px var(--font); white-space: nowrap;
}
.badge.is-mint { background: var(--mint); color: var(--mint-ink); }

/* ---------- Inicio ---------- */

.home-top { display: flex; flex-wrap: wrap; gap: 16px; align-items: stretch; }

.home-hero {
  flex: 2 1 420px; min-width: 0; padding: 24px; border-radius: 28px;
  display: flex; flex-direction: column; justify-content: space-between; gap: 22px;
  background: var(--mint); color: var(--mint-ink);
}
.home-hero .hero-label, .home-hero .hero-note { color: inherit; }
.home-hero .hero-label { font-weight: 700; }
.home-hero .hero-amount { font-size: clamp(36px, 9vw, 48px); }
.hero-note { font: 600 14px var(--font); opacity: .85; }
.spend-meter { display: block; height: 8px; border-radius: 999px; overflow: hidden; background: color-mix(in srgb, var(--mint-ink) 18%, transparent); }
.spend-meter > span { display: block; height: 100%; border-radius: 999px; background: var(--green); }
.hero-split { display: flex; justify-content: space-between; gap: 12px; font: 600 14px var(--font); }
.hero-split a { color: inherit; text-decoration: none; padding: 6px 0; }
.hero-split b { font-weight: 800; }

.home-totals { flex: 1 1 240px; min-width: 0; display: flex; flex-direction: column; gap: 12px; }
.total-card {
  flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 4px;
  padding: 16px 20px; border-radius: 22px; background: var(--surface); color: var(--ink); text-decoration: none;
}
.total-card:hover { color: var(--ink); }
@media (max-width: 899px) {
  .home-totals { flex-direction: row; }
  .total-card { min-width: 0; }
}
.total-label { font: 600 13px var(--font); color: var(--muted); }
.total-value { font: 800 22px var(--font); letter-spacing: -.02em; white-space: nowrap; }

.pay-total { font: 800 24px var(--font); letter-spacing: -.02em; }
.pay-total span { font: 600 14px var(--font); letter-spacing: 0; color: var(--muted); }
.dues { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; }
.due { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--row-line); }
.due:last-child { border-bottom: 0; }
.due-title { font: 700 15px var(--font); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.due-amount { grid-row: 1 / 3; grid-column: 2; align-self: center; font: 800 15px var(--font); white-space: nowrap; }
.due-note { font: 600 13px var(--font); color: var(--muted); }
.due-note.is-due { color: var(--amber); }

.mini-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
.mini-card {
  --card-from: #1d2b4f; --card-to: #0b1226;
  display: flex; flex-direction: column; gap: 2px; min-width: 0; padding: 16px; border-radius: 20px;
  background: var(--card-to) linear-gradient(135deg, var(--card-from), var(--card-to)); color: #fff; text-decoration: none;
}
.mini-card:hover { color: #fff; }
.mini-card.is-teal { --card-from: #0f6b6a; --card-to: #06302f; }
.mini-card.is-graphite { --card-from: #4a4f55; --card-to: #1c1f23; }
.mini-card.is-violet { --card-from: #5b3f9e; --card-to: #241444; }
.mini-card-name { font: 700 13px var(--font); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini-card-digits { font: 600 12px ui-monospace, "SF Mono", Menlo, monospace; letter-spacing: .1em; opacity: .75; }
.mini-card-amount { margin-top: 18px; font: 800 19px var(--font); letter-spacing: -.02em; white-space: nowrap; }
.mini-card-due { font: 600 12px var(--font); opacity: .85; }

.stat { padding: 16px 18px; border-radius: var(--radius-tile); background: var(--surface); display: flex; flex-direction: column; gap: 6px; }
.stat-label { font: 600 13px var(--font); color: var(--muted); }
.stat-value { font: 800 24px var(--font); letter-spacing: -.02em; white-space: nowrap; }
.stat.is-peach { background: var(--peach); }
.stat.is-peach .stat-label, .stat.is-peach .stat-value { color: var(--peach-ink); }

.columns { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(320px, 100%), 1fr)); gap: 36px; align-items: start; }
.stack { display: flex; flex-direction: column; gap: 18px; }

.section { display: flex; flex-direction: column; gap: 10px; }
.section-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.section-head h2 { font: 800 22px var(--font); letter-spacing: -.02em; }
.section-head .aside { font: 700 14px var(--font); color: var(--muted); white-space: nowrap; }
.text-link { font: 700 14px var(--font); text-decoration: underline; text-underline-offset: 3px; white-space: nowrap; }
.section-note { font: 600 14px var(--font); color: var(--muted); }

.group-label {
  display: flex; justify-content: space-between; gap: 12px;
  padding-bottom: 6px; font: 800 13px var(--font); letter-spacing: .04em; color: var(--muted); text-transform: uppercase;
}

.row {
  display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; gap: 14px; align-items: center;
  padding: 8px 0;
}
.rows.is-lined .row { border-bottom: 1px solid var(--row-line); }

.row-badge {
  width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center;
  background: var(--surface); font: 800 14px var(--font);
}
.row-badge.is-outline { background: none; border: 1px solid var(--line-strong); }
.row-badge.is-ink { background: var(--ink); color: var(--on-ink); font-size: 11px; }
.row-badge.is-mint { background: var(--mint); color: var(--mint-ink); }
.row-badge.is-peach { background: var(--peach); color: var(--peach-ink); font-size: 13px; }
.row-badge.is-logo { overflow: hidden; background: #fff; box-shadow: inset 0 0 0 1px var(--line); }
.row-badge.is-logo img { width: 100%; height: 100%; object-fit: contain; }

.row-main { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.row-title { font: 700 15px var(--font); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-sub { font: 500 13px var(--font); color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-end { text-align: right; display: flex; flex-direction: column; gap: 2px; align-items: flex-end; }
.row-amount { font: 700 15px var(--font); white-space: nowrap; }
.row-amount.is-income { color: var(--green); }
.row-note { font: 700 12px var(--font); color: var(--muted); white-space: nowrap; }
.row-note.is-due { color: var(--amber); }
.row-note.is-quiet { font-weight: 600; color: var(--faint); }

.status { padding: 2px 8px; border-radius: 999px; font: 700 12px var(--font); white-space: nowrap; }
.status.is-paid { background: var(--paid); color: var(--paid-ink); }
.status.is-due { background: var(--peach); color: var(--amber); }

.bar { height: 6px; border-radius: 3px; background: var(--peach); overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--green); }

.progress { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 8px; margin-top: 2px; }
.progress-track { flex: 1 1 64px; max-width: 160px; height: 4px; border-radius: 2px; background: var(--track); }
.progress-track > span { display: block; height: 100%; border-radius: 2px; background: var(--ink); }
.progress-label { font: 600 12px var(--font); color: var(--muted); white-space: nowrap; }

.panel { padding: 18px; border-radius: var(--radius-tile); background: var(--surface); display: flex; flex-direction: column; gap: 12px; }
.panel h2, .panel h3 { font: 800 16px var(--font); }
.panel p { font: 500 13px/1.4 var(--font); color: var(--muted); }
.panel.is-ink { background: var(--ink); color: var(--on-ink); }
.panel.is-ink p { color: inherit; }
.panel.is-peach { background: var(--peach); }
.panel.is-peach h2, .panel.is-peach p { color: var(--peach-ink); }

.empty { padding: 18px; border-radius: var(--radius-card); background: var(--surface); font: 600 14px var(--font); color: var(--muted); }

.pager { display: flex; justify-content: space-between; gap: 12px; }

.flash { padding: 12px 14px; border-radius: 16px; background: var(--mint); color: var(--mint-ink); font: 700 14px/1.4 var(--font); }
.flash-alert { background: var(--peach); color: var(--peach-ink); }

/* ---------- Buttons and sheet ---------- */

.button {
  height: 54px; padding: 0 22px; border-radius: 999px; border: 0; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  font: 800 16px var(--font); text-decoration: none;
}
.button.is-primary { background: var(--ink); color: var(--on-ink); }
.button.is-soft { background: var(--surface); color: var(--ink); }
.button.is-outline { background: var(--page); color: var(--ink); border: 1.5px solid var(--line-strong); }

.sheet {
  width: 440px; max-width: calc(100% - 48px); padding: 0; border: 0; border-radius: 28px;
  background: var(--page); color: var(--ink);
}
.sheet::backdrop { background: var(--scrim); }
.sheet-body { padding: 28px; display: flex; flex-direction: column; gap: 18px; }
.sheet-who { display: grid; grid-template-columns: 48px minmax(0, 1fr); gap: 14px; align-items: center; }
.sheet-who strong { display: block; font: 800 18px var(--font); }
.sheet-who small { display: block; font: 500 13px var(--font); color: var(--muted); }
.sheet-copy { display: flex; flex-direction: column; gap: 6px; }
.sheet-copy h2 { font: 800 24px/1.15 var(--font); letter-spacing: -.02em; }
.sheet-copy p { font: 500 14px/1.5 var(--font); color: var(--muted); }
.sheet-form { display: flex; flex-direction: column; gap: 10px; }
.sheet-link { align-self: center; font: 700 13px var(--font); color: var(--muted); }

.switch-row {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  margin-bottom: 8px; padding: 14px 16px; border-radius: 16px; background: var(--surface); cursor: pointer;
}
.switch-row strong { display: block; font: 700 14px var(--font); }
.switch-row small { display: block; font: 500 12px var(--font); color: var(--muted); }

.switch {
  appearance: none; flex: none; margin: 0; cursor: pointer;
  width: 46px; height: 28px; border-radius: 999px; padding: 3px;
  background: var(--grey-light); display: flex; transition: background .15s;
}
.switch::before {
  content: ""; width: 22px; height: 22px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 2px rgb(0 0 0 / 20%); transition: transform .15s;
}
.switch:checked { background: var(--green); }
.switch:checked::before { transform: translateX(18px); }

@media (max-width: 899px) {
  .hero-amount { font-size: 38px; }
  .stat-value { font-size: 17px; }

  .sheet {
    width: 100%; max-width: 100%; margin: auto 0 0; border-radius: 28px 28px 0 0;
  }
  .sheet-body { padding: 22px 22px calc(34px + env(safe-area-inset-bottom)); }
  .sheet-body::before {
    content: ""; align-self: center; width: 40px; height: 5px; margin-top: -8px;
    border-radius: 3px; background: var(--line-strong);
  }
}

.section-note .is-due, .is-due { color: var(--amber); }

/* ---------- Compromisos ---------- */

.commitments { display: flex; flex-direction: column; gap: 26px; }
.commitments-top { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(420px, 100%), 1fr)); gap: 20px; align-items: stretch; }
.commitments-top .alert { align-content: center; }
.commitments-tabs .chip { min-height: 44px; display: inline-flex; align-items: center; }
.commitments-summary { display: grid; gap: 28px; align-items: start; }
@media (min-width: 900px) {
  .commitments-summary { grid-template-columns: minmax(0, 1.5fr) minmax(300px, 1fr); }
}
.commitments-parts { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.parts-title { font: 800 18px var(--font); }
.commitments .group { display: flex; flex-direction: column; gap: 6px; }
.commitments .panel { gap: 14px; }
.commitments .panel h2 { font-size: 18px; }

.pending-hero { padding: 24px 28px; gap: 14px; border-radius: 28px; background: var(--surface); }
.pending-hero .hero-line { justify-content: space-between; }
.hero-count { font: 600 13px var(--font); color: var(--muted); }
.pending-hero .usage-legend { gap: 6px 20px; font-size: 14px; }
.pending-hero .usage-legend b { color: var(--ink); }
.pending-hero .usage-legend span::before, .spend-swatch {
  content: ""; display: inline-block; width: 9px; height: 9px; margin-right: 6px; border-radius: 2px; background: var(--ink);
}
.hero-foot { display: flex; justify-content: space-between; align-items: flex-end; flex-wrap: wrap; gap: 8px 18px; }
.hero-foot .usage-line { margin-left: auto; font-size: 14px; gap: 0 10px; }
.pending-hero .hero-amount { font-size: clamp(40px, 11vw, 60px); }

.split-meter.is-shares > span { flex: 0 1 auto; flex-basis: 0; min-width: 0; }
.split-meter > .is-paid, .pending-hero .usage-legend .is-paid::before { background: var(--green); }
.split-meter > .is-overdue, .pending-hero .usage-legend .is-overdue::before { background: var(--red); }
.split-meter > .is-pending, .pending-hero .usage-legend .is-pending::before { background: var(--debt-bar); }
.split-meter > .is-fixed, .spend-swatch.is-fixed { background: var(--ink); }
.split-meter > .is-installments, .spend-swatch.is-installments { background: var(--green); }
.split-meter > .is-cards, .spend-swatch.is-cards { background: var(--debt-bar); }

.alert.is-stacked { grid-template-columns: 44px minmax(0, 1fr); align-items: start; }
.alert-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 10px; }
.alert-action.is-soft { background: var(--page); color: var(--red-ink); }
.alert-action.is-soft:hover { color: var(--red-ink); }

.calendar-section .section-head h2 { font-size: 17px; }
.calendar-section .aside { font-size: 12px; font-weight: 600; }
.calendar-screen { display: grid; gap: 24px; align-items: start; }
@media (min-width: 900px) {
  .calendar-screen { grid-template-columns: minmax(0, 1.2fr) minmax(360px, 1fr); }
}
.calendar-weekdays, .calendar { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.calendar-weekdays { margin-bottom: 6px; font: 700 12px var(--font); color: var(--faint); text-align: center; }
.calendar li a {
  min-height: 60px; border: 1px solid var(--line-strong); border-radius: 16px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  color: var(--ink); text-decoration: none;
}
.calendar li a:hover { border-color: var(--ink); }
.calendar-number { font: 700 14px var(--font); color: var(--muted); }
.calendar-dots { display: flex; gap: 3px; min-height: 6px; }
.calendar li.is-past a { background: var(--surface); border-color: transparent; }
.calendar li.is-ahead .calendar-number { color: var(--ink); }
.calendar li.is-today a { border: 2px solid var(--ink); }
.calendar li.is-today .calendar-number { color: var(--ink); font-weight: 800; }
.calendar li.is-selected a { background: var(--ink); border-color: var(--ink); }
.calendar li.is-selected .calendar-number { color: var(--on-ink); font-weight: 800; }
.calendar-legend { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 12px; font: 600 13px var(--font); color: var(--muted); }
.calendar-legend > span { display: inline-flex; align-items: center; gap: 6px; }
.day-detail .section-head h2 { font-size: 20px; }
.day-total { font: 800 15px var(--font); white-space: nowrap; }
.dot { width: 6px; height: 6px; border-radius: 50%; background: var(--grey-bar); }
.dot.is-paid { background: var(--green); }
.dot.is-overdue { background: var(--red); }
.dot.is-due-today { background: var(--debt-bar); }
.dot.is-upcoming { background: var(--grey-bar); }

.chip-count { margin-left: 4px; font-weight: 600; opacity: .6; }
@media (max-width: 599px) {
  .chips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .chip { flex: none; }
}

.overdue .group-label { color: var(--red); }
.due-today .group-label { color: var(--peach-ink); }
.row-badge.is-overdue { background: var(--red-soft); color: var(--red-ink); }
.row-badge.is-due-today { background: var(--peach); color: var(--peach-ink); }
.row-badge.is-upcoming, .row-badge.is-paid { background: none; border: 1px solid var(--line-strong); }
.status.is-overdue { background: var(--red-soft); color: var(--red-ink); }

.row-sub.is-meta { display: flex; align-items: center; gap: 8px; }
.row:has(.row-link) { position: relative; }
.row-link { color: inherit; text-decoration: none; }
.row-link::after { content: ""; position: absolute; inset: 0; }
.row-link:focus-visible { outline: none; }
.row:has(.row-link:focus-visible) { outline: 2px solid var(--ink); outline-offset: 2px; border-radius: 12px; }
.row-sub.is-meta .row-chip { flex: none; align-self: center; }
.row-sub-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.owner { display: inline-flex; align-items: center; gap: 6px; min-width: 0; }
.owner-dot {
  width: 18px; height: 18px; flex: none; border-radius: 50%; display: grid; place-items: center;
  background: var(--surface); color: var(--muted); font: 800 10px var(--font);
}
.owner-dot.is-ink { background: var(--ink); color: var(--on-ink); }
.owner-dot.is-mint { background: var(--mint); color: var(--mint-ink); }
.row-usd { white-space: nowrap; }

.more summary {
  width: fit-content; margin-top: 10px; padding: 10px 16px; border-radius: 999px; background: var(--surface);
  font: 700 13px var(--font); list-style: none; cursor: pointer;
}
.more summary::-webkit-details-marker { display: none; }

.spend-line { display: grid; grid-template-columns: 12px minmax(0, 1fr) auto; gap: 12px; align-items: center; }
.spend-swatch { width: 12px; height: 12px; margin: 0; border-radius: 3px; }
.spend-text { display: flex; flex-direction: column; min-width: 0; }
.spend-name { font: 800 15px var(--font); }
.spend-note { font: 500 12px var(--font); color: var(--muted); }
.spend-amount { font: 800 15px var(--font); white-space: nowrap; }

.breakdown-top { display: flex; flex-direction: column; gap: 12px; }
.breakdown-label { font: 700 15px var(--font); color: var(--muted); }
.breakdown-total { font: 800 44px var(--font); letter-spacing: -.03em; line-height: 1; }
.spend-groups { display: flex; flex-direction: column; gap: 12px; }
.spend-group { border: 1px solid var(--line-strong); border-radius: var(--radius-card); padding: 0 16px; }
.spend-group > summary { min-height: 68px; cursor: pointer; list-style: none; }
.spend-group > summary::-webkit-details-marker { display: none; }
.spend-group[open] > summary { border-bottom: 1px solid var(--line); }
.spend-group .spend-line { grid-template-columns: 12px minmax(0, 1fr) auto; }
.spend-figures { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.spend-share { font: 700 12px var(--font); color: var(--muted); }
.spend-group .rows, .spend-group .empty { padding: 4px 0 8px; }
.spend-group .row-chip { display: none; }

.relief-screen { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(400px, 100%), 1fr)); gap: 28px; align-items: start; }
.relief-main { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.relief-hero { padding: 22px 24px; gap: 8px; border-radius: var(--radius-tile); background: var(--mint); color: var(--mint-ink); }
.relief-hero .hero-label, .relief-hero p { color: var(--mint-ink); }
.relief-hero .hero-amount { font-size: 44px; }
.active-loans .section-head h2 { font-size: 18px; }

.relief-steps { display: flex; flex-direction: column; gap: 14px; }
.relief-step { display: flex; flex-direction: column; gap: 6px; }
.relief-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.relief-title { display: flex; align-items: baseline; flex-wrap: wrap; gap: 2px 10px; min-width: 0; }
.relief-when { font: 800 14px var(--font); }
.relief-what { font: 500 13px var(--font); color: var(--muted); }
.relief-figures { display: flex; align-items: baseline; gap: 10px; white-space: nowrap; }
.relief-drop { font: 700 12px var(--font); color: var(--green); }
.relief-amount { font: 800 14px var(--font); }
.relief-step .progress-meter { flex: none; max-width: none; height: 8px; border-radius: 4px; background: var(--line-strong); }
.relief-step .progress-meter > span { background: var(--green); }
.relief-step.is-today .progress-meter > span { background: var(--ink); }

/* ---------- Tarjetas ---------- */

/* The card face looks like the plastic in the wallet, in the color it was saved with. */
.card-face {
  --card-from: #1d2b4f; --card-to: #0b1226;
  position: relative; overflow: hidden; aspect-ratio: 1.586; padding: 16px 18px; border-radius: 16px;
  background: var(--card-to) linear-gradient(135deg, var(--card-from), var(--card-to)); color: #fff;
  display: grid; grid-template-rows: auto 1fr auto auto; gap: 6px;
  box-shadow: 0 1px 2px rgb(0 0 0 / 12%), 0 8px 20px -10px rgb(0 0 0 / 45%);
  transition: transform .15s, box-shadow .15s;
}
.card-face::after {
  content: ""; position: absolute; inset: -40% -20% auto auto; width: 75%; aspect-ratio: 1; border-radius: 50%;
  background: radial-gradient(circle, rgb(255 255 255 / 14%), transparent 70%); pointer-events: none;
}
.card-face.is-teal { --card-from: #0f6b6a; --card-to: #06302f; }
.card-face.is-graphite { --card-from: #4a4f55; --card-to: #1c1f23; }
.card-face.is-violet { --card-from: #5b3f9e; --card-to: #241444; }

.card-face-chip {
  align-self: center; width: 38px; height: 28px; border-radius: 6px;
  background:
    linear-gradient(90deg, transparent 45%, rgb(0 0 0 / 22%) 45% 55%, transparent 55%),
    linear-gradient(0deg, transparent 30%, rgb(0 0 0 / 18%) 30% 36%, transparent 36% 64%, rgb(0 0 0 / 18%) 64% 70%, transparent 70%),
    linear-gradient(135deg, #f3dc92, #c9a44c);
}
.card-face-number { font: 600 17px ui-monospace, "SF Mono", Menlo, monospace; letter-spacing: .12em; }
.card-face-bottom { display: flex; justify-content: space-between; align-items: flex-end; gap: 8px; }
.card-face-holder { font: 700 11px var(--font); letter-spacing: .1em; text-transform: uppercase; opacity: .85; }
.card-face-network { font: 800 13px var(--font); white-space: nowrap; }
.card-face-network.is-visa { font: italic 900 20px var(--font); letter-spacing: -.02em; text-transform: uppercase; }
.card-face-network.is-mastercard {
  width: 42px; height: 26px; font-size: 0;
  background: radial-gradient(circle at 13px 50%, #eb001b 12.5px, transparent 13px), radial-gradient(circle at 29px 50%, #f79e1b 12.5px, transparent 13px);
}

.section-title { font: 800 22px var(--font); letter-spacing: -.02em; }
.card-detail { gap: 16px; }

/* A card has its own page: the list shows each one as the plastic with what it asks, the page keeps the rest. */
.cards-total { display: flex; flex-direction: column; gap: 4px; padding: 18px 22px; border-radius: 22px; background: var(--peach); color: var(--peach-ink); }
.cards-total-label { font: 700 13px var(--font); }
.cards-total-amount { font: 800 30px var(--font); letter-spacing: -.02em; }
.cards-total-note { font: 600 13px var(--font); opacity: .85; }

.card-rows { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 24px; }
.card-row { display: flex; flex-direction: column; gap: 12px; max-width: 380px; color: var(--ink); text-decoration: none; }
.card-row:hover { color: inherit; }
.card-row:hover .card-face { transform: translateY(-2px); }
.card-row-name { display: flex; align-items: center; gap: 8px; min-width: 0; font: 700 15px var(--font); }
.card-row-logo { width: 22px; height: 22px; flex: none; border-radius: 6px; background: #fff; }
.card-row-caption { display: grid; grid-template-columns: 1fr auto; align-items: baseline; gap: 8px 12px; padding: 0 4px; }
.card-row-amount { font: 800 22px var(--font); letter-spacing: -.02em; white-space: nowrap; }
.card-row-due { font: 700 13px var(--font); color: var(--muted); white-space: nowrap; }
.card-row-due.is-due { color: var(--amber); }
.card-row-caption .usage-meter { grid-column: 1 / -1; }

.card-page { grid-template-columns: repeat(auto-fit, minmax(min(320px, 100%), 1fr)); }
.card-summary { display: flex; flex-direction: column; gap: 24px; max-width: 380px; }
.facts { display: flex; flex-direction: column; margin: 0; }
.fact { display: flex; justify-content: space-between; align-items: center; gap: 12px; min-height: 52px; border-bottom: 1px solid var(--row-line); }
.fact:last-child { border-bottom: 0; }
.fact dt { font: 500 14px var(--font); color: var(--muted); }
.fact dd { margin: 0; text-align: right; font: 700 15px var(--font); }
.card-dates { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; }
.card-dates .fact { flex-direction: column; align-items: flex-start; justify-content: center; gap: 4px; padding: 14px 16px; border: 0; border-radius: 16px; background: var(--surface); }
.card-dates .fact dt { font-weight: 600; font-size: 13px; }
.card-dates .fact dd { text-align: left; font-weight: 800; font-size: 16px; }

/* The page of a loan: what is left, the next installment and the ones that follow. */
.loan-lender { margin-top: -22px; font: 600 14px var(--font); color: var(--muted); }
.loan-top { display: flex; flex-wrap: wrap; gap: 16px; align-items: stretch; }
.loan-left {
  flex: 2 1 420px; min-width: 0; padding: 24px; border-radius: 28px;
  display: flex; flex-direction: column; justify-content: space-between; gap: 22px;
  background: var(--peach); color: var(--peach-ink);
}
.loan-left-label { font: 700 14px var(--font); }
.loan-left-amount { font: 800 clamp(36px, 9vw, 48px)/1.05 var(--font); letter-spacing: -.03em; white-space: nowrap; }
.loan-left-progress { display: flex; flex-direction: column; gap: 10px; }
.loan-left .progress-meter { background: color-mix(in srgb, var(--peach-ink) 18%, transparent); }
.loan-left .progress-meter > span { background: var(--peach-ink); }
.loan-meta { display: flex; justify-content: space-between; gap: 12px; font: 700 13px var(--font); }
.loan-figures { flex: 1 1 240px; min-width: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; align-content: stretch; }
.loan-figures .stat { justify-content: center; }

.loan-next-card { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 16px 18px; border-radius: 18px; border: 1.5px solid var(--line-strong); }
.loan-next-what { display: flex; flex-direction: column; gap: 2px; }
.loan-next-title { font: 800 16px var(--font); }
.loan-next-due { font: 600 13px var(--font); color: var(--muted); }
.loan-next-due.is-due { color: var(--amber); }
.loan-next-amount { font: 800 18px var(--font); white-space: nowrap; }
.loan-next-note { font: 600 13px var(--font); color: var(--muted); }
.loan-relief { display: flex; flex-direction: column; gap: 6px; padding: 16px 18px; border-radius: 18px; background: var(--mint); color: var(--mint-ink); }
.loan-relief h2 { font: 700 14px var(--font); }
.loan-relief p { font: 700 15px/1.4 var(--font); }
.loan-over { padding: 16px 18px; border-radius: 18px; background: var(--mint); color: var(--mint-ink); font: 700 15px var(--font); }

.installments { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.installment { display: flex; align-items: center; gap: 14px; min-height: 60px; border-bottom: 1px solid var(--row-line); }
.installment:last-child { border-bottom: 0; }
.installment-mark { width: 28px; height: 28px; flex: none; box-sizing: border-box; display: grid; place-items: center; border: 2px solid var(--grey-light); border-radius: 50%; font: 700 14px var(--font); }
.installment.is-paid .installment-mark { border-color: var(--green); background: var(--green); color: var(--page); }
.installment.is-next .installment-mark { border-color: var(--peach-ink); }
.installment-what { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.installment-title { font: 700 15px var(--font); }
.installment-note { font: 500 13px var(--font); color: var(--muted); }
.installment.is-next .installment-note { color: var(--amber); font-weight: 600; }
.installment-amount { font: 800 15px var(--font); white-space: nowrap; }

/* ---------- Cuentas ---------- */

.accounts-total { gap: 10px; }
.account-face { grid-template-rows: auto 1fr auto; }
.account-face.is-itau { --card-from: #c75b00; --card-to: #6b3000; }
.account-face.is-ueno { --card-from: #0f6b6a; --card-to: #06302f; }
.account-face.is-coop { --card-from: #1f7a45; --card-to: #0d3d22; }
.account-face.is-wallet { --card-from: #5b3f9e; --card-to: #241444; }
.account-face.is-wise { --card-from: #2f6f1f; --card-to: #12330c; }
.account-face.is-cash { --card-from: #4a4f55; --card-to: #1c1f23; }
.account-detail { gap: 14px; }
.account-movements .day + .day { margin-top: 18px; }

.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat.is-small { padding: 14px 16px; border-radius: var(--radius-card); gap: 2px; }
.stat.is-small .stat-label { font-size: 12px; }
.stat.is-small .stat-value { font-size: 19px; }

.card-usage { display: flex; flex-direction: column; gap: 8px; }
.usage-line { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 4px 12px; font: 600 13px var(--font); color: var(--muted); }
.usage-line span { white-space: nowrap; }
.usage-line b { color: var(--ink); }
.usage-line b.is-income { color: var(--green); }
.usage-meter { display: flex; height: 10px; border-radius: 5px; background: var(--track); overflow: hidden; }
.usage-meter .is-billed { background: var(--ink); }
.usage-meter .is-unbilled { background: var(--grey-bar); }
.usage-legend { display: flex; gap: 14px; flex-wrap: wrap; font: 600 12px var(--font); color: var(--muted); }
.usage-legend .is-soft { color: var(--faint); }
.card-rates { margin: 0; font: 600 13px var(--font); color: var(--muted); }
.card-rates .is-soft { color: var(--faint); }
.usage-limit { margin-left: auto; }

.rows .row > .row-amount { text-align: right; }

/* ---------- Movimientos ---------- */

.movements { display: flex; flex-direction: column; gap: 22px; max-width: 860px; }
.movements-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.movements-count { font: 600 13px var(--font); color: var(--muted); }
.day .row { padding: 9px 0; }
.day .row-badge { font-size: 15px; }

/* ---------- Patrimonio ---------- */

.net-worth-top { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(420px, 100%), 1fr)); gap: 20px; align-items: start; }
.net-worth-top .hero { gap: 18px; }
.hero-head { display: flex; flex-direction: column; gap: 10px; }
.net-worth-top .hero-amount { font-size: 60px; letter-spacing: -.04em; }
.hero-line.is-badges { gap: 8px; }
.badge.is-peach { background: var(--peach); color: var(--peach-ink); }

.makeup { gap: 12px; }
.makeup h2 { font-size: 15px; }
.makeup-bar { display: flex; flex-direction: column; gap: 6px; }
.makeup .usage-line.is-small { font-size: 12px; }
.makeup .is-debt { color: var(--peach-ink); }
.makeup .is-ours { color: var(--green); }

.net-worth-tabs .chip { min-height: 44px; display: inline-flex; align-items: center; }

.net-worth-parts { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.net-worth-parts .group-label { padding-bottom: 0; }
.part {
  display: flex; align-items: center; gap: 14px; min-height: 76px; padding: 14px 16px;
  border: 1px solid var(--line-strong); border-radius: var(--radius-card);
  color: var(--ink); text-decoration: none;
}
.part:hover { color: var(--ink); background: var(--surface); }
.part-icon {
  flex: none; width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center;
  background: var(--surface); color: var(--green);
}
.part-icon.is-mint { background: var(--mint); color: var(--mint-ink); }
.part-icon.is-peach { background: var(--peach); color: var(--peach-ink); }
.part-icon svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.part-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.part-title { font: 800 16px var(--font); }
.part-note { font: 500 13px/1.35 var(--font); color: var(--muted); }
.part-value { font: 800 15px var(--font); white-space: nowrap; }
.part-value.is-debt { color: var(--peach-ink); }
.part-value.is-income { color: var(--green); }
.part-spark { flex: none; width: 64px; height: 28px; overflow: visible; }
.part-spark path { fill: none; stroke: var(--green); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
@media (max-width: 599px) {
  .part-spark { display: none; }
}

.row-amount.is-debt { color: var(--peach-ink); }

turbo-frame#history { display: flex; flex-direction: column; gap: 28px; }
.monthly-changes .row { grid-template-columns: minmax(0, 1fr) auto; }

.history { padding: 18px 20px 14px; gap: 10px; min-width: 0; }
.history h2 { font-size: 15px; }
.history-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.history-chart { position: relative; height: 196px; }
.panel .history-note { font: 600 12px var(--font); color: var(--muted); }

.toggle { display: flex; gap: 4px; padding: 3px; border-radius: 999px; background: var(--page); }
.toggle a {
  padding: 6px 12px; border-radius: 999px; color: var(--muted);
  font: 700 12px var(--font); text-decoration: none; white-space: nowrap;
}
.toggle a[aria-current="page"] { background: var(--ink); color: var(--on-ink); }

.split-meter { display: flex; gap: 2px; height: 10px; border-radius: 5px; overflow: hidden; }
.split-meter.is-thick { height: 14px; border-radius: 7px; }
.split-meter > span { background: var(--ink); }
.split-meter > .is-dollars { background: var(--green); }
.split-meter > .is-debt { background: var(--debt-bar); }
.split-meter > .is-ours { background: var(--green); }

.alert {
  padding: 18px 20px; border-radius: var(--radius-tile); background: var(--red-soft); color: var(--red-ink);
  display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; gap: 16px; align-items: center;
}
.alert-icon {
  width: 44px; height: 44px; border-radius: 50%; background: var(--red); color: var(--page);
  display: grid; place-items: center; font: 800 18px var(--font);
}
.alert-body { display: flex; flex-direction: column; gap: 3px; }
.alert h2 { font: 800 17px var(--font); }
.alert p { font: 600 14px/1.45 var(--font); text-wrap: pretty; }
.alert-action {
  height: 44px; padding: 0 18px; border-radius: 999px; background: var(--red-ink); color: var(--red-soft);
  display: inline-flex; align-items: center; font: 800 14px var(--font); text-decoration: none; white-space: nowrap;
}
.alert-action:hover { color: var(--red-soft); }
@media (max-width: 599px) {
  .alert { grid-template-columns: 44px minmax(0, 1fr); }
  .alert-action { grid-column: 1 / -1; justify-content: center; }
}

.columns.is-wide { grid-template-columns: repeat(auto-fit, minmax(min(360px, 100%), 1fr)); gap: 40px; }
.assets-split { display: flex; flex-direction: column; gap: 6px; }
.assets-split .usage-line { font-size: 12px; }
.holdings { margin: 2px 0 10px; gap: 6px; }
.holdings .chip { padding: 4px 10px; font-size: 12px; color: var(--muted); }
.section-head .aside.is-debt { color: var(--peach-ink); }

.debt-installments {
  padding: 10px 14px; border-radius: 14px; background: var(--peach);
  display: flex; justify-content: space-between; gap: 12px; font: 600 13px var(--font); color: var(--muted);
}
.debt-installments b { color: var(--peach-ink); white-space: nowrap; }
.debts .row { padding: 10px 0; }
.debts .row-main { gap: 4px; }
.debts a.row-note { color: var(--muted); text-decoration: underline; text-underline-offset: 3px; }
.row-progress-line { display: flex; align-items: center; gap: 8px; }
.row-progress { font: 600 12px var(--font); color: var(--muted); white-space: nowrap; }
.progress-meter { display: block; flex: 1; max-width: 200px; height: 5px; border-radius: 3px; background: var(--track); overflow: hidden; }
.progress-meter > span { display: block; height: 100%; border-radius: inherit; background: var(--ink); }
.row-chip {
  align-self: flex-start; padding: 3px 9px; border-radius: 999px; background: var(--surface); color: var(--pill-ink);
  font: 600 12px var(--font);
}

.payoff { gap: 14px; }
.payoff-steps { list-style: none; display: flex; flex-direction: column; gap: 12px; }
.payoff-step { display: grid; grid-template-columns: 70px minmax(0, 1fr) 96px; gap: 12px; align-items: center; }
.payoff-when { font: 700 12px var(--font); color: var(--muted); }
.payoff-bar { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.payoff-bar .progress-meter { flex: none; max-width: none; height: 8px; border-radius: 4px; background: var(--line-strong); }
.payoff-bar .progress-meter > span { background: var(--green); }
.payoff-step.is-today .progress-meter > span { background: var(--debt-bar); }
.payoff-what { font: 600 12px var(--font); }
.payoff-amount { font: 700 13px var(--font); text-align: right; white-space: nowrap; }

.row-note.is-income { color: var(--green); }

/* ---------- Agente ---------- */

.agent-panels { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr)); gap: 12px; }
.agent-status { gap: 14px; }
.agent-status .section-head h2 { font-size: 16px; }
.agent-status .badge { padding: 4px 10px; font-size: 12px; }
.agent-stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.agent-stat strong { display: block; font: 800 22px var(--font); }
.agent-stat span { display: block; font: 600 12px var(--font); opacity: .7; }
.agent-review { gap: 10px; }
.agent-review li { font: 600 14px/1.4 var(--font); }
.agent-review p { font-size: 12px; }
.agent-connection { gap: 12px; margin-top: 12px; }
.agent-connection h2 { font-size: 16px; }
.agent-connection code { font: 600 13px ui-monospace, SFMono-Regular, Menlo, monospace; overflow-wrap: anywhere; }
.agent-token-created { display: grid; gap: 6px; }
.agent-tokens .row { grid-template-columns: minmax(0, 1fr) auto; align-items: center; }
.agent-token-form { display: flex; flex-wrap: wrap; align-items: end; gap: 10px; }
.agent-token-form .field { flex: 1 1 220px; }

.prompts { display: flex; flex-wrap: wrap; gap: 8px; }
.prompts li { padding: 9px 14px; border-radius: 999px; background: var(--surface); font: 700 13px var(--font); }

/* ---------- Entrar ---------- */

.auth { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); min-height: 100vh; min-height: 100dvh; }

.auth-aside {
  padding: 44px 48px; display: flex; flex-direction: column; justify-content: space-between; gap: 40px;
  background: #16241b; color: #fff;
}
.auth-aside .brand { color: #fff; }
.auth-lockup { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
.brand-version { padding: 3px 10px; border-radius: 999px; background: var(--surface); color: var(--muted); font: 700 12px var(--font); letter-spacing: .02em; }
.auth-aside .brand-version { background: rgb(255 255 255 / 14%); color: #b9c4bb; }
.auth-pitch { display: flex; flex-direction: column; gap: 18px; }
.auth-pitch h2 { font: 800 48px/1.05 var(--font); letter-spacing: -.035em; text-wrap: pretty; }
.auth-pitch p { max-width: 420px; font: 600 17px/1.5 var(--font); color: #b9c4bb; text-wrap: pretty; }
.auth-agent { font: 700 13px var(--font); color: #cfeccb; }

.auth-main { display: flex; flex-direction: column; justify-content: center; gap: 22px; padding: 48px; }
.auth-brand { display: none; }

.auth-card { width: 100%; max-width: 380px; margin: 0 auto; display: flex; flex-direction: column; gap: 22px; }
.auth-heading { display: flex; flex-direction: column; gap: 6px; }
.auth-heading h1 { font: 800 32px/1.1 var(--font); letter-spacing: -.03em; }
.auth-heading p { font: 600 15px var(--font); color: var(--muted); }
.auth-form { display: flex; flex-direction: column; gap: 14px; }
.auth-form .button { margin-top: 6px; }
.auth-note { text-align: center; font: 600 13px var(--font); }
.auth-note a { color: var(--muted); }

.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font: 700 13px var(--font); color: var(--muted); }
.field-password { position: relative; }
.field .field-password input { padding-right: 50px; }
.field-toggle {
  position: absolute; top: 0; right: 0; width: 50px; height: 50px;
  display: grid; place-items: center; padding: 0; border: 0; border-radius: 14px;
  background: none; color: var(--muted); cursor: pointer;
}
.field-toggle[hidden] { display: none; }
.field-toggle:hover, .field-toggle:focus-visible { color: var(--ink); }
.field-toggle:focus-visible { outline: 2px solid var(--green); outline-offset: -2px; }
.field-toggle svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.field-toggle .eye-off, .field-toggle[aria-pressed="true"] .eye { display: none; }
.field-toggle[aria-pressed="true"] .eye-off { display: block; }
.field input, .field select {
  width: 100%; min-width: 0;
  height: 50px; padding: 0 16px; border: 1.5px solid transparent; border-radius: 14px;
  background: var(--surface); font: 600 15px var(--font);
}
.field input:focus, .field select:focus { outline: none; border-color: var(--green); }

@media (max-width: 899px) {
  .auth { grid-template-columns: minmax(0, 1fr); }
  .auth-aside { display: none; }
  .auth-main { justify-content: flex-start; padding: 32px 22px 40px; }
  .auth-brand { display: flex; max-width: 380px; width: 100%; margin: 0 auto; }
  .auth-brand .brand { font-size: 18px; }
  .auth-brand .logo { width: 40px; height: 40px; }
}

/* ---------- Configuración ---------- */

.settings { display: flex; flex-direction: column; gap: 18px; max-width: 1040px; }
.settings-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr)); gap: 12px; align-items: start; }
.settings-panel { gap: 14px; }
.settings-panel .field input, .settings-panel .field select { background: var(--page); }
.field-hint { font: 500 12px var(--font); color: var(--muted); }
.settings-save { align-self: flex-start; }

.choices { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; border: 0; }
.choices legend { width: 100%; margin-bottom: 6px; padding: 0; font: 700 13px var(--font); color: var(--muted); }
.choice { position: relative; cursor: pointer; }
.choice input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.choice span {
  display: block; padding: 10px 16px; border-radius: 999px; border: 1px solid var(--line-strong);
  background: var(--page); font: 700 14px var(--font);
}
.choice input:checked + span { background: var(--ink); border-color: var(--ink); color: var(--on-ink); }
.choice input:focus-visible + span { outline: 2px solid var(--green); outline-offset: 2px; }
.settings-panel .switch-row { background: var(--page); margin: 0; }
.profile-links { display: flex; flex-direction: column; gap: 8px; }
.profile-links a { color: inherit; text-decoration: none; }
.profile-links a:hover strong, .profile-links a:focus-visible strong { text-decoration: underline; text-underline-offset: 3px; }
.profile-link-arrow { font: 700 22px/1 var(--font); color: var(--muted); }
.password-change { max-width: 480px; }
.settings-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 18px; }
.family { max-width: 640px; }
.family .row-badge { font-size: 15px; }
.family .rows .row:last-child { border-bottom: 0; }
.admin .rows li:last-child .row { border-bottom: 0; }
.admin a.row { color: inherit; text-decoration: none; }
.admin a.row:hover .row-title, .admin a.row:focus-visible .row-title { text-decoration: underline; text-underline-offset: 3px; }
.admin .row-note.text-link { color: var(--ink); }
.admin-form { max-width: 640px; }
.admin .row-sub.is-wrapped { white-space: normal; }
.admin .badge.is-active { background: var(--mint); color: var(--mint-ink); }
.admin .badge.is-browsing, .admin .badge.is-fading { background: var(--peach); color: var(--peach-ink); }
.admin .badge.is-dormant { background: var(--red-soft); color: var(--red-ink); }
.admin .badge.is-unused { background: none; box-shadow: inset 0 0 0 1px var(--line-strong); }
.activity-end { display: flex; align-items: center; gap: 8px; }
.activity-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
@media (max-width: 520px) { .activity-stats { grid-template-columns: repeat(2, 1fr); } }
.activity-facts { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.activity-facts dt { font: 600 12px var(--font); color: var(--muted); }
.activity-facts dd { margin: 2px 0 0; font: 800 16px var(--font); }

.split-meter > .is-liquid { background: var(--green); }
.split-meter > .is-illiquid { background: var(--grey-bar); }
.assets > section + section { margin-top: 14px; }
.assets .group-label { padding-top: 6px; }

/* ---------- Indicators ---------- */

.indicator-grid { list-style: none; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(210px, 100%), 1fr)); gap: 12px; }
.indicator {
  position: relative; padding: 16px 18px; border-radius: var(--radius-tile); background: var(--surface);
  display: flex; flex-direction: column; gap: 12px; min-width: 0;
  --tone: var(--muted); --tone-soft: var(--track); --tone-ink: var(--muted);
}
.indicator.is-good { --tone: var(--green); --tone-soft: var(--paid); --tone-ink: var(--mint-ink); }
.indicator.is-watch, .indicator.is-warning { --tone: var(--amber); --tone-soft: var(--peach); --tone-ink: var(--peach-ink); }
.indicator.is-dragging { opacity: .6; outline: 2px dashed var(--line-strong); outline-offset: 2px; }
.indicator-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; }
.indicator-name { flex: 1 1 auto; font: 700 14px/1.3 var(--font); }
.indicator-status {
  padding: 3px 9px; border-radius: 999px; background: var(--tone-soft); color: var(--tone-ink);
  font: 800 11px var(--font); white-space: nowrap;
}
.indicator-value { font: 800 32px/1 var(--font); letter-spacing: -.03em; white-space: nowrap; color: var(--tone); }
.indicator.is-neutral .indicator-value { color: var(--ink); }
.indicator-meter { position: relative; display: block; height: 6px; border-radius: 3px; background: var(--line-strong); }
.indicator-meter .is-fill { display: block; height: 100%; border-radius: inherit; background: var(--tone); }
.indicator-meter .is-goal { position: absolute; top: -4px; bottom: -4px; width: 2px; margin-left: -1px; background: var(--ink); }
.indicator-note { font: 600 12px/1.4 var(--font); color: var(--muted); text-wrap: pretty; }
.indicator-tools { display: none; margin: -4px -8px -4px 0; }
.indicators.is-customizing .indicator-tools { display: flex; }
.indicators:not(.is-customizing) .indicator-add { display: none; }
.link-button {
  border: 0; padding: 0; background: none; color: var(--ink); cursor: pointer;
  font: 700 14px var(--font); text-decoration: underline; text-underline-offset: 3px; white-space: nowrap;
}
.link-button:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }
.indicator-remove-form { display: contents; }
.indicator-handle, .indicator-remove {
  width: 28px; height: 28px; border: 0; border-radius: 8px; background: transparent; color: var(--muted);
  font: 700 16px var(--font); line-height: 1; cursor: pointer;
}
.indicator-handle { cursor: grab; touch-action: none; }
.indicator-handle:active { cursor: grabbing; }
.indicator-handle:hover, .indicator-remove:hover { background: var(--page); color: var(--ink); }
.indicator-handle:focus-visible, .indicator-remove:focus-visible { outline: 2px solid var(--green); outline-offset: 1px; }
.indicator-add { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.indicator-add form { display: contents; }
.indicator-add .chip { cursor: pointer; }
@media (max-width: 599px) {
  .indicator-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .indicator { padding: 12px 12px 14px; }
  .indicator-value { font-size: 24px; }
  .indicator-head { flex-wrap: wrap; }
  .indicator-handle, .indicator-remove { width: 26px; height: 26px; }
}

/* ---------- Reports ---------- */

.report-grid { list-style: none; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; grid-auto-flow: dense; }
.report {
  display: flex; flex-direction: column; gap: 16px; min-width: 0; padding: 22px;
  border: 1px solid var(--line-strong); border-radius: var(--radius-tile); background: var(--page);
}
.report.is-wide { grid-column: 1 / -1; }
.report.is-dragging { opacity: .6; outline: 2px dashed var(--line-strong); outline-offset: 2px; }
.reports.is-customizing .report { border-style: dashed; }
.report-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.report-name { font: 800 18px/1.3 var(--font); letter-spacing: -.01em; }
.report-body { display: flex; flex-direction: column; gap: 14px; }
.report-tools { display: none; margin: -4px -8px -4px 0; }
.reports.is-customizing .report-tools { display: flex; }
.reports:not(.is-customizing) .report-add { display: none; }
.report-remove-form { display: contents; }
.report-handle, .report-remove {
  width: 28px; height: 28px; border: 0; border-radius: 8px; background: transparent; color: var(--muted);
  font: 700 16px var(--font); line-height: 1; cursor: pointer;
}
.report-handle { cursor: grab; touch-action: none; }
.report-handle:active { cursor: grabbing; }
.report-handle:hover, .report-remove:hover { background: var(--surface); color: var(--ink); }
.report-handle:focus-visible, .report-remove:focus-visible { outline: 2px solid var(--green); outline-offset: 1px; }
.report-add { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.report-add form { display: contents; }
.report-add .chip { cursor: pointer; }

.report-body:has(> .report-hero) { flex-direction: row; flex-wrap: wrap; gap: 28px 40px; }
.report-hero { flex: 1 1 260px; display: flex; flex-direction: column; gap: 10px; }
.report-detail { flex: 1.4 1 320px; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.report-lead { font: 600 14px var(--font); color: var(--muted); }
.report-amount { font: 800 clamp(34px, 8vw, 44px)/1.05 var(--font); letter-spacing: -.03em; white-space: nowrap; color: var(--green); }
.report-amount.is-negative { color: var(--red); }
.report .spend-meter { background: var(--track); }
.report-note { font: 600 14px var(--font); color: var(--muted); }
.report-note b { color: var(--ink); }
.report-figures { display: flex; gap: 28px; flex-wrap: wrap; padding-top: 4px; }
.report-figures > div { display: flex; flex-direction: column; gap: 2px; }
.report-figure-label { font: 600 13px var(--font); color: var(--muted); }
.report-figure-value { font: 800 17px var(--font); white-space: nowrap; }
.report-subhead { font: 700 14px var(--font); }

.report-rows { list-style: none; display: flex; flex-direction: column; gap: 12px; }
.report-rows li { display: grid; grid-template-columns: minmax(0, 9em) minmax(40px, 1fr) auto auto; align-items: center; gap: 6px 12px; font: 600 14px var(--font); }
.report-row-name { overflow-wrap: anywhere; }
.report-row-bar { display: block; height: 8px; border-radius: 999px; background: var(--track); overflow: hidden; }
.report-row-bar > span { display: block; height: 100%; border-radius: inherit; background: var(--green); }
.report-row-amount { font-weight: 800; text-align: right; white-space: nowrap; }
.report-row-share { min-width: 3ch; color: var(--muted); text-align: right; }

.report-sources, .report-people { list-style: none; }
.report-source { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 12px; padding-bottom: 12px; border-bottom: 1px solid var(--row-line); }
.report-source:last-child { border-bottom: 0; padding-bottom: 0; }
.report-source-name { font: 700 15px var(--font); }
.report-source-note { grid-row: 2; font: 600 13px var(--font); color: var(--muted); }
.report-source-amount { font: 800 15px var(--font); text-align: right; white-space: nowrap; }
.report-source-share { grid-row: 2; grid-column: 2; font: 600 13px var(--font); color: var(--muted); text-align: right; }

.report-split { display: flex; height: 14px; border-radius: 999px; overflow: hidden; background: var(--track); }
.report-split > span, .report-dot { background: var(--ink); }
.report-split > .is-1, .report-dot.is-1 { background: var(--green); }
.report-split > .is-2, .report-dot.is-2 { background: var(--grey-bar); }
.report-split > .is-3, .report-dot.is-3 { background: var(--debt-bar); }
.report-people { display: flex; flex-direction: column; gap: 10px; }
.report-person { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 12px; font: 600 14px var(--font); }
.report-person-name { display: inline-flex; align-items: center; gap: 10px; }
.report-dot { width: 12px; height: 12px; border-radius: 4px; flex-shrink: 0; }
.report-person-amount { font-weight: 800; white-space: nowrap; }
.report-person-share { min-width: 3ch; color: var(--muted); text-align: right; }

.year-bars { list-style: none; display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 4px; }
.year-month {
  display: flex; flex-direction: column; align-items: center; padding: 6px 0 4px; border-radius: 10px;
  color: var(--ink); text-decoration: none;
}
a.year-month:hover { background: var(--surface); color: var(--ink); }
a.year-month[aria-current="date"] { background: var(--surface); }
.year-month.is-empty { opacity: .45; }
.year-bar-up, .year-bar-down { display: flex; justify-content: center; width: 100%; height: 72px; }
.year-bar-up { align-items: flex-end; }
.year-bar-down { align-items: flex-start; border-top: 1.5px solid var(--grey-bar); }
.year-bar { display: block; width: 70%; max-width: 28px; }
.year-bar.is-positive { border-radius: 6px 6px 0 0; background: var(--green); }
.year-bar.is-negative { border-radius: 0 0 6px 6px; background: var(--red); }
.year-month-name { padding-top: 6px; font: 700 12px var(--font); color: var(--muted); }
.year-note { display: flex; flex-direction: column; gap: 2px; padding: 14px 16px; border-radius: var(--radius-card); background: var(--surface); }
.year-note-title { font: 800 15px var(--font); }
.year-note-body, .year-average { font: 600 14px var(--font); color: var(--muted); }
.year-average { font-size: 13px; }
.hero-link { align-self: flex-start; font: 700 14px var(--font); color: inherit; text-decoration: underline; text-underline-offset: 3px; }
@media (max-width: 760px) {
  .report-grid { grid-template-columns: minmax(0, 1fr); }
  .report { padding: 18px; }
  .report-rows li { grid-template-columns: minmax(0, 1fr) auto auto; }
  .report-row-bar { grid-column: 1 / -1; grid-row: 2; }
  .year-month-name { font-size: 10px; }
}

/* ---------- Movement detail ---------- */

.movement { display: flex; flex-direction: column; gap: 24px; max-width: 640px; }
.movement-head { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; }
.movement-head > .chip { align-self: flex-start; }
.movement-head h1 { font: 800 20px var(--font); }
.movement-amount { font: 800 36px/1.1 var(--font); letter-spacing: -.03em; white-space: nowrap; }
.movement-amount.is-income { color: var(--green); }
.movement-meta { font: 600 14px var(--font); color: var(--muted); }

.items { padding: 16px; border-radius: var(--radius-tile); background: var(--surface); }
.items-list { list-style: none; display: flex; flex-direction: column; }
.item {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; align-items: center;
  padding: 10px 0; border-top: 1px solid var(--line-strong);
}
.item-quantity {
  min-width: 34px; padding: 4px 6px; border-radius: 8px; background: var(--page); text-align: center; font: 800 13px var(--font);
}
.item-main { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.item-name { font: 700 14px var(--font); overflow-wrap: anywhere; }
.item-unit { font: 500 12px var(--font); color: var(--muted); }
.item-cost { font: 700 14px var(--font); white-space: nowrap; }
.items-total {
  display: flex; justify-content: space-between; gap: 12px; padding-top: 12px; border-top: 2px solid var(--ink); font: 800 15px var(--font);
}
.items-total-amount { display: flex; align-items: center; gap: 8px; }
.items-total .status { display: inline-flex; align-items: center; gap: 4px; }
.items-total .status svg { width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.items-undetailed { padding: 10px 14px; border-radius: var(--radius-card); background: var(--peach); color: var(--peach-ink); font: 600 13px var(--font); }
