/* React application layouts and React-only components.
   Canonical clinical primitives later in this file intentionally win when a
   component exists in both systems. Do not add color, typography, radius, or
   elevation tokens here. */

/* Layout only. Color, type, radii, and focus tokens come from canonical intake CSS. */
.ay-shell { min-height: 100vh; display: flex; flex-direction: column; }
.ay-shell__header { width: min(100% - 32px, var(--ay-content-width)); margin: 0 auto; padding: 22px 0; display: flex; align-items: center; justify-content: space-between; gap: 16px; border-bottom: 1px solid var(--ui-border); }
.ay-brand:not(.dashboard-brand-lockup) { color: var(--ui-text); display: inline-flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 700; }
.dashboard-brand-lockup { color: var(--ui-text); text-decoration: none; }
.ay-brand__mark:not(.dashboard-brand-mark) { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: var(--ui-accent); color: var(--ui-surface); }
.ay-brand__mark--logo { overflow: hidden; border-radius: var(--ui-radius-sm); background: transparent !important; }
.ay-shell__status { color: var(--ui-muted); font-size: .82rem; }
.ay-shell__main { width: min(100% - 32px, var(--ay-content-width)); margin: 0 auto; flex: 1; padding: clamp(40px, 7vw, 88px) 0 56px; }
.ay-hero { max-width: 720px; }
.ay-eyebrow { margin: 0 0 10px; color: var(--ui-accent); font-size: .8rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
.ay-hero h1 { margin: 0; font-size: clamp(2rem, 4vw, 3.6rem); line-height: 1.08; letter-spacing: -.025em; }
.ay-lede { max-width: 62ch; margin: 20px 0 0; color: var(--ui-text-soft); font-size: 1.08rem; }
.ay-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }
.ay-content { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 18px; margin-top: 52px; }
.ay-card { padding: 24px; border: 1px solid var(--ui-border); border-radius: var(--ui-radius); background: var(--ui-surface); box-shadow: var(--ui-shadow-card); }
.ay-card h2 { margin: 0 0 10px; font-size: 1.08rem; }
.ay-card p { margin: 0; color: var(--ui-text-soft); }
.ay-card form { display: grid; gap: 13px; margin-top: 18px; }
.ay-card form > label { color: var(--ui-text-soft); font-size: .76rem; font-weight: 620; }
.ay-card [role="alert"] { color: var(--ui-danger); }
.ay-brand__mark img { width: 100%; height: 100%; object-fit: contain; }
.ay-queue-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; padding: 0; list-style: none; }
.ay-queue-summary li { display: flex; justify-content: space-between; gap: 12px; padding: 10px 12px; border: 1px solid var(--ui-border); border-radius: var(--ui-radius); color: var(--ui-text-soft); }
.ay-queue-summary strong { color: var(--ui-text); }
.ay-queue-controls { display: grid; grid-template-columns: auto minmax(160px, 1fr) auto minmax(160px, 1fr) auto minmax(120px, 1fr); align-items: center; gap: 10px; margin-top: 18px; }
.ay-queue-list { gap: 10px; }
.ay-queue-item { grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 14px; }
.ay-queue-item div { min-width: 0; display: grid; gap: 4px; }
.ay-queue-item span { color: var(--ui-text-soft); font-size: .9rem; }
.ay-chart-shell { grid-column: 1 / -1; border: 1px solid var(--ui-border); border-radius: var(--ui-radius-lg); box-shadow: var(--ui-shadow-card); }
.ay-chart-header { align-items: flex-start; }
.ay-chart-header .ay-eyebrow { margin: 0 0 5px; }
.ay-chart-meta { margin: 6px 0 0; color: var(--ui-text-soft); }
.ay-chart-tab { border-bottom: 3px solid transparent; cursor: pointer; }
.ay-chart-tab:hover, .ay-chart-tab:focus-visible { color: var(--ui-accent); }
.ay-chart-tab.is-selected { border-bottom-color: var(--ui-accent); color: var(--ui-accent); }
.ay-chart-body > p { max-width: 70ch; }
.ay-chart-disclosure { margin-top: 18px; color: var(--ui-muted); font-size: .9rem; }
.ay-spinner { width: 15px; height: 15px; flex: 0 0 15px; border: 2px solid var(--ui-accent-border); border-top-color: var(--ui-accent); border-radius: 50%; animation: ay-spin .75s linear infinite; }
.ay-shell__footer { width: min(100% - 32px, var(--ay-content-width)); margin: 0 auto; padding: 20px 0 26px; color: var(--ui-muted); font-size: .82rem; }
.ay-shell--clinical .ay-brand__mark { background: var(--ui-info); }
.ay-shell--platform .ay-brand__mark { background: var(--ui-accent); }
@media (max-width: 600px) { .ay-shell__status { display: none; } .ay-shell__main { padding-top: 48px; } }
@media (max-width: 720px) { .ay-queue-controls { grid-template-columns: 1fr 1fr; } .ay-queue-item { grid-template-columns: 1fr; } .ay-queue-item .ay-button { justify-self: start; } }
@media (max-width: 600px) { .ay-chart-header { flex-direction: column; padding: 18px; } .ay-chart-tabs { padding-inline: 12px; } .ay-chart-body { padding: 22px 18px; } .ay-chart-header .ay-button { align-self: flex-start; } }
@keyframes ay-spin { to { transform: rotate(360deg); } }

/* Clinical dashboard frame: intentionally token-driven so clinic branding can override --ui-* at runtime. */
.sr-only { position:absolute; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden; clip:rect(0,0,0,0); white-space:nowrap; border:0; }
.ay-shell--workspace { height:100dvh; min-height:100dvh; overflow:hidden; background:var(--ui-canvas); }
.ay-workspace-masthead:not(.dashboard-masthead) { flex:0 0 56px; min-height:56px; display:flex; align-items:center; padding:0 18px; border-bottom:1px solid var(--ui-border); background:var(--ui-surface); }
.ay-workspace-masthead:not(.dashboard-masthead) .ay-brand { min-width:0; font-size:.88rem; letter-spacing:0; text-transform:none; }
.ay-workspace-masthead:not(.dashboard-masthead) .ay-workspace-divider { margin-left:8px; color:var(--ui-border-strong); }
.ay-workspace-masthead:not(.dashboard-masthead) .ay-workspace-section { margin-left:8px; color:var(--ui-muted); font-size:.78rem; text-transform:none; }
.ay-workspace-main { flex:1 1 auto; min-height:0; display:flex; padding:0; }
.ay-clinical-dashboard { width:100%; min-width:0; min-height:0; display:grid; grid-template-columns:64px minmax(0,1fr); overflow:hidden; }
@media (min-width:900px) { .ay-pull-refresh { display:none; } }
.ay-dashboard-rail { display:flex; flex-direction:column; align-items:center; padding:12px 8px; border-right:1px solid var(--ui-border); background:var(--ui-surface); }
.ay-rail-button,.ay-account-button { position:relative; width:48px; min-height:42px; display:grid; place-items:center; padding:5px 2px; border:0; border-radius:var(--ui-radius-sm); background:transparent; color:var(--ui-muted); font-size:.59rem; font-weight:650; text-align:center; }
.ay-rail-button.is-selected,.ay-rail-button:hover { background:var(--ui-accent-soft); color:var(--ui-accent); }
.ay-rail-button b { position:absolute; top:0; right:0; min-width:16px; padding:2px 4px; border:2px solid var(--ui-surface); border-radius:999px; background:var(--ui-accent-fill); color:var(--ui-on-accent); font-size:.58rem; }
.ay-rail-spacer { flex:1; }
.ay-account-button { width:38px; height:38px; border-radius:50%; background:var(--ui-text-soft); color:#fff; }
.ay-clinical-workspace { position:relative; min-width:0; min-height:0; grid-template-columns:minmax(300px,34%) minmax(0,1fr); overflow:hidden; }
.ay-queue-sidebar { min-width:0; min-height:0; display:flex; flex-direction:column; padding:15px 19px 17px; overflow:hidden; }
.ay-queue-heading { display:flex; align-items:center; justify-content:space-between; margin-bottom:10px; }
.ay-queue-heading h1 { margin:0; font-size:1.25rem; }
.ay-queue-heading .ay-eyebrow { display:none; }
.ay-live { display:inline-flex; align-items:center; gap:6px; color:var(--ui-muted); font-size:.68rem; }
.ay-live i { width:7px; height:7px; border-radius:50%; background:var(--ui-success); }
.ay-queue-toolbar { margin-bottom:12px; }
.ay-queue-toolbar .ui-input { min-width:0; min-height:40px; }
.ay-queue-columns { min-height:38px; padding:10px 15px; border:1px solid var(--ui-border); border-bottom:0; border-radius:var(--ui-radius) var(--ui-radius) 0 0; background:var(--ui-surface-muted); color:var(--ui-muted); font-size:.63rem; font-weight:680; letter-spacing:.055em; text-transform:uppercase; }
.ay-queue-list { flex:1; min-height:0; overflow-x:hidden; overflow-y:auto; margin:0; padding:0; list-style:none; border:1px solid var(--ui-border); border-radius:0 0 var(--ui-radius) var(--ui-radius); background:var(--ui-surface); box-shadow:var(--ui-shadow-card); overscroll-behavior:contain; }
.ay-queue-row { width:100%; min-height:68px; display:grid; grid-template-columns:36px minmax(0,1fr) auto; align-items:center; gap:10px; padding:9px 15px; border:0; background:transparent; color:var(--ui-text); text-align:left; }
.ay-queue-row:hover,.ay-queue-row:focus-visible { background:var(--ui-accent-soft); }
.ay-avatar { width:36px; height:36px; display:grid; place-items:center; border-radius:50%; background:var(--ui-surface-muted); color:var(--ui-text-soft); font-size:.7rem; font-weight:700; }
.ay-queue-copy { min-width:0; display:grid; gap:2px; }
.ay-queue-copy strong,.ay-queue-copy span,.ay-queue-copy small { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.ay-queue-copy strong { font-size:.78rem; }
.ay-queue-copy span,.ay-queue-copy small { color:var(--ui-muted); font-size:.68rem; }
.ay-status-pill { max-width:130px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; padding:4px 8px; border-radius:999px; background:var(--ui-accent-soft); color:var(--ui-accent); font-size:.64rem; font-weight:680; }
.ay-empty,.ay-dashboard-state { display:grid; place-items:center; min-height:180px; padding:22px; color:var(--ui-muted); text-align:center; }
.ay-queue-footer { flex:0 0 auto; padding-top:8px; color:var(--ui-muted); font-size:.68rem; }
.ay-detail-empty { min-width:0; min-height:0; place-items:center; border-left:1px solid var(--ui-border); color:var(--ui-muted); }
.ay-detail-empty.is-hidden { display:none; }
.ay-detail-pane { grid-column:2; }
.ay-chart-shell { height:100%; min-width:0; min-height:0; flex-direction:column; overflow:hidden; background:var(--ui-canvas); }
.ay-chart-header { position:relative; display:grid; grid-template-columns:minmax(250px,1fr) minmax(350px,1.7fr); gap:20px; padding:14px 17px; border-bottom:1px solid var(--ui-accent-border); background:var(--ui-accent-soft); }
.ay-chart-header h2 { margin:0; font-size:1rem; }
.ay-chart-meta { margin:4px 0 0; color:var(--ui-muted); font-size:.73rem; }
.ay-chart-contact { margin:8px 0 0; display:flex; align-items:center; flex-wrap:wrap; gap:8px; }
.ay-chart-meta-skeleton, .ay-chart-contact-skeleton { display:inline-block; height:11px; border-radius:999px; background:linear-gradient(90deg, #edf0f0 25%, #f7f8f8 50%, #edf0f0 75%); background-size:200% 100%; animation:patient-attachment-pulse 1.35s ease-in-out infinite; }
.ay-chart-meta-skeleton { width:130px; }
.ay-chart-contact-skeleton { width:180px; }
.ay-chart-summary span { color:var(--ui-accent); font-size:.61rem; font-weight:700; letter-spacing:.065em; text-transform:uppercase; }
.ay-chart-summary p { margin:5px 0 0; color:var(--ui-text-soft); font-size:.74rem; }
.ay-chart-cc { display:none; }
.ay-chart-email { display:inline-flex; align-items:center; gap:6px; max-width:100%; border:1px solid var(--ui-accent-border); border-radius:999px; background:var(--ui-surface); color:var(--ui-text-soft); font:inherit; font-size:.71rem; font-weight:600; padding:5px 12px 5px 9px; cursor:pointer; transition:border-color .15s ease,background-color .15s ease,color .15s ease; }
.ay-chart-email svg { width:13px; height:13px; flex:0 0 auto; fill:none; stroke:currentColor; stroke-width:1.8; stroke-linecap:round; stroke-linejoin:round; }
.ay-chart-email span { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.ay-chart-email:hover,.ay-chart-email:focus-visible { border-color:var(--ui-accent); background:var(--ui-accent-soft); color:var(--ui-accent); }
.ay-chart-copy-status { color:var(--ui-accent); font-size:.68rem; font-weight:650; }
.ay-chart-tabs { flex:0 0 auto; }
.ay-chart-tab { flex:0 0 auto; background:transparent; color:var(--ui-muted); font-weight:650; }
.ay-chart-body { flex:1 1 0; min-height:0; overflow-x:hidden; overflow-y:auto; padding:16px 19px 22px; overscroll-behavior:contain; -webkit-overflow-scrolling:touch; }
.ay-chart-placeholder { padding:18px; border:1px solid var(--ui-border); border-radius:var(--ui-radius); background:var(--ui-surface); }
.ay-chart-placeholder h3 { margin:0 0 7px; font-size:.9rem; }
.ay-chart-placeholder p { margin:0 0 16px; color:var(--ui-text-soft); }
.ay-clinical-card { padding:22px 26px; border:1px solid var(--ui-border); border-radius:var(--ui-radius); background:var(--ui-surface); }
.ay-clinical-card__header h3 { margin:0 0 5px; font-size:.92rem; }
.ay-clinical-card__header p { margin:0 0 15px; color:var(--ui-muted); font-size:.72rem; }
.ay-wellness-home { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:14px; }
.ay-wellness-summary { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:10px 18px; margin:0; }
.ay-wellness-summary div { min-width:0; padding:8px 0; border-bottom:1px solid var(--ui-border); }
.ay-wellness-summary dt { color:var(--ui-muted); font-size:.65rem; text-transform:uppercase; letter-spacing:.05em; }
.ay-wellness-summary dd { margin:4px 0 0; color:var(--ui-text); font-size:.78rem; font-weight:650; }
.ay-eligibility-value { margin:0 0 12px; color:var(--ui-text); font-size:.86rem; font-weight:700; }
.ay-enrollment-notice { margin:0 0 12px; padding:10px 12px; border:1px solid var(--ui-warning-border); border-radius:var(--ui-radius-sm); background:var(--ui-warning-soft); color:var(--ui-warning); font-size:.72rem; }
/* Scribe mark beside "Intake Note" (chartShell.tsx ScribeNoteBadge): a small amber circle with a mic, and a tooltip on hover or focus. */
.ay-note-title { display:flex; align-items:center; gap:8px; min-width:0; }
.ay-scribe-mark { position:relative; display:inline-grid; place-items:center; width:22px; height:22px; flex:0 0 22px; border:1px solid var(--ui-warning-border); border-radius:50%; background:var(--ui-warning-soft); color:var(--ui-warning); cursor:default; }
.ay-scribe-mark:focus-visible { outline:2px solid var(--ui-accent); outline-offset:2px; }
.ay-scribe-mark--failed { border-color:var(--ui-danger-border); background:var(--ui-danger-soft); color:var(--ui-danger); }
/* Referral mark beside the patient name in the chart header (chartShell.tsx ReferralBadge); same shape and tooltip as the Scribe mark. */
.ay-chart-name-row { display:flex; align-items:center; gap:8px; min-width:0; }
.ay-chart-name-row > h2 { min-width:0; }
.ay-scribe-mark--referral { border-color:var(--ui-referral-border); background:var(--ui-referral-soft); color:var(--ui-referral); }
.ay-scribe-mark--generating::after { content:""; position:absolute; inset:-4px; border:1px solid var(--ui-warning-border); border-radius:50%; animation:ay-scribe-mark-pulse 1.6s var(--ui-ease-out) infinite; }
.ay-scribe-mark__tip { position:absolute; top:calc(100% + 8px); left:-6px; z-index:20; width:max-content; max-width:min(280px, 70vw); padding:8px 10px; border-radius:var(--ui-radius-sm); background:#172126; color:#fff; font-size:.72rem; font-weight:500; line-height:1.4; white-space:normal; opacity:0; visibility:hidden; transform:translateY(-2px); transition:opacity 150ms var(--ui-ease-out), transform 150ms var(--ui-ease-out), visibility 0s linear 150ms; pointer-events:none; }
.ay-scribe-mark:hover .ay-scribe-mark__tip, .ay-scribe-mark:focus-visible .ay-scribe-mark__tip { opacity:1; visibility:visible; transform:none; transition-delay:0s; }
@keyframes ay-scribe-mark-pulse { from { opacity:.9; transform:scale(.85); } to { opacity:0; transform:scale(1.25); } }
@media (prefers-reduced-motion: reduce) { .ay-scribe-mark--generating::after { animation:none; opacity:.6; } .ay-scribe-mark__tip { transition:none; } }
.ay-wellness-progress { display:grid; grid-template-columns:repeat(5,1fr); gap:5px; margin:18px 0 0; padding:0; list-style:none; }
.ay-wellness-progress li { position:relative; display:grid; gap:4px; justify-items:center; color:var(--ui-muted); font-size:.58rem; text-align:center; }
.ay-wellness-progress li:not(:last-child)::after { content:""; position:absolute; top:11px; left:calc(50% + 12px); width:calc(100% - 19px); height:1px; background:var(--ui-border-strong); }
.ay-wellness-progress li.is-complete:not(:last-child)::after { background:var(--ui-accent); }
.ay-wellness-progress span { position:relative; z-index:1; display:grid; place-items:center; width:23px; height:23px; border:1px solid var(--ui-border-strong); border-radius:50%; background:var(--ui-surface); }
.ay-wellness-progress li.is-current,.ay-wellness-progress li.is-complete { color:var(--ui-accent); }
.ay-wellness-progress li.is-current span,.ay-wellness-progress li.is-complete span { border-color:var(--ui-accent); background:var(--ui-accent-soft); }
.ay-note-card { min-height:0; display:flex; flex-direction:column; gap:14px; }
.ay-note-editor { min-height:0; display:flex; flex-direction:column; gap:7px; }
.ay-note-editor .ui-field__label { color:var(--ui-text); font-size:.68rem; font-weight:700; }
.ay-note-body { width:100%; height:min(68vh,660px); min-height:260px; overflow:auto; resize:vertical; white-space:pre-wrap; padding:16px; border:1px solid var(--ui-border); border-radius:var(--ui-radius-sm); background:var(--ui-surface); color:var(--ui-text); font-family:inherit; font-size:14px; font-weight:430; line-height:1.5; }
/* The Intake Note card fills the chart body's actual available height (it
   already has breathing room below from .ay-chart-body's own padding)
   instead of a viewport-relative guess, so the whole card sits above the
   footer without the chart body needing to scroll. */
.ay-chart-body > .ay-note-fill { height:100%; min-height:0; }
.ay-generated-layout.ay-note-fill .ay-generated-editor { height:100%; min-height:0; }
.ay-generated-layout.ay-note-fill .ay-note-card { height:100%; min-height:0; }
.ay-generated-layout.ay-note-fill .ay-plan-card { height:100%; min-height:0; }
.ay-footer-portal-target { display:contents; }
.ay-note-fill .ay-note-body { flex:1 1 auto; height:auto; min-height:0; resize:none; }
.ay-note-body:focus { outline:2px solid var(--ui-accent-border); outline-offset:1px; border-color:var(--ui-accent); }
.ay-note-status { margin:0; color:var(--ui-muted); font-size:.7rem; }
.ay-note-status--error { display:flex; align-items:center; justify-content:space-between; gap:12px; padding:10px 12px; border:1px solid var(--ui-danger-border); border-radius:var(--ui-radius-sm); background:var(--ui-danger-soft); color:var(--ui-danger); }
.ay-note-footer-status { min-width:0; margin-right:auto; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.ay-note-footer-status.is-success { color:var(--ui-success); }
.ay-note-footer-status.is-error { color:var(--ui-danger); }
.ay-chart-highlights { display:grid; grid-template-columns:130px minmax(0,1fr) auto; align-items:center; gap:10px 14px; margin:0; }
.ay-chart-highlights > div { display:contents; }
.ay-chart-highlights dt { color:var(--ui-text); font-size:.78rem; font-weight:650; }
.ay-chart-highlights dd { margin:0; padding:10px 12px; border:1px solid var(--ui-border); border-radius:var(--ui-radius-sm); background:var(--ui-surface-muted); color:var(--ui-text); font-size:.78rem; overflow-wrap:anywhere; }
.ay-chart-highlights dd.is-multiline { min-height:64px; white-space:pre-wrap; line-height:1.45; }
.ay-copy-chip { flex:0 0 auto; width:36px; height:36px; display:grid; place-items:center; padding:0; border:1px solid var(--ui-border); border-radius:var(--ui-radius-sm); background:var(--ui-surface); color:var(--ui-accent); cursor:pointer; }
.ay-copy-chip svg { width:16px; height:16px; fill:none; stroke:currentColor; stroke-width:1.8; stroke-linecap:round; stroke-linejoin:round; }
.ay-copy-chip:hover,.ay-copy-chip:focus-visible { border-color:var(--ui-accent-border); background:var(--ui-accent-soft); }
.ay-copy-chip.is-copied { border-color:var(--ui-accent); color:var(--ui-success,var(--ui-accent)); }
.ay-data-section { display:flex; flex-direction:column; gap:14px; }
.ay-data-section .ay-clinical-card__header p { margin-bottom:0; }
.ay-data-layout { display:grid; grid-template-columns:1fr 1fr; gap:14px; align-items:start; }
.ay-data-layout .ay-clinical-card__header p { margin-bottom:0; }
.ay-chart-body > .ay-data-fill { height:100%; min-height:0; }
.ay-data-fill .ay-data-key-card,.ay-data-fill .ay-data-intake-card { height:100%; min-height:0; display:flex; flex-direction:column; gap:14px; overflow:auto; }
.ay-data-intake-card { min-width:0; }
.ay-data-intake-body { flex:1 1 auto; width:100%; min-height:0; resize:none; padding:16px; border:1px solid var(--ui-border); border-radius:var(--ui-radius-sm); background:var(--ui-surface); color:var(--ui-text); font-family:inherit; font-size:14px; font-weight:430; line-height:1.5; white-space:pre-wrap; }
.ay-data-intake-body:focus { outline:2px solid var(--ui-accent-border); outline-offset:1px; border-color:var(--ui-accent); }
.ay-plan-layout { display:grid; grid-template-columns:minmax(0,2fr) minmax(240px,1fr); gap:14px; align-items:start; }
.ay-plan-card { display:flex; flex-direction:column; gap:14px; }
.ay-plan-card > .ay-button { align-self:flex-start; }
.ay-plan-card__header { display:flex; align-items:flex-start; justify-content:space-between; gap:14px; }
.ay-plan-card__header p { margin-bottom:0; }
.ay-plan-status { flex:0 0 auto; padding:5px 9px; border:1px solid var(--ui-accent-border); border-radius:999px; background:var(--ui-accent-soft); color:var(--ui-accent); font-size:.64rem; font-weight:750; letter-spacing:.03em; text-transform:uppercase; }
.ay-plan-status--draft { border-color:var(--ui-warning-border); background:var(--ui-warning-soft); color:var(--ui-warning); }
.ay-plan-status--approved { border-color:var(--ui-success-border); background:var(--ui-success-soft); color:var(--ui-success); }
.ay-plan-status--unavailable { border-color:var(--ui-border-strong); background:var(--ui-surface-muted); color:var(--ui-muted); }
.ay-plan-body { min-height:260px; max-height:min(62vh,620px); overflow:auto; padding:20px; border:1px solid var(--ui-border); border-radius:var(--ui-radius-sm); background:var(--ui-surface-muted); color:var(--ui-text); font:inherit; line-height:1.65; white-space:pre-wrap; overflow-wrap:anywhere; }
.ay-plan-meta { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:10px 16px; margin:0; }
.ay-plan-meta div { min-width:0; padding-top:9px; border-top:1px solid var(--ui-border); }
.ay-plan-meta dt,.ay-plan-provenance dt { color:var(--ui-muted); font-size:.63rem; letter-spacing:.05em; text-transform:uppercase; }
.ay-plan-meta dd,.ay-plan-provenance dd { margin:4px 0 0; color:var(--ui-text-soft); font-size:.72rem; overflow-wrap:anywhere; }
.ay-plan-provenance-card { display:flex; flex-direction:column; gap:12px; padding:16px 20px; }
.ay-plan-provenance-card .ay-clinical-card__header p { margin-bottom:0; }
.ay-plan-provenance { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:10px 18px; margin:0; }
.ay-plan-provenance div { min-width:0; padding:8px 0; border-bottom:1px solid var(--ui-border); }
.ay-plan-status--pending,.ay-plan-status--awaiting_diagnosis { border-color:var(--ui-warning-border); background:var(--ui-warning-soft); color:var(--ui-warning); }
.ay-telehealth-recommendations-card,.ay-telehealth-narrative-card,.ay-instructions-card { min-width:0; display:flex; flex-direction:column; gap:14px; }
.ay-telehealth-plan-groups { display:grid; gap:11px; }
.ay-telehealth-plan-group { min-width:0; overflow:hidden; border:1px solid var(--ui-border); border-radius:var(--ui-radius-sm); background:var(--ui-surface-muted); }
.ay-telehealth-plan-group h4 { margin:0; padding:10px 13px; border-bottom:1px solid var(--ui-border); background:var(--ui-success-soft); color:var(--ui-text); font-size:.76rem; }
.ay-telehealth-plan-item { display:grid; grid-template-columns:22px minmax(0,1fr); gap:8px; align-items:start; padding:10px 13px; border-bottom:1px solid var(--ui-border); color:var(--ui-muted); }
.ay-telehealth-plan-item:has(input:checked) { background:var(--ui-accent-soft); }
.ay-telehealth-plan-item input { appearance:none; width:18px; height:18px; margin:1px 0 0; border:1px solid var(--ui-border-strong); border-radius:50%; background:var(--ui-surface); cursor:pointer; }
.ay-telehealth-plan-item input:checked { border-color:var(--ui-accent); background:var(--ui-accent); box-shadow:inset 0 0 0 4px var(--ui-accent); }
.ay-telehealth-plan-item input:focus-visible { outline:2px solid var(--ui-accent); outline-offset:2px; }
.ay-telehealth-plan-item:last-child { border-bottom:0; }
.ay-telehealth-plan-item > span { display:grid; place-items:center; width:18px; height:18px; margin-top:1px; border:1px solid var(--ui-border-strong); border-radius:50%; background:var(--ui-surface); color:var(--ui-muted); font-size:.65rem; font-weight:800; }
.ay-telehealth-plan-item p { min-width:0; margin:0; color:var(--ui-text-soft); font-size:.74rem; line-height:1.45; overflow-wrap:anywhere; }
.ay-telehealth-plan-item.is-selected > span { border-color:var(--ui-accent-fill); background:var(--ui-accent-fill); color:var(--ui-on-accent); }
.ay-telehealth-plan-item.is-selected p { color:var(--ui-text); font-weight:650; }
.ay-telehealth-plan-item.is-manual { grid-template-columns:22px minmax(0,1fr) 22px; align-items:center; }
.ay-telehealth-plan-item.is-manual > span { border-radius:var(--ui-radius-xs); border-color:var(--ui-accent-border); background:var(--ui-accent-soft); color:var(--ui-accent); }
.ay-plan-item-remove { position:relative; width:18px; height:18px; display:grid; place-items:center; justify-self:end; padding:0; border:1px solid var(--ui-danger-border); border-radius:var(--ui-radius-xs); background:var(--ui-danger-soft); color:var(--ui-danger); cursor:pointer; transition:background-color 140ms ease-out,border-color 140ms ease-out,color 140ms ease-out; }
.ay-plan-item-remove::after { content:""; position:absolute; inset:-7px; border-radius:var(--ui-radius-sm); }
.ay-plan-item-remove svg { width:11px; height:11px; fill:none; stroke:currentColor; stroke-width:2; stroke-linecap:round; }
.ay-plan-item-remove:hover { border-color:var(--ui-danger); background:var(--ui-danger); color:#fff; }
.ay-plan-item-remove:focus-visible { outline:2px solid var(--ui-danger); outline-offset:3px; }
.ay-telehealth-plan-warning { display:block; margin-top:5px; color:var(--ui-danger); font-size:.66rem; line-height:1.4; }
.ay-plan-safety-note { margin:0; padding:10px 12px; border:1px solid var(--ui-warning-border); border-radius:var(--ui-radius-sm); background:var(--ui-warning-soft); color:var(--ui-warning); font-size:.7rem; line-height:1.45; }
.ay-plan-manual-entry { display:flex; gap:8px; align-items:center; padding:10px 13px; border-top:1px solid var(--ui-border); background:var(--ui-surface); }
.ay-plan-manual-entry .ui-input { min-width:0; flex:1; padding:8px 10px; font-size:.72rem; }
.ay-plan-manual-entry .ay-button { padding:8px 11px; font-size:.68rem; }
.ay-plan-inline-actions { display:flex; align-items:center; gap:8px; flex-wrap:wrap; }
.ay-plan-inline-actions .ay-button { padding:8px 11px; font-size:.68rem; }
.ay-plan-primary-actions { justify-content:flex-start; margin:14px 0 0; padding:0; border:0; border-radius:0; background:transparent; }
.ay-inline-success { margin:0; color:var(--ui-success); font-size:.68rem; font-weight:700; }
.ay-telehealth-narrative-card .ay-clinical-card__header p,.ay-instructions-card .ay-clinical-card__header p { margin-bottom:0; }
.ay-telehealth-narrative-card .ay-plan-body { min-height:240px; max-height:min(58vh,560px); padding:16px; background:var(--ui-surface); font-size:14px; font-weight:430; line-height:1.5; }
.ay-instructions-card > .ay-button { align-self:flex-start; }
.ay-instructions-diagnosis { display:grid; gap:4px; padding:11px 13px; border:1px solid var(--ui-border); border-radius:var(--ui-radius-sm); background:var(--ui-surface-muted); }
.ay-instructions-diagnosis span { color:var(--ui-muted); font-size:.63rem; font-weight:700; letter-spacing:.05em; text-transform:uppercase; }
.ay-instructions-diagnosis strong { color:var(--ui-text); font-size:.78rem; overflow-wrap:anywhere; }
/* Telehealth Instructions is a single stacked column (Diagnosis card above
   the Patient Instructions card), not the two-column AI layout below. */
.ay-instructions-layout { display:flex; flex-direction:column; gap:14px; }
.ay-diagnosis-row { display:flex; align-items:center; gap:10px; flex-wrap:wrap; }
.ay-diagnosis-row .ui-field { flex:1 1 auto; min-width:200px; }
.ay-instructions-card .ay-plan-body { min-height:240px; max-height:min(58vh,560px); padding:16px; background:var(--ui-surface); font-size:14px; font-weight:430; line-height:1.5; }
.ay-chart-body > .ay-instructions-layout { height:100%; min-height:0; }
.ay-instructions-layout .ay-instructions-card { flex:1 1 auto; min-height:0; height:100%; }
.ay-instructions-layout .ay-instructions-card .ay-plan-body { flex:1 1 auto; height:auto; min-height:0; max-height:none; resize:none; }
/* Shared AI-generated content layout: white editable content (~75%) beside
   a lightly tinted "Suggestions to AI" card (~25%). Used by the Telehealth
   Note/Plan tabs and the Wellness Plan tab. */
.ay-generated-layout { display:grid; grid-template-columns:minmax(0,3fr) minmax(260px,1fr); gap:14px; align-items:start; }
.ay-generated-editor { min-width:0; display:flex; flex-direction:column; gap:14px; }
.ay-generated-card-header { display:flex; align-items:flex-start; justify-content:space-between; gap:14px; }
.ay-generated-card-actions { flex:0 0 auto; display:flex; align-items:center; justify-content:flex-end; gap:8px; }
/* Round AI actions (chartShell.tsx RegenerateContentControl / RestorePreviousNoteControl): 30px circles with Lucide
   icons and a styled hover label. Motion follows the design skills: ease-out curve, press scale, no motion when reduced. */
.ay-ai-regenerate { position:relative; flex:0 0 auto; width:30px; height:30px; display:grid; place-items:center; padding:0; border:1px solid var(--ui-border-strong); border-radius:999px; background:var(--ui-surface); color:var(--ui-text-soft); cursor:pointer; transition:background-color 160ms var(--ui-ease-out),border-color 160ms var(--ui-ease-out),color 160ms var(--ui-ease-out),transform 160ms var(--ui-ease-out); }
.ay-ai-regenerate::after { content:""; position:absolute; inset:-5px; border-radius:999px; }
.ay-ai-regenerate > svg { width:15px; height:15px; stroke-width:2; }
.ay-ai-regenerate > .ay-spinner { width:13px; height:13px; flex-basis:13px; }
.ay-ai-regenerate:hover:not(:disabled) { border-color:var(--ui-accent); background:var(--ui-accent-soft); color:var(--ui-accent); }
.ay-ai-regenerate:active:not(:disabled) { transform:scale(.94); }
.ay-ai-regenerate:focus-visible { outline:2px solid var(--ui-accent); outline-offset:3px; }
.ay-ai-regenerate:disabled { cursor:not-allowed; }
.ay-ai-regenerate:disabled > svg { opacity:.5; }
.ay-ai-regenerate.is-loading > svg { animation:ay-ai-regenerate-spin .8s linear infinite; }
.ay-ai-regenerate-feedback { margin:0; color:var(--ui-success); font-size:.68rem; font-weight:700; }
.ay-ai-regenerate-modal .ay-order-confirm-dialog { max-width:430px; }
@keyframes ay-ai-regenerate-spin { to { transform:rotate(360deg); } }
/* Hover label: waits a beat on hover so passing the cursor over doesn't flash it, shows at once on keyboard focus. */
.ay-icon-tip { position:absolute; top:calc(100% + 8px); right:-4px; z-index:30; padding:6px 9px; border-radius:var(--ui-radius-sm); background:#172126; color:#fff; font-size:.7rem; font-weight:600; line-height:1.2; letter-spacing:.005em; white-space:nowrap; pointer-events:none; opacity:0; visibility:hidden; transform:translateY(-2px) scale(.97); transform-origin:top right; transition:opacity 150ms var(--ui-ease-out),transform 150ms var(--ui-ease-out),visibility 0s linear 150ms; }
.ay-ai-regenerate:hover > .ay-icon-tip { opacity:1; visibility:visible; transform:none; transition-delay:350ms,350ms,0s; }
.ay-ai-regenerate:focus-visible > .ay-icon-tip { opacity:1; visibility:visible; transform:none; transition-delay:0s; }
/* The Intake Note's actions share one pill: [restore | regenerate]. Buttons inside drop their own ring. */
.ay-icon-pill { display:inline-flex; align-items:center; height:30px; padding:0; border:1px solid var(--ui-border-strong); border-radius:999px; background:var(--ui-surface); }
.ay-icon-pill > .ay-ai-regenerate, .ay-icon-pill__extra > .ay-ai-regenerate { width:28px; height:28px; border:0; background:transparent; }
.ay-icon-pill > .ay-ai-regenerate:hover:not(:disabled), .ay-icon-pill__extra > .ay-ai-regenerate:hover:not(:disabled) { background:var(--ui-accent-soft); }
.ay-icon-pill__extra { display:inline-flex; align-items:center; flex:none; width:33px; }
.ay-icon-pill__divider { flex:none; width:1px; height:14px; margin:0 2px; border-radius:1px; background:var(--ui-border-strong); }
/* Restore arrives while the chart is open: the pill grows to the left (regenerate stays put), the divider draws in,
   then the undo icon eases in. clip-path only applies during the motion so hover labels are never clipped after. */
.ay-icon-pill__extra.is-entering { animation:ay-icon-pill-grow 260ms var(--ui-ease-out) backwards; }
.ay-icon-pill__extra.is-entering .ay-icon-pill__divider { animation:ay-icon-pill-divider 200ms var(--ui-ease-out) 90ms backwards; }
.ay-icon-pill__extra.is-entering > .ay-ai-restore > svg { animation:ay-icon-pill-icon 220ms var(--ui-ease-out) 110ms backwards; }
@keyframes ay-icon-pill-grow { from { width:0; clip-path:inset(0 0 0 0); } to { width:33px; clip-path:inset(0 0 0 0); } }
@keyframes ay-icon-pill-divider { from { transform:scaleY(0.2); opacity:0; } to { transform:none; opacity:1; } }
@keyframes ay-icon-pill-icon { from { transform:scale(.9) rotate(-35deg); opacity:0; } to { transform:none; opacity:1; } }
@media (prefers-reduced-motion:reduce) {
  .ay-ai-regenerate, .ay-icon-tip { transition:none; }
  .ay-ai-regenerate.is-loading > svg, .ay-icon-pill__extra.is-entering, .ay-icon-pill__extra.is-entering .ay-icon-pill__divider, .ay-icon-pill__extra.is-entering > .ay-ai-restore > svg { animation:none; }
}
.ay-suggestions-card { display:flex; flex-direction:column; gap:10px; padding:16px 18px; background:var(--ui-surface-muted); }
.ay-suggestions-card .ay-clinical-card__header p { margin-bottom:0; }
.ay-suggestions-field { position:relative; }
.ay-suggestions-field textarea { min-height:88px; padding-bottom:34px; background:var(--ui-surface); resize:vertical; }
.ay-suggestions-actions { display:flex; align-items:center; justify-content:flex-end; gap:8px; }
.ay-suggestions-status { margin:0; color:var(--ui-text-soft); font-size:.72rem; display:flex; align-items:center; gap:7px; }
.ay-suggestions-status.is-error { color:var(--ui-danger); }
@media (max-width:899px) { .ay-generated-layout { grid-template-columns:1fr; } }
@media (max-width:899px) { .ay-settings-group-card--wide .ay-patient-settings-form { grid-template-columns:1fr; } }
@media (max-width:600px) { .ay-plan-card__header.ay-generated-card-header,.ay-complete-record-card .ay-generated-card-header { flex-direction:row; align-items:flex-start; } .ay-generated-card-actions { flex-wrap:wrap; } }
.ay-data-remaining { padding:13px 15px; border:1px solid var(--ui-border); border-radius:var(--ui-radius-sm); background:var(--ui-surface-muted); }
.ay-data-remaining h4,.ay-data-records h4,.ay-data-records h5 { margin:0 0 5px; font-size:.78rem; }
.ay-data-remaining p,.ay-data-records p { margin:0; color:var(--ui-text-soft); font-size:.76rem; line-height:1.5; white-space:pre-wrap; overflow-wrap:anywhere; }
.ay-data-records .ay-data-records__subtitle { margin-bottom:8px; color:var(--ui-muted); font-size:.72rem; }
.ay-assessment-layout { display:grid; grid-template-columns:1fr; grid-template-rows:minmax(0,1fr) minmax(0,1fr); gap:16px; height:100%; min-height:0; }
.ay-assessment-note-card,.ay-assessment-section { min-width:0; min-height:0; height:100%; overflow:hidden; }
.ay-assessment-note-card { display:flex; flex-direction:column; }
.ay-assessment-note-card .ay-note-body--readonly { flex:1 1 auto; min-height:0; height:auto; }
.ay-note-body--readonly { overflow:auto; white-space:pre-wrap; cursor:text; }
.ay-assessment-note-meta { display:flex; align-items:center; justify-content:space-between; gap:12px; padding-top:12px; color:var(--ui-muted); font-size:.68rem; }
.ay-assessment-section { display:flex; flex-direction:column; gap:14px; }
.ay-assessment-section .ay-clinical-card__header p { margin-bottom:0; }
.ay-chart-body > .ay-assessment-fill { height:100%; min-height:0; }
.ay-assessment-fill { min-height:0; }
.ay-assessment-fill .ay-assessment-accordion,.ay-assessment-fill .ay-section-empty { flex:1 1 auto; min-height:0; overflow:auto; }
.ay-assessment-accordion { display:grid; grid-auto-rows:max-content; align-content:start; gap:8px; }
.ay-assessment-accordion details { height:max-content; align-self:start; border:1px solid var(--ui-border); border-radius:var(--ui-radius-sm); background:var(--ui-surface-muted); overflow:hidden; }
.ay-assessment-accordion details:not([open]) > .ay-assessment-answers { display:none; }
.ay-assessment-accordion summary { display:flex; align-items:center; justify-content:space-between; gap:12px; padding:12px 14px; color:var(--ui-text); cursor:pointer; font-size:.76rem; font-weight:700; list-style-position:inside; }
.ay-assessment-accordion summary::marker { color:var(--ui-accent); }
.ay-assessment-accordion summary time { flex:0 0 auto; color:var(--ui-muted); font-size:.68rem; font-weight:500; }
.ay-assessment-answers { display:grid; gap:10px; padding:0 14px 14px 32px; }
.ay-assessment-answers div { min-width:0; }
.ay-assessment-answers dt { color:var(--ui-muted); font-size:.68rem; font-weight:700; }
.ay-assessment-answers dd { margin:3px 0 0; color:var(--ui-text-soft); font-size:.76rem; line-height:1.45; white-space:pre-wrap; overflow-wrap:anywhere; }
.ay-messages-layout { display:grid; grid-template-columns:1fr; gap:14px; align-items:start; }
.ay-messages-card,.ay-followups-card { min-width:0; display:flex; flex-direction:column; gap:14px; }
.ay-messages-card .ay-clinical-card__header p,.ay-followups-card .ay-clinical-card__header p { margin-bottom:0; }
.ay-message-thread,.ay-followup-list { display:grid; gap:9px; min-width:0; }
.ay-message-bubble { min-width:0; padding:12px 14px; border:1px solid var(--ui-border); border-radius:var(--ui-radius-sm); background:var(--ui-surface-muted); }
.ay-message-meta { display:flex; align-items:baseline; gap:7px; flex-wrap:wrap; color:var(--ui-muted); font-size:.67rem; }
.ay-message-meta strong { color:var(--ui-text); font-size:.72rem; }
.ay-message-meta time { margin-left:auto; }
.ay-message-bubble p { margin:8px 0 10px; color:var(--ui-text-soft); font-size:.78rem; line-height:1.5; white-space:pre-wrap; overflow-wrap:anywhere; }
.ay-message-status { display:flex; align-items:center; gap:9px; flex-wrap:wrap; color:var(--ui-muted); font-size:.64rem; }
.ay-message-status .is-reviewed { color:var(--ui-success); font-weight:700; }
.ay-message-status .is-pending { color:var(--ui-warning); font-weight:700; }
.ay-followup-item { min-width:0; border:1px solid var(--ui-border); border-radius:var(--ui-radius-sm); background:var(--ui-surface-muted); overflow:hidden; }
.ay-followup-item.is-open { border-color:var(--ui-accent-border); box-shadow:0 0 0 1px var(--ui-accent-soft); }
.ay-followup-item.is-closed { opacity:.76; }
.ay-followup-item summary { display:flex; align-items:flex-start; justify-content:space-between; gap:10px; padding:12px 13px; color:var(--ui-text); cursor:pointer; list-style-position:inside; }
.ay-followup-summary { min-width:0; display:grid; gap:4px; }
.ay-followup-summary strong { color:var(--ui-text); font-size:.75rem; line-height:1.35; overflow-wrap:anywhere; }
.ay-followup-summary small { color:var(--ui-muted); font-size:.66rem; }
.ay-followup-status { flex:0 0 auto; color:var(--ui-accent); font-size:.64rem; font-weight:700; text-transform:capitalize; }
.ay-followup-item.is-open .ay-followup-status { color:var(--ui-warning); }
.ay-followup-detail { display:grid; gap:10px; padding:0 13px 13px 31px; }
.ay-followup-detail p { margin:0; color:var(--ui-text-soft); font-size:.73rem; line-height:1.45; white-space:pre-wrap; overflow-wrap:anywhere; }
.ay-followup-detail p strong { display:block; margin-bottom:3px; color:var(--ui-muted); font-size:.64rem; letter-spacing:.04em; text-transform:uppercase; }
.ay-followup-detail dl { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:8px; margin:0; }
.ay-followup-detail dt { color:var(--ui-muted); font-size:.61rem; text-transform:uppercase; }
.ay-followup-detail dd { margin:3px 0 0; color:var(--ui-text-soft); font-size:.68rem; overflow-wrap:anywhere; }
.ay-followup-pending { color:var(--ui-muted) !important; }
.ay-orders-layout { display:grid; gap:14px; min-width:0; }
.ay-orders-intro { display:flex; align-items:flex-start; justify-content:space-between; gap:14px; padding:0 2px; }
.ay-orders-intro h3 { margin:0 0 5px; color:var(--ui-text); font-size:.94rem; }
.ay-orders-intro p { margin:0; color:var(--ui-muted); font-size:.72rem; }
.ay-orders-count,.ay-order-group-count { flex:0 0 auto; min-width:26px; padding:5px 9px; border:1px solid var(--ui-accent-border); border-radius:999px; background:var(--ui-accent-soft); color:var(--ui-accent); font-size:.64rem; font-weight:750; text-align:center; }
.ay-order-groups { display:grid; gap:14px; }
.ay-order-group { display:flex; flex-direction:column; gap:14px; }
.ay-order-group .ay-clinical-card__header { display:flex; align-items:flex-start; justify-content:space-between; gap:12px; }
.ay-order-group .ay-clinical-card__header p { margin-bottom:0; }
.ay-order-list { display:grid; gap:10px; }
.ay-order-card { min-width:0; padding:14px 15px; border:1px solid var(--ui-border); border-radius:var(--ui-radius-sm); background:var(--ui-surface-muted); }
.ay-order-card__header { display:flex; align-items:flex-start; justify-content:space-between; gap:12px; }
.ay-order-card__header h4 { margin:3px 0 0; color:var(--ui-text); font-size:.8rem; overflow-wrap:anywhere; }
.ay-order-kind { color:var(--ui-muted); font-size:.61rem; font-weight:750; letter-spacing:.06em; text-transform:uppercase; }
.ay-order-status { flex:0 0 auto; padding:5px 8px; border:1px solid var(--ui-accent-border); border-radius:999px; background:var(--ui-accent-soft); color:var(--ui-accent); font-size:.61rem; font-weight:750; letter-spacing:.03em; text-transform:uppercase; }
.ay-order-status--draft { border-color:var(--ui-warning-border); background:var(--ui-warning-soft); color:var(--ui-warning); }
.ay-order-status--cancelled,.ay-order-status--superseded,.ay-order-status--abandoned { border-color:var(--ui-border-strong); background:var(--ui-surface); color:var(--ui-muted); }
.ay-order-summary { margin:11px 0 13px; color:var(--ui-text-soft); font-size:.75rem; line-height:1.5; white-space:pre-wrap; overflow-wrap:anywhere; }
.ay-order-details,.ay-order-dates { display:grid; grid-template-columns:repeat(auto-fit,minmax(145px,1fr)); gap:9px 14px; margin:0; }
.ay-order-details { padding-bottom:12px; border-bottom:1px solid var(--ui-border); }
.ay-order-details div,.ay-order-dates div { min-width:0; }
.ay-order-details dt,.ay-order-dates dt { color:var(--ui-muted); font-size:.61rem; letter-spacing:.04em; text-transform:uppercase; }
.ay-order-details dd,.ay-order-dates dd { margin:3px 0 0; color:var(--ui-text-soft); font-size:.69rem; line-height:1.4; overflow-wrap:anywhere; }
.ay-order-dates { margin-top:12px; }
.ay-order-disclosure { margin:12px 0 0; padding:8px 10px; border:1px solid var(--ui-warning-border); border-radius:var(--ui-radius-sm); background:var(--ui-warning-soft); color:var(--ui-warning); font-size:.67rem; line-height:1.4; }
.ay-orders-layout > .ay-button { align-self:flex-start; }
.ay-patient-settings-layout { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:14px; align-items:start; }
.ay-patient-settings-card { min-width:0; display:flex; flex-direction:column; gap:14px; }
.ay-patient-settings-column { min-width:0; display:flex; flex-direction:column; gap:14px; }
.ay-patient-settings-card .ay-clinical-card__header { display:flex; align-items:flex-start; justify-content:space-between; gap:12px; }
.ay-patient-settings-card .ay-clinical-card__header p { margin-bottom:0; }
.ay-patient-settings-list { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:9px 16px; margin:0; }
.ay-patient-settings-list div { min-width:0; padding:9px 0; border-bottom:1px solid var(--ui-border); }
.ay-patient-settings-list div.is-wide { grid-column:1/-1; }
.ay-patient-settings-list dt { color:var(--ui-muted); font-size:.62rem; font-weight:700; letter-spacing:.05em; text-transform:uppercase; }
.ay-patient-settings-list dd { margin:4px 0 0; color:var(--ui-text-soft); font-size:.74rem; line-height:1.45; white-space:pre-wrap; overflow-wrap:anywhere; }
.ay-patient-settings-portal { grid-column:1/-1; }
.ay-patient-settings-status { flex:0 0 auto; padding:5px 9px; border:1px solid var(--ui-border-strong); border-radius:999px; background:var(--ui-surface-muted); color:var(--ui-muted); font-size:.62rem; font-weight:750; }
.ay-patient-settings-status--linked { border-color:var(--ui-success-border); background:var(--ui-success-soft); color:var(--ui-success); }
.ay-patient-settings-status--invited { border-color:var(--ui-accent-border); background:var(--ui-accent-soft); color:var(--ui-accent); }
.ay-patient-invitation { display:grid; gap:7px; padding:13px 15px; border:1px solid var(--ui-border); border-radius:var(--ui-radius-sm); background:var(--ui-surface-muted); }
.ay-patient-invitation > span { color:var(--ui-muted); font-size:.62rem; font-weight:700; letter-spacing:.05em; text-transform:uppercase; }
.ay-patient-invitation code { display:block; color:var(--ui-text); font-family:ui-monospace,SFMono-Regular,Menlo,monospace; font-size:.7rem; line-height:1.5; overflow-wrap:anywhere; user-select:all; }
.ay-patient-invitation p,.ay-patient-settings-copy { margin:0; color:var(--ui-muted); font-size:.68rem; line-height:1.45; overflow-wrap:anywhere; }
.ay-patient-settings-handoff { grid-column:1/-1; display:flex; align-items:center; justify-content:space-between; gap:16px; padding:14px 16px; border:1px solid var(--ui-accent-border); border-radius:var(--ui-radius-sm); background:var(--ui-accent-soft); }
.ay-patient-settings-handoff h3 { margin:0 0 4px; color:var(--ui-text); font-size:.78rem; }
.ay-patient-settings-handoff p { margin:0; color:var(--ui-text-soft); font-size:.7rem; line-height:1.45; }
.ay-patient-settings-handoff .ay-button { flex:0 0 auto; }
.ay-complete-layout { display:grid; grid-template-columns:minmax(0,2fr) minmax(280px,1fr); gap:16px; align-items:start; }
.ay-complete-layout--full { grid-template-columns:1fr; }
.ay-complete-layout--single { grid-template-columns:1fr; align-content:start; }
.ay-complete-layout--single .ay-complete-plan-card { width:100%; }
/* --single's align-content:start sizes the single grid row to its content
   and packs it at the top, which is right for the ordinary (non-fill) case
   but leaves the height:100% on .ay-complete-plan-card below with nothing
   to be 100% of. When the fill treatment is requested, force the row itself
   to take the full available height instead of sizing to content. */
.ay-complete-layout--single.ay-note-fill { grid-template-rows:1fr; align-content:stretch; align-items:stretch; }
.ay-complete-record-card,.ay-complete-workflow-card,.ay-complete-plan-card { min-width:0; }
.ay-complete-record-card .ay-clinical-card__header { display:flex; align-items:flex-start; justify-content:space-between; gap:14px; }
.ay-complete-record-card .ay-clinical-card__header p,.ay-complete-workflow-card .ay-clinical-card__header p,.ay-complete-plan-card .ay-clinical-card__header p { margin-bottom:0; }
.ay-complete-state { flex:0 0 auto; padding:5px 9px; border:1px solid var(--ui-border); border-radius:999px; background:var(--ui-surface-muted); color:var(--ui-text-soft); font-size:.62rem; font-weight:750; letter-spacing:.03em; text-transform:uppercase; }
.ay-complete-state--completed { border-color:var(--ui-success-border); background:var(--ui-success-soft); color:var(--ui-success); }
.ay-complete-record { min-height:360px; max-height:calc(100dvh - 330px); margin-top:18px; overflow:auto; padding:18px; border:1px solid var(--ui-border); border-radius:var(--ui-radius-sm); background:var(--ui-surface-muted); color:var(--ui-text); font-size:.76rem; font-weight:500; line-height:1.65; white-space:pre-wrap; overflow-wrap:anywhere; }
.ay-complete-layout.ay-note-fill .ay-complete-record-card,.ay-complete-layout.ay-note-fill .ay-complete-plan-card { height:100%; min-height:0; }
.ay-complete-record-card.ay-note-card .ay-complete-dates,.ay-complete-record-card.ay-note-card .ay-complete-notices,.ay-complete-record-card.ay-note-card .ay-complete-reopen { margin-top:0; }
.ay-complete-dates { display:grid; grid-template-columns:1fr 1fr; gap:9px; margin:16px 0 0; }
.ay-complete-dates div { min-width:0; padding:10px; border:1px solid var(--ui-border); border-radius:var(--ui-radius-sm); background:var(--ui-surface-muted); }
.ay-complete-dates dt { color:var(--ui-muted); font-size:.61rem; font-weight:700; letter-spacing:.04em; text-transform:uppercase; }
.ay-complete-dates dd { margin:4px 0 0; color:var(--ui-text); font-size:.72rem; font-weight:700; overflow-wrap:anywhere; }
.ay-complete-notices { display:grid; gap:6px; margin:16px 0 0; padding:11px 12px 11px 28px; border:1px solid var(--ui-warning-border); border-radius:var(--ui-radius-sm); background:var(--ui-warning-soft); color:var(--ui-text-soft); font-size:.7rem; line-height:1.45; }
.ay-complete-notices li.is-blocked { color:var(--ui-danger); }
.ay-complete-plan-actions { display:grid; gap:10px; margin-top:14px; }
.ay-complete-plan-actions .ay-button { justify-self:start; }
.ay-complete-workflow { display:grid; gap:8px; margin:16px 0 0; padding:0; list-style:none; }
.ay-complete-workflow li { display:grid; grid-template-columns:28px minmax(0,1fr) auto; align-items:center; gap:9px; padding:10px; border:1px solid var(--ui-border); border-radius:var(--ui-radius-sm); background:var(--ui-surface-muted); }
.ay-complete-workflow li.is-available { border-color:var(--ui-accent-border); background:var(--ui-accent-soft); }
.ay-complete-step-icon { display:grid; width:28px; height:28px; place-items:center; border:1px solid var(--ui-border-strong); border-radius:50%; background:var(--ui-surface); color:var(--ui-muted); font-size:.68rem; font-weight:750; }
.ay-complete-workflow li.is-complete .ay-complete-step-icon { border-color:var(--ui-success); background:var(--ui-success); color:#fff; }
.ay-complete-workflow strong { display:block; color:var(--ui-text); font-size:.72rem; }
.ay-complete-workflow small { display:block; margin-top:2px; color:var(--ui-muted); font-size:.63rem; }
.ay-complete-step-state { color:var(--ui-muted); font-size:.61rem; font-weight:750; text-transform:uppercase; }
.ay-complete-workflow li.is-complete .ay-complete-step-state { color:var(--ui-success); }
.ay-complete-workflow li.is-available .ay-complete-step-state { color:var(--ui-accent); }
.ay-complete-handoff { grid-column:auto; align-items:flex-start; flex-direction:column; }
.ay-complete-handoff .ay-button { flex:0 0 auto; }
.ay-load-more { display:flex; justify-content:center; }
.ay-load-more .ay-button { gap:7px; min-width:118px; }
.ay-section-empty { display:grid; place-items:center; min-height:130px; margin:0; padding:20px; border:1px dashed var(--ui-border-strong); border-radius:var(--ui-radius-sm); color:var(--ui-muted); text-align:center; }
.ay-section-error { padding:14px; border:1px solid var(--ui-danger-border); border-radius:var(--ui-radius-sm); background:var(--ui-danger-soft); }
.ay-section-error p { margin:0; color:var(--ui-danger); font-size:.76rem; }
.ay-section-error .ay-actions { margin-top:14px; }
.ay-data-records { display:grid; gap:8px; }
.ay-data-records article { padding:12px 14px; border:1px solid var(--ui-border); border-radius:var(--ui-radius-sm); background:var(--ui-surface-muted); }
.ay-data-records article header { display:flex; justify-content:space-between; align-items:baseline; gap:12px; }
.ay-data-records time { flex:0 0 auto; color:var(--ui-muted); font-size:.67rem; }
.ay-wellness-data-layout { display:grid; gap:16px; }
.ay-wellness-trend-averages { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:10px; margin:0; }
.ay-wellness-trend-averages > div { min-width:0; padding:12px 14px; border:1px solid var(--ui-border); border-radius:var(--ui-radius-sm); background:var(--ui-surface-muted); }
.ay-wellness-trend-averages dt { color:var(--ui-muted); font-size:.67rem; font-weight:700; letter-spacing:.035em; text-transform:uppercase; }
.ay-wellness-trend-averages dd { margin:5px 0 0; color:var(--ui-text); font-size:1rem; font-weight:720; font-variant-numeric:tabular-nums; }
.ay-wellness-trend-table-wrap { overflow-x:auto; border:1px solid var(--ui-border); border-radius:var(--ui-radius-sm); }
.ay-wellness-trend-table { width:100%; border-collapse:collapse; color:var(--ui-text-soft); font-size:.74rem; font-variant-numeric:tabular-nums; }
.ay-wellness-trend-table th,.ay-wellness-trend-table td { padding:11px 12px; border-bottom:1px solid var(--ui-border); text-align:left; white-space:nowrap; }
.ay-wellness-trend-table thead th { background:var(--ui-surface-muted); color:var(--ui-muted); font-size:.65rem; font-weight:720; letter-spacing:.035em; text-transform:uppercase; }
.ay-wellness-trend-table tbody th { color:var(--ui-text); font-weight:680; }
.ay-wellness-trend-table tbody tr:last-child > * { border-bottom:0; }
.ay-data-note { margin:0; color:var(--ui-muted); font-size:.7rem; }
.ay-documents-section { display:flex; flex-direction:column; gap:14px; }
.ay-documents-section .ay-clinical-card__header p { margin-bottom:0; }
.ay-documents-section > .ay-button { align-self:flex-start; }
/* Patient Documents fills the chart body's actual available height, same
   as the Note/Instructions cards, instead of the legacy 45vh guess the
   pre-React clinical workspace still relies on (hence the extra class
   scoping here rather than changing .clinical-documents-card directly). */
.ay-chart-body > .ay-documents-fill { height:100%; min-height:0; }
.ay-documents-fill.clinical-documents-card { min-height:0; }
.ay-documents-fill .clinical-document-list,.ay-documents-fill .ay-section-empty { flex:1 1 auto; min-height:0; overflow:auto; }
/* Populated document regions should read as a file grid from the top of the
   available gray surface. Keep the empty state as a flex child so its own
   place-items:center behavior continues to center the no-files message. */
.ay-documents-fill .clinical-document-list { align-content:start; grid-template-columns:repeat(3,minmax(0,1fr)); }
.ay-documents-fill .ay-document-row { grid-template-columns:minmax(0,1fr) auto; align-items:center; align-content:start; min-width:0; height:max-content; margin:0; }
.ay-documents-fill .clinical-document-summary,.ay-documents-fill .patient-attachment-copy { min-width:0; }
.ay-documents-fill .clinical-document-actions { flex-wrap:nowrap; justify-content:flex-end; }
@media (max-width:899px) { .ay-documents-fill .clinical-document-list { grid-template-columns:repeat(2,minmax(0,1fr)); } }
@media (max-width:600px) { .ay-documents-fill .clinical-document-list { grid-template-columns:1fr; } }
.document-filter { grid-template-columns:repeat(2,minmax(0,210px)); }
.document-filter-field { min-width:0; display:grid; gap:5px; }
.document-filter-field .ui-field__label { color:var(--ui-muted); font-size:.66rem; font-weight:700; letter-spacing:.04em; text-transform:uppercase; }
.document-filter-field .ui-select { width:100%; min-height:38px; padding:8px 34px 8px 10px; border:1px solid var(--ui-border); border-radius:var(--ui-radius-sm); background-color:var(--ui-surface); color:var(--ui-text); font:inherit; font-size:.74rem; }
.ay-document-row { display:grid; grid-template-columns:minmax(0,1fr) auto; align-items:center; gap:12px; padding:12px 14px; border:1px solid var(--ui-border); border-radius:var(--ui-radius-sm); background:var(--ui-surface-muted); }
.patient-attachment-icon { border:1px solid var(--ui-accent-border); }
.ay-document-file-icon { font-size:.54rem; font-weight:800; letter-spacing:.03em; }
.patient-attachment-copy small { line-height:1.4; overflow-wrap:anywhere; }
.clinical-document-actions { align-items:center; }
.clinical-document-actions .ay-button { min-width:72px; gap:7px; padding:8px 11px; font-size:.7rem; }
.ay-document-row-error { grid-column:1/-1; margin:0; color:var(--ui-danger); font-size:.7rem; }
.ay-document-preview-modal { position:fixed; inset:0; z-index:120; display:grid; place-items:center; padding:20px; background:var(--ui-overlay); }
.ay-document-preview-dialog { width:min(100%,920px); height:min(86dvh,760px); min-height:320px; display:flex; flex-direction:column; overflow:hidden; border:1px solid var(--ui-border-strong); border-radius:var(--ui-radius); background:var(--ui-surface); box-shadow:var(--ui-shadow-card); }
.ay-document-preview-header { flex:0 0 auto; display:flex; align-items:flex-start; justify-content:space-between; gap:16px; padding:15px 17px; border-bottom:1px solid var(--ui-border); }
.ay-document-preview-header h3 { margin:4px 0 0; color:var(--ui-text); font-size:.9rem; overflow-wrap:anywhere; }
.attachment-preview-close-icon { flex:0 0 32px; font-size:1.15rem; cursor:pointer; }
.ay-document-preview-stage { flex:1 1 auto; min-height:0; display:grid; place-items:center; overflow:auto; padding:14px; background:var(--ui-canvas); }
.ay-document-preview-image { display:block; max-width:100%; max-height:100%; object-fit:contain; }
.ay-document-preview-pdf { width:100%; height:100%; min-height:300px; border:0; background:var(--ui-surface); }
.attachment-preview-status { margin:0; text-align:center; }
.ay-document-preview-footer { flex:0 0 auto; display:flex; align-items:center; justify-content:flex-end; gap:9px; padding:10px 15px; border-top:1px solid var(--ui-border); background:var(--ui-surface); }
.ay-chart-footer { flex:0 0 auto; min-height:54px; display:flex; align-items:center; justify-content:flex-start; gap:10px; padding:8px 18px; border-top:1px solid var(--ui-border); background:var(--ui-surface); color:var(--ui-muted); font-size:.7rem; }
.ay-chart-footer .ay-note-footer-status { min-width:0; margin-right:auto; }
.ay-chart-footer .ay-button { flex:0 0 auto; }
.ay-chart-footer-close { margin-right:auto; }
.ay-chart-footer-close:has(+ .ay-note-footer-status) { margin-right:0; }
.ay-order-create-actions,.ay-order-actions { display:flex; flex-wrap:wrap; gap:8px; }
.ay-order-create-actions { margin:0 0 14px; }
.ay-order-actions { margin-top:14px; }
.ay-order-editor-modal,.ay-order-confirm-modal { position:fixed; inset:0; z-index:110; display:grid; place-items:center; padding:18px; background:var(--ui-overlay); }
.ay-order-editor-dialog,.ay-order-confirm-dialog { width:min(100%,760px); max-height:min(92dvh,900px); overflow:auto; border:1px solid var(--ui-border-strong); border-radius:var(--ui-radius); background:var(--ui-surface); box-shadow:var(--ui-shadow-card); }
.ay-order-editor-dialog { display:flex; flex-direction:column; overflow:hidden; }
.ay-order-confirm-dialog { width:min(100%,560px); padding:20px; }
.ay-order-editor-header { flex:0 0 auto; display:flex; align-items:flex-start; justify-content:space-between; gap:16px; padding:15px 17px; border-bottom:1px solid var(--ui-border); }
.ay-order-editor-header h3,.ay-order-confirm-dialog h3 { margin:4px 0 0; color:var(--ui-text); font-size:.92rem; }
.ay-order-editor-dialog > .ay-order-disclosure { flex:0 0 auto; margin:14px 17px 0; }
.ay-order-editor-grid { min-height:0; overflow:auto; display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:12px; padding:16px 17px; }
.ay-order-editor-grid .ui-field { min-width:0; }
.ay-order-editor-grid .ui-field:has(textarea),.ay-order-editor-grid .ui-field:last-child { grid-column:1/-1; }
.ay-order-editor-grid > .ay-checkbox-field { grid-column:1/-1; margin:0; }
.ay-order-editor-grid textarea,.ay-order-confirm-dialog textarea { min-height:74px; resize:vertical; }
.ay-order-editor-footer { flex:0 0 auto; display:flex; justify-content:flex-end; gap:9px; padding:12px 17px; border-top:1px solid var(--ui-border); }
.ay-order-confirm-dialog > p { color:var(--ui-text-soft); font-size:.74rem; line-height:1.5; }
.ay-checkbox-field { display:flex; align-items:flex-start; gap:9px; margin:14px 0; color:var(--ui-text-soft); font-size:.74rem; line-height:1.45; }
.ay-checkbox-field input { flex:0 0 auto; margin-top:2px; }
.ay-order-confirm-dialog .ui-field { margin-top:12px; }
.ay-mobile-nav { display:none; }
.ay-nav-icon { width:20px; height:20px; fill:none; stroke:currentColor; stroke-width:1.8; stroke-linecap:round; stroke-linejoin:round; }
.ay-rail-button { text-decoration:none; cursor:pointer; }
.ay-rail-button span { line-height:1.05; }
.ay-patient-settings-form { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:12px; }
.ay-patient-settings-form .ui-field.is-wide,.ay-patient-settings-form .ay-checkbox-field.is-wide { grid-column:1/-1; }
.ay-patient-settings-form .ay-actions { grid-column:1/-1; align-items:center; }
.ay-settings-readonly { margin:0; color:var(--ui-muted); font-size:.68rem; }
.ay-message-composer,.ay-followup-create { display:grid; gap:10px; padding-top:12px; border-top:1px solid var(--ui-border); }
.ay-message-composer-actions { display:flex; align-items:center; justify-content:space-between; gap:10px; flex-wrap:wrap; }
.ay-file-button { display:inline-flex; align-items:center; min-height:36px; padding:8px 11px; border:1px solid var(--ui-border-strong); border-radius:var(--ui-radius-sm); color:var(--ui-text-soft); font-size:.68rem; cursor:pointer; }
.ay-file-button input { position:absolute; width:1px; height:1px; opacity:0; pointer-events:none; }
.ay-followup-create { grid-template-columns:minmax(0,1fr) 150px auto; align-items:end; }
.ay-followup-create p { grid-column:1/-1; }
.ay-complete-reopen { display:grid; gap:10px; margin-top:12px; }
.ay-alert-panel { position:fixed; bottom:12px; left:72px; z-index:98; width:min(320px,calc(100vw - 96px)); max-height:min(420px,calc(100dvh - 32px)); overflow:auto; padding:14px; border:1px solid var(--ui-border-strong); border-radius:var(--ui-radius); background:var(--ui-surface); box-shadow:var(--ui-shadow-popover); transform-origin:bottom left; opacity:0; transform:translateX(-6px) scale(.98); pointer-events:none; transition:opacity var(--ui-duration-standard) var(--ui-ease-out), transform var(--ui-duration-standard) var(--ui-ease-out); }
.ay-alert-panel.is-open { opacity:1; transform:translateX(0) scale(1); pointer-events:auto; }
@media (max-width:899px) {
  .ay-alert-panel { top:64px; bottom:auto; left:12px; right:12px; width:auto; transform-origin:top center; transform:translateY(-6px) scale(.98); }
  .ay-alert-panel.is-open { transform:translateY(0) scale(1); }
}
.ay-alert-panel header { display:flex; align-items:center; justify-content:space-between; gap:10px; }
.ay-alert-panel h2 { margin:0; color:var(--ui-text); font-size:.82rem; }
.ay-alert-panel ul { display:grid; gap:8px; margin:12px 0 0; padding:0; list-style:none; }
.ay-alert-panel li { display:flex; justify-content:space-between; gap:10px; padding:9px; border-radius:var(--ui-radius-sm); background:var(--ui-surface-muted); color:var(--ui-text-soft); font-size:.7rem; }
.ay-alert-panel li span { color:var(--ui-accent); font-weight:700; }
.ay-alert-panel > p { margin:12px 0 0; color:var(--ui-muted); font-size:.7rem; }
.ay-global-status { position:fixed; top:68px; left:50%; z-index:60; transform:translateX(-50%); pointer-events:none; margin:0; padding:9px 14px; border:1px solid var(--ui-success); border-radius:var(--ui-radius-sm); background:var(--ui-surface); color:var(--ui-success); box-shadow:var(--ui-shadow-card); font-size:.72rem; font-weight:800; }
@media (max-width:899px) { .ay-shell--workspace .ay-workspace-masthead:not(.dashboard-masthead) { padding:0 12px; } .ay-workspace-divider,.ay-workspace-section { display:none; } .ay-clinical-dashboard { display:block; padding-bottom:64px; } .ay-dashboard-rail { display:none; } .ay-clinical-workspace { height:calc(100dvh - 56px - 64px); display:block; } .ay-queue-sidebar { height:100%; padding:11px; } .ay-queue-toolbar { grid-template-columns:minmax(0,1fr) auto; } .ay-queue-toolbar select:last-child { grid-column:2; grid-row:1; width:40px; font-size:0; } .ay-queue-columns,.ay-detail-empty { display:none; } .ay-queue-list { border:0; border-radius:0; background:transparent; box-shadow:none; } .ay-queue-item { margin-bottom:9px; border:1px solid var(--ui-border); border-radius:var(--ui-radius-sm); background:var(--ui-surface); box-shadow:var(--ui-shadow-card); } .ay-queue-row { min-height:118px; grid-template-columns:36px minmax(0,1fr) auto; padding:13px; } .ay-queue-copy small { white-space:normal; display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; } .ay-queue-footer { display:none; } .ay-detail-pane { position:absolute; inset:0; z-index:40; border:0; background:var(--ui-canvas); animation:ay-chart-in .2s ease-out; } .ay-chart-header { grid-template-columns:1fr; gap:7px; padding:11px 44px 11px 13px; } .ay-chart-summary { display:none; } .ay-chart-cc { display:block; } .ay-chart-tabs { padding-inline:9px; } .ay-chart-body { padding:12px 11px 16px; } .ay-chart-footer { min-height:58px; padding:8px 11px max(8px,env(safe-area-inset-bottom)); flex-wrap:wrap; row-gap:8px; } .ay-mobile-nav { position:fixed; right:0; bottom:0; left:0; z-index:60; height:64px; display:flex; justify-content:space-around; padding:5px max(7px,env(safe-area-inset-right)) max(5px,env(safe-area-inset-bottom)); border-top:1px solid var(--ui-border); background:var(--ui-surface); } .ay-mobile-nav button { position:relative; width:25%; max-width:105px; display:grid; place-items:center; gap:2px; border:0; border-radius:var(--ui-radius-sm); background:transparent; color:var(--ui-muted); font-size:.61rem; font-weight:650; } .ay-mobile-nav button b { position:absolute; top:1px; right:18%; min-width:16px; padding:1px 4px; border-radius:999px; background:var(--ui-accent); color:#fff; font-size:.56rem; } .ay-mobile-nav button.is-selected { background:var(--ui-accent-soft); color:var(--ui-accent); } .ay-clinical-dashboard.has-selection .ay-mobile-nav { display:none; } }
@media (max-width:899px) { .ay-wellness-home,.ay-messages-layout,.ay-plan-layout,.ay-patient-settings-layout,.ay-complete-layout { grid-template-columns:1fr; } .ay-clinical-card { padding:16px; } .ay-wellness-summary { grid-template-columns:1fr 1fr; } .ay-note-body { height:48dvh; } .ay-chart-body > .ay-note-fill { height:auto; } .ay-generated-layout.ay-note-fill .ay-generated-editor,.ay-generated-layout.ay-note-fill .ay-note-card,.ay-generated-layout.ay-note-fill .ay-plan-card,.ay-complete-layout.ay-note-fill .ay-complete-record-card,.ay-complete-layout.ay-note-fill .ay-complete-plan-card { height:auto; } .ay-note-fill .ay-note-body { flex:none; height:48dvh; resize:vertical; } .ay-chart-body > .ay-instructions-layout { height:auto; } .ay-instructions-layout .ay-instructions-card { height:auto; } .ay-instructions-layout .ay-instructions-card .ay-plan-body { flex:none; height:48dvh; resize:vertical; } .ay-chart-body > .ay-documents-fill { height:auto; } .ay-documents-fill .clinical-document-list,.ay-documents-fill .ay-section-empty { flex:none; max-height:48dvh; overflow:auto; } .ay-chart-body > .ay-assessment-fill { height:auto; } .ay-assessment-layout { grid-template-rows:auto; } .ay-assessment-note-card,.ay-assessment-section { height:auto; overflow:visible; } .ay-assessment-note-card .ay-note-body--readonly { flex:none; max-height:42dvh; } .ay-assessment-fill .ay-assessment-accordion,.ay-assessment-fill .ay-section-empty { flex:none; max-height:48dvh; overflow:auto; } .ay-data-layout { grid-template-columns:1fr; } .ay-chart-body > .ay-data-fill { height:auto; } .ay-data-fill .ay-data-key-card,.ay-data-fill .ay-data-intake-card { height:auto; max-height:48dvh; } .ay-data-intake-body { flex:none; height:48dvh; } .ay-plan-meta { grid-template-columns:1fr 1fr; } .ay-plan-body { max-height:none; } .ay-order-details,.ay-order-dates { grid-template-columns:1fr 1fr; } .ay-complete-record { max-height:none; } }
@media (max-width:600px) { .ay-patient-settings-form,.ay-followup-create { grid-template-columns:1fr; } .ay-patient-settings-form .ui-field.is-wide { grid-column:auto; } }
@media (max-width:600px) { .ay-plan-card__header { flex-direction:column; } .ay-plan-status { align-self:flex-start; } .ay-plan-body { min-height:220px; padding:15px; } }
@media (max-width:899px) { .ay-chart-highlights { grid-template-columns:84px minmax(0,1fr) auto; gap:8px; } .ay-copy-chip { width:32px; height:32px; } .ay-assessment-accordion summary { align-items:flex-start; flex-direction:column; gap:4px; } .ay-data-records article header { align-items:flex-start; flex-direction:column; gap:4px; } .ay-wellness-trend-averages { grid-template-columns:repeat(2,minmax(0,1fr)); } .ay-followup-detail dl { grid-template-columns:1fr; } }
@media (max-width:600px) { .document-filter { grid-template-columns:1fr 1fr; } .ay-document-row { grid-template-columns:minmax(0,1fr); } .clinical-document-actions .ay-button { width:100%; } .ay-documents-fill .ay-document-row { grid-template-columns:minmax(0,1fr) auto; align-items:center; } .ay-documents-fill .clinical-document-actions .ay-button { width:auto; min-width:0; padding-inline:9px; } .ay-document-preview-modal { padding:9px; } .ay-document-preview-dialog { height:calc(100dvh - 18px); } .ay-document-preview-header { padding:12px; } .ay-document-preview-stage { padding:8px; } .ay-document-preview-footer { padding:9px; } .ay-orders-intro,.ay-order-card__header,.ay-patient-settings-card .ay-clinical-card__header,.ay-complete-record-card .ay-clinical-card__header { flex-direction:column; } .ay-order-status,.ay-orders-count,.ay-patient-settings-status,.ay-complete-state { align-self:flex-start; } .ay-order-details,.ay-order-dates,.ay-patient-settings-list,.ay-complete-dates { grid-template-columns:1fr; } .ay-order-editor-grid { grid-template-columns:1fr; padding:14px 12px; } .ay-order-editor-grid .ui-field:has(textarea),.ay-order-editor-grid .ui-field:last-child { grid-column:auto; } .ay-order-editor-header { padding:12px; } .ay-order-editor-dialog > .ay-order-disclosure { margin-inline:12px; } .ay-order-editor-footer { padding:10px 12px; flex-wrap:wrap; } .ay-order-editor-footer .ay-button { flex:1 1 auto; } .ay-patient-settings-handoff { align-items:flex-start; flex-direction:column; } .ay-complete-record { min-height:300px; padding:14px; } .ay-complete-workflow li { grid-template-columns:28px minmax(0,1fr); } .ay-complete-step-state { grid-column:2; } }
@keyframes ay-chart-in { from { transform:translateX(100%); } to { transform:translateX(0); } }
@media (prefers-reduced-motion: reduce) { .ay-spinner { animation:none; } }

/* Session-only clinic setup assistant. It uses the same tokens as every clinical surface. */
.ay-settings-assistant-launcher { position:fixed; right:22px; z-index:80; display:inline-flex; align-items:center; gap:8px; padding:9px 14px; border:1px solid var(--ui-accent-fill); background:var(--ui-accent-fill); color:var(--ui-on-accent); font:inherit; font-size:.76rem; font-weight:750; cursor:pointer; }
.ay-settings-assistant-launcher:hover { background:var(--ui-accent-hover); }
.ay-settings-assistant { position:fixed; right:20px; bottom:84px; z-index:90; width:min(410px,calc(100vw - 32px)); max-height:min(720px,calc(100dvh - 104px)); display:flex; flex-direction:column; overflow:hidden; border:1px solid var(--ui-border-strong); border-radius:var(--ui-radius); background:var(--ui-surface); }
.ay-settings-assistant > header { flex:0 0 auto; display:flex; align-items:center; justify-content:space-between; gap:12px; padding:12px 14px; border-bottom:1px solid var(--ui-border); background:var(--ui-accent-soft); }
.ay-settings-assistant > header strong,.ay-settings-assistant > header small { display:block; }
.ay-settings-assistant > header strong { color:var(--ui-text); font-size:.82rem; }
.ay-settings-assistant > header small { margin-top:2px; color:var(--ui-muted); font-size:.72rem; }
.ay-settings-assistant-window-actions { display:flex; gap:5px; }
.ay-settings-assistant-window-actions button,.ay-settings-assistant > footer button { border:0; background:transparent; color:var(--ui-text-soft); font:inherit; cursor:pointer; }
.ay-settings-assistant-window-actions button { width:30px; height:30px; border-radius:var(--ui-radius-sm); font-size:1.1rem; }
.ay-settings-assistant-window-actions button:hover { background:var(--ui-surface); color:var(--ui-accent); }
.ay-settings-assistant.is-minimized { max-height:none; }
.ay-settings-assistant-paths { display:grid; grid-template-columns:1fr 1fr; gap:8px; padding:14px; }
.ay-settings-assistant-paths p { grid-column:1/-1; margin:0 0 3px; color:var(--ui-text-soft); font-size:.72rem; }
.ay-settings-assistant-paths button { min-height:40px; padding:8px 10px; border:1px solid var(--ui-border); border-radius:var(--ui-radius-sm); background:var(--ui-surface-muted); color:var(--ui-text); font:inherit; font-size:.69rem; font-weight:650; text-align:left; cursor:pointer; }
.ay-settings-assistant-paths button:hover { border-color:var(--ui-accent); background:var(--ui-accent-soft); color:var(--ui-accent); }
.ay-settings-assistant-messages { flex:1 1 auto; min-height:150px; overflow:auto; display:grid; align-content:start; gap:9px; padding:14px; background:var(--ui-canvas); }
.ay-settings-assistant-messages article { width:fit-content; max-width:88%; padding:9px 11px; border:1px solid var(--ui-border); border-radius:var(--ui-radius-sm); background:var(--ui-surface); }
.ay-settings-assistant-messages article.is-admin { justify-self:end; border-color:var(--ui-accent-border); background:var(--ui-accent-soft); }
.ay-settings-assistant-messages article strong { display:block; margin-bottom:3px; color:var(--ui-muted); font-size:.59rem; text-transform:uppercase; }
.ay-settings-assistant-messages article p { margin:0; color:var(--ui-text); font-size:.71rem; line-height:1.48; white-space:pre-wrap; }
.ay-settings-assistant-thinking { display:flex; align-items:center; gap:7px; margin:0; color:var(--ui-muted); font-size:.68rem; }
.ay-settings-assistant-proposal { flex:0 0 auto; display:grid; gap:7px; padding:12px 14px; border-top:1px solid var(--ui-accent-border); border-bottom:1px solid var(--ui-accent-border); background:var(--ui-accent-soft); }
.ay-settings-assistant-proposal > strong { color:var(--ui-text); font-size:.73rem; }
.ay-settings-assistant-proposal p,.ay-settings-assistant-proposal small { margin:0; color:var(--ui-text-soft); font-size:.67rem; line-height:1.45; }
.ay-settings-assistant-proposal ul { display:flex; flex-wrap:wrap; gap:5px; margin:0; padding:0; list-style:none; }
.ay-settings-assistant-proposal li button { padding:4px 7px; border:1px solid var(--ui-accent-border); border-radius:var(--ui-radius-sm); background:var(--ui-surface); color:var(--ui-accent); font:inherit; font-size:.61rem; cursor:pointer; }
.ay-settings-assistant-proposal > div { display:flex; gap:7px; }
.ay-settings-assistant-proposal .ay-button { padding:7px 10px; font-size:.67rem; }
.ay-settings-assistant-error { margin:0; padding:9px 14px; border-bottom:1px solid var(--ui-danger-border); background:var(--ui-danger-soft); color:var(--ui-danger); font-size:.68rem; }
.ay-settings-assistant-composer { flex:0 0 auto; display:grid; grid-template-columns:minmax(0,1fr) auto; align-items:end; gap:8px; padding:11px 14px; }
.ay-settings-assistant-composer textarea { min-width:0; min-height:58px; max-height:120px; resize:vertical; padding:9px 10px; border:1px solid var(--ui-border-strong); border-radius:var(--ui-radius-sm); background:var(--ui-surface); color:var(--ui-text); font:inherit; font-size:.71rem; }
.ay-settings-assistant-composer .ay-button { min-height:38px; padding:8px 11px; font-size:.69rem; }
.ay-settings-assistant > footer { display:flex; justify-content:space-between; gap:12px; padding:8px 14px; border-top:1px solid var(--ui-border); color:var(--ui-muted); font-size:.61rem; }
.ay-settings-assistant > footer button { padding:0; color:var(--ui-accent); font-size:inherit; }
@media (max-width:600px) { .ay-settings-assistant-launcher { right:12px; bottom:12px; } .ay-settings-assistant { inset:auto 0 72px; width:100%; max-height:min(66dvh,720px); border-right:0; border-left:0; border-radius:var(--ui-radius) var(--ui-radius) 0 0; } .ay-settings-assistant-paths { grid-template-columns:1fr; } .ay-settings-assistant-composer { padding-bottom:max(11px,env(safe-area-inset-bottom)); } }

/* Clinical settings keeps the React workspace layout while consuming the
   canonical clinical-ui tokens and control classes. */
.ay-settings-page { position:relative; width:100%; min-width:0; min-height:0; height:100%; display:grid; grid-template-columns:220px minmax(0,1fr); overflow:hidden; background:var(--ui-canvas); }
.ay-settings-page > .ay-note-status { position:absolute; top:10px; right:18px; z-index:20; max-width:min(520px,calc(100% - 256px)); margin:0; }
.ay-settings-step-nav { min-width:0; min-height:0; z-index:5; display:grid; align-content:start; gap:4px; padding:18px 12px 76px; border-right:1px solid var(--ui-border); background:var(--ui-surface); overflow-x:hidden; overflow-y:auto; overscroll-behavior:contain; }
.ay-settings-step-nav > strong { padding:4px 9px 10px; color:var(--ui-muted); letter-spacing:.05em; text-transform:uppercase; }
.ay-settings-step-nav button { display:grid; grid-template-columns:24px minmax(0,1fr); align-items:center; gap:8px; width:100%; padding:8px 9px; border:1px solid transparent; border-radius:var(--ui-radius-sm); background:transparent; color:var(--ui-text-soft); font:inherit; text-align:left; cursor:pointer; }
.ay-settings-step-nav button span { width:22px; height:22px; display:grid; place-items:center; border:1px solid var(--ui-border-strong); border-radius:50%; color:var(--ui-muted); }
.ay-settings-step-nav button:hover,.ay-settings-step-nav button.is-selected { border-color:var(--ui-accent-border); background:var(--ui-accent-soft); color:var(--ui-accent); }
.ay-settings-editor { min-width:0; min-height:0; height:100%; overflow-x:hidden; overflow-y:auto; overscroll-behavior:contain; -webkit-overflow-scrolling:touch; padding:20px 24px 94px; }
.ay-settings-editor__header { display:flex; align-items:flex-start; justify-content:space-between; gap:18px; max-width:1120px; margin:0 auto 14px; }
.ay-settings-editor__header h1 { margin:4px 0 0; color:var(--ui-text); font-size:1.3rem; line-height:1.2; }
.ay-settings-editor__header p:not(.ay-eyebrow) { margin:5px 0 0; color:var(--ui-muted); font-size:.74rem; line-height:1.5; }
.ay-settings-editor > .config-status,.ay-settings-editor > .platform-floor,.ay-settings-editor > .config-grid,.ay-settings-editor > .ay-note-status { width:min(100%,1120px); margin-right:auto; margin-left:auto; }
.ay-settings-editor > .config-grid { margin-top:0; }
.ay-settings-editor .config-card { border-radius:var(--ui-radius); }
.ay-settings-editor .ay-patient-settings-form { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:13px 15px; }
.ay-settings-toggle-card { grid-column:1/-1; min-width:0; margin:0; padding:15px 16px 16px; border:1px solid var(--ui-border); border-radius:var(--ui-radius); background:var(--ui-surface-soft); }
.ay-settings-toggle-card legend { padding:0 6px; color:var(--ui-text); font-size:.78rem; font-weight:750; }
.ay-settings-toggle-card > p { margin:3px 0 13px; color:var(--ui-muted); font-size:.7rem; line-height:1.45; }
.ay-settings-toggle-grid { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:9px 16px; }
.ay-settings-toggle-grid .check-field { min-width:0; min-height:42px; display:grid; align-content:center; margin:0; padding:7px 9px; border:1px solid var(--ui-border); border-radius:var(--ui-radius-sm); background:var(--ui-surface); }
.ay-settings-toggle-grid .ay-switch-row { min-height:34px; }
.ay-settings-editor .ui-field__label { min-height:22px; display:flex; align-items:center; justify-content:flex-start; gap:2px; padding:0; color:var(--ui-text-soft); font-size:.73rem; font-weight:650; line-height:1.4; }
.ay-settings-editor .ui-field__label label, .ay-settings-advanced .ui-field__label label { margin:0; color:inherit; font:inherit; cursor:default; }
fieldset.ay-role-field { min-width:0; margin:0; padding:0; border:0; }
fieldset.ay-role-field > legend { padding:0; }
/* On/off settings are switches: the setting's own name labels the control, and the switch itself shows on or off.
   The real checkbox stays underneath (invisible but focusable) so keyboard and screen readers behave as a checkbox. */
.ay-switch-row { display:flex; align-items:center; gap:2px; min-height:32px; }
.ay-switch { position:relative; display:inline-flex; align-items:center; gap:10px; min-height:32px; color:var(--ui-text-soft); font-size:.73rem; font-weight:650; line-height:1.4; cursor:pointer; }
.ay-switch input { position:absolute; inset:0; width:100%; height:100%; margin:0; opacity:0; cursor:pointer; }
.ay-switch__track { position:relative; flex:0 0 auto; width:34px; height:20px; border:1px solid var(--ui-border-strong); border-radius:999px; background:var(--ui-surface-muted); transition:background-color 140ms ease-out, border-color 140ms ease-out; }
.ay-switch__track::after { content:""; position:absolute; top:2px; left:2px; width:14px; height:14px; border-radius:50%; background:var(--ui-surface); box-shadow:0 1px 2px rgba(20,30,35,.28); transition:transform 160ms var(--ui-ease-out, cubic-bezier(.23,1,.32,1)); }
.ay-switch input:checked + .ay-switch__track { border-color:var(--ui-accent-fill); background:var(--ui-accent-fill); }
.ay-switch input:checked + .ay-switch__track::after { transform:translateX(14px); }
.ay-switch input:focus-visible + .ay-switch__track { box-shadow:var(--ui-focus); }
.ay-switch input:disabled + .ay-switch__track, .ay-switch input:disabled ~ .ay-switch__text { opacity:.55; cursor:not-allowed; }
@media (prefers-reduced-motion: reduce) { .ay-switch__track::after { transition:none; } }
.ay-role-choices .ay-switch { min-height:36px; }
/* Eligibility rules: four cards with one style, in columns that wrap instead of squeezing (no clipped dropdowns). */
.ay-settings-editor .ay-settings-content-grid { display:grid; grid-template-columns:repeat(auto-fit, minmax(min(100%, 300px), 1fr)); gap:16px; margin-top:0; }
.ay-policy-card { min-width:0; padding:16px; border:1px solid var(--ui-border); border-radius:var(--ui-radius); background:var(--ui-surface); }
.ay-policy-card > h3 { margin:0 0 12px; }
.ay-policy-card .ay-patient-settings-form { grid-template-columns:minmax(0,1fr); }
/* Standard questions: a compact row each (switch + current wording); "Edit Wording" opens the wording field. */
.ay-question-list { display:grid; border:1px solid var(--ui-border); border-radius:var(--ui-radius); background:var(--ui-surface); overflow:hidden; }
.ay-question-row { padding:8px 14px; border-top:1px solid var(--ui-border); }
.ay-question-row:first-child { border-top:0; }
.ay-question-row__head { display:flex; align-items:center; justify-content:space-between; gap:12px; }
.ay-question-row__toggle { flex:none; min-height:32px; padding:0 10px; border:0; border-radius:var(--ui-radius-sm); background:transparent; color:var(--ui-accent); font:inherit; font-size:.73rem; font-weight:650; cursor:pointer; transition:background-color 140ms ease-out; }
@media (hover: hover) and (pointer: fine) { .ay-question-row__toggle:hover { background:var(--ui-accent-soft); } }
.ay-question-row__preview { margin:0 0 4px 44px; overflow:hidden; color:var(--ui-muted); font-size:.72rem; line-height:1.4; text-overflow:ellipsis; white-space:nowrap; }
.ay-question-row.is-off .ay-question-row__preview { opacity:.6; }
.ay-question-row__body { margin:6px 0 8px 44px; }
/* Sub-sections inside a step are ruled sections, not cards inside a card; headings get room above them. */
.ay-subsection { margin-top:22px; padding-top:20px; border-top:1px solid var(--ui-border); }
.ay-subsection > h3 { margin-top:0; }
.ay-subsection > .ui-field + .ui-field, .ay-subsection > .ui-field + button { margin-top:14px; }
.ay-settings-editor h3 { margin:24px 0 10px; }
.ay-settings-editor .ay-clinical-card__header h3, .ay-settings-editor .ay-policy-card > h3, .ay-settings-editor .ay-subsection > h3 { margin-top:0; }
.ay-settings-editor .step-heading { display:grid; gap:6px; margin-bottom:20px; }
.ay-settings-editor .step-heading :where(h2,p) { margin:0; }
.ay-settings-editor .step-heading p { max-width:76ch; color:var(--ui-muted); line-height:1.55; }
.ay-settings-section-stack { display:grid; gap:20px; }
.ay-settings-group-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:16px; }
.ay-settings-group-card { min-width:0; display:grid; align-content:start; gap:16px; padding:18px; border:1px solid var(--ui-border); border-radius:var(--ui-radius); background:var(--ui-surface-soft); }
.ay-settings-group-card--wide { grid-column:1/-1; }
.ay-settings-group-card--wide .ay-patient-settings-form { grid-template-columns:repeat(2,minmax(0,1fr)); }
.ay-ai-prompt-field { min-height:360px; font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace; font-size:.72rem; line-height:1.55; resize:vertical; }
.ay-settings-group-card > header { display:grid; gap:4px; }
.ay-settings-group-card > header :where(h3,p) { margin:0; }
.ay-settings-group-card > header h3 { font-size:.86rem; }
.ay-settings-group-card > header p { color:var(--ui-muted); font-size:.72rem; line-height:1.5; }
.ay-settings-field-card-grid,.ay-workflow-stage-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:16px; }
.ay-settings-field-card { min-width:0; display:grid; align-content:start; gap:12px; padding:16px; border:1px solid var(--ui-border); border-radius:var(--ui-radius); background:var(--ui-surface-soft); }
.ay-settings-field-card > .ui-field { height:100%; align-content:start; }
.ay-settings-field-card textarea { min-height:112px; }
.ay-settings-policy-link > h3,.ay-settings-policy-link > p { margin:0; }
.ay-settings-policy-link > h3 { font-size:.8rem; }
.ay-settings-policy-link > p { color:var(--ui-muted); font-size:.7rem; line-height:1.45; }
.ay-settings-content-grid.ay-eligibility-grid { grid-template-columns:repeat(2,minmax(0,1fr)); align-items:stretch; }
.ay-eligibility-grid .ay-policy-card { height:100%; }
.ay-settings-section-check { display:grid; justify-items:start; gap:10px; margin-top:18px; padding-top:18px; border-top:1px solid var(--ui-border); }
.ay-settings-check-button { min-height:42px; border:1px solid var(--ui-accent-border); background:var(--ui-accent-soft); color:var(--ui-accent); }
.ay-settings-section-check.is-approved .ay-settings-check-button { border-color:var(--ui-success); background:var(--ui-success); color:#fff; }
.ay-settings-check-button svg,.ay-settings-check-message svg,.ay-icon-text-action svg,.ay-settings-subsection-heading .ay-button svg { width:17px; height:17px; flex:none; fill:none; stroke:currentColor; stroke-width:1.8; stroke-linecap:round; stroke-linejoin:round; }
.ay-settings-check-message { display:flex; align-items:flex-start; gap:9px; max-width:70ch; margin:0; font-size:.72rem; line-height:1.5; }
.ay-settings-check-message.is-warning { padding:11px 12px; border:1px solid var(--ui-warning-border,var(--ui-danger-border)); border-radius:var(--ui-radius-sm); background:var(--ui-warning-soft,var(--ui-danger-soft)); color:var(--ui-text); }
.ay-settings-check-message.is-warning strong { color:var(--ui-text); }
.ay-settings-check-message.is-warning ul { margin:5px 0 0; padding-left:18px; }
.ay-settings-check-message.is-success { color:var(--ui-success); font-weight:650; }
.ay-note-format-description { margin:0; padding:11px 12px; border:1px solid var(--ui-accent-border); border-radius:var(--ui-radius-sm); background:var(--ui-accent-soft); color:var(--ui-text-soft); font-size:.72rem; line-height:1.5; }
.ay-settings-subsection-heading { display:flex; align-items:center; justify-content:space-between; gap:14px; margin-top:4px; }
.ay-settings-subsection-heading :where(h4,p) { margin:0; }
.ay-settings-subsection-heading h4 { color:var(--ui-text); font-size:.8rem; }
.ay-settings-subsection-heading p { margin-top:3px; color:var(--ui-muted); font-size:.69rem; line-height:1.45; }
.ay-settings-subsection-heading .ay-button { min-height:40px; }
.ay-settings-field-card__heading { display:flex; align-items:center; justify-content:space-between; gap:10px; }
.ay-settings-field-card__heading h4 { min-width:0; margin:0; overflow:hidden; color:var(--ui-text); font-size:.78rem; text-overflow:ellipsis; white-space:nowrap; }
.ay-icon-text-action { min-height:36px; display:inline-flex; align-items:center; gap:6px; padding:6px 9px; border:1px solid var(--ui-border); border-radius:var(--ui-radius-sm); background:var(--ui-surface); color:var(--ui-text-soft); font:inherit; font-size:.68rem; font-weight:650; cursor:pointer; }
.ay-icon-text-action.is-danger { border-color:var(--ui-danger-border); color:var(--ui-danger); }
.ay-advanced-nav-button { min-height:40px; display:block; text-align:left; color:var(--ui-text); font-size:.76rem; font-weight:700; }
/* Text floor: nothing on this page is set below 12px (the page root is 17px, so these are rem values that land just above it). */
.ay-settings-step-nav > strong { font-size:.72rem; }
.ay-settings-step-nav button span { font-size:.72rem; }
.ay-settings-editor .ay-status-pill, .ay-settings-editor small, .ay-settings-advanced small { font-size:.72rem; }
.ay-settings-footer .ay-button, .ay-settings-footer button { font-size:max(.74rem,12px); }
.ay-settings-content-grid { margin-top:0; }
.ay-settings-preview-grid { grid-template-columns:repeat(auto-fit,minmax(280px,1fr)); margin-top:18px; }
.ay-settings-editor :where(input,textarea,select)[aria-invalid="true"] { border-color:var(--ui-danger); box-shadow:0 0 0 2px color-mix(in srgb,var(--ui-danger) 14%,transparent); }
.ay-settings-editor :where(input[type="checkbox"],input[type="radio"]) { width:17px; height:17px; min-width:17px; flex:0 0 17px; margin:2px 0 0; accent-color:var(--ui-accent); }
.ay-settings-editor select.ui-input { min-height:40px; padding-right:34px; }
/* The "Fix these settings" list: one row per problem (where it is, what is wrong) with a compact Review action on the right. */
.ay-settings-editor .ay-note-status--error > div { flex:1; min-width:0; }
.ay-settings-editor .ay-note-status--error ul { margin:8px 0 0; padding:0; list-style:none; display:grid; }
.ay-settings-editor .ay-note-status--error li { display:flex; align-items:center; justify-content:space-between; gap:14px; padding:8px 0; border-top:1px solid var(--ui-danger-border); }
.ay-settings-editor .ay-note-status--error li > span { min-width:0; display:grid; gap:2px; font-size:.78rem; line-height:1.4; overflow-wrap:anywhere; }
.ay-settings-editor .ay-note-status--error li small { color:color-mix(in srgb, var(--ui-danger) 78%, var(--ui-text)); font-size:.66rem; font-weight:700; letter-spacing:.02em; }
.ay-role-choices { display:flex; flex-wrap:wrap; gap:6px 18px; padding-top:2px; }
.ay-settings-error-review { flex:none; min-height:30px; padding:0 12px; border:1px solid var(--ui-danger-border); border-radius:999px; background:transparent; color:var(--ui-danger); font:inherit; font-size:.72rem; font-weight:650; cursor:pointer; transition:background-color 140ms ease-out; }
.ay-settings-error-review:hover, .ay-settings-error-review:focus-visible { background:color-mix(in srgb, var(--ui-danger) 10%, transparent); }
/* Dropdowns on the settings page carry a down chevron at the right (same 1.8 outline language as the other icons), so a
   dropdown reads differently from a text field. It nudges toward the accent on hover and focus. */
html[data-theme-surface="clinic-configuration"] select:not([multiple]):not([size]) {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 38px;
  background-color: var(--ui-surface);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236b7880' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 16px 16px;
  cursor: pointer;
}
html[data-theme-surface="clinic-configuration"] select:not([multiple]):not([size]):hover,
html[data-theme-surface="clinic-configuration"] select:not([multiple]):not([size]):focus-visible { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2314506a' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); }
html[data-theme-surface="clinic-configuration"].dark select:not([multiple]):not([size]) { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23aab7b4' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); }
html[data-theme-surface="clinic-configuration"].dark select:not([multiple]):not([size]):hover,
html[data-theme-surface="clinic-configuration"].dark select:not([multiple]):not([size]):focus-visible { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23aab7b4' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); }
html[data-theme-surface="clinic-configuration"] select:not([multiple]):not([size]):disabled { cursor: not-allowed; opacity: .6; }

.ay-settings-editor textarea.ui-input { min-height:92px; line-height:1.45; }
.ay-settings-editor .ay-actions { gap:8px; margin-top:14px; }
.ay-settings-section-title { display:flex; align-items:center; gap:7px; min-width:0; }
.ay-settings-section-title .clinic-settings-info { flex:none; }
.ay-intake-location-field { padding-bottom:20px; }
.ay-intake-settings-stack { display:grid; gap:0; }
.ay-intake-settings-stack > :not(:first-child) { margin-top:24px; padding-top:24px; border-top:1px solid var(--ui-border); }
.ay-referral-rules { display:grid; gap:12px; grid-column:1/-1; }
.ay-referral-rules__heading { display:flex; align-items:center; justify-content:space-between; gap:12px; }
.ay-referral-rules__heading h3 { margin:0; }
.ay-referral-rules__empty { display:grid; justify-items:start; gap:12px; padding:18px; border:1px dashed var(--ui-border-strong); border-radius:var(--ui-radius-sm); background:var(--ui-surface-muted); }
.ay-referral-rules__empty p { margin:0; color:var(--ui-muted); font-size:.76rem; }
.ay-referral-rules__actions { display:flex; justify-content:flex-start; }
.ay-referral-card { display:flex; flex-direction:column; gap:0; padding:0; overflow:hidden; }
.ay-referral-card__head { display:flex; align-items:center; justify-content:space-between; gap:12px; min-height:54px; padding:10px 14px; }
.ay-referral-card h4 { flex:1 1 auto; min-width:0; margin:0; color:var(--ui-text); font-size:.82rem; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.ay-referral-card__toggle { flex:0 0 auto; min-width:64px; min-height:30px; padding:0 12px; border:1px solid var(--ui-border-strong); border-radius:999px; background:transparent; color:var(--ui-accent); font:inherit; font-size:.72rem; font-weight:700; cursor:pointer; }
.ay-referral-card__toggle:hover, .ay-referral-card__toggle:focus-visible { background:var(--ui-accent-soft); }
.ay-referral-card__body { display:grid; gap:14px; padding:0 14px 14px; }
.ay-referral-editor-grid { grid-template-columns:repeat(2,minmax(0,1fr)); gap:12px 14px; }
.ay-referral-editor-grid > .ui-field:nth-child(5), .ay-referral-availability { grid-column:1/-1; }
.ay-referral-editor-grid textarea { min-height:72px; }
.ay-referral-availability { display:grid; gap:6px; }
.ay-referral-availability__label { color:var(--ui-muted); font-size:.7rem; font-weight:700; }
.ay-referral-availability__fields { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:12px 14px; }
.ay-referral-card__footer { display:flex; align-items:center; justify-content:space-between; gap:12px; padding-top:12px; border-top:1px solid var(--ui-border); }
.ay-referral-card__footer .check-field { margin:0; }
@media (pointer: coarse) { .ay-referral-card__toggle { min-height:44px; } }
@media (max-width:600px) { .ay-referral-editor-grid,.ay-referral-availability__fields { grid-template-columns:1fr; } .ay-referral-editor-grid > .ui-field:nth-child(5) { grid-column:auto; } }
.ay-settings-page .ay-clinical-workspace { height:auto; min-height:0; overflow:visible; }
.ay-settings-page .ay-content > .ay-clinical-card,.ay-settings-advanced { scroll-margin-top:72px; }
.ay-settings-advanced { display:grid; gap:14px; padding:20px; border:1px solid var(--ui-border); border-radius:var(--ui-radius); background:var(--ui-surface); box-shadow:var(--ui-shadow-card); }
/* Help icons beside settings: just a small outlined glyph (no button chrome), quiet until hovered or focused.
   The bubble opens on hover, keyboard focus, or a tap (the .is-open class), and is always in the DOM for
   aria-describedby. Same 1.8 outline language as the chat and dashboard icons. */
.clinic-settings-info { position:relative; display:inline-flex; margin-left:4px; vertical-align:middle; }
.clinic-settings-info > .clinic-settings-info__button { width:24px; height:24px; min-width:0; min-height:0; display:inline-grid; place-items:center; margin:-4px 0; padding:0; border:0; border-radius:50%; background:transparent; box-shadow:none; color:var(--ui-muted); cursor:help; transition:color 140ms ease-out, background-color 140ms ease-out; }
.clinic-settings-info__button svg { width:15px; height:15px; fill:none; stroke:currentColor; stroke-width:1.8; stroke-linecap:round; stroke-linejoin:round; }
.clinic-settings-info.is-open > .clinic-settings-info__button,
.clinic-settings-info > .clinic-settings-info__button:focus-visible { color:var(--ui-accent); background:var(--ui-accent-soft); }
@media (hover: hover) and (pointer: fine) { .clinic-settings-info > .clinic-settings-info__button:hover { color:var(--ui-accent); background:var(--ui-accent-soft); } }
@media (pointer: coarse) { .clinic-settings-info > .clinic-settings-info__button { width:32px; height:32px; margin:-8px -4px; } }
.clinic-settings-info > .clinic-settings-info__bubble { position:absolute; top:calc(100% + 4px); right:-6px; z-index:10; width:min(260px,70vw); padding:8px 10px; border:1px solid var(--ui-border); border-radius:var(--ui-radius-sm); background:var(--ui-surface); color:var(--ui-text-soft); box-shadow:var(--ui-shadow-card); font-size:.72rem; font-weight:500; line-height:1.45; pointer-events:none; opacity:0; visibility:hidden; transform:translateY(2px); transition:opacity 120ms ease-out, transform 120ms ease-out, visibility 0s linear 120ms; }
.clinic-settings-info.is-open > .clinic-settings-info__bubble,
.clinic-settings-info:has(> .clinic-settings-info__button:focus-visible) > .clinic-settings-info__bubble { opacity:1; visibility:visible; transform:translateY(0); transition:opacity 120ms ease-out, transform 120ms ease-out, visibility 0s; }
@media (hover: hover) and (pointer: fine) { .clinic-settings-info:hover > .clinic-settings-info__bubble { opacity:1; visibility:visible; transform:translateY(0); transition:opacity 120ms ease-out 120ms, transform 120ms ease-out 120ms, visibility 0s linear 120ms; } }
@media (prefers-reduced-motion: reduce) { .clinic-settings-info > .clinic-settings-info__bubble { transform:none; transition:opacity 1ms; } }
/* On phones a right-aligned 260px bubble would run off the left edge, so inside a field it spans the field's width, just under the label row. */
@media (max-width: 640px) {
  .ui-field { position:relative; }
  .ui-field .clinic-settings-info { position:static; }
  .ui-field .clinic-settings-info > .clinic-settings-info__bubble { top:30px; right:0; left:0; width:auto; }
}
.ay-settings-dialog-backdrop { position:fixed; inset:0; z-index:400; display:grid; place-items:center; padding:18px; background:var(--ui-overlay); }
.ay-settings-dialog { width:min(100%,460px); padding:20px; border:1px solid var(--ui-border-strong); border-radius:var(--ui-radius); background:var(--ui-surface); }
.ay-settings-dialog h2 { margin:0; color:var(--ui-text); font-size:1rem; }
.ay-settings-dialog header p { margin:6px 0 16px; color:var(--ui-muted); font-size:.72rem; line-height:1.5; }
.ay-settings-dialog form { display:grid; gap:10px; }
.ay-settings-dialog label { color:var(--ui-text-soft); font-size:.7rem; font-weight:750; }
@media (max-width:899px) {
  .ay-settings-page { grid-template-columns:minmax(0,1fr); grid-template-rows:auto minmax(0,1fr); }
  .ay-settings-page > .ay-note-status { top:58px; right:10px; left:10px; max-width:none; }
  .ay-settings-step-nav { display:flex; overflow-x:auto; overflow-y:hidden; padding:8px; border-right:0; border-bottom:1px solid var(--ui-border); scrollbar-width:thin; }
  .ay-settings-step-nav > strong { display:none; }
  .ay-settings-step-nav button { flex:0 0 auto; width:auto; min-height:38px; white-space:nowrap; }
  /* Fade the right edge (with a spacer so the last step can scroll clear of it) to show there are more steps. */
  .ay-settings-step-nav { -webkit-mask-image:linear-gradient(to right, #000 calc(100% - 36px), transparent); mask-image:linear-gradient(to right, #000 calc(100% - 36px), transparent); }
  .ay-settings-step-nav::after { content:""; flex:0 0 28px; }
  .ay-settings-editor { padding:16px 16px 92px; }
}
@media (max-width:600px) {
  .ay-settings-editor { padding:13px 11px 86px; }
  .ay-settings-editor__header { align-items:stretch; flex-direction:column; gap:8px; }
  .ay-settings-editor__header .ay-status-pill { align-self:flex-start; }
  .ay-settings-editor .ay-patient-settings-form,.ay-settings-editor .field-grid,.ay-settings-editor .policy-grid,.ay-settings-toggle-grid { grid-template-columns:minmax(0,1fr); }
  .ay-settings-editor .config-card { margin-bottom:11px; padding:15px; }
}

/* React intake foundation: one viewport, one transcript scroll owner, stable composer. */
.ay-intake-app { width:100%; height:100dvh; min-height:0; display:grid; overflow:hidden; background:var(--ui-canvas); color:var(--ui-text); }
.ay-intake-header { display:flex; align-items:center; justify-content:space-between; gap:16px; border-bottom:1px solid var(--ui-border); color:var(--ui-muted); font-size:.72rem; }
.ay-intake-brand { min-width:0; display:flex; align-items:center; gap:10px; color:var(--ui-text); text-decoration:none; }
.ay-intake-brand img,.ay-intake-brand > span { flex:0 0 36px; width:36px; height:36px; display:grid; place-items:center; object-fit:contain; border-radius:var(--ui-radius-sm); background:var(--ui-accent-soft); color:var(--ui-accent); }
.ay-intake-brand strong { overflow:hidden; font-size:.86rem; text-overflow:ellipsis; white-space:nowrap; }
.ay-intake-main { min-width:0; min-height:0; overflow-x:hidden; overflow-y:auto; overscroll-behavior:contain; -webkit-overflow-scrolling:touch; }
.ay-intake-startup { width:min(100%,760px); min-height:280px; display:grid; align-content:center; justify-items:start; gap:12px; margin:0 auto; padding:clamp(22px,4vw,42px); border:1px solid var(--ui-border); border-radius:var(--ui-radius); background:var(--ui-surface); box-shadow:var(--ui-shadow-card); }
.ay-intake-startup__icon { width:44px; height:44px; display:grid; place-items:center; border:1px solid var(--ui-accent-border); border-radius:var(--ui-radius-sm); background:var(--ui-accent-soft); color:var(--ui-accent); font-size:1.25rem; }
.ay-intake-startup h1 { margin:6px 0 0; color:var(--ui-text); font-size:clamp(1.25rem,2.5vw,1.7rem); }
.ay-intake-startup > p { max-width:60ch; margin:0; color:var(--ui-text-soft); font-size:.82rem; line-height:1.55; }
.ay-intake-startup__status { display:flex; align-items:center; gap:8px; margin-top:5px; color:var(--ui-muted); font-size:.72rem; }
.ay-intake-startup__actions { width:100%; display:flex; flex-wrap:wrap; gap:9px; margin-top:10px; }
.ay-intake-startup__actions .ay-button { min-width:150px; }
.ay-intake-transcript { width:min(100%,880px); display:grid; align-content:start; gap:16px; margin:0 auto; }
.ay-intake-notice { display:flex; align-items:flex-start; gap:10px; margin:0; padding:10px 13px; border:1px solid var(--ui-warning-border); border-radius:var(--ui-radius-sm); background:var(--ui-warning-soft); color:var(--ui-warning); font-size:max(.76rem,12px); line-height:1.45; text-align:left; }
.ay-intake-notice svg { width:18px; height:18px; flex:none; margin-top:1px; fill:none; stroke:currentColor; stroke-width:1.8; stroke-linecap:round; stroke-linejoin:round; }
.ay-intake-bubble { width:fit-content; border:1px solid var(--ui-border); color:var(--ui-text); }
.ay-intake-bubble p { margin:0; }
.ay-intake-bubble.is-patient { justify-self:end; border-color:var(--ui-accent-border); background:var(--ui-accent-soft); }
.ay-intake-edit { margin-top:7px; padding:0; border:0; background:transparent; color:var(--ui-accent); font:inherit; font-size:.68rem; text-decoration:underline; cursor:pointer; }
.ay-intake-workflow { width:min(100%,880px); display:grid; gap:16px; margin:0 auto; }
.ay-intake-progress { color:var(--ui-muted); font-size:.72rem; font-weight:700; }
.ay-intake-question,.ay-intake-boundary,.ay-intake-gate { display:grid; gap:14px; padding:clamp(18px,3vw,28px); border:1px solid var(--ui-border); border-radius:var(--ui-radius); background:var(--ui-surface); box-shadow:var(--ui-shadow-card); }
.ay-intake-question h1,.ay-intake-boundary h1,.ay-intake-boundary h2,.ay-intake-gate h1,.ay-intake-gate h2 { margin:0; color:var(--ui-text); font-size:clamp(1.05rem,2.2vw,1.35rem); line-height:1.35; }
.ay-intake-boundary p { margin:0; color:var(--ui-text-soft); font-size:.8rem; line-height:1.55; }
.ay-intake-gate { border-color:var(--ui-warning-border); background:var(--ui-warning-soft); }
.ay-intake-gate--danger { border-color:var(--ui-danger-border); background:var(--ui-danger-soft); }
.ay-intake-gate__label { color:var(--ui-warning); font-size:.66rem; font-weight:750; letter-spacing:.065em; text-transform:uppercase; }
.ay-intake-gate--danger .ay-intake-gate__label { color:var(--ui-danger); }
.ay-intake-gate > p { max-width:68ch; margin:0; color:var(--ui-text-soft); font-size:.8rem; line-height:1.55; }
.ay-intake-gate > .ay-intake-gate__support { color:var(--ui-muted); font-size:.72rem; }
.ay-intake-acknowledgement { display:grid; grid-template-columns:18px minmax(0,1fr); align-items:start; gap:10px; padding:12px 13px; border:1px solid var(--ui-warning-border); border-radius:var(--ui-radius-sm); background:var(--ui-surface); color:var(--ui-text); font-size:.76rem; line-height:1.5; cursor:pointer; }
.ay-intake-acknowledgement input { width:17px; height:17px; margin:2px 0 0; accent-color:var(--ui-accent); }
.ay-intake-question fieldset { margin:0; padding:0; border:0; }
.ay-intake-choice { display:flex; align-items:center; gap:10px; border:1px solid var(--ui-border); color:var(--ui-text); cursor:pointer; }
.ay-intake-choice:has(input:checked) { border-color:var(--ui-accent-border); background:var(--ui-accent-soft); }
.ay-intake-choice input { width:16px; height:16px; }
.ay-intake-field { width:100%; border:1px solid var(--ui-border-strong); color:var(--ui-text); font:inherit; }
.ay-intake-field[aria-invalid="true"] { border-color:var(--ui-danger); }
.ay-intake-question textarea { resize:vertical; }
.ay-intake-actions,.ay-intake-save { display:flex; align-items:center; justify-content:space-between; flex-wrap:wrap; gap:10px; }
.ay-intake-save { min-height:28px; color:var(--ui-muted); font-size:.72rem; }
.ay-intake-validation { margin:0; color:var(--ui-danger); font-size:.75rem; }
.ay-intake-ai-status { width:fit-content; display:flex; align-items:center; gap:8px; padding:10px 12px; border:1px solid var(--ui-border); border-radius:var(--ui-radius-sm); background:var(--ui-surface); color:var(--ui-muted); font-size:.72rem; }
.ay-intake-ai-error { display:flex; align-items:center; justify-content:space-between; gap:12px; padding:10px 12px; border:1px solid var(--ui-danger-border); border-radius:var(--ui-radius-sm); background:var(--ui-danger-soft); color:var(--ui-danger); font-size:.74rem; }
.ay-intake-voice { display:flex; align-items:center; flex-wrap:wrap; gap:8px; min-height:30px; color:var(--ui-muted); font-size:.7rem; }
.ay-intake-voice__start { width:fit-content; }
.ay-intake-voice__timer { color:var(--ui-danger); font-weight:750; font-variant-numeric:tabular-nums; }
.ay-intake-voice__status { display:inline-flex; align-items:center; gap:7px; }
.ay-intake-voice__error { flex:1 1 220px; color:var(--ui-danger); line-height:1.45; }
.ay-intake-voice-fallback { margin:0; color:var(--ui-muted); font-size:.7rem; line-height:1.45; }
.ay-intake-voice--recording { padding:7px 9px; border:1px solid var(--ui-danger-border); border-radius:var(--ui-radius-sm); background:var(--ui-danger-soft); }
.ay-intake-voice--transcribing,.ay-intake-voice--review { padding:4px 0; }
.ay-intake-review__header { padding:clamp(18px,3vw,28px); border:1px solid var(--ui-border); border-radius:var(--ui-radius); background:var(--ui-surface); box-shadow:var(--ui-shadow-card); }
.ay-intake-review__header h1 { margin:5px 0 0; color:var(--ui-text); font-size:clamp(1.15rem,2.4vw,1.5rem); line-height:1.3; }
.ay-intake-review__header p { max-width:68ch; margin:7px 0 0; color:var(--ui-text-soft); font-size:.78rem; line-height:1.55; }
.ay-intake-review__list { display:grid; gap:10px; }
.ay-intake-review__item { min-width:0; display:flex; align-items:center; justify-content:space-between; gap:16px; padding:14px 16px; border:1px solid var(--ui-border); border-radius:var(--ui-radius-sm); background:var(--ui-surface); }
.ay-intake-review__item > div { min-width:0; display:grid; gap:4px; }
.ay-intake-review__item h2 { margin:0; color:var(--ui-text); font-size:.76rem; line-height:1.4; }
.ay-intake-review__item p { overflow-wrap:anywhere; margin:0; color:var(--ui-text-soft); font-size:.76rem; line-height:1.5; }
.ay-intake-review__status { width:fit-content; padding:3px 7px; border:1px solid var(--ui-border); border-radius:999px; background:var(--ui-surface-muted); color:var(--ui-muted); font-size:.62rem; font-weight:700; }
.ay-intake-review__editor { position:sticky; bottom:0; z-index:2; border-color:var(--ui-accent-border); }
.ay-intake-review__editor h2 { margin:0; color:var(--ui-text); font-size:.9rem; }
.ay-intake-step-actions { display:flex; align-items:center; justify-content:space-between; gap:10px; }
.ay-intake-upload-card,.ay-intake-consent__card { display:grid; gap:14px; padding:clamp(18px,3vw,26px); border:1px solid var(--ui-border); border-radius:var(--ui-radius); background:var(--ui-surface); box-shadow:var(--ui-shadow-card); }
.ay-intake-upload { min-height:116px; display:grid; place-items:center; align-content:center; gap:6px; padding:20px; border:1px dashed var(--ui-accent-border); border-radius:var(--ui-radius-sm); background:var(--ui-accent-soft); color:var(--ui-accent); cursor:pointer; }
.ay-intake-upload.is-disabled { opacity:.65; cursor:default; }
.ay-intake-upload input { position:absolute; width:1px; height:1px; overflow:hidden; clip:rect(0,0,0,0); white-space:nowrap; }
.ay-intake-upload span { font-size:.78rem; font-weight:750; }
.ay-intake-upload small,.ay-intake-empty { margin:0; color:var(--ui-muted); font-size:.68rem; line-height:1.45; }
.ay-intake-file-list { display:grid; gap:8px; margin:0; padding:0; list-style:none; }
.ay-intake-file-list li { min-width:0; display:flex; align-items:center; justify-content:space-between; gap:12px; padding:10px 12px; border:1px solid var(--ui-border); border-radius:var(--ui-radius-sm); background:var(--ui-surface-muted); }
.ay-intake-file-list li > div { min-width:0; display:grid; gap:3px; }
.ay-intake-file-list strong { overflow:hidden; color:var(--ui-text); font-size:.72rem; text-overflow:ellipsis; white-space:nowrap; }
.ay-intake-file-list span { color:var(--ui-muted); font-size:.64rem; }
.ay-intake-consent__card > div { display:grid; gap:7px; }
.ay-intake-consent__card h2 { margin:0; color:var(--ui-text); font-size:.84rem; }
.ay-intake-consent__card p { margin:0; color:var(--ui-text-soft); font-size:.76rem; line-height:1.55; }
.ay-intake-policy-links { display:flex; flex-wrap:wrap; gap:8px; }
.ay-intake-policy-links a { padding:7px 10px; border:1px solid var(--ui-border); border-radius:var(--ui-radius-sm); color:var(--ui-accent); font-size:.69rem; font-weight:700; text-decoration:none; }
.ay-intake-policy-links a:hover { border-color:var(--ui-accent-border); background:var(--ui-accent-soft); }
.ay-intake-complete { min-height:300px; display:grid; align-content:center; justify-items:center; gap:10px; padding:clamp(26px,5vw,48px); border:1px solid var(--ui-border); border-radius:var(--ui-radius); background:var(--ui-surface); box-shadow:var(--ui-shadow-card); text-align:center; }
.ay-intake-complete__icon { width:48px; height:48px; display:grid; place-items:center; border:1px solid var(--ui-accent-border); border-radius:50%; background:var(--ui-accent-soft); color:var(--ui-accent); font-size:1.2rem; font-weight:800; }
.ay-intake-complete h1 { margin:4px 0 0; color:var(--ui-text); font-size:clamp(1.2rem,2.5vw,1.55rem); }
.ay-intake-complete p { max-width:52ch; margin:0; color:var(--ui-text-soft); font-size:.78rem; line-height:1.55; }
.ay-intake-complete .ay-intake-complete__reference { margin-top:8px; color:var(--ui-muted); font-size:.68rem; }
.ay-intake-composer { min-width:0; display:grid; grid-template-columns:minmax(0,1fr) auto; align-items:end; gap:10px; padding:10px max(16px,env(safe-area-inset-right)) max(10px,env(safe-area-inset-bottom)) max(16px,env(safe-area-inset-left)); border-top:1px solid var(--ui-border); background:var(--ui-surface); }
.ay-intake-composer textarea { width:100%; min-height:44px; max-height:120px; resize:none; padding:11px 13px; border:1px solid var(--ui-border-strong); border-radius:var(--ui-radius-sm); background:var(--ui-surface-muted); color:var(--ui-text); font:inherit; font-size:.76rem; }
.ay-intake-composer .ay-button { min-height:44px; }
@media (max-width:600px) { .ay-intake-header { min-height:58px; } .ay-intake-main { padding:12px; } .ay-intake-startup { min-height:240px; padding:22px 18px; } .ay-intake-startup__actions { display:grid; grid-template-columns:1fr; } .ay-intake-startup__actions .ay-button { width:100%; min-width:0; } .ay-intake-bubble { max-width:92%; } .ay-intake-question,.ay-intake-boundary,.ay-intake-gate,.ay-intake-review__header { padding:18px 15px; } .ay-intake-actions { display:grid; grid-template-columns:1fr 1fr; } .ay-intake-actions .ay-button { width:100%; } .ay-intake-review__item { align-items:flex-start; padding:12px; } .ay-intake-review__item .ay-button { flex:0 0 auto; } .ay-intake-upload-card,.ay-intake-consent__card { padding:15px; } .ay-intake-step-actions { display:grid; grid-template-columns:1fr 1fr; } .ay-intake-step-actions .ay-button { width:100%; } .ay-intake-file-list li { align-items:flex-start; } .ay-intake-composer { padding-top:8px; } }

/*
 * Legacy-clinical parity bridge.
 *
 * React owns application state and behavior, while clinical-ui.css remains the
 * visual source of truth.  These rules deliberately mirror the established
 * dashboard and chat profile instead of introducing a second React-only theme.
 */
.ay-card,.ay-chart-shell { border-radius:var(--ui-radius); }

/* The legacy queue and chart are two states of one workspace, never two panes. */
.ay-clinical-workspace { display:block; }
.ay-queue-sidebar { width:100%; height:100%; }
.ay-detail-empty { display:none; }
.ay-detail-pane {
  position:absolute;
  inset:0;
  z-index:20;
  width:100%;
  min-width:0;
  min-height:0;
  overflow:hidden;
  border-left:0;
  background:var(--ui-canvas);
}
.ay-queue-toolbar { position:relative; display:grid; grid-template-columns:minmax(220px,1fr) auto; gap:8px; }
.ay-queue-search { position:relative; min-width:0; }
.ay-queue-search > svg { position:absolute; top:50%; left:13px; z-index:1; width:18px; height:18px; transform:translateY(-50%); fill:none; stroke:var(--ui-muted); stroke-width:1.8; stroke-linecap:round; }
.ay-queue-search .ui-input { width:100%; padding-left:40px; padding-right:36px; }
.ay-queue-search > button { position:absolute; top:50%; right:8px; width:28px; height:28px; padding:0; border:0; border-radius:50%; transform:translateY(-50%); background:transparent; color:var(--ui-muted); font-size:1.1rem; }
.ay-queue-filter { min-width:84px; display:inline-flex; align-items:center; justify-content:center; gap:6px; padding:7px 11px; border:1px solid var(--ui-border-strong); background:var(--ui-surface); color:var(--ui-text-soft); font:inherit; font-size:.7rem; font-weight:650; }
.ay-queue-filter:hover,.ay-queue-filter.is-open { border-color:var(--ui-accent-border); background:var(--ui-accent-soft); color:var(--ui-accent); }
.ay-queue-filter svg { width:18px; height:18px; fill:none; stroke:currentColor; stroke-width:1.8; stroke-linecap:round; }
.ay-queue-filter-panel { position:absolute; right:0; z-index:30; width:min(280px,100%); display:grid; gap:7px; padding:12px; border:1px solid var(--ui-border); border-radius:var(--ui-radius); background:var(--ui-surface); box-shadow:var(--ui-shadow-card); }
.ay-queue-filter-panel label { color:var(--ui-text-soft); font-size:.68rem; font-weight:700; }
.ay-queue-list { display:block; }
.ay-queue-item { display:block; padding:0; border:0; border-bottom:1px solid var(--ui-border); border-radius:0; }
.ay-queue-item:last-child { border-bottom:0; }

/* Patient chart section navigation follows the legacy left rail on tablet/mobile;
   desktop (>=900px) reuses the main dashboard rail instead of a second sidebar. */
.ay-chart-shell {
  display:grid;
  grid-template-columns:64px minmax(0,1fr);
  grid-template-rows:auto minmax(0,1fr) auto;
}
.ay-chart-header { grid-column:2; grid-row:1; }
.ay-chart-tabs {
  grid-column:1;
  grid-row:1 / -1;
  min-width:0;
  display:flex;
  flex-direction:column;
  align-items:center;
  gap:6px;
  padding:10px 7px;
  border-right:1px solid var(--ui-border);
  border-bottom:0;
  background:var(--ui-surface);
  overflow-x:hidden;
  overflow-y:auto;
}
.ay-chart-tab {
  width:50px;
  display:grid;
  place-items:center;
  gap:2px;
  padding:5px 2px;
  border:1px solid transparent;
  border-radius:var(--ui-radius-sm);
  font-size:.56rem;
  line-height:1.1;
  text-align:center;
  white-space:normal;
}
.ay-chart-tab.is-selected,.ay-chart-tab:hover {
  border-color:var(--ui-accent-border);
  background:var(--ui-accent-soft);
  color:var(--ui-accent);
}
.ay-chart-tab-icon { width:20px; height:20px; fill:none; stroke:currentColor; stroke-width:1.8; stroke-linecap:round; stroke-linejoin:round; }
.ay-chart-tab span { display:block; max-width:46px; }
.ay-chart-body { grid-column:2; grid-row:2; }
.ay-chart-footer { grid-column:2; grid-row:3; }
/* >=900px: the chart rail buttons are portaled into the shared dashboard-navigation-rail
   instead of rendering a second sidebar inside the chart. */
@media (min-width:900px) {
  .ay-chart-shell { grid-template-columns:minmax(0,1fr); }
  .ay-chart-tabs { display:none; }
  .ay-chart-header,.ay-chart-body,.ay-chart-footer { grid-column:1; }
}
/* <=899px (tablet and phone alike, matching the breakpoint every other
   dashboard surface already switches on): no merged rail exists to fall
   back on, so this becomes a horizontal, scrollable tab strip instead of
   the narrow 64px vertical rail above — that rail's fixed-width label
   pills wrapped longer names ("Patient Settings", "Complete Chart")
   across two lines, which is the tablet-width regression this fixes. */
@media (max-width:899px) {
  .ay-chart-shell { grid-template-columns:minmax(0,1fr); grid-template-rows:auto auto minmax(0,1fr) auto; }
  .ay-chart-header { grid-column:1; grid-row:1; }
  .ay-chart-tabs { grid-column:1; grid-row:2; flex-direction:row; align-items:stretch; gap:5px; padding:8px 12px; border-right:0; border-bottom:1px solid var(--ui-border); overflow-x:auto; overflow-y:hidden; }
  .ay-chart-tab { width:auto; min-width:max-content; min-height:38px; display:flex; gap:6px; padding:7px 11px; border-radius:999px; font-size:.7rem; white-space:nowrap; }
  .ay-chart-tab-icon { width:17px; height:17px; }
  .ay-chart-tab span { max-width:none; }
  .ay-chart-body { grid-column:1; grid-row:3; }
  .ay-chart-footer { grid-column:1; grid-row:4; }
}

/* Settings shows one guided step at a time, matching the approved legacy flow. */
.ay-settings-page .ay-content > [data-settings-section] { display:none; }
.ay-settings-page [data-settings-section] { display:none; }
.ay-settings-page [data-active-section="clinic"] #clinic,
.ay-settings-page [data-active-section="experience"] #experience,
.ay-settings-page [data-active-section="intake"] #intake,
.ay-settings-page [data-active-section="eligibility"] #eligibility,
.ay-settings-page [data-active-section="operations"] #operations,
.ay-settings-page [data-active-section="disclosures"] #disclosures,
.ay-settings-page [data-active-section="notes-dashboard"] #notes-dashboard,
.ay-settings-page [data-active-section="notifications"] #notifications,
.ay-settings-page [data-active-section="workflow-retention"] #workflow-retention,
.ay-settings-page [data-active-section="advanced"] #advanced,
.ay-settings-page [data-active-section="finalize"] #finalize { display:block; }
.ay-settings-footer:not(.setup-footer) {
  position:fixed;
  right:0;
  bottom:0;
  left:220px;
  z-index:60;
  display:flex;
  align-items:center;
  gap:9px;
  padding:9px 20px max(9px,env(safe-area-inset-bottom));
  border-top:1px solid var(--ui-border);
  background:var(--ui-surface);
  box-shadow:var(--ui-shadow-footer);
}
.ay-settings-footer:not(.setup-footer) .ay-settings-footer__step { margin-right:auto; color:var(--ui-muted); font-size:.72rem; }
.ay-settings-footer:not(.setup-footer) .ay-settings-footer__pager { display:flex; gap:6px; }
.ay-settings-footer:not(.setup-footer) .ay-settings-footer__pager .ay-button { padding:0; border-radius:50%; font-size:1rem; }
.ay-settings-footer__pager .ay-button svg { width:18px; height:18px; fill:none; stroke:currentColor; stroke-width:1.8; stroke-linecap:round; stroke-linejoin:round; }
.ay-settings-footer:not(.setup-footer) .ay-settings-footer__actions { display:flex; align-items:center; gap:7px; white-space:nowrap; }
.ay-settings-assistant-launcher { bottom:74px; }

/* React intake adopts the established clinical-chat proportions. */
.ay-intake-app { grid-template-rows:70px minmax(0,1fr); }
.ay-intake-header {
  position:relative;
  z-index:20;
  min-height:70px;
  padding:8px max(18px,env(safe-area-inset-right)) 8px max(18px,env(safe-area-inset-left));
  background:color-mix(in srgb,var(--ui-surface) 92%,transparent);
  backdrop-filter:blur(14px);
  -webkit-backdrop-filter:blur(14px);
}
.ay-intake-brand img { width:42px; height:42px; flex-basis:42px; padding:3px; background:var(--ui-accent-soft); }
.ay-intake-brand-placeholder { flex:0 0 42px !important; width:42px !important; height:42px !important; border-radius:var(--ui-radius-sm) !important; }
.ay-intake-brand-placeholder svg { width:25px; height:25px; fill:none; stroke:currentColor; stroke-width:1.7; stroke-linecap:round; stroke-linejoin:round; }
.ay-intake-wordmark { min-width:0; flex:1 1 auto !important; display:grid; place-items:initial !important; gap:1px; width:auto !important; height:auto !important; border-radius:0 !important; background:transparent !important; color:var(--ui-text) !important; }
.ay-intake-wordmark strong { font-size:.95rem; letter-spacing:.01em; }
.ay-intake-wordmark small { color:var(--ui-muted); font-size:.61rem; font-weight:600; }
.ay-intake-header-actions { position:relative; display:flex; align-items:center; gap:8px; }
.ay-intake-secure { display:inline-flex; align-items:center; gap:5px; color:var(--ui-muted); font-size:.65rem; }
.ay-intake-secure svg,.ay-intake-menu-button svg { width:18px; height:18px; fill:none; stroke:currentColor; stroke-width:1.8; stroke-linecap:round; stroke-linejoin:round; }
.ay-intake-menu-button { display:grid; place-items:center; padding:0; border:1px solid var(--ui-border-strong); background:var(--ui-surface); color:var(--ui-text-soft); }
.ay-intake-menu-button:hover { border-color:var(--ui-accent-border); background:var(--ui-accent-soft); color:var(--ui-accent); }
.ay-intake-menu { position:absolute; top:calc(100% + 9px); right:0; z-index:80; width:min(260px,calc(100vw - 24px)); display:grid; gap:5px; padding:8px; border:1px solid var(--ui-border); border-radius:var(--ui-radius); background:var(--ui-surface); }
.ay-intake-menu button,.ay-intake-menu a { display:flex; align-items:center; gap:9px; padding:8px 10px; border:0; border-radius:var(--ui-radius-sm); background:transparent; color:var(--ui-text-soft); font:inherit; font-size:.72rem; font-weight:650; text-align:left; text-decoration:none; }
.ay-intake-menu button:hover,.ay-intake-menu a:hover { background:var(--ui-accent-soft); color:var(--ui-accent); }
.ay-intake-menu p { margin:4px 5px; color:var(--ui-muted); font-size:.65rem; line-height:1.45; }
.ay-intake-main { padding:24px max(16px,env(safe-area-inset-right)) 104px max(16px,env(safe-area-inset-left)); }
.ay-intake-workflow,.ay-intake-transcript { width:min(100%,780px); }
.ay-intake-bubble { max-width:80%; padding:12px 16px; }
.ay-intake-bubble p { font-size:.98rem; line-height:1.5; }
.ay-intake-question { padding:0; border:0; background:transparent; box-shadow:none; }
.ay-intake-question fieldset { display:flex; flex-wrap:wrap; gap:8px; }
.ay-intake-choice { width:auto; padding:9px 14px; font-size:.86rem; }
.ay-intake-choice input { accent-color:var(--ui-accent); }
.ay-intake-field { min-height:56px; padding:14px 16px; border-radius:20px; background:var(--ui-surface); font-size:.92rem; }
.ay-intake-actions { justify-content:flex-end; }
.ay-intake-actions > span { display:none; }
.ay-intake-startup,.ay-intake-boundary,.ay-intake-gate,.ay-intake-review__header,.ay-intake-upload-card,.ay-intake-consent__card,.ay-intake-complete { border-radius:var(--ui-radius); }
.dashboard-mobile-action { display:none; }

@media (max-width:899px) {
  /* The legacy dashboard rail is also the approved mobile bottom navigation.
     Keep the generic React rail rule from suppressing that canonical surface. */
  #mainContent.ay-clinical-dashboard { padding-bottom:0; }
  .ay-dashboard-rail.dashboard-navigation-rail {
    display:flex;
    flex-direction:row;
    justify-content:center;
    gap:0;
    padding:5px max(7px,env(safe-area-inset-right)) max(5px,env(safe-area-inset-bottom)) max(7px,env(safe-area-inset-left));
    border:0;
    border-top:1px solid var(--ui-border);
  }
  .ay-dashboard-rail.dashboard-navigation-rail > .dashboard-rail-control-wrap,
  .ay-dashboard-rail.dashboard-navigation-rail > .dashboard-rail-spacer { display:none; }
  .dashboard-mobile-action { position:relative; width:38px; height:38px; flex:0 0 38px; display:grid; place-items:center; padding:0; border:0; border-radius:50%; background:transparent; color:var(--ui-text-soft); font:inherit; }
  .dashboard-mobile-action svg { width:20px; height:20px; fill:none; stroke:currentColor; stroke-width:1.8; stroke-linecap:round; stroke-linejoin:round; }
  .dashboard-mobile-action b { position:absolute; top:-1px; right:-1px; min-width:16px; height:16px; display:grid; place-items:center; padding:0 4px; border:2px solid var(--ui-surface); border-radius:999px; background:var(--ui-accent); color:#fff; font-size:9px; }
  .dashboard-mobile-account { background:var(--ui-text-soft); color:#fff; font-size:.68rem; font-weight:700; }
  body:has(.workspace-detail.has-selection) .ay-dashboard-rail.dashboard-navigation-rail { display:none; }
  .ay-settings-footer:not(.setup-footer) { left:0; padding-inline:10px; }
  .ay-settings-footer__step { display:none; }
  .ay-settings-footer .ay-button { padding-inline:10px; }
  .ay-settings-assistant-launcher { bottom:76px; }
}
@media (max-width:600px) {
  .ay-clinical-dashboard.has-selection { grid-template-columns:1fr; }
  .ay-queue-toolbar { grid-template-columns:minmax(0,1fr) auto; }
  .ay-queue-filter { min-width:42px; width:42px; padding:0; }
  .ay-queue-filter span { position:absolute; width:1px; height:1px; overflow:hidden; clip:rect(0,0,0,0); }
  .ay-intake-app { grid-template-rows:62px minmax(0,1fr); }
  .ay-intake-header { min-height:62px; }
  .ay-intake-secure { display:none; }
  .ay-intake-main { padding:14px 12px 92px; }
  .ay-intake-bubble { max-width:90%; }
  .ay-intake-question { padding:0; }
  .ay-intake-actions { display:flex; }
  .ay-settings-footer:not(.setup-footer) { gap:6px; overflow-x:auto; }
  .ay-settings-footer:not(.setup-footer) .ay-settings-footer__pager .ay-button { width:32px; min-width:32px; height:32px; min-height:32px; }
  .ay-settings-footer:not(.setup-footer) .ay-settings-footer__actions { gap:5px; }
  .ay-settings-footer:not(.setup-footer) .ay-settings-footer__actions .ay-button { min-height:32px; padding:7px 9px; font-size:.66rem; }
}

/* Commercial experience refinement: shared shell, depth, motion, and contrast. */
.ay-shell--auth {
  min-height:100dvh;
  background:
    radial-gradient(circle at 50% 18%, color-mix(in srgb,var(--ui-accent-soft) 60%,transparent) 0, transparent 42%),
    var(--ui-canvas);
}
.ay-auth-main { min-height:100dvh; display:grid; place-items:center; padding:clamp(20px,5vw,64px) 18px; }
.ay-auth-card { width:min(100%,448px); min-height:520px; display:grid; grid-template-rows:auto minmax(0,1fr) auto; align-content:start; gap:22px; padding:clamp(24px,5vw,36px); border:1px solid var(--ui-border); border-radius:var(--ui-radius-lg); background:var(--ui-surface); box-shadow:var(--ui-shadow-dialog); }
.ay-auth-card__header { display:flex; align-items:center; gap:14px; }
.ay-auth-brand-mark { width:46px; height:46px; flex:0 0 46px; display:grid; place-items:center; overflow:hidden; border:1px solid var(--ui-accent-border); border-radius:var(--ui-radius); background:var(--ui-accent-soft); color:var(--ui-accent); font-size:.95rem; font-weight:750; }
.ay-auth-brand-mark img { width:100%; height:100%; object-fit:contain; }
.ay-auth-brand { margin:0 0 8px; color:var(--ui-muted); font-size:.72rem; font-weight:700; }
.ay-auth-card h1 { margin:0; color:var(--ui-text); font-size:clamp(1.35rem,4vw,1.65rem); line-height:1.15; letter-spacing:-.025em; }
.ay-auth-card__header p:last-child { margin:7px 0 0; color:var(--ui-text-soft); font-size:.82rem; line-height:1.5; }
.ay-auth-card__body { min-height:0; }
.ay-auth-flow { display:grid; gap:16px; }
.ay-auth-flow > header { display:grid; gap:5px; }
.ay-auth-flow h2 { margin:0; color:var(--ui-text); font-size:1rem; }
.ay-auth-flow p { margin:0; color:var(--ui-text-soft); font-size:.78rem; line-height:1.5; }
.ay-auth-flow form { display:grid; gap:10px; }
.ay-auth-flow label { color:var(--ui-text-soft); font-size:.76rem; font-weight:700; }
.ay-auth-flow .ui-input { min-height:48px; }
.ay-auth-flow [role="alert"] { min-height:42px; padding:9px 11px; border:1px solid var(--ui-danger-border); border-radius:var(--ui-radius-sm); background:var(--ui-danger-soft); color:var(--ui-danger); }
.ay-auth-actions { align-items:center; justify-content:space-between; margin-top:7px; }
.ay-auth-actions .ay-button { min-width:148px; }
.ay-auth-options-row { display:flex; align-items:center; justify-content:space-between; gap:12px; }
.ay-auth-submit .ay-button { width:100%; }
.ay-auth-link { min-height:44px; padding:8px 4px; border:0; background:transparent; color:var(--ui-accent); font:inherit; font-size:.76rem; font-weight:700; }
/* Passkey sign-in: a quiet icon beside "Forgot password?" that opens the device prompt (or a small email modal). */
.ay-auth-options-end { display:flex; align-items:center; gap:6px; }
.ay-auth-passkey { display:grid; place-items:center; width:32px; height:32px; padding:0; border:1px solid var(--ui-border); border-radius:8px; background:transparent; color:var(--ui-accent); cursor:pointer; }
.ay-auth-passkey:hover { background:var(--ui-accent-soft); border-color:var(--ui-accent-soft); }
.ay-auth-passkey:focus-visible { outline:2px solid var(--ui-accent); outline-offset:2px; }
.ay-auth-passkey:disabled { opacity:.55; cursor:default; }
.ay-passkey-backdrop { position:fixed; inset:0; z-index:140; display:grid; place-items:center; padding:18px; background:rgba(24,34,39,.5); }
.ay-passkey-dialog { width:min(100%, 380px); padding:20px; border:1px solid var(--ui-border); border-radius:var(--ui-radius-lg); background:var(--ui-surface); color:var(--ui-text); box-shadow:var(--ui-shadow-dialog); }
.ay-passkey-dialog > header { display:flex; align-items:flex-start; justify-content:space-between; gap:16px; margin-bottom:14px; }
.ay-passkey-dialog h2 { margin:2px 0 0; font-size:1.05rem; }
.ay-passkey-dialog form { display:grid; gap:8px; }
.ay-passkey-dialog form label { color:var(--ui-text-soft); font-size:.72rem; font-weight:650; }
.ay-passkey-close { width:32px; height:32px; display:grid; place-items:center; padding:0; border:1px solid var(--ui-border); border-radius:50%; background:var(--ui-surface); color:var(--ui-text); font:inherit; font-size:1.1rem; cursor:pointer; }
.ay-auth-card__status { margin:0; color:var(--ui-muted); font-size:.72rem; }

/* Auth content should size to its actual form on compact screens. */
@media (max-width:600px) {
  .ay-auth-main { min-height:100dvh; padding:20px 16px; }
  .ay-auth-card { min-height:0; height:auto; padding:24px 20px; }
}

.ay-card,.ay-chart-shell,.ay-clinical-card,.config-card,.ay-settings-advanced { border-color:var(--ui-border); box-shadow:var(--ui-shadow-card); }
.ay-queue-filter-panel,.ay-intake-menu,.clinic-settings-info > .clinic-settings-info__bubble { box-shadow:var(--ui-shadow-popover); }
.ay-settings-dialog { box-shadow:var(--ui-shadow-dialog); }
/* (The help bubble is not in this list: it is always mounted and fades with transitions, and a fill-forwards
   entrance animation would pin it visible.) */
.ay-queue-filter-panel,.ay-intake-menu,.ay-settings-dialog {
  transform-origin:top right;
  animation:ay-layer-in var(--ui-duration-standard) var(--ui-ease-out) both;
}
.ay-settings-dialog-backdrop { animation:ay-backdrop-in var(--ui-duration-standard) var(--ui-ease-out) both; }
.ay-settings-dialog { transform-origin:center; animation:ay-dialog-in var(--ui-duration-dialog) var(--ui-ease-out) both; }
@keyframes ay-layer-in { from { opacity:0; transform:translateY(-4px); } to { opacity:1; transform:translateY(0); } }
@keyframes ay-backdrop-in { from { opacity:0; } to { opacity:1; } }
@keyframes ay-dialog-in { from { opacity:0; transform:translateY(10px); } to { opacity:1; transform:translateY(0); } }

.ay-dashboard-rail { gap:8px; }
.ay-rail-button,.ay-account-button,.dashboard-mobile-action,.ay-intake-menu-button { min-width:44px; min-height:44px; }
.ay-rail-button { width:48px; font-size:.62rem; line-height:1.15; }
.ay-queue-filter { min-height:44px; border-radius:var(--ui-radius-sm); }
.ay-queue-filter-panel { top:calc(100% + 8px); }
.ay-chart-header { padding-block:13px; }
.ay-chart-body { padding-bottom:30px; }
.ay-chart-footer,.ay-settings-footer:not(.setup-footer) { box-shadow:var(--ui-shadow-footer); }
.ay-chart-tab { min-height:44px; }
.ay-message-bubble { border-left-width:1px !important; box-shadow:0 1px 2px rgba(56,45,32,.035); }
.ay-message-bubble.is-patient { border-color:var(--ui-accent-border); background:var(--ui-accent-soft); }
.ay-message-bubble.is-clinician { border-color:var(--ui-border); background:var(--ui-surface); }

.ay-settings-editor { padding-inline:clamp(16px,3vw,32px); }
.ay-settings-editor__header,.ay-settings-editor > .config-status,.ay-settings-editor > .platform-floor,.ay-settings-editor > .config-grid,.ay-settings-editor > .ay-note-status { max-width:var(--ui-content-form); }
.ay-settings-editor .config-card .config-card,.ay-settings-advanced .ay-clinical-card .ay-clinical-card { padding:14px 0 0; border:0; border-top:1px solid var(--ui-border); border-radius:0; background:transparent; box-shadow:none; }
.ay-settings-step-nav button { min-height:44px; font-size:.73rem; }
.ay-settings-step-nav button.is-selected span { border-color:var(--ui-accent-fill); background:var(--ui-accent-fill); color:var(--ui-on-accent); }
.ay-settings-footer:not(.setup-footer) { min-height:64px; }
.ay-settings-footer:not(.setup-footer) .ay-settings-footer__pager .ay-button { width:44px; min-width:44px; min-height:44px; }
.ay-settings-footer:not(.setup-footer) .ay-settings-footer__actions .ay-button { min-height:44px; }
.ay-settings-assistant-launcher { min-height:44px; border-radius:var(--ui-radius-sm); box-shadow:var(--ui-shadow-popover); }
.ay-settings-assistant-launcher svg,.ay-settings-assistant-window-actions svg { width:18px; height:18px; fill:none; stroke:currentColor; stroke-width:1.8; stroke-linecap:round; stroke-linejoin:round; }
.ay-settings-assistant { box-shadow:var(--ui-shadow-dialog); animation:ay-assistant-in var(--ui-duration-dialog) var(--ui-ease-drawer) both; }
@keyframes ay-assistant-in { from { opacity:0; transform:translateY(12px); } to { opacity:1; transform:translateY(0); } }
.ay-settings-assistant button { min-height:44px; }
/* The header buttons are small icon buttons: the 44px rule above and the base button padding left the 18px icon no room, so it was
   squeezed to 0px wide and the buttons looked empty. */
.ay-settings-assistant .ay-settings-assistant-window-actions button { width:36px; min-width:36px; height:36px; min-height:36px; padding:0; display:grid; place-items:center; }
.ay-settings-assistant-window-actions svg { flex:none; }
/* Narrow screens: the launcher is just the icon (its accessible name stays "Open setup assistant"). */
@media (max-width:899px) {
  .ay-settings-assistant-launcher { width:44px; padding:0; justify-content:center; border-radius:50%; }
  .ay-settings-assistant-launcher > span { display:none; }
}
.ay-advanced-settings { display:grid; grid-template-columns:minmax(190px,240px) minmax(0,1fr); gap:18px; align-items:start; }
.ay-advanced-nav { position:sticky; top:0; display:grid; align-content:start; gap:4px; padding:7px; border:1px solid var(--ui-border); border-radius:var(--ui-radius); background:var(--ui-surface-soft); }
.ay-advanced-nav > div,.ay-team-list > div { position:relative; min-width:0; }
.ay-advanced-nav-button,.ay-team-member { width:100%; min-height:54px; display:grid; gap:3px; padding:9px 11px; border:1px solid transparent; border-radius:var(--ui-radius-sm); background:transparent; color:var(--ui-text-soft); font:inherit; text-align:left; }
.ay-advanced-nav-button strong,.ay-team-member strong { color:var(--ui-text); font-size:.76rem; }
.ay-advanced-nav-button small,.ay-team-member small { overflow:hidden; color:var(--ui-muted); font-size:.67rem; line-height:1.35; text-overflow:ellipsis; white-space:nowrap; }
.ay-advanced-nav-button:hover,.ay-advanced-nav-button.is-selected,.ay-team-member:hover,.ay-team-member.is-selected { border-color:var(--ui-accent-border); background:var(--ui-accent-soft); color:var(--ui-accent); }
.ay-advanced-content,.ay-advanced-stack,.ay-workflow-step-fields { min-width:0; display:grid; gap:14px; }
.ay-action-inline { display:inline-flex; align-items:center; gap:6px; min-width:0; }
.ay-action-inline .ay-button { min-height:42px; }
.ay-action-inline .clinic-settings-info { flex:none; }
.ay-workflow-step-fields { gap:10px; margin-top:12px; }
.ay-team-browser { display:grid; grid-template-columns:minmax(180px,.8fr) minmax(0,1.5fr); gap:18px; }
.ay-team-list { display:grid; align-content:start; gap:4px; padding-right:14px; border-right:1px solid var(--ui-border); }
.ay-team-detail { min-width:0; }
.ay-team-detail h4 { margin:0 0 4px; font-size:.9rem; }
.ay-team-detail > p { margin:4px 0; }
.ay-team-detail dl { display:grid; gap:8px; margin:16px 0 0; }
.ay-team-detail dl div { display:grid; grid-template-columns:minmax(110px,.7fr) minmax(0,1.3fr); gap:12px; padding:8px 0; border-bottom:1px solid var(--ui-border); }
.ay-team-detail dt { color:var(--ui-muted); font-size:.7rem; }
.ay-team-detail dd { margin:0; color:var(--ui-text); font-size:.74rem; font-weight:650; }
.ay-team-detail > .ui-field + .ui-field,.ay-team-detail > fieldset + .ui-field,.ay-team-detail > .ay-team-signing-summary,.ay-team-detail > .ay-team-signing-summary + .ui-field,.ay-team-detail > .ay-actions { margin-top:14px; }
.ay-team-signing-summary { display:grid; grid-template-columns:minmax(0,1fr) auto; gap:4px 12px; padding:12px; border:1px solid var(--ui-border); border-radius:var(--ui-radius-sm); background:var(--ui-surface-soft); }
.ay-team-signing-summary span { color:var(--ui-muted); font-size:.68rem; }
.ay-team-signing-summary strong { color:var(--ui-text); font-size:.72rem; }
.ay-team-signing-summary p { grid-column:1/-1; margin:3px 0 0; color:var(--ui-muted); font-size:.68rem; line-height:1.45; }
.ay-operations-list { display:grid; gap:12px; }
.ay-operations-item { display:grid; gap:10px; padding:14px; border:1px solid var(--ui-border); border-radius:var(--ui-radius-sm); background:var(--ui-surface-soft); }
.ay-operations-item__heading { display:flex; align-items:center; justify-content:space-between; gap:10px; }
.ay-operations-item :where(h4,p) { margin:0; }
.ay-operations-item h4 { color:var(--ui-text); font-size:.78rem; }
.ay-operations-item > p { color:var(--ui-muted); font-size:.7rem; line-height:1.45; }
.ay-reconcile-form { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:12px; padding-top:10px; border-top:1px solid var(--ui-border); }
.ay-reconcile-form > .ay-action-inline { align-self:end; }

.ay-intake-menu-button { width:44px; height:44px; border-radius:var(--ui-radius-sm); }
.ay-intake-startup__icon svg,.ay-intake-menu button svg { width:20px; height:20px; flex:0 0 20px; fill:none; stroke:currentColor; stroke-width:1.8; stroke-linecap:round; stroke-linejoin:round; }
.ay-intake-menu { box-shadow:var(--ui-shadow-popover); }
.ay-intake-menu button,.ay-intake-menu a { min-height:44px; }
.ay-intake-bubble { border-radius:16px 16px 16px 5px; background:var(--ui-surface); }
.ay-intake-bubble.is-patient { border-radius:16px 16px 5px 16px; }
.ay-intake-choice { min-height:44px; border-radius:var(--ui-radius); background:var(--ui-surface-soft); }
.ay-intake-ai-status,.ay-intake-voice { min-height:36px; }
.ay-intake-transcript-end { width:1px; height:1px; }
.ay-intake-latest { position:sticky; bottom:8px; z-index:4; justify-self:center; width:max-content; box-shadow:var(--ui-shadow-popover); }

html.clinical-ui.dark .ay-intake-bubble.is-assistant { border-color:var(--ui-chat-assistant-border); background:var(--ui-chat-assistant-surface); }
html.clinical-ui.dark .ay-intake-bubble.is-patient { border-color:var(--ui-accent-border); background:var(--ui-accent-soft); }
html.clinical-ui.dark .ay-intake-choice { border-color:var(--ui-chat-choice-border); background:var(--ui-chat-choice-surface); }
html.clinical-ui.dark .ay-intake-choice:hover { border-color:var(--ui-accent-border); background:var(--ui-chat-choice-hover); }
html.clinical-ui.dark .ay-intake-choice:has(input:checked) { border-color:var(--ui-accent); background:var(--ui-accent-soft); }

@media (hover:hover) {
  .ay-rail-button:hover,.ay-chart-tab:hover,.ay-queue-row:hover,.ay-settings-step-nav button:hover,.ay-intake-menu button:hover,.ay-intake-menu a:hover { transition:background-color var(--ui-duration-fast) var(--ui-ease-out), border-color var(--ui-duration-fast) var(--ui-ease-out), color var(--ui-duration-fast) var(--ui-ease-out); }
}
@media (max-width:600px) {
  .ay-auth-main { padding:16px 14px; }
  .ay-auth-card { width:min(100%,448px); min-height:0; height:auto; max-height:calc(100dvh - 32px); padding:24px 20px; overflow:auto; }
  .ay-auth-options-row { gap:8px; }
  .ay-auth-link { font-size:.72rem; white-space:nowrap; }
  .ay-settings-footer:not(.setup-footer) .ay-settings-footer__pager .ay-button { width:44px; min-width:44px; height:44px; min-height:44px; }
  .ay-settings-footer:not(.setup-footer) .ay-settings-footer__actions .ay-button { min-height:44px; padding:8px 10px; font-size:.68rem; }
  .ay-intake-bubble { max-width:92%; }
}
@media (max-width:780px) {
  .ay-advanced-settings { grid-template-columns:minmax(0,1fr); }
  .ay-advanced-nav { position:static; display:flex; overflow-x:auto; }
  .ay-advanced-nav > div { flex:0 0 150px; }
  .ay-advanced-nav-button small { white-space:normal; }
  .ay-team-browser { grid-template-columns:minmax(0,1fr); }
  .ay-team-list { grid-template-columns:repeat(auto-fit,minmax(150px,1fr)); padding:0 0 14px; border-right:0; border-bottom:1px solid var(--ui-border); }
  .ay-reconcile-form { grid-template-columns:minmax(0,1fr); }
  .ay-settings-group-grid,.ay-settings-field-card-grid,.ay-workflow-stage-grid,.ay-settings-content-grid.ay-eligibility-grid { grid-template-columns:minmax(0,1fr); }
  .ay-settings-toggle-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .ay-settings-subsection-heading { align-items:flex-start; flex-direction:column; }
  .ay-settings-subsection-heading .ay-button { width:100%; justify-content:center; }
  .preview-dashboard-layout { grid-template-columns:64px minmax(0,1fr); }
  .preview-dashboard-chart { grid-column:1/-1; border-top:1px solid var(--ui-border); }
}
@media (prefers-reduced-motion:reduce) {
  .ay-queue-filter-panel,.ay-intake-menu,.ay-settings-dialog,.ay-settings-dialog-backdrop,.ay-settings-assistant { animation-duration:1ms; transform:none; }
}


/* Canonical clinical primitives and surface compositions. */

/* Ayah clinical UI — canonical visual system for legacy and React clinical surfaces.
   This file owns tokens, reusable controls, and explicitly scoped compositions.
   Page-specific clinical-chat.css remains separate; no second React theme is allowed. */
@font-face {
  font-family: "Quicksand";
  font-style: normal;
  font-display: swap;
  font-weight: 300 700;
  src: url("/vendor/fonts/quicksand-latin-ext-wght-normal.woff2") format("woff2-variations");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: "Quicksand";
  font-style: normal;
  font-display: swap;
  font-weight: 300 700;
  src: url("/vendor/fonts/quicksand-latin-wght-normal.woff2") format("woff2-variations");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  color-scheme: light;
  --ay-content-width: 1120px;
  --ui-canvas: #f6f8f8;
  --ui-surface: #ffffff;
  --ui-surface-soft: #f9fbfb;
  --ui-surface-muted: #f1f4f4;
  --ui-border: #e8ebec;
  --ui-border-strong: #dce1e2;
  --ui-text: #202a30;
  --ui-text-soft: #344148;
  --ui-muted: #344148;
  --ui-faint: #46535a;
  /* Deployment branding is the early, release-scoped default. A validated
     clinic configuration may override these same --ui-* properties at
     runtime without loading a second visual system. */
  /* Use the deployment's contrast-safe strong color for filled controls.
     The brighter brand color remains available for non-text decoration. */
  --ui-brand: var(--deployment-brand, #0e9d90);
  --ui-accent: var(--deployment-brand-strong, #0f5954);
  --ui-accent-fill: var(--deployment-brand-strong, #0f5954);
  --ui-accent-fill-hover: color-mix(in srgb, var(--ui-accent-fill) 84%, #000000);
  --ui-on-accent: #ffffff;
  --ui-accent-hover: color-mix(in srgb, var(--ui-accent) 84%, #000000);
  --ui-accent-soft: var(--deployment-brand-wash, #e8f3f1);
  --ui-accent-border: var(--deployment-brand-wash-strong, #bfd9d5);
  --ui-info: #1f4e70;
  --ui-info-soft: #eaf3fb;
  --ui-info-border: #cbdfee;
  --ui-referral: #5b3aa8;
  --ui-referral-soft: #f1ecfb;
  --ui-referral-border: #d8ccf1;
  --ui-success: #145c3b;
  --ui-success-soft: #e9f5ed;
  --ui-success-border: #c8e2d1;
  --ui-warning: #5c3b13;
  --ui-warning-soft: #f8efe0;
  --ui-warning-border: #ead6b3;
  --ui-danger: #74251f;
  --ui-danger-soft: #faeae8;
  --ui-danger-border: #e8c2bf;
  --ui-overlay: rgba(24, 34, 39, .5);
  --ui-chat-assistant-surface: var(--ui-surface);
  --ui-chat-assistant-border: var(--ui-border);
  --ui-chat-choice-surface: var(--ui-surface-soft);
  --ui-chat-choice-border: var(--ui-border-strong);
  --ui-chat-choice-hover: var(--ui-accent-soft);
  --ui-radius-xs: 5px;
  --ui-radius-sm: 7px;
  --ui-radius: 9px;
  --ui-radius-lg: 11px;
  --ui-space-1: 4px;
  --ui-space-2: 8px;
  --ui-space-3: 12px;
  --ui-space-4: 16px;
  --ui-space-5: 20px;
  --ui-space-6: 24px;
  --ui-space-8: 32px;
  --ui-content-reading: 720px;
  --ui-content-form: 1040px;
  --ui-content-workspace: 1440px;
  --ui-shadow-card: 0 1px 2px rgba(56, 45, 32, .035), 0 7px 20px rgba(56, 45, 32, .028);
  --ui-shadow-popover: 0 14px 38px rgba(56, 45, 32, .14), 0 3px 10px rgba(56, 45, 32, .07);
  --ui-shadow-dialog: 0 28px 72px rgba(43, 34, 25, .20), 0 7px 22px rgba(43, 34, 25, .10);
  --ui-shadow-footer: 0 -8px 24px rgba(56, 45, 32, .055);
  --ui-duration-fast: 140ms;
  --ui-duration-standard: 190ms;
  --ui-duration-dialog: 250ms;
  --ui-ease-out: cubic-bezier(.23, 1, .32, 1);
  --ui-ease-in-out: cubic-bezier(.77, 0, .175, 1);
  --ui-ease-drawer: cubic-bezier(.32, .72, 0, 1);
  --ui-focus: 0 0 0 3px color-mix(in srgb, var(--ui-accent) 20%, transparent);
  --ui-font: "Quicksand", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { background: var(--ui-canvas); color: var(--ui-text); font-family: var(--ui-font); font-size: 17px; scrollbar-color: var(--ui-border-strong) transparent; }
body { min-width: 320px; margin: 0; background: var(--ui-canvas); color: var(--ui-text); font-family: var(--ui-font); line-height: 1.45; }
button, input, textarea, select { color: inherit; font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
::selection { background: var(--ui-accent-soft); color: var(--ui-text); }
button:disabled { cursor: not-allowed; opacity: 1 !important; border-color: var(--ui-border); background: var(--ui-surface-muted); color: var(--ui-muted); -webkit-text-fill-color: currentColor; }
a { color: var(--ui-accent); }
[hidden], .hidden, .module-disabled { display: none !important; }

:where(button, a, input, textarea, select, [tabindex]):focus-visible {
  outline: 0;
  box-shadow: var(--ui-focus);
}

html.clinical-ui .ui-loading-state {
  max-width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-wrap: nowrap;
  gap: 7px;
  white-space: nowrap;
}
html.clinical-ui .ui-loading-state i { width: 15px; height: 15px; flex: 0 0 15px; }
html.clinical-ui .ui-loading-state > span { min-width: 0; }

/* Small compatibility helpers while legacy business logic is extracted from
   dashboard.html. These define layout only; they do not import Tailwind. */
.flex { display: flex; }
.grid { display: grid; }
.block { display: block; }
.inline-flex { display: inline-flex; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.justify-end { justify-content: flex-end; }
.flex-wrap { flex-wrap: wrap; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.ml-auto { margin-left: auto; }
.mb-1 { margin-bottom: 4px; }
.mb-3 { margin-bottom: 12px; }
.w-full { width: 100%; }
.min-w-0 { min-width: 0; }
.shrink-0 { flex-shrink: 0; }
.text-center { text-align: center; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.space-y-2 > * + * { margin-top: 8px; }
.space-y-3 > * + * { margin-top: 12px; }
.space-y-4 > * + * { margin-top: 16px; }
.space-y-5 > * + * { margin-top: 20px; }

.text-display { margin: 0; color: var(--ui-text); font-size: 1.45rem; font-weight: 650; letter-spacing: -.025em; }
.text-title { margin: 0; color: var(--ui-text); font-size: 1rem; font-weight: 650; letter-spacing: -.015em; }
.text-caption, .text-xs { color: var(--ui-muted); font-size: .76rem; line-height: 1.45; }
.text-primary { color: var(--ui-text); }
.text-accent { color: var(--ui-accent); }
.text-danger { color: var(--ui-danger); }
.font-medium { font-weight: 550; }
.font-semibold { font-weight: 650; }

.card, .ui-card, .clinical-card, .ay-card, .ay-clinical-card {
  border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius);
  background: var(--ui-surface);
  box-shadow: var(--ui-shadow-card);
}

.btn, .ui-button, .ay-button, .clinical-surface button, .clinical-surface a.ui-button {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 8px 14px;
  border: 1px solid var(--ui-border-strong);
  border-radius: var(--ui-radius-sm);
  background: var(--ui-surface);
  color: var(--ui-text-soft);
  font-size: .76rem;
  font-weight: 620;
  line-height: 1.1;
  text-decoration: none;
  transition: border-color var(--ui-duration-fast) var(--ui-ease-out), background-color var(--ui-duration-fast) var(--ui-ease-out), color var(--ui-duration-fast) var(--ui-ease-out), box-shadow var(--ui-duration-fast) var(--ui-ease-out), transform var(--ui-duration-fast) var(--ui-ease-out);
}
.btn:hover, .ui-button:hover, .ay-button:hover, .clinical-surface button:hover, .clinical-surface a.ui-button:hover {
  border-color: var(--ui-accent-border);
  background: var(--ui-accent-soft);
  color: var(--ui-accent-hover);
}
.btn-primary, .ui-button--primary, .ay-button--primary, .clinical-surface button.primary, .clinical-surface .ui-button--primary {
  border-color: var(--ui-accent-fill);
  background: var(--ui-accent-fill);
  color: var(--ui-on-accent);
}
.btn-primary:hover, .ui-button--primary:hover, .ay-button--primary:hover, .clinical-surface button.primary:hover, .clinical-surface .ui-button--primary:hover {
  border-color: var(--ui-accent-fill-hover);
  background: var(--ui-accent-fill-hover);
  color: var(--ui-on-accent);
}
.btn-secondary, .ui-button--secondary, .ay-button--secondary { background: var(--ui-surface); }
.ui-button--soft, .ay-button--soft, .clinical-surface .ui-button--soft { border-color: var(--ui-accent-border); background: var(--ui-accent-soft); color: var(--ui-accent); }
.ui-button--soft:hover, .ay-button--soft:hover, .clinical-surface .ui-button--soft:hover { border-color: var(--ui-accent); background: color-mix(in srgb, var(--ui-accent-soft) 78%, var(--ui-accent) 22%); color: var(--ui-accent-hover); }
.ay-button--quiet { background: transparent; color: var(--ui-text-soft); }
.ay-button--quiet:hover { border-color: var(--ui-accent-border); background: var(--ui-accent-soft); color: var(--ui-accent-hover); }
.btn-danger, .ui-button--danger, .ay-button--danger { border-color: var(--ui-danger-border); background: var(--ui-danger-soft); color: var(--ui-danger); }
.btn-danger:hover, .ui-button--danger:hover, .ay-button--danger:hover { border-color: var(--ui-danger); background: var(--ui-danger); color: #ffffff; }
.ay-button:active:not(:disabled) { transform: translateY(1px); }
.btn-icon, .ui-icon-button {
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  display: inline-grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: var(--ui-radius-sm);
  background: transparent;
  color: var(--ui-muted);
}
.btn-icon:hover, .ui-icon-button:hover { background: var(--ui-surface-muted); color: var(--ui-accent); }

.ui-field, .clinical-surface label.ui-field {
  min-width: 0;
  display: grid;
  align-content: start;
  gap: 6px;
  margin: 0;
  color: var(--ui-text-soft);
  font-size: .76rem;
  font-weight: 620;
}
.ui-field__hint { color: var(--ui-muted); font-size: .7rem; font-weight: 450; line-height: 1.45; }
.ui-input, .ui-textarea, .ui-select,
.clinical-surface input:not([type="checkbox"]):not([type="radio"]),
.clinical-surface textarea, .clinical-surface select {
  width: 100%;
  min-width: 0;
  min-height: 40px;
  margin: 0;
  padding: 9px 11px;
  border: 1px solid var(--ui-border-strong);
  border-radius: var(--ui-radius-sm);
  background: var(--ui-surface);
  color: var(--ui-text);
  font-size: 14px;
  font-weight: 430;
  line-height: 1.4;
}
.ui-textarea, .clinical-surface textarea { min-height: 96px; resize: vertical; }
.ui-select, .clinical-surface select {
  appearance: none;
  padding-right: 34px;
  background-image: linear-gradient(45deg, transparent 50%, #768187 50%), linear-gradient(135deg, #768187 50%, transparent 50%);
  background-position: calc(100% - 16px) 17px, calc(100% - 11px) 17px;
  background-repeat: no-repeat;
  background-size: 5px 5px, 5px 5px;
}
.ui-input:hover, .ui-textarea:hover, .ui-select:hover,
.clinical-surface input:not([type="checkbox"]):not([type="radio"]):hover,
.clinical-surface textarea:hover, .clinical-surface select:hover { border-color: #c8d2d4; }
.ui-input:focus, .ui-textarea:focus, .ui-select:focus,
.clinical-surface input:not([type="checkbox"]):not([type="radio"]):focus,
.clinical-surface textarea:focus, .clinical-surface select:focus { border-color: var(--ui-accent); }
input[type="checkbox"], input[type="radio"] { accent-color: var(--ui-accent); }

.ui-form, .clinical-surface form { display: grid; gap: 13px; margin: 0; }
.ui-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px 15px; }
.ui-form-actions, .actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.ui-form-section {
  min-width: 0;
  padding: 16px;
  border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius);
  background: var(--ui-surface);
  box-shadow: var(--ui-shadow-card);
}
.ui-form-section__header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.ui-form-section__header h3, .ui-card h3 { margin: 0; color: var(--ui-text); font-size: .9rem; font-weight: 650; }
.ui-form-section__header p { margin: 4px 0 0; color: var(--ui-muted); font-size: .72rem; }

.ui-disclosure {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius);
  background: var(--ui-surface);
  box-shadow: var(--ui-shadow-card);
}
.ui-disclosure__trigger, .clinical-surface .ui-disclosure__trigger {
  width: 100%;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 13px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--ui-text);
  font-size: .78rem;
  font-weight: 650;
  text-align: left;
}
.ui-disclosure__trigger:hover, .clinical-surface .ui-disclosure__trigger:hover { border-color: transparent; background: var(--ui-surface-soft); color: var(--ui-accent); }
.ui-disclosure__trigger i { width: 13px; height: 13px; flex: 0 0 13px; transition: transform 140ms ease; }
.ui-disclosure__trigger[aria-expanded="true"] i { transform: rotate(180deg); }
.ui-disclosure__body { display: grid; gap: 13px; padding: 0 13px 13px; border-top: 1px solid var(--ui-border); }
.ui-disclosure__body[hidden] { display: none; }
.ui-disclosure__body > :first-child { margin-top: 13px; }

.ui-chip, .clinical-badge, .badge, .eyebrow {
  width: fit-content;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 8px;
  border-radius: 999px;
  background: var(--ui-surface-muted);
  color: #566268;
  font-size: .65rem;
  font-weight: 620;
  line-height: 1;
  white-space: nowrap;
}
.ui-chip--success { background: var(--ui-success-soft); color: var(--ui-success); }
.ui-chip--warning { background: var(--ui-warning-soft); color: var(--ui-warning); }
.ui-chip--danger { background: var(--ui-danger-soft); color: var(--ui-danger); }

.ui-modal, .dashboard-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(24, 34, 39, .5);
}
.ui-dialog, .dashboard-dialog {
  width: min(100%, 620px);
  max-height: min(90dvh, 840px);
  overflow: auto;
  border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius-lg);
  background: var(--ui-surface);
  box-shadow: var(--ui-shadow-dialog);
}
.ui-dialog__header, .ui-dialog__footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 15px 17px; }
.ui-dialog__header { border-bottom: 1px solid var(--ui-border); }
.ui-dialog__footer { border-top: 1px solid var(--ui-border); }
.ui-dialog__body { padding: 17px; }

/* One self-contained outline icon system. Existing class names are retained
   as behavior hooks, but Font Awesome is no longer loaded. */
.fa-solid, .fa-regular, .fa-brands {
  width: 18px;
  height: 18px;
  display: inline-block;
  flex: 0 0 18px;
  background: currentColor;
  -webkit-mask: var(--ui-icon) center / contain no-repeat;
  mask: var(--ui-icon) center / contain no-repeat;
  font-size: 0 !important;
  line-height: 0;
}
.fa-magnifying-glass { --ui-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7.5'/%3E%3Cpath d='m20 20-3.7-3.7'/%3E%3C/svg%3E"); }
.fa-house { --ui-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m3 11 9-8 9 8'/%3E%3Cpath d='M5 10v11h14V10M9 21v-7h6v7'/%3E%3C/svg%3E"); }
.fa-clipboard-check { --ui-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9 5V3h6v2M8 4H6v17h12V4h-2'/%3E%3Cpath d='m9 13 2 2 4-5'/%3E%3C/svg%3E"); }
.fa-sliders, .fa-arrow-down-short-wide, .fa-arrow-up-short-wide { --ui-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round'%3E%3Cpath d='M4 7h10M18 7h2M4 17h3M11 17h9M14 4v6M7 14v6'/%3E%3C/svg%3E"); }
.fa-stethoscope { --ui-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 3v6a4 4 0 0 0 8 0V3M4 3h4M12 3h4M10 15v1a4 4 0 0 0 8 0v-2'/%3E%3Ccircle cx='18' cy='11' r='2'/%3E%3C/svg%3E"); }
.fa-leaf { --ui-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 4C12 4 5 8 5 15c0 3 2 5 5 5 7 0 10-8 10-16Z'/%3E%3Cpath d='M4 21c3-7 8-10 13-13'/%3E%3C/svg%3E"); }
.fa-box-archive, .fa-folder-open { --ui-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linejoin='round'%3E%3Cpath d='M4 7h16v13H4zM3 3h18v4H3zM9 11h6'/%3E%3C/svg%3E"); }
.fa-users, .fa-user, .fa-address-card, .fa-user-check, .fa-user-lock, .fa-user-plus { --ui-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round'%3E%3Ccircle cx='9' cy='8' r='3'/%3E%3Cpath d='M3 20c0-4 2-6 6-6s6 2 6 6M17 5a3 3 0 0 1 0 6M18 14c2 .6 3 2.4 3 5'/%3E%3C/svg%3E"); }
.fa-bell { --ui-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round'%3E%3Cpath d='M18 8a6 6 0 0 0-12 0c0 7-3 7-3 9h18c0-2-3-2-3-9M10 21h4'/%3E%3C/svg%3E"); }
.fa-xmark { --ui-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.9' stroke-linecap='round'%3E%3Cpath d='m6 6 12 12M18 6 6 18'/%3E%3C/svg%3E"); }
.fa-envelope, .fa-envelope-circle-check { --ui-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linejoin='round'%3E%3Cpath d='M3 5h18v14H3zM3 6l9 7 9-7'/%3E%3C/svg%3E"); }
.fa-note-sticky, .fa-file-medical, .fa-notes-medical, .fa-clipboard, .fa-file-pdf { --ui-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 3h9l3 3v15H6zM15 3v4h4M9 11h6M9 15h6'/%3E%3C/svg%3E"); }
.fa-list-check { --ui-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round'%3E%3Cpath d='m3 6 2 2 3-4M11 6h10M3 14l2 2 3-4M11 14h10M11 20h10'/%3E%3C/svg%3E"); }
.fa-comment-dots { --ui-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linejoin='round'%3E%3Cpath d='M21 15a4 4 0 0 1-4 4H8l-5 3V7a4 4 0 0 1 4-4h10a4 4 0 0 1 4 4z'/%3E%3C/svg%3E"); }
.fa-check { --ui-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='m5 12 4 4L19 6'/%3E%3C/svg%3E"); }
.fa-arrow-left, .fa-chevron-left { --ui-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.9' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m15 18-6-6 6-6'/%3E%3C/svg%3E"); }
.fa-chevron-right { --ui-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.9' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m9 6 6 6-6 6'/%3E%3C/svg%3E"); }
.fa-chevron-down { --ui-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.9' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); }
.fa-prescription { --ui-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round'%3E%3Cpath d='M5 3v18M5 4h7a4 4 0 0 1 0 8H5M11 12l8 9M18 13l-7 8'/%3E%3C/svg%3E"); }
.fa-flask { --ui-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linejoin='round'%3E%3Cpath d='M9 3h6M10 3v6L4 20h16L14 9V3M7 15h10'/%3E%3C/svg%3E"); }
.fa-x-ray, .fa-image { --ui-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linejoin='round'%3E%3Crect x='3' y='4' width='18' height='16' rx='2'/%3E%3Ccircle cx='9' cy='9' r='2'/%3E%3Cpath d='m4 18 5-5 4 4 2-2 5 5'/%3E%3C/svg%3E"); }
.fa-download, .fa-arrow-up-right-from-square { --ui-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round'%3E%3Cpath d='M12 3v12M7 10l5 5 5-5M5 21h14'/%3E%3C/svg%3E"); }
.fa-trash, .fa-trash-can { --ui-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round'%3E%3Cpath d='M4 7h16M9 7V4h6v3M6 7l1 14h10l1-14M10 11v6M14 11v6'/%3E%3C/svg%3E"); }
.fa-lock, .fa-shield-halved { --ui-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linejoin='round'%3E%3Cpath d='M12 3 4 6v6c0 5 3.5 8 8 9 4.5-1 8-4 8-9V6z'/%3E%3C/svg%3E"); }
.fa-triangle-exclamation, .fa-exclamation { --ui-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linejoin='round'%3E%3Cpath d='m12 3 10 18H2zM12 9v5M12 18h.01'/%3E%3C/svg%3E"); }
.fa-copy { --ui-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8'%3E%3Crect x='8' y='8' width='12' height='12' rx='2'/%3E%3Cpath d='M16 8V4H4v12h4'/%3E%3C/svg%3E"); }
.fa-arrows-rotate, .fa-rotate { --ui-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round'%3E%3Cpath d='M20 7v5h-5M4 17v-5h5M6.5 8A7 7 0 0 1 19 10M17.5 16A7 7 0 0 1 5 14'/%3E%3C/svg%3E"); }
.fa-arrow-right-from-bracket { --ui-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round'%3E%3Cpath d='M10 4H4v16h6M14 8l4 4-4 4M8 12h10'/%3E%3C/svg%3E"); }
.fa-circle-question { --ui-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M9.7 9a2.5 2.5 0 1 1 3.1 2.4c-.8.3-.8 1-.8 1.6M12 17h.01'/%3E%3C/svg%3E"); }
.fa-gear { --ui-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.38a2 2 0 0 0-.73-2.73l-.15-.09a2 2 0 0 1-1-1.74v-.51a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z'/%3E%3Ccircle cx='12' cy='12' r='3'/%3E%3C/svg%3E"); }
.fa-clock, .fa-clock-rotate-left { --ui-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 7v5l3 2'/%3E%3C/svg%3E"); }
.fa-route { --ui-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='6' cy='18' r='2'/%3E%3Ccircle cx='18' cy='6' r='2'/%3E%3Cpath d='M8 18h3a3 3 0 0 0 3-3v-6a3 3 0 0 1 3-3h1'/%3E%3C/svg%3E"); }
.fa-calendar-check { --ui-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='5' width='18' height='16' rx='2'/%3E%3Cpath d='M8 3v4M16 3v4M3 10h18M8 15l2 2 5-5'/%3E%3C/svg%3E"); }
.fa-paperclip { --ui-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m20 11-8.5 8.5a5 5 0 0 1-7-7L14 3a3.5 3.5 0 0 1 5 5l-9.5 9.5a2 2 0 0 1-3-3L15 6'/%3E%3C/svg%3E"); }
.fa-mobile-screen-button { --ui-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='6' y='2' width='12' height='20' rx='2'/%3E%3Cpath d='M10 5h4M12 18h.01'/%3E%3C/svg%3E"); }
.fa-heart-pulse { --ui-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linejoin='round'%3E%3Cpath d='M20.8 4.6a5.5 5.5 0 0 0-7.8 0L12 5.6l-1-1a5.5 5.5 0 0 0-7.8 7.8L12 21l8.8-8.6a5.5 5.5 0 0 0 0-7.8Z'/%3E%3Cpath d='M3 12h5l2-3 3 6 2-3h6'/%3E%3C/svg%3E"); }
.fa-wand-magic-sparkles { --ui-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round'%3E%3Cpath d='m4 20 11-11M13 4l1 2 2 1-2 1-1 2-1-2-2-1 2-1zM19 13l.7 1.3L21 15l-1.3.7L19 17l-.7-1.3L17 15l1.3-.7zM5 6l.7 1.3L7 8l-1.3.7L5 10l-.7-1.3L3 8l1.3-.7z'/%3E%3C/svg%3E"); }
.fa-circle-notch { --ui-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Cpath d='M12 3a9 9 0 1 1-8 5'/%3E%3C/svg%3E"); }
.fa-moon { --ui-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 15.5A8.5 8.5 0 0 1 8.5 4 8.5 8.5 0 1 0 20 15.5Z'/%3E%3C/svg%3E"); }
.fa-sun { --ui-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='4'/%3E%3Cpath d='M12 2v2M12 20v2M4.9 4.9l1.4 1.4M17.7 17.7l1.4 1.4M2 12h2M20 12h2M4.9 19.1l1.4-1.4M17.7 6.3l1.4-1.4'/%3E%3C/svg%3E"); }
.fa-plus { --ui-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.9' stroke-linecap='round'%3E%3Cpath d='M12 5v14M5 12h14'/%3E%3C/svg%3E"); }
.fa-bars { --ui-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round'%3E%3Cpath d='M4 7h16M4 12h16M4 17h16'/%3E%3C/svg%3E"); }
.fa-ellipsis { --ui-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black'%3E%3Ccircle cx='5' cy='12' r='1.6'/%3E%3Ccircle cx='12' cy='12' r='1.6'/%3E%3Ccircle cx='19' cy='12' r='1.6'/%3E%3C/svg%3E"); }
.fa-language { --ui-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 5h10M9 3v2M6 9c2 3 4 5 7 6M13 6c-1 4-4 7-8 9M14 21l4-10 4 10M15.5 17h5'/%3E%3C/svg%3E"); }
.fa-microphone { --ui-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round'%3E%3Crect x='9' y='3' width='6' height='11' rx='3'/%3E%3Cpath d='M5 11a7 7 0 0 0 14 0M12 18v3M9 21h6'/%3E%3C/svg%3E"); }
.fa-paper-plane { --ui-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m3 11 18-8-8 18-2-8zM11 13 21 3'/%3E%3C/svg%3E"); }
.fa-stop { --ui-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black'%3E%3Crect x='6' y='6' width='12' height='12' rx='2'/%3E%3C/svg%3E"); }
.fa-circle { --ui-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black'%3E%3Ccircle cx='12' cy='12' r='8'/%3E%3C/svg%3E"); }
.fa-circle-check { --ui-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='m8 12 2.5 2.5L16 9'/%3E%3C/svg%3E"); }
.fa-circle-exclamation { --ui-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 7v6M12 17h.01'/%3E%3C/svg%3E"); }
.fa-arrow-rotate-right, .fa-rotate-right { --ui-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 11a8 8 0 1 0-2.3 5.7M20 4v7h-7'/%3E%3C/svg%3E"); }
.fa-shield-heart { --ui-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 3 4 6v6c0 5 3.5 8 8 9 4.5-1 8-4 8-9V6z'/%3E%3Cpath d='M15.4 9.2a2.1 2.1 0 0 0-3 0l-.4.4-.4-.4a2.1 2.1 0 1 0-3 3L12 15.5l3.4-3.3a2.1 2.1 0 0 0 0-3Z'/%3E%3C/svg%3E"); }
.fa-apple { --ui-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black'%3E%3Cpath d='M16.7 13.1c0-2.5 2-3.7 2.1-3.8a4.6 4.6 0 0 0-3.6-2c-1.5-.2-3 .9-3.8.9-.8 0-2-.9-3.3-.8a4.9 4.9 0 0 0-4.1 2.5c-1.8 3.1-.5 7.7 1.2 10.2.9 1.2 1.9 2.5 3.2 2.4 1.3-.1 1.8-.8 3.4-.8 1.6 0 2 .8 3.4.8 1.4 0 2.3-1.2 3.1-2.4 1-1.4 1.4-2.8 1.4-2.9-.1 0-3-.9-3-4.1ZM14.2 5.7a4.2 4.2 0 0 0 1-3.1 4.4 4.4 0 0 0-2.9 1.5 4 4 0 0 0-1 3c1.1.1 2.2-.5 2.9-1.4Z'/%3E%3C/svg%3E"); }
.fa-google-play { --ui-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black'%3E%3Cpath d='M4 3.8v16.4l9-8.2zM14.4 10.7l2.4-2.2L6.8 3l7.6 7.7ZM14.4 13.3 6.8 21l10-5.5zM18 9.2 15.1 12l2.9 2.8c2.7-1.5 2.7-4.1 0-5.6Z'/%3E%3C/svg%3E"); }
.fa-spin { animation: ui-spin .8s linear infinite; }
@keyframes ui-spin { to { transform: rotate(360deg); } }

@media (max-width: 720px) {
  .ui-form-grid { grid-template-columns: 1fr; }
  .ui-dialog, .dashboard-dialog { width: 100%; max-height: calc(100dvh - 18px); }
  .ui-modal, .dashboard-modal { align-items: end; padding: 9px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; }
}

/* ========================================================================== */
/* Dashboard application rules — consolidated 2026-09-07                    */
/* Preserved from the former dashboard.css in original cascade order.         */
/* ========================================================================== */

/* Provider dashboard — canonical layout.
   The approved dashboard visual-direction prototype is the source of truth.
   This stylesheet intentionally does not layer over an earlier dashboard. */
html, body { width: 100%; min-width: 320px; height: 100%; overflow: hidden; overscroll-behavior-x: none; }
body { min-height: 100dvh; }

#authLoadingGate, #pinGate {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: grid;
  place-items: center;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: var(--ui-canvas);
}
#authLoadingGate[hidden], #authLoadingGate.hidden, #pinGate[hidden], #pinGate.hidden { display: none !important; }
.auth-loading-content { box-sizing: border-box; width: min(404px, calc(100vw - 40px)); height: 440px; min-height: 440px; display: flex; align-items: center; justify-content: center; gap: 10px; padding: 24px; overflow: hidden; border: 1px solid var(--ui-border); border-radius: var(--ui-radius-lg); background: #fff; color: var(--ui-text-soft); font-size: .82rem; box-shadow: var(--ui-shadow-dialog); }
#pinGate > .card { box-sizing: border-box; width: min(404px, calc(100vw - 40px)); height: 440px; min-height: 440px; padding: 24px; overflow: hidden; }
.login-card { display: grid; grid-template-rows: auto 1fr; align-content: start; gap: 18px; box-shadow: var(--ui-shadow-dialog); }
.login-card-header { display: grid; justify-items: center; gap: 8px; }
.login-card-icon { width: 48px; height: 48px; margin: 0 auto 2px; font-size: 1rem; }
.login-form { display: grid; gap: 12px; }
.icon-tile { display: grid; place-items: center; border-radius: var(--ui-radius); background: var(--ui-accent-soft); color: var(--ui-accent); }
.login-options-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.remember-me-row, .remember-me-label { display: flex; align-items: center; gap: 6px; }
.remember-me-label { margin: 0; color: var(--ui-text-soft); }
.remember-me-label input { width: 17px; height: 17px; margin: 0; }
.remember-me-info { position: relative; display: grid; place-items: center; width: 18px; height: 18px; padding: 0; border: 1px solid var(--ui-border-strong); border-radius: 50%; background: transparent; color: var(--ui-muted); font: inherit; font-size: 10px; cursor: help; }
.remember-me-info:focus-visible { outline: 2px solid var(--ui-accent); outline-offset: 2px; }
.remember-me-tooltip { position: absolute; left: 0; bottom: 26px; width: 230px; display: none; padding: 8px 10px; border-radius: var(--ui-radius-sm); background: #172126; color: #fff; font-size: .68rem; line-height: 1.4; }
.remember-me-info:hover .remember-me-tooltip, .remember-me-info:focus .remember-me-tooltip { display: block; }
.login-text-button { border: 0; background: transparent; color: var(--ui-accent); font-size: .76rem; font-weight: 600; text-decoration: none; }
.login-notice { padding: 9px 10px; border-radius: var(--ui-radius-sm); background: var(--ui-accent-soft); color: var(--ui-accent-hover); font-size: .74rem; line-height: 1.45; }
.login-form > .text-danger, .login-notice { min-height: 38px; }
#loginForm input:not([type="checkbox"]):not([type="radio"]),
#loginMfaForm input:not([type="checkbox"]):not([type="radio"]) {
  width: 100% !important;
  min-height: 42px;
  margin: 0 !important;
  padding: 10px 12px !important;
  border: 1px solid var(--ui-border-strong) !important;
  border-radius: var(--ui-radius-sm) !important;
  background: #fff !important;
  color: var(--ui-text) !important;
  font-size: 14px !important;
  transform: none !important;
}

/* Site-rendered modal system. Existing IDs remain stable for business logic. */
.verification-dialog {
  position: fixed !important;
  inset: 0 !important;
  z-index: 1000;
  width: min(calc(100vw - 36px), 460px);
  max-width: none;
  max-height: min(calc(100dvh - 36px), 720px);
  margin: auto !important;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius-lg);
  background: var(--ui-surface);
  color: var(--ui-text);
  box-shadow: var(--ui-shadow-dialog);
}
.verification-dialog::backdrop { background: rgba(24, 34, 39, .5); }
.verification-dialog h2 { margin: 0; font-size: 1rem; font-weight: 700; }
.verification-dialog__form { max-height: calc(100dvh - 96px); display: grid; gap: 12px; overflow-y: auto; overscroll-behavior: contain; }
.verification-dialog__error { margin: -2px 0 0; color: var(--ui-danger); font-size: .72rem; font-weight: 550; line-height: 1.4; }
.verification-dialog__actions { margin: 4px -17px -17px; }
.verification-dialog__actions .ui-button { flex: 0 1 auto; }
#recentAuthModal, #dashboardInputModal, #dashboardConfirmModal,
#mfaEnrollmentModal, #aiSettingsModal, #notificationCenterModal, #accountSettingsModal,
.attachment-preview-modal {
  position: fixed !important;
  inset: 0 !important;
  z-index: 100 !important;
  display: grid;
  place-items: center;
  padding: 18px !important;
  background: rgba(24, 34, 39, .5) !important;
}
/* Account Settings can launch destructive confirmations. Those child action
   dialogs must be above the still-open Settings layer, not behind it. */
#dashboardInputModal, #dashboardConfirmModal { z-index: 140 !important; }
#recentAuthModal, #mfaEnrollmentModal { z-index: 150 !important; }
#recentAuthModal.hidden, #dashboardInputModal.hidden,
#dashboardConfirmModal.hidden, #mfaEnrollmentModal.hidden, #aiSettingsModal.hidden,
#notificationCenterModal.hidden, #accountSettingsModal.hidden,
.attachment-preview-modal.hidden { display: none !important; }
.dashboard-settings-dialog, .attachment-preview-dialog {
  width: min(100%, 520px) !important;
  max-width: none !important;
  max-height: min(90dvh, 850px);
  overflow: auto;
  padding: 20px !important;
  border: 1px solid var(--ui-border) !important;
  border-radius: var(--ui-radius-lg) !important;
  background: #fff !important;
  box-shadow: var(--ui-shadow-dialog) !important;
}
.dashboard-settings-dialog { width: min(100%, 940px) !important; padding: 0 !important; }
.focused-dialog { width: min(100%, 680px); }
.settings-dialog-subtitle, .dialog-subtitle { margin: 3px 0 0; }
.notification-center-body, .account-settings-body { display: grid; gap: 12px; }
.clinic-alert-list { display: grid; gap: 8px; margin-top: 10px; }
.clinic-alert-row { min-width: 0; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px; border: 1px solid var(--ui-border); border-radius: var(--ui-radius-sm); background: var(--ui-surface-soft); }
.clinic-alert-row.is-critical { border-color: var(--ui-danger-border); background: var(--ui-danger-soft); }
.patient-message-notification-row .btn { flex: 0 0 auto; }
.security-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.dashboard-settings-header, .dashboard-settings-footer, .attachment-preview-header, .attachment-preview-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 15px 17px;
}
.dashboard-settings-header, .attachment-preview-header { border-bottom: 1px solid var(--ui-border); }
.dashboard-settings-footer, .attachment-preview-footer { border-top: 1px solid var(--ui-border); }
.dashboard-settings-body { padding: 17px; overflow: auto; }
.settings-panel-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.settings-panel { min-width: 0; padding: 15px; border: 1px solid var(--ui-border); border-radius: var(--ui-radius); background: #fff; }
.settings-panel--wide { grid-column: 1 / -1; }
.settings-panel-title { margin: 0; color: var(--ui-text); font-size: .86rem; font-weight: 650; }
.settings-panel-help { margin: 4px 0 12px; color: var(--ui-muted); font-size: .72rem; line-height: 1.5; }
.attachment-preview-dialog { width: min(100%, 920px) !important; padding: 0 !important; }
.attachment-preview-eyebrow { color: var(--ui-muted); font-size: .65rem; font-weight: 650; letter-spacing: .06em; text-transform: uppercase; }
.attachment-preview-heading h3 { margin: 3px 0 0; font-size: 1rem; }
.attachment-preview-close-icon { width: 38px; height: 38px; display: grid; place-items: center; border: 0; border-radius: var(--ui-radius-sm); background: transparent; color: var(--ui-muted); }
.attachment-preview-stage { min-height: min(60dvh, 560px); display: grid; place-items: center; padding: 16px; background: var(--ui-canvas); }
.attachment-preview-image { display: block; max-width: 100%; max-height: 58dvh; object-fit: contain; }
.attachment-preview-status { display: flex; align-items: center; gap: 9px; color: var(--ui-muted); font-size: .8rem; }
.attachment-preview-status.is-error { color: var(--ui-danger); }

/* Application frame */
.page-wrap { width: 100%; height: 100dvh; display: flex; flex-direction: column; overflow: hidden; background: var(--ui-canvas); }
.page-wrap:not(.visible) { display: none; }
.dashboard-masthead { flex: 0 0 56px; min-height: 56px; border-bottom: 1px solid var(--ui-border); background: var(--ui-surface); }
.dashboard-masthead-inner { height: 56px; display: flex; align-items: center; gap: 12px; padding: 0 18px; }
.dashboard-brand-lockup { display: flex; align-items: center; min-width: 0; gap: 9px; }
.dashboard-brand-mark { width: 32px; height: 32px; display: grid; place-items: center; border-radius: var(--ui-radius-sm); background: var(--ui-accent-soft); color: var(--ui-accent); }
.dashboard-brand-logo { width: 32px; height: 32px; flex: 0 0 32px; object-fit: contain; }
.dashboard-brand-primary { overflow: hidden; color: var(--ui-text); font-size: .88rem; font-weight: 680; text-overflow: ellipsis; white-space: nowrap; }
.dashboard-brand-divider { color: var(--ui-border-strong); }
.dashboard-brand-section { color: var(--ui-muted); font-size: .78rem; }
.dashboard-settings-trigger { width: 38px; height: 38px; display: grid; place-items: center; flex: 0 0 38px; margin-left: auto; padding: 0; border: 0; border-radius: 50%; background: transparent; color: var(--ui-text-soft); }
.dashboard-settings-trigger i { width: 19px; height: 19px; flex-basis: 19px; }
.dashboard-settings-trigger svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.dashboard-masthead-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.dashboard-masthead-actions .dashboard-settings-trigger { margin-left: 0; }
.dashboard-settings-trigger:hover { background: var(--ui-surface-muted); color: var(--ui-accent); }
body:has(.workspace-detail.has-selection) .dashboard-settings-trigger { display: none; }
.ay-refresh-action { width: 38px; height: 38px; display: grid; place-items: center; margin-left: auto; padding: 0; border: 0; border-radius: 50%; background: transparent; color: var(--ui-text-soft); }
.ay-refresh-action:hover { background: var(--ui-accent-soft); color: var(--ui-accent); }
@media (max-width:899px) { .ay-refresh-action { display: none; } }

#mainContent { flex: 1 1 auto; min-height: 0; display: grid; grid-template-columns: 64px minmax(0, 1fr); overflow: hidden; background: var(--ui-canvas); }
.dashboard-navigation-rail { min-height: 0; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 8px; border-right: 1px solid var(--ui-border); background: var(--ui-surface); }
.workspace-mode-row { width: 100%; display: flex; flex-direction: column; gap: 6px; }
/* The legacy `body:has(.workspace-detail.has-selection) .workspace-mode-row { display:none }`
   rule hides the queue mode row while a chart is open; the chart-tab rail row must stay
   visible in that same state, so it needs a higher-specificity override here. */
body:has(.workspace-detail.has-selection) .dashboard-navigation-rail .workspace-mode-row { display: flex; }
body:has(.workspace-detail.has-selection) .dashboard-navigation-rail .workspace-mode-row > .workspace-rail-button { display: none; }
.dashboard-navigation-rail .workspace-mode-row .btn, .dashboard-rail-control, .dashboard-account-trigger {
  position: relative;
  width: 38px;
  height: 38px;
  min-width: 38px;
  min-height: 38px;
  display: grid;
  place-items: center;
  margin: 0 auto;
  padding: 0;
  border: 0;
  border-radius: var(--ui-radius-sm);
  background: transparent;
  color: var(--ui-muted);
  box-shadow: none;
}
.dashboard-navigation-rail .workspace-mode-row .btn > span:not(.tab-count-badge) { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.dashboard-navigation-rail .workspace-mode-row .btn-primary,
.dashboard-navigation-rail .workspace-mode-row .btn:hover,
.dashboard-rail-control:hover { background: var(--ui-accent-soft); color: var(--ui-accent); }
.dashboard-rail-control { position: relative; }
.menu-alert-badge {
  position: absolute;
  top: -3px;
  right: -3px;
  min-width: 17px;
  height: 17px;
  display: inline-grid;
  place-items: center;
  padding: 0 4px;
  border: 2px solid var(--ui-surface);
  border-radius: 999px;
  background: var(--ui-danger);
  color: #fff;
  font-size: .58rem;
  font-weight: 700;
  line-height: 1;
}
.dashboard-navigation-rail [data-rail-label]::after {
  position: absolute;
  left: 46px;
  top: 50%;
  z-index: 95;
  min-width: max-content;
  padding: 6px 8px;
  border-radius: var(--ui-radius-xs);
  background: #172126;
  color: #fff;
  content: attr(data-rail-label);
  font-size: .68rem;
  font-weight: 550;
  opacity: 0;
  pointer-events: none;
  transform: translate(-4px, -50%);
  transition: opacity 120ms ease, transform 120ms ease;
  visibility: hidden;
}
.dashboard-navigation-rail [data-rail-label]:hover::after,
.dashboard-navigation-rail [data-rail-label]:focus-visible::after { opacity: 1; transform: translate(0, -50%); visibility: visible; }
.tab-count-badge { position: absolute; top: -4px; right: -4px; min-width: 18px; height: 18px; display: grid; place-items: center; padding: 0 4px; border: 2px solid #fff; border-radius: 999px; background: var(--ui-accent); color: #fff; font-size: 9px; font-weight: 700; }
#completedCount { display: none !important; }
.dashboard-rail-spacer { flex: 1; }
.dashboard-rail-control-wrap { position: relative; flex: 0 0 38px; }
.dashboard-account-wrap { position: relative; flex: 0 0 auto; }
.dashboard-account-trigger { border-radius: 50%; background: #2b3938; color: #fff; font-size: .7rem; font-weight: 720; }
.dashboard-account-popover { position: absolute; left: 48px; bottom: 0; z-index: 98; width: 225px; padding: 7px; border: 1px solid var(--ui-border); border-radius: var(--ui-radius-sm); background: var(--ui-surface); box-shadow: var(--ui-shadow-popover); }
.dashboard-account-popover:not(.open) { display: none; }
.dashboard-account-identity { display: grid; gap: 3px; padding: 8px 9px 10px; border-bottom: 1px solid var(--ui-border); }
.dashboard-account-identity strong { font-size: .8rem; font-weight: 650; }
.dashboard-account-identity span { color: var(--ui-muted); font-size: .69rem; }
.menu-grid { display: grid; gap: 2px; padding-top: 5px; }
.menu-grid-btn { width: 100%; min-height: 36px; display: flex; align-items: center; justify-content: flex-start; gap: 9px; padding: 7px 9px; border: 0; border-radius: var(--ui-radius-xs); background: transparent; color: var(--ui-text-soft); font-size: .74rem; text-decoration: none; }
.menu-grid-btn:hover { background: var(--ui-surface-muted); }
.menu-grid-btn--danger { color: var(--ui-danger); }

/* Full-width queue */
.workspace { position: relative; min-width: 0; min-height: 0; height: 100%; overflow: hidden; }
.workspace-sidebar { position: absolute; inset: 0; display: flex; flex-direction: column; min-width: 0; min-height: 0; padding: 15px 19px 17px; background: var(--ui-canvas); }
.workspace-sidebar-heading { display: flex; align-items: center; justify-content: space-between; min-height: 42px; margin-bottom: 10px; }
.workspace-sidebar-heading h1 { margin: 0; color: var(--ui-text); font-size: 1.25rem; font-weight: 650; letter-spacing: -.025em; }
.workspace-eyebrow { display: none; }
.workspace-live-indicator { display: inline-flex; align-items: center; gap: 6px; color: var(--ui-muted); font-size: .68rem; }
.workspace-live-indicator > span { width: 7px; height: 7px; border-radius: 50%; background: #43a072; }
.workspace-toolbar { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.workspace-filter-wrap { position: relative; flex: 0 0 auto; }
.workspace-search { width: min(520px, calc(100% - 150px)); height: 40px; display: flex; align-items: center; gap: 8px; padding: 0 12px; border: 1px solid var(--ui-border-strong); border-radius: var(--ui-radius-sm); background: var(--ui-surface); }
.workspace-search-icon { color: var(--ui-muted); }
.workspace-search-input { flex: 1; min-width: 0; height: 38px; padding: 0; border: 0; outline: 0; background: transparent; color: var(--ui-text); font-size: 16px; }
.workspace-search-input::placeholder { color: var(--ui-faint); }
.workspace-search-clear { width: 30px; height: 30px; display: grid; place-items: center; padding: 0; border: 0; border-radius: var(--ui-radius-xs); background: transparent; color: var(--ui-muted); }
.workspace-sort-btn { min-height: 38px; display: inline-flex; align-items: center; gap: 7px; padding: 8px 13px; border: 1px solid var(--ui-border-strong); border-radius: 999px; background: var(--ui-surface); color: var(--ui-text-soft); font-size: .73rem; font-weight: 620; }
.workspace-sort-btn:hover { border-color: var(--ui-accent-border); background: var(--ui-accent-soft); color: var(--ui-accent); }
.workspace-filter-popover { position: absolute; top: 46px; right: 0; z-index: 40; width: 280px; padding: 14px; border: 1px solid var(--ui-border); border-radius: var(--ui-radius); background: var(--ui-surface); box-shadow: var(--ui-shadow-popover); }
.workspace-filter-popover h3 { margin: 0 0 10px; font-size: .83rem; }
.workspace-filter-group { padding: 10px 0; border-top: 1px solid var(--ui-border); }
.workspace-filter-group:first-of-type { border-top: 0; }
.workspace-filter-group > span { display: block; margin-bottom: 7px; color: var(--ui-muted); font-size: .66rem; font-weight: 650; letter-spacing: .05em; text-transform: uppercase; }
.workspace-filter-option { width: 100%; min-height: 34px; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 7px 8px; border: 0; border-radius: var(--ui-radius-xs); background: transparent; color: var(--ui-text-soft); font-size: .74rem; text-align: left; }
.workspace-filter-option:hover, .workspace-filter-option[aria-pressed="true"] { background: var(--ui-accent-soft); color: var(--ui-accent); }
.workspace-filter-check { width: 17px; height: 17px; display: grid; place-items: center; border: 1px solid var(--ui-border-strong); border-radius: 4px; }
.workspace-filter-option[aria-pressed="true"] .workspace-filter-check { border-color: var(--ui-accent); background: var(--ui-accent); color: #fff; }
.clinical-access-status { margin: 0 0 10px; padding: 10px 12px; border: 1px solid var(--ui-border); border-radius: var(--ui-radius-sm); background: #fff; color: var(--ui-muted); font-size: .74rem; }
.workspace-table-head, .workspace-list .compact-card, .workspace-list .clinical-queue-card {
  display: grid;
  grid-template-columns: minmax(180px, 1.25fr) minmax(190px, 1.12fr) minmax(95px, .62fr) minmax(230px, 1.55fr) minmax(90px, .55fr) 42px;
  gap: 14px;
  align-items: center;
}
.workspace-table-head { min-height: 38px; padding: 0 15px; border: 1px solid var(--ui-border); border-bottom: 0; border-radius: var(--ui-radius) var(--ui-radius) 0 0; background: var(--ui-surface-soft); color: var(--ui-muted); font-size: .63rem; font-weight: 680; letter-spacing: .055em; text-transform: uppercase; }
.workspace-list-wrap { position: relative; flex: 1; min-height: 0; overflow: hidden; border: 1px solid var(--ui-border); border-radius: 0 0 var(--ui-radius) var(--ui-radius); background: var(--ui-surface); box-shadow: var(--ui-shadow-card); }
.workspace-list {
  height: 100%;
  min-height: 0;
  max-height: 100%;
  overflow-x: hidden;
  overflow-y: auto;
  background: var(--ui-surface);
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
}
.workspace-list .compact-card, .workspace-list .clinical-queue-card { position: relative; width: 100%; min-height: 64px; margin: 0; padding: 8px 15px; border: 0; border-bottom: 1px solid var(--ui-border); border-radius: 0; background: var(--ui-surface); color: var(--ui-text); box-shadow: none; text-align: left; }
.workspace-list .compact-card:has(.patient-row-open:hover), .workspace-list .compact-card:focus-within,
.workspace-list .clinical-queue-card:has(.patient-row-open:hover), .workspace-list .clinical-queue-card:has(.patient-row-open[aria-current="page"]) { background: var(--ui-surface-soft); }
.workspace-list .compact-card.sidebar-card--selected { background: var(--ui-accent-soft); }
.patient-row-open { position: absolute; inset: 0; z-index: 0; width: 100%; min-height: 100%; padding: 0; border: 0; border-radius: inherit; background: transparent; color: inherit; }
.patient-row-open:focus-visible { box-shadow: inset var(--ui-focus); }
.workspace-list .compact-card > .patient-list-cell,
.workspace-list .clinical-queue-card > .patient-list-cell { position: relative; z-index: 1; pointer-events: none; }
.workspace-list .patient-list-note, .workspace-list .notes-widget, .workspace-list .notes-fab,
.workspace-list .safety-alert-icon { z-index: 2; pointer-events: auto; }
.patient-list-cell { min-width: 0; color: var(--ui-text-soft); font-size: .74rem; }
.patient-list-identity { display: flex; align-items: center; gap: 9px; }
.patient-list-avatar { width: 36px; height: 36px; display: grid; place-items: center; flex: 0 0 36px; border-radius: 50%; background: var(--ui-surface-muted); color: var(--ui-text-soft); font-size: .68rem; font-weight: 700; }
.patient-list-row-content { min-width: 0; }
.compact-card-identity { display: flex; align-items: center; gap: 6px; min-width: 0; }
.compact-card-name { overflow: hidden; color: var(--ui-text); font-size: .78rem; font-weight: 650; text-overflow: ellipsis; white-space: nowrap; }
.patient-list-demographics { display: flex; gap: 6px; margin-top: 3px; color: var(--ui-muted); font-size: .68rem; }
.patient-list-email, .patient-list-reason { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.patient-list-email { display: flex; align-items: center; gap: 6px; }
.patient-list-email svg { width: 14px; height: 14px; flex: 0 0 14px; fill: none; stroke: var(--ui-faint); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.patient-type-badge { border: 1px solid transparent; }
.patient-type-badge--blue { border-color: var(--ui-info-border); background: var(--ui-info-soft); color: var(--ui-info); }
.patient-type-badge--green { border-color: #c8e2d1; background: var(--ui-success-soft); color: var(--ui-success); }
.wait-time { display: inline-flex; align-items: center; min-height: 24px; color: var(--ui-text-soft); font-size: .71rem; font-weight: 580; white-space: nowrap; }
.wait-time--watch, .wait-time--late { padding: 4px 9px; border-radius: 999px; font-weight: 650; }
.wait-time--watch { background: var(--ui-warning-soft); color: var(--ui-warning); }
.wait-time--late { background: var(--ui-danger-soft); color: var(--ui-danger); }
.program-status { display: inline-flex; align-items: center; min-height: 24px; padding: 4px 9px; border: 1px solid transparent; border-radius: 999px; font-size: .68rem; font-weight: 680; line-height: 1.2; white-space: nowrap; }
.program-status--pending-eligibility { border-color: var(--ui-info-border); background: var(--ui-info-soft); color: var(--ui-info); }
.program-status--awaiting-payment { border-color: var(--ui-warning-border); background: var(--ui-warning-soft); color: var(--ui-warning); }
.program-status--active { border-color: var(--ui-success-border); background: var(--ui-success-soft); color: var(--ui-success); }
.program-status--overdue { border-color: var(--ui-danger-border); background: var(--ui-danger-soft); color: var(--ui-danger); }
.program-status--cancellation-attention { border-color: #ddd1ee; background: #f4effb; color: #6f4a91; }
.sidebar-card-unread-dot { width: 7px; height: 7px; flex: 0 0 7px; margin-left: -3px; border-radius: 50%; background: var(--ui-accent); }
.notes-widget { position: relative; display: flex; justify-content: flex-end; }
.workspace-list .patient-list-note:has(.notes-popover.open),
.workspace-list .notes-widget:has(.notes-popover.open) { z-index: 110; }
.notes-fab { width: 36px; height: 36px; display: grid; place-items: center; padding: 0; border: 0; border-radius: var(--ui-radius-sm); background: transparent; color: var(--ui-muted); }
.notes-fab:hover, .notes-fab.has-notes { background: var(--ui-accent-soft); color: var(--ui-accent); }
.nf-icon { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.notes-fab.has-notes .nf-icon { fill: currentColor; fill-opacity: .16; }
.notes-popover { position: fixed; z-index: 85; width: min(330px, calc(100vw - 24px)); display: none; padding: 13px; border: 1px solid var(--ui-border); border-radius: var(--ui-radius); background: var(--ui-surface); box-shadow: var(--ui-shadow-popover); }
.notes-popover.open { display: block; }
.notes-popover-label { margin-bottom: 7px; color: var(--ui-text-soft); font-size: .72rem; font-weight: 650; }
.notes-save-status { display: block; margin-top: 7px; }
.provider-notes { width: 100%; min-height: 110px; padding: 10px 11px; border: 1px solid var(--ui-border-strong); border-radius: var(--ui-radius-sm); background: var(--ui-surface-soft); color: var(--ui-text); font-size: 16px; resize: vertical; }
.queue-section-label { padding: 10px 14px 7px; border-bottom: 1px solid var(--ui-border); background: #fafbfb; color: var(--ui-muted); font-size: .66rem; font-weight: 680; letter-spacing: .055em; text-transform: uppercase; }
.archive-service-filter { display: flex; align-items: center; justify-content: flex-end; gap: 8px; padding: 9px 13px; border-bottom: 1px solid var(--ui-border); color: var(--ui-muted); font-size: .72rem; font-weight: 620; }
.archive-service-filter select { width: auto; min-width: 145px; min-height: 34px; padding: 6px 30px 6px 9px; border: 1px solid var(--ui-border-strong); border-radius: var(--ui-radius-sm); background-color: #fff; font-size: 16px; }
.empty-state { display: grid; place-items: center; min-height: 180px; padding: 22px; color: var(--ui-muted); font-size: .8rem; text-align: center; }
.wellness-roster-list > .empty-state, .chart-content-section .empty-state, .clinical-files-section .empty-state { min-height: 0; padding: 12px 2px; justify-items: start; text-align: left; }
.chart-panel-loading { grid-column: 1 / -1; align-self: start; width: 100%; min-height: 128px; display: flex; align-items: center; justify-content: center; gap: 7px; padding: 22px; color: var(--ui-muted); font-size: .8rem; line-height: 1.4; text-align: center; }
.chart-panel-loading i { flex: 0 0 auto; }
.workspace-sidebar-footer { padding-top: 8px; }
.last-updated { color: var(--ui-faint); font-size: .66rem; }
.pull-refresh-indicator { display: none; }
.safety-alert-icon { width: 20px; height: 20px; display: grid; place-items: center; padding: 0; border: 0; border-radius: 50%; background: var(--ui-danger-soft); color: var(--ui-danger); }
.safety-alert-icon i { width: 11px; height: 11px; flex-basis: 11px; }
.safety-alert-popover { position: fixed; z-index: 90; display: none; max-width: min(330px, calc(100vw - 20px)); padding: 9px 11px; border-radius: var(--ui-radius-sm); background: #342525; color: #fff; font-size: .71rem; line-height: 1.45; box-shadow: var(--ui-shadow-popover); }
.safety-alert-popover.open { display: block; }

/* Full-screen chart workspace */
.workspace-detail { position: absolute; inset: 0; z-index: 20; display: none; min-width: 0; min-height: 0; background: var(--ui-canvas); }
.workspace-detail.has-selection { display: block; }
.workspace-detail-empty { height: 100%; display: none; place-items: center; color: var(--ui-muted); }
.workspace-detail-pulltab { display: none; }
.workspace-detail-card { width: 100%; height: 100%; max-height: 100%; min-height: 0; display: flex; flex-direction: column; overflow: hidden; border: 0; border-radius: 0; background: var(--ui-canvas); box-shadow: none; }
.patient-detail-modal-sticky-top { flex: 0 0 auto; background: #fff; }
.patient-open-tabs { min-height: 52px; display: flex; align-items: center; gap: 4px; padding: 6px 17px; border-bottom: 1px solid var(--ui-border); background: #fff; }
.patient-open-tab { min-height: 35px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 0 13px; border: 1px solid var(--ui-border); border-radius: var(--ui-radius-sm); background: #f7f9f9; color: var(--ui-muted); font-size: .73rem; line-height: 1; }
.patient-open-tab.is-active { border-color: var(--ui-accent-border); background: var(--ui-accent-soft); color: var(--ui-accent); font-weight: 650; }
.patient-open-tabs-fill { flex: 1; }
.patient-open-actions { min-width: 0; display: flex; align-items: center; gap: 7px; overflow: hidden; }
.clinical-shell-tools, .chart-tool-row { min-width: 0; display: flex; align-items: center; gap: 7px; }
.clinical-shell-tools[hidden] { display: none !important; }
.clinical-shell-tools { max-width: min(48vw, 520px); overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: thin; touch-action: pan-x; -webkit-overflow-scrolling: touch; }
.clinical-shell-tools .chart-tool-row { flex: 0 0 max-content; }
.clinical-shell-tools button, .chart-tool-row button { min-height: 35px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 7px 12px; border: 1px solid var(--ui-border-strong); border-radius: 999px; background: #fff; color: var(--ui-text-soft); font-size: .74rem; font-weight: 620; }
.clinical-shell-tools button i, .chart-tool-row button i { width: 16px; height: 16px; flex: 0 0 16px; margin: 0; }
.patient-detail-modal-header { min-height: 80px; display: grid; grid-template-columns: minmax(250px, 1fr) minmax(350px, 1.7fr); align-items: center; gap: 20px; padding: 10px 17px; border-bottom: 1px solid var(--ui-accent-border); background: var(--ui-accent-soft); }
.patient-detail-modal-identity h3 { margin: 0; font-size: 1rem; font-weight: 650; }
.patient-detail-modal-meta { color: var(--ui-muted); }
.patient-detail-summary { min-width: 0; }
.patient-detail-summary-label { color: var(--ui-accent); font-size: .61rem; font-weight: 700; letter-spacing: .065em; text-transform: uppercase; }
.patient-detail-summary p { margin: 5px 0 0; color: var(--ui-text-soft); font-size: .74rem; line-height: 1.45; }
.patient-detail-summary .ui-loading-state { display: inline-flex; align-items: center; gap: 6px; }
.patient-detail-summary .ui-loading-state i { flex: 0 0 auto; }
.patient-detail-modal-header-right { display: none; }
#patientDetailDeleteBtn, #patientDetailRetentionHoldBtn, #patientDetailCompleteBtn { display: none !important; }
.patient-detail-modal-header-right:empty { display: none; }
.detail-complete-toggle, .status-dot { width: 26px; height: 26px; display: grid; place-items: center; padding: 0; border: 1px solid var(--ui-border-strong); border-radius: 50%; background: #fff; color: var(--ui-faint); }
.detail-complete-toggle.is-checked, .status-dot.is-checked { border-color: #9acdaf; background: var(--ui-success-soft); color: var(--ui-success); }
.detail-complete-toggle i, .status-dot i { width: 13px; height: 13px; flex-basis: 13px; }
.patient-contact-row { grid-column: 1; display: flex; align-items: center; gap: 7px; margin-top: -18px; }
.email-copy-btn { min-width: 0; display: inline-flex; align-items: center; gap: 6px; padding: 0; border: 0; background: transparent; color: var(--ui-muted); }
.email-copy-btn span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.patient-detail-modal-status-icons { display: flex; gap: 5px; }
.patient-detail-safety-banner { display: flex; align-items: center; gap: 10px; padding: 9px 17px; border-bottom: 1px solid #efd3d0; background: var(--ui-danger-soft); color: var(--ui-danger); font-size: .72rem; }
.patient-detail-safety-banner div { display: flex; flex-wrap: wrap; gap: 7px; }
.patient-chart-layout { flex: 1 1 0; min-height: 0; display: flex; overflow: hidden; }
.patient-detail-view-buttons { position: fixed; top: 56px; bottom: 104px; left: 0; z-index: 70; width: 64px; display: none; flex-direction: column; align-items: center; padding: 12px 8px; border-right: 1px solid var(--ui-border); background: #fff; }
body:has(.workspace-detail.has-selection) .workspace-mode-row { display: none; }
body:has(.workspace-detail.has-selection) .patient-detail-view-buttons { display: flex; }
.patient-detail-tab-scroll { width: 100%; display: flex; flex-direction: column; align-items: center; gap: 6px; overflow: visible; }
.patient-detail-tab-scroll .btn { position: relative; width: 38px; height: 38px; min-width: 38px; min-height: 38px; gap: 0; padding: 0; border: 0; border-radius: var(--ui-radius-sm); background: transparent; color: var(--ui-muted); font-size: 0; }
.patient-detail-tab-scroll .btn i { width: 16px; height: 16px; flex: 0 0 16px; margin: 0; }
.patient-detail-tab-scroll .btn:hover, .patient-detail-tab-scroll .btn[aria-selected="true"], .patient-detail-tab-scroll .btn.btn-primary { background: var(--ui-accent-soft); color: var(--ui-accent); }
.patient-detail-tab-scroll .btn[aria-selected="true"] { box-shadow: none; }
.clinical-tab-unread-badge { position: absolute; top: -5px; right: -5px; z-index: 2; min-width: 17px; height: 17px; display: inline-grid; place-items: center; padding: 0 4px; border: 2px solid #fff; border-radius: 999px; background: var(--ui-danger); color: #fff; font-size: .56rem; font-weight: 700; line-height: 1; }
.workspace-detail-card.is-clinical-chart .telehealth-chart-tab { display: none !important; }
.patient-detail-tab-scroll .btn::after { position: absolute; left: 46px; top: 50%; z-index: 100; min-width: max-content; padding: 6px 8px; border-radius: var(--ui-radius-xs); background: #172126; color: #fff; content: attr(aria-label); font-size: .68rem; font-weight: 550; opacity: 0; pointer-events: none; transform: translate(-4px,-50%); visibility: hidden; }
.patient-detail-tab-scroll .btn:hover::after, .patient-detail-tab-scroll .btn:focus-visible::after { opacity: 1; transform: translate(0,-50%); visibility: visible; }
.patient-detail-tab-scroll .patient-complete-tab { margin-top: 8px; color: var(--ui-success); }
.patient-detail-copy-note-btn { display: none !important; }
.patient-chart-main { flex: 1 1 0; min-width: 0; min-height: 0; display: flex; flex-direction: column; overflow: hidden; background: var(--ui-canvas); }
.patient-detail-modal-body, .integrated-clinical-chart [role="tabpanel"] { flex: 1 1 0; min-height: 0; overflow-x: hidden; overflow-y: auto; padding: 16px 19px 22px; background: var(--ui-canvas); -webkit-overflow-scrolling: touch; touch-action: pan-y; }
.patient-detail-modal-footer { position: relative; z-index: 30; flex: 0 0 auto; min-height: 54px; padding: 8px 18px; border-top: 1px solid var(--ui-border); background: #fff; }
.workspace-detail-card.is-clinical-chart > .patient-chart-layout > .patient-chart-main > .patient-detail-modal-body { display: none !important; }
.workspace-detail-card.is-clinical-chart > .patient-chart-layout > .patient-chart-main > .patient-detail-modal-footer:empty { display: none !important; }
.integrated-clinical-chart { flex: 1 1 0; min-width: 0; min-height: 0; overflow: hidden; background: var(--ui-canvas); }
.integrated-clinical-chart > #detail { height: 100%; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
.integrated-clinical-chart > #detail > [role="tabpanel"]:not([hidden]) { width: 100%; height: 100%; min-height: 0; flex: 1 1 0; overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; touch-action: pan-y; }
.integrated-clinical-chart .clinical-chart-header { display: none; }

/* Unified chart content */
.chart-content-section, .soap-note-editor-wrap, .plan-order-section, .patient-data-highlights,
.patient-attachments, .instructions-diagnosis-block, .clinical-chart-section, .clinical-surface .document,
.clinical-surface .panel, .clinical-surface fieldset, .wellness-program-card, .wellness-answer-card {
  min-width: 0;
  margin: 0 0 12px;
  padding: 22px 26px;
  border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius);
  background: #fff;
  box-shadow: var(--ui-shadow-card);
}
.chart-content-section-header, .chart-section-heading, .wellness-card-heading, .wellness-workflow-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 13px; }
.chart-content-section h3, .chart-section-heading h3, .clinical-surface h3, .telehealth-chart-card h3, .wellness-card-heading h3, .wellness-workflow-heading h4 { margin: 0; color: var(--ui-text); font-size: .94rem; font-weight: 680; }
.chart-content-section p, .clinical-surface p, .telehealth-chart-card p, .wellness-card-heading p, .wellness-workflow-heading p { margin: 6px 0; color: var(--ui-muted); font-size: .78rem; line-height: 1.52; }
.soap-note-editor-wrap { padding: 0; overflow: hidden; }
.soap-note-editor { width: 100%; min-height: 55vh; padding: 18px; border: 0; background: #fff; color: var(--ui-text-soft); font-size: 14px; line-height: 1.65; resize: vertical; }
.workspace-detail-card.is-telehealth-chart .telehealth-chart-card { margin-bottom: 14px; }
.workspace-detail-card.is-telehealth-chart .telehealth-editor-wrap { margin: 0; padding: 0; border: 1px solid var(--ui-border-strong); border-radius: var(--ui-radius-sm); background: #fff; box-shadow: none; }
.workspace-detail-card.is-telehealth-chart .telehealth-editor-wrap .soap-note-editor { border-radius: inherit; }
.plan-sections { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.plan-section { min-width: 0; overflow: hidden; }
.plan-section-head { display: flex; align-items: center; min-height: 48px; padding: 13px 16px; border-bottom: 1px solid var(--ui-border); background: #fff; }
.plan-section-head h3 { margin: 0; color: var(--ui-text); font-size: .94rem; font-weight: 680; }
.plan-section-body { padding: 7px 16px 14px; }
.plan-order-row { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 9px; align-items: start; padding: 10px 0; border-bottom: 1px solid var(--ui-border); }
.plan-order-row:last-of-type { border-bottom: 0; }
.plan-order-row input[type="checkbox"] { margin-top: 2px; }
.clinical-surface input[type="checkbox"], .clinical-surface input[type="radio"],
.settings-panel input[type="checkbox"], .settings-panel input[type="radio"] {
  width: 18px;
  height: 18px;
  min-width: 18px;
  min-height: 18px;
  flex: 0 0 18px;
  margin: 0;
  padding: 0;
}
.plan-order-copy, .plan-order-name, .plan-order-script { min-width: 0; color: var(--ui-text-soft); font-size: .78rem; line-height: 1.45; }
.plan-manual-entries { display: grid; gap: 7px; padding-top: 9px; }
.plan-manual-entry-row { display: flex; gap: 6px; align-items: center; }
.plan-manual-entry-input-wrap { min-width: 0; flex: 1; }
.plan-manual-entry-input { width: 100%; min-height: 38px; padding: 8px 10px; border: 1px solid var(--ui-border-strong); border-radius: var(--ui-radius-sm); background: #fff; color: var(--ui-text); font: inherit; font-size: 14px; }
.plan-manual-add-btn, .plan-manual-remove-btn { min-height: 32px; border: 0; border-radius: 999px; background: transparent; color: var(--ui-accent); font: inherit; font-size: .7rem; font-weight: 650; cursor: pointer; }
.plan-manual-add-btn { justify-self: start; padding: 5px 8px; }
.plan-manual-remove-btn { width: 32px; flex: 0 0 32px; padding: 0; }
.plan-manual-add-btn:hover, .plan-manual-remove-btn:hover { background: var(--ui-accent-soft); }
.plan-generate-row, .patient-detail-field-actions { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 12px; }
.plan-generate-row { justify-content: flex-end; }
.patient-detail-field-actions-buttons { display: flex; flex-wrap: wrap; gap: 7px; }
.plan-notes-editor-wrap { margin-top: 0; }
.plan-notes-editor-wrap .soap-note-editor { min-height: 220px; }
.instructions-editor-wrap .soap-note-editor { min-height: 280px; }
.instructions-diagnosis-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 10px; }
.instructions-diagnosis-input-wrap { min-width: 0; display: grid; gap: 6px; }
.instructions-diagnosis-label, .patient-data-highlight-label { color: var(--ui-text-soft); font-size: .76rem; font-weight: 650; }
.instructions-diagnosis-input { width: 100%; min-height: 40px; padding: 9px 11px; border: 1px solid var(--ui-border-strong); border-radius: var(--ui-radius-sm); background: #fff; color: var(--ui-text); font-size: 14px; }
.patient-detail-modal-footer:empty { display: none; }
.patient-detail-modal-footer .patient-detail-field-actions { width: 100%; margin: 0; }
.patient-detail-modal-footer > .wellness-plan-footer,
.patient-detail-modal-footer > .clinical-complete-actions,
.patient-detail-modal-footer > .clinical-order-footer,
.patient-detail-modal-footer > [data-clinical-footer-for] {
  position: static;
  width: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  backdrop-filter: none;
}
.patient-detail-modal-footer:has(> .wellness-plan-footer) { margin-top: 12px; }
.plan-blocked-note { margin: 0 0 10px; padding: 9px 11px; border: 1px solid var(--ui-warning-border); border-radius: var(--ui-radius-sm); background: var(--ui-warning-soft); }
.plan-narrative-empty, .plan-section-empty { color: var(--ui-muted); }
.plan-loading-lines { display: grid; gap: 8px; padding: 7px 0 3px; }
.plan-loading-line { width: 100%; height: 10px; display: block; border-radius: 999px; background: #edf0f0; }
.plan-loading-line--long { width: 88%; }
.plan-loading-line--short { width: 61%; }
.plan-loading-card.is-generating .plan-loading-line { background: linear-gradient(90deg, #edf0f0 24%, var(--ui-accent-soft) 50%, #edf0f0 76%); background-size: 220% 100%; animation: plan-loading-shimmer 1.5s ease-in-out infinite; }
.plan-loading-caption { margin: 9px 0 0; }
.plan-generated-card--waiting textarea:disabled { background: var(--ui-surface-soft); color: var(--ui-muted); opacity: 1; }
@keyframes plan-loading-shimmer { from { background-position: 100% 0; } to { background-position: -100% 0; } }
.chart-card-grid, #clinical-panel-home:not([hidden]), .wellness-answer-grid, .wellness-program-section { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-content: start; gap: 12px; }
.chart-card-grid > .wide, .wellness-grid-wide, .wellness-program-overview-card, .wellness-card--wide { grid-column: 1 / -1; }
.wellness-program-section { grid-column: 1 / -1; margin: 0; }
.wellness-program-section > .wellness-card-heading { grid-column: 1 / -1; margin: 0 0 18px; padding: 0; }
.wellness-program-overview-card > .wellness-card-heading h3 { font-size: 1rem; font-weight: 650; }
.wellness-program-overview-card > .wellness-card-heading p { margin: 5px 0 0; font-size: .78rem; line-height: 1.48; }
.wellness-program-summary { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 34px; margin: 0; }
.wellness-program-summary > div { min-width: 0; padding: 12px 0; }
.wellness-program-summary > div:nth-child(n + 3) { border-top: 1px solid var(--ui-border); }
.wellness-program-summary dt { margin: 0 0 4px; color: var(--ui-muted); font-size: .72rem; font-weight: 500; letter-spacing: 0; text-transform: none; }
.wellness-program-summary dd { margin: 0; color: var(--ui-text); font-size: .88rem; font-weight: 550; line-height: 1.4; text-transform: capitalize; }
.wellness-program-summary dd.is-overdue { color: var(--ui-danger); }
.wellness-home-grid { width: 100%; min-width: 0; display: grid; grid-column: 1 / -1; grid-template-columns: repeat(2, minmax(0, 1fr)); align-content: start; gap: 12px; }
.wellness-home-grid > .patient-settings-card { min-width: 0; }
.wellness-home-summary:only-child { grid-column: 1 / -1; }
.wellness-workflow-card:has(.wellness-eligibility-state), .wellness-workflow-card:has(.wellness-eligibility-form) { grid-column: auto; }
.wellness-workflow-card:not(:has(.wellness-eligibility-state)):not(:has(.wellness-eligibility-form)) { grid-column: 1 / -1; }
.wellness-track-form { display: grid !important; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 10px !important; }
.wellness-track-form .ui-button { min-height: 40px; }
.wellness-progress { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 0; margin: 3px 0 0; padding: 0; list-style: none; }
.wellness-progress li { position: relative; min-width: 0; display: grid; justify-items: center; gap: 6px; color: var(--ui-faint); font-size: .66rem; text-align: center; }
.wellness-progress li:not(:last-child)::after { position: absolute; top: 12px; left: calc(50% + 14px); right: calc(-50% + 14px); height: 2px; background: var(--ui-border-strong); content: ""; }
.wellness-progress li > span { position: relative; z-index: 1; width: 25px; height: 25px; display: grid; place-items: center; border: 1px solid var(--ui-border-strong); border-radius: 50%; background: #fff; font-size: .65rem; font-weight: 700; }
.wellness-progress li strong { overflow: hidden; max-width: 100%; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.wellness-progress li.is-current, .wellness-progress li.is-complete { color: var(--ui-accent); }
.wellness-progress li.is-current > span, .wellness-progress li.is-complete > span { border-color: var(--ui-accent-border); background: var(--ui-accent-soft); }
.wellness-progress li.is-complete:not(:last-child)::after { background: var(--ui-accent-border); }
.wellness-eligibility-state { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.wellness-enrollment-notice, .wellness-eligibility-feedback { margin: 0; color: var(--ui-muted); font-size: .72rem; line-height: 1.45; }
.wellness-enrollment-notice { padding: 9px 10px; border: 1px solid var(--ui-accent-border); border-radius: var(--ui-radius-sm); background: var(--ui-accent-soft); color: var(--ui-text-soft); }
.wellness-eligibility-feedback[data-tone="danger"] { color: var(--ui-danger); }
.wellness-eligibility-feedback[data-tone="success"] { color: var(--ui-success); }
.wellness-assessment-history { display: grid; gap: 10px; }
.wellness-assessment-history > .chart-content-section-header { padding: 2px 1px 7px; }
.wellness-assessment-list { display: grid; gap: 8px; }
.wellness-assessment-entry { overflow: hidden; border: 1px solid var(--ui-border); border-radius: var(--ui-radius-sm); background: #fff; }
.wellness-assessment-entry.is-open { border-color: var(--ui-accent-border); box-shadow: var(--ui-shadow-card); }
.wellness-assessment-trigger { width: 100%; min-height: 48px; display: flex !important; align-items: center; justify-content: space-between !important; gap: 12px; margin: 0 !important; padding: 10px 12px !important; border: 0 !important; border-radius: 0 !important; background: #fff !important; color: var(--ui-text) !important; text-align: left; }
.wellness-assessment-trigger:hover { background: var(--ui-surface-soft) !important; }
.wellness-assessment-trigger-copy { min-width: 0; display: grid; gap: 2px; }
.wellness-assessment-trigger-copy strong { font-size: .78rem; font-weight: 680; }
.wellness-assessment-trigger-copy small { color: var(--ui-muted); font-size: .7rem; }
.wellness-assessment-trigger i { color: var(--ui-muted); transition: transform 140ms ease; }
.wellness-assessment-trigger[aria-expanded="true"] i { transform: rotate(180deg); }
.wellness-assessment-answers { display: grid; gap: 0; padding: 0; border-top: 1px solid var(--ui-border); background: var(--ui-surface-soft); }
.wellness-assessment-answer { padding: 12px 13px; border-bottom: 1px solid var(--ui-border); }
.wellness-assessment-answer:last-child { border-bottom: 0; }
.wellness-assessment-answer span { display: block; color: var(--ui-text); font-size: .76rem; font-weight: 650; }
.wellness-assessment-answer p { margin: 5px 0 0; color: var(--ui-text-soft); font-size: .75rem; }
#clinical-panel-plan:not([hidden]) { display: grid; grid-template-rows: minmax(0, 1fr); align-content: stretch; gap: 12px; }
.wellness-plan-source-summary { display: grid; gap: 0; margin: 0; }
.wellness-plan-source-summary > div { display: grid; grid-template-columns: minmax(150px, .42fr) minmax(0, 1fr); gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--ui-border); }
.wellness-plan-source-summary > div:last-child { border-bottom: 0; }
.wellness-plan-source-summary dt { color: var(--ui-muted); font-size: .7rem; font-weight: 650; }
.wellness-plan-source-summary dd { margin: 0; color: var(--ui-text-soft); font-size: .75rem; }
.wellness-plan-grid { min-height: 0; display: grid; grid-template-columns: minmax(0, 2fr) minmax(250px, 1fr); align-items: start; gap: 12px; padding-bottom: 14px; }
.wellness-plan-grid > .patient-settings-card { min-width: 0; height: auto; display: flex; flex-direction: column; margin: 0; }
.wellness-plan-grid > .patient-settings-card > .patient-settings-card-body { min-height: 0; flex: 1 1 auto; }
.wellness-plan-editor-card { position: relative; }
.clinical-surface .wellness-plan-editor { min-height: clamp(420px, 62dvh, 820px); height: clamp(420px, 62dvh, 820px); padding-bottom: 30px; scroll-padding-bottom: 30px; overflow-y: auto; resize: vertical; }
.wellness-plan-grid > .wellness-plan-refine-card { height: auto; align-self: start; }
.wellness-plan-grid > .wellness-plan-refine-card > .patient-settings-card-body { flex: 0 0 auto; }
.clinical-surface .wellness-plan-refine-card textarea { min-height: clamp(180px, 28dvh, 340px); height: clamp(180px, 28dvh, 340px); }
.wellness-plan-footer, .clinical-complete-actions { position: sticky; right: 0; bottom: 0; left: 0; z-index: 4; display: flex; flex-wrap: wrap; justify-content: flex-start; gap: 8px; margin: 12px -12px -12px; padding: 10px 12px; border-top: 1px solid var(--ui-border); background: rgba(255,255,255,.96); backdrop-filter: blur(10px); }
.wellness-assessment-section { grid-column: 1 / -1; padding: 0; border: 0; background: transparent; box-shadow: none; }
.wellness-answer-grid { margin-top: 11px; }
.wellness-answer-card { margin: 0; }
.wellness-form-primary { grid-column: 1 / -1; justify-self: end; }
.wellness-inline-status { display: inline-flex; width: fit-content; margin: 0 6px 10px 0 !important; padding: 6px 9px; border-radius: 999px; background: var(--ui-accent-soft); color: var(--ui-accent) !important; }
.wellness-inline-status.needs-review, .wellness-inline-status.draft-failed { background: var(--ui-danger-soft); color: var(--ui-danger) !important; }
.clinical-surface .task { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--ui-border); }
.clinical-surface .task:last-child { border-bottom: 0; }
.clinical-files-section .document, .patient-attachment-row, .clinical-document-row { display: flex; align-items: center; gap: 11px; }
.integrated-clinical-chart #clinical-panel-files:not([hidden]) { display: grid; grid-template-columns: minmax(0, 1fr); align-content: start; gap: 12px; }
.integrated-clinical-chart #clinical-panel-files > .patient-settings-card { min-width: 0; margin: 0; }
.integrated-clinical-chart #clinical-panel-files > .clinical-documents-card { margin-bottom: 0; }
.clinical-documents-card { min-height: 45vh; }
.clinical-upload-card { margin-top: 0 !important; }
.document-filter { display: flex; align-items: end; flex-wrap: wrap; gap: 10px; margin: 0 0 14px; }
.document-filter .ui-field { width: min(240px, 100%); min-width: min(210px, 100%); flex: 0 1 240px; }
.document-filter .ui-field__label { color: var(--ui-text-soft); font-size: .76rem; font-weight: 620; line-height: 1.4; }
.document-filter .ui-select { min-height: 40px; font-size: 14px; font-weight: 430; }
.unified-document-list { display: grid; gap: 8px; }
.clinical-document-list { display: grid; gap: 8px; margin: 12px 0 16px; }
.clinical-document-row { margin: 0; padding: 10px; border: 1px solid var(--ui-border); border-radius: var(--ui-radius-sm); background: var(--ui-surface-soft); }
.clinical-document-row .patient-attachment-copy { min-width: 0; flex: 1; display: grid; gap: 2px; }
.clinical-document-row .patient-attachment-copy strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.clinical-document-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.clinical-generated-document { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 9px 12px; margin: 8px 0; padding: 10px; border: 1px solid var(--ui-border); border-radius: var(--ui-radius-sm); background: var(--ui-surface-soft); }
.clinical-generated-document > .meta { grid-column: 1 / -1; margin: 0; }
.clinical-document-summary { min-width: 0; display: flex; align-items: center; gap: 10px; }
.clinical-document-summary .patient-attachment-copy { min-width: 0; display: grid; gap: 3px; }
.clinical-generated-document > label, .clinical-generated-document > .ui-disclosure, .clinical-generated-document > .clinical-order-editor { grid-column: 1 / -1; }
.clinical-message-dialog { width: min(520px, calc(100vw - 24px)); }
.clinical-message-dialog form { display: grid; gap: 14px; }
.clinical-review-delivery { display: grid; gap: 10px; margin: 0 17px 14px; padding: 13px; border: 1px solid var(--ui-border); border-radius: var(--ui-radius-sm); background: var(--ui-surface-soft); }
.ui-choice { min-height: 36px; display: flex !important; align-items: center; gap: 8px; margin: 0 !important; color: var(--ui-text-soft); font-size: .76rem; font-weight: 550 !important; }
.ui-choice input[type="checkbox"], .ui-choice input[type="radio"],
.clinical-surface input[type="checkbox"], .clinical-surface input[type="radio"] { box-sizing: border-box; width: 16px !important; height: 16px !important; min-width: 16px; margin: 0 !important; padding: 0 !important; accent-color: var(--ui-accent); }
.clinical-order-footer { grid-column: 1 / -1; position: sticky; bottom: 0; z-index: 3; display: flex; flex-wrap: wrap; justify-content: flex-start; gap: 8px; margin: 8px -14px -14px; padding: 10px 14px; border-top: 1px solid var(--ui-border); background: rgba(255,255,255,.97); backdrop-filter: blur(10px); }
.clinical-order-review-note, .clinical-order-support-note { grid-column: 1 / -1; margin: 0; color: var(--ui-muted); font-size: .7rem !important; font-weight: 450; line-height: 1.5; }
.clinical-order-form-feedback { grid-column: 1 / -1; margin: 0; padding: 9px 11px; border: 1px solid var(--ui-danger-border); border-radius: var(--ui-radius-sm); background: var(--ui-danger-soft); color: var(--ui-danger); font-size: .72rem; font-weight: 560; line-height: 1.45; }
.clinical-order-dialog-status { flex: 0 0 auto; margin: 0 14px; padding: 9px 11px; border: 1px solid var(--ui-danger-border); border-radius: var(--ui-radius-sm); background: var(--ui-danger-soft); color: var(--ui-danger); font-size: .72rem; font-weight: 560; line-height: 1.45; }
.clinical-followups-section { margin-top: 12px; }
.clinical-followups-section .empty-state { margin: -2px 0 0; padding: 0; }
.followup-create-editor { margin-top: 2px; padding-top: 14px; border-top: 1px solid var(--ui-border); }
.followup-create-editor form { gap: 12px; }
.followup-create-editor .ui-textarea { min-height: 128px; }
.followup-create-editor .ui-button--primary { justify-self: start; }
.followup-workspace { min-width: 0; display: grid; grid-template-columns: minmax(230px, .72fr) minmax(0, 1.28fr); gap: 12px; }
.followup-list, .followup-detail { min-width: 0; display: grid; align-content: start; gap: 7px; padding: 11px; border: 1px solid var(--ui-border); border-radius: var(--ui-radius); background: var(--ui-surface-soft); }
.clinical-surface .followup-list-item { width: 100%; min-height: 50px; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 9px; padding: 9px; border: 1px solid transparent; border-radius: var(--ui-radius-sm); background: var(--ui-surface); text-align: left; }
.clinical-surface .followup-list-item:hover { border-color: var(--ui-accent-border); background: var(--ui-accent-soft); }
.followup-list-item > span:first-child { min-width: 0; display: grid; gap: 2px; }
.followup-list-item strong { overflow: hidden; color: var(--ui-text); font-size: .72rem; text-overflow: ellipsis; white-space: nowrap; }
.followup-list-item small, .followup-list-item > span:last-child { color: var(--ui-muted); font-size: .64rem; text-transform: capitalize; }
.followup-list-item.is-closed { opacity: .62; }
.followup-detail-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.followup-detail-heading h4, .followup-detail-heading p { margin: 0; }
.followup-detail-heading h4 { color: var(--ui-text); font-size: .78rem; }
.followup-detail-heading p, .followup-original-note, .followup-resolution-note { color: var(--ui-muted); font-size: .69rem; line-height: 1.45; }
.followup-original-note, .followup-resolution-note { margin: 0; padding: 9px 10px; border-radius: var(--ui-radius-sm); background: var(--ui-surface); }
.followup-detail form { gap: 9px; }
.followup-detail textarea { min-height: 74px; }
.followup-detail-actions { display: flex; flex-wrap: wrap; gap: 7px; }
.patient-profile-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.patient-profile-form > .ui-field:has(textarea), .patient-profile-form > .patient-identity-confirmation, .patient-profile-form > .meta, .patient-profile-form > button { grid-column: 1 / -1; }
.patient-profile-form > button { justify-self: end; }
.clinical-upload-form, .clinical-order-editor form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px; }
.clinical-upload-form > button, .clinical-order-editor form > button, .clinical-order-editor form > p, .clinical-order-editor form > fieldset { grid-column: 1 / -1; }
.clinical-upload-form > button, .clinical-order-editor form > button { justify-self: end; }
.clinical-order-editor { max-height: min(78dvh, 840px); overflow: auto; overscroll-behavior: contain; scrollbar-gutter: stable; }
.clinical-order-form { align-content: start; }
.clinical-order-group { margin: 0; padding: 14px; border: 1px solid var(--ui-border); border-radius: var(--ui-radius-sm); background: var(--ui-surface-soft); }
.clinical-order-group > legend { display: grid; gap: 2px; max-width: calc(100% - 16px); padding: 0 6px; color: var(--ui-text); }
.clinical-order-group > legend strong { font-size: .8rem; font-weight: 680; }
.clinical-order-group > legend small { color: var(--ui-muted); font-size: .68rem; font-weight: 430; line-height: 1.35; }
.clinical-order-group__fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.clinical-order-group__fields > .ui-field:has(textarea), .clinical-order-group__fields > p, .clinical-order-confirmation { grid-column: 1 / -1; }
.clinical-order-confirmation { display: flex; align-items: flex-start; gap: 9px; color: var(--ui-text-soft); font-size: .72rem; }
.clinical-order-confirmation input { margin-top: 2px; }
.patient-link-confirmation { align-items: flex-start; }
.patient-link-confirmation input { margin-top: 2px !important; }
.workspace[data-list-mode="wellness"] .workspace-list-wrap { border-radius: var(--ui-radius); background: var(--ui-canvas); }
.workspace[data-list-mode="wellness"] .workspace-list { display: block; padding: 10px; background: var(--ui-canvas); }
.wellness-queue-group { flex: 1 1 0; min-height: 228px; display: flex; flex-direction: column; overflow: hidden; border: 1px solid var(--ui-border); border-radius: var(--ui-radius); background: var(--ui-surface); box-shadow: var(--ui-shadow-card); }
.wellness-queue-group-header { flex: 0 0 auto; min-height: 40px; display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 8px 14px; border-bottom: 1px solid var(--ui-border); }
.wellness-queue-group--new .wellness-queue-group-header { background: var(--ui-info-soft); }
.wellness-queue-group--returning .wellness-queue-group-header { background: var(--ui-success-soft); }
.wellness-queue-group-copy { min-width: 0; }
.wellness-queue-group-copy h2 { margin: 0; color: var(--ui-text); font-size: .79rem; font-weight: 680; }
.wellness-queue-group-count { min-width: 24px; height: 24px; display: grid; place-items: center; padding: 0 7px; border: 1px solid var(--ui-border); border-radius: 999px; background: var(--ui-surface); color: var(--ui-accent); font-size: .66rem; font-weight: 700; }
.wellness-queue-group-body { flex: 1 1 auto; min-height: 174px; overflow-y: auto; background: var(--ui-surface); }
.wellness-queue-group-body > .workspace-empty-state { height: 100%; }
.wellness-queue-group-body > .clinical-queue-card:last-of-type { border-bottom: 0; }
.wellness-load-more { margin: 10px 14px 12px; }
.queue-card--attention { border-color: var(--ui-danger-border) !important; background: color-mix(in srgb, var(--ui-danger-soft) 34%, var(--ui-surface)) !important; }
.patient-attachment-copy { flex: 1; min-width: 0; display: grid; gap: 3px; }
.patient-attachment-copy strong { overflow: hidden; color: var(--ui-text); font-size: .8rem; font-weight: 650; text-overflow: ellipsis; white-space: nowrap; }
.patient-attachment-copy small { color: var(--ui-muted); font-size: .72rem; }
.patient-attachment-icon { width: 42px; height: 42px; flex: 0 0 42px; display: grid; place-items: center; border-radius: var(--ui-radius-sm); background: var(--ui-accent-soft); color: var(--ui-accent); }
.patient-attachments-list { min-height: 216px; display: grid; align-content: start; gap: 8px; }
.patient-attachment-row { width: 100%; min-height: 64px; padding: 10px 11px; border: 1px solid var(--ui-border); border-radius: var(--ui-radius-sm); background: var(--ui-surface-soft); color: var(--ui-text); font-family: inherit; text-align: left; }
button.patient-attachment-row { cursor: pointer; transition: border-color 130ms ease, background 130ms ease; }
button.patient-attachment-row:hover, button.patient-attachment-row:focus-visible { border-color: var(--ui-accent-border); background: var(--ui-accent-soft); }
button.patient-attachment-row.is-opening { opacity: .68; }
.patient-attachment-open-icon { width: 28px; height: 28px; flex: 0 0 28px; display: grid; place-items: center; color: var(--ui-muted); }
.patient-attachment-skeleton { pointer-events: none; }
.patient-attachment-skeleton .patient-attachment-icon, .patient-attachment-skeleton-action, .patient-attachment-skeleton-line { background: linear-gradient(90deg, #edf0f0 25%, #f7f8f8 50%, #edf0f0 75%); background-size: 200% 100%; animation: patient-attachment-pulse 1.35s ease-in-out infinite; }
.patient-attachment-skeleton-line { height: 10px; border-radius: 999px; }
.patient-attachment-skeleton-line--name { width: min(260px, 72%); }
.patient-attachment-skeleton-line--meta { width: min(180px, 52%); }
.patient-attachment-skeleton-action { width: 28px; height: 28px; border-radius: 50%; }
@keyframes patient-attachment-pulse { from { background-position: 100% 0; } to { background-position: -100% 0; } }
.patient-data-highlight-row { display: grid; grid-template-columns: 132px minmax(0, 1fr) 38px; align-items: center; gap: 10px; padding: 7px 0; }
.patient-data-highlight-input { width: 100%; min-height: 40px; padding: 9px 11px; border: 1px solid var(--ui-border-strong); border-radius: var(--ui-radius-sm); background: var(--ui-surface-soft); color: var(--ui-text-soft); font-size: 14px; }
.patient-data-copy-button { width: 38px; height: 38px; min-width: 38px; display: grid; place-items: center; padding: 0; border: 1px solid var(--ui-border); border-radius: var(--ui-radius-sm); background: #fff; color: var(--ui-accent); }
.patient-data-copy-button:hover { border-color: var(--ui-accent-border); background: var(--ui-accent-soft); }
.clinical-surface .patient-data-copy-button { border-color: var(--ui-border); border-radius: var(--ui-radius-sm); background: #fff; color: var(--ui-accent); }
.clinical-surface .patient-data-copy-button:hover { border-color: var(--ui-accent-border); background: var(--ui-accent-soft); color: var(--ui-accent-hover); }
.clinical-surface .patient-data-highlight-input { border-color: var(--ui-border-strong); background: var(--ui-surface-soft); color: var(--ui-text-soft); }
.patient-settings-list { display: grid; gap: 0; margin: 0; }
.patient-settings-list > div { display: grid; grid-template-columns: minmax(95px, .42fr) minmax(0, 1fr); align-items: baseline; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--ui-border); }
.patient-settings-list > div:last-child { border-bottom: 0; }
.patient-settings-list dt { color: var(--ui-muted); font-size: .69rem; font-weight: 620; }
.patient-settings-list dd { min-width: 0; margin: 0; overflow-wrap: anywhere; color: var(--ui-text); font-size: .75rem; }
.portal-access-status { display: flex; align-items: center; margin-bottom: 12px; }
.portal-invitation-code { display: grid; gap: 6px; }
.portal-invitation-code__row { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 8px; }
.portal-invitation-code__row .ui-input { min-width: 0; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .68rem; }
.patient-settings-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.patient-settings-grid { align-items: start; }
.patient-settings-card { margin-bottom: 0; }
.patient-settings-card-header { margin-bottom: 16px; }
.patient-settings-card-header h3 { font-weight: 700; }
.patient-settings-card-header p { margin: 4px 0 0; color: var(--ui-muted); font-weight: 400; }
.patient-settings-card-body { display: grid; gap: 13px; }
.patient-settings-card-body > p { margin: 0; }
.patient-settings-card-body form { display: grid; gap: 13px; }
.patient-settings-card-body form > p { margin: 0; }
.patient-settings-card-body fieldset {
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}
.patient-settings-card-body fieldset legend { margin-bottom: 9px; color: var(--ui-text); font-size: .76rem; font-weight: 680; }
.patient-settings-card-body fieldset label { display: flex; align-items: center; gap: 8px; margin-top: 8px; color: var(--ui-text-soft); font-size: .76rem; }
.patient-settings-status-copy { margin: 0 !important; }
.patient-settings-danger-zone { grid-column: 1 / -1; border-color: #efd3d0; }
.integrated-clinical-chart #clinical-panel-settings:not([hidden]) { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-content: start; gap: 12px; }
.integrated-clinical-chart #clinical-panel-settings > .patient-settings-card { margin: 0; }
.wellness-program-section > .wellness-workflow-card { grid-column: 1 / -1; }
.clinical-generated-documents > .document { margin: 9px 0 0; background: var(--ui-surface-soft); box-shadow: none; }
.clinical-message-list { display: grid; gap: 9px; }
.clinical-message-list > .document { margin: 0; background: var(--ui-surface-soft); box-shadow: none; }
.provider-message-list { padding: 14px; border: 1px solid var(--ui-border); border-radius: var(--ui-radius); background: var(--ui-canvas); }
.provider-message-entry { width: min(82%, 660px); display: grid; justify-self: start; gap: 4px; }
.provider-message-entry--clinic { justify-self: end; }
.provider-message-bubble { width: 100%; display: grid; justify-items: start; gap: 5px; padding: 11px 13px; border: 1px solid var(--ui-border); border-radius: var(--ui-radius); background: var(--ui-surface); }
.provider-message-bubble--clinic { border-color: var(--ui-accent-border); background: var(--ui-accent-soft); }
.provider-message-bubble strong { color: var(--ui-text); font-size: .72rem; }
.clinical-surface .provider-message-bubble p { margin: 0; color: var(--ui-text-soft); font-size: .76rem; font-weight: 400; line-height: 1.5; }
.provider-message-bubble small { color: var(--ui-muted); font-size: .65rem; }
.provider-message-review { width: max-content; min-height: 18px; display: inline-flex !important; gap: 5px; padding: 0 2px; color: var(--ui-muted); font-size: .65rem; line-height: 1.2; }
.provider-message-review input[type="checkbox"] { width: 13px !important; height: 13px !important; min-width: 13px; min-height: 13px; flex-basis: 13px; }
.provider-message-composer { display: grid; gap: 10px; margin-top: 14px; padding: 14px; border: 1px solid var(--ui-border); border-radius: var(--ui-radius); background: var(--ui-surface-soft); }
.provider-message-composer h4, .provider-message-composer .meta { margin: 0; }
.provider-message-composer-actions { display: flex; justify-content: space-between; gap: 8px; }
.provider-message-attachment { position: relative; overflow: hidden; }
.provider-message-attachment input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.message-composer { display: grid; gap: 9px; margin-top: 16px; padding-top: 15px; border-top: 1px solid var(--ui-border); }
.message-composer h4 { margin: 0; color: var(--ui-text); font-size: .8rem; }
.message-composer > button { justify-self: end; }
.complete-chart-preview .soap-note-editor { min-height: 42vh; }
.complete-chart-preview > .chart-content-section-header { justify-content: flex-start; text-align: left; }
.clinical-complete-actions { justify-content: flex-start; }
.clinical-surface .wellness-raw-data { min-height: clamp(380px, 55dvh, 760px); height: clamp(380px, 55dvh, 760px); }
.queue-subsection-label { padding: 9px 14px 4px; color: var(--ui-muted); font-size: .67rem; font-weight: 650; }
.clinical-pdf-dialog { width: min(94vw, 980px); max-height: 92dvh; overflow: auto; padding: 0; border: 1px solid var(--ui-border); border-radius: var(--ui-radius-lg); background: #fff; color: var(--ui-text); box-shadow: var(--ui-shadow-dialog); }
.clinical-pdf-dialog::backdrop { background: rgba(24, 34, 39, .52); }
.clinical-pdf-dialog h2, .clinical-pdf-dialog > p, .clinical-pdf-dialog > .actions { margin: 0; padding: 14px 17px; }
.clinical-pdf-dialog h2 { border-bottom: 1px solid var(--ui-border); font-size: 1rem; }
.clinical-pdf-dialog iframe { width: 100%; height: 62dvh; border: 0; background: var(--ui-canvas); }
.clinical-pdf-dialog img { display: block; max-width: 100%; max-height: 62dvh; margin: auto; padding: 14px; }
.clinical-order-dialog { width: min(820px, calc(100vw - 40px)); height: min(880px, calc(100dvh - 48px)); max-width: none; max-height: calc(100dvh - 48px); overflow: hidden; }
.clinical-order-dialog[open] { display: flex; flex-direction: column; }
.clinical-order-dialog-header { position: relative; z-index: 5; display: flex; flex: 0 0 auto; align-items: flex-start; justify-content: space-between; gap: 14px; padding: 14px 17px; border-bottom: 1px solid var(--ui-border); background: #fff; }
.clinical-order-dialog-header h2 { margin: 0; padding: 0; border: 0; }
.clinical-order-dialog-header p { margin: 4px 0 0; color: var(--ui-muted); font-size: .72rem; }
.clinical-order-dialog-close { width: 34px; height: 34px; min-width: 34px; min-height: 34px; flex: 0 0 34px; border: 1px solid var(--ui-border); border-radius: 50%; background: #fff; }
.clinical-order-dialog-close i { width: 15px; height: 15px; }
.clinical-order-dialog-body { flex: 1 1 0; min-height: 0; overflow: hidden; padding: 0; }
.clinical-order-dialog-body > .ui-form-section { height: 100%; max-height: none; margin: 0; padding: 0; border: 0; border-radius: 0; box-shadow: none; overflow: hidden; }
.clinical-order-dialog-body > .ui-form-section > .ui-form-section__header { display: none; }
.clinical-order-dialog-body .clinical-order-form { height: 100%; min-height: 0; padding: 14px; overflow-x: hidden; overflow-y: auto; scrollbar-gutter: stable; }
.clinical-order-dialog > .clinical-order-dialog-footer { position: relative; right: auto; bottom: auto; left: auto; z-index: 6; width: 100%; flex: 0 0 auto; margin: 0; padding: 10px 14px; border-top: 1px solid var(--ui-border); background: rgba(255,255,255,.98); backdrop-filter: blur(10px); }

#toast { position: fixed; top: 68px; left: 50%; z-index: 130; max-width: min(430px, calc(100vw - 24px)); padding: 10px 13px; border: 1px solid var(--ui-border); border-radius: 999px; background: #fff; color: var(--ui-text-soft); font-size: .74rem; box-shadow: var(--ui-shadow-popover); opacity: 0; pointer-events: none; transform: translate(-50%, -8px); transition: opacity 150ms ease, transform 150ms ease; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 1120px) {
  .workspace-table-head, .workspace-list .compact-card, .workspace-list .clinical-queue-card { grid-template-columns: minmax(170px, 1.1fr) minmax(170px, 1fr) minmax(90px, .55fr) minmax(200px, 1.2fr) 42px; }
  .workspace-table-head > :nth-child(5), .patient-list-time { display: none; }
}

@media (max-width: 899px) {
  .plan-sections { grid-template-columns: minmax(0, 1fr); }
  .dashboard-masthead { flex-basis: 56px; }
  .dashboard-masthead-inner { padding: 0 12px; }
  .dashboard-brand-divider, .dashboard-brand-section { display: none; }
  #mainContent { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) 64px; }
  .workspace { grid-row: 1; }
  .dashboard-navigation-rail { grid-row: 2; z-index: 60; flex-direction: row; justify-content: center; gap: 0; padding: 5px max(7px, env(safe-area-inset-right)) max(5px, env(safe-area-inset-bottom)) max(7px, env(safe-area-inset-left)); border: 0; border-top: 1px solid var(--ui-border); }
  .workspace-mode-row { width: min(100%, 520px); flex-direction: row; justify-content: space-around; gap: 2px; }
  .dashboard-navigation-rail .workspace-mode-row .btn { width: 25%; max-width: 92px; height: 52px; display: flex; flex-direction: column; gap: 3px; border-radius: var(--ui-radius-sm); font-size: .61rem; }
  .dashboard-navigation-rail .workspace-mode-row .btn > span:not(.tab-count-badge) { position: static; width: auto; height: auto; clip: auto; overflow: visible; }
  #completedCount { display: none; }
  .dashboard-navigation-rail [data-rail-label]::after { display: none; }
  .dashboard-rail-spacer { display: none; }
  .dashboard-rail-control { position: fixed; top: 9px; right: 96px; z-index: 80; display: grid; background: var(--ui-surface); }
  .dashboard-account-wrap { position: fixed; top: 9px; right: 54px; z-index: 80; }
  .dashboard-account-trigger { width: 36px; height: 36px; min-width: 36px; min-height: 36px; }
  .dashboard-account-popover { top: 44px; right: -42px; bottom: auto; left: auto; }
  .workspace-sidebar { padding: 11px 11px 10px; }
  .workspace-sidebar-heading { min-height: 38px; margin-bottom: 8px; }
  .workspace-sidebar-heading h1 { font-size: 1.1rem; }
  .workspace-toolbar { gap: 8px; margin-bottom: 10px; }
  .workspace-search { width: auto; flex: 1; }
  .workspace-sort-btn { width: 40px; min-width: 40px; height: 40px; justify-content: center; gap: 0; padding: 0; font-size: 0; }
  .workspace-sort-btn > span { display: none; }
  .workspace-filter-popover { top: 47px; width: min(290px, calc(100vw - 22px)); }
  .workspace-table-head { display: none; }
  .workspace-list-wrap { border: 0; border-radius: 0; background: transparent; box-shadow: none; }
  .workspace-list { display: grid; align-content: start; gap: 9px; padding: 0 1px 14px; background: transparent; transition: transform 180ms ease; will-change: transform; }
  .workspace-list-wrap.is-pulling .workspace-list { transition: none; }
  .pull-refresh-indicator { position: absolute; top: 0; right: 0; left: 0; z-index: 4; min-height: 48px; display: flex; align-items: center; justify-content: center; gap: 7px; padding: 9px 12px; background: var(--ui-accent-soft); color: var(--ui-accent); font-size: .72rem; font-weight: 650; pointer-events: none; transform: translateY(-100%); transition: transform 180ms ease; }
  .workspace-list-wrap.is-pulling .pull-refresh-indicator { transition: none; }
  .pull-refresh-indicator .ay-nav-icon { width: 15px; height: 15px; flex: 0 0 15px; }
  .pull-refresh-indicator.refreshing .ay-nav-icon { animation: pull-refresh-spin .8s linear infinite; }
  .workspace[data-list-mode="wellness"] .workspace-list { display: block; padding: 0 1px 14px; }
  .wellness-queue-group { min-height: 188px; }
  .wellness-queue-group-header { min-height: 38px; padding: 7px 12px; }
  .wellness-queue-group-body { min-height: 138px; display: grid; align-content: start; gap: 8px; padding: 9px; }
  .wellness-queue-group-body > .clinical-queue-card { border-bottom: 1px solid var(--ui-border); }
  /* The mobile queue carries three independent rows (identity/type, summary,
     and completion status).  Reserve a real grid track for each so a long
     summary can never paint over the name, badge, or document controls. */
  .workspace-list .compact-card, .workspace-list .clinical-queue-card { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-rows: auto auto minmax(36px, auto); gap: 7px 12px; padding: 11px 13px; border: 1px solid var(--ui-border); border-radius: var(--ui-radius-sm); background: var(--ui-surface); box-shadow: var(--ui-shadow-card); }
  .workspace-list .compact-card.sidebar-card--selected, .workspace-list .clinical-queue-card[aria-pressed="true"] { border-color: var(--ui-accent-border); background: var(--ui-surface); }
  .patient-list-identity { grid-column: 1; grid-row: 1; }
  .patient-list-email { display: none; }
  .patient-list-type { grid-column: 2; grid-row: 1; align-self: start; }
  .patient-list-reason { grid-column: 1 / -1; grid-row: 2; min-width: 0; padding-left: 45px; padding-right: 4px; white-space: normal; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
  .workspace-list .compact-card > .patient-list-time, .workspace-list .clinical-queue-card > .patient-list-time { grid-column: 1; grid-row: 3; display: flex; align-items: center; min-height: 36px; align-self: center; margin: 0; padding-left: 45px; padding-right: 0; }
  .workspace-list .compact-card > .patient-list-note, .workspace-list .clinical-queue-card > .patient-list-note { position: static !important; right: auto; bottom: auto; grid-column: 2; grid-row: 3; display: flex; align-self: center; justify-self: end; min-height: 36px; }
  .queue-section-label { padding: 7px 2px 1px; border: 0; background: transparent; }
  .archive-service-filter { border: 1px solid var(--ui-border); border-radius: var(--ui-radius-sm); background: #fff; }
  .workspace-sidebar-footer { display: none; }
  .workspace-detail { transform: translateX(100%); transition: transform 230ms cubic-bezier(.32,.72,0,1); }
  .workspace-detail.has-selection.is-open { display: block; transform: translateX(0); }
  body:has(.workspace-detail.has-selection) #mainContent { grid-template-rows: minmax(0, 1fr); }
  body:has(.workspace-detail.has-selection) .dashboard-navigation-rail { display: none; }
  body:has(.workspace-detail.has-selection) .dashboard-account-wrap { display: none; }
  .patient-open-tabs { min-height: 48px; padding: 6px 9px; }
  .patient-open-tab { min-height: 34px; padding: 0 10px; }
  .patient-open-actions { gap: 4px; }
  .clinical-shell-tools { max-width: min(42vw, 260px); }
  .clinical-shell-tools button { min-height: 32px; padding: 6px 9px; }
  .dashboard-chart-close { width: 36px; height: 36px; min-width: 36px; min-height: 36px; }
  .patient-detail-modal-header { grid-template-columns: minmax(0, 1fr); gap: 0; padding: 0; border-bottom-color: var(--ui-border); background: #fff; }
  .patient-detail-modal-identity { padding: 11px 13px; border-bottom: 1px solid var(--ui-accent-border); background: var(--ui-accent-soft); }
  .patient-detail-summary { padding: 9px 13px; border: 0; background: color-mix(in srgb, var(--ui-accent-soft) 52%, #fff); }
  .patient-contact-row { grid-column: 1; margin-top: 0; padding: 7px 13px 11px; border: 0; background: color-mix(in srgb, var(--ui-accent-soft) 52%, #fff); }
  .patient-chart-layout { flex-direction: column; }
  body:has(.workspace-detail.has-selection) .patient-detail-view-buttons { position: static; z-index: auto; width: 100%; flex: 0 0 auto; display: block; padding: 6px 9px; border-right: 0; border-bottom: 1px solid var(--ui-border); background: #fff; overflow: hidden; }
  .patient-detail-tab-scroll { flex-direction: row; align-items: center; gap: 5px; overflow-x: auto; scrollbar-width: none; }
  .patient-detail-tab-scroll { scroll-behavior: smooth; mask-image: linear-gradient(to right, transparent 0, #000 9px, #000 calc(100% - 9px), transparent 100%); }
  .patient-detail-tab-scroll::-webkit-scrollbar { display: none; }
  .patient-detail-tab-scroll .btn { width: auto; height: 34px; min-width: max-content; min-height: 34px; gap: 6px; padding: 0 11px; border: 1px solid var(--ui-border); border-radius: 999px; background: #fff; font-size: .7rem; }
  .patient-detail-tab-scroll .btn[aria-selected="true"], .patient-detail-tab-scroll .btn.btn-primary { border-color: var(--ui-accent-border); background: var(--ui-accent-soft); color: var(--ui-accent); box-shadow: none; }
  .patient-detail-tab-scroll .btn i { width: 14px; height: 14px; flex-basis: 14px; }
  .patient-detail-tab-scroll .btn::after { display: none; }
  .patient-detail-tab-scroll .patient-complete-tab { margin: 0; }
  .patient-detail-modal-body, .integrated-clinical-chart [role="tabpanel"] { padding: 12px 11px 16px; scroll-padding-bottom: 16px; }
  .chart-content-section, .soap-note-editor-wrap, .plan-order-section, .patient-data-highlights,
  .patient-attachments, .instructions-diagnosis-block, .clinical-chart-section, .clinical-surface .document,
  .clinical-surface .panel, .clinical-surface fieldset, .wellness-program-card, .wellness-answer-card { padding: 16px; }
  .soap-note-editor-wrap { padding: 0; }
  .patient-detail-modal-footer { position: relative; right: auto; bottom: auto; left: auto; z-index: 30; min-height: 58px; padding: 8px 11px max(8px, env(safe-area-inset-bottom)); }
  .chart-card-grid, #clinical-panel-home:not([hidden]), .wellness-answer-grid, .wellness-program-section, .wellness-home-grid { grid-template-columns: minmax(0, 1fr); }
  .chart-card-grid > .wide, .wellness-grid-wide, .wellness-program-overview-card, .wellness-card--wide,
  .wellness-program-section > .wellness-card-heading { grid-column: 1; }
  .wellness-home-summary { grid-column: 1; }
  .wellness-plan-grid { grid-template-columns: minmax(0, 1fr); }
  .wellness-plan-grid > .patient-settings-card { height: auto; }
  .clinical-surface .wellness-plan-editor { min-height: 48dvh; height: 48dvh; }
  .clinical-surface .wellness-plan-refine-card textarea { min-height: 140px; height: 140px; }
  .clinical-surface .wellness-raw-data { min-height: 52dvh; height: 52dvh; }
  .wellness-form-primary { width: 100%; justify-self: stretch; }
  .clinical-upload-form, .clinical-order-editor form, .clinical-order-group__fields { grid-template-columns: minmax(0, 1fr); }
  .integrated-clinical-chart #clinical-panel-files:not([hidden]), .patient-profile-form { grid-template-columns: minmax(0, 1fr); }
  .clinical-generated-document { grid-template-columns: minmax(0, 1fr); }
  .clinical-generated-document > .clinical-document-actions { justify-content: flex-start; }
  .clinical-upload-form > *, .clinical-order-editor form > *, .clinical-order-group__fields > * { grid-column: 1; }
  .clinical-order-editor { max-height: calc(100dvh - 96px); }
  .clinical-order-dialog { width: calc(100vw - 20px); height: calc(100dvh - 20px); max-height: calc(100dvh - 20px); }
  .patient-data-highlight-row { grid-template-columns: minmax(0, 1fr) 38px; }
  .patient-data-highlight-label { grid-column: 1 / -1; }
  input:not([type="checkbox"]):not([type="radio"]), textarea, select,
  #loginForm input:not([type="checkbox"]):not([type="radio"]),
  #loginMfaForm input:not([type="checkbox"]):not([type="radio"]),
  .soap-note-editor, .plan-manual-entry-input, .instructions-diagnosis-input,
  .patient-data-highlight-input, .provider-notes, .archive-service-filter select {
    /* iOS uses the declared 16px size to avoid focus zoom. Quicksand's
       adjusted x-height keeps the visible type close to the 14px desktop
       scale without shrinking the field, hit target or caret area. */
    font-size: 16px !important;
    font-size-adjust: .44;
  }
  .integrated-clinical-chart #clinical-panel-settings:not([hidden]) { grid-template-columns: minmax(0, 1fr); }
  .integrated-clinical-chart #clinical-panel-settings > .clinical-settings-heading { grid-column: 1; }
  .auth-loading-content, #pinGate > .card { width: min(404px, calc(100vw - 40px)); height: min(440px, calc(100dvh - 40px)); min-height: min(440px, calc(100dvh - 40px)); padding: 22px 20px; }
  #recentAuthModal, #dashboardInputModal, #dashboardConfirmModal,
  #mfaEnrollmentModal, #aiSettingsModal, #notificationCenterModal, #accountSettingsModal, .attachment-preview-modal { align-items: end; padding: 8px !important; }
  .dashboard-settings-dialog, .attachment-preview-dialog { max-height: calc(100dvh - 16px); }
  .settings-panel-grid { grid-template-columns: 1fr; }
  .settings-panel--wide { grid-column: 1; }
}

@media (max-width: 560px) {
  .dashboard-brand-logo { width: 30px; height: 30px; flex-basis: 30px; }
  .dashboard-brand-primary { max-width: 170px; }
  .patient-open-tab--all { font-size: 0; }
  .patient-open-tab--all i { margin: 0; }
  .patient-open-tabs-fill { flex: 0; }
  .patient-open-actions { margin-left: auto; }
  .clinical-shell-tools { max-width: 104px; }
  .clinical-shell-tools button { width: 32px; min-width: 32px; padding: 0; font-size: 0; }
  .clinical-shell-tools button i { width: 16px; height: 16px; flex-basis: 16px; }
  .instructions-diagnosis-row { grid-template-columns: minmax(0, 1fr); align-items: stretch; }
  .instructions-diagnosis-row .btn { width: 100%; }
  .patient-attachment-row { min-height: 60px; padding: 9px; }
  .wellness-program-summary { grid-template-columns: 1fr; }
  .wellness-program-summary > div, .wellness-program-summary > div:nth-child(n + 3) { padding: 9px 0; border-top: 0; border-bottom: 1px solid var(--ui-border); }
  .wellness-program-summary > div:last-child { border-bottom: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .workspace-detail, #toast { transition: none; }
  .workspace-list, .pull-refresh-indicator, .ay-alert-panel { transition: none; }
  .patient-attachment-skeleton .patient-attachment-icon, .patient-attachment-skeleton-action, .patient-attachment-skeleton-line,
  .plan-loading-card.is-generating .plan-loading-line, .pull-refresh-indicator.refreshing .ay-nav-icon,
  .ay-chart-meta-skeleton, .ay-chart-contact-skeleton { animation: none; }
}

@keyframes pull-refresh-spin { to { transform: rotate(360deg); } }

/* Patient portal
   The portal consumes the same canonical tokens and controls as the clinical
   dashboard. These rules define only the patient-facing page composition. */
.fa-upload { --ui-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 16V4M7 9l5-5 5 5M4 15v5h16v-5'/%3E%3C/svg%3E"); }
.fa-right-from-bracket { --ui-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M10 4H4v16h6M14 8l4 4-4 4M8 12h10'/%3E%3C/svg%3E"); }

html[data-theme-surface="patient-portal"] {
  min-height: 100%;
  height: auto;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior-y: none;
  background: var(--ui-canvas);
}
html[data-theme-surface="patient-portal"] body {
  min-height: 100dvh;
  height: auto;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior-y: none;
}
html.clinical-ui.dark {
  color-scheme: dark;
  --ui-canvas: #151b1d;
  --ui-surface: #202729;
  --ui-surface-soft: #252e30;
  --ui-surface-muted: #2b3436;
  --ui-border: #334044;
  --ui-border-strong: #465459;
  --ui-text: #f2f6f5;
  --ui-text-soft: #d5dedc;
  --ui-muted: #c4cecc;
  --ui-faint: #b7c2c0;
  --ui-brand: var(--deployment-brand-dark, #83c4bb);
  --ui-accent: var(--deployment-brand-strong-dark, #83c4bb);
  --ui-accent-fill: var(--deployment-brand-fill-dark, #286f68);
  --ui-accent-fill-hover: color-mix(in srgb, var(--ui-accent-fill) 82%, #000000);
  --ui-on-accent: #ffffff;
  --ui-accent-hover: color-mix(in srgb, var(--ui-accent) 78%, #ffffff);
  --ui-accent-soft: var(--deployment-brand-wash-dark, #213b3a);
  --ui-accent-border: var(--deployment-brand-wash-strong-dark, #3d6965);
  --ui-info-soft: #1c3443;
  --ui-info-border: #31566c;
  --ui-info: #b8def5;
  --ui-referral-soft: #2c2440;
  --ui-referral-border: #4d3f73;
  --ui-referral: #d3c4f7;
  --ui-success-soft: #1d382c;
  --ui-success-border: #365e49;
  --ui-success: #a8dfbd;
  --ui-warning-soft: #3a3021;
  --ui-warning-border: #654f2f;
  --ui-warning: #f3d6a2;
  --ui-danger-soft: #402725;
  --ui-danger-border: #70423e;
  --ui-danger: #f3b3ae;
  --ui-overlay: rgba(6, 10, 12, .72);
  --ui-chat-assistant-surface: #2a3234;
  --ui-chat-assistant-border: #465154;
  --ui-chat-choice-surface: #202729;
  --ui-chat-choice-border: #4c5a5d;
  --ui-chat-choice-hover: #263133;
  --ui-shadow-card: 0 1px 2px rgba(0, 0, 0, .16), 0 7px 20px rgba(0, 0, 0, .10);
  --ui-shadow-popover: 0 16px 44px rgba(0, 0, 0, .38), 0 3px 10px rgba(0, 0, 0, .18);
  --ui-shadow-dialog: 0 30px 76px rgba(0, 0, 0, .50), 0 8px 24px rgba(0, 0, 0, .24);
  --ui-shadow-footer: 0 -8px 24px rgba(0, 0, 0, .22);
}
html.clinical-ui.dark :where(.btn-primary, .ui-button--primary, .ay-button--primary, .clinical-surface button.primary, .clinical-surface .ui-button--primary) {
  border-color: var(--ui-accent-fill);
  background: var(--ui-accent-fill);
  color: var(--ui-on-accent);
}
html.clinical-ui.dark :where(.btn-primary, .ui-button--primary, .ay-button--primary, .clinical-surface button.primary, .clinical-surface .ui-button--primary):hover {
  background: var(--ui-accent-fill-hover);
  color: var(--ui-on-accent);
}
/* Clinic configuration dark-surface contract. Keeping these rules beside the
   tokens prevents settings panels from falling back to light-only colors. */
html.clinical-ui.dark[data-theme-surface="clinic-configuration"] :where(
  .config-status,
  .config-card,
  .setup-nav,
  .setup-group > details,
  .setup-advanced,
  .assistant-result,
  .question-row,
  .role-pill,
  .preview-chip,
  .preview-action,
  .preview-chat-shell,
  .preview-dashboard-shell,
  .interface-preview-frame
) {
  background-color: var(--ui-surface);
  color: var(--ui-text);
}
html.clinical-ui.dark[data-theme-surface="clinic-configuration"] :where(
  .policy-card,
  .custom-card,
  .interface-preview,
  .question-group,
  .controlled-field
) {
  background-color: var(--ui-surface-soft) !important;
  color: var(--ui-text) !important;
}
html.clinical-ui.dark[data-theme-surface="clinic-configuration"] :where(
  .field input,
  .field textarea,
  .field select,
  .publish-row input,
  .question-edit textarea,
  .question-library-select
) {
  background-color: var(--ui-surface-soft);
  color: var(--ui-text);
}
html.clinical-ui.dark[data-theme-surface="clinic-configuration"] .setup-footer {
  background: color-mix(in srgb, var(--ui-surface) 94%, transparent);
}
html[data-theme-surface="patient-portal"] .skip-link {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 200;
  padding: 9px 12px;
  border-radius: var(--ui-radius-sm);
  background: var(--ui-accent);
  color: #fff;
  font-size: .76rem;
  font-weight: 650;
  text-decoration: none;
  transform: translateY(-150%);
}
html[data-theme-surface="patient-portal"] .skip-link:focus { transform: translateY(0); }
.portal-masthead {
  position: sticky;
  top: 0;
  z-index: 40;
  min-height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 10px clamp(16px, 4vw, 44px);
  border-bottom: 1px solid var(--ui-border);
  background: color-mix(in srgb, var(--ui-surface) 94%, transparent);
  backdrop-filter: blur(14px);
}
.portal-brand { min-width: 0; display: flex; align-items: center; gap: 11px; }
.portal-brand-logo { width: 38px; height: 38px; flex: 0 0 38px; object-fit: contain; }
.portal-brand-copy { display: flex; min-width: 0; flex-direction: column; line-height: 1.15; }
.portal-wordmark {
  display: inline-flex;
  align-items: center;
  gap: .25rem;
  font-family: "SF Pro Display", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 1rem;
  line-height: 1;
}
.portal-brand-word.primary { color: var(--ui-text); font-weight: 800; letter-spacing: -.025em; }
.portal-brand-word.secondary { color: var(--ui-accent); font-weight: 300; letter-spacing: .025em; }
.portal-brand-subtitle { margin-top: 3px; color: var(--ui-muted); font-size: .7rem; font-weight: 600; }
.portal-brand-mark, .portal-card-icon {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  flex: 0 0 38px;
  border: 1px solid var(--ui-accent-border);
  border-radius: var(--ui-radius-sm);
  background: var(--ui-accent-soft);
  color: var(--ui-accent);
}
.portal-brand-mark i, .portal-card-icon i { width: 18px; height: 18px; flex-basis: 18px; }
.portal-brand h1 { margin: 1px 0 0; color: var(--ui-text); font-size: 1.08rem; font-weight: 670; letter-spacing: -.02em; }
.portal-eyebrow {
  display: block;
  color: var(--ui-accent);
  font-size: .61rem;
  font-weight: 720;
  letter-spacing: .08em;
  line-height: 1.25;
  text-transform: uppercase;
}
.portal-masthead-actions { display: flex; align-items: center; gap: 8px; }
.portal-masthead .theme-icon-control {
  width: 36px;
  height: 36px;
  min-width: 36px;
  min-height: 36px;
  padding: 0;
  border: 0;
  border-radius: var(--ui-radius-sm);
  background: transparent;
  color: var(--ui-muted);
  font-size: .9rem;
}
.portal-masthead .theme-icon-control:hover { background: var(--ui-accent-soft); color: var(--ui-accent); }
.portal-main {
  --portal-chevron-down: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.9' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  width: min(100%, 1240px);
  margin: 0 auto;
  padding: 18px clamp(14px, 3vw, 30px) 40px;
}
.portal-main .portal-status {
  min-height: 30px;
  width: fit-content;
  max-width: 100%;
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 0 auto 14px;
  padding: 6px 10px;
  border: 1px solid transparent;
  border-radius: 999px;
  color: var(--ui-text-soft);
  font-size: .71rem;
  font-weight: 560;
  line-height: 1.3;
}
.portal-main .portal-status:empty { min-height: 0; margin-bottom: 0; padding: 0; }
.portal-main .portal-status[data-error="true"] { border-color: var(--ui-danger-border); background: var(--ui-danger-soft); color: var(--ui-danger); }
.portal-main .portal-status .ui-loading-state { display: inline-flex; align-items: center; gap: 7px; }
.portal-main .portal-status .ui-loading-state i { width: 15px; height: 15px; flex: 0 0 15px; }
.portal-auth-stage { min-height: min(62dvh, 610px); display: grid; place-items: center; }
.portal-auth-stage:empty { display: none; }
.portal-auth-stage:not(:has(> :not([hidden]))) { display: none; }
.portal-main .portal-auth-card,
.portal-main .account-setup {
  width: min(100%, 470px);
  min-height: 0;
  margin: 0;
  padding: 24px;
  border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius-lg);
  background: var(--ui-surface);
  box-shadow: 0 10px 34px rgba(28, 41, 46, .055);
}
.portal-card-heading, .portal-section-heading {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}
.portal-card-heading { margin-bottom: 18px; }
.portal-card-heading h2, .portal-main .account-setup h2 {
  margin: 0;
  color: var(--ui-text);
  font-size: 1.08rem;
  font-weight: 670;
  letter-spacing: -.018em;
}
.portal-card-heading p, .portal-main .account-setup > p, .portal-supporting-copy {
  margin: 4px 0 0;
  color: var(--ui-muted);
  font-size: .74rem;
  line-height: 1.5;
}
.portal-main :where(.portal-auth-card, .account-setup) form { gap: 13px; }
.portal-main :where(.portal-auth-card, .account-setup) label,
.portal-main :where(.portal-section, .portal-composer, .portal-upload-form) label {
  min-width: 0;
  display: grid;
  gap: 6px;
  margin: 0;
  color: var(--ui-text-soft);
  font-size: .75rem;
  font-weight: 630;
}
.portal-main :where(.portal-auth-card, .account-setup) form > button.primary { width: 100%; margin-top: 2px; }
.portal-main .account-setup-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 18px;
}
.portal-main .account-setup-actions .ui-button { min-height: 36px; }
.portal-main .account-setup-actions .ui-button--primary { flex: 1 1 190px; }
.portal-main .portal-auth-card > .actions {
  justify-content: center;
  gap: 3px 12px;
  margin-top: 13px !important;
}
.portal-main .portal-auth-card > .actions button,
.portal-main .account-setup > button {
  min-height: 30px;
  padding: 5px 4px;
  border: 0;
  background: transparent;
  color: var(--ui-accent);
}
.portal-main .portal-auth-card > .actions button:hover,
.portal-main .account-setup > button:hover { background: transparent; color: var(--ui-accent-hover); text-decoration: underline; }
.portal-main .account-setup code {
  display: block;
  overflow-wrap: anywhere;
  padding: 10px;
  border-radius: var(--ui-radius-sm);
  background: var(--ui-surface-muted);
  color: var(--ui-text);
  font-size: .76rem;
}
.portal-main .account-setup img { display: block; margin: 10px auto; border-radius: var(--ui-radius-sm); }
.portal-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 21px 24px;
  border: 1px solid var(--ui-accent-border);
  border-radius: var(--ui-radius);
  background: linear-gradient(115deg, var(--ui-accent-soft), color-mix(in srgb, var(--ui-accent-soft) 52%, var(--ui-surface)));
  box-shadow: var(--ui-shadow-card);
}
.portal-hero h2 { margin: 4px 0 0; color: var(--ui-text); font-size: 1.2rem; font-weight: 680; letter-spacing: -.02em; }
.portal-hero p { margin: 4px 0 0; color: var(--ui-text-soft); font-size: .76rem; }
.portal-load-more { display: flex; margin: 12px auto 0; }
.portal-tabs {
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 13px 0;
  padding: 5px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius);
  background: var(--ui-surface);
  box-shadow: var(--ui-shadow-card);
  scrollbar-width: thin;
  touch-action: pan-x;
  -webkit-overflow-scrolling: touch;
}
.portal-tabs button {
  min-width: max-content;
  min-height: 38px;
  justify-content: flex-start;
  gap: 7px;
  padding: 8px 12px;
  border: 1px solid transparent;
  border-radius: var(--ui-radius-sm);
  background: transparent;
  color: var(--ui-muted);
  font-size: .72rem;
}
.portal-tabs button:hover,
.portal-tabs button[aria-selected="true"] {
  border-color: var(--ui-accent-border);
  background: var(--ui-accent-soft);
  color: var(--ui-accent);
}
.portal-tabs button[aria-selected="true"] { font-weight: 680; }
.portal-tabs button i { width: 16px; height: 16px; flex: 0 0 16px; }
.portal-more-trigger, .portal-more-menu { display: none; }
.portal-main .portal-section {
  min-height: 360px;
  margin: 0;
  padding: 23px 25px;
  border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius);
  background: var(--ui-surface);
  box-shadow: var(--ui-shadow-card);
}
.portal-section-heading { margin-bottom: 19px; padding-bottom: 15px; border-bottom: 1px solid var(--ui-border); }
.portal-section-heading h3 { margin: 0; color: var(--ui-text); font-size: .94rem; font-weight: 680; }
.portal-section-heading p { margin: 3px 0 0; color: var(--ui-muted); font-size: .72rem; }
.portal-card-icon { width: 36px; height: 36px; flex-basis: 36px; }
.portal-stack, .portal-message-list, .portal-file-list { display: grid; gap: 10px; }
.portal-stack > p:only-child, .portal-message-list > p:only-child, .portal-file-list > p:only-child {
  margin: 0;
  padding: 22px 4px;
  color: var(--ui-muted);
  font-size: .76rem;
  text-align: center;
}
.portal-stack > .ui-loading-state {
  min-height: 150px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  color: var(--ui-muted);
  font-size: .76rem;
}
.portal-stack > .ui-loading-state i { width: 16px; height: 16px; flex: 0 0 16px; }
.portal-document-notice {
  margin: 0;
  padding: 10px 12px;
  border: 1px solid var(--ui-warning-border);
  border-radius: var(--ui-radius-sm);
  background: var(--ui-warning-soft);
  color: var(--ui-warning);
  font-size: .72rem;
}
.portal-main details {
  overflow: hidden;
  border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius-sm);
  background: var(--ui-surface-soft);
}
.portal-main details > summary {
  position: relative;
  min-height: 44px;
  display: flex;
  align-items: center;
  padding: 10px 38px 10px 13px;
  color: var(--ui-text);
  font-size: .76rem;
  font-weight: 650;
  cursor: pointer;
  list-style: none;
}
.portal-main details > summary::-webkit-details-marker { display: none; }
.portal-main details > summary::after {
  position: absolute;
  right: 13px;
  width: 14px;
  height: 14px;
  background: currentColor;
  content: "";
  -webkit-mask: var(--portal-chevron-down) center / contain no-repeat;
  mask: var(--portal-chevron-down) center / contain no-repeat;
  transition: transform 140ms ease;
}
.portal-main details[open] > summary::after { transform: rotate(180deg); }
.portal-main details > :not(summary) { margin-right: 13px; margin-left: 13px; }
.portal-main details > :last-child { margin-bottom: 13px; }
.portal-main details pre {
  max-height: 300px;
  overflow: auto;
  padding: 12px;
  border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius-sm);
  background: var(--ui-surface);
  color: var(--ui-text-soft);
  font: 500 .7rem/1.55 var(--ui-font);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.portal-note, .portal-safety-note {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  padding: 10px 11px;
  border-radius: var(--ui-radius-sm);
  font-size: .68rem;
  line-height: 1.45;
}
.portal-main .portal-note { margin: 16px 0 0; background: var(--ui-surface-muted); color: var(--ui-text-soft); }
.portal-safety-note { margin: 0 0 14px; border: 1px solid var(--ui-danger-border); background: var(--ui-danger-soft); color: var(--ui-danger); }
.portal-safety-note i { width: 15px; height: 15px; flex: 0 0 15px; margin-top: 1px; }
.portal-main .portal-message {
  max-width: min(82%, 660px);
  display: grid;
  justify-items: start;
  gap: 5px;
  margin: 0;
  padding: 11px 13px;
  border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius);
  background: var(--ui-surface-soft);
}
.portal-main .portal-message--patient { justify-self: end; border-color: var(--ui-accent-border); background: var(--ui-accent-soft); }
.portal-message strong { font-size: .72rem; }
.portal-message p { margin: 0; color: var(--ui-text-soft); font-size: .76rem; line-height: 1.5; }
.portal-message small { color: var(--ui-muted); font-size: .65rem; }
.portal-message button { min-height: 31px; padding: 6px 10px; font-size: .67rem; }
.portal-composer, .portal-upload-form {
  margin-top: 18px !important;
  padding: 17px;
  border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius);
  background: var(--ui-surface-soft);
}
.portal-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.portal-form-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.portal-file-list > .portal-file,
.portal-stack > .portal-file {
  min-height: 52px;
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  margin: 0;
  padding: 8px 10px;
  border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius-sm);
  background: var(--ui-surface-soft);
  color: var(--ui-text-soft);
  font-size: .74rem;
}
.portal-file-icon {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: var(--ui-radius-sm);
  background: var(--ui-accent-soft);
  color: var(--ui-accent);
}
.portal-file-icon i { width: 16px; height: 16px; flex-basis: 16px; }
.portal-file-copy { min-width: 0; overflow-wrap: anywhere; }
.portal-file-copy strong { display: block; color: var(--ui-text); font-size: .73rem; }
.portal-file-copy span { display: block; margin-top: 2px; color: var(--ui-muted); font-size: .66rem; text-transform: capitalize; }
.portal-file button { min-height: 32px; padding: 6px 10px; }
.portal-home-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.portal-overview-card { min-width: 0; display: flex; align-items: center; gap: 11px; padding: 14px; border: 1px solid var(--ui-border); border-radius: var(--ui-radius); background: var(--ui-surface-soft); }
.portal-overview-card > div { min-width: 0; display: grid; gap: 2px; }
.portal-overview-card strong { color: var(--ui-text); font-size: .82rem; }
.portal-overview-card small, .portal-overview-label { color: var(--ui-muted); font-size: .67rem; line-height: 1.4; }
.portal-overview-label { font-weight: 680; letter-spacing: .045em; text-transform: uppercase; }
.portal-home-grid > .ui-button { grid-column: 1 / -1; justify-self: start; }
.portal-home-trends { margin-top: 20px; }
.portal-subsection-heading h4 { margin: 0; color: var(--ui-text); font-size: .84rem; }
.portal-subsection-heading p { margin: 3px 0 10px; color: var(--ui-muted); font-size: .7rem; }
.portal-trend-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.portal-trend-card { display: grid; gap: 4px; padding: 13px; border: 1px solid var(--ui-border); border-radius: var(--ui-radius-sm); background: var(--ui-surface-soft); }
.portal-trend-card strong { color: var(--ui-text-soft); font-size: .72rem; }
.portal-trend-card > span { color: var(--ui-accent); font-size: 1.2rem; font-weight: 700; }
.portal-trend-card small { color: var(--ui-muted); font-size: .66rem; }
.portal-message-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; }
.portal-attachment-status, .upload-progress { margin: 0; color: var(--ui-muted); font-size: .68rem; }
.portal-composer-actions { min-width: 0; display: flex; flex-wrap: nowrap; align-items: center; justify-content: space-between; gap: 8px; }
.portal-composer-actions :where(.portal-attachment-picker, button) { min-height: 34px; height: 34px; padding: 6px 11px; font-size: .7rem; white-space: nowrap; }
.portal-composer-actions :where(.portal-attachment-picker, button) i { width: 14px; height: 14px; flex-basis: 14px; }
.portal-main .portal-composer-actions .portal-attachment-picker { position: relative; min-width: 0; display: inline-flex; grid-template-columns: none; align-items: center; gap: 6px; overflow: hidden; }
.portal-attachment-picker span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.portal-main .portal-composer-actions > button { min-height: 34px; height: 34px; flex: 0 0 auto; }
.portal-attachment-picker input { position: absolute; width: 1px !important; height: 1px !important; opacity: 0; pointer-events: none; }
.portal-history-record summary > span { min-width: 0; display: grid; gap: 2px; }
.portal-history-record summary small { color: var(--ui-muted); font-size: .66rem; font-weight: 500; }
.portal-history-answers { display: grid; grid-template-columns: minmax(130px, .55fr) minmax(0, 1.45fr); gap: 0; padding-bottom: 6px; }
.portal-history-answers dt, .portal-history-answers dd { margin: 0; padding: 9px 0; border-top: 1px solid var(--ui-border); font-size: .71rem; line-height: 1.45; }
.portal-history-answers dt { padding-right: 12px; color: var(--ui-text); font-weight: 640; }
.portal-history-answers dd { color: var(--ui-text-soft); white-space: pre-wrap; }
.portal-settings-layout { display: grid; grid-template-columns: 190px minmax(0, 1fr); gap: 16px; align-items: start; }
.portal-settings-nav { display: grid; gap: 4px; padding: 5px; border: 1px solid var(--ui-border); border-radius: var(--ui-radius); background: var(--ui-surface-soft); }
.portal-settings-nav button { justify-content: flex-start; min-height: 36px; padding: 7px 10px; border: 1px solid transparent; background: transparent; color: var(--ui-muted); font-size: .71rem; }
.portal-settings-nav button[aria-selected="true"] { border-color: var(--ui-accent-border); background: var(--ui-accent-soft); color: var(--ui-accent); }
.portal-settings-panes > section { min-width: 0; }
.portal-settings-panes h4 { margin: 0 0 4px; color: var(--ui-text); font-size: .86rem; }
.portal-settings-panes h4 + p { margin: 0 0 14px; color: var(--ui-muted); font-size: .71rem; }
.portal-form-grid-wide { grid-column: 1 / -1; }
.portal-settings-actions, .portal-choice-list { display: grid; gap: 9px; }
.portal-choice-list .ui-choice { display: flex; align-items: center; gap: 8px; }
.portal-checkin-chat { margin-bottom: 14px; }
.portal-checkin-start, .portal-checkin-submit { display: grid; gap: 11px; padding: 14px; border: 1px solid var(--ui-border); border-radius: var(--ui-radius); background: var(--ui-surface-soft); }
.portal-checkin-start .primary, .portal-checkin-submit .ui-button { justify-self: start; }
.portal-success-note { padding: 11px 12px; border: 1px solid var(--ui-success-border); border-radius: var(--ui-radius-sm); background: var(--ui-success-soft); color: var(--ui-success); font-size: .72rem; }
.portal-masthead #signoutButton, .portal-hero #refreshButton { align-items: center; justify-content: center; }
.portal-masthead #signoutButton i, .portal-hero #refreshButton i { display: block; margin: 0; }
.portal-main #program { gap: 13px; }
.portal-main #program > p:first-child {
  margin: 0;
  padding: 11px 13px;
  border-radius: var(--ui-radius-sm);
  background: var(--ui-accent-soft);
  color: var(--ui-accent);
  font-size: .74rem;
  font-weight: 650;
  text-transform: capitalize;
}
.portal-main #program > form, .portal-main #program > section {
  display: grid;
  gap: 12px;
  padding: 15px;
  border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius);
  background: var(--ui-surface-soft);
}
.portal-main #program > section h4 { margin: 0; font-size: .84rem; }
.portal-main #program article {
  padding: 10px 12px;
  border-radius: var(--ui-radius-sm);
  background: var(--ui-surface);
}
.portal-main #program article strong { font-size: .7rem; }
.portal-main #program article p { margin: 3px 0 0; font-size: .74rem; }
.portal-main #program label:has(input[type="checkbox"]) {
  display: flex;
  grid-template-columns: none;
  align-items: flex-start;
  gap: 9px;
  font-size: .72rem;
  font-weight: 520;
}
.portal-main #wellness form { display: grid; gap: 13px; }
.portal-main #wellness form > button { justify-self: end; }
.portal-main input[type="file"] {
  padding: 6px;
  background: var(--ui-surface);
  color: var(--ui-muted);
}
.portal-main input[type="file"]::file-selector-button {
  min-height: 30px;
  margin-right: 9px;
  padding: 6px 11px;
  border: 1px solid var(--ui-border-strong);
  border-radius: 999px;
  background: var(--ui-surface);
  color: var(--ui-text-soft);
  font: 620 .7rem var(--ui-font);
  cursor: pointer;
}
.portal-main input[type="file"]::file-selector-button:hover { border-color: var(--ui-accent-border); background: var(--ui-accent-soft); color: var(--ui-accent); }
html[data-theme-surface="patient-portal"].dark :where(.portal-masthead, .portal-main .portal-auth-card, .portal-main .account-setup, .portal-main .portal-section, .portal-tabs, .portal-main details pre, .portal-main #program article) { background-color: var(--ui-surface); }
html[data-theme-surface="patient-portal"].dark .portal-masthead { background: color-mix(in srgb, var(--ui-surface) 94%, transparent); }
html[data-theme-surface="patient-portal"].dark .portal-hero { background: linear-gradient(115deg, var(--ui-accent-soft), color-mix(in srgb, var(--ui-accent-soft) 50%, var(--ui-surface))); }
html[data-theme-surface="patient-portal"].dark .portal-tabs button:not([aria-selected="true"]) {
  color: var(--ui-muted);
  transition: none;
}

@media (max-width: 680px) {
  .portal-masthead { min-height: 62px; padding: 9px 14px; }
  .portal-brand-logo { width: 34px; height: 34px; flex-basis: 34px; }
  .portal-wordmark { font-size: .94rem; }
  .portal-brand-subtitle { font-size: .64rem; }
  .portal-masthead-actions { gap: 4px; }
  .portal-masthead #signoutButton { width: 36px; min-width: 36px; padding: 0; font-size: 0; }
  .portal-masthead #signoutButton i { margin: 0; }
  .portal-main { padding: 13px 11px 30px; }
  .portal-status { margin-bottom: 10px; }
  .portal-auth-stage { min-height: calc(100dvh - 155px); align-items: center; }
  .portal-main .portal-auth-card, .portal-main .account-setup { width: min(100%, 430px); padding: 19px 17px; }
  .portal-hero { align-items: flex-start; padding: 17px; }
  .portal-hero h2 { font-size: 1.03rem; }
  .portal-hero #refreshButton { width: 36px; min-width: 36px; min-height: 36px; padding: 0; font-size: 0; }
  .portal-hero #refreshButton i { margin: 0; }
  .portal-tabs { margin: 10px 0; padding: 4px; }
  .portal-tabs button { min-height: 36px; padding: 7px 10px; }
  .portal-tabs button[data-mobile-more="true"] { display: none; }
  .portal-tabs .portal-more-trigger { display: inline-flex; }
  .portal-more-menu { position: fixed; z-index: 45; top: 178px; right: 11px; min-width: 165px; padding: 5px; border: 1px solid var(--ui-border); border-radius: var(--ui-radius); background: var(--ui-surface); box-shadow: var(--ui-shadow-popover); }
  .portal-more-menu:not([hidden]) { display: grid; }
  .portal-more-menu button { width: 100%; justify-content: flex-start; }
  .portal-main .portal-section { min-height: 300px; padding: 17px 15px; }
  .portal-section-heading { margin-bottom: 15px; padding-bottom: 13px; }
  .portal-section-heading .portal-card-icon { display: none; }
  .portal-form-grid { grid-template-columns: minmax(0, 1fr); }
  .portal-form-grid-wide { grid-column: auto; }
  .portal-home-grid, .portal-trend-grid, .portal-settings-layout { grid-template-columns: minmax(0, 1fr); }
  .portal-settings-nav { display: flex; overflow-x: auto; }
  .portal-settings-nav button { min-width: max-content; }
  .portal-history-answers { grid-template-columns: minmax(0, 1fr); }
  .portal-history-answers dt { padding-bottom: 2px; }
  .portal-history-answers dd { padding-top: 2px; border-top: 0; }
  .portal-main .portal-message { max-width: 92%; }
  .portal-composer, .portal-upload-form { padding: 13px; }
  .portal-file-list > .portal-file { grid-template-columns: 34px minmax(0, 1fr); }
  .portal-file > button { grid-column: 2; justify-self: start; }
  .portal-main input:not([type="checkbox"]):not([type="radio"]),
  .portal-main textarea,
  .portal-main select {
    font-size: 16px !important;
    font-size-adjust: .44;
  }
}

@media (prefers-reduced-motion: reduce) {
  .portal-main details > summary::after { transition: none; }
}

/* ========================================================================== */
/* Clinic configuration — migrated 2026-09-09                                */
/* ========================================================================== */

html[data-theme-surface="clinic-configuration"],
html[data-theme-surface="clinic-configuration"] body {
  width: 100%;
  min-width: 320px;
  min-height: 100%;
  height: auto;
  overflow-x: hidden;
  overflow-y: auto;
  background: var(--ui-canvas);
}

html[data-theme-surface="clinic-configuration"] .config-shell {
  width: min(1220px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0 84px;
}
.config-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 18px; }
.config-header h1 { margin-top: 7px !important; font-size: 1.35rem !important; }
.config-header p { margin-top: 4px !important; }
.config-back-button { width: fit-content; min-height: 36px; }
.config-back-button__icon { display: inline-grid; place-items: center; line-height: 1; }
.config-status {
  min-height: 42px;
  display: flex;
  align-items: center;
  margin-bottom: 16px;
  padding: 10px 13px;
  border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius);
  background: var(--ui-surface);
  color: var(--ui-text-soft);
  font-size: .76rem;
  box-shadow: var(--ui-shadow-card);
}
.config-status[data-tone="danger"] { border-color: var(--ui-danger-border); background: var(--ui-danger-soft); color: var(--ui-danger); }
.config-status[data-tone="success"] { border-color: var(--ui-success-border); background: var(--ui-success-soft); color: var(--ui-success); }
/* (The .ay-settings-loading rules are not surface-scoped: the code-loading fallback renders before the settings page
   switches the page to its own surface, while it is still the dashboard surface.)
   Clinic settings waits use the dashboard's spinner: the same 38px ring turning at 720ms, centered, fading in
   after a short delay so a fast response never flashes it. The wording stays for screen readers only.
   Two implementations share the look. The React page (the one the commercial build serves) renders
   <SettingsLoading>, styled by .ay-settings-loading below. The legacy HTML page renders the shared loading
   helper's icon + label, restyled here by matching that exact icon (so nothing else using .ui-loading-state
   is touched); its page-level status becomes a full-screen overlay. */
.ay-settings-loading {
  position: relative;
  width: 100%;
  min-height: 96px;
  display: grid;
  place-items: center;
  animation: config-loading-in 200ms ease-out 180ms both;
}
.ay-settings-loading.is-overlay {
  position: fixed;
  inset: 0;
  z-index: 300;
  min-height: 0;
  pointer-events: none;
}
/* A save that needs the password prompt stays "busy" until the password is entered, so the blocking spinner must
   never sit over (or beside) an open dialog: dialogs sit above it, and it hides while any dialog is open. */
body:has(.ay-settings-dialog-backdrop:not(.is-leaving)) .ay-settings-loading { display: none; }
.ay-settings-loading.is-blocking {
  pointer-events: auto;
  background: color-mix(in srgb, var(--ui-canvas) 78%, transparent);
}
html[data-theme-surface="clinic-configuration"] .dashboard-modern-spinner {
  width: 38px; height: 38px; display: block; border: 3px solid var(--ui-accent-soft);
  border-top-color: var(--ui-accent); border-radius: 50%; animation: dashboard-spinner 720ms linear infinite;
}
html[data-theme-surface="clinic-configuration"] .ui-loading-state:has(> i.fa-spin) {
  position: relative;
  width: 100%;
  min-height: 96px;
  display: grid;
  place-items: center;
  gap: 0;
  animation: config-loading-in 200ms ease-out 180ms both;
}
html[data-theme-surface="clinic-configuration"] .ui-loading-state:has(> i.fa-spin) > i {
  width: 38px;
  height: 38px;
  flex: none;
  display: block;
  color: transparent;
  font-size: 0;
  border: 3px solid var(--ui-accent-soft);
  border-top-color: var(--ui-accent);
  border-radius: 50%;
  animation: dashboard-spinner 720ms linear infinite;
}
html[data-theme-surface="clinic-configuration"] .ui-loading-state:has(> i.fa-spin) > i::before { content: none; }
html[data-theme-surface="clinic-configuration"] .ui-loading-state:has(> i.fa-spin) > span {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
html[data-theme-surface="clinic-configuration"] .config-status:has(> .ui-loading-state > i.fa-spin) {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: grid;
  place-items: center;
  min-height: 0;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: color-mix(in srgb, var(--ui-canvas) 82%, transparent);
  box-shadow: none;
  animation: config-loading-in 200ms ease-out 180ms both;
}
html[data-theme-surface="clinic-configuration"] .config-status > .ui-loading-state:has(> i.fa-spin) { min-height: 0; animation: none; }
@keyframes config-loading-in { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  html[data-theme-surface="clinic-configuration"] .ui-loading-state > i, html[data-theme-surface="clinic-configuration"] .dashboard-modern-spinner { animation-duration: 1.8s; }
}
.config-inline-status { margin: 0 0 14px; padding: 0 2px; }
.config-inline-status p { margin: 0; color: var(--ui-muted); font-size: .74rem; line-height: 1.45; }
.config-grid { display: block; }
.config-card {
  min-width: 0;
  margin-bottom: 14px;
  padding: 19px;
  border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius-lg);
  background: var(--ui-surface);
  box-shadow: var(--ui-shadow-card);
}
.config-card--wide { grid-column: 1 / -1; }
.config-card h2 { margin: 0 0 4px; color: var(--ui-text); font-size: 1rem; font-weight: 650; letter-spacing: -.015em; }
.config-card h3 { color: var(--ui-text); font-weight: 650; }
.config-subheading { margin: 18px 0 8px; font-size: .88rem; }
.config-help { margin: 0 0 14px; color: var(--ui-muted); font-size: .74rem; line-height: 1.5; }
.config-help i { vertical-align: -3px; }
.field-grid, .policy-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 14px; }
.field { min-width: 0; display: grid; align-content: start; gap: 6px; }
.field--wide { grid-column: 1 / -1; }
.field label, .field-label { margin: 0; color: var(--ui-text-soft); font-size: .75rem; font-weight: 650; }
html[data-theme-surface="clinic-configuration"] :where(.field input, .field textarea, .field select, .publish-row input, .question-edit textarea, .question-library-select, .settings-inline-section input:not([type="checkbox"]):not([type="radio"]), .settings-inline-section textarea, .settings-inline-section select) {
  width: 100%;
  min-width: 0;
  min-height: 40px;
  margin: 0;
  padding: 9px 11px;
  border: 1px solid var(--ui-border-strong);
  border-radius: var(--ui-radius-sm);
  background: var(--ui-surface);
  color: var(--ui-text);
  font-size: 14px;
}
html[data-theme-surface="clinic-configuration"] :where(.field textarea, .question-edit textarea, .settings-inline-section textarea) { min-height: 92px; resize: vertical; }
.policy-card, .custom-card, .interface-preview {
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius);
  background: var(--ui-surface-soft);
}
.policy-head, .custom-card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.policy-title { color: var(--ui-text); font-size: .8rem; font-weight: 650; }
.check-row {
  min-width: 0;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 0;
  color: var(--ui-text-soft);
  font-size: .75rem;
  font-weight: 520;
  line-height: 1.45;
}
.check-row input[type="checkbox"], .check-row input[type="radio"] { width: 17px; height: 17px; flex: 0 0 17px; margin: 2px 0 0; }
.publish-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; margin-top: 14px; }
.validation-list { margin: 10px 0 0; padding-left: 20px; color: var(--ui-danger); font-size: .74rem; }
.changed-sections, .version-meta { color: var(--ui-muted); font-size: .72rem; }
.version-list { display: grid; gap: 8px; }
.version-history { display: grid; gap: 8px; margin-top: 8px; padding-top: 12px; border-top: 1px solid var(--ui-border); }
.version-list-heading { margin: 0; font-size: .78rem; }
.version-item { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--ui-border); }
.platform-floor { border: 1px solid var(--ui-accent-border); background: color-mix(in srgb, var(--ui-accent-soft) 42%, var(--ui-surface)); }
.setup-layout { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 18px; align-items: start; }
.setup-nav {
  position: sticky;
  top: 16px;
  display: grid;
  gap: 3px;
  padding: 8px;
  border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius-lg);
  background: var(--ui-surface);
  box-shadow: var(--ui-shadow-card);
}
.setup-nav button {
  width: 100%;
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  padding: 9px 10px;
  border: 0;
  border-radius: var(--ui-radius-sm);
  background: transparent;
  color: var(--ui-text-soft);
  font-size: .76rem;
  font-weight: 620;
  text-align: left;
}
.setup-nav button:hover { background: var(--ui-surface-soft); color: var(--ui-accent); }
.setup-nav button[aria-current="step"] { background: var(--ui-accent-soft); color: var(--ui-accent); }
.step-number { width: 23px; height: 23px; display: grid; place-items: center; flex: 0 0 23px; border: 1px solid var(--ui-border-strong); border-radius: 50%; background: var(--ui-surface); color: var(--ui-muted); font-size: .66rem; }
.setup-nav button[aria-current="step"] .step-number { border-color: var(--ui-accent-border); background: var(--ui-accent); color: #fff; }
.setup-main { min-width: 0; }
.config-card[data-step-panel] { display: none; }
.config-card[data-step-panel].is-active { display: block; animation: config-fade 160ms ease-out; }
@keyframes config-fade { from { transform: translateY(3px); } }
.step-heading { margin: 0 0 15px; }
.setup-footer {
  position: sticky;
  bottom: 10px;
  z-index: 12;
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
  padding: 9px;
  border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius-lg);
  background: color-mix(in srgb, var(--ui-surface) 94%, transparent);
  box-shadow: var(--ui-shadow-popover);
  backdrop-filter: blur(14px);
}
.setup-footer-navigation, .setup-footer-actions { display: flex; align-items: center; gap: 7px; }
.setup-footer-navigation { flex: 0 0 auto; }
.setup-footer-position { margin-right: auto; white-space: nowrap; }
.setup-footer-actions { flex: 0 0 auto; white-space: nowrap; }
.setup-footer-actions .btn { min-height: 34px; padding: 7px 13px; font-size: .72rem; }
.setup-footer-arrow {
  width: 34px;
  height: 34px;
  min-width: 34px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid var(--ui-border-strong);
  border-radius: 50%;
  background: var(--ui-surface);
  color: var(--ui-text-soft);
}
.setup-footer-arrow:hover:not(:disabled) { border-color: var(--ui-accent-border); background: var(--ui-accent-soft); color: var(--ui-accent); }
.setup-footer-arrow:disabled { opacity: .4; cursor: not-allowed; }
.setup-footer-arrow i { width: 13px; height: 13px; }
.assistant-card { border-color: var(--ui-accent-border); background: linear-gradient(135deg, color-mix(in srgb, var(--ui-accent-soft) 55%, var(--ui-surface)), var(--ui-surface)); }
.assistant-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: end; }
.assistant-result { margin-top: 12px; padding: 12px; border: 1px solid var(--ui-border); border-radius: var(--ui-radius); background: var(--ui-surface); }
.assistant-result-actions, .role-pills, .preview-action-row, .preview-chip-row { display: flex; flex-wrap: wrap; gap: 8px; }
.assistant-result-actions, .preview-action-row { margin-top: 10px; }
.question-groups { display: grid; gap: 11px; }
.question-group { overflow: hidden; border: 1px solid var(--ui-border); border-radius: var(--ui-radius); background: var(--ui-surface-soft); }
.question-group-title { margin: 0; padding: 12px 13px; border-bottom: 1px solid var(--ui-border); color: var(--ui-text); font-size: .78rem; font-weight: 650; }
.question-list { display: grid; gap: 1px; background: var(--ui-border); }
.question-row { padding: 11px 13px; background: var(--ui-surface); }
.question-row-main { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.question-row-main > label:first-child { font-size: .76rem; font-weight: 620; }
.question-edit { display: grid; gap: 6px; margin-top: 9px; }
.question-edit label { color: var(--ui-text-soft); font-size: .7rem; font-weight: 620; }
.question-library-actions { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 10px; padding: 12px 13px; border-top: 1px solid var(--ui-border); background: var(--ui-surface); }
.switch { position: relative; width: 38px; height: 22px; flex: 0 0 38px; }
.switch input { position: absolute; opacity: 0; }
.switch span { position: absolute; inset: 0; border: 1px solid var(--ui-border-strong); border-radius: 999px; background: var(--ui-surface-muted); transition: 150ms ease; }
.switch span::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: var(--ui-surface); box-shadow: 0 1px 3px rgba(15,23,42,.18); transition: 150ms ease; }
.switch input:checked + span { border-color: var(--ui-accent); background: var(--ui-accent); }
.switch input:checked + span::after { transform: translateX(16px); }
.switch input:focus-visible + span { box-shadow: var(--ui-focus); }
.role-pill, .preview-chip, .preview-action { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--ui-border); background: var(--ui-surface); color: var(--ui-text-soft); }
.role-pill { padding: 7px 10px; border-radius: 999px; font-size: .72rem; }
.controlled-field { background: var(--ui-surface-muted) !important; color: var(--ui-text-soft) !important; }
.interface-preview-grid { display: grid; grid-template-columns: 1fr; gap: 12px; margin-top: 14px; }
.interface-preview-title { margin: 0 0 9px; color: var(--ui-muted); font-size: .67rem; font-weight: 650; letter-spacing: .05em; text-transform: uppercase; }
.interface-preview-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; color: var(--ui-text); font-size: .78rem; }
.preview-size-controls { display: flex; gap: 6px; }
.preview-size-controls .btn { min-height: 34px; padding: 6px 11px; font-size: .7rem; }
.preview-size-controls .btn.is-active { border-color: var(--ui-accent-border); background: var(--ui-accent-soft); color: var(--ui-accent); }
.preview-chat-shell, .preview-dashboard-shell, .interface-preview-frame { padding: 11px; border: 1px solid var(--ui-border); border-radius: var(--ui-radius); background: var(--ui-surface); }
.interface-preview-frame { width: 100%; margin-inline: auto; transition: opacity var(--ui-duration-fast) var(--ui-ease-out); }
.interface-preview-frame.is-mobile { width: min(390px, 100%); }
.patient-chat-preview { overflow: hidden; padding: 0; background: var(--ui-canvas); }
.patient-chat-preview__masthead { min-height: 54px; display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--ui-border); background: var(--ui-surface); }
.patient-chat-preview__mark { width: 30px; height: 30px; display: grid; place-items: center; flex: 0 0 30px; border-radius: var(--ui-radius-sm); background: var(--ui-accent-soft); color: var(--ui-accent); font-size: 1rem; }
.patient-chat-preview__masthead div { display: grid; gap: 1px; }
.patient-chat-preview__masthead strong { color: var(--ui-text); font-size: .76rem; }
.patient-chat-preview__masthead span:last-child { color: var(--ui-muted); font-size: .64rem; }
.patient-chat-preview__mark img { width:100%; height:100%; object-fit:contain; border-radius:inherit; }
.patient-chat-preview__menu { margin-left:auto; display:flex !important; grid-auto-flow:column; align-items:center; gap:5px !important; }
.patient-chat-preview__menu span { padding:4px 6px; border:1px solid var(--ui-border); border-radius:var(--ui-radius-xs); color:var(--ui-muted); font-size:.58rem !important; }
.patient-chat-preview__notice { margin: 10px auto 0; padding: 7px 11px; color: var(--ui-danger); font-size: .67rem; font-weight: 600; text-align: center; }
.patient-chat-preview__conversation { min-height: 178px; display:flex; flex-direction:column; gap:9px; padding:14px; }
.patient-chat-preview__bubble { width: min(72%, 430px); padding: 10px 12px; border: 1px solid var(--ui-border); border-radius: var(--ui-radius) var(--ui-radius) var(--ui-radius) 3px; background: var(--ui-surface); color: var(--ui-text-soft); font-size: .72rem; box-shadow: var(--ui-shadow-card); }
.patient-chat-preview__bubble.is-patient { align-self:flex-end; width:auto; max-width:62%; border-color:color-mix(in srgb,var(--preview-accent) 32%,var(--ui-border)); border-radius:var(--ui-radius) var(--ui-radius) 3px var(--ui-radius); background:color-mix(in srgb,var(--preview-accent) 10%,var(--ui-surface)); }
.patient-chat-preview__choices { display:flex; flex-wrap:wrap; gap:6px; }
.patient-chat-preview__choices span { padding:6px 9px; border:1px solid var(--ui-border-strong); border-radius:var(--ui-radius-sm); background:var(--ui-surface-soft); color:var(--ui-text); font-size:.66rem; font-weight:650; }
.patient-chat-preview__composer { padding: 10px; border-top: 1px solid var(--ui-border); background: var(--ui-surface); }
.patient-chat-preview__composer textarea { min-height: 48px !important; resize: none !important; }
.patient-chat-preview__controls { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 8px; }
.patient-chat-preview__controls .btn { min-height: 32px; padding: 6px 10px; font-size: .66rem; }
.patient-chat-preview__controls span { min-height:30px; display:inline-flex; align-items:center; padding:5px 8px; border:1px solid var(--ui-border); border-radius:var(--ui-radius-xs); color:var(--ui-muted); font-size:.62rem; }
.patient-chat-preview__controls .is-security { margin-right:auto; border:0; }
.patient-chat-preview__controls .is-send { border-color:var(--preview-accent); background:var(--preview-accent); color:#fff; }
.ay-settings-field-card-grid > .ay-settings-policy-link:last-child:nth-child(odd) { grid-column:1/-1; }
.patient-chat-preview.is-dark { --ui-canvas:#11191b; --ui-surface:#1d2729; --ui-surface-soft:#172123; --ui-border:#344447; --ui-border-strong:#53676b; --ui-text:#f3f6f5; --ui-text-soft:#dbe4e2; --ui-muted:#aebcba; --ui-danger:#ffb4ab; --ui-shadow-card:none; }
.patient-chat-preview.is-mobile .patient-chat-preview__controls .btn { flex: 1 1 calc(50% - 6px); }
.preview-chat-message { padding: 7px 9px; border: 1px solid var(--ui-accent-border); border-radius: var(--ui-radius-sm); background: var(--ui-accent-soft); color: var(--ui-text-soft); font-size: .72rem; }
.preview-chat-composer { display: flex; align-items: center; gap: 7px; margin-top: 11px; padding: 7px 8px; border: 1px solid var(--ui-border); border-radius: 999px; }
.preview-chat-composer span:first-child { flex: 1; color: var(--ui-muted); font-size: .68rem; }
.preview-chip { padding: 5px 8px; border-radius: 999px; font-size: .65rem; font-weight: 650; }
.preview-chip.is-primary { border-color: var(--ui-accent); background: var(--ui-accent); color: #fff; }
.preview-action { padding: 5px 7px; border-radius: var(--ui-radius-xs); font-size: .64rem; }
.preview-dashboard-shell { padding:0; overflow:hidden; }
.preview-dashboard-masthead { min-height:48px; display:flex; align-items:center; gap:10px; padding:10px 13px; border-bottom:1px solid var(--ui-border); }
.preview-dashboard-masthead strong { color:var(--ui-text); font-size:.72rem; }
.preview-dashboard-masthead span { padding-left:10px; border-left:1px solid var(--ui-border); color:var(--ui-muted); font-size:.65rem; }
.preview-dashboard-layout { min-height:210px; display:grid; grid-template-columns:90px minmax(150px,.8fr) minmax(190px,1.2fr); }
.preview-dashboard-layout > * { min-width:0; padding:11px; }
.preview-dashboard-layout > nav { display:grid; align-content:start; gap:5px; border-right:1px solid var(--ui-border); background:var(--ui-surface-soft); }
.preview-dashboard-layout > nav span { padding:7px; border-radius:var(--ui-radius-xs); color:var(--ui-muted); font-size:.61rem; }
.preview-dashboard-layout > nav span.is-active { background:var(--ui-accent-soft); color:var(--ui-accent); font-weight:700; }
.preview-dashboard-queue { border-right:1px solid var(--ui-border); }
.preview-dashboard-search { margin-bottom:10px; padding:7px 8px; border:1px solid var(--ui-border); border-radius:var(--ui-radius-xs); color:var(--ui-muted); font-size:.61rem; }
.preview-dashboard-queue article { display:grid; grid-template-columns:minmax(0,1fr) auto; gap:3px 8px; padding:10px; border:1px solid var(--ui-border); border-radius:var(--ui-radius-sm); background:var(--ui-surface); }
.preview-dashboard-queue article strong { color:var(--ui-text); font-size:.67rem; }
.preview-dashboard-queue article small { grid-column:1; color:var(--ui-muted); font-size:.59rem; }
.preview-dashboard-queue article span { grid-column:2; grid-row:1/3; align-self:center; padding:4px 6px; border-radius:999px; background:var(--ui-accent-soft); color:var(--ui-accent); font-size:.57rem; font-weight:700; }
.preview-dashboard-chart { display:grid; align-content:start; gap:9px; }
.preview-dashboard-chart > strong { color:var(--ui-text); font-size:.72rem; }
.preview-dashboard-chart > p { margin:0; color:var(--ui-muted); font-size:.62rem; line-height:1.45; }
.preview-dashboard-tabs { display:flex; gap:6px; padding-bottom:8px; border-bottom:1px solid var(--ui-border); }
.preview-dashboard-tabs span { padding:4px 7px; color:var(--ui-muted); font-size:.6rem; }
.preview-dashboard-tabs span.is-active { border-bottom:2px solid var(--ui-accent); color:var(--ui-accent); font-weight:700; }
.preview-hidden { display: none !important; }
.dashboard-dialog-textarea { min-height: 110px; resize: vertical; }
.mfa-enrollment-qr-wrap { margin-bottom: 14px; text-align: center; }
.mfa-enrollment-qr-label { margin-bottom: 8px; }
.mfa-enrollment-qr { display: block; width: 220px; height: 220px; max-width: 100%; margin: 0 auto; padding: 8px; border: 1px solid var(--ui-border); border-radius: var(--ui-radius); background: #fff; }
.mfa-enrollment-secret { margin-top: 4px; padding: 10px; overflow-wrap: anywhere; border-radius: var(--ui-radius-sm); background: var(--ui-surface-soft); }
.mfa-enrollment-help { margin-top: 8px; }
.commercial-only-control { display: none !important; }

/* Administrator tools are direct, consistently spaced cards. */
.setup-group { display: grid; gap: 12px; margin: 0; padding: 0; border: 0; }
.setup-group + .setup-group { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--ui-border); }
.setup-group > h3 { margin: 0; font-size: .84rem; }
.settings-section-stack, [data-clinical-settings] { display: grid; gap: 12px; }
.settings-inline-section { min-width: 0; display: grid; gap: 13px; padding: 15px; border: 1px solid var(--ui-border); border-radius: var(--ui-radius); background: var(--ui-surface-soft); }
.settings-inline-section__header { display: grid; gap: 3px; }
.settings-inline-section__header h3 { margin: 0; color: var(--ui-text); font-size: .82rem; font-weight: 650; }
.settings-inline-section__header p { max-width: 76ch; margin: 0; color: var(--ui-muted); font-size: .72rem; line-height: 1.48; }
.settings-inline-subsection { background: var(--ui-surface); }
.settings-inline-section form { width: 100%; max-width: 780px; display: grid; gap: 12px; margin: 0; }
.settings-inline-section form > label:not(.ui-field):not(.check-row) { min-width: 0; display: grid; gap: 6px; color: var(--ui-text-soft); font-size: .75rem; font-weight: 620; }
.settings-inline-section form > label:has(> input[type="checkbox"]), .settings-inline-section fieldset > label:has(> input[type="checkbox"]) { display: flex; align-items: flex-start; gap: 8px; font-weight: 520; }
.settings-inline-section :where(input[type="checkbox"], input[type="radio"]) { width: 17px; height: 17px; flex: 0 0 17px; margin: 2px 0 0; }
.settings-inline-section form > p, .settings-inline-section > p { max-width: 76ch; margin: 0; color: var(--ui-muted); font-size: .72rem; line-height: 1.48; }
.setup-group fieldset { min-width: 0; margin: 15px 0; padding: 14px; border: 1px solid var(--ui-border); border-radius: var(--ui-radius); }
.setup-group > p, #adminTools > p { max-width: 72ch; color: var(--ui-muted); font-size: .74rem; }
.staff-lookup { flex-wrap: wrap; padding-bottom: 16px; }
.staff-lookup label { flex: 1 1 240px; }

.referral-editor { display: grid; gap: 13px; }
.referral-summary, .referral-editor-card { min-width: 0; padding: 14px; border: 1px solid var(--ui-border); border-radius: var(--ui-radius); background: var(--ui-surface-soft); }
.referral-summary-table-wrap { margin-top: 12px; overflow-x: auto; }
.referral-summary-table { width: 100%; border-collapse: collapse; font-size: .72rem; }
.referral-summary-table th, .referral-summary-table td { padding: 9px 10px; border-bottom: 1px solid var(--ui-border); color: var(--ui-text-soft); text-align: left; white-space: nowrap; }
.referral-summary-table th { color: var(--ui-muted); font-size: .66rem; font-weight: 650; letter-spacing: .04em; text-transform: uppercase; }
.status-pill { display: inline-flex; padding: 4px 8px; border: 1px solid var(--ui-border); border-radius: 999px; font-size: .66rem; font-weight: 620; }
.status-pill--success { border-color: var(--ui-success-border); background: var(--ui-success-soft); color: var(--ui-success); }
.status-pill--neutral { background: var(--ui-surface-muted); color: var(--ui-muted); }
.referral-editor-card { display: grid; gap: 12px; margin: 0; background: var(--ui-surface); }
.referral-code { grid-column: 1 / -1; }
.referral-code { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0; padding: 8px 10px; border-radius: var(--ui-radius-sm); background: var(--ui-surface-soft); color: var(--ui-muted); font-size: .7rem; }
.referral-code strong { color: var(--ui-accent); font-size: .7rem; overflow-wrap: anywhere; }
.referral-remove { justify-self: start; }

@media (max-width: 760px) {
  .ay-settings-field-card-grid > .ay-settings-policy-link:last-child:nth-child(odd) { grid-column:auto; }
  html[data-theme-surface="clinic-configuration"] .config-shell { width: min(100% - 20px, 1220px); padding-top: 14px; }
  .config-header, .version-item { align-items: stretch; flex-direction: column; }
  .config-back-button { width: 36px; min-width: 36px; height: 36px; padding: 0; }
  .config-back-button__label { display: none; }
  .field-grid, .policy-grid, .interface-preview-grid { grid-template-columns: 1fr; }
  .field--wide, .config-card--wide { grid-column: auto; }
  .publish-row, .assistant-row { grid-template-columns: 1fr; }
  .setup-layout { grid-template-columns: 1fr; }
  .setup-nav { position: static; display: flex; overflow-x: auto; scrollbar-width: thin; }
  .setup-nav button { width: auto; min-width: max-content; }
  .setup-footer { bottom: 7px; gap: 6px; overflow-x: auto; scrollbar-width: none; }
  .setup-footer::-webkit-scrollbar { display: none; }
  .setup-footer-position { display: none; }
  .setup-footer-actions { gap: 5px; }
  .setup-footer-actions .btn { min-height: 32px; padding: 6px 10px; font-size: .68rem; }
  .setup-footer-arrow { width: 32px; height: 32px; min-width: 32px; }
  .config-card { padding: 16px; }
  .question-library-actions { grid-template-columns: 1fr; }
  .question-library-actions .btn { width: 100%; }
  .dashboard-modal { align-items: end; padding: 9px; }
}

/* Canonical clinic-settings editors. */
.referral-editor-heading { grid-column: 1 / -1; }
.referral-editor-card { grid-template-columns: minmax(0, 1fr); }
.referral-editor-field-grid { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 14px; }
.referral-editor-field-grid > .ui-field:nth-child(3), .referral-editor-field-grid > .ui-field:nth-child(4) { grid-column: 1 / -1; }
.referral-editor-field-grid textarea { min-height: 84px; }
.referral-availability { grid-column: 1 / -1; }
.referral-editor-actions { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 8px; }
.referral-code > div { min-width: 0; display: grid; gap: 2px; }
.referral-summary-empty { margin: 10px 0 0; }
.question-library-field { min-width: 0; }
.wellness-question-card { display: grid; gap: 12px; margin: 0; padding: 14px; border: 1px solid var(--ui-border); border-radius: var(--ui-radius); background: var(--ui-surface); }
.wellness-question-card + .wellness-question-card { margin-top: 10px; }
.wellness-question-card legend { padding: 0 6px; color: var(--ui-text); font-size: .78rem; font-weight: 650; }
.wellness-question-choices { display: flex; flex-wrap: wrap; gap: 8px 20px; }
.settings-template-preview { display: grid; gap: 7px; }
.settings-template-preview p { margin: 0; color: var(--ui-text-soft); font-size: .72rem; line-height: 1.45; }
.settings-form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
.settings-form-grid > :where(p, button) { grid-column: 1 / -1; justify-self: start; }
.settings-inline-section--testing { border-color: var(--ui-warning-border); background: var(--ui-warning-soft); }
.settings-operation-note { color: var(--ui-warning) !important; font-weight: 600; }
.staff-dashboard-preview__queue { overflow: hidden; border: 1px solid var(--ui-border); border-radius: var(--ui-radius); background: var(--ui-surface); }
.staff-dashboard-preview__row { min-height: 64px; display: grid; grid-template-columns: auto minmax(125px, 1.1fr) minmax(145px, 1.2fr) auto minmax(110px, .7fr); align-items: center; gap: 10px; padding: 10px 12px; }
.staff-dashboard-preview__avatar { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; background: var(--ui-accent-soft); color: var(--ui-accent); font-size: .67rem; font-weight: 700; }
.staff-dashboard-preview__patient { display: grid; gap: 2px; }
.staff-dashboard-preview__patient strong { font-size: .74rem; }
.staff-dashboard-preview__patient span, .staff-dashboard-preview__email, .staff-dashboard-preview__state { color: var(--ui-muted); font-size: .68rem; }
.staff-dashboard-preview.is-mobile .staff-dashboard-preview__row { grid-template-columns: auto minmax(0, 1fr) auto; }
.staff-dashboard-preview.is-mobile :where(.staff-dashboard-preview__email, .staff-dashboard-preview__state) { display: none; }

/* Clinic workflow, team, and notification editors share one compact settings contract. */
.completion-role-fieldset {
  min-width: 0;
  display: grid;
  gap: 9px;
  margin: 0;
  padding: 13px;
  border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius);
  background: var(--ui-surface-soft);
}
.completion-role-fieldset legend { padding: 0 5px; color: var(--ui-text); font-size: .76rem; font-weight: 650; }
.completion-role-fieldset > .config-help { margin: 0; }
.completion-role-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
.completion-role-option {
  min-height: 58px;
  align-items: flex-start;
  padding: 10px;
  border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius-sm);
  background: var(--ui-surface);
}
.completion-role-option > span { min-width: 0; display: grid; gap: 2px; }
.completion-role-option strong { color: var(--ui-text); font-size: .75rem; font-weight: 650; }
.completion-role-option small { color: var(--ui-muted); font-size: .68rem; font-weight: 450; line-height: 1.4; }
.completion-role-option:has(input:checked) { border-color: var(--ui-accent-border); background: var(--ui-accent-soft); }

.workflow-template-settings > .workflow-template-form,
.notification-settings > .notification-settings-form { max-width: none; }
.workflow-template-form { gap: 13px !important; }
.workflow-template-form > .ui-field:first-child { max-width: 420px; }
.workflow-step-list { display: grid; gap: 9px; }
.workflow-step-card {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(190px, .65fr);
  gap: 9px 12px;
  margin: 0;
  padding: 12px;
  border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius);
  background: var(--ui-surface);
}
.workflow-step-card legend { padding: 0 5px; color: var(--ui-muted); font-size: .66rem; font-weight: 680; letter-spacing: .04em; text-transform: uppercase; }
.workflow-step-toggle { grid-column: 1 / -1; min-height: 26px; }
.workflow-step-card .ui-field { font-size: .73rem; }
.workflow-template-form > p, .workflow-preview { margin: 0; color: var(--ui-muted); font-size: .72rem; line-height: 1.48; }
.workflow-preview:not(:empty) { padding: 10px 12px; border: 1px solid var(--ui-accent-border); border-radius: var(--ui-radius-sm); background: var(--ui-accent-soft); color: var(--ui-text-soft); }
.workflow-history { display: grid; gap: 8px; }
.workflow-history > div { padding: 10px 0; border-top: 1px solid var(--ui-border); }
.workflow-history p { margin: 0 0 7px; color: var(--ui-text-soft); font-size: .72rem; }

.staff-layout { min-width: 0; display: grid; grid-template-columns: minmax(260px, 320px) minmax(0, 1fr); gap: 12px; align-items: start; }
.staff-directory, .staff-detail { min-width: 0; display: grid; gap: 12px; padding: 13px; border: 1px solid var(--ui-border); border-radius: var(--ui-radius); background: var(--ui-surface); }
.staff-panel-header { display: grid; gap: 3px; padding-bottom: 10px; border-bottom: 1px solid var(--ui-border); }
.staff-panel-header h4, .staff-detail-empty h4 { margin: 0; color: var(--ui-text); font-size: .78rem; font-weight: 650; }
.staff-panel-header p, .staff-detail-empty p { margin: 0; color: var(--ui-muted); font-size: .7rem; line-height: 1.45; }
.staff-directory-search { width: 100%; }
.staff-person-list { display: grid; gap: 5px; max-height: 430px; overflow: auto; padding-right: 2px; }
.clinical-surface .staff-person-row {
  width: 100%;
  min-height: 52px;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  align-items: center;
  justify-content: stretch;
  gap: 9px;
  padding: 8px;
  border: 1px solid transparent;
  border-radius: var(--ui-radius-sm);
  background: transparent;
  color: var(--ui-text-soft);
  text-align: left;
}
.clinical-surface .staff-person-row:hover,
.clinical-surface .staff-person-row[aria-pressed="true"] { border-color: var(--ui-accent-border); background: var(--ui-accent-soft); color: var(--ui-accent); }
.staff-person-avatar { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; background: var(--ui-surface-muted); color: var(--ui-text-soft); font-size: .7rem; font-weight: 700; }
.staff-person-row[aria-pressed="true"] .staff-person-avatar { background: var(--ui-surface); color: var(--ui-accent); }
.staff-person-copy { min-width: 0; display: grid; gap: 2px; }
.staff-person-copy strong, .staff-person-copy small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.staff-person-copy strong { color: inherit; font-size: .74rem; font-weight: 650; }
.staff-person-copy small { color: var(--ui-muted); font-size: .65rem; font-weight: 450; }
.staff-detail-empty { min-height: 150px; display: grid; place-content: center; gap: 4px; padding: 18px; text-align: center; }
.staff-detail > form { max-width: none; }
.staff-detail > form > h3 { margin: 0; color: var(--ui-text); font-size: .86rem; }
.staff-detail > form > .meta { margin: -7px 0 0; color: var(--ui-muted); font-size: .7rem; }
.staff-detail fieldset { display: grid; gap: 7px; margin: 0; padding: 11px; border: 1px solid var(--ui-border); border-radius: var(--ui-radius-sm); }
.staff-detail fieldset legend { padding: 0 5px; color: var(--ui-text-soft); font-size: .72rem; font-weight: 650; }
.staff-detail fieldset label:not(.ui-field) { min-height: 30px; }
.staff-role-fieldset { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.staff-role-fieldset legend { grid-column: 1 / -1; }
.staff-role-option {
  min-height: 38px !important;
  padding: 8px 9px;
  border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius-sm);
  background: var(--ui-surface);
  color: var(--ui-text-soft) !important;
  font-size: .72rem !important;
  font-weight: 560 !important;
}
.staff-role-option > input[type="checkbox"], .staff-verification-choice > input[type="checkbox"], .staff-recovery-confirmation > input[type="checkbox"] {
  inline-size: 16px !important;
  width: 16px !important;
  min-width: 16px !important;
  max-width: 16px !important;
  block-size: 16px !important;
  height: 16px !important;
  min-height: 16px !important;
  max-height: 16px !important;
  flex: 0 0 16px !important;
}
.staff-role-option:has(input:checked) { border-color: var(--ui-accent-border); background: var(--ui-accent-soft); color: var(--ui-accent) !important; }
.staff-verification-choice { min-height: 30px !important; color: var(--ui-text-soft) !important; font-size: .72rem !important; }
.staff-recovery-settings > .staff-recovery-form { max-width: none; }
.staff-recovery-explanation { display: grid; gap: 3px; padding: 11px 12px; border: 1px solid var(--ui-accent-border); border-radius: var(--ui-radius-sm); background: var(--ui-accent-soft); }
.staff-recovery-explanation strong { color: var(--ui-text); font-size: .73rem; font-weight: 650; }
.staff-recovery-explanation p, .staff-recovery-status, .staff-recovery-result, .staff-recovery-help { margin: 0; color: var(--ui-muted); font-size: .7rem; line-height: 1.45; }
.staff-recovery-form { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
.staff-recovery-form > .ui-field:has(textarea), .staff-recovery-form > .staff-recovery-status,
.staff-recovery-form > .staff-recovery-confirmation, .staff-recovery-form > .staff-recovery-actions,
.staff-recovery-form > .staff-recovery-result, .staff-recovery-form > .staff-recovery-help { grid-column: 1 / -1; }
.staff-recovery-confirmation { min-height: 30px !important; font-size: .72rem !important; }
.staff-recovery-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.staff-recovery-result:not(:empty) { padding: 9px 11px; border: 1px solid var(--ui-success-border, var(--ui-accent-border)); border-radius: var(--ui-radius-sm); background: var(--ui-success-soft, var(--ui-accent-soft)); color: var(--ui-text-soft); }
.staff-lookup { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 8px; padding: 11px 0 0; border-top: 1px solid var(--ui-border); border-bottom: 0; }
.staff-lookup label { min-width: 0; margin: 0; }

.notification-settings-form { gap: 12px !important; }
.notification-master-choices { display: flex; flex-wrap: wrap; gap: 8px 22px; }
.notification-master-choice { min-height: 30px; }
.notification-routing-tools { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.notification-routing-status { margin: 0; color: var(--ui-muted); font-size: .7rem; line-height: 1.4; }
.notification-routing { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.notification-route-group { min-width: 0; display: grid; align-content: start; gap: 9px; }
.notification-route-group > h4 { margin: 0; color: var(--ui-text); font-size: .78rem; font-weight: 650; }
.notification-route-group > p { margin: -5px 0 0; color: var(--ui-muted); font-size: .69rem; line-height: 1.42; }
.notification-route-list { display: grid; gap: 8px; }
.notification-event-card { min-width: 0; display: grid; gap: 8px; margin: 0; padding: 11px; border: 1px solid var(--ui-border); border-radius: var(--ui-radius-sm); background: var(--ui-surface); }
.notification-event-card legend { max-width: calc(100% - 10px); padding: 0 5px; color: var(--ui-text); font-size: .73rem; font-weight: 650; }
.notification-channel-choices { display: flex; flex-wrap: wrap; gap: 6px 18px; }
.notification-channel-choices .ui-choice { min-height: 28px; font-size: .71rem; }
.notification-recipient-choices { display: grid; gap: 6px; padding-top: 7px; border-top: 1px solid var(--ui-border); }
.notification-recipient-choices p { margin: 0; color: var(--ui-muted); font-size: .67rem; line-height: 1.4; }
.notification-staff-list { display: grid; gap: 4px; max-height: 170px; overflow: auto; }
.notification-staff-list .ui-choice { min-height: 28px; font-size: .69rem; }
.notification-failure-list { display: grid; gap: 8px; }
.notification-failure-list > p { margin: 0; color: var(--ui-text-soft); font-size: .71rem; }
@media (max-width: 760px) {
  .referral-editor-field-grid, .settings-form-grid { grid-template-columns: 1fr !important; }
  .referral-editor-field-grid > .ui-field:nth-child(3), .referral-editor-field-grid > .ui-field:nth-child(4) { grid-column: auto; }
  .referral-code { align-items: flex-start; flex-direction: column; }
  .completion-role-grid, .workflow-step-card, .staff-layout, .notification-routing { grid-template-columns: 1fr; }
  .staff-directory, .staff-detail { padding: 11px; }
  .staff-person-list { max-height: 290px; }
  .staff-role-fieldset, .staff-recovery-form { grid-template-columns: 1fr; }
  .staff-lookup { grid-template-columns: 1fr; }
  .notification-routing-tools { align-items: stretch; flex-direction: column; }
  .notification-routing-tools .ui-button { width: 100%; }
  .followup-workspace { grid-template-columns: 1fr; }
  .provider-message-entry { width: min(92%, 650px); }
  .provider-message-composer-actions { align-items: stretch; flex-direction: column; }
}

/* Final dark-mode surface contract for every intake page other than the
   dashboard. Older page modules include a few literal white backgrounds;
   these rules intentionally resolve those controls through the current
   clinical tokens so the same pages remain cohesive in either theme. */
html.clinical-ui.dark:not([data-theme-surface="dashboard"]) :where(
  .ui-card, .panel, .action-card, .config-card, .config-status, .setup-nav,
  .setup-group > details, .setup-advanced, .assistant-result, .question-row,
  .role-pill, .interface-preview-frame, .portal-auth-card, .account-setup,
  .portal-section, .portal-tabs, .portal-main details, .portal-main details pre,
  .portal-main #program article, .clinical-pdf-dialog, .clinical-order-dialog,
  .clinical-order-dialog-header, .clinical-order-dialog-close, .portal-masthead,
  .staff-directory, .staff-detail, .notification-event-card
) {
  border-color: var(--ui-border);
  background-color: var(--ui-surface);
  color: var(--ui-text);
}

html.clinical-ui.dark:not([data-theme-surface="dashboard"]) :where(
  input:not([type="checkbox"]):not([type="radio"]):not([type="file"]), textarea, select
) {
  border-color: var(--ui-border-strong) !important;
  background-color: var(--ui-surface-soft) !important;
  color: var(--ui-text) !important;
}
html.clinical-ui.dark:not([data-theme-surface="dashboard"]) :where(input, textarea)::placeholder { color: var(--ui-muted); opacity: .82; }
html.clinical-ui.dark:not([data-theme-surface="dashboard"]) :where(
  .btn-secondary, .ui-button--secondary, .ui-button--soft,
  .clinical-surface button:not(.primary):not(.btn-primary):not(.ui-button--primary),
  .clinical-surface .portal-auth-card > .actions button,
  .clinical-surface .account-setup > button
) {
  border-color: var(--ui-border-strong);
  background-color: var(--ui-surface-soft);
  color: var(--ui-text-soft);
}
html.clinical-ui.dark:not([data-theme-surface="dashboard"]) :where(
  .portal-tabs button[aria-selected="true"], .portal-settings-nav button[aria-selected="true"],
  .staff-person-row[aria-pressed="true"], .staff-role-option:has(input:checked)
) {
  border-color: var(--ui-accent-border);
  background-color: var(--ui-accent-soft);
  color: var(--ui-accent);
}
/* Use a deliberately deeper brand fill behind white primary-button text.
   The light accent token is intended for labels and selection tints, not
   as a dark-mode button background. */
html.clinical-ui.dark:not([data-theme-surface="dashboard"]) :where(
  .btn-primary, .ui-button--primary, .clinical-surface button.primary,
  .clinical-surface .ui-button--primary
) {
  border-color: #2a9188;
  background-color: #105c55;
  color: #fff;
}
html.clinical-ui.dark:not([data-theme-surface="dashboard"]) :where(
  .btn-primary:hover, .ui-button--primary:hover, .clinical-surface button.primary:hover,
  .clinical-surface .ui-button--primary:hover
) { border-color: #3fa99f; background-color: #126059; color: #fff; }

/* Portal authentication fields need an explicit final selector. Browser
   autofill can otherwise paint a light native fill over the tokenized field,
   even though the surrounding portal is in dark mode. */
html.clinical-ui.dark[data-theme-surface="patient-portal"] .portal-main :is(.portal-auth-card, .account-setup) input:not([type="checkbox"]):not([type="radio"]):not([type="file"]) {
  border-color: var(--ui-border-strong) !important;
  background: var(--ui-surface-soft) !important;
  color: var(--ui-text) !important;
  caret-color: var(--ui-text);
}
html.clinical-ui.dark[data-theme-surface="patient-portal"] .portal-main :is(.portal-auth-card, .account-setup) input:-webkit-autofill,
html.clinical-ui.dark[data-theme-surface="patient-portal"] .portal-main :is(.portal-auth-card, .account-setup) input:-webkit-autofill:hover,
html.clinical-ui.dark[data-theme-surface="patient-portal"] .portal-main :is(.portal-auth-card, .account-setup) input:-webkit-autofill:focus {
  -webkit-box-shadow: 0 0 0 1000px var(--ui-surface-soft) inset !important;
  -webkit-text-fill-color: var(--ui-text) !important;
  caret-color: var(--ui-text);
}

/* Final dashboard-rail ownership contract. Keep these after legacy-compatible
   declarations so React cannot re-introduce duplicate labeled utilities. */
html[data-theme-surface="dashboard"] .dashboard-navigation-rail .dashboard-rail-control {
  width: 38px;
  height: 38px;
  min-width: 38px;
  min-height: 38px;
  display: grid;
  place-items: center;
  padding: 0;
}
html[data-theme-surface="dashboard"] .dashboard-navigation-rail .dashboard-rail-control > span { display: none; }
html[data-theme-surface="dashboard"] .dashboard-account-trigger { width: 38px; height: 38px; min-width: 38px; min-height: 38px; display: grid; place-items: center; padding: 0; border: 0; }
html[data-theme-surface="dashboard"] .dashboard-account-popover { background: var(--ui-surface); }
html[data-theme-surface="dashboard"] .dashboard-account-menu-grid { display: grid; gap: 2px; padding-top: 5px; }
html[data-theme-surface="dashboard"] .dashboard-account-menu-grid > :is(a, button) { min-height: 40px; display: flex; align-items: center; gap: 9px; padding: 8px 9px; border: 0; border-radius: var(--ui-radius-sm); background: transparent; color: var(--ui-text-soft); font: inherit; font-size: .72rem; font-weight: 650; line-height: 1.25; text-align: left; text-decoration: none; }
html[data-theme-surface="dashboard"] .dashboard-account-menu-grid > :is(a, button):hover { background: var(--ui-accent-soft); color: var(--ui-accent); }
html[data-theme-surface="dashboard"] .dashboard-account-menu-grid > .is-danger { color: var(--ui-danger); }
html[data-theme-surface="dashboard"] .dashboard-account-menu-grid .ay-nav-icon { width: 18px; height: 18px; flex: 0 0 18px; }
html[data-theme-surface="dashboard"] :is(.tab-count-badge, .menu-alert-badge, .dashboard-mobile-action b) {
  box-sizing: border-box;
  width: 18px;
  min-width: 18px;
  height: 18px;
  padding: 0;
  border-radius: 50%;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
html[data-theme-surface="dashboard"] .dashboard-mobile-action b { width: 17px; min-width: 17px; height: 17px; }
html[data-theme-surface="dashboard"] .dashboard-settings-trigger { display: none !important; }
html[data-theme-surface="dashboard"] .dashboard-account-wrap--mobile { display: none; }

/* Dashboard queue states stay inside the data surface so filters, search,
   navigation, and open chart framing never jump during a bounded refresh. */
html[data-theme-surface="dashboard"] .dashboard-loading-state {
  width: 100%; min-height: 50vh; display: grid; place-items: center;
}
/* Inside an open chart, .dashboard-loading-state is reused for per-tab
   section loading, not the full patient queue this 50vh sizing was tuned
   for. .ay-chart-body already has a definite grid-row height, so fill and
   center within that instead of a viewport-relative height that can render
   below the visible pane or off-center within it. */
html[data-theme-surface="dashboard"] .ay-chart-body > .dashboard-loading-state {
  min-height: 0; height: 100%;
}
html[data-theme-surface="dashboard"] .dashboard-modern-spinner {
  width: 38px; height: 38px; display: block; border: 3px solid var(--ui-accent-soft);
  border-top-color: var(--ui-accent); border-radius: 50%; animation: dashboard-spinner 720ms linear infinite;
}
@keyframes dashboard-spinner { to { transform: rotate(360deg); } }
html[data-theme-surface="dashboard"] .workspace-list-wrap.is-refreshing > :not(.workspace-list-refresh) { opacity: .58; }
html[data-theme-surface="dashboard"] .workspace-list-wrap.is-refreshing > :not(.workspace-list-refresh) { transition: opacity 140ms ease; }
html[data-theme-surface="dashboard"] .workspace-list-refresh {
  position: absolute; inset: 0; z-index: 8; display: grid; place-items: center;
  background: color-mix(in srgb, var(--ui-surface) 72%, transparent); pointer-events: none;
}
html[data-theme-surface="dashboard"] .workspace-empty-state {
  min-height: 210px; display: grid; place-content: center; justify-items: center; gap: 6px;
  padding: 28px; color: var(--ui-muted); text-align: center;
}
html[data-theme-surface="dashboard"] .workspace-empty-state svg {
  width: 42px; height: 42px; margin-bottom: 3px; fill: none; stroke: currentColor;
  stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; opacity: .72;
}
html[data-theme-surface="dashboard"] .workspace-empty-state strong { color: var(--ui-text-soft); font-size: .82rem; }
html[data-theme-surface="dashboard"] .workspace-empty-state span { max-width: 28rem; font-size: .7rem; line-height: 1.45; }
html[data-theme-surface="dashboard"] .workspace-sidebar[data-list-mode="wellness"] .workspace-list-wrap { border-radius: var(--ui-radius); background: var(--ui-canvas); }
html[data-theme-surface="dashboard"] .workspace-sidebar[data-list-mode="wellness"] .workspace-list { display: flex; flex-direction: column; gap: 10px; height: 100%; min-height: 0; padding: 10px; background: var(--ui-canvas); }
html[data-theme-surface="dashboard"] .wellness-queue-group-body > ul { min-height: inherit; margin: 0; padding: 0; list-style: none; }

html[data-theme-surface="dashboard"] .dashboard-account-dialog-backdrop {
  position: fixed; inset: 0; z-index: 140; display: grid; place-items: center; padding: 18px;
  background: rgba(24,34,39,.5);
}
html[data-theme-surface="dashboard"] .dashboard-account-dialog {
  width: min(100%, 560px); max-height: min(760px, calc(100dvh - 36px)); overflow: auto;
  padding: 20px; border: 1px solid var(--ui-border); border-radius: var(--ui-radius-lg);
  background: var(--ui-surface); color: var(--ui-text); box-shadow: var(--ui-shadow-dialog);
}
html[data-theme-surface="dashboard"] .dashboard-account-dialog > header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
html[data-theme-surface="dashboard"] .dashboard-account-dialog h2 { margin: 2px 0 0; font-size: 1.05rem; }
html[data-theme-surface="dashboard"] .dashboard-account-dialog-close { width: 36px; height: 36px; display: grid; place-items: center; padding: 0; border: 1px solid var(--ui-border); border-radius: 50%; background: var(--ui-surface); color: var(--ui-text); font: inherit; font-size: 1.2rem; }
html[data-theme-surface="dashboard"] .dashboard-account-dialog form { display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: end; gap: 8px; padding-bottom: 18px; border-bottom: 1px solid var(--ui-border); }
html[data-theme-surface="dashboard"] .dashboard-account-dialog form label { grid-column: 1 / -1; color: var(--ui-text-soft); font-size: .72rem; font-weight: 650; }
html[data-theme-surface="dashboard"] .dashboard-account-status { display: grid; gap: 0; margin: 8px 0 16px; }
html[data-theme-surface="dashboard"] .dashboard-account-status > div { display: grid; grid-template-columns: 9rem minmax(0,1fr); gap: 14px; padding: 10px 0; border-bottom: 1px solid var(--ui-border); }
html[data-theme-surface="dashboard"] .dashboard-account-status dt { color: var(--ui-muted); font-size: .69rem; }
html[data-theme-surface="dashboard"] .dashboard-account-status dd { margin: 0; color: var(--ui-text); font-size: .72rem; overflow-wrap: anywhere; }
html[data-theme-surface="dashboard"] .dashboard-status-dot { margin-left: 6px; color: var(--ui-muted); font-size: .64rem; }
html[data-theme-surface="dashboard"] .dashboard-status-dot.is-good { color: var(--ui-success, var(--ui-accent)); }
html[data-theme-surface="dashboard"] .dashboard-account-security-actions { display: flex; flex-wrap: wrap; gap: 6px; }
html[data-theme-surface="dashboard"] .dashboard-account-security-actions .ay-button { min-height: 30px; padding: 6px 11px; border-radius: 8px; font-size: .68rem; white-space: nowrap; }
html[data-theme-surface="dashboard"] .dashboard-account-dialog form .ay-button { min-height: 38px; padding: 8px 14px; font-size: .72rem; white-space: nowrap; }
html[data-theme-surface="dashboard"] .dashboard-passkey-list { display: grid; gap: 6px; margin: 0; padding: 0; list-style: none; }
html[data-theme-surface="dashboard"] .dashboard-passkey-list li { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; }
html[data-theme-surface="dashboard"] .dashboard-passkey-list .dashboard-status-dot { margin-left: 0; }
html[data-theme-surface="dashboard"] .dashboard-inline-action { margin-left: auto; padding: 0; border: 0; background: transparent; color: var(--ui-accent); font: inherit; font-size: .69rem; font-weight: 650; cursor: pointer; }
html[data-theme-surface="dashboard"] .dashboard-inline-action:hover { text-decoration: underline; }
html[data-theme-surface="dashboard"] .dashboard-inline-action--start { display: block; margin: 6px 0 0; }
html[data-theme-surface="dashboard"] .dashboard-inline-action:disabled { opacity: .55; cursor: default; }
html[data-theme-surface="dashboard"] .dashboard-account-hint { margin: 6px 0 0; color: var(--ui-muted); font-size: .64rem; line-height: 1.45; }

@media (max-width:899px) {
  html[data-theme-surface="dashboard"] .ay-dashboard-rail.dashboard-navigation-rail > .dashboard-rail-control-wrap { display: none; }
  html[data-theme-surface="dashboard"] .ay-dashboard-rail.dashboard-navigation-rail > .dashboard-account-wrap { display: none; }
  html[data-theme-surface="dashboard"] .dashboard-account-wrap--mobile { position: relative; inset: auto; z-index: 90; display: block; }
  html[data-theme-surface="dashboard"] body:has(.workspace-detail.has-selection) .dashboard-account-wrap--mobile { display: block; }
  html[data-theme-surface="dashboard"] .dashboard-account-wrap--mobile .dashboard-account-popover { position: absolute; top: calc(100% + 9px); right: 0; bottom: auto; left: auto; width: min(235px, calc(100vw - 24px)); }
  html[data-theme-surface="dashboard"] .dashboard-account-dialog { padding: 17px; }
  html[data-theme-surface="dashboard"] .dashboard-account-dialog form { grid-template-columns: 1fr; }
  html[data-theme-surface="dashboard"] .dashboard-account-status > div { grid-template-columns: 1fr; gap: 3px; }
}

@media (prefers-reduced-motion: reduce) {
  html[data-theme-surface="dashboard"] .dashboard-modern-spinner { animation-duration: 1.8s; }
}

/* Review popup: the single step between "done editing" and "live". Enter is a short fade + rise; exit is quicker
   (the choice is already made). Only opacity and transform animate. */
.ay-review-backdrop { position:fixed; inset:0; z-index:350; display:grid; place-items:center; padding:18px; background:var(--ui-overlay); animation:ay-review-fade 160ms var(--ui-ease-out) both; }
.ay-review-backdrop.is-leaving { animation:ay-review-fade-out 120ms ease-in both; pointer-events:none; }
.ay-review-dialog { width:min(100%,440px); max-height:min(640px,calc(100dvh - 36px)); overflow:auto; padding:24px 22px 20px; border:1px solid var(--ui-border-strong); border-radius:var(--ui-radius); background:var(--ui-surface); box-shadow:var(--ui-shadow-popover); animation:ay-review-rise 200ms var(--ui-ease-out) both; outline:none; }
.ay-review-backdrop.is-leaving .ay-review-dialog { animation:ay-review-sink 120ms ease-in both; }
.ay-review-dialog__body { display:grid; gap:10px; justify-items:stretch; animation:ay-review-fade 160ms var(--ui-ease-out) both; }
.ay-review-dialog__icon { width:44px; height:44px; margin:0 auto 2px; display:grid; place-items:center; }
.ay-review-dialog__icon svg { width:36px; height:36px; fill:none; stroke:currentColor; stroke-width:1.75; stroke-linecap:round; stroke-linejoin:round; }
.ay-review-dialog.is-ready .ay-review-dialog__icon { color:var(--ui-success); }
.ay-review-dialog.is-problem .ay-review-dialog__icon { color:var(--ui-danger); }
.ay-review-dialog__icon .dashboard-modern-spinner { width:32px; height:32px; }
.ay-review-dialog h2 { margin:0; color:var(--ui-text); font-size:1.05rem; line-height:1.3; text-align:center; text-wrap:balance; }
.ay-review-dialog p { margin:0; color:var(--ui-muted); font-size:.8rem; line-height:1.5; text-align:center; }
.ay-review-problems, .ay-review-updates { margin:4px 0 0; padding:0; list-style:none; display:grid; text-align:left; }
.ay-review-problems li, .ay-review-updates li { padding:10px 2px; border-top:1px solid var(--ui-border); color:var(--ui-text); font-size:.8rem; line-height:1.45; }
.ay-review-problems li:last-child, .ay-review-updates li:last-child { border-bottom:1px solid var(--ui-border); }
.ay-review-problems li { display:grid; gap:2px; }
.ay-review-problems small { color:var(--ui-muted); font-size:.78rem; font-weight:700; }
.ay-review-updates li { display:flex; align-items:center; gap:10px; font-weight:650; }
.ay-review-updates svg { width:18px; height:18px; flex:none; fill:none; stroke:var(--ui-success); stroke-width:2; stroke-linecap:round; stroke-linejoin:round; }
.ay-review-dialog .ay-review-note { display:grid; gap:2px; padding:10px 12px; border-radius:var(--ui-radius-sm); background:var(--ui-canvas); color:var(--ui-text); text-align:left; }
.ay-review-note small { color:var(--ui-muted); font-size:.78rem; font-weight:700; }
.ay-review-dialog__actions { margin-top:8px; display:flex; flex-direction:row-reverse; justify-content:flex-start; gap:8px; }
.ay-review-dialog__actions .ay-button { min-height:40px; padding-inline:18px; }
@media (max-width:520px) {
  .ay-review-backdrop { align-items:end; padding:0; }
  .ay-review-dialog { width:100%; max-height:calc(100dvh - 24px); border-radius:var(--ui-radius) var(--ui-radius) 0 0; padding-bottom:max(20px,env(safe-area-inset-bottom)); }
  .ay-review-dialog__actions { flex-direction:column; }
  .ay-review-dialog__actions .ay-button { width:100%; }
}
/* Result of a publish, shown at the top of Finalize. */
.ay-flow-banner { display:flex; align-items:flex-start; gap:10px; margin:0 0 14px; padding:12px 14px; border:1px solid; border-radius:var(--ui-radius-sm); font-size:.8rem; font-weight:650; line-height:1.45; animation:ay-review-fade 200ms var(--ui-ease-out) both; }
.ay-flow-banner svg { width:20px; height:20px; flex:none; fill:none; stroke:currentColor; stroke-width:1.9; stroke-linecap:round; stroke-linejoin:round; }
.ay-flow-banner span { color:var(--ui-text); }
.ay-flow-banner.is-success { border-color:color-mix(in srgb, var(--ui-success) 45%, transparent); background:var(--ui-success-soft); color:var(--ui-success); }
.ay-flow-banner.is-error { border-color:var(--ui-danger-border); background:var(--ui-danger-soft); color:var(--ui-danger); }
@keyframes ay-review-fade { from { opacity:0; } to { opacity:1; } }
@keyframes ay-review-fade-out { from { opacity:1; } to { opacity:0; } }
@keyframes ay-review-rise { from { opacity:0; transform:translateY(10px) scale(.98); } to { opacity:1; transform:none; } }
@keyframes ay-review-sink { from { opacity:1; transform:none; } to { opacity:0; transform:translateY(6px) scale(.985); } }
@media (prefers-reduced-motion: reduce) {
  .ay-review-dialog, .ay-review-backdrop.is-leaving .ay-review-dialog { animation:none; }
  .ay-review-dialog__body, .ay-flow-banner { animation-duration:1ms; }
  .ay-review-backdrop, .ay-review-backdrop.is-leaving { animation-duration:1ms; }
}
/* `.clinical-surface button` (0,1,1) outranks `.ay-button--primary` (0,1,0), which left the settings page's main action
   (Review / Publish / Apply) looking like a secondary button. Restore the filled primary style on this page. */
html[data-theme-surface="clinic-configuration"] .clinical-surface .ay-button--primary:not(:disabled),
html[data-theme-surface="clinic-configuration"] .ay-review-dialog .ay-button--primary:not(:disabled) { border-color:var(--ui-accent-fill); background:var(--ui-accent-fill); color:var(--ui-on-accent); }
html[data-theme-surface="clinic-configuration"] .clinical-surface .ay-button--primary:not(:disabled):hover,
html[data-theme-surface="clinic-configuration"] .ay-review-dialog .ay-button--primary:not(:disabled):hover { border-color:var(--ui-accent-fill-hover); background:var(--ui-accent-fill-hover); color:var(--ui-on-accent); }

/* Exits (Phase 6): quicker than the enter, opacity/transform only. They are skipped under reduced motion in the hook. */
.ay-settings-assistant.is-leaving { animation:ay-assistant-out 120ms ease-in both; pointer-events:none; }
.ay-settings-dialog-backdrop.is-leaving { animation:ay-review-fade-out 120ms ease-in both; pointer-events:none; }
.ay-settings-dialog-backdrop.is-leaving .ay-settings-dialog { animation:ay-review-sink 120ms ease-in both; }
.ay-settings-loading.is-leaving { animation:config-loading-out 120ms ease-in both; pointer-events:none; }
@keyframes ay-assistant-out { from { opacity:1; transform:none; } to { opacity:0; transform:translateY(8px); } }
@keyframes config-loading-out { from { opacity:1; } to { opacity:0; } }
/* Problem lists and status messages fade in (opacity only, so nothing shifts). */
.ay-settings-editor .ay-note-status:not(.sr-only) { animation:ay-review-fade 180ms var(--ui-ease-out) both; }
@media (prefers-reduced-motion: reduce) { .ay-settings-editor .ay-note-status:not(.sr-only), .ay-settings-assistant.is-leaving, .ay-settings-loading.is-leaving { animation-duration:1ms; } }
/* 12px text floor on the settings page: earlier per-breakpoint rules set the footer buttons, small labels and status text below it. */
.ay-settings-footer:not(.setup-footer) .ay-settings-footer__actions .ay-button { font-size:max(.74rem,12px); }
.ay-settings-editor .ay-status-pill, .ay-settings-editor small, .ay-settings-advanced small { font-size:max(.72rem,12px); }
.ay-settings-editor .ay-note-status--error li small { font-size:max(.72rem,12px); }
.ay-settings-editor .ay-note-status { font-size:max(.74rem,12px); }

/* ===== Review screen (chat design pass, C4) =====
   No kicker and no header card; one grouped list with hairline dividers; a quiet 44px Edit; Continue stays reachable. */
.ay-intake-review .ay-intake-review__header { padding: 4px 2px 10px; border: 0; border-radius: 0; background: transparent; box-shadow: none; }
.ay-intake-review .ay-intake-review__header h1 { margin: 0; }
.ay-intake-review__list { margin: 0; padding: 0; list-style: none; display: block; gap: 0; border: 1px solid var(--ui-border); border-radius: var(--ui-radius); background: var(--ui-surface); overflow: hidden; }
.ay-intake-review__list > .ay-intake-review__item { border: 0; border-top: 1px solid var(--ui-border); border-radius: 0; background: transparent; box-shadow: none; padding: 10px 6px 10px 16px; min-height: 56px; }
.ay-intake-review__list > .ay-intake-review__item:first-child { border-top: 0; }
.ay-intake-review__edit { min-width: 44px; min-height: 44px; padding: 0 12px; font-weight: 700; }
html[data-theme-surface="patient-chat"] .ay-intake-review .ay-intake-review__list .ay-intake-review__edit { border-color: transparent; background: transparent; color: var(--ui-accent); }
.ay-intake-review__status { font-size: max(.72rem, 12px); }
.ay-intake-review .ay-intake-step-actions { display: flex; position: sticky; bottom: 0; z-index: 2; margin-top: 6px; padding: 12px 0 max(12px, env(safe-area-inset-bottom)); background: var(--ui-canvas); }
.ay-intake-review .ay-intake-step-actions .ay-button { flex: 1 1 100%; width: 100%; min-height: 48px; }
/* Short labels above headings read as decoration; keep the information, drop the shouting. */
.ay-intake-gate__label { font-size: max(.72rem, 12px); letter-spacing: 0; text-transform: none; }

/* Consent step: one sentence naming the documents the person agrees to by sending. */
.ay-intake-consent__notice { margin: 0; color: var(--ui-text-soft); font-size: max(.78rem, 12px); line-height: 1.6; }
.ay-intake-consent__notice a { color: var(--ui-accent); font-weight: 700; text-decoration: underline; text-underline-offset: 2px; }

/* The summary and the consent note are cards inside the conversation (chat finishing step). */
.ay-intake-module { display: grid; gap: 10px; width: 100%; min-width: 0; }
.ay-intake-module.ay-intake-review .ay-intake-gate { padding: 14px 16px; gap: 6px; }
.ay-intake-module.ay-intake-review .ay-intake-gate h2 { margin: 0; font-size: .95rem; }
.ay-intake-module.ay-intake-review .ay-intake-gate p { margin: 0; }
.ay-intake-module--note { display: grid; gap: 8px; }
.ay-intake-module--note p { margin: 0; }

/* ===== Ordered intake questions with conditions (Settings, step 3) ===== */
.ay-intake-questions { display: grid; gap: 12px; }
.ay-intake-questions__intro { margin: 0; color: var(--ui-text-soft); font-size: max(.76rem, 12px); line-height: 1.55; }
ol.ay-question-list { margin: 0; padding: 0; list-style: none; }
.ay-question-list--ordered .ay-question-row { display: grid; gap: 2px; padding: 8px 10px 8px 12px; cursor: grab; transition: background-color 140ms ease-out, box-shadow 140ms ease-out, opacity 140ms ease-out; }
.ay-question-list--ordered .ay-question-row:active { cursor: grabbing; }
.ay-question-list--ordered .ay-question-row.is-dragging { opacity: .62; }
.ay-question-list--ordered .ay-question-row.is-drag-over { box-shadow: inset 0 2px 0 var(--ui-accent); }
.ay-question-list--ordered .ay-question-row.is-moving { animation: ay-question-row-moved 180ms cubic-bezier(.16, 1, .3, 1); }
@keyframes ay-question-row-moved { from { opacity: .78; transform: translateY(3px); } to { opacity: 1; transform: translateY(0); } }
.ay-question-row__position { flex: none; width: 24px; color: var(--ui-muted); font-size: max(.72rem, 12px); font-variant-numeric: tabular-nums; font-weight: 700; text-align: right; }
.ay-question-list--ordered .ay-question-row__head { justify-content: flex-start; gap: 8px; }
.ay-question-list--ordered .ay-question-row__head .ay-switch-row { flex: 1 1 auto; min-width: 0; }
.ay-question-row__managed { flex: 1 1 auto; min-width: 0; display: grid; gap: 1px; }
.ay-question-row__managed-label { color: var(--ui-accent); font-size: max(.7rem, 12px); font-weight: 700; letter-spacing: .01em; }
.ay-question-row__managed strong { overflow: hidden; color: var(--ui-text); font-size: max(.78rem, 12px); line-height: 1.35; text-overflow: ellipsis; white-space: nowrap; }
.ay-question-row__managed small, .ay-question-row__managed-copy { color: var(--ui-muted); font-size: max(.72rem, 12px); line-height: 1.45; }
.ay-question-row__managed-copy { margin: 0; }
.ay-question-row__moves { flex: none; display: inline-flex; gap: 2px; }
.ay-icon-button { width: 34px; height: 34px; min-height: 34px; padding: 0; display: grid; place-items: center; border: 1px solid transparent; border-radius: var(--ui-radius-sm); background: transparent; color: var(--ui-text-soft); cursor: pointer; }
.ay-icon-button svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.ay-icon-button:disabled { opacity: .35; cursor: not-allowed; background: transparent; border-color: transparent; }
@media (hover: hover) and (pointer: fine) { .ay-icon-button:not(:disabled):hover { background: var(--ui-accent-soft); color: var(--ui-accent); } }
.ay-question-list--ordered .ay-question-row__preview { margin: 0 0 4px 32px; white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.ay-question-row__condition { display: block; margin-top: 2px; color: var(--ui-accent); font-weight: 650; }
.ay-question-list--ordered .ay-question-row__body { margin: 6px 0 8px 32px; display: grid; gap: 12px; }
.ay-question-marker { margin: 2px 0 0 32px; padding: 6px 10px; border-radius: var(--ui-radius-sm); background: var(--ui-accent-soft); color: var(--ui-accent); font-size: max(.72rem, 12px); line-height: 1.45; }
.ay-condition { margin: 0; padding: 12px 14px; display: grid; gap: 10px; border: 1px solid var(--ui-border); border-radius: var(--ui-radius-sm); background: var(--ui-surface-muted); min-width: 0; }
.ay-condition legend { padding: 0 6px; display: inline-flex; align-items: center; gap: 4px; color: var(--ui-text); font-size: max(.74rem, 12px); font-weight: 750; }
.ay-condition__hint { margin: 0; color: var(--ui-muted); font-size: max(.74rem, 12px); }
.ay-condition__row { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) minmax(0, 2fr); gap: 10px; }
@media (max-width: 720px) { .ay-condition__row { grid-template-columns: minmax(0, 1fr); } .ay-question-list--ordered .ay-question-row__body, .ay-question-list--ordered .ay-question-row__preview, .ay-question-marker { margin-left: 0; } }
/* `.clinical-surface button` padding and height win over the plain class, which squeezed the arrow icons to a sliver. */
html[data-theme-surface="clinic-configuration"] .ay-question-row__moves .ay-icon-button { width: 34px; min-width: 34px; height: 34px; min-height: 34px; padding: 0; }
html[data-theme-surface="clinic-configuration"] .ay-question-row__moves .ay-icon-button:not(:disabled) { color: var(--ui-text-soft); background: transparent; border-color: transparent; }
html[data-theme-surface="clinic-configuration"] .ay-question-row__moves .ay-icon-button:disabled { background: transparent; border-color: transparent; color: var(--ui-muted); }
/* Phones: the switch and its name take the first line; the arrows and Edit sit on the line below, so nothing runs off the edge. */
.ay-question-list--ordered .ay-question-row, .ay-question-list--ordered .ay-question-row > * { min-width: 0; }
@media (max-width: 720px) {
  .ay-question-list--ordered .ay-question-row__head { flex-wrap: wrap; row-gap: 2px; }
  .ay-question-list--ordered .ay-question-row__head .ay-switch-row { flex: 1 1 calc(100% - 40px); }
  .ay-question-list--ordered .ay-question-row__managed { flex-basis: calc(100% - 40px); }
  .ay-question-list--ordered .ay-question-row__moves { margin-left: 32px; }
  .ay-question-list--ordered .ay-question-row__toggle { margin-left: auto; }
}
@media (prefers-reduced-motion: reduce) {
  .ay-question-list--ordered .ay-question-row { transition-duration: 0ms; }
  .ay-question-list--ordered .ay-question-row.is-moving { animation: none; }
}

/* ===== Wellness question tree (Settings, step 3) ===== */
.ay-wellness-questions { display: grid; gap: 14px; margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--ui-border); }
.ay-wellness-questions--disabled { padding: 16px; border: 1px dashed var(--ui-border); border-radius: var(--ui-radius); background: var(--ui-surface-muted); filter: grayscale(.72); opacity: .72; }
.ay-wellness-questions--disabled .ay-clinical-card__header { padding: 0; border: 0; background: transparent; }
.ay-wellness-disabled-state { display: flex; align-items: center; gap: 8px; margin-top: 4px; color: var(--ui-muted); font-size: max(.76rem, 12px); }
.ay-wellness-disabled-state svg { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; }
.ay-wellness-questions > .ay-clinical-card__header { padding: 0; border: 0; background: transparent; }
.ay-wellness-questions > .ay-clinical-card__header h3 { margin: 0; }
.ay-wellness-questions > .ay-clinical-card__header p, .ay-wellness-branch__header p, .ay-wellness-pathways-heading p { margin: 3px 0 0; color: var(--ui-muted); font-size: max(.76rem, 12px); line-height: 1.5; }
.ay-wellness-branch { display: grid; gap: 8px; padding: 12px; border: 1px solid var(--ui-border); border-radius: var(--ui-radius-sm); background: var(--ui-surface); }
.ay-wellness-branch.has-error { border-color: var(--ui-danger-border); background: color-mix(in srgb, var(--ui-danger-soft) 28%, var(--ui-surface)); }
.ay-wellness-branch__header, .ay-wellness-pathways-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.ay-wellness-branch__header h3, .ay-wellness-pathways-heading h3 { margin: 0; color: var(--ui-text); font-size: max(.86rem, 13px); }
.ay-wellness-branch__actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.ay-wellness-questions .ay-button { display: inline-flex; align-items: center; gap: 7px; }
.ay-wellness-questions .ay-button svg { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.ay-wellness-branch__actions .ay-switch-row { flex: none; }
.ay-wellness-pathways-heading { align-items: center; padding-top: 6px; }
.ay-wellness-tree-list { border: 1px solid var(--ui-border); border-radius: var(--ui-radius-sm); background: var(--ui-surface-muted); overflow: hidden; }
.ay-wellness-tree-list .ay-question-row.has-error { background: color-mix(in srgb, var(--ui-danger-soft) 44%, var(--ui-surface)); }
.ay-question-row__error { margin: 6px 0 8px 32px; }
.ay-wellness-tree-list:empty { min-height: 44px; }
.ay-wellness-tree-list + .ay-button { justify-self: start; }
.ay-wellness-question-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.ay-wellness-move-label { display: inline-flex; align-items: center; gap: 8px; color: var(--ui-text-soft); font-size: max(.74rem, 12px); }
.ay-wellness-move-label .ui-input { min-width: 180px; }
.ay-wellness-condition { margin: 0; padding: 12px 14px; display: grid; gap: 10px; border: 1px solid var(--ui-border); border-radius: var(--ui-radius-sm); background: var(--ui-surface-muted); min-width: 0; }
.ay-wellness-condition legend { padding: 0 6px; color: var(--ui-text); font-size: max(.74rem, 12px); font-weight: 750; }
.ay-wellness-condition .ay-condition__row { align-items: end; }
@media (max-width: 720px) { .ay-wellness-branch__header, .ay-wellness-pathways-heading { align-items: stretch; flex-direction: column; } .ay-wellness-branch__actions { justify-content: flex-start; } .ay-wellness-question-actions { align-items: stretch; flex-direction: column; } .ay-wellness-move-label .ui-input { min-width: 0; flex: 1; } }
@media (prefers-reduced-motion: reduce) { .ay-wellness-questions *, .ay-wellness-questions *::before, .ay-wellness-questions *::after { transition-duration: 0ms !important; animation-duration: 1ms !important; } }
.ay-wellness-branch__title { display:flex; align-items:flex-start; gap:10px; min-width:0; }
.ay-wellness-branch__toggle { display:flex; align-items:flex-start; gap:8px; min-width:0; padding:2px; border:0; background:transparent; color:var(--ui-text); text-align:left; cursor:pointer; font:inherit; }
.ay-wellness-branch__toggle > svg { flex:none; margin-top:2px; transition:transform 160ms ease-out; }
.ay-wellness-branch__toggle.is-expanded > svg { transform:rotate(90deg); }
.ay-wellness-branch__toggle span { display:grid; gap:3px; min-width:0; }
.ay-wellness-branch__toggle strong { font-size:max(.86rem,13px); }
.ay-wellness-branch__toggle small { color:var(--ui-muted); font-size:max(.74rem,12px); line-height:1.45; }
.ay-wellness-track-status { flex:none; padding:3px 8px; border:1px solid var(--ui-border); border-radius:999px; color:var(--ui-muted); font-size:max(.68rem,11px); font-weight:700; }
.ay-wellness-track-status--active { border-color:color-mix(in srgb,var(--ui-accent) 35%,var(--ui-border)); color:var(--ui-accent); background:var(--ui-accent-soft); }
.ay-wellness-track-status--retired { color:var(--ui-danger); background:var(--ui-danger-soft); }
.ay-wellness-track-name { max-width:420px; }
.ay-wellness-empty { display:grid; justify-items:start; gap:3px; padding:14px; border:1px dashed var(--ui-border-strong); border-radius:var(--ui-radius-sm); color:var(--ui-muted); background:var(--ui-surface-muted); }
.ay-wellness-empty svg { width:18px; height:18px; color:var(--ui-accent); }
.ay-wellness-empty p { margin:0; color:var(--ui-text); font-weight:700; }
.ay-wellness-empty span { font-size:max(.74rem,12px); }
@media (max-width:720px) { .ay-wellness-branch__title { align-items:stretch; flex-direction:column; } .ay-wellness-track-status { align-self:flex-start; } .ay-wellness-track-name { max-width:none; } }

/* Wellness question hierarchy: the two shared lists stay visible, while the
   Track grid selects one focused set of settings and questions below. */
.ay-wellness-questions { gap: 26px; }
.ay-wellness-section,
.ay-wellness-tracks { display: grid; gap: 12px; min-width: 0; }
.ay-wellness-section + .ay-wellness-section,
.ay-wellness-section + .ay-wellness-tracks,
.ay-wellness-tracks + .ay-wellness-track-detail { padding-top: 24px; border-top: 1px solid var(--ui-border); }
.ay-wellness-section__header { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.ay-wellness-section__header h3 { margin: 0; color: var(--ui-text); font-size: max(.9rem, 14px); line-height: 1.3; }
.ay-wellness-section__header p { max-width: 72ch; margin: 4px 0 0; color: var(--ui-muted); font-size: max(.76rem, 12px); line-height: 1.5; }
.ay-wellness-section.has-error > .ay-wellness-section__header h3 { color: var(--ui-danger); }
.ay-wellness-section .ay-wellness-tree-list:empty { display: none; }
.ay-wellness-track-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
html[data-theme-surface="clinic-configuration"] .ay-wellness-track-tile {
  min-height: 78px;
  display: grid;
  align-content: center;
  justify-items: start;
  gap: 5px;
  padding: 14px 16px;
  border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius-sm);
  background: var(--ui-surface);
  color: var(--ui-text);
  text-align: left;
  cursor: pointer;
  box-shadow: none;
  transition: border-color var(--ui-duration-fast) ease, background-color var(--ui-duration-fast) ease, color var(--ui-duration-fast) ease, transform var(--ui-duration-fast) var(--ui-ease-out);
}
html[data-theme-surface="clinic-configuration"] .ay-wellness-track-tile:not(.ay-wellness-track-tile--add) > strong,
html[data-theme-surface="clinic-configuration"] .ay-wellness-track-tile:not(.ay-wellness-track-tile--add) > span {
  width: 100%;
  justify-self: stretch;
  text-align: left;
}
/* Track selectors are buttons, so the shared `.clinical-surface button` flex
   contract can center their content if the runtime surface attribute changes
   during React startup. Make the Track-card layout self-contained: the copy
   column spans the card and stays left aligned in every theme and state. */
button.ay-wellness-track-tile:not(.ay-wellness-track-tile--add) {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: center;
  text-align: left;
}
button.ay-wellness-track-tile:not(.ay-wellness-track-tile--add) > strong,
button.ay-wellness-track-tile:not(.ay-wellness-track-tile--add) > span {
  display: block;
  width: 100%;
  align-self: stretch;
  text-align: left;
}
html[data-theme-surface="clinic-configuration"] .ay-wellness-track-tile:hover { border-color: var(--ui-border-strong); background: var(--ui-surface-muted); }
html[data-theme-surface="clinic-configuration"] .ay-wellness-track-tile:active { transform: translateY(1px); }
html[data-theme-surface="clinic-configuration"] .ay-wellness-track-tile:focus-visible { outline: 0; box-shadow: var(--ui-focus); }
html[data-theme-surface="clinic-configuration"] .ay-wellness-track-tile.is-selected { border-color: var(--ui-accent-border); background: var(--ui-accent-soft); color: var(--ui-accent); }
html[data-theme-surface="clinic-configuration"] .ay-wellness-track-tile.is-retired:not(.is-selected) { background: var(--ui-surface-muted); color: var(--ui-muted); }
.ay-wellness-track-tile > strong,
.ay-wellness-track-tile--add strong { font-size: max(.8rem, 13px); font-weight: 750; line-height: 1.3; }
.ay-wellness-track-tile > span { color: var(--ui-muted); font-size: max(.72rem, 12px); line-height: 1.35; }
.ay-wellness-track-tile.is-selected > span { color: var(--ui-accent); }
html[data-theme-surface="clinic-configuration"] .ay-wellness-track-tile--add { grid-template-columns: 28px minmax(0, 1fr); align-items: center; align-content: center; border-style: dashed; color: var(--ui-accent); }
.ay-wellness-track-tile--add > svg { width: 22px; height: 22px; grid-row: 1; fill: none; stroke: currentColor; stroke-width: 1.8; }
.ay-wellness-track-tile--add > span { display: grid; gap: 3px; }
.ay-wellness-track-tile--add small { color: var(--ui-muted); font-size: max(.7rem, 11px); font-weight: 500; line-height: 1.35; }
.ay-wellness-track-detail { gap: 12px; }
.ay-wellness-track-settings { display: grid; gap: 14px; padding: 14px; border: 1px solid var(--ui-border); border-radius: var(--ui-radius-sm); background: var(--ui-surface-muted); }
.ay-wellness-track-settings__heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.ay-wellness-track-settings__heading h4 { margin: 0; color: var(--ui-text); font-size: max(.8rem, 13px); }
.ay-wellness-track-settings__heading p { margin: 3px 0 0; color: var(--ui-muted); font-size: max(.72rem, 12px); line-height: 1.45; }
.ay-wellness-track-settings .ay-wellness-track-name { width: min(100%, 520px); max-width: none; }
.ay-wellness-track-detail.is-retired .ay-wellness-tree-list,
.ay-wellness-track-detail.is-retired > .ay-button { opacity: .72; }
@media (max-width: 720px) {
  .ay-wellness-questions { gap: 22px; }
  .ay-wellness-section + .ay-wellness-section,
  .ay-wellness-section + .ay-wellness-tracks,
  .ay-wellness-tracks + .ay-wellness-track-detail { padding-top: 20px; }
  .ay-wellness-track-grid { grid-template-columns: minmax(0, 1fr); }
  .ay-wellness-section__header,
  .ay-wellness-track-settings__heading { align-items: stretch; flex-direction: column; }
  .ay-wellness-track-settings__heading .ay-wellness-branch__actions { justify-content: flex-start; }
}
@media (pointer: coarse) {
  html[data-theme-surface="clinic-configuration"] .ay-wellness-track-tile { min-height: 72px; }
}

/* ========================================================================== */
/* React patient portal — spacious, patient-facing visual system             */
/*                                                                            */
/* This layer is intentionally scoped to .portal-shell so the legacy portal  */
/* and the staff dashboard keep their existing selectors. It uses the same   */
/* clinical-ui tokens, adds no second font/color system, and keeps each view  */
/* readable at phone and desktop widths.                                     */
/* ========================================================================== */

html[data-theme-surface="patient-portal"] {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

.portal-shell {
  --portal-rail-width: 78px;
  --portal-content-width: 1440px;
  --portal-card-radius: 18px;
  --portal-card-shadow: 0 1px 2px rgba(67, 54, 38, .04), 0 16px 34px rgba(67, 54, 38, .075);
  --portal-warm: #fffaf3;
  --portal-lilac: #f2edfb;
  --portal-mint: #eaf7f2;
  --portal-peach: #fff1e8;
  --portal-blue: #edf5fb;
  min-height: 100dvh;
  height: 100dvh;
  overflow: hidden;
  background: var(--ui-canvas);
  color: var(--ui-text);
}
.portal-shell *, .portal-shell *::before, .portal-shell *::after { min-width: 0; }
.portal-shell button, .portal-shell a, .portal-shell input, .portal-shell textarea, .portal-shell select { font: inherit; }
.portal-shell a { color: var(--ui-accent); }
.portal-shell .ay-button,
.portal-shell .ui-input,
.portal-shell .ui-select,
.portal-shell button,
.portal-shell input,
.portal-shell textarea,
.portal-shell select { transition: border-color var(--ui-duration-fast) ease, background-color var(--ui-duration-fast) ease, color var(--ui-duration-fast) ease, box-shadow var(--ui-duration-fast) ease, transform var(--ui-duration-fast) var(--ui-ease-out); }
.portal-shell .ay-button { min-height: 34px; gap: 6px; padding: 6px 10px; border-radius: 8px; font-size: .68rem; font-weight: 630; line-height: 1.15; }
.portal-shell .ay-button svg { width: 15px; height: 15px; flex: 0 0 15px; }
.portal-shell :where(button, a, input, textarea, select):focus-visible { outline: 0; box-shadow: var(--ui-focus); }

/* App frame and navigation */
.portal-shell .ay-shell__status { color: var(--ui-muted); font-size: .7rem; }
.portal-shell .portal-workspace-main { min-height: 0; display: block; overflow: hidden; }
.portal-shell .portal-dashboard { width: 100%; height: 100%; min-height: 0; margin: 0; display: grid; grid-template-columns: var(--portal-rail-width) minmax(0, 1fr); overflow: hidden; }
.portal-shell .portal-sidebar { position: relative; top: auto; height: 100%; min-height: 0; display: flex; align-items: center; gap: 8px; padding: 18px 12px; overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; border-right: 1px solid var(--ui-border); background: var(--ui-surface); }
.portal-shell .portal-rail-brand { width: 54px; min-height: 54px; flex: 0 0 54px; display: grid; place-items: center; margin: 0 0 6px; padding: 5px; color: var(--ui-accent); }
.portal-shell .portal-rail-brand__mark { width: 42px; height: 42px; display: grid; place-items: center; overflow: hidden; border: 1px solid var(--ui-accent-border); border-radius: 13px; background: var(--ui-accent-soft); color: var(--ui-accent); font-size: .82rem; font-weight: 760; }
.portal-shell .portal-rail-brand__logo { width: 100%; height: 100%; object-fit: contain; }
.portal-shell .portal-rail-button { width: 54px; min-height: 52px; display: grid; place-items: center; gap: 3px; padding: 7px 3px; border: 1px solid transparent; border-radius: 12px; background: transparent; color: var(--ui-muted); font-size: .6rem; font-weight: 650; }
.portal-shell .portal-rail-button svg { width: 21px; height: 21px; }
.portal-shell .portal-rail-button:hover, .portal-shell .portal-rail-button.is-selected { border-color: var(--ui-accent-border); background: var(--ui-accent-soft); color: var(--ui-accent); }
.portal-shell .portal-rail-button b { top: 2px; right: 2px; min-width: 17px; padding: 2px 4px; border: 2px solid var(--ui-surface); border-radius: 99px; background: var(--ui-accent-fill); color: var(--ui-on-accent); font-size: .58rem; line-height: 1.05; }
.portal-shell .portal-account-wrap { position: relative; margin-top: auto; }
.portal-shell .portal-account-button { width: 38px; min-height: 38px; margin: 0; padding: 0; border: 0; border-radius: 50%; background: var(--ui-text-soft); color: #fff; font-size: .7rem; font-weight: 750; }
.portal-shell .portal-account-button:hover, .portal-shell .portal-account-button.is-selected { box-shadow: 0 0 0 3px var(--ui-accent-soft); }
.portal-shell .portal-account-initials { display: grid; place-items: center; width: 100%; height: 100%; border-radius: inherit; }
.portal-shell .portal-account-popover { position: fixed; bottom: 16px; left: calc(var(--portal-rail-width) + 10px); z-index: 90; width: min(270px, calc(100vw - var(--portal-rail-width) - 28px)); padding: 8px; border: 1px solid var(--ui-border-strong); border-radius: 13px; background: var(--ui-surface); box-shadow: var(--ui-shadow-popover); }
.portal-shell .portal-account-popover[hidden] { display: none; }
.portal-shell .portal-account-identity { display: grid; gap: 2px; margin: 2px 2px 7px; padding: 8px 9px 10px; border-bottom: 1px solid var(--ui-border); }
.portal-shell .portal-account-identity strong { overflow: hidden; color: var(--ui-text); font-size: .76rem; text-overflow: ellipsis; white-space: nowrap; }
.portal-shell .portal-account-identity span { color: var(--ui-muted); font-size: .64rem; }
.portal-shell .portal-account-menu-grid { display: grid; gap: 3px; }
.portal-shell .portal-account-menu-grid button { width: 100%; min-height: 40px; display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 0; border-radius: 8px; background: transparent; color: var(--ui-text-soft); font-size: .7rem; font-weight: 620; text-align: left; }
.portal-shell .portal-account-menu-grid button > span { min-width: 0; white-space: nowrap; }
.portal-shell .portal-account-menu-grid button:hover { background: var(--ui-accent-soft); color: var(--ui-accent); }
.portal-shell .portal-account-menu-grid button.is-danger { color: var(--ui-danger); }
.portal-shell .portal-account-menu-grid button.is-danger:hover { background: var(--ui-danger-soft); color: var(--ui-danger); }
.portal-shell .portal-account-menu-grid svg { width: 18px; height: 18px; flex: 0 0 18px; }
.portal-shell .portal-main { width: 100%; height: 100%; min-height: 0; margin: 0; padding: clamp(24px, 4vw, 48px) clamp(18px, 4vw, 42px) 60px; overflow-x: hidden; overflow-y: auto; overscroll-behavior-y: contain; scrollbar-gutter: stable; }
.portal-shell .portal-toolbar { width: min(100%, var(--portal-content-width)); display: flex; justify-content: flex-end; gap: 8px; margin: -8px auto 14px; }
.portal-global-notice { width: min(100%, var(--portal-content-width)); display: flex; align-items: flex-start; gap: 8px; margin: 0 auto 18px; padding: 12px 14px; border: 1px solid var(--ui-border); border-radius: var(--portal-card-radius); background: var(--ui-surface); color: var(--ui-text-soft); box-shadow: var(--ui-shadow-card); font-size: .76rem; line-height: 1.45; }
.portal-global-notice--success { border-color: var(--ui-success-border); background: var(--ui-success-soft); color: var(--ui-success); }
.portal-global-notice--error { border-color: var(--ui-danger-border); background: var(--ui-danger-soft); color: var(--ui-danger); }
.portal-global-notice--info { border-color: var(--ui-info-border); background: var(--ui-info-soft); color: var(--ui-info); }
.portal-global-notice.is-transient { position: fixed; inset-block-start: max(16px, env(safe-area-inset-top)); inset-inline-start: 50%; z-index: 160; width: max-content; max-width: calc(100vw - 32px); justify-content: center; align-items: center; margin: 0; padding: 9px 14px; transform: translateX(-50%); border-radius: 14px; box-shadow: 0 10px 28px rgb(0 27 33 / .14); text-align: center; overflow-wrap: anywhere; pointer-events: none; animation: portal-toast-in 180ms var(--ui-ease-out) both; }
@keyframes portal-toast-in { from { opacity: 0; transform: translate(-50%, -8px); } to { opacity: 1; transform: translate(-50%, 0); } }
.portal-shell .portal-mobile-nav { display: none; }

/* Shared page hierarchy and cards */
.portal-shell .portal-page { width: min(100%, var(--portal-content-width)); margin: 0 auto; display: grid; gap: 20px; animation: portal-page-in 180ms var(--ui-ease-out) both; }
.portal-shell .portal-view-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; margin: 0 0 2px; padding: 0 2px 6px; border: 0; background: transparent; }
.portal-shell .portal-view-header > div:first-child { min-width: 0; }
.portal-shell .portal-view-header h1 { margin: 0; color: var(--ui-text); font-size: clamp(1.45rem, 2.4vw, 2rem); font-weight: 700; letter-spacing: -.032em; line-height: 1.1; }
.portal-shell .portal-view-header p:not(.ay-eyebrow) { max-width: 60ch; margin: 8px 0 0; color: var(--ui-muted); font-size: .84rem; line-height: 1.55; }
.portal-shell .portal-view-header .ay-eyebrow { display: none; }
.portal-shell .portal-view-actions { margin: 0; }
.portal-shell .portal-card { min-width: 0; padding: 22px; border: 1px solid var(--ui-border); border-radius: var(--portal-card-radius); background: var(--ui-surface); box-shadow: var(--portal-card-shadow); }
.portal-shell .portal-card > .ay-clinical-card__header { margin: 0 0 18px; padding: 0 0 14px; border-bottom: 1px solid var(--ui-border); }
.portal-shell .portal-card > .ay-clinical-card__header h2 { margin: 0; color: var(--ui-text); font-size: .94rem; font-weight: 700; letter-spacing: -.012em; }
.portal-shell .portal-card > .ay-clinical-card__header p { margin: 5px 0 0; color: var(--ui-muted); font-size: .82rem; line-height: 1.5; }
.portal-shell .portal-card .ay-actions { margin-top: 16px; }
.portal-shell .portal-state { min-height: 142px; padding: 22px 16px; border: 1px dashed var(--ui-border-strong); border-radius: 12px; background: var(--ui-surface-soft); }
.portal-shell .portal-state strong { display: block; color: var(--ui-text); font-size: .8rem; }
.portal-shell .portal-state p { margin: 6px 0 0; color: var(--ui-muted); font-size: .8rem; line-height: 1.5; }
.portal-shell .portal-state.ay-section-error { min-height: 0; border-style: solid; border-color: var(--ui-danger-border); background: var(--ui-danger-soft); }
.portal-shell .portal-meta { display: grid; gap: 3px; padding: 10px 0; border-bottom: 1px solid var(--ui-border); }
.portal-shell .portal-meta dt { color: var(--ui-muted); font-size: .7rem; font-weight: 680; letter-spacing: .03em; text-transform: uppercase; }
.portal-shell .portal-meta dd { margin: 0; color: var(--ui-text); font-size: .84rem; line-height: 1.45; overflow-wrap: anywhere; }
.portal-shell .portal-notices { display: grid; gap: 10px; }
.portal-shell .portal-notice { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; padding: 13px 15px; border: 1px solid var(--ui-info-border); border-radius: 12px; background: var(--ui-info-soft); color: var(--ui-info); }
.portal-shell .portal-notice h2 { margin: 0; color: currentColor; font-size: .82rem; }
.portal-shell .portal-notice p { margin: 5px 0 0; color: var(--ui-text-soft); font-size: .78rem; line-height: 1.45; }
.portal-shell .portal-notice--success { border-color: var(--ui-success-border); background: var(--ui-success-soft); color: var(--ui-success); }
.portal-shell .portal-notice--warning { border-color: var(--ui-warning-border); background: var(--ui-warning-soft); color: var(--ui-warning); }
.portal-shell .portal-notice--error { border-color: var(--ui-danger-border); background: var(--ui-danger-soft); color: var(--ui-danger); }

/* Home dashboard */
.portal-shell .portal-home-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.portal-shell .portal-home-summary { grid-row: span 2; }
.portal-shell .portal-home-messages { grid-column: 1 / -1; }
.portal-shell .portal-home-wellness { grid-column: 1 / -1; display: grid; gap: 12px; }
.portal-shell .portal-home-wellness > header { padding: 2px 2px 0; }
.portal-shell .portal-home-wellness > header h2 { margin: 0; color: var(--ui-text); font-size: 1rem; font-weight: 720; letter-spacing: -.015em; }
.portal-shell .portal-home-wellness > header p { margin: 5px 0 0; color: var(--ui-muted); font-size: .8rem; line-height: 1.5; }
.portal-shell .portal-wellness-metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.portal-shell .portal-wellness-metric { min-height: 232px; display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-rows: auto auto 64px auto; gap: 10px 14px; padding: 20px; border: 1px solid color-mix(in srgb, var(--ui-border) 72%, transparent); border-radius: var(--portal-card-radius); box-shadow: var(--portal-card-shadow); }
.portal-shell .portal-wellness-metric--energy { --portal-metric-accent: #b14a32; --portal-metric-surface: var(--portal-peach); background: var(--portal-peach); }
.portal-shell .portal-wellness-metric--sleep { --portal-metric-accent: #6843ba; --portal-metric-surface: var(--portal-lilac); background: var(--portal-lilac); }
.portal-shell .portal-wellness-metric--stress { --portal-metric-accent: #1d7457; --portal-metric-surface: var(--portal-mint); background: var(--portal-mint); }
.portal-shell .portal-wellness-metric--weight { --portal-metric-accent: #2f5ca8; --portal-metric-surface: var(--portal-blue); background: var(--portal-blue); }
.portal-shell .portal-wellness-metric__heading { grid-column: 1 / -1; display: flex; align-items: center; gap: 9px; color: var(--ui-text-soft); font-size: .82rem; }
.portal-shell .portal-wellness-metric__icon { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 50%; background: color-mix(in srgb, var(--ui-surface) 84%, transparent); color: var(--ui-text-soft); }
.portal-shell .portal-wellness-metric__icon svg { width: 17px; height: 17px; }
.portal-shell .portal-wellness-metric__summary { align-self: end; display: grid; gap: 5px; }
.portal-shell .portal-wellness-metric__summary > span,
.portal-shell .portal-wellness-metric__latest > span { color: var(--ui-muted); font-size: .66rem; font-weight: 680; letter-spacing: .035em; text-transform: uppercase; }
.portal-shell .portal-wellness-metric__value { align-self: end; color: var(--ui-text); font-size: clamp(1.45rem, 2.1vw, 2rem); font-weight: 640; letter-spacing: -.04em; line-height: 1; }
.portal-shell .portal-wellness-metric__latest { align-self: end; display: grid; justify-items: end; gap: 5px; }
.portal-shell .portal-wellness-metric__latest strong { color: var(--ui-text); font-size: .94rem; font-variant-numeric: tabular-nums; }
.portal-shell .portal-wellness-metric__spark { grid-column: 1 / -1; width: 100%; height: 64px; display: block; align-self: center; overflow: visible; color: var(--portal-metric-accent); }
.portal-shell .portal-wellness-metric__baseline { stroke: color-mix(in srgb, var(--portal-metric-accent) 22%, transparent); stroke-width: 1; vector-effect: non-scaling-stroke; }
.portal-shell .portal-wellness-metric__plot { transform-origin: left center; animation: portal-spark-reveal 240ms cubic-bezier(.23, 1, .32, 1) both; }
.portal-shell .portal-wellness-metric:nth-child(2) .portal-wellness-metric__plot { animation-delay: 40ms; }
.portal-shell .portal-wellness-metric:nth-child(3) .portal-wellness-metric__plot { animation-delay: 80ms; }
.portal-shell .portal-wellness-metric:nth-child(4) .portal-wellness-metric__plot { animation-delay: 120ms; }
.portal-shell .portal-wellness-metric__plot polyline { fill: none; stroke: currentColor; stroke-width: 2.75; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.portal-shell .portal-wellness-metric__plot circle { fill: var(--portal-metric-surface); stroke: currentColor; stroke-width: 1.8; vector-effect: non-scaling-stroke; }
.portal-shell .portal-wellness-metric__plot circle.is-latest { fill: currentColor; stroke-width: 0; }
.portal-shell .portal-wellness-metric__empty { grid-column: 1 / -1; min-height: 64px; display: flex; align-items: center; border-bottom: 1px solid color-mix(in srgb, var(--portal-metric-accent) 18%, transparent); color: var(--ui-muted); font-size: .72rem; line-height: 1.4; }
.portal-shell .portal-wellness-metric__detail { grid-column: 1 / -1; color: var(--ui-muted); font-size: .72rem; }
@keyframes portal-spark-reveal { from { opacity: .38; clip-path: inset(0 100% 0 0); } to { opacity: 1; clip-path: inset(0 0 0 0); } }
@keyframes portal-spark-fade { from { opacity: .45; } to { opacity: 1; } }
.portal-shell .portal-home-summary { background: color-mix(in srgb, var(--portal-blue) 62%, var(--ui-surface)); }
.portal-shell .portal-home-checkin { background: color-mix(in srgb, var(--portal-mint) 68%, var(--ui-surface)); }
.portal-shell .portal-home-messages { background: color-mix(in srgb, var(--portal-lilac) 54%, var(--ui-surface)); }
.portal-shell .portal-summary-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 18px; margin: 0; }
.portal-shell .portal-summary-list > div { min-width: 0; padding: 11px 0; border-bottom: 1px solid var(--ui-border); }
.portal-shell .portal-summary-list dt { color: var(--ui-muted); font-size: .7rem; font-weight: 680; letter-spacing: .04em; text-transform: uppercase; }
.portal-shell .portal-summary-list dd { margin: 5px 0 0; color: var(--ui-text); font-size: .9rem; font-weight: 680; overflow-wrap: anywhere; }
.portal-shell .portal-summary-list dd small { display: block; margin-top: 4px; color: var(--ui-muted); font-size: .75rem; font-weight: 500; line-height: 1.4; }
.portal-shell .portal-next-task { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: start; gap: 12px; }
.portal-shell .portal-next-task > .ay-button { grid-column: 2; justify-self: start; margin-top: 2px; }
.portal-shell .portal-task-icon { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 12px; background: var(--portal-mint); color: var(--ui-success); }
.portal-shell .portal-task-icon svg { width: 20px; height: 20px; }
.portal-shell .portal-next-task h3 { margin: 1px 0 0; color: var(--ui-text); font-size: .85rem; }
.portal-shell .portal-next-task p { margin: 4px 0 0; color: var(--ui-muted); font-size: .73rem; line-height: 1.5; }
.portal-shell .portal-next-task time { display: block; margin-top: 7px; color: var(--ui-accent); font-size: .68rem; font-weight: 700; }
.portal-shell .portal-message-preview-list { display: grid; gap: 5px; }
.portal-shell .portal-message-preview { width: 100%; display: grid; grid-template-columns: 32px minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 9px 6px; border: 0; border-bottom: 1px solid var(--ui-border); background: transparent; color: inherit; text-align: left; }
.portal-shell .portal-message-preview:hover { background: var(--ui-surface-soft); }
.portal-shell .portal-message-preview__avatar { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 50%; background: var(--portal-lilac); color: var(--ui-accent); font-size: .68rem; font-weight: 750; }
.portal-shell .portal-message-preview > span:nth-child(2) { display: grid; gap: 2px; min-width: 0; }
.portal-shell .portal-message-preview strong { color: var(--ui-text); font-size: .74rem; }
.portal-shell .portal-message-preview small { overflow: hidden; color: var(--ui-muted); font-size: .69rem; text-overflow: ellipsis; white-space: nowrap; }
.portal-shell .portal-message-preview time { color: var(--ui-muted); font-size: .63rem; white-space: nowrap; }
.portal-shell .portal-text-action { justify-self: start; margin-top: 5px; }

/* Secure messages */
.portal-shell .portal-messages-card { max-width: none; margin: 0; background: color-mix(in srgb, var(--portal-blue) 44%, var(--ui-surface)); }
.portal-shell .portal-message-thread { display: grid; grid-auto-rows: max-content; align-content: start; gap: 15px; max-height: min(52vh, 560px); overflow-y: auto; padding-right: 4px; scrollbar-gutter: stable; }
.portal-shell .ay-message-bubble { width: fit-content; max-width: min(78%, 680px); align-self: start; padding: 13px 15px; border: 1px solid var(--ui-border); border-radius: 14px 14px 14px 5px; background: var(--ui-surface-soft); box-shadow: 0 2px 8px rgba(67, 54, 38, .025); }
.portal-shell .ay-message-bubble.is-patient { justify-self: end; border-color: var(--ui-accent-border); border-radius: 14px 14px 5px 14px; background: var(--ui-accent-soft); }
.portal-shell .ay-message-meta { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px; color: var(--ui-muted); font-size: .74rem; }
.portal-shell .ay-message-meta strong { color: var(--ui-text); font-size: .82rem; }
.portal-shell .ay-message-meta time { margin-left: auto; font-variant-numeric: tabular-nums; }
.portal-shell .ay-message-bubble p { margin: 8px 0 0; color: var(--ui-text-soft); font-size: .88rem; line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; }
.portal-shell .portal-message-warning { display: flex; align-items: flex-start; gap: 7px; margin: 10px 0 0 !important; padding: 9px 10px; border: 1px solid var(--ui-warning-border); border-radius: 9px; background: var(--ui-warning-soft); color: var(--ui-warning) !important; font-size: .66rem !important; line-height: 1.45 !important; }
.portal-shell .portal-message-warning svg { width: 15px; height: 15px; flex: 0 0 15px; }
.portal-shell .ay-message-status { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 9px; color: var(--ui-muted); font-size: .63rem; }
.portal-shell .ay-message-status .is-reviewed { color: var(--ui-success); font-weight: 700; }
.portal-shell .ay-message-status .is-pending { color: var(--ui-warning); font-weight: 700; }
.portal-shell .portal-linked-records, .portal-shell .portal-attachment-list { display: grid; gap: 6px; margin: 11px 0 0; padding: 0; list-style: none; }
.portal-shell .portal-linked-records li, .portal-shell .portal-attachment-list li { min-width: 0; display: flex; align-items: flex-start; flex-wrap: wrap; gap: 8px; padding: 9px 10px; border: 1px solid var(--ui-border); border-radius: 10px; background: var(--ui-surface); }
.portal-shell .portal-attachment-kind { flex: 0 0 auto; padding: 3px 5px; border: 1px solid var(--ui-accent-border); border-radius: 5px; background: var(--ui-accent-soft); color: var(--ui-accent); font-size: .57rem; font-weight: 750; }
.portal-shell .portal-attachment-name { flex: 1 1 120px; overflow-wrap: anywhere; color: var(--ui-text-soft); font-size: .68rem; }
.portal-shell .portal-attachment-error { color: var(--ui-danger); font-size: .66rem; }
.portal-shell .portal-composer, .portal-shell .portal-message-composer { display: grid; gap: 11px; margin-top: 20px !important; padding: 18px; border: 1px solid var(--ui-border); border-radius: 14px; background: color-mix(in srgb, var(--ui-surface-soft) 82%, var(--portal-lilac)); }
.portal-shell .portal-composer > label:first-child, .portal-shell .portal-message-composer > label:first-child, .portal-shell .portal-upload-form > label { color: var(--ui-text-soft); font-size: .72rem; font-weight: 680; }
.portal-shell .portal-composer .ui-input, .portal-shell .portal-message-composer .ui-input, .portal-shell .portal-upload-form .ui-input { width: 100%; min-height: 96px; padding: 11px 12px; border: 1px solid var(--ui-border-strong); border-radius: 10px; background: var(--ui-surface); color: var(--ui-text); resize: vertical; font-size: .88rem; line-height: 1.5; }
.portal-shell .portal-message-field-frame { width: 100%; min-width: 0; overflow: hidden; border-radius: var(--portal-control-radius); }
.portal-shell .portal-attachment-picker { position: relative; display: inline-flex !important; width: fit-content; align-items: center; gap: 6px; min-height: 36px; padding: 7px 11px !important; border: 1px solid var(--ui-border-strong); border-radius: 9px; background: var(--ui-surface); color: var(--ui-text-soft) !important; cursor: pointer; font-size: .68rem !important; }
.portal-shell .portal-attachment-picker--icon { width: var(--portal-action-height); min-width: var(--portal-action-height); padding: 0 !important; justify-content: center; }
.portal-shell .portal-attachment-picker--icon svg { width: 18px; height: 18px; }
.portal-shell .portal-attachment-picker:hover { border-color: var(--ui-accent-border); background: var(--ui-accent-soft); color: var(--ui-accent) !important; }
.portal-shell .portal-attachment-picker input { position: absolute; width: 1px !important; height: 1px !important; overflow: hidden; opacity: 0; pointer-events: none; }
.portal-shell .portal-composer-footer { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding-top: 3px; }
.portal-shell .portal-composer-footer > span { display: inline-flex; align-items: center; gap: 6px; color: var(--ui-muted); font-size: .67rem; font-weight: 620; }
.portal-shell .portal-composer-footer svg { width: 15px; height: 15px; }

/* Documents */
.portal-shell .portal-documents-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; align-items: start; }
.portal-shell .portal-documents-card, .portal-shell .portal-upload-card, .portal-shell .portal-document-notices-card { grid-column: auto; grid-row: auto; align-self: start; }
.portal-shell .portal-documents-card { background: color-mix(in srgb, var(--portal-blue) 44%, var(--ui-surface)); }
.portal-shell .portal-upload-card { background: color-mix(in srgb, var(--portal-mint) 54%, var(--ui-surface)); }
.portal-shell .portal-document-notices-card { background: color-mix(in srgb, var(--portal-peach) 52%, var(--ui-surface)); }
.portal-shell .portal-document-list, .portal-shell .portal-notice-list, .portal-shell .portal-upload-list { display: grid; gap: 9px; }
.portal-shell .portal-document-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: start; gap: 12px; padding: 12px 13px; border: 1px solid var(--ui-border); border-radius: 11px; background: var(--ui-surface-soft); }
.portal-shell .portal-document-row:hover { border-color: var(--ui-accent-border); background: var(--ui-accent-soft); }
.portal-shell .patient-attachment-copy { min-width: 0; display: flex; align-items: flex-start; gap: 10px; }
.portal-shell .patient-attachment-copy > div { min-width: 0; display: grid; gap: 3px; }
.portal-shell .patient-attachment-copy strong { overflow-wrap: anywhere; color: var(--ui-text); font-size: .84rem; }
.portal-shell .patient-attachment-copy small { color: var(--ui-muted); font-size: .74rem; }
.portal-shell .patient-attachment-icon { width: 34px; height: 34px; flex: 0 0 34px; display: grid; place-items: center; border: 1px solid var(--ui-accent-border); border-radius: 9px; background: var(--ui-accent-soft); }
.portal-shell .ay-document-file-icon { color: var(--ui-accent); font-size: .54rem; font-weight: 750; }
.portal-shell .clinical-document-actions { display: flex; align-items: flex-start; gap: 7px; }
.portal-shell .portal-document-status, .portal-shell .portal-document-row-error { grid-column: 1 / -1; margin: 0; color: var(--ui-muted); font-size: .74rem; }
.portal-shell .portal-document-row-error { color: var(--ui-danger); }
.portal-shell .portal-document-notice { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; padding: 10px 11px; border: 1px solid var(--ui-warning-border); border-radius: 10px; background: var(--ui-warning-soft); color: var(--ui-warning); }
.portal-shell .portal-document-notice strong { font-size: .78rem; }
.portal-shell .portal-document-notice p { margin: 4px 0 0; color: var(--ui-text-soft); font-size: .74rem; line-height: 1.45; }
.portal-shell .portal-document-notice time { flex: 0 0 auto; color: var(--ui-muted); font-size: .61rem; }
.portal-shell .portal-upload-form { display: grid; gap: 10px; margin: 0 !important; padding: 0; border: 0; border-radius: 0; background: transparent; }
.portal-shell .portal-upload-controls { display: grid; grid-template-columns: minmax(180px, .72fr) minmax(0, 2fr); align-items: end; gap: 12px; }
.portal-shell .portal-upload-category, .portal-shell .portal-upload-file-field { min-width: 0; display: grid; gap: 6px; }
.portal-shell .portal-upload-category { position: relative; }
.portal-shell .portal-upload-category::after { content: ""; position: absolute; right: 14px; bottom: 17px; width: 6px; height: 6px; border-right: 1.5px solid var(--ui-muted); border-bottom: 1.5px solid var(--ui-muted); transform: rotate(45deg); pointer-events: none; }
.portal-shell .portal-upload-file-field > .ui-field__label { color: var(--ui-text-soft); font-size: .72rem; font-weight: 680; }
.portal-shell .portal-upload-file-row { min-width: 0; min-height: 40px; display: grid; grid-template-columns: auto minmax(72px, 1fr) auto; align-items: center; gap: 8px; }
.portal-shell .portal-upload-input { position: absolute; width: 1px !important; height: 1px !important; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; opacity: 0; }
.portal-shell .portal-upload-choose, .portal-shell .portal-upload-submit { min-height: 40px; white-space: nowrap; }
.portal-shell .portal-upload-file-name { min-width: 0; overflow: hidden; color: var(--ui-muted); font-size: .72rem; line-height: 1.35; text-overflow: ellipsis; white-space: nowrap; }
.portal-shell .portal-upload-file-name.has-file { color: var(--ui-text-soft); font-weight: 620; }
.portal-shell .portal-upload-form > p[role="status"] { display: flex; align-items: center; gap: 7px; margin: 0; color: var(--ui-muted); font-size: .68rem; }
.portal-shell .portal-upload-list { margin-top: 15px; padding-top: 14px; border-top: 1px solid var(--ui-border); }
.portal-shell .portal-upload-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 10px; border: 1px solid var(--ui-border); border-radius: 9px; background: var(--ui-surface-soft); }
.portal-shell .portal-upload-row > div { min-width: 0; display: grid; gap: 2px; }
.portal-shell .portal-upload-row strong { overflow-wrap: anywhere; color: var(--ui-text); font-size: .68rem; }
.portal-shell .portal-upload-row small { color: var(--ui-muted); font-size: .62rem; }
.portal-shell .portal-upload-status { flex: 0 0 auto; color: var(--ui-accent); font-size: .62rem; font-weight: 680; }
.portal-shell .portal-upload-status--failed { color: var(--ui-danger); }

/* Check-in conversation */
.portal-shell .portal-checkin-card { max-width: none; margin: 0; background: color-mix(in srgb, var(--portal-warm) 54%, var(--ui-surface)); }
.portal-shell .portal-checkin-start, .portal-shell .portal-checkin-submit { display: grid; gap: 12px; padding: 15px; border: 1px solid var(--ui-border); border-radius: 12px; background: var(--portal-warm); }
.portal-shell .portal-checkin-start .ui-field, .portal-shell .portal-checkin-submit .ui-field { display: grid; gap: 6px; }
.portal-shell .portal-checkin-start .ui-field__label, .portal-shell .portal-checkin-submit .ui-field__label { color: var(--ui-text-soft); font-size: .71rem; font-weight: 680; }
.portal-shell .portal-checkin-conversation { display: grid; gap: 15px; }
.portal-shell .portal-checkin-transcript { display: grid; gap: 12px; }
.portal-shell .portal-checkin-turn { width: fit-content; max-width: 80%; padding: 13px 15px; border: 1px solid var(--ui-border); border-radius: 13px 13px 13px 5px; background: var(--ui-surface-soft); color: var(--ui-text-soft); font-size: .88rem; line-height: 1.55; white-space: pre-wrap; }
.portal-shell .portal-checkin-turn--patient { justify-self: end; border-color: var(--ui-accent-border); border-radius: 13px 13px 5px 13px; background: var(--ui-accent-soft); }
.portal-shell .portal-checkin-answer { display: grid; gap: 7px; }
.portal-shell .portal-checkin-answer .ui-input { min-height: 92px; padding: 11px 12px; border: 1px solid var(--ui-border-strong); border-radius: 10px; background: var(--ui-surface); resize: vertical; font-size: .88rem; }
.portal-shell .portal-checkin-flag { padding: 10px 11px; border: 1px solid var(--ui-warning-border); border-radius: 10px; background: var(--ui-warning-soft); color: var(--ui-warning); font-size: .68rem; line-height: 1.45; }
.portal-shell .portal-review-checkbox { display: flex; align-items: flex-start; gap: 8px; color: var(--ui-text-soft); font-size: .7rem; }
.portal-shell .portal-review-checkbox input { width: 18px; height: 18px; accent-color: var(--ui-accent-fill); }
.portal-shell .portal-checkin-complete { display: flex; align-items: center; gap: 12px; padding: 16px; border: 1px solid var(--ui-success-border); border-radius: 12px; background: var(--ui-success-soft); color: var(--ui-success); }
.portal-shell .portal-checkin-complete svg { width: 22px; height: 22px; flex: 0 0 22px; }
.portal-shell .portal-checkin-complete strong { color: currentColor; font-size: .78rem; }
.portal-shell .portal-checkin-complete p { margin: 3px 0 0; color: var(--ui-text-soft); font-size: .7rem; line-height: 1.45; }

/* History and settings */
.portal-shell .portal-history-card { max-width: none; margin: 0; background: color-mix(in srgb, var(--portal-lilac) 42%, var(--ui-surface)); }
.portal-shell .portal-assessment-list { display: grid; grid-auto-rows: max-content; align-content: start; gap: 11px; max-height: min(58vh, 640px); overflow-y: auto; padding-right: 4px; scrollbar-gutter: stable; }
.portal-shell .portal-assessment { align-self: start; border: 1px solid var(--ui-border); border-radius: 11px; background: var(--ui-surface-soft); overflow: hidden; }
.portal-shell .portal-assessment > summary { min-height: 72px; display: grid; grid-template-columns: minmax(0, 1fr) auto 18px; align-items: center; gap: 12px; padding: 14px 16px; color: var(--ui-text); cursor: pointer; list-style: none; }
.portal-shell .portal-assessment > summary::-webkit-details-marker { display: none; }
.portal-shell .portal-assessment > summary::marker { content: ""; }
.portal-shell .portal-assessment > summary::after { content: none; }
.portal-shell .portal-assessment > summary:hover { background: color-mix(in srgb, var(--ui-accent-soft) 42%, transparent); }
.portal-shell .portal-assessment > summary:focus-visible { outline: 0; box-shadow: inset 0 0 0 2px var(--ui-accent-border); }
.portal-shell .portal-assessment[open] > summary { border-bottom: 1px solid var(--ui-border); }
.portal-shell .portal-assessment__identity { display: grid; align-content: center; gap: 4px; min-width: 0; }
.portal-shell .portal-assessment__identity strong { color: var(--ui-text); font-size: .9rem; line-height: 1.35; overflow-wrap: anywhere; }
.portal-shell .portal-assessment__identity time,
.portal-shell .portal-assessment > summary > small { display: block; margin: 0; color: var(--ui-muted); font-size: .74rem; line-height: 1.45; }
.portal-shell .portal-assessment > summary > small { text-align: right; white-space: nowrap; }
.portal-shell .portal-assessment__chevron { width: 18px; height: 18px; color: var(--ui-muted); transition: transform 180ms var(--ui-ease-out); }
.portal-shell .portal-assessment[open] .portal-assessment__chevron { transform: rotate(180deg); }
.portal-shell .portal-assessment dl { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 18px; margin: 0; padding: 4px 13px 13px; }
.portal-shell .portal-assessment dl > div { padding: 10px 0; border-bottom: 1px solid var(--ui-border); }
.portal-shell .portal-assessment dt { color: var(--ui-muted); font-size: .72rem; font-weight: 680; }
.portal-shell .portal-assessment dd { margin: 4px 0 0; color: var(--ui-text-soft); font-size: .84rem; line-height: 1.45; overflow-wrap: anywhere; }
.portal-shell .portal-assessment__empty { margin: 0; padding: 16px; color: var(--ui-muted); font-size: .76rem; line-height: 1.5; }
.portal-shell .portal-settings-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
.portal-shell .portal-settings-form { min-width: 0; display: grid; gap: 16px; }
.portal-shell .portal-settings-form > section { min-width: 0; }
.portal-shell .portal-settings-form h3 { margin: 0; color: var(--ui-text); font-size: .9rem; }
.portal-shell .portal-settings-form h3 + p { margin: 4px 0 15px; color: var(--ui-muted); font-size: .72rem; line-height: 1.5; }
.portal-shell .portal-settings-grid .ui-field { display: grid; gap: 6px; }
.portal-shell .portal-settings-grid .ui-field__label { color: var(--ui-text-soft); font-size: .7rem; font-weight: 680; }
.portal-shell .portal-settings-grid .ui-input, .portal-shell .portal-settings-grid .ui-select { width: 100%; min-height: 40px; padding: 9px 11px; border: 1px solid var(--ui-border-strong); border-radius: 9px; background: var(--ui-surface); color: var(--ui-text); font-size: .74rem; }
.portal-shell .portal-settings-nav { position: sticky; top: 94px; display: grid; gap: 4px; padding: 5px; border: 1px solid var(--ui-border); border-radius: 12px; background: var(--ui-surface-soft); }
.portal-shell .portal-settings-nav button { min-height: 38px; justify-content: flex-start; padding: 8px 10px; border: 1px solid transparent; border-radius: 8px; background: transparent; color: var(--ui-muted); font-size: .7rem; text-align: left; }
.portal-shell .portal-settings-nav button:hover, .portal-shell .portal-settings-nav button[aria-selected="true"] { border-color: var(--ui-accent-border); background: var(--ui-accent-soft); color: var(--ui-accent); }
.portal-shell .portal-preference-list { display: grid; gap: 7px; }
.portal-shell .portal-preference-list label { display: flex; align-items: flex-start; gap: 8px; padding: 10px; border: 1px solid var(--ui-border); border-radius: 9px; background: var(--ui-surface-soft); color: var(--ui-text-soft); font-size: .71rem; }
.portal-shell .portal-preference-list input { width: 17px; height: 17px; margin: 0; accent-color: var(--ui-accent-fill); }
.portal-shell .portal-settings-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.portal-shell .portal-billing, .portal-shell .portal-privacy { padding: 13px; border: 1px solid var(--ui-border); border-radius: 11px; background: var(--portal-mint); }
.portal-shell .portal-billing p, .portal-shell .portal-privacy p { margin: 0; color: var(--ui-text-soft); font-size: .72rem; line-height: 1.5; }
.portal-shell .portal-settings-footer { color: var(--ui-muted); font-size: .67rem; line-height: 1.5; }

/* Account security dialogs */
.portal-shell .portal-dialog-backdrop { position: fixed; inset: 0; z-index: 150; display: grid; place-items: center; padding: 18px; background: var(--ui-overlay); animation: portal-fade-in 160ms ease-out both; }
.portal-shell .portal-dialog { width: min(100%, 500px); max-height: min(760px, calc(100dvh - 36px)); overflow: auto; padding: 22px; border: 1px solid var(--ui-border-strong); border-radius: 15px; background: var(--ui-surface); box-shadow: var(--ui-shadow-dialog); animation: portal-dialog-in 200ms var(--ui-ease-out) both; }
.portal-shell .portal-dialog > header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.portal-shell .portal-dialog h2 { margin: 0; color: var(--ui-text); font-size: 1rem; }
.portal-shell .portal-dialog p { color: var(--ui-muted); font-size: .74rem; line-height: 1.5; }
.portal-shell .portal-dialog-close { width: 34px; height: 34px; display: grid; place-items: center; padding: 0; border: 1px solid var(--ui-border-strong); border-radius: 50%; background: var(--ui-surface); color: var(--ui-text-soft); }
.portal-shell .portal-dialog-options { display: grid; gap: 10px; }
.portal-shell .portal-dialog .ui-field { display: grid; gap: 6px; }
.portal-shell .portal-dialog .ui-field__label { color: var(--ui-text-soft); font-size: .7rem; font-weight: 680; }
.portal-shell .portal-dialog .ui-input { width: 100%; min-height: 40px; padding: 9px 11px; border: 1px solid var(--ui-border-strong); border-radius: 9px; background: var(--ui-surface); color: var(--ui-text); font-size: .74rem; }
.portal-shell .portal-setup-key { padding: 11px; border: 1px dashed var(--ui-accent-border); border-radius: 9px; background: var(--ui-accent-soft); color: var(--ui-accent); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .72rem; overflow-wrap: anywhere; user-select: all; }
.portal-shell .portal-setup-qr { width: min(100%, 240px); height: auto; justify-self: center; padding: 8px; border: 1px solid var(--ui-border); border-radius: 10px; background: #fff; }
html[data-theme-surface="patient-portal"] .portal-mfa-choices { display: grid; gap: 9px; margin: 4px 0 0; padding: 0; border: 0; }
html[data-theme-surface="patient-portal"] .portal-mfa-choices legend { margin-bottom: 5px; color: var(--ui-text-soft); font-size: .72rem; font-weight: 680; }
html[data-theme-surface="patient-portal"] body > #root > .portal-global-notice:not(.is-transient) { width: min(calc(100% - 32px), 450px); margin: 14px auto; }
html[data-theme-surface="patient-portal"] .portal-app-loading { min-height: 100dvh; display: grid; place-items: center; align-content: center; gap: 10px; padding: 24px; background: var(--ui-canvas); color: var(--ui-muted); font-size: .76rem; }
html[data-theme-surface="patient-portal"] .portal-app-loading .ay-spinner { width: 22px; height: 22px; }

/* Auth uses the same system but remains an intentional, focused single card. */
html[data-theme-surface="patient-portal"] .ay-auth-card__header { display: grid; grid-template-columns: 46px minmax(0, 1fr); grid-template-rows: auto auto; align-items: center; column-gap: 14px; row-gap: 5px; }
html[data-theme-surface="patient-portal"] .ay-auth-card__header > .ay-auth-brand-mark { grid-column: 1; grid-row: 1; align-self: center; }
html[data-theme-surface="patient-portal"] .ay-auth-card__header > div { display: contents; }
html[data-theme-surface="patient-portal"] .ay-auth-card__header h1 { grid-column: 2; grid-row: 1; align-self: center; }
html[data-theme-surface="patient-portal"] .ay-auth-card__header h1 + p { grid-column: 2; grid-row: 2; margin: 0; }
html[data-theme-surface="patient-portal"] .portal-auth-flow { width: min(100%, 450px); }
html[data-theme-surface="patient-portal"] .portal-auth-flow form { display: grid; gap: 8px; }
html[data-theme-surface="patient-portal"] .portal-auth-flow form > label { margin-top: 6px; color: var(--ui-text-soft); font-size: .72rem; font-weight: 680; }
html[data-theme-surface="patient-portal"] .portal-auth-flow .ui-input { width: 100%; min-height: 43px; padding: 10px 12px; border: 1px solid var(--ui-border-strong); border-radius: 10px; background: var(--ui-surface); color: var(--ui-text); font-size: .78rem; }
html[data-theme-surface="patient-portal"] .portal-auth-flow .ui-input:hover { border-color: var(--ui-accent-border); }
html[data-theme-surface="patient-portal"] .portal-auth-flow .ay-auth-submit { margin-top: 8px; }
html[data-theme-surface="patient-portal"] .portal-auth-flow .ay-auth-submit .ay-button { width: 100%; min-height: 44px; }
html[data-theme-surface="patient-portal"] .portal-auth-flow .ay-auth-options-row { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 3px 9px; margin-top: 14px; color: var(--ui-muted); font-size: .68rem; }
html[data-theme-surface="patient-portal"] .portal-auth-flow .ay-auth-link { min-height: 32px; padding: 5px 7px; border: 0; border-radius: 7px; background: transparent; color: var(--ui-accent); font-size: .68rem; font-weight: 680; }
html[data-theme-surface="patient-portal"] .portal-auth-flow .ay-auth-link:hover { background: var(--ui-accent-soft); }

@keyframes portal-page-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
@keyframes portal-fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes portal-dialog-in { from { opacity: 0; transform: translateY(8px) scale(.985); } to { opacity: 1; transform: none; } }

html.clinical-ui.dark .portal-shell {
  --portal-warm: #2c302c;
  --portal-lilac: #302c3b;
  --portal-mint: #233831;
  --portal-peach: #3a2c28;
  --portal-blue: #25333e;
  --portal-card-shadow: 0 1px 2px rgba(0,0,0,.22), 0 12px 30px rgba(0,0,0,.12);
}
html.clinical-ui.dark .portal-shell .portal-rail-button:hover, html.clinical-ui.dark .portal-shell .portal-rail-button.is-selected { background: var(--ui-accent-soft); }
html.clinical-ui.dark .portal-shell .portal-card,
html.clinical-ui.dark .portal-shell .portal-dialog,
html.clinical-ui.dark .portal-shell .portal-auth-flow { color: var(--ui-text); }
html.clinical-ui.dark .portal-shell .ay-message-bubble.is-patient, html.clinical-ui.dark .portal-shell .portal-checkin-turn--patient { background: var(--ui-accent-soft); border-color: var(--ui-accent-border); }
html.clinical-ui.dark .portal-shell .ay-message-bubble:not(.is-patient), html.clinical-ui.dark .portal-shell .portal-checkin-turn:not(.portal-checkin-turn--patient) { background: var(--ui-chat-assistant-surface); border-color: var(--ui-chat-assistant-border); }
html.clinical-ui.dark .portal-shell .portal-checkin-start, html.clinical-ui.dark .portal-shell .portal-checkin-submit { background: var(--portal-warm); }

@media (min-width: 900px) {
  .portal-shell .portal-page--messages,
  .portal-shell .portal-page--checkin,
  .portal-shell .portal-page--history { height: 100%; grid-template-rows: auto minmax(0, 1fr); }
  .portal-shell .portal-messages-card,
  .portal-shell .portal-history-card { min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
  .portal-shell .portal-message-thread,
  .portal-shell .portal-assessment-list { min-height: 120px; max-height: none; flex: 1 1 auto; }
  .portal-shell .portal-checkin-card { min-height: 0; overflow-y: auto; }
}

@media (min-width: 900px) and (max-width: 1120px) {
  .portal-shell .portal-main { padding: 32px 24px 48px; }
  .portal-shell .portal-home-grid,
  .portal-shell .portal-documents-grid,
  .portal-shell .portal-settings-grid { grid-template-columns: minmax(0, 1fr); }
  .portal-shell .portal-home-summary,
  .portal-shell .portal-home-messages,
  .portal-shell .portal-documents-card,
  .portal-shell .portal-document-notices-card,
  .portal-shell .portal-upload-card { grid-column: auto; grid-row: auto; }
  .portal-shell .portal-home-wellness { grid-column: auto; }
  .portal-shell .portal-wellness-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 899px) {
  .portal-shell .portal-dashboard { display: block; height: 100%; min-height: 0; padding-bottom: 0; }
  .portal-shell .portal-sidebar { display: none; }
  .portal-shell .portal-main { width: 100%; height: 100%; min-height: 0; padding: 26px 16px calc(108px + env(safe-area-inset-bottom)); }
  .portal-shell .portal-mobile-nav { position: fixed; right: 0; bottom: 0; left: 0; z-index: 60; display: flex; align-items: stretch; justify-content: space-around; gap: 4px; min-height: 68px; padding: 6px max(8px, env(safe-area-inset-left)) max(6px, env(safe-area-inset-bottom)); border-top: 1px solid var(--ui-border); background: color-mix(in srgb, var(--ui-surface) 96%, transparent); box-shadow: var(--ui-shadow-footer); backdrop-filter: blur(14px); }
  .portal-shell .portal-mobile-nav__item { position: relative; width: 20%; min-height: 52px; display: grid; place-items: center; align-content: center; gap: 3px; padding: 6px 2px; border: 1px solid transparent; border-radius: 11px; background: transparent; color: var(--ui-muted); font-size: .61rem; font-weight: 650; }
  .portal-shell .portal-mobile-nav__item svg { width: 20px; height: 20px; }
  .portal-shell .portal-mobile-nav__item:hover, .portal-shell .portal-mobile-nav__item.is-selected { border-color: var(--ui-accent-border); background: var(--ui-accent-soft); color: var(--ui-accent); }
  .portal-shell .portal-mobile-nav__item b { position: absolute; top: 1px; right: 16%; min-width: 17px; padding: 2px 4px; border: 2px solid var(--ui-surface); border-radius: 99px; background: var(--ui-accent-fill); color: var(--ui-on-accent); font-size: .57rem; }
  .portal-shell .portal-home-grid, .portal-shell .portal-documents-grid, .portal-shell .portal-settings-grid { grid-template-columns: minmax(0, 1fr); }
  .portal-shell .portal-home-summary, .portal-shell .portal-home-messages, .portal-shell .portal-documents-card, .portal-shell .portal-document-notices-card, .portal-shell .portal-upload-card { grid-column: auto; grid-row: auto; }
  .portal-shell .portal-home-wellness { grid-column: auto; }
  .portal-shell .portal-wellness-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .portal-shell .portal-wellness-metric { min-height: 224px; }
  .portal-shell .portal-view-header { align-items: flex-start; flex-direction: column; gap: 10px; }
  .portal-shell .portal-view-header h1 { font-size: 1.5rem; }
  .portal-shell .portal-card { padding: 17px; }
  .portal-shell .portal-message-thread, .portal-shell .portal-assessment-list { max-height: none; overflow: visible; padding-right: 0; }
  .portal-shell .portal-settings-nav { position: static; display: flex; overflow-x: auto; gap: 4px; }
  .portal-shell .portal-settings-nav button { flex: 0 0 auto; }
  .portal-shell .portal-summary-list { grid-template-columns: minmax(0, 1fr); }
  .portal-shell .portal-assessment > summary { grid-template-columns: minmax(0, 1fr) 18px; gap: 5px 10px; }
  .portal-shell .portal-assessment > summary > small { grid-column: 1; text-align: left; white-space: normal; }
  .portal-shell .portal-assessment__chevron { grid-column: 2; grid-row: 1 / span 2; }
  .portal-shell .portal-assessment dl { grid-template-columns: minmax(0, 1fr); }
  .portal-shell .portal-account-wrap--mobile { width: 20%; margin: 0; }
  .portal-shell .portal-mobile-account-button { width: 100%; min-height: 52px; display: grid; place-items: center; align-content: center; gap: 3px; padding: 6px 2px; border: 1px solid transparent; border-radius: 11px; background: transparent; color: var(--ui-muted); font-size: .61rem; font-weight: 650; }
  .portal-shell .portal-mobile-account-button:hover, .portal-shell .portal-mobile-account-button.is-selected { border-color: var(--ui-accent-border); background: var(--ui-accent-soft); color: var(--ui-accent); box-shadow: none; }
  .portal-shell .portal-mobile-account-button .portal-account-initials { width: 24px; height: 24px; background: var(--ui-text-soft); color: #fff; font-size: .6rem; }
  .portal-shell .portal-account-popover--mobile { right: max(8px, env(safe-area-inset-right)); bottom: calc(76px + env(safe-area-inset-bottom)); left: auto; width: min(260px, calc(100vw - 24px)); padding: 6px; }
  .portal-shell .portal-account-popover--mobile .portal-account-identity { margin-bottom: 5px; padding: 7px 8px 9px; }
  .portal-shell .portal-account-popover--mobile .portal-account-menu-grid { width: 100%; display: grid; grid-template-columns: minmax(0, 1fr); justify-items: stretch; }
  .portal-shell .portal-account-popover--mobile .portal-account-menu-grid button { width: 100% !important; max-width: none; min-height: 42px; display: grid; grid-template-columns: 20px minmax(0, 1fr); justify-self: stretch; justify-content: stretch; gap: 10px; padding: 8px 10px; }
  .portal-shell .portal-account-popover--mobile .portal-account-menu-grid button > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .portal-shell .portal-upload-controls { grid-template-columns: minmax(0, 1fr); }
  .portal-shell .portal-upload-category { max-width: 100%; }
  html.clinical-ui:not(.dark)[data-theme-surface="patient-portal"] .portal-shell .portal-upload-category .ui-select { background-color: #ffffff; }
  .portal-shell .ay-button { min-height: 40px; padding: 8px 12px; font-size: .71rem; }
}

@media (max-width: 520px) {
  .portal-shell .portal-wellness-metrics { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 520px) {
  .portal-shell .portal-main { padding: 20px 12px calc(100px + env(safe-area-inset-bottom)); }
  .portal-shell .portal-toolbar { justify-content: stretch; margin-top: -1px; }
  .portal-shell .portal-toolbar > * { flex: 1 1 0; }
  .portal-shell .portal-card { padding: 15px; border-radius: 13px; }
  .portal-shell .portal-card > .ay-clinical-card__header { margin-bottom: 14px; padding-bottom: 12px; }
  .portal-shell .ay-message-bubble, .portal-shell .portal-checkin-turn { max-width: 88%; }
  .portal-shell .portal-document-row { grid-template-columns: minmax(0, 1fr); }
  .portal-shell .clinical-document-actions { justify-content: flex-start; }
  .portal-shell .portal-composer-footer { align-items: stretch; flex-direction: column; }
  .portal-shell .portal-composer-footer .ay-button { width: 100%; }
  .portal-shell .portal-attachment-picker { width: 100%; justify-content: center; }
  .portal-shell .portal-upload-controls { grid-template-columns: minmax(0, 1fr); }
  .portal-shell .portal-upload-file-row { grid-template-columns: auto minmax(64px, 1fr) auto; }
  .portal-shell .portal-upload-choose, .portal-shell .portal-upload-submit { min-width: 0; padding-inline: 9px; }
  .portal-shell .portal-next-task { grid-template-columns: 34px minmax(0, 1fr); }
  .portal-shell .portal-next-task > .ay-button { grid-column: 1 / -1; }
  .portal-shell .portal-message-preview { grid-template-columns: 30px minmax(0, 1fr); }
  .portal-shell .portal-message-preview time { display: none; }
  .portal-shell .portal-dialog-backdrop { align-items: end; padding: 0; }
  .portal-shell .portal-dialog { width: 100%; max-height: calc(100dvh - 20px); border-radius: 15px 15px 0 0; padding-bottom: max(20px, env(safe-area-inset-bottom)); }
}

/* Dedicated wellness check-in uses the same patient conversation component as intake.
   The portal owns state and API calls; these rules only adapt its presentation. */
.portal-shell .portal-main--checkin { min-height: 0; display: flex; flex-direction: column; padding: clamp(24px, 4vw, 48px) clamp(18px, 4vw, 42px) 14px; overflow: hidden; scrollbar-gutter: auto; }
.portal-shell .portal-main--checkin > .portal-toolbar,
.portal-shell .portal-main--checkin > .portal-global-notice { flex: 0 0 auto; }
.portal-shell .portal-page--checkin { position: relative; width: 100%; max-width: none; height: auto; min-height: 0; flex: 1 1 auto; display: flex; flex-direction: column; gap: 16px; }
.portal-shell .portal-page--checkin > .portal-view-header { width: min(100%, var(--portal-content-width)); flex: 0 0 auto; align-self: center; margin: 0 auto; padding-bottom: 2px; }
.portal-shell .portal-page--checkin.is-unavailable,
.portal-shell .portal-page--checkin.is-available,
.portal-shell .portal-page--checkin.is-submitted { align-items: center; }
.portal-shell .portal-checkin-unavailable { width: min(100%, 620px); display: grid; gap: 16px; padding: clamp(20px, 3vw, 28px); border: 1px solid var(--ui-border); border-radius: var(--portal-card-radius); background: var(--portal-card-surface); }
.portal-shell .portal-checkin-unavailable h2,
.portal-shell .portal-checkin-review h2 { margin: 0 0 7px; color: var(--ui-text); font-size: .95rem; }
.portal-shell .portal-checkin-unavailable p { margin: 0; color: var(--ui-text-soft); font-size: .8rem; line-height: 1.55; }
.portal-shell .portal-checkin-emergency { padding: 11px 12px; border: 1px solid var(--ui-warning-border); border-radius: 10px; background: var(--ui-warning-soft); color: var(--ui-warning) !important; }
.portal-shell .portal-page--checkin > .portal-checkin-start,
.portal-shell .portal-page--checkin > .portal-checkin-complete,
.portal-shell .portal-page--checkin > .portal-state { width: min(100%, 620px); }
.portal-shell .portal-page--checkin > .portal-checkin-unavailable,
.portal-shell .portal-page--checkin > .portal-checkin-start,
.portal-shell .portal-page--checkin > .portal-checkin-complete { margin-block: auto; }
.portal-shell .portal-page--checkin.is-conversation > .portal-state { position: absolute; top: 50%; left: 50%; margin: 0; transform: translate(-50%, -50%); }
.portal-shell .portal-checkin-focus { width: 100%; height: auto; min-height: 0; flex: 1 1 auto; overflow: auto; overscroll-behavior: contain; }
.portal-shell .portal-checkin-focus .ay-intake-conversation { width: min(100%, 980px); min-height: 100%; margin: 0 auto; display: flex; flex-direction: column; gap: 16px; }
.portal-shell .portal-checkin-focus .ay-intake-transcript { width: min(100%, 780px); display: grid; align-content: start; gap: 14px; margin: 0 auto; padding: 0 2px 12px; }
.portal-shell .portal-checkin-focus .ay-intake-transcript > div { min-width: 0; }
.portal-shell .portal-checkin-focus .ay-intake-transcript .outgoing-message { width: fit-content; max-width: 80%; justify-self: end; align-self: auto; }
.portal-shell .portal-checkin-focus .ay-intake-transcript .outgoing-message .ay-intake-bubble { max-width: 100%; }
.portal-shell .portal-checkin-focus .ay-intake-bubble.is-assistant { justify-self: start; }
.portal-shell .portal-checkin-focus .ay-intake-response-composer { position: sticky; bottom: 0; z-index: 2; margin: 0 -2px; }
.portal-shell .portal-checkin-focus .ay-intake-response-composer { width: min(100%, 780px); display: block; margin-top: auto; margin-right: auto; margin-left: auto; padding: 8px 0 max(8px, env(safe-area-inset-bottom)); border: 0; background: transparent; }
.portal-shell .portal-checkin-focus .ay-intake-composer-shell { min-height: 56px; display: flex; align-items: center; gap: 4px; padding: 5px; border: 1px solid var(--ui-border-strong); border-radius: 22px; background: var(--ui-surface); }
.portal-shell .portal-checkin-focus .ay-intake-composer-shell:focus-within { border-color: var(--ui-accent-border); box-shadow: 0 0 0 3px var(--ui-accent-soft); }
.portal-shell .portal-checkin-focus .ay-intake-field { min-width: 0; min-height: 44px; max-height: 140px; flex: 1 1 auto; padding: 10px 8px; border: 0 !important; border-radius: 0; background: transparent !important; line-height: 1.4; box-shadow: none !important; resize: none; }
.portal-shell .portal-checkin-focus .ay-intake-field:disabled { color: var(--ui-muted); -webkit-text-fill-color: var(--ui-muted); cursor: not-allowed; opacity: 1; }
.portal-shell .portal-checkin-focus .ay-intake-action-slot { width: 40px; height: 40px; flex: 0 0 40px; align-self: center; display: grid; place-items: center; }
.portal-shell .portal-checkin-focus .ay-intake-composer-icon { width: 40px; height: 40px; display: grid; place-items: center; padding: 0; border: 0; border-radius: 50%; background: var(--ui-accent); color: var(--ui-on-accent); }
.portal-shell .portal-checkin-focus .ay-intake-composer-icon:disabled { background: var(--ui-surface-muted); color: var(--ui-muted); }
.portal-shell .portal-checkin-focus .ay-intake-composer-icon svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.portal-shell .portal-checkin-focus .ay-intake-typing { display: flex; align-items: center; gap: 5px; min-height: 42px; padding: 11px 14px; }
.portal-shell .portal-checkin-focus .typing-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; animation: portal-checkin-typing 900ms ease-in-out infinite; }
.portal-shell .portal-checkin-focus .typing-dot:nth-child(2) { animation-delay: 120ms; }
.portal-shell .portal-checkin-focus .typing-dot:nth-child(3) { animation-delay: 240ms; }
.portal-shell .ay-patient-conversation__mobile-return { display: none; }
.portal-shell .portal-checkin-attachment-request,
.portal-shell .portal-checkin-review { display: grid; gap: 10px; padding: 13px; border: 1px solid var(--ui-border); border-radius: 12px; background: var(--portal-subtle-surface); }
.portal-shell .portal-checkin-review { border-color: #c8dfcf; background: #edf8f0; }
.portal-shell .portal-checkin-review__actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.portal-shell .portal-checkin-restart-confirm { width: 100%; display: grid; gap: 9px; padding-top: 4px; border-top: 1px solid color-mix(in srgb, #5c8b68 24%, transparent); }
.portal-shell .portal-checkin-restart-confirm p { margin: 0; color: var(--ui-text-soft); font-size: .72rem; line-height: 1.45; }
.portal-shell .portal-checkin-restart-confirm > div { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 8px; }
html.clinical-ui.dark[data-theme-surface="patient-portal"] .portal-shell .portal-checkin-review { border-color: #294b35; background: #15251b; }
.portal-shell .portal-checkin-attachment-request strong,
.portal-shell .portal-checkin-review h2 { color: var(--ui-text); }
.portal-shell .portal-checkin-attachment-request p { margin: 0; color: var(--ui-text-soft); font-size: .76rem; line-height: 1.45; }
.portal-shell .portal-checkin-attachment-list { display: grid; gap: 6px; margin: 0; padding: 0; list-style: none; }
.portal-shell .portal-checkin-attachment-list li { display: flex; align-items: center; gap: 8px; padding: 9px 10px; border: 1px solid var(--ui-border); border-radius: 9px; background: var(--ui-surface); color: var(--ui-text-soft); font-size: .74rem; }
.portal-shell .portal-checkin-attachment-list li span:first-child { color: var(--ui-muted); font-size: .64rem; font-weight: 700; text-transform: uppercase; }
.portal-shell .portal-checkin-uploading { margin: 0; color: var(--ui-muted); font-size: .74rem; }
.portal-shell .portal-checkin-attach-wrap { position: relative; width: 40px; height: 40px; flex: 0 0 40px; align-self: center; }
.portal-shell .portal-checkin-attach-button { width: 40px; height: 40px; display: grid; place-items: center; padding: 0; border: 0; border-radius: 50%; background: transparent; color: var(--ui-accent); cursor: pointer; }
.portal-shell .portal-checkin-attach-button:not(:disabled):hover { background: var(--ui-accent-soft); }
.portal-shell .portal-checkin-attach-button:disabled { background: transparent; color: var(--ui-muted); opacity: .48; cursor: not-allowed; }
.portal-shell .portal-checkin-attach-button svg { width: 20px; height: 20px; }
.portal-shell .portal-checkin-attachment-input { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }

@media (max-width: 899px) {
  .portal-shell .portal-main--checkin { padding: 16px 12px calc(88px + env(safe-area-inset-bottom)); overflow: hidden; }
  .portal-shell .portal-page--checkin > .portal-view-header { display: none; }
  .portal-shell:has(.portal-checkin-focus) .portal-main { overflow: hidden; padding: 0; }
  .portal-shell .portal-checkin-focus { position: fixed; inset: 0 0 calc(76px + env(safe-area-inset-bottom)) 0; z-index: 90; display: block; padding: max(14px, env(safe-area-inset-top)) 12px 12px; background: var(--ui-canvas); }
  .portal-shell .portal-checkin-focus .ay-intake-conversation { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; height: 100%; }
  .portal-shell .portal-checkin-focus .ay-intake-transcript { min-height: 0; overflow-y: auto; padding: 0 2px 12px; }
  .portal-shell .portal-checkin-focus .ay-intake-transcript .outgoing-message { max-width: 92%; }
  .portal-shell .portal-checkin-focus .ay-intake-response-composer { position: static; margin: 0; }
  .portal-shell .ay-patient-conversation__mobile-return { display: flex; justify-content: flex-start; }
}

@keyframes portal-checkin-typing { 0%, 60%, 100% { transform: translateY(0); opacity: .45; } 30% { transform: translateY(-3px); opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  .portal-shell *, .portal-shell *::before, .portal-shell *::after { animation-duration: 1ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; transition-duration: 1ms !important; }
  .portal-shell .portal-wellness-metric__plot { animation-name: portal-spark-fade; animation-delay: 0ms !important; }
}

/* Portal refinement: calm cream surfaces, flat cards, and a clear records
   hierarchy. Wellness metric cards intentionally keep their color treatment. */
.portal-shell {
  --portal-card-shadow: none;
  --portal-card-surface: #f5f5f5;
  --portal-subtle-surface: #fffaf2;
  --portal-chrome-surface: #f5f5f5;
  background: #ffffff;
}
.portal-shell .portal-sidebar { background: var(--portal-chrome-surface); }
.portal-shell .portal-main,
.portal-shell .portal-dashboard,
.portal-shell .portal-workspace-main { background: #ffffff; }
.portal-shell .portal-card,
.portal-shell .portal-messages-card,
.portal-shell .portal-checkin-card,
.portal-shell .portal-history-card,
.portal-shell .portal-documents-card,
.portal-shell .portal-upload-card,
.portal-shell .portal-document-notices-card,
.portal-shell .portal-home-summary,
.portal-shell .portal-home-checkin,
.portal-shell .portal-home-messages { background: var(--portal-card-surface); box-shadow: none; }
.portal-shell .portal-message-composer,
.portal-shell .portal-billing,
.portal-shell .portal-privacy { background: var(--portal-subtle-surface); }
.portal-shell .ay-message-bubble,
.portal-shell .portal-wellness-metric { box-shadow: none; }
.portal-shell .portal-documents-grid { grid-template-columns: minmax(0, 2fr) minmax(240px, .85fr); }
.portal-shell .portal-documents-card { grid-column: 1; grid-row: 1; }
.portal-shell .portal-upload-card { grid-column: 1; grid-row: 2; }
.portal-shell .portal-document-notices-card { grid-column: 2; grid-row: 1 / span 2; }
@media (min-width: 1121px) {
  .portal-shell .portal-page--documents { height: 100%; grid-template-rows: auto minmax(0, 1fr); padding-bottom: 2px; }
  .portal-shell .portal-documents-grid { min-height: 0; height: 100%; grid-template-rows: repeat(2, minmax(0, 1fr)); align-items: stretch; }
  .portal-shell .portal-documents-card,
  .portal-shell .portal-upload-card,
  .portal-shell .portal-document-notices-card { min-height: 0; height: 100%; align-self: stretch; }
  .portal-shell .portal-documents-card .portal-card__body,
  .portal-shell .portal-upload-card .portal-card__body,
  .portal-shell .portal-document-notices-card .portal-card__body { overflow-y: auto; overscroll-behavior: contain; }
}
.portal-shell .portal-messages-card { position: relative; }
.portal-shell .portal-message-warning--top {
  position: absolute;
  top: 24px;
  right: 22px;
  z-index: 1;
  align-items: center;
  justify-content: center;
  width: auto;
  margin: 0 !important;
  padding: 5px 8px;
  border: 1px solid var(--ui-warning-border);
  border-radius: 999px;
  background: var(--ui-warning-soft);
  color: var(--ui-warning) !important;
  font-size: .62rem !important;
  font-weight: 680;
  letter-spacing: .03em;
  line-height: 1.2 !important;
  text-transform: uppercase;
  text-align: center;
}
.portal-shell .portal-message-warning--top:hover,
.portal-shell .portal-message-warning--top:focus-visible { background: var(--ui-warning-soft); color: var(--ui-warning) !important; }
.portal-shell .portal-message-composer { background: #f1f3f2; }
.portal-shell .portal-message-composer .portal-composer-footer .ay-button--primary:not(:disabled) {
  border-color: var(--ui-accent-fill);
  background: var(--ui-accent-fill);
  color: var(--ui-on-accent);
}
.portal-shell .portal-message-composer .portal-composer-footer .ay-button--primary:not(:disabled):hover {
  border-color: var(--ui-accent-fill-hover);
  background: var(--ui-accent-fill-hover);
  color: var(--ui-on-accent);
}
.portal-shell .portal-message-composer .portal-composer-footer .ay-button--primary:disabled {
  border-color: var(--ui-accent-fill);
  background: var(--ui-accent-fill);
  color: var(--ui-on-accent);
  opacity: .52;
}
.portal-shell .portal-message-composer .portal-composer-footer { justify-content: flex-end; }
.portal-shell .portal-message-composer .portal-composer-footer .portal-attachment-picker { margin-right: auto; }

html.clinical-ui.dark[data-theme-surface="patient-portal"] {
  --ui-canvas: #000000;
  --ui-surface: #121212;
  --ui-surface-soft: #181818;
  --ui-surface-muted: #202020;
  --ui-border: #2b2b2b;
  --ui-border-strong: #3b3b3b;
  background: #000000;
}
html.clinical-ui.dark[data-theme-surface="patient-portal"] body,
html.clinical-ui.dark[data-theme-surface="patient-portal"] .portal-shell,
html.clinical-ui.dark[data-theme-surface="patient-portal"] .portal-shell .portal-main,
html.clinical-ui.dark[data-theme-surface="patient-portal"] .portal-shell .portal-dashboard,
html.clinical-ui.dark[data-theme-surface="patient-portal"] .portal-shell .portal-workspace-main { background: #000000; }
html.clinical-ui.dark[data-theme-surface="patient-portal"] .portal-shell {
  --portal-card-surface: #121212;
  --portal-subtle-surface: #181818;
  --portal-chrome-surface: #0d1111;
  --portal-warm: #171717;
  --portal-lilac: #282033;
  --portal-mint: #17362d;
  --portal-peach: #3b2720;
  --portal-blue: #1b2f3b;
}
html.clinical-ui.dark[data-theme-surface="patient-portal"] .portal-shell .portal-wellness-metric--energy { --portal-metric-accent: #f08c73; }
html.clinical-ui.dark[data-theme-surface="patient-portal"] .portal-shell .portal-wellness-metric--sleep { --portal-metric-accent: #ac91ee; }
html.clinical-ui.dark[data-theme-surface="patient-portal"] .portal-shell .portal-wellness-metric--stress { --portal-metric-accent: #71caaa; }
html.clinical-ui.dark[data-theme-surface="patient-portal"] .portal-shell .portal-wellness-metric--weight { --portal-metric-accent: #80b5e8; }
html.clinical-ui.dark[data-theme-surface="patient-portal"] .portal-shell .portal-sidebar { background: var(--portal-chrome-surface); }
html.clinical-ui.dark[data-theme-surface="patient-portal"] .portal-shell .portal-message-composer { background: #1b1f20; }
html.clinical-ui.dark[data-theme-surface="patient-portal"] .portal-shell .portal-card,
html.clinical-ui.dark[data-theme-surface="patient-portal"] .portal-shell .portal-messages-card,
html.clinical-ui.dark[data-theme-surface="patient-portal"] .portal-shell .portal-checkin-card,
html.clinical-ui.dark[data-theme-surface="patient-portal"] .portal-shell .portal-history-card,
html.clinical-ui.dark[data-theme-surface="patient-portal"] .portal-shell .portal-documents-card,
html.clinical-ui.dark[data-theme-surface="patient-portal"] .portal-shell .portal-upload-card,
html.clinical-ui.dark[data-theme-surface="patient-portal"] .portal-shell .portal-document-notices-card,
html.clinical-ui.dark[data-theme-surface="patient-portal"] .portal-shell .portal-home-summary,
html.clinical-ui.dark[data-theme-surface="patient-portal"] .portal-shell .portal-home-checkin,
html.clinical-ui.dark[data-theme-surface="patient-portal"] .portal-shell .portal-home-messages { background: var(--portal-card-surface); box-shadow: none; }

@media (max-width: 899px) {
  .portal-shell .portal-message-warning--top { display: none; }
  .portal-shell .portal-documents-grid { grid-template-columns: minmax(0, 1fr); }
  .portal-shell .portal-documents-card,
  .portal-shell .portal-upload-card,
  .portal-shell .portal-document-notices-card { grid-column: auto; grid-row: auto; }
}
@media (max-width: 520px) {
  .portal-shell .portal-message-composer .portal-composer-footer { align-items: center; flex-direction: row; }
  .portal-shell .portal-message-composer .portal-composer-footer .ay-button { width: auto; flex: 0 0 auto; }
  .portal-shell .portal-message-composer .portal-composer-footer .portal-attachment-picker { width: auto; max-width: calc(100% - 112px); justify-content: flex-start; }
}

/* Portal form system and Account Settings hierarchy. The shared scale below
   keeps auth, dialogs, page forms, upload controls, and primary actions in one
   visual language while preserving intentional multiline field height. */
.portal-shell {
  --portal-control-height: 42px;
  --portal-control-radius: 10px;
  --portal-control-font: .78rem;
  --portal-label-font: .72rem;
  --portal-action-height: 40px;
  --portal-action-font: .72rem;
}
.portal-shell .ay-button {
  min-height: var(--portal-action-height);
  padding: 8px 13px;
  border-radius: 9px;
  font-size: var(--portal-action-font);
  line-height: 1.2;
}
.portal-shell .ay-button--primary:not(:disabled) {
  border-color: var(--ui-accent-fill);
  background: var(--ui-accent-fill);
  color: var(--ui-on-accent);
}
.portal-shell .ay-button--primary:not(:disabled):hover {
  border-color: var(--ui-accent-fill-hover);
  background: var(--ui-accent-fill-hover);
  color: var(--ui-on-accent);
}
.portal-shell .ay-button--danger { border-color: var(--ui-danger-border); background: transparent; color: var(--ui-danger); }
.portal-shell .ay-button--danger:hover { border-color: var(--ui-danger); background: var(--ui-danger); color: #fff; }
.portal-shell .ui-field { display: grid; gap: 7px; }
.portal-shell .ui-field__label,
.portal-shell .portal-composer > label:first-child,
.portal-shell .portal-message-composer > label:first-child,
.portal-shell .portal-upload-form > label,
.portal-shell .portal-upload-file-field > .ui-field__label {
  color: var(--ui-text-soft);
  font-size: var(--portal-label-font);
  font-weight: 680;
  line-height: 1.35;
}
.portal-shell :is(.ui-input, .ui-select) {
  width: 100%;
  min-height: var(--portal-control-height);
  padding: 9px 12px;
  border: 1px solid var(--ui-border-strong);
  border-radius: var(--portal-control-radius);
  background: var(--ui-surface);
  color: var(--ui-text);
  font-size: var(--portal-control-font);
  line-height: 1.4;
}
.portal-shell .ui-select {
  appearance: none;
  padding-right: 34px;
  background-image: linear-gradient(45deg, transparent 50%, #768187 50%), linear-gradient(135deg, #768187 50%, transparent 50%);
  background-position: calc(100% - 16px) 17px, calc(100% - 11px) 17px;
  background-repeat: no-repeat;
  background-size: 5px 5px, 5px 5px;
}
.portal-shell textarea.ui-input { min-height: 96px; resize: vertical; }
.portal-shell :is(.ui-input, .ui-select):hover { border-color: var(--ui-accent-border); }
.portal-shell :is(.ui-input, .ui-select):read-only {
  border-color: var(--ui-border);
  background: var(--ui-surface-muted);
  color: var(--ui-text-soft);
  cursor: default;
}
.portal-shell :is(.ui-input, .ui-select)::placeholder { color: var(--ui-muted); opacity: .86; }
.portal-shell .portal-attachment-picker {
  min-height: var(--portal-action-height);
  padding: 8px 13px !important;
  border-radius: 9px;
  font-size: var(--portal-action-font) !important;
}
.portal-shell .portal-upload-file-row { min-height: var(--portal-control-height); }
.portal-shell .portal-upload-choose,
.portal-shell .portal-upload-submit { min-height: var(--portal-control-height); }
.portal-shell .portal-dialog .ui-input,
html[data-theme-surface="patient-portal"] .portal-auth-flow .ui-input,
.portal-shell .portal-settings-grid :is(.ui-input, .ui-select) {
  min-height: var(--portal-control-height);
  padding: 9px 12px;
  border-radius: var(--portal-control-radius);
  font-size: var(--portal-control-font);
}
.portal-shell .portal-message-composer .ui-input,
.portal-shell .portal-composer .ui-input,
.portal-shell .portal-checkin-answer .ui-input {
  min-height: 96px;
  font-size: .82rem;
}

.portal-shell .portal-page--settings { max-width: var(--portal-content-width); }
.portal-shell .portal-settings-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 18px;
  align-items: start;
}
.portal-shell .portal-settings-card { height: 100%; display: flex; flex-direction: column; }
.portal-shell .portal-settings-card--account { grid-column: 1 / -1; }
.portal-shell .portal-settings-card--notifications,
.portal-shell .portal-settings-card--security,
.portal-shell .portal-settings-card--billing,
.portal-shell .portal-settings-card--privacy { grid-column: span 6; }
.portal-shell .portal-settings-form { display: grid; gap: 20px; }
.portal-shell .portal-settings-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 15px 16px; }
.portal-shell .portal-settings-field--wide { grid-column: 1 / -1; }
.portal-shell .portal-settings-readonly {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 13px 16px;
  padding-top: 18px;
  border-top: 1px solid var(--ui-border);
}
.portal-shell .portal-settings-readonly > p { grid-column: 1 / -1; display: grid; gap: 3px; margin: 0; }
.portal-shell .portal-settings-readonly > p strong { color: var(--ui-text); font-size: .76rem; }
.portal-shell .portal-settings-readonly > p span { color: var(--ui-muted); font-size: .7rem; line-height: 1.45; }
.portal-shell .portal-settings-footer-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  padding-top: 16px;
  border-top: 1px solid var(--ui-border);
}
.portal-shell .portal-settings-footer-actions > span { color: var(--ui-muted); font-size: .68rem; line-height: 1.45; }
.portal-shell .portal-settings-footer-actions--end { justify-content: flex-end; margin-top: auto; }
.portal-shell .portal-preference-list { height: 100%; display: flex; flex-direction: column; gap: 16px; }
.portal-shell .portal-preference-options { display: grid; gap: 0; }
.portal-shell .portal-preference-options label {
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 11px 2px;
  border: 0;
  border-bottom: 1px solid var(--ui-border);
  border-radius: 0;
  background: transparent;
  color: var(--ui-text-soft);
}
.portal-shell .portal-preference-options label:first-child { padding-top: 2px; }
.portal-shell .portal-preference-options label > span { display: grid; gap: 3px; }
.portal-shell .portal-preference-options strong { color: var(--ui-text); font-size: .76rem; }
.portal-shell .portal-preference-options small { color: var(--ui-muted); font-size: .68rem; line-height: 1.4; }
.portal-shell .portal-preference-options input {
  width: 19px;
  height: 19px;
  flex: 0 0 19px;
  margin: 0;
  accent-color: var(--ui-accent-fill);
}
.portal-shell .portal-security-status {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 13px;
  border-radius: 11px;
  background: var(--ui-surface-muted);
}
.portal-shell .portal-security-status > span { width: 9px; height: 9px; flex: 0 0 9px; margin-top: 5px; border-radius: 50%; background: var(--ui-warning); }
.portal-shell .portal-security-status.is-enabled > span { background: var(--ui-success); }
.portal-shell .portal-security-status strong { color: var(--ui-text); font-size: .76rem; }
.portal-shell .portal-security-status p { margin: 3px 0 0; color: var(--ui-muted); font-size: .68rem; line-height: 1.45; }
.portal-shell .portal-settings-action-list { display: grid; gap: 0; margin-top: 12px; }
.portal-shell .portal-settings-action-row {
  min-height: 64px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  padding: 11px 0;
  border-bottom: 1px solid var(--ui-border);
}
.portal-shell .portal-settings-action-row:last-child { border-bottom: 0; padding-bottom: 0; }
.portal-shell .portal-settings-action-row > div { display: grid; gap: 3px; }
.portal-shell .portal-settings-action-row strong { color: var(--ui-text); font-size: .75rem; }
.portal-shell .portal-settings-action-row span { color: var(--ui-muted); font-size: .68rem; line-height: 1.4; }
.portal-shell .portal-billing,
.portal-shell .portal-privacy { min-height: 0; display: flex; flex-direction: column; gap: 14px; padding: 0; border: 0; border-radius: 0; background: transparent; }
.portal-shell .portal-settings-summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 13px; border-radius: 11px; background: var(--ui-surface-muted); }
.portal-shell .portal-settings-summary span { color: var(--ui-muted); font-size: .68rem; }
.portal-shell .portal-settings-summary strong { color: var(--ui-text); font-size: .78rem; }
.portal-shell .portal-billing-details { display: grid; gap: 6px; }
.portal-shell .portal-billing-details p { display: flex; justify-content: space-between; gap: 12px; padding-bottom: 7px; border-bottom: 1px solid var(--ui-border); }
.portal-shell .portal-billing-details strong { color: var(--ui-text); font-weight: 680; }
.portal-shell .portal-privacy { justify-content: space-between; }
.portal-shell .portal-privacy > p { max-width: 68ch; font-size: .75rem; }
.portal-shell .portal-settings-links { display: flex; flex-wrap: wrap; gap: 8px; padding-top: 14px; border-top: 1px solid var(--ui-border); }
.portal-shell .portal-settings-links a { min-height: var(--portal-action-height); display: inline-flex; align-items: center; justify-content: center; padding: 8px 12px; border: 1px solid var(--ui-border-strong); border-radius: 9px; background: var(--ui-surface); color: var(--ui-text-soft); font-size: var(--portal-action-font); font-weight: 630; text-decoration: none; }
.portal-shell .portal-settings-links a:hover { border-color: var(--ui-accent-border); background: var(--ui-accent-soft); color: var(--ui-accent); }

html.clinical-ui.dark[data-theme-surface="patient-portal"] .portal-shell :is(.ui-input, .ui-select):read-only { background: #1b1b1b; }

@media (max-width: 1120px) {
  .portal-shell .portal-settings-card--notifications,
  .portal-shell .portal-settings-card--security,
  .portal-shell .portal-settings-card--billing,
  .portal-shell .portal-settings-card--privacy { grid-column: 1 / -1; }
}
@media (max-width: 899px) {
  .portal-shell { --portal-control-height: 44px; --portal-action-height: 44px; --portal-action-font: .76rem; }
  .portal-shell .portal-settings-grid :is(.ui-input, .ui-select),
  .portal-shell :is(.ui-input, .ui-select),
  .portal-shell .portal-dialog .ui-input,
  html[data-theme-surface="patient-portal"] .portal-auth-flow .ui-input,
  .portal-shell .portal-message-composer .ui-input,
  .portal-shell .portal-composer .ui-input,
  .portal-shell .portal-checkin-answer .ui-input {
    width: 100%;
    min-height: var(--portal-control-height);
    font-size: 16px;
    font-size-adjust: .44;
  }
  .portal-shell .portal-message-field-frame { min-height: 96px; overflow: hidden; }
  .portal-shell .portal-message-field-frame .ui-input {
    display: block;
    width: 100%;
    min-height: 96px;
    margin: 0;
    resize: none;
  }
  .portal-shell .portal-message-composer .portal-attachment-picker--icon {
    width: var(--portal-action-height);
    max-width: none;
    flex: 0 0 var(--portal-action-height);
    justify-content: center;
  }
  html.clinical-ui:not(.dark)[data-theme-surface="patient-portal"] .portal-shell .portal-upload-category .ui-select { background-color: #ffffff; }
  .portal-shell textarea.ui-input,
  .portal-shell .portal-message-composer .ui-input,
  .portal-shell .portal-composer .ui-input,
  .portal-shell .portal-checkin-answer .ui-input { min-height: 96px; }
  .portal-shell .portal-checkin-focus .ay-intake-field {
    width: 100%;
    min-height: var(--portal-control-height);
    max-height: 160px;
    font-size: 16px;
    font-size-adjust: .44;
  }
  .portal-shell .portal-settings-grid { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  .portal-shell .portal-settings-card--account,
  .portal-shell .portal-settings-card--notifications,
  .portal-shell .portal-settings-card--security,
  .portal-shell .portal-settings-card--billing,
  .portal-shell .portal-settings-card--privacy { grid-column: 1; }
}
@media (max-width: 620px) {
  .portal-shell .portal-settings-fields,
  .portal-shell .portal-settings-readonly { grid-template-columns: minmax(0, 1fr); }
  .portal-shell .portal-settings-field--wide,
  .portal-shell .portal-settings-readonly > p { grid-column: 1; }
  .portal-shell .portal-settings-action-row { grid-template-columns: minmax(0, 1fr); align-items: stretch; gap: 9px; }
  .portal-shell .portal-settings-action-row .ay-button { width: 100%; }
  .portal-shell .portal-settings-footer-actions { align-items: stretch; flex-direction: column; }
  .portal-shell .portal-settings-footer-actions .ay-button { width: 100%; }
  .portal-shell .portal-settings-footer-actions--end { justify-content: stretch; }
  .portal-shell .portal-settings-links { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Portal card system. Context headers use a restrained, content-coded pastel;
   readable content stays on white and action footers remain quiet gray.
   Purposefully colored wellness cards remain independent of PortalCard. */
.portal-shell {
  --portal-neutral-chrome: #f5f5f5;
  --portal-neutral-body: #ffffff;
  --portal-header-green: #e8f4eb;
  --portal-header-blue: #e8f1fb;
  --portal-header-red: #f9e9e9;
  --portal-header-purple: #f1eafb;
  --portal-section-radius: 22px;
  --portal-card-radius: var(--portal-section-radius);
}
.portal-shell .portal-card {
  position: relative;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
  border-radius: var(--portal-section-radius);
  background: var(--portal-neutral-body);
  box-shadow: none;
}
.portal-shell .portal-card > .ay-clinical-card__header {
  flex: 0 0 auto;
  margin: 0;
  padding: 18px 20px;
  border-bottom: 1px solid var(--ui-border);
  background: var(--portal-neutral-chrome);
}
.portal-shell .portal-home-summary > .ay-clinical-card__header,
.portal-shell .portal-documents-card > .ay-clinical-card__header {
  background: var(--portal-header-green);
}
.portal-shell .portal-home-checkin > .ay-clinical-card__header,
.portal-shell .portal-upload-card > .ay-clinical-card__header {
  background: var(--portal-header-blue);
}
.portal-shell .portal-document-notices-card > .ay-clinical-card__header {
  background: var(--portal-header-red);
}
.portal-shell .portal-history-card > .ay-clinical-card__header {
  background: var(--portal-header-purple);
}
.portal-shell :is(.portal-home-messages, .portal-messages-card) > .ay-clinical-card__header {
  background: var(--portal-neutral-chrome);
}
.portal-shell .portal-settings-card > .ay-clinical-card__header {
  background: var(--portal-neutral-chrome);
}
.portal-shell .portal-card__body {
  min-height: 0;
  flex: 1 1 auto;
  padding: 20px;
  background: var(--portal-neutral-body);
}
.portal-shell .portal-card__footer {
  min-height: 64px;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px;
  padding: 12px 20px;
  border-top: 1px solid var(--ui-border);
  background: var(--portal-neutral-chrome);
}
.portal-shell .portal-card__footer-note {
  margin-right: auto;
  color: var(--ui-muted);
  font-size: .68rem;
  line-height: 1.45;
}

/* Home: a balanced first row and a clearer primary check-in action. */
.portal-shell .portal-home-grid { align-items: stretch; }
.portal-shell .portal-home-summary,
.portal-shell .portal-home-checkin {
  height: 100%;
  grid-row: auto;
  align-self: stretch;
}
.portal-shell .portal-home-messages .portal-card__footer { justify-content: flex-start; }
.portal-shell .portal-message-preview:last-child { border-bottom: 0; }
.portal-shell .portal-next-task {
  min-height: 100%;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
}
.portal-shell .portal-next-task > .ay-button {
  grid-column: 3;
  grid-row: 1;
  align-self: center;
  justify-self: end;
  min-height: 46px;
  margin: 0;
  padding: 10px 18px;
  border-radius: 11px;
  font-size: .76rem;
  font-weight: 720;
}
.portal-shell .portal-next-task h3 { margin-top: 0; font-size: .9rem; }
.portal-shell .portal-next-task time { margin-top: 8px; font-size: .72rem; }

/* Long-form portal pages keep their collections in the white body and their
   controls in the shared gray footer. */
.portal-shell .portal-messages-card .portal-card__body,
.portal-shell .portal-history-card .portal-card__body,
.portal-shell .portal-settings-card .portal-card__body {
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.portal-shell .portal-messages-card > .ay-clinical-card__header { padding-right: 250px; }
.portal-shell .portal-messages-card .portal-card__footer {
  display: block;
  min-height: 0;
  padding: 16px 20px;
}
.portal-shell .portal-messages-card .portal-message-composer {
  margin: 0 !important;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}
.portal-shell .portal-history-card .portal-assessment-list { min-height: 0; }
.portal-shell .portal-settings-card .portal-card__footer .portal-settings-links {
  padding: 0;
  border-top: 0;
}
.portal-shell .portal-settings-card--notifications .portal-card__body,
.portal-shell .portal-settings-card--notifications .portal-preference-list { height: 100%; }

/* Scheduled check-in guidance uses the same chrome/body/action hierarchy even
   though the active conversation intentionally remains borderless. */
.portal-shell .portal-checkin-unavailable {
  width: min(100%, 620px);
  display: block;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--ui-border);
  border-radius: var(--portal-section-radius);
  background: var(--portal-neutral-body);
}
.portal-shell .portal-checkin-unavailable__header {
  padding: 18px 20px;
  border-bottom: 1px solid var(--ui-border);
  background: var(--portal-neutral-chrome);
}
.portal-shell .portal-checkin-unavailable__header h2 { margin: 0; }
.portal-shell .portal-checkin-unavailable__body {
  display: grid;
  gap: 12px;
  padding: 20px;
  background: var(--portal-neutral-body);
}
.portal-shell .portal-checkin-unavailable__footer {
  display: flex;
  justify-content: flex-end;
  padding: 12px 20px;
  border-top: 1px solid var(--ui-border);
  background: var(--portal-neutral-chrome);
}

html.clinical-ui.dark[data-theme-surface="patient-portal"] .portal-shell {
  --portal-neutral-chrome: #181818;
  --portal-neutral-body: #080909;
  --portal-header-green: #17281d;
  --portal-header-blue: #172635;
  --portal-header-red: #301c20;
  --portal-header-purple: #271e34;
}

@media (max-width: 899px) {
  .portal-shell .portal-messages-card > .ay-clinical-card__header { padding-right: 20px; }
}
@media (max-width: 620px) {
  .portal-shell { --portal-section-radius: 18px; }
  .portal-shell .portal-card > .ay-clinical-card__header,
  .portal-shell .portal-card__body { padding: 16px; }
  .portal-shell .portal-card__footer { min-height: 60px; padding: 10px 16px; }
  .portal-shell .portal-card__footer-note { width: 100%; margin-right: 0; }
  .portal-shell .portal-next-task { grid-template-columns: 34px minmax(0, 1fr); align-items: start; gap: 12px; }
  .portal-shell .portal-next-task > .ay-button {
    width: 100%;
    grid-column: 1 / -1;
    grid-row: auto;
    justify-content: center;
    margin-top: 2px;
  }
  .portal-shell .portal-checkin-unavailable__header,
  .portal-shell .portal-checkin-unavailable__body { padding: 16px; }
  .portal-shell .portal-checkin-unavailable__footer { padding: 10px 16px; }
  .portal-shell .portal-checkin-unavailable__footer .ay-button { width: 100%; }
}

/* Light portal shell: white navigation chrome around a quiet reading canvas.
   Dark mode retains its independently composed palette above. */
html.clinical-ui:not(.dark)[data-theme-surface="patient-portal"],
html.clinical-ui:not(.dark)[data-theme-surface="patient-portal"] body {
  background: #fcfcfc;
}
html.clinical-ui:not(.dark)[data-theme-surface="patient-portal"] .portal-shell {
  --portal-chrome-surface: #ffffff;
  --portal-chrome-foreground: #152a2f;
  --portal-chrome-muted: #52676c;
  --portal-chrome-divider: #d7e0e2;
  --portal-chrome-hover: #f2f7f7;
  --portal-chrome-selected: #e2f2f3;
  --portal-chrome-selected-text: #00515d;
  --portal-page-background: #fcfcfc;
  background: var(--portal-page-background);
}
html.clinical-ui:not(.dark)[data-theme-surface="patient-portal"] .portal-shell .portal-main,
html.clinical-ui:not(.dark)[data-theme-surface="patient-portal"] .portal-shell .portal-dashboard,
html.clinical-ui:not(.dark)[data-theme-surface="patient-portal"] .portal-shell .portal-workspace-main {
  background: var(--portal-page-background);
}
html.clinical-ui:not(.dark)[data-theme-surface="patient-portal"] .portal-shell .portal-sidebar,
html.clinical-ui:not(.dark)[data-theme-surface="patient-portal"] .portal-shell .portal-mobile-nav {
  border-color: #e0e7e8;
  background: var(--portal-chrome-surface);
}
html.clinical-ui:not(.dark)[data-theme-surface="patient-portal"] .portal-shell .portal-rail-brand__mark {
  border-color: #a8cfd3;
  background: #e9f5f6;
  color: #005965;
}
html.clinical-ui:not(.dark)[data-theme-surface="patient-portal"] .portal-shell .portal-rail-button,
html.clinical-ui:not(.dark)[data-theme-surface="patient-portal"] .portal-shell .portal-mobile-nav__item {
  color: var(--portal-chrome-muted);
}
html.clinical-ui:not(.dark)[data-theme-surface="patient-portal"] .portal-shell .portal-rail-button:hover,
html.clinical-ui:not(.dark)[data-theme-surface="patient-portal"] .portal-shell .portal-mobile-nav__item:hover {
  border-color: #b8d2d5;
  background: var(--portal-chrome-hover);
  color: var(--portal-chrome-foreground);
}
html.clinical-ui:not(.dark)[data-theme-surface="patient-portal"] .portal-shell .portal-rail-button.is-selected,
html.clinical-ui:not(.dark)[data-theme-surface="patient-portal"] .portal-shell .portal-mobile-nav__item.is-selected {
  border-color: #9fcbd0;
  background: var(--portal-chrome-selected);
  color: var(--portal-chrome-selected-text);
}
html.clinical-ui:not(.dark)[data-theme-surface="patient-portal"] .portal-shell .portal-rail-button.is-selected:hover,
html.clinical-ui:not(.dark)[data-theme-surface="patient-portal"] .portal-shell .portal-mobile-nav__item.is-selected:hover {
  background: #d6eaec;
  color: var(--portal-chrome-selected-text);
}
html.clinical-ui:not(.dark)[data-theme-surface="patient-portal"] .portal-shell .portal-rail-button b,
html.clinical-ui:not(.dark)[data-theme-surface="patient-portal"] .portal-shell .portal-mobile-nav__item b {
  border-color: #ffffff;
  background: #7cdde3;
  color: #002c34;
}
html.clinical-ui:not(.dark)[data-theme-surface="patient-portal"] .portal-shell .portal-account-button,
html.clinical-ui:not(.dark)[data-theme-surface="patient-portal"] .portal-shell .portal-mobile-account-button .portal-account-initials {
  border: 1px solid #a8cfd3;
  background: #e9f5f6;
  color: #00343c;
}
html.clinical-ui:not(.dark)[data-theme-surface="patient-portal"] .portal-shell .portal-account-button:hover,
html.clinical-ui:not(.dark)[data-theme-surface="patient-portal"] .portal-shell .portal-account-button.is-selected,
html.clinical-ui:not(.dark)[data-theme-surface="patient-portal"] .portal-shell .portal-mobile-account-button:hover .portal-account-initials,
html.clinical-ui:not(.dark)[data-theme-surface="patient-portal"] .portal-shell .portal-mobile-account-button.is-selected .portal-account-initials {
  box-shadow: 0 0 0 3px rgba(124, 221, 227, .26);
}
html.clinical-ui:not(.dark)[data-theme-surface="patient-portal"] .portal-shell :is(.portal-rail-button, .portal-mobile-nav__item, .portal-account-button):focus-visible {
  box-shadow: 0 0 0 3px rgba(124, 221, 227, .38);
}

/* ==========================================================================
   Scribe (html[data-theme-surface="scribe"]) — the clinician's phone recorder.
   Mobile-first Operate surface built only from the canonical --ui-* tokens,
   so light/dark and clinic branding follow automatically. Motion: one short
   entrance per screen (220ms, --ui-ease-out), press feedback on controls, a
   drawer-curve sheet, and the live-recording pulse as the only continuous
   motion (it carries state). Everything stills under prefers-reduced-motion.
   ========================================================================== */
html[data-theme-surface="scribe"] { --scribe-tabbar-height: 64px; --scribe-gutter: 16px; }
html[data-theme-surface="scribe"] ::selection { background: var(--ui-accent-soft); color: var(--ui-text); }
html[data-theme-surface="scribe"] body { caret-color: var(--ui-accent); -webkit-tap-highlight-color: transparent; }
html[data-theme-surface="scribe"] svg.lucide { width: 20px; height: 20px; stroke-width: 1.75; flex: none; }

/* Shell: fixed masthead, one scrolling content area, fixed bottom tab bar.
   Signed in, the page itself never scrolls, so iOS rubber-banding can't move the
   masthead or tab bar; only .ay-workspace-main scrolls, and its bounce stays inside
   it (overscroll-behavior: contain). The sign-in page keeps normal page scrolling. */
html[data-theme-surface="scribe"]:has(.ay-shell--workspace), html[data-theme-surface="scribe"]:has(.ay-shell--workspace) body { height: 100%; overflow: hidden; overscroll-behavior: none; }
html[data-theme-surface="scribe"] .ay-shell--workspace { display: flex; flex-direction: column; height: 100dvh; min-height: 0; overflow: hidden; background: var(--ui-canvas); }
html[data-theme-surface="scribe"] .ay-workspace-masthead { position: relative; flex: none; z-index: 30; padding-top: env(safe-area-inset-top); border-bottom: 1px solid var(--ui-border); background: color-mix(in srgb, var(--ui-surface) 92%, transparent); backdrop-filter: saturate(1.4) blur(12px); -webkit-backdrop-filter: saturate(1.4) blur(12px); }
html[data-theme-surface="scribe"] .dashboard-masthead-inner { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: min(100%, 640px); min-height: 52px; margin: 0 auto; padding: 0 var(--scribe-gutter); }
html[data-theme-surface="scribe"] .dashboard-brand-lockup { display: inline-flex; align-items: center; gap: 10px; min-width: 0; color: var(--ui-text); text-decoration: none; }
html[data-theme-surface="scribe"] .dashboard-brand-mark { display: grid; place-items: center; width: 30px; height: 30px; overflow: hidden; border-radius: var(--ui-radius-sm); background: var(--ui-accent-fill); color: var(--ui-on-accent); font-size: .78rem; font-weight: 700; }
html[data-theme-surface="scribe"] .dashboard-brand-mark img { width: 100%; height: 100%; object-fit: contain; }
html[data-theme-surface="scribe"] .dashboard-brand-mark.ay-brand__mark--logo { background: transparent; }
html[data-theme-surface="scribe"] .dashboard-brand-primary { font-size: .86rem; font-weight: 700; white-space: nowrap; }
html[data-theme-surface="scribe"] .dashboard-masthead .ay-workspace-divider { display: inline; color: var(--ui-border-strong); font-size: .86rem; }
html[data-theme-surface="scribe"] .dashboard-masthead .ay-workspace-section { display: inline; color: var(--ui-muted); font-size: .82rem; font-weight: 600; }
html[data-theme-surface="scribe"] .ay-workspace-main { display: block; flex: 1 1 auto; min-height: 0; width: 100%; margin: 0; overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; padding: 20px max(var(--scribe-gutter), calc((100% - 640px) / 2)) calc(var(--scribe-tabbar-height) + env(safe-area-inset-bottom) + 28px); }
/* backwards fill: once the entrance ends no transform remains, so fixed sheets inside stay viewport-anchored. */
html[data-theme-surface="scribe"] .scribe-screen { animation: scribe-enter 220ms var(--ui-ease-out) backwards; }
@keyframes scribe-enter { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

html[data-theme-surface="scribe"] .scribe-tabbar { position: fixed; inset: auto 0 0; z-index: 40; display: grid; grid-template-columns: 1fr 1fr; height: calc(var(--scribe-tabbar-height) + env(safe-area-inset-bottom)); padding: 0 max(var(--scribe-gutter), env(safe-area-inset-left)) env(safe-area-inset-bottom) max(var(--scribe-gutter), env(safe-area-inset-right)); border-top: 1px solid var(--ui-border); background: color-mix(in srgb, var(--ui-surface) 94%, transparent); backdrop-filter: saturate(1.4) blur(14px); -webkit-backdrop-filter: saturate(1.4) blur(14px); }
html[data-theme-surface="scribe"] .scribe-tab { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-height: 44px; border: 0; background: transparent; color: var(--ui-muted); font: inherit; font-size: .66rem; font-weight: 650; cursor: pointer; transition: color var(--ui-duration-fast) ease, transform 120ms var(--ui-ease-out); }
html[data-theme-surface="scribe"] .scribe-tab svg.lucide { width: 22px; height: 22px; }
html[data-theme-surface="scribe"] .scribe-tab[aria-current="page"] { color: var(--ui-accent); }
html[data-theme-surface="scribe"] .scribe-tab:active { transform: scale(.94); }
html[data-theme-surface="scribe"] .scribe-tab:focus-visible { outline: 2px solid var(--ui-accent); outline-offset: -4px; border-radius: var(--ui-radius); }

/* Page scaffolding. */
html[data-theme-surface="scribe"] .scribe-screen,
html[data-theme-surface="scribe"] .scribe-page { width: 100%; min-width: 0; }
html[data-theme-surface="scribe"] .scribe-page { display: grid; gap: 16px; }
html[data-theme-surface="scribe"] .scribe-page__header { display: grid; gap: 4px; margin: 4px 0 4px; }
html[data-theme-surface="scribe"] .scribe-page__header h2 { margin: 0; font-size: 1.5rem; line-height: 1.15; letter-spacing: -.02em; text-wrap: balance; }
html[data-theme-surface="scribe"] .scribe-page__header p { margin: 0; color: var(--ui-text-soft); font-size: .86rem; }
html[data-theme-surface="scribe"] .scribe-card { display: grid; gap: 12px; padding: 16px; border: 1px solid var(--ui-border); border-radius: var(--ui-radius-lg); background: var(--ui-surface); box-shadow: var(--ui-shadow-card); }
html[data-theme-surface="scribe"] .scribe-card__help { margin: 0; color: var(--ui-text-soft); font-size: .8rem; line-height: 1.5; }
html[data-theme-surface="scribe"] .scribe-card__footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
html[data-theme-surface="scribe"] .scribe-actions { display: grid; gap: 10px; }
html[data-theme-surface="scribe"] .scribe-button--wide { display: inline-flex; align-items: center; justify-content: center; gap: 8px; width: 100%; min-height: 50px; font-size: .9rem; }
html[data-theme-surface="scribe"] .ay-button { transition: background-color var(--ui-duration-fast) ease, border-color var(--ui-duration-fast) ease, color var(--ui-duration-fast) ease, transform 120ms var(--ui-ease-out); }
html[data-theme-surface="scribe"] .ay-button:active:not(:disabled) { transform: scale(.97); }
html[data-theme-surface="scribe"] .scribe-back { display: inline-flex; align-items: center; gap: 2px; justify-self: start; min-height: 44px; margin: -8px 0 -8px -8px; padding: 0 8px; border: 0; background: transparent; color: var(--ui-accent); font: inherit; font-size: .84rem; font-weight: 650; cursor: pointer; }
html[data-theme-surface="scribe"] .scribe-text-button { min-height: 44px; padding: 0 10px; border: 0; background: transparent; color: var(--ui-accent); font: inherit; font-size: .82rem; font-weight: 650; cursor: pointer; }
html[data-theme-surface="scribe"] .scribe-text-button--danger { color: var(--ui-danger); }
html[data-theme-surface="scribe"] .scribe-icon-button { display: grid; place-items: center; width: 44px; height: 44px; flex: none; border: 1px solid var(--ui-border); border-radius: var(--ui-radius); background: var(--ui-surface); color: var(--ui-text-soft); cursor: pointer; transition: background-color var(--ui-duration-fast) ease, transform 120ms var(--ui-ease-out); }
html[data-theme-surface="scribe"] .scribe-icon-button:active:not(:disabled) { transform: scale(.94); background: var(--ui-accent-soft); }
html[data-theme-surface="scribe"] .scribe-icon-button .is-spinning { animation: scribe-spin .7s linear infinite; }
@keyframes scribe-spin { to { transform: rotate(360deg); } }

/* Notices. */
html[data-theme-surface="scribe"] .scribe-notice { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; margin: 0; padding: 12px 14px; border: 1px solid var(--ui-border); border-radius: var(--ui-radius); background: var(--ui-surface-soft); color: var(--ui-text-soft); font-size: .8rem; line-height: 1.45; }
html[data-theme-surface="scribe"] .scribe-notice p { flex: 1 1 200px; margin: 0; }
html[data-theme-surface="scribe"] .scribe-notice > svg.lucide { width: 18px; height: 18px; }
html[data-theme-surface="scribe"] .scribe-notice > svg.lucide + span { flex: 1 1 0; min-width: 0; }
html[data-theme-surface="scribe"] .scribe-notice--error { border-color: var(--ui-danger-border); background: var(--ui-danger-soft); color: var(--ui-danger); }
html[data-theme-surface="scribe"] .scribe-notice--warning { border-color: var(--ui-warning-border); background: var(--ui-warning-soft); color: var(--ui-warning); }

/* Patient picker. */
html[data-theme-surface="scribe"] .scribe-search { position: relative; display: flex; align-items: center; gap: 8px; }
html[data-theme-surface="scribe"] .scribe-search__icon { position: absolute; left: 13px; color: var(--ui-muted); pointer-events: none; }
html[data-theme-surface="scribe"] .scribe-search__input { flex: 1; min-width: 0; min-height: 44px; padding-left: 40px; border-radius: var(--ui-radius); font-size: 16px; }
html[data-theme-surface="scribe"] .scribe-search__input::-webkit-search-cancel-button { -webkit-appearance: none; }
html[data-theme-surface="scribe"] .scribe-list { display: grid; margin: 0; padding: 0; overflow: hidden; list-style: none; border: 1px solid var(--ui-border); border-radius: var(--ui-radius-lg); background: var(--ui-surface); box-shadow: var(--ui-shadow-card); }
html[data-theme-surface="scribe"] .scribe-list > li + li { border-top: 1px solid var(--ui-border); }
html[data-theme-surface="scribe"] .scribe-patient { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; grid-template-areas: "name time chevron" "meta meta chevron"; align-items: center; gap: 5px 10px; width: 100%; min-height: 64px; padding: 12px 12px 12px 16px; border: 0; background: transparent; color: var(--ui-text); font: inherit; text-align: left; cursor: pointer; transition: background-color var(--ui-duration-fast) ease; }
html[data-theme-surface="scribe"] .scribe-patient:active { background: var(--ui-accent-soft); }
html[data-theme-surface="scribe"] .scribe-patient:focus-visible { outline: 2px solid var(--ui-accent); outline-offset: -2px; }
html[data-theme-surface="scribe"] .scribe-patient > .scribe-patient__name { grid-area: name; }
html[data-theme-surface="scribe"] .scribe-patient > .scribe-patient__meta { grid-area: meta; }
html[data-theme-surface="scribe"] .scribe-patient > .scribe-patient__time { grid-area: time; }
html[data-theme-surface="scribe"] .scribe-patient > .scribe-patient__chevron { grid-area: chevron; }
html[data-theme-surface="scribe"] .scribe-patient__name { display: flex; align-items: center; gap: 6px; min-width: 0; font-size: .94rem; font-weight: 650; }
html[data-theme-surface="scribe"] .scribe-patient__name-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Seen marker: a recording was sent for this chart (light green row, check), or its note failed (amber). */
html[data-theme-surface="scribe"] .scribe-patient--recorded { background: var(--ui-success-soft); }
html[data-theme-surface="scribe"] .scribe-patient--failed { background: var(--ui-warning-soft); }
html[data-theme-surface="scribe"] svg.lucide.scribe-patient__status { width: 16px; height: 16px; stroke-width: 2; }
html[data-theme-surface="scribe"] .scribe-patient--recorded .scribe-patient__status { color: var(--ui-success); }
html[data-theme-surface="scribe"] .scribe-patient--failed .scribe-patient__status { color: var(--ui-warning); }
html[data-theme-surface="scribe"] .scribe-patient__meta { display: flex; align-items: center; gap: 8px; min-width: 0; }
html[data-theme-surface="scribe"] .scribe-patient__reason { overflow: hidden; color: var(--ui-text-soft); font-size: .78rem; text-overflow: ellipsis; white-space: nowrap; }
html[data-theme-surface="scribe"] .scribe-patient__time { color: var(--ui-muted); font-size: .72rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
html[data-theme-surface="scribe"] .scribe-patient__chevron { color: var(--ui-border-strong); }
html[data-theme-surface="scribe"] .scribe-badge { display: inline-flex; align-items: center; flex: none; min-height: 20px; padding: 0 8px; border: 1px solid var(--ui-info-border); border-radius: 999px; background: var(--ui-info-soft); color: var(--ui-info); font-size: .66rem; font-weight: 700; letter-spacing: .01em; }
html[data-theme-surface="scribe"] .scribe-badge--clinic { border-color: var(--ui-accent-border); background: var(--ui-accent-soft); color: var(--ui-accent); }
html[data-theme-surface="scribe"] .scribe-list__skeleton { display: grid; gap: 8px; padding: 16px; }
html[data-theme-surface="scribe"] .scribe-list__skeleton span { height: 12px; border-radius: 6px; background: var(--ui-surface-soft); animation: scribe-breathe 1.4s ease-in-out infinite; }
html[data-theme-surface="scribe"] .scribe-list__skeleton span:first-child { width: 46%; height: 14px; }
html[data-theme-surface="scribe"] .scribe-list__skeleton span:last-child { width: 72%; }
@keyframes scribe-breathe { 50% { opacity: .55; } }
html[data-theme-surface="scribe"] .scribe-empty { display: grid; justify-items: center; gap: 6px; padding: 36px 20px; border: 1px dashed var(--ui-border-strong); border-radius: var(--ui-radius-lg); color: var(--ui-text-soft); text-align: center; }
html[data-theme-surface="scribe"] .scribe-empty svg.lucide { width: 28px; height: 28px; color: var(--ui-muted); }
html[data-theme-surface="scribe"] .scribe-empty h3 { margin: 4px 0 0; color: var(--ui-text); font-size: .98rem; }
html[data-theme-surface="scribe"] .scribe-empty p { margin: 0; font-size: .8rem; }

/* Consent. */
html[data-theme-surface="scribe"] .scribe-card__patient { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-bottom: 12px; border-bottom: 1px solid var(--ui-border); }
html[data-theme-surface="scribe"] .scribe-card__question { margin: 0; font-size: .94rem; font-weight: 650; }
html[data-theme-surface="scribe"] .scribe-consent { display: grid; grid-template-columns: auto 1fr; align-items: start; gap: 12px; padding: 14px; border: 1px solid var(--ui-border); border-radius: var(--ui-radius); background: var(--ui-surface-soft); color: var(--ui-text); font-size: .86rem; line-height: 1.45; cursor: pointer; transition: border-color var(--ui-duration-fast) ease, background-color var(--ui-duration-fast) ease; }
html[data-theme-surface="scribe"] .scribe-consent:has(input:checked) { border-color: var(--ui-accent-border); background: var(--ui-accent-soft); }
html[data-theme-surface="scribe"] .scribe-consent input { width: 22px; height: 22px; margin: 0; accent-color: var(--ui-accent-fill); }

/* Recorder. */
html[data-theme-surface="scribe"] .scribe-recorder { justify-items: center; gap: 20px; text-align: center; }
html[data-theme-surface="scribe"] .scribe-recorder__patient { display: grid; justify-items: center; gap: 8px; }
html[data-theme-surface="scribe"] .scribe-recorder__patient h2 { margin: 0; font-size: 1.2rem; letter-spacing: -.01em; }
html[data-theme-surface="scribe"] .scribe-recorder__stage { display: grid; justify-items: center; gap: 6px; padding: 24px 0 8px; }
html[data-theme-surface="scribe"] .scribe-recorder__pulse { position: relative; display: grid; place-items: center; width: 120px; height: 120px; margin-bottom: 14px; border-radius: 50%; background: var(--ui-danger-soft); color: var(--ui-danger); }
html[data-theme-surface="scribe"] .scribe-recorder__pulse svg.lucide { position: relative; width: 36px; height: 36px; }
html[data-theme-surface="scribe"] .scribe-recorder__pulse span { position: absolute; inset: 0; border-radius: 50%; border: 2px solid var(--ui-danger-border); animation: scribe-pulse 1.8s var(--ui-ease-out) infinite; }
@keyframes scribe-pulse { from { transform: scale(1); opacity: .9; } to { transform: scale(1.45); opacity: 0; } }
html[data-theme-surface="scribe"] .scribe-recorder__timer { margin: 0; font-size: 3rem; font-weight: 600; letter-spacing: -.03em; line-height: 1; font-variant-numeric: tabular-nums; }
html[data-theme-surface="scribe"] .scribe-recorder__status { margin: 0; color: var(--ui-muted); font-size: .8rem; }
html[data-theme-surface="scribe"] .scribe-recorder .scribe-notice { width: 100%; text-align: left; }
html[data-theme-surface="scribe"] .scribe-recorder__controls { display: grid; justify-items: center; gap: 6px; margin-top: 8px; }
html[data-theme-surface="scribe"] .scribe-stop { display: grid; place-items: center; width: 76px; height: 76px; border: 0; border-radius: 50%; background: var(--ui-danger); color: #ffffff; box-shadow: 0 6px 18px color-mix(in srgb, var(--ui-danger) 32%, transparent); cursor: pointer; transition: transform 140ms var(--ui-ease-out), box-shadow 140ms var(--ui-ease-out); }
html[data-theme-surface="scribe"] .scribe-stop svg.lucide { width: 26px; height: 26px; fill: currentColor; }
html[data-theme-surface="scribe"] .scribe-stop:active { transform: scale(.94); box-shadow: 0 2px 8px color-mix(in srgb, var(--ui-danger) 28%, transparent); }
html[data-theme-surface="scribe"] .scribe-stop:focus-visible { outline: 3px solid var(--ui-danger-border); outline-offset: 3px; }
html[data-theme-surface="scribe"] .scribe-recorder__hint { color: var(--ui-text-soft); font-size: .8rem; font-weight: 650; }

/* Discard sheet. */
html[data-theme-surface="scribe"] .scribe-sheet-backdrop { position: fixed; inset: 0; z-index: 60; display: flex; align-items: flex-end; justify-content: center; background: var(--ui-overlay); animation: scribe-fade 200ms ease both; }
html[data-theme-surface="scribe"] .scribe-sheet { display: grid; gap: 10px; width: min(100%, 520px); padding: 22px var(--scribe-gutter) calc(18px + env(safe-area-inset-bottom)); border-radius: 16px 16px 0 0; background: var(--ui-surface); box-shadow: var(--ui-shadow-dialog); text-align: left; animation: scribe-sheet-in 280ms var(--ui-ease-drawer) both; }
html[data-theme-surface="scribe"] .scribe-sheet h3 { margin: 0; font-size: 1.05rem; }
html[data-theme-surface="scribe"] .scribe-sheet p { margin: 0 0 8px; color: var(--ui-text-soft); font-size: .84rem; }
@keyframes scribe-fade { from { opacity: 0; } }
@keyframes scribe-sheet-in { from { transform: translateY(100%); } }

/* Sending and done. */
html[data-theme-surface="scribe"] .scribe-progress p { margin: 0; color: var(--ui-text-soft); font-size: .86rem; }
html[data-theme-surface="scribe"] .scribe-progress__status { display: flex; align-items: center; gap: 10px; }
html[data-theme-surface="scribe"] .scribe-progress__bar { width: 100%; height: 6px; overflow: hidden; border: 0; border-radius: 999px; background: var(--ui-surface-soft); -webkit-appearance: none; appearance: none; }
html[data-theme-surface="scribe"] .scribe-progress__bar::-webkit-progress-bar { border-radius: 999px; background: var(--ui-surface-soft); }
html[data-theme-surface="scribe"] .scribe-progress__bar::-webkit-progress-value { border-radius: 999px; background: var(--ui-accent-fill); transition: width 300ms var(--ui-ease-out); }
html[data-theme-surface="scribe"] .scribe-progress__bar::-moz-progress-bar { border-radius: 999px; background: var(--ui-accent-fill); }
html[data-theme-surface="scribe"] .scribe-done { justify-items: center; gap: 12px; padding-top: 32px; text-align: center; }
html[data-theme-surface="scribe"] .scribe-done h2 { margin: 6px 0 0; font-size: 1.35rem; letter-spacing: -.015em; }
html[data-theme-surface="scribe"] .scribe-done > p { max-width: 36ch; margin: 0; color: var(--ui-text-soft); font-size: .86rem; line-height: 1.5; }
html[data-theme-surface="scribe"] .scribe-done .scribe-actions { width: 100%; margin-top: 12px; }
html[data-theme-surface="scribe"] .scribe-done__mark { display: grid; place-items: center; width: 64px; height: 64px; border-radius: 50%; background: var(--ui-success-soft); color: var(--ui-success); animation: scribe-mark-in 260ms var(--ui-ease-out) both; }
html[data-theme-surface="scribe"] .scribe-done__mark svg.lucide { width: 30px; height: 30px; stroke-width: 2.25; }
@keyframes scribe-mark-in { from { opacity: 0; transform: scale(.9); } }

/* Settings. */
html[data-theme-surface="scribe"] .scribe-group { display: grid; gap: 8px; }
html[data-theme-surface="scribe"] .scribe-group__title { margin: 8px 4px 0; color: var(--ui-muted); font-size: .76rem; font-weight: 700; }
html[data-theme-surface="scribe"] .scribe-textarea { min-height: 132px; resize: vertical; font-size: 16px; line-height: 1.5; }
html[data-theme-surface="scribe"] .scribe-counter { color: var(--ui-muted); font-size: .74rem; font-variant-numeric: tabular-nums; }
html[data-theme-surface="scribe"] .scribe-list__row { display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 4px 6px 4px 16px; font-size: .88rem; }
html[data-theme-surface="scribe"] .scribe-list__row svg.lucide { color: var(--ui-muted); }
html[data-theme-surface="scribe"] .scribe-list__row--muted { padding-right: 16px; color: var(--ui-muted); font-size: .84rem; }
html[data-theme-surface="scribe"] .scribe-list__label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
html[data-theme-surface="scribe"] .scribe-list__action { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 52px; padding: 0 16px; border: 0; background: transparent; color: var(--ui-danger); font: inherit; font-size: .88rem; font-weight: 650; text-align: left; cursor: pointer; transition: background-color var(--ui-duration-fast) ease; }
html[data-theme-surface="scribe"] .scribe-list__action:active { background: var(--ui-danger-soft); }

@media (prefers-reduced-motion: reduce) {
  html[data-theme-surface="scribe"] .scribe-screen,
  html[data-theme-surface="scribe"] .scribe-sheet,
  html[data-theme-surface="scribe"] .scribe-sheet-backdrop,
  html[data-theme-surface="scribe"] .scribe-done__mark { animation: none; }
  html[data-theme-surface="scribe"] .scribe-recorder__pulse span,
  html[data-theme-surface="scribe"] .scribe-list__skeleton span,
  html[data-theme-surface="scribe"] .scribe-icon-button .is-spinning { animation: none; }
  html[data-theme-surface="scribe"] .scribe-recorder__pulse span { opacity: .6; transform: scale(1.12); }
}
