/* Momento dark design system v104. App UI only; the 3D city keeps its own lighting. */
:root[data-theme="dark"]{color-scheme:dark;--bg:#11131d;--bg2:#181b29;--card:#202434;--card2:#282d40;--txt:#f7f4ff;--muted:#bdc1d2;--bd:#3a4055;--bd2:#505971;--hover:#ffffff0a;--overlay:#070913c7;--nav-bg:#202433f5;--chart-grid:#5f657c42;--accent:#ff9b8e;--accent2:#ffc77b;--accent3:#80d5f0;--accent4:#72d8b6;--accent5:#b7a5ff;--pink:#f1a6c9;--shadow:0 18px 48px #00000038;--shadow-sm:0 7px 22px #00000024;--grad1:linear-gradient(135deg,#ef8178,#df9662);--grad2:linear-gradient(135deg,#9b87ed,#67b9dd);--grad3:linear-gradient(135deg,#51bd9a,#5eb4d0);--grad4:linear-gradient(135deg,#df8eb7,#9282e3);font-variant-numeric:tabular-nums}
:root[data-theme="dark"] body{background:radial-gradient(circle at 88% -8%,#31284a 0,transparent 35rem),radial-gradient(circle at 7% 86%,#193a35 0,transparent 34rem),linear-gradient(160deg,#151522,#0f161b 75%);color:var(--txt)}
:root[data-theme="dark"] body:before{opacity:.42;background:radial-gradient(500px circle at 88% 0,#dca0c11a,transparent 60%),radial-gradient(620px circle at 5% 100%,#6fd7bd12,transparent 58%)}
:root[data-theme="dark"] :is(.app,.login-bg){--rx-ink:#f7f4ff;--rx-muted:#bdc1d2;--rx-paper:#202434;--rx-line:#3a4055;--rx-soft:#292e42;--rx-purple:#b9a7ff;--rx-mint:#75d7bb;--rx-rose:#f2a2bd;--rx-shadow:0 13px 36px #0000002b;--m-surface:var(--rx-paper);--m-soft:var(--rx-soft);--m-text:var(--rx-ink);--m-secondary:var(--rx-muted);--m-border:var(--rx-line);--m-brand:var(--rx-purple)}
:root[data-theme="dark"] .app{background:linear-gradient(150deg,#9e86ed0a,transparent 350px);color:var(--txt)}
:root[data-theme="dark"] .app .page{--p-ink:#f7f4ff;--p-muted:#bdc1d2;--p-card:#202434;--p-soft:#292e42;--p-line:#3a4055;--p-accent:#b9a7ff;--p-tint:#342e51;--dark-accent:#b9a7ff;--dark-tint:#332e50;color:var(--p-ink)}
:root[data-theme="dark"] #page-today{--dark-accent:#f3a29a;--dark-tint:#402d39}:root[data-theme="dark"] #page-goals{--dark-accent:#f3b077;--dark-tint:#443329}:root[data-theme="dark"] #page-habits{--dark-accent:#72d8b6;--dark-tint:#243c39}:root[data-theme="dark"] #page-library{--dark-accent:#b9a7ff;--dark-tint:#332e50}:root[data-theme="dark"] #page-progress{--dark-accent:#efa5c8;--dark-tint:#412d3c}:root[data-theme="dark"] #page-health{--dark-accent:#72d8b6;--dark-tint:#243c39}:root[data-theme="dark"] #page-finance{--dark-accent:#80d5f0;--dark-tint:#263a47}:root[data-theme="dark"] #page-fun{--dark-accent:#f3a29a;--dark-tint:#412f39}:root[data-theme="dark"] #page-reports{--dark-accent:#80d5f0;--dark-tint:#29374b}:root[data-theme="dark"] #page-leaderboard{--dark-accent:#ffd081;--dark-tint:#423827}:root[data-theme="dark"] #page-profile{--dark-accent:#c0aeff;--dark-tint:#352f50}
:root[data-theme="dark"] .m-pastel{--p-ink:#f7f4ff;--p-muted:#bdc1d2;--p-card:#202434;--p-soft:#292e42;--p-line:#3a4055;--p-accent:var(--dark-accent,#b9a7ff);--p-tint:var(--dark-tint,#342e51);--p-coral:#432f37;--p-mint:#243d39;--p-blue:#273a48;--p-rose:#412e3e}
:root[data-theme="dark"] .app>header{color:var(--txt)}:root[data-theme="dark"] .app>header:before{background:#171a27ed;border-color:#353b50;box-shadow:0 10px 32px #00000030}:root[data-theme="dark"] .app>header .theme-btn{background:#252a3b!important;border-color:#41485e!important;color:#f7f4ff;box-shadow:0 5px 18px #0002}:root[data-theme="dark"] .app>header .logo{filter:saturate(.92) brightness(1.12)}
:root[data-theme="dark"] .app nav.tabs{background:#202433f5;border-color:#40475c;box-shadow:0 -8px 32px #0000003d}:root[data-theme="dark"] .app nav.tabs button{color:#c0c4d3}:root[data-theme="dark"] .app nav.tabs button.active{color:var(--nav-accent);background:color-mix(in srgb,var(--nav-accent) 18%,#292d3f);box-shadow:inset 0 0 0 1px color-mix(in srgb,var(--nav-accent) 32%,#3b4155)}:root[data-theme="dark"] nav.tabs .tico>.rx-art{filter:brightness(.96) saturate(.92)}
:root[data-theme="dark"] .app .page :is(.card,.m-card,.well-card,.habit-card,.stat,.item,.book-card,.course-card,.goal-center-card),:root[data-theme="dark"] .m-pastel :is(.card,.m-card,.habit-card,.well-card){background:#202434;border-color:#3a4055;color:#f7f4ff;box-shadow:0 12px 34px #00000020}
:root[data-theme="dark"] .app .page :is(.hint-p,.meta,.sub,.lbl,.l,.m-muted,.fin-meta,.rec-meta,.compound-caption,small){color:#bdc1d2}:root[data-theme="dark"] .app .page :is(h1,h2,h3,h4,strong,.name,.n,.val){color:#f8f6ff}
:root[data-theme="dark"] .app .page :is(.module-icon,.m-heading-icon,.m-icon){background:linear-gradient(145deg,#30364b,var(--dark-tint,#342e51));color:var(--dark-accent,#b9a7ff);border:1px solid #424960;box-shadow:inset 0 1px #ffffff0d}
:root[data-theme="dark"] .app .page :is(.badge,.momentum-pill,.core-goal-pill){background:#2c3144;color:#d9d6e6;border-color:#464e65}:root[data-theme="dark"] :is(.page-route-home,.page-route-back){color:#d8d9e4}:root[data-theme="dark"] .page-route-home{background:#24293a;border-color:#3d455b}
:root[data-theme="dark"] .app .page :is(.btn:not(.ghost):not(.danger):not(.red),.m-primary){background:linear-gradient(120deg,#a38cf0,#7d69df);border-color:#ae9af1;color:#fff;box-shadow:0 7px 19px #5945b63d;text-shadow:0 1px 1px #35266c55}
:root[data-theme="dark"] .app .page :is(.ghost,.m-secondary,.icon-action){background:#292e42;border-color:#444c63;color:#f1eff8;box-shadow:none}:root[data-theme="dark"] .app .page :is(.btn,.ghost,.m-primary,.m-secondary,.icon-action):hover:not(:disabled){border-color:color-mix(in srgb,var(--dark-accent,#b9a7ff) 55%,#454d63);filter:brightness(1.08)}
:root[data-theme="dark"] .app .page button:disabled{opacity:.68;color:#d1d3df;background:#34394a;cursor:not-allowed;text-shadow:none}:root[data-theme="dark"] .app .page :is(.danger,.btn.red,.btn.danger){background:#4b2f3a!important;border-color:#744252!important;color:#ffc7d1!important}:root[data-theme="dark"] .app .page :is(.m-link,a:not(.btn)){color:var(--dark-accent,#c0aeff)}
:root[data-theme="dark"] .app .page :is(input:not([type=checkbox]):not([type=range]):not([type=color]):not([type=radio]),select,textarea),:root[data-theme="dark"] :is(.modal,.cal,.timepick,.drawer) :is(input:not([type=checkbox]):not([type=range]):not([type=color]):not([type=radio]),select,textarea){background:#292e42;border-color:#495169;color:#f7f4ff;box-shadow:inset 0 1px #ffffff08}
:root[data-theme="dark"] :is(input,textarea)::placeholder{color:#a5aabb;opacity:1}:root[data-theme="dark"] select option{background:#202434;color:#f7f4ff}:root[data-theme="dark"] label{color:#d8d9e4}:root[data-theme="dark"] :is(button,input,select,textarea,summary,a):focus-visible{outline:3px solid #b9a7ff;outline-offset:3px}
:root[data-theme="dark"] .m-pastel :is(.well-tabs,.finance-tabs,.filters,.seg){background:#252a3c;border-color:#3d455b}:root[data-theme="dark"] .m-pastel :is(.well-tabs,.finance-tabs,.filters,.seg)>button{color:#c2c5d3}:root[data-theme="dark"] .m-pastel :is(.well-tabs,.finance-tabs,.filters,.seg)>button:is(.on,.active){background:var(--dark-tint,#342e51);color:var(--dark-accent,#c0aeff);outline-color:#4a5269;box-shadow:inset 0 0 0 1px color-mix(in srgb,var(--dark-accent,#b9a7ff) 20%,transparent)}
:root[data-theme="dark"] .m-pastel .p-table-scroll{border-color:#3d455b}:root[data-theme="dark"] .m-pastel th{background:var(--dark-tint,#342e51);color:#faf8ff}:root[data-theme="dark"] .m-pastel td{border-color:#373e52;color:#e9e7f0}:root[data-theme="dark"] .m-pastel tbody tr:nth-child(even){background:#252a3a}
:root[data-theme="dark"] :is(.modal,.cal,.timepick,.drawer,.pop){background:#202434;border-color:#444c63;color:#f7f4ff;box-shadow:0 26px 84px #00000080}:root[data-theme="dark"] :is(.modal-bg,.cal-bg,.timepick-bg,.drawer-bg,.pop-bg){background:#070913d1;backdrop-filter:blur(6px)}:root[data-theme="dark"] :is(.datepicker-btn,.optional-fields,.repeat-editor,.series-scope,.reminder-studio){background:#292e42;border-color:#444c63;color:#f4f2fa}
:root[data-theme="dark"] #mobileHome .m-welcome{background:linear-gradient(125deg,#3d2e38,#302c49 55%,#243b39);border-color:#494b61;box-shadow:0 16px 42px #0002}:root[data-theme="dark"] #mobileHome .m-welcome time{background:#252a3a;border-color:#444b61;color:#e1dfeb}
:root[data-theme="dark"] .rx-week{background:#242839;border-color:#41485d;box-shadow:none}:root[data-theme="dark"] .rx-week-head{background:linear-gradient(135deg,#412f37,#342f50)!important;border-color:#51475e!important}:root[data-theme="dark"] .rx-week-head>small{background:#292d3e;color:#e1ddeb;box-shadow:inset 0 0 0 1px #4a5165}:root[data-theme="dark"] .rx-week-head strong i{background:#453b2b;box-shadow:inset 0 0 0 1px #685c39}
:root[data-theme="dark"] .rx-week-day{background:#292e40;border-color:#41485d;color:#c4c7d5}:root[data-theme="dark"] .rx-week-day b{background:#343a4d;color:#e0e2ea;box-shadow:inset 0 0 0 1px #4d556d}:root[data-theme="dark"] .rx-week-day[data-active=true]{background:#243b37;border-color:#3f695f}:root[data-theme="dark"] .rx-week-day[data-active=true] b{background:linear-gradient(145deg,#6bd8b8,#329d83);color:#102b24}:root[data-theme="dark"] .rx-week-day[aria-current=date]{background:#342f4d;border-color:#7568a6;box-shadow:inset 0 0 0 1px #5c527e}
:root[data-theme="dark"] #mobileHome .m-row{background:#252a3a;border-color:#3b4358}:root[data-theme="dark"] #mobileHome .m-time{background:#303548;color:#dfe0e8}:root[data-theme="dark"] #mobileHome .m-check{background:#2c3143;border-color:#4b5369;color:#83dabe}
:root[data-theme="dark"] #page-today.m-pastel #mobileHome .m-head{background:var(--dark-tint,#342e51)}:root[data-theme="dark"] #mobileHome .m-home-plan{--dark-tint:#3d2e39}:root[data-theme="dark"] #mobileHome .m-home-steps{--dark-tint:#44342b}:root[data-theme="dark"] #mobileHome .m-home-habits{--dark-tint:#243d39}:root[data-theme="dark"] #mobileHome .m-home-trend{--dark-tint:#402f42}
:root[data-theme="dark"] .rx-hero{background:linear-gradient(130deg,#263b38,#332f4b);border-color:#444b60}:root[data-theme="dark"] .rx-hero[data-theme=learning]{background:linear-gradient(130deg,#342f50,#3a3136)}:root[data-theme="dark"] .rx-hero[data-theme=goals]{background:linear-gradient(130deg,#443228,#342e50)}:root[data-theme="dark"] .rx-hero[data-theme=progress]{background:linear-gradient(130deg,#29394a,#412f3d)}:root[data-theme="dark"] .rx-art{filter:brightness(.92) saturate(.9)}
:root[data-theme="dark"] :is(.m-meter,.pbar,.budget-bar,.xpbar){background:#3a4054}:root[data-theme="dark"] :is(.finance-insight,.compound-caption,.habit-plan-row,.m-preview,.m-forecast>div){background:color-mix(in srgb,var(--dark-accent,#b9a7ff) 9%,#252a3a);border-color:#41495f}
:root[data-theme="dark"] :is(.finance-kpi,.fin-row,.rec-card,.budget-row,.home-kpi){background:#272c3e;border-color:#3e465c}:root[data-theme="dark"] .finance-kpi.income strong{color:#7ce0bd}:root[data-theme="dark"] .finance-kpi.expense strong{color:#ffaaa0}:root[data-theme="dark"] .book-completion-toggle{background:#292e42;border-color:#454d64}:root[data-theme="dark"] .book-completion-toggle>span:first-child{background:#33394d}
:root[data-theme="dark"] #page-calendar{--cp-line:#3b4359;--cp-accent:#b9a7ff;--cp-soft:#292e40;--cp-surface:#202434;--cp-muted:#bdc1d2;color:#f7f4ff}:root[data-theme="dark"] #page-calendar :is(.time-calendar,.calendar-toolbar,.cp-project,.cp-tools,.cp-project-panel){background:#202434;border-color:#3b4359}:root[data-theme="dark"] #page-calendar :is(.time-day-head,.time-label,.time-corner,.cp-all-day,.cp-all-label){background:#252a3a;border-color:#3a4257;color:#dfe0e8}:root[data-theme="dark"] #page-calendar .time-slot{border-color:#343c50;background-color:#1b1f2d}:root[data-theme="dark"] #page-calendar .cp-event{color:#fff}:root[data-theme="dark"] #page-calendar .calendar-search{background:#282d3f;border-color:#424a60}:root[data-theme="dark"] #page-calendar :is(.cal-view-switch,.calendar-actions)>button{color:#d8d9e3}:root[data-theme="dark"] #page-calendar :is(.cal-view-switch,.calendar-actions)>button.on{background:#3a3357;color:#cbbcff}
:root[data-theme="dark"] .m-pastel .profile-head{background:linear-gradient(130deg,#432f39,#342f50)}:root[data-theme="dark"] .m-pastel .avatar-big{background:#292e42;box-shadow:0 5px 0 #0c0e1655}:root[data-theme="dark"] #mobileThemeSettings .m-account-menu button{background:#292e42;color:#f1eff8;border-color:#444c63}
:root[data-theme="dark"] .plus-hero,:root[data-theme="dark"] .profile-plus-card{background:linear-gradient(135deg,#412f38,#342f50 55%,#243c38)!important;border-color:#4c4b61!important}:root[data-theme="dark"] .plus-status-badge{background:#292e40;color:#f7f4ff;border-color:#4a5269}:root[data-theme="dark"] .plus-benefit,:root[data-theme="dark"] .plus-plan,:root[data-theme="dark"] .gem-item,:root[data-theme="dark"] .gem-pack-grid article{background:#222738;border-color:#3d455b;color:#f7f4ff}:root[data-theme="dark"] .plus-gift{background:linear-gradient(135deg,#423725,#342e4c)}:root[data-theme="dark"] .gift-options button{background:#2a2e40;color:#f7f4ff;border-color:#474f66}:root[data-theme="dark"] .gift-options .selected{background:#244038;color:#9ce5cb;border-color:#49806f}:root[data-theme="dark"] .gem-discount{background:#244038;color:#a0e8cf}:root[data-theme="dark"] .gem-debt{background:#4a3038;color:#ffc8d0}
:root[data-theme="dark"] .login-bg{background:radial-gradient(circle at 15% 10%,#392f55,transparent 38rem),radial-gradient(circle at 90% 90%,#3e2b35,transparent 35rem),#11131d}:root[data-theme="dark"] .login-card{background:#202434;border-color:#40485e;box-shadow:0 28px 92px #00000073}:root[data-theme="dark"] .login-card .auth-tabs{background:#292e42;border-color:#41495f}:root[data-theme="dark"] .login-card .auth-tabs button{color:#c3c6d4}:root[data-theme="dark"] .login-card :is(.auth-tabs button.on,button#loginBtn){background:linear-gradient(120deg,#a58ff0,#7864dc);color:#fff}
:root[data-theme="dark"] :is(.m-error,.error,.toast){color:#ffd7dd}:root[data-theme="dark"] ::selection{background:#806bd8;color:#fff}:root[data-theme="dark"] ::-webkit-scrollbar-thumb{background:#505a72}:root[data-theme="dark"] ::-webkit-scrollbar-track{background:#171a26}
@media(prefers-contrast:more){:root[data-theme="dark"]{--muted:#d0d3df;--bd:#535d76;--bd2:#6b7691}:root[data-theme="dark"] :is(.app,.login-bg){--rx-muted:#d0d3df;--rx-line:#555f78}}

/* Dynamic components are sometimes rebuilt after a light-theme render. These
   explicit surfaces prevent stale light variables from leaking into dark UI. */
:root[data-theme="dark"] .m-pastel :is(.item,.wish-item,.goal,.stat,.book-card,.course-card){background:#292e42!important;border-color:#41495f!important;color:#f7f4ff!important}
:root[data-theme="dark"] .m-pastel :is(.item,.wish-item,.goal,.stat,.book-card,.course-card) :is(.name,strong,.n){color:#f7f4ff!important}
:root[data-theme="dark"] .m-pastel :is(.item,.wish-item,.goal,.stat,.book-card,.course-card) :is(.meta,small,.l,.pbar-lbl){color:#bdc1d2!important}
:root[data-theme="dark"] #mobileHome :is(.m-secondary,.m-utilities button){background:#292e42!important;border-color:#444c63!important;color:#e9e7f1!important}
:root[data-theme="dark"] #mobileHome .m-step .m-secondary{background:color-mix(in srgb,var(--domain) 14%,#292e42)!important;border-color:color-mix(in srgb,var(--domain) 38%,#444c63)!important;color:color-mix(in srgb,var(--domain) 72%,#fff)!important}
:root[data-theme="dark"] #mobileHome .m-step .m-secondary:disabled{background:#34394a!important;border-color:#484f64!important;color:#d4d6e1!important;opacity:.72}
:root[data-theme="dark"] #mobileHome .m-utilities i{color:#b9a7ff!important}
:root[data-theme="dark"] #page-library :is(.library-tools input,.library-tools select){background:#292e42!important;color:#f7f4ff!important;border-color:#495169!important}
:root[data-theme="dark"] #page-library .item{background:#292e42!important;border-color:#41495f!important;color:#f7f4ff!important}:root[data-theme="dark"] #page-library .item :is(.name,strong){color:#f7f4ff!important}:root[data-theme="dark"] #page-library .item :is(.meta,small,.pbar-lbl){color:#bdc1d2!important}
:root[data-theme="dark"] #page-library .book-cover{background:linear-gradient(145deg,#343a4d,#252a3a);border-color:#495169}
:root[data-theme="dark"] #page-library .badge.reading{background:#353149;color:#d6caff;border-color:#574c76}
:root[data-theme="dark"] #page-calendar :is(.calendar-nav button,.cal-view-switch button,.calendar-actions button){background:#292e42;color:#e8e7ef;border-color:#444c63}
:root[data-theme="dark"] #page-calendar :is(.calendar-nav button,.cal-view-switch button,.calendar-actions button):disabled{background:#34394a;color:#d6d8e2;opacity:.72}
:root[data-theme="dark"] #page-calendar :is(.calendar-nav button,.cal-view-switch button,.calendar-actions button).on{background:#3a3357;color:#d5caff;border-color:#65598a}
:root[data-theme="dark"] .m-pastel .filters>button:not(.on),:root[data-theme="dark"] .m-pastel .seg>button:not(.on){color:#c5c8d5!important;background:transparent!important}
