/* ══════════════════════════════════════════════════════════════════
   DOMICARE PATIENT WORKSPACE — PAGES
   Green design system per the approved Patient Stitch references.
   ══════════════════════════════════════════════════════════════════ */

/* ─── Page scaffold ────────────────────────────────────────────── */
.patient-page {
  width: min(100% - 32px, var(--patient-content, 1320px));
  margin: 0 auto;
  padding: 26px 0 40px;
  overflow-wrap: break-word;
}

.patient-workspace {
  width: min(100% - 32px, var(--patient-content, 1320px));
  margin: 0 auto;
}

/* Deliberate application gutters: 16px on phones, 24px on tablet and 32px
   inside the desktop workspace. Keep this at the shared scaffold so cards do
   not need page-specific edge nudges. */
@media (min-width: 768px) {
  .patient-page,
  .patient-workspace { width: min(100% - 48px, var(--patient-content, 1320px)); }
}

@media (min-width: 1024px) {
  .patient-page,
  .patient-workspace { width: min(100% - 64px, var(--patient-content, 1320px)); }
}

.patient-page-heading,
.patient-page-header {
  max-width: 860px;
  margin-bottom: 26px;
}

.patient-page-heading h1,
.patient-page-header h1,
.patient-records-list h1,
.patient-records-empty h1,
.patient-record-detail h1 {
  margin: 8px 0 10px;
  color: var(--p-ink);
  font-family: var(--p-font-head);
  font-size: clamp(1.6rem, 2.2vw + 1rem, 2rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.patient-page-heading p,
.patient-page-header p,
.patient-hero p {
  color: var(--p-body);
  line-height: 1.6;
}

.patient-eyebrow {
  margin: 0;
  color: var(--p-accent);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.patient-hero {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: clamp(26px, 4vw, 44px) clamp(24px, 4vw, 48px);
  border-radius: 24px;
  background:
    radial-gradient(110% 190% at 100% -20%, rgba(255, 255, 255, 0.12) 0%, rgba(255, 255, 255, 0) 42%),
    linear-gradient(115deg, var(--p-primary-deep) 0%, var(--p-primary) 58%, #0f7d52 100%);
  box-shadow: 0 10px 30px rgba(4, 56, 37, 0.22);
  overflow: hidden;
}

.patient-hero .patient-eyebrow { color: #a9ecc7; }

.patient-hero h1 {
  max-width: 30ch;
  margin: 8px 0 10px;
  color: #fff;
  font-family: var(--p-font-head);
  font-size: clamp(1.65rem, 2.4vw + 0.8rem, 2.2rem);
  font-weight: 800;
  letter-spacing: -0.025em;
  line-height: 1.16;
}

.patient-hero p { max-width: 62ch; margin: 0; color: rgba(255, 255, 255, 0.86); }

.patient-hero .patient-primary-action {
  margin-top: 20px;
  background: #fff;
  color: var(--p-primary);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
}

.patient-hero .patient-primary-action:hover { background: #eafaf1; color: var(--p-primary-dark); }

/* ─── Buttons & links ──────────────────────────────────────────── */
.patient-primary-action,
.patient-form button[type="submit"],
.patient-btn-primary,
.patient-record-view-btn {
  display: inline-flex;
  min-height: 46px;
  align-items: center;
  justify-content: center;
  margin-top: 16px;
  padding: 0 22px;
  border: 0;
  border-radius: 12px;
  background: var(--p-primary);
  color: #fff;
  font: inherit;
  font-family: var(--p-font-head);
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.005em;
  text-decoration: none;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(10, 108, 71, 0.22);
  transition: background-color 0.15s ease, transform 0.1s ease, box-shadow 0.15s ease;
}

.patient-primary-action:hover,
.patient-form button[type="submit"]:hover,
.patient-btn-primary:hover,
.patient-record-view-btn:hover {
  background: var(--p-primary-hover);
  box-shadow: 0 4px 12px rgba(10, 108, 71, 0.26);
}

.patient-primary-action:active,
.patient-form button[type="submit"]:active { transform: scale(0.985); }

.patient-primary-action[disabled],
.patient-form button[disabled],
.patient-btn[disabled] { opacity: 0.6; cursor: not-allowed; box-shadow: none; }

.patient-secondary-action {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  padding: 0 18px;
  border: 1px solid var(--p-border);
  border-radius: 12px;
  background: var(--p-surface);
  color: var(--p-ink-2);
  font: inherit;
  font-size: 0.92rem;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.patient-secondary-action:hover { background: var(--p-mint-50); border-color: var(--p-mint-150); }

.patient-inline-action { margin-top: 22px; }

.patient-back {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
  color: var(--p-primary);
  font-weight: 700;
  font-size: 0.92rem;
  text-decoration: none;
}

.patient-back:hover { color: var(--p-primary-hover); text-decoration: underline; }

.patient-text-danger { color: var(--p-danger) !important; }

/* ─── Cards ────────────────────────────────────────────────────── */
.patient-card,
.patient-person-card,
.patient-address-card,
.patient-service-card,
.appointment-detail-card,
.appointment-practitioner-card,
.appointment-card,
.patient-record-card,
.patient-message-card {
  border: 1px solid var(--p-border);
  background: var(--p-surface);
  box-shadow: 0 1px 2px rgba(20, 38, 28, 0.02), 0 2px 10px rgba(20, 38, 28, 0.03);
}

.patient-card { padding: 22px; border-radius: 20px; }
.patient-card h2 { margin: 0; font-size: 1.02rem; }

.patient-card-title { display: flex; align-items: center; gap: 10px; }

.patient-section-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin: 30px 0 14px;
}

.patient-section-heading h2,
.patient-card h2,
.patient-record-card strong {
  color: var(--p-ink);
  font-family: var(--p-font-head);
  font-weight: 700;
  letter-spacing: -0.01em;
}

.patient-section-heading h2 { font-size: 1.12rem; }

/* Text links inside cards keep link styling, but real BUTTONS/CTAs keep
   their own button colours — a broad card-anchor rule must never paint
   button labels the same colour as their background. Empty/error-state
   action anchors and button-classed actions are excluded so the button
   system owns their colours. */
.patient-section-heading a:not(.patient-primary-action):not(.patient-secondary-action):not(.patient-btn-primary),
.patient-card a:not(.patient-home-care-row):not(.patient-home-activity-row):not(.patient-primary-action):not(.patient-secondary-action):not(.patient-btn-primary):not(.patient-record-view-btn):not(.patient-btn):not([class*="-action"]):not(:is(.patient-empty a, .patient-error a)),
.patient-card-actions button,
.patient-record-card a:not(.patient-record-view-btn):not(.patient-btn):not([class*="-action"]):not(:is(.patient-empty a, .patient-error a)) {
  color: var(--p-primary);
  font-weight: 700;
  text-decoration: none;
}

.patient-section-heading a:hover:not(.patient-primary-action):not(.patient-secondary-action):not(.patient-btn-primary),
.patient-card a:hover:not(.patient-home-care-row):not(.patient-home-activity-row):not(.patient-primary-action):not(.patient-secondary-action):not(.patient-btn-primary):not(.patient-record-view-btn):not(.patient-btn):not([class*="-action"]):not(:is(.patient-empty a, .patient-error a)),
.patient-record-card a:hover:not(.patient-record-view-btn):not(.patient-btn):not([class*="-action"]):not(:is(.patient-empty a, .patient-error a)) { color: var(--p-primary-hover); text-decoration: underline; }

.patient-home-grid,
.patient-profile-grid,
.patient-list {
  display: grid;
  gap: 16px;
  margin-top: 20px;
}

/* ─── Home: hero action & services ─────────────────────────────── */

.patient-service-shortcuts,
.patient-services-grid { display: grid; gap: 12px; }

/* Service card: the redundant category/eyebrow line was removed, so the card
   leads with the real service name. Vertical padding and the minimum height are
   tightened so the card shrinks with its content instead of leaving a gap. */
.patient-service-card {
  position: relative;
  display: grid;
  align-content: start;
  gap: 6px;
  min-height: 132px;
  padding: 16px 18px;
  border-radius: 18px;
  color: var(--p-ink);
  text-decoration: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.patient-service-card:hover {
  border-color: var(--p-mint-200);
  box-shadow: 0 8px 24px rgba(10, 108, 71, 0.07);
  transform: translateY(-1px);
}

.patient-service-icon {
  display: grid;
  width: 44px;
  height: 44px;
  margin-bottom: 10px;
  place-items: center;
  border-radius: 50%;
  background: var(--p-mint-100);
  color: var(--p-primary);
  font-size: 1.45rem;
  font-weight: 500;
  line-height: 1;
}

.patient-service-card strong {
  color: var(--p-ink-2);
  font-family: var(--p-font-head);
  font-size: 0.98rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.3;
}

.patient-service-card > span:not(.patient-service-icon, .patient-card-link),
.patient-service-card p {
  margin: 0;
  color: var(--p-body);
  font-size: 0.86rem;
  line-height: 1.5;
}

.patient-service-card h2 { margin: 3px 0; font-size: 1.12rem; }
.patient-card-link { margin-top: auto; color: var(--p-primary) !important; font-weight: 700; }

.patient-home .patient-home-grid { grid-template-columns: 1fr; }

/* Home upcoming/family/activity rows */
.patient-home-care-list,
.patient-home-activity-list { display: grid; gap: 10px; margin-top: 16px; }

.patient-home-care-row,
.patient-home-activity-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 16px;
  border: 1px solid var(--p-border-soft);
  border-radius: 14px;
  background: var(--p-surface);
  color: var(--p-ink);
  text-decoration: none;
  text-align: left;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.patient-home-care-row:hover,
.patient-home-activity-row:hover { border-color: var(--p-mint-200); background: var(--p-mint-50); }

.patient-home-care-main,
.patient-home-activity-main {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.patient-home-care-main strong,
.patient-home-activity-main strong {
  color: var(--p-ink-2);
  font-size: 0.95rem;
  font-weight: 700;
}

.patient-home-care-main span,
.patient-home-activity-main span {
  color: var(--p-body);
  font-size: 0.84rem;
  line-height: 1.45;
  overflow-wrap: break-word;
}

.patient-home-care-status {
  flex: 0 0 auto;
  max-width: 46%;
  padding: 4px 12px;
  border-radius: 999px;
  background: var(--p-tint);
  color: var(--p-primary);
  font-size: 0.72rem;
  font-weight: 700;
  text-align: center;
}

.patient-home-activity-link { flex: 0 0 auto; color: var(--p-primary); font-size: 0.84rem; font-weight: 700; }

/* State-driven home status chips */
.patient-home-care-status[data-status="AWAITING_PAYMENT"],
.patient-home-care-status[data-status="PROVIDER_ASSIGNED"] { background: var(--p-amber-bg); color: #92400e; }
.patient-home-care-status[data-status="MATCHING"],
.patient-home-care-status[data-status="PROVIDER_EN_ROUTE"] { background: var(--p-enroute-bg); color: var(--p-primary-dark); }
.patient-home-care-status[data-status="PROVIDER_ACCEPTED"],
.patient-home-care-status[data-status="PAYMENT_CONFIRMED"],
.patient-home-care-status[data-status="IN_PROGRESS"] { background: var(--p-tint); color: var(--p-primary); }

/* ─── Loading / empty / error states ───────────────────────────── */
.patient-state,
.patient-error,
.patient-loading-state,
.patient-empty-state {
  display: grid;
  justify-items: center;
  gap: 8px;
  padding: 22px 16px;
  text-align: center;
}

/* Empty states are application CARDS — remove the data, not the workspace.
   Populated and empty states share the same surface language. */
.patient-empty {
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 8px;
  min-height: 176px;
  padding: 32px 24px;
  text-align: center;
  border: 1px solid var(--p-border);
  border-radius: 18px;
  background: var(--p-surface);
  box-shadow: 0 1px 2px rgba(12, 31, 22, 0.04), 0 6px 18px rgba(12, 31, 22, 0.04);
}

.patient-empty h2 {
  margin: 0;
  color: var(--p-ink);
  font-family: var(--p-font-head);
  font-size: 1.1rem;
}

.patient-empty .patient-empty-glyph {
  font-size: 2.4rem;
  color: var(--p-primary);
  margin-bottom: 4px;
}

.patient-empty p {
  margin: 0;
  color: var(--p-body);
  line-height: 1.55;
  max-width: 44ch;
}

.patient-state { color: var(--p-body); justify-items: center; }
.patient-state p { margin: 0; }

.patient-loader {
  width: 28px;
  height: 28px;
  border: 3px solid var(--p-mint-150);
  border-top-color: var(--p-primary);
  border-radius: 50%;
  animation: patient-spin 0.8s linear infinite;
}

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

.patient-empty h2,
.patient-error h2 { margin: 0; color: var(--p-ink); font-family: var(--p-font-head); font-size: 1.05rem; }
.patient-empty p,
.patient-error p,
.patient-help { margin: 0; color: var(--p-body); line-height: 1.55; }

.patient-empty a { color: var(--p-primary); font-weight: 700; }

.patient-error[role="alert"] { justify-items: center; }

.patient-destination-empty {
  min-height: 320px;
  display: grid;
  place-items: center;
}

.patient-destination-empty .patient-empty { justify-items: center; }

/* ─── People / dependants / addresses ──────────────────────────── */
.patient-person-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.patient-person-row div { display: grid; gap: 3px; }
.patient-person-row span, .patient-person-row p { margin: 0; color: var(--p-body); }

.patient-avatar {
  display: grid;
  flex: 0 0 46px;
  width: 46px;
  height: 46px;
  place-items: center;
  border: 1px solid var(--p-mint-150);
  border-radius: 50%;
  background: var(--p-mint-100);
  color: var(--p-primary-dark);
  font-weight: 800;
  font-size: 1.05rem;
  text-transform: uppercase;
}

.patient-avatar.patient-avatar-lg {
  width: 58px;
  height: 58px;
  flex-basis: 58px;
  font-size: 1.4rem;
}

.patient-person-card,
.patient-address-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 20px;
  border-radius: 18px;
}

.patient-person-card h2,
.patient-address-card h2 {
  margin: 0;
  color: var(--p-ink-2);
  font-family: var(--p-font-head);
  font-size: 1.05rem;
  font-weight: 700;
}

.patient-card-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
}

.patient-card-actions :is(a, button) {
  /* D002: the Edit / Set Default / Remove inline controls must meet the ~44px
     touch-target floor at mobile widths, not 40px. */
  min-height: 44px;
  padding: 8px 14px;
  border: 0;
  background: transparent;
  font: inherit;
  font-size: 0.88rem;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  border-radius: 10px;
}

.patient-card-actions a { color: var(--p-primary); }
.patient-card-actions a:hover { background: var(--p-mint-50); }

.patient-address-card { align-items: flex-start; }
.patient-address-card address {
  margin-top: 8px;
  color: var(--p-body);
  font-style: normal;
  line-height: 1.5;
}
.patient-address-card p { margin: 8px 0 0; color: var(--p-body); font-size: 0.88rem; }

.patient-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--p-tint);
  color: var(--p-primary);
  font-size: 0.72rem;
  font-weight: 800;
}

/* ─── Profile ──────────────────────────────────────────────────── */
.patient-profile-hero {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 22px;
}

.patient-profile-hero-text { min-width: 0; }
.patient-profile-hero-text h2 { margin: 0 0 2px; font-size: 1.15rem; }
.patient-profile-hero-text p { margin: 0; color: var(--p-body); font-size: 0.88rem; overflow-wrap: break-word; }

.patient-details {
  display: grid;
  gap: 12px;
  margin: 18px 0;
}

.patient-details > div { display: grid; gap: 4px; }
.patient-details dt {
  color: var(--p-body);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}
.patient-details dd { margin: 0; color: var(--p-ink-2); font-weight: 600; overflow-wrap: break-word; }

.patient-id { color: var(--p-body); font-size: 0.82rem; overflow-wrap: break-word; word-break: normal; }
.patient-readonly-name { margin-bottom: 0; }

.patient-profile-links {
  padding: 0;
  overflow: hidden;
}

.patient-profile-links a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 66px;
  padding: 14px 20px;
  color: var(--p-ink);
  text-decoration: none;
  transition: background-color 0.15s ease;
}

.patient-profile-links a:hover { background: var(--p-mint-50); }
.patient-profile-links a + a { border-top: 1px solid var(--p-border-soft); }

.patient-profile-links span:first-child { display: grid; gap: 3px; }
.patient-profile-links strong { color: var(--p-ink-2); font-size: 0.95rem; }
.patient-profile-links small { color: var(--p-body); font-weight: 500; font-size: 0.8rem; }
.patient-profile-links > a > span:last-child { color: var(--p-muted); font-size: 1.2rem; }

/* ─── Forms ────────────────────────────────────────────────────── */
.patient-form { display: grid; gap: 16px; margin-top: 18px; }
.patient-form-row { display: grid; gap: 16px; }

.patient-form label {
  display: grid;
  gap: 7px;
  color: var(--p-ink-2);
  font-size: 0.9rem;
  font-weight: 700;
}

.patient-form label small { color: var(--p-body); font-weight: 500; }

.patient-form :is(input, select, textarea) {
  box-sizing: border-box;
  width: 100%;
  min-height: 46px;
  padding: 10px 13px;
  border: 1px solid var(--p-border);
  border-radius: 12px;
  background: var(--p-surface);
  color: var(--p-ink);
  font: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.patient-form :is(input, select, textarea):focus {
  border-color: var(--p-primary);
  outline: none;
  box-shadow: 0 0 0 3px rgba(13, 148, 100, 0.16);
}

.patient-form :is(input, select, textarea)::placeholder { color: var(--p-muted); }
.patient-form textarea { resize: vertical; }
.patient-form [aria-invalid="true"] { border-color: var(--p-danger); }

.patient-field-error {
  min-height: 1em;
  color: var(--p-danger);
  font-size: 0.8rem;
  font-weight: 600;
}

.patient-form-summary {
  padding: 12px 14px;
  border-left: 4px solid var(--p-danger);
  border-radius: 10px;
  background: var(--p-red-bg);
  color: #93000a;
}

.patient-form-card { max-width: 780px; }

.patient-check {
  display: grid;
  grid-template-columns: 22px 1fr !important;
  align-items: center;
}

.patient-check input { width: 20px; min-height: 20px; }

/* ─── Appointments list ────────────────────────────────────────── */
.appointment-section { margin-bottom: 30px; }

.appointment-list { display: grid; gap: 12px; margin-top: 14px; }

.appointment-card {
  display: block;
  padding: 18px 20px;
  border-radius: 18px;
  text-decoration: none;
  color: var(--p-ink);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.12s ease;
}

.appointment-card:hover {
  border-color: var(--p-mint-200);
  box-shadow: 0 6px 18px rgba(10, 108, 71, 0.07);
  transform: translateY(-1px);
}

.appointment-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.appointment-date { color: var(--p-muted); font-size: 0.8rem; font-weight: 500; }

.appointment-card-body { display: grid; gap: 4px; }

.appointment-timing {
  margin: 0;
  color: var(--p-ink-2);
  font-size: 1rem;
  font-weight: 700;
  font-family: var(--p-font-head);
}

.appointment-service,
.appointment-practitioner {
  margin: 0;
  color: var(--p-body);
  font-size: 0.86rem;
}

.appointment-practitioner { color: var(--p-primary); font-weight: 600; }

/* Status pills (green design system) */
.appointment-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: max-content;
  max-width: 100%;
  padding: 5px 12px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  line-height: 1.2;
  white-space: normal;
  overflow: hidden;
}

.appointment-badge::before {
  content: "";
  width: 6px;
  height: 6px;
  flex: 0 0 6px;
  border-radius: 50%;
  background: currentColor;
}

.appointment-badge-draft,
.appointment-badge-cancelled { background: var(--p-neutral-bg); color: var(--p-neutral-text); border-color: #e2e8f0; }

.appointment-badge-payment,
.appointment-badge-assigned { background: var(--p-amber-bg); color: #92400e; border-color: #fde68a; }

.appointment-badge-confirmed { background: var(--p-tint); color: var(--p-primary); border-color: var(--p-mint-150); }

.appointment-badge-accepted { background: #d9f3e3; color: var(--p-primary-dark); border-color: var(--p-mint-200); }

.appointment-badge-matching {
  background: var(--p-enroute-bg);
  color: var(--p-primary-dark);
  border-color: var(--p-mint-150);
}

.appointment-badge-matching::before {
  background: var(--p-accent);
  box-shadow: 0 0 0 0 rgba(13, 148, 100, 0.45);
  animation: p-badge-pulse 1.8s infinite;
}

@keyframes p-badge-pulse {
  70% { box-shadow: 0 0 0 5px rgba(13, 148, 100, 0); }
  100% { box-shadow: 0 0 0 0 rgba(13, 148, 100, 0); }
}

/* ─── Appointment detail ───────────────────────────────────────── */
.appointment-info-banner {
  margin-bottom: 18px;
  padding: 14px 16px;
  border: 1px solid var(--p-mint-150);
  border-left: 4px solid var(--p-primary);
  border-radius: 12px;
  background: var(--p-mint-50);
}

.appointment-info-banner p { margin: 0; color: var(--p-ink-2); font-size: 0.92rem; line-height: 1.5; }

.appointment-detail-card,
.appointment-practitioner-card {
  margin-bottom: 18px;
  padding: 22px;
  border-radius: 20px;
}

.appointment-detail-card h2,
.appointment-practitioner-card h2 {
  margin: 0 0 16px;
  color: var(--p-ink);
  font-family: var(--p-font-head);
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.appointment-detail-card > .appointment-badge { margin-bottom: 14px; }

.appointment-detail-list {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px 18px;
  margin: 0;
}

.appointment-detail-list dt {
  color: var(--p-body);
  font-size: 0.82rem;
  font-weight: 600;
  min-width: 0;
}

.appointment-detail-list dd {
  margin: 0;
  color: var(--p-ink-2);
  font-size: 0.93rem;
  min-width: 0;
  overflow-wrap: break-word;
}

.appointment-practitioner-card p { margin: 4px 0; color: var(--p-body); }
.appointment-practitioner-card p:first-of-type { color: var(--p-ink-2); font-size: 1.05rem; }

.appointment-detail-actions { margin-top: 22px; }
.appointment-detail-actions [role="alert"] { color: var(--p-danger); font-size: 0.85rem; margin-top: 10px; }

/* ─── Fulfilment timeline ──────────────────────────────────────── */
.fulfilment-timeline { display: flex; flex-direction: column; }

.fulfilment-step {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 46px;
  padding: 7px 0;
}

.fulfilment-step:not(:last-child)::after {
  content: "";
  position: absolute;
  top: 34px;
  left: 12px;
  bottom: -6px;
  width: 2px;
  background: var(--p-border);
}

.fulfilment-step--completed:not(:last-child)::after,
.fulfilment-step--current:not(:last-child)::after { background: var(--p-mint-200); }

.fulfilment-step-icon {
  position: relative;
  z-index: 1;
  display: grid;
  width: 26px;
  height: 26px;
  flex: 0 0 26px;
  place-items: center;
  border-radius: 50%;
  background: var(--p-neutral-bg);
  color: var(--p-muted);
  font-size: 0.72rem;
  font-weight: 800;
}

.fulfilment-step--completed .fulfilment-step-icon,
.fulfilment-step--current .fulfilment-step-icon { background: var(--p-primary); color: #fff; }

.fulfilment-step-label { color: var(--p-muted); font-size: 0.92rem; font-weight: 500; }
.fulfilment-step--completed .fulfilment-step-label { color: var(--p-ink-2); font-weight: 600; }
.fulfilment-step--current .fulfilment-step-label { color: var(--p-primary); font-weight: 700; }

.fulfilment-step-time {
  margin-left: auto;
  color: var(--p-muted);
  font-size: 0.78rem;
  white-space: nowrap;
}

/* ─── Health records (list + detail) ───────────────────────────── */
.patient-records-list,
.patient-records-empty {
  width: min(100% - 32px, var(--patient-content, 1320px));
  margin: 0 auto;
  padding: 30px 0 44px;
}

.patient-records-empty { text-align: center; padding-top: 70px; }
.patient-records-empty .patient-empty-state-text,
.patient-empty-state-text {
  color: var(--p-ink-2);
  font-family: var(--p-font-head);
  font-size: 1.2rem;
  font-weight: 700;
  margin: 4px 0 6px;
}

.patient-records-empty .patient-empty-state-sub,
.patient-empty-state-sub {
  color: var(--p-body);
  max-width: 46ch;
  margin: 0 auto;
  line-height: 1.6;
}

.patient-records-count { color: var(--p-body); font-size: 0.9rem; margin: -4px 0 20px; }

.patient-record-cards { display: grid; gap: 14px; }

.patient-record-card {
  padding: 20px 22px;
  border-radius: 18px;
}

.patient-record-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 12px;
}

.patient-record-card-header strong { color: var(--p-ink-2); font-size: 1.04rem; }

.patient-record-date {
  flex: 0 0 auto;
  color: var(--p-body);
  font-size: 0.82rem;
  font-weight: 600;
  white-space: nowrap;
}

.patient-record-meta {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 6px 14px;
  margin: 0 0 16px;
}

.patient-record-meta dt { color: var(--p-muted); font-size: 0.8rem; font-weight: 600; }
.patient-record-meta dd { margin: 0; color: var(--p-body); font-size: 0.9rem; min-width: 0; }

.patient-record-summary { color: var(--p-ink-2) !important; line-height: 1.55; }

.patient-record-view-btn { margin-top: 6px; }

/* Record detail */
.patient-record-detail {
  width: min(100% - 32px, 980px);
  margin: 0 auto;
  padding: 30px 0 44px;
}

.patient-record-back-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 40px;
  margin-bottom: 8px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--p-primary);
  font: inherit;
  font-size: 0.92rem;
  font-weight: 700;
  cursor: pointer;
}

.patient-record-back-btn:hover { text-decoration: underline; }

.patient-record-detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 28px;
  margin: 6px 0 26px;
  padding: 14px 18px;
  border: 1px solid var(--p-border-soft);
  border-radius: 16px;
  background: var(--p-mint-50);
}

.patient-record-detail-meta p { margin: 0; color: var(--p-body); font-size: 0.88rem; }
.patient-record-detail-meta strong { color: var(--p-ink-2); font-weight: 700; }

.patient-record-section {
  margin-bottom: 18px;
  padding: 20px 22px;
  border: 1px solid var(--p-border);
  border-radius: 18px;
  background: var(--p-surface);
}

.patient-record-section h2 {
  margin: 0 0 10px;
  color: var(--p-ink);
  font-family: var(--p-font-head);
  font-size: 0.98rem;
  font-weight: 700;
  letter-spacing: -0.005em;
}

.patient-record-section p { margin: 0; color: var(--p-ink-2); line-height: 1.65; }

.patient-record-amended {
  border-color: #fde68a;
  background: #fffbeb;
}

.patient-record-amended-notice { color: #92400e !important; font-weight: 600; }

.patient-record-amendments {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.patient-record-amendment-item {
  display: grid;
  gap: 2px;
  padding: 12px 14px;
  border: 1px solid #fde68a;
  border-radius: 12px;
  background: #fff;
}

.patient-record-amendment-section {
  color: var(--p-ink-2);
  font-weight: 700;
  font-size: 0.88rem;
  text-transform: capitalize;
}

.patient-record-amendment-reason { color: var(--p-body); font-size: 0.86rem; }
.patient-record-amendment-date { color: var(--p-muted); font-size: 0.76rem; }

/* ─── Messages ─────────────────────────────────────────────────── */
.patient-messages-page { width: min(100% - 32px, 960px); margin: 0 auto; padding: 26px 0 36px; }

/* Messages live inside a deliberate workspace/card surface — empty and
   populated states both stay contained, never floating on the canvas. */
.patient-messages-workspace {
  border: 1px solid var(--p-border);
  border-radius: 20px;
  background: var(--p-surface);
  box-shadow: 0 1px 2px rgba(20, 38, 28, 0.02), 0 4px 16px rgba(20, 38, 28, 0.04);
  min-height: 320px;
  overflow: hidden;
}

.patient-messages-workspace > .patient-loading-state,
.patient-messages-workspace > .messages-empty-state {
  min-height: 320px;
  display: grid;
  place-content: center;
  justify-items: center;
  text-align: center;
  padding: 40px 24px;
  gap: 6px;
}

.messages-empty-state .messages-empty-icon {
  display: grid;
  width: 52px;
  height: 52px;
  place-items: center;
  margin-bottom: 8px;
  border-radius: 16px;
  background: var(--p-mint-50);
  color: var(--p-primary);
}

.messages-empty-state .messages-empty-icon svg {
  width: 26px;
  height: 26px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.messages-empty-state p { margin: 2px 0; color: var(--p-body); }
.messages-empty-state p.patient-muted,
.messages-empty-state p.practitioner-muted { font-size: 0.88rem; max-width: 46ch; }

.patient-messages-list-wrap { padding: 14px; }

.patient-messages-list { display: grid; gap: 10px; }

.patient-messages-page .patient-page-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 18px;
}

.patient-messages-page .patient-page-header h1 { margin: 0; font-size: 1.45rem; }

.patient-back-btn {
  border: none;
  background: transparent;
  color: var(--p-primary);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  padding: 6px 0;
}

.patient-back-btn:hover { text-decoration: underline; }

.patient-muted { color: var(--p-muted); font-size: 0.88rem; }

.patient-messages-list { display: grid; gap: 10px; }

.patient-message-card {
  display: block;
  width: 100%;
  padding: 16px 18px;
  border-radius: 16px;
  text-align: left;
  font: inherit;
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease, transform 0.12s ease;
}

.patient-message-card:hover {
  border-color: var(--p-mint-200);
  background: var(--p-mint-50);
  transform: translateY(-1px);
}

.message-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 2px;
}

.message-practitioner-name {
  color: var(--p-ink-2);
  font-family: var(--p-font-head);
  font-weight: 700;
  font-size: 0.95rem;
}

.message-time { color: var(--p-muted); font-size: 0.76rem; white-space: nowrap; }

.message-service-name { color: var(--p-primary); font-size: 0.82rem; font-weight: 700; margin-bottom: 5px; }

.message-preview {
  color: var(--p-body);
  font-size: 0.88rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Conversation */
.patient-conversation-container {
  display: flex;
  flex-direction: column;
  height: min(72vh, 720px);
  min-height: 420px;
  border: 1px solid var(--p-border);
  border-radius: 20px;
  background: var(--p-surface);
  box-shadow: 0 1px 2px rgba(20, 38, 28, 0.02), 0 4px 16px rgba(20, 38, 28, 0.04);
  overflow: hidden;
}

.patient-messages-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 18px 18px 12px;
  overflow-y: auto;
  background: linear-gradient(180deg, var(--p-mint-50), var(--p-canvas));
}

.message-bubble {
  max-width: min(78%, 560px);
  padding: 9px 14px;
  border: 1px solid var(--p-border);
  border-radius: 16px;
  background: #fff;
}

.message-bubble .message-text { color: var(--p-ink-2); }

.message-sent {
  align-self: flex-end;
  border-color: var(--p-primary);
  background: var(--p-primary);
  border-bottom-right-radius: 6px;
}

.message-sent .message-text { color: #fff; }

.message-sent .message-meta { color: rgba(255, 255, 255, 0.78); text-align: right; }

.message-received { align-self: flex-start; border-bottom-left-radius: 6px; }

.message-system {
  align-self: center;
  max-width: 90%;
  border: 0;
  background: transparent;
  font-style: italic;
  color: var(--p-muted);
  text-align: center;
}

.message-text { font-size: 0.92rem; line-height: 1.5; word-wrap: break-word; overflow-wrap: break-word; }

.message-meta { font-size: 0.7rem; margin-top: 5px; color: var(--p-muted); opacity: 0.9; }

.patient-message-input-area {
  padding: 12px 16px;
  border-top: 1px solid var(--p-border-soft);
  background: #fff;
}

.patient-message-form { display: flex; gap: 10px; align-items: center; }

.patient-message-input {
  flex: 1;
  min-height: 44px;
  padding: 10px 15px;
  border: 1px solid var(--p-border);
  border-radius: 999px;
  background: var(--p-mint-50);
  font: inherit;
  font-size: 0.94rem;
  color: var(--p-ink);
}

.patient-message-input:focus { outline: none; border-color: var(--p-primary); box-shadow: 0 0 0 3px rgba(13, 148, 100, 0.16); }

.patient-send-btn {
  min-height: 44px;
  padding: 0 20px;
  border: 0;
  border-radius: 999px;
  background: var(--p-primary);
  color: #fff;
  font: inherit;
  font-family: var(--p-font-head);
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.patient-send-btn:hover { background: var(--p-primary-hover); }
.patient-send-btn:disabled { opacity: 0.6; cursor: not-allowed; }

/* ─── Messages workspace (reference v2) ───────────────────────── */
.pmsg-page { width: min(100% - 32px, 1180px); margin: 0 auto; padding: 26px 0 36px; }

.pmsg-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px 20px;
  margin-bottom: 18px;
}

.pmsg-header h1 { margin: 0; font-family: var(--p-font-head); font-size: 1.5rem; font-weight: 800; letter-spacing: -0.02em; color: var(--p-ink-2); }
.pmsg-header p { margin: 4px 0 0; color: var(--p-body); font-size: 0.9rem; }

.pmsg-header-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 13px;
  border: 1px solid var(--p-mint-150);
  border-radius: 999px;
  background: var(--p-mint-50);
  color: var(--p-primary);
  font-size: 0.76rem;
  font-weight: 700;
  white-space: nowrap;
}

.pmsg-header-pill span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #0d9464;
}

.pmsg-workspace {
  display: flex;
  /* Bounded by the viewport so the header, scrollable thread and composer
     all stay on screen (composer must never fall below the fold). */
  height: min(780px, 78vh, calc(100dvh - 210px));
  min-height: 520px;
  border: 1px solid var(--p-border);
  border-radius: 20px;
  background: var(--p-surface);
  box-shadow: 0 1px 2px rgba(20, 38, 28, 0.02), 0 6px 20px rgba(20, 38, 28, 0.05);
  overflow: hidden;
}

/* Left: conversation list */
.pmsg-list-pane {
  display: flex;
  width: 330px;
  flex: 0 0 330px;
  flex-direction: column;
  border-right: 1px solid var(--p-border-soft);
  background: var(--p-surface);
}

.pmsg-list {
  flex: 1;
  overflow-y: auto;
  padding: 10px;
  display: grid;
  gap: 4px;
  align-content: start;
}

.pmsg-conv-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  width: 100%;
  padding: 12px;
  border: 1px solid transparent;
  border-radius: 14px;
  background: transparent;
  text-align: left;
  font: inherit;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.pmsg-conv-row:hover { background: var(--p-mint-50); border-color: var(--p-border-soft); }
.pmsg-conv-row.is-active { background: var(--p-mint-100); border-color: var(--p-mint-150); }

.pmsg-conv-avatar {
  position: relative;
  display: grid;
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  place-items: center;
  border: 1px solid var(--p-border-soft);
  border-radius: 50%;
  background: var(--p-mint-100);
  color: var(--p-primary-dark);
  font-size: 0.8rem;
  font-weight: 800;
}

.pmsg-conv-dot {
  position: absolute;
  right: -1px;
  bottom: -1px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--p-neutral-text);
  border: 2px solid var(--p-surface);
}

.pmsg-conv-dot.is-online { background: #0d9464; }

.pmsg-conv-copy { display: grid; gap: 2px; min-width: 0; }

.pmsg-conv-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.pmsg-conv-head strong {
  overflow: hidden;
  color: var(--p-ink-2);
  font-size: 0.9rem;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pmsg-conv-row.is-active .pmsg-conv-head strong { color: var(--p-primary-dark); }

.pmsg-conv-head time { color: var(--p-muted); font-size: 0.72rem; white-space: nowrap; }

.pmsg-conv-service {
  justify-self: start;
  max-width: 100%;
  padding: 1px 8px;
  border: 1px solid var(--p-border-soft);
  border-radius: 999px;
  background: var(--p-mint-50);
  color: var(--p-primary);
  font-size: 0.68rem;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pmsg-conv-preview {
  overflow: hidden;
  color: var(--p-body);
  font-size: 0.82rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pmsg-list-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 11px 16px;
  border-top: 1px solid var(--p-border-soft);
  color: var(--p-body);
  font-size: 0.74rem;
}

.pmsg-list-foot span { display: inline-flex; align-items: center; gap: 7px; font-weight: 600; color: var(--p-ink-2); }
.pmsg-list-foot-dot { width: 7px; height: 7px; border-radius: 50%; background: #0d9464; }
.pmsg-list-foot small { color: var(--p-muted); }

/* Right: chat pane */
.pmsg-chat-pane {
  display: flex;
  flex: 1;
  min-width: 0;
  flex-direction: column;
  background: #fff;
}

.pmsg-chat-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--p-border-soft);
  background: #fff;
  flex-shrink: 0;
  z-index: 1;
}

.pmsg-back {
  display: none;
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  border: 1px solid var(--p-border);
  border-radius: 10px;
  background: var(--p-surface);
  color: var(--p-primary);
  font-size: 1.1rem;
  cursor: pointer;
}

.pmsg-chat-avatar {
  position: relative;
  display: grid;
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  place-items: center;
  border: 1px solid var(--p-border-soft);
  border-radius: 50%;
  background: var(--p-mint-100);
  color: var(--p-primary-dark);
  font-size: 0.8rem;
  font-weight: 800;
}

.pmsg-chat-avatar .pmsg-conv-dot { border-color: #fff; }

.pmsg-chat-id { min-width: 0; }

.pmsg-chat-id h2 {
  margin: 0;
  overflow: hidden;
  color: var(--p-ink-2);
  font-size: 1rem;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pmsg-chat-id p {
  margin: 2px 0 0;
  overflow: hidden;
  color: var(--p-body);
  font-size: 0.78rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pmsg-chat-id p span { color: var(--p-primary); font-weight: 600; }

/* Feed */
.pmsg-feed {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 18px 20px 14px;
  overflow-y: auto;
  background: linear-gradient(180deg, var(--p-mint-50), var(--p-canvas));
}

.pmsg-feed .message-bubble { max-width: min(78%, 560px); padding: 10px 14px; border: 1px solid var(--p-border); border-radius: 16px; background: #fff; box-shadow: 0 1px 2px rgba(20, 38, 28, 0.03); }
.pmsg-feed .message-text { font-size: 0.92rem; line-height: 1.5; word-wrap: break-word; overflow-wrap: break-word; }
.pmsg-feed .message-meta { font-size: 0.7rem; margin-top: 5px; color: var(--p-muted); opacity: 0.9; }
.pmsg-feed .message-sent { align-self: flex-end; border-color: var(--p-primary); background: var(--p-primary); border-bottom-right-radius: 6px; }
.pmsg-feed .message-sent .message-text { color: #fff; }
.pmsg-feed .message-sent .message-meta { color: rgba(255, 255, 255, 0.78); text-align: right; }
.pmsg-feed .message-received { align-self: flex-start; border-bottom-left-radius: 6px; }
.pmsg-feed .message-system { align-self: center; max-width: 90%; border: 0; background: transparent; font-style: italic; color: var(--p-muted); text-align: center; }

.pmsg-feed-empty {
  margin: auto;
  display: grid;
  justify-items: center;
  gap: 8px;
  max-width: 320px;
  padding: 20px;
  text-align: center;
}

.pmsg-feed-empty > span {
  display: grid;
  width: 52px;
  height: 52px;
  place-items: center;
  border-radius: 16px;
  background: var(--p-mint-100);
  color: var(--p-primary);
}

.pmsg-feed-empty > span svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.pmsg-feed-empty p { margin: 0; color: var(--p-body); font-size: 0.9rem; }

/* Composer (always visible under the feed) */
.pmsg-composer {
  padding: 12px 16px;
  border-top: 1px solid var(--p-border-soft);
  background: #fff;
  flex-shrink: 0;
  z-index: 1;
}

.pmsg-composer-form { display: flex; align-items: center; gap: 10px; }

.pmsg-input {
  flex: 1;
  min-width: 0;
  min-height: 46px;
  max-height: 120px;
  padding: 10px 16px;
  border: 1px solid var(--p-border);
  border-radius: 18px;
  background: var(--p-mint-50);
  font: inherit;
  font-size: 0.94rem;
  color: var(--p-ink);
  resize: none;
  overflow-y: auto;
  line-height: 1.4;
  field-sizing: content;
}

textarea.pmsg-input { height: auto; }

.pmsg-input:focus { outline: none; border-color: var(--p-primary); box-shadow: 0 0 0 3px rgba(13, 148, 100, 0.16); }
.pmsg-input:disabled { opacity: 0.7; }

.pmsg-send {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 46px;
  padding: 0 20px;
  border: 0;
  border-radius: 999px;
  background: var(--p-primary);
  color: #fff;
  font: inherit;
  font-family: var(--p-font-head);
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 0.15s ease;
}

.pmsg-send:hover { background: var(--p-primary-hover); }
.pmsg-send:disabled { opacity: 0.65; cursor: not-allowed; }

.pmsg-send svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* Placeholder (no selected conversation, desktop) */
.pmsg-chat-placeholder {
  margin: auto;
  display: grid;
  justify-items: center;
  gap: 8px;
  max-width: 360px;
  padding: 30px;
  text-align: center;
}

.pmsg-placeholder-glyph {
  display: grid;
  width: 72px;
  height: 72px;
  place-items: center;
  margin-bottom: 8px;
  border-radius: 50%;
  background: var(--p-mint-100);
  color: var(--p-primary);
  box-shadow: 0 0 0 8px var(--p-mint-50);
}

.pmsg-placeholder-glyph svg { width: 34px; height: 34px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.pmsg-chat-placeholder h2 { margin: 0; color: var(--p-ink-2); font-family: var(--p-font-head); font-size: 1.1rem; font-weight: 800; }
.pmsg-chat-placeholder p { margin: 0; color: var(--p-body); font-size: 0.88rem; line-height: 1.55; }

.pmsg-chat-loading, .pmsg-loading, .pmsg-fail {
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 10px;
  flex: 1;
  padding: 40px 24px;
  text-align: center;
  color: var(--p-body);
}

.pmsg-loading { margin: auto; }
.pmsg-loading > span, .pmsg-fail > span {
  display: grid;
  width: 54px;
  height: 54px;
  place-items: center;
  border-radius: 50%;
  background: var(--p-mint-100);
  color: var(--p-primary);
}

.pmsg-loading > span svg, .pmsg-fail > span svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.pmsg-loading p, .pmsg-fail p { margin: 0; font-size: 0.9rem; }
.pmsg-fail h2 { margin: 0; color: var(--p-ink-2); font-family: var(--p-font-head); font-size: 1.1rem; font-weight: 800; }

/* Empty workspace (no conversations) */
.pmsg-empty-wrap {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  padding: 22px 26px 28px;
}

.pmsg-empty-card {
  max-width: 680px;
  margin: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  padding: 0;
  text-align: center;
}

.pmsg-empty-card .patient-primary-action {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 2px;
}

.pmsg-empty-card .patient-primary-action svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.pmsg-empty-emblem {
  position: relative;
  display: grid;
  width: 88px;
  height: 88px;
  place-items: center;
  margin-bottom: 20px;
  border-radius: 50%;
  background: var(--p-mint-100);
  color: var(--p-primary);
  border: 1px solid var(--p-mint-150);
}

.pmsg-empty-emblem > svg { width: 42px; height: 42px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }

.pmsg-empty-emblem > b {
  position: absolute;
  right: -6px;
  bottom: -4px;
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 50%;
  background: var(--p-primary);
  color: #fff;
  box-shadow: 0 2px 8px rgba(10, 108, 71, 0.3);
}

.pmsg-empty-emblem > b svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.pmsg-empty-card h2 { margin: 0 0 8px; color: var(--p-ink-2); font-family: var(--p-font-head); font-size: 1.25rem; font-weight: 800; letter-spacing: -0.01em; }
.pmsg-empty-card > p { max-width: 500px; margin: 0 0 22px; color: var(--p-body); font-size: 0.92rem; line-height: 1.65; }

.pmsg-concierge {
  display: flex;
  align-items: center;
  gap: 12px;
  width: min(100%, 560px);
  margin-top: 24px;
  padding: 14px 18px;
  border: 1px solid var(--p-border-soft);
  border-radius: 14px;
  background: var(--p-mint-50);
  text-align: left;
}

.pmsg-concierge-icon {
  display: grid;
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  place-items: center;
  border-radius: 10px;
  background: var(--p-surface);
  color: var(--p-primary);
  border: 1px solid var(--p-border-soft);
}

.pmsg-concierge-icon svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.pmsg-concierge strong { color: var(--p-ink-2); font-size: 0.86rem; }
.pmsg-concierge p { margin: 2px 0 0; color: var(--p-body); font-size: 0.8rem; line-height: 1.5; }

.pmsg-feature-triad {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  width: min(100%, 860px);
  margin: 22px auto 0;
}

.pmsg-feature-triad article {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 16px;
  border: 1px solid var(--p-border);
  border-radius: 14px;
  background: var(--p-surface);
  text-align: left;
}

.pmsg-feature-triad article > span {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  margin-bottom: 6px;
  border-radius: 10px;
  background: var(--p-mint-100);
  color: var(--p-primary);
}

.pmsg-feature-triad article > span svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.pmsg-feature-triad h3 { margin: 0; color: var(--p-ink-2); font-size: 0.9rem; font-weight: 800; }
.pmsg-feature-triad p { margin: 0; color: var(--p-body); font-size: 0.8rem; line-height: 1.5; }

@media (max-width: 900px) {
  .pmsg-list-pane { width: 290px; flex-basis: 290px; }
}

/* Mobile: one pane at a time; composer stays above the bottom dock. */
@media (max-width: 760px) {
  .pmsg-page { width: min(100% - 24px, 1180px); padding: 18px 0 30px; }
  .pmsg-workspace { height: min(72vh, 720px); min-height: 440px; }
  .pmsg-list-pane { width: 100%; flex-basis: 100%; border-right: 0; }
  .pmsg-chat-pane { display: none; }
  .pmsg-workspace[data-has-conversation="true"] .pmsg-list-pane { display: none; }
  .pmsg-workspace[data-has-conversation="true"] .pmsg-chat-pane { display: flex; }
  .pmsg-back { display: inline-flex; align-items: center; justify-content: center; }
  .pmsg-feature-triad { grid-template-columns: 1fr; }

  .pmsg-page[data-has-conversation="true"] {
    width: 100%;
    padding: 0;
  }

  .pmsg-page[data-has-conversation="true"] .pmsg-header { display: none; }

  .pmsg-page[data-has-conversation="true"] .pmsg-workspace {
    min-height: 300px;
    border-right: 0;
    border-left: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .pmsg-workspace:has(.pmsg-empty-wrap) {
    height: auto !important;
    min-height: 0;
    overflow: visible;
  }

  .pmsg-workspace:has(.pmsg-empty-wrap) .pmsg-empty-wrap {
    overflow: visible;
  }

  .pmsg-chat-id p {
    overflow: visible;
    line-height: 1.35;
    text-overflow: clip;
    white-space: normal;
  }
}

@media (prefers-reduced-motion: reduce) {
  .pmsg-conv-row, .pmsg-send { transition: none; }
}

/* ─── Misc helpers ─────────────────────────────────────────────── */
.patient-help { font-size: 0.86rem; }

/* ─── Responsive ───────────────────────────────────────────────── */
@media (min-width: 620px) {
  .patient-form-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .patient-service-shortcuts,
  .patient-services-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .patient-conversation-container { height: min(76vh, 760px); }
}

@media (min-width: 900px) {
  .patient-page { padding: 34px 0 48px; }
  .patient-hero { padding: 42px 46px; }
  .patient-service-shortcuts { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .patient-services-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .patient-home-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .patient-home-wide { grid-column: 1 / -1; }
  .patient-profile-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
  .patient-form-card { max-width: 820px; }
  .patient-record-cards { grid-template-columns: 1fr; }
  .patient-message-card { padding: 18px 20px; }
}

@media (min-width: 1200px) {
  .patient-hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 32px;
  }
  .patient-hero > * { grid-column: 1; }
  .patient-hero .patient-primary-action { grid-column: 2; grid-row: 1 / span 3; align-self: center; min-width: 150px; }
  .patient-home-care-list { grid-template-columns: 1fr; }
}

/* Wide content inside the desktop content column */
@media (min-width: 1440px) {
  .patient-home-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .patient-service-card { min-height: 136px; }
}

@media (max-width: 540px) {
  .patient-address-card,
  .patient-person-card { align-items: stretch; flex-direction: column; }
  .patient-card-actions { justify-content: flex-start; }
  .patient-header-context { display: none; }
  .patient-home-care-status { max-width: 52%; }
  .appointment-card { padding: 16px; }
  .patient-record-card-header { flex-direction: column; align-items: flex-start; gap: 4px; }
}

@media (prefers-reduced-motion: reduce) {
  .patient-loader,
  .appointment-badge-matching::before { animation-duration: 2.2s; }
  .patient-service-card,
  .appointment-card,
  .patient-message-card { transition: none; }
}

/* ══════════════════════════════════════════════════════════════════
   UI QUALITY PASS — CTA system
   Important actions must always read as BUTTONS (never invisible, never
   plain-text links) with readable contrast and safe label wrapping.
   ══════════════════════════════════════════════════════════════════ */

/* Robust label rendering on every state — text must never blend into bg */
.patient-primary-action,
.patient-btn-primary,
.patient-secondary-action,
.patient-record-view-btn {
  white-space: normal;
  overflow-wrap: break-word;
  line-height: 1.25;
  min-width: 0;
}

/* Secondary/outline actions carry an explicit green outline so they read
   as buttons (Request Care = primary, Browse Services = outline). */
.patient-secondary-action {
  border: 1.5px solid var(--p-primary);
  color: var(--p-primary);
  background: var(--p-surface);
}

.patient-secondary-action:hover {
  background: var(--p-mint-50);
  border-color: var(--p-primary-hover);
  color: var(--p-primary-hover);
}

/* Draft / continue-care card */
.care-home-draft .patient-section-heading { margin: 0 0 6px; }
.care-home-draft > p { margin: 0 0 16px; color: var(--p-body); }
.patient-draft-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.patient-draft-actions .patient-primary-action,
.patient-draft-actions .patient-secondary-action {
  margin-top: 0;
  min-height: 44px;
}

/* Empty-state CTAs become real buttons (primary). The generic card-anchor
   link rules are excluded above so labels stay readable. */
.patient-empty > a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  margin-top: 12px;
  padding: 10px 20px;
  border-radius: 12px;
  background: var(--p-primary);
  color: #fff;
  font-weight: 700;
  font-size: 0.92rem;
  text-decoration: none;
  box-shadow: 0 2px 6px rgba(10, 108, 71, 0.2);
  transition: background-color 0.15s ease, box-shadow 0.15s ease;
}

.patient-empty > a:hover {
  background: var(--p-primary-hover);
  color: #fff;
  box-shadow: 0 4px 12px rgba(10, 108, 71, 0.24);
}

/* Error / empty destinations: secondary outline for “Browse/View all” */
.patient-error > a,
.patient-error a[href*="services"],
.patient-error a[href*="request-care"],
.patient-next-step > a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  margin-top: 10px;
  padding: 9px 18px;
  border: 1.5px solid var(--p-primary);
  border-radius: 12px;
  background: var(--p-surface);
  color: var(--p-primary);
  font-weight: 700;
  font-size: 0.9rem;
  text-decoration: none;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.patient-error > a:hover,
.patient-error a[href*="services"]:hover,
.patient-next-step > a:hover {
  background: var(--p-mint-50);
  border-color: var(--p-primary-hover);
  color: var(--p-primary-hover);
  text-decoration: none;
}

/* Service detail action row */
.patient-next-step {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-top: 18px;
}

.patient-next-step .patient-primary-action { margin-top: 0; }
.patient-next-step > a { margin-top: 0; }

/* Long CTA labels wrap instead of overflowing on small screens */
.patient-primary-action {
  text-align: center;
  max-width: 100%;
}

@media (max-width: 540px) {
  .patient-primary-action,
  .patient-secondary-action,
  .patient-empty > a,
  .patient-error > a,
  .patient-next-step > a {
    width: 100%;
    box-sizing: border-box;
  }

  .patient-draft-actions,
  .patient-next-step {
    width: 100%;
  }

  .patient-draft-actions .patient-primary-action,
  .patient-draft-actions .patient-secondary-action {
    flex: 1 1 100%;
  }
}

/* ══════════════════════════════════════════════════════════════════
   UI QUALITY PASS — In-app confirmation modal
   Replaces the browser-native window.confirm() for cancelling a care
   request with a proper DomiCare modal (same underlying action).
   ══════════════════════════════════════════════════════════════════ */
.patient-confirm-dialog {
  position: fixed;
  inset: 0;
  margin: auto;
  border: 0;
  border-radius: 22px;
  padding: 0;
  width: min(92vw, 440px);
  max-width: 440px;
  max-height: calc(100dvh - 48px);
  box-shadow: 0 24px 70px rgba(4, 56, 37, 0.3);
  overflow: auto;
}

.patient-confirm-dialog::backdrop {
  background: rgba(12, 31, 22, 0.5);
}

.patient-confirm-panel {
  padding: 26px 26px 22px;
  background: var(--p-surface, #ffffff);
}

.patient-confirm-icon {
  display: grid;
  width: 48px;
  height: 48px;
  margin-bottom: 16px;
  place-items: center;
  border-radius: 14px;
  background: var(--p-red-bg, #fef2f2);
  color: var(--p-danger, #ba1a1a);
}

.patient-confirm-icon svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.patient-confirm-panel h2 {
  margin: 0 0 8px;
  color: var(--p-ink, #0c1f16);
  font-family: var(--p-font-head, 'Plus Jakarta Sans', sans-serif);
  font-size: 1.2rem;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.patient-confirm-panel p {
  margin: 0;
  color: var(--p-body, #3f4942);
  font-size: 0.92rem;
  line-height: 1.55;
}

.patient-confirm-error {
  margin: 14px 0 0;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--p-red-bg, #fef2f2);
  color: var(--p-red-text, #991b1b);
  font-size: 0.85rem;
  font-weight: 600;
  line-height: 1.45;
}

.patient-confirm-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 22px;
}

.patient-confirm-actions button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 9px 20px;
  border-radius: 12px;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 700;
  line-height: 1.2;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.patient-confirm-keep {
  border: 1.5px solid var(--p-primary, #0a6c47);
  background: var(--p-surface, #ffffff);
  color: var(--p-primary, #0a6c47);
}

.patient-confirm-keep:hover {
  background: var(--p-mint-50, #f0f8f4);
  border-color: var(--p-primary-hover, #085e3e);
  color: var(--p-primary-hover, #085e3e);
}

.patient-confirm-danger {
  border: 1.5px solid var(--p-danger, #ba1a1a);
  background: var(--p-danger, #ba1a1a);
  color: #fff;
}

.patient-confirm-danger:hover {
  background: #a01616;
  border-color: #a01616;
}

.patient-confirm-danger:disabled {
  opacity: 0.65;
  cursor: wait;
}

@media (max-width: 480px) {
  .patient-confirm-actions button {
    flex: 1 1 100%;
  }
}

/* ══════════════════════════════════════════════════════════════════
   HOME (reference v2) — dashboard composition
   Structure derived from patient.stitch patient-home-desktop:
   greeting+hero row → Request Care banner → two-column page
   (services + upcoming appointments) / (messages + health activity).
   ══════════════════════════════════════════════════════════════════ */
.patient-home-draft-zone { margin-bottom: 20px; }

/* ── Greeting + hero promo row ─────────────────────────────── */
.patient-home-top {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
}

.patient-home-greet { padding: 4px 0; }

.patient-home-greet .patient-eyebrow {
  margin: 0 0 6px;
  color: var(--p-primary);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.11em;
}

.patient-greet-name {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 6px;
  color: var(--p-ink);
  font-family: var(--p-font-head);
  font-size: clamp(1.7rem, 3vw + 0.6rem, 2.4rem);
  font-weight: 800;
  letter-spacing: -0.025em;
  line-height: 1.12;
  overflow-wrap: break-word;
}

.patient-greet-name span { font-size: 0.78em; }

.patient-home-greet > p:last-child {
  margin: 0;
  color: var(--p-body);
  font-size: clamp(0.86rem, 1vw + 0.4rem, 0.95rem);
  line-height: 1.5;
}

.patient-home-hero {
  position: relative;
  display: flex;
  min-height: 148px;
  align-items: center;
  justify-content: space-between;
  padding: 20px;
  border: 1px solid var(--p-mint-150);
  border-radius: 20px;
  background: var(--p-hero-mint);
  box-shadow: 0 1px 2px rgba(20, 38, 28, 0.03), 0 6px 18px rgba(10, 108, 71, 0.05);
  overflow: hidden;
}

.patient-home-hero-copy {
  position: relative;
  z-index: 2;
  max-width: 62%;
}

.patient-home-hero-copy h2 {
  margin: 0;
  color: var(--p-ink-2);
  font-family: var(--p-font-head);
  font-size: clamp(0.95rem, 1.3vw + 0.4rem, 1.12rem);
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.42;
}

.patient-home-hero-slides {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 56%;
  height: 100%;
  overflow: hidden;
}

.patient-hero-slide {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  opacity: 0;
  transition: opacity 0.9s ease;
}

.patient-hero-slide.is-active {
  opacity: 1;
}

@media (prefers-reduced-motion: reduce) {
  .patient-hero-slide { transition: none; }
  .patient-hero-slide:not(.is-active) { display: none; }
}

/* ── Slideshow indicator dots ───────────────────────────────── */
.patient-hero-dots {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 6px;
  z-index: 2;
}

.patient-hero-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.5);
  transition: background-color 0.3s ease, transform 0.3s ease;
}

.patient-hero-dot.is-active {
  background: #fff;
  transform: scale(1.2);
}

/* Left-edge scrim: the photo dissolves into the hero background instead of
   meeting it at a hard vertical edge. The 0% stop is fully opaque and uses the
   hero's own background colour (#d9ede1 / --p-hero-mint), so the transition
   begins in pure background and becomes transparent over the photograph. */
.patient-home-hero::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 56%;
  background: linear-gradient(
    90deg,
    rgba(217, 237, 225, 1) 0%,
    rgba(217, 237, 225, 0.86) 20%,
    rgba(217, 237, 225, 0.4) 42%,
    rgba(217, 237, 225, 0) 64%
  );
  pointer-events: none;
}

/* ── Request Care banner ────────────────────────────────────── */
.patient-home-request {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 20px;
  padding: 18px 20px;
  border-radius: 20px;
  background: linear-gradient(115deg, var(--p-primary-deep) 0%, var(--p-primary) 58%, #0f7d52 100%);
  color: #fff;
  text-decoration: none;
  box-shadow: 0 10px 26px rgba(4, 56, 37, 0.22);
  overflow: hidden;
  transition: box-shadow 0.15s ease, transform 0.12s ease;
}

.patient-home-request:hover {
  box-shadow: 0 14px 32px rgba(4, 56, 37, 0.28);
  transform: translateY(-1px);
}

.patient-home-request-icon {
  display: grid;
  flex: 0 0 46px;
  width: 46px;
  height: 46px;
  place-items: center;
  border-radius: 50%;
  background: #fff;
  color: var(--p-primary);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.16);
}

.patient-home-request-icon svg { width: 24px; height: 24px; stroke-width: 2.6; }

.patient-home-request-copy {
  display: grid;
  gap: 2px;
  min-width: 0;
  margin-right: auto;
}

.patient-home-request-copy strong {
  font-family: var(--p-font-head);
  font-size: 1.06rem;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.patient-home-request-copy small {
  color: rgba(255, 255, 255, 0.85);
  font-size: 0.78rem;
  line-height: 1.4;
}

.patient-home-request-arrow {
  display: grid;
  flex: 0 0 34px;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 50%;
  color: rgba(255, 255, 255, 0.95);
  transition: transform 0.15s ease;
}

.patient-home-request-arrow svg { width: 22px; height: 22px; stroke-width: 2.6; }
.patient-home-request:hover .patient-home-request-arrow { transform: translateX(3px); }

/* ── Full-width services section ──────────────────────────────── */
.patient-home-services-full {
  margin-top: 30px;
}

/* ── Messages + Activity two-column row ───────────────────────── */
/* Uses .patient-home-cards-row (NOT .patient-home-activity-row which is
   reused for individual activity items — see line 2705). */
.patient-home-cards-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
  margin-top: 24px;
}

.patient-home-cards-row > .patient-home-card {
  min-width: 0;
}

/* Legacy layout support (still used by some internal patterns) */
.patient-home-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 28px;
  margin-top: 30px;
}

.patient-home-main { min-width: 0; }
.patient-home-side { min-width: 0; }

/* ── Section headings (shared by columns) ───────────────────── */
.patient-home-section { margin-top: 30px; }

.patient-home-section-head,
.patient-home-card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.patient-home-section-head h2,
.patient-home-card-head h2 {
  margin: 0;
  color: var(--p-ink);
  font-family: var(--p-font-head);
  font-size: 1.04rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.patient-home-view {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex: 0 0 auto;
  color: var(--p-primary);
  font-size: 0.8rem;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}

.patient-home-view:hover { color: var(--p-primary-hover); }
.patient-home-view svg {
  width: 13px;
  height: 13px;
  stroke-width: 2.4;
  transition: transform 0.15s ease;
}
.patient-home-view:hover svg { transform: translateX(2px); }

.patient-home-view svg,
.patient-home-request svg,
.patient-home-activity-arrow svg,
.patient-home-msg-time svg {
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ── Services shortcut grid ─────────────────────────────────── */
.patient-home-service-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.patient-home-service-card {
  display: flex;
  min-width: 0;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 20px 16px;
  border: 1px solid var(--p-border);
  border-radius: 18px;
  background: var(--p-surface);
  color: var(--p-ink);
  text-align: center;
  text-decoration: none;
  box-shadow: 0 1px 2px rgba(20, 38, 28, 0.02), 0 4px 12px rgba(20, 38, 28, 0.03);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.12s ease;
}

.patient-home-service-card:hover {
  border-color: var(--p-mint-200);
  box-shadow: 0 8px 24px rgba(10, 108, 71, 0.07);
  transform: translateY(-1px);
}

.patient-home-service-icon {
  display: grid;
  width: 48px;
  height: 48px;
  flex: 0 0 48px;
  margin-bottom: 6px;
  place-items: center;
  border-radius: 50%;
  background: var(--p-mint-100);
  color: var(--p-primary);
}

.patient-home-service-icon svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.patient-home-service-card > strong {
  color: var(--p-ink-2);
  font-family: var(--p-font-head);
  font-size: 0.92rem;
  font-weight: 700;
  line-height: 1.32;
  text-align: center;
  overflow-wrap: break-word;
}

.patient-home-service-card > span:last-child {
  color: var(--p-body);
  font-size: 0.8rem;
  line-height: 1.5;
  overflow-wrap: break-word;
}

/* ── Upcoming appointment cards ─────────────────────────────── */
.patient-home-care-list,
.patient-home-activity-list,
.patient-home-msg-list {
  display: grid;
  gap: 12px;
}

.patient-home-section > #home-upcoming > .patient-state { padding: 26px 16px; }

.patient-upcoming-card {
  display: flex;
  align-items: center;
  gap: 15px;
  padding: 14px 16px;
  border: 1px solid var(--p-border);
  border-radius: 18px;
  background: var(--p-surface);
  color: var(--p-ink);
  text-decoration: none;
  box-shadow: 0 1px 2px rgba(20, 38, 28, 0.02), 0 3px 10px rgba(20, 38, 28, 0.03);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.12s ease;
}

.patient-upcoming-card:hover {
  border-color: var(--p-mint-200);
  box-shadow: 0 8px 22px rgba(10, 108, 71, 0.08);
  transform: translateY(-1px);
}

.patient-upcoming-chip {
  display: flex;
  width: 58px;
  height: 62px;
  flex: 0 0 58px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--p-mint-150);
  border-radius: 13px;
  background: var(--p-mint-50);
  line-height: 1;
}

.patient-upcoming-chip b {
  color: var(--p-body);
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.patient-upcoming-chip strong {
  margin: 5px 0 6px;
  color: var(--p-ink-2);
  font-family: var(--p-font-head);
  font-size: 1.45rem;
  font-weight: 800;
  line-height: 1;
}

.patient-upcoming-chip small {
  color: var(--p-body);
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: capitalize;
}

.patient-upcoming-chip-asap svg {
  width: 20px;
  height: 20px;
  margin-bottom: 6px;
  color: var(--p-primary);
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.patient-upcoming-chip-asap { color: var(--p-primary); }
.patient-upcoming-chip-asap b,
.patient-upcoming-chip-asap small {
  color: var(--p-primary);
  font-size: 0.6rem;
  letter-spacing: 0.05em;
}

.patient-upcoming-chip-asap strong { display: none; }

.patient-upcoming-info {
  display: grid;
  gap: 3px;
  min-width: 0;
  flex: 1;
}

.patient-upcoming-info > strong {
  color: var(--p-ink-2);
  font-family: var(--p-font-head);
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.3;
  overflow-wrap: break-word;
}

.patient-upcoming-practitioner {
  color: var(--p-primary);
  font-size: 0.82rem;
  font-weight: 600;
  overflow-wrap: break-word;
}

.patient-upcoming-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 14px;
  padding-top: 2px;
  color: var(--p-body);
  font-size: 0.8rem;
  line-height: 1.4;
}

.patient-upcoming-meta span { display: inline-flex; align-items: center; gap: 5px; min-width: 0; overflow-wrap: break-word; }

.patient-upcoming-meta svg {
  width: 13px;
  height: 13px;
  flex: 0 0 13px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
  color: var(--p-muted);
}

.patient-upcoming-card > .appointment-badge {
  flex: 0 0 auto;
  max-width: 38%;
  white-space: normal;
}

/* ── Right rail cards ───────────────────────────────────────── */
.patient-home-card {
  padding: 18px;
  border: 1px solid var(--p-border);
  border-radius: 20px;
  background: var(--p-surface);
  box-shadow: 0 1px 2px rgba(20, 38, 28, 0.02), 0 4px 16px rgba(20, 38, 28, 0.04);
}

.patient-home-card + .patient-home-card { margin-top: 16px; }

.patient-home-card-head { margin-bottom: 10px; }

.patient-home-msg-list,
.patient-home-activity-list { gap: 2px; }

.patient-home-msg-row,
.patient-home-activity-row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  padding: 10px 6px;
  border-radius: 12px;
  color: var(--p-ink);
  text-decoration: none;
  transition: background-color 0.14s ease;
}

.patient-home-msg-row:hover,
.patient-home-activity-row:hover { background: var(--p-mint-50); }

.patient-home-msg-row + .patient-home-msg-row,
.patient-home-activity-row + .patient-home-activity-row {
  border-top: 1px solid var(--p-border-soft);
}

.patient-home-msg-avatar {
  display: grid;
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  place-items: center;
  border-radius: 50%;
  background: var(--p-mint-100);
  color: var(--p-primary-dark);
  font-size: 0.9rem;
  font-weight: 800;
}

.patient-home-activity-icon {
  display: grid;
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  place-items: center;
  border-radius: 50%;
  background: var(--p-mint-50);
  color: var(--p-primary);
}

.patient-home-activity-icon svg { width: 15px; height: 15px; stroke-width: 1.9; }

.patient-home-msg-main,
.patient-home-activity-main {
  display: grid;
  gap: 2px;
  min-width: 0;
  flex: 1;
}

.patient-home-msg-main strong,
.patient-home-activity-main strong {
  color: var(--p-ink-2);
  font-size: 0.86rem;
  font-weight: 700;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.patient-home-msg-main > span,
.patient-home-activity-main > span {
  color: var(--p-body);
  font-size: 0.78rem;
  line-height: 1.4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.patient-home-msg-time {
  flex: 0 0 auto;
  align-self: flex-start;
  padding-top: 2px;
  color: var(--p-muted);
  font-size: 0.68rem;
  white-space: nowrap;
}

.patient-home-activity-arrow {
  flex: 0 0 auto;
  color: var(--p-border);
}

.patient-home-activity-arrow svg { width: 15px; height: 15px; stroke-width: 2; }
.patient-home-activity-row:hover .patient-home-activity-arrow { color: var(--p-primary); }

/* ── Empty states inside home cards ─────────────────────────── */
.patient-home-empty {
  display: flex;
  min-height: 156px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 24px 18px;
  text-align: center;
  border: 1px solid var(--p-border);
  border-radius: 18px;
  background: var(--p-surface);
  box-shadow: 0 1px 2px rgba(12, 31, 22, 0.04), 0 6px 18px rgba(12, 31, 22, 0.04);
}

.patient-home-empty-icon {
  display: grid;
  width: 42px;
  height: 42px;
  margin-bottom: 6px;
  place-items: center;
  border: 1px solid var(--p-mint-150);
  border-radius: 14px;
  background: var(--p-mint-50);
  color: var(--p-primary);
  font-size: 1.1rem;
  font-weight: 700;
}

.patient-home-empty-icon svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.patient-home-empty strong {
  color: var(--p-ink-2);
  font-family: var(--p-font-head);
  font-size: 0.94rem;
  font-weight: 700;
}

.patient-home-empty p {
  max-width: 40ch;
  margin: 0;
  color: var(--p-body);
  font-size: 0.82rem;
  line-height: 1.5;
}

/* ── Home grid breakpoints ──────────────────────────────────── */
@media (min-width: 620px) {
  .patient-home-service-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .patient-home-cards-row { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 820px) {
  .patient-home-service-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 15px; }
}

/* Two-column page only once there is real width to work with */
@media (min-width: 1024px) {
  .patient-home-top {
    grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
    align-items: center;
    gap: 26px;
  }

  .patient-home-layout {
    grid-template-columns: minmax(0, 1fr) 340px;
    gap: 34px;
  }
}

@media (min-width: 1280px) {
  .patient-home-layout { grid-template-columns: minmax(0, 1fr) 360px; }
}

@media (max-width: 1023px) {
  .patient-home-hero { min-height: 132px; }
}

@media (max-width: 600px) {
  .patient-home-hero-slides { width: 52%; }
  /* keep the scrim flush with the photo so the fade still starts in pure
     background colour at the photo's left edge on narrow screens */
  .patient-home-hero::after { width: 52%; }
  .patient-home-hero-copy { max-width: 66%; }
  .patient-home-request-copy small { font-size: 0.74rem; }
}

@media (max-width: 619px) {
  .patient-home-service-grid { grid-template-columns: 1fr; }
}

@media (max-width: 420px) {
  .patient-home-hero-copy h2 { font-size: 0.92rem; }
  .patient-upcoming-card {
    display: grid;
    grid-template-columns: 58px minmax(0, 1fr);
    align-items: start;
  }
  .patient-upcoming-chip { grid-column: 1; grid-row: 1; }
  .patient-upcoming-info { grid-column: 2; grid-row: 1; }
  .patient-upcoming-card > .appointment-badge {
    grid-column: 2;
    grid-row: 2;
    justify-self: start;
    max-width: 100%;
    margin-top: 8px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .patient-home-request,
  .patient-home-service-card,
  .patient-upcoming-card,
  .patient-home-view svg,
  .patient-home-request-arrow { transition: none; }
}

/* ══════════════════════════════════════════════════════════════════
   APPOINTMENTS (reference v2) — appointments workspace
   Derived from patient.stitch appointments: header + Request Care CTA,
   filter tabs, live-care highlight card with progression tracker,
   upcoming visit grid and past consultation row list.
   ══════════════════════════════════════════════════════════════════ */
.appt-page { padding-top: 20px; }

/* Badge variant for completed states (neutral) */
.appointment-badge-completed,
.appointment-badge-cancelled {
  background: var(--p-neutral-bg);
  color: var(--p-neutral-text);
  border-color: #e2e8f0;
}

.appt-glyph svg,
.appt-btn svg,
.appt-visit-open svg,
.appt-past-view svg,
.appt-header-cta svg,
.appt-empty-glyph svg,
.appt-live .appt-live-actions svg,
.appt-live-eta svg {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.appt-glyph {
  display: grid;
  width: 48px;
  height: 48px;
  flex: 0 0 48px;
  place-items: center;
  border-radius: 14px;
  background: var(--p-mint-50);
  color: var(--p-primary);
}

.appt-glyph svg { width: 24px; height: 24px; }

/* ── Page header ─────────────────────────────────────────────── */
.appt-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px 20px;
  margin-bottom: 20px;
}

.appt-header-copy h1 {
  margin: 0 0 4px;
  color: var(--p-ink);
  font-family: var(--p-font-head);
  font-size: clamp(1.55rem, 2.2vw + 0.9rem, 1.95rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.18;
}

.appt-header-copy p {
  margin: 0;
  color: var(--p-body);
  font-size: 0.9rem;
  line-height: 1.5;
}

.appt-header-cta { margin-top: 0; min-height: 44px; }
.appt-header-cta svg { width: 17px; height: 17px; margin-right: 2px; stroke-width: 2.4; }

/* ── Filter tabs ─────────────────────────────────────────────── */
.appt-tabs {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 20px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--p-border-soft);
  overflow-x: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(13, 148, 100, 0.35) transparent;
  -webkit-overflow-scrolling: touch;
}

.appt-tabs::-webkit-scrollbar { height: 4px; }
.appt-tabs::-webkit-scrollbar-thumb { background: rgba(13, 148, 100, 0.35); border-radius: 999px; }
.appt-tabs::-webkit-scrollbar-track { background: transparent; }

.appt-tab {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding: 0 15px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--p-body);
  font: inherit;
  font-size: 0.84rem;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.appt-tab:hover { background: var(--p-mint-50); color: var(--p-ink); }

.appt-tab.is-active {
  background: var(--p-mint-100);
  color: var(--p-primary);
  font-weight: 700;
}

.appt-tab.has-live::after {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--p-accent);
}

.appt-loading-zone > .patient-state { padding: 60px 16px; }

/* ── Section scaffolding ─────────────────────────────────────── */
.appt-page-body { display: grid; gap: 26px; }

.appt-section { display: grid; gap: 14px; }

.appt-section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px 16px;
}

.appt-section-head h2 {
  margin: 0;
  color: var(--p-ink);
  font-family: var(--p-font-head);
  font-size: 1.02rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.appt-section-note {
  color: var(--p-muted);
  font-size: 0.8rem;
  font-weight: 500;
}

/* ── Live highlight card ────────────────────────────────────── */
.appt-live {
  padding: 22px 22px 18px;
  border: 1px solid var(--p-border);
  border-radius: 22px;
  background: var(--p-surface);
  box-shadow: 0 1px 2px rgba(20, 38, 28, 0.02), 0 6px 20px rgba(20, 38, 28, 0.05);
}

.appt-live-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--p-border-soft);
}

.appt-live-statusline {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.appt-live-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 13px;
  border-radius: 999px;
  background: var(--p-enroute-bg);
  color: var(--p-primary-dark);
  font-size: 0.78rem;
  font-weight: 700;
}

.appt-live-dot {
  position: relative;
  width: 8px;
  height: 8px;
  flex: 0 0 8px;
  border-radius: 50%;
  background: var(--p-accent);
}

.appt-live-badge[data-status="IN_PROGRESS"] .appt-live-dot,
.appt-live-badge[data-status="PROVIDER_ARRIVED"] .appt-live-dot {
  box-shadow: 0 0 0 0 rgba(13, 148, 100, 0.45);
  animation: p-badge-pulse 1.8s infinite;
}

.appt-live-id {
  color: var(--p-muted);
  font-size: 0.76rem;
  font-weight: 600;
  letter-spacing: 0.03em;
}

.appt-live-eta {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--p-ink-2);
  font-size: 0.82rem;
  font-weight: 600;
}

.appt-live-eta-icon { display: grid; place-items: center; color: var(--p-primary); }
.appt-live-eta-icon svg { width: 16px; height: 16px; }

.appt-live-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 18px;
  padding: 18px 0;
}

.appt-live-main {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  min-width: 0;
}

.appt-live-service-icon {
  width: 54px;
  height: 54px;
  flex-basis: 54px;
  border-radius: 16px;
}

.appt-live-service-icon svg { width: 27px; height: 27px; }

.appt-live-copy { min-width: 0; }

.appt-live-copy h2 {
  margin: 2px 0 6px;
  color: var(--p-ink-2);
  font-family: var(--p-font-head);
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  line-height: 1.3;
  overflow-wrap: break-word;
}

.appt-live-copy p {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
  margin: 4px 0 0;
  color: var(--p-body);
  font-size: 0.86rem;
  line-height: 1.5;
}

.appt-live-copy .appt-live-practitioner { color: var(--p-primary); font-weight: 600; }

.appt-live-mini {
  width: 17px;
  height: 17px;
  flex: 0 0 17px;
  border-radius: 0;
  background: transparent;
}

.appt-live-mini svg { width: 15px; height: 15px; }

.appt-live-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
}

.appt-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 42px;
  padding: 0 17px;
  border-radius: 11px;
  font: inherit;
  font-size: 0.86rem;
  font-weight: 700;
  text-decoration: none;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.appt-btn svg { width: 16px; height: 16px; }

.appt-btn-primary {
  border: 1px solid var(--p-primary);
  background: var(--p-primary);
  color: #fff;
  box-shadow: 0 2px 8px rgba(10, 108, 71, 0.2);
}

.appt-btn-primary:hover { background: var(--p-primary-hover); border-color: var(--p-primary-hover); color: #fff; }

.appt-btn-ghost {
  border: 1px solid var(--p-border);
  background: var(--p-surface);
  color: var(--p-primary);
}

.appt-btn-ghost:hover { background: var(--p-mint-50); border-color: var(--p-mint-200); }

/* ── Progression tracker ────────────────────────────────────── */
.appt-live-track { padding-top: 16px; border-top: 1px solid var(--p-border-soft); }

.appt-progress {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

.appt-progress-step {
  display: grid;
  grid-template-rows: 8px auto;
  gap: 9px;
  min-width: 0;
}

.appt-progress-bar {
  height: 6px;
  border-radius: 999px;
  background: var(--p-mint-150);
}

.appt-progress-step.is-done .appt-progress-bar { background: var(--p-primary); }
.appt-progress-step.is-current .appt-progress-bar { background: var(--p-primary); }

.appt-progress-label {
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
  color: var(--p-muted);
  font-size: 0.68rem;
  font-weight: 600;
  line-height: 1.25;
  overflow-wrap: break-word;
}

.appt-progress-step.is-done .appt-progress-label,
.appt-progress-step.is-current .appt-progress-label { color: var(--p-primary-dark); }

.appt-progress-step.is-current .appt-progress-label { font-weight: 800; }

.appt-progress-icon {
  display: grid;
  flex: 0 0 15px;
  width: 15px;
  height: 15px;
  place-items: center;
}

.appt-progress-icon svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ── Upcoming visit cards ───────────────────────────────────── */
.appt-visit-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

.appt-visit-card {
  display: flex;
  min-width: 0;
  flex-direction: column;
  justify-content: space-between;
  gap: 16px;
  padding: 20px;
  border: 1px solid var(--p-border);
  border-radius: 20px;
  background: var(--p-surface);
  color: var(--p-ink);
  text-decoration: none;
  box-shadow: 0 1px 2px rgba(20, 38, 28, 0.02), 0 4px 14px rgba(20, 38, 28, 0.04);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.12s ease;
}

.appt-visit-card:hover {
  border-color: var(--p-mint-200);
  box-shadow: 0 10px 26px rgba(10, 108, 71, 0.08);
  transform: translateY(-1px);
}

.appt-visit-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.appt-visit-title {
  display: flex;
  align-items: flex-start;
  gap: 13px;
  min-width: 0;
}

.appt-visit-heading { min-width: 0; }

.appt-visit-heading h3 {
  margin: 1px 0 3px;
  color: var(--p-ink-2);
  font-family: var(--p-font-head);
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.3;
  overflow-wrap: break-word;
}

.appt-visit-heading > span {
  color: var(--p-body);
  font-size: 0.8rem;
  line-height: 1.45;
  overflow-wrap: break-word;
}

.appt-visit-top .appointment-badge {
  flex: 0 0 auto;
  max-width: 44%;
  white-space: normal;
}

.appt-visit-facts {
  display: grid;
  gap: 8px;
  padding: 12px 14px;
  border: 1px solid var(--p-border-soft);
  border-radius: 14px;
  background: var(--p-mint-50);
}

.appt-visit-facts p {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  margin: 0;
  color: var(--p-body);
  font-size: 0.84rem;
  line-height: 1.45;
}

.appt-visit-facts .appt-glyph {
  width: 19px;
  height: 19px;
  flex: 0 0 19px;
  border-radius: 0;
  background: transparent;
  color: var(--p-primary);
}

.appt-visit-facts .appt-glyph svg { width: 16px; height: 16px; }

.appt-visit-facts p span { min-width: 0; overflow-wrap: break-word; }
.appt-visit-facts strong { color: var(--p-ink-2); font-weight: 700; }

.appt-visit-foot {
  display: flex;
  justify-content: flex-end;
  padding-top: 14px;
  border-top: 1px solid var(--p-border-soft);
}

.appt-visit-open {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--p-primary);
  font-size: 0.84rem;
  font-weight: 700;
}

.appt-visit-open svg { width: 15px; height: 15px; stroke-width: 2.2; }
.appt-visit-card:hover .appt-visit-open { text-decoration: underline; }

/* ── Past list ──────────────────────────────────────────────── */
.appt-past-list {
  border: 1px solid var(--p-border);
  border-radius: 18px;
  background: var(--p-surface);
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(20, 38, 28, 0.02), 0 4px 14px rgba(20, 38, 28, 0.04);
}

.appt-past-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 16px;
  padding: 16px 18px;
  border: 1px solid var(--p-border);
  border-radius: 16px;
  background: var(--p-surface);
  color: var(--p-ink);
  text-decoration: none;
  box-shadow: 0 1px 2px rgba(20, 38, 28, 0.02), 0 3px 10px rgba(20, 38, 28, 0.03);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.12s ease;
}

.appt-past-row + .appt-past-row { margin-top: 10px; }
.appt-past-row:hover { border-color: var(--p-mint-200); box-shadow: 0 8px 22px rgba(10, 108, 71, 0.08); transform: translateY(-1px); }

.appt-past-main {
  display: flex;
  align-items: center;
  gap: 13px;
  min-width: 0;
}

.appt-past-icon {
  width: 40px;
  height: 40px;
  flex-basis: 40px;
  border-radius: 12px;
  background: var(--p-mint-50);
}

.appt-past-icon svg { width: 20px; height: 20px; }

.appt-past-copy {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.appt-past-copy strong {
  color: var(--p-ink-2);
  font-family: var(--p-font-head);
  font-size: 0.94rem;
  font-weight: 700;
  overflow-wrap: break-word;
}

.appt-past-copy span {
  color: var(--p-body);
  font-size: 0.8rem;
  line-height: 1.45;
  overflow-wrap: break-word;
}

.appt-past-end {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.appt-past-end .appointment-badge { white-space: normal; max-width: 46%; }

.appt-past-view {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex: 0 0 auto;
  color: var(--p-primary);
  font-size: 0.84rem;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}

.appt-past-view svg { width: 14px; height: 14px; stroke-width: 2.2; }
.appt-past-view:hover { text-decoration: underline; }

/* ── Empty panel (visual application surface, not naked text) ── */
.appt-empty-panel {
  display: flex;
  min-height: 240px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 34px 22px;
  border: 1px solid var(--p-border);
  border-radius: 20px;
  background: var(--p-surface);
  text-align: center;
  box-shadow: 0 1px 2px rgba(20, 38, 28, 0.02), 0 4px 14px rgba(20, 38, 28, 0.04);
}

.appt-empty-glyph {
  display: grid;
  width: 54px;
  height: 54px;
  margin-bottom: 10px;
  place-items: center;
  border-radius: 17px;
  background: var(--p-mint-50);
  color: var(--p-primary);
}

.appt-empty-glyph svg { width: 26px; height: 26px; }

.appt-empty-panel h3 {
  margin: 0;
  color: var(--p-ink-2);
  font-family: var(--p-font-head);
  font-size: 1.05rem;
  font-weight: 700;
}

.appt-empty-panel p {
  max-width: 46ch;
  margin: 0 0 8px;
  color: var(--p-body);
  font-size: 0.88rem;
  line-height: 1.55;
}

.appt-empty-panel .patient-primary-action { margin-top: 10px; }

/* ── Zero-appointments state (reference empty frame) ─────────── */
.appt-zero-card {
  width: 100%;
  max-width: 672px;
  margin: 6px auto 0;
  padding: 38px 26px 28px;
  border: 1px solid var(--p-border);
  border-radius: 20px;
  background: var(--p-surface);
  box-shadow: 0 1px 2px rgba(20, 38, 28, 0.02), 0 6px 18px rgba(20, 38, 28, 0.05);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

@media (min-width: 620px) {
  .appt-zero-card { padding: 48px; }
}

.appt-zero-emblem {
  display: grid;
  width: 64px;
  height: 64px;
  place-items: center;
  margin-bottom: 18px;
  border-radius: 50%;
  background: var(--p-mint-100);
  color: var(--p-primary);
  border: 1px solid var(--p-mint-150);
  box-shadow: 0 1px 2px rgba(20, 38, 28, 0.04);
}

.appt-zero-emblem svg {
  width: 30px;
  height: 30px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.appt-zero-card h2 {
  margin: 0 0 8px;
  color: var(--p-ink-2);
  font-family: var(--p-font-head);
  font-size: 1.2rem;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.appt-zero-card > p:not(.appt-zero-popular) {
  max-width: 470px;
  margin: 0 0 20px;
  color: var(--p-body);
  font-size: 0.9rem;
  line-height: 1.6;
}

.appt-zero-divider {
  width: 100%;
  margin: 22px 0 18px;
  border-top: 1px solid var(--p-border-soft);
}

.appt-zero-popular {
  margin: 0 0 10px;
  color: var(--p-ink-2);
  font-size: 0.82rem;
  font-weight: 600;
}

.appt-zero-chips {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

.appt-chip {
  display: inline-flex;
  align-items: center;
  padding: 7px 14px;
  border: 1px solid var(--p-border);
  border-radius: 999px;
  background: var(--p-mint-50);
  color: var(--p-primary);
  font-size: 0.8rem;
  font-weight: 600;
  text-decoration: none;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.appt-chip:hover { background: var(--p-mint-100); border-color: var(--p-mint-200); }

.appt-how-card {
  max-width: 900px;
  margin: 18px auto 0;
  padding: 16px 18px;
  border: 1px solid var(--p-border);
  border-radius: 14px;
  background: var(--p-surface);
  box-shadow: 0 1px 2px rgba(20, 38, 28, 0.02);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px 20px;
}

.appt-how-copy {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 260px;
}

.appt-how-icon {
  display: grid;
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  place-items: center;
  border-radius: 10px;
  background: var(--p-mint-100);
  color: var(--p-primary);
}

.appt-how-icon svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.appt-how-copy h3 { margin: 0 0 2px; color: var(--p-ink-2); font-size: 0.92rem; font-weight: 800; }
.appt-how-copy p { margin: 0; color: var(--p-body); font-size: 0.8rem; }

.appt-how-steps {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.appt-how-step {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 12px;
  border: 1px solid var(--p-border);
  border-radius: 9px;
  background: var(--p-mint-50);
  color: var(--p-ink-2);
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
}

.appt-how-step b {
  display: grid;
  width: 19px;
  height: 19px;
  place-items: center;
  border-radius: 50%;
  background: var(--p-primary);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 800;
}

@media (max-width: 560px) {
  .appt-zero-card { padding: 28px 18px 22px; }
  .appt-how-card { align-items: flex-start; flex-direction: column; }
}

/* ── Responsive ──────────────────────────────────────────────── */
@media (min-width: 560px) {
  .appt-visit-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (min-width: 720px) {
  .appt-live-body {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
  }
  .appt-live-actions { justify-content: flex-end; }
  .appt-past-row { padding: 18px 22px; }
}

@media (max-width: 520px) {
  .appt-visit-top { flex-direction: column; }
  .appt-visit-top .appointment-badge,
  .appt-past-end .appointment-badge { max-width: 100%; }
  .appt-past-end { justify-content: space-between; width: 100%; }
  .appt-live { padding: 18px 16px 14px; }
  .appt-live-badge { padding: 4px 11px; font-size: 0.74rem; }
  .appt-live-eta { font-size: 0.78rem; }
  .appt-progress-label { font-size: 0.62rem; }
  .appt-btn { min-height: 40px; padding: 0 13px; }
  .appt-btn-ghost { flex: 1 1 100%; }
  .appt-visit-card { padding: 17px; }
}

@media (prefers-reduced-motion: reduce) {
  .appt-live-badge .appt-live-dot,
  .appt-live-badge[data-status="IN_PROGRESS"] .appt-live-dot,
  .appt-live-badge[data-status="PROVIDER_ARRIVED"] .appt-live-dot { animation: none; }
  .appt-visit-card,
  .appt-past-row { transition: none; }
}

/* ══════════════════════════════════════════════════════════════════
   APPOINTMENT DETAIL (reference v2) — two-column detail workspace
   Derived from patient.stitch appointment-detail: header + status badge
   + reference chip, timeline card, care & practitioner card, location &
   information card, actions; right rail overview + what-to-expect.
   ══════════════════════════════════════════════════════════════════ */
.patd-page { padding-top: 18px; }

.patd-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 18px;
  margin-bottom: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--p-border-soft);
}

.patd-heading {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.patd-heading h1 {
  margin: 0;
  color: var(--p-ink);
  font-family: var(--p-font-head);
  font-size: clamp(1.45rem, 2.2vw + 0.8rem, 1.85rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.patd-heading .appointment-badge { white-space: normal; max-width: 52%; }

/* pulse dot for live states inside header badge */
.appointment-badge-live { position: relative; }
.appointment-badge-pulse {
  display: inline-block;
  width: 7px;
  height: 7px;
  flex: 0 0 7px;
  border-radius: 50%;
  background: var(--p-accent);
  box-shadow: 0 0 0 0 rgba(13, 148, 100, 0.45);
  animation: p-badge-pulse 1.8s infinite;
}

.patd-ref {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--p-body);
  font-size: 0.8rem;
  font-weight: 500;
}

.patd-ref code {
  padding: 3px 9px;
  border-radius: 7px;
  background: var(--p-mint-100);
  color: var(--p-primary);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.78rem;
  font-weight: 700;
}

/* ── Layout columns ─────────────────────────────────────────── */
.patd-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 18px;
  align-items: start;
  margin-top: 18px;
}

.patd-main,
.patd-side {
  display: grid;
  gap: 18px;
  min-width: 0;
}

.patd-card {
  padding: 20px 20px;
  border: 1px solid var(--p-border);
  border-radius: 20px;
  background: var(--p-surface);
  box-shadow: 0 1px 2px rgba(20, 38, 28, 0.02), 0 4px 14px rgba(20, 38, 28, 0.04);
}

.patd-card-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  padding-bottom: 16px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--p-border-soft);
}

.patd-service-icon {
  display: grid;
  width: 48px;
  height: 48px;
  flex: 0 0 48px;
  place-items: center;
  border-radius: 14px;
  background: var(--p-mint-100);
  color: var(--p-primary);
}

.patd-service-icon svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.patd-card-title {
  display: grid;
  gap: 2px;
  min-width: 0;
  margin-right: auto;
}

.patd-card-title > span {
  color: var(--p-primary);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.patd-card-title h2 {
  margin: 0;
  color: var(--p-ink-2);
  font-family: var(--p-font-head);
  font-size: 1.1rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  line-height: 1.3;
  overflow-wrap: break-word;
}

.patd-card-head > .appointment-badge {
  flex: 0 0 auto;
  max-width: 46%;
  white-space: normal;
}

.patd-card-title-nolabel {
  margin: 0;
  color: var(--p-ink-2);
  font-family: var(--p-font-head);
  font-size: 1.05rem;
  font-weight: 700;
}

/* ── Timeline (horizontal 5-step) ───────────────────────────── */
.patd-timeline-head { padding-bottom: 12px; }
.patd-timeline-now {
  margin-left: auto;
  color: var(--p-muted);
  font-size: 0.74rem;
  font-weight: 600;
}

.patd-timeline {
  position: relative;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
  padding: 4px 0 2px;
}

.patd-timeline::before {
  content: "";
  position: absolute;
  top: 19px;
  right: 9%;
  left: 9%;
  height: 3px;
  border-radius: 999px;
  background: var(--p-mint-150);
}

.patd-tl-step {
  position: relative;
  z-index: 1;
  display: flex;
  min-width: 0;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-align: center;
}

.patd-tl-dot {
  display: grid;
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  place-items: center;
  border: 1px solid var(--p-border);
  border-radius: 50%;
  background: var(--p-surface);
  color: var(--p-muted);
  box-shadow: 0 0 0 4px var(--p-surface);
}

.patd-tl-dot b { font-size: 0.85rem; font-weight: 800; }

.patd-tl-dot svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.patd-tl-step.is-done .patd-tl-dot {
  border-color: var(--p-primary);
  background: var(--p-primary);
  color: #fff;
}

.patd-tl-step.is-current .patd-tl-dot {
  border-color: var(--p-primary);
  box-shadow: 0 0 0 5px var(--p-mint-100);
}

.patd-tl-step.is-current:not(.is-done) .patd-tl-dot {
  background: var(--p-primary);
  color: #fff;
}

.patd-tl-label {
  color: var(--p-muted);
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1.25;
  overflow-wrap: break-word;
}

.patd-tl-step.is-done .patd-tl-label,
.patd-tl-step.is-current .patd-tl-label { color: var(--p-primary-dark); font-weight: 700; }

.patd-tl-step.is-current .patd-tl-label { font-weight: 800; }

.patd-tl-time {
  color: var(--p-muted);
  font-size: 0.64rem;
}

/* ── Practitioner row ────────────────────────────────────────── */
.patd-practitioner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
}

.patd-prac-avatar {
  display: grid;
  width: 58px;
  height: 58px;
  flex: 0 0 58px;
  place-items: center;
  border: 2px solid var(--p-mint-150);
  border-radius: 16px;
  background: var(--p-mint-100);
  color: var(--p-primary-dark);
  font-family: var(--p-font-head);
  font-size: 1.4rem;
  font-weight: 800;
}

.patd-prac-copy {
  min-width: 0;
  flex: 1;
}

.patd-prac-copy h3 {
  margin: 0 0 2px;
  color: var(--p-ink-2);
  font-family: var(--p-font-head);
  font-size: 1.05rem;
  font-weight: 800;
  overflow-wrap: break-word;
}

.patd-prac-copy p {
  margin: 0;
  color: var(--p-body);
  font-size: 0.86rem;
  line-height: 1.45;
  overflow-wrap: break-word;
}

.patd-prac-meta {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 6px !important;
  color: var(--p-body);
  font-size: 0.78rem;
}

.patd-verified {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--p-tint);
  color: var(--p-primary);
  font-size: 0.72rem;
  font-weight: 700;
}

.patd-pending {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--p-amber-bg, #fef3c7);
  color: var(--p-amber-text, #92400e);
  font-size: 0.72rem;
  font-weight: 700;
}

.patd-msg-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 42px;
  padding: 0 16px;
  border: 1px solid var(--p-primary);
  border-radius: 11px;
  background: var(--p-surface);
  color: var(--p-primary);
  font: inherit;
  font-size: 0.86rem;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.patd-msg-btn:hover { background: var(--p-mint-50); border-color: var(--p-primary-hover); }

.patd-msg-btn svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.patd-unassigned {
  padding: 14px 16px;
  border: 1px solid var(--p-border-soft);
  border-radius: 14px;
  background: var(--p-mint-50);
}

.patd-unassigned h3 {
  margin: 0 0 4px;
  color: var(--p-ink-2);
  font-size: 0.95rem;
  font-weight: 700;
}

.patd-unassigned p {
  margin: 0;
  color: var(--p-body);
  font-size: 0.85rem;
  line-height: 1.5;
}

/* ── Details list / overview ────────────────────────────────── */
.patd-subhead {
  margin: 0 0 14px;
  color: var(--p-ink-2);
  font-family: var(--p-font-head);
  font-size: 1rem;
  font-weight: 700;
}

.patd-dl {
  display: grid;
  grid-template-columns: minmax(0, 130px) minmax(0, 1fr);
  gap: 12px 18px;
  margin: 0;
}

.patd-dl dt {
  color: var(--p-muted);
  font-size: 0.8rem;
  font-weight: 600;
}

.patd-dl dd {
  margin: 0;
  color: var(--p-ink-2);
  font-size: 0.9rem;
  min-width: 0;
  overflow-wrap: break-word;
}

.patd-dl dd .appointment-badge { margin-bottom: 2px; }

.patd-side-head {
  margin: 0 0 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--p-border-soft);
  color: var(--p-ink-2);
  font-family: var(--p-font-head);
  font-size: 0.98rem;
  font-weight: 700;
}

.patd-overview {
  display: grid;
  gap: 12px;
  margin: 0;
}

.patd-overview > div {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 6px 14px;
}

.patd-overview dt { color: var(--p-body); font-size: 0.82rem; }
.patd-overview dd { margin: 0; color: var(--p-ink-2); font-size: 0.86rem; font-weight: 600; text-align: right; overflow-wrap: break-word; }
.patd-overview dd code {
  color: var(--p-primary);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.8rem;
  font-weight: 700;
}
.patd-overview dd .appointment-badge { font-size: 0.72rem; }

/* What to expect */
.patd-expect > p:first-of-type {
  margin: 0 0 14px;
  color: var(--p-body);
  font-size: 0.84rem;
  line-height: 1.55;
}

.patd-expect-list {
  display: grid;
  gap: 13px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.patd-expect-list li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.patd-expect-list li > span {
  display: grid;
  width: 22px;
  height: 22px;
  flex: 0 0 22px;
  place-items: center;
  border-radius: 50%;
  background: var(--p-mint-100);
  color: var(--p-primary);
  font-size: 0.72rem;
  font-weight: 800;
  margin-top: 1px;
}

.patd-expect-list strong {
  display: block;
  color: var(--p-ink-2);
  font-size: 0.86rem;
  font-weight: 700;
}

.patd-expect-list p {
  margin: 2px 0 0;
  color: var(--p-body);
  font-size: 0.78rem;
  line-height: 1.45;
}

.patd-main .appointment-detail-actions { margin-top: 0; }

/* ── Responsive ──────────────────────────────────────────────── */
@media (min-width: 640px) {
  .patd-grid { grid-template-columns: minmax(0, 1fr) 340px; }
}

@media (min-width: 1100px) {
  .patd-grid { grid-template-columns: minmax(0, 1fr) 360px; gap: 20px; }
  .patd-card { padding: 22px 22px; }
}

@media (max-width: 560px) {
  .patd-card-head { gap: 12px; }
  .patd-card-head > .appointment-badge { max-width: 100%; }
  .patd-dl { grid-template-columns: 1fr; gap: 4px 0 14px; }
  .patd-dl > dd { padding-bottom: 10px; }
  .patd-msg-btn { width: 100%; }
  .patd-timeline-now { display: none; }
  .patd-tl-time { display: none; }
  .patd-tl-dot { width: 34px; height: 34px; flex-basis: 34px; }
  .patd-timeline::before { top: 17px; }
  .patd-overview > div { flex-direction: column; align-items: flex-start; gap: 3px; }
  .patd-overview dd { text-align: left; }
}

@media (prefers-reduced-motion: reduce) {
  .appointment-badge-pulse { animation: none; }
}

/* ══════════════════════════════════════════════════════════════════
   RECORDS (reference v2) — patient clinical records workspace
   Derived from patient.stitch records: header, filter pills, record
   cards with service/status/practitioner/summary, inline detail view.
   ══════════════════════════════════════════════════════════════════ */
.prec-page { padding-top: 20px; }

.prec-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px 20px;
  margin-bottom: 18px;
}

.prec-header-copy h1 {
  margin: 0 0 4px;
  color: var(--p-ink);
  font-family: var(--p-font-head);
  font-size: clamp(1.5rem, 2.2vw + 0.9rem, 1.9rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.18;
}

.prec-header-copy p {
  margin: 0;
  color: var(--p-body);
  font-size: 0.88rem;
  line-height: 1.5;
}

/* ── Filter pills ───────────────────────────────────────────── */
.prec-tabs {
  display: flex;
  flex-wrap: nowrap;
  gap: 8px;
  margin-bottom: 18px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--p-border-soft);
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.prec-tabs::-webkit-scrollbar { display: none; }

.prec-tab {
  min-height: 34px;
  padding: 0 15px;
  border: 1px solid var(--p-border);
  border-radius: 999px;
  background: var(--p-surface);
  color: var(--p-body);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.prec-tab:hover { border-color: var(--p-mint-200); color: var(--p-primary); }

.prec-tab.is-active {
  border-color: var(--p-primary);
  background: var(--p-primary);
  color: #fff;
  box-shadow: 0 2px 8px rgba(10, 108, 71, 0.22);
}

/* ── Card list ──────────────────────────────────────────────── */
.prec-card-list {
  display: grid;
  gap: 16px;
}

.prec-card {
  padding: 20px 20px 16px;
  border: 1px solid var(--p-border);
  border-radius: 20px;
  background: var(--p-surface);
  box-shadow: 0 1px 2px rgba(20, 38, 28, 0.02), 0 4px 14px rgba(20, 38, 28, 0.04);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  cursor: pointer;
}

.prec-card:hover { border-color: var(--p-mint-200); box-shadow: 0 8px 22px rgba(10, 108, 71, 0.07); }
.prec-card:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--p-primary) 32%, transparent);
  outline-offset: 3px;
  border-color: var(--p-primary);
}

.prec-card-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px 20px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--p-border-soft);
}

.prec-card-title {
  display: flex;
  align-items: center;
  gap: 13px;
  min-width: 0;
}

.prec-service-icon {
  display: grid;
  width: 46px;
  height: 46px;
  flex: 0 0 46px;
  place-items: center;
  border-radius: 50%;
  background: var(--p-mint-100);
  color: var(--p-primary);
}

.prec-service-icon svg {
  width: 23px;
  height: 23px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.prec-title-copy { min-width: 0; }

.prec-title-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
}

.prec-title-line h2 {
  margin: 0;
  color: var(--p-ink-2);
  font-family: var(--p-font-head);
  font-size: 1.02rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  line-height: 1.3;
  overflow-wrap: break-word;
}

.prec-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 11px;
  border-radius: 999px;
  background: var(--p-neutral-bg);
  border: 1px solid #e2e8f0;
  color: var(--p-neutral-text);
  font-size: 0.72rem;
  font-weight: 700;
  white-space: nowrap;
}

.prec-status-amended {
  background: var(--p-tint);
  border-color: var(--p-mint-150);
  color: var(--p-primary);
}

.prec-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 8px;
  margin: 4px 0 0;
  color: var(--p-body);
  font-size: 0.8rem;
  line-height: 1.45;
  overflow-wrap: break-word;
}

.prec-recipient {
  display: inline-flex;
  align-items: center;
  padding: 1px 9px;
  border-radius: 7px;
  background: var(--p-neutral-bg);
  border: 1px solid var(--p-border-soft);
  color: var(--p-ink-2);
  font-size: 0.72rem;
  font-weight: 600;
  white-space: nowrap;
}

.prec-practitioner {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 8px 12px;
  border: 1px solid var(--p-border-soft);
  border-radius: 13px;
  background: var(--p-mint-50);
}

.prec-prac-avatar {
  display: grid;
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  place-items: center;
  border-radius: 50%;
  background: var(--p-mint-100);
  color: var(--p-primary-dark);
  font-size: 0.8rem;
  font-weight: 800;
}

.prec-prac-copy {
  display: grid;
  gap: 1px;
  min-width: 0;
}

.prec-prac-copy strong {
  color: var(--p-ink-2);
  font-size: 0.86rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.prec-prac-copy span {
  color: var(--p-body);
  font-size: 0.74rem;
}

/* card body summary */
.prec-card-body {
  padding: 14px 0 4px;
}

.prec-body-label {
  display: block;
  margin-bottom: 4px;
  color: var(--p-primary);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.prec-card-body p {
  margin: 0;
  color: var(--p-ink-2);
  font-size: 0.9rem;
  line-height: 1.6;
  overflow-wrap: break-word;
}

.prec-card-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 16px;
  margin-top: 12px;
  padding-top: 14px;
  border-top: 1px solid var(--p-border-soft);
}

.prec-signed {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--p-muted);
  font-size: 0.72rem;
  font-weight: 500;
}

.prec-pill-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--p-mint-100);
  color: var(--p-primary);
  font-size: 0.68rem;
  font-weight: 800;
  line-height: 1;
}

.prec-empty-card {
  width: 100%;
  max-width: 672px;
  margin: 26px auto 0;
  padding: 32px;
  border: 1px solid var(--p-border);
  border-radius: 20px;
  background: var(--p-surface);
  box-shadow: 0 1px 2px rgba(20, 38, 28, 0.02), 0 6px 18px rgba(20, 38, 28, 0.05);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.prec-empty-emblem {
  display: grid;
  width: 64px;
  height: 64px;
  place-items: center;
  margin-bottom: 18px;
  border-radius: 50%;
  background: var(--p-mint-100);
  color: var(--p-primary);
  box-shadow: 0 0 0 8px var(--p-mint-50);
}

.prec-empty-emblem svg {
  width: 30px;
  height: 30px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.prec-empty-card h2 {
  margin: 0 0 8px;
  color: var(--p-ink-2);
  font-family: var(--p-font-head);
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.prec-empty-card > p {
  max-width: 480px;
  margin: 0 0 20px;
  color: var(--p-body);
  font-size: 0.88rem;
  line-height: 1.6;
}

.prec-empty-card .patient-primary-action { margin-bottom: 4px; }

.prec-empty-note {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  width: 100%;
  margin-top: 24px;
  padding: 14px 16px;
  border-top: 1px solid var(--p-border-soft);
  text-align: left;
  background: var(--p-mint-50);
  border-radius: 13px;
}

.prec-empty-note > span {
  display: grid;
  width: 22px;
  height: 22px;
  flex: 0 0 22px;
  place-items: center;
  margin-top: 1px;
  color: var(--p-primary);
}

.prec-empty-note > span svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.prec-empty-note p {
  margin: 0;
  color: var(--p-body);
  font-size: 0.8rem;
  line-height: 1.5;
  text-align: left;
}

.prec-empty-note strong {
  color: var(--p-ink-2);
}

.prec-empty-help {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  max-width: 896px;
  margin: 18px auto 0;
}

.prec-empty-help article {
  padding: 18px;
  border: 1px solid var(--p-border);
  border-radius: 14px;
  background: var(--p-surface);
  box-shadow: 0 1px 2px rgba(20, 38, 28, 0.02), 0 4px 12px rgba(20, 38, 28, 0.04);
}

.prec-help-icon {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  margin-bottom: 10px;
  border-radius: 9px;
  background: var(--p-mint-100);
  color: var(--p-primary);
}

.prec-help-icon svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.prec-empty-help h3 {
  margin: 0 0 4px;
  color: var(--p-ink-2);
  font-size: 0.9rem;
  font-weight: 700;
}

.prec-empty-help p {
  margin: 0;
  color: var(--p-body);
  font-size: 0.8rem;
  line-height: 1.55;
}

.prec-view-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 40px;
  padding: 0 16px;
  border: 1px solid var(--p-primary);
  border-radius: 11px;
  background: var(--p-surface);
  color: var(--p-primary);
  font: inherit;
  font-size: 0.84rem;
  font-weight: 700;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.prec-view-btn:hover { background: var(--p-mint-50); border-color: var(--p-primary-hover); }
.prec-view-btn:disabled { opacity: 0.65; cursor: wait; }

.prec-view-btn svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ── Empty state ────────────────────────────────────────────── */
.prec-page-inner { padding-top: 8px; }

.prec-empty {
  display: flex;
  min-height: 300px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 40px 24px;
  border: 1px solid var(--p-border);
  border-radius: 20px;
  background: var(--p-surface);
  text-align: center;
  box-shadow: 0 1px 2px rgba(20, 38, 28, 0.02), 0 4px 14px rgba(20, 38, 28, 0.04);
}

.prec-empty-icon {
  display: grid;
  width: 54px;
  height: 54px;
  margin-bottom: 10px;
  place-items: center;
  border-radius: 17px;
  background: var(--p-mint-50);
  color: var(--p-primary);
}

.prec-empty-icon svg {
  width: 26px;
  height: 26px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.prec-empty h2 {
  margin: 0;
  color: var(--p-ink-2);
  font-family: var(--p-font-head);
  font-size: 1.05rem;
  font-weight: 700;
}

.prec-empty p {
  max-width: 46ch;
  margin: 0;
  color: var(--p-body);
  font-size: 0.88rem;
  line-height: 1.55;
}

/* ── Detail view ────────────────────────────────────────────── */
.prec-detail {
  width: min(100% - 32px, 1000px);
  margin: 0 auto;
  padding: 26px 0 44px;
}

.prec-detail-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  margin-bottom: 18px;
}

.prec-detail-head .prec-service-icon { width: 52px; height: 52px; flex-basis: 52px; }

.prec-detail-title { min-width: 0; flex: 1; }

.prec-detail-title h1 {
  margin: 0 0 3px;
  color: var(--p-ink);
  font-family: var(--p-font-head);
  font-size: clamp(1.35rem, 2vw + 0.8rem, 1.7rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.2;
  overflow-wrap: break-word;
}

.prec-detail-title p {
  margin: 0;
  color: var(--p-body);
  font-size: 0.86rem;
  line-height: 1.5;
  overflow-wrap: break-word;
}

.prec-detail-section {
  margin-bottom: 14px;
  padding: 18px 20px;
  border: 1px solid var(--p-border);
  border-radius: 18px;
  background: var(--p-surface);
  box-shadow: 0 1px 2px rgba(20, 38, 28, 0.02), 0 3px 10px rgba(20, 38, 28, 0.03);
}

.prec-detail-section h2 {
  margin: 0 0 8px;
  color: var(--p-ink-2);
  font-family: var(--p-font-head);
  font-size: 0.96rem;
  font-weight: 700;
}

.prec-detail-section p {
  margin: 0;
  color: var(--p-ink-2);
  line-height: 1.65;
  font-size: 0.92rem;
  overflow-wrap: break-word;
}

.prec-vitals {
  display: grid;
  gap: 8px;
  margin: 0;
}

.prec-vital-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  padding: 7px 0;
  border-bottom: 1px solid var(--p-border);
}

.prec-vital-row:last-child { border-bottom: 0; padding-bottom: 0; }

.prec-vital-row dt {
  color: var(--p-muted);
  font-size: 0.86rem;
  line-height: 1.4;
}

.prec-vital-row dd {
  margin: 0;
  color: var(--p-ink-2);
  font-size: 0.92rem;
  font-weight: 600;
  white-space: nowrap;
}

.prec-vital-unit {
  color: var(--p-muted);
  font-weight: 500;
  font-size: 0.84rem;
}

.prec-amended {
  border-color: #fde68a;
  background: #fffbeb;
}

.prec-amended-notice { color: #92400e !important; font-weight: 600; }

.prec-amend-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.prec-amend-item {
  display: grid;
  gap: 2px;
  padding: 12px 14px;
  border: 1px solid #fde68a;
  border-radius: 12px;
  background: #fff;
}

.prec-amend-item strong { color: var(--p-ink-2); font-size: 0.88rem; text-transform: capitalize; }
.prec-amend-item span { color: var(--p-body); font-size: 0.86rem; }
.prec-amend-item small { color: var(--p-muted); font-size: 0.76rem; }

@media (max-width: 700px) {
  .prec-empty-help { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  .prec-card { padding: 17px 16px 14px; }
  .prec-card-top { align-items: flex-start; flex-direction: column; }
  .prec-practitioner { width: 100%; }
  .prec-card-foot { flex-direction: column; align-items: stretch; }
  .prec-view-btn { width: 100%; }
  .prec-detail { width: min(100% - 24px, 1000px); }
  .prec-empty-card { padding: 26px 18px 20px; }
  .prec-empty-note { padding: 12px 12px; }
}

@media (prefers-reduced-motion: reduce) {
  .prec-card { transition: none; }
}

/* ══════════════════════════════════════════════════════════════
   PROFILE — reference v2 workspace
   Hero identity card → section nav → stacked section cards
   ══════════════════════════════════════════════════════════════ */
.ppro-page { width: min(100% - 32px, 1000px); margin: 0 auto; padding: 24px 0 44px; }

.ppro-heading { margin-bottom: 18px; }
.ppro-heading h1 {
  margin: 0;
  color: var(--p-ink-2);
  font-family: var(--p-font-head);
  font-size: clamp(1.55rem, 2.1vw + 0.9rem, 1.95rem);
  font-weight: 800;
  letter-spacing: -0.02em;
}
.ppro-heading p { margin: 5px 0 0; color: var(--p-body); font-size: 0.92rem; }

/* ── Hero ─────────────────────────────────────────────────────── */
.ppro-hero {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 18px 22px;
  padding: 24px 26px;
  border: 1px solid var(--p-border);
  border-radius: 20px;
  background: var(--p-surface);
  box-shadow: 0 1px 2px rgba(20, 38, 28, 0.02), 0 6px 18px rgba(20, 38, 28, 0.05);
  overflow: hidden;
}

.ppro-hero::before {
  content: "";
  position: absolute;
  top: -90px;
  right: -70px;
  width: 300px;
  height: 300px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--p-mint-50) 0%, transparent 70%);
  pointer-events: none;
}

.ppro-hero-avatar {
  display: grid;
  width: 78px;
  height: 78px;
  flex: 0 0 78px;
  place-items: center;
  border: 2px solid var(--p-mint-150);
  border-radius: 22px;
  background: linear-gradient(145deg, var(--p-mint-100), var(--p-mint-50));
  color: var(--p-primary-dark);
  font-family: var(--p-font-head);
  font-size: 2rem;
  font-weight: 800;
  box-shadow: 0 3px 10px rgba(20, 38, 28, 0.08);
}

.ppro-hero-copy { min-width: 220px; flex: 1 1 320px; }

.ppro-hero-name {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.ppro-hero-name h2 { margin: 0; color: var(--p-ink-2); font-family: var(--p-font-head); font-size: 1.4rem; font-weight: 800; letter-spacing: -0.01em; }

.ppro-verified {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 3px 11px;
  border: 1px solid var(--p-mint-150);
  border-radius: 999px;
  background: var(--p-mint-100);
  color: var(--p-primary);
  font-size: 0.72rem;
  font-weight: 700;
}

.ppro-verified span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #0d9464;
}

.ppro-hero-lines {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  margin-top: 10px;
}

.ppro-hero-lines > span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--p-body);
  font-size: 0.84rem;
  overflow-wrap: break-word;
}

.ppro-hero-lines .ppro-glyph { color: var(--p-muted); }

.ppro-hero-edit {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 40px;
  padding: 0 15px;
  border: 1px solid var(--p-border);
  border-radius: 11px;
  background: #fff;
  color: var(--p-primary);
  font-size: 0.84rem;
  font-weight: 700;
  text-decoration: none;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.ppro-hero-edit:hover { border-color: var(--p-primary); background: var(--p-mint-50); }
.ppro-hero-edit svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.ppro-glyph { display: inline-grid; place-items: center; }
.ppro-glyph svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }

.ppro-practitioner-entry {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  margin: 14px 0 4px;
  padding: 15px 16px;
  border: 1px solid var(--p-mint-150);
  border-radius: 16px;
  background: linear-gradient(105deg, var(--p-mint-50), var(--p-mint-100));
  box-shadow: 0 3px 12px rgba(10, 108, 71, 0.05);
}

.ppro-practitioner-entry-icon {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 12px;
  background: var(--p-surface);
  color: var(--p-primary);
}

.ppro-practitioner-entry-icon svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.ppro-practitioner-entry strong { color: var(--p-ink-2); font-size: 0.92rem; }
.ppro-practitioner-entry p { margin: 3px 0 0; color: var(--p-body); font-size: 0.8rem; line-height: 1.45; }
.ppro-practitioner-entry > a {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  gap: 7px;
  padding: 0 15px;
  border-radius: 11px;
  background: var(--p-primary);
  color: #fff;
  font-size: 0.82rem;
  font-weight: 800;
  text-decoration: none;
  white-space: nowrap;
}
.ppro-practitioner-entry > a:hover { background: var(--p-primary-hover); }

/* ── Section nav ──────────────────────────────────────────────── */
.ppro-nav {
  display: flex;
  gap: 6px;
  margin: 20px 0 6px;
  overflow-x: auto;
  border-bottom: 1px solid var(--p-border-soft);
  scrollbar-width: none;
}

.ppro-nav::-webkit-scrollbar { display: none; }

.ppro-nav a {
  position: relative;
  flex: 0 0 auto;
  padding: 10px 14px 12px;
  color: var(--p-body);
  font-size: 0.88rem;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  transition: color 0.15s ease;
}

.ppro-nav a:hover { color: var(--p-ink-2); }
.ppro-nav a.is-active { color: var(--p-primary); font-weight: 800; }
.ppro-nav a.is-active::after {
  content: "";
  position: absolute;
  right: 12px;
  bottom: -1px;
  left: 12px;
  height: 2px;
  border-radius: 2px;
  background: var(--p-primary);
}

/* ── Stacked sections ─────────────────────────────────────────── */
.ppro-sections { display: grid; gap: 18px; margin-top: 18px; }

.ppro-card {
  padding: 22px 22px 24px;
  border: 1px solid var(--p-border);
  border-radius: 20px;
  background: var(--p-surface);
  box-shadow: 0 1px 2px rgba(20, 38, 28, 0.02), 0 4px 14px rgba(20, 38, 28, 0.04);
}
.ppro-card[hidden] { display: none; }

.ppro-card-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px 18px;
  margin-bottom: 18px;
  padding-bottom: 15px;
  border-bottom: 1px solid var(--p-border-soft);
}

.ppro-card-head h2 { margin: 0; color: var(--p-ink-2); font-family: var(--p-font-head); font-size: 1.08rem; font-weight: 800; }
.ppro-card-head p { margin: 4px 0 0; color: var(--p-body); font-size: 0.82rem; }

.ppro-card-action {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 38px;
  padding: 0 14px;
  border: 0;
  border-radius: 10px;
  background: var(--p-mint-100);
  color: var(--p-primary);
  font-size: 0.82rem;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color 0.15s ease;
}

.ppro-card-action:hover { background: var(--p-mint-150); }
.ppro-card-action svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2.1; stroke-linecap: round; stroke-linejoin: round; }

/* ── Tiles ────────────────────────────────────────────────────── */
.ppro-tile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
}

.ppro-tile {
  display: grid;
  gap: 4px;
  padding: 14px 15px;
  border: 1px solid var(--p-border-soft);
  border-radius: 13px;
  background: var(--p-mint-50);
}

.ppro-tile > span {
  color: var(--p-muted);
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.ppro-tile strong {
  color: var(--p-ink-2);
  font-size: 0.92rem;
  font-weight: 700;
  overflow-wrap: break-word;
}

.ppro-tile-emergency { grid-column: span 2; }

/* ── Edit forms ───────────────────────────────────────────────── */
.ppro-edit-zone {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--p-border-soft);
}

.ppro-edit-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px;
}

.ppro-form {
  display: grid;
  gap: 13px;
  align-content: start;
  padding: 16px;
  border: 1px solid var(--p-border-soft);
  border-radius: 14px;
  background: #fff;
}

.ppro-form h3 { margin: 0 0 2px; color: var(--p-ink-2); font-size: 0.9rem; font-weight: 800; }

.ppro-form label {
  display: grid;
  gap: 6px;
  color: var(--p-ink-2);
  font-size: 0.82rem;
  font-weight: 700;
}

.ppro-form :is(input) {
  box-sizing: border-box;
  width: 100%;
  min-height: 44px;
  padding: 9px 12px;
  border: 1px solid var(--p-border);
  border-radius: 11px;
  background: var(--p-surface);
  color: var(--p-ink);
  font: inherit;
}

.ppro-form input:focus { border-color: var(--p-primary); outline: none; box-shadow: 0 0 0 3px rgba(13, 148, 100, 0.15); }
.ppro-form [aria-invalid="true"] { border-color: var(--p-danger); }

.ppro-form button[type="submit"] {
  justify-self: start;
  min-height: 42px;
  padding: 0 18px;
  border: 0;
  border-radius: 10px;
  background: var(--p-primary);
  color: #fff;
  font: inherit;
  font-family: var(--p-font-head);
  font-size: 0.86rem;
  font-weight: 700;
  cursor: pointer;
}

.ppro-form .patient-secondary-action {
  justify-self: start;
  min-height: 42px;
  padding: 0 16px;
  border: 1px solid var(--p-danger);
  border-radius: 10px;
  background: #fff;
  color: var(--p-danger);
  font: inherit;
  font-size: 0.84rem;
  font-weight: 700;
  cursor: pointer;
}

.ppro-form .patient-form-summary { margin-bottom: 2px; }
.ppro-form .patient-field-error { min-height: 0; }

/* ── Address cards ────────────────────────────────────────────── */
.ppro-address-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px;
}

.ppro-address-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--p-border);
  border-radius: 15px;
  background: #fff;
}

.ppro-address-card.is-default { border: 2px solid var(--p-primary); }

.ppro-address-head { display: flex; gap: 12px; align-items: flex-start; }

.ppro-address-icon {
  display: grid;
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  place-items: center;
  border-radius: 10px;
  background: var(--p-mint-100);
  color: var(--p-primary);
}

.ppro-address-icon svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }

.ppro-address-copy { min-width: 0; }

.ppro-address-title { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.ppro-address-title h3 { margin: 0; color: var(--p-ink-2); font-size: 0.95rem; font-weight: 800; }

.ppro-default-chip {
  padding: 1px 8px;
  border: 1px solid var(--p-mint-150);
  border-radius: 999px;
  background: var(--p-mint-100);
  color: var(--p-primary);
  font-size: 0.66rem;
  font-weight: 700;
}

.ppro-address-copy p { margin: 4px 0 0; color: var(--p-ink-2); font-size: 0.86rem; line-height: 1.45; }
.ppro-address-copy small { display: inline-block; margin-top: 6px; color: var(--p-body); font-size: 0.76rem; }

.ppro-address-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--p-border-soft);
}

.ppro-address-foot > span { color: var(--p-primary); font-size: 0.74rem; font-weight: 700; }
.ppro-active-loc { color: var(--p-primary); }
.ppro-address-foot a { color: var(--p-primary); font-size: 0.76rem; font-weight: 700; text-decoration: none; }
.ppro-address-foot a:hover { text-decoration: underline; }

.ppro-address-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 26px 18px;
  border: 1px dashed var(--p-border);
  border-radius: 14px;
  color: var(--p-body);
  font-size: 0.86rem;
  background: var(--p-mint-50);
}

.ppro-address-empty span {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 50%;
  background: var(--p-mint-100);
  color: var(--p-primary);
}

.ppro-address-empty span svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.ppro-address-empty p { margin: 0; }

/* ── Family / people ──────────────────────────────────────────── */
.ppro-people-list { display: grid; gap: 10px; }

.ppro-person-card {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  padding: 13px 14px;
  border: 1px solid var(--p-border);
  border-radius: 14px;
  background: #fff;
}

.ppro-person-card.is-self { background: var(--p-mint-50); border-color: var(--p-mint-150); }

.ppro-person-avatar {
  display: grid;
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  place-items: center;
  border-radius: 13px;
  background: var(--p-mint-100);
  color: var(--p-primary-dark);
  font-size: 0.9rem;
  font-weight: 800;
}

.ppro-person-copy { min-width: 150px; flex: 1 1 200px; }
.ppro-person-copy h3 { margin: 0; color: var(--p-ink-2); font-size: 0.94rem; font-weight: 800; }
.ppro-person-copy span { color: var(--p-body); font-size: 0.8rem; }

.ppro-person-tag {
  padding: 3px 10px;
  border: 1px solid var(--p-mint-150);
  border-radius: 999px;
  background: var(--p-mint-100);
  color: var(--p-primary);
  font-size: 0.7rem;
  font-weight: 700;
  white-space: nowrap;
}

.ppro-person-manage {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--p-primary);
  font-size: 0.78rem;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}

.ppro-person-manage:hover { text-decoration: underline; }
.ppro-person-manage svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }

.ppro-family-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  margin-top: 14px;
  padding: 26px 20px;
  border: 1px dashed var(--p-border);
  border-radius: 15px;
  background: var(--p-mint-50);
  text-align: center;
}

.ppro-family-empty-icon {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  margin-bottom: 4px;
  border-radius: 50%;
  background: var(--p-mint-100);
  color: var(--p-primary);
}

.ppro-family-empty-icon svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.ppro-family-empty h3 { margin: 0; color: var(--p-ink-2); font-size: 0.98rem; font-weight: 800; }
.ppro-family-empty p { max-width: 540px; margin: 0 0 12px; color: var(--p-body); font-size: 0.84rem; line-height: 1.55; }
.ppro-family-empty small { max-width: 560px; color: var(--p-muted); font-size: 0.74rem; line-height: 1.5; }

.ppro-inline-action {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 38px;
  padding: 0 16px;
  border-radius: 10px;
  background: var(--p-primary);
  color: #fff;
  font-size: 0.82rem;
  font-weight: 700;
  text-decoration: none;
}

/* ── Account rows ─────────────────────────────────────────────── */
.ppro-account-list { display: grid; }

.ppro-account-list a {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 13px 8px;
  border-radius: 12px;
  color: var(--p-ink-2);
  text-decoration: none;
  transition: background-color 0.15s ease;
}

.ppro-account-list a:hover { background: var(--p-mint-50); }
.ppro-account-list a + a { border-top: 1px solid var(--p-border-soft); border-radius: 0; }

.ppro-acct-icon {
  display: grid;
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  place-items: center;
  border-radius: 11px;
  background: var(--p-mint-100);
  color: var(--p-primary);
}

.ppro-acct-icon svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.ppro-account-list a > span:nth-child(2) { display: grid; gap: 2px; min-width: 0; }
.ppro-account-list strong { color: var(--p-ink-2); font-size: 0.92rem; }
.ppro-account-list small { color: var(--p-body); font-size: 0.8rem; }
.ppro-acct-chevron { margin-left: auto; color: var(--p-muted); font-size: 1.15rem; }

/* ── Responsive ───────────────────────────────────────────────── */
@media (max-width: 700px) {
  .ppro-nav { flex-wrap: wrap; overflow-x: visible; }
  .ppro-nav a { flex: 1 1 auto; text-align: center; }
  .ppro-hero { padding: 20px 18px; }
  .ppro-hero-avatar { width: 62px; height: 62px; flex-basis: 62px; border-radius: 18px; font-size: 1.6rem; }
  .ppro-card { padding: 18px 16px 20px; }
  .ppro-tile-emergency { grid-column: auto; }
  .ppro-card-head { flex-direction: column; }
  .ppro-edit-zone { padding-top: 14px; }
  .ppro-edit-grid { grid-template-columns: 1fr; }
  .ppro-practitioner-entry { grid-template-columns: auto minmax(0, 1fr); }
  .ppro-practitioner-entry > a { grid-column: 1 / -1; justify-content: center; width: 100%; }
}

/* ═══ PATIENT FAQ ══════════════════════════════════════════════ */
.patient-faq-page { max-width: 720px; }

.faq-list {
  display: grid;
  gap: 10px;
  margin-top: 24px;
}

.faq-item {
  border: 1px solid var(--p-border);
  border-radius: 14px;
  background: var(--p-surface);
  overflow: hidden;
  transition: border-color 0.15s ease;
}

.faq-item[open] {
  border-color: var(--p-mint-200);
}

.faq-question {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  cursor: pointer;
  list-style: none;
  font-family: var(--p-font-head);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--p-ink);
  line-height: 1.4;
}

.faq-question::-webkit-details-marker { display: none; }
.faq-question::marker { display: none; content: ''; }

.faq-chevron {
  flex: 0 0 auto;
  color: var(--p-body);
  transition: transform 0.2s ease;
}

.faq-chevron svg { width: 18px; height: 18px; }

.faq-item[open] .faq-chevron { transform: rotate(90deg); }

.faq-answer {
  padding: 0 18px 16px;
}

.faq-answer p {
  margin: 0;
  color: var(--p-body);
  font-size: 0.88rem;
  line-height: 1.65;
}

.faq-contact {
  margin-top: 40px;
  padding: 24px;
  border: 1px solid var(--p-border);
  border-radius: 18px;
  background: var(--p-surface);
  text-align: center;
}

.faq-contact h2 {
  margin: 0 0 8px;
  color: var(--p-ink);
  font-family: var(--p-font-head);
  font-size: 1.1rem;
  font-weight: 700;
}

.faq-contact p {
  margin: 0 0 18px;
  color: var(--p-body);
  font-size: 0.88rem;
}

.faq-contact-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
}

.faq-whatsapp-btn {
  border-color: #25D366;
  color: #128C7E;
}

.faq-whatsapp-btn:hover {
  background: #DCF8C6;
  border-color: #25D366;
}

@media (max-width: 480px) {
  .faq-question { padding: 14px 16px; font-size: 0.9rem; }
  .faq-answer { padding: 0 16px 14px; }
  .faq-contact { padding: 20px 16px; }
}
