/* =========================================================================
   Phoenix Geriatric Care — shared design system

   Two audiences, one set of rules: families under stress, and a physician
   working one-handed on a phone between patients. That means large targets
   (44px minimum), high contrast, generous line-height for Persian text, and
   no interaction that depends on hover.

   Everything is scoped under .pgc and marked !important where a theme would
   otherwise reach in. These pages must look the same on any WordPress theme.
   ========================================================================= */

@font-face {
  font-family: 'Phoenix AM';
  src: url('../../assets/fonts/phoenix-AM.woff2') format('woff2');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --pgc-font: 'Phoenix AM', Vazirmatn, Tahoma, Arial, sans-serif;
}

.pgc {
  /* Teal rather than the reservation plugin's red: this is a care setting,
     and red is reserved here for genuine clinical alarm. */
  --pgc-primary: #0f766e;
  --pgc-primary-600: #0d6560;
  --pgc-primary-700: #0a554f;
  --pgc-primary-50: #eef6f5;
  --pgc-primary-100: #dcedeb;
  --pgc-ring: rgba(15, 118, 110, .26);

  --pgc-bg: #f5f7f8;
  --pgc-surface: #ffffff;
  --pgc-surface-2: #f9fafb;
  --pgc-surface-3: #f2f4f5;
  --pgc-ink: #0d1321;
  --pgc-ink-soft: #475467;
  --pgc-muted: #8a94a6;
  --pgc-border: #e6e9ec;
  --pgc-border-strong: #d3d8de;

  --pgc-critical: #b42318;
  --pgc-critical-bg: #fef3f2;
  --pgc-critical-border: #fecdca;
  --pgc-warning: #b54708;
  --pgc-warning-bg: #fffaeb;
  --pgc-warning-border: #fde68a;
  --pgc-info: #175cd3;
  --pgc-info-bg: #eff8ff;
  --pgc-info-border: #b2ddff;
  --pgc-success: #067647;
  --pgc-success-bg: #ecfdf3;
  --pgc-success-border: #abefc6;

  --pgc-r-xl: 22px;
  --pgc-r-lg: 16px;
  --pgc-r-md: 12px;
  --pgc-r-sm: 9px;

  --pgc-shadow-sm: 0 1px 3px rgba(16, 24, 40, .07), 0 1px 2px rgba(16, 24, 40, .04);
  --pgc-shadow: 0 4px 8px -2px rgba(16, 24, 40, .06), 0 12px 24px -6px rgba(16, 24, 40, .09);
  --pgc-shadow-lg: 0 12px 16px -8px rgba(16, 24, 40, .08), 0 24px 48px -12px rgba(16, 24, 40, .16);

  /* Smallest tap target we allow anywhere. Apple and Material both land on
     44–48px; these forms are filled in by older hands and by a physician
     thumbing a phone one-handed, so it is a floor, not a guideline. */
  --pgc-tap: 44px;

  /* Height of the sticky action bar, so scroll containers can clear it. */
  --pgc-action-bar: 76px;

  box-sizing: border-box !important;
  direction: rtl !important;
  text-align: right !important;
  font-family: var(--pgc-font) !important;
  font-size: 16px !important;
  line-height: 1.85 !important;
  color: var(--pgc-ink) !important;
  background: transparent !important;
  max-width: 780px;
  margin: 0 auto !important;
  padding: 0 !important;

  /* ---- mobile primitives ----
     iOS enlarges text when a phone rotates unless this is pinned. */
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* The grey flash iOS paints over any tapped element looks broken next to our
   own pressed states, so we suppress it and provide the feedback ourselves. */
.pgc a,
.pgc button,
.pgc label,
.pgc input,
.pgc select,
.pgc textarea,
.pgc [role] {
  -webkit-tap-highlight-color: transparent;
}

/* touch-action: manipulation removes the ~300ms wait mobile browsers keep for
   a possible double-tap-to-zoom. Every control here is single-tap. */
.pgc button,
.pgc a,
.pgc label,
.pgc [role="button"] {
  touch-action: manipulation;
}

/* Chrome should not be selectable — long-pressing a tab to get a text cursor
   is never what someone meant. Content stays selectable. */
.pgc button,
.pgc .pgc-tabs,
.pgc .pgc-steps,
.pgc .pgc-rail {
  -webkit-user-select: none;
  user-select: none;
}

.pgc *,
.pgc *::before,
.pgc *::after { box-sizing: border-box !important; }

/* The `hidden` attribute must beat every display rule in this file.
   `[hidden] { display: none }` comes from the browser's own stylesheet, so any
   author-level `display: grid|flex|inline-flex` below silently wins and the
   element stays on screen — which left the loading overlay covering the page
   and the sticky footer showing on step one. */
.pgc [hidden],
.pgc[hidden] { display: none !important; }

.pgc h2, .pgc h3, .pgc h4 {
  margin: 0 0 8px !important;
  font-weight: 800 !important;
  line-height: 1.5 !important;
  color: var(--pgc-ink) !important;
}
.pgc h2 { font-size: 20px !important; }
.pgc h3 { font-size: 17.5px !important; }
.pgc h4 { font-size: 15.5px !important; }
.pgc p { margin: 0 0 10px !important; }
.pgc small { font-size: 12.5px !important; }
.pgc b, .pgc strong { font-weight: 700 !important; }

.pgc svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: none;
}

.pgc-muted { color: var(--pgc-muted) !important; font-size: 14px !important; }

/* ---------------------------------------------------------------- buttons */

.pgc-btn {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  gap: 8px;
  /* 52px tall: this is used by people with tremor and by a physician
     tapping with a thumb while holding a phone. */
  min-height: 52px;
  padding: 12px 22px !important;
  border-radius: var(--pgc-r-md) !important;
  border: 1.5px solid transparent !important;
  font-family: var(--pgc-font) !important;
  font-size: 16px !important;
  font-weight: 700 !important;
  line-height: 1.4 !important;
  text-decoration: none !important;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease, transform .08s ease;
  -webkit-appearance: none;
  appearance: none;
}
.pgc-btn:active { transform: translateY(1px); }
.pgc-btn:disabled,
.pgc-btn[disabled] { opacity: .5; cursor: not-allowed; }

.pgc-btn-primary {
  background: var(--pgc-primary) !important;
  color: #fff !important;
  box-shadow: 0 6px 16px -8px var(--pgc-ring);
}
.pgc-btn-primary:hover:not(:disabled) { background: var(--pgc-primary-600) !important; }

.pgc-btn-ghost {
  background: var(--pgc-surface) !important;
  color: var(--pgc-ink-soft) !important;
  border-color: var(--pgc-border-strong) !important;
}
.pgc-btn-ghost:hover:not(:disabled) { background: var(--pgc-surface-3) !important; color: var(--pgc-ink) !important; }

.pgc-btn-danger {
  background: var(--pgc-critical-bg) !important;
  color: var(--pgc-critical) !important;
  border-color: var(--pgc-critical-border) !important;
}

.pgc-btn-link {
  background: none !important;
  border: 0 !important;
  color: var(--pgc-primary) !important;
  min-height: var(--pgc-tap);
  padding: 6px 12px !important;
  font-size: 14.5px !important;
  box-shadow: none;
}
.pgc-btn-link:hover:not(:disabled) { text-decoration: underline !important; }

.pgc-btn-block { width: 100% !important; }
.pgc-btn-sm { min-height: var(--pgc-tap); padding: 8px 16px !important; font-size: 14.5px !important; }

.pgc-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1.5px solid var(--pgc-border);
  background: var(--pgc-surface);
  color: var(--pgc-ink-soft);
  cursor: pointer;
  text-decoration: none !important;
}
.pgc-icon-btn:hover { background: var(--pgc-surface-3); color: var(--pgc-ink); }

.pgc-back {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: var(--pgc-tap);
  padding: 6px 10px 6px 14px;
  margin-bottom: 6px;
  background: none;
  border: 0;
  color: var(--pgc-ink-soft);
  font-family: var(--pgc-font);
  font-size: 14.5px;
  font-weight: 600;
  cursor: pointer;
}
.pgc-back svg { width: 17px; height: 17px; }
.pgc-back:hover { color: var(--pgc-primary); }

/* ----------------------------------------------------------------- cards */

.pgc-card {
  background: var(--pgc-surface);
  border: 1px solid var(--pgc-border);
  border-radius: var(--pgc-r-lg);
  padding: 18px;
  margin-bottom: 12px;
  box-shadow: var(--pgc-shadow-sm);
}

/* ---------------------------------------------------------------- forms */

.pgc-form { margin: 0; }

.pgc-fieldset {
  border: 1px solid var(--pgc-border);
  border-radius: var(--pgc-r-lg);
  padding: 16px;
  margin: 0 0 14px;
  background: var(--pgc-surface);
}
.pgc-fieldset legend {
  padding: 0 8px;
  font-size: 14px;
  font-weight: 700;
  color: var(--pgc-primary-700);
}

.pgc-field { display: block; margin-bottom: 16px; }
.pgc-field:last-child { margin-bottom: 0; }
.pgc-field > span {
  display: block;
  margin-bottom: 7px;
  font-size: 15px;
  font-weight: 600;
  color: var(--pgc-ink);
  line-height: 1.6;
}
.pgc-field > span small { color: var(--pgc-muted); font-weight: 500; }

.pgc-field input[type="text"],
.pgc-field input[type="tel"],
.pgc-field input[type="email"],
.pgc-field input[type="number"],
.pgc-field input[type="search"],
.pgc-field textarea,
.pgc-select select {
  width: 100% !important;
  min-height: 52px;
  padding: 12px 14px !important;
  border: 1.5px solid var(--pgc-border-strong) !important;
  border-radius: var(--pgc-r-md) !important;
  background: var(--pgc-surface) !important;
  font-family: var(--pgc-font) !important;
  /* 16px keeps iOS from zooming the viewport when a field is focused. */
  font-size: 16px !important;
  line-height: 1.7 !important;
  color: var(--pgc-ink) !important;
  transition: border-color .15s ease, box-shadow .15s ease;
  -webkit-appearance: none;
  appearance: none;
}
.pgc-field textarea { min-height: 92px; resize: vertical; }

.pgc-field input:focus,
.pgc-field textarea:focus,
.pgc-select select:focus {
  outline: none !important;
  border-color: var(--pgc-primary) !important;
  box-shadow: 0 0 0 4px var(--pgc-ring) !important;
}
.pgc-field input::placeholder,
.pgc-field textarea::placeholder { color: var(--pgc-muted); }

.pgc-field.has-error input,
.pgc-field.has-error textarea,
.pgc-field.has-error select { border-color: var(--pgc-critical) !important; }

.pgc-hint {
  display: block;
  margin-top: 6px;
  font-size: 13px;
  font-style: normal;
  color: var(--pgc-muted);
  line-height: 1.8;
}
.pgc-err {
  display: none;
  margin-top: 6px;
  font-size: 13.5px;
  font-style: normal;
  font-weight: 600;
  color: var(--pgc-critical);
}
.pgc-err.is-visible { display: block; }

.pgc-select { position: relative; }
.pgc-select select { padding-left: 40px !important; }
.pgc-select svg {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: var(--pgc-muted);
  pointer-events: none;
}

.pgc-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 480px) { .pgc-row { grid-template-columns: 1fr; } }

/* Checkbox / radio rows are full-width tap targets, not tiny boxes. */
.pgc-check-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  min-height: 52px;
  padding: 12px 14px;
  margin-bottom: 8px;
  border: 1.5px solid var(--pgc-border);
  border-radius: var(--pgc-r-md);
  background: var(--pgc-surface);
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease;
  font-size: 15.5px;
  line-height: 1.7;
}
.pgc-check-row:hover { border-color: var(--pgc-border-strong); }
.pgc-check-row input { position: absolute; opacity: 0; pointer-events: none; }
.pgc-check-row.is-checked,
.pgc-check-row:has(input:checked) {
  border-color: var(--pgc-primary);
  background: var(--pgc-primary-50);
}

.pgc-check {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  margin-top: 3px;
  border: 2px solid var(--pgc-border-strong);
  border-radius: 7px;
  background: #fff;
  color: #fff;
  flex: none;
  transition: background .15s ease, border-color .15s ease;
}
.pgc-check svg { width: 15px; height: 15px; stroke-width: 3; opacity: 0; }
.pgc-check-row.is-checked .pgc-check,
.pgc-check-row:has(input:checked) .pgc-check {
  background: var(--pgc-primary);
  border-color: var(--pgc-primary);
}
.pgc-check-row.is-checked .pgc-check svg,
.pgc-check-row:has(input:checked) .pgc-check svg { opacity: 1; }

.pgc-check--radio { border-radius: 50%; }

/* ----------------------------------------------------------------- tabs */

.pgc-tabs {
  position: relative;
  display: flex;
  gap: 4px;
  padding: 4px;
  margin-bottom: 14px;
  background: var(--pgc-surface-3);
  border-radius: var(--pgc-r-md);
  overflow-x: auto;
  scrollbar-width: none;
  /* Snap so a flick lands on a tab rather than halfway between two, and
     contain the scroll so swiping the strip never drags the page behind it. */
  scroll-snap-type: x proximity;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
}

/* A soft edge on a scrollable strip is the only cue that there is more to
   the left; without it the last tabs are simply invisible. */
.pgc-tabs.is-scrollable {
  -webkit-mask-image: linear-gradient(to left, transparent 0, #000 22px);
  mask-image: linear-gradient(to left, transparent 0, #000 22px);
}
.pgc-tabs.is-scrollable.is-at-end {
  -webkit-mask-image: linear-gradient(to right, transparent 0, #000 22px);
  mask-image: linear-gradient(to right, transparent 0, #000 22px);
}
.pgc-tabs.is-scrollable.is-mid {
  -webkit-mask-image: linear-gradient(to right, transparent 0, #000 22px, #000 calc(100% - 22px), transparent 100%);
  mask-image: linear-gradient(to right, transparent 0, #000 22px, #000 calc(100% - 22px), transparent 100%);
}
.pgc-tabs::-webkit-scrollbar { display: none; }

/* A scrolling strip hides tabs, and a hidden tab is one nobody finds — the
   physician panel has eight and the family portal six, which is well past what
   fits a phone in one line. Where every destination has to be visible at once,
   lay the strip out as a wrapping grid instead of a scroller. */
.pgc-tabs--wrap {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  overflow-x: visible;
  -webkit-mask-image: none;
  mask-image: none;
}
.pgc-tabs--wrap button {
  justify-content: center;
  padding: 9px 6px;
  font-size: 13.5px;
  line-height: 1.35;
  white-space: normal;
  text-align: center;
}
@media (max-width: 339px) {
  .pgc-tabs--wrap { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
/* Past phone width there is room for one honest row again. */
@media (min-width: 620px) {
  .pgc-tabs--wrap { display: flex; flex-wrap: wrap; }
  .pgc-tabs--wrap button { flex: 1 1 auto; font-size: 14.5px; padding: 8px 15px; }
}
.pgc-tabs button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: none;
  min-height: var(--pgc-tap);
  padding: 8px 15px;
  border: 0;
  border-radius: var(--pgc-r-sm);
  scroll-snap-align: center;
  background: transparent;
  font-family: var(--pgc-font);
  font-size: 14.5px;
  font-weight: 600;
  color: var(--pgc-ink-soft);
  white-space: nowrap;
  cursor: pointer;
}
.pgc-tabs button.is-active {
  background: var(--pgc-surface);
  color: var(--pgc-ink);
  box-shadow: var(--pgc-shadow-sm);
}

.pgc-tab-panel { display: none; }
.pgc-tab-panel.is-active { display: block; }

.pgc-badge {
  display: inline-grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 10px;
  background: var(--pgc-critical);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
}
.pgc-count {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--pgc-muted);
}

/* ---------------------------------------------------------------- chips */

.pgc-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 11px;
  border-radius: 999px;
  border: 1px solid var(--pgc-border);
  background: var(--pgc-surface-2);
  font-size: 13px;
  font-weight: 600;
  color: var(--pgc-ink-soft);
  line-height: 1.6;
}
.pgc-chip--critical { background: var(--pgc-critical-bg); border-color: var(--pgc-critical-border); color: var(--pgc-critical); }
.pgc-chip--warning  { background: var(--pgc-warning-bg);  border-color: var(--pgc-warning-border);  color: var(--pgc-warning); }
.pgc-chip--info     { background: var(--pgc-info-bg);     border-color: var(--pgc-info-border);     color: var(--pgc-info); }
.pgc-chip--success  { background: var(--pgc-success-bg);  border-color: var(--pgc-success-border);  color: var(--pgc-success); }

.pgc-chips { display: flex; flex-wrap: wrap; gap: 6px; }

/* --------------------------------------------------------------- notices */

.pgc-notice { padding: 32px 16px; }
.pgc-notice-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  max-width: 480px;
  margin: 0 auto;
  padding: 20px;
  border: 1px solid var(--pgc-warning-border);
  border-radius: var(--pgc-r-lg);
  background: var(--pgc-warning-bg);
  color: var(--pgc-warning);
}
.pgc-notice-card svg { width: 22px; height: 22px; margin-top: 3px; }
.pgc-notice-card p { margin: 0 !important; font-size: 15.5px; line-height: 1.9; }

.pgc-empty {
  padding: 34px 18px;
  text-align: center;
  color: var(--pgc-muted);
  font-size: 15px;
}
.pgc-empty svg { width: 38px; height: 38px; margin-bottom: 10px; opacity: .5; }

/* The standing caveat next to any screening flag. */
.pgc-disclaimer {
  margin-top: 10px;
  padding: 9px 12px;
  border-radius: var(--pgc-r-sm);
  background: var(--pgc-surface-3);
  font-size: 12.5px;
  line-height: 1.8;
  color: var(--pgc-muted);
}

/* --------------------------------------------------------- toast / load */

.pgc-toast {
  position: fixed;
  inset-inline: 16px;
  bottom: 20px;
  z-index: 99999;
  max-width: 420px;
  margin: 0 auto;
  padding: 14px 18px;
  border-radius: var(--pgc-r-md);
  background: #0d1321;
  color: #fff;
  font-family: var(--pgc-font);
  font-size: 15px;
  line-height: 1.7;
  text-align: center;
  box-shadow: var(--pgc-shadow-lg);
  animation: pgc-rise .25s ease both;
}
.pgc-toast--error { background: var(--pgc-critical); }
.pgc-toast--success { background: var(--pgc-success); }

@keyframes pgc-rise {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

.pgc-saving {
  position: fixed;
  inset-inline-end: 16px;
  bottom: 16px;
  z-index: 9999;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(13, 19, 33, .88);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
}

.pgc-loading {
  position: fixed;
  inset: 0;
  z-index: 99998;
  display: grid;
  place-items: center;
  background: rgba(245, 247, 248, .72);
  backdrop-filter: blur(2px);
}
.pgc-spinner {
  width: 38px;
  height: 38px;
  border: 3px solid var(--pgc-primary-100);
  border-top-color: var(--pgc-primary);
  border-radius: 50%;
  animation: pgc-spin .7s linear infinite;
}
@keyframes pgc-spin { to { transform: rotate(360deg); } }

.pgc-skeleton {
  height: 180px;
  border-radius: var(--pgc-r-md);
  background: linear-gradient(90deg, var(--pgc-surface-3) 25%, var(--pgc-surface-2) 50%, var(--pgc-surface-3) 75%);
  background-size: 200% 100%;
  animation: pgc-shimmer 1.3s linear infinite;
}
@keyframes pgc-shimmer { to { background-position: -200% 0; } }

/* ---------------------------------------------------------------- auth */

.pgc-auth { padding: 24px 16px; }
.pgc-auth-card {
  max-width: 420px;
  margin: 0 auto;
  padding: 26px 22px;
  background: var(--pgc-surface);
  border: 1px solid var(--pgc-border);
  border-radius: var(--pgc-r-xl);
  box-shadow: var(--pgc-shadow);
}
.pgc-auth-card h2 { margin-bottom: 6px !important; }
.pgc-auth-card > p { color: var(--pgc-ink-soft); font-size: 14.5px; margin-bottom: 20px !important; }

.pgc-otp-input {
  text-align: center !important;
  font-size: 26px !important;
  font-weight: 800 !important;
  letter-spacing: 10px !important;
  direction: ltr !important;
}
.pgc-otp-sent {
  padding: 10px 14px;
  border-radius: var(--pgc-r-sm);
  background: var(--pgc-primary-50);
  color: var(--pgc-primary-700);
  font-size: 14px;
  text-align: center;
}

/* --------------------------------------------------------------- upload */

.pgc-upload { margin-bottom: 14px; }
.pgc-upload-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 26px 16px;
  border: 2px dashed var(--pgc-border-strong);
  border-radius: var(--pgc-r-lg);
  background: var(--pgc-surface-2);
  cursor: pointer;
  text-align: center;
  transition: border-color .15s ease, background .15s ease;
}
.pgc-upload-btn:hover,
.pgc-upload.is-dragging .pgc-upload-btn {
  border-color: var(--pgc-primary);
  background: var(--pgc-primary-50);
}
.pgc-upload-btn svg { width: 28px; height: 28px; color: var(--pgc-primary); }
.pgc-upload-btn strong { font-size: 15.5px; }
.pgc-upload-btn span { font-size: 13px; color: var(--pgc-muted); }
.pgc-upload--sm .pgc-upload-btn { padding: 16px; }

.pgc-docs { display: flex; flex-direction: column; gap: 8px; }
.pgc-doc {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 13px;
  border: 1px solid var(--pgc-border);
  border-radius: var(--pgc-r-md);
  background: var(--pgc-surface);
}
.pgc-doc-thumb {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: var(--pgc-r-sm);
  background: var(--pgc-surface-3);
  color: var(--pgc-ink-soft);
  overflow: hidden;
  flex: none;
}
.pgc-doc-thumb img { width: 100%; height: 100%; object-fit: cover; }
.pgc-doc-meta { flex: 1; min-width: 0; }
.pgc-doc-meta strong { display: block; font-size: 14.5px; }
.pgc-doc-meta span { display: block; font-size: 12.5px; color: var(--pgc-muted); }
.pgc-doc-actions { display: flex; gap: 4px; flex: none; }

/* ------------------------------------------------------------- timeline */

.pgc-timeline-day { margin-bottom: 20px; }
.pgc-timeline-date {
  position: sticky;
  top: 0;
  z-index: 2;
  display: inline-block;
  margin-bottom: 8px;
  padding: 4px 12px;
  border-radius: 999px;
  background: var(--pgc-surface-3);
  font-size: 13px;
  font-weight: 700;
  color: var(--pgc-ink-soft);
}
.pgc-timeline-item {
  position: relative;
  padding: 0 26px 16px 0;
  border-inline-start: 2px solid var(--pgc-border);
  margin-inline-start: 9px;
}
.pgc-timeline-item:last-child { border-inline-start-color: transparent; padding-bottom: 0; }
.pgc-timeline-dot {
  position: absolute;
  inset-inline-start: -10px;
  top: 2px;
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--pgc-primary-100);
  color: var(--pgc-primary-700);
  border: 2px solid var(--pgc-surface);
}
.pgc-timeline-dot svg { width: 10px; height: 10px; stroke-width: 2.6; }
.pgc-timeline-body strong { display: block; font-size: 14.5px; }
.pgc-timeline-body span { display: block; font-size: 13px; color: var(--pgc-muted); line-height: 1.8; }
.pgc-timeline-time { font-size: 12px; color: var(--pgc-muted); }

/* ----------------------------------------------------------------- chat */

.pgc-chat {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 460px;
  overflow-y: auto;
  padding: 4px 2px 12px;
}
.pgc-msg { max-width: 82%; }
.pgc-msg-bubble {
  padding: 11px 14px;
  border-radius: var(--pgc-r-md);
  font-size: 15px;
  line-height: 1.85;
  white-space: pre-wrap;
  word-break: break-word;
}
.pgc-msg--them { align-self: flex-start; }
.pgc-msg--them .pgc-msg-bubble {
  background: var(--pgc-surface);
  border: 1px solid var(--pgc-border);
  border-start-start-radius: 4px;
}
.pgc-msg--me { align-self: flex-end; }
.pgc-msg--me .pgc-msg-bubble {
  background: var(--pgc-primary);
  color: #fff;
  border-start-end-radius: 4px;
}
.pgc-msg-meta {
  margin-top: 3px;
  font-size: 12px;
  color: var(--pgc-muted);
}
.pgc-msg--me .pgc-msg-meta { text-align: left; }

.pgc-chat-form {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding-top: 10px;
  border-top: 1px solid var(--pgc-border);
}
.pgc-chat-form textarea {
  flex: 1;
  min-height: 52px;
  max-height: 140px;
  padding: 12px 14px;
  border: 1.5px solid var(--pgc-border-strong);
  border-radius: var(--pgc-r-md);
  background: var(--pgc-surface);
  font-family: var(--pgc-font);
  font-size: 16px;
  line-height: 1.7;
  resize: none;
}
.pgc-chat-form textarea:focus {
  outline: none;
  border-color: var(--pgc-primary);
  box-shadow: 0 0 0 4px var(--pgc-ring);
}
.pgc-chat-form .pgc-btn { width: 52px; padding: 0 !important; flex: none; }
.pgc-chat-note {
  margin-top: 8px !important;
  font-size: 12.5px;
  color: var(--pgc-muted);
  text-align: center;
}

@media (prefers-reduced-motion: reduce) {
  .pgc *, .pgc *::before, .pgc *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

/* =========================================================================
   Mobile
   -------------------------------------------------------------------------
   The physician panel is used one-handed between patients and the intake form
   is filled in by a relative on their own phone. Everything below exists to
   make those two cases feel like an app rather than a page.
   ========================================================================= */

/* ---- pressed feedback ----
   Hover does not exist on touch. Without an active state a tap feels like
   nothing happened, which is how people end up double-booking. */
@media (hover: none) {
  .pgc-btn:active:not(:disabled) { transform: scale(.98); }
  .pgc-btn-primary:active:not(:disabled) { background: var(--pgc-primary-700) !important; }
  .pgc-btn-ghost:active:not(:disabled) { background: var(--pgc-surface-3) !important; }
  .pgc-icon-btn:active { background: var(--pgc-surface-3); transform: scale(.94); }
  .pgc-opt:active,
  .pgc-check-row:active { background: var(--pgc-primary-50); }
  .pgc-case:active,
  .pgc-patient:active,
  .pgc-type:active { transform: scale(.995); border-color: var(--pgc-primary-100); }
  .pgc-tabs button:active { background: rgba(0, 0, 0, .05); }

  /* Hover styles that linger after a tap on touch devices — suppress them. */
  .pgc-btn:hover:not(:active) { transform: none; }
}

/* ---- safe areas ----
   Notched phones inset the top; the home-indicator bar eats the bottom. */
@supports (padding: max(0px)) {
  .pgc-foot,
  .pgc-nav,
  .pgc-action-bar {
    padding-bottom: max(12px, env(safe-area-inset-bottom));
  }
  .pgc-sheet-body {
    padding-bottom: max(20px, calc(env(safe-area-inset-bottom) + 20px));
  }
  .pgc-toast {
    bottom: max(20px, calc(env(safe-area-inset-bottom) + 12px));
  }
  .pgc-saving {
    bottom: max(16px, calc(env(safe-area-inset-bottom) + 8px));
  }
}

/* ---- scrolling ----
   Contained overscroll stops a swipe inside a list from dragging the whole
   page, which on iOS produces the rubber-band that feels broken. */
.pgc-chat,
.pgc-tab-panel,
.pgc-sheet-body,
.pgc-rail,
.pgc-tabs {
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

/* Sticky headers would otherwise cover whatever we scroll into view. */
.pgc-intake,
.pgc-doctor,
.pgc-portal { scroll-padding-top: 96px; }

/* The day rail should settle on a day, not between two. */
.pgc-rail {
  scroll-snap-type: x proximity;
  overscroll-behavior-x: contain;
}
.pgc-day { scroll-snap-align: center; }

/* ---- full-height overlays ----
   100vh on mobile includes the browser chrome that is not actually there, so
   overlays get cut off. dvh tracks the real visible height. */
@supports (height: 100dvh) {
  .pgc-loading { height: 100dvh; }
  .pgc-sheet { height: 100dvh; }
  .pgc-sheet-panel { max-height: 88dvh; }
}

/* ---- sticky primary action ----
   The physician's main act is signing the note, which otherwise sits below a
   long form. Keeping it in thumb reach is the difference between a note
   written and a note left as a draft. */
.pgc-action-bar {
  position: sticky;
  bottom: 0;
  z-index: 40;
  display: flex;
  gap: 10px;
  margin: 14px -14px 0;
  padding: 12px 14px;
  background: rgba(255, 255, 255, .97);
  backdrop-filter: blur(8px);
  border-top: 1px solid var(--pgc-border);
}
.pgc-action-bar .pgc-btn { flex: 1; }

/* ---- narrow phones ----
   Only rules that no surface stylesheet also declares belong here. base.css is
   a dependency of every bundle, so it loads FIRST: a plain `.pgc-phase` rule in
   this block loses to intake.css's own `.pgc-phase`, which comes later with
   equal specificity. Each surface's narrow-phone overrides therefore live at
   the end of that surface's stylesheet, where they actually win. */
@media (max-width: 360px) {
  .pgc { font-size: 15.5px !important; }
  .pgc-btn { padding: 12px 16px !important; font-size: 15.5px !important; }
  .pgc-tabs button { padding: 8px 12px; font-size: 14px; }
}

/* ---- landscape ----
   A phone on its side has ~350px of height. Sticky headers that are fine in
   portrait leave almost nothing for the content, so they compact. */
@media (orientation: landscape) and (max-height: 500px) {
  .pgc-intake-head,
  .pgc-doc-head,
  .pgc-chart-head,
  .pgc-portal-head,
  .pgc-record-head { padding-top: 8px; padding-bottom: 8px; }

  .pgc-intake-who strong,
  .pgc-doc-head strong { font-size: 15px; }

  .pgc-progress { margin-top: 4px; }
  .pgc-section-card { padding: 14px 16px; }
  .pgc-chat { max-height: 40vh; }
  .pgc-sheet-panel { max-height: 94vh; }

  /* Two columns of answers rather than one very tall list. */
  .pgc-options:not(.pgc-options--pair) { display: grid; grid-template-columns: 1fr 1fr; }
}

/* ---- wide phones and tablets ----
   Above ~640px the single column starts to look lost, so the denser grids
   get a second column instead of stretching. */
@media (min-width: 640px) {
  .pgc-type-grid { display: grid; grid-template-columns: 1fr 1fr; }
  .pgc-docs { display: grid; grid-template-columns: 1fr 1fr; }
  .pgc-patient-list { display: grid; grid-template-columns: 1fr 1fr; }
}

/* ---- pointer devices ----
   On a desktop the 52px controls read as oversized, so they relax slightly.
   Touch keeps the full size. */
@media (hover: hover) and (pointer: fine) and (min-width: 780px) {
  .pgc-btn { min-height: 46px; }
  .pgc-opt { min-height: 48px; }
}

/* ---- print ----
   A care plan or a visit note is something families print and take with them. */
@media print {
  .pgc-tabs,
  .pgc-foot,
  .pgc-nav,
  .pgc-action-bar,
  .pgc-back,
  .pgc-toast,
  .pgc-saving,
  .pgc-loading,
  .pgc-sheet { display: none !important; }

  .pgc { max-width: none; font-size: 12pt !important; }
  .pgc-card,
  .pgc-section-card { border: 1px solid #ccc; box-shadow: none; break-inside: avoid; }
}
