/* ===== Ahorrito 12: fixed opaque header, aligned sidebar and accessible tables ===== */
:root{--ah12-header-height:80px}
body[data-mode="web"] #appScreen .shell,body[data-mode="app"] #appScreen .shell{padding-top:calc(var(--ah12-header-height) + 28px)!important;max-width:1560px!important}
body[data-mode="web"] #appScreen .topbar.topbar-v5,body[data-mode="app"] #appScreen .topbar.topbar-v5{
 position:fixed!important;top:0!important;left:0!important;right:0!important;width:100vw!important;max-width:none!important;
 height:var(--ah12-header-height)!important;min-height:0!important;z-index:850!important;
 display:flex!important;align-items:center!important;justify-content:space-between!important;
 margin:0!important;padding:env(safe-area-inset-top,0px) max(20px,calc((100vw - 1490px)/2)) 0!important;
 border:0!important;border-bottom:1px solid #d7e6de!important;border-radius:0!important;
 background:#fff!important;box-shadow:0 8px 28px rgba(10,51,39,.10)!important;backdrop-filter:none!important
}
html[data-theme="dark"] body[data-mode="web"] #appScreen .topbar.topbar-v5,html[data-theme="dark"] body[data-mode="app"] #appScreen .topbar.topbar-v5{background:#0d211b!important;border-bottom-color:#29443a!important;box-shadow:0 9px 30px rgba(0,0,0,.30)!important}
@media(min-width:951px){
body[data-mode="web"] #appScreen .sidebar,body[data-mode="app"] #appScreen .sidebar{position:sticky!important;top:calc(var(--ah12-header-height) + 14px)!important;align-self:start!important;max-height:calc(100dvh - var(--ah12-header-height) - 28px)!important;overflow-y:auto!important}
}
@media(max-width:950px){:root{--ah12-header-height:calc(65px + env(safe-area-inset-top,0px))}
body[data-mode="web"] #appScreen .shell,body[data-mode="app"] #appScreen .shell{padding-top:calc(var(--ah12-header-height) + 18px)!important}
body[data-mode="web"] #appScreen .topbar.topbar-v5,body[data-mode="app"] #appScreen .topbar.topbar-v5{padding:env(safe-area-inset-top,0px) 18px 0!important}
#appScreen #view-inicio .v7-welcome,#appScreen .v7-welcome-copy,#appScreen #greetingName,#appScreen .home-greeting-subtitle{text-align:left!important;align-items:flex-start!important;justify-content:flex-start!important}
}
/* Prevent first-install and install-instruction overlays from stealing taps when hidden. */
#pwaBootGate.hidden,#installGuide.hidden,#modalRoot.hidden,#offlinePrepBanner.hidden{display:none!important;pointer-events:none!important;visibility:hidden!important}
#pwaBootGate:not(.hidden),#installGuide:not(.hidden){pointer-events:auto!important;visibility:visible!important}
#authScreen:not(.hidden),#lockScreen:not(.hidden){position:relative;z-index:2;pointer-events:auto}
#authScreen input,#authScreen select,#lockScreen input,#lockScreen select,#modalRoot input,#modalRoot textarea{pointer-events:auto!important;user-select:text!important;-webkit-user-select:text!important}
#appScreen .v101-category-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
#appScreen .v12-both-panel{grid-column:1/-1;background:linear-gradient(125deg,#e5f4ff,#eafaf1);border:1px solid #b8ddda}
#appScreen .v12-both-choice{--type-accent:#3495be}
#appScreen .v101-type-options{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px}
html[data-theme="dark"] #appScreen .v12-both-panel{background:#112c32!important;border-color:#38616a!important;color:#eaf8f9!important}
@media(max-width:650px){#appScreen .v101-category-grid{grid-template-columns:1fr}#appScreen .v101-type-options{grid-template-columns:1fr!important}}
/* Dark tables: explicit foreground for normal, muted, label, IDs, links and amounts. */
html[data-theme="dark"] #appScreen .table-wrap,html[data-theme="dark"] #appScreen .v101-category-details .panel,html[data-theme="dark"] #appScreen table{background:#122922!important;border-color:#315248!important;color:#f0fbf7!important}
html[data-theme="dark"] #appScreen :is(.table-wrap,.panel) table :is(td,th),html[data-theme="dark"] #appScreen table td :is(strong,span,a,small,b),html[data-theme="dark"] #appScreen table td .detail-cell{color:#eaf8f1!important;opacity:1!important}
html[data-theme="dark"] #appScreen table tbody tr{background:#122922!important}
html[data-theme="dark"] #appScreen table tbody tr:nth-child(even){background:#1b372d!important}
html[data-theme="dark"] #appScreen table tbody tr:hover{background:#234738!important}
html[data-theme="dark"] #appScreen table thead th{background:#214439!important;color:#f0fff8!important}
html[data-theme="dark"] #appScreen table .muted,html[data-theme="dark"] #appScreen table td .small{color:#bed8cb!important}
html[data-theme="dark"] #appScreen table td .sum.pos{color:#76efbd!important}
html[data-theme="dark"] #appScreen table td .sum.neg{color:#ffb4b1!important}
html[data-theme="dark"] #appScreen table td .btn.light{background:#21463a!important;color:#effff6!important;border-color:#507267!important}
html[data-theme="dark"] #appScreen table td .idchip{background:#254d41!important;color:#e7fff2!important}
