/* v6.81.0 — Glass Layers, first production layer.
   Existing theme, accent, routing, layout and data remain the source of truth. */
:root {
  --gl-line: var(--border-soft);
  --gl-edge: rgba(255,255,255,.78);
  --gl-shadow: 0 10px 30px rgba(35,39,68,.07), 0 2px 5px rgba(35,39,68,.035);
  --gl-dock-shadow: 0 8px 25px rgba(31,35,60,.14), inset 0 1px 0 var(--gl-edge);
  --gl-income: #136c54;
  --gl-expense: #b13452;
  --gl-surface: var(--surface);
  --gl-chrome: var(--sidebar);
  --gl-active: var(--text);
  --gl-focus: var(--text);
}
:root[data-theme="dark"] {
  --gl-edge: rgba(255,255,255,.09);
  --gl-shadow: 0 10px 30px rgba(0,0,0,.24), 0 2px 5px rgba(0,0,0,.12);
  --gl-dock-shadow: 0 8px 25px rgba(0,0,0,.36), inset 0 1px 0 var(--gl-edge);
  --gl-income: #79dfb9;
  --gl-expense: #ffa1b2;
}
@supports (color:color-mix(in srgb,white,black)) {
  :root {
    --gl-chrome: color-mix(in srgb,var(--sidebar) 94%,transparent);
    --gl-active: color-mix(in srgb,var(--accent) 36%,var(--text));
  }
  :root[data-theme="dark"] {--gl-active:color-mix(in srgb,var(--accent) 24%,var(--text));}
}
/* Shell only, never auth or public views. Fixed mobile chrome stays blur-free
   (v6.40.1 performance decision); no extra scrolling or animation listeners. */
body:not(.auth-mode):not(.public-mode) .topbar {
  background:var(--gl-chrome);
  box-shadow:inset 0 1px 0 var(--gl-edge);
}
body:not(.auth-mode):not(.public-mode) .topbar :is(.topbar-tool,.theme-toggle) {
  background:var(--surface);border-color:var(--gl-line);border-radius:14px;
  box-shadow:inset 0 1px 0 var(--gl-edge);
}
@media(min-width:901px){
  body:not(.auth-mode):not(.public-mode) .sidebar {
    background:var(--gl-chrome);
    box-shadow:inset -1px 0 0 var(--gl-edge);
  }
  body:not(.auth-mode):not(.public-mode) .sidebar .nav-item.active {
    color:var(--gl-active);background:var(--accent-soft);border-color:transparent;box-shadow:none;
  }
  body:not(.auth-mode):not(.public-mode) .sidebar .nav-item.active .nav-icon {color:var(--gl-active);}
  body:not(.auth-mode):not(.public-mode) .topbar {backdrop-filter:blur(14px);-webkit-backdrop-filter:blur(14px);}
}
/* Dashboard only. No size/order overrides to the existing S/M/L packing. */
.main:has(.calm-home) {
  background:radial-gradient(ellipse at 95% 0%,rgba(var(--accent-rgb),.07),transparent 44%),var(--bg);
}
.calm-home {gap:16px;margin-bottom:18px;}
.calm-home .calm-intro {padding-top:7px;}
.calm-home .calm-intro h2 {font-weight:750;letter-spacing:-.045em;}
.calm-home .calm-desktop-add {background:var(--surface);border-color:var(--border);box-shadow:var(--gl-shadow);}
.calm-home .calm-desktop-add span {color:var(--gl-active);}
.calm-home .calm-today {background:var(--surface);border-radius:22px;box-shadow:var(--gl-shadow),inset 0 1px 0 var(--gl-edge);}
.calm-home .calm-today-label {color:var(--gl-active);}
.calm-home .calm-today-mark {color:var(--gl-active);}
.calm-widget-section .home-focus-actions {border-bottom:0;padding:0 0 6px;min-height:48px;}
.calm-widget-section .home-focus-actions :is(#toggleHomeWidgets,#editHomeWidgets) {min-height:44px;padding:6px 10px;color:var(--text);}
.calm-widget-section .home-focus-heading strong {font-size:19px;}
.calm-widget-section .dashboard-widget {
  border:1px solid var(--gl-line);border-radius:23px;background:var(--gl-surface);
  box-shadow:var(--gl-shadow),inset 0 1px 0 var(--gl-edge);overflow:hidden;
}
.calm-widget-section .dashboard-widget>.card-head {
  background:transparent;border-bottom:1px solid var(--border-soft);gap:10px;
}
.calm-widget-section .dashboard-widget .card-head>div:first-child {min-width:0;}
.calm-widget-section .dashboard-widget .card-title {font-size:16px;letter-spacing:-.025em;overflow-wrap:anywhere;}
.calm-widget-section .dashboard-widget .card-subtitle {font-size:12px;color:var(--muted);overflow-wrap:anywhere;}
.calm-widget-section .dashboard-widget .card-head>.btn {min-height:44px;border-radius:13px;flex:none;color:var(--text);}
.calm-widget-section :is(.dashboard-finance-kpis,.dashboard-health-kpis--adaptive) {grid-template-columns:repeat(auto-fit,minmax(min(100%,135px),1fr));gap:9px;}
.calm-widget-section :is(.dashboard-finance-kpi,.dashboard-health-kpis>div) {background:var(--surface-2);border:1px solid var(--border-soft);border-radius:15px;min-width:0;padding:12px;}
.calm-widget-section :is(.dashboard-finance-kpi b,.dashboard-health-kpis b) {font-size:clamp(18px,2vw,24px);font-variant-numeric:tabular-nums;line-height:1.2;white-space:normal;overflow-wrap:anywhere;}
.calm-widget-section :is(.dashboard-finance-kpi span,.dashboard-finance-kpi small,.dashboard-health-date) {color:var(--muted);white-space:normal;overflow-wrap:anywhere;}
.calm-widget-section :is(.dashboard-finance-kpi b.good,.dashboard-transaction strong.good) {color:var(--gl-income);}
.calm-widget-section :is(.dashboard-finance-kpi b.bad,.dashboard-transaction strong.bad,.dashboard-budget-foot .bad) {color:var(--gl-expense);}
.calm-widget-section .dashboard-transaction-list {border:0;border-radius:12px;overflow:visible;}
.calm-widget-section .dashboard-transaction {min-height:44px;padding:10px 2px;gap:8px;}
.calm-widget-section .dashboard-transaction strong {flex:0 1 auto;max-width:56%;text-align:right;white-space:normal;overflow-wrap:anywhere;}
.calm-widget-section .dashboard-list-row {min-height:44px;}
.calm-widget-section .home-focus-empty {box-shadow:var(--gl-shadow);}
.calm-widget-section :is(button,a):focus-visible,.calm-home button:focus-visible {outline:2px solid var(--gl-focus);outline-offset:-3px;}
/* Keep editor clearance: the pre-existing controls are positioned above the header. */
.calm-widget-section .dashboard-edit-mode .dashboard-widget>.card-head {padding-top:50px;}
/* Four existing navigation destinations, plus one separate capture action.
   The parent keeps its existing ID, safe area, inert state and keyboard motion. */
@media(max-width:900px){
  :root body:not(.auth-mode):not(.public-mode) #mobileBottomNav {
    grid-template-columns:minmax(0,1fr) 56px;gap:9px;align-items:center;
    left:max(10px,env(safe-area-inset-left,0px));right:max(10px,env(safe-area-inset-right,0px));
    max-width:540px;margin-inline:auto;min-height:0;padding:0;
    border:0;border-radius:0;background:transparent;box-shadow:none;
    backdrop-filter:none;-webkit-backdrop-filter:none;
  }
  #mobileBottomNav .mobile-glass-tabs {
    display:grid;grid-template-columns:repeat(4,minmax(0,1fr));align-items:center;gap:2px;
    min-width:0;min-height:62px;padding:5px;border:1px solid var(--border);border-radius:24px;
    background:var(--gl-chrome);box-shadow:var(--gl-dock-shadow);
  }
  #mobileBottomNav .mobile-glass-tabs .mobile-bottom-item {
    min-height:50px;min-width:0;padding:3px 0;gap:4px;border-radius:17px;font-size:10px;
    color:var(--muted);font-weight:640;line-height:1.15;
  }
  #mobileBottomNav .mobile-glass-tabs .mobile-bottom-item svg {width:21px;height:21px;filter:none;}
  #mobileBottomNav .mobile-glass-tabs .mobile-bottom-item.active {
    color:var(--gl-active);background:var(--accent-soft);font-weight:750;
  }
  #mobileBottomNav #mobileQuickAdd {
    position:relative;width:56px;height:56px;min-height:56px;padding:0;border-radius:21px;
    background:#55519a;color:white;border:1px solid var(--gl-edge);box-shadow:var(--gl-dock-shadow);
  }
  @supports (color:color-mix(in srgb,white,black)) {
    #mobileBottomNav #mobileQuickAdd {background:linear-gradient(145deg,color-mix(in srgb,var(--accent) 55%,#29243d),color-mix(in srgb,var(--accent) 45%,#211e30));}
  }
  #mobileBottomNav #mobileQuickAdd .mobile-add-icon {width:100%;height:100%;min-height:0;margin:0;background:none;box-shadow:none;color:inherit;border-radius:inherit;}
  #mobileBottomNav #mobileQuickAdd .mobile-add-icon svg {width:25px;height:25px;}
  #mobileBottomNav #mobileQuickAdd [data-mobile-label="add"] {position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap;}
  #mobileBottomNav .mobile-bottom-item:focus-visible {outline:2px solid var(--gl-focus);outline-offset:-3px;}
  #mobileBottomNav #mobileQuickAdd:focus-visible {outline-color:#fff;}
  body:not(.auth-mode):not(.public-mode) .topbar {backdrop-filter:none;-webkit-backdrop-filter:none;}
  .calm-widget-section .dashboard-widget {border-radius:21px;}
  .calm-widget-section .home-focus-heading strong {font-size:17px;}
  .calm-widget-section .home-focus-actions {gap:5px;}
  .calm-widget-section .home-focus-actions :is(#toggleHomeWidgets,#editHomeWidgets) {padding-inline:6px;}
}
@media(max-width:360px){
  :root body:not(.auth-mode):not(.public-mode) #mobileBottomNav {grid-template-columns:minmax(0,1fr) 50px;gap:6px;}
  #mobileBottomNav #mobileQuickAdd {width:50px;height:50px;min-height:50px;border-radius:18px;}
  #mobileBottomNav .mobile-glass-tabs {padding:4px;gap:1px;}
  #mobileBottomNav .mobile-glass-tabs .mobile-bottom-item {font-size:9px;}
}
@media(prefers-reduced-transparency:reduce),(forced-colors:active){
  :root {--gl-chrome:var(--sidebar);--gl-shadow:none;--gl-dock-shadow:none;}
  body:not(.auth-mode):not(.public-mode) .topbar {backdrop-filter:none;-webkit-backdrop-filter:none;}
}
@media(forced-colors:active){
  #mobileBottomNav #mobileQuickAdd {background:ButtonFace;color:ButtonText;border-color:ButtonText;}
  #mobileBottomNav .mobile-glass-tabs .mobile-bottom-item.active {outline:2px solid Highlight;outline-offset:-3px;}
}
@media(prefers-reduced-motion:reduce){
  #mobileBottomNav,#mobileBottomNav .mobile-bottom-item {transition:none!important;animation:none!important;}
}
