/* Custom Styles - Omolewa Hospital & Maternity */

/* Root Variables */
:root {
  --primary-color: #4f46e5;
  --primary-hover: #4338ca;
  --secondary-color: #6366f1;
  --success-color: #22c55e;
  --danger-color: #ef4444;
  --warning-color: #f59e0b;
  --info-color: #3b82f6;
  --body-bg: #f8fafc;
  --sidebar-width: 256px;
  --header-height: 64px;
}

/* ── Type scale: every font size in the project, in one place (PROVISIONAL).
   rem, so the browser's own text size, zoom and Windows scaling all apply.
   Pages, <style> blocks, inline styles and markup built in JavaScript use
   these variables; chart fonts read them too (js/dashboard.js). Nothing
   visible is smaller than --fs-xs. ── */
:root {
  /* Reading text matches the legal consent text everywhere: 16px on phones
     and tablets, up to 17px on large screens, in dark #1f2937 / #374151. */
  --fs-xs: clamp(1rem, 0.964rem + 0.1vw, 1.0625rem);       /* 16-17px: meta lines, hints, table headers */
  --fs-sm: clamp(1rem, 0.964rem + 0.1vw, 1.0625rem);       /* 16-17px: secondary text, captions, hints */
  --fs-body: clamp(1rem, 0.964rem + 0.1vw, 1.0625rem);     /* 16-17px: table cells, dense body text */
  --fs-base: clamp(1rem, 0.964rem + 0.1vw, 1.0625rem);     /* 16-17px: body text, form fields */
  --fs-md: clamp(1.125rem, 1.071rem + 0.15vw, 1.25rem);    /* 18-20px */
  --fs-lg: clamp(1.25rem, 1.196rem + 0.15vw, 1.375rem);    /* 20-22px */
  --fs-xl: 1.5rem;      /* 24px */
  --fs-2xl: 1.75rem;    /* 28px */
  --fs-3xl: 2rem;       /* 32px */
  --fs-4xl: 2.5rem;     /* 40px: large figures and icons */
  --fs-5xl: 3rem;       /* 48px */
  --fs-6xl: 4rem;       /* 64px */
  --lh-body: 1.5;
  --lh-heading: 1.3;
  --bs-secondary-color: #374151;
  --bs-body-color: #1f2937;
  --bs-body-font-size: var(--fs-base);
  --bs-body-line-height: var(--lh-body);
}
html { font-size: 100%; }

/* Base Styles */
body {
  font-family: 'Instrument Sans', ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  background-color: var(--body-bg);
  font-size: var(--fs-base);
  line-height: var(--lh-body);
}

/* Headings */
h1, h2, h3, h4, h5, h6 {
  font-family: 'Inter', 'Instrument Sans', ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, "Noto Sans", sans-serif;
}
h1, h2, h3, h4, h5, h6, .h1, .h2, .h3, .h4, .h5, .h6 { line-height: var(--lh-heading); }

/* Bootstrap's relative and small sizes, held to the scale: "small" text is
   never below --fs-xs whatever it sits in; buttons, fields, tooltips,
   pagination, dropdowns and toasts on the scale. Form fields are 16px, which
   also stops phones zooming in on focus. */
small, .small, .form-text { font-size: var(--fs-sm); }
.badge { --bs-badge-font-size: 0.875rem; }
.btn { --bs-btn-font-size: var(--fs-base); }
.btn-sm, .btn-group-sm > .btn { --bs-btn-font-size: 0.9375rem; }
.form-control, .form-select, .form-control-sm, .form-select-sm, .input-group-text, .input-group-sm > .form-control,
.input-group-sm > .form-select, .input-group-sm > .input-group-text, .form-control-plaintext { font-size: var(--fs-base); }
.form-check-label, .form-label, .col-form-label { line-height: var(--lh-body); }
.tooltip { --bs-tooltip-font-size: var(--fs-sm); }
.popover { --bs-popover-font-size: var(--fs-sm); --bs-popover-header-font-size: var(--fs-base); }
.pagination { --bs-pagination-font-size: var(--fs-base); }
.pagination-sm { --bs-pagination-font-size: var(--fs-body); }
.dropdown-menu { --bs-dropdown-font-size: var(--fs-base); }
.toast { --bs-toast-font-size: var(--fs-sm); }
.table { line-height: var(--lh-body); }
/* A dialog never runs off the screen: its content scrolls inside it. */
.modal-dialog:not(.modal-fullscreen) .modal-content { max-height: calc(100dvh - var(--bs-modal-margin, 1.75rem) * 2); overflow-y: auto; }

/* Toast Notifications */
#toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast-notification {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  min-width: 300px;
  max-width: 400px;
  animation: slideIn 0.3s ease;
}

.toast-success {
  background-color: #dcfce7;
  border-left: 4px solid var(--success-color);
  color: #166534;
}

.toast-error {
  background-color: #fee2e2;
  border-left: 4px solid var(--danger-color);
  color: #991b1b;
}

.toast-info {
  background-color: #dbeafe;
  border-left: 4px solid var(--info-color);
  color: #1e40af;
}

.toast-warning {
  background-color: #fef3c7;
  border-left: 4px solid var(--warning-color);
  color: #92400e;
}

.toast-message {
  flex: 1;
  font-size: var(--fs-body);
  font-weight: 500;
}

.toast-close {
  background: none;
  border: none;
  font-size: var(--fs-md);
  cursor: pointer;
  opacity: 0.6;
  margin-left: 10px;
}

.toast-close:hover {
  opacity: 1;
}

.toast-fade-out {
  animation: fadeOut 0.3s ease forwards;
}

@keyframes slideIn {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes fadeOut {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
    transform: translateX(100%);
  }
}

/* Sidebar Styles */
.sidebar {
  position: fixed;
  top: var(--header-height);
  left: 0;
  bottom: 0;
  width: var(--sidebar-width);
  background-color: #fff;
  border-right: 1px solid #e2e8f0;
  z-index: 30;
  transition: transform 0.3s ease;
  overflow-y: auto;
}

/* Below 992px the sidebar is a slide-in menu: hidden until the menu
   button adds .collapsed (despite its name, .collapsed means OPEN here,
   with the dark overlay behind it). The staff pages already did this
   through js/staff-layout.js; the patient pages relied on these rules
   and opened with the menu covering the page. */
@media (max-width: 991.98px) {
  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.collapsed {
    transform: translateX(0);
    box-shadow: 4px 0 24px rgba(15, 23, 42, 0.15);
  }
}

@media (min-width: 992px) {
  .sidebar {
    transform: translateX(0) !important;
  }
}

.sidebar-nav {
  padding: 16px 0;
}

.sidebar-nav .nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 24px;
  color: #374151;
  text-decoration: none;
  font-size: var(--fs-body);
  font-weight: 500;
  transition: all 0.2s ease;
  border-right: 4px solid transparent;
}

.sidebar-nav .nav-link:hover {
  background-color: #f8fafc;
  color: var(--primary-color);
}

.sidebar-nav .nav-link.active {
  background-color: #eef2ff;
  color: var(--primary-color);
  border-right-color: var(--primary-color);
}

.sidebar-nav .nav-link i {
  font-size: var(--fs-lg);
  width: 24px;
  text-align: center;
}

/* Header Styles */
.main-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height);
  background-color: #fff;
  border-bottom: 1px solid #e2e8f0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
}

.main-header .logo {
  height: 36px;
  width: auto;
}

/* Main Content Area */
.main-content {
  margin-top: var(--header-height);
  padding: 24px;
  min-height: calc(100vh - var(--header-height));
}

@media (min-width: 992px) {
  .main-content {
    margin-left: var(--sidebar-width);
    padding: 32px;
  }
}

/* Overlay */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 29;
}

@media (max-width: 991.98px) {
  .sidebar-overlay.active {
    display: block;
  }
}

/* Card Styles */
.stat-card {
  background-color: #fff;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  border: 1px solid #f1f5f9;
}

.stat-card .stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.stat-card .stat-value {
  font-size: var(--fs-2xl);
  font-weight: 700;
  color: #1e293b;
}

.stat-card .stat-label {
  font-size: var(--fs-body);
  color: #374151;
  margin-top: 4px;
}

.stat-card .stat-change {
  font-size: var(--fs-sm);
  font-weight: 500;
}

.stat-change.positive {
  color: var(--success-color);
}

.stat-change.negative {
  color: var(--danger-color);
}

/* Welcome Banner */
.welcome-banner {
  background: linear-gradient(135deg, #4f46e5 0%, #6366f1 100%);
  border-radius: 16px;
  padding: 32px;
  color: #fff;
}

/* Table Styles */
.table-container {
  background-color: #fff;
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  overflow: hidden;
}

.table-container .table {
  margin-bottom: 0;
}

.table-container .table th {
  background-color: #f8fafc;
  font-weight: 600;
  color: #374151;
  font-size: var(--fs-sm);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid #e2e8f0;
}

/* Button Styles */
.btn-primary {
  background-color: var(--primary-color);
  border-color: var(--primary-color);
}

.btn-primary:hover {
  background-color: var(--primary-hover);
  border-color: var(--primary-hover);
}

/* Loading Spinner */
.loading-spinner {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 400px;
}

.loading-spinner::after {
  content: "";
  width: 48px;
  height: 48px;
  border: 4px solid #e2e8f0;
  border-top-color: var(--primary-color);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

/* Modal Styles */
.modal-content {
  border-radius: 16px;
  border: none;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
}

.modal-header {
  border-bottom: 1px solid #e2e8f0;
  padding: 20px 24px;
}

.modal-body {
  padding: 24px;
}

.modal-footer {
  border-top: 1px solid #e2e8f0;
  padding: 16px 24px;
}

/* Notification Dropdown */
.notification-dropdown {
  position: absolute;
  right: 0;
  margin-top: 8px;
  width: 320px;
  background-color: #fff;
  border-radius: 12px;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  border: 1px solid #e2e8f0;
  z-index: 50;
  max-height: 384px;
  overflow-y: auto;
}

.notification-item {
  padding: 12px 16px;
  border-bottom: 1px solid #f1f5f9;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.notification-item:hover {
  background-color: #f8fafc;
}

.notification-item.unread {
  background-color: #eef2ff;
}

.notification-item .notification-text {
  font-size: var(--fs-body);
  color: #334155;
}

.notification-item .notification-time {
  font-size: var(--fs-xs);
  color: #4b5563;
  margin-top: 4px;
}

/* Pagination — mirrors the Next.js source's Pagination component
   (border-blue-600 bg-blue-50 text-blue-600 on the active page, not a
   solid fill — a solid fill left the active page number invisible
   because it inherited the same blue as its own background). */
.pagination {
  gap: 4px;
}

.pagination .page-link {
  margin-left: 0;
  padding: 8px 14px;
  color: #374151;
  border: 1px solid #d1d5db;
  border-radius: 8px;
}

.pagination .page-link:hover {
  background-color: #f9fafb;
}

.pagination .page-item.active .page-link {
  background-color: #eff6ff;
  border-color: #2563eb;
  color: #2563eb;
  font-weight: 600;
}

.pagination .page-item.disabled .page-link {
  color: #9ca3af;
  opacity: 0.65;
}

/* Utility Classes */
.text-primary-custom {
  color: var(--primary-color) !important;
}

.bg-primary-custom {
  background-color: var(--primary-color) !important;
}

/* Sidebar Footer */
.sidebar-footer {
  border-top: 1px solid #e2e8f0;
  padding: 8px 0;
  margin-top: auto;
}

/* ══════════════════════════════════════════════════════════════════
   Staff header + sidebar (Figma). Scoped to .staff-header /
   .staff-sidebar (set only by staff/partials/header-and-sidebar.php)
   so the patient pages, which share .main-header/.sidebar-nav, are
   unaffected.
   ══════════════════════════════════════════════════════════════════ */
.staff-header .staff-header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

/* Search */
.staff-header .header-search {
  position: relative;
  width: 315px;
  margin: 0;
}
.staff-header .header-search i {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: var(--fs-base);
  color: #374151;
  pointer-events: none;
}
.staff-header .header-search input {
  width: 100%;
  height: 36px;
  padding: 0 12px 0 36px;
  background-color: #f3f4f6;
  border: 1px solid transparent;
  border-radius: 8px;
  font-size: var(--fs-body);
  color: #101828;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.staff-header .header-search input::placeholder { color: #6a7282; }
.staff-header .header-search input:focus {
  background-color: #fff;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

/* Bell + unread dot */
.staff-header .header-bell {
  position: relative;
  background: none;
  border: none;
  padding: 8px;
  border-radius: 8px;
  font-size: var(--fs-lg);
  line-height: 1;
  color: #364153;
  cursor: pointer;
}
.staff-header .header-bell:hover { background-color: #f3f4f6; }
/* staff-layout.js toggles display and writes the unread count into this
   span; the Figma draws it as a plain dot, so the text is hidden. */
.staff-header #notifBadge {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 8px;
  height: 8px;
  padding: 0;
  border-radius: 50%;
  background-color: #fb2c36;
  font-size: 0;
  overflow: hidden;
}

/* Role / "Online" + avatar, separated from the bell by a divider */
.staff-header .header-user {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-left: 16px;
  border-left: 1px solid #e5e7eb;
  height: 40px;
}
.staff-header .header-user-text { text-align: right; line-height: 1.25; }
.staff-header .header-user-role { font-size: var(--fs-body); color: #101828; }
.staff-header .header-user-status { font-size: var(--fs-xs); color: #374151; }
.staff-header .profile-circle {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  border-radius: 50%;
  background-color: #dbeafe;
  color: #155dfc;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--fs-md);
  font-weight: 400;
  text-decoration: none;
  overflow: hidden;
}
/* Page scripts inline a 36px size on the photo; fill the 40px circle. */
.staff-header .profile-circle img {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover;
  border-radius: 50%;
}

@media (max-width: 1099.98px) {
  .staff-header .header-search { width: 220px; }
}
@media (max-width: 767.98px) {
  .staff-header .header-search,
  .staff-header .header-user-text { display: none; }
  .staff-header .header-user { border-left: none; padding-left: 0; }
}

/* Sidebar items: rounded, inset, light-blue pill for the current page */
.staff-sidebar .sidebar-nav .nav-link {
  margin: 2px 30px 2px 16px;
  padding: 12px 16px;
  border-radius: 8px;
  border-right: none;
  font-size: var(--fs-base);
  font-weight: 400;
  color: #364153;
}
.staff-sidebar .sidebar-nav button.nav-link {
  width: calc(100% - 46px) !important;
}
.staff-sidebar .sidebar-nav .nav-link:hover {
  background-color: #f9fafb;
  color: #155dfc;
}
.staff-sidebar .sidebar-nav .nav-link.active {
  background-color: #eff6ff;
  color: #155dfc;
}
/* The 20px icon's inherited line-height made each item ~54px tall; the
   Figma item is ~47px. */
.staff-sidebar .sidebar-nav .nav-link i {
  line-height: 1;
}

/* ── Time-frame selector pills (staff reports.php + dashboard.php) ──
   Mirrors the Next.js TimeFrameSelector: active = filled blue, others
   plain gray text with no outline. Moved here unchanged from
   reports.php so both pages share one definition. */
.time-frame-btn {
  padding: 6px 12px;
  border-radius: 6px;
  border: none;
  background: transparent;
  color: #374151;
  font-size: var(--fs-body);
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}
.time-frame-btn:hover {
  background-color: #f1f5f9;
}
.time-frame-btn.active {
  background-color: #2563eb;
  color: #fff;
}
.time-frame-selector {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  border: 1px solid #e2e8f0;
  padding: 8px;
}
.time-frame-selector > i {
  color: #374151;
  font-size: var(--fs-base);
  padding-left: 4px;
}
.time-frame-selector .time-frame-options {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}
@media (max-width: 767.98px) {
  .time-frame-selector > i { display: none; }
}

/* ── Patient account-type badges (shared: staff/patients.php and any
   other staff page showing a patient's type; see staffHelpers.
   accountTypeBadge). Personal / Family Head / Family Member / Antenatal
   use the patients Figma's colors (Tailwind v4 100/600 pairs);
   Gynecology / NHIS / Kwara Care keep their existing distinct colors. */
.acct-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 9999px;
  font-size: var(--fs-xs);
  font-weight: 500;
  line-height: 1.5;
  white-space: nowrap;
}
.acct-badge--personal      { background-color: #f3f4f6; color: #374151; }
.acct-badge--family_head   { background-color: #f3e8ff; color: #9810fa; }
.acct-badge--family_member { background-color: #dbeafe; color: #155dfc; }
.acct-badge--antenatal     { background-color: #fce7f3; color: #e60076; }
.acct-badge--gynecology    { background-color: #fae8ff; color: #a21caf; }
.acct-badge--nhis          { background-color: #fef3c7; color: #b45309; }
.acct-badge--kwaraCare     { background-color: #cffafe; color: #0e7490; }

/* ── Staff list pages: patients.php + medical-records.php (Figma).
   Shared title / stat cards / search row / table / icon actions, moved
   verbatim from patients.php. Account-type badge colors: .acct-badge--*. ── */
.pm-title { margin: 0; font-size: var(--fs-xl); font-weight: 400; color: #101828; }
.pm-subtitle { margin: 4px 0 0; font-size: var(--fs-body); color: #374151; }
.pm-register-btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 18px; border-radius: 8px;
  background-color: #1447e6; color: #fff; font-size: var(--fs-body); font-weight: 500;
  text-decoration: none; transition: background-color 0.15s ease;
}
.pm-register-btn:hover { background-color: #193cb8; color: #fff; }
.pm-register-btn i { font-size: var(--fs-md); line-height: 1; }

.pm-stats {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px; margin-bottom: 24px;
}
.pm-stat {
  display: flex; align-items: center; gap: 12px;
  background: #fff; border: 1px solid #e5e7eb; border-radius: 12px; padding: 16px;
}
.pm-stat-icon {
  width: 40px; height: 40px; flex-shrink: 0; border-radius: 8px;
  display: flex; align-items: center; justify-content: center; font-size: var(--fs-md);
}
.pm-stat-value { font-size: var(--fs-xl); font-weight: 400; line-height: 1.2; color: #101828; }
.pm-stat-label { font-size: var(--fs-xs); color: #374151; margin-top: 2px; }
.pm-stat-breakdown { font-size: var(--fs-xs); color: #374151; margin-top: 2px; }
@media (max-width: 1199.98px) { .pm-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 575.98px) { .pm-stats { grid-template-columns: 1fr; } }

.pm-card { background: #fff; border: 1px solid #e5e7eb; border-radius: 12px; }
.pm-search-row { display: flex; align-items: center; gap: 12px; padding: 16px; margin-bottom: 24px; }
.pm-search { position: relative; flex: 1; min-width: 0; }
@media (max-width: 575.98px) {
  .pm-search-row { flex-wrap: wrap; }
  .pm-search { flex-basis: 100%; }
}
/* Settings (staff and patient): the inline two-column field grids stack on phones,
   so the larger inputs keep a usable width. */
@media (max-width: 575.98px) {
  .settings-layout [style*="grid-template-columns"],
  #settingsGrid [style*="grid-template-columns"] { grid-template-columns: minmax(0, 1fr) !important; }
}
.pm-search i {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  color: #374151; font-size: var(--fs-base); pointer-events: none;
}
.pm-search input {
  width: 100%; height: 40px; padding: 0 12px 0 38px;
  border: 1px solid #d1d5dc; border-radius: 8px; font-size: var(--fs-body); color: #101828; outline: none;
}
.pm-search input::placeholder { color: #6a7282; }
.pm-search input:focus { border-color: #3b82f6; box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15); }
.pm-filter-btn {
  position: relative; display: inline-flex; align-items: center; gap: 8px;
  height: 40px; padding: 0 16px; background: #fff; border: 1px solid #d1d5dc;
  border-radius: 8px; font-size: var(--fs-body); color: #101828;
}
.pm-filter-btn:hover { background: #f9fafb; }

.pm-table { width: 100%; margin: 0; border-collapse: separate; border-spacing: 0; }
.pm-table thead th {
  padding: 12px; background: #f9fafb; border-bottom: 1px solid #e5e7eb;
  font-size: var(--fs-xs); font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase;
  color: #374151; white-space: nowrap;
}
.pm-table thead th:first-child { border-top-left-radius: 12px; }
.pm-table thead th:last-child { border-top-right-radius: 12px; }
.pm-table tbody td {
  padding: 16px 12px; border-bottom: 1px solid #f3f4f6; font-size: var(--fs-body); vertical-align: middle;
}
.pm-table tbody tr:last-child td { border-bottom: none; }
.pm-table tbody tr:hover td { background: #f9fafb; }
.pm-cell-id { color: #1e2939; white-space: nowrap; }
.pm-cell-name { color: #101828; white-space: nowrap; }
.pm-cell-muted { color: #374151; white-space: nowrap; }
.pm-actions { display: flex; align-items: center; gap: 2px; }
.pm-action {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; padding: 0; border: none; border-radius: 6px;
  background: transparent; font-size: var(--fs-base); text-decoration: none; cursor: pointer;
}
.pm-action:hover { background: #f3f4f6; }
.pm-action:focus-visible { outline: 2px solid #3b82f6; outline-offset: 1px; }

/* ── Staff Employees page (Figma): role pills + employees table.
   Moved verbatim from staff/employees.php; builds on .pm-table. ── */
/* Role pills: one colour per role. The frame's six (doctor, nurse,
   pharmacist, lab, receptionist, cashier) use its colours; manager
   indigo, records teal, admin slate. */
.role-badge-doctor { background-color: #dbeafe; color: #1447e6; }
.role-badge-nurse { background-color: #dcfce7; color: #008236; }
.role-badge-pharmacist { background-color: #f3e8ff; color: #8200db; }
.role-badge-lab { background-color: #ffedd4; color: #ca3500; }
.role-badge-receptionist { background-color: #fce7f3; color: #c6005c; }
.role-badge-cashier { background-color: #fef9c2; color: #a65f00; }
.role-badge-manager { background-color: #e0e7ff; color: #432dd7; }
.role-badge-records { background-color: #cbfbf1; color: #00786f; }
.role-badge-admin { background-color: #f1f5f9; color: #45556c; }

/* Employees table (Figma): avatar + name/ID, role pill, contact, icon actions */
.em-table thead th:first-child, .em-table tbody td:first-child { padding-left: 24px; }
.em-table thead th:last-child, .em-table tbody td:last-child { padding-right: 24px; }
.em-table tbody td { padding-top: 19px; padding-bottom: 19px; }
.em-person { display: flex; align-items: center; gap: 12px; min-width: 0; }
.em-avatar {
  width: 40px; height: 40px; flex-shrink: 0; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: #dbeafe; color: #155dfc; font-size: var(--fs-base); font-weight: 500;
}
.em-avatar--dim { opacity: 0.45; }
.em-name { display: flex; align-items: center; gap: 8px; font-size: var(--fs-body); font-weight: 500; color: #101828; white-space: nowrap; }
.em-id { font-size: var(--fs-xs); color: #374151; margin-top: 2px; white-space: nowrap; }
.em-disabled-tag {
  font-size: var(--fs-xs); font-weight: 500; line-height: 1.5; padding: 0 6px;
  border-radius: 9999px; background: #f3f4f6; color: #374151;
}
.em-role { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 8px; }
.em-pill {
  display: inline-block; padding: 2px 10px; border-radius: 9999px;
  font-size: var(--fs-xs); font-weight: 500; line-height: 1.5; white-space: nowrap;
}
.em-dept { font-size: var(--fs-xs); color: #374151; margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 240px; }
.em-contact { display: flex; align-items: center; gap: 6px; font-size: var(--fs-sm); color: #374151; line-height: 1.5; white-space: nowrap; }
.em-contact i { font-size: var(--fs-xs); color: #374151; }

/* Select beside the search box (Employees role filter, Invoices status
   filter). Moved verbatim from staff/employees.php. */
.em-select {
  height: 40px; min-width: 168px; padding: 0 36px 0 12px; border: 1px solid #d1d5dc; border-radius: 8px;
  font-size: var(--fs-body); color: #101828; background-color: #fff; outline: none; appearance: none;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%234a5565' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
  background-repeat: no-repeat; background-position: right 12px center; background-size: 14px 10px;
}
.em-select:focus { border-color: #3b82f6; box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15); }

/* Invoice status pills (staff + patient Invoices pages); used with
   .em-pill, colours taken from the role pills and status badges above. */
.inv-status-pending { background-color: #fef9c2; color: #a65f00; }
.inv-status-paid { background-color: #dcfce7; color: #008236; }
.inv-status-failed { background-color: #fee2e2; color: #dc2626; }
.inv-status-cancelled { background-color: #f1f5f9; color: #45556c; }

/* ── Pharmacy (Figma "Pharmacy" frame): tabs, prescription cards.
   Builds on .pm-stats / .pm-card / .pm-search-row / .em-avatar / .em-pill;
   only what those cannot express is here. ── */
.ph-tabs { display: flex; gap: 8px; padding: 8px; margin-bottom: 24px; }
.ph-tab {
  flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; border: none; border-radius: 10px; background: transparent;
  font-size: var(--fs-base); color: #374151;
}
.ph-tab:hover { background: #f9fafb; }
.ph-tab.active { background: #eff6ff; color: #155dfc; }
.ph-tab i { font-size: var(--fs-base); }

.ph-rx { display: flex; flex-direction: column; gap: 16px; padding: 24px; margin-bottom: 12px; border-radius: 14px; }
.ph-rx-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.ph-rx-name { font-size: var(--fs-base); line-height: 24px; color: #101828; }
.ph-rx-meta { display: flex; flex-direction: column; gap: 8px; font-size: var(--fs-xs); line-height: 1.5; color: #374151; }
.ph-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  min-height: 48px; padding: 8px 12px; border-radius: 10px; background: #f9fafb;
}
.ph-row-label { font-size: var(--fs-xs); color: #374151; }
.ph-items { display: flex; flex-direction: column; gap: 8px; }
.ph-item { min-height: 60px; }
.ph-item-main { display: flex; align-items: center; gap: 12px; min-width: 0; }
.ph-item-icon { font-size: var(--fs-base); color: #374151; }
.ph-item-icon--injection { color: #9810fa; }
.ph-item-name { font-size: var(--fs-body); line-height: 1.5; color: #101828; }
.ph-item-qty { font-size: var(--fs-xs); line-height: 1.5; color: #374151; }
/* Status pills with an icon, as in the frame (12px text, 12px icon). */
.ph-pill { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 9999px; font-size: var(--fs-xs); line-height: 1.5; white-space: nowrap; }
.ph-pill i { font-size: var(--fs-xs); }
.ph-pay-paid { background: #dcfce7; color: #008236; }
.ph-pay-unpaid { background: #ffe2e2; color: #c10007; }
.ph-pay-legacy { background: #f1f5f9; color: #45556c; }
/* Stock tags: square-ish, as in the frame. */
.ph-stock { padding: 4px 8px; border-radius: 4px; font-size: var(--fs-xs); line-height: 1.5; white-space: nowrap; }
.ph-stock-in { background: #f0fdf4; color: #00a63e; }
.ph-stock-low { background: #fefce8; color: #a65f00; }
.ph-stock-out { background: #fef2f2; color: #e7000b; }
.ph-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.ph-btn { height: 38px; padding: 0 16px; border-radius: 10px; font-size: var(--fs-body); line-height: 1.5; }
.ph-btn-muted { border: none; background: #d1d5dc; color: #374151; }
.ph-btn-muted:disabled { opacity: 1; cursor: not-allowed; }
.ph-btn-outline { border: 1px solid #d1d5dc; background: #fff; color: #364153; }
.ph-btn-outline:hover { background: #f9fafb; }
/* Dispensing (no frame of its own: the frame's buttons, made active). */
.ph-btn-primary { border: none; background: #155dfc; color: #fff; }
.ph-btn-primary:hover { background: #1447e6; }
.ph-btn-emergency { border: 1px solid #ffc9c9; background: #fff; color: #c10007; }
.ph-btn-emergency:hover { background: #fef2f2; }
.ph-btn-emergency:disabled { opacity: .6; cursor: not-allowed; }
.ph-btn-sm { height: 30px; padding: 0 12px; border-radius: 8px; font-size: var(--fs-xs); }
.ph-pay-emergency { background: #fef3c6; color: #973c00; }
.ph-block-reason { font-size: var(--fs-xs); line-height: 1.5; color: #c10007; margin-top: 4px; }
.ph-override { display: block; background: #fffbeb; }
/* Item row: name on the left, stock tag / chip / Dispense on the right; the
   right group wraps under the name when a long drug name needs the room. */
.ph-item { flex-wrap: wrap; }
.ph-item-main { flex: 1 1 260px; }
.ph-item-text { min-width: 0; overflow-wrap: anywhere; }
.ph-item-side { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 8px; margin-left: auto; }
.ph-item-icon { color: #99a1af; }
/* An item the server will not dispense for a reason of its own: a small
   amber chip, the full sentence as its tooltip. */
.ph-chip {
  display: inline-flex; align-items: center; gap: 4px; padding: 4px 8px; border-radius: 4px;
  background: #fef3c6; color: #973c00; font-size: var(--fs-xs); line-height: 1.5; white-space: nowrap; cursor: help;
}
.ph-chip i { font-size: var(--fs-xs); }
/* A disabled button's reason, as a tooltip on its wrapper (browsers show none
   on a disabled button). */
.ph-tip { display: inline-flex; cursor: not-allowed; }
/* Phones: the payment band wraps (a long pill such as "Emergency, payment
   pending" no longer pushes the amount out of the band). */
@media (max-width: 575.98px) {
  .ph-rx > .ph-row { flex-wrap: wrap; }
  .ph-rx > .ph-row > div { min-width: 0; flex-wrap: wrap; }
  .ph-rx > .ph-row .ph-pill { white-space: normal; }
}

/* ── Appointments (Figma "Appointments" frame, Filter Appointments,
   View Appointment Details, Select Appointment Type, Schedule
   Appointment). Builds on .pm-title / .pm-stats / .pm-card / .em-avatar /
   .ph-pill / .ph-actions; only what those cannot express is here. ── */
.ap-subtitle { margin: 0; font-size: var(--fs-base); line-height: 24px; color: #374151; }
.ap-new-btn { height: 40px; padding: 0 16px; border-radius: 10px; background-color: #103fd3; font-size: var(--fs-base); }
.ap-new-btn:hover { background-color: #0d34ad; }
.ap-stat { display: flex; flex-direction: column; gap: 4px; padding: 16px; background: #fff; border: 1px solid #e5e7eb; border-radius: 10px; }
.ap-stat-value { font-size: var(--fs-xl); line-height: 32px; color: #101828; }
.ap-stat-value--done { color: #00a63e; }
.ap-stat-value--queue { color: #103fd3; }
.ap-stat-value--wait { color: #d08700; }
.ap-stat-label { font-size: var(--fs-xs); line-height: 1.5; color: #374151; }

.ap-layout { display: grid; grid-template-columns: minmax(0, 1fr) 333px; gap: 24px; align-items: start; }
@media (max-width: 991.98px) { .ap-layout { grid-template-columns: minmax(0, 1fr); } }
.ap-side { display: flex; flex-direction: column; gap: 16px; }

.ap-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; padding: 16px; margin-bottom: 16px; border-radius: 14px; }
.ap-input {
  height: 42px; padding: 0 14px; border: 1px solid #d1d5dc; border-radius: 10px;
  font-size: var(--fs-base); color: #101828; background: #fff; outline: none;
}
.ap-input:focus { border-color: #3b82f6; box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15); }
.ap-toolbar .ap-date { flex: 1 1 200px; min-width: 0; }
.ap-toolbar .ap-search { flex: 1 1 200px; min-width: 0; }
.ap-filter-btn { height: 42px; border-radius: 10px; font-size: var(--fs-base); color: #0a0a0a; }
.ap-filter-count { min-width: 20px; padding: 0 6px; border-radius: 9999px; background: #103fd3; color: #fff; font-size: var(--fs-xs); line-height: 1.5; }
.ap-showing { margin: 0 0 16px; font-size: var(--fs-body); line-height: 1.5; color: #374151; }
.ap-showing strong { font-weight: 400; color: #101828; }

.ap-list { display: flex; flex-direction: column; gap: 12px; }
.ap-card { display: flex; flex-direction: column; gap: 12px; padding: 16px; background: #fff; border: 1px solid #e5e7eb; border-radius: 14px; }
.ap-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.ap-person { display: flex; align-items: center; gap: 12px; min-width: 0; }
.ap-minw { min-width: 0; }
.ap-avatar { background: #dbeafe; color: #103fd3; font-weight: 400; }
.ap-name { font-size: var(--fs-base); line-height: 24px; color: #101828; overflow-wrap: anywhere; }
.ap-pid { font-size: var(--fs-xs); line-height: 1.5; color: #374151; }
.ap-facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; font-size: var(--fs-body); line-height: 1.5; color: #374151; }
@media (max-width: 575.98px) { .ap-facts { grid-template-columns: minmax(0, 1fr); } }
.ap-fact { display: flex; align-items: center; gap: 8px; min-width: 0; overflow-wrap: anywhere; }
.ap-fact i { font-size: var(--fs-base); color: #374151; }
.ap-btn { height: 34px; padding: 0 13px; border-radius: 10px; font-size: var(--fs-body); line-height: 1.5; }
.ap-btn-primary { border: none; background: #103fd3; color: #fff; }
.ap-btn-primary:hover { background: #0d34ad; color: #fff; }
.ap-btn-success { border: none; background: #00a63e; color: #fff; }
.ap-btn-success:hover { background: #008236; color: #fff; }
.ap-btn-danger { border: 1px solid #ffc9c9; background: #fff; color: #c10007; }
.ap-btn-danger:hover { background: #fef2f2; }

/* Status pills: colours from the frame; cancelled from its filter dot. */
.ap-st-scheduled { background: #f3f4f6; color: #364153; }
.ap-st-waiting { background: #fef9c2; color: #a65f00; }
.ap-st-in_progress { background: #dbeafe; color: #1447e6; }
.ap-st-completed { background: #dcfce7; color: #008236; }
.ap-st-cancelled { background: #ffe2e2; color: #c10007; }

.ap-empty { padding: 48px 16px; text-align: center; color: #374151; border-radius: 14px; }
.ap-empty i { font-size: var(--fs-3xl); color: #99a1af; }

.ap-panel { padding: 24px; border-radius: 14px; }
.ap-panel-title { margin: 0 0 16px; font-size: var(--fs-base); line-height: 24px; font-weight: 400; color: #101828; }
.ap-doc { display: flex; flex-direction: column; gap: 8px; padding: 12px; margin-bottom: 12px; border: 1px solid #e5e7eb; border-radius: 10px; }
.ap-doc:last-child { margin-bottom: 0; }
.ap-doc-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.ap-doc-name { font-size: var(--fs-body); line-height: 1.5; color: #101828; }
.ap-doc-dept { font-size: var(--fs-xs); line-height: 1.5; color: #374151; }
.ap-avail { padding: 2px 8px; border-radius: 9999px; font-size: var(--fs-xs); line-height: 1.5; white-space: nowrap; }
.ap-avail-available { background: #dcfce7; color: #008236; }
.ap-avail-busy { background: #ffe2e2; color: #c10007; }
.ap-avail-leave { background: #f3f4f6; color: #374151; }
.ap-queue { padding: 24px; border-radius: 14px; color: #fff; background: linear-gradient(149deg, #155dfc 0%, #1447e6 100%); }
.ap-queue-title { margin: 0 0 16px; font-size: var(--fs-md); line-height: 27px; font-weight: 400; }
.ap-queue-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 28px; margin-bottom: 12px; font-size: var(--fs-body); }
.ap-queue-row:last-child { margin-bottom: 0; }
.ap-queue-row > span:first-child { flex-shrink: 0; }
.ap-queue-value { min-width: 0; font-size: var(--fs-lg); line-height: 28px; text-align: right; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Dialogs: the frames' widths, header/footer rules and 10px fields. */
.ap-modal .modal-content { border: none; border-radius: 14px; }
.ap-modal .modal-header { align-items: flex-start; padding: 24px; border-bottom: 1px solid #e5e7eb; }
.ap-modal .modal-body { padding: 24px; }
.ap-modal .modal-footer { gap: 12px; padding: 24px; border-top: 1px solid #e5e7eb; flex-wrap: nowrap; }
.ap-modal .modal-footer > .btn { flex: 1; margin: 0; height: 42px; border-radius: 10px; font-size: var(--fs-base); }
.ap-modal-title { margin: 0; font-size: var(--fs-lg); line-height: 28px; font-weight: 400; color: #101828; }
.ap-modal-sub { margin: 4px 0 0; font-size: var(--fs-body); line-height: 1.5; color: #374151; }
.ap-modal-filter .modal-dialog { max-width: 448px; }
.ap-modal-form .modal-dialog { max-width: 672px; }
.ap-modal-details .modal-dialog { max-width: 768px; }
.ap-label { display: block; margin-bottom: 8px; font-size: var(--fs-base); line-height: 24px; color: #364153; }
.ap-field { width: 100%; }
.ap-field[readonly] { background: #f9fafb; color: #374151; }
textarea.ap-field { height: 90px; padding: 8px 16px; resize: vertical; }
.ap-error { margin-top: 6px; font-size: var(--fs-sm); color: #c10007; }
.ap-back { padding: 0; margin-bottom: 8px; border: none; background: none; font-size: var(--fs-body); color: #103fd3; }
.ap-btn-main { border: none; background: #103fd3; color: #fff; }
.ap-btn-main:hover, .ap-btn-main:focus { background: #0d34ad; color: #fff; }
.ap-btn-main:disabled { background: #103fd3; color: #fff; opacity: 0.65; }
.ap-btn-line { border: 1px solid #d1d5dc; background: #fff; color: #364153; }
.ap-btn-line:hover { background: #f9fafb; }

/* Option buttons (filter panel, appointment type): 2px border, blue when chosen. */
.ap-opt-group { display: flex; flex-direction: column; gap: 8px; margin-bottom: 24px; }
.ap-opt-group:last-child { margin-bottom: 0; }
.ap-opt {
  display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%;
  min-height: 52px; padding: 12px; border: 2px solid #e5e7eb; border-radius: 10px;
  background: #fff; font-size: var(--fs-base); line-height: 24px; color: #101828; text-align: left;
}
.ap-opt:hover { border-color: #bedbff; }
.ap-opt.active { border-color: #103fd3; background: #eff6ff; }
.ap-opt-main { display: flex; align-items: center; gap: 8px; min-width: 0; }
.ap-opt-main i { font-size: var(--fs-md); color: #374151; }
.ap-opt-sub { display: block; font-size: var(--fs-xs); line-height: 1.5; color: #374151; }
.ap-dot { width: 8px; height: 8px; flex-shrink: 0; border-radius: 50%; }
.ap-dot-scheduled { background: #99a1af; }
.ap-dot-waiting { background: #f0b100; }
.ap-dot-in_progress { background: #2b7fff; }
.ap-dot-completed { background: #00c950; }
.ap-dot-cancelled { background: #fb2c36; }
.ap-type { min-height: 88px; padding: 16px; }
.ap-type-title { display: block; font-size: var(--fs-md); line-height: 28px; color: #101828; }
.ap-type-desc { display: block; margin-top: 4px; font-size: var(--fs-body); line-height: 1.5; color: #374151; }

/* Patient search results under the patient field. */
.ap-results { max-height: 220px; margin-top: 4px; overflow-y: auto; border: 1px solid #e5e7eb; border-radius: 10px; }
.ap-result { display: block; width: 100%; padding: 8px 12px; border: none; border-bottom: 1px solid #f3f4f6; background: #fff; font-size: var(--fs-body); color: #101828; text-align: left; }
.ap-result:last-child { border-bottom: none; }
.ap-result:hover, .ap-result:focus { background: #eff6ff; }
.ap-result-meta { font-size: var(--fs-xs); color: #374151; }

/* Details dialog. */
.ap-who { display: flex; align-items: center; gap: 16px; padding: 20px 16px; margin-bottom: 24px; border-radius: 10px; background: #f9fafb; }
.ap-who .ap-avatar { width: 64px; height: 64px; font-size: var(--fs-xl); color: #155dfc; }
.ap-who-name { font-size: var(--fs-lg); line-height: 28px; color: #101828; overflow-wrap: anywhere; }
.ap-who-id { font-size: var(--fs-body); line-height: 1.5; color: #374151; }
.ap-section { margin: 0 0 12px; font-size: var(--fs-base); line-height: 24px; font-weight: 400; color: #101828; }
.ap-info { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-bottom: 24px; }
@media (max-width: 575.98px) { .ap-info { grid-template-columns: minmax(0, 1fr); } }
.ap-info-cell { min-height: 64px; padding: 12px; border-radius: 10px; background: #f9fafb; }
.ap-info-label { margin-bottom: 4px; font-size: var(--fs-xs); line-height: 1.5; color: #374151; }
.ap-info-value { font-size: var(--fs-body); line-height: 1.5; color: #101828; overflow-wrap: anywhere; }
.ap-note { padding: 16px; margin-bottom: 24px; border: 1px solid #bedbff; border-radius: 10px; background: #eff6ff; font-size: var(--fs-body); line-height: 1.5; color: #101828; white-space: pre-wrap; overflow-wrap: anywhere; }
.ap-note--plain { border-color: #e5e7eb; background: #f9fafb; }
.ap-vitals { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 8px; }
@media (max-width: 575.98px) { .ap-vitals { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.ap-vital { padding: 16px; border-radius: 10px; text-align: center; }
.ap-vital-label { font-size: var(--fs-xs); line-height: 1.5; }
.ap-vital-value { margin-top: 4px; font-size: var(--fs-md); line-height: 28px; color: #101828; }
.ap-vital--bp { background: #eff6ff; } .ap-vital--bp .ap-vital-label { color: #155dfc; }
.ap-vital--temp { background: #f0fdf4; } .ap-vital--temp .ap-vital-label { color: #00a63e; }
.ap-vital--pulse { background: #faf5ff; } .ap-vital--pulse .ap-vital-label { color: #9810fa; }
.ap-vital--weight { background: #fff7ed; } .ap-vital--weight .ap-vital-label { color: #f54900; }
.ap-vitals-when { margin-bottom: 0; font-size: var(--fs-xs); color: #374151; }

/* ── Medical Records (Figma "Medical Records Patient List", "Medical Records",
   "Vitals", "Visits", "Prescriptions", "Lab Results"). The list builds on
   .pm-*; the record reuses .ph-tabs (tabs), .ap-vital (vital tiles),
   .ph-pill (pills) and .pm-table (vitals history). ── */
/* List: moved from the page unchanged. */
.mr-inactive-tag {
  display: inline-block; margin-left: 8px; padding: 1px 6px; border-radius: 9999px;
  background: #f3f4f6; color: #374151; font-size: var(--fs-xs); font-weight: 500; vertical-align: 1px;
}
.mr-view-link {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 6px;
  border: none; border-radius: 6px; background: transparent;
  color: #155dfc; font-size: var(--fs-xs); white-space: nowrap; cursor: pointer;
}
.mr-view-link:hover { background: #eff6ff; }
.mr-view-link i { font-size: var(--fs-base); }
.mr-pagination { display: flex; justify-content: center; margin-top: 24px; }
.mr-pagination ul { display: flex; align-items: center; gap: 8px; list-style: none; margin: 0; padding: 0; }
.mr-page-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-width: 32px; height: 32px; padding: 0 10px; border: 1px solid #d1d5dc; border-radius: 6px;
  background: #fff; color: #364153; font-size: var(--fs-sm); text-decoration: none; cursor: pointer;
}
.mr-page-btn:hover { background: #f9fafb; color: #364153; }
.mr-page-btn.active { background: #155dfc; border-color: #155dfc; color: #fff; }
.mr-page-btn.nav { border-color: #155dfc; color: #155dfc; }
.mr-page-btn.nav.disabled { border-color: #d1d5dc; color: #99a1af; pointer-events: none; }
.mr-page-ellipsis { color: #374151; font-size: var(--fs-sm); padding: 0 2px; }
.mr-filter-dot {
  position: absolute; top: -3px; right: -3px; width: 9px; height: 9px;
  border-radius: 50%; background: #155dfc; border: 2px solid #fff;
}
.mr-search-results {
  position: absolute; top: 100%; left: 0; right: 0; z-index: 50; max-height: 320px; overflow-y: auto;
  background: #fff; border: 1px solid #e5e7eb; border-radius: 0 0 8px 8px; box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
}
.mr-search-result { display: block; width: 100%; padding: 10px 16px; border: none; border-bottom: 1px solid #f3f4f6; background: #fff; text-align: left; }
.mr-search-result:last-child { border-bottom: none; }
.mr-search-result:hover, .mr-search-result:focus { background: #f9fafb; }
.mr-requests { padding: 24px; margin-bottom: 24px; }

/* Record: header with Cancel, profile column, tabbed column. */
.mr-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 24px; }
.mr-cancel { display: inline-flex; align-items: center; gap: 6px; height: 40px; padding: 0 16px; border-radius: 10px; font-size: var(--fs-base); }
.mr-record { display: grid; grid-template-columns: 244px minmax(0, 1fr); gap: 24px; align-items: start; }
@media (max-width: 991.98px) { .mr-record { grid-template-columns: minmax(0, 1fr); } }
.mr-side, .mr-main { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.mr-card { padding: 24px; border-radius: 14px; }
.mr-card-title { margin: 0 0 12px; font-size: var(--fs-base); line-height: 24px; font-weight: 400; color: #101828; }
.mr-profile { text-align: center; }
.mr-avatar { width: 80px; height: 80px; margin: 0 auto 16px; font-size: var(--fs-3xl); }
.mr-profile-name { font-size: var(--fs-base); line-height: 24px; color: #101828; overflow-wrap: anywhere; }
.mr-profile-id { margin-bottom: 16px; font-size: var(--fs-body); line-height: 1.5; color: #374151; }
.mr-facts { display: flex; flex-direction: column; gap: 12px; text-align: left; }
.mr-fact { display: flex; justify-content: space-between; gap: 8px; font-size: var(--fs-body); line-height: 1.5; }
.mr-fact-label { color: #374151; }
.mr-fact-value { color: #101828; text-align: right; overflow-wrap: anywhere; }
.mr-box { padding: 8px 12px; border-radius: 10px; background: #f9fafb; font-size: var(--fs-body); line-height: 1.5; color: #374151; white-space: pre-wrap; overflow-wrap: anywhere; }
.mr-box--alert { background: #fef2f2; color: #c10007; }
.mr-box--warn { background: #fefce8; color: #a65f00; }
.mr-tabs { margin-bottom: 0; }
.mr-tabs .ph-tab { min-width: 0; padding: 0 8px; }
@media (max-width: 575.98px) { .mr-tabs { flex-wrap: wrap; } .mr-tabs .ph-tab { flex: 1 1 40%; } }
.mr-section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.mr-section-head .mr-card-title { margin: 0; }
.mr-empty { padding: 16px; border-radius: 10px; background: #f9fafb; text-align: center; font-size: var(--fs-body); color: #374151; }
.mr-list { display: flex; flex-direction: column; gap: 12px; }
.mr-item { padding: 16px; border: 1px solid #e5e7eb; border-radius: 10px; }
.mr-item-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.mr-item-title { font-size: var(--fs-base); line-height: 24px; color: #101828; overflow-wrap: anywhere; }
.mr-item-meta { font-size: var(--fs-xs); line-height: 1.5; color: #374151; }
.mr-field { margin-top: 12px; }
.mr-field-label { margin-bottom: 4px; font-size: var(--fs-xs); line-height: 1.5; color: #374151; }
.mr-field-value { font-size: var(--fs-body); line-height: 1.5; color: #101828; white-space: pre-wrap; overflow-wrap: anywhere; }
.mr-minivitals { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-top: 12px; }
@media (max-width: 575.98px) { .mr-minivitals { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.mr-minivital { padding: 8px; border-radius: 8px; background: #f9fafb; text-align: center; }
.mr-minivital-label { font-size: var(--fs-xs); color: #374151; }
.mr-minivital-value { font-size: var(--fs-body); color: #101828; }
.mr-med { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 12px; border-radius: 10px; background: #f9fafb; }
.mr-med-name { font-size: var(--fs-body); line-height: 1.5; color: #101828; overflow-wrap: anywhere; }
.mr-med-detail { margin-top: 2px; font-size: var(--fs-xs); line-height: 1.5; color: #374151; overflow-wrap: anywhere; }
.mr-med-pills { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 4px; flex-shrink: 0; }
.mr-pill-blue { background: #eff6ff; color: #155dfc; }
.mr-pill-purple { background: #faf5ff; color: #9810fa; }
.mr-group-title { margin: 16px 0 8px; font-size: var(--fs-body); line-height: 1.5; color: #374151; }
.mr-result { margin-top: 12px; padding: 12px; border-radius: 10px; background: #f9fafb; font-size: var(--fs-body); color: #101828; overflow-wrap: anywhere; }
.mr-result dt { font-size: var(--fs-xs); font-weight: 400; color: #374151; }
.mr-result dd { margin: 0 0 8px; }
.mr-vitals-table td, .mr-vitals-table th { white-space: nowrap; }

/* ── Ward Management (Figma "Ward Management", "Ward Details", "Add New Ward",
   "Admit Patient"; staff/ward-management.php + js/ward-management.js).
   Builds on .pm-title / .pm-stats / .pm-card / .pm-table / .em-id; only what
   those cannot express is here. Tables become stacked cards on phones. ── */
.wm-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.wm-kicker { font-size: var(--fs-xs); color: #374151; text-transform: uppercase; letter-spacing: 0.05em; }
.wm-break { overflow-wrap: anywhere; }
.wm-shrink { min-width: 0; }
.wm-back {
  display: inline-flex; align-items: center; gap: 6px; flex-shrink: 0;
  height: 36px; padding: 0 12px; border: 1px solid #d1d5dc; border-radius: 8px;
  background: #fff; color: #364153; font-size: var(--fs-body);
}
.wm-back:hover { background: #f9fafb; }
.wm-ward-name { display: inline-flex; align-items: center; gap: 8px; color: #101828; }
.wm-ward-name i { color: #1447e6; }
.wm-occupied { color: #e7000b; }
.wm-available { color: #00a63e; }
.wm-rate { display: flex; align-items: center; gap: 8px; min-width: 120px; }
.wm-rate .progress { flex: 1; height: 8px; border-radius: 4px; background: #e5e7eb; }
.wm-rate span { font-size: var(--fs-xs); color: #374151; min-width: 36px; text-align: right; }
.wm-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 12px; }
.wm-link {
  display: inline-flex; align-items: center; gap: 6px; padding: 0; border: none; background: none;
  font-size: var(--fs-body); color: #1447e6; text-decoration: none; white-space: nowrap;
}
.wm-link:hover { text-decoration: underline; }
.wm-link--muted { color: #374151; }
.wm-link--danger { color: #e7000b; }
.wm-sep { color: #d1d5dc; }
.wm-ward-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; padding: 16px; }
.wm-section-head { display: flex; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; gap: 8px; padding: 16px; }
.wm-section-title { margin: 0; font-size: var(--fs-base); font-weight: 500; color: #101828; }
.wm-legend { display: flex; flex-wrap: wrap; gap: 12px; font-size: var(--fs-xs); color: #374151; }
.wm-legend span { display: inline-flex; align-items: center; gap: 6px; }
.wm-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; }
.wm-dot--occupied { background: #ef4444; }
.wm-dot--available { background: #22c55e; }
.wm-dot--stale { background: #9ca3af; }
.wm-bed-status { display: inline-flex; align-items: center; gap: 6px; }
.wm-bed-tag { display: inline-block; padding: 2px 8px; border-radius: 6px; background: #eff6ff; color: #1447e6; font-size: var(--fs-sm); }
.wm-bed-grid-wrap { padding: 0 16px 16px; }
.wm-bed-grid { line-height: 1; }
.bed-cell { width: 20px; height: 20px; border-radius: 4px; display: inline-block; margin: 2px; }
.bed-occupied { background-color: #ef4444; }
.bed-available { background-color: #22c55e; }
.bed-stale { background-color: #9ca3af; }
@media (max-width: 991.98px) { .wm-ward-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
/* Phones, tablets and small laptops (the sidebar takes room): each table row
   becomes a card, its cells labelled from data-label, so the six-column
   patient table never scrolls sideways. */
@media (max-width: 1199.98px) {
  .wm-table thead { display: none; }
  .wm-table, .wm-table tbody, .wm-table tr, .wm-table td { display: block; width: 100%; }
  .wm-table tbody tr { padding: 8px 0; border-bottom: 1px solid #e5e7eb; }
  .wm-table tbody tr:last-child { border-bottom: none; }
  .wm-table tbody td { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 6px 16px; border-bottom: none; text-align: right; }
  .wm-table tbody td[colspan] { display: block; text-align: center; }
  .wm-table tbody td::before { content: attr(data-label); flex-shrink: 0; font-size: var(--fs-xs); color: #374151; text-align: left; }
  .wm-table tbody td[colspan]::before { content: none; }
  .wm-table .pm-cell-name, .wm-table .em-id { white-space: normal; }
  .wm-actions { justify-content: flex-end; }
  .wm-rate { min-width: 0; width: 60%; }
}

/* ── Staff Dashboard (Figma "Dashboard Home" and the role dashboards;
   staff/dashboard.php + js/dashboard.js). Moved here from the page's own
   <style> block unchanged, every selector scoped to the page's body class
   .staff-dashboard-page; then the role layout, the three-card grid and
   Upcoming Appointments. ── */
/* ── Welcome banner (Figma: blue-600 → blue-700 gradient, one shared
   translucent profile bar with 4 equal columns) ── */
.staff-dashboard-page .welcome-banner {
  background: linear-gradient(135deg, #155dfc 0%, #1447e6 100%);
  border-radius: 12px;
  padding: 24px;
  color: #fff;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
  margin-bottom: 24px;
}
.staff-dashboard-page .welcome-banner .welcome-top {
  display: flex;
  align-items: center;
  gap: 16px;
}
.staff-dashboard-page .welcome-banner .avatar-circle {
  width: 80px;
  height: 80px;
  flex-shrink: 0;
  border-radius: 50%;
  background-color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  font-size: var(--fs-3xl);
  font-weight: 400;
  color: #1447e6;
  text-transform: uppercase;
}
.staff-dashboard-page .welcome-banner .avatar-circle img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.staff-dashboard-page .welcome-banner .welcome-title {
  margin: 0 0 8px;
  font-size: var(--fs-xl);
  font-weight: 400;
  line-height: 1.25;
  color: #fff;
}
.staff-dashboard-page .welcome-banner .role-badge {
  display: inline-block;
  background-color: rgba(255, 255, 255, 0.25);
  color: #fff;
  padding: 3px 12px;
  border-radius: 9999px;
  font-size: var(--fs-xs);
  font-weight: 400;
}
.staff-dashboard-page .welcome-banner .profile-bar {
  margin-top: 24px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  padding: 12px 22px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 12px;
}
.staff-dashboard-page .welcome-banner .profile-item {
  min-width: 0;
}
/* The only intentional deviation from the Figma: a small label
   naming each value. */
.staff-dashboard-page .welcome-banner .profile-label {
  font-size: var(--fs-xs);
  color: rgba(255, 255, 255, 0.7);
  margin-bottom: 2px;
}
.staff-dashboard-page .welcome-banner .profile-value {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: var(--fs-body);
  color: #fff;
}
.staff-dashboard-page .welcome-banner .profile-value i {
  font-size: var(--fs-base);
  line-height: 1;
  flex-shrink: 0;
}
.staff-dashboard-page .welcome-banner .profile-value span {
  min-width: 0;
  overflow-wrap: anywhere;
}
/* Heading + time-range selector row (a deliberate addition beyond
   the Figma; the pills share .time-frame-* styles with reports.php). */
.staff-dashboard-page .dashboard-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 24px;
}
.staff-dashboard-page .dashboard-section-head h2 {
  margin: 0;
  font-size: var(--fs-lg);
  font-weight: 600;
  color: #101828;
}
.staff-dashboard-page .stats-grid.is-loading { opacity: 0.55; transition: opacity 0.15s ease; }
@media (max-width: 991.98px) {
  .staff-dashboard-page .welcome-banner .profile-bar { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 575.98px) {
  .staff-dashboard-page .welcome-banner .profile-bar { grid-template-columns: 1fr; }
  .staff-dashboard-page .welcome-banner .welcome-title { font-size: var(--fs-lg); }
}
/* ── Stat cards (Figma: icon top-left, change top-right, then value,
   then label) ── */
.staff-dashboard-page .stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 24px;
  margin-bottom: 24px;
}
.staff-dashboard-page .stat-card {
  background-color: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 24px;
}
.staff-dashboard-page .stat-card .stat-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.staff-dashboard-page .stat-card .stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--fs-xl);
  line-height: 1;
}
.staff-dashboard-page .stat-card .stat-icon .naira {
  font-size: var(--fs-xl);
  font-weight: 400;
}
/* The card's headline figure: the dominant element of each card.
   fitStatValues() shrinks all 4 together (never one alone) only if
   a long value, e.g. a 6-month revenue total, wouldn't fit its
   card. */
.staff-dashboard-page .stat-card .stat-value {
  margin-top: 12px;
  font-size: var(--fs-3xl);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.01em;
  color: #101828;
  white-space: nowrap;
}
.staff-dashboard-page .stat-card .stat-label {
  margin-top: 6px;
  font-size: var(--fs-body);
  color: #374151;
}
.staff-dashboard-page .stat-card .stat-change {
  font-size: var(--fs-body);
  font-weight: 500;
  color: #374151;
}
.staff-dashboard-page .stat-card .stat-change.positive { color: #00a63e; }
@media (max-width: 1199.98px) {
  .staff-dashboard-page .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
}
@media (max-width: 575.98px) {
  .staff-dashboard-page .stats-grid { grid-template-columns: 1fr; }
}
/* ── Patient Flow chart card (Figma) ── */
.staff-dashboard-page .chart-card {
  background-color: #fff;
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  border: 1px solid #e5e7eb;
  min-width: 0; /* the chart canvas must not hold its grid column open after a resize */
}
.staff-dashboard-page .chart-card .chart-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.staff-dashboard-page .chart-card .chart-title {
  margin: 0;
  font-size: var(--fs-base);
  font-weight: 500;
  color: #101828;
}
.staff-dashboard-page .chart-card .chart-subtitle {
  margin: 6px 0 0;
  font-size: var(--fs-body);
  color: #374151;
}
.staff-dashboard-page .chart-card .chart-trend {
  margin-top: 10px;
  font-size: var(--fs-md);
  line-height: 1;
  color: #00a63e;
}
.staff-dashboard-page .chart-card .chart-canvas-wrap {
  position: relative;
  height: 290px;
  margin-top: 16px;
}
.staff-dashboard-page .chart-card .chart-fallback {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #4b5563;
  font-size: var(--fs-body);
}
/* Recent Activity (Figma section 4): same card as Patient Flow; plain
   rows of status icon + actor + description + relative time. */
.staff-dashboard-page .activity-card {
  background-color: #fff;
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  border: 1px solid #e5e7eb;
  min-width: 0; /* one-line rows must not widen its grid column */
}
.staff-dashboard-page .activity-card .activity-heading {
  margin: 0;
  font-size: var(--fs-base);
  font-weight: 500;
  color: #101828;
}
.staff-dashboard-page .activity-card .activity-list {
  margin-top: 16px;
}
/* Figma: 16px above each row's content, 12px below, 1px divider;
   name/description stay on one line so 5 rows always fit the card. */
.staff-dashboard-page .activity-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px 0 12px;
  border-bottom: 1px solid #f3f4f6;
}
.staff-dashboard-page .activity-item:first-child { padding-top: 0; }
.staff-dashboard-page .activity-item:last-child { border-bottom: none; padding-bottom: 0; }
.staff-dashboard-page .activity-item .activity-icon {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--fs-base);
}
.staff-dashboard-page .activity-item .activity-icon.is-done { background: #dcfce7; color: #00a63e; }
.staff-dashboard-page .activity-item .activity-icon.is-info { background: #dbeafe; color: #155dfc; }
.staff-dashboard-page .activity-item .activity-body { flex: 1; min-width: 0; }
.staff-dashboard-page .activity-item .activity-title,
.staff-dashboard-page .activity-item .activity-text {
  overflow-wrap: anywhere;
}
.staff-dashboard-page .activity-item .activity-title {
  font-size: var(--fs-body);
  line-height: 1.5;
  font-weight: 500;
  color: #101828;
}
.staff-dashboard-page .activity-item .activity-text {
  font-size: var(--fs-xs);
  line-height: 1.5;
  color: #374151;
}
.staff-dashboard-page .activity-item .activity-time {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: var(--fs-xs);
  line-height: 1.5;
  color: #374151;
  white-space: nowrap;
}
.staff-dashboard-page .activity-item .activity-time .bi { font-size: var(--fs-xs); line-height: 1; }
.staff-dashboard-page .notification-dropdown {
  position: absolute;
  right: 0;
  margin-top: 8px;
  width: 320px;
  background-color: #fff;
  border-radius: 12px;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  border: 1px solid #e2e8f0;
  z-index: 50;
  max-height: 384px;
  overflow-y: auto;
}
.staff-dashboard-page .notification-item {
  padding: 12px 16px;
  border-bottom: 1px solid #f1f5f9;
  cursor: pointer;
  transition: background-color 0.2s ease;
}
.staff-dashboard-page .notification-item:hover { background-color: #f8fafc; }
.staff-dashboard-page .notification-item.unread { background-color: #eef2ff; }
.staff-dashboard-page .notification-item .notification-text {
  font-size: var(--fs-body);
  color: #334155;
}
.staff-dashboard-page .notification-item .notification-time {
  font-size: var(--fs-xs);
  color: #4b5563;
  margin-top: 4px;
}
.staff-dashboard-page .profile-circle {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background-color: #e0e7ff;
  color: #4f46e5;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: var(--fs-body);
  text-decoration: none;
  overflow: hidden;
}
.staff-dashboard-page .profile-circle img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
/* Patient Flow + Recent Activity side by side from 1024px (admin layout). */
.staff-dashboard-page .two-col-section {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 24px;
}
@media (min-width: 1024px) {
  .staff-dashboard-page .two-col-section { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
/* Role layout (Figma role dashboards): Recent Activity + Upcoming
   Appointments, then Patient Flow across the full width below (kept: the
   role frames leave it out, but it is a working chart these roles had). */
.staff-dashboard-page .two-col-section.is-role-layout .activity-card { order: 1; }
.staff-dashboard-page .two-col-section.is-role-layout .upcoming-card { order: 2; }
.staff-dashboard-page .two-col-section.is-role-layout .chart-card { order: 3; grid-column: 1 / -1; }
/* Three stat cards when no money is sent (every role but admin and
   manager): equal columns, the last one full width when they wrap to two. */
.staff-dashboard-page .stats-grid.is-three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 1199.98px) {
  .staff-dashboard-page .stats-grid.is-three { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .staff-dashboard-page .stats-grid.is-three > .stat-card:last-child { grid-column: 1 / -1; }
}
@media (max-width: 575.98px) {
  .staff-dashboard-page .stats-grid.is-three { grid-template-columns: 1fr; }
}
/* The Revenue card's wallet line (was an inline style). */
.staff-dashboard-page .stat-card .stat-sub {
  font-size: var(--fs-xs);
  color: #374151;
  margin-top: 4px;
}
/* Empty and unavailable messages in Recent Activity / Upcoming
   Appointments (was an inline style). */
.staff-dashboard-page .dashboard-empty {
  padding: 24px 0;
  text-align: center;
  color: #4b5563;
  font-size: var(--fs-body);
}
/* Upcoming Appointments (Figma role dashboards): the same card as Recent
   Activity; 64px rows on gray-50, 16px apart, a 40px blue icon circle,
   name / "doctor • type" / time on the right. */
.staff-dashboard-page .upcoming-card {
  background-color: #fff;
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  border: 1px solid #e5e7eb;
  min-width: 0;
}
.staff-dashboard-page .upcoming-card .upcoming-heading {
  margin: 0;
  font-size: var(--fs-base);
  font-weight: 500;
  color: #101828;
}
.staff-dashboard-page .upcoming-list {
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.staff-dashboard-page .upcoming-item {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 64px;
  padding: 12px;
  background-color: #f9fafb;
  border-radius: 10px;
}
.staff-dashboard-page .upcoming-item .upcoming-icon {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #dbeafe;
  color: #155dfc;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--fs-md);
}
.staff-dashboard-page .upcoming-item .upcoming-body { flex: 1; min-width: 0; }
.staff-dashboard-page .upcoming-item .upcoming-name,
.staff-dashboard-page .upcoming-item .upcoming-meta {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.staff-dashboard-page .upcoming-item .upcoming-name {
  font-size: var(--fs-body);
  line-height: 1.5;
  font-weight: 500;
  color: #101828;
}
.staff-dashboard-page .upcoming-item .upcoming-meta {
  font-size: var(--fs-xs);
  line-height: 1.5;
  color: #374151;
}
.staff-dashboard-page .upcoming-item .upcoming-time {
  flex-shrink: 0;
  font-size: var(--fs-body);
  line-height: 1.5;
  color: #101828;
  white-space: nowrap;
}

/* ── Laboratory (Figma "Laboratory" and "Filter Lab Tests"; staff/laboratory.php +
   js/laboratory.js). Builds on .pm-title / .pm-stats / .pm-card / .pm-search-row /
   .pm-filter-btn / .pm-table / .pm-action; the page's former inline styles (status
   badges, pagination, patient search) are here, scoped to .staff-lab-page. Figma's
   eight-column table with text action buttons, kept as a table from 1100px up
   (fixed layout: long names wrap inside their column); below that each row
   becomes a labelled card. The tab bar is left out: Test Management is not on
   this page, and one tab alone would be a dead control. ── */
.staff-lab-page .lab-content { padding: 0 24px 24px; }
.staff-lab-page .lab-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.staff-lab-page .lab-shrink { min-width: 0; }
.staff-lab-page .lab-break { overflow-wrap: anywhere; }
.staff-lab-page .pm-filter-btn i { font-size: var(--fs-base); color: #374151; }
.staff-lab-page .lab-filter-dot {
  position: absolute; top: 6px; right: 6px; width: 8px; height: 8px;
  border-radius: 50%; background: #1447e6;
}
/* Status pill with its icon (Figma); the page's colours. */
.staff-lab-page .badge-status {
  display: inline-flex; align-items: center; gap: 4px; font-size: var(--fs-xs); font-weight: 500;
  padding: 0.3em 0.65em; border-radius: 9999px; white-space: nowrap;
}
.staff-lab-page .badge-status .bi { font-size: var(--fs-xs); line-height: 1; }
.staff-lab-page .badge-pending { background-color: #fef3c7; color: #92400e; border: 1px solid #fde68a; }
.staff-lab-page .badge-processing { background-color: #dbeafe; color: #1d4ed8; border: 1px solid #bfdbfe; }
.staff-lab-page .badge-completed { background-color: #dcfce7; color: #15803d; border: 1px solid #bbf7d0; }

/* Table (Figma column proportions; fixed layout, so nothing can push it wider
   than its card). */
.staff-lab-page .lab-table { table-layout: fixed; }
.staff-lab-page .lab-col-id { width: 10%; }
.staff-lab-page .lab-col-test { width: 16%; }
.staff-lab-page .lab-col-patient { width: 14.5%; }
.staff-lab-page .lab-col-doctor { width: 11%; }
.staff-lab-page .lab-col-date { width: 10.5%; }
.staff-lab-page .lab-col-payment { width: 12.5%; }
.staff-lab-page .lab-col-status { width: 11.5%; }
.staff-lab-page .lab-col-actions { width: 14%; }
.staff-lab-page .lab-table thead th { padding: 12px 8px; white-space: normal; vertical-align: middle; }
.staff-lab-page .lab-table tbody td { padding: 14px 8px; vertical-align: middle; }
.staff-lab-page .lab-table .lab-cell { min-width: 0; }
.staff-lab-page .lab-table .lab-ellipsis .lab-cell { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.staff-lab-page .lab-table .lab-cell-name { color: #101828; overflow-wrap: break-word; }
/* A long test name: three lines at most, the whole name in its tooltip. */
.staff-lab-page .lab-table td[data-label="Test Name"] .lab-cell-name {
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.staff-lab-page .lab-table .lab-cell-sub { font-size: var(--fs-xs); color: #374151; margin-top: 2px; overflow-wrap: break-word; }
.staff-lab-page .lab-table .lab-wrap { white-space: normal; overflow-wrap: break-word; }
/* Payment Status: the pill, the amount under it, the receipt number. */
.staff-lab-page .lab-pay { display: flex; flex-wrap: wrap; gap: 4px; }
.staff-lab-page .lab-pay-pill {
  display: inline-flex; align-items: center; gap: 4px; max-width: 100%;
  padding: 3px 8px; border-radius: 12px; font-size: var(--fs-xs); font-weight: 500; line-height: 1.5;
}
.staff-lab-page .lab-pay-pill .bi { font-size: var(--fs-xs); line-height: 1; flex-shrink: 0; }
.staff-lab-page .lab-pay--paid { background: #dcfce7; color: #008236; }
.staff-lab-page .lab-pay--unpaid { background: #ffe2e2; color: #c10007; }
.staff-lab-page .lab-pay--emergency { background: #ffedd4; color: #9f2d00; }
.staff-lab-page .lab-pay--covered { background: #dbeafe; color: #1447e6; }
.staff-lab-page .lab-pay--legacy { background: #e5e7eb; color: #364153; }
.staff-lab-page .lab-amount { margin-top: 4px; color: #374151; }
.staff-lab-page .lab-receipt { font-size: var(--fs-xs); line-height: 1.3; margin-top: 2px; overflow-wrap: anywhere; }
.staff-lab-page .lab-receipt .text-nowrap { white-space: normal !important; font-size: inherit !important; }
/* Actions: Figma's small text buttons, then the details and delete icons. */
.staff-lab-page .lab-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.staff-lab-page .lab-btn {
  display: inline-flex; align-items: center; gap: 5px; max-width: 100%;
  min-height: 26px; padding: 3px 10px; border: 1px solid transparent; border-radius: 6px;
  font-size: var(--fs-xs); font-weight: 500; line-height: 1.5; text-align: left; white-space: normal; cursor: pointer;
}
.staff-lab-page .lab-btn .bi { font-size: var(--fs-xs); line-height: 1; flex-shrink: 0; }
.staff-lab-page .lab-btn--start { background: #1447e6; color: #fff; }
.staff-lab-page .lab-btn--start:hover { background: #193cb8; }
.staff-lab-page .lab-btn--upload { background: #00a63e; color: #fff; }
.staff-lab-page .lab-btn--upload:hover { background: #008236; }
.staff-lab-page .lab-btn--view { background: #fff; border-color: #d1d5dc; color: #364153; }
.staff-lab-page .lab-btn--view:hover { background: #f9fafb; }
.staff-lab-page .lab-btn--blocked, .staff-lab-page .lab-btn--blocked:disabled { background: #f3f4f6; border-color: #e5e7eb; color: #6a7282; cursor: not-allowed; opacity: 1; }
.staff-lab-page .lab-btn--emergency { background: #fff; border-color: #ffa2a2; color: #c10007; }
.staff-lab-page .lab-btn--emergency:hover { background: #fef2f2; }
.staff-lab-page .lab-btn:focus-visible { outline: 2px solid #3b82f6; outline-offset: 1px; }
.staff-lab-page .lab-tip { display: inline-flex; max-width: 100%; cursor: not-allowed; }
.staff-lab-page .lab-icons { display: inline-flex; align-items: center; gap: 2px; }
.staff-lab-page .lab-icons .pm-action { color: #374151; }
.staff-lab-page .lab-icons .lab-action--danger { color: #e7000b; }
.staff-lab-page .lab-pagination {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px;
  padding: 12px 16px; border-top: 1px solid #e5e7eb;
}
.staff-lab-page .page-link { min-width: 36px; text-align: center; }
/* Test Details: the round test icon. */
.staff-lab-page .lab-detail-icon {
  width: 56px; height: 56px; flex-shrink: 0; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: #eff6ff; color: #155dfc; font-size: var(--fs-xl);
}
/* Filter Lab Tests (Figma 448px dialog): one bordered row per status. */
.staff-lab-page .lab-filter-dialog { max-width: 448px; }
.staff-lab-page .lab-filter-label { font-size: var(--fs-body); font-weight: 500; color: #101828; margin-bottom: 12px; }
.staff-lab-page .lab-filter-options { display: flex; flex-direction: column; gap: 12px; }
.staff-lab-page .lab-filter-option {
  display: flex; align-items: center; gap: 12px; margin: 0; padding: 12px 16px;
  border: 1px solid #e5e7eb; border-radius: 8px; font-size: var(--fs-body); color: #101828; cursor: pointer;
}
.staff-lab-page .lab-filter-option:hover { background: #f9fafb; }
.staff-lab-page .lab-filter-option:has(input:checked) { border-color: #1447e6; background: #eff6ff; }
.staff-lab-page .lab-filter-option input { width: 16px; height: 16px; accent-color: #1447e6; }
/* Add Test: the patient search list (the page's own, unchanged). */
.staff-lab-page .patient-search-results {
  position: absolute; top: 100%; left: 0; right: 0; background: white;
  border: 1px solid #dee2e6; border-top: none; border-radius: 0 0 0.375rem 0.375rem;
  max-height: 200px; overflow-y: auto; z-index: 1050; display: none;
}
.staff-lab-page .patient-search-results.show { display: block; }
.staff-lab-page .patient-search-item { padding: 8px 12px; cursor: pointer; font-size: var(--fs-body); }
.staff-lab-page .patient-search-item:hover { background-color: #f8f9fa; }
.staff-lab-page .patient-search-item .text-muted { font-size: var(--fs-xs); }
/* Laptops from 1100px to 1439px: the page's side padding goes (the main area
   keeps its own) and the table text is a size smaller, so the eight columns
   keep room beside the 256px sidebar. */
@media (max-width: 1439.98px) {
  .staff-lab-page .lab-content { padding: 0 0 24px; }
  .staff-lab-page .lab-table tbody td { font-size: var(--fs-sm); padding: 12px 6px; }
  .staff-lab-page .lab-table thead th { padding: 12px 6px; font-size: var(--fs-xs); }
}
/* 1100px to 1279px: Status takes a little from Actions (whose buttons wrap)
   so a one-word status pill always fits its column. */
@media (max-width: 1279.98px) {
  .staff-lab-page .lab-col-test { width: 14.5%; }
  .staff-lab-page .lab-col-status { width: 13%; }
  .staff-lab-page .lab-col-actions { width: 14%; }
  .staff-lab-page .lab-btn { padding: 3px 6px; gap: 3px; }
  .staff-lab-page .badge-status { font-size: var(--fs-xs); padding: 2px 6px; gap: 3px; }
  .staff-lab-page .badge-status .bi { font-size: var(--fs-xs); }
}
@media (max-width: 575.98px) {
  .staff-lab-page .pm-search-row { flex-wrap: wrap; }
}
/* Below 1100px (tablets, phones) each row becomes a card, its cells labelled
   from data-label; the text buttons work the same there. */
@media (max-width: 1099.98px) {
  .staff-lab-page .lab-table { table-layout: auto; }
  .staff-lab-page .lab-table colgroup, .staff-lab-page .lab-table thead { display: none; }
  .staff-lab-page .lab-table, .staff-lab-page .lab-table tbody, .staff-lab-page .lab-table tr, .staff-lab-page .lab-table td { display: block; width: 100%; }
  .staff-lab-page .lab-table tbody tr { padding: 8px 0; border-bottom: 1px solid #e5e7eb; }
  .staff-lab-page .lab-table tbody tr:last-child { border-bottom: none; }
  .staff-lab-page .lab-table tbody td { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 6px 16px; border-bottom: none; text-align: right; font-size: var(--fs-body); }
  .staff-lab-page .lab-table tbody td::before { content: attr(data-label); flex-shrink: 0; font-size: var(--fs-xs); color: #374151; text-align: left; }
  .staff-lab-page .lab-table tbody td > .lab-cell { min-width: 0; overflow-wrap: anywhere; }
  .staff-lab-page .lab-table .lab-ellipsis .lab-cell { white-space: normal; }
  .staff-lab-page .lab-pay, .staff-lab-page .lab-actions { justify-content: flex-end; }
  .staff-lab-page .lab-table td[data-label="Test Name"] .lab-cell-name { display: block; -webkit-line-clamp: unset; }
}

/* ── Legal documents and consents ──────────────────────────────────────
   /privacy and /terms (partials/legal-page.php), the consent screen
   (consent.php) and the consent boxes of the registration forms. A
   [PLACEHOLDER] not yet filled in from Settings reads as plain text: nothing
   on the website is highlighted. */
.legal-placeholder { background: transparent; color: inherit; padding: 0; }
.legal-page { padding: 40px 0 56px; background: #f9fafb; }
.legal-doc { max-width: 820px; margin: 0 auto; background: #fff; border: 1px solid #e5e7eb; border-radius: 12px; padding: 32px 40px; }
.legal-title { font-size: var(--fs-3xl); font-weight: 700; color: #111827; margin-bottom: 4px; }
.legal-meta { font-size: var(--fs-sm); color: #374151; margin-bottom: 24px; }
.legal-body { font-size: var(--fs-base); line-height: 1.65; color: #1f2937; overflow-wrap: anywhere; }
.legal-body h3 { font-size: var(--fs-lg); font-weight: 600; color: #111827; margin: 28px 0 10px; }
.legal-body ul, .legal-body ol { padding-left: 1.25rem; }
.legal-body li { margin-bottom: 6px; }
.legal-other { font-size: var(--fs-body); color: #374151; margin: 28px 0 0; padding-top: 16px; border-top: 1px solid #e5e7eb; }
@media (max-width: 575.98px) {
  .legal-page { padding: 16px 0 32px; }
  .legal-doc { padding: 20px 16px; border-radius: 8px; }
  .legal-title { font-size: var(--fs-2xl); }
}
.consent-box { border: 1px solid #e5e7eb; border-radius: 8px; padding: 12px 14px; margin-bottom: 10px; background: #fff; }
.consent-box .form-check { margin-bottom: 0; }
.consent-box .form-check-label { font-size: var(--fs-body); line-height: 1.5; color: #1f2937; }
.consent-box .form-check-label p { margin: 0; display: inline; }
.consent-box .consent-required { color: #dc2626; font-size: 0.875rem; font-weight: 600; margin-left: 4px; }
.consent-links { font-size: var(--fs-sm); color: #374151; margin-bottom: 10px; }
.legal-links { font-size: var(--fs-xs); padding: 8px 16px; display: flex; gap: 12px; flex-wrap: wrap; }
.legal-links a { color: #374151; text-decoration: none; }
.legal-links a:hover { color: #103fd3; text-decoration: underline; }
/* In the sidebars: a quiet footer row under Settings and Logout, not more menu items. */
/* The text starts where the icons above it start: 32px in from the edge for staff, 24px for patients. */
.sidebar-legal { justify-content: flex-start; align-items: center; flex-wrap: nowrap; gap: 0; margin: 4px 16px 12px; padding: 12px 0 0 16px; border-top: 1px solid #f1f5f9; }
.patient-portal .sidebar-legal { margin-left: 12px; margin-right: 12px; padding-left: 12px; }
.sidebar-legal a { color: #6b7280; }
.sidebar-legal a + a::before { content: "\00B7"; display: inline-block; margin: 0 10px; color: #cbd5e1; font-weight: 700; }
.consent-page { min-height: 100vh; background: #f9fafb; padding: 32px 16px; }
.consent-card { max-width: 760px; margin: 0 auto; background: #fff; border: 1px solid #e5e7eb; border-radius: 12px; padding: 28px 32px; }
.consent-card h1 { font-size: var(--fs-2xl); font-weight: 700; color: #111827; margin-bottom: 4px; }
.consent-card .consent-text { font-size: var(--fs-base); line-height: 1.6; color: #1f2937; max-height: 52vh; overflow-y: auto; border: 1px solid #e5e7eb; border-radius: 8px; padding: 16px 18px; margin: 16px 0; background: #fcfcfd; }
.consent-card .consent-text ol { padding-left: 1.25rem; }
.consent-card .consent-text li { margin-bottom: 8px; }
@media (max-width: 575.98px) {
  .consent-page { padding: 12px 0; }
  .consent-card { padding: 20px 16px; border-radius: 0; border-left: 0; border-right: 0; }
  .consent-card .consent-text { max-height: none; }
}

/* ── Patient pages on phones (public/patient/*.php) ── */

/* Page-header action (Appointments' "Book Appointment"): full width under
   the title, instead of squeezed beside it and past the screen edge. */
@media (max-width: 575.98px) {
  .patient-page-action {
    width: 100%;
  }
}

/* Payments summary boxes: icon above the label, and long amounts wrap,
   so "Total Spent ₦6,620.40" is never cut off. */
.pay-stat > div:last-child {
  min-width: 0;
}

@media (max-width: 1199.98px) {
  .pay-stat {
    flex-direction: column;
    align-items: flex-start !important;
    gap: 8px !important;
  }

  .pay-stat .fw-bold {
    overflow-wrap: anywhere;
  }
}

/* Invoices and Tests tables: below 576px each row becomes a card. The
   first cell (.stack-title) is its heading, every other cell shows its
   column name from data-label, and the buttons (.stack-actions) sit
   along the bottom, so Status and View are never off-screen. */
@media (max-width: 575.98px) {
  .table-stack thead {
    display: none;
  }

  .table-stack,
  .table-stack tbody,
  .table-stack tr,
  .table-stack td {
    display: block;
    width: 100%;
  }

  .table-stack tr {
    padding: 14px 16px;
    border-bottom: 1px solid #e2e8f0;
  }

  .table-stack td {
    padding: 4px 0 !important;
    border: 0;
  }

  .table-stack td[data-label] {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    text-align: right;
  }

  .table-stack td[data-label]::before {
    content: attr(data-label);
    flex-shrink: 0;
    color: #374151;
    font-size: var(--fs-xs);
    font-weight: 600;
    text-align: left;
  }

  .table-stack td.stack-title {
    padding-bottom: 8px !important;
  }

  .table-stack td.stack-actions {
    padding-top: 10px !important;
    text-align: left !important;
  }

  .table-stack td.stack-actions > div {
    justify-content: flex-start !important;
  }
}

/* Settings: below 768px the three tabs (My Profile, Notifications,
   Security) sit in one row above the content; patient/settings.php adds
   .is-row. */
#settingsSidebarWrap.is-row > div {
  display: flex;
  gap: 6px;
  padding: 6px !important;
}

#settingsSidebarWrap.is-row .settings-tab-btn {
  flex: 1 1 0;
  flex-direction: column;
  justify-content: center;
  gap: 6px !important;
  margin-top: 0 !important;
  padding: 10px 4px !important;
  text-align: center !important;
  font-size: var(--fs-xs);
}

/* Settings profile summary: avatar above the text on phones. */
@media (max-width: 575.98px) {
  .profile-summary {
    flex-direction: column;
    text-align: center;
    gap: 12px !important;
  }
}

/* ── Staff data tables on phones (labelled by js/staff-layout.js) ──
   Below 576px each row is a card: one line per cell, the column heading on
   the left (data-label) and the value on the right. Cells with no heading
   (usually the buttons) span the card. A full-width cell (an empty-state
   message, colspan) is centred. */
@media (max-width: 575.98px) {
  .table-autostack thead {
    display: none;
  }

  .table-autostack,
  .table-autostack tbody,
  .table-autostack tr,
  .table-autostack td {
    display: block;
    width: 100% !important;
  }

  .table-autostack tbody tr {
    padding: 12px 16px;
    border-bottom: 1px solid #e2e8f0;
  }

  .table-autostack tbody tr:last-child {
    border-bottom: 0;
  }

  .table-autostack tbody td {
    padding: 5px 0 !important;
    border: 0 !important;
    white-space: normal !important;
    overflow-wrap: anywhere;
    text-align: left;
  }

  /* Label in the left column; everything in the cell stacked, right
     aligned, in the right column (a name above its ID, an email above a
     phone number). */
  .table-autostack tbody td[data-label] {
    display: grid;
    grid-template-columns: fit-content(40%) minmax(0, 1fr);
    column-gap: 12px;
    align-items: center;
    text-align: right;
  }

  .table-autostack tbody td[data-label]::before {
    content: attr(data-label);
    grid-column: 1;
    grid-row: 1 / span 4;
    color: #374151;
    font-size: var(--fs-xs);
    font-weight: 600;
    text-align: left;
    text-transform: none;
    letter-spacing: 0;
  }

  .table-autostack tbody td[data-label] > * {
    grid-column: 2;
    justify-self: end;
    min-width: 0;
    max-width: 100%;
  }

  .table-autostack tbody td[data-label] * {
    white-space: normal !important;
    overflow-wrap: anywhere;
  }

  .table-autostack tbody td[data-label] > input,
  .table-autostack tbody td[data-label] > select {
    justify-self: stretch;
  }

  .table-autostack tbody td.autostack-full {
    display: block;
    text-align: center;
  }

  .table-autostack tbody tr:hover td {
    background: transparent;
  }
}

/* ── Phones: nothing cut off, nothing broken mid-word ── */
@media (max-width: 575.98px) {
/* Wallet balance scales down so a long amount stays on one line */
  #balanceDisplay {
    font-size: clamp(1.25rem, 6.5vw, var(--fs-2xl)) !important;
  }
}

/* Small phones (320 to 379px): the header keeps the profile circle on screen,
   and two-column summary tiles go to one column so amounts stay whole. */
@media (max-width: 379.98px) {
  .main-header {
    padding: 0 8px;
  }

  .main-header .logo {
    height: 28px;
  }

  .main-header .btn-link {
    padding-left: 4px;
    padding-right: 4px;
  }

  .main-header > div:last-child {
    gap: 4px !important;
  }

  .main-header a > .border-start {
    border-left: 0 !important;
    padding-left: 0 !important;
  }

.col-6:has(> .pay-stat),
  .col-6:has(> .stat-card),
  .col-6:has(> .border.rounded-3 > small) {
    flex: 0 0 100%;
    width: 100%;
    max-width: 100%;
  }
}

/* ── Staff > Consultation (staff/consultation.php). Built on the Medical Records
   layout (.mr-*) and the appointment form controls (.ap-*). ── */
.cs-field { margin-bottom: 16px; min-width: 0; }
.cs-textarea { height: auto; padding: 10px 14px; line-height: 1.5; resize: vertical; }
.cs-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; }
.cs-grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cs-follow { margin-bottom: 16px; }
.cs-follow-date { max-width: 240px; margin-top: 12px; }
.cs-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px; margin-top: 8px; }
.cs-actions .ap-btn { height: 42px; padding: 0 16px; display: inline-flex; align-items: center; }
.cs-saved { margin-right: auto; color: #008236; font-size: var(--fs-sm); }
.cs-saved i { margin-right: 6px; }
.cs-record-link { display: inline-flex; align-items: center; gap: 6px; margin-top: 16px; color: #155dfc; font-size: var(--fs-body); text-decoration: none; }
.cs-record-link:hover { text-decoration: underline; }
.cs-when { color: #374151; font-size: var(--fs-sm); }
.cs-allergy { margin-bottom: 16px; }
.cs-drug-search { position: relative; }
.cs-drug-option { display: flex; align-items: center; justify-content: space-between; gap: 12px; text-align: left; }
.cs-drug-option:disabled { background: #f9fafb; cursor: not-allowed; }
.cs-drug-option:disabled .cs-drug-name { color: #374151; }
.cs-drug-name { min-width: 0; color: #101828; overflow-wrap: anywhere; }
.cs-drug-meta { flex-shrink: 0; color: #374151; font-size: var(--fs-sm); }
.cs-drug-blocked { color: #c10007; }
.cs-chosen { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 12px; padding: 12px 14px; margin-bottom: 16px; border: 1px solid #bedbff; border-radius: 10px; background: #eff6ff; color: #101828; }
.cs-chosen span { color: #374151; font-size: var(--fs-sm); }
.cs-line-end { display: flex; flex-shrink: 0; align-items: center; gap: 8px; color: #101828; font-size: var(--fs-body); }
.cs-total { display: flex; justify-content: space-between; gap: 12px; padding: 12px 0; margin-bottom: 16px; border-bottom: 1px solid #e5e7eb; color: #101828; }
.cs-hint { margin: 0 0 8px; color: #374151; font-size: var(--fs-sm); }
.cs-sent + .cs-sent { padding-top: 16px; margin-top: 16px; border-top: 1px solid #e5e7eb; }
#draftWrap { margin-top: 24px; padding-top: 16px; border-top: 1px solid #e5e7eb; }

@media (max-width: 767.98px) {
  .cs-grid, .cs-grid--3 { grid-template-columns: minmax(0, 1fr); }
  .cs-follow-date { max-width: none; }
}

@media (max-width: 575.98px) {
  .cs-actions .ap-btn { flex: 1 1 auto; justify-content: center; }
  .cs-drug-option { flex-direction: column; align-items: flex-start; gap: 2px; }
}
