/* Mis gastos — a quiet, legible monthly notebook. All selectors are scoped. */
.exp-page {
  --exp-green: #176044;
  --exp-ink: #23352b;
  --exp-muted: #637268;
  --exp-border: #dfe5db;
  --exp-cream: #f6f7f2;
  --exp-error: #944735;
  color: var(--exp-ink);
  max-width: 1180px;
  margin: 0 auto;
  padding: 30px 0 44px;
  font-family: 'DM Sans', sans-serif;
}
.exp-page *, .exp-dialog * { box-sizing: border-box; }
.exp-page button, .exp-page input, .exp-page select, .exp-dialog button, .exp-dialog input, .exp-dialog select, .exp-dialog textarea { font: inherit; }
.exp-page button, .exp-dialog button { cursor: pointer; }
.exp-page button:disabled, .exp-dialog button:disabled { opacity: .5; cursor: not-allowed; }
.exp-page [hidden], .exp-dialog [hidden] { display: none !important; }
.exp-page svg, .exp-dialog svg { display: block; width: 20px; height: 20px; flex-shrink: 0; }
.exp-page h1, .exp-page h2, .exp-page h3, .exp-page p, .exp-dialog h2, .exp-dialog p { margin: 0; }
.exp-header { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-bottom: 30px; }
.exp-eyebrow { display: block; font-size: 11px; font-weight: 700; letter-spacing: .11em; text-transform: uppercase; color: var(--exp-muted, #637268); line-height: 1.5; }
.exp-header h1 { font: 500 clamp(30px, 3.7vw, 43px)/1.2 'Lora', Georgia, serif; letter-spacing: -.035em; margin: 6px 0 9px; }
.exp-header p { color: var(--exp-muted); font-size: 14px; line-height: 1.6; }
.exp-btn { min-height: 44px; border: 1px solid transparent; border-radius: 9px; padding: 10px 16px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; font-size: 13px !important; font-weight: 600 !important; line-height: 1.4; background: transparent; color: var(--exp-green, #176044); white-space: nowrap; text-decoration: none; }
.exp-btn-primary { background: var(--exp-green, #176044); color: #fff; border-color: var(--exp-green, #176044); }
.exp-btn-primary:hover:not(:disabled) { background: #124c36; }
.exp-btn-quiet { border-color: var(--exp-border, #dfe5db); background: #fff; color: var(--exp-ink, #23352b); }
.exp-btn-quiet:hover:not(:disabled) { background: #f0f3ec; }
.exp-btn-text { padding: 8px 0; justify-content: flex-start; }
.exp-btn-text:hover:not(:disabled) { text-decoration: underline; text-underline-offset: 3px; }
.exp-btn-text svg { width: 16px; height: 16px; }
.exp-icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; flex-shrink: 0; background: transparent; border: 1px solid transparent; border-radius: 8px; color: inherit; padding: 0; }
.exp-icon-btn:hover:not(:disabled) { background: #edf1e9; }
.exp-page :focus-visible, .exp-dialog :focus-visible { outline: 3px solid #6a997f; outline-offset: 3px; }
.exp-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.exp-month-nav { display: flex; align-items: center; gap: 6px; }
.exp-month-nav .exp-icon-btn { border-color: var(--exp-border); background: #fff; }
.exp-month-label { position: relative; min-width: 200px; height: 44px; display: flex; align-items: center; justify-content: center; border-radius: 8px; }
.exp-month-label > span:not(.exp-sr-only) { pointer-events: none; font-size: 17px; font-weight: 600; text-transform: capitalize; }
.exp-month-label input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.exp-month-label:focus-within { outline: 3px solid #6a997f; outline-offset: 3px; }
.exp-mode { display: flex; align-items: center; gap: 12px; padding: 13px 17px; border: 1px solid var(--exp-border); background: #f0f3ec; border-radius: 10px; margin-bottom: 22px; }
.exp-mode > svg { color: var(--exp-muted); }
.exp-mode > div { min-width: 0; flex: 1; }
.exp-mode strong { display: block; font-size: 12px; font-weight: 600; }
.exp-mode span { display: block; font-size: 11px; color: var(--exp-muted); line-height: 1.5; margin-top: 3px; overflow-wrap: anywhere; }
.exp-mode .exp-btn { flex-shrink: 0; padding-left: 8px; }
.exp-mode-account { background: #eef5ed; }
.exp-mode-account > svg { color: var(--exp-green); }
.exp-overview { display: grid; grid-template-columns: 1.1fr 1fr; gap: 22px; margin-bottom: 28px; }
.exp-summary { background: var(--exp-cream); border: 1px solid var(--exp-border); border-radius: 14px; padding: 26px 30px 24px; display: flex; flex-direction: column; min-width: 0; }
.exp-summary .exp-eyebrow { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.exp-currency { letter-spacing: .03em; font-size: 10px; padding: 3px 6px; border: 1px solid var(--exp-border); border-radius: 4px; }
.exp-total { font-size: clamp(32px, 4.3vw, 48px); font-weight: 500; letter-spacing: -.055em; line-height: 1.2; font-variant-numeric: tabular-nums; display: block; margin: 18px 0 26px; overflow-wrap: anywhere; }
.exp-summary-bottom { display: grid; grid-template-columns: 1fr 1fr; padding-top: 18px; border-top: 1px solid var(--exp-border); gap: 20px; margin-top: auto; }
.exp-summary-bottom span { display: block; color: var(--exp-muted); font-size: 12px; margin-bottom: 5px; }
.exp-summary-bottom strong { display: block; font-size: 18px; font-weight: 500; font-variant-numeric: tabular-nums; letter-spacing: -.02em; overflow-wrap: anywhere; }
.exp-negative { color: var(--exp-error); }
.exp-budget { border: 1px solid var(--exp-border); background: #fff; padding: 26px 30px 20px; border-radius: 14px; min-width: 0; }
.exp-budget-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.exp-budget-heading svg { color: var(--exp-green); }
.exp-budget h2 { font: 500 25px/1.3 'Lora', Georgia, serif; letter-spacing: -.025em; margin: 18px 0 12px; }
.exp-budget > p { font-size: 12px; line-height: 1.65; color: var(--exp-muted); margin-top: 9px; }
.exp-budget > .exp-btn { margin-top: 8px; }
.exp-budget-amount { display: block; font-size: clamp(28px, 3vw, 36px); font-weight: 500; font-variant-numeric: tabular-nums; line-height: 1.25; letter-spacing: -.035em; margin: 17px 0 17px; overflow-wrap: anywhere; }
.exp-budget-track { height: 6px; width: 100%; background: #ebf0e6; border-radius: 8px; overflow: hidden; }
.exp-budget-track span { display: block; height: 100%; background: var(--exp-green); border-radius: inherit; }
.exp-budget-exceeded .exp-budget-amount, .exp-budget-exceeded .exp-budget-heading svg { color: var(--exp-error); }
.exp-budget-exceeded .exp-budget-track span { background: var(--exp-error); }
.exp-budget-form { margin-top: 16px; border-top: 1px solid var(--exp-border); padding-top: 16px; }
.exp-budget-form > label { display: block; font-size: 12px; margin-bottom: 8px; font-weight: 600; }
.exp-budget-actions { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-top: 10px; }
.exp-money-input { display: flex; align-items: center; gap: 8px; border: 1px solid var(--exp-border, #dfe5db); border-radius: 8px; background: #fff; padding: 0 12px; min-width: 0; }
.exp-money-input:focus-within { border-color: var(--exp-green, #176044); box-shadow: 0 0 0 3px #17604414; }
.exp-money-input > span { color: #637268; font-size: 18px; }
.exp-money-input input { border: 0 !important; width: 100%; min-width: 0; background: transparent; min-height: 44px; padding: 8px 0 !important; outline: none !important; font-variant-numeric: tabular-nums; box-shadow: none !important; }
.exp-content-grid { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 22px; align-items: start; }
.exp-ledger { min-width: 0; background: #fff; border: 1px solid var(--exp-border); border-radius: 14px; overflow: hidden; }
.exp-section-head { display: flex; align-items: center; justify-content: space-between; padding: 22px 24px 17px; }
.exp-section-head h2, .exp-breakdown h2 { font: 500 22px/1.3 'Lora', Georgia, serif; letter-spacing: -.025em; }
.exp-section-head p { color: var(--exp-muted); font-size: 11px; line-height: 1.5; margin-top: 5px; }
.exp-filters { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; padding: 0 24px 18px; border-bottom: 1px solid var(--exp-border); }
.exp-type-filter { display: flex; gap: 2px; border: 1px solid var(--exp-border); padding: 3px; border-radius: 8px; background: var(--exp-cream); }
.exp-type-filter button { border: 1px solid transparent; background: transparent; color: var(--exp-muted); border-radius: 5px; min-height: 44px; padding: 7px 12px; font-size: 12px; font-weight: 500; }
.exp-type-filter button[aria-pressed='true'] { background: #fff; color: var(--exp-green); border-color: var(--exp-border); }
.exp-category-filter { flex: 1; min-width: 165px; }
.exp-category-filter select { width: 100%; min-height: 44px; border: 1px solid var(--exp-border); border-radius: 8px; padding: 9px 30px 9px 10px; color: var(--exp-ink); background: #fff; font-size: 12px; }
.exp-search { display: flex; align-items: center; gap: 8px; border: 1px solid var(--exp-border); border-radius: 8px; padding: 0 10px; flex: 1 1 100%; min-height: 44px; color: var(--exp-muted); }
.exp-search svg { width: 17px; height: 17px; }
.exp-search input { width: 100%; min-width: 0; border: 0; outline: 0; color: var(--exp-ink); background: transparent; min-height: 42px; font-size: 12px; }
.exp-search:focus-within { outline: 3px solid #6a997f; outline-offset: 2px; }
.exp-entry-list, .exp-category-list { list-style: none; padding: 0; margin: 0; }
.exp-entry { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto 88px; align-items: center; column-gap: 12px; padding: 17px 20px; border-bottom: 1px solid #edf0e9; }
.exp-entry:last-child { border-bottom: 0; }
.exp-entry-icon { width: 38px; height: 38px; background: var(--exp-cream); border: 1px solid #e9eee3; border-radius: 10px; display: flex; align-items: center; justify-content: center; color: #667c63; }
.exp-entry-income .exp-entry-icon { color: var(--exp-green); background: #edf5ea; }
.exp-entry-main { min-width: 0; }
.exp-entry-main > strong { display: block; font-size: 13px; line-height: 1.5; font-weight: 500; overflow-wrap: anywhere; }
.exp-entry-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 8px; color: var(--exp-muted); font-size: 10px; line-height: 1.5; margin-top: 4px; }
.exp-entry-meta span { position: relative; padding-left: 8px; }
.exp-entry-meta span::before { content: ''; position: absolute; left: 0; top: 6px; width: 2px; height: 2px; border-radius: 50%; background: #84917f; }
.exp-entry-note { font-size: 11px; line-height: 1.5; color: var(--exp-muted); margin-top: 6px !important; overflow-wrap: anywhere; white-space: pre-line; }
.exp-entry-amount { font-size: 14px; font-weight: 500; color: #70493a; font-variant-numeric: tabular-nums; white-space: nowrap; }
.exp-entry-income .exp-entry-amount { color: var(--exp-green); }
.exp-entry-actions { display: flex; align-items: center; gap: 0; color: #6a7a69; }
.exp-entry-actions .exp-icon-btn svg { width: 16px; height: 16px; }
.exp-danger { color: var(--exp-error, #944735) !important; }
.exp-btn-danger { background: #944735; color: #fff; }
.exp-delete-confirm { grid-column: 2 / -1; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-top: 12px; padding-top: 12px; border-top: 1px solid #eadfd5; }
.exp-delete-confirm > span { font-size: 12px; flex: 1; }
.exp-empty { padding: 42px 28px 44px; text-align: center; }
.exp-empty > svg { width: 35px; height: 35px; color: #6f8969; margin: 0 auto 17px; }
.exp-empty h3 { font: 500 23px/1.3 'Lora', Georgia, serif; letter-spacing: -.025em; }
.exp-empty p { max-width: 320px; margin: 10px auto 20px; color: var(--exp-muted); font-size: 12px; line-height: 1.7; }
.exp-breakdown { border: 1px solid var(--exp-border); border-radius: 14px; background: var(--exp-cream); padding: 23px 22px; min-width: 0; }
.exp-breakdown h2 { margin: 6px 0 23px; }
.exp-category-list li + li { margin-top: 20px; }
.exp-category-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.exp-category-top > span { display: inline-flex; gap: 7px; align-items: center; font-size: 11px; }
.exp-category-top svg { width: 15px; height: 15px; color: #688365; }
.exp-category-top > strong { font-size: 12px; font-weight: 500; font-variant-numeric: tabular-nums; white-space: nowrap; }
.exp-category-bottom { display: flex; gap: 10px; align-items: center; margin: 9px 0 0 22px; }
.exp-category-track { flex: 1; height: 4px; background: #e1e8d9; border-radius: 3px; overflow: hidden; }
.exp-category-track span { display: block; height: 100%; background: #568765; border-radius: inherit; }
.exp-category-bottom > span { color: var(--exp-muted); font-size: 10px; font-variant-numeric: tabular-nums; width: 29px; text-align: right; }
.exp-breakdown-empty { color: var(--exp-muted); font-size: 12px; line-height: 1.8; padding: 2px 0 10px; }
.exp-breakdown-foot { margin-top: 25px !important; padding-top: 16px; border-top: 1px solid var(--exp-border); color: var(--exp-muted); font-size: 10px; line-height: 1.7; }
.exp-local-note { color: var(--exp-muted); font-size: 11px; max-width: 760px; margin-top: 22px !important; line-height: 1.7; }
.exp-notice, .exp-error { display: flex; align-items: center; gap: 14px; justify-content: space-between; padding: 10px 15px; border-radius: 8px; font-size: 12px; line-height: 1.6; margin-bottom: 20px; }
.exp-notice { background: #edf5e8; border: 1px solid #d7e6cf; color: #305b30; }
.exp-error { background: #fcf3ed; color: #944735; border: 1px solid #e9d5c8; }
.exp-error > span { min-width: 0; }
.exp-loading { display: flex; align-items: center; justify-content: center; gap: 12px; padding: 80px 20px; color: var(--exp-muted); font-size: 13px; }
.exp-spinner { width: 18px; height: 18px; border: 2px solid #d7e1d1; border-top-color: var(--exp-green); border-radius: 50%; animation: exp-spin .8s linear infinite; }
@keyframes exp-spin { to { transform: rotate(360deg); } }
.exp-sr-only { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip: rect(0,0,0,0) !important; white-space: nowrap !important; border: 0 !important; }

.exp-dialog { --exp-green: #176044; --exp-ink: #23352b; --exp-muted: #637268; --exp-border: #dfe5db; --exp-error: #944735; font-family: 'DM Sans', sans-serif; color: var(--exp-ink); width: min(560px, calc(100vw - 32px)); max-height: calc(100dvh - 48px); margin: auto; padding: 0; border: 1px solid #dfe5db; border-radius: 16px; background: #fff; box-shadow: 0 20px 70px #10251924; overflow-y: auto; }
.exp-dialog::backdrop { background: #172a2359; }
.exp-dialog-card { padding: 26px 28px 24px; }
.exp-dialog-header { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 24px; }
.exp-dialog-header h2 { font: 500 27px/1.3 'Lora', Georgia, serif; letter-spacing: -.03em; margin-top: 5px; }
.exp-dialog-header .exp-icon-btn { align-self: flex-start; margin: -5px -10px 0 0; }
.exp-form-type { display: flex; border: 1px solid var(--exp-border); background: #f6f7f2; border-radius: 9px; gap: 3px; padding: 4px; margin: 0 0 21px; }
.exp-form-type label { flex: 1; position: relative; cursor: pointer; }
.exp-form-type input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.exp-form-type span { display: flex; align-items: center; justify-content: center; min-height: 44px; font-size: 13px; font-weight: 500; border: 1px solid transparent; border-radius: 6px; color: var(--exp-muted); }
.exp-form-type input:checked + span { background: #fff; color: var(--exp-green); border-color: var(--exp-border); }
.exp-form-type input:focus-visible + span { outline: 3px solid #6a997f; outline-offset: 1px; }
.exp-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px 16px; }
.exp-field { min-width: 0; }
.exp-field-full { grid-column: 1 / -1; }
.exp-field > label { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 12px; font-weight: 600; margin-bottom: 8px; }
.exp-field > label > span { color: var(--exp-muted); font-size: 10px; font-weight: 400; }
.exp-field > input, .exp-field > select, .exp-field > textarea { width: 100%; min-height: 46px; color: var(--exp-ink); background: #fff; border: 1px solid var(--exp-border); border-radius: 8px; padding: 10px 12px; font-size: 13px; transition: border-color 150ms ease; }
.exp-field > input:focus, .exp-field > select:focus, .exp-field > textarea:focus { border-color: var(--exp-green); }
.exp-field input[aria-invalid='true'] { border-color: #b57c67; }
.exp-field .exp-money-input:has(input[aria-invalid='true']) { border-color: #b57c67; }
.exp-amount-field input { font-size: 24px !important; min-height: 52px; letter-spacing: -.025em; }
.exp-field textarea { resize: vertical; min-height: 76px; max-height: 180px; }
.exp-field-error { margin-top: 7px !important; font-size: 11px; line-height: 1.5; color: #944735; }
.exp-form-error { background: #fcf3ed; border: 1px solid #e9d5c8; border-radius: 8px; color: #944735; padding: 11px 13px; font-size: 12px; line-height: 1.6; margin-top: 18px; }
.exp-form-storage { display: flex; align-items: center; gap: 7px; font-size: 10px; color: var(--exp-muted); margin-top: 20px !important; }
.exp-form-storage svg { width: 14px; height: 14px; }
.exp-dialog-footer { display: flex; align-items: center; justify-content: flex-end; gap: 12px; border-top: 1px solid var(--exp-border); margin-top: 18px; padding-top: 20px; }

@media (max-width: 1050px) {
  .exp-content-grid { grid-template-columns: minmax(0, 1fr) 260px; gap: 18px; }
  .exp-entry { grid-template-columns: 36px minmax(0, 1fr) auto; gap: 10px; padding: 15px 18px; }
  .exp-entry-actions { grid-column: 2 / -1; justify-content: flex-end; margin: -5px -3px -8px 0; }
  .exp-entry-actions .exp-icon-btn { width: 44px; height: 44px; }
  .exp-delete-confirm { grid-column: 1 / -1; }
  .exp-summary, .exp-budget { padding-left: 24px; padding-right: 24px; }
}
@media (max-width: 760px) {
  .exp-page { padding-top: 18px; }
  .exp-header { align-items: flex-start; gap: 15px; flex-wrap: wrap; margin-bottom: 22px; }
  .exp-header > div { flex: 1 1 260px; }
  .exp-header h1 { font-size: 34px; }
  .exp-header > .exp-btn { padding-left: 13px; padding-right: 13px; }
  .exp-overview { gap: 16px; margin-bottom: 20px; }
  .exp-summary, .exp-budget { padding: 21px 20px 18px; }
  .exp-total { font-size: 35px; }
  .exp-summary-bottom { grid-template-columns: 1fr; gap: 13px; padding-top: 15px; }
  .exp-summary-bottom > div { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; }
  .exp-summary-bottom strong { font-size: 16px; }
  .exp-budget-amount { font-size: 30px; }
  .exp-content-grid { grid-template-columns: 1fr; }
  .exp-category-list { display: grid; grid-template-columns: 1fr 1fr; column-gap: 28px; row-gap: 20px; }
  .exp-category-list li + li { margin-top: 0; }
  .exp-breakdown { padding: 22px; }
  .exp-entry { grid-template-columns: 38px minmax(0, 1fr) auto 88px; }
  .exp-entry-actions { grid-column: auto; margin: 0; }
  .exp-mode { gap: 10px; padding: 12px; }
  .exp-mode > svg { width: 18px; height: 18px; }
}
@media (max-width: 520px) {
  .exp-header > div { flex-basis: 100%; }
  .exp-header > .exp-btn { width: 100%; }
  .exp-toolbar { gap: 8px; flex-wrap: wrap; }
  .exp-month-nav { width: 100%; justify-content: space-between; }
  .exp-month-label { min-width: 0; flex: 1; }
  .exp-toolbar > .exp-btn { min-height: 44px; margin-left: auto; }
  .exp-month-label > span:not(.exp-sr-only) { font-size: 16px; }
  .exp-overview { grid-template-columns: 1fr; gap: 14px; }
  .exp-total { font-size: 42px; margin-top: 14px; margin-bottom: 20px; }
  .exp-summary-bottom { grid-template-columns: 1fr 1fr; gap: 20px; }
  .exp-summary-bottom > div { display: block; }
  .exp-summary-bottom strong { font-size: 17px; }
  .exp-mode { align-items: flex-start; flex-wrap: wrap; }
  .exp-mode > svg { margin-top: 3px; }
  .exp-mode .exp-btn { width: 100%; padding-left: 28px; margin-top: -4px; min-height: 44px; }
  .exp-section-head { padding: 21px 17px 16px; }
  .exp-filters { padding: 0 17px 17px; gap: 10px; }
  .exp-type-filter { width: 100%; }
  .exp-type-filter button { flex: 1; min-height: 44px; }
  .exp-category-filter { flex-basis: 100%; }
  .exp-entry { grid-template-columns: 35px minmax(0, 1fr) auto; column-gap: 9px; padding: 17px 14px 12px; }
  .exp-entry-icon { width: 34px; height: 34px; }
  .exp-entry-main > strong { font-size: 12px; }
  .exp-entry-amount { font-size: 13px; }
  .exp-entry-actions { grid-column: 2 / -1; margin: -2px -2px -6px 0; }
  .exp-entry-meta { font-size: 10px; gap: 4px 6px; }
  .exp-entry-note { font-size: 11px; }
  .exp-delete-confirm { gap: 7px 12px; }
  .exp-delete-confirm > span { flex-basis: 100%; }
  .exp-empty { padding: 35px 20px 38px; }
  .exp-empty .exp-btn { white-space: normal; }
  .exp-category-list { grid-template-columns: 1fr; }
  .exp-error { align-items: flex-start; flex-wrap: wrap; }
  .exp-dialog { width: 100%; max-width: 100%; max-height: calc(100dvh - 24px); margin: auto 0 0; border-radius: 16px 16px 0 0; border-bottom: 0; }
  .exp-dialog-card { padding: 23px 20px max(22px, env(safe-area-inset-bottom)); }
  .exp-dialog-header h2 { font-size: 25px; }
  .exp-form-grid { gap: 18px 12px; }
  .exp-field > input, .exp-field > select, .exp-field > textarea { font-size: 16px; padding: 10px; }
  .exp-amount-field input { font-size: 23px !important; }
  .exp-dialog-footer { gap: 10px; }
  .exp-dialog-footer .exp-btn-primary { flex: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .exp-spinner { animation: none; }
  .exp-field > input, .exp-field > select, .exp-field > textarea { transition: none; }
}
