/* Dashboard visual language only. Authentication/data/print rules stay unchanged. */
@media screen {
  :root { --primary: #0e4c80; --muted: #647180; --border: #e6eaee; color: #20262f; background: #f8f9fb; font-family: Inter, "Segoe UI", Arial, sans-serif; font-size: 14px; -webkit-font-smoothing: antialiased; }
  body { min-height: 100dvh; background: #f8f9fb; }
  .shell { width: min(1120px, calc(100% - 64px)); padding: 0 0 32px; }
  header { justify-content: flex-start; gap: 12px; min-height: 88px; margin: 0 0 32px; border-bottom: 1px solid var(--border); text-align: left; }
  header img { width: 48px; height: 48px; }
  .brand-name { display: block; color: var(--primary); font-size: 22px; font-weight: 650; }
  .eyebrow { color: var(--muted); font-size: 11px; font-weight: 500; letter-spacing: .2px; }
  header .eyebrow { margin-top: 3px; }
  .privacy-badge { margin-left: auto; color: #536635; background: #f0f5e9; padding: 8px 12px; border-radius: 8px; font-size: 12px; white-space: nowrap; }
  .portal-page-heading { margin-bottom: 28px; }
  h1, h2, h3 { color: #20262f; text-wrap: balance; }
  h1 { font-size: clamp(26px, 4vw, 32px); font-weight: 650; line-height: 1.3; }
  h2 { font-size: 20px; font-weight: 650; }
  p { text-wrap: pretty; }
  .portal-page-heading p { color: var(--muted); margin: 8px 0 0; }
  .card, .visit, .welcome { border-color: var(--border); border-radius: 12px; padding: 28px; box-shadow: 0 1px 3px #00000004; background: white; }
  #auth, #password-reset, #clinician-confirmed { text-align: left; }
  .card > p { color: var(--muted); line-height: 1.65; }
  label { font-weight: 500; font-size: 14px; }
  input { border-color: #dfe4e9; border-radius: 8px; background: white; min-height: 48px; font-size: 16px; }
  button, .action-link { font: inherit; font-weight: 600; min-height: 44px; border-radius: 8px; background: var(--primary); transition: background-color 150ms ease-out, color 150ms ease-out; }
  button:hover, .action-link:hover { background: #093c67; }
  button:disabled { cursor: not-allowed; opacity: .5; }
  .secondary { background: white; color: var(--primary); border: 1px solid var(--border); }
  .secondary:hover { color: var(--primary); background: #edf3f8; }
  .password-field input { padding-right: 58px; }
  .password-field .password-visibility { width: 44px; height: 44px; color: var(--muted); }
  button:focus-visible, a:focus-visible, input:focus-visible, summary:focus-visible { outline: 2px solid #165d93; outline-offset: 3px; }
  .welcome { color: #20262f; border-left: 3px solid var(--primary); }
  .welcome h2 { color: #20262f; }
  .welcome .eyebrow { color: var(--muted); }
  .patient-email { color: var(--muted); font-size: 14px; font-weight: 400; }
  .patient-name { font-size: 22px; }
  .patient-avatar { width: 64px; height: 64px; flex-basis: 64px; border: 0; background: #edf3f8; color: var(--primary); box-shadow: none; font-weight: 600; font-size: 22px; }
  .patient-avatar img, .image-button img { outline: 1px solid #0000001a; outline-offset: -1px; }
  .welcome .icon-button { border-radius: 8px; width: 44px; height: 44px; flex-basis: 44px; }
  .stats { gap: 16px; margin: 20px 0; }
  .stat, .stat:nth-child(n) { display: flex; flex-direction: column-reverse; align-items: flex-start; gap: 18px; background: white; color: #20262f; padding: 20px; border: 1px solid var(--border); border-radius: 10px; box-shadow: none; }
  .stat-value { font-size: 30px; font-weight: 650; font-variant-numeric: tabular-nums; }
  .stat-label { margin: 0; color: var(--muted); font-size: 13px; font-weight: 500; }
  .next-visit { background: #f6f8f4; border-color: #e2ead8; box-shadow: none; border-radius: 10px; }
  .next-label, .appointment-status { color: #536635; letter-spacing: .6px; font-weight: 600; }
  .next-icon, .appointment-icon { background: #edf3f8; color: var(--primary); border-radius: 8px; }
  .portal-tabs { width: fit-content; max-width: 100%; background: white; border: 1px solid var(--border); border-radius: 10px; padding: 4px; gap: 4px; }
  .portal-tab { background: transparent; color: var(--muted); padding: 10px 20px; white-space: nowrap; }
  .portal-tab.active { background: #edf3f8; color: var(--primary); box-shadow: none; }
  .portal-tab:hover { background: #f3f5f7; }
  .tab-count, .folder-count, .visit-number { color: var(--primary); background: #edf3f8; font-variant-numeric: tabular-nums; font-weight: 600; }
  .notice, .meta, .facility-title small, .encounter-title small, .care-team span, .viewer-help, footer { color: var(--muted); }
  .record-root { background: transparent; padding: 8px 0; border: 0; }
  .record-root strong { font-weight: 600; }
  .facility-records { background: white; border-color: var(--border); border-radius: 12px; }
  .facility-heading { background: #f3f5f7; padding: 20px; }
  .facility-title strong { font-size: 18px; font-weight: 600; }
  .encounter-tree { border-color: var(--border); margin-left: 24px; padding: 16px 20px; }
  .encounter-folder { border-color: var(--border); border-radius: 10px; }
  .encounter-summary { padding: 18px; }
  .encounter-summary:hover { background: #f8f9fb; }
  .encounter-folder .visit { border-top-color: var(--border); }
  .visit h3 { color: #20262f; font-size: 18px; }
  .care-team > div, .section { background: #f3f5f7; border-radius: 8px; }
  .care-team strong { color: #20262f; }
  .attachment { border-color: var(--border); border-radius: 10px; }
  .image-button, .image-button:hover, .pdf-preview { background: #f3f5f7; border-radius: 8px; border-color: var(--border); }
  .pdf-controls { background: #f3f5f7; }
  .image-viewer { background: white; border-radius: 12px; box-shadow: 0 24px 80px #00000030; }
  .appointment-card { border-color: var(--border); border-radius: 10px; box-shadow: none; }
  .appointment-card.upcoming { border-left: 3px solid #85ae35; }
  .appointment-card.completed { opacity: 1; }
  .empty-state { border: 1px solid var(--border); color: var(--muted); border-radius: 10px; padding: 40px 20px; }
  .empty-state strong { color: #20262f; }
  footer { border-top: 1px solid var(--border); font-size: 12px; }
  @media (max-width: 640px) {
    .shell { width: calc(100% - 32px); }
    header { flex-direction: row; min-height: 80px; gap: 10px; margin-bottom: 24px; }
    header img { width: 40px; height: 40px; }
    .brand-name { font-size: 20px; }
    .privacy-badge { display: none; }
    .card, .visit, .welcome { padding: 20px 16px; }
    .patient-identity { gap: 12px; }
    .patient-avatar { width: 48px; height: 48px; flex-basis: 48px; }
    .patient-name { font-size: 18px; }
    .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
    .stat, .stat:nth-child(n) { padding: 16px; gap: 14px; }
    .stat-label { font-size: 12px; }
    .portal-tabs { width: 100%; }
    .portal-tab { min-width: 0; padding-inline: 8px; }
    .facility-heading { padding: 16px; }
    .facility-title strong { font-size: 16px; }
    .encounter-tree { margin-left: 0; border: 0; padding: 8px; }
    .encounter-summary { padding: 12px; }
    .image-viewer { border-radius: 0; }
  }
}
@media print { .portal-page-heading { display: none; } }
