/* Portal geometry extends public-website.css. Its palette is overridden here only
   for the patient layout. Backup/restore: docs/11 Repo Integration/theme-backups/. */
/* BEGIN PATIENT PALETTE */
/* Klinik Park: warm ivory, forest green and leaf accents. Colors only. */
:root {
    color-scheme: light;
    --paper: #f7f6ef;
    --surface: #fffef8;
    --patient-header-background: light-dark(#dfe7d5, var(--surface));
    --patient-body-background:
        linear-gradient(110deg, light-dark(#d4e2bf, #203725), var(--paper) 48%, light-dark(#dce8c7, #1d3324));
    --ink: #183c2b;
    --muted: #56664f;
    --line: #c6d0bc;
    --accent: #20583a;
    --on-accent: #fffef8;
    --soft: #e7eedb;
    --wash: #edf1df;
    --azure: #dce8c7;
    --blue: #e9edda;
    --art: #c5d8aa;
    --art-inner: #f0f4e5;
    --symbol: #567b32;
    --shadow: 0 16px 48px #193d2112;
    --clinic-overview-background: linear-gradient(120deg, #edf1df, #dce8c7);
    --clinic-contact-background: #e7eedb;
    --field-background: #fffef8;
    --patient-success: #32642b;
    --patient-danger: #ae3037;
    --patient-warning: #855213;
    --patient-timeline-active: #ad4500;
}
@media (prefers-color-scheme: dark) {
    :root:not([data-public-theme=light]) {
        color-scheme: dark;
        --paper: #111c17;
        --surface: #192a20;
        --ink: #edf3e6;
        --muted: #b2c1ad;
        --line: #3d5540;
        --accent: #b4d982;
        --on-accent: #172714;
        --soft: #243a2a;
        --wash: #172a1e;
        --azure: #2a4027;
        --blue: #293b25;
        --art: #3d5830;
        --art-inner: #223720;
        --symbol: #b4d982;
        --shadow: 0 16px 48px #0003;
        --clinic-overview-background: var(--surface);
        --clinic-contact-background: var(--soft);
        --field-background: var(--paper);
        --patient-success: #b7db96;
        --patient-danger: #ffabb0;
        --patient-warning: #f5ce8d;
        --patient-timeline-active: #ffb45c;
    }
}
:root[data-public-theme=dark] {
    color-scheme: dark;
    --paper: #111c17;
    --surface: #192a20;
    --ink: #edf3e6;
    --muted: #b2c1ad;
    --line: #3d5540;
    --accent: #b4d982;
    --on-accent: #172714;
    --soft: #243a2a;
    --wash: #172a1e;
    --azure: #2a4027;
    --blue: #293b25;
    --art: #3d5830;
    --art-inner: #223720;
    --symbol: #b4d982;
    --shadow: 0 16px 48px #0003;
    --clinic-overview-background: var(--surface);
    --clinic-contact-background: var(--soft);
    --field-background: var(--paper);
    --patient-success: #b7db96;
    --patient-danger: #ffabb0;
    --patient-warning: #f5ce8d;
    --patient-timeline-active: #ffb45c;
}
.patient-dashboard-sections {
    --dashboard-surface: var(--surface);
    --dashboard-ink: var(--ink);
    --dashboard-muted: var(--muted);
    --dashboard-line: var(--line);
    --dashboard-accent: var(--accent);
    --dashboard-hover: var(--soft);
    --dashboard-hover-line: color-mix(in srgb, var(--accent) 45%, var(--line));
    --dashboard-shadow: light-dark(#193d2114, #0003);
    --dashboard-hover-shadow: light-dark(#193d2120, #0005);
    --dashboard-hover-muted: var(--ink);
}
/* END PATIENT PALETTE */
.patient-shell { min-height: 100vh; display: flex; flex-direction: column; }
.patient-shell > .site-header { background: var(--patient-header-background); }
.patient-shell-portal { background-image: var(--patient-body-background); }
.patient-shell :is(textarea, select) { font: inherit; }
.patient-main { flex: 1; padding-block: 48px 80px; min-width: 0; }
.patient-main-auth { padding-block: 0; }
.patient-main-auth > .patient-alert { margin-block: 24px 0; }
.patient-auth-wrap { display: grid; grid-template-columns: 1.18fr 1fr; gap: 7%; align-items: center; padding-block: 66px 76px; min-height: 560px; }
.patient-main-auth:has(> .patient-auth-wrap-centered) { display: flex; flex-direction: column; }
.patient-auth-wrap.patient-auth-wrap-centered { flex: 1; grid-template-columns: minmax(0, 480px); justify-content: center; gap: 0; padding-block: 48px; }
.patient-auth-heading h1 { margin: 22px 0 26px; }
.patient-auth-heading p { color: var(--muted); font-size: 1.1rem; line-height: 1.8; max-width: 580px; }
.patient-auth-card { min-width: 0; padding: 36px; border: 1px solid var(--line); border-radius: 24px; background: var(--surface); box-shadow: var(--shadow); }
.patient-auth-card-heading h1 { margin: 0 0 12px; font-size: 1.6rem; line-height: 1.3; }
.patient-auth-card-heading p { margin: 0 0 24px; color: var(--muted); font-size: .9rem; }
.patient-login-heading { margin-bottom: 24px; }
.patient-login-heading h1 { margin: 0; }
.patient-auth-form { display: grid; gap: 20px; }
.patient-password-field { position: relative; }
.patient-shell .patient-password-field .form-control { padding-right: 60px; }
.patient-password-toggle { position: absolute; inset: 1px 1px 1px auto; width: 48px; padding: 0; display: grid; place-items: center; border: 0; border-left: 1px solid var(--line); border-radius: 0 11px 11px 0; background: var(--surface); color: var(--muted); cursor: pointer; }
.patient-password-toggle[hidden] { display: none; }
.patient-password-toggle:hover { color: var(--accent); }
.patient-password-toggle svg { width: 20px; height: 20px; }
.patient-password-toggle[aria-pressed=false] .patient-eye-off, .patient-password-toggle[aria-pressed=true] .patient-eye { display: none; }
.patient-remember-me { display: flex; align-items: center; gap: 10px; min-height: 44px; font-size: .9rem; cursor: pointer; }
.patient-remember-me input { width: 18px; height: 18px; margin: 0; accent-color: var(--accent); cursor: pointer; }
.patient-auth-help, .patient-card-note { margin: 20px 0 0; color: var(--muted); font-size: .85rem; }
.patient-auth-help a { display: inline-flex; align-items: center; min-height: 44px; color: var(--accent); border-bottom: 1px solid var(--line); font-weight: 600; }
.patient-auth-help a:hover { border-color: var(--accent); }
.patient-shell .language-switch > span { color: var(--muted); }
.patient-shell .mobile-menu form { margin: 0; }
.patient-header-auth .desktop-nav { gap: 0; font-size: .92rem; }
.patient-header-auth .desktop-nav > a, .patient-header-auth .desktop-nav > .patient-navigation-menu > summary { position: relative; display: inline-flex; align-items: center; gap: 6px; min-height: 48px; padding: 12px 10px; border-bottom: 2px solid transparent; }
.patient-header-auth .desktop-nav > a[aria-current=page], .patient-header-auth .desktop-nav > .patient-navigation-menu[data-active=true] > summary { border-bottom-color: var(--accent); }
.patient-header-auth .desktop-nav > :is(a, .patient-navigation-menu) + :is(a, .patient-navigation-menu)::before { content: ""; position: absolute; inset-inline-start: 0; top: 50%; width: 1px; height: 18px; background: var(--line); transform: translateY(-50%); }
.patient-header-auth :is(.patient-primary-link, .patient-navigation-options a) { font-weight: 600; }
.patient-header-auth :is(.patient-primary-link, .patient-navigation-options a) > .patient-section-icon { display: none; }
.patient-navigation-menu { position: relative; }
.patient-navigation-menu.patient-profile-menu > .patient-navigation-options { left: auto; right: 0; }
.patient-navigation-menu > summary { display: flex; align-items: center; gap: 6px; color: var(--ink); font-weight: inherit; list-style: none; cursor: pointer; }
.patient-navigation-menu > summary::-webkit-details-marker { display: none; }
.patient-navigation-menu > summary::marker { content: ''; }
.patient-navigation-menu > summary:is(:hover, :focus-visible), .patient-navigation-menu[open] > summary { color: var(--accent); }
.patient-navigation-menu > summary:focus-visible { outline: 2px solid var(--accent); outline-offset: -3px; border-radius: 8px; }
.patient-treatment-chevron { flex: 0 0 auto; width: 14px; height: 14px; transition: transform .15s ease; }
.patient-navigation-menu[open] .patient-treatment-chevron { transform: rotate(180deg); }
.patient-navigation-menu > .patient-navigation-options { position: absolute; top: calc(100% + 6px); left: 0; z-index: 60; display: grid; width: max-content; min-width: 220px; max-width: min(280px, calc(100vw - 32px)); max-height: min(360px, calc(100dvh - 130px)); overflow-y: auto; margin: 0; padding: 6px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.patient-navigation-menu:not([open]) > .patient-navigation-options { display: none; }
.patient-navigation-menu .patient-navigation-options a { display: flex; align-items: center; gap: 10px; min-height: 46px; padding: 10px 12px; border: 0; border-radius: 9px; color: var(--ink); font-size: .92rem; line-height: 1.4; text-decoration: none; white-space: normal; }
.patient-navigation-menu .patient-navigation-options a:is(:hover, :focus-visible, [aria-current=page]) { color: var(--accent); background: var(--soft); }
.patient-navigation-menu .patient-navigation-options a:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
@media (max-width: 1399px) {
  .patient-header-auth .mobile-menu .patient-navigation-menu > summary { min-height: 48px; gap: 12px; padding: 12px; border-radius: 10px; font-size: .98rem; }
  .patient-header-auth .mobile-menu .patient-navigation-menu[data-active=true] > summary { background: var(--soft); color: var(--accent); }
  .patient-header-auth .mobile-menu .patient-navigation-menu .patient-treatment-chevron { margin-left: auto; }
  .patient-header-auth .mobile-menu .patient-navigation-menu > .patient-navigation-options { position: static; width: auto; min-width: 0; max-width: none; max-height: none; overflow: visible; margin: 4px 0 8px 21px; padding: 0 0 0 10px; border: 0; border-left: 1px solid var(--line); border-radius: 0; background: transparent; box-shadow: none; }
  .patient-header-auth .mobile-menu .patient-navigation-options a { min-height: 48px; font-size: .95rem; }
}
.patient-account-logout { margin: 0; }
.patient-account-signout { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; white-space: nowrap; }
.patient-account-signout > .patient-section-icon { width: 19px; height: 19px; }

@media (min-width: 1400px) {
  .patient-header-auth .header-inner { gap: 16px; }
  .patient-header-auth .header-actions { gap: 8px; }
}
@media (max-width: 1399px) {
  .patient-header-auth .desktop-nav, .patient-header-account { display: none; }
  .patient-header-auth .mobile-menu { display: block; }

  .patient-header-auth .mobile-menu > summary { min-height: 44px; display: flex; align-items: center; gap: 8px; list-style: none; font-size: .8rem; padding: 8px; }
  .patient-header-auth .mobile-menu > summary::-webkit-details-marker { display: none; }
  .patient-header-auth .mobile-menu > nav { position: absolute; top: 100%; left: 0; right: 0; background: var(--surface); border-bottom: 1px solid var(--line); padding: 16px 24px; box-shadow: var(--shadow); display: grid; gap: 4px; max-height: calc(100dvh - 90px); overflow-y: auto; overscroll-behavior: contain; scroll-padding-block: 12px; }
  .patient-header-auth .mobile-menu nav a { padding: 12px; border-radius: 10px; }
  .patient-header-auth .mobile-menu .patient-primary-link { display: flex; align-items: center; gap: 12px; min-height: 48px; font-size: .98rem; }
  .patient-header-auth .mobile-menu nav a[aria-current=page] { background: var(--soft); color: var(--accent); }
  .patient-header-auth .mobile-menu .patient-account-logout { margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line); }
  .patient-header-auth .mobile-menu .patient-account-signout { width: 100%; justify-content: flex-start; min-height: 48px; padding: 12px; border: 0; border-radius: 10px; font-size: .98rem; }

}
.patient-context-banner { background: var(--soft); border-bottom: 1px solid var(--line); }
@media (max-width: 600px) {
}
.patient-navigation-options .patient-section-icon { width: 20px; height: 20px; }
.patient-medication-section-heading { flex-wrap: wrap; align-items: center; gap: 16px; }
@media (max-width: 575px) {
}
.patient-context-banner > div { display: flex; justify-content: space-between; align-items: center; gap: 24px; padding-block: 12px; font-size: .85rem; }
.patient-full-width { width: 100%; }
.patient-action-spacing { margin-top: 24px; }
.patient-button-danger { color: var(--patient-danger); border-color: var(--patient-danger); }
.patient-shell .button:disabled { opacity: .55; cursor: not-allowed; transform: none; box-shadow: none; }
.patient-shell .form-control { display: block; }
.patient-shell .form-control::placeholder { color: var(--muted); opacity: 1; }
.patient-shell .form-control:focus-visible { outline-offset: 2px; }
.patient-shell .form-control.input-validation-error { border-color: var(--patient-danger); }
/* Progressive clinic/type selection uses the same cards and geometry in both themes. */
.patient-booking > :is([data-booking-enhanced], [data-booking-fallback]) { max-width: 760px; margin-inline: auto; }
.patient-booking-choices { display: flex; flex-wrap: wrap; gap: 12px; margin: 24px 0 0; padding: 0; border: 0; min-width: 0; }
.patient-booking-choices legend { width: 100%; margin-bottom: 12px; font-size: 1.2rem; font-weight: 700; line-height: 1.4; }
.patient-booking-choice-row { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0; }
.patient-booking-choice-row:has(> :not([hidden])) { margin-top: 24px; }
.patient-booking-choice-row .patient-booking-choices { margin: 0; }
.patient-booking-question { max-width: 780px; width: 100%; }
.patient-booking-choice-row [data-booking-service-choices] { margin-inline: auto; }
[data-booking-service-choices] > legend { text-align: center; }
.patient-booking-choice-hint { width: 100%; margin: 0 0 6px; font-size: .95rem; line-height: 1.6; }
.patient-choice-options { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; width: 100%; min-width: 0; }
.patient-choice-option { min-width: 0; }
.patient-shell .patient-choice-card { display: grid; grid-template-columns: 46px minmax(0, 1fr) 24px; align-items: center; gap: 16px; width: 100%; min-height: 82px; padding: 18px 20px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); color: var(--ink); font: inherit; text-align: start; text-decoration: none; cursor: pointer; transition: border-color .18s, background .18s; }
.patient-shell .patient-choice-card:hover, .patient-shell .patient-choice-card[aria-pressed=true] { background: var(--soft); border-color: var(--accent); color: var(--ink); }
.patient-choice-card:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
.patient-choice-card:disabled { opacity: .55; cursor: not-allowed; }
.patient-choice-card-icon { display: grid; place-items: center; width: 46px; height: 46px; border: 1px solid var(--line); border-radius: 13px; background: var(--soft); color: var(--accent); }
.patient-choice-card-icon svg { width: 25px; height: 25px; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.patient-choice-card-copy { display: flex; flex-direction: column; gap: 6px; min-width: 0; overflow-wrap: anywhere; }
.patient-choice-card-title { font-size: 1rem; font-weight: 700; line-height: 1.4; }
.patient-choice-card-description { color: var(--muted); font-size: .88rem; line-height: 1.5; }
.patient-choice-card-arrow { color: var(--accent); font-size: 1.3rem; text-align: center; }
.patient-choice-search-box { width: 100%; }
.patient-choice-empty { margin: 8px 0 0; color: var(--muted); font-size: .9rem; }
.patient-booking-context { display: grid; gap: 4px; padding-bottom: 12px; margin-top: 16px; border-bottom: 1px solid var(--line); }
.patient-booking-context-item { display: grid; grid-template-columns: 32px minmax(0, 1fr) auto; align-items: center; gap: 10px; min-width: 0; }
.patient-booking-context .patient-choice-card-icon { width: 32px; height: 32px; border: 0; background: transparent; }
.patient-booking-context .patient-choice-card-icon svg { width: 22px; height: 22px; }
.patient-booking-context-item strong { min-width: 0; font-size: .9rem; line-height: 1.5; overflow-wrap: anywhere; }
.patient-booking-context-item button { max-width: 180px; font-size: .85rem; text-align: right; }
.patient-booking button.patient-text-link { min-height: 44px; padding: 6px 0; border: 0; background: transparent; font-family: inherit; cursor: pointer; }
.patient-booking button.patient-text-link:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; border-radius: 4px; }
.patient-booking-context-item button:disabled { opacity: .55; cursor: not-allowed; }
.patient-booking-fallback-selection { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 20px; margin-top: 20px; }
@media (max-width: 575px) {
    .patient-shell .patient-choice-card { grid-template-columns: 40px minmax(0, 1fr) 20px; gap: 12px; padding: 16px 14px; }
    .patient-choice-card-icon { width: 40px; height: 40px; border-radius: 11px; }
    .patient-booking-context-item { grid-template-columns: 32px minmax(0, 1fr); }
    .patient-booking-context-item button { grid-column: 2; justify-self: end; }
}
@media (prefers-reduced-motion: reduce) { .patient-shell .patient-choice-card { transition: none; } }
.patient-booking .patient-booking-step-title { margin: 0 0 16px; font-size: 1.15rem; text-align: center; }
.patient-booking [data-booking-day-title], .patient-booking [data-booking-times-panel] > .patient-booking-step-title { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.patient-booking [data-booking-calendar-panel] { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); column-gap: 16px; align-items: center; }
.patient-booking [data-booking-nearest] { grid-column: 1; grid-row: 1; justify-self: start; min-width: 0; max-width: 100%; white-space: normal; }
.patient-booking .booking-month-nav { display: grid; grid-template-columns: 44px minmax(0, 1fr) 44px; gap: 8px; width: 296px; max-width: 100%; grid-column: 2; grid-row: 1; justify-self: center; }
.patient-booking .booking-month-nav h3 { display: grid; place-items: center; height: 48px; margin: 0; font-size: 1.1rem; text-align: center; line-height: 1.25; }
.patient-booking .booking-month-nav button { width: 44px; min-height: 44px; }
.patient-booking .booking-calendar-key { grid-column: 3; grid-row: 1; justify-self: end; margin: 0; text-align: right; }
.patient-booking [data-booking-calendar-panel] > :is(.booking-weekdays, .booking-days, .booking-calendar-loading, [data-booking-month-retry]) { grid-column: 1 / -1; }
@media (max-width: 899px) {
    .patient-booking [data-booking-nearest] { grid-column: 1 / -1; }
    .patient-booking .booking-month-nav { grid-column: 1 / -1; grid-row: 2; justify-self: center; margin-top: 12px; }
    .patient-booking .booking-calendar-key { grid-column: 1 / -1; grid-row: 3; justify-self: center; margin-top: 8px; text-align: center; }
}
.patient-booking .booking-layout { grid-template-columns: minmax(0, 1fr); gap: 24px; margin-top: 20px; }
.patient-booking .booking-calendar { min-height: 0; }
.patient-booking .booking-times-nav { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 4px 16px; }
.patient-booking .booking-times-nav h3 { display: grid; place-items: center; grid-column: 2; grid-row: 1; margin: 0; min-width: 0; max-width: 296px; min-height: 44px; font-size: 1rem; text-align: center; overflow-wrap: anywhere; }
.patient-booking .booking-times-nav button { grid-column: 3; grid-row: 1; justify-self: end; max-width: 100%; font-size: .85rem; }
@media (max-width: 575px) {
    .patient-booking .booking-times-nav { grid-template-columns: minmax(0, 1fr); }
    .patient-booking .booking-times-nav h3 { grid-column: 1; grid-row: 2; justify-self: center; }
    .patient-booking .booking-times-nav button { grid-column: 1; }
}
.patient-booking .booking-days button { min-height: 48px; }
.patient-booking .booking-days button[data-available="true"]:not([aria-pressed="true"]) { background: color-mix(in srgb, var(--accent) 10%, var(--surface)); border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); font-weight: 650; }
.patient-booking .booking-days button[data-available="true"]:not(:disabled):hover { border-color: var(--accent); }
.patient-booking .booking-slots { margin-top: 16px; }
.patient-booking [data-recommendations="true"] { display: block; }
.patient-booking .booking-slot-options { display: grid; grid-template-columns: repeat(auto-fit, minmax(90px, 1fr)); gap: .5rem; }
.patient-booking .booking-slot-heading { margin: 0 0 .75rem; font-size: .95rem; font-weight: 650; }
.patient-booking .booking-recommendations { padding: 1rem; border: 1px solid color-mix(in srgb, var(--accent) 45%, var(--line)); border-radius: 14px; background: color-mix(in srgb, var(--accent) 7%, var(--surface)); }
.patient-booking .booking-recommendations .booking-slot-options { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.patient-booking .booking-ordinary-times, .patient-booking .booking-all-times { margin-top: 1rem; }
.patient-booking button.booking-show-all-times { display: flex; align-items: center; justify-content: space-between; gap: .75rem; width: 100%; min-height: 44px; margin-top: 1rem; padding: .65rem .85rem; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--accent); font: inherit; font-size: .88rem; font-weight: 600; text-align: start; white-space: normal; cursor: pointer; }
.patient-booking .booking-show-all-times::after { content: "+"; flex-shrink: 0; font-size: 1.25rem; }
.patient-booking .booking-show-all-times:disabled { opacity: .55; cursor: not-allowed; }
.patient-booking details.booking-all-times > summary { display: flex; align-items: center; justify-content: space-between; gap: .75rem; min-height: 44px; margin-bottom: 0; padding: .65rem .85rem; border: 1px solid var(--line); border-radius: 12px; color: var(--accent); cursor: pointer; font-size: .88rem; font-weight: 600; list-style: none; overflow-wrap: anywhere; }
.patient-booking .booking-all-times > summary::-webkit-details-marker { display: none; }
.patient-booking details.booking-all-times > summary::after { content: "+"; color: var(--accent); font-size: 1.25rem; }
.patient-booking details.booking-all-times[open] > summary::after { content: "−"; }
.patient-booking .booking-all-times > summary:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.patient-booking details.booking-all-times[open] > summary { margin-bottom: .75rem; }
.patient-booking .booking-hide-other, .patient-booking .booking-all-times[open] .booking-show-all { display: none; }
.patient-booking .booking-all-times[open] .booking-hide-other { display: inline; }
.patient-booking .booking-calendar-loading:empty { min-height: 0; margin-top: 0; }
.patient-booking [data-booking-status] { min-height: 1.65em; }
.patient-booking [data-booking-status]:empty { display: none; }
.patient-booking-date { margin-top: 24px; font-size: 1.1rem; }
.patient-booking-status { margin-top: 16px; font-size: .9rem; overflow-wrap: anywhere; }
.patient-booking [data-booking-message]:empty { display: none; }
.patient-booking .patient-booking-form { margin-top: 0; align-self: start; gap: 16px; }
.patient-booking .patient-booking-form textarea { height: 80px; min-height: 80px; }
.patient-booking-note > summary { display: flex; align-items: center; justify-content: center; gap: 8px; width: fit-content; max-width: 100%; min-height: 44px; margin-inline: auto; padding: 10px 18px; box-sizing: border-box; border: 1px solid var(--line); border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); border-radius: 999px; background: var(--soft); text-align: center; color: var(--accent); font-size: .9rem; font-weight: 600; line-height: 1.4; cursor: pointer; list-style: none; overflow-wrap: anywhere; transition: background-color .15s, border-color .15s; }
.patient-booking-note > summary::-webkit-details-marker { display: none; }
.patient-booking-note > summary::before { content: "+"; flex: 0 0 1em; font-size: 1.2rem; line-height: 1; }
.patient-booking-note[open] > summary::before { content: "−"; }
.patient-booking-note > summary:is(:hover, :focus-visible) { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, var(--soft)); }
.patient-booking-note > summary:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
.patient-booking-note-field { margin-top: 8px; }
:is(.patient-appointment-history, .patient-infusion-history) .patient-appointment-list { grid-template-rows: repeat(7, 1fr); }
.patient-history-filters { display: grid; gap: 8px; margin-top: 8px; margin-bottom: 16px; }
.patient-history-filters fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
.patient-sr-only, .patient-history-sr-only, .patient-history-option input, .patient-visit-day-navigation > [data-visit-day-position], .patient-visit-window-heading > p { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.patient-history-options { display: flex; flex-wrap: wrap; gap: 8px; }
.patient-history-filter-label { margin-bottom: 8px; color: var(--muted); font-size: .82rem; font-weight: 600; }
.patient-history-option { position: relative; max-width: 100%; cursor: pointer; }
.patient-history-option > .patient-status { min-height: 44px; border: 1px solid var(--line); border-radius: 999px; background: transparent; opacity: .7; transition: background-color .15s, border-color .15s, opacity .15s; }
.patient-history-option input:checked + .patient-status { border-color: color-mix(in srgb, var(--patient-status-tint, var(--muted)) 65%, var(--line)); background: color-mix(in srgb, var(--patient-status-tint, var(--muted)) 22%, var(--surface)); opacity: 1; }
.patient-history-option:hover > .patient-status { opacity: 1; border-color: var(--patient-status-tint, var(--muted)); }
.patient-history-option input:focus-visible + .patient-status { outline: 3px solid var(--accent); outline-offset: 3px; }
.patient-history-filter-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; }
.patient-history-filter-actions > [hidden] { display: none !important; }
.patient-history-filter-actions:not(:has(> :not([hidden]))) { display: none; }
.patient-history-count { margin: 0 0 12px; font-size: .85rem; }
.patient-history-count:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.patient-history-pagination { display: flex; align-items: center; justify-content: center; gap: 18px; margin-top: 20px; }
.patient-history-page-arrow { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; flex: 0 0 44px; border: 1px solid var(--line); border-radius: 50%; background: var(--surface); color: var(--accent); font-size: 1.2rem; }
.patient-history-page-arrow:not(.is-disabled):hover { background: var(--soft); border-color: var(--accent); }
.patient-history-page-arrow:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
.patient-history-pagination .is-disabled { opacity: .35; cursor: default; }
.patient-history-page-number { min-width: 4em; color: var(--muted); font-size: .9rem; text-align: center; }
.patient-history-feedback { margin: 12px 0 0; font-size: .85rem; }
.patient-history-feedback:empty { display: none; }
[data-appointment-history][aria-busy=true] .patient-list { opacity: .6; }
.patient-booking-selection { color: var(--accent); font-weight: 700; }
.patient-booking-review { padding: 20px; border: 1px solid var(--line); border-radius: 16px; background: var(--soft); overflow-wrap: anywhere; text-align: center; }
.patient-booking .patient-booking-review h3 { margin: 0 0 12px; font-size: 1.05rem; }
.patient-booking-review-service { display: block; font-size: .95rem; line-height: 1.5; }
.patient-booking-review .patient-booking-review-label { margin: 0; color: var(--muted); font-size: .9rem; }
.patient-booking-review .patient-booking-selection { margin-top: 6px; line-height: 1.6; }
.patient-booking .patient-booking-confirmation-hint { margin: 0; font-size: .85rem; line-height: 1.6; text-align: center; }
.patient-booking .booking-calendar-tools { display: contents; }
.patient-confirm-dialog { width: min(540px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); overflow: auto; margin: auto; padding: 28px; border: 1px solid var(--line); border-radius: 20px; background: var(--surface); color: var(--ink); }
.patient-confirm-dialog::backdrop { background: rgb(0 0 0 / .45); }
.patient-confirm-dialog h2 { font-size: 1.4rem; margin: 0 0 16px; }
.patient-confirm-dialog p { margin: 0 0 16px; overflow-wrap: anywhere; }
.patient-confirm-dialog .patient-form-actions { margin-top: 24px; }
.patient-shell .patient-confirm-danger { background: transparent; border-color: var(--patient-danger); color: var(--patient-danger); }
.patient-booking .booking-slots button { font-weight: 700; min-height: 44px; }
.patient-appointment-time { color: var(--ink); font-weight: 700; white-space: nowrap; }
.patient-booking-fallback { margin-top: 24px; }
.patient-booking .booking-days button:disabled { opacity: .5; cursor: not-allowed; }
.patient-page-head h1 { margin: 20px 0; }
.patient-page-head h1:is(.patient-dashboard-greeting, .patient-page-title) { margin: 0; font-size: clamp(2rem, 3vw, 3.2rem); line-height: 1.2; overflow-wrap: anywhere; }
.patient-page-head h1.patient-dashboard-greeting { display: flex; flex-wrap: wrap; column-gap: .25em; row-gap: .08em; }
.patient-page-head h1.patient-page-title { margin-bottom: 16px; }
.patient-dashboard-greeting span { min-width: 0; color: var(--accent); }
.patient-page-head p { color: var(--muted); font-size: 1.1rem; line-height: 1.8; max-width: 720px; }
.patient-eyebrow { color: var(--accent); font-size: .73rem; letter-spacing: .11em; font-weight: 650; line-height: 1.6; text-transform: uppercase; }
.patient-shell :is(.patient-card, .patient-section, .patient-form-card, .patient-request-card, .patient-product-item) p + p { margin-top: 12px; }
.patient-section > :is(h2, h3), .patient-protocol > h3 { margin-block: 24px 12px; }
.patient-section h3 { font-size: 1.25rem; }
.patient-table-scroll { overflow-x: auto; }
.patient-table thead { background: var(--soft); }
.patient-table th, .patient-table td { overflow-wrap: anywhere; }
.patient-table td:first-child { white-space: nowrap; }
.patient-shell :is(.patient-card, .patient-section, .patient-list-main, .patient-session > div, .patient-document > span) { min-width: 0; }
.patient-shell :is(.patient-profile-list dd, .patient-change-list dd, .patient-mini-facts dd, .patient-card, .patient-session small, .patient-document) { overflow-wrap: anywhere; }
.patient-alert.is-warning { color: var(--patient-warning); background: color-mix(in srgb, var(--patient-warning) 10%, var(--surface)); border-color: color-mix(in srgb, var(--patient-warning) 35%, var(--line)); }
.patient-dashboard-head, .patient-page-head { margin-bottom: 2rem; }
.patient-page-head { max-width: 820px; }
.patient-page-head-row { max-width: none; display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; }
.patient-page-head-row > div { max-width: 820px; }
:is(.patient-appointments-head, .patient-medications-head, .patient-section-page-head) { align-items: center; }
:is(.patient-appointments-head, .patient-medications-head, .patient-section-page-head) > div { min-width: 0; }
:is(.patient-appointments-head, .patient-medications-head, .patient-section-page-head) h1.patient-page-title { margin-bottom: 0; font-family: inherit; font-size: clamp(2rem, 3vw, 3.2rem); font-weight: 650; letter-spacing: -.04em; line-height: 1.2; }
:is(.patient-appointments-head, .patient-medications-head, .patient-section-page-head) > .button { flex-shrink: 0; }
.patient-section-page-head { max-width: none; padding-bottom: 1.25rem; border-bottom: 1px solid var(--line); }
.patient-section-page-head.patient-page-head-row > div { flex: 1; max-width: none; }
.patient-section-page-head .patient-eyebrow { display: block; margin-bottom: .75rem; }
.patient-section-page-head > .patient-status { flex-shrink: 0; }
.patient-section-page-head h1.patient-page-title { display: flex; align-items: center; gap: .4em; text-wrap: wrap; }
.patient-section-page-head h1.patient-page-title > span { min-width: 0; }
.patient-section-page-head > p, .patient-section-page-head > div > p { margin-top: 1rem; }
.patient-section-icon { width: 22px; height: 22px; flex: 0 0 auto; color: var(--accent); }
/* Keep icons for actions and states; omit decoration beside descriptive text in both themes. */
.patient-shell :is(h1, h2, h3, h4) > .patient-section-icon,
.patient-shell .patient-appointment-type > .patient-section-icon,
.patient-shell .patient-security-session-info > .patient-section-icon,
.patient-shell .patient-medication-history-event-heading > strong > .patient-section-icon,
.patient-shell :is(.patient-history-disclosure, .patient-infusion-history) > summary > .patient-section-icon { display: none; }
.patient-section-page-head h1 .patient-section-icon { width: .72em; height: .72em; }
.patient-section-title { display: flex; align-items: center; gap: .65rem; }
.patient-section-title > span { min-width: 0; }
.patient-dashboard-sections {
  display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 24px;
  list-style: none; margin: 0; padding: 0;
}
.patient-dashboard-sections > li { display: flex; min-width: 0; }
.patient-dashboard-card {
  --card-muted: var(--dashboard-muted);
  --card-accent: var(--dashboard-accent);
  --card-line: color-mix(in srgb, var(--dashboard-accent) 40%, transparent);
  position: relative; isolation: isolate; display: flex; flex-direction: column; align-items: flex-start;
  width: 100%; min-width: 0; min-height: 300px; padding: 32px; overflow: hidden;
  border: 1px solid var(--dashboard-line); border-radius: 18px; background: var(--dashboard-surface);
  color: var(--dashboard-ink); box-shadow: 0 6px 24px var(--dashboard-shadow); text-decoration: none;
  transition: border-color .25s ease, box-shadow .25s ease, transform .25s ease;
}
.patient-dashboard-card::before {
  content: ""; position: absolute; z-index: -1; inset: 0; pointer-events: none;
  background: var(--dashboard-hover); clip-path: polygon(0 100%, 0 100%, 0 100%);
  transition: clip-path .5s cubic-bezier(.4, 0, .2, 1);
}
.patient-dashboard-card .patient-section-icon { width: 40px; height: 40px; margin-bottom: 20px; color: var(--card-accent); transition: color .2s ease; }
.patient-dashboard-card h2 { align-self: stretch; margin: 0; padding-bottom: 18px; border-bottom: 1px solid var(--card-line); font-size: 1.2rem; font-weight: 650; line-height: 1.4; overflow-wrap: anywhere; }
.patient-dashboard-card p { margin: 16px 0 24px; color: var(--card-muted); font-size: .95rem; line-height: 1.65; overflow-wrap: anywhere; transition: color .2s ease; }
.patient-dashboard-section-arrow { margin-top: auto; color: var(--card-accent); font-size: 1.8rem; font-weight: 400; line-height: 1; transition: color .2s ease, transform .2s ease; }
.patient-dashboard-card:is(:focus-visible, :active) { --card-muted: var(--dashboard-hover-muted); border-color: var(--dashboard-hover-line); box-shadow: 0 14px 32px var(--dashboard-hover-shadow); }
.patient-dashboard-card:is(:focus-visible, :active)::before { clip-path: polygon(0 -100%, 200% 100%, 0 100%); }
.patient-dashboard-card:focus-visible { outline: 3px solid var(--dashboard-accent); outline-offset: 4px; }
@media (hover: hover) and (pointer: fine) {
  .patient-dashboard-card:hover { --card-muted: var(--dashboard-hover-muted); border-color: var(--dashboard-hover-line); box-shadow: 0 14px 32px var(--dashboard-hover-shadow); transform: translateY(-4px); }
  .patient-dashboard-card:hover::before { clip-path: polygon(0 -100%, 200% 100%, 0 100%); }
  .patient-dashboard-card:hover .patient-dashboard-section-arrow { transform: translate(3px, -3px); }
}
@media (max-width: 767px) {
  .patient-dashboard-sections { grid-auto-flow: row; grid-template-columns: minmax(0, 1fr); gap: 18px; }
  .patient-dashboard-card { min-height: 250px; padding: 24px; }
  .patient-dashboard-card .patient-section-icon { margin-bottom: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  .patient-dashboard-card, .patient-dashboard-card::before, .patient-dashboard-card .patient-section-icon, .patient-dashboard-card p, .patient-dashboard-section-arrow { transition: none; }
  .patient-dashboard-card:hover, .patient-dashboard-card:hover .patient-dashboard-section-arrow { transform: none; }
}
.patient-dashboard-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; }
.patient-dashboard-grid[data-preview-count="1"] { grid-template-columns: minmax(0, 1fr); }
.patient-dashboard-grid[data-preview-count="3"] > .patient-card:nth-child(3) { grid-column: 1 / -1; }
.patient-dashboard-grid > .patient-module-card { grid-column: 1 / -1; }
.patient-card { padding: 26px; border: 1px solid var(--line); border-radius: 22px; background: var(--surface); box-shadow: var(--shadow); }
.patient-card h2 { color: var(--ink); font-size: 1.45rem; margin: .55rem 0; }
.patient-card-heading { display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.patient-profile-list { margin: 1rem 0 0; }
.patient-profile-list > div { display: grid; grid-template-columns: 130px 1fr; gap: 24px; padding: .75rem 0; border-bottom: 1px solid var(--line); }
.patient-profile-list dt { color: var(--muted); font-weight: 500; }
.patient-profile-list dd { margin: 0; }
.patient-profile-sections { display: grid; grid-template-columns: minmax(0, 1fr); gap: 24px; }
.patient-personal-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; min-width: 0; }
.patient-personal-details .patient-section-heading { flex-wrap: wrap; gap: 16px; }
.patient-personal-details [hidden] { display: none !important; }
.patient-personal-list { margin: 0; }
.patient-personal-list dt > label { cursor: default; }
.patient-personal-list > div { grid-template-columns: 130px minmax(0, 1fr); align-items: center; gap: 16px; padding: 8px 0; min-height: 0; }
.patient-personal-list .form-control { max-width: 620px; min-height: 44px; padding: 8px 12px; }
.patient-personal-details > .patient-detail-block-heading { margin-bottom: 12px; }
.patient-personal-list [data-profile-editor] { display: block; padding: 0; border: 0; }
.patient-personal-list .patient-request-dropdown-menu { display: block; padding: 6px; }
.patient-insurance-picker { max-width: 620px; }
.patient-insurance-picker > summary { min-height: 44px; padding: 8px 12px; background: var(--field-background); font-size: 1rem; }
.patient-insurance-picker .patient-request-dropdown-menu { width: 100%; max-width: 100%; }
.patient-insurance-picker button { display: flex; align-items: center; width: 100%; min-height: 44px; padding: 8px 12px; border: 0; border-radius: 7px; background: transparent; color: var(--ink); text-align: start; font: inherit; }
.patient-insurance-picker button:is(:hover, :focus-visible), .patient-insurance-picker button[aria-pressed=true] { background: var(--soft); color: var(--accent); }
.patient-insurance-picker > summary[aria-disabled=true] { opacity: .65; cursor: wait; }
.patient-personal-edit-options { display: grid; gap: 20px; margin-top: 20px; }
.patient-personal-edit-options .patient-info-box > .button { margin-top: 12px; }
.patient-personal-edit-options [data-profile-code-box] { margin-top: 16px; }
.patient-personal-edit-options .patient-alert { margin-bottom: 0; }
.patient-personal-edit-options textarea { max-width: 680px; }
.patient-birth-control { position: relative; display: flex; align-items: stretch; max-width: 620px; gap: 8px; }
.patient-birth-control > .form-control { min-width: 0; flex: 1; }
.patient-birth-control > .button { flex: 0 0 44px; min-width: 44px; padding: 8px; border-radius: 12px; }
.patient-birth-control > .button > svg { width: 20px; height: 20px; color: inherit; }
.patient-profile-calendar { position: absolute; top: calc(100% + 6px); right: 0; z-index: 35; width: 320px; max-width: 100%; padding: 12px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.patient-profile-calendar-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.patient-profile-calendar-toolbar > span { min-width: 0; font-weight: 650; text-align: center; text-transform: capitalize; }
.patient-profile-calendar button { display: grid; place-items: center; min-width: 0; min-height: 36px; padding: 4px; border: 1px solid transparent; border-radius: 8px; background: transparent; color: var(--ink); font: inherit; }
.patient-profile-calendar button:is(:hover, :focus-visible):not(:disabled) { background: var(--soft); border-color: var(--accent); }
.patient-profile-calendar button[aria-pressed=true] { background: var(--accent); color: var(--on-accent); }
.patient-profile-calendar button:disabled { opacity: .35; cursor: default; }
.patient-profile-calendar-toolbar > button { width: 36px; }
.patient-profile-calendar-year { display: flex; align-items: center; justify-content: center; gap: 10px; margin-block: 8px; color: var(--muted); font-size: .85rem; }
.patient-profile-calendar-year > input { width: 5.5rem; min-height: 36px; padding: 4px 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--field-background); color: var(--ink); font: inherit; }
.patient-profile-calendar-weekdays, .patient-profile-calendar-days { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 3px; }
.patient-profile-calendar-weekdays { margin-bottom: 4px; color: var(--muted); text-align: center; font-size: .75rem; }
.patient-profile-address-control { position: relative; max-width: 620px; }
.patient-profile-address-popup { position: absolute; top: calc(100% + 6px); left: 0; z-index: 34; width: 100%; max-height: 280px; overflow: auto; padding: 6px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.patient-profile-address-popup button { display: block; width: 100%; min-height: 44px; padding: 8px 12px; border: 0; border-radius: 8px; background: transparent; color: var(--ink); font: inherit; text-align: start; }
.patient-profile-address-popup button:is(:hover, :focus-visible), .patient-profile-address-popup button[aria-selected=true] { background: var(--soft); color: var(--accent); }
.patient-profile-address-popup small { display: block; padding: 6px 12px; color: var(--muted); font-size: .7rem; }
.patient-profile-address-popup small a { text-decoration: underline; }
[data-profile-suggest-status] { margin-top: 6px; font-size: .8rem; }
@media (max-width: 700px) {
  .patient-personal-details .patient-section-heading { align-items: flex-start; }
  .patient-personal-actions { width: 100%; }
  .patient-personal-actions > .button { flex: 1 1 140px; min-width: 0; }
  .patient-personal-list > div { grid-template-columns: minmax(0, 1fr); gap: 6px; }
  .patient-personal-details:not(.is-editing) .patient-personal-list > div { grid-template-columns: minmax(100px, .4fr) minmax(0, 1fr); gap: 8px; }
}

.patient-communication-block { min-width: 0; }
.patient-communication-block + .patient-communication-block { margin-top: 24px; padding-top: 24px; border-top: 1px solid var(--line); }
.patient-communication-block h3, .patient-communication-settings .email-language-picker legend { margin: 0 0 .6rem; color: var(--ink); font-family: inherit; font-size: 1rem; font-weight: 650; line-height: 1.5; }
.patient-communication-hint, .patient-communication-settings .email-language-help { margin: 0; color: var(--muted); font-size: .875rem; line-height: 1.6; opacity: 1; }
.patient-communication-preference { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; margin-top: 16px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 14px; background: var(--soft); }
.patient-communication-preference > label { display: flex; flex: 1 1 220px; min-width: 0; align-items: center; gap: 10px; color: var(--ink); cursor: pointer; }
.patient-communication-preference > label > span { overflow-wrap: anywhere; }
.patient-communication-preference > .patient-muted { font-size: .85rem; }
.patient-communication-preference input[type=checkbox], .patient-communication-settings .email-language-choice input[type=radio] { width: 18px; height: 18px; flex: 0 0 18px; margin: 0; accent-color: var(--accent); cursor: pointer; }
.patient-communication-settings .email-language-choice { min-height: 44px; padding: 10px 16px; margin: 0 10px 12px 0; gap: 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--ink); }
.patient-communication-settings .email-language-choice:has(input:checked) { border-color: var(--accent); background: var(--soft); }
.patient-communication-settings .email-language-choice:hover { border-color: var(--accent); }
.patient-communication-settings .email-language-choice:has(input:focus-visible), .patient-communication-preference input:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.patient-communication-settings .email-language-picker { margin-bottom: 0; }
.patient-communication-settings .email-language-picker:disabled .email-language-choice { opacity: .65; cursor: wait; }
.patient-email-language-saving { font-size: .85rem; }
.patient-email-language-error { margin: 12px 0 0; }
.patient-email-language-error .button { margin-top: 12px; }
/* Profile change details reuse the Requests information panel in both themes. */
.patient-request-profile-change .patient-change-list { margin: 8px 0 0; }
.patient-request-profile-change .patient-change-list > div { grid-template-columns: minmax(100px, 130px) minmax(0, 1fr); gap: 8px 16px; padding: 10px 0; }
.patient-request-profile-change .patient-change-list dd > span:first-child { color: var(--muted); }
.patient-requests-workspace .patient-request-profile-change .patient-change-list dd > .patient-status { width: auto; max-width: 100%; margin: 0; min-height: 26px; font-size: .75rem; padding: 3px 8px; }
.patient-request-profile-change .patient-card-note { margin-top: 12px; padding: 12px; border-radius: 10px; background: var(--soft); }
@media (max-width: 700px) {
  .patient-request-profile-change .patient-change-list > div { grid-template-columns: minmax(0, 1fr); gap: 4px; }
}
.patient-module-card { display: block; color: var(--ink); text-decoration: none; transition: border-color .18s ease, transform .18s ease, background .18s ease; }
a.patient-module-card:hover, .patient-treatment-card:hover { color: var(--ink); border-color: color-mix(in srgb, var(--accent) 58%, var(--line)); transform: translateY(-2px); background: color-mix(in srgb, var(--surface) 91%, var(--accent)); }
.patient-dashboard-preview { min-width: 0; }
.patient-dashboard-preview:not(.patient-module-card) { display: flex; flex-direction: column; }
.patient-dashboard-preview > .patient-dashboard-preview-link { margin-top: auto; align-self: flex-start; }
.patient-dashboard-preview > .patient-card-heading { padding-bottom: .75rem; margin-bottom: .75rem; border-bottom: 1px solid var(--line); }
.patient-dashboard-preview:not(.patient-module-card) > .patient-card-heading { margin-bottom: 0; }
.patient-dashboard-preview > .patient-card-heading h2 { margin: 0; }
.patient-dashboard-preview-list { list-style: none; padding: 0; margin: .75rem 0; }
.patient-dashboard-preview-list > li + li { border-top: 1px solid var(--line); }
:is(.patient-module-card, .patient-requests-list) .patient-dashboard-preview-list > li { padding-inline: .65rem; margin-inline: -.65rem; border-radius: 8px; transition: background .15s ease; }
:is(.patient-module-card, .patient-requests-list) .patient-dashboard-preview-list > li:is(:hover, :focus-within) { background: var(--soft); }
.patient-dashboard-preview-item { display: flex; align-items: center; flex-wrap: wrap; justify-content: space-between; gap: .6rem 1rem; padding: .8rem 0; color: var(--ink); text-decoration: none; }
.patient-dashboard-preview-main { flex: 1 1 180px; min-width: 0; display: flex; flex-direction: column; gap: .2rem; overflow-wrap: anywhere; }
.patient-dashboard-preview-main strong { font-size: .95rem; line-height: 1.4; }
.patient-dashboard-detail-row { min-height: 44px; padding-block: .65rem; }
.patient-dashboard-preview-heading { display: flex; flex-wrap: wrap; align-items: baseline; gap: .25rem .75rem; }
.patient-dashboard-preview-heading > strong { flex: 1 1 12rem; min-width: 0; }
.patient-dashboard-preview-heading > .patient-detail-label { padding: .18rem .5rem; font-size: .75rem; line-height: 1.4; }
.patient-dashboard-detail-row[href] .patient-dashboard-preview-heading > strong { color: var(--accent); text-decoration: underline; text-underline-offset: .18em; }
.patient-dashboard-preview-meta { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-start; gap: .35rem .75rem; font-size: .86rem; }
.patient-treatment-meta { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .75rem; }
.patient-dashboard-preview-main > span { font-size: .86rem; }
.patient-dashboard-preview-main small { color: var(--muted); font-size: .78rem; }
.patient-dashboard-preview-main .patient-clinic-name { display: block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.patient-clinic-name-full { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.patient-dashboard-medication-dosage { white-space: pre-line; }
.patient-dashboard-preview .patient-status { max-width: 100%; white-space: normal; }
a.patient-dashboard-preview-item:hover { color: var(--ink); background: var(--soft); }
a.patient-dashboard-preview-item:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }
.patient-dashboard-processed-requests { margin-top: 1.25rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.patient-card-heading + .patient-dashboard-processed-requests { margin-top: .75rem; padding-top: 0; border-top: 0; }
.patient-dashboard-processed-requests h3 { margin: 0 0 .5rem; color: var(--ink); font-size: 1.05rem; }
.patient-dashboard-processed-requests.patient-disclosure > summary { min-height: 44px; gap: 1rem; }
.patient-dashboard-processed-requests > summary h3 { margin: 0; }
.patient-dashboard-processed-requests > summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }
.patient-dashboard-request-links { display: flex; flex-wrap: wrap; gap: .5rem 1.5rem; }
.patient-dashboard-request-response { margin: 0 0 .8rem; color: var(--ink); font-size: .86rem; overflow-wrap: anywhere; }
.patient-dashboard-request-response p { margin: .25rem 0 0; white-space: pre-wrap; }
.patient-request-pagination { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: .75rem 1.25rem; margin-top: 1.25rem; }

.patient-dashboard-preview-link { display: inline-flex; align-items: center; gap: .5rem; min-height: 44px; font-size: .9rem; }
.patient-kicker { color: var(--accent); text-transform: uppercase; letter-spacing: .08em; font-size: .68rem; font-weight: 650; }
.patient-text-link, .patient-back-link { color: var(--accent); font-weight: 600; text-decoration: none; }
.patient-text-link:hover, .patient-back-link:hover { color: var(--accent); text-decoration: underline; }
.patient-back-link { display: block; width: fit-content; margin-bottom: 1rem; font-size: .9rem; }

.patient-urgent-note { display: flex; align-items: flex-start; gap: .65rem; margin: 0 0 1.5rem; padding: .9rem 1rem; color: var(--muted); border: 1px solid color-mix(in srgb, var(--patient-warning) 35%, var(--line)); border-radius: 14px; background: color-mix(in srgb, var(--patient-warning) 8%, var(--surface)); font-size: .875rem; line-height: 1.65; }
.patient-urgent-icon { flex: 0 0 18px; width: 18px; height: 18px; margin-top: .16em; color: var(--accent); }
.patient-urgent-note > span { min-width: 0; }
@media screen {
  .patient-main:has(> .patient-dashboard-sections) { display: flex; flex-direction: column; padding-bottom: 12px; }
  .patient-main:has(> .patient-dashboard-sections) > * { flex-shrink: 0; }
  .patient-main > .patient-dashboard-sections { margin-bottom: 24px; }
  .patient-main:has(> .patient-dashboard-sections) > .patient-urgent-note { margin: auto 0 0; }
}

.patient-alert { margin-bottom: 1rem; padding: .85rem 1rem; border: 1px solid var(--line); border-radius: 14px; }
.patient-alert.is-success { color: var(--patient-success); background: color-mix(in srgb, var(--patient-success) 10%, var(--surface)); border-color: color-mix(in srgb, var(--patient-success) 35%, var(--line)); }
.patient-alert.is-danger { color: var(--patient-danger); background: color-mix(in srgb, var(--patient-danger) 10%, var(--surface)); border-color: color-mix(in srgb, var(--patient-danger) 35%, var(--line)); }
.patient-info-box { padding: .85rem 1rem; color: var(--muted); background: var(--soft); border: 1px solid var(--line); border-radius: 14px; }
.patient-muted { color: var(--muted); }

.patient-section { margin-top: 1rem; padding: clamp(1.15rem, 3vw, 1.6rem); background: var(--surface); border: 1px solid var(--line); border-radius: 22px; box-shadow: var(--shadow); }
.patient-section-flat { margin-top: 0; }
.patient-section-heading { margin-bottom: 1rem; display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.patient-section-heading h2 { margin: .2rem 0 0; font-size: 1.45rem; }
.patient-section-heading .patient-heading-with-icon { display: flex; align-items: center; gap: 10px; }
.patient-appointments-head > .button > .patient-section-icon { width: 18px; height: 18px; color: inherit; }
.patient-detail-block-heading { padding-bottom: .8rem; margin-bottom: 1rem; border-bottom: 1px solid var(--line); }
.patient-detail-block-heading > .patient-section-title { min-width: 0; margin: 0; font-family: inherit; font-size: 1.45rem; font-weight: 650; letter-spacing: -.03em; line-height: 1.35; overflow-wrap: anywhere; }
.patient-treatment-heading > .patient-section-title { font-family: inherit; font-size: 1.45rem; font-weight: 600; letter-spacing: -.04em; line-height: 1.2; }
.patient-detail-block-heading > .patient-text-link { flex-shrink: 0; }
.patient-clinical-summary > .patient-detail-block-heading:not(:first-child) { margin-top: 1.5rem; }
.patient-section h2, .patient-section h3, .patient-section h4 { color: var(--ink); }
.patient-two-column { display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr); gap: 24px; align-items: start; }
.patient-card-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; }
.patient-card-summary { padding-top: .75rem; border-top: 1px solid var(--line); color: var(--ink) !important; }
.patient-card-meta { margin-top: 1rem; display: flex; flex-wrap: wrap; gap: .5rem 1rem; color: var(--muted); font-size: .78rem; }

.patient-status { display: inline-flex; width: fit-content; min-height: 44px; max-width: 100%; align-items: center; justify-content: center; gap: .45rem; padding: 10px 16px; border-radius: 8px; border: 1px solid transparent; color: color-mix(in srgb, var(--patient-status-tint, var(--muted)) 80%, var(--ink)); background: color-mix(in srgb, var(--patient-status-tint, var(--muted)) 20%, var(--surface)); font-size: .8rem; font-weight: 650; line-height: 1.4; text-align: center; white-space: normal; overflow-wrap: anywhere; }
.patient-status.is-ok { --patient-status-tint: var(--patient-success); }
.patient-status.is-warning { --patient-status-tint: var(--patient-warning); }
.patient-status.is-danger { --patient-status-tint: var(--patient-danger); }
.patient-status.is-info { --patient-status-tint: var(--accent); }

.patient-segmented { display: flex; width: fit-content; padding: .25rem; gap: .25rem; background: var(--soft); border: 1px solid var(--line); border-radius: 14px; }
.patient-segmented a { padding: .6rem .85rem; color: var(--muted); text-decoration: none; border-radius: 10px; font-weight: 600; font-size: .88rem; }
.patient-segmented a.active { color: var(--on-accent); background: var(--accent); }
.patient-inline-form { margin: 1rem 0; display: flex; align-items: end; gap: .7rem; }
.patient-inline-form label { align-self: center; color: var(--muted); font-weight: 600; }
.patient-inline-form .form-control { width: auto; min-height: 44px; }
.patient-slot-group { margin-top: 1rem; }
.patient-slot-group h3 { margin-bottom: .7rem; font-size: 1rem; }
.patient-slot-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: .55rem; }
.patient-slot { min-height: 58px; padding: .65rem; display: grid; place-items: center; color: var(--ink); text-decoration: none; background: var(--soft); border: 1px solid var(--line); border-radius: 13px; }
.patient-slot span { color: var(--muted); font-size: .7rem; }
.patient-slot:hover { color: var(--ink); border-color: var(--accent); background: color-mix(in srgb, var(--accent) 9%, var(--surface)); }

.patient-list { display: grid; gap: .7rem; }
.patient-list-compact { margin-top: 1rem; }
.patient-list-item { padding: .85rem; display: flex; align-items: center; gap: .9rem; background: var(--soft); border: 1px solid var(--line); border-radius: 15px; }
.patient-list-item.is-muted { opacity: 1; color: var(--muted); }
.patient-list-main { min-width: 0; flex: 1; }
.patient-list-main h3 { margin: 0 0 .2rem; font-size: .98rem; }
.patient-list-main p { margin: 0; color: var(--muted); font-size: .86rem; }
.patient-list-main small { display: block; margin-top: .3rem; color: var(--muted); }
.patient-list-item.patient-protocol-row { display: grid; grid-template-columns: minmax(0, 1fr) 11rem 9rem; gap: 12px 20px; color: var(--ink); text-decoration: none; overflow-wrap: anywhere; }
.patient-protocol-row .patient-list-main h3 { margin: 0; line-height: 1.5; }
.patient-protocol-title-link { color: var(--accent); text-decoration: underline; text-underline-offset: .18em; }
.patient-protocol-title-link:hover { color: var(--accent); }
.patient-protocol-clinic { color: var(--muted); font-size: .86rem; font-weight: 400; }
.patient-protocol-row .patient-protocol-summary { margin-top: .35rem; line-height: 1.5; }
.patient-protocol-facts { display: grid; gap: .3rem; min-width: 0; color: var(--muted); font-size: .82rem; line-height: 1.5; font-variant-numeric: tabular-nums; }
.patient-protocol-facts > span:first-child { color: var(--accent); font-weight: 700; }
.patient-protocol-actions { display: grid; justify-items: stretch; gap: .5rem; min-width: 0; }
.patient-protocol-actions > .patient-status { width: 100%; box-sizing: border-box; }
.patient-protocol-actions .patient-detail-label { color: var(--accent); }
.patient-protocol-row:is(:hover, :focus-within) { border-color: var(--accent); }
.patient-protocol-row:is(:hover, :focus-within) .patient-detail-label { border-color: var(--accent); background: var(--surface); }
.patient-protocol-title-link:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
@media (min-width: 900px) {
  .patient-protocol-row .patient-list-main > h3 { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); align-items: center; column-gap: 20px; }
  .patient-protocol-row .patient-list-main > h3 > :is(.patient-protocol-title-link, .patient-protocol-clinic) { min-width: 0; }
}
@media (max-width: 767px) {
  .patient-list-item.patient-protocol-row { grid-template-columns: minmax(0, 1fr) 9rem; gap: 12px; }
  .patient-protocol-row .patient-list-main { grid-column: 1 / -1; }
  .patient-protocol-actions .patient-detail-label { max-width: 100%; white-space: normal; }
}
@media (max-width: 479px) {
  .patient-list-item.patient-protocol-row { grid-template-columns: minmax(0, 1fr); }
  .patient-protocol-actions { width: min(100%, 9rem); }
}
.patient-list-actions { display: flex; align-items: stretch; justify-content: flex-end; flex-wrap: wrap; gap: .55rem; }
.patient-list-actions > .button-small { min-height: 44px; max-width: 100%; justify-content: center; padding: 10px 16px; font-size: .8rem; font-weight: 650; line-height: 1.4; text-align: center; white-space: normal; overflow-wrap: anywhere; }
.patient-status-icon { width: 1rem; height: 1rem; flex: 0 0 1rem; }
.patient-status-icon > * { display: none; }
.patient-status-icon > .patient-status-icon-info { display: block; }
.patient-status:is(.is-ok, .is-warning, .is-danger, .patient-status-readonly) .patient-status-icon-info,
.patient-status-infusion:is(.is-info, .is-neutral) .patient-status-icon-info,
.patient-status-schedule.is-info .patient-status-icon-info,
.patient-status-treatment.is-neutral .patient-status-icon-info { display: none; }
.patient-status.is-ok .patient-status-icon-check,
.patient-status.is-warning .patient-status-icon-clock,
.patient-status.is-danger .patient-status-icon-cross,
.patient-status-infusion.is-info .patient-status-icon-clock,
.patient-status-infusion.is-neutral .patient-status-icon-cross,
.patient-status-schedule.is-info .patient-status-icon-clock,
.patient-status-treatment.is-neutral .patient-status-icon-check,
.patient-status-readonly .patient-status-icon-lock { display: block; }
.patient-status-treatment.is-warning .patient-status-icon-clock { display: none; }
.patient-status-treatment.is-warning .patient-status-icon-pause { display: block; }
.patient-date-text { color: var(--accent); font-size: 1rem; font-weight: 700; line-height: 1.45; font-variant-numeric: tabular-nums; white-space: nowrap; }
.patient-list-item.patient-appointment-card { display: grid; grid-template-columns: max-content minmax(0, 1fr) auto; align-items: center; gap: 8px 16px; padding: 14px; }
.patient-appointment-when { grid-column: 1; grid-row: 1 / 3; align-self: center; display: flex; align-items: baseline; flex-wrap: wrap; gap: .25rem .6rem; width: 10.5rem; max-width: 100%; min-width: 0; line-height: 1.45; font-variant-numeric: tabular-nums; }
.patient-appointment-when > .patient-time-block { color: var(--ink); font-size: 1rem; font-weight: 500; white-space: nowrap; }
.patient-appointment-card > .patient-list-main { grid-column: 2; grid-row: 1; }
.patient-appointment-card > .patient-list-main h3 { margin: 0; line-height: 1.5; }
.patient-appointment-type { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; vertical-align: middle; }
.patient-appointment-type > .patient-section-icon { width: 16px; height: 16px; flex: 0 0 16px; }
.patient-appointment-type-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.patient-appointment-card .patient-appointment-clinic { color: var(--muted); font-size: .86rem; font-weight: 400; overflow-wrap: anywhere; }
.patient-clinic-map-link { color: var(--accent); text-decoration: underline; text-decoration-color: color-mix(in srgb, var(--accent) 40%, transparent); text-underline-offset: .18em; }
.patient-clinic-map-link > svg { display: inline-block; width: 1em; height: 1em; margin-inline-end: .25em; vertical-align: -.15em; }
.patient-clinic-map-link:hover { color: var(--accent); text-decoration-color: currentColor; }
.patient-clinic-map-link:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 2px; }
.patient-appointment-status { grid-column: 3; grid-row: 1; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; min-width: 0; }
.patient-appointment-status .patient-status { min-height: 32px; padding: 4px 0; gap: 5px; border: 0; border-radius: 0; background: none; font-size: .75rem; line-height: 1.35; cursor: default; }
.patient-appointment-status .patient-status-icon { width: .85rem; height: .85rem; flex-basis: .85rem; }
.patient-appointment-controls { grid-column: 2 / -1; min-width: 0; display: flex; flex-direction: column; }
.patient-appointment-card .patient-list-actions { padding: 0; width: auto; justify-content: flex-end; gap: 6px; }
.patient-appointment-card .patient-appointment-deadline.is-expired + .patient-list-actions:not([hidden]) { margin-top: 6px; }
.patient-appointment-menu-trigger, .patient-appointment-card .patient-appointment-action { min-height: 32px; padding: 6px 10px; gap: 6px; font-size: .76rem; line-height: 1.35; }
.patient-appointment-card .button > svg { width: 14px; height: 14px; flex: 0 0 14px; }
.patient-appointment-menu { position: relative; min-width: 0; max-width: 100%; }
.patient-appointment-menu[open] { z-index: 30; }
.patient-appointment-menu-trigger { list-style: none; white-space: nowrap; }
.patient-appointment-menu-trigger::-webkit-details-marker { display: none; }
.patient-appointment-menu[open] > .patient-appointment-menu-trigger { background: var(--surface); }
.patient-appointment-menu[open] > .patient-appointment-menu-trigger > svg { transform: rotate(180deg); }
.patient-appointment-menu-panel { position: absolute; inset-inline-end: 0; top: calc(100% + 6px); width: max-content; min-width: 210px; max-width: min(280px, calc(100vw - 56px)); max-height: min(280px, 70vh); overflow: auto; padding: 5px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); box-shadow: 0 8px 24px color-mix(in srgb, var(--ink) 16%, transparent); }
.patient-appointment-menu.opens-up > .patient-appointment-menu-panel { top: auto; bottom: calc(100% + 6px); }
.patient-appointment-menu-deadline { padding: 10px 12px 12px; margin-bottom: 4px; border-bottom: 1px solid var(--line); color: var(--muted); font-size: .76rem; line-height: 1.5; }
.patient-appointment-menu-deadline strong { display: block; margin-top: 2px; }
.patient-appointment-menu-action { display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 10px 12px; border-radius: 7px; color: var(--ink); font-size: .82rem; font-weight: 550; line-height: 1.4; text-decoration: none; overflow-wrap: anywhere; }
.patient-appointment-menu-action > svg { width: 16px; height: 16px; flex: 0 0 16px; }
.patient-appointment-menu-action:hover { background: var(--soft); }
.patient-appointment-menu-action:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; background: var(--soft); }
.patient-appointment-menu-action.is-danger { color: var(--patient-danger); }
.patient-appointment-menu-action.is-danger:hover, .patient-appointment-menu-action.is-danger:focus-visible { background: color-mix(in srgb, var(--patient-danger) 10%, var(--surface)); }
.patient-appointment-deadline { color: var(--muted); font-size: .76rem; line-height: 1.5; overflow-wrap: anywhere; }
.patient-deadline-message { display: flex; gap: 7px; align-items: flex-start; }
.patient-deadline-message > svg { width: 16px; height: 16px; flex: 0 0 16px; margin-top: .2em; }
.patient-deadline-message strong { color: var(--ink); white-space: nowrap; }
.patient-appointment-deadline.is-expired .patient-deadline-message { color: var(--patient-warning); }
.patient-appointment-deadline.is-expired strong { color: inherit; }
.patient-deadline-contact { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; min-height: 32px; margin-top: 4px; color: var(--accent); text-decoration: underline; text-underline-offset: .18em; overflow-wrap: anywhere; }
.patient-deadline-contact > svg { width: 14px; height: 14px; flex: 0 0 14px; }
.patient-deadline-contact > span { min-width: 0; }
.patient-deadline-contact:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 3px; }
.patient-appointment-card [hidden] { display: none !important; }
@media (min-width: 900px) {
  .patient-appointment-controls { grid-column: 2 / -1; grid-row: 2; align-self: center; }
}
@media (min-width: 1100px) {
  .patient-list-item.patient-appointment-card { grid-template-columns: 10.5rem minmax(0, 1fr) 170px 180px; gap: 10px; padding: 10px 12px; }
  .patient-appointment-when { grid-row: 1; }
  .patient-appointment-card > .patient-list-main h3 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .patient-appointment-card .patient-deadline-message { gap: 5px; }
  .patient-appointment-card .patient-deadline-message > svg { width: 14px; height: 14px; flex-basis: 14px; }
  .patient-appointment-card > .patient-appointment-status { grid-column: 3; grid-row: 1; max-width: 170px; justify-content: flex-start; }
  .patient-appointment-status > .patient-status { justify-content: flex-start; text-align: start; }
  .patient-appointment-controls { grid-column: 4; grid-row: 1; max-width: 260px; }
  .patient-appointment-controls:has(> .patient-appointment-deadline.is-expired) { align-items: center; }
  .patient-appointment-controls > .patient-appointment-deadline.is-expired { width: 100%; text-align: center; }
  .patient-appointment-deadline.is-expired > [data-deadline-expired] { display: flex; flex-direction: column; align-items: center; }
  .patient-appointment-deadline.is-expired .patient-deadline-message { max-width: 100%; justify-content: center; }
  :is(.patient-appointment-history, .patient-infusion-history) .patient-appointment-card > .patient-appointment-status { grid-column: 3 / -1; max-width: none; justify-content: flex-end; }
  @supports (grid-template-columns: subgrid) {
    /* The outer subgrid tracks include the card's 12px padding and 1px border. */
    .patient-appointment-list { grid-template-columns: max-content minmax(0, 1fr) minmax(0, 1.25fr) 170px 193px; column-gap: 10px; }
    .patient-appointment-list > .patient-appointment-card { grid-column: 1 / -1; grid-template-columns: subgrid; }
    .patient-appointment-list .patient-appointment-card > .patient-list-main { grid-column: 2 / 4; display: grid; grid-template-columns: subgrid; align-items: center; }
    .patient-appointment-list .patient-list-main > h3 { grid-column: 1 / -1; display: grid; grid-template-columns: subgrid; align-items: center; }
    .patient-appointment-list .patient-list-main > h3 > :is(.patient-appointment-type, .patient-appointment-clinic) { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
    .patient-appointment-list .patient-list-main > small { grid-column: 1 / -1; }
    .patient-appointment-list .patient-appointment-card > .patient-appointment-status { grid-column: 4; }
    .patient-appointment-list .patient-appointment-controls { grid-column: 5; }
    :is(.patient-appointment-history, .patient-infusion-history) .patient-appointment-card > .patient-appointment-status { grid-column: 4 / -1; }
  }
}
@media (max-width: 899px) {
  .patient-list-item.patient-appointment-card { grid-template-columns: max-content minmax(0, 1fr); }
  .patient-appointment-card > .patient-appointment-status { grid-column: 2; grid-row: 2; justify-content: flex-start; }
  .patient-appointment-controls { grid-column: 1 / -1; }
  .patient-appointment-card .patient-list-actions { justify-content: flex-start; }
  .patient-appointment-menu { width: 100%; }
  .patient-appointment-menu-trigger { width: 100%; min-height: 44px; justify-content: space-between; }
  .patient-appointment-card .patient-appointment-action { min-height: 44px; width: 100%; }
  .patient-appointment-status > .patient-status { min-height: 44px; }
}
@media (max-width: 599px) {
  .patient-list-item.patient-appointment-card { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .patient-appointment-when { grid-column: 1; grid-row: 1; }
  .patient-appointment-card > .patient-list-main { grid-column: 1; grid-row: 2; }
  .patient-appointment-card > .patient-appointment-status { grid-column: 1; grid-row: auto; }
}
@media (pointer: coarse) {
  .patient-deadline-contact { min-height: 44px; }
  .patient-appointment-menu-trigger { min-height: 44px; }
  .patient-appointment-card .patient-appointment-action { min-height: 44px; }
  .patient-appointment-status > .patient-status { min-height: 44px; }
}
.patient-empty-state { padding: 1.4rem; text-align: center; color: var(--muted); background: var(--soft); border: 1px solid var(--line); border-radius: 16px; }
.patient-empty-state h2, .patient-empty-state h3 { color: var(--ink); }
.patient-empty-large { padding: 3rem 1.5rem; }

.patient-form-card { max-width: 820px; margin: 0 auto; padding: clamp(1.2rem, 4vw, 2rem); background: var(--surface); border: 1px solid var(--line); border-radius: 24px; box-shadow: var(--shadow); }
.patient-form-stack { display: grid; gap: 24px; margin-top: 1rem; }
.patient-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; }
.patient-form-wide { grid-column: 1 / -1; }
.patient-form-actions { display: flex; justify-content: flex-end; gap: .7rem; }
.patient-validation { color: var(--patient-danger); font-size: .82rem; }
.patient-validation ul { margin: 0; padding-left: 1.2rem; }
.validation-summary-valid, .field-validation-valid { display: none; }
.patient-code-box { max-width: 360px; padding: 1rem; background: var(--soft); border: 1px solid var(--line); border-radius: 15px; }
.patient-code-input { max-width: 190px; letter-spacing: .25em; font-size: 1.25rem !important; font-weight: 650; text-align: center; }
.patient-code-send { margin-top: 1rem; }

.patient-change-list, .patient-mini-facts { margin: .8rem 0; }
.patient-change-list div { padding: .55rem 0; display: grid; grid-template-columns: 120px 1fr; gap: .8rem; border-top: 1px solid var(--line); }
.patient-change-list dt, .patient-mini-facts dt { color: var(--muted); }
.patient-change-list dd { margin: 0; display: flex; flex-wrap: wrap; gap: .45rem; align-items: center; }
.patient-request-list { display: grid; gap: .8rem; }
.patient-request-card { padding: 1rem; background: var(--soft); border: 1px solid var(--line); border-radius: 16px; }
.patient-request-card .patient-card-heading small { display: block; color: var(--muted); }
.patient-staff-response { padding: .7rem; background: color-mix(in srgb, var(--accent) 9%, var(--surface)); border-radius: 12px; }
.patient-mini-facts div { display: flex; justify-content: space-between; gap: 24px; padding: .35rem 0; }
.patient-mini-facts dd { margin: 0; text-align: right; }
.patient-dosage { color: var(--ink) !important; font-size: 1rem; }

.patient-medication-list { list-style: none; margin: 0; padding: 0; }
.patient-medication-item { display: grid; grid-template-columns: minmax(0, 1fr); align-items: start; gap: 1rem; padding: 14px; overflow-wrap: anywhere; }
.patient-medication-item[id] { scroll-margin-top: 110px; }
.patient-medication-main, .patient-medication-usage, .patient-medication-facts { min-width: 0; }
.patient-medications .patient-medication-main h3 { margin: 0; font-size: 1.1rem; line-height: 1.45; }
.patient-medication-detail-link { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem 1.25rem; min-height: 44px; }
.patient-medication-detail-link:hover { text-decoration: none; }
.patient-medication-name { flex: 1 1 15rem; min-width: 0; text-decoration: underline; text-underline-offset: .18em; }
.patient-detail-label, .patient-medication-detail-label { display: inline-flex; align-items: center; gap: .45rem; padding: .35rem .7rem; border: 1px solid var(--line); border-radius: 999px; font-size: .85rem; font-weight: 600; line-height: 1.5; white-space: nowrap; }
.patient-card-detail-heading { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem 1rem; min-height: 44px; margin-block: .55rem; }
.patient-card-detail-heading h2 { flex: 1 1 15rem; min-width: 0; margin: 0; color: var(--accent); text-decoration: underline; text-underline-offset: .18em; }
.patient-card-detail-heading.is-unavailable h2 { color: var(--ink); text-decoration: none; }
.patient-card-detail-heading .patient-detail-label { color: var(--accent); }
a.patient-card-detail-heading:hover { text-decoration: none; }
.patient-card-detail-heading:is(:hover, :focus-visible) .patient-detail-label, .patient-treatment-card:is(:hover, :focus-visible) .patient-detail-label { border-color: var(--accent); background: var(--soft); }
.patient-medication-detail-link:is(:hover, :focus-visible) :is(.patient-detail-label, .patient-medication-detail-label), a.patient-dashboard-detail-row:is(:hover, :focus-visible) .patient-detail-label { border-color: var(--accent); background: var(--soft); }
.patient-medication-label { color: var(--muted); font-size: .78rem; }
.patient-medication-dosage .patient-dosage { margin: .25rem 0 0; line-height: 1.7; white-space: pre-line; }
.patient-medication-meta { border-top: 1px solid var(--line); padding-top: .75rem; }
.patient-medication-meta .patient-medication-prescribed { margin: .8rem 0 0; color: var(--muted); font-size: .8rem; }
.patient-medication-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 12rem), 1fr)); align-content: start; gap: .8rem; margin: 0; font-size: .86rem; }
.patient-medication-facts dt { margin-bottom: .15rem; color: var(--muted); font-size: .78rem; font-weight: 400; }
.patient-medication-facts dd { margin: 0; color: var(--ink); line-height: 1.5; }
.patient-medication-history > summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; border-radius: 6px; }
.patient-medication-help { margin-top: 1rem; }
.patient-medication-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem; }
.patient-medication-actions .button { white-space: normal; text-align: center; }
.patient-dose-slots { display: flex; flex-wrap: wrap; gap: 1rem 2rem; margin: 1.25rem 0; }
.patient-dose-slots dt { color: var(--muted); font-size: .85rem; }
.patient-dose-slots dd { margin: .3rem 0 0; color: var(--ink); font-weight: 650; }
.patient-diary-outcomes { display: flex; flex-wrap: wrap; gap: .5rem 1.5rem; border: 0; padding: 0; margin: 0; }
.patient-diary-outcomes legend { color: var(--ink); font-weight: 600; margin-bottom: .5rem; }
.patient-diary-outcomes label { display: inline-flex; align-items: center; gap: .45rem; min-height: 44px; cursor: pointer; }
.patient-diary-outcomes input { accent-color: var(--accent); }
.patient-diary-item { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; padding: 1.25rem 0; overflow-wrap: anywhere; }
.patient-diary-item > div { min-width: 0; flex: 1; }
.patient-diary-item + .patient-diary-item { border-top: 1px solid var(--line); }
.patient-diary-item h3 { margin: 0 0 .5rem; }
.patient-diary-item p { margin: .3rem 0; }
.patient-diary-item > a { flex-shrink: 0; min-height: 44px; }
.patient-diary-snapshot { margin-top: .65rem; color: var(--muted); font-size: .85rem; }
.patient-diary-snapshot summary { min-height: 44px; }
.patient-reminder-panel { margin-bottom: 1.5rem; padding: 1.25rem; background: var(--surface); border: 1px solid var(--accent); border-radius: 18px; }
.patient-reminder-panel[hidden] { display: none; }
.patient-reminder-panel h2 { margin: 0 0 1rem; font-size: 1.25rem; }
.patient-reminder-item { padding: .75rem 0; overflow-wrap: anywhere; }
.patient-reminder-item + .patient-reminder-item { border-top: 1px solid var(--line); }
.patient-reminder-item h3 { margin: 0; font-size: 1rem; }
.patient-reminder-item p { margin: .35rem 0 .75rem; color: var(--muted); }
.patient-reminder-panel > p { margin-bottom: 0; color: var(--muted); }

.patient-protocol { margin-top: .8rem; padding: 1rem; background: var(--soft); border: 1px solid var(--line); border-radius: 16px; }
.patient-protocol > h3 { margin-top: 0; }
.patient-product-item { padding: .9rem; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; }
.patient-product-item h4 { margin: 0 0 .45rem; font-size: 1rem; }
.patient-product-item p { margin: .3rem 0; color: var(--muted); }
.patient-clinical-summary { border-left: 4px solid var(--accent); }

/* Compact protocol detail; infusion pages and staff charts keep their own layout. */
.patient-main:has(> .patient-protocol-detail) { padding-block: 28px 36px; }
.patient-protocol-detail { min-width: 0; }
.patient-protocol-detail > .patient-page-head { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 12px 16px; padding-bottom: 14px; margin-bottom: 16px; }
.patient-protocol-detail > .patient-page-head > div { display: contents; }
.patient-protocol-detail .patient-back-link { grid-column: 3; grid-row: 1; display: inline-flex; align-items: center; justify-self: end; min-height: 36px; margin: 0; font-size: .85rem; white-space: nowrap; }
.patient-protocol-detail .patient-page-head h1.patient-page-title { grid-column: 1; grid-row: 1; margin-bottom: 0; font-size: clamp(1.5rem, 2.2vw, 2rem); line-height: 1.25; }
.patient-protocol-detail .patient-page-head > .patient-status { grid-column: 2; grid-row: 1; }
.patient-protocol-detail > .patient-section,
.patient-protocol-detail .patient-treatment-intro > .patient-section { margin-top: 12px; padding: 18px; border-radius: 16px; box-shadow: none; }
.patient-protocol-detail .patient-treatment-intro { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); gap: 12px; margin-top: 12px; }
.patient-protocol-detail .patient-treatment-intro > .patient-section { min-width: 0; margin-top: 0; }
.patient-protocol-detail .patient-treatment-heading { margin-bottom: 10px; padding-bottom: 8px; gap: 12px; }
.patient-protocol-detail .patient-treatment-heading > .patient-section-title { margin: 0; font-size: 1.1rem; line-height: 1.3; letter-spacing: -.025em; }
.patient-protocol-detail .patient-treatment-info p { margin: 8px 0; font-size: .9rem; line-height: 1.55; overflow-wrap: anywhere; }
.patient-protocol-detail .patient-treatment-info > p:last-child { margin-bottom: 0; }
.patient-protocol-detail .patient-mini-facts { margin: 0 0 8px; font-size: .85rem; }
.patient-protocol-detail .patient-mini-facts div { display: flex; align-items: baseline; padding: 2px 0; }
.patient-protocol-detail .patient-wellbeing .wellbeing-today { flex: none; max-width: 100%; padding: 6px 10px; border: 1px solid var(--line); border-radius: 8px; color: var(--ink); font-size: .88rem; font-weight: 600; line-height: 1.4; font-variant-numeric: tabular-nums; }
.patient-protocol-detail .patient-wellbeing .wellbeing-today[data-period=past] { border-color: color-mix(in srgb, var(--accent) 35%, var(--line)); background: color-mix(in srgb, var(--accent) 8%, var(--surface)); color: var(--accent); }
.wellbeing-help-button { display: inline-flex; align-items: center; gap: 8px; max-width: 100%; min-width: 32px; min-height: 32px; justify-content: center; padding: 0; border: 0; background: transparent; color: inherit; font: inherit; cursor: pointer; }
.wellbeing-help-button > span { min-width: 0; }
.wellbeing-help-button > .patient-section-icon { flex: none; width: 16px; height: 16px; color: var(--accent); }
.wellbeing-help-button:hover { color: var(--accent); }
.wellbeing-help-button:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; border-radius: 4px; }
.wellbeing-help-popover { --wellbeing-help-width: min(380px, calc(100vw - 24px)); position: fixed; inset: 0; width: var(--wellbeing-help-width); max-height: calc(100dvh - 24px); overflow: auto; margin: auto; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--ink); box-shadow: var(--shadow); font: inherit; font-size: .85rem; line-height: 1.55; }
.wellbeing-help-popover[data-wellbeing-anchored] { inset: auto; margin: 0; }
.wellbeing-help-popover[data-wellbeing-anchored]:popover-open:not([data-wellbeing-positioned]) { visibility: hidden; }
.wellbeing-note-heading { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; }
.wellbeing-note-heading > .form-label { margin: 0; }
.patient-protocol-detail .patient-wellbeing .wellbeing-muted { margin: 8px 0 12px; font-size: .82rem; line-height: 1.5; }
.patient-protocol-detail .patient-wellbeing .patient-form-stack { grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 14px; margin-top: 12px; }
.patient-protocol-detail .wellbeing-fieldset { grid-column: 1 / -1; }
.patient-protocol-detail .wellbeing-note-field { min-width: 0; }
.patient-protocol-detail .wellbeing-fieldset legend { max-width: 100%; padding: 0; margin-bottom: 10px; color: var(--ink); font-size: .9rem; line-height: 1.5; }
.patient-protocol-detail .wellbeing-scale-group { gap: 8px; padding: 8px; border-radius: 10px; }
.patient-protocol-detail .wellbeing-face { padding-block: 2px; }
.patient-protocol-detail .wellbeing-face svg { width: 42px; height: 42px; margin-bottom: 6px; }
.patient-protocol-detail .wellbeing-face { opacity: 1; }
/* Unavailable dates stay readable; the existing markup keeps them non-interactive. */
.patient-shell .wellbeing-calendar .is-disabled { opacity: 1; color: var(--muted); }
.patient-protocol-detail .wellbeing-face span { font-size: .85rem; color: var(--ink); }
.patient-protocol-detail #wellbeing-note { min-height: 64px; padding: 10px 12px; font-size: .9rem; resize: vertical; }
.patient-protocol-detail .wellbeing-form-actions { display: flex; justify-content: flex-end; }
.patient-protocol-detail .wellbeing-form-actions .button { min-height: 44px; padding: 10px 24px; font-size: .9rem; }
.patient-protocol-detail .patient-card-note { margin-top: 12px; font-size: .78rem; line-height: 1.5; }
.patient-protocol-detail .patient-wellbeing-history { scroll-margin-top: 20px; }
.patient-protocol-detail .patient-wellbeing-history > summary { flex-wrap: wrap; row-gap: 4px; }
.patient-protocol-detail .wellbeing-history-count { margin-inline-start: 0; color: var(--muted); font-size: .85rem; font-weight: 500; white-space: nowrap; }
.patient-protocol-detail .wellbeing-history-count::before { content: "· "; }
.patient-protocol-detail .patient-wellbeing-history > summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.patient-protocol-detail .wellbeing-toolbar { gap: 8px 16px; margin-bottom: 10px; font-size: .85rem; }
.patient-protocol-detail .wellbeing-toolbar a { display: inline-flex; align-items: center; min-height: 36px; }
.patient-protocol-detail .wellbeing-history { max-height: 24rem; overflow-y: auto; margin-bottom: 14px; overscroll-behavior: contain; scrollbar-gutter: stable; }
.patient-protocol-detail .wellbeing-history:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.patient-protocol-detail .patient-wellbeing .wellbeing-history-row { padding-block: 7px; font-size: .85rem; }
.patient-protocol-detail .wellbeing-history-face svg { width: 24px; height: 24px; }
.patient-protocol-detail .patient-protocol { margin-top: 14px; padding: 0; border: 0; border-radius: 0; background: transparent; }
.patient-protocol-detail .patient-protocol + .patient-protocol { padding-top: 14px; border-top: 1px solid var(--line); }
.patient-protocol-detail .patient-protocol > h3 { margin: 0 0 6px; color: var(--accent); font-size: .95rem; }
.patient-protocol-detail .patient-protocol > p { margin: 6px 0 10px; color: var(--muted); font-size: .85rem; line-height: 1.5; }
.patient-protocol-detail .patient-protocol .patient-list { gap: 0; }
.patient-protocol-detail .patient-product-item { display: grid; grid-template-columns: minmax(160px, 1fr) minmax(0, 2fr); gap: 6px 20px; padding: 12px 0; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; background: transparent; }
.patient-protocol-detail .patient-product-item:last-child { border-bottom: 0; padding-bottom: 0; }
.patient-protocol-detail .patient-product-item h4 { margin: 0; font-size: .9rem; line-height: 1.5; overflow-wrap: anywhere; }
.patient-protocol-detail .patient-product-instructions { min-width: 0; }
.patient-protocol-detail .patient-product-item p { margin: 0 0 4px; font-size: .85rem; line-height: 1.5; overflow-wrap: anywhere; }
.patient-protocol-detail .patient-product-item p:last-child { margin-bottom: 0; }
@media (max-width: 600px) {
  .patient-main:has(> .patient-protocol-detail) { padding-block: 20px 28px; }
  .patient-protocol-detail > .patient-section,
  .patient-protocol-detail .patient-treatment-intro > .patient-section { padding: 14px; border-radius: 14px; }
  .patient-protocol-detail .patient-page-head-row { grid-template-columns: minmax(0, 1fr) auto; }
  .patient-protocol-detail .patient-page-head h1.patient-page-title { grid-column: 1 / -1; }
  .patient-protocol-detail .patient-back-link { grid-column: 2; grid-row: 2; min-height: 36px; padding-block: 4px; }
  .patient-protocol-detail .patient-page-head-row > .patient-status { grid-column: 1; grid-row: 2; justify-self: start; min-height: 28px; padding: 6px 10px; font-size: .78rem; }
  .patient-protocol-detail .patient-treatment-heading { flex-wrap: wrap; }
  .patient-protocol-detail .patient-wellbeing .patient-form-stack { grid-template-columns: minmax(0, 1fr); }
  .patient-protocol-detail .wellbeing-face svg { width: 36px; height: 36px; }
  .patient-protocol-detail .wellbeing-form-actions .button { width: 100%; }
  .patient-protocol-detail .patient-product-item { grid-template-columns: minmax(0, 1fr); gap: 6px; }
  .patient-protocol-detail .wellbeing-toolbar strong { order: -1; flex-basis: 100%; }
  .patient-protocol-detail .wellbeing-history-note[open] { grid-column: 1 / -1; }
}
@media (max-width: 800px) {
  .patient-protocol-detail .wellbeing-scale-scroll { overflow: visible; margin: 0; padding: 0; }
  .patient-protocol-detail .wellbeing-scale { grid-template-columns: minmax(0, 1fr); min-width: 0; }
  .patient-protocol-detail .wellbeing-scale > .wellbeing-scale-group { grid-column: 1; grid-template-columns: minmax(0, 1fr) 148px; grid-template-rows: auto; align-items: center; }
  .patient-protocol-detail .wellbeing-face svg { width: 32px; height: 32px; margin-bottom: 4px; }
}
.patient-preserve-lines { white-space: pre-line; }
.patient-summary-lead { font-size: 1.06rem; }
.patient-line-clamp { display: -webkit-box; overflow: hidden; -webkit-box-orient: vertical; -webkit-line-clamp: 3; }

.patient-timeline { display: grid; gap: 24px; }
.patient-timeline-item { display: grid; grid-template-columns: 64px 1fr; gap: 24px; align-items: start; }
.patient-timeline-date { padding-top: .8rem; display: grid; text-align: center; color: var(--muted); }
.patient-timeline-date strong { color: var(--accent); font-size: 1rem; }
.patient-timeline-date span { font-size: .72rem; }
.patient-document-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .7rem; }
.patient-document { padding: .9rem; display: flex; align-items: center; gap: .75rem; color: var(--ink); text-decoration: none; background: var(--soft); border: 1px solid var(--line); border-radius: 14px; }
.patient-document:hover { color: var(--ink); border-color: var(--accent); }
.patient-document-icon { width: 38px; height: 38px; display: grid; place-items: center; color: var(--accent); border-radius: 11px; background: color-mix(in srgb, var(--accent) 10%, var(--surface)); }
.patient-document small { display: block; color: var(--muted); }

.patient-session-list { display: grid; gap: .6rem; }
.patient-session { padding: .8rem; display: flex; align-items: center; justify-content: space-between; gap: .7rem; background: var(--soft); border: 1px solid var(--line); border-radius: 14px; }
.patient-session p { max-width: 430px; margin: .25rem 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: .8rem; }
.patient-session small { color: var(--muted); }
.patient-security { display: grid; grid-template-columns: minmax(0, 1fr); gap: 24px; }
.patient-security-head > p { font-size: .95rem; line-height: 1.6; }
.patient-security-account { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 16px; padding: 14px 16px; margin-bottom: 20px; border: 1px solid var(--line); border-radius: 14px; background: var(--soft); overflow-wrap: anywhere; }
.patient-security-account > * { min-width: 0; }
.patient-security-code-request { display: flex; justify-content: flex-end; }
.patient-security-password-form { grid-template-columns: repeat(2, minmax(0, 1fr)); max-width: 820px; }
.patient-security-password-form > div { min-width: 0; }
.patient-security-password-form small { display: block; margin-top: 6px; font-size: .8rem; }
.patient-security .patient-section-heading > form { margin: 0; max-width: 100%; }
.patient-security .patient-session-list { gap: 12px; }
.patient-security .patient-session { padding: 16px; gap: 20px; }
.patient-security-session-info { display: flex; align-items: flex-start; gap: 12px; min-width: 0; }
.patient-security-session-info > .patient-section-icon { margin-top: 3px; }
.patient-security-session-info > div { min-width: 0; }
.patient-security .patient-session p { max-width: none; white-space: normal; overflow-wrap: anywhere; font-size: .85rem; }
.patient-security-session-meta { display: flex; flex-wrap: wrap; gap: 4px 20px; font-size: .8rem; overflow-wrap: anywhere; }
.patient-security .patient-session > form { flex-shrink: 0; margin: 0; max-width: 100%; }
.patient-security .button { white-space: normal; overflow-wrap: anywhere; }
.patient-security-events { border: 1px solid var(--line); border-radius: 14px; }
.patient-security-events .patient-table { font-size: .9rem; }
.patient-security-events .patient-table th, .patient-security-events .patient-table td { padding: 12px 16px; vertical-align: middle; }
.patient-security-events .patient-table tr:last-child td { border-bottom: 0; }
.patient-security-events .patient-status { min-height: 32px; padding: 4px 10px; }
@media (max-width: 760px) {
  .patient-security-password-form { grid-template-columns: minmax(0, 1fr); gap: 18px; }
  .patient-security .patient-section-heading { align-items: flex-start; flex-wrap: wrap; gap: 16px; }
  .patient-security .patient-session { align-items: stretch; flex-direction: column; gap: 16px; }
  .patient-security .patient-session > form { align-self: flex-end; }
  .patient-security-events .patient-table { min-width: 560px; }
}
.patient-table { width: 100%; border-collapse: collapse; color: var(--ink); }
.patient-table th, .patient-table td { padding: .7rem; border-bottom: 1px solid var(--line); text-align: left; }
.patient-table th { color: var(--muted); font-size: .76rem; text-transform: uppercase; letter-spacing: .04em; }

.patient-context-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; }
.patient-context-card { display: grid; gap: .8rem; }
.patient-context-card.is-current { border-color: var(--accent); }
.patient-disclosure summary { display: flex; align-items: center; justify-content: space-between; gap: 24px; min-height: 54px; list-style: none; cursor: pointer; color: var(--ink); font-weight: 600; }
.patient-disclosure summary::-webkit-details-marker { display: none; }
.patient-disclosure summary::after { content: "+"; color: var(--accent); font-size: 1.5rem; }
.patient-disclosure[open] summary::after { content: "−"; }
.patient-disclosure[open] summary { margin-bottom: 24px; }


@media (max-width: 1023px) {
  .patient-auth-wrap { gap: 5%; }
  .patient-auth-card { padding: 28px; }
  .patient-session, .patient-section-heading { flex-wrap: wrap; }
}
@media (max-width: 767px) {
  .patient-main { padding-block: 30px 44px; }
  .patient-main-auth { padding-block: 0; }
  .patient-auth-wrap { grid-template-columns: minmax(0, 1fr); gap: 28px; padding-block: 38px 36px; min-height: 0; }
  .patient-auth-heading p { font-size: 1rem; }
  .patient-auth-card { padding: 26px; }
  .patient-page-head p { font-size: 1rem; }
  .patient-shell .brand { max-width: calc(100vw - 155px); }
  .patient-shell .footer-intro .brand { max-width: 100%; }
  .patient-shell .mobile-menu nav { max-height: calc(100dvh - 78px); overflow-y: auto; }
  .patient-dashboard-grid, .patient-card-grid, .patient-two-column, .patient-context-grid, .patient-form-grid, .patient-document-list { grid-template-columns: minmax(0, 1fr); gap: 18px; }
  .patient-profile-list > div, .patient-change-list div { grid-template-columns: minmax(0, 1fr); gap: 4px; }
  .patient-medication-item { grid-template-columns: minmax(0, 1fr); gap: 1rem; }
  .patient-diary-item { flex-direction: column; }
  .patient-medication-facts { grid-template-columns: repeat(auto-fit, minmax(min(100%, 12rem), 1fr)); }
  .patient-page-head-row { align-items: flex-start; flex-direction: column; }
  .patient-requests-list .patient-request-pagination { gap: .75rem; }
  .patient-requests-list .patient-request-pagination > span { flex-basis: 100%; text-align: center; }
  .patient-requests-list .patient-request-pagination > .button { min-width: 0; min-height: 44px; padding: 10px 12px; white-space: normal; overflow-wrap: anywhere; }
  .patient-card-heading, .patient-section-heading { flex-wrap: wrap; }
  .patient-list-item { align-items: flex-start; flex-wrap: wrap; }
  .patient-list-actions { width: 100%; justify-content: space-between; padding-left: 58px; flex-wrap: wrap; }
  .patient-inline-form { align-items: stretch; flex-direction: column; }
  .patient-inline-form label { align-self: flex-start; }
  .patient-inline-form .form-control { width: 100%; }
  .patient-form-actions { flex-wrap: wrap; }
  .patient-form-actions .button { flex: 1 1 180px; }
  .patient-session { align-items: flex-start; flex-direction: column; }
  .patient-session p { max-width: 100%; white-space: normal; }
  .patient-context-banner > div { align-items: flex-start; flex-wrap: wrap; gap: 8px; }
}
@media (max-width: 470px) {
  .patient-timeline-item { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .patient-timeline-date { display: flex; gap: 5px; padding: 0 4px; text-align: left; }
  .patient-mini-facts div { flex-direction: column; gap: 4px; }
  .patient-mini-facts dd { text-align: left; }
}
@media print {
  .patient-shell-portal { background-image: none; }
  .patient-context-banner, .patient-shell form { display: none; }
  .patient-main { width: 100%; padding: 0; }
}
.patient-review-open { overflow: hidden; }
.patient-review-dialog { position: fixed; inset: 0; width: min(720px, calc(100% - 32px)); max-height: calc(100dvh - 32px); margin: auto; padding: clamp(20px, 4vw, 36px); overflow-y: auto; overscroll-behavior: contain; border: 1px solid var(--line); border-radius: 22px; background: var(--surface); color: var(--ink); box-shadow: var(--shadow); z-index: 100; }
.patient-review-dialog::backdrop { background: #0008; backdrop-filter: blur(4px); }
.patient-review-dialog [hidden] { display: none !important; }
.patient-review-dialog.patient-review-enhanced { height: min(740px, calc(100dvh - 32px)); display: flex; flex-direction: column; overflow: hidden; }
.patient-review-enhanced .patient-review-head, .patient-review-enhanced .patient-review-footer { flex-shrink: 0; }
.patient-review-enhanced [data-review-form] { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 0; margin-top: 0; }
.patient-review-enhanced .patient-review-content { flex: 1; min-height: 0; display: flex; flex-direction: column; overflow-y: auto; overscroll-behavior: contain; scrollbar-gutter: stable; padding-right: 8px; }
.patient-review-enhanced .patient-review-content > * { flex-shrink: 0; }
.patient-review-enhanced .patient-review-step:not([data-review-final]) { flex: 1 0 auto; display: flex; flex-direction: column; }
.patient-review-enhanced .patient-review-step:not([data-review-final]) .patient-review-current { flex: 1 0 auto; align-content: start; margin-bottom: 0; }
.patient-review-content > .patient-info-box { margin-top: 12px; }
.patient-review-actions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: center; gap: 12px; margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line); flex-shrink: 0; }
.patient-review-actions > [data-review-back] { grid-column: 1; }
.patient-review-secondary { grid-column: 2; min-width: 0; }
.patient-review-primary { grid-column: 3; min-width: 0; }
.patient-review-actions .button { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; height: 48px; min-height: 48px; padding: 6px 10px; border-radius: 12px; font-size: .85rem; font-weight: 600; line-height: 1.25; }
.patient-review-actions .button svg { width: 18px; height: 18px; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.patient-review-actions .button span { min-width: 0; }
.patient-review-actions .button:hover { transform: none; }
.patient-review-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; }
.patient-review-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-left: auto; }
.patient-review-tools form { margin: 0; }
.patient-review-tools .button { width: auto; }
.patient-review-head h1 { margin: 0; font-size: clamp(1.5rem, 4vw, 2rem); }
.patient-review-head h1:focus { outline: none; }
.patient-review-dialog #review-description { margin-top: 16px; }
.patient-review-tools .language-switch a { border-radius: 6px; }
.patient-review-tools .language-switch a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.patient-review-head .theme-toggle { flex-shrink: 0; }
.patient-review-progress { color: var(--accent); font-size: .85rem; font-weight: 650; min-height: 1.5em; margin-block: 8px 20px; }
.patient-review-step { border: 0; padding: 0; margin: 0; min-width: 0; }
.patient-review-step legend { margin-bottom: 16px; font-size: 1.2rem; font-weight: 650; width: 100%; }
.patient-review-current { display: grid; gap: 12px; padding: 20px; background: var(--soft); border: 1px solid var(--line); border-radius: 14px; }
.patient-review-current dt { color: var(--muted); font-size: .8rem; }
.patient-review-current dd { margin: 4px 0 0; overflow-wrap: anywhere; }
.patient-review-confirmation { display: flex; align-items: flex-start; gap: 12px; margin-block: 20px; }
.patient-review-confirmation input { margin-top: 5px; accent-color: var(--accent); flex-shrink: 0; }
.patient-review-footer { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-top: 16px; font-size: .8rem; }
@media (max-width: 480px) { .patient-review-dialog { width: calc(100% - 16px); max-height: calc(100dvh - 16px); border-radius: 16px; } .patient-review-dialog .patient-form-actions { flex-direction: column; align-items: stretch; } .patient-review-dialog .patient-form-actions .button { flex: 0 0 auto; } .patient-review-footer { flex-wrap: wrap; } }
@media (max-width: 480px) {
  .patient-review-dialog.patient-review-enhanced { height: min(740px, calc(100dvh - 16px)); }
}
@media (max-width: 640px) {
  .patient-review-actions { gap: 8px; margin-top: 12px; padding-top: 12px; }
  .patient-review-actions .button { padding: 6px; font-size: .8rem; line-height: 1.25; }
}
@media (max-width: 480px) {
  .patient-review-actions .button { flex-direction: column; gap: 3px; height: 56px; min-height: 56px; padding: 2px 4px; font-size: .75rem; }
  .patient-review-actions .button svg { width: 16px; height: 16px; }
}
@media (max-height: 500px) {
  .patient-review-dialog { padding: 16px; }
  .patient-review-actions { margin-top: 8px; padding-top: 8px; }
  .patient-review-footer { margin-top: 8px; }
}

/* The infusion schedule shares the plain date/time text of other appointments. */
.patient-infusion-title { display: inline-flex; align-items: baseline; gap: .25em; max-width: 100%; min-width: 0; }
.patient-infusion-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.patient-infusion-dose { flex-shrink: 0; white-space: nowrap; }
.patient-infusion-title[href]:hover { text-decoration: underline; }
.patient-infusion-absence-form { max-width: 760px; overflow-wrap: anywhere; }
.patient-infusion-absence-form h2 { font-size: 1.3rem; line-height: 1.35; }
.patient-infusion-absence-form textarea { width: 100%; resize: vertical; }
.patient-infusion-absence-form label { display: block; margin-bottom: 8px; font-weight: 650; }
.patient-infusion-absence-warning { color: var(--patient-warning); padding: 12px; border: 1px solid currentColor; border-radius: 12px; }
@media (max-width: 899px) {
  .patient-infusion-absence-form .patient-form-actions { flex-wrap: wrap; }
  .patient-infusion-absence-form .patient-form-actions > .button { flex: 1 1 auto; min-width: 0; white-space: normal; text-align: center; }
}

:is(.patient-infusion-history, .patient-history-disclosure) { margin-top: 18px; border-top: 1px solid var(--line); }
:is(.patient-infusion-history, .patient-history-disclosure) > summary { display: flex; align-items: center; justify-content: flex-start; gap: 8px; min-height: 44px; padding-block: 12px; cursor: pointer; font-weight: 650; list-style: none; }
:is(.patient-infusion-history, .patient-history-disclosure) > summary::-webkit-details-marker { display: none; }
:is(.patient-infusion-history, .patient-history-disclosure) > summary > .patient-section-icon { width: 18px; height: 18px; flex: 0 0 18px; }
:is(.patient-infusion-history, .patient-history-disclosure) > summary::before { content: "+"; flex: none; width: 1em; color: var(--accent); text-align: center; }
:is(.patient-infusion-history, .patient-history-disclosure)[open] > summary::before { content: "−"; }
.patient-infusion-history .patient-list-main h3 a:hover { text-decoration: underline; }


/* Examination date navigation: the same layout and theme tokens in light and dark mode. */
.patient-main:has(> .patient-visit-history-browser) { padding-bottom: 24px; }
.patient-visit-history-browser { display: grid; grid-template-columns: 96px minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr) auto; height: max(26rem, calc(100dvh - 17rem)); max-height: 70rem; gap: 0 1rem; align-items: stretch; padding: clamp(1.15rem, 3vw, 1.6rem); background: var(--surface); border: 1px solid var(--line); border-radius: 22px; box-shadow: var(--shadow); }
.patient-visit-date-sidebar { grid-column: 1; grid-row: 2; position: relative; z-index: 2; display: flex; align-items: center; width: 96px; min-width: 0; min-height: 0; pointer-events: auto; }
.patient-visit-date-list { max-height: calc(100dvh - 19rem); overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; padding: .2rem .5rem .2rem .2rem; }
.patient-visit-date-month + .patient-visit-date-month { margin-top: 1.25rem; }
.patient-visit-date-month h3 { margin: 0 0 .45rem; color: var(--muted); font-size: .8rem; font-weight: 600; text-transform: capitalize; }
.patient-visit-date-link { display: flex; align-items: center; justify-content: space-between; gap: .75rem; min-height: 44px; padding: .45rem .65rem; border-left: 2px solid var(--line); color: var(--ink); font-size: .9rem; text-decoration: none; }
.patient-visit-date-link:hover { background: var(--soft); text-decoration: none; }
.patient-visit-date-link[aria-current=date] { border-color: var(--accent); background: var(--soft); color: var(--accent); font-weight: 700; }
.patient-visit-date-count { min-width: 1.6rem; padding: .1rem .35rem; border-radius: 999px; border: 1px solid var(--line); text-align: center; font-size: .72rem; color: var(--muted); }
.patient-visit-date-sidebar .patient-visit-date-list { position: relative; width: 100%; height: auto; max-height: 100%; display: grid; grid-auto-rows: var(--patient-axis-step, 24px); align-content: start; padding: 4px 0; scroll-padding-block: 4px; scrollbar-width: none; overscroll-behavior: contain; pointer-events: auto; }
.patient-visit-date-sidebar .patient-visit-date-list::-webkit-scrollbar { display: none; }
.patient-visit-date-sidebar .patient-visit-date-month { display: contents; }
.patient-visit-date-sidebar .patient-visit-date-month h3,
.patient-visit-date-sidebar .patient-visit-date-link > * { display: none; }
.patient-visit-date-sidebar .patient-visit-date-link { position: relative; justify-content: flex-start; height: var(--patient-axis-step, 24px); min-height: 24px; padding: 0 2px; border: 0; border-radius: 0; background: none; }
.patient-visit-date-sidebar .patient-visit-date-link::before { content: ""; position: absolute; left: 2px; top: calc(50% - 1px); width: 6px; height: 2px; flex-shrink: 0; background: var(--ink); opacity: .65; transition: width .12s ease, opacity .12s ease; }
.patient-visit-date-sidebar .patient-visit-date-link.is-month-start::before { width: 10px; opacity: .8; }
.patient-visit-date-sidebar .patient-visit-date-link.has-multiple-visits::before { height: 2px; }
.patient-visit-date-sidebar .patient-visit-date-link:is(:hover, :focus-visible)::before { width: 22px; background: var(--accent); opacity: 1; }
.patient-visit-date-sidebar .patient-visit-date-link[aria-current=date]::before { width: 26px; height: 2px; background: var(--patient-timeline-active); opacity: 1; }
.patient-visit-date-sidebar .patient-visit-date-link:is(:hover, :focus-visible) { background: var(--soft); border-radius: 5px; }
.patient-visit-date-sidebar .patient-visit-date-link:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.patient-visit-date-sidebar .patient-visit-date-link > .patient-visit-axis-label { display: block; position: absolute; left: 34px; right: 2px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: .75rem; font-weight: 600; line-height: 14px; white-space: nowrap; }
.patient-visit-axis-label small { display: block; color: var(--muted); font-size: .625rem; font-weight: 400; line-height: 12px; }
.patient-visit-date-sidebar .patient-visit-date-link[aria-current=date] > .patient-visit-axis-label,
.patient-visit-date-sidebar .patient-visit-date-link[aria-current=date] > .patient-visit-axis-label small { color: var(--patient-timeline-active); font-weight: 700; }
.patient-visit-date-sidebar .patient-visit-date-link:not([aria-current=date]):is(:hover, :focus-visible) > .patient-visit-axis-label { color: var(--accent); }
.patient-visit-date-preview { position: fixed; z-index: 40; pointer-events: auto; display: grid; gap: .2rem; width: 20rem; max-width: calc(100vw - 3rem); padding: .65rem .75rem; color: var(--ink); background: color-mix(in srgb, var(--surface) 92%, var(--ink)); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 4px 16px color-mix(in srgb, var(--ink) 8%, transparent); font-size: .82rem; line-height: 1.45; overflow-wrap: anywhere; }
.patient-visit-date-preview[hidden] { display: none; }
.patient-visit-date-preview > span { color: var(--muted); font-size: .8rem; }
@media (prefers-reduced-motion: reduce) {
  .patient-visit-date-sidebar .patient-visit-date-link::before { transition: none; }
}
.patient-visit-history-content { display: contents; }
.patient-visit-window-controls { grid-column: 1 / -1; grid-row: 1; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0 .75rem; align-items: start; min-width: 0; }
.patient-visit-history-window { gap: 16px; position: relative; grid-column: 2; grid-row: 2; min-width: 0; min-height: 0; align-content: start; overflow-y: auto; overscroll-behavior-y: auto; scrollbar-width: none; scroll-padding-top: 1rem; overflow-anchor: none; padding: 3px 1rem 1.5rem 3px; }
/* Keep native scrolling while hiding the scrollbar in every interaction state. */
.patient-visit-history-window::-webkit-scrollbar { display: none; }
.patient-visit-history-window:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.patient-visit-history-window [data-report-loaded=false] .patient-card { min-height: 10.5rem; }
.patient-visit-history-browser.is-enhanced .patient-visit-window-navigation { display: none; }
.patient-visit-history-browser.is-enhanced .patient-visit-day-navigation { min-height: 0; margin-bottom: 0; }
.patient-visit-history-browser.is-enhanced .patient-visit-day-navigation[hidden] { display: flex !important; visibility: hidden; }
.patient-visit-history-browser.is-enhanced .patient-visit-day-navigation a { display: none; }
.patient-visit-history-feedback { min-height: 1.5em; margin: .75rem 0 0 60px; color: var(--muted); font-size: .85rem; }
/* Keep the live status mounted without reserving space while it has no message or retry action. */
.patient-visit-history-feedback:has(> [data-visit-history-feedback]:empty):has(> .patient-visit-history-retry[hidden]) { min-height: 0; height: 0; margin-top: 0; }
.patient-visit-history-retry { min-height: 44px; margin-left: .75rem; padding: .5rem .85rem; border: 1px solid var(--line); border-radius: 12px; color: var(--ink); background: var(--surface); font: inherit; cursor: pointer; }
.patient-visit-history-retry[hidden] { display: none; }
.patient-visit-history-retry:hover, .patient-visit-history-retry:focus-visible { border-color: var(--accent); }
/* A named date picker makes the compact rail discoverable on desktop as well as touch. */
.patient-visit-mobile-dates { display: block; position: relative; grid-column: 2; grid-row: 1; margin-bottom: 1rem; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.patient-visit-mobile-dates > summary { display: flex; align-items: center; justify-content: space-between; gap: .5rem; min-height: 44px; padding: .5rem .75rem; list-style: none; cursor: pointer; color: var(--accent); border-radius: 12px; font-size: .85rem; font-weight: 600; }
.patient-visit-mobile-dates > summary::-webkit-details-marker { display: none; }
.patient-visit-mobile-dates > summary strong { display: none; }
.patient-visit-mobile-dates > summary::after { content: "⌄"; }
.patient-visit-mobile-dates[open] > summary::after { content: "⌃"; }
.patient-visit-mobile-dates > summary:hover, .patient-visit-mobile-dates[open] > summary { background: var(--soft); }
.patient-visit-mobile-dates > :is(.patient-visit-calendar, .patient-visit-date-list) { position: absolute; z-index: 36; top: calc(100% + .5rem); right: 0; width: min(22rem, calc(100vw - 2rem)); max-height: min(22rem, 50dvh); margin: 0; padding: .75rem; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); box-shadow: var(--shadow); scroll-padding-block: .75rem; }
.patient-visit-mobile-dates[data-opens-up=true] > :is(.patient-visit-calendar, .patient-visit-date-list) { top: auto; bottom: calc(100% + .5rem); }
.patient-visit-mobile-dates[data-calendar-overlay=true] > .patient-visit-calendar { position: fixed; right: 1rem; bottom: auto; }
.patient-visit-calendar { overflow-y: auto; overscroll-behavior: contain; scrollbar-width: none; }
.patient-visit-calendar::-webkit-scrollbar { display: none; }
.patient-visit-calendar.is-calendar-ready > .patient-visit-date-list { display: none; }
.patient-visit-calendar > .patient-visit-date-list { max-height: none; padding: 0; }
.patient-visit-calendar-header { position: sticky; top: -.75rem; z-index: 1; margin-top: -.75rem; padding-top: .75rem; padding-bottom: 4px; background: var(--surface); }
.patient-visit-calendar-toolbar { display: grid; grid-template-columns: 32px 32px minmax(0, 1fr) 32px 32px; align-items: center; gap: 3px; }
.patient-visit-calendar-caption { margin: 0; text-align: center; text-transform: capitalize; color: var(--ink); font-size: .9rem; line-height: 1.35; }
.patient-visit-calendar-step { display: flex; justify-content: center; align-items: center; min-height: 40px; padding: 0; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--accent); font: inherit; font-size: 1.2rem; cursor: pointer; }
.patient-visit-calendar-step:hover:not(:disabled) { background: var(--soft); border-color: var(--accent); }
.patient-visit-calendar-step:disabled { opacity: .35; cursor: default; }
.patient-visit-calendar-weekdays, .patient-visit-calendar-days { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 3px; }
.patient-visit-calendar-weekdays { margin-block: 8px 4px; text-align: center; color: var(--muted); font-size: .72rem; }
.patient-visit-calendar-day, .patient-visit-calendar-blank { min-height: 40px; min-width: 0; }
.patient-visit-calendar-day { display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 1px; border: 1px solid var(--line); border-radius: 8px; background: var(--soft); color: var(--accent); font-size: .82rem; font-weight: 650; line-height: 1.1; text-decoration: none; }
.patient-visit-calendar-day:hover { border-color: var(--accent); text-decoration: none; }
.patient-visit-calendar-day[aria-current=date] { border-color: var(--patient-timeline-active); outline: 1px solid var(--patient-timeline-active); background: color-mix(in srgb, var(--patient-timeline-active) 18%, var(--surface)); color: var(--ink); }
.patient-visit-calendar-day.is-unavailable { border-color: transparent; background: none; color: var(--muted); opacity: .55; font-weight: 400; }
.patient-visit-calendar-count { min-width: 15px; padding: 1px 3px; border: 1px solid currentColor; border-radius: 5px; font-size: .58rem; line-height: 1.1; }
.patient-visit-calendar-step:focus-visible, .patient-visit-calendar-day:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.patient-visit-calendar-day[aria-current=date]:focus-visible { outline-color: var(--patient-timeline-active); }
.patient-visit-calendar-notice { min-height: 1.4em; margin: 6px 0 0; color: var(--muted); text-align: center; font-size: .75rem; line-height: 1.4; }
.patient-visit-window-heading { grid-column: 1; grid-row: 1; min-height: 44px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .35rem 1rem; margin-bottom: 1rem; }
.patient-visit-window-heading p { margin: 0; color: var(--muted); font-size: .82rem; }
.patient-visit-day-navigation { grid-column: 1 / -1; display: flex; align-items: center; flex-wrap: wrap; gap: .5rem; margin-bottom: 1.25rem; }
.patient-visit-day-navigation[hidden], .patient-visit-day-navigation a[hidden] { display: none; }
.patient-visit-day-navigation > span { flex: 1 1 12rem; font-size: .85rem; color: var(--muted); }
.patient-visit-day-navigation a, .patient-visit-window-navigation > :is(a, span) { display: inline-flex; align-items: center; justify-content: center; gap: .5rem; min-height: 44px; padding: .55rem .85rem; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); font-size: .82rem; line-height: 1.45; text-align: center; text-decoration: none; overflow-wrap: anywhere; }
.patient-visit-day-navigation a:hover, .patient-visit-window-navigation a:hover { border-color: var(--accent); background: var(--soft); text-decoration: none; }
.patient-visit-window-navigation { grid-column: 2; grid-row: 3; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; margin-top: 1.5rem; }
.patient-visit-window-navigation > span { color: var(--muted); }
.patient-visit-window-navigation > a[aria-disabled=true] { color: var(--muted); cursor: default; }
.patient-visit-history-window .patient-timeline-item { grid-template-columns: minmax(0, 1fr); gap: 0; }
.patient-visit-history-window .patient-card { padding: 18px 26px; background: color-mix(in srgb, var(--surface) 70%, var(--soft)); border-radius: 16px; box-shadow: none; }
.patient-visit-history-window .patient-card-meta { margin-top: .375rem; }
.patient-visit-history-window .patient-card > .patient-muted { margin: .375rem 0 0; }
.patient-visit-history-window .patient-card.is-selected { border-color: var(--patient-timeline-active); box-shadow: 0 0 0 1px var(--patient-timeline-active); }
.patient-visit-detail-title-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem 1.5rem; }
.patient-visit-detail-title-row > h1.patient-page-title { flex: 1 1 24rem; min-width: 0; }
.patient-visit-detail-footer { display: flex; justify-content: flex-end; margin-top: 1.5rem; }
.patient-visit-detail-title-row > .button, .patient-visit-detail-footer > .button { flex: 0 0 auto; max-width: 100%; min-height: 44px; margin-left: auto; padding: .65rem 1rem; white-space: normal; text-align: center; }
.patient-visit-detail-meta { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem 1rem; margin-top: 1rem; }
.patient-visit-detail-meta > time { max-width: 100%; color: var(--patient-timeline-active); font-size: 1.1rem; line-height: 1.8; overflow-wrap: anywhere; }
.patient-visit-detail-meta > .patient-kicker { min-width: 0; overflow-wrap: anywhere; }

.patient-visit-card-date { display: flex; align-items: center; width: fit-content; min-height: 32px; margin-bottom: .5rem; color: var(--accent); font-size: 1rem; font-weight: 700; line-height: 1.45; }
.patient-visit-card-header { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-start; gap: .25rem 1rem; margin-bottom: 0; }
.patient-visit-card-header .patient-visit-card-date { flex: none; margin: 0; }
.patient-visit-card-header .patient-kicker { flex: 1 1 12rem; min-width: 0; text-align: left; overflow-wrap: anywhere; }
.patient-visit-card-heading { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .25rem 1rem; min-height: 44px; margin-block: .125rem; }
.patient-visit-card-heading > h2 { flex: 1 1 12rem; min-width: 0; margin: 0; color: var(--ink); text-decoration: none; overflow-wrap: anywhere; }
.patient-visit-detail-link { display: inline-flex; align-items: center; justify-content: center; flex: none; max-width: 100%; min-height: 44px; margin-left: auto; text-decoration: none; }
.patient-visit-detail-link .patient-detail-label { max-width: 100%; white-space: normal; text-align: center; }
.patient-visit-detail-link:is(:hover, :focus-visible) .patient-detail-label { border-color: var(--accent); background: var(--soft); }
.patient-visit-history-window .is-selected-day .patient-visit-card-date,
.patient-visit-history-window .patient-card.is-selected .patient-visit-card-date { color: var(--patient-timeline-active); }
.patient-visit-focus-link { align-self: start; border-radius: 8px; text-decoration: none; }
.patient-visit-focus-link:hover { background: var(--soft); text-decoration: none; }
.patient-visit-history-browser a:focus-visible, .patient-visit-mobile-dates > summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
@media (max-width: 800px) {
  .patient-visit-history-browser { grid-template-columns: 64px minmax(0, 1fr); height: max(23rem, calc(100dvh - 15rem)); gap: 0 .35rem; padding: 1rem .75rem; }
  .patient-visit-date-sidebar { width: 64px; }
  .patient-visit-date-sidebar .patient-visit-date-list { width: 100%; }
  .patient-visit-date-sidebar .patient-visit-date-link { padding: 0 2px; }
  .patient-visit-date-sidebar .patient-visit-date-link > .patient-visit-axis-label { left: 26px; font-size: .68rem; line-height: 13px; }
  .patient-visit-axis-label small { font-size: .6rem; line-height: 11px; }
  .patient-visit-date-sidebar .patient-visit-date-link::before { width: 6px; }
  .patient-visit-date-sidebar .patient-visit-date-link.is-month-start::before { width: 10px; }
  .patient-visit-date-sidebar .patient-visit-date-link:is(:hover, :focus-visible)::before { width: 18px; }
  .patient-visit-date-sidebar .patient-visit-date-link[aria-current=date]::before { width: 20px; }
  .patient-visit-window-controls { grid-template-columns: minmax(0, 1fr); }
  .patient-visit-day-navigation { grid-row: 3; }
  .patient-visit-history-feedback { margin-left: 0; }
  .patient-visit-mobile-dates { grid-column: 1; grid-row: 2; width: 100%; }
  .patient-visit-mobile-dates > summary { min-height: 48px; }
  .patient-visit-mobile-dates > :is(.patient-visit-calendar, .patient-visit-date-list) { width: min(22rem, calc(100vw - 4rem)); max-height: min(18rem, 50dvh); }
  .patient-visit-history-window { gap: 1rem; padding-right: .25rem; }
  .patient-visit-history-window .patient-card { padding: 16px; }
}
@media (max-width: 600px) {
  .patient-visit-detail-meta > time { font-size: 1rem; }
  .patient-visit-card-header .patient-kicker { flex-basis: auto; text-align: left; }
}

/* Patient medication table shares the staff column layout, using patient theme tokens. */
.patient-medication-table-scroll { max-width: 100%; overflow-x: auto; border: 1px solid var(--line); border-radius: 14px; }
.patient-medication-table-scroll:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
.patient-portal-medication-table { width: 100%; min-width: 1080px; border-collapse: collapse; table-layout: fixed; color: var(--ink); background: var(--surface); font-size: .9rem; }
.patient-portal-medication-table .patient-table-name { width: 19%; }
.patient-portal-medication-table .patient-table-regimen { width: 24%; }
.patient-portal-medication-table .patient-table-prescriber { width: auto; }
.patient-portal-medication-table .patient-table-actions { width: 6rem; }
.patient-portal-medication-table > :is(thead, tbody) > tr > :is(th, td) { padding: 14px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; overflow-wrap: anywhere; }
.patient-portal-medication-table > thead > tr > th { background: var(--soft); color: var(--muted); font-weight: 600; }
.patient-portal-medication-table > thead > tr > th:not(.patient-table-regimen-heading) { text-align: center; vertical-align: middle; }
.patient-portal-medication-table > tbody > tr:last-child > * { border-bottom: 0; }
.patient-portal-medication-table > tbody > tr > th { font-weight: 400; }
.patient-portal-medication-table .patient-table-dose-cell { text-align: center; }
.patient-table-medication-name { font-size: 1rem; font-weight: 600; }
.patient-table-medication-clinic { margin-top: 8px; color: var(--muted); font-size: .8rem; }
.patient-table-dose-grid, .patient-table-usage-form [data-usage-slots] { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(44px, 1fr); overflow-x: auto; }
.patient-table-dose-slot { min-width: 0; display: grid; align-content: start; gap: 6px; padding: 0 3px; }
.patient-table-dose-label { display: flex; align-items: center; justify-content: center; min-height: 32px; font-size: .75rem; color: var(--muted); line-height: 1.3; }
.patient-table-dose-amount { display: flex; align-items: center; justify-content: center; min-height: 40px; padding: 4px; border-radius: 8px; background: var(--surface); font-weight: 400; overflow-wrap: anywhere; }
.patient-portal-medication-table .patient-table-usage-form { margin: 0; gap: 8px; }
.patient-table-usage-form .medication-usage-editable-table { display: block; }
.patient-table-usage-form .medication-usage-editable-table thead { display: none; }
.patient-table-usage-form .medication-usage-editable-table [data-usage-slot] { display: grid; align-content: start; gap: 6px; min-width: 0; padding: 0 3px; }
.patient-table-usage-form .medication-usage-editable-table :is(th, td) { padding: 0; border: 0; text-align: center; }
.patient-table-usage-form .medication-usage-editable-table th { display: flex; align-items: center; justify-content: center; min-height: 32px; font-size: .75rem; color: var(--muted); line-height: 1.3; font-weight: 400; }
.patient-table-usage-form .medication-usage-editable-table .form-control { height: 40px; min-height: 40px; border-radius: 8px; padding: 4px; }
.patient-portal-medication-table .medication-usage-note { margin: 8px 0 0; font-size: .75rem; }
.patient-portal-medication-table details > summary { padding: 8px 0; font-weight: 500; font-size: .8rem; color: var(--accent); cursor: pointer; }
.patient-portal-medication-table details p { margin: 6px 0; font-size: .85rem; }
.patient-table-actions-cell .medication-usage-history[open], .patient-table-actions-cell .medication-usage-renewal[open] { min-width: 0; }
.patient-portal-medication-table .button { white-space: normal; }

/* Keep every medicine on one compact row, as in the staff medication table. */
.patient-portal-medication-table .patient-table-name { width: 30%; }
.patient-portal-medication-table .patient-table-regimen { width: 23%; }
.patient-portal-medication-table .patient-table-actions { width: 6rem; }
.patient-portal-medication-table > tbody > tr { height: 48px; }
.patient-portal-medication-table > tbody > tr > :is(th, td) { padding: 4px 8px; vertical-align: middle; }
.patient-portal-medication-table .patient-table-medication-name, .patient-table-prescriber-cell { display: block; white-space: nowrap; text-overflow: ellipsis; overflow: hidden; }
.patient-portal-medication-table td.patient-table-prescriber-cell { display: table-cell; }
.patient-portal-medication-table .patient-table-dose-cell { padding: 0; }
.patient-table-common-intervals { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin-top: 6px; font-size: .75rem; font-weight: 400; text-align: center; }
.patient-portal-medication-table .patient-table-regimen-heading { padding-inline: 0; text-align: center; }
.patient-table-dose-grid, .patient-table-usage-form [data-usage-slots] { grid-auto-flow: column; grid-auto-columns: minmax(44px, 1fr); }
.patient-table-dose-slot, .patient-table-usage-form .medication-usage-editable-table [data-usage-slot] { gap: 0; padding: 0; }
.patient-table-dose-label, .patient-table-usage-form .medication-usage-editable-table th { position: absolute; width: 1px; height: 1px; min-height: 0; margin: -1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.patient-table-dose-amount { min-height: 46px; border-radius: 0; background: var(--surface); border-inline-end: 1px solid var(--line); }
.patient-table-usage-form .medication-usage-editable-table .form-control { height: 46px; min-height: 46px; border: 1px solid transparent; border-inline-end-color: var(--line); border-radius: 0; background: var(--soft); font-weight: 600; }
.patient-table-usage-form .medication-usage-editable-table .form-control:is(:hover, :focus-visible) { border-color: var(--accent); }
.patient-table-usage-form:has([data-usage-save] > button[hidden]) [data-usage-save]:not([hidden]) { position: fixed; z-index: 90; inset: auto 16px 16px auto; width: min(420px, calc(100vw - 32px)); max-height: 45dvh; overflow: auto; padding: 16px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.patient-table-usage-form .medication-usage-status:not([data-save-state=error]) { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip-path: inset(50%); }
.patient-portal-medication-table :is(.patient-table-info-button, .patient-table-actions-button) { display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 4px 8px; font-size: .8rem; white-space: nowrap; }

.patient-table-info-button .patient-section-icon { width: 16px; height: 16px; }
.patient-table-details-panel { position: fixed; inset: 0; margin: auto; width: min(600px, calc(100vw - 32px)); max-height: calc(100dvh - 48px); padding: 24px; border: 1px solid var(--line); border-radius: 18px; overflow-y: auto; background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.patient-table-details-panel::backdrop { background: rgb(0 0 0 / .3); }
.patient-table-details-heading { display: flex; align-items: start; justify-content: space-between; gap: 16px; margin-bottom: 12px; }
.patient-table-details-heading h3 { margin: 0; font-size: 1.1rem; }
.patient-table-details-heading button { flex: none; width: 36px; height: 36px; min-height: 36px; padding: 0; border-radius: 50%; line-height: 1; }
.patient-table-details-panel .patient-table-medication-clinic { margin: 0 0 12px; }
.patient-portal-medication-table > caption.visually-hidden { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.patient-medication-table-scroll, .patient-table-usage-form { position: relative; }

/* Dose counts are implicit columns: portal CSP intentionally blocks inline styles. */
.patient-table-dose-grid, .patient-table-usage-form [data-usage-slots] { height: 46px; overflow-y: hidden; scrollbar-width: none; }
.patient-table-dose-grid::-webkit-scrollbar, .patient-table-usage-form [data-usage-slots]::-webkit-scrollbar { display: none; }
.patient-table-dose-grid:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.patient-table-usage-form { grid-template-columns: minmax(0, 1fr); }
.patient-table-usage-form .medication-usage-editable-table { min-width: 0; max-width: 100%; }
.patient-table-dose-slot, .patient-table-usage-form [data-usage-slot] { position: relative; }

/* Highlight actual patient use, including read-only history, in both themes. */
.patient-portal-medication-table td[data-medication-regimen="patient"],
.patient-portal-medication-table td[data-medication-regimen="patient"] .patient-table-dose-amount { background: var(--soft); }
.patient-portal-medication-table td[data-medication-regimen="patient"] .patient-table-dose-amount { font-weight: 600; }

/* Keep action controls compact and give the remaining space to the prescriber. */
.patient-portal-medication-table > :is(thead, tbody) > tr > :first-child { border-inline-end: 1px solid var(--line); }
.patient-portal-medication-table > thead > tr > th:last-child,
.patient-portal-medication-table > tbody > tr > .patient-table-actions-cell { padding-inline: 4px; text-align: center; }

/* Header separators align the main columns and the common dose intervals. */
.patient-portal-medication-table > thead > tr > th:not(:last-child) { border-inline-end: 1px solid var(--line); }
.patient-table-common-intervals > span + span { border-inline-start: 1px solid var(--line); }

.patient-portal-medication-table > tbody > tr > .patient-table-prescriber-cell { border-inline-end: 1px solid var(--line); }

.patient-medication-table-toolbar { flex-wrap: wrap; gap: 12px; }
.patient-table-name-content { display: flex; align-items: center; gap: 8px; min-width: 0; }
.patient-table-name-content .patient-table-medication-name { min-width: 0; }
.patient-reported-medication-badge { display: inline-block; flex: none; padding: 2px 6px; border: 1px solid var(--line); border-radius: 6px; color: var(--accent); background: var(--soft); font-size: .7rem; line-height: 1.5; white-space: nowrap; }
.patient-reported-medication-form { display: grid; gap: 20px; max-width: 720px; }
.patient-reported-medication-form label { display: block; margin-bottom: 6px; }
.patient-reported-medication-doses { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; padding: 0; border: 0; min-width: 0; }
.patient-reported-medication-doses legend { margin-bottom: 12px; font-weight: 600; }
.patient-reported-medication-doses .form-control { min-width: 0; width: 100%; }
.patient-reported-medication-archive { margin-top: 16px; }

/* Separate prescription information from the compact renewal dropdown. */
.patient-table-name-content .patient-table-medication-name { flex: 1 1 auto; }
.patient-portal-medication-table .patient-table-prescription-button { display: inline-flex; align-items: center; justify-content: center; flex: none; margin-inline-start: auto; width: 28px; min-height: 28px; padding: 4px; border: 0; border-radius: 50%; color: var(--accent); background: transparent; }
.patient-table-prescription-button .patient-section-icon { width: 18px; height: 18px; }
.patient-portal-medication-table .patient-table-prescription-button:is(:hover, :focus-visible) { background: var(--soft); }
.patient-table-details-name { margin: 0 0 18px; font-size: 1.05rem; font-weight: 600; line-height: 1.5; overflow-wrap: anywhere; }
.patient-protocol-details { text-align: start; font-weight: 400; }
.patient-protocol-details .patient-table-details-heading { margin-bottom: 16px; }
.patient-protocol-details .patient-table-details-heading h3 { min-width: 0; padding-top: 5px; font-size: 1.2rem; line-height: 1.4; overflow-wrap: anywhere; }
.patient-protocol-details-content { display: grid; gap: 16px; }
.patient-protocol-details-regimen { justify-self: start; padding: 3px 8px; border: 1px solid var(--line); border-radius: 999px; background: var(--soft); color: var(--ink); font-size: .8rem; }
.patient-protocol-details-section { min-width: 0; }
.patient-protocol-details-section h4 { margin: 0 0 6px; color: var(--muted); font-size: .85rem; font-weight: 600; line-height: 1.4; }
.patient-protocol-details-section-heading { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 4px 8px; margin-bottom: 8px; }
.patient-protocol-details-section-heading h4 { margin: 0; }
.patient-protocol-details-section p { margin: 0; font-size: .95rem; line-height: 1.6; overflow-wrap: anywhere; }
.patient-protocol-details-section p + p { margin-top: 6px; }
.patient-protocol-details-dosage { padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--soft); }
.patient-protocol-details-dosage p:first-of-type { font-size: 1rem; font-weight: 600; }
.patient-protocol-details-more { padding-top: 12px; border-top: 1px solid var(--line); }
.patient-protocol-details-more > summary { width: fit-content; max-width: 100%; padding: 4px 0; color: var(--muted); font-size: .85rem; cursor: pointer; }
.patient-protocol-details-more > summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }
.patient-protocol-details-more .patient-prescription-facts { margin-top: 12px; }
.patient-table-details-panel .patient-table-prescription p { margin: 8px 0; }
.patient-prescription-facts { display: grid; gap: 10px; margin: 0; font-size: .85rem; line-height: 1.5; }
.patient-prescription-facts > div { display: grid; grid-template-columns: 7rem minmax(0, 1fr); gap: 12px; }
.patient-prescription-facts dt { color: var(--muted); font-weight: 400; }
.patient-prescription-facts dd { margin: 0; overflow-wrap: anywhere; }
.patient-prescription-facts .patient-table-medication-clinic { margin: 0; font-size: inherit; }
.patient-prescription-section { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }
.patient-prescription-section h4 { margin: 0 0 8px; font-size: .9rem; line-height: 1.4; }
.patient-prescription-section > p { margin: 0; font-size: .9rem; line-height: 1.6; }
.patient-prescription-patient-report { padding: 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--soft); }
.patient-prescription-section > .patient-prescription-report { display: grid; gap: 6px; color: var(--ink); }
.patient-prescription-report-recorded { color: var(--muted); font-size: .8rem; }
.patient-prescription-section[hidden], .patient-prescription-report[hidden] { display: none; }
.patient-prescription-history { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }
@media (max-width: 480px) {
  .patient-table-details-panel { padding: 20px; }
  .patient-prescription-facts > div { grid-template-columns: minmax(0, 1fr); gap: 2px; }
}
.patient-table-actions-cell { anchor-scope: --patient-medication-actions; }
.patient-table-actions-button { anchor-name: --patient-medication-actions; }
.patient-table-actions-menu { position: fixed; position-anchor: --patient-medication-actions; inset: auto; top: anchor(bottom); right: anchor(right); position-try-fallbacks: flip-block; margin: 6px 0; width: max-content; max-width: min(340px, calc(100vw - 32px)); max-height: min(480px, calc(100dvh - 32px)); overflow-x: hidden; overflow-y: auto; padding: 4px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--ink); box-shadow: var(--shadow); font-weight: 400; text-align: start; }
.patient-table-actions-menu::backdrop { background: transparent; }
.patient-table-actions-menu > :not([hidden]) ~ :not([hidden]) { margin-block-start: 4px; padding-block-start: 4px; border-block-start: 1px solid var(--line); }
.patient-table-actions-menu :is(details.medication-usage-renewal, [data-renewal-fallback]) > summary { list-style: none; padding: 8px 10px; border-radius: 7px; font-size: .85rem; font-weight: 500; line-height: 1.4; cursor: pointer; }
.patient-table-actions-menu :is(details.medication-usage-renewal, [data-renewal-fallback]) > summary::-webkit-details-marker { display: none; }
.patient-table-actions-menu :is(details.medication-usage-renewal, [data-renewal-fallback]) > summary:is(:hover, :focus-visible), .patient-table-actions-menu :is(details.medication-usage-renewal, [data-renewal-fallback])[open] > summary { background: var(--soft); }
.patient-table-actions-menu :is(details.medication-usage-renewal, [data-renewal-fallback]) > :not(summary) { margin: 10px 12px; }
.patient-table-actions-menu .medication-usage-renewal form { display: grid; gap: 10px; }
.patient-table-actions-menu > a.button { display: flex; align-items: center; justify-content: flex-start; gap: 8px; width: 100%; min-height: 36px; padding: 8px 10px; border: 0; border-radius: 7px; font-size: .85rem; line-height: 1.4; text-align: start; white-space: normal; overflow-wrap: anywhere; }
.patient-table-actions-menu > a.button > .patient-section-icon { width: 18px; height: 18px; }
.patient-table-actions-menu .button:is(:hover, :focus-visible) { background: var(--soft); box-shadow: none; transform: none; }
@supports not (anchor-name: --patient-medication-actions) {
  .patient-table-actions-menu { top: 25vh; right: 16px; }
}

/* Committing an existing regimen requires an explicit reason in a modal dialog. */
html:has(.medication-usage-dialog[open]) { overflow: hidden; scrollbar-gutter: stable; }
.medication-usage-dialog { position: fixed; inset: 0; margin: auto; box-sizing: border-box; width: min(520px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); overflow-y: auto; padding: 24px; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); color: var(--ink); box-shadow: var(--shadow); text-align: start; font-size: .95rem; font-weight: 400; }
.medication-usage-dialog[open] { display: grid; gap: 16px; }
.medication-usage-dialog::backdrop { background: rgb(0 0 0 / .5); }
.medication-usage-dialog h2 { margin: 0; font-size: 1.2rem; line-height: 1.35; }
.medication-usage-dialog-name { margin: 0; overflow-wrap: anywhere; font-weight: 600; }
.medication-usage-dialog-changes { display: grid; gap: 8px; margin: 0; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--soft); }
.medication-usage-dialog-changes > div { display: flex; justify-content: space-between; gap: 16px; }
.medication-usage-dialog-changes :is(dt, dd) { margin: 0; overflow-wrap: anywhere; }
.medication-usage-dialog-changes dd { text-align: end; font-variant-numeric: tabular-nums; }
.medication-usage-dialog .medication-usage-save { gap: 16px; }
.medication-usage-dialog .medication-usage-reason { gap: 8px; }
.medication-usage-dialog textarea.form-control { width: 100%; box-sizing: border-box; min-height: 96px; resize: vertical; }
.medication-usage-dialog-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 10px; }
.patient-table-usage-form .medication-usage-dialog .medication-usage-status { position: static; width: auto; height: auto; margin: 0; overflow: visible; clip-path: none; }
.medication-usage-dialog .button:disabled { opacity: .6; cursor: not-allowed; }

/* Portal PDF actions share the existing themed popover menu. */
.patient-medication-table-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; anchor-scope: --patient-medication-pdf; }
.patient-medication-pdf-button { anchor-name: --patient-medication-pdf; }
.patient-medication-pdf-chevron, .patient-table-actions-button > [aria-hidden="true"] { display: inline-block; transform: translateY(-.15em); }
.patient-medication-pdf-menu { position-anchor: --patient-medication-pdf; width: max-content; max-width: calc(100vw - 32px); padding: 4px; }
.patient-medication-pdf-menu > a.button { display: flex; align-items: center; justify-content: flex-start; gap: 8px; min-height: 36px; padding: 8px 10px; }
.patient-medication-pdf-menu .patient-section-icon { width: 16px; height: 16px; flex: none; }
.patient-medication-pdf-menu > a.button > span { min-width: 0; }

/* One compact patient-created draft, aligned with the existing table cells. */
.patient-medication-create[hidden] { display: none; }
.patient-portal-medication-table > .patient-medication-create > tr > td { padding: 4px 8px; background: color-mix(in srgb, var(--accent) 7%, var(--surface)); border-top: 2px solid var(--accent); vertical-align: middle; }
.patient-portal-medication-table > .patient-medication-create > tr > td:first-child { box-shadow: inset 3px 0 var(--accent); }
.patient-portal-medication-table > .patient-medication-create > tr > td[data-medication-regimen] { padding-inline: 0; }
.patient-medication-create label.visually-hidden { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.patient-medication-create .form-control { min-width: 0; width: 100%; min-height: 38px; height: 38px; padding: 6px 8px; border-radius: 6px; font-size: .9rem; }
.patient-medication-create-doses { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0; }
.patient-medication-create-doses input { text-align: center; border-radius: 0 !important; border-width: 0 1px 0 0; background: transparent; }
.patient-medication-create-doses input:last-child { border-right: 0; }
.patient-medication-create-actions { display: flex; align-items: center; justify-content: center; gap: 4px; }
.patient-medication-create-actions .button { display: inline-flex; align-items: center; justify-content: center; width: 32px; min-height: 32px; padding: 0; border-radius: 50%; font-size: 1rem; }
.patient-medication-create .form-control:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.patient-medication-create [data-medication-create-errors] { font-size: .8rem; }
.patient-medication-create [data-medication-create-errors]:is(.validation-summary-valid, :empty) { display: none; }
.patient-medication-create [data-medication-create-errors] ul { padding-left: 16px; margin-block: 8px 0; }

.patient-request-updates { margin-block: 16px; padding: 16px; border: 1px solid var(--line); border-inline-start: 4px solid var(--accent); border-radius: 12px; background: var(--surface); }
.patient-request-updates-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.patient-request-updates-heading h2 { min-width: 0; margin: 0; font-size: 1rem; color: var(--ink); overflow-wrap: anywhere; }
.patient-request-updates-heading > button { flex: none; width: 40px; min-width: 40px; height: 40px; padding: 0; }
.patient-request-updates .patient-dashboard-preview-list { margin-block: 12px; }
.patient-request-updates .patient-request-clinic { grid-template-columns: minmax(0, 1fr); }
.patient-request-updates .patient-request-clinic > small { min-width: 0; }

/* Creation feedback floats above the portal without moving the medication table. */
.patient-toast-region { position: fixed; inset: 16px 16px auto auto; z-index: 120; display: grid; gap: 12px; width: min(400px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); overflow-y: auto; pointer-events: none; }
.patient-toast { --toast-color: var(--patient-success); display: flex; align-items: flex-start; gap: 12px; padding: 16px; border: 1px solid var(--toast-color); border-inline-start-width: 4px; border-radius: 14px; background: var(--toast-color); color: var(--surface); box-shadow: var(--shadow); pointer-events: auto; animation: patient-toast-enter .16s ease-out; }
.patient-toast.is-error { --toast-color: var(--patient-danger); }
.patient-toast-icon { display: grid; place-items: center; flex: none; width: 24px; height: 24px; border: 1px solid currentColor; border-radius: 50%; color: inherit; font-weight: 700; }
.patient-toast-content { flex: 1; min-width: 0; font-size: .9rem; line-height: 1.5; overflow-wrap: anywhere; }
.patient-toast-content p { margin: 0; }
.patient-toast-content p + p { margin-top: 6px; }
.patient-toast-close { display: grid; place-items: center; flex: none; width: 32px; height: 32px; margin: -4px -4px -4px 0; padding: 0; border: 0; border-radius: 50%; background: transparent; color: inherit; font: inherit; font-size: 1.25rem; cursor: pointer; }
.patient-toast-close[hidden] { display: none; }
.patient-toast-close:is(:hover, :focus-visible) { background: color-mix(in srgb, currentColor 15%, transparent); }
.patient-toast-close:focus-visible { outline: 2px solid currentColor; outline-offset: 2px; }
@keyframes patient-toast-enter { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: translateY(0); } }
@media (prefers-reduced-motion: reduce) { .patient-toast { animation: none; } }

/* Patient identity corrections use the same compact row, until staff dosing starts. */
.patient-portal-medication-table .patient-medication-metadata-input { width: 100%; min-width: 0; height: 38px; min-height: 38px; padding: 4px 6px; border: 1px solid transparent; border-radius: 6px; background: transparent; color: var(--ink); font: inherit; }
.patient-portal-medication-table .patient-medication-metadata-name { flex: 1 1 auto; font-weight: 600; }
.patient-portal-medication-table textarea.patient-medication-metadata-name { resize: none; overflow: hidden; white-space: nowrap; }
.patient-portal-medication-table .patient-medication-metadata-input:is(:hover, :focus-visible) { border-color: var(--accent); background: var(--surface); }
.patient-medication-metadata-input:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.patient-medication-table-row.is-editing-metadata > :is(th, td) { box-shadow: inset 0 -2px color-mix(in srgb, var(--accent) 65%, transparent); }
[data-medication-metadata-actions][hidden], [data-medication-metadata-cancel][hidden] { display: none; }

.patient-portal-medication-table [data-medication-row-actions][hidden] { display: none; }
.patient-table-actions-menu .patient-medication-cancel-button { display: flex; align-items: center; justify-content: flex-start; gap: 8px; width: 100%; min-height: 36px; padding: 8px 10px; font-size: .85rem; line-height: 1.4; text-align: start; white-space: normal; overflow-wrap: anywhere; }
.patient-medication-cancel-button > [aria-hidden] { flex: none; font-size: 1.1rem; }
.patient-table-actions-menu .patient-medication-cancel-button { border: 0; border-radius: 7px; background: transparent; }
.patient-table-actions-menu .patient-medication-cancel-button:is(:hover, :focus-visible) { background: var(--soft); }

/* Renewal requests require explicit confirmation in the same themed modal style. */
.patient-table-actions-menu .medication-renewal-open { display: flex; align-items: center; justify-content: flex-start; gap: 8px; width: 100%; min-height: 36px; margin: 0; padding: 8px 10px; border: 0; border-radius: 7px; font-size: .85rem; line-height: 1.4; text-align: start; white-space: normal; overflow-wrap: anywhere; }
.medication-renewal-open:is(:hover, :focus-visible) { background: var(--soft); }
.medication-renewal-content { display: grid; gap: 16px; }
.medication-renewal-content > p { margin: 0; overflow-wrap: anywhere; }
.medication-renewal-content form { margin: 0; }
.medication-renewal-locked { display: grid; gap: 8px; min-width: 0; max-width: 22rem; padding: 8px 10px; color: var(--muted); overflow-wrap: anywhere; }
.medication-renewal-locked-label { display: flex; align-items: flex-start; gap: 8px; font-size: .85rem; font-weight: 500; line-height: 1.4; }
.medication-renewal-locked-label > .patient-section-icon { flex: 0 0 18px; width: 18px; height: 18px; margin-top: 1px; color: inherit; }
.medication-renewal-locked > p { margin: 0; font-size: .8rem; line-height: 1.5; }
.medication-renewal-locked > .patient-text-link { justify-self: start; font-size: .85rem; }
[data-renewal-open][hidden], [data-renewal-fallback][hidden], [data-renewal-heading][hidden], [data-renewal-cancel][hidden] { display: none; }

.patient-medication-cancel-content { display: grid; gap: 16px; }
.patient-medication-cancel-content > p { margin: 0; overflow-wrap: anywhere; }
.patient-medication-cancel-content form { margin: 0; }
[data-medication-cancel-fallback] > summary { list-style: none; cursor: pointer; }
[data-medication-cancel-fallback] > summary::-webkit-details-marker { display: none; }
[data-medication-cancel-open][hidden], [data-medication-cancel-fallback][hidden], [data-medication-cancel-heading][hidden], [data-medication-cancel-dismiss][hidden] { display: none; }

/* Requests move only curated membership after a doctor's decision. */
.patient-table-actions-menu :is(.patient-medication-table-request-open, .patient-medication-table-request-pending) { display: flex; align-items: center; justify-content: flex-start; gap: 8px; width: 100%; min-height: 36px; margin: 0; padding: 8px 10px; border: 0; border-radius: 7px; font-size: .85rem; line-height: 1.4; text-align: start; white-space: normal; overflow-wrap: anywhere; }
.patient-table-actions-menu [data-medication-table-request] { min-width: 0; }
.patient-table-actions-menu [data-table-request-fallback] > summary { list-style: none; padding: 8px 10px; font-size: .85rem; line-height: 1.4; }
.patient-table-actions-menu [data-table-request-fallback] > summary::-webkit-details-marker { display: none; }
.patient-table-actions-menu [data-table-request-fallback] > summary:is(:hover, :focus-visible) { background: var(--soft); }
/* Medication menu icons share History's size and inherit each theme's text colour. */
.patient-table-actions-menu :is(.medication-renewal-open, [data-renewal-fallback] > summary) { --medication-action-icon: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22black%22%20stroke-width%3D%221.8%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Cpath%20d%3D%22M14%203H6a2%202%200%200%200-2%202v14a2%202%200%200%200%202%202h12a2%202%200%200%200%202-2V9Z%20M14%203v6h6%20M9%2015h6%20M12%2012v6%22%2F%3E%3C%2Fsvg%3E"); }
.patient-table-actions-menu :is(.patient-medication-table-request-open, [data-table-request-fallback] > summary) { --medication-action-icon: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22black%22%20stroke-width%3D%221.8%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Cpath%20d%3D%22M3%204h18v4H3Z%20M5%208v12h14V8%20M10%2012h4%22%2F%3E%3C%2Fsvg%3E"); }
.patient-table-actions-menu :is([data-renewal-fallback], [data-table-request-fallback]) > summary { display: flex; align-items: center; justify-content: flex-start; gap: 8px; min-height: 36px; }
.patient-table-actions-menu :is(.medication-renewal-open, .patient-medication-table-request-open, [data-renewal-fallback] > summary, [data-table-request-fallback] > summary)::before { content: ""; flex: 0 0 18px; width: 18px; height: 18px; background: currentColor; -webkit-mask: var(--medication-action-icon) center / contain no-repeat; mask: var(--medication-action-icon) center / contain no-repeat; }
.patient-medication-table-request-content, .patient-medication-table-request-content form { display: grid; gap: 16px; }
.patient-medication-table-request-content > p, .patient-medication-table-request-content form { margin: 0; }
.patient-medication-table-request-reason { display: grid; gap: 8px; }
.patient-medication-table-request-error { margin: 0; color: var(--patient-danger); }
[data-table-request-open][hidden], [data-table-request-pending][hidden], [data-table-request-fallback][hidden], [data-table-request-heading][hidden], [data-table-request-cancel][hidden], [data-table-request-error][hidden] { display: none; }
.reported-medication-membership-heading { margin-top: 24px; }
.reported-medication-membership-history { margin-bottom: 24px; }

/* A modal button stays under the pointer when opening and when validation changes focus. */
.patient-medication-table-request-dialog .button:hover { transform: none; }

/* Keep the first entry field and row actions within a phone's visible area. */
@media (max-width: 600px) {
  .patient-portal-medication-table .patient-table-name { width: 220px; }
  .patient-table-actions-cell > .patient-table-actions-menu,
  .patient-medication-pdf-menu { inset-inline: 16px; margin-inline: auto; }
}

/* Movement reasons are ordinary prescription information, in both themes. */
.patient-medication-moves { margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.patient-medication-moves h4 { margin: 0 0 .75rem; font-size: 1rem; }
.patient-medication-move { padding: .5rem 0; font-weight: 400; }
.patient-medication-move p { margin: 0 0 .5rem; }
.patient-medication-move-reason { white-space: pre-wrap; overflow-wrap: anywhere; }

/* One set of fields/forms: the desktop table becomes medicine cards on narrow screens. */
.patient-table-mobile-label { display: none; }
@media (max-width: 900px) {
  .patient-medication-table-scroll { overflow: visible; border: 0; border-radius: 0; }
  .patient-portal-medication-table { display: block; min-width: 0; background: transparent; }
  .patient-portal-medication-table > colgroup { display: none; }
  .patient-portal-medication-table > thead { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .patient-portal-medication-table > tbody { display: grid; gap: 12px; }
  .patient-portal-medication-table > tbody > tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0 8px; height: auto; padding: 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--soft); }
  .patient-portal-medication-table > tbody > tr > :is(th, td) { min-width: 0; padding: 0; border: 0; text-align: start; }
  .patient-portal-medication-table > tbody > tr > :first-child { grid-column: 1 / -1; margin-bottom: 12px; border: 0; }
  .patient-portal-medication-table .patient-table-medication-name { white-space: normal; overflow: visible; text-overflow: clip; line-height: 1.5; }
  .patient-table-name-content { align-items: start; gap: 10px; }
  .patient-portal-medication-table .patient-table-prescription-button { width: 44px; min-height: 44px; margin-top: -8px; margin-bottom: -4px; }
  .patient-table-mobile-label { display: block; }
  .patient-portal-medication-table > tbody > tr > .patient-table-dose-cell { grid-column: 1 / -1; display: grid; grid-template-columns: 5.4rem minmax(0, 1fr); gap: 6px; padding: 8px; background: var(--surface); border: 1px solid var(--line); }
  .patient-portal-medication-table > tbody > tr > [data-medication-regimen="doctor"] { border-radius: 10px 10px 0 0; }
  .patient-portal-medication-table > tbody > tr > [data-medication-regimen="patient"] { margin-top: -1px; border-radius: 0 0 10px 10px; }
  .patient-table-dose-cell > .patient-table-mobile-label { align-self: end; display: flex; align-items: center; min-height: 44px; font-size: .75rem; font-weight: 500; line-height: 1.4; color: var(--muted); overflow-wrap: anywhere; }
  .patient-table-dose-cell[data-medication-regimen="patient"] > .patient-table-mobile-label { color: var(--ink); }
  .patient-medication-distinct-intervals .patient-table-dose-cell > .patient-table-mobile-label { align-self: start; padding-top: 28px; }
  .patient-table-dose-cell > :not(.patient-table-mobile-label) { min-width: 0; }
  .patient-table-dose-grid, .patient-table-usage-form [data-usage-slots] { grid-auto-flow: row; grid-auto-columns: auto; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; height: auto; overflow: visible; }
  .patient-table-dose-grid:has(> :last-child:nth-child(1)), .patient-table-usage-form [data-usage-slots]:has(> :last-child:nth-child(1)) { grid-template-columns: minmax(0, 1fr); }
  .patient-table-dose-grid:has(> :last-child:nth-child(2)), .patient-table-usage-form [data-usage-slots]:has(> :last-child:nth-child(2)) { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .patient-table-dose-slot, .patient-table-usage-form .medication-usage-editable-table [data-usage-slot] { align-content: start; }
  .patient-table-dose-label,
  .patient-medication-distinct-intervals .patient-table-usage-form .medication-usage-editable-table th { position: static; width: auto; height: auto; min-height: 28px; margin: 0; padding: 0 1px 4px; overflow: visible; clip-path: none; white-space: normal; font-size: .7rem; line-height: 1.35; }
  .patient-medication-table-row:not(.patient-medication-distinct-intervals) [data-medication-regimen="patient"] .patient-table-dose-label { position: absolute; width: 1px; height: 1px; min-height: 0; margin: -1px; padding: 0; overflow: hidden; clip-path: inset(50%); }
  .patient-table-dose-amount { min-height: 44px; padding: 4px 2px; border: 0; border-radius: 6px; background: transparent; font-variant-numeric: tabular-nums; }
  .patient-portal-medication-table [data-medication-regimen="doctor"] .patient-table-dose-amount { color: var(--muted); font-weight: 500; }
  .patient-portal-medication-table [data-medication-regimen="patient"] .patient-table-dose-amount { background: transparent; color: var(--ink); }
  .patient-table-usage-form .medication-usage-editable-table .form-control,
  .patient-medication-create-doses .form-control { width: 100%; height: 44px; min-height: 44px; padding: 4px 2px; border: 1px solid var(--line); border-radius: 7px !important; background: var(--surface); color: var(--ink); font-size: 1rem; font-variant-numeric: tabular-nums; }
  .patient-table-usage-form .medication-usage-editable-table .form-control:is(:hover, :focus-visible) { border-color: var(--accent); background: var(--soft); }
  .patient-portal-medication-table > tbody > tr > .patient-table-prescriber-cell { display: flex; flex-wrap: wrap; align-content: center; align-items: baseline; gap: 2px 6px; padding-top: 10px; color: var(--muted); font-size: .75rem; white-space: normal; overflow: visible; border: 0; }
  .patient-table-prescriber-cell > .patient-table-mobile-label { font-weight: 400; }
  .patient-table-prescriber-cell > .patient-table-mobile-label::after { content: ":"; }
  .patient-portal-medication-table > tbody > tr > .patient-table-actions-cell { padding: 10px 0 0; text-align: end; }
  .patient-portal-medication-table > tbody > tr > .patient-table-actions-unavailable { display: none; }
  .patient-portal-medication-table .patient-table-actions-button { min-height: 44px; padding: 8px 12px; }
  .patient-portal-medication-table .patient-medication-metadata-input { min-height: 44px; height: 44px; font-size: 1rem; border-color: var(--line); background: var(--surface); }
  .patient-portal-medication-table .patient-medication-metadata-name { margin-top: -6px; }
  .patient-portal-medication-table textarea.patient-medication-metadata-name { height: auto; field-sizing: content; white-space: pre-wrap; line-height: 1.5; }
  .patient-portal-medication-table > .patient-medication-create { margin-top: 12px; }
  .patient-portal-medication-table > .patient-medication-create[hidden] { display: none; }
  .patient-portal-medication-table > .patient-medication-create > tr > td { background: transparent; border: 0; }
  .patient-portal-medication-table > .patient-medication-create > tr > td.patient-table-dose-cell { padding: 8px; background: var(--surface); border: 1px solid var(--line); }
  .patient-portal-medication-table > .patient-medication-create > tr > td[data-medication-regimen="patient"] { border-top: 0; }
  .patient-portal-medication-table > .patient-medication-create > tr > td:first-child { box-shadow: none; }
  .patient-medication-create-name > label.visually-hidden { position: static; width: auto; height: auto; margin: 0 0 6px; clip-path: none; white-space: normal; font-size: .8rem; }
  .patient-medication-create-doses { min-width: 0; align-self: end; gap: 6px; }
  .patient-medication-create-doses input:last-child { border-right: 1px solid var(--line); }
  .patient-medication-create .form-control { min-height: 44px; height: 44px; font-size: 1rem; }
  .patient-portal-medication-table > .patient-medication-create > tr > .patient-table-prescriber-cell,
  .patient-portal-medication-table > .patient-medication-create > tr > .patient-table-actions-cell { grid-column: 1 / -1; }
  .patient-medication-create-actions { justify-content: flex-end; gap: 8px; }
  .patient-medication-create-actions .button { gap: 6px; min-height: 44px; width: auto; padding: 8px 12px; }
  .patient-medication-table-toolbar > h2 { flex-basis: 100%; }
  .patient-medication-table-toolbar > .patient-medication-table-actions { margin-inline-start: auto; }
  .patient-medication-table-actions > :is(.button, a) { min-height: 44px; }
  .patient-table-actions-cell > .patient-table-actions-menu, .patient-medication-pdf-menu { inset-inline: 16px; margin-inline: auto; }
}

/* Requests share the blue row surfaces used by appointments and protocols. */
.patient-request-description, .patient-request-clinic, .patient-request-dates { display: grid; align-content: start; gap: .3rem; min-width: 0; }
.patient-request-description > span { font-size: .86rem; }
.patient-request-actions:not(:has(a, button, details)) { display: none; }
.patient-requests-workspace .patient-request-toolbar { min-width: 0; }
.patient-requests-workspace [data-request-toolbar-controls] { width: 100%; min-width: 0; }
.patient-requests-workspace .patient-request-control > span { display: block; margin-bottom: 8px; color: var(--muted); font-size: .78rem; font-weight: 600; }
.patient-request-controls { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)) 152px; align-items: start; gap: 12px; }
.patient-request-control { min-width: 0; }
.patient-request-size { grid-column: -2 / -1; justify-self: end; width: 152px; max-width: 100%; }
.patient-request-clear { grid-column: 1 / -1; justify-self: end; font-size: .8rem; }
.patient-request-dropdown { position: relative; min-width: 0; }
.patient-request-dropdown > summary { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 46px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--ink); font-size: .86rem; line-height: 1.5; list-style: none; cursor: pointer; }
.patient-request-dropdown > summary::-webkit-details-marker { display: none; }
.patient-request-dropdown > summary::marker { content: ''; }
.patient-request-dropdown > summary > span:first-child { min-width: 0; overflow-wrap: anywhere; }
.patient-request-dropdown > summary > span:last-child { color: var(--muted); flex: 0 0 auto; }
.patient-request-dropdown[open] > summary { border-color: var(--accent); }
.patient-request-dropdown > summary:focus-visible, .patient-request-dropdown-menu a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.patient-request-dropdown-menu { position: absolute; top: calc(100% + 6px); left: 0; z-index: 30; width: max-content; min-width: 100%; max-width: min(340px, calc(100vw - 24px)); max-height: 360px; overflow: auto; overscroll-behavior: contain; padding: 6px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.patient-request-size .patient-request-dropdown-menu { width: 100%; min-width: 0; }
.patient-request-dropdown-menu a { display: flex; align-items: center; min-height: 44px; padding: 10px 12px; border-radius: 7px; color: var(--ink); text-decoration: none; font-size: .86rem; line-height: 1.5; overflow-wrap: anywhere; }
.patient-request-dropdown-menu a:is(:hover, :focus-visible) { background: var(--soft); }
.patient-request-dropdown-menu a[aria-current] { background: var(--soft); color: var(--accent); font-weight: 650; }
.patient-requests-workspace [data-request-results] { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line); }
.patient-request-result-count { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.patient-requests-workspace .patient-dashboard-preview-list { display: grid; gap: 8px; margin: 0; }
.patient-requests-workspace .patient-dashboard-preview-list > li { margin: 0; padding: 14px 16px; border: 1px solid var(--line); border-radius: 14px; background: var(--soft); overflow-wrap: anywhere; }
.patient-requests-workspace .patient-dashboard-preview-list > li:is(:hover, :focus-within) { border-color: color-mix(in srgb, var(--accent) 58%, var(--line)); }
.patient-requests-workspace .patient-dashboard-preview-item { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr) minmax(0, 1fr) 170px; align-items: center; gap: 10px 20px; padding: 0; }
.patient-requests-workspace .patient-dashboard-preview-main { display: contents; }
.patient-requests-workspace .patient-request-description { grid-column: 1; grid-row: 1; }
.patient-requests-workspace .patient-request-clinic { grid-column: 2; grid-row: 1; }
.patient-requests-workspace .patient-request-dates { grid-column: 3; grid-row: 1; }
.patient-requests-workspace .patient-status { grid-column: 4; grid-row: 1; justify-self: end; }
.patient-requests-workspace .patient-request-actions { grid-column: 1 / -1; grid-row: 2; }
.patient-requests-workspace .patient-request-actions .button { min-height: 36px; padding: 7px 12px; }
.patient-requests-workspace .patient-dashboard-request-response { margin-top: 12px; }
.patient-request-feedback { margin: 12px 0 0; font-size: .82rem; }
.patient-request-feedback:empty { display: none; }
.patient-requests-workspace .patient-request-feedback:not(.is-error) { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.patient-requests-workspace [data-request-body][aria-busy=true] { opacity: .65; }
.patient-requests-workspace [hidden] { display: none !important; }
@media (max-width: 1000px) {
  .patient-requests-workspace .patient-dashboard-preview-item { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) 160px; }
  .patient-requests-workspace .patient-request-dates { grid-column: 1 / 3; grid-row: 2; display: flex; flex-wrap: wrap; gap: 4px 16px; }
  .patient-requests-workspace .patient-status { grid-column: 3; }
  .patient-requests-workspace .patient-request-actions { grid-row: 3; }
}
@media (max-width: 767px) {
  .patient-request-controls { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .patient-requests-workspace .patient-request-control > span { min-height: 2.8em; line-height: 1.4; }
  .patient-requests-workspace .patient-dashboard-preview-list > li { padding: 14px; }
  .patient-requests-workspace .patient-dashboard-preview-item { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .patient-requests-workspace .patient-request-description,
  .patient-requests-workspace .patient-request-clinic,
  .patient-requests-workspace .patient-request-dates,
  .patient-requests-workspace .patient-request-actions,
  .patient-requests-workspace .patient-status { grid-column: 1; grid-row: auto; justify-self: start; }
  .patient-requests-workspace .patient-request-actions { order: 1; }
}

/* Consistent request rows: one-line subject, inline information, status then actions. */
.patient-requests-workspace .patient-dashboard-preview-list > li.patient-request-row { --request-info-row: 3; display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, .8fr) minmax(0, .8fr) 152px 136px; grid-template-rows: minmax(20px, auto) minmax(32px, auto); align-items: center; gap: 0 16px; }
.patient-requests-workspace .patient-request-row > .patient-dashboard-preview-item,
.patient-requests-workspace .patient-request-row .patient-dashboard-preview-main,
.patient-requests-workspace .patient-request-row .patient-request-description { display: contents; }
.patient-requests-workspace .patient-request-row .patient-request-title { grid-column: 1; grid-row: 1; display: block; align-self: end; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .95rem; line-height: 1.4; }
.patient-request-title > a:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.patient-requests-workspace .patient-request-row .patient-request-subject { grid-column: 1; grid-row: 2; display: block; min-width: 0; padding-inline-end: 40px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .86rem; line-height: 1.5; }
.patient-requests-workspace .patient-request-row.is-info-evaluated:not(.has-request-info) .patient-request-subject { padding-inline-end: 0; }
.patient-requests-workspace .patient-request-row .patient-request-clinic { grid-column: 2; grid-row: 1 / span 2; min-width: 0; }
.patient-requests-workspace .patient-request-row .patient-request-dates { grid-column: 3; grid-row: 1 / span 2; display: grid; min-width: 0; min-height: 42px; align-content: center; gap: 4px; line-height: 1.5; }
.patient-request-row .patient-request-dates > small { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.patient-requests-workspace .patient-request-row .patient-status { grid-column: 4; grid-row: 1 / span 2; justify-self: end; justify-content: flex-start; width: 100%; max-width: 152px; min-height: 32px; padding: 4px 0; gap: 5px; border: 0; border-radius: 0; background: none; font-size: .8rem; font-weight: 700; line-height: 1.35; text-align: start; color: var(--patient-status-tint, var(--ink)); overflow-wrap: normal; }
.patient-request-row .patient-status.is-warning { --patient-status-tint: var(--patient-timeline-active); }
.patient-request-row .patient-status .patient-status-icon { width: .85rem; height: .85rem; flex-basis: .85rem; }
.patient-requests-workspace .patient-request-row.has-actions .patient-status { grid-column: 4; width: 100%; }
.patient-requests-workspace .patient-request-row .patient-request-actions { grid-column: 5; grid-row: 1 / span 2; display: flex; align-items: center; justify-content: flex-end; justify-self: end; flex-wrap: wrap; gap: 6px; min-width: 0; max-width: 136px; }
.patient-requests-workspace .patient-request-row .patient-request-actions:not(:has(a, button, details)) { display: none; }
.patient-requests-workspace .patient-request-row .patient-request-actions .button { min-height: 36px; max-width: 100%; padding: 7px 10px; font-size: .76rem; white-space: normal; overflow-wrap: anywhere; }
.patient-request-row .patient-request-actions [data-renewal-request], .patient-request-row .patient-request-actions [data-renewal-fallback] { min-width: 0; max-width: 100%; }
.patient-request-row .patient-request-actions .medication-renewal-content { min-width: 0; overflow-wrap: anywhere; }
.patient-request-row > .patient-request-info { grid-column: 1 / -1; grid-row: var(--request-info-row); min-width: 0; }
.patient-request-row > .patient-request-info.is-ready,
.patient-request-row > .patient-request-info.is-ready::details-content { display: contents; }
.patient-request-info > summary { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; padding: 0; border: 1px solid var(--line); border-radius: 50%; background: var(--surface); color: var(--accent); list-style: none; cursor: pointer; }
.patient-request-info > summary::-webkit-details-marker { display: none; }
.patient-request-info > summary::marker { content: ''; }
.patient-request-info > summary .patient-section-icon { width: 20px; height: 20px; }
.patient-request-info > summary:is(:hover, :focus-visible), .patient-request-info[open] > summary { border-color: var(--accent); background: var(--soft); }
.patient-request-info > summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.patient-request-info.is-ready > summary { grid-column: 1; grid-row: 1 / span 2; justify-self: end; align-self: center; }
.patient-request-info:not([open]) > .patient-request-info-content { display: none; }
.patient-request-info-content { grid-column: 1 / -1; grid-row: var(--request-info-row); display: grid; gap: 12px; min-width: 0; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); font-size: .86rem; line-height: 1.6; overflow-wrap: anywhere; }
.patient-request-info-content strong { font-size: .82rem; }
.patient-request-info-content p { margin: 4px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.patient-requests-workspace .patient-request-info-content .patient-dashboard-request-response { margin: 0; }
@media (max-width: 1000px) {
  .patient-requests-workspace .patient-dashboard-preview-list > li.patient-request-row { --request-info-row: 5; grid-template-columns: minmax(0, 1fr) 152px 136px; gap: 4px 12px; }
  .patient-requests-workspace .patient-request-row .patient-request-clinic { grid-column: 1; grid-row: 3; }
  .patient-requests-workspace .patient-request-row .patient-request-dates { grid-column: 1; grid-row: 4; display: grid; gap: 4px; }
  .patient-requests-workspace .patient-request-row .patient-status { grid-column: 2; }
  .patient-requests-workspace .patient-request-row.has-actions .patient-status { grid-column: 2; }
  .patient-requests-workspace .patient-request-row .patient-request-actions { grid-column: 3; grid-row: 1 / span 2; }
}
@media (max-width: 767px) {
  .patient-requests-workspace .patient-dashboard-preview-list > li.patient-request-row { --request-info-row: 6; grid-template-columns: minmax(0, 1fr) 104px; grid-template-rows: minmax(20px, auto) minmax(44px, auto) minmax(18px, auto) minmax(42px, auto) minmax(72px, auto); gap: 6px 8px; }
  .patient-requests-workspace .patient-request-row .patient-request-title,
  .patient-requests-workspace .patient-request-row .patient-request-subject,
  .patient-requests-workspace .patient-request-row .patient-request-clinic,
  .patient-requests-workspace .patient-request-row .patient-request-dates { grid-column: 1 / -1; justify-self: stretch; }
  .patient-requests-workspace .patient-request-row .patient-request-subject { padding-inline-end: 50px; }
  .patient-requests-workspace .patient-request-row .patient-status { grid-column: 1; grid-row: 5; width: 100%; max-width: min(152px, 100%); min-height: 44px; justify-self: end; }
  .patient-requests-workspace .patient-request-row.has-actions .patient-status { grid-column: 1; width: 100%; min-width: 0; max-width: min(152px, 100%); }
  .patient-requests-workspace .patient-request-row .patient-request-actions { grid-column: 2; grid-row: 5; max-width: 104px; }
  .patient-requests-workspace .patient-request-row .patient-request-actions .button { min-height: 44px; padding-inline: 8px; }
  .patient-request-info.is-ready > summary { grid-column: 1 / -1; width: 44px; height: 44px; }
}

.patient-request-row .patient-request-clinic > small { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

@media (max-width: 439px) {
  .patient-card.patient-requests-workspace { padding-inline: 16px; }
}

/* Available actions live in the status popover; all statuses share the rightmost column. */
.patient-requests-workspace .patient-request-row.has-request-info .patient-request-title { padding-inline-end: 40px; }
.patient-requests-workspace.has-status-menus .patient-dashboard-preview-list > li.patient-request-row { grid-template-columns: minmax(0, 1.5fr) minmax(0, .8fr) minmax(0, .8fr) 176px; }
.patient-requests-workspace.has-status-menus .patient-request-row .patient-status { grid-column: 4; justify-self: start; width: 152px; max-width: 100%; }
.patient-request-status-trigger { grid-column: 4; grid-row: 1 / span 2; display: flex; align-items: center; justify-content: flex-start; gap: 6px; justify-self: end; width: 176px; max-width: 100%; min-height: 44px; margin: 0; padding: 0; border: 0; border-radius: 8px; background: transparent; color: var(--muted); font: inherit; text-align: start; cursor: pointer; }
.patient-requests-workspace.has-status-menus .patient-request-status-trigger .patient-status { flex: 0 1 auto; width: auto; min-width: 0; max-width: 152px; margin: 0; }
.patient-request-status-trigger:is(:hover, :focus-visible) { background: color-mix(in srgb, var(--accent) 7%, transparent); }
.patient-request-status-trigger:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.patient-request-status-chevron { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 12px; width: 12px; height: 12px; transition: transform .15s ease; }
.patient-request-status-chevron::before { content: ''; width: 6px; height: 6px; border: solid currentColor; border-width: 0 1.5px 1.5px 0; transform: translateY(-2px) rotate(45deg); }
.patient-request-status-trigger[aria-expanded=true] .patient-request-status-chevron { transform: rotate(180deg); }
.patient-request-status-popover { position: fixed; inset: auto; margin: 0; padding: 6px; overflow: auto; overscroll-behavior: contain; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.patient-requests-workspace .patient-request-status-popover > .patient-request-actions { grid-column: auto; grid-row: auto; display: block; justify-self: stretch; width: 100%; max-width: none; }
.patient-requests-workspace .patient-request-status-popover .patient-request-actions .button,
.patient-request-status-popover [data-renewal-fallback] > summary { display: flex; align-items: center; justify-content: flex-start; width: 100%; min-height: 44px; padding: 10px 12px; border: 0; border-radius: 8px; background: transparent; color: var(--ink); font-size: .86rem; text-align: start; }
.patient-requests-workspace .patient-request-status-popover .patient-request-actions .button:is(:hover, :focus-visible),
.patient-request-status-popover [data-renewal-fallback] > summary:is(:hover, :focus-visible) { background: var(--soft); }
@media (max-width: 1000px) {
  .patient-requests-workspace.has-status-menus .patient-dashboard-preview-list > li.patient-request-row { grid-template-columns: minmax(0, 1fr) 176px; }
  .patient-requests-workspace.has-status-menus .patient-request-row .patient-status,
  .patient-request-status-trigger { grid-column: 2; }
}
@media (max-width: 767px) {
  .patient-requests-workspace.has-status-menus .patient-dashboard-preview-list > li.patient-request-row { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(20px, auto) minmax(44px, auto) minmax(18px, auto) minmax(42px, auto) minmax(44px, auto); }
  .patient-requests-workspace.has-status-menus .patient-request-row .patient-status { grid-column: 1; grid-row: 5; justify-self: end; margin-inline-end: 24px; max-width: 152px; }
  .patient-request-status-trigger { grid-column: 1; grid-row: 5; }
  .patient-requests-workspace.has-status-menus .patient-request-status-trigger .patient-status { margin: 0; }
  .patient-requests-workspace .patient-request-row.has-request-info .patient-request-title { padding-inline-end: 50px; }
}

/* Appointments and infusions expose their existing action menu through the status. */
.has-appointment-status-actions .patient-appointment-card > .patient-appointment-status { flex-direction: column; align-items: stretch; justify-content: center; width: 194px; max-width: 100%; }
.patient-appointment-status .patient-list-actions { display: block; width: 100%; }
.patient-appointment-menu.is-status-menu { width: 100%; }
.patient-appointment-status-trigger { display: flex; align-items: center; justify-content: flex-start; gap: 6px; min-height: 44px; padding: 0; border: 0; border-radius: 8px; background: transparent; color: var(--muted); font: inherit; text-align: start; cursor: pointer; }
.patient-appointment-status-trigger > .patient-status { flex: 0 1 auto; width: auto; min-width: 0; max-width: calc(100% - 18px); justify-content: flex-start; text-align: start; cursor: pointer; }
.patient-appointment-status-trigger > svg { width: 12px; height: 12px; flex: 0 0 12px; }
.patient-appointment-status-trigger:is(:hover, :focus-visible),
.patient-appointment-menu.is-status-menu[open] > .patient-appointment-status-trigger { background: color-mix(in srgb, var(--accent) 7%, transparent); }
.patient-appointment-status-trigger:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.has-appointment-status-actions .patient-appointment-status > .patient-status { padding-inline-end: 20px; justify-content: flex-start; text-align: start; }
@media (min-width: 1100px) {
  .has-appointment-status-actions .patient-appointment-card { grid-template-columns: 126px minmax(0, 1fr) 194px; }
  .has-appointment-status-actions .patient-appointment-card > .patient-appointment-status { grid-column: 3; grid-row: 1; }
  .has-appointment-status-actions .patient-appointment-controls { grid-column: 2 / -1; grid-row: 2; max-width: none; }
  .has-appointment-status-actions .patient-appointment-controls:has(> .patient-appointment-deadline.is-expired) { align-items: flex-start; }
  .has-appointment-status-actions .patient-appointment-controls > .patient-appointment-deadline.is-expired { text-align: start; }
  .has-appointment-status-actions .patient-appointment-deadline.is-expired > [data-deadline-expired] { align-items: flex-start; }
  @supports (grid-template-columns: subgrid) {
    .has-appointment-status-actions .patient-appointment-list { grid-template-columns: max-content minmax(0, 1fr) minmax(0, 1.25fr) 207px; }
    .has-appointment-status-actions .patient-appointment-list > .patient-appointment-card { grid-template-columns: subgrid; }
    .has-appointment-status-actions .patient-appointment-list .patient-appointment-card > .patient-appointment-status { grid-column: 4; }
    .has-appointment-status-actions .patient-appointment-list .patient-appointment-controls { grid-column: 2 / -1; }
  }
}
@media (pointer: coarse), (max-width: 899px) {
  .patient-appointment-status .patient-status { min-height: 44px; }
}

/* Protocol products reuse the actual medication table and dose-cell component. */
.patient-portal-medication-table.patient-protocol-products-table { min-width: 0; }
.patient-protocol-products-table .patient-protocol-product-col { width: 32%; }
.patient-protocol-products-table .patient-protocol-dosage-col { width: 38%; }
.patient-protocol-instruction-text, .patient-protocol-dose-fallback { display: block; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.patient-protocol-dose-fallback { padding: 8px; }
.patient-protocol-day-note { flex: none; padding: 2px 5px; border: 1px solid var(--line); border-radius: 5px; color: var(--accent); font-size: .7rem; white-space: nowrap; }
/* Keep meal triples inside their interval; align mixed daily schedules by time of day. */
.patient-protocol-products-table-detailed .patient-protocol-product-col { width: 30%; }
.patient-protocol-products-table-detailed .patient-protocol-dosage-col { width: 55%; }
.patient-protocol-interval-headings, .patient-protocol-dose-groups { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); }
.patient-protocol-interval-headings { margin-top: 6px; font-size: .75rem; font-weight: 400; text-align: center; }
.patient-protocol-interval-heading { display: grid; grid-template-rows: auto 1fr; min-width: 0; }
.patient-protocol-interval-heading + .patient-protocol-interval-heading { border-inline-start: 1px solid var(--line); }
.patient-protocol-interval-title { padding: 0 2px; }
.patient-protocol-meal-headings { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin-top: 6px; font-size: .7rem; line-height: 1.3; }
.patient-protocol-meal-headings > span { display: flex; align-items: center; justify-content: center; min-width: 0; min-height: 32px; padding: 4px 2px; }
.patient-protocol-meal-headings > span + span { border-inline-start: 1px solid var(--line); }
.patient-protocol-dose-group { min-width: 0; display: grid; align-content: center; border-inline-end: 1px solid var(--line); }
.patient-protocol-dose-group:last-child { border-inline-end: 0; }
.patient-protocol-interval-label { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.patient-protocol-dose-group .patient-table-dose-grid { min-width: 0; grid-auto-columns: minmax(0, 1fr); }
.patient-protocol-dose-group .patient-table-dose-slot:last-child .patient-table-dose-amount { border-inline-end: 0; }
.patient-protocol-dose-group:not(.patient-protocol-meal-group) .patient-table-dose-label { display: none; }
.patient-protocol-meal-group .patient-table-dose-grid { height: auto; overflow: visible; grid-template-rows: auto auto; }
.patient-protocol-meal-group .patient-table-dose-slot { grid-row: 1 / 3; grid-template-rows: subgrid; align-content: normal; }
.patient-protocol-meal-group .patient-table-dose-label,
.patient-protocol-own-intervals .patient-protocol-interval-label { position: static; width: auto; height: auto; min-height: 32px; margin: 0; padding: 4px 2px; overflow: visible; clip-path: none; white-space: normal; font-size: .7rem; line-height: 1.3; text-align: center; }
.patient-protocol-missing-interval { display: flex; align-items: center; justify-content: center; min-height: 46px; background: var(--surface); color: var(--muted); }
.patient-protocol-own-intervals { grid-auto-flow: row; grid-auto-columns: auto; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
@media (min-width: 901px) {
  /* Desktop meal labels belong to the shared header; mobile cards keep their own labels. */
  .patient-protocol-products-table-detailed .patient-protocol-meal-group .patient-table-dose-label { position: absolute; width: 1px; height: 1px; min-height: 0; margin: -1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .patient-protocol-products-table-detailed .patient-protocol-meal-group .patient-table-dose-grid { height: 46px; grid-template-rows: minmax(0, 1fr); }
  .patient-protocol-products-table-detailed .patient-protocol-meal-group .patient-table-dose-slot { grid-row: auto; grid-template-rows: minmax(0, 1fr); }
}
@media (max-width: 900px) {
  .patient-protocol-products-table > tbody > tr > .patient-protocol-dosage-cell { border-radius: 10px; }
  .patient-protocol-instruction-text { white-space: normal; overflow: visible; }
  .patient-protocol-dose-fallback { padding: 0; white-space: normal; overflow: visible; }
  .patient-protocol-products-table > tbody > .patient-protocol-grouped-row > .patient-protocol-dosage-cell { grid-template-columns: minmax(0, 1fr); }
  .patient-protocol-grouped-row .patient-table-mobile-label { min-height: 0; }
  .patient-protocol-dose-groups { grid-auto-flow: row; grid-template-columns: minmax(0, 1fr); gap: 6px; }
  .patient-protocol-dose-group { grid-template-columns: 5rem minmax(0, 1fr); align-items: center; border-inline-end: 0; border-bottom: 1px solid var(--line); }
  .patient-protocol-dose-group:last-child { border-bottom: 0; }
  .patient-protocol-dose-group .patient-protocol-interval-label { position: static; width: auto; height: auto; margin: 0; padding: 4px; overflow: visible; clip-path: none; white-space: normal; color: var(--muted); font-size: .75rem; text-align: start; }
  .patient-protocol-meal-group .patient-table-dose-label { min-height: 28px; }
  .patient-protocol-missing-interval { min-height: 44px; background: transparent; }
}

@media (max-width: 400px) {
  .patient-protocol-detail .wellbeing-history-count { flex-basis: 100%; margin-inline-start: calc(1rem + 34px); }
  .patient-protocol-detail .wellbeing-history-count::before { content: none; }
}

/* One shared dose unit per medicine; theme tokens and geometry remain identical. */
.patient-table-name-content > .patient-table-medication-label { display: flex; align-items: baseline; gap: 6px; flex: 1 1 auto; min-width: 0; }
.patient-table-medication-label > .patient-table-medication-name { flex: 0 1 auto; }
.patient-table-medication-unit { flex: 0 0 auto; min-width: 0; max-width: 40%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: .75rem; font-weight: 400; line-height: 1.2; }

/* Patient medication history uses the same geometry and semantic colours in both themes. */
.patient-medication-history-dialog { width: min(820px, calc(100vw - 32px)); }
.patient-medication-history-dialog > .patient-section-heading { display: flex; flex-direction: row; flex-wrap: nowrap; align-items: center; margin: 0; gap: 12px; }
.patient-medication-history-dialog > .patient-section-heading h2 { flex: 1 1 auto; min-width: 0; }
.patient-medication-history-dialog > .patient-section-heading > button { flex: 0 0 44px; width: 44px; min-width: 44px; padding: 0; }
.patient-medication-history-content { display: grid; gap: 18px; min-width: 0; }
.patient-medication-history-content :is(p, h3, dl, dd) { margin: 0; overflow-wrap: anywhere; }
.patient-medication-history-content h3 { font-size: 1rem; }
.patient-medication-history-current { display: grid; gap: 12px; padding: 16px; border: 1px solid var(--accent); border-inline-start-width: 4px; border-radius: 12px; background: var(--soft); }
.patient-medication-history-current h3 { color: var(--accent); }
.patient-medication-history-current dl > div { min-width: 0; padding: 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.patient-medication-history-current dd { font-weight: 600; font-variant-numeric: tabular-nums; line-height: 1.55; }
.patient-medication-history-current dl, .patient-medication-history-doses { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.patient-medication-history-content dt { color: var(--muted); font-size: .85rem; margin-bottom: 4px; }
.patient-medication-history-list-heading { display: grid; gap: 6px; padding-top: 6px; }
.patient-medication-history-list-heading h3 { display: flex; align-items: center; gap: 8px; }
.patient-medication-history-list-heading .patient-section-icon { width: 18px; height: 18px; }
.patient-medication-history-help { color: var(--muted); font-size: .85rem; line-height: 1.5; }
.patient-medication-history-events { display: grid; gap: 18px; list-style: none; margin: 0 0 0 5px; padding: 0 0 0 20px; border-inline-start: 1px solid var(--line); }
.patient-medication-history-event { --history-event-colour: var(--muted); position: relative; display: grid; gap: 12px; min-width: 0; padding: 16px; border: 1px solid var(--line); border-inline-start: 3px solid var(--history-event-colour); border-radius: 10px; background: var(--surface); }
.patient-medication-history-event[data-history-kind="Doctor"] { --history-event-colour: var(--accent); }
.patient-medication-history-event::before { content: ""; position: absolute; inset-inline-start: -28px; top: 20px; width: 12px; height: 12px; border: 2px solid var(--history-event-colour); border-radius: 50%; background: var(--surface); }
.patient-medication-history-event-heading { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; }
.patient-medication-history-event-heading strong { display: inline-flex; align-items: center; gap: 8px; min-width: 0; font-size: .9rem; }
.patient-medication-history-event-heading .patient-section-icon { width: 18px; height: 18px; flex: none; color: var(--history-event-colour); }
.patient-medication-history-event time { margin-inline-start: auto; color: var(--muted); font-size: .8rem; font-variant-numeric: tabular-nums; }
.patient-medication-history-author { font-size: .85rem; }
.patient-medication-history-doses { position: relative; gap: 28px; padding: 0; font-size: .9rem; line-height: 1.55; font-variant-numeric: tabular-nums; }
.patient-medication-history-doses > div { min-width: 0; padding: 10px 12px; border: 1px solid transparent; border-radius: 8px; }
.patient-medication-history-before { color: var(--muted); }
.patient-medication-history-doses > .patient-medication-history-after { border-color: var(--line); background: var(--soft); }
.patient-medication-history-after dd { font-weight: 600; }
.patient-medication-history-reason { padding-top: 10px; border-top: 1px solid var(--line); }
.patient-medication-history-reason, .patient-medication-history-response { font-size: .9rem; line-height: 1.55; }
.patient-medication-history-reason strong, .patient-medication-history-response strong { display: block; margin-bottom: 3px; color: var(--muted); font-size: .8rem; font-weight: 500; }
.patient-medication-history-dialog .button { min-height: 44px; }
.patient-medication-history-content .patient-request-pagination { margin-top: 4px; }
@media (max-width: 600px) {
  .patient-medication-history-dialog { padding: 16px; width: calc(100vw - 20px); max-height: calc(100dvh - 20px); }
  .patient-medication-history-current dl, .patient-medication-history-doses { grid-template-columns: minmax(0, 1fr); }
  .patient-medication-history-events { padding-inline-start: 12px; }
  .patient-medication-history-event { padding: 12px; }
  .patient-medication-history-event::before { inset-inline-start: -20px; }
  .patient-medication-history-doses { gap: 6px; }
}

/* Profile changes: one action area; email-only verification uses the shared dialog. */
.patient-profile-edit-actions { margin-top: 16px; justify-content: flex-start; }
.patient-profile-confirmation p { margin: 0 0 8px; }
.patient-profile-verify-dialog p { margin: 0; }
.patient-profile-verify-dialog form { display: grid; gap: 12px; }
.patient-profile-verify-dialog .patient-code-input { width: 12ch; letter-spacing: .18em; }
.patient-profile-verify-actions { display: grid; gap: 10px; margin-top: 8px; }
.patient-profile-verify-dialog > .patient-text-link { justify-self: start; background: none; border: 0; padding: 4px 0; font: inherit; cursor: pointer; }
.patient-profile-verify-dialog [hidden] { display: none !important; }
html:has(.patient-profile-verify-dialog[open]) { overflow: hidden; scrollbar-gutter: stable; }
