@font-face{font-family:Inter;font-weight:400;font-display:swap;src:url(../fonts/Inter-Regular.woff) format("woff")}
@font-face{font-family:Inter;font-weight:500;font-display:swap;src:url(../fonts/Inter-Medium.woff) format("woff")}
@font-face{font-family:Inter;font-weight:600;font-display:swap;src:url(../fonts/Inter-SemiBold.woff) format("woff")}
@font-face{font-family:Inter;font-weight:700;font-display:swap;src:url(../fonts/Inter-Bold.woff) format("woff")}

/* Letra sobre los círculos de categoría: blanco en claro y oscuro (la paleta se verificó a 3:1 contra blanco). */
:root{--color-on-category:#FFFFFF}
*,*::before,*::after{box-sizing:border-box}
html{-webkit-text-size-adjust:100%}
body{margin:0;background:var(--color-bg);color:var(--color-text);font:var(--text-base-w) var(--text-base)/var(--text-base-lh) var(--font-sans);-webkit-tap-highlight-color:transparent}
body.no-scroll{overflow:hidden}
h1,h2,h3,p,ul{margin:0}
ul{padding:0;list-style:none}
button,input,select,textarea{font:inherit;color:inherit}
button{cursor:pointer}
a{color:var(--color-accent)}
.num{font-variant-numeric:tabular-nums}
.sr-only{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;border:0}
[hidden]{display:none!important}
:focus-visible{outline:3px solid var(--color-focus-ring);outline-offset:2px}
#screen-title:focus,#main:focus{outline:none}

.skip-link{position:absolute;left:var(--space-3);top:-100px;z-index:100;background:var(--color-accent);color:var(--color-on-accent);padding:var(--space-2) var(--space-4);border-radius:var(--radius-md)}
.skip-link:focus{top:var(--space-3)}

.app{max-width:var(--content-max);margin:0 auto;min-height:100dvh;display:flex;flex-direction:column;padding-bottom:calc(var(--bottom-nav-h) + var(--space-10) + env(safe-area-inset-bottom))}
.screen-header{position:sticky;top:0;z-index:5;display:flex;align-items:center;gap:var(--space-2);min-height:var(--header-h);padding:0 var(--space-4);background:var(--color-bg)}
.screen-header h1{flex:1;min-width:0;font-size:var(--text-xl);line-height:var(--text-xl-lh);font-weight:var(--text-xl-w);overflow-wrap:anywhere}
.header-right{display:flex;align-items:center}
.main{flex:1;padding:0 var(--space-4) var(--space-6)}
.content{display:flex;flex-direction:column;gap:var(--space-4)}
.main.auth{padding-top:var(--space-8);display:flex;flex-direction:column;gap:var(--space-4)}
.auth-title{font-size:var(--text-2xl);line-height:var(--text-2xl-lh);font-weight:var(--text-2xl-w)}
.lead{color:var(--color-text-muted)}

.card{background:var(--color-surface);border:1px solid var(--color-border);border-radius:var(--radius-lg);box-shadow:var(--shadow-sm)}
.summary{padding:var(--space-5);display:flex;flex-direction:column;gap:var(--space-3)}
.lbl{display:block;color:var(--color-text-muted);font-size:var(--text-sm);line-height:var(--text-sm-lh);font-weight:500}
.big{font-size:var(--text-2xl);line-height:var(--text-2xl-lh);font-weight:700;overflow-wrap:anywhere}
.two{display:grid;grid-template-columns:1fr 1fr;gap:var(--space-4)}
.two b{display:flex;align-items:center;gap:var(--space-1);font-weight:600;overflow-wrap:anywhere}
.income{color:var(--color-income)}.expense{color:var(--color-expense)}
.pending-line{color:var(--color-text-muted);font-size:var(--text-sm);line-height:var(--text-sm-lh)}
.accounts-line{display:flex;justify-content:space-between;gap:var(--space-3);padding-top:var(--space-3);border-top:1px solid var(--color-border);font-size:var(--text-sm)}

.month{display:flex;align-items:center;justify-content:space-between;margin-bottom:var(--space-3)}
.month b{font-weight:600}
.month b::first-letter,.day h3::first-letter{text-transform:uppercase}
.section-head{display:flex;justify-content:space-between;align-items:baseline;margin-bottom:var(--space-2)}
.section-head h2,.section-title{font-size:var(--text-lg);line-height:var(--text-lg-lh);font-weight:var(--text-lg-w)}
.section-title{margin:var(--space-5) 0 var(--space-2)}
.link{font-weight:600}
.day{margin-bottom:var(--space-4)}
.day h3{font-size:var(--text-sm);line-height:var(--text-sm-lh);color:var(--color-text-muted);font-weight:600;margin-bottom:var(--space-2)}

.list{overflow:hidden}
.list>li+li{border-top:1px solid var(--color-border)}
.row{display:flex;align-items:center;gap:var(--space-3);padding:var(--space-3) var(--space-4);min-height:var(--tap-min)}
.row-text{flex:1;min-width:0;display:flex;flex-direction:column}
.row-text b{font-weight:600;overflow-wrap:anywhere}
.row-text span{color:var(--color-text-muted);font-size:var(--text-sm);line-height:var(--text-sm-lh);overflow-wrap:anywhere}
.row .amount{display:flex;align-items:center;gap:var(--space-1);font-weight:600;white-space:nowrap}
.row-pending .row-text b{font-style:italic}
.tag{align-self:flex-start;font-style:normal;font-size:var(--text-xs);line-height:var(--text-xs-lh);font-weight:600;background:var(--color-warning-soft);color:var(--color-warning);border-radius:var(--radius-full);padding:0 var(--space-2);margin-top:var(--space-1)}
.link-row .tag{margin:0 var(--space-2) 0 auto}
.link-row{display:flex;align-items:center;gap:var(--space-2);min-height:var(--tap-min);padding:var(--space-3) var(--space-4);color:var(--color-text);text-decoration:none}

.chip{flex:none;display:inline-grid;place-items:center;width:40px;height:40px;border-radius:var(--radius-full);color:var(--color-on-category);font-weight:700}
.chip-sm{width:28px;height:28px;font-size:var(--text-sm)}

.btn{display:inline-flex;align-items:center;justify-content:center;gap:var(--space-2);min-height:var(--tap-min);padding:0 var(--space-5);border-radius:var(--radius-md);border:1px solid transparent;font-weight:600}
.btn-primary{background:var(--color-accent);color:var(--color-on-accent)}
.btn-secondary{background:var(--color-surface);color:var(--color-text);border-color:var(--color-border-input)}
.btn-danger{background:var(--color-surface);color:var(--color-danger);border-color:var(--color-danger)}
.btn-sm{min-height:36px;padding:0 var(--space-4)}
.btn-full{width:100%}
.btn:disabled{opacity:.6;cursor:progress}
.icon-btn{display:inline-grid;place-items:center;min-width:var(--tap-min);min-height:var(--tap-min);background:none;border:0;border-radius:var(--radius-full);color:var(--color-text)}
.link-btn{background:none;border:0;color:var(--color-accent);font-weight:600;min-height:var(--tap-min);padding:0;text-align:left;display:inline-flex;align-items:center;gap:var(--space-1)}
.link-btn.more[aria-expanded=true] svg{transform:rotate(180deg)}

.form,.settings{display:flex;flex-direction:column;gap:var(--space-4)}
.settings{padding:var(--space-4)}
.field{display:flex;flex-direction:column;gap:var(--space-1)}
.field>label{font-weight:600;font-size:var(--text-sm)}
.opt{color:var(--color-text-muted);font-weight:400}
.hint{color:var(--color-text-muted);font-size:var(--text-sm);line-height:var(--text-sm-lh)}
.hint.note{margin-top:var(--space-2)}
.field input:not([type=checkbox]),.field select,.field textarea,.input,.picker,.amount-wrap{width:100%;min-height:var(--tap-min);padding:0 var(--space-3);background:var(--color-surface);border:1px solid var(--color-border-input);border-radius:var(--radius-md);font-size:max(16px,var(--text-base))}
textarea.input{padding:var(--space-3);min-height:88px}
.picker{display:flex;align-items:center;gap:var(--space-3);text-align:left}
.picker>span:not(.chip){flex:1}
.placeholder{color:var(--color-text-muted)}
.amount-wrap{display:flex;align-items:center;gap:var(--space-2)}
.amount-sym{color:var(--color-text-muted);font-weight:600}
.field input.amount-input{flex:1;min-width:0;border:0;background:none;outline:none;min-height:0;padding:var(--space-2) 0;font-size:var(--text-2xl);font-weight:700;padding:var(--space-2) 0}
.amount-wrap:focus-within{outline:3px solid var(--color-focus-ring);outline-offset:2px}
.has-error .input,.has-error .picker,.has-error .amount-wrap{border-color:var(--color-danger)}
.form-info{background:var(--color-success-soft);color:var(--color-success);border-radius:var(--radius-md);padding:var(--space-3);font-size:var(--text-sm);line-height:var(--text-sm-lh);font-weight:500}
.field-error,.form-error{color:var(--color-danger);font-size:var(--text-sm);line-height:var(--text-sm-lh);font-weight:500}
.check{display:flex;align-items:center;gap:var(--space-3);min-height:var(--tap-min)}
.check input{width:22px;height:22px;accent-color:var(--color-accent)}
.form-actions{margin-top:var(--space-4)}
.static{font-weight:500}

.empty{display:flex;flex-direction:column;align-items:center;gap:var(--space-2);text-align:center;padding:var(--space-8) var(--space-5);color:var(--color-text-muted)}
.empty b{color:var(--color-text)}
.empty-shape{width:56px;height:56px;border-radius:var(--radius-lg);background:var(--color-accent-soft)}

.skeleton-wrap{display:flex;flex-direction:column;gap:var(--space-3)}
.skeleton{border-radius:var(--radius-lg);background:linear-gradient(90deg,var(--color-surface-2),var(--color-border),var(--color-surface-2));background-size:200% 100%;animation:sk 1.4s var(--ease) infinite}
.sk-card{height:176px}.sk-row{height:60px}
@keyframes sk{to{background-position:-200% 0}}

.sync{display:inline-flex;align-items:center;gap:var(--space-1);font-size:var(--text-xs);line-height:var(--text-xs-lh);color:var(--color-text-muted)}
.sync i{width:8px;height:8px;border-radius:50%;background:var(--color-success)}
.sync-off i{background:var(--color-warning)}

.bottom-nav{position:fixed;left:0;right:0;bottom:0;z-index:10;display:flex;justify-content:center;background:var(--color-surface);border-top:1px solid var(--color-border);height:calc(var(--bottom-nav-h) + env(safe-area-inset-bottom));padding-bottom:env(safe-area-inset-bottom)}
.bottom-nav a{flex:1;max-width:calc(var(--content-max) / 4);display:flex;flex-direction:column;align-items:center;justify-content:center;gap:2px;color:var(--color-text-muted);text-decoration:none;font-size:var(--text-xs);line-height:var(--text-xs-lh);font-weight:500}
.bottom-nav a.on{color:var(--color-accent);font-weight:700}
.fab-rail{position:fixed;left:0;right:0;bottom:calc(var(--bottom-nav-h) + var(--space-4) + env(safe-area-inset-bottom));z-index:11;max-width:var(--content-max);margin:0 auto;padding:0 var(--space-4);display:flex;justify-content:flex-end;pointer-events:none}
.fab{pointer-events:auto;display:grid;place-items:center;width:var(--fab);height:var(--fab);border:0;border-radius:var(--radius-full);background:var(--color-accent);color:var(--color-on-accent);box-shadow:var(--shadow-md)}

.sheet-backdrop{position:fixed;inset:0;z-index:50;background:var(--color-overlay);display:flex;align-items:flex-end;justify-content:center}
.sheet{width:100%;max-width:var(--content-max);max-height:85dvh;overflow:auto;background:var(--color-surface);border-radius:var(--radius-lg) var(--radius-lg) 0 0;box-shadow:var(--shadow-sheet);padding:0 var(--space-4) calc(var(--space-4) + env(safe-area-inset-bottom));animation:up var(--dur-base) var(--ease)}
.sheet-handle{width:40px;height:4px;border-radius:var(--radius-full);background:var(--color-border-input);margin:var(--space-2) auto}
.sheet-head{display:flex;align-items:center;justify-content:space-between}
.sheet-head h2{font-size:var(--text-lg);font-weight:var(--text-lg-w)}
.sheet-list{display:flex;flex-direction:column}
.sheet-item{width:100%;display:flex;align-items:center;gap:var(--space-3);min-height:var(--tap-min);padding:var(--space-2) var(--space-1);background:none;border:0;text-align:left}
.sheet-item>span:not(.chip){flex:1}
@keyframes up{from{transform:translateY(24px);opacity:0}}

.toasts{position:fixed;left:0;right:0;bottom:calc(var(--bottom-nav-h) + var(--fab) + var(--space-6) + env(safe-area-inset-bottom));z-index:60;display:flex;justify-content:center;padding:0 var(--space-4);pointer-events:none}
.toast{pointer-events:auto;display:flex;align-items:center;gap:var(--space-4);background:var(--color-text);color:var(--color-bg);padding:var(--space-3) var(--space-4);border-radius:var(--radius-md);box-shadow:var(--shadow-md)}
.toast-action{background:none;border:0;color:inherit;font-weight:700;text-decoration:underline;min-height:var(--tap-min)}

@media (min-width:768px){.main,.screen-header{padding-left:var(--space-6);padding-right:var(--space-6)}}
@media (prefers-reduced-motion:reduce){*,*::before,*::after{animation-duration:.01ms!important;transition-duration:.01ms!important}}
