.referral-page { margin:0; background:var(--theme-canvas,#16191e); color:var(--theme-text,#f5f5f5); font:16px/1.5 system-ui,sans-serif; }
.referral-page * { box-sizing:border-box; }
.referral-card { width:min(100% - 32px,720px); margin:40px auto; padding:32px; background:var(--theme-surface,#22262d); border:1px solid var(--theme-border,#606977); border-radius:12px; }
.referral-page h1 { font-size:1.9rem; margin:18px 0 8px; line-height:1.2; }
.referral-page a { color:var(--theme-link,#e0cfc0); }
.referral-grid { display:grid; grid-template-columns:1fr 1fr; gap:18px; }
.referral-wide { grid-column:1/-1; }
.referral-page label { display:flex; flex-direction:column; gap:6px; font-weight:600; min-width:0; }
.referral-page label span,.referral-help { color:var(--theme-text-muted,#bbc2cc); font-weight:400; font-size:.875rem; }
.referral-page input,.referral-page select { width:100%; min-width:0; min-height:44px; border:1px solid var(--theme-border,#6c7888); border-radius:6px; padding:9px 10px; background:var(--theme-surface,#22262d); color:inherit; font:inherit; }
.referral-page input[type=checkbox] { width:20px; min-height:20px; flex:none; }
.referral-page button,.referral-page .referral-action { min-height:44px; padding:10px 18px; border:1px solid var(--theme-accent-border,#c8bdb2); border-radius:6px; color:var(--theme-text,#f5f5f5); background:var(--theme-accent-surface,#3a3342); font:600 1rem/1.4 system-ui,sans-serif; cursor:pointer; }
.referral-page button:disabled { opacity:.6; cursor:wait; }
.referral-page :focus-visible { outline:3px solid var(--theme-accent,#c8bdb2); outline-offset:3px; }
.referral-upload { margin-top:24px; }
.referral-file { display:flex; align-items:center; gap:12px; flex-wrap:wrap; overflow-wrap:anywhere; }
#referral-status { overflow-wrap:anywhere; }
.referral-entry { display:inline-flex; align-items:center; justify-content:center; min-height:44px; padding:10px 18px; border:1px solid currentColor; border-radius:5px; color:inherit; font:inherit; text-decoration:none; margin:8px; }
.referral-page [hidden] { display:none!important; }
.intake-card { border-top:1px solid var(--theme-border,#606977); padding:24px 0; overflow-wrap:anywhere; }
.intake-actions { display:flex; gap:12px; flex-wrap:wrap; margin:14px 0; }
.intake-details { display:grid; gap:14px; margin-top:18px; }
.referral-page .intake-confirm { flex-direction:row; align-items:start; gap:10px; }
@media(max-width:540px) { .referral-card { margin:16px auto; padding:20px; } .referral-grid { grid-template-columns:1fr; gap:16px; } .referral-page h1 { font-size:1.65rem; } }
/* Public surfaces are always Lucent Light; no appearance preference is changed. */
:root[data-theme] .referral-page:not(.intake-page),:root[data-theme] .patients-home[data-account-state="signed-out"] {
 --theme-canvas:#f6f3ee; --theme-surface:#fffdfa; --theme-surface-raised:#e4dbcf; --theme-surface-hover:#eee8e0; --theme-text:#2d2010; --theme-text-muted:#655a4e; --theme-border:#928578; --theme-border-strong:#746553; --theme-accent:#51384d; --theme-accent-border:#51384d; --theme-accent-surface:#eee7ec; --theme-link:#51384d; --theme-danger:#86432e; --landing-background:#f6f3ee; --landing-text:#2d2010; --landing-muted:#655a4e; --landing-accent:#51384d;
 background:#f6f3ee; color:#2d2010; color-scheme:light;
}
:root[data-theme] .patients-home[data-account-state="signed-out"] .site-settings,
:root[data-theme] .patients-home[data-account-state="signed-out"] .site-settings-menu,
:root[data-theme] .patients-home[data-account-state="signed-out"] .site-appearance { display:none!important; }
:root[data-theme] .patients-home[data-account-state="signed-out"] .landing-welcome img { filter:none; }
:root[data-theme] .patients-home[data-account-state="signed-out"] .account-microsoft { display:inline-flex; align-items:center; justify-content:center; gap:12px; width:calc(50% - 6px); min-height:48px; padding:12px 14px; margin:0; border:1px solid #51384d; border-radius:8px; background:#51384d; color:#fffdfa; font:600 1rem/1.4 Nunito,system-ui,sans-serif; vertical-align:middle; }
:root[data-theme] .patients-home[data-account-state="signed-out"] .account-microsoft:hover { background:#402b3d; }
:root[data-theme] .patients-home[data-account-state="signed-out"] .account-microsoft svg { width:20px; height:20px; flex:0 0 20px; aspect-ratio:1; }
:root[data-theme] .patients-home[data-account-state="signed-out"] .referral-entry { display:inline-flex; align-items:center; justify-content:center; width:calc(50% - 6px); min-height:48px; margin:0 0 0 12px; padding:12px 10px; border:1px solid #51384d; border-radius:8px; background:transparent; color:#51384d; font:600 1rem/1.4 Nunito,system-ui,sans-serif; vertical-align:middle; text-align:center; box-sizing:border-box; }
:root[data-theme] .patients-home[data-account-state="signed-out"] :is(.account-microsoft,.referral-entry):focus-visible { outline:3px solid #51384d; outline-offset:4px; }
:root[data-theme] .patients-home[data-account-state="signed-out"] .account-landing [role="status"] { color:#86432e; }
:root[data-theme] .referral-page #submit-referral { background:#51384d; color:#fffdfa; }
@media(max-width:380px) { :root[data-theme] .patients-home[data-account-state="signed-out"] :is(.account-microsoft,.referral-entry) { width:100%; margin:0 0 12px; } }
.referral-embed .referral-back { display:none; }
.referral-embed .referral-card { margin:0 auto; width:100%; border:0; border-radius:0; }
.referral-page:not(.intake-page) { --theme-input:#fffdfa; --theme-action:#51384d; --theme-action-text:#fffdfa; --theme-action-hover:#402b3d; }
:root[data-theme] .patients-home[data-account-state="signed-out"] .landing-welcome img { filter:none!important; }

.referral-entry[hidden] { display:none!important; }
