:root {
  color-scheme: light;
  --background: #fff;
  --surface: #f7f9fc;
  --surface-strong: #eef3f9;
  --ink: #07152f;
  --muted: #69758f;
  --border: #e3e8f0;
  --blue: #2463eb;
  --blue-soft: #eaf1ff;
  --green: #0b9b58;
  --green-soft: #def6e9;
  --coral: #ff5a4f;
  --coral-soft: #ffe9e7;
  --shadow: 0 24px 60px rgba(28, 45, 74, 0.09);
  --font: "Manrope", Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background: var(--background);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }
button { border: 0; cursor: pointer; }
svg { display: block; }
.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;
}

.app-shell {
  display: grid;
  grid-template-columns: 224px minmax(0, 1fr);
  min-height: 100vh;
}

.app-navigation {
  position: sticky;
  top: 0;
  z-index: 10;
  height: 100vh;
  padding: 34px 26px;
  border-right: 1px solid #eef1f6;
  background: #fbfcfe;
}

.brand {
  display: inline-block;
  margin: 0 14px 44px;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.05em;
}

.navigation-list {
  display: grid;
  gap: 16px;
  padding: 0;
  margin: 0;
  list-style: none;
}

.navigation-list a {
  position: relative;
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: 48px;
  padding: 0 14px;
  color: #8792a9;
  font-size: 15px;
  font-weight: 500;
  transition: color 180ms ease, transform 180ms ease;
}

.navigation-list a::before {
  position: absolute;
  left: -27px;
  width: 4px;
  height: 34px;
  border-radius: 0 5px 5px 0;
  background: var(--blue);
  content: "";
  opacity: 0;
  transform: scaleY(0.55);
  transition: opacity 180ms ease, transform 180ms ease;
}

.navigation-list a:hover,
.navigation-list a:focus-visible,
.navigation-list a[aria-current="page"] { color: var(--ink); }
.navigation-list a:hover { transform: translateX(2px); }
.navigation-list a[aria-current="page"]::before { opacity: 1; transform: scaleY(1); }
.navigation-list svg {
  width: 24px;
  height: 24px;
  overflow: visible;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}
.navigation-list li:first-child svg { fill: currentColor; stroke: none; }
.navigation-list a[aria-current="page"] svg { color: var(--blue); }
.mobile-add, .mobile-header { display: none; }

.dashboard {
  width: 100%;
  max-width: 1600px;
  min-width: 0;
  padding: 44px clamp(34px, 4vw, 70px) 50px;
  margin: 0 auto;
}

.balance-overview {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 370px);
  gap: clamp(28px, 3.5vw, 60px);
  align-items: start;
}
.balance-copy { min-width: 0; padding: 32px 0 0; }
.balance-copy h1 {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: clamp(20px, 1.65vw, 27px);
  font-weight: 500;
  letter-spacing: -0.025em;
}
.balance-amount {
  margin: 0;
  font-size: clamp(50px, 5.7vw, 88px);
  font-weight: 700;
  letter-spacing: -0.075em;
  line-height: 1.04;
}
.balance-breakdown { display: flex; flex-wrap: wrap; gap: 24px; margin: 30px 0 0; }
.metric { display: flex; align-items: center; gap: 14px; }
.metric + .metric { padding-left: 24px; border-left: 1px solid var(--border); }
.metric-icon {
  display: grid;
  width: 52px;
  height: 52px;
  place-items: center;
  border-radius: 50%;
}
.metric-icon svg {
  width: 26px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}
.metric-income .metric-icon { background: var(--blue-soft); color: var(--blue); }
.metric-expense .metric-icon { background: var(--coral-soft); color: var(--coral); }
.metric dt { color: var(--muted); font-size: 15px; font-weight: 500; }
.metric dd {
  margin: 1px 0 0;
  font-size: clamp(20px, 1.7vw, 26px);
  font-weight: 600;
  letter-spacing: -0.045em;
}

.goals-overview-link {
  display: grid;
  max-width: 620px;
  grid-template-columns: 42px auto minmax(120px, 1fr) 18px;
  gap: 13px;
  align-items: center;
  padding: 13px 15px;
  margin-top: 30px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--surface);
  color: var(--ink);
  transition: border-color 180ms ease, background 180ms ease, transform 180ms ease;
}
.goals-overview-link:hover,
.goals-overview-link:focus-visible {
  border-color: rgba(36, 99, 235, 0.3);
  background: var(--blue-soft);
  transform: translateY(-1px);
}
.goals-overview-icon {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 14px;
  background: var(--blue-soft);
  color: var(--blue);
}
.goals-overview-icon svg,
.goals-overview-link > .chevron {
  width: 22px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}
.goals-overview-copy { display: grid; gap: 2px; }
.goals-overview-copy small,
.goals-overview-progress { color: var(--muted); font-size: 12px; font-weight: 500; }
.goals-overview-copy strong { font-size: 17px; letter-spacing: -0.035em; }
.goals-overview-progress { justify-self: end; }
.goals-overview-link > .chevron { color: #8d98ac; }

.month-summary {
  padding: 26px 28px 22px;
  border: 1px solid var(--border);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow);
}
.month-summary h2 {
  margin: 0 0 14px;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.04em;
}
.summary-period-control {
  position: relative;
  display: inline-flex;
  max-width: 100%;
  align-items: center;
}
.summary-period-control select {
  max-width: 100%;
  padding: 0 28px 0 0;
  border: 0;
  outline: 0;
  appearance: none;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-weight: inherit;
  letter-spacing: inherit;
  cursor: pointer;
}
.summary-period-control svg {
  position: absolute;
  right: 0;
  width: 18px;
  pointer-events: none;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}
.month-range {
  display: grid;
  grid-template-columns: 24px 1fr 18px;
  gap: 12px;
  align-items: center;
  padding: 4px 0 18px;
  border-bottom: 1px solid var(--border);
  color: var(--muted);
}
.month-range p { margin: 0; font-size: 14px; font-weight: 500; }
.month-range svg {
  width: 22px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.6;
}
.month-range .chevron { width: 17px; }
.month-summary dl { display: grid; gap: 12px; margin: 18px 0 20px; }
.month-summary dl > div { display: flex; align-items: center; justify-content: space-between; }
.month-summary dt, .month-summary dd { margin: 0; font-size: 14px; }
.month-summary dt {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-weight: 500;
}
.month-summary dd { color: var(--ink); font-weight: 600; }
.dot { width: 9px; height: 9px; border-radius: 50%; box-shadow: 0 0 0 4px rgba(0, 0, 0, 0.025); }
.dot-income { background: var(--blue); }
.dot-expense { background: var(--coral); }
.month-summary .month-balance {
  padding-top: 16px;
  margin-top: 4px;
  border-top: 1px solid var(--border);
}
.month-summary .month-balance dd { color: var(--blue); font-size: 21px; letter-spacing: -0.035em; }

.primary-button, .secondary-button {
  display: inline-flex;
  min-height: 52px;
  align-items: center;
  justify-content: center;
  border-radius: 16px;
  font-size: 15px;
  font-weight: 600;
  transition: transform 180ms ease, box-shadow 180ms ease, background 180ms ease;
}
.primary-button {
  width: 100%;
  gap: 10px;
  background: var(--blue);
  color: #fff;
  box-shadow: 0 12px 24px rgba(36, 99, 235, 0.19);
}
.primary-button svg {
  width: 22px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-width: 1.7;
}
.primary-button:hover, .primary-button:focus-visible {
  background: #1855d7;
  box-shadow: 0 15px 30px rgba(36, 99, 235, 0.26);
  transform: translateY(-1px);
}
.secondary-button { background: var(--surface-strong); color: var(--ink); }

.cash-flow { margin: 32px 0 0; }
.cash-flow figcaption, .recent-movements h2 {
  margin: 0;
  font-size: clamp(22px, 2vw, 28px);
  font-weight: 700;
  letter-spacing: -0.045em;
}
.cash-flow-chart { width: 100%; height: 190px; margin-top: 8px; overflow: visible; }
.mobile-chart { display: none; }
.chart-baseline { fill: none; stroke: #dfe6ec; stroke-width: 1; }
.chart-area { stroke: none; }
.income-area { fill: url(#income-area); }
.expense-area { fill: url(#expense-area); }
.mobile-income-area { fill: url(#mobile-income-area); }
.mobile-expense-area { fill: url(#mobile-expense-area); }
.chart-line { fill: none; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.9; }
.income-line { stroke: var(--green); }
.expense-line { stroke: var(--coral); }
.chart-event path { fill: none; stroke-dasharray: 3 3; stroke-width: 1; }
.chart-event circle { stroke: #fff; stroke-width: 3; }
.chart-event text { font-family: var(--font); font-size: 12px; font-weight: 700; }
.income-event path { stroke: rgba(11, 155, 88, 0.5); }
.income-event circle { fill: var(--green); }
.income-event rect { fill: var(--green-soft); }
.income-event text { fill: var(--green); }
.expense-event path { stroke: rgba(255, 90, 79, 0.55); }
.expense-event circle { fill: var(--coral); }
.expense-event rect { fill: var(--coral-soft); }
.expense-event text { fill: #e54b43; }
.chart-axis text { fill: var(--muted); font-family: var(--font); font-size: 13px; font-weight: 500; }
.chart-empty-message { fill: var(--muted); font-family: var(--font); font-size: 13px; font-weight: 500; }

noscript {
  position: fixed;
  inset: 20px 20px auto;
  z-index: 100;
  padding: 14px 18px;
  border: 1px solid var(--coral);
  border-radius: 14px;
  background: var(--coral-soft);
  color: var(--ink);
  text-align: center;
}

.recent-movements { padding: 24px 0 0; }
.recent-movements > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}
.recent-movements header a {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
}
.recent-movements header a svg, .row-chevron {
  width: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}
.movement-list { padding: 0; margin: 0; list-style: none; }
.movement {
  display: grid;
  grid-template-columns: 48px minmax(140px, 1fr) minmax(120px, 0.8fr) minmax(140px, auto) 24px;
  gap: 18px;
  align-items: center;
  min-height: 58px;
  padding: 4px 8px;
  border-bottom: 1px solid var(--border);
  border-radius: 14px;
  transition: background 180ms ease, transform 180ms ease;
}
.movement:hover { background: var(--surface); transform: translateX(2px); }
.movement-icon {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border-radius: 50%;
}
.movement-icon svg {
  width: 22px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}
.movement-income .movement-icon { background: var(--blue-soft); color: var(--blue); }
.movement-expense .movement-icon { background: var(--coral-soft); color: var(--coral); }
.movement-name { font-weight: 600; }
.movement time { color: #8994aa; font-size: 13px; font-weight: 500; }
.movement strong {
  justify-self: end;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.025em;
}
.movement-income strong { color: var(--blue); }
.movement-expense strong { color: var(--coral); }
.row-chevron { color: #8d98ac; }
.recent-open {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border-radius: 11px;
  background: transparent;
  color: #8d98ac;
}
.recent-open:hover, .recent-open:focus-visible { background: var(--blue-soft); color: var(--blue); }
.recent-open .row-chevron { width: 18px; height: 18px; }

.movement-detail-dialog {
  width: min(430px, calc(100vw - 28px));
  max-height: calc(100dvh - 28px);
  padding: 0;
  margin: auto;
  border: 1px solid var(--border);
  border-radius: 24px;
  box-shadow: var(--shadow);
}
.movement-detail-dialog::backdrop { background: rgba(7, 21, 47, .3); backdrop-filter: blur(3px); }
.movement-detail-content { padding: 28px; }
.movement-detail-content header { display: flex; align-items: center; justify-content: space-between; }
.detail-eyebrow { color: var(--muted); font-size: 13px; font-weight: 600; }
.movement-detail-content h2 { margin: 20px 0 2px; font-size: 28px; letter-spacing: -.04em; }
.detail-amount { font-size: 30px; letter-spacing: -.04em; }
.detail-amount.income { color: var(--blue); }
.detail-amount.expense { color: var(--coral); }
.movement-detail-content dl { margin: 24px 0; border-top: 1px solid var(--border); }
.movement-detail-content dl div { display: flex; justify-content: space-between; gap: 20px; padding: 13px 0; border-bottom: 1px solid var(--border); }
.movement-detail-content dt { color: var(--muted); }
.movement-detail-content dd { margin: 0; font-weight: 600; text-align: right; }
.detail-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.detail-actions .danger-button { border-radius: 16px; }

.planning-page { width: 100%; max-width: 1400px; min-width: 0; padding: 54px clamp(28px, 5vw, 70px) 80px; margin: 0 auto; }
.planning-header { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 38px; }
.planning-header h1 { margin: 0; font-size: clamp(38px, 4vw, 56px); letter-spacing: -.055em; }
.planning-header p, .planning-section-heading p, .planning-note { color: var(--muted); }
.planning-header p { margin: 5px 0 0; }
.planning-backup-link { color: var(--blue); font-size: 14px; font-weight: 600; white-space: nowrap; }
.planning-section { padding: 30px; margin-bottom: 24px; border: 1px solid var(--border); border-radius: 24px; background: #fff; box-shadow: 0 10px 30px rgba(28,45,74,.04); }
.planning-section-heading { display: flex; align-items: start; justify-content: space-between; gap: 20px; }
.planning-section-heading h2 { margin: 0; font-size: 25px; letter-spacing: -.04em; }
.planning-section-heading p { margin: 5px 0 0; font-size: 14px; }
.planning-section-heading > span { padding: 6px 12px; border-radius: 20px; background: var(--blue-soft); color: var(--blue); font-size: 12px; font-weight: 700; white-space: nowrap; }
.planning-month-picker { display: grid; gap: 3px; color: var(--muted); font-size: 11px; font-weight: 700; white-space: nowrap; }
.planning-month-picker select { min-height: 38px; padding: 0 10px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--ink); font-size: 13px; font-weight: 700; }
.planning-form { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)) auto; align-items: end; gap: 12px; margin-top: 26px; }
.planning-form label { display: grid; gap: 7px; color: var(--muted); font-size: 13px; font-weight: 600; }
.planning-form input, .planning-form select { width: 100%; min-height: 48px; padding: 0 13px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); color: var(--ink); outline-color: var(--blue); }
.planning-form .primary-button, .planning-form .secondary-button { min-height: 48px; padding: 0 20px; white-space: nowrap; }
.recurring-form { grid-template-columns: repeat(4, minmax(0, 1fr)) auto; }
.planning-note { margin: 14px 0 22px; font-size: 12px; }
.budget-totals { padding: 14px 16px; margin-bottom: 16px; border-radius: 13px; background: var(--blue-soft); color: var(--ink); font-size: 13px; font-weight: 700; }
.planning-error { padding: 11px 14px; border-radius: 10px; background: var(--coral-soft); color: #bd3f37; font-size: 13px; font-weight: 700; }
.budget-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.budget-card, .recurring-card { padding: 18px; border: 1px solid var(--border); border-radius: 18px; background: var(--surface); }
.budget-card-head, .recurring-card-head { display: flex; align-items: start; justify-content: space-between; gap: 12px; }
.budget-card h3, .recurring-card h3 { margin: 0; font-size: 17px; }
.budget-card p, .recurring-card p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.budget-card strong { font-size: 16px; }
.budget-progress { height: 9px; overflow: hidden; margin: 16px 0 8px; border-radius: 9px; background: #dfe7f1; }
.budget-progress span { display: block; height: 100%; border-radius: inherit; background: var(--blue); }
.budget-card.warning .budget-progress span { background: #e7a329; }
.budget-card.over .budget-progress span { background: var(--coral); }
.budget-alert { color: #996515 !important; font-weight: 700; }
.budget-card.over .budget-alert { color: #d54339 !important; }
.budget-card-actions { display: flex; gap: 8px; margin-top: 12px; }
.budget-card-actions button { min-height: 34px; padding: 0 12px; border-radius: 9px; background: #fff; color: var(--blue); font-size: 12px; font-weight: 700; }
.budget-card-actions button:hover, .budget-card-actions button:focus-visible { background: var(--blue-soft); }
.budget-rollover-button { min-height: 36px; padding: 0 12px; margin-top: 10px; border-radius: 10px; background: var(--blue-soft); color: var(--blue); font-size: 12px; font-weight: 700; }
.budget-rollover-button:hover { background: #dbe8ff; }
.budget-transfer-note { margin-top: 10px !important; color: var(--blue) !important; font-weight: 700; }
.planning-empty { padding: 20px; border-radius: 14px; background: var(--surface); color: var(--muted); text-align: center; }
.recurring-list { display: grid; gap: 10px; }
.recurring-card { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.recurring-card-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: end; gap: 8px; }
.recurring-card-actions button { min-height: 36px; padding: 0 11px; border-radius: 10px; background: #fff; color: var(--ink); font-size: 12px; font-weight: 700; }
.recurring-card-actions button:hover { background: var(--blue-soft); color: var(--blue); }
.recurring-card-actions button:disabled { opacity: .5; cursor: default; }
.recurring-card-actions button[data-recurring-delete]:hover { background: var(--coral-soft); color: var(--coral); }
.recurring-due { color: #ad7018 !important; font-weight: 700; }
.report-summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-top: 24px; }
.report-summary > div { display: grid; align-content: start; gap: 6px; min-height: 90px; padding: 14px; border-radius: 14px; background: var(--surface); }
.report-summary span { color: var(--muted); font-size: 12px; font-weight: 600; }
.report-summary strong { font-size: 16px; line-height: 1.4; }
.report-summary > div:last-child strong { font-size: 12px; }
.report-categories { display: grid; gap: 16px; margin-top: 26px; }
.report-category-labels { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; }
.report-category-labels span { color: var(--muted); }
.report-bar { height: 10px; overflow: hidden; margin-top: 7px; border-radius: 10px; background: var(--surface-strong); }
.report-bar span { display: block; height: 100%; border-radius: inherit; background: var(--blue); }
.report-export { width: auto; min-height: 42px; padding: 0 18px; margin-top: 26px; font-size: 13px; }
.report-export:disabled { opacity: .5; cursor: default; }
.detail-plan-button { grid-column: 1 / -1; }
.plan-alert-banner { display: block; padding: 13px 17px; margin-top: 22px; border: 1px solid #f1d396; border-radius: 14px; background: #fff9eb; color: #855c14; font-size: 13px; font-weight: 700; }
.plan-alert-banner:not([hidden]) + .cash-flow { margin-top: 35px; }

/* Pantalla de movimientos */
.movements-page {
  width: 100%;
  max-width: 1600px;
  min-width: 0;
  padding: 94px clamp(34px, 4vw, 70px) 60px;
  margin: 0 auto;
}

.movements-page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 32px;
}

.movements-page-header h1 {
  margin: 0;
  font-size: clamp(42px, 3.8vw, 56px);
  font-weight: 700;
  letter-spacing: -0.065em;
  line-height: 1;
}

.movements-page-actions {
  display: flex;
  align-items: center;
  gap: 18px;
}

.month-select,
.mobile-month-control,
.mobile-period-control,
.category-filter {
  position: relative;
  display: flex;
  align-items: center;
}

.month-select select,
.mobile-month-control select,
.mobile-period-control select,
.category-filter select {
  width: 100%;
  border: 0;
  outline: 0;
  appearance: none;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.month-select {
  width: 210px;
  min-height: 58px;
  padding: 0 48px 0 22px;
  border-radius: 18px;
  background: var(--surface);
}

.month-select svg,
.mobile-month-control svg,
.mobile-period-control svg,
.category-filter svg {
  position: absolute;
  right: 18px;
  width: 19px;
  pointer-events: none;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.add-movement-button {
  width: auto;
  min-width: 250px;
  padding: 0 26px;
}

.movements-summary {
  display: grid;
  grid-template-columns: 1fr 1fr 1.16fr;
  padding: 46px 0 40px;
  margin: 0;
  border-bottom: 1px solid var(--border);
}

.summary-metric {
  display: flex;
  align-items: center;
  gap: 20px;
  min-width: 0;
  padding: 0 clamp(22px, 3vw, 50px);
  border-right: 1px solid var(--border);
}

.summary-metric:first-child { padding-left: 0; }
.summary-metric:last-child { border-right: 0; }
.summary-metric dt {
  color: var(--muted);
  font-size: 16px;
  font-weight: 500;
}
.summary-metric dd {
  margin: 0;
  font-size: clamp(28px, 2.8vw, 42px);
  font-weight: 600;
  letter-spacing: -0.055em;
  line-height: 1.12;
  white-space: nowrap;
}
.summary-income .metric-icon { background: var(--blue-soft); color: var(--blue); }
.summary-expense .metric-icon { background: var(--coral-soft); color: var(--coral); }
.summary-balance { align-items: flex-end; }

.movements-directory { padding-top: 28px; }
.movement-toolbar {
  display: grid;
  grid-template-columns: minmax(260px, 1.35fr) minmax(300px, 1fr) minmax(210px, 0.78fr);
  gap: 18px;
  padding-bottom: 28px;
  border-bottom: 1px solid var(--border);
}

.movement-search,
.category-filter,
.type-filter {
  min-height: 62px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: #fff;
}

.movement-search {
  display: grid;
  grid-template-columns: 27px 1fr;
  gap: 14px;
  align-items: center;
  padding: 0 20px;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}
.movement-search:focus-within,
.category-filter:focus-within {
  border-color: rgba(36, 99, 235, 0.65);
  box-shadow: 0 0 0 4px rgba(36, 99, 235, 0.1);
}
.movement-search svg {
  width: 25px;
  fill: none;
  stroke: #71809c;
  stroke-linecap: round;
  stroke-width: 1.8;
}
.movement-search input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-size: 15px;
  font-weight: 500;
}
.movement-search input::placeholder { color: #8994aa; }
.movement-search input::-webkit-search-cancel-button { cursor: pointer; }

.type-filter {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  padding: 4px;
}
.type-filter button {
  border-radius: 12px;
  background: transparent;
  color: #42506d;
  font-size: 15px;
  font-weight: 600;
}
.type-filter button[aria-pressed="true"] {
  background: var(--blue-soft);
  color: var(--blue);
}
.category-filter { padding: 0 48px 0 20px; }
.category-filter select { font-size: 15px; }

.movements-directory h2 {
  margin: 30px 0 22px;
  font-size: clamp(27px, 2.2vw, 34px);
  font-weight: 700;
  letter-spacing: -0.045em;
}

.all-movements-columns,
.all-movement-row {
  display: grid;
  grid-template-columns: 48px minmax(190px, 1.25fr) minmax(140px, 0.9fr) minmax(130px, 0.75fr) minmax(150px, 0.82fr) 48px;
  gap: 16px;
  align-items: center;
}
.all-movements-columns {
  min-height: 42px;
  padding: 0 8px;
  border-bottom: 1px solid var(--border);
  color: #73809b;
  font-size: 14px;
  font-weight: 600;
}
.all-movements-columns > :first-child { grid-column: 1 / 3; }
.all-movement-list {
  padding: 0;
  margin: 0;
  list-style: none;
}
.all-movement-row {
  position: relative;
  min-height: 76px;
  padding: 8px;
  border-bottom: 1px solid var(--border);
  transition: background 160ms ease;
}
.all-movement-row:hover { background: var(--surface); }
.all-movement-details { display: grid; gap: 2px; min-width: 0; }
.all-movement-details > strong {
  overflow: hidden;
  color: var(--ink);
  font-size: 17px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mobile-row-meta { display: none; }
.all-movement-category,
.all-movement-date { color: #69758f; font-size: 14px; font-weight: 500; }
.all-movement-amount {
  justify-self: end;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.025em;
  white-space: nowrap;
}
.all-movement-row.movement-income .all-movement-amount { color: var(--blue); }
.all-movement-row.movement-expense .all-movement-amount { color: var(--coral); }

.row-actions { position: relative; justify-self: end; }
.row-action-button {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 13px;
  background: var(--surface-strong);
  color: var(--ink);
  transition: background 160ms ease, transform 160ms ease;
}
.row-action-button:hover,
.row-action-button[aria-expanded="true"] { background: #dfe9f7; transform: translateY(-1px); }
.row-action-button svg { width: 20px; fill: currentColor; }
.row-action-menu {
  position: absolute;
  top: 48px;
  right: 0;
  z-index: 20;
  width: 150px;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 18px 44px rgba(28, 45, 74, 0.15);
}
.row-action-menu button {
  display: flex;
  width: 100%;
  min-height: 42px;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  border-radius: 10px;
  background: transparent;
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
}
.row-action-menu button:hover { background: var(--surface); }
.row-action-menu .delete-action { color: #d53d36; }
.row-action-menu svg {
  width: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}

.movements-empty {
  display: grid;
  min-height: 310px;
  place-items: center;
  align-content: center;
  text-align: center;
}
.movements-empty > span {
  display: grid;
  width: 58px;
  height: 58px;
  place-items: center;
  border-radius: 50%;
  background: var(--blue-soft);
  color: var(--blue);
}
.movements-empty svg {
  width: 28px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-width: 1.7;
}
.movements-empty h3 { margin: 18px 0 4px; font-size: 21px; }
.movements-empty p { margin: 0; color: var(--muted); }

/* Pantalla de metas */
.goals-page {
  width: 100%;
  max-width: 1600px;
  min-width: 0;
  padding: 94px clamp(34px, 4vw, 70px) 60px;
  margin: 0 auto;
}
.goals-page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 32px;
}
.goals-page-header h1 {
  margin: 0;
  font-size: clamp(42px, 3.8vw, 56px);
  font-weight: 700;
  letter-spacing: -0.065em;
  line-height: 1;
}
.add-goal-button { width: auto; min-width: 210px; padding-inline: 26px; }
.goals-total {
  display: flex;
  min-height: 130px;
  align-items: center;
  gap: 24px;
  padding: 24px 28px;
  margin-top: 38px;
  border: 1px solid var(--border);
  border-radius: 16px;
}
.goals-total-icon {
  display: grid;
  width: 66px;
  height: 66px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 50%;
  background: var(--blue-soft);
  color: var(--blue);
}
.goals-total-icon svg {
  width: 32px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}
.goals-total p { margin: 0; color: var(--muted); font-size: 15px; font-weight: 500; }
.goals-total strong {
  display: block;
  font-size: clamp(34px, 3.2vw, 49px);
  font-weight: 700;
  letter-spacing: -0.06em;
  line-height: 1.05;
}
.goals-total-target {
  align-self: flex-end;
  padding: 0 0 15px 28px;
  margin-left: 12px;
  border-left: 1px solid var(--border);
  color: var(--muted);
  font-size: 18px;
}
.goals-total-target b { font-weight: 600; }
.goals-directory {
  padding-top: 28px;
  margin-top: 28px;
  border-top: 1px solid var(--border);
}
.goals-directory h2 {
  margin: 0 0 24px;
  font-size: clamp(27px, 2.2vw, 34px);
  letter-spacing: -0.045em;
}
.goals-list { display: grid; gap: 14px; }
.goal-card {
  position: relative;
  display: grid;
  align-items: center;
  gap: 22px;
  padding: 12px 16px 12px 12px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: #fff;
  transition: border-color 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}
.goal-card:hover {
  border-color: #d3ddea;
  box-shadow: 0 14px 34px rgba(28, 45, 74, 0.07);
  transform: translateY(-1px);
}
.goal-card.featured {
  grid-template-columns: minmax(340px, 0.9fr) minmax(460px, 1.1fr);
  min-height: 260px;
}
.goal-card.compact {
  grid-template-columns: 170px minmax(0, 1fr);
  min-height: 120px;
}
.goal-image {
  width: 100%;
  height: 100%;
  min-height: 96px;
  border-radius: 13px;
  object-fit: cover;
  background: var(--surface);
}
.featured .goal-image { min-height: 232px; }
.goal-content { min-width: 0; }
.featured .goal-content { display: grid; gap: 18px; padding: 12px 0; }
.goal-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.goal-heading h3,
.compact h3 {
  overflow: hidden;
  margin: 0;
  font-size: 25px;
  letter-spacing: -0.045em;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.compact h3 { font-size: 19px; }
.goal-metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
}
.goal-metric { padding: 0 24px; border-left: 1px solid var(--border); }
.goal-metric:first-child { padding-left: 0; border-left: 0; }
.goal-metric span { display: block; color: var(--muted); font-size: 13px; font-weight: 500; }
.goal-metric strong { font-size: 21px; font-weight: 600; letter-spacing: -0.035em; white-space: nowrap; }
.goal-progress-row { display: grid; grid-template-columns: 1fr auto; gap: 16px; align-items: center; }
.goal-progress {
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-strong);
}
.goal-progress > span {
  display: block;
  width: var(--progress);
  height: 100%;
  border-radius: inherit;
  background: var(--blue);
  transition: width 380ms cubic-bezier(0.22, 0.8, 0.32, 1);
}
.goal-progress-row > strong { color: var(--muted); font-size: 15px; font-weight: 600; }
.goal-save-button {
  display: inline-flex;
  min-height: 50px;
  align-items: center;
  justify-content: center;
  gap: 9px;
  justify-self: end;
  padding: 0 20px;
  border-radius: 14px;
  background: var(--blue-soft);
  color: var(--blue);
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
}
.goal-save-button svg { width: 20px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-width: 1.8; }
.featured .goal-save-button { margin-top: -2px; }
.goal-card > .row-actions { position: absolute; top: 18px; right: 16px; }
.compact .goal-content {
  display: grid;
  grid-template-columns: minmax(170px, 0.72fr) minmax(350px, 1.25fr) minmax(250px, 1fr);
  gap: 18px;
  align-items: center;
  padding-right: 48px;
}
.compact .goal-heading { min-width: 0; }
.compact .goal-metrics { align-self: stretch; align-items: center; }
.compact .goal-metric { padding-inline: 18px; }
.compact .goal-metric strong { font-size: 16px; }
.compact .goal-progress-area { display: grid; grid-template-columns: 1fr; gap: 10px; align-items: center; }
.compact .goal-progress-row { min-width: 0; grid-column: 1 / -1; }
.compact .goal-save-button { min-height: 44px; padding-inline: 14px; }
.goal-action-menu { width: 158px; }
.goals-empty {
  display: grid;
  min-height: 430px;
  place-items: center;
  align-content: center;
  text-align: center;
}
.goals-empty > span {
  display: grid;
  width: 68px;
  height: 68px;
  place-items: center;
  border-radius: 50%;
  background: var(--blue-soft);
  color: var(--blue);
}
.goals-empty svg { width: 32px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.7; }
.goals-empty h3 { margin: 20px 0 4px; font-size: 23px; }
.goals-empty p { margin: 0 0 22px; color: var(--muted); }
.goals-empty .primary-button { width: auto; padding-inline: 24px; }
.mobile-goals-date { display: none; }

.goal-dialog {
  width: min(520px, 100%);
  max-width: none;
  height: 100dvh;
  max-height: none;
  padding: 0;
  margin: 0 0 0 auto;
  border: 0;
  border-radius: 28px 0 0 28px;
  background: #fff;
  color: var(--ink);
  box-shadow: -24px 0 70px rgba(13, 30, 55, 0.14);
}
.goal-dialog::backdrop,
.saving-dialog::backdrop,
.goal-delete-dialog::backdrop { background: rgba(7, 21, 47, 0.28); backdrop-filter: blur(3px); }
.goal-dialog[open] { animation: drawer-enter 260ms cubic-bezier(0.22, 0.8, 0.32, 1); }
.goal-dialog form { display: grid; grid-template-rows: auto auto 1fr auto; height: 100%; }
.goal-dialog form > header,
.saving-dialog header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 48px 34px 26px;
}
.goal-dialog h2,
.saving-dialog h2 { margin: 0; font-size: 31px; letter-spacing: -0.045em; }
.goal-image-picker {
  display: grid;
  grid-template-columns: 86px 1fr;
  gap: 16px;
  align-items: center;
  padding: 12px;
  margin: 0 34px 34px;
  border: 1px dashed #cbd5e4;
  border-radius: 18px;
  cursor: pointer;
}
.goal-image-picker input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.goal-image-picker:focus-within { border-color: var(--blue); box-shadow: 0 0 0 4px rgba(36, 99, 235, 0.1); }
.goal-image-preview {
  display: grid;
  width: 86px;
  height: 66px;
  place-items: center;
  overflow: hidden;
  border-radius: 12px;
  background: var(--blue-soft);
  color: var(--blue);
}
.goal-image-preview img { width: 100%; height: 100%; object-fit: cover; }
.goal-image-preview svg { width: 28px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.7; }
.goal-image-picker > span:last-child { display: grid; }
.goal-image-picker b { font-size: 15px; }
.goal-image-picker small { color: var(--muted); font-size: 12px; }
.goal-form-fields { display: grid; align-content: start; gap: 24px; padding: 0 34px; }
.goal-form-fields label { display: grid; gap: 8px; color: #42506d; font-size: 14px; font-weight: 600; }
.goal-form-fields input {
  width: 100%;
  min-height: 60px;
  padding: 0 17px;
  border: 1px solid var(--border);
  border-radius: 15px;
  outline: 0;
  color: var(--ink);
  font-size: 15px;
  font-weight: 500;
}
.goal-form-fields input:focus { border-color: rgba(36, 99, 235, 0.65); box-shadow: 0 0 0 4px rgba(36, 99, 235, 0.1); }
.goal-dialog footer,
.saving-dialog footer {
  display: grid;
  grid-template-columns: 0.8fr 1.2fr;
  gap: 12px;
  padding: 24px 34px 28px;
  border-top: 1px solid var(--border);
}
.goal-dialog footer button,
.saving-dialog footer button { width: 100%; }

.saving-dialog {
  width: min(470px, calc(100% - 40px));
  max-width: none;
  padding: 0;
  border: 0;
  border-radius: 24px;
  background: #fff;
  color: var(--ink);
  box-shadow: 0 28px 80px rgba(13, 30, 55, 0.2);
}
.saving-dialog header { padding-bottom: 16px; }
.saving-dialog header p { margin: 0 0 3px; color: var(--muted); font-size: 13px; font-weight: 600; }
.saving-dialog h2 { font-size: 26px; }
.saving-amount {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 5px;
  min-height: 106px;
  padding: 14px 22px;
  margin: 0 34px;
  border: 1px solid var(--border);
  border-radius: 18px;
}
.saving-amount span,
.saving-amount input { color: #5e6b8e; font-size: 44px; font-weight: 700; letter-spacing: -0.06em; }
.saving-amount input { width: 100%; min-width: 0; border: 0; outline: 0; appearance: textfield; }
.saving-amount input::-webkit-inner-spin-button,
.saving-amount input::-webkit-outer-spin-button { appearance: none; }
.saving-amount b { padding-left: 14px; border-left: 1px solid var(--border); font-size: 15px; }
.saving-remaining { margin: 14px 34px 30px; color: var(--muted); font-size: 13px; }
.saving-remaining strong { color: var(--ink); }
.goal-delete-dialog {
  width: min(420px, calc(100% - 40px));
  max-width: none;
  padding: 0;
  border: 0;
  border-radius: 24px;
  background: #fff;
  color: var(--ink);
  box-shadow: 0 28px 80px rgba(13, 30, 55, 0.2);
}
.goal-delete-dialog h2 { margin: 0; font-size: 25px; letter-spacing: -0.04em; }
.goal-delete-dialog p { margin: 10px auto 24px; color: var(--muted); font-size: 14px; }

.delete-dialog {
  width: min(420px, calc(100% - 40px));
  max-width: none;
  padding: 0;
  border: 0;
  border-radius: 24px;
  background: #fff;
  color: var(--ink);
  box-shadow: 0 28px 80px rgba(13, 30, 55, 0.2);
}
.delete-dialog::backdrop { background: rgba(7, 21, 47, 0.3); backdrop-filter: blur(3px); }
.delete-dialog-content { padding: 30px; text-align: center; }
.delete-dialog-icon {
  display: grid;
  width: 56px;
  height: 56px;
  place-items: center;
  margin: 0 auto 18px;
  border-radius: 50%;
  background: var(--coral-soft);
  color: var(--coral);
}
.delete-dialog-icon svg {
  width: 26px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}
.delete-dialog h2 { margin: 0; font-size: 25px; letter-spacing: -0.04em; }
.delete-dialog p { margin: 10px auto 24px; color: var(--muted); font-size: 14px; }
.delete-dialog-content > div {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.danger-button {
  min-height: 52px;
  border-radius: 16px;
  background: var(--coral);
  color: #fff;
  font-weight: 700;
}

.movement-dialog {
  width: min(520px, 100%);
  max-width: none;
  height: 100dvh;
  max-height: none;
  padding: 0;
  margin: 0 0 0 auto;
  border: 0;
  border-radius: 28px 0 0 28px;
  background: #fff;
  color: var(--ink);
  box-shadow: -24px 0 70px rgba(13, 30, 55, 0.14);
}
.movement-dialog::backdrop { background: rgba(7, 21, 47, 0.26); backdrop-filter: blur(3px); }
.movement-dialog[open] { animation: drawer-enter 260ms cubic-bezier(0.22, 0.8, 0.32, 1); }
.movement-dialog form { display: grid; grid-template-rows: auto auto auto 1fr auto; height: 100%; }
.movement-dialog form > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 54px 36px 30px;
}
.movement-dialog h2 { margin: 0; font-size: 32px; font-weight: 700; letter-spacing: -0.045em; }
.icon-button {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: 14px;
  background: var(--surface-strong);
  color: var(--ink);
}
.icon-button svg {
  width: 22px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-width: 1.6;
}
.type-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 5px;
  margin: 0 34px 24px;
  border: 1px solid var(--border);
  border-radius: 16px;
}
.type-switch legend {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}
.type-switch label {
  display: flex;
  min-height: 58px;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border: 1px solid transparent;
  border-radius: 13px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}
.type-switch input { position: absolute; opacity: 0; }
.type-switch label:has(input:checked) {
  border-color: rgba(255, 90, 79, 0.55);
  background: var(--coral-soft);
  color: #8f2924;
}
.type-switch label:first-of-type:has(input:checked) {
  border-color: rgba(36, 99, 235, 0.42);
  background: var(--blue-soft);
  color: #1746a7;
}
.type-icon {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 50%;
}
.type-icon svg {
  width: 21px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}
.type-income { background: var(--blue-soft); color: var(--blue); }
.type-expense { background: var(--coral-soft); color: var(--coral); }
.amount-field {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 4px;
  align-items: center;
  min-height: 132px;
  padding: 10px 28px;
  margin: 0 34px 50px;
  border: 1px solid var(--border);
  border-radius: 20px;
}
.amount-field > span[aria-hidden="true"], .amount-field input {
  color: #5e6b8e;
  font-size: 58px;
  font-weight: 700;
  letter-spacing: -0.06em;
}
.amount-field input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  appearance: textfield;
}
.amount-field input::-webkit-inner-spin-button,
.amount-field input::-webkit-outer-spin-button { margin: 0; appearance: none; }
.amount-field input::placeholder { color: #5e6b8e; opacity: 1; }
.amount-field b { padding-left: 22px; border-left: 1px solid var(--border); font-size: 18px; font-weight: 600; }
.form-fields { display: grid; align-content: start; gap: 48px; padding: 0 34px; }
.form-fields label {
  display: grid;
  gap: 8px;
  color: #42506d;
  font-size: 15px;
  font-weight: 600;
}
.form-fields input, .form-fields select {
  width: 100%;
  min-height: 64px;
  padding: 0 17px;
  border: 1px solid var(--border);
  border-radius: 15px;
  outline: 0;
  background: #fff;
  color: var(--ink);
  font-size: 15px;
  font-weight: 500;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}
.form-fields input:focus, .form-fields select:focus, .amount-field:focus-within {
  border-color: rgba(36, 99, 235, 0.65);
  box-shadow: 0 0 0 4px rgba(36, 99, 235, 0.1);
}
.form-fields input::placeholder { color: #8994aa; }
.movement-dialog footer {
  display: grid;
  grid-template-columns: 0.8fr 1.2fr;
  gap: 12px;
  padding: 24px 34px 28px;
  border-top: 1px solid var(--border);
}
.movement-dialog footer .primary-button, .movement-dialog footer .secondary-button { width: 100%; }

@keyframes drawer-enter {
  from { transform: translateX(36px); opacity: 0.7; }
  to { transform: translateX(0); opacity: 1; }
}

@media (max-width: 1250px) {
  .goal-card.featured { grid-template-columns: minmax(280px, 0.82fr) minmax(0, 1.18fr); }
  .featured .goal-content { padding-right: 42px; }
  .goal-metric { padding-inline: 14px; }
  .goal-metric strong { font-size: 18px; }
  .goal-card.compact { grid-template-columns: 145px minmax(0, 1fr); }
  .compact .goal-content {
    grid-template-columns: minmax(150px, 0.65fr) minmax(310px, 1.35fr);
    gap: 14px;
  }
  .compact .goal-progress-area {
    grid-column: 1 / -1;
    grid-template-columns: minmax(0, 1fr) auto;
  }
  .compact .goal-progress-row { grid-column: auto; }
}

@media (max-width: 1050px) {
  .balance-overview { grid-template-columns: minmax(0, 1fr) 330px; gap: 34px; }
  .balance-copy { padding-top: 38px; }
  .balance-amount { font-size: clamp(58px, 7vw, 76px); }
  .balance-breakdown { gap: 24px; }
  .metric + .metric { padding-left: 24px; }
  .movement-toolbar { grid-template-columns: minmax(240px, 1fr) minmax(280px, 1fr); }
  .category-filter { grid-column: 1 / -1; }
  .all-movements-columns,
  .all-movement-row { grid-template-columns: 44px minmax(170px, 1.2fr) minmax(120px, 0.8fr) minmax(120px, 0.72fr) minmax(135px, 0.8fr) 44px; gap: 12px; }
}

@media (max-width: 820px) {
  .app-shell { display: block; }
  .dashboard { max-width: 620px; padding: 28px 24px 126px; }
  .mobile-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 52px;
  }
  .mobile-header > a { font-size: 30px; font-weight: 700; letter-spacing: -0.055em; }
  .mobile-header button,
  .mobile-period-control {
    display: inline-flex;
    min-height: 52px;
    align-items: center;
    gap: 10px;
    padding: 0 18px;
    border-radius: 17px;
    background: var(--surface);
    color: var(--ink);
    font-weight: 600;
  }
  .mobile-period-control {
    position: relative;
    width: 166px;
    padding-right: 40px;
  }
  .mobile-period-control select { font-size: 13px; }
  .mobile-period-control svg { right: 14px; width: 18px; }
  .mobile-header svg {
    width: 20px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.7;
  }
  .app-navigation {
    position: fixed;
    inset: auto 0 0;
    z-index: 30;
    width: 100%;
    height: 92px;
    padding: 0;
    border: 0;
    border-top: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(18px);
  }
  .app-navigation .brand { display: none; }
  .app-navigation nav, .navigation-list { width: 100%; height: 100%; }
  .navigation-list { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0; }
  .navigation-list li:nth-child(1) { grid-column: 1; }
  .navigation-list li:nth-child(2) { grid-column: 3; }
  .navigation-list li:nth-child(3) { grid-column: 4; }
  .navigation-list a {
    display: flex;
    height: 100%;
    min-height: 0;
    flex-direction: column;
    gap: 4px;
    justify-content: center;
    padding: 12px 4px 8px;
    font-size: 11px;
  }
  .navigation-list a::before { display: none; }
  .navigation-list a:hover { transform: none; }
  .navigation-list svg { width: 25px; height: 25px; }
  .mobile-add {
    position: absolute;
    top: -26px;
    left: 37.5%;
    z-index: 2;
    display: grid;
    width: 62px;
    height: 62px;
    place-items: center;
    border-radius: 50%;
    background: var(--blue);
    color: #fff;
    box-shadow: 0 15px 30px rgba(36, 99, 235, 0.3);
    transform: translateX(-50%);
  }
  .mobile-add svg {
    width: 29px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-width: 1.7;
  }
  .balance-overview { display: block; }
  .balance-copy { padding: 0; }
  .balance-copy h1 { font-size: 21px; }
  .balance-amount { margin-top: 4px; font-size: clamp(54px, 14.8vw, 82px); white-space: nowrap; }
  .balance-breakdown { justify-content: space-between; gap: 14px; margin-top: 26px; }
  .metric { gap: 10px; }
  .metric + .metric { padding-left: 16px; }
  .metric-icon { width: 44px; height: 44px; }
  .metric-icon svg { width: 23px; }
  .metric dt { font-size: 13px; }
  .metric dd { font-size: clamp(17px, 4.5vw, 23px); }
  .goals-overview-link {
    grid-template-columns: 40px minmax(0, 1fr) 18px;
    gap: 11px;
    padding: 11px 13px;
    margin-top: 22px;
  }
  .goals-overview-icon { width: 40px; height: 40px; }
  .goals-overview-progress { grid-column: 2; justify-self: start; margin-top: -3px; }
  .goals-overview-link > .chevron { grid-column: 3; grid-row: 1 / span 2; }
  .month-summary { display: none; }
  .cash-flow { margin-top: 35px; }
  .cash-flow > .cash-flow-chart:not(.mobile-chart) { display: none; }
  .cash-flow .mobile-chart { display: block; height: 164px; margin-top: 10px; }
  .mobile-chart .chart-axis text { font-size: 12px; }
  .recent-movements { padding-top: 20px; }
  .movement {
    grid-template-columns: 46px minmax(90px, 1fr) minmax(90px, auto) 18px;
    gap: 12px;
    min-height: 54px;
    padding-inline: 0;
    border-radius: 0;
  }
  .movement time { display: none; }
  .movement strong { font-size: clamp(14px, 3.9vw, 18px); }
  .movement-dialog {
    width: 100%;
    height: min(92dvh, 790px);
    margin: auto 0 0;
    border-radius: 28px 28px 0 0;
  }
  .movement-dialog[open] { animation-name: sheet-enter; }
  .movement-dialog form > header { padding: 28px 24px 20px; }
  .type-switch, .amount-field { margin-right: 24px; margin-left: 24px; }
  .amount-field { margin-bottom: 30px; }
  .form-fields { gap: 20px; padding: 0 24px; }
  .movement-dialog footer { padding: 20px 24px calc(20px + env(safe-area-inset-bottom)); }

  .movements-page { max-width: 620px; padding: 28px 20px 126px; }
  .movements-page-header { display: block; margin: 0 0 28px; }
  .movements-page-header h1 { font-size: clamp(40px, 11vw, 54px); }
  .movements-page-actions { display: none; }
  .mobile-month-control {
    width: 166px;
    min-height: 52px;
    padding: 0 40px 0 16px;
    border-radius: 17px;
    background: var(--surface);
  }
  .mobile-month-control select { font-size: 13px; }
  .mobile-month-control svg { right: 14px; width: 18px; }
  .movements-summary { display: none; }
  .movements-directory { padding-top: 0; }
  .movement-toolbar { display: grid; grid-template-columns: 1fr; gap: 14px; padding-bottom: 0; border: 0; }
  .movement-search,
  .category-filter,
  .type-filter { min-height: 56px; border-radius: 15px; }
  .category-filter { grid-column: auto; }
  .category-filter::before {
    position: absolute;
    left: 20px;
    z-index: 1;
    color: var(--ink);
    font-size: 15px;
    font-weight: 600;
    pointer-events: none;
    content: attr(data-mobile-label);
  }
  .category-filter select { color: transparent; }
  .category-filter select option { color: var(--ink); }
  .movements-directory h2 { margin: 32px 0 14px; font-size: 24px; }
  .all-movements-columns { display: none; }
  .all-movement-row {
    grid-template-columns: 44px minmax(0, 1fr) minmax(92px, auto) 42px;
    gap: 11px;
    min-height: 76px;
    padding: 8px 0;
  }
  .all-movement-details { grid-column: 2; }
  .all-movement-details > strong { font-size: 15px; }
  .mobile-row-meta {
    display: block;
    overflow: hidden;
    color: var(--muted);
    font-size: 11px;
    font-weight: 500;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .all-movement-category,
  .all-movement-date { display: none; }
  .all-movement-amount { grid-column: 3; font-size: clamp(13px, 3.8vw, 17px); }
  .row-actions { grid-column: 4; }
  .row-action-button { width: 38px; height: 38px; border-radius: 12px; }
  .row-action-menu { top: 43px; }

  .goals-page { max-width: 620px; padding: 28px 20px 126px; }
  .goals-page .mobile-header { margin-bottom: 34px; }
  .mobile-goals-date {
    display: inline-flex;
    min-height: 52px;
    align-items: center;
    padding: 0 18px;
    border-radius: 17px;
    background: var(--surface);
    font-size: 13px;
    font-weight: 600;
  }
  .goals-page-header { display: block; }
  .goals-page-header h1 { font-size: clamp(40px, 11vw, 54px); }
  .add-goal-button { display: none; }
  .goals-total {
    display: grid;
    grid-template-columns: 58px minmax(0, 1fr);
    min-height: 118px;
    gap: 16px;
    padding: 18px;
    margin-top: 20px;
  }
  .goals-total-icon { grid-row: 1 / 3; width: 58px; height: 58px; }
  .goals-total-icon svg { width: 28px; }
  .goals-total p { font-size: 13px; }
  .goals-total strong { font-size: clamp(30px, 9vw, 43px); }
  .goals-total-target { grid-column: 2; align-self: auto; padding: 0; margin: -22px 0 0; border: 0; font-size: 14px; }
  .goals-total > div { min-width: 0; }
  .goals-directory { padding-top: 28px; margin-top: 28px; }
  .goals-directory h2 { margin-bottom: 18px; font-size: 25px; }
  .goals-list { gap: 14px; }
  .goal-card.featured,
  .goal-card.compact { display: block; min-height: 0; padding: 10px; }
  .featured .goal-image { height: 176px; min-height: 0; }
  .compact .goal-image { width: 116px; height: 104px; min-height: 0; float: left; margin: 0 14px 8px 0; }
  .featured .goal-content,
  .compact .goal-content { display: grid; grid-template-columns: 1fr; gap: 12px; padding: 14px 4px 4px; }
  .compact .goal-content { display: block; min-height: 104px; padding-top: 4px; padding-right: 42px; }
  .goal-heading h3,
  .compact h3 { padding-right: 44px; font-size: 21px; }
  .compact h3 { padding-right: 0; font-size: 17px; }
  .goal-card > .row-actions { top: auto; right: 14px; bottom: 14px; }
  .featured > .row-actions { top: 200px; bottom: auto; }
  .compact > .row-actions { top: 12px; right: 12px; bottom: auto; }
  .goal-metrics { clear: both; }
  .goal-metric { padding: 0 10px; }
  .goal-metric span { font-size: 11px; }
  .goal-metric strong { font-size: clamp(13px, 3.8vw, 17px); }
  .compact .goal-metrics { display: grid; margin-top: 10px; }
  .compact .goal-metric { padding-inline: 8px; }
  .compact .goal-metric strong { font-size: 13px; }
  .goal-progress { height: 9px; }
  .goal-progress-row { gap: 10px; }
  .goal-progress-row > strong { font-size: 13px; }
  .compact .goal-progress-area { display: grid; gap: 8px; margin-top: 10px; }
  .goal-save-button { width: 100%; min-height: 46px; justify-self: stretch; }
  .compact .goal-save-button { min-height: 42px; font-size: 12px; }
  .goal-dialog {
    width: 100%;
    height: min(92dvh, 790px);
    margin: auto 0 0;
    border-radius: 28px 28px 0 0;
  }
  .goal-dialog[open] { animation-name: sheet-enter; }
  .goal-dialog form > header { padding: 28px 24px 20px; }
  .goal-image-picker { margin: 0 24px 24px; }
  .goal-form-fields { gap: 18px; padding-inline: 24px; }
  .goal-form-fields input { min-height: 56px; }
  .goal-dialog footer { padding: 20px 24px calc(20px + env(safe-area-inset-bottom)); }
  .saving-dialog header { padding: 28px 24px 18px; }
  .saving-amount { margin-inline: 24px; }
  .saving-remaining { margin-inline: 24px; }
  .saving-dialog footer { padding: 20px 24px 24px; }
}

@media (max-width: 480px) {
  .dashboard { padding-right: 20px; padding-left: 20px; }
  .mobile-header { margin-bottom: 42px; }
  .mobile-header > a { font-size: 27px; }
  .mobile-header button,
  .mobile-period-control { min-height: 48px; padding: 0 38px 0 14px; font-size: 13px; }
  .balance-copy h1 { font-size: 19px; }
  .balance-amount { font-size: clamp(48px, 14vw, 68px); }
  .metric-icon { width: 40px; height: 40px; }
  .metric + .metric { padding-left: 11px; }
  .cash-flow { margin-top: 58px; }
  .cash-flow figcaption, .recent-movements h2 { font-size: 21px; }
  .recent-movements header a { font-size: 13px; }
  .movement-name { font-size: 14px; }
  .movement-icon { width: 38px; height: 38px; }
  .amount-field { min-height: 100px; }
  .amount-field > span[aria-hidden="true"], .amount-field input { font-size: 48px; }
  .movements-page .mobile-header { margin-bottom: 34px; }
  .movements-page-header { margin-bottom: 24px; }
  .movements-page-header h1 { font-size: 40px; }
  .movement-search,
  .category-filter,
  .type-filter { min-height: 52px; }
  .movement-search { grid-template-columns: 24px 1fr; padding: 0 16px; }
  .movement-search svg { width: 22px; }
  .type-filter button,
  .category-filter select,
  .movement-search input { font-size: 13px; }
  .category-filter::before { font-size: 13px; }
  .movements-directory h2 { margin: 24px 0 12px; font-size: 22px; }
  .all-movement-row { min-height: 62px; padding-block: 6px; }
  .goals-page .mobile-header { margin-bottom: 8px; }
  .goals-page-header h1 { font-size: 40px; }
  .goals-total {
    grid-template-columns: 48px minmax(0, 1fr);
    min-height: 90px;
    gap: 12px;
    padding: 12px;
    margin-top: 14px;
  }
  .goals-total-icon { width: 48px; height: 48px; }
  .goals-total-icon svg { width: 25px; }
  .goals-total strong { font-size: 30px; }
  .goals-total-target { margin-top: -17px; font-size: 11px; }
  .goals-directory { padding-top: 0; margin-top: 14px; border-top: 0; }
  .goals-directory h2 { margin-bottom: 0; font-size: 22px; }
  .goal-card.featured,
  .goal-card.compact { padding: 9px; }
  .featured .goal-image { height: 110px; }
  .featured .goal-content { gap: 4px; padding: 7px 4px 2px; }
  .goal-heading h3 { font-size: 19px; }
  .featured > .row-actions { top: 129px; }
  .goal-metric span { font-size: 10px; }
  .goal-metric strong { font-size: 13px; }
  .goal-save-button { min-height: 36px; font-size: 12px; }
  .compact .goal-image { width: 100px; height: 66px; }
  .compact .goal-content { min-height: 66px; }
  .compact .goal-metrics { margin-top: 4px; }
  .compact .goal-progress-area {
    clear: both;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    margin-top: 7px;
  }
  .compact .goal-save-button { width: auto; min-height: 34px; padding-inline: 10px; }
}

@keyframes sheet-enter {
  from { transform: translateY(36px); opacity: 0.7; }
  to { transform: translateY(0); opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Respaldo de datos */
.data-page {
  width: 100%;
  max-width: 1600px;
  min-width: 0;
  padding: 94px clamp(34px, 4vw, 70px) 60px;
  margin: 0 auto;
}
.data-page-header { max-width: 680px; }
.data-page-header h1 {
  margin: 0;
  font-size: clamp(42px, 3.8vw, 56px);
  letter-spacing: -0.065em;
  line-height: 1;
}
.data-page-header p { margin: 20px 0 0; color: var(--muted); }
.data-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px; margin-top: 42px; }
.data-card { display: flex; flex-direction: column; align-items: flex-start; min-height: 290px; padding: 30px; border: 1px solid var(--border); border-radius: 22px; background: #fff; }
.data-card-icon { display: grid; width: 48px; height: 48px; place-items: center; border-radius: 14px; background: var(--blue-soft); color: var(--blue); }
.data-card-icon svg { width: 24px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.8; }
.data-card h2 { margin: 22px 0 8px; font-size: 23px; letter-spacing: -0.04em; }
.data-card p { margin: 0 0 24px; color: var(--muted); font-size: 14px; }
.data-card .primary-button, .data-card .secondary-button { width: auto; min-height: 46px; padding-inline: 20px; margin-top: auto; }
.data-card .data-error { margin: 14px 0 0; color: #c8372e; }
.import-dialog { width: min(440px, calc(100% - 32px)); padding: 0; border: 0; border-radius: 22px; box-shadow: var(--shadow); }
.import-dialog::backdrop { background: rgba(7, 21, 47, 0.3); backdrop-filter: blur(3px); }
.import-dialog-content { padding: 30px; }
.import-dialog h2 { margin: 0 0 16px; font-size: 25px; letter-spacing: -0.04em; }
.import-dialog p { margin: 0 0 14px; color: var(--muted); font-size: 14px; }
.import-dialog [data-import-summary] { color: var(--ink); font-weight: 700; }
.import-dialog-actions { display: flex; gap: 12px; margin-top: 26px; }
.import-dialog-actions button { flex: 1; }
.import-dialog:has([data-import-review]:not([hidden])) { width: min(720px, calc(100% - 32px)); }
[data-import-review] { font-size: 14px; }
[data-import-review] h3 { margin: 22px 0 10px; font-size: 17px; }
[data-import-candidate-list] { max-height: 260px; overflow-y: auto; }
.import-candidate { display: flex; gap: 12px; align-items: start; padding: 12px 0; border-bottom: 1px solid #e2e8f0; }
.import-candidate input { flex: none; margin-top: 4px; }
.import-candidate img { width: 48px; height: 48px; object-fit: cover; border-radius: 8px; }
.import-candidate span { overflow-wrap: anywhere; }
.import-review-pages { display: flex; gap: 12px; align-items: center; justify-content: space-between; margin: 14px 0; }
.import-review-pages button { font-size: 12px; }
.import-periods-scroll { max-height: 260px; overflow: auto; }
.import-periods-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.import-periods-table th, .import-periods-table td { padding: 10px 6px; border-bottom: 1px solid #e2e8f0; text-align: right; white-space: nowrap; }
.import-periods-table th:first-child, .import-periods-table td:first-child { text-align: left; }
[data-import-periods] summary { cursor: pointer; font-weight: 600; margin: 18px 0 8px; }

@media (max-width: 820px) {
  .navigation-list { grid-template-columns: repeat(5, 1fr); }
  .navigation-list li:nth-child(2) { grid-column: 2; }
  .navigation-list li:nth-child(3) { grid-column: 4; }
  .navigation-list li:nth-child(4) { grid-column: 5; }
  .mobile-add { left: 50%; }
  .data-page { max-width: 620px; padding: 28px 24px 126px; }
  .data-cards { grid-template-columns: 1fr; gap: 16px; margin-top: 30px; }
  .data-card { min-height: 245px; padding: 24px; }
}
@media (max-width: 480px) {
  .data-page { padding-right: 20px; padding-left: 20px; }
  .data-page .mobile-header { margin-bottom: 34px; }
  .data-page-header h1 { font-size: 40px; }
  .data-page-header p { font-size: 14px; }
  .data-card h2 { font-size: 21px; }
  .import-dialog-actions { flex-direction: column-reverse; }
}

@media (max-width: 1180px) and (min-width: 821px) {
  .planning-form, .recurring-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .planning-form .primary-button { width: auto; }
  .report-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 1050px) and (min-width: 821px) {
  .balance-overview { grid-template-columns: minmax(0, 1fr) 310px; gap: 22px; }
  .balance-copy { padding-top: 24px; }
  .balance-amount { font-size: clamp(46px, 5.3vw, 67px); }
  .balance-breakdown { gap: 15px; }
  .metric + .metric { padding-left: 15px; }
  .metric-icon { width: 44px; height: 44px; }
  .metric dd { font-size: 18px; }
}
@media (max-width: 930px) and (min-width: 821px) {
  .balance-overview { display: block; }
  .balance-copy { padding-top: 0; }
  .balance-amount { font-size: clamp(52px, 7vw, 68px); }
  .month-summary { margin-top: 30px; }
  .cash-flow { margin-top: 32px; }
}
@media (max-width: 820px) {
  .navigation-list li:nth-child(5) { display: none; }
  .planning-page { max-width: 620px; padding: 28px 20px 126px; }
  .planning-page .mobile-header { margin-bottom: 34px; }
  .planning-header { display: block; margin-bottom: 26px; }
  .planning-header h1 { font-size: 42px; }
  .planning-backup-link { display: inline-block; margin-top: 14px; }
  .planning-section { padding: 22px; }
  .planning-form, .recurring-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .budget-grid { grid-template-columns: 1fr; }
  .report-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .recurring-card { align-items: start; flex-direction: column; }
  .recurring-card-actions { justify-content: start; }
  .balance-amount { font-size: clamp(46px, 12vw, 78px); }
  .cash-flow { margin-top: 28px; }
}
@media (max-width: 480px) {
  .planning-section { padding: 18px; }
  .planning-section-heading { display: block; }
  .planning-month-picker { display: inline-grid; margin-top: 10px; }
  .planning-form, .recurring-form { grid-template-columns: 1fr; }
  .planning-form .primary-button, .planning-form .secondary-button { width: 100%; }
  .movement-detail-content { padding: 22px; }
  .report-summary { grid-template-columns: 1fr 1fr; gap: 8px; }
  .report-summary > div { padding: 12px; }
  .report-summary strong { font-size: 14px; }
}
/* Account surfaces share the existing typography and controls. */
.cloud-pending .app-shell, .cloud-locked .app-shell { display: none; }
.auth-gate { min-height: 100vh; padding: 40px 24px; background: #f8fafc; }
.auth-gate > .brand { display: block; max-width: 420px; margin: 0 auto 36px; }
.auth-card { max-width: 420px; margin: 0 auto; padding: 32px; border: 1px solid #e2e8f0; border-radius: 24px; background: white; box-shadow: 0 12px 40px #1e293b08; }
.auth-card h1 { margin: 8px 0 12px; font-size: 28px; letter-spacing: -1px; }
.auth-card > p, .account-card p, .admin-panel > p { color: #64748b; font-size: 14px; line-height: 1.7; }
.auth-eyebrow { color: #2463eb !important; font-weight: 600; }
.auth-card form { margin-top: 24px; }
.auth-card label, .account-dialog label, [data-mfa-setup] label { display: block; font-size: 13px; font-weight: 600; margin: 16px 0; }
.auth-card input, .account-dialog input, [data-mfa-code], [data-mfa-secret] { width: 100%; margin-top: 8px; padding: 12px; border: 1px solid #cbd5e1; border-radius: 10px; font: inherit; }
.auth-card form > button { width: 100%; }
.auth-links { display: flex; flex-wrap: wrap; gap: 14px; margin: 24px 0; }
.auth-links button { padding: 0; border: 0; background: none; color: #2463eb; font: inherit; font-size: 12px; cursor: pointer; }
.auth-footnote { font-size: 12px !important; margin-bottom: 0; }
.account-message { font-size: 13px; line-height: 1.6; min-height: 1.6em; }
.account-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.account-actions button { font-size: 12px; }
.account-badge { display: inline-block; background: #eff6ff; color: #2463eb; padding: 5px 10px; border-radius: 8px; font-size: 12px; }
.account-dialog { width: min(420px,calc(100% - 32px)); padding: 28px; border: 0; border-radius: 20px; }
.account-dialog::backdrop { background: #0f172a66; }
.admin-panel { margin-top: 24px; }
[data-mfa-qr] { max-width: 180px; display: block; margin: 20px 0; }
.admin-account { padding: 18px 0; border-bottom: 1px solid #e2e8f0; overflow-wrap: anywhere; }
.admin-account select, .admin-account input { margin: 6px 8px 6px 0; padding: 9px; border-radius: 8px; border: 1px solid #cbd5e1; font: inherit; font-size: 12px; max-width: 100%; }
button:disabled { opacity: .65; cursor: wait; }
@media (max-width: 500px) { .auth-gate { padding: 28px 16px; } .auth-card { padding: 24px; } .auth-card h1 { font-size: 25px; } }
.movement-pagination { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 16px; padding: 20px 12px; color: var(--text-muted, #667085); font-size: 14px; }
.movement-pagination[hidden] { display: none; }
.movement-pagination button[hidden] { display: none; }
.movement-pagination button:disabled { cursor: default; }
.collection-search { max-width: 420px; min-height: 52px; margin: 16px 0; }
.collection-search[hidden] { display: none; }

[data-mfa-manual] { max-width: 480px; margin: 16px 0; font-size: 14px; line-height: 1.6; }
[data-mfa-manual] summary { cursor: pointer; color: #2463eb; }
[data-mfa-secret] { font-family: monospace; }
