/* iPhone appearance is the single source for every application surface. */
:root{--fh-app-bg:#F5F6F8;--fh-app-surface:#fff;--fh-app-text:#08090F;--fh-app-muted:#5C6380;--fh-app-link:#2457FF;--fh-app-selected:#E9EEFF;--fh-app-accent:#2457FF;--fh-app-on-accent:#fff;--fh-app-grid:#D9DBEA}
html[data-blue-theme=light]{color-scheme:light}
html[data-blue-theme=dark]{color-scheme:dark;--fh-app-bg:#080D28;--fh-app-surface:#10183A;--fh-app-text:#F5F6FA;--fh-app-muted:#B7C0DF;--fh-app-link:#B7C9FF;--fh-app-selected:#1D2B54;--fh-app-grid:#344264;--fh-attention-bg:#302718;--fh-attention-ink:#FFE0A3;--fh-attention-line:#8D7138;--fh-critical-bg:#361E32;--fh-critical-ink:#FFC3CE;--fh-critical-line:#AD657E}
html[data-appearance],html[data-appearance] body,html[data-appearance] .fh-app,#blue-root,body.fh-booting{background:var(--fh-app-bg);color:var(--fh-app-text)}
#fhSplash,html[data-blue-theme=dark] #fhSplash{--film-paper:var(--fh-app-bg)}
#fhFirstRun,#fhFirstRun header,#fhFirstRun footer,#fhFirstRun main.fh-step-outgoing,#fhDemoPreview,#fhLaunchError{background:var(--fh-app-bg);color:var(--fh-app-text)}
#fhFirstProgress,#fhFirstHint,#fhFirstCountryContext,#fhDemoPreview p{color:var(--fh-app-muted)}
#fhFirstRun .fh-first-choice,#fhFirstRun input,#fhFirstRun input[type=search]{background:var(--fh-app-surface);color:var(--fh-app-text);border-color:var(--fh-border)}
#fhFirstRun .fh-first-choice[aria-pressed=true]{background:var(--fh-app-selected);border-color:var(--fh-app-link)}
#fhFirstBack,#fhFirstCustom,#fhFirstRun .fh-first-choice[aria-pressed=true]::after{color:var(--fh-app-link)}
#fhFirstDots i{background:var(--fh-border)}#fhFirstDots .is-complete{background:#2457FF}
#fhDemoPreview button{background:var(--fh-app-surface);color:var(--fh-app-text);border-color:var(--fh-border)}
#fhDemoPreview .fh-demo-tabs [aria-pressed=true]{color:#fff}
.fh-sp-root{--fh-sp-bg:var(--fh-app-bg);--fh-sp-panel:var(--fh-app-surface);--fh-sp-text:var(--fh-app-text);--fh-sp-muted:var(--fh-app-muted)}
.fh-sp-project{background:var(--fh-app-surface);border-color:var(--fh-border)}
.fh-brand-lockup,.fh-sp-icon-button{color:var(--fh-app-text)}
.fh-sp-device,.fh-sp-eyebrow,.fh-sp-live,.fh-sp-area small,.fh-sp-project-sub,.fh-sp-count,.fh-space-context,.fh-space-actions{color:var(--fh-app-muted)}
.fh-sp-intro h1 span,.fh-space-context button,.fh-space-actions .fh-onboard-import{color:var(--fh-app-link)}
/* Before the bridge starts, native and HTML paint the same system background. */
@media(prefers-color-scheme:dark){html:not([data-blue-theme]){--fh-app-bg:#080D28;--fh-app-text:#F5F6FA}}

/* Legacy screens use --fh-white as both a surface and a foreground. Keep
   foregrounds on filled buttons/brand panels separate from adaptive surfaces. */
.fh-btn--primary,.fh-chip[aria-pressed=true]{background:var(--fh-app-accent);border-color:var(--fh-app-accent);color:var(--fh-app-on-accent)}
.fh-card--dark,.fh-screen--dark,.fh-btn--ghost-dark{color:#F5F6FA}
.fh-card--dark .fh-p,.fh-screen--dark .fh-p{color:#B7C9FF}
.fh-devbar{background:#08090F;color:#fff}.fh-devbar button{color:#fff}
.fh-canvas-toolbar button,.fh-add-row button,.fh-chip{color:var(--fh-app-text)}
.fh-canvas-toolbar button[aria-pressed=true],.fh-chip[aria-pressed=true]{background:var(--fh-app-accent);color:var(--fh-app-on-accent);border-color:var(--fh-app-accent)}
#fhApp input:not([type=checkbox]):not([type=radio]):not([type=file]),#fhApp select,#fhApp textarea{background:var(--fh-app-surface);color:var(--fh-app-text);border-color:var(--fh-border)}
#fhApp .muted,#fhApp input::placeholder{color:var(--fh-app-muted);opacity:1}
#fhApp a:hover{color:var(--fh-app-link)}
.fh-option,.fh-line,.fh-passport,details.fh-details{border-color:var(--fh-hairline)}
.fh-note--unknown,.fh-badge--unknown{border-color:var(--fh-border)}

/* Creation sheets and secondary controls update without closing the screen. */
#fhCreateSheet .fh-sp-sheet{background:var(--fh-app-bg);color:var(--fh-app-text)}
#fhCreateSheet .fh-sp-sheet-title{color:var(--fh-app-text)}
#fhCreateSheet .fh-sp-eyebrow,#fhCreateSheet .fh-sp-field-label,#fhCreateSheet .fh-sp-sheet-description,#fhCreateSheet .fh-sp-note,.fh-onboard-note,.fh-onboard-store small{color:var(--fh-app-muted)}
#fhCreateSheet .fh-sp-input,.fh-onboard-setting,.fh-onboard-store{background:var(--fh-app-surface);color:var(--fh-app-text);border-color:var(--fh-border)}
#fhCreateSheet .fh-sp-input::placeholder{color:var(--fh-app-muted);opacity:1}
#fhCreateSheet .fh-sp-primary{background:var(--fh-app-accent);color:var(--fh-app-on-accent)}
#fhCreateSheet .fh-sp-icon-button,.fh-onboard-cities button,.fh-onboard-back{background:var(--fh-app-selected);color:var(--fh-app-link)}
.fh-onboard-setting span,.fh-onboard-import{color:var(--fh-app-link)}
.fh-room-swipe .fh-sp-room{background:var(--fh-app-bg);color:var(--fh-app-text)}
.fh-sp-room-value{color:var(--fh-app-text)}.fh-swipe-hint,#fhRoomListStatus{color:var(--fh-app-muted)}
#fhFirstError{color:var(--fh-critical-ink)}
#fhFirstRun input::placeholder{color:var(--fh-app-muted);opacity:1}

/* Review panels had fixed white surfaces but inherited dark-theme text. */
.fh-capture-review .fh-review-steps,.fh-capture-review .fh-plan-controls,.fh-capture-review .fh-opening-list>div>p,.fh-survey-3d{background:var(--fh-app-surface);color:var(--fh-app-text);border-color:var(--fh-border)}
.fh-capture-review .fh-review-steps li,.fh-review-draft,.fh-review-summary,.fh-review-scroll #fhReviewPlan>.muted{color:var(--fh-app-muted);border-color:var(--fh-border)}
.fh-review-steps span{background:var(--fh-app-selected)}
.fh-review-steps .active,.fh-review-steps .done{color:var(--fh-app-link)}
.fh-review-steps .active span{background:var(--fh-app-accent);color:var(--fh-app-on-accent)}
.fh-review-steps .done span{background:var(--fh-app-selected);color:var(--fh-app-link)}
.fh-capture-review .fh-review-history button,.fh-capture-review .fh-review-secondary button,.fh-capture-review .fh-opening-list button,.fh-service-evidence button{color:var(--fh-app-link)}
.fh-capture-review .fh-capture-message{background:var(--fh-attention-bg);color:var(--fh-attention-ink)}
.fh-capture-review input::placeholder,.fh-capture-review textarea::placeholder{color:var(--fh-app-muted);opacity:1}
.fh-capture-review .fh-survey-table th,.fh-capture-review .fh-survey-table td,.fh-service-evidence{border-color:var(--fh-border)}
.fh-capture-review .primary,html[data-blue-theme=dark] .fh-capture-review .primary{background:var(--fh-app-accent);color:var(--fh-app-on-accent)}
#fhSurveyAnalyze:disabled{background:var(--fh-app-bg);color:var(--fh-app-muted)}
.fh-height-illustration{background:var(--fh-app-selected);border-color:var(--fh-border);color:var(--fh-app-link)}
.fh-empty-icon{background:var(--fh-app-selected);color:var(--fh-app-link)}
.fh-review-empty p{color:var(--fh-app-muted)}
.fh-capture-plan{background-color:var(--fh-app-surface);background-image:radial-gradient(var(--fh-app-grid) 1px,transparent 1px)}
.fh-capture-plan text{fill:var(--fh-app-text);stroke:var(--fh-app-surface)}
.fh-capture-plan [stroke=white]{stroke:var(--fh-app-surface)}
.fh-capture-plan [stroke="#1957f5"],.fh-capture-plan [stroke="#5146a3"]{stroke:var(--fh-app-link)}
.fh-capture-plan [fill="#1957f5"],.fh-capture-plan [fill="#5146a3"]{fill:var(--fh-app-link)}
html[data-blue-theme=dark] .fh-capture-plan [stroke="#087f9c"]{stroke:#65D2F0}
html[data-blue-theme=dark] .fh-capture-plan [stroke="#a76013"]{stroke:#FFBE6E}

/* Reading mode is an app surface; the separate .a4.doc print page stays paper. */
#blue-root .rd-plan-in{background:var(--surface);color:var(--text)}
.leaflet-popup-content-wrapper,.leaflet-popup-tip{background:var(--fh-app-surface);color:var(--fh-app-text)}
.leaflet-container a.leaflet-popup-close-button{color:var(--fh-app-muted)}
.fh-map-popup button{color:var(--fh-app-text)}
.leaflet-bar a,.leaflet-bar a:hover,.leaflet-control-attribution{background:var(--fh-app-surface);color:var(--fh-app-text)}
.leaflet-container .leaflet-control-attribution a{color:var(--fh-app-link)}
