/* ============================================================
   MOFATE OneHealth - custom stylesheet (no Tailwind/DaisyUI)
   ============================================================ */

:root {
  --primary: #0EA5E9;
  --primary-light: #38BDF8;
  --primary-dark: #0284C7;
  --primary-soft: #E0F2FE;
  --secondary: #22C55E;
  --secondary-soft: #DCFCE7;
  --accent: #D97706;
  --accent-soft: #FEF3E2;
  --danger: #DC2626;
  --success: #22C55E;
  --warning: #D97706;
  --background: #FFFFFF;
  --surface: #FFFFFF;
  --surface-2: #F6F8F7;
  --border: #E5E8E6;
  --text: #16221C;
  --text-secondary: #5C6C64;
  --text-muted: #97A49D;
  --sidebar-width: 264px;
  --radius: 18px;
  --shadow: 0 1px 2px rgba(41, 37, 28, 0.04), 0 6px 20px rgba(64, 56, 40, 0.06);
  --shadow-lg: 0 24px 48px -12px rgba(52, 44, 30, 0.18);
  --shadow-glow: 0 10px 24px rgba(14, 165, 233, 0.28);
  --ring: 0 0 0 4px rgba(14, 165, 233, 0.15);
  --ease-out-soft: cubic-bezier(0.16, 1, 0.3, 1);
  --green-50: #F0FDF4;
  --green-100: #DCFCE7;
  --green-600: #22C55E;
  --green-700: #16A34A;
  --blue-400: #60A5FA;
  --blue-500: #3B82F6;
  --blue-600: #2563EB;
  --blue-50: #EFF6FF;
  --amber-400: #FBBF24;
  --amber-500: #F59E0B;
  --amber-600: #D97706;
  --amber-50: #FFFBEB;
  --red-400: #F87171;
  --red-500: #EF4444;
  --red-600: #DC2626;
  --red-50: #FEF2F2;
  --indigo-400: #818CF8;
  --indigo-500: #6366F1;
  --purple-600: #9333EA;
  --purple-50: #FAF5FF;
  --rose-500: #F43F5E;
  --rose-50: #FFF1F2;
  --cyan-400: #22D3EE;
  --orange-400: #FB923C;
  --gray-100: #F3F4F6;
  --gray-200: #E5E7EB;
  --gray-300: #D1D5DB;
  --gray-400: #9CA3AF;
  --gray-500: #6B7280;
  --gray-600: #4B5563;
  --gray-700: #374151;
  --gray-800: #1F2937;
  --gray-900: #111827;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--background);
  color: var(--text);
  font-size: 15px;
  line-height: 1.6;
  letter-spacing: -0.006em;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4, h5 { margin: 0; font-weight: 700; line-height: 1.25; }

button { font-family: inherit; cursor: pointer; }

/* ============ Layout ============ */

.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  min-height: 100vh;
}

.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 1.25rem 0.9rem;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--sidebar-width);
  overflow-y: auto;
  z-index: 50;
  display: flex;
  flex-direction: column;
}

.sidebar .brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0 0.5rem 1rem;
}

.sidebar .brand img { height: 2.2rem; }

.sidebar .brand .brand-name {
  font-size: 1.1rem;
  font-weight: 800;
  line-height: 1.1;
  color: var(--primary);
}

.sidebar .brand .brand-sub {
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--gray-400);
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.68rem 0.9rem;
  border-radius: 0.8rem;
  color: var(--text-secondary);
  font-weight: 500;
  text-decoration: none;
  transition: background 0.25s var(--ease-out-soft), color 0.25s ease, transform 0.25s var(--ease-out-soft);
  width: 100%;
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 0.92rem;
  text-align: left;
  margin-bottom: 0.15rem;
}

.nav-link:hover { background: var(--green-50); color: var(--primary); text-decoration: none; transform: translateX(2px); }
.nav-link.active { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.nav-link:focus-visible { outline: none; box-shadow: var(--ring); }

.nav-link .nav-badge {
  margin-left: auto;
  font-size: 0.7rem;
  padding: 0.1rem 0.5rem;
  border-radius: 9999px;
  background: var(--warning);
  color: #fff;
}

.sidebar .sidebar-footer { margin-top: auto; padding-top: 1rem; border-top: 1px solid var(--border); }

.sidebar-footer-user {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 0.65rem;
  border-radius: 0.9rem;
  background: var(--surface-2);
}

.sidebar-footer-user .u-name { font-size: 0.85rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-footer-user .u-role { font-size: 0.72rem; color: var(--gray-400); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.main-region {
  grid-column: 1 / -1;
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 0.7rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.page-title { font-size: 1.15rem; font-weight: 700; }

.main-content { padding: 1.5rem; flex: 1; }

/* ============ Buttons ============ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.55rem 1.1rem;
  border-radius: 0.8rem;
  border: 1px solid transparent;
  font-weight: 600;
  font-size: 0.9rem;
  line-height: 1.4;
  transition: transform 0.2s var(--ease-out-soft), box-shadow 0.25s ease, background 0.25s ease, border-color 0.25s ease, color 0.25s ease;
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
  white-space: nowrap;
}

.btn:hover { box-shadow: var(--shadow); text-decoration: none; }
.btn:active { transform: translateY(1px) scale(0.99); }
.btn:focus-visible { outline: none; box-shadow: var(--ring); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); box-shadow: var(--shadow-glow); }

.btn-secondary { background: var(--secondary); color: #fff; }

.btn-success { background: var(--success); color: #fff; }

.btn-error { background: var(--danger); color: #fff; }

.btn-ghost { background: transparent; color: var(--text-secondary); border-color: transparent; }
.btn-ghost:hover { background: var(--gray-100); color: var(--text); }

.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--text-secondary); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); background: var(--green-50); }

.btn-sm { padding: 0.35rem 0.75rem; font-size: 0.82rem; border-radius: 0.5rem; }
.btn-xs { padding: 0.25rem 0.55rem; font-size: 0.75rem; border-radius: 0.4rem; }
.btn-circle { padding: 0; width: 2.25rem; height: 2.25rem; border-radius: 9999px; justify-content: center; }
.btn-sm.btn-circle { width: 1.8rem; height: 1.8rem; }

.btn-block { width: 100%; }

/* ============ Forms ============ */

.form-label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 0.35rem;
}

.input, .textarea, .select {
  width: 100%;
  padding: 0.62rem 0.85rem;
  border: 1px solid #D8D3C6;
  border-radius: 0.75rem;
  background: var(--surface);
  color: var(--text);
  font-size: 0.92rem;
  font-family: inherit;
  transition: border-color 0.2s ease, box-shadow 0.25s ease;
}

.input:focus, .textarea:focus, .select:focus {
  outline: none;
  border-color: var(--primary-light);
  box-shadow: var(--ring);
}

.input:disabled { background: var(--gray-100); color: var(--gray-500); cursor: not-allowed; }
.textarea { resize: vertical; }

.input-sm { padding: 0.3rem 0.6rem; font-size: 0.82rem; }
.select-sm { padding: 0.3rem 0.6rem; font-size: 0.82rem; }

.input-lg { padding: 0.75rem 1rem; font-size: 1rem; }

/* Password visibility toggle */
.input-wrap { position: relative; }
.input-wrap .input { padding-right: 2.85rem; }
.password-toggle {
  position: absolute; top: 50%; right: 0.6rem; transform: translateY(-50%);
  width: 2rem; height: 2rem; border: none; background: transparent;
  color: var(--text-muted, #6B7280); cursor: pointer; border-radius: 0.5rem;
  display: inline-flex; align-items: center; justify-content: center;
  transition: color 0.15s ease, background 0.15s ease;
}
.password-toggle:hover { color: var(--text); background: var(--gray-100, #F3F4F6); }
.password-toggle:focus-visible { outline: none; box-shadow: var(--ring); }

/* ============ Cards ============ */

.dashboard-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1.35rem 1.55rem;
  box-shadow: var(--shadow);
  border: 1px solid rgba(58, 50, 34, 0.06);
}

.stat-card { position: relative; }
.stat-card .stat-label { font-size: 0.82rem; color: var(--text-secondary); font-weight: 600; letter-spacing: 0.01em; }
.stat-card .stat-value { font-size: 1.9rem; font-weight: 800; margin-top: 0.25rem; letter-spacing: -0.02em; }
.stat-icon {
  position: absolute;
  top: 1.1rem;
  right: 1.1rem;
  font-size: 1.4rem;
  opacity: 0.5;
}

/* ============ Badges / chips ============ */

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  background: var(--gray-100);
  color: var(--text-secondary);
  font-size: 0.75rem;
  font-weight: 600;
  border: 1px solid transparent;
}

.chip-active { background: var(--primary-soft); color: var(--primary); border-color: var(--primary-light); }

.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.6rem;
  border-radius: 9999px;
  font-size: 0.72rem;
  font-weight: 700;
  background: var(--gray-200);
  color: var(--text-secondary);
}

.badge-warning { background: var(--amber-50); color: var(--amber-600); }

.status-badge {
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
  display: inline-block;
  white-space: nowrap;
}

.status-pending { background: #FEF3C7; color: #92400E; }
.status-accepted { background: #D1FAE5; color: #065F46; }
.status-rejected { background: #FEE2E2; color: #991B1B; }
.status-cancelled { background: #F3F4F6; color: #4B5563; }
.status-in_transit { background: #DBEAFE; color: #1E40AF; }
.status-arrived { background: #EDE9FE; color: #5B21B6; }
.status-treated { background: #FCE7F3; color: #9D174D; }
.status-completed { background: #D1FAE5; color: #065F46; }
.status-offline_pending { background: #E5E7EB; color: #374151; }

.urgency-emergency { background: #FEE2E2; color: #991B1B; animation: pulse-soft 2s infinite; }
.urgency-urgent { background: #FEF3C7; color: #92400E; }
.urgency-routine { background: #E0E7FF; color: #3730A3; }

@keyframes pulse-soft { 0%, 100% { opacity: 1; } 50% { opacity: 0.55; } }

.presence-dot {
  display: inline-block;
  width: 0.6rem;
  height: 0.6rem;
  border-radius: 9999px;
  flex-shrink: 0;
}

.avatar-circle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.2rem;
  height: 2.2rem;
  border-radius: 9999px;
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 700;
  flex-shrink: 0;
}

.status-dot { display: inline-block; width: 0.6rem; height: 0.6rem; border-radius: 9999px; }

/* ============ Tables ============ */

.table { width: 100%; border-collapse: collapse; }
.table th {
  text-align: left;
  padding: 0.65rem 0.8rem;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--gray-500);
  border-bottom: 1px solid var(--gray-200);
  background: var(--surface-2);
}
.table th:first-child { border-radius: 0.6rem 0 0 0; }
.table th:last-child { border-radius: 0 0.6rem 0 0; }
.table td { padding: 0.78rem 0.8rem; border-bottom: 1px solid var(--surface-2); font-size: 0.88rem; }
.table tbody tr { transition: background 0.2s ease; }
.table tbody tr:hover { background: var(--green-50); }
.table-hover tbody tr:hover { background: var(--green-50); }
.table-responsive { overflow-x: auto; }

/* ============ Progress ============ */

.progress-bar {
  width: 100%;
  height: 8px;
  background: var(--gray-200);
  border-radius: 9999px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary-light), var(--primary));
  border-radius: 9999px;
  transition: width 0.6s var(--ease-out-soft);
}

/* ============ Tabs ============ */

.tabs {
  display: flex;
  gap: 0.25rem;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.tab {
  padding: 0.6rem 1.1rem;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
}

.tab:hover { color: var(--primary); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }

/* ============ Modal ============ */

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(24, 30, 26, 0.45);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  padding: 1rem;
  animation: fadeIn 0.25s ease;
}

.modal-box {
  background: var(--surface);
  border-radius: 1.25rem;
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  animation: popIn 0.3s var(--ease-out-soft);
}

@keyframes popIn {
  from { opacity: 0; transform: translateY(12px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  z-index: 2;
}

/* ============ Toast ============ */

#toast-container {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.toast {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  min-width: 260px;
  max-width: 24rem;
  color: #fff;
  padding: 0.8rem 1.05rem;
  border-radius: 0.9rem;
  box-shadow: var(--shadow-lg);
  animation: toastIn 0.35s var(--ease-out-soft);
  font-size: 0.9rem;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateX(16px); }
  to { opacity: 1; transform: translateX(0); }
}

.toast.success { background: var(--green-600); }
.toast.error { background: var(--danger); }
.toast.info { background: var(--blue-600); }
.toast.warning { background: var(--amber-500); }

/* ============ Empty state / loading ============ */

.empty-state { text-align: center; padding: 2.75rem 1rem; color: var(--text-secondary); }
.empty-state i {
  font-size: 1.5rem;
  width: 3.6rem;
  height: 3.6rem;
  line-height: 3.6rem;
  text-align: center;
  background: var(--surface-2);
  border-radius: 50%;
  color: var(--primary);
  opacity: 0.85;
  margin: 0 auto 0.9rem;
  display: block;
}
.empty-state p { margin: 0 0 0.5rem; }

.loading-spinner {
  display: inline-block;
  width: 1.6rem;
  height: 1.6rem;
  border: 3px solid var(--gray-200);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* ============ Notifications ============ */

.notification-dropdown {
  position: absolute;
  right: 0;
  top: 2.6rem;
  width: 320px;
  max-height: 380px;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  z-index: 60;
}

.notification-dropdown .nd-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--gray-100);
}

.notification-item { padding: 0.75rem 1rem; border-bottom: 1px solid var(--gray-100); cursor: pointer; }
.notification-item:hover { background: var(--gray-100); }
.notification-item.unread { background: #F0F7F0; }

/* ============ Referrals ============ */

.filter-bar { display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: center; }

.referral-detail-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.75rem 1rem; }

.detail-block { padding: 0.5rem 0.75rem; background: var(--surface-2); border-radius: 0.5rem; }
.detail-block .label { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--gray-400); font-weight: 600; }
.detail-block .value { font-size: 0.9rem; font-weight: 500; margin-top: 0.15rem; }

.status-timeline { position: relative; padding-left: 1.25rem; }
.status-timeline::before {
  content: '';
  position: absolute;
  left: 0.3rem;
  top: 0.25rem;
  bottom: 0.25rem;
  width: 2px;
  background: var(--gray-200);
}
.timeline-item { position: relative; padding-bottom: 0.9rem; }
.timeline-item::before {
  content: '';
  position: absolute;
  left: -1.25rem;
  top: 0.35rem;
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 9999px;
  background: var(--primary-light);
  border: 2px solid var(--surface);
}

/* ============ Dashboard ============ */

.quick-actions-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 0.75rem; }

.quick-action {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.9rem 1rem;
  border: 1px solid var(--gray-100);
  border-radius: 0.75rem;
  color: var(--text);
  transition: all 0.2s ease;
}

.quick-action:hover { border-color: var(--primary-light); background: var(--green-50); text-decoration: none; transform: translateY(-1px); }
.quick-action i { font-size: 1.3rem; color: var(--primary); }
.quick-action .qa-title { font-weight: 600; font-size: 0.9rem; }
.quick-action .qa-sub { font-size: 0.75rem; color: var(--gray-400); }

/* ============ Consultation ============ */

.room-card { display: flex; flex-direction: column; }

.consultation-room {
  position: relative;
  min-height: 320px;
  background: #1A2332;
  border-radius: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
}

.consultation-controls {
  position: absolute;
  bottom: 1rem;
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
  gap: 0.75rem;
}

.chat-window { display: flex; flex-direction: column; gap: 0.5rem; overflow-y: auto; max-height: 340px; }

.chat-bubble {
  max-width: 82%;
  padding: 0.5rem 0.75rem;
  border-radius: 0.8rem;
  font-size: 0.88rem;
  line-height: 1.4;
}

.chat-bubble.me { background: var(--primary); color: #fff; border-bottom-right-radius: 0.2rem; align-self: flex-end; }
.chat-bubble.other { background: var(--gray-100); color: var(--text); border-bottom-left-radius: 0.2rem; align-self: flex-start; }
.chat-bubble.system { background: transparent; color: var(--gray-400); font-size: 0.75rem; text-align: center; }

/* ============ Education ============ */

.course-card { overflow: hidden; padding: 0; display: flex; flex-direction: column; }

.course-thumb {
  height: 96px;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 2rem;
  border-radius: var(--radius) var(--radius) 0 0;
}

.course-card .p-4 { padding: 1rem; flex: 1; }

.webinar-date {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 3.5rem;
  height: 3.5rem;
  border-radius: 0.75rem;
  background: var(--primary-soft);
  color: var(--primary);
  flex-shrink: 0;
}

.resource-icon {
  width: 2.6rem;
  height: 2.6rem;
  border-radius: 0.6rem;
  background: var(--blue-50);
  color: var(--blue-600);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.line-clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* ============ Auth pages ============ */

.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: linear-gradient(180deg, #EFF8FF 0%, #FFFFFF 55%);
}

.auth-card {
  width: 100%;
  max-width: 28rem;
  background: var(--surface);
  border-radius: 1.25rem;
  box-shadow: var(--shadow-lg);
  padding: 2rem;
  border-top: 4px solid transparent;
  border-image: linear-gradient(90deg, var(--secondary), var(--primary)) 1;
}

.auth-card .auth-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  margin-bottom: 1.25rem;
}

.auth-card .auth-logo img { height: 2.5rem; }
.auth-card .auth-logo span { font-size: 1.25rem; font-weight: 800; color: var(--primary); }
.auth-card .auth-title { text-align: center; font-size: 1.25rem; font-weight: 700; }
.auth-card .auth-sub { text-align: center; font-size: 0.85rem; color: var(--gray-500); margin-bottom: 1.5rem; }

.auth-demo {
  margin-top: 1.5rem;
  padding: 0.75rem;
  border-radius: 0.75rem;
  background: var(--gray-100);
  font-size: 0.78rem;
  color: var(--gray-500);
}

.auth-demo code { color: var(--primary); font-weight: 600; }

/* ============ Offline banner ============ */

.offline-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--warning);
  color: #fff;
  padding: 0.75rem;
  text-align: center;
  z-index: 90;
  font-size: 0.9rem;
}

/* ============ Animations ============ */

.fade-in { animation: fadeIn 0.45s var(--ease-out-soft); }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.slide-in { animation: slideIn 0.3s ease; }

@keyframes slideIn {
  from { transform: translateX(-20px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* ============ Utilities ============ */

.flex { display: flex; }
.flex-1 { flex: 1; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.items-end { align-items: flex-end; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.justify-end { justify-content: flex-end; }
.justify-start { justify-content: flex-start; }

.gap-1 { gap: 0.25rem; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.gap-4 { gap: 1rem; }
.gap-5 { gap: 1.25rem; }
.gap-6 { gap: 1.5rem; }

.grid { display: grid; }
.grid-cols-1 { grid-template-columns: repeat(1, minmax(0, 1fr)); }
.grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-cols-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.col-span-2 { grid-column: span 2 / span 2; }
.col-span-full { grid-column: 1 / -1; }

.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 0.75rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-5 { margin-bottom: 1.25rem; }
.mb-6 { margin-bottom: 1.5rem; }
.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 0.75rem; }
.mt-4 { margin-top: 1rem; }
.mt-5 { margin-top: 1.25rem; }
.mr-1 { margin-right: 0.25rem; }
.mr-2 { margin-right: 0.5rem; }
.ml-2 { margin-left: 0.5rem; }
.ml-auto { margin-left: auto; }

.p-3 { padding: 0.75rem; }
.p-4 { padding: 1rem; }
.p-6 { padding: 1.5rem; }
.p-8 { padding: 2rem; }
.px-2 { padding-left: 0.5rem; padding-right: 0.5rem; }
.px-3 { padding-left: 0.75rem; padding-right: 0.75rem; }
.px-4 { padding-left: 1rem; padding-right: 1rem; }
.px-5 { padding-left: 1.25rem; padding-right: 1.25rem; }
.py-2 { padding-top: 0.5rem; padding-bottom: 0.5rem; }
.py-3 { padding-top: 0.75rem; padding-bottom: 0.75rem; }
.py-4 { padding-top: 1rem; padding-bottom: 1rem; }
.py-6 { padding-top: 1.5rem; padding-bottom: 1.5rem; }
.pt-2 { padding-top: 0.5rem; }
.pt-4 { padding-top: 1rem; }

.w-full { width: 100%; }
.w-52 { width: 13rem; }
.min-w-0 { min-width: 0; }
.h-3 { height: 0.75rem; }
.h-10 { height: 2.5rem; }
.h-12 { height: 3rem; }
.h-14 { height: 3.5rem; }
.h-24 { height: 6rem; }
.h-56 { height: 14rem; }
.h-64 { height: 16rem; }
.w-5 { width: 1.25rem; }
.w-8 { width: 2rem; }
.w-10 { width: 2.5rem; }
.w-12 { width: 3rem; }
.w-14 { width: 3.5rem; }
.w-24 { width: 6rem; }

.text-xs { font-size: 0.75rem; }
.text-sm { font-size: 0.85rem; }
.text-lg { font-size: 1.125rem; }
.text-xl { font-size: 1.25rem; }
.text-2xl { font-size: 1.5rem; }
.text-3xl { font-size: 1.875rem; }
.text-4xl { font-size: 2.25rem; }
.text-2xs { font-size: 0.68rem; }
.text-3xs { font-size: 0.6rem; }

.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }
.font-extrabold { font-weight: 800; }
.font-mono { font-family: ui-monospace, 'Cascadia Code', Consolas, monospace; }

.text-center { text-align: center; }
.text-right { text-align: right; }
.text-left { text-align: left; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.whitespace-nowrap { white-space: nowrap; }
.leading-snug { line-height: 1.375; }

.text-primary { color: var(--primary); }
.text-green-600 { color: var(--green-600); }
.text-green-700 { color: var(--green-700); }
.text-blue-500 { color: var(--blue-500); }
.text-blue-600 { color: var(--blue-600); }
.text-red-400 { color: var(--red-400); }
.text-red-500 { color: var(--red-500); }
.text-amber-400 { color: var(--amber-400); }
.text-amber-500 { color: var(--amber-500); }
.text-amber-600 { color: var(--amber-600); }
.text-purple-600 { color: var(--purple-600); }
.text-gray-300 { color: var(--gray-300); }
.text-gray-400 { color: var(--gray-400); }
.text-gray-500 { color: var(--gray-500); }
.text-gray-600 { color: var(--gray-600); }
.text-white { color: #fff; }
.text-black { color: #000; }

.bg-green-50 { background: var(--green-50); }
.bg-green-100 { background: var(--green-100); }
.bg-blue-50 { background: var(--blue-50); }
.bg-amber-50 { background: var(--amber-50); }
.bg-red-50 { background: var(--red-50); }
.bg-gray-50 { background: var(--gray-100); }
.bg-gray-100 { background: var(--gray-100); }
.bg-white { background: #fff; }
.bg-black\/50 { background: rgba(0, 0, 0, 0.5); }

.border { border: 1px solid var(--border); }
.border-b { border-bottom: 1px solid var(--border); }
.border-t { border-top: 1px solid var(--border); }
.border-l { border-left: 1px solid var(--border); }
.border-r { border-right: 1px solid var(--border); }
.border-gray-100 { border-color: var(--gray-100); }
.border-gray-200 { border-color: var(--gray-200); }
.border-gray-300 { border-color: var(--gray-300); }

.rounded { border-radius: 0.375rem; }
.rounded-lg { border-radius: 0.75rem; }
.rounded-xl { border-radius: 1rem; }
.rounded-2xl { border-radius: 1.25rem; }

.shadow-lg { box-shadow: var(--shadow-lg); }
.shadow-2xl { box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25); }

.relative { position: relative; }
.absolute { position: absolute; }
.fixed { position: fixed; }
.inset-0 { inset: 0; }
.top-0 { top: 0; }
.right-0 { right: 0; }
.left-0 { left: 0; }
.bottom-0 { bottom: 0; }

.overflow-x-auto { overflow-x: auto; }
.overflow-y-auto { overflow-y: auto; }
.max-h-50vh { max-height: 50vh; }
.max-w-sm { max-width: 24rem; }
.max-w-md { max-width: 28rem; }
.max-w-lg { max-width: 32rem; }
.max-w-2xl { max-width: 42rem; }
.max-w-3xl { max-width: 48rem; }
.max-w-5xl { max-width: 64rem; }

.hover\:bg-gray-50:hover { background: var(--gray-100); }
.hover\:cursor-pointer:hover { cursor: pointer; }
.cursor-pointer { cursor: pointer; }
.cursor-not-allowed { cursor: not-allowed; }
.opacity-70 { opacity: 0.7; }
.space-y-1 > * + * { margin-top: 0.25rem; }
.space-y-2 > * + * { margin-top: 0.5rem; }
.space-y-3 > * + * { margin-top: 0.75rem; }
.space-y-4 > * + * { margin-top: 1rem; }
.space-y-5 > * + * { margin-top: 1.25rem; }

.aspect-video { aspect-ratio: 16 / 9; }
.uppercase { text-transform: uppercase; }
.hidden { display: none; }
.last\:border-0:last-child { border-bottom: 0; }
.shrink-0 { flex-shrink: 0; }
.z-10 { z-index: 10; }
.z-50 { z-index: 50; }

/* ============ Pagination ============ */

.pagination { display: flex; align-items: center; justify-content: center; gap: 0.35rem; margin-top: 1rem; flex-wrap: wrap; }

.pagination-btn:not(.btn-primary):not(:disabled):hover { border-color: var(--primary); color: var(--primary); }

/* ============ Topbar / shell additions ============ */

.topbar-search {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--gray-100);
  border-radius: 0.6rem;
  padding: 0.35rem 0.75rem;
  flex: 0 1 22rem;
  color: var(--gray-400);
}

.topbar-search input {
  border: none;
  background: transparent;
  outline: none;
  font-size: 0.88rem;
  width: 100%;
  color: var(--text);
}

.topbar-actions { display: flex; align-items: center; gap: 0.5rem; margin-left: auto; }

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.3rem;
  height: 2.3rem;
  border-radius: 0.6rem;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.95rem;
  position: relative;
  transition: all 0.2s ease;
}

.icon-btn:hover { background: var(--gray-100); color: var(--text); }

.mobile-nav-toggle { display: none; }

.notifications-wrap { position: relative; }

.badge-count {
  position: absolute;
  top: -0.2rem;
  right: -0.2rem;
  min-width: 1.1rem;
  height: 1.1rem;
  padding: 0 0.25rem;
  border-radius: 9999px;
  background: var(--danger);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ============ Modal additions ============ */

.modal-box.modal-sm { max-width: 22rem; }
.modal-box.modal-md { max-width: 32rem; }
.modal-box.modal-lg { max-width: 44rem; }
.modal-box.modal-xl { max-width: 56rem; }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.1rem 1.25rem;
  border-bottom: 1px solid var(--border);
}

.modal-title { font-size: 1.05rem; font-weight: 700; }

.modal-body { padding: 1.25rem; }

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--border);
}

/* ============ Toast additions ============ */

.toast-close {
  margin-left: auto;
  background: transparent;
  border: none;
  color: inherit;
  font-size: 1.1rem;
  line-height: 1;
  opacity: 0.7;
}

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

.toast-hide { opacity: 0; transform: translateX(20px); transition: all 0.3s ease; }

/* ============ Form errors ============ */

.form-error { color: var(--danger); font-size: 0.78rem; margin-top: 0.25rem; display: none; }
.form-error.show { display: block; }
.form-hint { font-size: 0.78rem; color: var(--muted); margin-top: 0.3rem; display: flex; align-items: center; gap: 0.35rem; }

/* ============ Offline banner ============ */

/* ============ Loading / list items ============ */

.list-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.8rem 1rem;
  border: 1px solid var(--gray-100);
  border-radius: 0.75rem;
  transition: all 0.2s ease;
}

.list-item:hover { border-color: var(--primary-light); background: var(--green-50); }

.link-plain { color: var(--text); }
.link-plain:hover { color: var(--primary); text-decoration: none; }

/* ============ Responsive ============ */

.mobile-nav-toggle { display: none; }

@media (min-width: 640px) {
  .sm\:flex-row { flex-direction: row; }
  .sm\:items-center { align-items: center; }
  .sm\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sm\:inline-flex { display: inline-flex; }
}

@media (min-width: 768px) {
  .md\:flex-row { flex-direction: row; }
  .md\:items-center { align-items: center; }
  .md\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .md\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (min-width: 1024px) {
  .lg\:flex-row { flex-direction: row; }
  .lg\:col-span-2 { grid-column: span 2 / span 2; }
  .lg\:col-span-3 { grid-column: span 3 / span 3; }
  .lg\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .lg\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .lg\:grid-cols-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .lg\:grid-cols-6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
}

@media (max-width: 767px) {
  .app-shell { display: block; }
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    box-shadow: none;
  }
  .sidebar.open { transform: translateX(0); box-shadow: var(--shadow-lg); }
  .main-region { margin-left: 0; }
  .mobile-nav-toggle { display: inline-flex; }
  .main-content { padding: 1rem; }
  .topbar { padding: 0.6rem 1rem; }
  .topbar-search { display: none; }
  .grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ============ Dark mode ============ */

/* White backgrounds are the default brand look (MOFATE). The manual
   dark theme (html.dark) below remains available via the toggle. */

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

/* ============ Manual dark theme (toggle) ============ */

html.dark {
  --background: #0B1512;
  --surface: #13211B;
  --surface-2: #0E1A15;
  --border: #24362D;
  --text: #E9F4EE;
  --text-secondary: #A8BBB1;
  --text-muted: #6D8076;
  --green-50: #0C2E1E;
  --primary-soft: #0F3020;
  --secondary-soft: #0E2A33;
  --accent-soft: #33230D;
}
html.dark .dashboard-card, html.dark .sidebar, html.dark .topbar { background: var(--surface); }
html.dark .dashboard-card { border-color: var(--border); }
html.dark .nav-link:hover { background: var(--surface-2); }
html.dark .nav-link.active { background: var(--primary); color: #fff; }
html.dark .chip { background: var(--surface-2); color: var(--text-secondary); }
html.dark .auth-card { background: var(--surface); }
html.dark .auth-demo { background: var(--surface-2); }
html.dark .progress-bar { background: var(--border); }
html.dark .input, html.dark .textarea, html.dark .select { background: var(--surface-2); color: var(--text); border-color: var(--border); }
html.dark .table th { background: var(--surface-2); }
html.dark .table td { border-color: var(--border); }
html.dark .table tbody tr:hover { background: var(--surface-2); }
html.dark .detail-block { background: var(--surface-2); }
html.dark .btn-ghost { color: var(--text-secondary); }
html.dark .btn-ghost:hover { background: var(--surface-2); }
html.dark .btn-outline { border-color: var(--border); color: var(--text-secondary); }
html.dark .facility-row:hover { background: var(--surface-2); }
html.dark .member-card:hover { border-color: var(--primary-light); }

/* ============ Facility map ============ */

.facility-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.8rem 1rem;
  border-bottom: 1px solid var(--border);
  transition: background 0.15s ease;
}
.facility-row:hover { background: var(--green-50); }
.facility-row-dot {
  width: 0.65rem;
  height: 0.65rem;
  border-radius: 9999px;
  flex-shrink: 0;
}
.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.75rem;
  color: var(--text-secondary);
}
.legend-dot {
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 9999px;
  display: inline-block;
}
.capacity-dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 9999px;
  display: inline-block;
  margin-right: 0.25rem;
}
#facility-map { z-index: 1; }
#facility-map.leaflet-container {
  font-family: 'Segoe UI', system-ui, sans-serif;
}

/* ============ Directory ============ */

.member-card {
  display: flex;
  flex-direction: column;
  transition: border-color 0.15s ease, transform 0.15s ease;
}
.member-card:hover { border-color: var(--primary-light); transform: translateY(-1px); }
.member-card .fa-circle-check { font-size: 0.8rem; margin-left: 0.25rem; }

/* ============ Emergency ============ */

.quick-action-emergency {
  border-color: rgba(198, 40, 40, 0.35) !important;
  background: var(--red-50);
}
.quick-action-emergency i { color: var(--danger) !important; }
html.dark .quick-action-emergency { background: #3a1a1a; }

/* ============================================================
   Rebuilt static page components (module screens)
   ============================================================ */

/* --- Stat cards (standalone use in education/cpd/admin) --- */
.stat-card {
  position: relative;
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1.35rem 1.55rem;
  box-shadow: var(--shadow);
  border: 1px solid rgba(58, 50, 34, 0.06);
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 6.5rem;
}

.bg-primary { background: var(--primary); color: #fff; }
.bg-blue { background: var(--blue-600); color: #fff; }
.bg-green { background: var(--green-600); color: #fff; }
.bg-warning { background: var(--amber-500); color: #fff; }
.bg-red { background: #DC2626; color: #fff; }
.bg-teal { background: #0D9488; color: #fff; }
.bg-indigo { background: #4F46E5; color: #fff; }
.bg-purple { background: #7C3AED; color: #fff; }

/* --- Status bars (admin overview) --- */
.status-bar-row { width: 100%; }
.status-bar-track { height: 0.55rem; border-radius: 999px; background: var(--surface-2, rgba(128,128,128,.18)); overflow: hidden; }
.status-bar-fill { display: block; height: 100%; border-radius: 999px; background: var(--primary); transition: width .5s ease; }
.status-bar-fill.status-pending { background: var(--amber-500); }
.status-bar-fill.status-accepted { background: var(--blue-600); }
.status-bar-fill.status-in_transit { background: var(--indigo-500, #6366F1); }
.status-bar-fill.status-completed { background: var(--green-600); }
.status-bar-fill.status-rejected { background: var(--red-500, #EF4444); }
.status-bar-fill.status-cancelled { background: var(--gray-500, #6B7280); }

.avatar-lg { width: 3rem; height: 3rem; font-size: 1.05rem; }

/* --- Tabs panels --- */
.tab-panel { animation: fadeIn 0.35s ease; }

/* --- Chip groups --- */
.chips { display: flex; flex-wrap: wrap; gap: 0.5rem; }

/* --- Checkbox lists (consultation participants) --- */
.checkbox-list {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  max-height: 220px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 0.6rem;
  padding: 0.5rem 0.6rem;
  background: var(--surface-2);
}
.checkbox-item {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  padding: 0.35rem 0.45rem;
  border-radius: 0.45rem;
  cursor: pointer;
  font-size: 0.9rem;
  transition: background 0.15s ease;
}
.checkbox-item:hover { background: var(--surface); }
.checkbox-item input { width: 1rem; height: 1rem; margin-top: 0.2rem; flex-shrink: 0; accent-color: var(--primary); cursor: pointer; }
.checkbox-item em { font-style: normal; }

/* --- Consultation stats / chips --- */
.stat-chips { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.consult-stats { display: flex; align-items: center; }

/* --- Facilities --- */
.facility-filter-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem; margin-bottom: 1rem; }
.facility-grid { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 1rem; align-items: start; }
.facility-map-wrap { position: relative; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); border: 1px solid var(--border); background: var(--surface); }
.facility-map { height: 540px; position: relative; z-index: 1; }
.facility-map.leaflet-container { font-family: 'Segoe UI', system-ui, sans-serif; }
.map-placeholder { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.5rem; color: var(--text-muted); background: var(--surface-2); z-index: 5; }
.map-placeholder i { font-size: 2.5rem; opacity: 0.5; }
.map-placeholder p { margin: 0; font-size: 0.9rem; }
.map-legend {
  position: absolute;
  bottom: 1rem;
  left: 1rem;
  z-index: 6;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  padding: 0.5rem 0.9rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0.6rem;
  box-shadow: var(--shadow);
  font-size: 0.75rem;
  color: var(--text-secondary);
}
.map-legend span { display: inline-flex; align-items: center; gap: 0.35rem; }
.legend-hospital { background: var(--danger); }
.legend-health-center { background: var(--primary); }
.legend-dispensary { background: var(--secondary); }
.legend-clinic { background: var(--accent); }
.facility-list-panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.facility-list-header { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; padding: 0.75rem 1rem; border-bottom: 1px solid var(--border); background: var(--surface-2); font-size: 0.9rem; }
.facility-row-head { display: flex; align-items: center; gap: 0.5rem; min-width: 0; }
.facility-type-dot { width: 0.6rem; height: 0.6rem; border-radius: 9999px; flex-shrink: 0; }
.facility-row-meta { display: flex; flex-wrap: wrap; gap: 0.35rem 0.9rem; margin-top: 0.4rem; font-size: 0.78rem; color: var(--text-secondary); }
.facility-row-meta i { margin-right: 0.3rem; opacity: 0.7; }
.capacity-badge { font-size: 0.7rem; }
.cap-critical { background: var(--red-50); color: var(--red-600); }
.cap-strained { background: var(--amber-50); color: var(--amber-600); }
.cap-good { background: var(--green-50); color: var(--green-700); }
.facility-marker { background: transparent; border: none; }
.facility-marker-pin {
  width: 1.8rem;
  height: 1.8rem;
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 0.8rem;
}
.facility-marker-pin i { transform: rotate(45deg); }
.user-loc-pin {
  background: var(--blue-600);
  color: #fff;
  border-radius: 9999px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.35);
}
.facility-detail-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.75rem 1rem; }

/* --- Directory --- */
.directory-filter-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem; margin-bottom: 1rem; }
.directory-summary { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 1rem; font-size: 0.9rem; color: var(--text-secondary); }
.directory-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1rem; }
.member-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.1rem; box-shadow: var(--shadow); }
.member-card-head { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; margin-bottom: 0.75rem; }
.member-card-actions { display: flex; gap: 0.5rem; margin-top: auto; padding-top: 0.85rem; }

/* --- Consultation chat --- */
.chat-layout {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  height: calc(100vh - 7.5rem);
  min-height: 460px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
  box-shadow: var(--shadow);
}
.chat-sidebar { display: flex; flex-direction: column; border-right: 1px solid var(--border); background: var(--surface-2); min-width: 0; }
.chat-sidebar-header { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; padding: 0.85rem 1rem; border-bottom: 1px solid var(--border); }
.chat-rooms-list { flex: 1; overflow-y: auto; }
.chat-room-item { padding: 0.8rem 1rem; border-bottom: 1px solid var(--border); cursor: pointer; transition: background 0.15s ease; }
.chat-room-item:hover { background: var(--surface); }
.chat-room-item.active { background: var(--primary-soft); border-left: 3px solid var(--primary); }
.chat-main { display: flex; flex-direction: column; min-width: 0; }
.chat-header { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; padding: 0.85rem 1.25rem; border-bottom: 1px solid var(--border); }
.chat-header-actions { display: flex; align-items: center; gap: 0.35rem; }
.chat-messages { flex: 1; overflow-y: auto; padding: 1.25rem; display: flex; flex-direction: column; gap: 0.85rem; }
.chat-msg { max-width: 74%; display: flex; flex-direction: column; gap: 0.15rem; align-self: flex-start; }
.chat-msg-mine { align-self: flex-end; align-items: flex-end; }
.chat-msg-name { font-size: 0.68rem; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; padding: 0 0.55rem; }
.chat-msg-bubble { padding: 0.55rem 0.85rem; border-radius: 1rem 1rem 1rem 0.2rem; background: var(--green-50); border: 1px solid var(--border); font-size: 0.9rem; line-height: 1.45; overflow-wrap: anywhere; }
.chat-msg-mine .chat-msg-bubble { background: var(--primary); color: #fff; border-radius: 1rem 1rem 0.2rem 1rem; border-color: transparent; }
.chat-msg-time { font-size: 0.68rem; color: var(--text-muted); padding: 0 0.55rem; }
.chat-composer { display: flex; align-items: flex-end; gap: 0.6rem; padding: 0.85rem 1rem; border-top: 1px solid var(--border); background: var(--surface-2); }
.chat-composer textarea {
  flex: 1;
  resize: none;
  border: 1px solid var(--gray-300);
  border-radius: 0.6rem;
  padding: 0.55rem 0.8rem;
  font-family: inherit;
  font-size: 0.92rem;
  background: var(--surface);
  color: var(--text);
}
.chat-composer textarea:focus { outline: none; border-color: var(--primary-light); box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.15); }
.chat-composer textarea:disabled { background: var(--gray-100); color: var(--gray-500); }

/* --- Education --- */
.edu-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1rem; }
.edu-card { display: flex; flex-direction: column; gap: 0.6rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.1rem; box-shadow: var(--shadow); transition: transform 0.15s ease, border-color 0.15s ease; }
.edu-card:hover { border-color: var(--primary-light); transform: translateY(-2px); }
.edu-card-head { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; }
.edu-card-icon { width: 2.4rem; height: 2.4rem; border-radius: 0.7rem; background: var(--primary-soft); color: var(--primary); display: flex; align-items: center; justify-content: center; font-size: 1.1rem; flex-shrink: 0; }
.edu-card-meta { display: flex; flex-wrap: wrap; gap: 0.35rem 1rem; font-size: 0.75rem; color: var(--text-secondary); margin-top: auto; }
.edu-card-meta i { margin-right: 0.3rem; opacity: 0.7; }
.library-content { line-height: 1.7; color: var(--text-primary); }
.library-image { padding: 0.5rem; border: 1px solid var(--border, #e5e7eb); border-radius: var(--radius); background: var(--bg, #f9fafb); }
.webinar-banner { display: flex; align-items: center; gap: 1rem; padding: 1rem 1.25rem; border-radius: var(--radius); background: linear-gradient(135deg, var(--secondary), var(--primary)); color: #fff; box-shadow: var(--shadow); }
.webinar-banner i { font-size: 1.75rem; opacity: 0.9; }
.course-progress { margin-top: auto; }
.progress-done { background: var(--success); }
.course-lessons { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.5rem; }
.course-lesson { display: flex; align-items: flex-start; gap: 0.6rem; padding: 0.5rem 0.75rem; border: 1px solid var(--border); border-radius: 0.6rem; font-size: 0.88rem; background: var(--surface-2); cursor: pointer; transition: border-color 0.15s ease, background 0.15s ease; }
.course-lesson:hover { border-color: var(--primary-light); background: var(--surface); }
.course-lesson.lesson-done { border-color: rgba(16, 185, 129, 0.4); }
.course-lesson .lesson-check { color: var(--gray-400); font-size: 0.95rem; flex-shrink: 0; margin-top: 0.1rem; }
.course-lesson.lesson-done .lesson-check { color: var(--success); }
.course-lesson .lesson-info { min-width: 0; }
.lesson-number { width: 1.5rem; height: 1.5rem; border-radius: 9999px; background: var(--primary-soft); color: var(--primary); font-size: 0.72rem; font-weight: 700; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }

.lesson-player { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.lesson-video { position: relative; padding-top: 56.25%; }
.lesson-video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.lesson-body { padding: 1.25rem; display: flex; flex-direction: column; gap: 1rem; }
.lesson-intro { font-size: 0.95rem; line-height: 1.65; color: var(--text); }
.lesson-p { font-size: 0.92rem; line-height: 1.6; color: var(--text-secondary); }
.lesson-bullets { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.55rem; }
.lesson-bullets li { display: flex; align-items: flex-start; gap: 0.6rem; font-size: 0.92rem; line-height: 1.55; color: var(--text); padding: 0.55rem 0.75rem; background: var(--surface-2); border: 1px solid var(--border); border-radius: 0.6rem; }
.lesson-bullet-ico { flex-shrink: 0; width: 1.25rem; height: 1.25rem; border-radius: 9999px; background: var(--primary-soft); color: var(--primary); display: flex; align-items: center; justify-content: center; font-size: 0.6rem; margin-top: 0.1rem; }
.lesson-callout { display: flex; gap: 0.8rem; padding: 0.9rem 1rem; border-radius: 0.7rem; font-size: 0.92rem; line-height: 1.55; border: 1px solid; color: var(--text); }
.lesson-callout .callout-ico { flex-shrink: 0; width: 2rem; height: 2rem; border-radius: 0.6rem; display: flex; align-items: center; justify-content: center; font-size: 1rem; }
.lesson-callout .callout-label { font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; font-size: 0.72rem; margin-bottom: 0.25rem; }
.lesson-takeaway { background: var(--green-50); border-color: rgba(22, 163, 74, 0.35); }
.lesson-takeaway .callout-ico { background: var(--success); color: #fff; }
.lesson-takeaway .callout-label { color: var(--green-700); }
.lesson-watch { background: var(--red-50); border-color: rgba(220, 38, 38, 0.35); }
.lesson-watch .callout-ico { background: var(--danger); color: #fff; }
.lesson-watch .callout-label { color: var(--red-600); }
.lesson-breadcrumb { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; flex-wrap: wrap; }
.lesson-breadcrumb .lesson-obj { color: var(--primary); font-weight: 600; }
.lesson-duration-chip { display: inline-flex; align-items: center; gap: 0.35rem; font-size: 0.72rem; font-weight: 600; color: var(--primary); background: var(--primary-soft); border-radius: 9999px; padding: 0.25rem 0.6rem; }
.lesson-progress { color: var(--primary); }
.lesson-group-list { display: flex; flex-direction: column; gap: 1rem; }
.lesson-group { display: flex; flex-direction: column; gap: 0.5rem; }
.lesson-group-head { display: flex; align-items: center; gap: 0.5rem; font-size: 0.82rem; color: var(--text-secondary); padding: 0 0.15rem; }
.lesson-group-ico { color: var(--primary); }
.lesson-group-count { margin-left: auto; font-size: 0.7rem; font-weight: 700; color: var(--primary); background: var(--primary-soft); border-radius: 9999px; padding: 0.1rem 0.5rem; }
.lesson-min-chip { display: inline-flex; align-items: center; gap: 0.25rem; color: var(--primary); }
.lesson-done-label { display: inline-flex; align-items: center; gap: 0.25rem; color: var(--success); margin-left: 0.5rem; }

.certificate { border: 3px solid var(--primary); border-radius: 1rem; padding: 2rem 1.5rem; text-align: center; background: linear-gradient(160deg, #ffffff 0%, #f0fdf4 100%); position: relative; overflow: hidden; }
html.dark .certificate { background: linear-gradient(160deg, #12201a 0%, #0b3d2a 100%); }
.certificate::before { content: ''; position: absolute; inset: 0.75rem; border: 1px solid rgba(14, 122, 77, 0.35); border-radius: 0.7rem; pointer-events: none; }
.certificate-badge { font-size: 2.5rem; color: var(--primary); }
.certificate-title { font-size: 1.35rem; font-weight: 800; letter-spacing: 0.05em; text-transform: uppercase; color: var(--primary); }
.certificate-sub { font-size: 0.85rem; color: var(--gray-500); margin-top: 0.9rem; }
.certificate-name { font-size: 1.6rem; font-weight: 800; color: var(--text); margin: 0.4rem 0 0.2rem; }
.certificate-course { font-size: 1.15rem; font-weight: 700; color: var(--primary-dark); }
.certificate-meta { display: flex; justify-content: center; gap: 1.5rem; font-size: 0.78rem; color: var(--gray-500); margin-top: 1rem; }
.certificate-date { font-size: 0.78rem; color: var(--gray-400); margin-top: 0.5rem; }

/* --- CPD --- */
.cpd-grid { display: grid; grid-template-columns: minmax(280px, 360px) 1fr; gap: 1.25rem; }
.cpd-overview { display: flex; flex-direction: column; gap: 1.1rem; }
.cpd-rings { display: flex; justify-content: center; }
.cpd-ring {
  --progress: 0deg;
  width: 10.5rem;
  height: 10.5rem;
  border-radius: 50%;
  background: conic-gradient(var(--primary) var(--progress), var(--border) 0deg);
  display: flex;
  align-items: center;
  justify-content: center;
}
.cpd-ring-center { width: 8rem; height: 8rem; border-radius: 50%; background: var(--surface); display: flex; flex-direction: column; align-items: center; justify-content: center; box-shadow: var(--shadow); }
.cpd-points { font-size: 2rem; font-weight: 800; color: var(--primary); line-height: 1; }
.cpd-points-label { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-muted); margin-top: 0.25rem; }
.cpd-target { margin-top: 0.25rem; }
.cpd-breakdown { display: flex; flex-direction: column; gap: 0.75rem; }
.cpd-category-stats { display: flex; flex-direction: column; gap: 0.9rem; }
.cpd-cat-row { display: flex; align-items: center; gap: 0.75rem; }
.cpd-cat-icon { width: 2.2rem; height: 2.2rem; border-radius: 0.6rem; background: var(--primary-soft); color: var(--primary); display: flex; align-items: center; justify-content: center; flex-shrink: 0; font-size: 1rem; }

/* --- Admin --- */
.content-list { display: flex; flex-direction: column; gap: 0.5rem; max-height: 340px; overflow-y: auto; }
.content-list-item { display: flex; align-items: center; gap: 0.5rem; padding: 0.5rem 0.7rem; border: 1px solid var(--border); border-radius: 0.5rem; background: var(--surface-2); }
.content-delete { color: var(--text-muted); }
.content-delete:hover { color: var(--danger); background: var(--red-50); }

/* --- Emergency referral category --- */
.emergency-category-block { padding: 0.9rem 1rem; border: 1px solid rgba(220, 38, 38, 0.35); border-radius: 0.6rem; background: var(--red-50); }

/* --- Added utilities --- */
.p-0 { padding: 0; }
.py-8 { padding-top: 2rem; padding-bottom: 2rem; }
.mt-6 { margin-top: 1.5rem; }
.opacity-80 { opacity: 0.8; }
.capitalize { text-transform: capitalize; }
.line-clamp-1 { display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
.border-top { border-top: 1px solid var(--border); }
.border-bottom { border-bottom: 1px solid var(--border); }
.space-y-6 > * + * { margin-top: 1.5rem; }

/* --- Dark mode additions --- */
html.dark .map-legend,
html.dark .facility-list-panel,
html.dark .facility-map-wrap,
html.dark .chat-layout,
html.dark .edu-card,
html.dark .member-card,
html.dark .content-list-item { background: var(--surface); }
html.dark .map-placeholder,
html.dark .facility-list-header,
html.dark .chat-sidebar,
html.dark .chat-sidebar-header,
html.dark .chat-composer,
html.dark .course-lesson,
html.dark .checkbox-list { background: var(--surface-2); }
html.dark .chat-room-item:hover { background: var(--surface-2); }
html.dark .chat-msg-bubble { background: var(--surface-2); border-color: var(--border); }
html.dark .chat-msg-mine .chat-msg-bubble { background: var(--primary); border-color: transparent; }
html.dark .cpd-ring-center { background: var(--surface); }
html.dark .checkbox-item:hover { background: var(--surface); }
html.dark .cap-critical { background: #3a1212; color: var(--red-400); }
html.dark .cap-strained { background: #33230d; color: var(--amber-400); }
html.dark .cap-good { background: var(--green-50); color: var(--green-600); }
html.dark .emergency-category-block { background: #3a1212; }
html.dark .content-delete:hover { background: var(--red-50); }
html.dark .lesson-watch { background: #3a1212; border-color: rgba(239, 68, 68, 0.4); }
html.dark .lesson-watch .callout-label { color: var(--red-400); }

/* --- Responsive additions --- */
@media (min-width: 768px) {
  .md\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (min-width: 1024px) {
  .lg\:grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (max-width: 1023px) {
  .facility-grid { grid-template-columns: 1fr; }
  .facility-map { height: 420px; }
  .cpd-grid { grid-template-columns: 1fr; }
  .chat-layout { grid-template-columns: 1fr; height: auto; }
  .chat-sidebar { max-height: 280px; border-right: none; border-bottom: 1px solid var(--border); }
  .chat-main { height: calc(100vh - 12rem); min-height: 440px; }
}

/* --- Community crowdfunding (needs) --- */
.need-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1rem; }
.need-card { display: flex; flex-direction: column; gap: 0.6rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.1rem; box-shadow: var(--shadow); transition: transform 0.15s ease, border-color 0.15s ease; }
.need-card:hover { border-color: var(--primary-light); transform: translateY(-2px); }
.need-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 0.5rem; }
.need-avatar { width: 2.4rem; height: 2.4rem; border-radius: 9999px; background: linear-gradient(135deg, var(--secondary), var(--primary)); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 1.1rem; flex-shrink: 0; }
.need-progress { margin-top: auto; }
.need-card-actions { display: flex; gap: 0.5rem; }
.need-card-actions .btn-ghost { margin-left: auto; }
.donation-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.5rem; max-height: 260px; overflow-y: auto; }
.donation-item { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; padding: 0.55rem 0.75rem; border: 1px solid var(--border); border-radius: 0.6rem; background: var(--surface-2); font-size: 0.88rem; }
.donation-amt { font-weight: 700; color: var(--primary); flex-shrink: 0; }
.donate-quick-row { display: flex; gap: 0.4rem; flex-wrap: wrap; }

/* --- Announcements --- */
.announce-list { display: flex; flex-direction: column; gap: 0.9rem; max-width: 46rem; }
.announce-card { display: flex; flex-direction: column; gap: 0.35rem; background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--primary); border-radius: var(--radius); padding: 1.1rem 1.25rem; box-shadow: var(--shadow); transition: transform 0.15s ease, border-color 0.15s ease; }
.announce-card:hover { border-color: var(--primary-light); transform: translateY(-2px); }
.announce-head { display: flex; align-items: center; gap: 0.6rem; }
.announce-form { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.1rem; box-shadow: var(--shadow); max-width: 46rem; }
.btn-danger { color: #dc2626; }
.btn-danger:hover { background: #fee2e2; color: #b91c1c; }
.chip-chip { border: 1px solid var(--border); background: var(--surface-2); color: var(--text); border-radius: 9999px; padding: 0.35rem 0.75rem; font-size: 0.78rem; cursor: pointer; transition: all 0.15s ease; }
.chip-chip:hover { border-color: var(--primary); color: var(--primary); }
.chip-chip.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.chip-green { background: var(--green-50); color: var(--green-700); border-color: rgba(22, 163, 74, 0.3); }
.chip-warning { background: var(--amber-50); color: var(--amber-600); border-color: rgba(245, 158, 11, 0.3); }
.chip-danger { background: var(--red-50); color: var(--red-500); border-color: rgba(220, 38, 38, 0.3); }
.text-danger { color: var(--red-500); }
.bg-danger { background: var(--red-50); color: var(--red-500); }
.text-green-500 { color: var(--green-600); }

/* --- Quizzes & badges --- */
.quiz-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 1rem; }
.quiz-card { display: flex; flex-direction: column; gap: 0.6rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.1rem; box-shadow: var(--shadow); transition: transform 0.15s ease, border-color 0.15s ease; }
.quiz-card:hover { border-color: var(--primary-light); transform: translateY(-2px); }
.quiz-icon { width: 2.8rem; height: 2.8rem; border-radius: 0.8rem; background: linear-gradient(135deg, #f59e0b, #d97706); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 1.25rem; }
.quiz-meta { display: flex; flex-wrap: wrap; gap: 0.35rem 1rem; font-size: 0.75rem; color: var(--text-secondary); margin-top: auto; }
.badges-strip { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.badge-chip { display: inline-flex; align-items: center; gap: 0.35rem; padding: 0.35rem 0.75rem; border-radius: 9999px; background: linear-gradient(135deg, #fef3c7, #fde68a); color: #92400e; font-size: 0.75rem; font-weight: 700; border: 1px solid #fcd34d; }
html.dark .badge-chip { background: #422006; color: #fde68a; border-color: #92400e; }
.quiz-options { display: flex; flex-direction: column; gap: 0.6rem; }
.quiz-option { display: flex; align-items: center; gap: 0.6rem; padding: 0.7rem 0.9rem; border: 1px solid var(--border); border-radius: 0.6rem; background: var(--surface-2); cursor: pointer; transition: all 0.15s ease; font-size: 0.9rem; }
.quiz-option:hover { border-color: var(--primary-light); }
.quiz-option.selected { border-color: var(--primary); background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.quiz-option input { accent-color: var(--primary); }
.quiz-result { display: flex; flex-direction: column; align-items: center; gap: 0.6rem; text-align: center; padding: 1.25rem; border-radius: var(--radius); }
.result-pass { background: var(--green-50); border: 1px solid rgba(22, 163, 74, 0.3); }
.result-fail { background: var(--red-50); border: 1px solid rgba(220, 38, 38, 0.3); }
html.dark .result-pass { background: #052e16; }
html.dark .result-fail { background: #3a1212; }
.quiz-result-icon { font-size: 2.2rem; color: #f59e0b; }
.quiz-score-ring { --pct: 0deg; width: 6.5rem; height: 6.5rem; border-radius: 50%; background: conic-gradient(var(--primary) var(--pct), var(--border) 0deg); display: flex; align-items: center; justify-content: center; }
.quiz-score-ring span { width: 5rem; height: 5rem; border-radius: 50%; background: var(--surface); display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 1.3rem; color: var(--primary); }
html.dark .quiz-score-ring span { background: var(--surface-2); }
.quiz-review { display: flex; flex-direction: column; gap: 0.3rem; width: 100%; text-align: left; max-height: 200px; overflow-y: auto; }
.quiz-review-item { display: flex; align-items: center; gap: 0.5rem; font-size: 0.82rem; padding: 0.3rem 0.5rem; }
.modal-wide { width: min(640px, 94vw); max-height: 90vh; }
.checkbox-row { display: flex; align-items: center; gap: 0.5rem; font-size: 0.88rem; color: var(--text-secondary); cursor: pointer; margin-top: 0.35rem; }

/* ============================================================
   MOFATE OneHealth — "Stunning" polish pass
   Mirrors the landing design language: clean white canvas,
   emerald/teal/amber gradients, soft layered shadows, hover
   lifts, glass topbar, refined focus rings. Dark-mode aware.
   ============================================================ */

body {
  background: var(--background);
}

h1, h2, h3, h4, h5 { letter-spacing: -0.02em; }

/* ---------- Sidebar ---------- */

.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--border);
  box-shadow: 2px 0 24px rgba(15, 40, 30, 0.05);
}

.sidebar .brand { gap: 0.7rem; padding: 0 0.5rem 1.1rem; }
.sidebar .brand img {
  height: 2.4rem;
  width: auto;
  object-fit: contain;
}
.sidebar .brand .brand-name {
  background: linear-gradient(100deg, var(--primary), var(--primary-dark));
  -webkit-background-clip: text; background-clip: text; color: transparent;
  font-weight: 900;
}
.sidebar .brand .brand-sub { color: var(--primary); opacity: 0.8; letter-spacing: 0.18em; }

.sidebar-nav { display: flex; flex-direction: column; gap: 0.2rem; }

.nav-link {
  border-radius: 0.8rem;
  margin-bottom: 0.1rem;
  padding: 0.7rem 0.9rem;
  transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}
.nav-link i { width: 1.4rem; text-align: center; font-size: 1rem; opacity: 0.85; transition: transform 0.18s ease; }
.nav-link:hover { background: var(--green-50); color: var(--primary); transform: translateX(2px); }
.nav-link:hover i { transform: scale(1.12); }
.nav-link.active {
  background: linear-gradient(100deg, var(--primary), var(--primary-dark));
  color: #fff;
  box-shadow: var(--shadow-glow);
  font-weight: 600;
}
.nav-link.active i { opacity: 1; }
.nav-link.active .nav-badge { background: #fff; color: var(--primary-dark); }

.sidebar .sidebar-footer { padding-top: 1rem; border-top: 1px solid var(--border); }
.sidebar-footer-user {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 0.9rem;
  padding: 0.6rem 0.7rem;
}
.sidebar-footer-user .u-role { color: var(--primary); opacity: 0.75; font-weight: 600; }

.avatar-circle {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: #fff;
  box-shadow: 0 4px 10px rgba(14, 122, 77, 0.28);
}

/* ---------- Topbar ---------- */

.topbar {
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(14px) saturate(1.3);
  -webkit-backdrop-filter: blur(14px) saturate(1.3);
  padding: 0.75rem 1.5rem;
}
.page-title { font-size: 1.25rem; letter-spacing: -0.02em; }

.topbar-search {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.45rem 1rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.topbar-search:focus-within {
  border-color: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(14, 122, 77, 0.12);
}

.icon-btn { border-radius: 0.7rem; transition: all 0.18s ease; }
.icon-btn:hover { background: var(--green-50); color: var(--primary); transform: translateY(-1px); }

/* ---------- Cards ---------- */

.dashboard-card {
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.25s ease, border-color 0.2s ease;
}
.dashboard-card:hover {
  box-shadow: var(--shadow-lg);
  border-color: rgba(14, 122, 77, 0.2);
  transform: translateY(-2px);
}

.stat-card { overflow: hidden; }
.stat-card::after {
  content: ''; position: absolute; inset: auto -30% -65% -30%; height: 65%;
  background: radial-gradient(ellipse at center, rgba(14, 122, 77, 0.1), transparent 70%);
  pointer-events: none; opacity: 0; transition: opacity 0.3s ease;
}
.stat-card:hover::after { opacity: 1; }
.stat-card .stat-label {
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.stat-card .stat-value {
  font-size: 2rem;
  letter-spacing: -0.035em;
  background: linear-gradient(100deg, var(--text), var(--text-secondary));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.stat-card .stat-icon {
  top: 1.1rem; right: 1.1rem;
  width: 2.6rem; height: 2.6rem;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 0.85rem;
  font-size: 1.05rem;
  box-shadow: 0 6px 14px rgba(15, 40, 30, 0.14);
  z-index: 1;
}
.grid > .stat-card:nth-child(1) .stat-icon { background: linear-gradient(135deg, #35C98F, #0E7A4D); color: #fff; }
.grid > .stat-card:nth-child(2) .stat-icon { background: linear-gradient(135deg, #FBBF24, #D97706); color: #fff; }
.grid > .stat-card:nth-child(3) .stat-icon { background: linear-gradient(135deg, #F87171, #DC2626); color: #fff; }
.grid > .stat-card:nth-child(4) .stat-icon { background: linear-gradient(135deg, #60A5FA, #2563EB); color: #fff; }
.grid > .stat-card:nth-child(5) .stat-icon { background: linear-gradient(135deg, #A78BFA, #7C3AED); color: #fff; }
.grid > .stat-card:nth-child(6) .stat-icon { background: linear-gradient(135deg, #22D3EE, #0E7490); color: #fff; }

/* ---------- Buttons ---------- */

.btn {
  border-radius: 0.7rem;
  box-shadow: 0 1px 2px rgba(15, 40, 30, 0.06);
  transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}
.btn:hover { filter: brightness(0.98); transform: translateY(-1px); }
.btn:active { transform: translateY(0) scale(0.98); }

.btn-primary {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  box-shadow: 0 8px 18px rgba(14, 122, 77, 0.28);
}
.btn-primary:hover { box-shadow: 0 12px 26px rgba(14, 122, 77, 0.38); }
.btn-primary:disabled { box-shadow: none; }

.btn-secondary { background: linear-gradient(135deg, var(--secondary), #0C5F75); box-shadow: 0 8px 18px rgba(14, 116, 144, 0.24); }
.btn-success { background: linear-gradient(135deg, #22C55E, #15803D); box-shadow: 0 8px 18px rgba(22, 163, 74, 0.24); }
.btn-error { background: linear-gradient(135deg, #EF4444, #B91C1C); box-shadow: 0 8px 18px rgba(220, 38, 38, 0.24); }
.btn-outline { box-shadow: none; }
.btn-outline:hover { box-shadow: 0 6px 14px rgba(14, 122, 77, 0.12); }
.btn-ghost { box-shadow: none; }

/* ---------- Forms ---------- */

.input, .textarea, .select {
  border-radius: 0.7rem;
  border-color: var(--border);
  background: var(--surface);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.input:focus, .textarea:focus, .select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(14, 122, 77, 0.15);
}

/* ---------- Tables ---------- */

.table th {
  background: var(--surface-2);
  color: var(--text-secondary);
  font-weight: 700;
  padding: 0.7rem 0.85rem;
}
.table td { padding: 0.85rem 0.85rem; border-bottom: 1px solid var(--border); }
.table tbody tr { transition: background 0.15s ease; }
.table tbody tr:hover { background: var(--green-50); }

/* ---------- Status badges ---------- */

.status-badge { font-size: 0.72rem; letter-spacing: 0.01em; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.03); }

/* ---------- Empty states ---------- */

.empty-state i {
  width: 4.2rem; height: 4.2rem; margin: 0 auto 0.9rem;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.7rem;
  border-radius: 9999px;
  background: var(--primary-soft);
  color: var(--primary);
  opacity: 1;
}

/* ---------- Quick actions ---------- */

.quick-action {
  border: 1px solid var(--border);
  border-radius: 0.85rem;
  padding: 1rem;
  box-shadow: var(--shadow);
}
.quick-action:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.quick-action i {
  width: 2.6rem; height: 2.6rem; border-radius: 0.8rem;
  background: var(--primary-soft); color: var(--primary);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 1.1rem; flex-shrink: 0;
  transition: transform 0.2s ease;
}
.quick-action:hover i { transform: scale(1.1) rotate(-4deg); }
.quick-action-emergency { background: var(--red-50); border-color: rgba(220, 38, 38, 0.28); }
.quick-action-emergency i { background: linear-gradient(135deg, #F87171, #DC2626); color: #fff !important; }

/* ---------- Modals ---------- */

.modal-box { border-radius: 1.25rem; box-shadow: 0 30px 70px rgba(7, 60, 38, 0.22); }
.modal-backdrop { background: rgba(15, 30, 24, 0.55); backdrop-filter: blur(3px); }
.modal-header { border-radius: 1.25rem 1.25rem 0 0; }
.modal-title { letter-spacing: -0.02em; }

/* ---------- Auth ---------- */

.auth-card { border-radius: 1.5rem; box-shadow: 0 24px 60px -16px rgba(2, 132, 199, 0.18), 0 8px 24px -12px rgba(34, 197, 94, 0.12); }

/* ---------- Notifications ---------- */

.notification-dropdown { border-radius: 1rem; box-shadow: var(--shadow-lg); }
.notification-item { transition: background 0.15s ease; }
.notification-item:hover { background: var(--green-50); }

/* ---------- Scrollbars ---------- */

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb {
  background: #CBD5CF; border-radius: 999px; border: 2px solid transparent; background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover { background: #B0BDB6; background-clip: padding-box; }
::-webkit-scrollbar-track { background: transparent; }
html.dark ::-webkit-scrollbar-thumb { background: #2C4037; border: 2px solid transparent; background-clip: padding-box; }
html.dark ::-webkit-scrollbar-thumb:hover { background: #3A5548; background-clip: padding-box; }

/* ---------- Dark-mode parity (toggle) ---------- */

html.dark body { background: var(--background); }
html.dark .topbar { background: rgba(19, 33, 27, 0.82); }
html.dark .sidebar-footer-user { background: var(--surface-2); }
html.dark .quick-action-emergency i { background: linear-gradient(135deg, #B91C1C, #7F1D1D); }
html.dark .modal-backdrop { background: rgba(0, 0, 0, 0.6); }

@media (prefers-color-scheme: dark) {
  .topbar { background: rgba(19, 33, 27, 0.82); }
  .sidebar-footer-user { background: var(--surface-2); }
  .modal-backdrop { background: rgba(0, 0, 0, 0.6); }
}

/* ============================================================
   Mobile polish (small viewports / smartphones)
   ============================================================ */

.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 45;
  background: rgba(15, 30, 24, 0.5);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}

@media (max-width: 767px) {
  .sidebar-backdrop { display: block; opacity: 0; pointer-events: none; transition: opacity 0.25s ease; }
  .sidebar-backdrop.show { opacity: 1; pointer-events: auto; }

  /* --- Topbar --- */
  .topbar { gap: 0.5rem; padding: 0.55rem 0.75rem; }
  .page-title {
    font-size: 1rem;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 0 1 auto;
  }
  .topbar-actions { gap: 0.1rem; flex-shrink: 0; }
  .icon-btn { width: 2.15rem; height: 2.15rem; }

  /* --- Notification dropdown fits the phone screen --- */
  .notification-dropdown {
    position: fixed;
    top: 3.6rem;
    right: 0.75rem;
    left: 0.75rem;
    width: auto;
    max-height: 70vh;
  }

  /* --- Cards / spacing --- */
  .main-content { padding: 0.75rem; }
  .dashboard-card { padding: 1rem; }
  .stat-card { padding: 1rem 1.1rem; min-height: 5.5rem; }
  .stat-card .stat-value { font-size: 1.65rem; }
  .mb-6 { margin-bottom: 1rem; }
  .gap-6 { gap: 1rem; }
  .quick-actions-grid { grid-template-columns: 1fr; }

  /* --- Detail grids go single column --- */
  .referral-detail-grid,
  .facility-detail-grid { grid-template-columns: 1fr; }

  /* --- Filter bars stack full width --- */
  .filter-bar,
  .facility-filter-bar,
  .directory-filter-bar {
    display: grid;
    grid-template-columns: 1fr;
    align-items: stretch;
  }
  .filter-bar > *,
  .facility-filter-bar > *,
  .directory-filter-bar > * { width: 100%; min-width: 0; }

  /* --- Tabs scroll instead of wrapping --- */
  .tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .tabs .tab { flex: 0 0 auto; white-space: nowrap; }

  /* --- Modal footer stacks full-width buttons --- */
  .modal-footer { flex-direction: column-reverse; align-items: stretch; }
  .modal-footer .btn { width: 100%; }
  .modal-box.modal-sm,
  .modal-box.modal-md,
  .modal-box.modal-lg,
  .modal-box.modal-xl { max-width: 100%; }
  .modal-body { padding: 1rem; }
  .modal-header { padding: 0.9rem 1rem; }
  .modal-footer { padding: 0.9rem 1rem; }

  /* --- Auth pages --- */
  .auth-page { padding: 1rem; }
  .auth-card { padding: 1.5rem 1.25rem; border-radius: 1.15rem; }

  /* --- Sidebar: roomier tap targets --- */
  .sidebar { padding: 1rem 0.75rem; }
  .nav-link { padding: 0.8rem 0.9rem; font-size: 0.95rem; }

  /* --- Banners stack --- */
  .webinar-banner { flex-direction: column; text-align: center; }
  .webinar-banner .btn { width: 100%; }

  /* --- Facility map --- */
  .facility-map { height: 320px; }
  .map-legend { left: 0.5rem; right: 0.5rem; bottom: 0.5rem; }

  /* --- CPD ring shrinks --- */
  .cpd-ring { width: 8.5rem; height: 8.5rem; }
  .cpd-ring-center { width: 6.4rem; height: 6.4rem; }
  .cpd-points { font-size: 1.6rem; }

  /* --- Chat main fits viewport --- */
  .chat-main { height: calc(100vh - 11rem); }

  /* --- Toast spans the screen --- */
  #toast-container { left: 0.75rem; right: 0.75rem; }
  .toast { min-width: 0; max-width: none; width: 100%; }
}

/* Very narrow phones: collapse 2-col form grids so inputs stay usable */
@media (max-width: 419px) {
  .grid-cols-2 {
    grid-template-columns: minmax(0, 1fr);
  }
  .modal-box { max-height: 92vh; }
}

/* ================== In-app Live Meeting room (live.html) ================== */

.live-body { background: var(--surface-2); }

.live-stage {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.live-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 0.9rem 1.25rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.live-header-left { display: flex; align-items: center; gap: 0.85rem; min-width: 0; }
.live-title { font-weight: 800; font-size: 1.05rem; color: var(--text); line-height: 1.2; }
.live-meta { display: flex; align-items: center; gap: 0.9rem; flex-wrap: wrap; font-size: 0.8rem; color: var(--text-secondary); }

.live-badge {
  display: inline-flex; align-items: center; gap: 0.35rem;
  background: #FEF2F2; color: #DC2626;
  padding: 0.15rem 0.6rem; border-radius: 999px;
  font-weight: 600; font-size: 0.75rem;
}
.live-badge i { font-size: 0.55rem; animation: live-pulse 1.4s ease-in-out infinite; }
@keyframes live-pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.3; } }

.live-header-right { display: flex; align-items: center; gap: 0.5rem; }

.live-main {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 21rem;
  gap: 1rem;
  padding: 1rem 1.25rem;
}

.live-video-area {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  min-width: 0;
}

.live-video-wrap {
  position: relative;
  flex: 1;
  min-height: 26rem;
  background: #0B0F0D;
  border-radius: 1rem;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.live-video-wrap video { width: 100%; height: 100%; object-fit: contain; }

.live-empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.75rem;
  color: #8AA298; font-size: 1rem; text-align: center; padding: 1.5rem;
}
.live-empty i { font-size: 2.6rem; color: #33473D; }

.live-local {
  position: absolute; right: 0.85rem; bottom: 0.85rem;
  width: 14rem; max-width: 34%; aspect-ratio: 16/9;
  border-radius: 0.7rem; overflow: hidden;
  border: 2px solid var(--primary-light);
  box-shadow: 0 6px 18px rgba(0,0,0,0.45);
}
.live-local video { width: 100%; height: 100%; object-fit: cover; }
.live-local-tag {
  position: absolute; left: 0.4rem; bottom: 0.4rem;
  background: rgba(0,0,0,0.55); color: #fff;
  font-size: 0.7rem; padding: 0.15rem 0.5rem; border-radius: 999px;
}

.live-controls {
  display: flex; align-items: center; justify-content: center; gap: 0.6rem; flex-wrap: wrap;
  padding: 0.75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0.85rem;
}
.live-control-btn {
  display: inline-flex; align-items: center; gap: 0.45rem;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  border-radius: 0.7rem;
  padding: 0.55rem 0.9rem;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.18s ease;
}
.live-control-btn:hover { border-color: var(--primary-light); color: var(--primary); }
.live-control-btn.btn-primary-solid { background: var(--primary); color: #fff; border-color: var(--primary); }
.live-control-btn.btn-primary-solid:hover { background: var(--primary-dark); }
.live-control-btn.btn-error-solid { background: #DC2626; color: #fff; border-color: #DC2626; }
.live-control-btn.btn-error-solid:hover { background: #B91C1C; }

/* Live chat panel */
.live-chat-panel {
  display: flex; flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0.85rem;
  overflow: hidden;
  max-height: calc(100vh - 7rem);
}
.live-chat-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}
.live-chat-count {
  background: var(--primary-soft); color: var(--primary);
  font-size: 0.75rem; font-weight: 700;
  padding: 0.15rem 0.55rem; border-radius: 999px;
}
.live-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 0.85rem;
  display: flex; flex-direction: column; gap: 0.6rem;
}
.live-chat-msg { background: var(--surface-2); border-radius: 0.6rem; padding: 0.5rem 0.7rem; }
.live-chat-msg.mine { background: var(--primary-soft); }
.live-chat-msg-head { display: flex; align-items: baseline; gap: 0.4rem; font-size: 0.75rem; }
.live-chat-msg-head b { color: var(--primary); }
.live-chat-msg-head span { color: var(--text-muted); }
.live-chat-msg-head small { margin-left: auto; color: var(--text-muted); }
.live-chat-msg-body { font-size: 0.86rem; color: var(--text); margin-top: 0.15rem; word-break: break-word; }

.live-chat-composer {
  display: flex; gap: 0.5rem;
  padding: 0.7rem;
  border-top: 1px solid var(--border);
}
.live-chat-composer input {
  flex: 1;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 0.6rem;
  padding: 0.5rem 0.8rem;
  font-size: 0.88rem;
  outline: none;
}
.live-chat-composer input:focus { border-color: var(--primary-light); }

/* Chat tabs */
.live-chat-tabs {
  display: flex; border-bottom: 1px solid var(--border);
}
.live-chat-tab {
  flex: 1; padding: 0.65rem; text-align: center;
  background: none; border: none; border-bottom: 2px solid transparent;
  color: var(--text-muted); font-size: 0.82rem; font-weight: 600;
  cursor: pointer; transition: all 0.15s;
}
.live-chat-tab:hover { color: var(--text); background: var(--surface-2); }
.live-chat-tab.active { color: var(--primary); border-bottom-color: var(--primary); }
.live-chat-section { display: flex; flex-direction: column; flex: 1; min-height: 0; }

/* Control divider */
.live-ctrl-divider {
  width: 1px; height: 1.6rem;
  background: var(--border); margin: 0 0.15rem;
  align-self: center;
}

/* Hand raised */
.live-control-btn.hand-raised {
  background: #FEF3C7; color: #D97706; border-color: #F59E0B;
  animation: hand-wiggle 0.6s ease-in-out infinite;
}
@keyframes hand-wiggle { 0%,100% { transform: rotate(0); } 25% { transform: rotate(-8deg); } 75% { transform: rotate(8deg); } }
.live-hand-badge {
  display: inline-flex; align-items: center; gap: 0.3rem;
  background: #FEF3C7; color: #92400E;
  padding: 0.2rem 0.6rem; border-radius: 999px;
  font-size: 0.75rem; font-weight: 600;
  animation: hand-in 0.3s ease;
}
@keyframes hand-in { from { opacity: 0; transform: scale(0.5); } to { opacity: 1; transform: scale(1); } }
.live-hands-overlay {
  position: absolute; top: 0.6rem; left: 0.6rem;
  display: flex; gap: 0.4rem; flex-wrap: wrap;
  z-index: 10;
}

/* Noise suppression */
.live-control-btn.noise-active {
  background: #059669; color: #fff; border-color: #059669;
}

/* Captions */
.live-control-btn.captions-active {
  background: #2563EB; color: #fff; border-color: #2563EB;
}
.live-captions {
  position: absolute; bottom: 0; left: 0; right: 0;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,0.75); color: #fff;
  font-size: 0.9rem; font-weight: 500;
  padding: 0.6rem 1rem; min-height: 2.4rem;
  z-index: 10; word-break: break-word; text-align: center;
}

/* Reactions picker */
.live-reactions-picker {
  display: flex; gap: 0.35rem; flex-wrap: wrap;
  padding: 0.55rem 0.75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  justify-content: center;
}
.live-react-emoji {
  font-size: 1.4rem; background: none; border: none;
  cursor: pointer; padding: 0.3rem; border-radius: 0.5rem;
  transition: all 0.15s;
}
.live-react-emoji:hover { background: var(--surface-2); transform: scale(1.25); }

/* Floating reactions */
.live-reactions-float {
  position: absolute; inset: 0; pointer-events: none;
  overflow: hidden; z-index: 15;
}
.live-float-emoji {
  position: absolute; bottom: 10%;
  font-size: 2.2rem;
  animation: float-up 2.5s ease-out forwards;
}
@keyframes float-up {
  0% { opacity: 1; transform: translateY(0) scale(1); }
  50% { opacity: 1; transform: translateY(-40vh) scale(1.3); }
  100% { opacity: 0; transform: translateY(-70vh) scale(0.8); }
}

/* People list */
.live-people-list {
  flex: 1; overflow-y: auto; padding: 0.5rem;
  display: flex; flex-direction: column; gap: 0.3rem;
}
.live-person {
  display: flex; align-items: center; gap: 0.6rem;
  padding: 0.5rem 0.65rem;
  border-radius: 0.55rem;
  transition: background 0.15s;
}
.live-person:hover { background: var(--surface-2); }
.live-person-avatar {
  width: 2rem; height: 2rem;
  display: flex; align-items: center; justify-content: center;
  background: var(--primary-soft); color: var(--primary);
  border-radius: 50%; font-size: 0.75rem; flex-shrink: 0;
}
.live-person-info { display: flex; flex-direction: column; min-width: 0; }
.live-person-name { font-size: 0.82rem; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.live-person-role { font-size: 0.7rem; color: var(--text-muted); }
.live-person-hand { color: #D97706; font-size: 0.9rem; animation: hand-wiggle 0.6s ease-in-out infinite; }

/* Screen sharing active */
.live-control-btn.screen-sharing {
  background: #7C3AED; color: #fff; border-color: #7C3AED;
  animation: screen-share-pulse 2s ease-in-out infinite;
}
.live-control-btn.screen-sharing:hover { background: #6D28D9; }
@keyframes screen-share-pulse { 0%,100% { box-shadow: 0 0 0 0 rgba(124,58,237,0.5); } 50% { box-shadow: 0 0 0 8px rgba(124,58,237,0); } }
.live-screen-banner {
  position: absolute; top: 0; left: 0; right: 0;
  display: flex; align-items: center; justify-content: center; gap: 0.5rem;
  background: linear-gradient(135deg, #7C3AED, #2563EB);
  color: #fff; font-size: 0.82rem; font-weight: 600;
  padding: 0.55rem 1rem; z-index: 10;
  animation: screen-banner-in 0.3s ease;
}
@keyframes screen-banner-in { from { opacity: 0; transform: translateY(-100%); } to { opacity: 1; transform: translateY(0); } }

/* Connection quality */
.conn-quality { font-size: 0.75rem; }

@media (max-width: 900px) {
  .live-main { grid-template-columns: 1fr; }
  .live-chat-panel { max-height: 24rem; }
  .live-video-wrap { min-height: 18rem; }
  .live-ctrl-divider { display: none; }
}

/* ============================================================
   CPD Course Builder — objectives, sessions, question builder
   ============================================================ */

.pm-step-btn { font-size: 0.8rem; }
.pm-step-btn.active { font-weight: 700; }

.pm-obj-card { position: relative; }
.pm-sess-row textarea { resize: vertical; min-height: 3.5rem; }

.pm-opt-correct { border-color: var(--primary) !important; background: var(--primary-soft) !important; }

.pm-q-card { position: relative; }

@media (max-width: 600px) {
  .pm-step-btn { font-size: 0.7rem; padding: 0.25rem 0.5rem; }
  .grid-cols-3 { grid-template-columns: 1fr; }
  .edu-grid { grid-template-columns: 1fr; }
}

/* Keep Learning Center search/filters visible on mobile (topbar-search is hidden in topbar) */
@media (max-width: 767px) {
  #learning-courses .topbar-search,
  #learning-webinars .topbar-search { display: flex; }
  #learning-courses .topbar-search { flex: 1 1 100%; }
  #learning-webinars .topbar-search { flex: 1 1 100%; }
}



/* ===== ICD-10 / ICD-11 diagnosis coder ===== */
.icd-search-results {
  position: relative; z-index: 20;
  max-height: 220px; overflow-y: auto;
  border: 1px solid var(--border, #dce8f2); border-radius: 10px;
  background: var(--card, #fff); margin-top: 0.4rem;
  box-shadow: 0 10px 30px -12px rgba(2, 30, 55, 0.25);
}
.icd-result-item {
  display: flex; align-items: center; justify-content: space-between; gap: 0.6rem;
  padding: 0.55rem 0.75rem; cursor: pointer; border-bottom: 1px solid rgba(220,232,242,0.5);
}
.icd-result-item:hover { background: rgba(14,165,233,0.06); }
.icd-result-item .sys {
  flex: none; font-size: 0.68rem; font-weight: 700; letter-spacing: 0.04em;
  padding: 0.15rem 0.45rem; border-radius: 999px;
}
.icd-result-item .sys.icd11 { background: rgba(14,165,233,0.12); color: #0284C7; }
.icd-result-item .sys.icd10 { background: rgba(130,71,229,0.12); color: #7C3AED; }
.icd-result-item .code { font-family: var(--font-mono, ui-monospace, monospace); font-size: 0.8rem; color: var(--primary, #0ea5e9); font-weight: 700; white-space: nowrap; }
.icd-result-item .t { font-size: 0.83rem; line-height: 1.25; }
.icd-chips { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.6rem; }
.icd-chip {
  display: inline-flex; align-items: center; gap: 0.4rem;
  border: 1px solid var(--border, #dce8f2); border-radius: 999px;
  padding: 0.3rem 0.7rem; font-size: 0.8rem; background: var(--card, #fff);
}
.icd-chip.icd11 { border-color: rgba(14,165,233,0.4); background: rgba(14,165,233,0.07); }
.icd-chip.icd10 { border-color: rgba(130,71,229,0.4); background: rgba(130,71,229,0.06); }
.icd-chip .code { font-weight: 800; font-family: var(--font-mono, ui-monospace, monospace); }
.icd-chip .x { cursor: pointer; opacity: 0.5; }
.icd-chip .x:hover { opacity: 1; }
.icd-house { display:inline-flex; align-items:center; gap:0.45rem; flex-wrap:wrap; margin-top:0.35rem; }
.icd-house .icd-chip { margin: 0; }

/* ==== Booking lifecycle stepper ==== */
.booking-steps { display:flex; align-items:center; gap:0.4rem; flex-wrap:wrap; margin-top:0.6rem; }
.booking-step {
  display:inline-flex; align-items:center; gap:0.4rem; font-size:0.8rem; font-weight:700;
  padding:0.35rem 0.8rem; border-radius:999px; border:1px solid var(--border,#dce8f2); color:var(--muted,#5a6b7a);
}
.booking-step.active { border-color:var(--primary,#0ea5e9); color:var(--primary,#0ea5e9); background:rgba(14,165,233,0.08); }
.booking-step.done { border-color:var(--green,#22c55e); color:var(--green,#22c55e); background:rgba(34,197,94,0.08); }
.booking-step.cancelled { border-color:#DC2626; color:#DC2626; background:rgba(220,38,38,0.07); }
.booking-steps .step-divider { color:var(--border,#dce8f2); }
@media (max-width: 640px) { .booking-steps .step-label { display:none; } }
