/* Shared visual language from the live welcome page (index.html).
   Load after route styles. Layout, clinical severity, auth and data states remain
   owned by their existing components. Screen-only rules preserve print tools. */
:root {
  --welcome-ink: #061639;
  --welcome-copy: #3e5676;
  --welcome-action: #0664ed;
  --welcome-hover: #0759b6;
  --welcome-line: #cbdcf5;
  --welcome-wash: #e8f2ff;
  --welcome-surface: #ffffffed;
  --welcome-radius: 20px;
  --welcome-control-radius: 13px;
  --welcome-shadow: 0 8px 28px #173b670b;
  --welcome-font: 'DM Sans', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}
/* Resolve the colour variables on the body so live alert state overrides apply. */
body {
  --welcome-atmosphere: radial-gradient(ellipse at 49% 33%, #ffffffc7, transparent 41%),
    radial-gradient(ellipse 12% 13% at 20% 39%, #ffffffa8, transparent 96%),
    radial-gradient(ellipse 13% 13% at 80% 39%, #ffffffa8, transparent 96%),
    radial-gradient(ellipse 19% 15% at -1% 0%, var(--aurora-lilac, #b9b8f9ad), transparent 92%),
    radial-gradient(ellipse 19% 16% at -2% 31%, var(--aurora-side, #8dacfac4), transparent 88%),
    radial-gradient(ellipse 22% 18% at 27% 23%, var(--aurora-cyan, #95dffbc4), transparent 90%),
    radial-gradient(ellipse 23% 19% at 103% 31%, var(--aurora-cyan, #95dffbc4), transparent 90%),
    radial-gradient(ellipse 18% 18% at -3% 49%, var(--aurora-blush, #f4c9f1ae), transparent 88%),
    radial-gradient(ellipse 22% 20% at 102% 49%, var(--aurora-glow, #ad9bf4ae), transparent 90%),
    radial-gradient(ellipse 20% 18% at 16% 77%, var(--aurora-lilac, #b9b8f9ad), transparent 90%),
    radial-gradient(ellipse 24% 19% at 83% 79%, var(--aurora-cyan, #95dffbc4), transparent 90%),
    radial-gradient(ellipse 35% 27% at 0% 36%, var(--aurora-side, #8dacfac4), transparent 90%),
    radial-gradient(ellipse 34% 30% at 100% 46%, var(--aurora-glow, #ad9bf4ae), transparent 90%),
    radial-gradient(ellipse at 6% 28%, var(--aurora-cyan, #95dffbc4), transparent 44%),
    radial-gradient(ellipse at 96% 32%, var(--aurora-cyan, #95dffbc4), transparent 45%),
    radial-gradient(ellipse at 7% 53%, var(--aurora-blush, #f4c9f1ae), transparent 40%),
    radial-gradient(ellipse at 88% 55%, var(--aurora-lilac, #b9b8f9ad), transparent 44%),
    radial-gradient(ellipse at 48% 84%, var(--aurora-cyan, #95dffbc4), transparent 47%);
}

@media screen {
  /* The welcome and clinical Hub already own this exact atmosphere. Extend it
     to the remaining routes, without selecting the Hub's alert-level body. */
  html body:is(.doctorai-public-page, .doctorai-system-page, .doctorai-about,
    .appointment-guide, .medication-guide, .aurora-demo-page) {
    background-color: #f5f8ff;
    background-image: var(--welcome-atmosphere);
    background-size: 100% 1120px;
    background-repeat: no-repeat;
    color: var(--welcome-ink);
    font-family: var(--welcome-font);
  }

  /* A later legacy category layer repaints the Hub solid grey. Restore the
     welcome atmosphere using the existing semantic variables: orange and red
     still come from health-alert-status, never from a decorative category. */
  html body[data-hub-layout="reference"][data-hub-theme] {
    background-color: var(--aurora-base, #f5f8ff);
    background-image: var(--welcome-atmosphere);
    background-size: 100% 1120px;
    background-repeat: no-repeat;
  }
  body[data-hub-layout="reference"][data-hub-theme] #hub-shell { background: transparent; }
  body[data-hub-layout="reference"][data-hub-theme] #hub-shell :is(.sidebar, .hub-topbar) {
    background: var(--aurora-glass, #ffffffb8);
  }

  /* Typography follows the welcome's navy headings and comfortable body copy.
     Editorial serif emphasis on About and pricing is retained from the welcome. */
  body:is(.doctorai-public-page, .doctorai-system-page, .appointment-guide,
    .medication-guide, .aurora-demo-page) :is(button, input, select, textarea) {
    font-family: inherit;
  }
  body.doctorai-public-page :is(.research-hero, .hero-copy, .panel, main.shell) h1,
  body.doctorai-system-page .panel h1 {
    color: var(--welcome-ink);
    font-weight: 700;
    letter-spacing: -.055em;
  }

  /* Header surfaces and the blue primary action are shared across public pages.
     Keep the native mobile menu, route links and accessible names intact. */
  body.doctorai-public-page .doctorai-site-header {
    border-bottom-color: #ffffffc9;
    background: #ffffffb8;
    box-shadow: none;
  }
  body.doctorai-public-page .doctorai-site-menu > .doctorai-site-primary,
  body.doctorai-about .home-nav > .home-button,
  body.appointment-guide .page-header nav .nav-cta,
  body.medication-guide .guide-header .guide-nav-cta {
    min-height: 46px;
    border: 1px solid transparent;
    border-radius: var(--welcome-control-radius);
    background: var(--welcome-action);
    color: #fff;
    box-shadow: 0 8px 26px #0877f529;
  }

  /* Only known primary actions are selected. Delete, warning, authentication,
     billing availability and severity controls retain their existing treatment. */
  body.doctorai-public-page :is(.install, .primary-cta, .plan-primary),
  body.doctorai-public-page.subscription-page :is(.primary-cta, .plan-primary),
  body.doctorai-public-page main.shell .install,
  body.doctorai-public-page .search-row > button,
  body.doctorai-about .about-next .home-button,
  body.appointment-guide .button:not(.button-secondary),
  body.medication-guide .guide-button:not(.guide-button-secondary),
  body.staff-page .apply,
  body.staff-page .staff-idea-form > button,
  body.subscription-page .pro-access-panel button {
    min-height: 46px;
    border-color: transparent;
    border-radius: var(--welcome-control-radius);
    background: var(--welcome-action);
    color: #fff;
    box-shadow: 0 8px 26px #0877f529;
    font-weight: 700;
  }
  body.doctorai-public-page .doctorai-site-menu > .doctorai-site-primary:hover,
  body.doctorai-about :is(.home-nav > .home-button, .about-next .home-button):hover,
  body.appointment-guide :is(.nav-cta, .button:not(.button-secondary)):hover,
  body.medication-guide :is(.guide-nav-cta, .guide-button:not(.guide-button-secondary)):hover,
  body.doctorai-public-page :is(.install, .primary-cta, .plan-primary, .search-row > button):hover:not(:disabled),
  body.doctorai-public-page.subscription-page :is(.primary-cta, .plan-primary):hover:not(:disabled),
  body.doctorai-public-page main.shell .install:hover,
  body.staff-page :is(.apply, .staff-idea-form > button):hover,
  body.subscription-page .pro-access-panel button:hover:not(:disabled) {
    background: var(--welcome-hover);
    color: #fff;
  }

  /* Task actions in the Hub use the same blue and geometry. Alert surfaces,
     badges and alert-level atmosphere are intentionally outside these selectors. */
  body[data-hub-layout="reference"][data-hub-theme] #hub-shell
    :is(#view-today, #view-health, #view-visit-prep, #view-profile, #view-add, #view-diary)
    .primary-button {
    border-color: var(--welcome-action);
    border-radius: var(--welcome-control-radius);
    background: var(--welcome-action);
    color: #fff;
  }
  body[data-hub-layout="reference"][data-hub-theme] #hub-shell
    :is(#view-today, #view-health, #view-visit-prep, #view-profile, #view-add, #view-diary)
    .primary-button:hover:not(:disabled) {
    border-color: var(--welcome-hover);
    background: var(--welcome-hover);
  }

  /* Match the welcome's white cards; maintain reading widths and page grids. */
  body.doctorai-public-page :is(main > .panel, main.shell, .research-hero,
    .highlight-card, .paper-card, .feature-card, .plan-card),
  body.doctorai-about :is(.about-hero, .about-story-copy, .about-next),
  body.appointment-guide :is(.hero, .visit-fields, .checklist-section),
  body.medication-guide :is(.guide-hero, .medicine-sheet),
  body.doctorai-system-page :is(.panel, .card),
  body.staff-page :is(.staff-review-card, .staff-idea-form, .staff-idea-card),
  body.aurora-demo-page .brief-sheet {
    border-color: var(--welcome-line);
    border-radius: var(--welcome-radius);
    background: var(--welcome-surface);
    box-shadow: var(--welcome-shadow);
  }
  body.staff-page .staff-review-card.review-candidate { border-left-color: #cf7a16; }
  body.doctorai-public-page main > .panel::before { background: var(--welcome-action); }
  body.doctorai-public-page main > .panel .grid section:nth-child(n) {
    border-left-color: #4d8bea;
  }

  /* Blue decorative icons. Clinical, warning and evidence-status icons keep
     their semantic colours and are not selected here. */
  body.doctorai-about :is(.about-founder-initials, .about-bridge-symbol),
  body.appointment-guide :is(.resource-mark, .section-icon, .item-icon),
  body.medication-guide :is(.guide-hero-mark, .guide-section-icon),
  body.doctorai-public-page :is(.method-icon, .research-share-icon) {
    background: var(--welcome-wash);
    color: var(--welcome-hover);
    border-color: var(--welcome-line);
  }

  /* The dynamically inserted staff grant/stats cards have legacy inline paint.
     Override presentation only; do not alter grant actions or access checks. */
  body.staff-page #staff-tools-panel > section {
    border: 1px solid var(--welcome-line) !important;
    border-radius: var(--welcome-radius) !important;
    background: var(--welcome-surface) !important;
    color: var(--welcome-ink) !important;
    box-shadow: var(--welcome-shadow);
  }
  body.staff-page #staff-tools-panel > section :is(p, small, [role="status"], code) {
    color: var(--welcome-copy) !important;
  }
  body.staff-page #staff-tools-panel > section a { color: var(--welcome-hover) !important; }
  body.staff-page #staff-tools-panel > section form > button {
    border-radius: var(--welcome-control-radius) !important;
    background: var(--welcome-action) !important;
    color: #fff !important;
  }

  /* Form controls share readable text, clear boundaries and keyboard focus.
     Native checkbox/radio geometry and validation state colours are preserved. */
  body:is(.doctorai-public-page, .doctorai-system-page, .appointment-guide, .medication-guide)
    :is(input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):not([type="range"]):not([type="file"]), select, textarea) {
    max-width: 100%;
    min-height: 46px;
    border-radius: var(--welcome-control-radius);
    font-size: 16px;
    line-height: 1.5;
  }
  body.staff-page #staff-content input { border-radius: var(--welcome-control-radius) !important; }
  body.staff-page .staff-tabs [role="tab"] {
    border-radius: var(--welcome-control-radius);
    font-weight: 700;
  }
  body.staff-page .staff-tabs [aria-selected="true"] {
    border-color: #b9d2f5;
    background: var(--welcome-wash);
    color: var(--welcome-hover);
  }
  body:is(.doctorai-public-page, .doctorai-system-page, .doctorai-about,
    .appointment-guide, .medication-guide, .aurora-demo-page)
    :is(a, button, input, select, textarea, summary):focus-visible {
    outline: 3px solid var(--welcome-hover);
    outline-offset: 3px;
  }
  body:is(.doctorai-public-page, .doctorai-system-page, .appointment-guide, .medication-guide)
    button:disabled { box-shadow: none; }

  @media (max-width: 700px) {
    body.doctorai-public-page :is(main > .panel, main.shell, .research-hero),
    body.doctorai-about .about-hero,
    body.appointment-guide .hero,
    body.medication-guide .guide-hero,
    body.doctorai-system-page .panel { border-radius: 20px; }
    body.staff-page .staff-tabs [role="tab"] { padding: 10px 12px; }
    body.staff-page .staff-ideas-manage > select { min-width: 0; flex: 1 1 180px; }
  }
}

/* Whole-site aurora system. Presentation only: no content, routing or state changes.
   Screen-only so printable lists, briefs and legal print layouts retain their paper. */
@media screen {
  html body:is(.doctorai-homepage, .doctorai-public-page, .doctorai-system-page, .doctorai-system-page.staff-page,
    .doctorai-about, .appointment-guide, .medication-guide, .aurora-demo-page,
    [data-hub-layout="reference"]) {
    --aurora-base: #dceefa;
    --aurora-cyan: #95dffbc4;
    --aurora-lilac: #96c9efad;
    --aurora-blush: #9edfeaae;
    --aurora-side: #8dbcf4c4;
    --aurora-glow: #8eccefae;
    --aurora-glass: #d9edfac9;
    --welcome-surface: #d9edfab8;
    --welcome-line: #8db3d5;
    --welcome-radius: 18px;
    --welcome-control-radius: 13px;
    background-color: var(--aurora-base);
    background-image: var(--welcome-atmosphere);
    background-size: 100% 100%;
    background-repeat: no-repeat;
    background-attachment: scroll;
    min-height: 100vh;
  }
  /* Remove page-sized paint without changing their layout or content widths. */
  body.doctorai-public-page :is(main.shell, main > .panel, .pro-shell),
  body.doctorai-homepage :is(.home-shell, .home-main),
  body[data-hub-layout="reference"][data-hub-theme] #hub-shell,
  body[data-hub-layout="reference"][data-hub-theme] #hub-shell :is(.hub-main, .view-stack, .view) {
    background: transparent !important;
    box-shadow: none;
  }
  /* Shared navigation frame; existing active/pressed states remain distinct. */
  body.doctorai-public-page :is(.doctorai-site-header, .doctorai-site-footer),
  body.doctorai-homepage :is(.home-header, .home-mobile-menu nav),
  body[data-hub-layout="reference"][data-hub-theme] #hub-shell :is(.sidebar, .hub-topbar),
  body[data-hub-layout="reference"][data-hub-theme] .mobile-bottom-nav {
    background: var(--aurora-glass);
    border-color: var(--welcome-line);
  }
  /* The mobile dropdown overlaps page content, so keep the text below it from
     competing with its links while retaining a soft aurora-glass surface. */
  body.doctorai-homepage .home-mobile-menu nav {
    background: rgba(217, 237, 250, .98);
    backdrop-filter: blur(12px);
  }
  /* Public content uses the same blue glass as the six-tool landing. */
  body.doctorai-homepage :is(.home-universe, .home-brief, .home-destination, .home-invitation, .home-control, .home-aurora-dock),
  body.doctorai-public-page :is(.research-hero, .research-tabs, .research-controls, .highlight-card, .paper-card, .research-community, .discussion-card, .forum-compose, .research-share, .research-trust, .feature-card, .feature-card.featured, .plan-card, .pro-plan, .pro-section-nav, .care-pack-preview, .comparison-table, .pro-access-panel),
  body.doctorai-public-page main > .panel .grid section,
  body.subscription-page .preview-grid > div,
  body.doctorai-about :is(.about-hero, .about-story-copy, .about-next),
  body.doctorai-system-page :is(.panel, .card),
  body.appointment-guide :is(.hero, .visit-fields, .checklist-section),
  body.medication-guide :is(.guide-hero, .medicine-sheet),
  body.aurora-demo-page .brief-sheet {
    background: var(--welcome-surface) !important;
    border-color: var(--welcome-line);
    border-radius: var(--welcome-radius);
    box-shadow: var(--welcome-shadow);
  }
  /* Explicit non-clinical app surfaces; alert/severity and emergency cards are excluded. */
  body[data-hub-layout="reference"][data-hub-theme] #hub-shell
    :is(#view-today, #view-health, #view-visit-prep, #view-profile, #view-add, #view-diary,
        #view-documents, #view-results, #view-timeline, #view-appointments, #view-ask)
    :is(.page-heading, .reference-intro, .reference-brief-card, .profile-page-hero,
        .memory-card, .profile-shortcuts-card, .profile-shortcut-card, .profile-shortcut-add,
        .today-focus-card, .today-next-up-card, .today-actions-card, .today-compact-panel,
        .health-snapshot, .health-reminders-disclosure, .care-visit-card, .document-card, .document-drop,
        .result-list-card, .measurements-card, .timeline-card, .timeline-entry,
        .diary-question-panel, .symptom-log-card, .symptom-summary-card,
        .upcoming-card, .past-appointments, .appointment-large, .past-item, .add-detail-choice):not(.hub-alert-card):not(.emergency-card) {
    background: var(--welcome-surface) !important;
    border-color: var(--welcome-line);
    border-radius: var(--welcome-radius);
  }
  body[data-hub-layout="reference"][data-hub-theme] #hub-shell #view-profile .hub-storage-status article,
  body[data-hub-layout="reference"][data-hub-theme] #hub-shell #view-ask .quick-asks button,
  body[data-hub-layout="reference"][data-hub-theme] #hub-shell #view-medications :is(.library-card, .refill-card, .history-card),
  body[data-hub-layout="reference"][data-hub-theme] #storage-consent {
    background: var(--welcome-surface);
    border-color: var(--welcome-line);
    border-radius: var(--welcome-radius);
  }
  /* Keep the My Health hero open to the atmosphere, not inside a new card. */
  body[data-hub-layout="reference"][data-hub-theme="health"][data-hub-panel="details"] #hub-shell #view-health > .health-page-heading {
    background: transparent !important;
    border: 0;
  }
  /* Shared shape/typography, without overwriting destructive/semantic button colours. */
  body:is(.doctorai-homepage, .doctorai-public-page, .doctorai-system-page, .doctorai-about,
    .appointment-guide, .medication-guide, .aurora-demo-page, [data-hub-layout="reference"])
    :is(.home-button, .primary-button, .secondary-button, .primary-cta, .plan-primary,
        .plan-secondary, .button, .guide-button, .doctorai-site-primary) {
    border-radius: var(--welcome-control-radius);
    min-height: 44px;
    font-family: var(--welcome-font);
    line-height: 1.4;
  }
  body.doctorai-public-page :is(.feature-icon, .method-icon, .research-share-icon),
  body.doctorai-homepage :is(.home-dock-icon, .home-destination > .home-feature-icon) {
    color: var(--welcome-hover);
    background: #c8e5f5b3;
    border-color: var(--welcome-line);
    border-radius: 12px;
  }
  body:is(.doctorai-homepage, .doctorai-public-page, .doctorai-system-page, .doctorai-about,
    .appointment-guide, .medication-guide, .aurora-demo-page) :is(h1, h2, h3) {
    font-family: var(--welcome-font);
    line-height: 1.2;
  }
  body:is(.doctorai-homepage, .doctorai-public-page, .doctorai-system-page, .doctorai-about,
    .appointment-guide, .medication-guide, .aurora-demo-page) :is(a, button, summary):focus-visible {
    outline: 3px solid var(--welcome-hover);
    outline-offset: 3px;
  }
}
/* Static atmosphere adds no motion. Respect system accessibility and paper output. */
@media (forced-colors: active) {
  html body:is(.doctorai-homepage, .doctorai-public-page, .doctorai-system-page, .doctorai-system-page.staff-page,
    .doctorai-about, .appointment-guide, .medication-guide, .aurora-demo-page,
    [data-hub-layout="reference"]) {
    --welcome-surface: Canvas;
    --aurora-glass: Canvas;
    --welcome-line: CanvasText;
    background: Canvas;
  }
}

/* UX audit: keep actions in flow, reduce first-use repetition and protect narrow layouts.
   Presentation only. Existing auth, consent, form submission and clinical states own behavior. */
@media screen {
  /* A sticky footer inside the scrolling form covered fields before their turn in the flow. */
  body #quick-modal[open] { overflow: hidden; max-height: calc(100dvh - 24px); }
  body #quick-modal[open] > .modal-header { flex: 0 0 auto; }
  body #quick-modal[open] > #modal-body {
    flex: 1 1 auto; min-height: 0; overflow-y: auto;
    padding-bottom: env(safe-area-inset-bottom, 0px); scroll-padding-block: 16px;
  }
  body #quick-modal .modal-form[data-modal-form="symptom"] .modal-actions {
    position: static; margin: 0; padding: 14px 0 0; background: transparent;
    flex-wrap: wrap;
  }
  body #quick-modal .modal-field { min-width: 0; align-content: start; }
  body #quick-modal .modal-field :is(input, select, textarea) { min-width: 0; }
  body #quick-modal .modal-actions > button { white-space: normal; }

  /* Keep the privacy choice complete, while giving the actual daily task room. */
  body[data-hub-layout="reference"][data-hub-theme] #storage-consent {
    padding: 16px 20px; gap: 12px; margin-bottom: 12px;
  }
  body[data-hub-layout="reference"][data-hub-theme] #hub-shell
    :is(#view-today, #view-visit-prep, #view-profile, #view-health) { padding-top: 16px; }
  body[data-hub-layout="reference"][data-hub-theme] #hub-shell
    :is(#view-today, #view-visit-prep, #view-profile) > .page-heading {
    padding: 16px 20px; margin-bottom: 16px; min-height: 0;
  }
  body[data-hub-layout="reference"][data-hub-theme] #hub-shell
    :is(#view-today, #view-visit-prep, #view-profile) > .page-heading h1 {
    font-size: clamp(28px, 3vw, 36px); line-height: 1.15;
  }
  body[data-hub-layout="reference"][data-hub-theme] #hub-shell #view-visit-prep .reference-brief-card {
    padding: 24px; margin-block: 16px;
  }
  body[data-hub-layout="reference"][data-hub-theme] #hub-shell #view-visit-prep .reference-brief-card > span {
    width: 36px; height: 36px; margin-inline: auto;
  }
  body[data-hub-layout="reference"][data-hub-theme] #hub-shell #view-visit-prep .reference-brief-card h2 { margin: 8px 0; font-size: 24px; }
  body[data-hub-layout="reference"][data-hub-theme] #hub-shell #view-visit-prep .reference-brief-card > p { margin: 8px 0 12px; max-width: none; }
  body[data-hub-layout="reference"][data-hub-theme] #hub-shell #view-visit-prep .reference-brief-card > small { margin-top: 10px; }
  body[data-hub-layout="reference"][data-hub-theme="health"][data-hub-panel="details"] #hub-shell .health-tool-welcome {
    grid-template-columns: 112px minmax(0, 1fr); gap: 10px 18px;
    align-items: center; justify-items: stretch; margin-bottom: 20px; text-align: left;
  }
  body[data-hub-layout="reference"][data-hub-theme="health"] #hub-shell .health-tool-brand {
    grid-column: 1; grid-row: 1 / span 3; width: 112px; height: 84px; max-width: 100%;
  }
  body[data-hub-layout="reference"][data-hub-theme="health"] #hub-shell #view-health .health-tool-tagline {
    grid-column: 2; font-size: 17px !important; line-height: 1.4 !important;
  }
  body[data-hub-layout="reference"][data-hub-theme="health"] #hub-shell
    :is(.health-tool-account, .health-tool-account-state) { grid-column: 2; width: 100%; }
  body[data-hub-layout="reference"][data-hub-theme="health"] #hub-shell .health-tool-account > button { min-height: 44px; }
  body[data-hub-layout="reference"][data-hub-theme="health"][data-hub-panel="details"] #hub-shell #view-health > .hub-panel-nav > button {
    white-space: normal; overflow-wrap: anywhere;
  }
}
@media screen and (max-width: 820px) {
  body.doctorai-public-page .doctorai-site-menu {
    max-height: calc(100vh - 68px); max-height: calc(100dvh - 68px);
    overflow-y: auto; overscroll-behavior: contain;
  }
}
@media screen and (max-width: 600px) {
  body[data-hub-layout="reference"][data-hub-theme="health"][data-hub-panel="details"] #hub-shell .health-tool-welcome {
    grid-template-columns: 72px minmax(0, 1fr); gap: 8px 12px;
  }
  body[data-hub-layout="reference"][data-hub-theme="health"] #hub-shell .health-tool-brand { width: 72px; height: 64px; }
  body[data-hub-layout="reference"][data-hub-theme="health"] #hub-shell .health-tool-account { grid-column: 1 / -1; }
  body[data-hub-layout="reference"][data-hub-theme] #storage-consent { padding: 14px 16px; }
}

/* Personal Today suggestions are local, optional and never a substitute for clinical advice. */
@media screen {
  body[data-hub-layout="reference"] #hub-shell #view-today .today-goal-suggestion {
    margin: 16px 0; padding: 16px; border: 1px solid #8db3d5; border-radius: 16px;
    background: #d9edfab8; color: #153c66; min-width: 0;
  }
  body[data-hub-layout="reference"] #hub-shell #view-today .today-goal-suggestion[hidden] { display: none; }
  body[data-hub-layout="reference"] #hub-shell #view-today .today-goal-suggestion h3 { margin: 0 0 10px; font-size: 18px; }
  body[data-hub-layout="reference"] #hub-shell #view-today .today-goal-suggestion p { margin: 8px 0; line-height: 1.5; overflow-wrap: anywhere; }
  body[data-hub-layout="reference"] #hub-shell #view-today .today-suggestion-label { font-weight: 700; }
  body[data-hub-layout="reference"] #hub-shell #view-today .today-suggestion-reason { font-size: 14px; }
  body[data-hub-layout="reference"] #hub-shell #view-today .today-suggestion-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
  body[data-hub-layout="reference"] #hub-shell #view-today .today-suggestion-actions button { min-height: 44px; white-space: normal; }
  body[data-hub-layout="reference"][data-hub-theme="health"][data-hub-panel="details"] #hub-shell .health-tool-welcome { margin-top: 24px; }
}
@media (forced-colors: active) {
  body[data-hub-layout="reference"] #hub-shell #view-today .today-goal-suggestion { background: Canvas; color: CanvasText; border-color: CanvasText; }
}


/* Primary medication workspace and pinned app header — no clinical state selectors. */
@media screen {
  html { overflow-x: clip; scroll-padding-top: calc(var(--doctorai-header-height, 78px) + 16px); }
  body[data-hub-layout="reference"] { overflow-x: clip; }
  body[data-hub-layout="reference"] #hub-shell .primary-nav .nav-item { min-height: 52px; height: auto; padding-block: 10px; }
  body[data-hub-layout="reference"] #hub-shell .primary-nav .nav-item > span:last-child { white-space: normal; overflow-wrap: anywhere; line-height: 1.35; }
  body[data-hub-layout="reference"] #hub-shell #view-medications > .page-heading { align-items: flex-start; flex-wrap: wrap; }
  body[data-hub-layout="reference"] #hub-shell #view-medications h1 { font-size: clamp(24px, 3vw, 36px); overflow-wrap: anywhere; }
  .medication-schedule { padding: clamp(16px, 3vw, 24px); margin-bottom: 24px; color: #143855; }
  .medication-schedule p, .medication-schedule small { line-height: 1.55; overflow-wrap: anywhere; }
  .medication-calendar-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); gap: 24px; margin-top: 20px; }
  .medication-calendar-layout > section { min-width: 0; }
  .medication-calendar-controls { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
  .medication-calendar-controls h3 { text-align: center; margin: 0; }
  .medication-calendar-controls button { min-width: 44px; min-height: 44px; }
  .medication-calendar-date { display: grid; gap: 6px; margin: 12px 0; font-weight: 600; }
  .medication-calendar-date input { min-width: 0; width: 100%; min-height: 44px; box-sizing: border-box; border: 1px solid #809db5; border-radius: 10px; padding: 8px; color: #143855; background: #edf8ff; }
  .medication-calendar-grid, .medication-calendar-weekdays { display: grid; grid-template-columns: repeat(7,minmax(0,1fr)); gap: 3px; }
  .medication-calendar-weekdays { text-align: center; margin: 10px 0 5px; }
  .medication-calendar-day { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-width: 0; min-height: 44px; padding: 4px 0; border: 1px solid #88a9bf; border-radius: 8px; background: #e6f5fcaa; color: #123856; font: inherit; }
  .medication-calendar-day[aria-pressed="true"] { background: #0759a8; color: white; border-color: #0759a8; }
  .calendar-dot { display: block; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
  .medication-calendar-selection { margin-top: 16px; }
  .medication-calendar-selection summary { min-height: 44px; padding: 10px 0; font-weight: 700; cursor: pointer; }
  .medication-calendar-selection fieldset { border: 1px solid #88a9bf; border-radius: 12px; padding: 12px; }
  .medication-calendar-selection label { display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 6px 0; overflow-wrap: anywhere; }
  .medication-calendar-selection input { flex-shrink: 0; width: 22px; height: 22px; }
  .medication-day-timeline { list-style: none; padding: 0; }
  .medication-day-timeline li { display: grid; grid-template-columns: 60px minmax(0,1fr); gap: 12px; padding: 16px 0; border-bottom: 1px solid #9bb7cc; }
  .medication-day-timeline time { font-weight: 700; }
  .medication-calendar-review article { padding: 12px; margin: 10px 0; border: 1px solid #89aabd; border-radius: 12px; background: #d8edfa80; }
  .medication-calendar-boundary { font-size: 13px; }
  .medication-schedule :is(button,input,summary):focus-visible { outline: 3px solid #0759a8; outline-offset: 3px; }
  @media (max-width: 800px) {
    body[data-hub-layout="reference"] #hub-shell .hub-topbar { position: fixed; inset: 0 0 auto 0; z-index: 80; box-sizing: border-box; height: auto; min-height: calc(78px + env(safe-area-inset-top, 0px)); padding-top: env(safe-area-inset-top, 0px); background: #d5edfaf2; }
    body[data-hub-layout="reference"] #hub-shell .hub-main { padding-top: var(--doctorai-header-height, calc(78px + env(safe-area-inset-top, 0px))); }
    body[data-hub-layout="reference"].mobile-category-open #hub-shell #category-bar { position: fixed; top: var(--doctorai-header-height, 78px); left: 8px; right: 8px; bottom: auto; z-index: 79; margin: 8px 0; max-height: calc(100dvh - var(--doctorai-header-height, 78px) - 110px - env(safe-area-inset-bottom, 0px)); overflow-y: auto; }
    body[data-hub-layout="reference"] .mobile-bottom-nav-item b { white-space: normal; overflow-wrap: anywhere; font-size: 11px; line-height: 1.2; }
    body[data-hub-layout="reference"] .mobile-bottom-nav-item { min-width: 0; }
    .medication-calendar-layout { grid-template-columns: minmax(0,1fr); }
  }
  @media (max-width: 390px) {
    .medication-schedule { padding: 12px; }
    .medication-calendar-grid, .medication-calendar-weekdays { gap: 2px; }
    .medication-calendar-day { min-height: 44px; }
  }
  @media (forced-colors: active) {
    .medication-calendar-day, .medication-calendar-review article { background: Canvas; color: CanvasText; border-color: ButtonText; }
    .medication-calendar-day[aria-pressed="true"] { background: Highlight; color: HighlightText; }
  }
}
@media print { .medication-schedule { break-inside: avoid; } .medication-calendar-controls, .medication-calendar-selection { display: none; } }

/* Deep audit: readable controls and one scroll owner per shared dialog. */
@media screen {
  body[data-hub-layout="reference"] :is(#quick-modal, #privacy-modal) :is(button, .modal-field > span),
  body[data-hub-layout="reference"] #hub-shell :is(.trend-tabs, .measurement-history-actions, .timeline-filters) button,
  body[data-hub-layout="reference"] #hub-shell :is(.primary-button, .secondary-button, .quiet-button, .text-button),
  body:is(.appointment-guide, .medication-guide) button {
    font-size: 14px !important; line-height: 1.45; white-space: normal;
  }
  body[data-hub-layout="reference"] :is(#quick-modal, #privacy-modal) button,
  body[data-hub-layout="reference"] #hub-shell :is(.trend-tabs, .measurement-history-actions, .timeline-filters) button,
  body:is(.appointment-guide, .medication-guide) button { min-height: 44px; }
  body[data-hub-layout="reference"] #quick-modal :is(input, select, textarea) { font-size: 16px !important; }
  body[data-hub-layout="reference"] #privacy-modal .privacy-actions { flex-wrap: wrap; justify-content: flex-start; gap: 12px; }
  body[data-hub-layout="reference"] #privacy-modal [data-delete-health] {
    border: 1px solid #9c3244; border-radius: 10px; padding: 10px 14px; background: transparent; color: #81273a;
  }
  body #quick-modal #modal-body .personal-overview-sections { max-height: none; overflow: visible; }
  body #quick-modal #modal-body :is(.personal-overview-modal, .today-dashboard) { min-width: 0; }
  body #quick-modal #modal-body .modal-actions { position: static; flex-wrap: wrap; }
}

/* Screenshot correction: Medication was missing from the shared glass heading scope.
   Explicit non-clinical surfaces only; clinical severity and focus colors remain intact. */
@media screen {
  body[data-hub-layout="reference"][data-hub-theme] #hub-shell #view-medications > .page-heading,
  body[data-hub-layout="reference"][data-hub-theme] #hub-shell #view-medications :is(.medication-schedule, .library-card, .refill-card, .history-card, .medication-learning-panel, .medication-scan-help) {
    background: #c7e7f75c !important; background-image: none !important;
    border-color: #83acc9; color: #143855;
  }
  body[data-hub-layout="reference"][data-hub-theme] #hub-shell :is(#view-medications, #view-documents) .secondary-button,
  body[data-hub-layout="reference"][data-hub-theme] #hub-shell .hub-breadcrumb button {
    background: #c7e7f752 !important; background-image: none !important; color: #0759a8;
  }
  body[data-hub-layout="reference"][data-hub-theme] #hub-shell :is(#view-medications, #view-documents) .secondary-button:hover { background: #b0ddf280 !important; }
  .document-capture-button { display: inline-flex; align-items: center; justify-content: center; gap: 12px; }
  .document-capture-button small { display: block; font-size: 13px; }
  #quick-modal .document-capture-copy, #quick-modal .document-capture-consent { margin: 18px 24px; line-height: 1.6; color: #143855; }
  #quick-modal .document-capture-consent { display: flex; align-items: flex-start; gap: 12px; }
  #quick-modal .document-capture-consent input { flex-shrink: 0; width: 22px; height: 22px; margin-top: 3px; }
  #quick-modal .document-capture-actions { padding: 12px 24px 24px; }
}
@media (forced-colors: active) {
  body[data-hub-layout="reference"][data-hub-theme] #hub-shell #view-medications > .page-heading,
  body[data-hub-layout="reference"][data-hub-theme] #hub-shell #view-medications :is(.medication-schedule, .library-card, .refill-card, .history-card, .medication-learning-panel, .medication-scan-help),
  body[data-hub-layout="reference"][data-hub-theme] #hub-shell :is(#view-medications, #view-documents) .secondary-button { background: Canvas !important; color: CanvasText; border-color: ButtonText; }
}
@media screen {
  /* Name similarity alone is information, not a verified medication risk. */
  body[data-hub-layout="reference"] .medication-safety-alert.info { background: #c7e7f752; border-color: #83acc9; color: #143855; }
  body[data-hub-layout="reference"] .medication-safety-alert.info .safety-alert-icon { color: #0759a8; }
}
@media screen {
  /* Coverage limitations remain visible but are not styled as detected interactions.
     Do not select is-warning/is-caution or clinical severity cards here. */
  body[data-hub-layout="reference"] #hub-shell #view-medications :is(.safety-result-alert.is-unknown, .medication-db-summary.is-incomplete, .medication-pair-coverage-badge) {
    background: #c7e7f752; border-color: #83acc9; color: #143855;
  }
  body[data-hub-layout="reference"] #hub-shell #view-medications .safety-result-alert.is-unknown h3 { color: #143855; }
}
@media screen {
  body[data-hub-layout="reference"][data-hub-theme] #hub-shell #view-medications .medication-view-grid { display: flex; flex-direction: column; gap: 18px; }
  body[data-hub-layout="reference"][data-hub-theme] #hub-shell #view-medications .medication-view-grid > * { width: 100%; min-width: 0; }
  body[data-hub-layout="reference"][data-hub-theme] #hub-shell #view-medications .medication-toolbar { align-items: flex-start; }
  body[data-hub-layout="reference"][data-hub-theme] #hub-shell #view-medications :is(.medication-scan-options, .medication-secondary-details, .medication-learning-panel, .medication-scan-help) { min-width: 0; background: #c7e7f73d !important; }
  body[data-hub-layout="reference"] #view-medications details > summary { min-height: 44px; padding: 12px; box-sizing: border-box; cursor: pointer; font-size: 15px; line-height: 1.4; }
  .medication-scan-options-actions { display: flex; flex-wrap: wrap; gap: 10px; padding: 8px; }
  body[data-hub-layout="reference"] #hub-shell #view-medications .medication-scan-options-actions > button { width: auto; min-height: 44px; flex: 1 1 180px; }
  .medication-secondary-details > .medication-side { padding-top: 12px; }
  .medication-calendar-details { margin-top: 16px; }
  .medication-calendar-status:empty { display: none; }
  body[data-hub-layout="reference"] #view-medications .library-disclaimer { display: block; }
  body[data-hub-layout="reference"] #view-medications .library-disclaimer > p { margin: 10px 12px; }
}

/* Scan-help actions need distinct cells even when both use secondary styling. */
@media screen {
  body[data-hub-layout="reference"] #hub-shell #view-scan .scan-start-card > [data-open-medication-scanner] { grid-area: primary; }
  body[data-hub-layout="reference"] #hub-shell #view-scan .scan-start-card > [data-modal="medication"] { grid-area: manual; }
  body[data-hub-layout="reference"][data-hub-theme] #hub-shell #view-scan > .page-heading,
  body[data-hub-layout="reference"][data-hub-theme] #hub-shell #view-scan .scan-start-card { background: #c7e7f75c !important; background-image: none !important; }
}
@media (forced-colors: active) {
  body[data-hub-layout="reference"][data-hub-theme] #hub-shell #view-scan > .page-heading,
  body[data-hub-layout="reference"][data-hub-theme] #hub-shell #view-scan .scan-start-card { background: Canvas !important; }
}
