/* UI-M4. Three explicit contexts: image palettes, dark tools, white carrier.
   Foreground/background pairs are owned by the same surface. Screen only. */
@media screen {
html[data-l98-theme="photo"]{color-scheme:light;--m4-photo-a:#ebe7e2;--m4-photo-b:#dcd5cc;--m4-photo-panel:#fbfaf8;--m4-photo-soft:#f3efea;--m4-photo-line:#a2a5a3;--text:#1d2d33;--ink:#1d2d33;--muted:#485a61;--panel:var(--m4-photo-panel);--card:var(--m4-photo-panel);--line:#a2a5a3;--soft:var(--m4-photo-soft);--soft2:var(--m4-photo-panel);background:var(--m4-photo-a)}
html[data-l98-theme="photo"] body{background:linear-gradient(145deg,var(--m4-photo-a),var(--m4-photo-b)) fixed!important;color:#1d2d33!important;--panel:var(--m4-photo-panel);--soft:var(--m4-photo-soft);--soft2:var(--m4-photo-panel);--muted:#485a61;--line:#a2a5a3;min-height:100dvh}
html[data-l98-theme="photo"] body.l98-clean-post :is(.page>.card,#editForm>.card,#postSwipeZone>.card,#l98EditVisual,.l98-clean-details,.fb-compose,.l98-clean-publish){background:var(--m4-photo-panel)!important;color:#1d2d33!important;border-color:var(--m4-photo-line)!important}
html[data-l98-theme="photo"] body.l98-clean-post :is(.hero-title,.hero-title-input,.title,.l98-clean-details summary,.label,.ai-tone,.ai-title,.ai-content){color:#1d2d33!important}
html[data-l98-theme="photo"] body.l98-clean-post :is(.hero-sub,.hero-title small,.note,.ai-msg,.ai-snippet,.l98-clean-details-body,.l98-memory-help,.location-hint,.l98-thumb-status){color:#485a61!important}
html[data-l98-theme="photo"] body.l98-clean-post .page>.hero-sub{color:#1d2d33!important}
html[data-l98-theme="photo"] body.l98-clean-post :is(input:not([type=checkbox]):not([type=radio]):not([type=hidden]),textarea,select){color:#1d2d33!important;background:#fff!important;border-color:#9aabb1!important;caret-color:#1d2d33}
html[data-l98-theme="photo"] body.l98-clean-post :is(input,textarea)::placeholder{color:#53666e!important;opacity:1}
html[data-l98-theme="photo"] body.l98-clean-post :is(.meta-pill,.action-btn,.tool-icon-btn,.btn,.fb-tool-btn,.fb-privacy-pill,.l98-memory-bubble){background:var(--m4-photo-soft)!important;color:#263e47!important;border-color:#a2a5a3!important}
html[data-l98-theme="photo"] body.l98-clean-post :is(.btn-main,.btn-green,.action-btn.primary){background:#245e50!important;color:#fff!important}
html[data-l98-theme="photo"] body.l98-clean-post :is(.btn-danger,.action-btn.danger){background:#fbe8e4!important;color:#8a2925!important}
html[data-l98-theme="photo"] body.l98-clean-post :is(.main-image,#l98EditVisual .l98-edit-stage){background:linear-gradient(135deg,var(--m4-photo-a),var(--m4-photo-b))!important}
html[data-l98-theme="photo"] body.l98-clean-post .main-image img{background:transparent!important}
html[data-l98-theme="photo"] body.l98-social-m6 #pinboard :is(.pin-item,.pin-link){background:var(--m4-photo-panel)!important;color:#1d2d33!important}
html[data-l98-theme="photo"] body.l98-social-m6 #pinboard .pin-media:not(.is-deep-locked){background:linear-gradient(135deg,var(--m4-photo-a),var(--m4-photo-b))!important}
html[data-l98-theme="photo"] body.l98-social-m6 #pinboard .pin-info{background:var(--m4-photo-panel)!important;color:#1d2d33!important}
html[data-l98-theme="photo"] body.l98-social-m6 #pinboard .pin-info :is(.pin-title,.pin-date,.pin-snippet,.pin-location,.pin-comment-preview){color:#30454d!important}
/* The existing account strip has light text: give the entire strip its dark surface. */
html[data-l98-theme="photo"] body #l98LifeClock{background:#17262b!important;color:#e7eeef!important;border-color:#47626b!important;--h1-ink:#e7eeef;--h1-line:#49626c}
html[data-l98-theme="photo"] body #l98LifeClock :is(.h1-clock-face,.h1-btn){color:#e7eeef!important}
html[data-l98-theme="photo"] body #l98LifeClock :is(.h1-clock-date,.h1-clock-face small){color:#b6c5ca!important}
html[data-l98-theme="photo"] body #l98LifeClock .h1-btn{background:#253b43!important;border-color:#49626c!important}
html[data-l98-theme="photo"] body :is(.h1-dialog,.h1-surface){color:#20332f}
html[data-l98-theme="photo"] body .h1-dialog :is(.h1-subtle,.h1-empty,.h1-choice>span:last-child,.h1-dialog-kicker,.h1-week,.h1-legend,.h1-daytitle span,.h1-wheel-label,.h1-wheel button,.h1-record time,.h1-record p){color:#4c6258}
html[data-l98-theme="photo"] body .h1-dialog .h1-wheel button[aria-selected=true]{color:#1b634d}

/* Shared dark surfaces omitted by the previous blanket heading rules. */
html[data-l98-theme="dark"] body :is(.hero,.box,.modal,.modal-head,.modal-body,.editor-panel,.editor-toolbar,.submit-panel,.alert,.info-card,.form-card,.stat-card,.summary-card,.bubble-panel,.map-top-chip,.foot-bottom,.foot-card,.help-line,.help-last,.help-task-grid>a,.l98-expense-view-post){background:#172127!important;color:#e7eeef!important;border-color:#455963!important}
html[data-l98-theme="dark"] body :is(.modal-head,.bubble-head,.foot-card-head,.summary .sum,.help-line){background:#202e34!important;color:#e7eeef!important}
html[data-l98-theme="dark"] body :is(.map-top-chip,.bubble-title,.foot-card-title,.foot-title,.detail-label,.hero h1,.box h1,.modal h1,.modal h2,.modal h3,.submit-title,.help-line h2,.help-last h2){color:#e7eeef!important}
html[data-l98-theme="dark"] body :is(.bubble-sub,.bubble-desc,.bubble-meta,.foot-sub,.foot-card-sub,.source-note,.ocr-note,.detail-label,.cell-muted,.help-line p,.help-hero .eyebrow,.help-start .eyebrow,.section-head .eyebrow,.hero p,.submit-sub,.help-faq p){color:#b6c5ca!important}
html[data-l98-theme="dark"] body :is(.iconbtn,.close-btn,.small-btn,.pdfbtn,.add-toggle,.bubble-close,.mini-fab,.l98-expense-view-post){background:#2a3e47!important;color:#e7eeef!important;border-color:#526b76!important}
html[data-l98-theme="dark"] body :is(.iconbtn.danger,.small-btn.danger,.alert-err){background:#382428!important;color:#ffc7bd!important;border-color:#87524e!important}
html[data-l98-theme="dark"] body :is(.alert-ok,.small-btn.primary){background:#315b4c!important;color:#e7f6ec!important;border-color:#81b79a!important}
html[data-l98-theme="dark"] body :is(.detail-card,.expense-row-detail,.add-row,.sum,.foot-card,.foot-bottom){background:#172127!important;color:#e7eeef!important;border-color:#455963!important}
html[data-l98-theme="dark"] body :is(.help-hero h1 em,.task-link,.step-number,.step-plus,.help-line .eyebrow){color:#a6d5bd!important}
html[data-l98-theme="dark"] body .help-line .primary{background:#315b4c!important;color:#e7f6ec!important}
html[data-l98-theme="dark"] body[data-page="footprints"] :is(.bubble-count,.route-badge,.foot-card-count){background:#b9650b!important;color:#fff!important}
html[data-l98-theme="dark"] body[data-page="footprints"] .map-top-chip small{color:#b6c5ca!important}
html[data-l98-theme="dark"] body :is(input,textarea,select,button,a,summary):focus-visible{outline:3px solid #b2dbc9;outline-offset:2px}

/* An expense popup owns its header; it must not shrink out of the flex viewport. */
html[data-l98-page="expense_list"] .modal-head{flex:0 0 auto;min-height:68px;height:auto;gap:10px;z-index:10}
html[data-l98-page="expense_list"] .modal-body{flex:1 1 auto;min-height:0;overscroll-behavior:contain}
html[data-l98-page="expense_list"] .m4-expense-home{display:inline-flex;align-items:center;gap:10px;min-height:44px;text-decoration:none;color:#e7eeef;min-width:0;font-size:15px;font-weight:750}
html[data-l98-page="expense_list"] .m4-expense-home img{width:118px;height:44px;object-fit:contain;flex:none}
html[data-l98-page="expense_list"] .close-btn{min-height:44px;flex:none}
html[data-l98-page="expense_list"] .iconbtn{min-width:36px}
@media(max-width:380px){html[data-l98-page="expense_list"] .modal-head{padding:10px}.m4-expense-home{gap:5px!important}.m4-expense-home img{width:90px!important}.m4-expense-home span{font-size:13px}.close-btn{padding:10px!important}}

/* Carrier is deliberately white, including the surrounding quiet area. */
html[data-l98-theme="dark"] body :is(.l98-topbar,.l98-note,.l98-warning,.lv-playlist-row,.lv-upload-panel,.lv-replace-content,.hero .privacy,.share-tease-hint,#voiceInfo,#result){background:#172127!important;color:#e7eeef!important;border-color:#455963!important}
html[data-l98-theme="dark"] body :is(.l98-policy-card p,.l98-policy-card li,.l98-policy-card h3,.l98-policy-card strong,.l98-policy-card a,.lv-upload-panel p,.lv-replace-content p){color:#c4d2d5!important}
html[data-l98-theme="dark"] body :is(.l98-toc a,.lv-secondary){background:#29443e!important;color:#daf0e3!important;border-color:#6f9c87!important}
html[data-l98-theme="dark"] body .lv-error{background:#382428!important;color:#ffc7bd!important}
html[data-l98-theme="dark"] body .lv-error p{color:#ffc7bd!important}
html[data-l98-theme="dark"] body :is(.video-bridge-note,.l98-radar-label,.card>p.note,.card>div.note){color:#b6c5ca!important}
html[data-l98-theme="dark"] body :is(.req,.small>.danger){color:#ffc7bd!important}
html[data-l98-theme="dark"] body :is(#viewerPrev,#viewerNext){background:#183b47!important;color:#fff!important}
html[data-l98-theme="dark"] body :is(#btnAuthorFriend,#liveTranslateBtn,#sendBtn,.post-fixed-actions>button,.cta){background:#e9bd7e!important;color:#292116!important}
html[data-l98-theme="dark"] body :is(.locked-cover,.l98-deep-lock-hero){background:linear-gradient(135deg,#251a13,#5b3e23)!important;color:#fff4dc!important}
html[data-l98-theme="photo"] body .l98-deep-lock-hero{background:linear-gradient(135deg,#251a13,#5b3e23)!important;color:#fff4dc!important}
html[data-l98-theme="photo"] body .l98-deep-lock-hero em{color:#efdfc5!important}
html[data-l98-theme="dark"][data-l98-page="calendar"] #btnToggleVideoInput{background:#253b43!important;color:#e7eeef!important}
html[data-l98-theme="dark"][data-l98-page="calendar"] #btnToggleVideoInput span{color:#e7eeef!important}
html[data-l98-theme="dark"][data-l98-page="expense_analysis"] .modal-head{background:#202e34!important;color:#e7eeef!important;flex:none}
html[data-l98-theme="dark"] body .container.footer-inner :is(div,strong,span,a){color:#c4d2d5!important}
html[data-l98-theme="dark"] body #navMenu>a{color:#c4d2d5!important;background:#253b43!important}
html[data-l98-theme="dark"] body #navToggle{background:#253b43!important;color:#e7eeef!important;border-color:#526b76!important}
html[data-l98-theme="dark"][data-l98-page="landing"] :is(.hero-content,.hero-copy,.trust-ico){background:#172127!important;color:#e7eeef!important}
html[data-l98-theme="dark"][data-l98-page="landing"] :is(.hero-content .eyebrow,.hero-content li,.hero-copy li){color:#b6c5ca!important}
html[data-l98-theme="dark"] body .lv-button:not(.lv-secondary){background:#315b4c!important;color:#e7f6ec!important}
html[data-l98-theme="dark"][data-l98-page="service_policy"] :is(.card p,.card li,.card a){color:#c4d2d5!important}
html[data-l98-theme="dark"][data-l98-page="login"] :is(.splash-sub,.policy-links a){color:#b6c5ca!important}
html[data-l98-theme="dark"][data-l98-page="ai_voice_settings"] .top>p{color:#b6c5ca!important}
html[data-l98-theme="dark"][data-l98-page="ai_voice_server_test"] :is(.card>p,.card>p b){color:#b6c5ca!important}
html[data-l98-theme="dark"][data-l98-page="ai_voice_server_test"] #btnSave{background:#315b4c!important;color:#e7f6ec!important}
html[data-l98-theme="dark"][data-l98-page="avatar_rebuild_v2"] :is(.card>p,.row>label){color:#b6c5ca!important}
html[data-l98-theme="dark"][data-l98-page="avatar_rebuild_v2"] form>button{background:#315b4c!important;color:#e7f6ec!important}
html[data-l98-theme="dark"][data-l98-page="fast_blood_pressure_ocr_demo"] :is(#confirm,#manual,#cancel){background:#315b4c!important;color:#e7f6ec!important}
html[data-l98-theme="dark"][data-l98-page="admin_broadcast"] .notice.err .debug{background:#382428!important;color:#ffc7bd!important}
html[data-l98-theme="dark"][data-l98-page="line_open"] .card .logo{background:#315b4c!important;color:#e7f6ec!important}
html[data-l98-theme="dark"][data-l98-page="security_risk_users"] p>a{color:#b8e2d6!important}
html[data-l98-theme="dark"][data-l98-page="vapid_generate"] form>button,
html[data-l98-theme="dark"][data-l98-page="promo_codes"] p>button,
html[data-l98-theme="dark"][data-l98-page="push_vapid_generate"] .row>button,
html[data-l98-theme="dark"][data-l98-page="push_generate_keys"] .row>button{background:#315b4c!important;color:#e7f6ec!important}
/* Matched surface families from the complete route/template inventory. */
html[data-l98-theme="dark"] body :is(.empty-box,.empty-state,.empty-add-card,.share-tease-head,.share-tease-body,.video-bridge,.video-bridge-body,.sheet-head,.sheet-body,.modalbox,.photo-box,.voice-box,.trust-item,.closing-card,.hero-content,.metric,.chip,.status-panel,.log-item,.lv-current,.lv-playlist-item,.lv-upload,.lv-upload-card,.lv-card,.lv-existing-picker,.l98-legal-section,.l98-policy-card,.l98-toc){background:#172127!important;color:#e7eeef!important;border-color:#455963!important}
html[data-l98-theme="dark"] body :is(.video-bridge-title,.sheet-title,.share-tease-title,.metric .num,.danger-title){color:#e7eeef!important}
html[data-l98-theme="dark"] body :is(.msg,.small-note,.danger-text,.text,.fine-print,.privacy,.lv-wrap p,.lv-kicker,.lv-library-head span,.lv-hint,.lv-cleanup summary,.voice-box .hint,.share-tease-hint,.item-text,.alert-form .checkline){color:#b6c5ca!important}
html[data-l98-theme="dark"] body :is(.lv-wrap a,.privacy a,.card>a.link){color:#b8e2d6!important}
html[data-l98-theme="dark"] body :is(.action-btn,.location-btn,.primary,.empty-add-action,.today-badge,.video-bridge-pill,#btnQuickAddImages,#floatingCreateBtn,#btnSendFinal){background:#e9bd7e!important;color:#292116!important;border-color:#e9bd7e!important}
html[data-l98-theme="dark"] body :is(.item-actions .action-btn,.weekday,.manual-toggle,.manual-wrap,#alertCreateToggle){background:#253b43!important;color:#e7eeef!important;border-color:#49626c!important}
html[data-l98-theme="dark"] body :is(.weekday.weekend,.holiday-pill){background:#382428!important;color:#ffc7bd!important}
html[data-l98-theme="dark"] body :is(.editable-title-label,.item-title[contenteditable],#videoInputNote){background:#172127!important;color:#e7eeef!important;border-color:#61747e!important}
html[data-l98-theme="dark"] body :is(#videoInputToggleIcon,.empty-add-text,#alertCreateToggle small,.locked-cover-sub){color:#e7eeef!important}
html[data-l98-theme="dark"] body .f2-button.f2-line{background:#06c755!important;color:#083d20!important}
html[data-l98-theme="dark"][data-l98-page="help"] :is(#helpClose,.task-icon){background:#253b43!important;color:#cce8db!important}
html[data-l98-theme="dark"][data-l98-page="help"] .preview-curtain{background:linear-gradient(135deg,#355448,#203b31)!important}
html[data-l98-theme="dark"][data-l98-page="help"] .preview-tiles span{background:linear-gradient(150deg,#40575c,#273e45)!important;color:#fff!important}
html[data-l98-theme="dark"][data-l98-page="help"] .preview-tiles span:nth-child(2){background:linear-gradient(150deg,#715936,#45372a)!important}
html[data-l98-theme="dark"][data-l98-page="help"] .preview-tiles span:nth-child(3){background:linear-gradient(150deg,#3f6553,#243f32)!important}
html[data-l98-theme="photo"] body :is(#titleCounter,.l98-video-share-hint,.l98-memory-bubble small){color:#485a61!important}
html[data-l98-theme="photo"] body :is(.video-bridge-pill,.location-btn,#btnVoiceCompose,#btnQuickAddImages,#btnSaveLocationMemory,#favoriteAiNoteSaveBtn,#btnSendComment,.l98-edit-add){background:#245e50!important;color:#fff!important}
html[data-l98-theme="photo"] body :is(#viewerPrev,#viewerNext){background:#183b47!important;color:#fff!important}
html[data-l98-theme="photo"] body #mainImageWrap>div:not(.l98-deep-lock-hero){color:#1d2d33!important}
html[data-l98-theme="photo"] body .favorite-ai-memory-card>div{color:#485a61!important}
html[data-l98-theme="photo"] body .media-actions>.mini-pill{background:var(--m4-photo-soft)!important;color:#263e47!important}
html[data-l98-page="footprints"] :is(.foot-card-num,.route-marker,.search-target-pin){background:#185f9e!important;color:#fff!important}
html[data-l98-theme="dark"] body :is(.card>div.note,.hero-panel,.hero-content .eyebrow,#l98FlashWarningModal>div){background:#202e34!important;color:#c4d2d5!important;border-color:#455963!important}
html[data-l98-theme="dark"] body #l98FlashWarningModal>div>div{color:#e7eeef!important}
html[data-l98-theme="dark"][data-l98-page="guest_ai_intro"] :is(nav>a,nav>a.brand,nav>a.brand>b,section>a){color:#b8e2d6!important}
html[data-l98-theme="dark"][data-l98-page="guest_ai_intro"] section>small{color:#c4d2d5!important}
html[data-l98-theme="dark"][data-l98-page="parking_memory"] body #radarBox .l98-radar-label{color:#30454d!important}
html[data-l98-theme="dark"] body #mainImageWrap>div:not(.l98-deep-lock-hero){color:#30454d!important}
html[data-l98-theme="dark"][data-l98-page="expense_analysis"] .head{background:#202e34!important;color:#e7eeef!important;flex:none}
html[data-l98-theme="dark"][data-l98-page="demo"] .h3-demo-scene :is(small,p){color:#e7eeef!important}
html[data-l98-theme="dark"][data-l98-page="demo"] .h3-demo-tile small{background:#17262b!important;color:#fff!important;border-radius:8px;padding:4px 8px}
html[data-l98-theme="photo"][data-l98-page="post_view"] span[style*="color:#9a6618;background:#fff1d8"]{color:#805012!important}
html[data-l98-theme="dark"][data-l98-page="loading"] .brand-logo{background:#315b4c!important;color:#fff!important}
html[data-l98-theme="dark"][data-l98-page="login_videos"] details>summary{color:#c4d2d5!important}
html[data-l98-theme="dark"][data-l98-page="login_videos"] :is(.lv-replace,.lv-add-more)>summary{background:#253b43!important;color:#e7eeef!important}
html[data-l98-theme="dark"][data-l98-page="login"] .card>p{color:#c4d2d5!important}
html[data-l98-theme="dark"][data-l98-page="login"] a[style*="background:#d97706"]{background:#e9bd7e!important;color:#292116!important}
html[data-l98-theme="paper"],html[data-l98-theme="paper"] body{color-scheme:light!important;background:#fff!important;color:#111!important;--text:#111;--ink:#111;--muted:#444;--panel:#fff;--bg:#fff}
html[data-l98-page="carrier_pass"] :is(.page,.topbar,.barcode,#barcode){background:#fff!important;color:#111!important;filter:none!important;mix-blend-mode:normal!important}
html[data-l98-page="carrier_pass"] .page{padding:90px 16px 32px;min-height:100dvh;height:auto;box-sizing:border-box}
html[data-l98-page="carrier_pass"] .topbar{z-index:2;align-items:center;gap:12px;min-height:60px;box-sizing:border-box}
html[data-l98-page="carrier_pass"] .barcode{max-width:100%;height:auto;display:block}
html[data-l98-page="carrier_pass"] .close{background:#17262b!important;color:white!important;min-height:44px}
html[data-l98-page="carrier_pass"] :is(.name,.code){color:#111!important}
@media(prefers-reduced-motion:reduce){html[data-l98-theme="photo"] body{transition:none!important}}
}
