/* Preview V6.4.2: components share semantic color tokens; official brand art is untouched. */
:root{color-scheme:light;--background:#f5f8f6;--surface:#fff;--surface-secondary:#f8faf9;--border:#dfe8e3;--text-primary:#10231d;--text-secondary:#62776c;--accent:#0b7852;--success:#087844;--warning:#946016;--danger:#b8423d;--input-bg:#fff;--canvas:var(--background);--soft:var(--surface-secondary);--ink:var(--text-primary);--ink-2:var(--text-secondary);--muted:var(--text-secondary);--line:var(--border);--hero-gradient:linear-gradient(115deg,#f1faf5,#fff 70%);--on-accent:#fff}
:root[data-theme=dark]{color-scheme:dark;--background:#101916;--surface:#1a2621;--surface-secondary:#223129;--border:#3a5044;--text-primary:#eff7f1;--text-secondary:#b2c7ba;--accent:#83ddb0;--success:#85dfb0;--warning:#f1c06f;--danger:#ffa49c;--input-bg:#15231c;--green-950:#0b2018;--green-900:#0b271d;--green-850:#113a2b;--green-800:#a1e7c3;--green-700:#83ddb0;--green-600:#67cd99;--green-500:#45b780;--green-400:#80d6a8;--green-300:#406a52;--green-100:#234735;--green-50:#203b2c;--line-2:#304339;--blue:#91c7ff;--blue-soft:#203749;--red:var(--danger);--red-soft:#402a29;--amber:var(--warning);--amber-soft:#3d3320;--purple:#ccb0ff;--shadow:0 14px 38px #0003;--shadow-sm:0 5px 16px #0003;--card-shadow:0 8px 28px #0003;--hero-gradient:linear-gradient(115deg,#1c3628,#1a2621 75%)}
body,.app-shell{background:var(--background);color:var(--text-primary)}
.theme-toggle{padding:0;width:44px;height:44px;min-width:44px;flex:none;border-radius:50%}.auth-theme-toggle{position:fixed;top:max(16px,env(safe-area-inset-top));right:16px;z-index:100;background:var(--surface);color:var(--text-primary)}body:not(.auth-needed)>.auth-theme-toggle{display:none}
#valueToggle{display:grid;place-items:center;min-width:44px;min-height:44px;padding:0}.value-toggle .icon,.theme-toggle .icon{width:22px;height:22px}
.sidebar .brand img{filter:none!important;opacity:1;width:100%;height:auto;object-fit:contain}.sidebar .brand{width:180px;max-width:100%}.sidebar .brand-lockup{margin-bottom:24px}.sidebar .month-label{margin-top:0}
.home-hero{padding:24px 28px;border:1px solid var(--border);border-radius:24px;background:var(--hero-gradient);position:relative;isolation:isolate;overflow:hidden;align-items:center}.home-hero:before{content:'';position:absolute;right:12%;top:-100px;width:220px;height:220px;border:1px solid var(--border);border-radius:50%;z-index:-1;opacity:.4}.home-hero h1{font-size:clamp(23px,2.3vw,32px);max-width:660px;line-height:1.2}.home-hero .home-context{font-size:14px;margin-bottom:0}.home-hero .health-pill{background:var(--surface);border:1px solid var(--border);box-shadow:none;flex-shrink:0}.home-hero .mini-gauge{flex-shrink:0}
.bank-card-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:16px}.bank-card.panel{padding:0;overflow:hidden;background:var(--surface)}.bank-card .bank-card-face{--card-base:#194e3c;--card-end:#10362b;background:linear-gradient(125deg,var(--card-base),var(--card-end));color:#fff;padding:24px;min-height:310px;display:flex;flex-direction:column;border-radius:18px;gap:12px;position:relative;isolation:isolate;overflow:hidden}.bank-card .bank-card-face:hover{background:linear-gradient(125deg,var(--card-base),var(--card-end));transform:translateY(-2px)}.bank-card-face:after{content:'';position:absolute;width:240px;height:240px;border:1px solid #ffffff20;border-radius:50%;right:-110px;top:10px;z-index:-1}.bank-card-face[data-bank=itau]{--card-base:#103e82;--card-end:#092852}.bank-card-face[data-bank=nubank]{--card-base:#70249a;--card-end:#471368}.bank-card-face[data-bank=c6]{--card-base:#333537;--card-end:#141618}.bank-card-face[data-bank=inter]{--card-base:#b5470a;--card-end:#853009}.bank-card-face[data-bank=mercado-pago],.bank-card-face[data-bank=porto-bank],.bank-card-face[data-bank=porto]{--card-base:#12618b;--card-end:#073c63}.bank-card-face[data-bank=santander],.bank-card-face[data-bank=bradesco]{--card-base:#932b35;--card-end:#641b25}.bank-card-face .credit-card-top{width:100%}.bank-card-face .bank-logo{width:52px;height:44px;border-radius:10px;padding:6px;background:#fff}.bank-card-label{font-size:11px;letter-spacing:2px;color:#fff;opacity:.85}.bank-card .card-title{font-size:20px;margin:0}.bank-card .credit-card-value{display:grid;gap:4px;margin:0}.bank-card .credit-card-value strong{font-size:28px;color:#fff}.bank-card .credit-card-value small,.bank-card-limit,.bank-card-dates{font-size:12px;color:#fff}.bank-card-dates{display:flex;justify-content:space-between;gap:12px;width:100%}.bank-card-limit{margin-top:auto}.bank-card .progress{width:100%;background:#ffffff30}.bank-card .progress i{background:#ffffffc9}.bank-card .card-detail-hint{color:#fff;font-size:13px;margin:0}.bank-card .rule-actions{padding:12px 16px;margin:0;justify-content:flex-end}
.planning-subtotal{padding:0 0 12px 16px;border-bottom:1px solid var(--line);display:grid;gap:8px;font-size:13px;color:var(--muted)}.planning-subtotal>span{display:flex;justify-content:space-between;gap:16px}.planning-subtotal b{color:var(--ink);white-space:nowrap}.installment-overview .planning-inline>span{display:grid;gap:4px}.installment-overview small{font-size:12px;color:var(--muted)}
.subscription-cards.subscription-entry-list{display:grid}.subscription-card{padding:20px;min-width:0;display:flex;flex-direction:column;gap:12px;background:var(--surface);border:1px solid var(--line);border-radius:18px}.subscription-card h3{margin:0;font-size:18px;overflow-wrap:anywhere}.subscription-card>strong{font-size:26px;color:var(--ink)}.subscription-card>strong>small{display:block;font-size:12px;color:var(--muted);font-weight:500}.subscription-card-top{display:flex;justify-content:space-between;align-items:center;gap:12px}.subscription-card dl{margin:0}.subscription-card dd{overflow-wrap:anywhere}.subscription-card .subscription-item-actions{margin-top:auto}.subscription-card .subscription-item-actions button{font-size:12px}.subscription-grid>.empty{grid-column:1/-1}
.category-select{display:flex;position:relative;align-items:center;min-width:0;width:100%}.category-select select{padding-left:44px!important;max-width:100%}.category-preview{position:absolute;left:8px;pointer-events:none;z-index:1}.category-preview .category-mark{width:28px;height:28px}.icon-picker{border:1px solid var(--line);border-radius:16px;padding:16px;min-width:0}.icon-picker legend{font-size:14px;font-weight:700}.icon-preview{display:flex;align-items:center;gap:12px;padding-bottom:16px}.icon-picker-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:8px;max-height:260px;overflow:auto;margin-top:12px}.icon-choice{display:flex;flex-direction:column;min-height:72px;padding:8px 4px;font-size:11px;font-weight:500}.icon-choice[aria-pressed=true]{border-color:var(--accent);background:var(--green-50);box-shadow:inset 0 0 0 1px var(--accent)}.icon-choice .category-mark{background:transparent}.icon-choice .category-mark svg{width:24px;height:24px}.category-chart-summary .category-mark{display:inline-flex;width:24px;height:24px;vertical-align:middle}
/* Explicit dark surfaces: no filters or inversion of official brand assets. */
html[data-theme=dark] :is(.panel,.metric,.subscription-card,.goal-card,.budget-row,.asset-card,.insight-card,.health-hero,.health-pill,.filters,.filter-panel,.account-menu,.auth-card,dialog,.quick-sheet,.updates-modal,.invoice-item,.statement-summary span,.analysis-rank,.bank-picker-grid button,.calendar-days .calendar-day,.planning-tabs button,.start-choice label,.responsive-table.table-mode-cards tr){background:var(--surface);color:var(--ink);border-color:var(--line)}
html[data-theme=dark] :is(.topbar,.mobile-bottom-nav){background:var(--surface);border-color:var(--line)}
html[data-theme=dark] :is(.dialog-footer,.updates-modal .dialog-footer){background:var(--surface);border-color:var(--line)}
html[data-theme=dark] :is(input:not([type=checkbox]):not([type=radio]):not([type=file]),select,textarea),html[data-theme=dark] #modal #formFields :is(input,select,textarea),html[data-theme=dark] #quickModal :is(input,select,textarea){background:var(--input-bg);color:var(--ink);border-color:var(--line);color-scheme:dark}
html[data-theme=dark] :is(button,.file-button){background:var(--surface-secondary);color:var(--ink);border-color:var(--line)}
html[data-theme=dark] :is(button,.file-button):hover{background:var(--green-50)}
html[data-theme=dark] :is(button.primary,.file-button.primary,.auth-card button.primary){background:#176742;color:#fff;border-color:#33895f}
html[data-theme=dark] :is(.text-button,.account-menu>button,.mobile-bottom-nav a,.mobile-bottom-nav button,.sort-button){background:transparent}
html[data-theme=dark] :is(.danger,.account-signout,.expense-value,.error,#authMessage,#migrationError){color:var(--danger)!important}
html[data-theme=dark] :is(.auth-card p,.auth-card label,.planning-sim-row small,.subscription-explanation,.account-cell small,.catalog-row small,.insight-card p){color:var(--muted)}
html[data-theme=dark] :is(.auth-card h1,.auth-card h2,.updates-modal h2,.updates-modal h3,.metric>strong,.goal-value strong,.asset-card>b){color:var(--ink)}
html[data-theme=dark] :is(.bulk-actions,.table-wrap th,.table-view-control,.goal-scenario,.insight-evidence,.info-banner,.input-methods,.account-details,.analysis-facts span,.check-row,.invoice-diagnostics){background:var(--surface-secondary);color:var(--ink);border-color:var(--line)}
html[data-theme=dark] :is(.input-method-grid button,.input-method-grid button:hover,.sheet-grid button){background:var(--surface);color:var(--ink)}
html[data-theme=dark] :is(.input-method-grid small,.input-method-grid strong,.sheet-grid button small,.sheet-grid button strong){color:var(--ink)}
html[data-theme=dark] :is(.badge.paid,.badge.healthy,.review-badge){background:var(--green-50);color:var(--success)}
html[data-theme=dark] :is(.badge.pending,.duplicate-badge){background:var(--amber-soft);color:var(--warning)}
html[data-theme=dark] :is(.badge.info,.tone-info .metric-icon){background:var(--blue-soft);color:var(--blue)}
html[data-theme=dark] :is(.invoice-item.duplicate,.statement-item.review-needs-attention,#quickModal .statement-validation){background:var(--red-soft);color:var(--danger);border-color:var(--danger)}
html[data-theme=dark] :is(.statement-row-issue,#quickModal .statement-item .statement-row-issue){color:var(--danger)}
html[data-theme=dark] :is(.analysis-rank.active,.planning-tabs button.active,.calendar-days .calendar-day.selected,.bank-picker-grid button[aria-pressed=true]){background:var(--green-50);border-color:var(--accent);color:var(--ink)}
html[data-theme=dark] .category-chart .donut>div,html[data-theme=dark] .donut:after{background:var(--surface)}
html[data-theme=dark] .ledger-panel .due-filter:not(.active) .due-date-control:after{background:var(--input-bg);color:var(--muted)}
html[data-theme=dark] .release-topic{border-color:var(--line)}
html[data-theme=dark] :is(.progress,.bar-chart){background-color:var(--surface-secondary)}
html[data-theme=dark] .home-hero{background:var(--hero-gradient)}
html[data-theme=dark] .home-hero .health-pill{background:var(--surface)}
html[data-theme=dark] .mini-gauge:after,html[data-theme=dark] .health-gauge:after{background:var(--surface)}
html[data-theme=dark] .auth-gate{background:var(--background)}
html[data-theme=dark] #quickModal #quickMic{background:var(--green-50);color:var(--accent)}
html[data-theme=dark] #quickModal #quickMic[aria-pressed=true]{background:#176742;color:#fff}
html[data-theme=dark] :is(.bank-logo,.catalog-icon:has(>img)){background:#fff;border-color:#dfe7e3}
html[data-theme=dark] .bank-card .bank-card-face,html[data-theme=dark] .bank-card .bank-card-face:hover{background:linear-gradient(125deg,var(--card-base),var(--card-end));color:#fff}
html[data-theme=dark] .bank-card .credit-card-value strong,html[data-theme=dark] .bank-card .card-detail-hint{color:#fff}
html[data-theme=dark] .icon-choice[aria-pressed=true]{background:var(--green-50);border-color:var(--accent)}
html[data-theme=dark] .sidebar{background:#0b241a}html[data-theme=dark] .sidebar :is(button,.period-picker){background:#153b2a;color:#eff7f1;border-color:#37614c}
body,button,.panel,.metric,.topbar,.mobile-bottom-nav{transition:background-color .16s ease,color .16s ease,border-color .16s ease,box-shadow .16s ease}button:active{transform:translateY(1px)}
@media(min-width:761px){.metric:hover{box-shadow:var(--shadow)}.bank-card-grid{align-items:stretch}}
@media(max-width:1200px){.bank-card-grid{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media(max-width:760px){.bank-card-grid{grid-template-columns:minmax(0,1fr)}.home-hero{padding:20px;gap:16px}.home-hero .health-pill{width:auto;max-width:100%;padding:8px 12px}.home-hero h1{font-size:25px}.topbar-actions{gap:4px}.mobile-sync{max-width:55px;font-size:9px}.topbar .mobile-brand{flex-shrink:1}.topbar .mobile-brand strong{display:none}.topbar .theme-toggle,.topbar #valueToggle,.topbar .avatar{width:44px;height:44px;min-width:44px}.bank-card .bank-card-face{min-height:300px}.icon-picker-grid{grid-template-columns:repeat(3,minmax(0,1fr))}.subscription-cards{grid-template-columns:minmax(0,1fr)}.subscription-item-actions{grid-column:auto}.home-context{max-width:100%}.installment-overview .planning-inline{flex-direction:column;align-items:flex-start}.category-select select{font-size:16px}}
@media(prefers-reduced-motion:reduce){*,*:before,*:after{transition:none!important;animation:none!important;scroll-behavior:auto!important}}
@media(max-width:420px){.dashboard-six .metric>strong{font-size:clamp(18px,5vw,21px);letter-spacing:-.035em}.dashboard-six .metric{padding:12px;min-width:0}.dashboard-six .metric-top{gap:6px}.dashboard-six .metric-label{font-size:11px}}
/* Match the legacy form selectors exactly so native dates and amounts share the theme. */
html[data-theme=dark] #modal #formFields .form-grid input:not([type=checkbox]),html[data-theme=dark] #modal #formFields .form-grid select,html[data-theme=dark] #quickModal .statement-item .form-grid input:not([type=checkbox]),html[data-theme=dark] #quickModal .statement-item .form-grid select{background:var(--input-bg);color:var(--ink);border-color:var(--line)}
html[data-theme=dark] .auth-actions button{color:var(--accent)}
html[data-theme=dark] :is(.metric-icon,.info-banner>span,.coming-icon){background:var(--surface-secondary);color:var(--accent)}
html[data-theme=dark] :is(.tone-expense,.tone-danger,.tone-negative) .metric-icon{background:var(--red-soft);color:var(--danger)}
html[data-theme=dark] .tone-wealth .metric-icon{background:#322941;color:var(--purple)}
html[data-theme=dark] .skip{background:var(--surface);color:var(--ink)}
html[data-theme=dark] .planning-list-row{border-color:var(--line)}
.analysis-rank>span>b,.analysis-detail h2,.category-inline{display:flex;align-items:center;gap:8px}.analysis-rank .category-mark{width:24px;height:24px;flex:none;background:transparent}.planning-sim-row>span>.category-mark{display:inline-flex;vertical-align:middle;margin-right:8px}.legend-name{white-space:normal;overflow:visible}.legend-name .category-mark{width:18px;height:18px;flex:none;background:transparent}.legend-name .category-mark svg{width:16px;height:16px}
@media(min-width:761px) and (max-width:1600px){.chart-panel .category-chart{grid-template-columns:minmax(0,1fr)}.chart-panel .category-chart .donut{max-width:140px;justify-self:center;width:100%}.metric-grid.four .metric>strong{font-size:clamp(22px,2vw,30px)}}
.bank-card-face[data-bank=porto-seguro]{--card-base:#12618b;--card-end:#073c63}
.category-rule-list>.empty{display:flex;flex-direction:column;align-items:center;justify-content:center;padding:24px}.category-rule-list>.empty>span{display:grid}.category-rule-list>.empty h3,.category-rule-list>.empty p{width:100%;text-align:center}
