/* ==========================================================================
   PulsePoint Clinic Pro - Master Stylesheet
   Modern Glassmorphism Medical Design System
   ========================================================================== */

:root {
  --bg-primary: #0a0e17;
  --bg-secondary: #111827;
  --bg-surface: rgba(17, 24, 39, 0.7);
  --bg-surface-elevated: rgba(30, 41, 59, 0.85);
  --bg-surface-hover: rgba(39, 53, 77, 0.8);

  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-light: rgba(255, 255, 255, 0.15);
  --border-focus: #0ea5e9;

  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --text-inverse: #0a0e17;

  /* Brand Accents */
  --primary: #0ea5e9;
  --primary-hover: #0284c7;
  --primary-glow: rgba(14, 165, 233, 0.25);

  --accent-new: #10b981;
  --accent-new-bg: rgba(16, 185, 129, 0.15);
  --accent-new-border: rgba(16, 185, 129, 0.35);

  --accent-followup: #818cf8;
  --accent-followup-bg: rgba(99, 102, 241, 0.15);
  --accent-followup-border: rgba(99, 102, 241, 0.35);

  --accent-warning: #f59e0b;
  --accent-warning-bg: rgba(245, 158, 11, 0.15);

  --accent-danger: #ef4444;
  --accent-danger-bg: rgba(239, 68, 68, 0.15);

  --accent-purple: #a855f7;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.6);
  --shadow-glow: 0 0 24px rgba(14, 165, 233, 0.2);

  --font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  --transition-smooth: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Light Theme Variables */
[data-theme="light"] {
  --bg-primary: #f8fafc;
  --bg-secondary: #ffffff;
  --bg-surface: rgba(255, 255, 255, 0.92);
  --bg-surface-elevated: #ffffff;
  --bg-surface-hover: #f1f5f9;

  --border-subtle: #e2e8f0;
  --border-light: #cbd5e1;
  --border-focus: #0284c7;

  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;
  --text-inverse: #ffffff;

  --primary: #0284c7;
  --primary-hover: #0369a1;
  --primary-glow: rgba(2, 132, 199, 0.15);
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 4px 16px rgba(15, 23, 42, 0.06);
  --shadow-lg: 0 12px 32px rgba(15, 23, 42, 0.08);
}

/* Base Resets */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-family);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  background-image:
    radial-gradient(at 10% 20%, rgba(14, 165, 233, 0.08) 0px, transparent 50%),
    radial-gradient(at 90% 80%, rgba(99, 102, 241, 0.07) 0px, transparent 50%);
  background-attachment: fixed;
}

/* App Container */
#app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ==========================================================================
   Header & Demo Persona Switcher Bar
   ========================================================================== */
.top-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg-surface);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-subtle);
  padding: 0.75rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  transition: background-color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

[data-theme="light"] .top-header {
  background: rgba(255, 255, 255, 0.94);
  border-bottom: 1px solid #e2e8f0;
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.04);
}

.brand-wrapper {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  flex-shrink: 0;
}

.brand-icon {
  width: 50px;
  height: 33px;
  background: #ffffff;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2px 3px;
  overflow: hidden;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.12), 0 0 10px rgba(14, 165, 233, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.3);
  flex-shrink: 0;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.brand-icon:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 14px rgba(14, 165, 233, 0.35);
}

.brand-logo-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.brand-title {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.brand-name {
  background: linear-gradient(to right, #f8fafc, #94a3b8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  display: inline-block;
}

[data-theme="light"] .brand-name {
  background: linear-gradient(to right, #0f172a, #1e293b);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-badge {
  font-size: 0.68rem;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  display: inline-flex;
  align-items: center;
  line-height: 1;
  background: rgba(14, 165, 233, 0.2);
  color: #38bdf8;
  border: 1px solid rgba(14, 165, 233, 0.4);
  -webkit-text-fill-color: currentColor !important;
  -webkit-background-clip: border-box !important;
}

.brand-badge.role-receptionist {
  background: rgba(16, 185, 129, 0.18);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.35);
  -webkit-text-fill-color: #34d399 !important;
}

[data-theme="light"] .brand-badge.role-receptionist {
  background: #ecfdf5;
  color: #047857 !important;
  border: 1px solid #6ee7b7;
  font-weight: 800;
  -webkit-text-fill-color: #047857 !important;
}

.brand-badge.role-admin {
  background: rgba(239, 68, 68, 0.18);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.35);
  -webkit-text-fill-color: #f87171 !important;
}

[data-theme="light"] .brand-badge.role-admin {
  background: #fef2f2;
  color: #b91c1c !important;
  border: 1px solid #fca5a5;
  font-weight: 800;
  -webkit-text-fill-color: #b91c1c !important;
}

/* Clinic Active Context Badge / Pill */
.clinic-context-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.32rem 0.85rem;
  background: rgba(30, 41, 59, 0.75);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-full);
  font-size: 0.82rem;
  color: var(--text-secondary);
  flex: 0 1 auto;
  min-width: 0;
  max-width: 520px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
  cursor: pointer;
  user-select: none;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

[data-theme="light"] .clinic-context-chip {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
}

.clinic-context-chip:hover {
  border-color: rgba(56, 189, 248, 0.5);
  background: rgba(30, 41, 59, 0.95);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25), 0 0 12px rgba(14, 165, 233, 0.15);
  transform: translateY(-1px);
}

[data-theme="light"] .clinic-context-chip:hover {
  border-color: #0284c7;
  background: #ffffff;
  box-shadow: 0 2px 8px rgba(14, 165, 233, 0.12), 0 1px 3px rgba(15, 23, 42, 0.04);
  transform: translateY(-1px);
}

.clinic-context-chip:focus-visible,
.clinic-chip-config-badge:focus-visible {
  outline: 2px solid #38bdf8;
  outline-offset: 2px;
}

.clinic-chip-lead {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.clinic-chip-icon-box {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  background: linear-gradient(135deg, rgba(14, 165, 233, 0.18), rgba(99, 102, 241, 0.12));
  border: 1px solid rgba(14, 165, 233, 0.3);
}

[data-theme="light"] .clinic-chip-icon-box {
  background: #f0f9ff;
  border: 1px solid #bae6fd;
}

.clinic-chip-lead .pulse-indicator {
  position: absolute;
  bottom: -1px;
  right: -1px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: #10b981;
  border: 2px solid #0f172a;
  box-shadow: 0 0 5px #10b981;
}

[data-theme="light"] .clinic-chip-lead .pulse-indicator {
  border: 2px solid #ffffff;
}

.clinic-context-text {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.1rem;
  min-width: 0;
  flex: 1 1 auto;
  text-align: left;
}

.clinic-context-main-row {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  min-width: 0;
  white-space: nowrap;
}

.clinic-context-title {
  font-size: 0.86rem;
  font-weight: 750;
  color: #f8fafc;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 0 1 auto;
  min-width: 0;
  max-width: 260px;
  line-height: 1.25;
}

[data-theme="light"] .clinic-context-title {
  color: #0f172a;
}

.clinic-context-hours {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  padding: 1.5px 7px;
  border-radius: var(--radius-full);
  font-size: 0.68rem;
  font-weight: 600;
  white-space: nowrap;
  line-height: 1.35;
  background: rgba(14, 165, 233, 0.12);
  color: #38bdf8;
  border: 1px solid rgba(14, 165, 233, 0.3);
  flex-shrink: 0;
}

[data-theme="light"] .clinic-context-hours {
  background: #f0f9ff;
  color: #0284c7;
  border: 1px solid #bae6fd;
}

.clinic-context-sub-row {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  min-width: 0;
  white-space: nowrap;
}

.clinic-doctor-icon {
  font-size: 0.72rem;
  opacity: 0.85;
  flex-shrink: 0;
}

.clinic-context-doctor {
  font-size: 0.72rem;
  font-weight: 500;
  color: #94a3b8;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 240px;
  line-height: 1.2;
}

[data-theme="light"] .clinic-context-doctor {
  color: #64748b;
}

.clinic-chip-config-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(14, 165, 233, 0.08);
  border: 1px solid rgba(14, 165, 233, 0.2);
  color: #38bdf8;
  font-size: 0.78rem;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  flex-shrink: 0;
  margin-left: 0.2rem;
}

[data-theme="light"] .clinic-chip-config-badge {
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  color: #475569;
}

.clinic-chip-config-badge:hover,
.clinic-context-chip:hover .clinic-chip-config-badge {
  background: #0284c7;
  border-color: #0284c7;
  color: #ffffff;
  transform: rotate(60deg) scale(1.08);
}

.config-gear-icon {
  display: inline-block;
  font-size: 0.78rem;
  line-height: 1;
}

.btn-clinic-config-action {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-weight: 600;
  border-color: rgba(14, 165, 233, 0.3);
  transition: all 0.2s ease;
}

.btn-clinic-config-action:hover {
  border-color: #38bdf8;
  color: #38bdf8;
  box-shadow: 0 0 10px rgba(14, 165, 233, 0.18);
}

.btn-whatsapp-cta {
  background: linear-gradient(135deg, #25d366 0%, #128c7e 100%) !important;
  color: #ffffff !important;
  border: 1px solid #20ba5a !important;
  font-weight: 700 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 0.65rem !important;
  padding: 0.85rem 1.25rem !important;
  border-radius: var(--radius-md) !important;
  font-size: 0.95rem !important;
  text-decoration: none !important;
  box-shadow: 0 4px 14px rgba(37, 211, 102, 0.35) !important;
  transition: all 0.25s ease !important;
  width: 100% !important;
  cursor: pointer !important;
  box-sizing: border-box !important;
}

.btn-whatsapp-cta:hover {
  background: linear-gradient(135deg, #20ba5a 0%, #075e54 100%) !important;
  box-shadow: 0 6px 20px rgba(37, 211, 102, 0.5) !important;
  transform: translateY(-2px) !important;
  color: #ffffff !important;
}

.btn-copy-whatsapp {
  margin-top: 6px;
  width: 100%;
  font-size: 0.82rem;
  padding: 0.48rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  color: var(--text-secondary);
}

.whatsapp-chip {
  background: rgba(37, 211, 102, 0.15) !important;
  color: #25d366 !important;
  border: 1px solid rgba(37, 211, 102, 0.35) !important;
  font-weight: 700 !important;
}

.pulse-indicator {
  width: 8px;
  height: 8px;
  background-color: #10b981;
  border-radius: 50%;
  box-shadow: 0 0 8px #10b981;
  animation: pulseAnim 2s infinite;
  flex-shrink: 0;
}

@keyframes pulseAnim {
  0% {
    transform: scale(0.95);
    opacity: 0.8;
  }

  50% {
    transform: scale(1.2);
    opacity: 1;
  }

  100% {
    transform: scale(0.95);
    opacity: 0.8;
  }
}

/* Persona Switcher Dropdown / Buttons */
.header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
  margin-left: auto;
}

/* Header User Profile Pill */
.header-user-profile {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.3rem 0.65rem 0.3rem 0.4rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
}

[data-theme="light"] .header-user-profile {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
}

.user-avatar-circle {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary) 0%, #6366f1 100%);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.75rem;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
  flex-shrink: 0;
}

.user-info-text {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
  text-align: left;
}

.user-display-name {
  font-weight: 700;
  font-size: 0.78rem;
  color: var(--text-primary);
  white-space: nowrap;
}

.user-display-role {
  font-size: 0.65rem;
  color: var(--text-muted);
}

.logout-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.45rem 0.8rem;
  border-radius: var(--radius-md);
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.25);
  color: #f87171;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.logout-btn:hover {
  background: #ef4444;
  border-color: #ef4444;
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.35);
  transform: translateY(-1px);
}

.logout-icon {
  font-size: 0.95rem;
  line-height: 1;
}

/* Header Live Clock */
.header-live-clock {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-secondary);
  background: rgba(30, 41, 59, 0.65);
  padding: 0.38rem 0.8rem;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-subtle);
  font-variant-numeric: tabular-nums;
  display: flex;
  align-items: center;
  transition: var(--transition-smooth);
}

[data-theme="light"] .header-live-clock {
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  color: #334155;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03);
}

/* Theme Toggle Button */
.theme-toggle-btn {
  background: rgba(30, 41, 59, 0.65);
  border: 1px solid var(--border-subtle);
  color: #facc15;
  border-radius: var(--radius-full);
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.1rem;
  transition: var(--transition-smooth);
  flex-shrink: 0;
}

.theme-toggle-btn:hover {
  background: var(--bg-surface-hover);
  transform: scale(1.06);
}

[data-theme="light"] .theme-toggle-btn {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  color: #d97706;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
}

[data-theme="light"] .theme-toggle-btn:hover {
  background: #f8fafc;
  border-color: #94a3b8;
  transform: scale(1.06);
}

/* ==========================================================================
   Navigation Tabs
   ========================================================================== */
.nav-tabs-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem 0;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
  overflow-x: auto;
  transition: background-color 0.2s ease, border-color 0.2s ease;
}

[data-theme="light"] .nav-tabs-bar {
  background: #ffffff;
  border-bottom: 1px solid #e2e8f0;
}

.nav-tab-btn {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.65rem 1.25rem;
  background: transparent;
  border: none;
  border-bottom: 3px solid transparent;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-smooth);
  white-space: nowrap;
}

.nav-tab-btn:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.03);
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}

[data-theme="light"] .nav-tab-btn {
  color: #64748b;
}

[data-theme="light"] .nav-tab-btn:hover {
  color: #0f172a;
  background: #f8fafc;
}

.nav-tab-btn.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  background: rgba(14, 165, 233, 0.06);
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}

[data-theme="light"] .nav-tab-btn.active {
  color: #0284c7;
  border-bottom-color: #0284c7;
  background: rgba(2, 132, 199, 0.06);
}

/* Role Segregation: hide admin-only elements for receptionist and vice-versa */
.role-hidden,
.nav-tab-btn.role-hidden,
[data-role="receptionist"] #tab-btn-clinics,
[data-role="receptionist"] [data-tab="clinics"],
[data-role="receptionist"] #view-clinics,
body[data-role="receptionist"] #tab-btn-clinics,
body[data-role="receptionist"] [data-tab="clinics"],
body[data-role="receptionist"] #view-clinics,
html[data-role="receptionist"] #tab-btn-clinics,
html[data-role="receptionist"] [data-tab="clinics"],
html[data-role="receptionist"] #view-clinics {
  display: none !important;
}

[data-role="admin"] #tab-btn-queue,
[data-role="admin"] [data-tab="queue"],
[data-role="admin"] #view-queue,
body[data-role="admin"] #tab-btn-queue,
body[data-role="admin"] [data-tab="queue"],
body[data-role="admin"] #view-queue,
html[data-role="admin"] #tab-btn-queue,
html[data-role="admin"] [data-tab="queue"],
html[data-role="admin"] #view-queue {
  display: none !important;
}

.tab-badge {
  background: rgba(14, 165, 233, 0.2);
  color: var(--primary);
  font-size: 0.72rem;
  padding: 1px 7px;
  border-radius: var(--radius-full);
  font-weight: 700;
}

[data-theme="light"] .tab-badge {
  background: #e0f2fe;
  color: #0284c7;
  border: 1px solid #bae6fd;
}

.badge-long {
  display: inline;
}

.badge-short {
  display: none;
}

/* App Navigation Icons & Multi-Platform Labels */
.nav-tab-icon {
  font-size: 1.1rem;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.tab-label-short {
  display: none;
}

.tab-label-long {
  display: inline;
}

.nav-tab-action-btn {
  display: none !important;
}

.mobile-only-tab {
  display: none !important;
}

.mobile-fab {
  display: none !important;
}

/* Base Queue Status Filter Chips Bar */
.queue-status-chips-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  overflow-x: auto;
  padding: 0.35rem 0.2rem 0.65rem;
  margin-bottom: 1.25rem;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.queue-status-chips-bar::-webkit-scrollbar {
  display: none;
}

.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.45rem 0.85rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-full);
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  user-select: none;
  transition: all 0.16s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  flex-shrink: 0;
}

[data-theme="light"] .status-chip {
  background: #ffffff;
  border-color: #cbd5e1;
  color: #64748b;
}

.status-chip:hover {
  background: var(--bg-surface-elevated);
  color: var(--text-primary);
  border-color: var(--border-subtle);
}

[data-theme="light"] .status-chip:hover {
  background: #f8fafc;
  color: #0f172a;
  border-color: #94a3b8;
}

.status-chip:active {
  transform: scale(0.96);
}

.status-chip.active {
  background: var(--primary) !important;
  color: #ffffff !important;
  border-color: var(--primary) !important;
  box-shadow: 0 4px 14px rgba(2, 132, 199, 0.35) !important;
}

.status-chip .chip-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 1px 6px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-full);
  font-size: 0.72rem;
  font-weight: 800;
}

[data-theme="light"] .status-chip .chip-count {
  background: rgba(0, 0, 0, 0.08);
}

.status-chip.active .chip-count {
  background: rgba(255, 255, 255, 0.28);
  color: #ffffff;
}

.status-chip .chip-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.chip-dot.status-in_queue {
  background: #f59e0b;
  box-shadow: 0 0 6px rgba(245, 158, 11, 0.5);
}

.chip-dot.status-in_consultation {
  background: #0284c7;
  box-shadow: 0 0 6px rgba(2, 132, 199, 0.5);
}

.chip-dot.status-completed {
  background: #10b981;
  box-shadow: 0 0 6px rgba(16, 185, 129, 0.5);
}

.chip-dot.status-cancelled {
  background: #ef4444;
  box-shadow: 0 0 6px rgba(239, 68, 68, 0.5);
}

/* Mobile Bottom Sheet Drawer Styles */
.mobile-sheet-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 60000 !important;
  background: rgba(0, 0, 0, 0.72) !important;
  backdrop-filter: blur(8px) !important;
  -webkit-backdrop-filter: blur(8px) !important;
  align-items: flex-end !important;
  justify-content: center !important;
  padding: 0 !important;
  overscroll-behavior: none;
  touch-action: none;
}

.mobile-sheet-overlay.active {
  display: flex !important;
  opacity: 1 !important;
  pointer-events: auto !important;
}

.mobile-sheet-card {
  width: 100% !important;
  max-width: 580px !important;
  background: var(--bg-surface, #111827) !important;
  border: 1px solid var(--border-light, #374151) !important;
  border-bottom: none !important;
  border-radius: 24px 24px 0 0 !important;
  padding: 0 !important;
  margin: 0 !important;
  display: flex !important;
  flex-direction: column !important;
  max-height: 85vh !important;
  max-height: 85dvh !important;
  overflow: hidden !important;
  box-shadow: 0 -12px 48px rgba(0, 0, 0, 0.65) !important;
  animation: mobileSheetSlideIn 0.24s cubic-bezier(0.16, 1, 0.3, 1) forwards !important;
}

.mobile-sheet-card::before {
  display: none !important;
}

[data-theme="light"] .mobile-sheet-card {
  background: #ffffff !important;
  border-color: #cbd5e1 !important;
  box-shadow: 0 -12px 36px rgba(15, 23, 42, 0.15) !important;
}

@keyframes mobileSheetSlideIn {
  from {
    transform: translateY(100%);
  }

  to {
    transform: translateY(0);
  }
}

.mobile-sheet-drag-handle {
  width: 44px;
  height: 5px;
  background: var(--border-light, #475569);
  border-radius: 9999px;
  margin: 0.65rem auto 0.45rem;
  flex-shrink: 0;
}

[data-theme="light"] .mobile-sheet-drag-handle {
  background: #cbd5e1 !important;
}

.mobile-sheet-header {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 0.75rem !important;
  padding: 0.25rem 1.25rem 0.85rem 1.25rem !important;
  border-bottom: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.08)) !important;
  flex-shrink: 0 !important;
}

[data-theme="light"] .mobile-sheet-header {
  border-bottom-color: #e2e8f0 !important;
}

.mobile-sheet-body {
  flex: 1 1 auto !important;
  min-height: 0 !important;
  overflow-y: auto !important;
  -webkit-overflow-scrolling: touch !important;
  overscroll-behavior: contain !important;
  touch-action: pan-y !important;
  padding: 0.85rem 1.25rem calc(80px + env(safe-area-inset-bottom, 24px)) 1.25rem !important;
}


.mobile-user-profile-card {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex: 1;
  min-width: 0;
}

.mobile-user-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, #0284c7, #2563eb);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1.05rem;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(2, 132, 199, 0.35);
}

.mobile-user-details {
  min-width: 0;
  flex: 1;
}

.mobile-user-name {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mobile-user-sub {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.78rem;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mobile-user-role {
  font-weight: 700;
  color: var(--primary);
  text-transform: uppercase;
  font-size: 0.7rem;
}

.mobile-menu-section-title {
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin: 1.1rem 0 0.45rem;
  padding-left: 0.25rem;
}

.mobile-menu-list {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.mobile-menu-item {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  width: 100%;
  padding: 0.8rem 1rem;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  text-align: left;
  cursor: pointer;
  color: var(--text-primary);
  transition: all 0.16s ease;
  font-family: inherit;
  user-select: none;
}

[data-theme="light"] .mobile-menu-item {
  background: #f8fafc;
  border-color: #e2e8f0;
}

.mobile-menu-item:hover,
.mobile-menu-item:active {
  background: rgba(14, 165, 233, 0.08);
  border-color: rgba(14, 165, 233, 0.35);
}

[data-theme="light"] .mobile-menu-item:hover,
[data-theme="light"] .mobile-menu-item:active {
  background: #f0f7ff;
  border-color: #bae6fd;
}

.mobile-menu-item:active {
  transform: scale(0.985);
}

.mmi-icon {
  font-size: 1.25rem;
  flex-shrink: 0;
  line-height: 1;
}

.mmi-content {
  flex: 1;
  min-width: 0;
}

.mmi-title {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mmi-desc {
  font-size: 0.74rem;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-top: 2px;
}

.mmi-arrow {
  color: var(--text-muted);
  font-size: 1.25rem;
  font-weight: 700;
  flex-shrink: 0;
}

.mobile-menu-item-danger {
  color: #ef4444 !important;
}

.mobile-menu-item-danger .mmi-title {
  color: #ef4444 !important;
}

.mobile-menu-item-toggle {
  cursor: default;
}

.mobile-theme-switch-btn {
  width: 48px;
  height: 28px;
  border-radius: 9999px;
  background: var(--border-light);
  position: relative;
  border: none;
  cursor: pointer;
  transition: background-color 0.2s ease;
  flex-shrink: 0;
  padding: 3px;
}

.mobile-theme-switch-btn.active {
  background: var(--primary);
}

.theme-switch-slider {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #ffffff;
  display: block;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  transform: translateX(0);
}

.mobile-theme-switch-btn.active .theme-switch-slider {
  transform: translateX(20px);
}

/* Main Layout Viewport */
.main-viewport {
  flex: 1;
  padding: 1.5rem;
  max-width: 1440px;
  width: 100%;
  margin: 0 auto;
}

/* ==========================================================================
   Hero & Header Actions within View
   ========================================================================== */
.view-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.view-title-group h1 {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.view-subtitle {
  font-size: 0.88rem;
  color: var(--text-secondary);
  margin-top: 0.2rem;
}

.actions-group {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.6rem 1.15rem;
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: var(--transition-smooth);
  text-decoration: none;
  min-height: 42px;
}

.btn-primary {
  background: linear-gradient(135deg, #0ea5e9, #0284c7);
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(14, 165, 233, 0.35);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #38bdf8, #0ea5e9);
  box-shadow: 0 6px 20px rgba(14, 165, 233, 0.5);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--bg-surface-elevated);
  color: var(--text-primary);
  border-color: var(--border-light);
}

.btn-secondary:hover {
  background: var(--bg-surface-hover);
  border-color: var(--text-muted);
}

.btn-success {
  background: linear-gradient(135deg, #10b981, #059669);
  color: #fff;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.35);
}

.btn-success:hover {
  background: linear-gradient(135deg, #34d399, #10b981);
}

.btn-sm {
  padding: 0.4rem 0.8rem;
  font-size: 0.8rem;
  min-height: 34px;
}

.btn-icon {
  width: 38px;
  height: 38px;
  padding: 0;
  border-radius: var(--radius-md);
}

/* ==========================================================================
   Enhanced Refresh Queue Button with Live Indicator & Rotation Animation
   ========================================================================== */
.btn-refresh-enhanced {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-md);
  background: var(--bg-surface-elevated);
  border: 1.5px solid var(--border-light);
  color: var(--text-primary);
  font-weight: 700;
  font-size: 0.85rem;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  user-select: none;
}

[data-theme="light"] .btn-refresh-enhanced {
  background: #ffffff;
  border: 1.5px solid #cbd5e1;
  color: #0f172a;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.06);
}

.btn-refresh-enhanced:hover {
  border-color: var(--primary);
  color: var(--primary);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(14, 165, 233, 0.2);
}

[data-theme="light"] .btn-refresh-enhanced:hover {
  background: #f0f9ff;
  border-color: #0284c7;
  color: #0284c7;
  box-shadow: 0 4px 12px rgba(2, 132, 199, 0.15);
}

.btn-refresh-enhanced:active {
  transform: scale(0.97);
}

/* Pulsing Live Connectivity Indicator Dot */
.refresh-indicator-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.25);
  animation: livePulse 2s infinite ease-in-out;
  flex-shrink: 0;
}

@keyframes livePulse {

  0%,
  100% {
    transform: scale(1);
    opacity: 1;
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.5);
  }

  50% {
    transform: scale(1.15);
    opacity: 0.8;
    box-shadow: 0 0 0 4px rgba(16, 185, 129, 0);
  }
}

/* SVG Icon & 360° Spin */
.btn-refresh-icon {
  transition: transform 0.25s ease;
  flex-shrink: 0;
  color: var(--primary);
}

[data-theme="light"] .btn-refresh-icon {
  color: #0284c7;
}

@keyframes spinRefresh {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(360deg);
  }
}

.btn-refresh-enhanced.is-refreshing .btn-refresh-icon {
  animation: spinRefresh 0.75s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

.btn-refresh-enhanced.is-refreshing {
  pointer-events: none;
  opacity: 0.85;
}

/* Success Check state */
.btn-refresh-enhanced.is-synced {
  border-color: #10b981 !important;
  color: #10b981 !important;
}

.btn-refresh-enhanced.is-synced .btn-refresh-icon {
  color: #10b981 !important;
}

.btn-new-patient-enhanced {
  border-radius: var(--radius-md);
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  letter-spacing: 0.01em;
}


/* ==========================================================================
   KPI Summary Cards Grid & Collapsible Section Wrapper
   ========================================================================== */
.kpi-section-wrapper {
  margin-bottom: 1.5rem;
  transition: opacity 0.2s ease;
}

.kpi-section-header {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 0.65rem 0.95rem;
  margin-bottom: 0.75rem;
  user-select: none;
  cursor: pointer;
  transition: background-color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

[data-theme="light"] .kpi-section-header {
  background: #ffffff;
  border-color: #e2e8f0;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
}

.kpi-header-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

.kpi-header-title-wrap {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.kpi-section-heading {
  font-size: 0.85rem;
  font-weight: 800;
  color: var(--text-primary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.kpi-mini-summary {
  display: none;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.6rem;
  margin-top: 0.65rem;
  padding-top: 0.65rem;
  border-top: 1px solid var(--border-subtle);
}

.kpi-section-wrapper.is-minimized .kpi-mini-summary {
  display: grid !important;
}

.mini-chip {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.35rem 0.6rem;
  border-radius: 8px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.mini-chip .chip-icon {
  font-size: 0.85rem;
  line-height: 1;
}

.mini-chip .chip-text strong {
  font-weight: 800;
}

.mini-chip.chip-waiting {
  background: rgba(245, 158, 11, 0.12);
  color: #f59e0b;
  border: 1px solid rgba(245, 158, 11, 0.35);
}

.mini-chip.chip-consulting {
  background: rgba(14, 165, 233, 0.12);
  color: #0ea5e9;
  border: 1px solid rgba(14, 165, 233, 0.35);
}

.mini-chip.chip-completed {
  background: rgba(16, 185, 129, 0.12);
  color: #10b981;
  border: 1px solid rgba(16, 185, 129, 0.35);
}

.mini-chip.chip-scheduled {
  background: rgba(168, 85, 247, 0.12);
  color: #c084fc;
  border: 1px solid rgba(168, 85, 247, 0.35);
}

.kpi-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.32rem 0.8rem;
  border-radius: 999px;
  font-family: inherit;
  font-size: 0.75rem;
  font-weight: 700;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-light);
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.kpi-toggle-btn:hover {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
}

/* Minimized State */
.kpi-section-wrapper.is-minimized .kpi-grid {
  max-height: 0 !important;
  opacity: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  pointer-events: none !important;
  overflow: hidden !important;
}

.kpi-section-wrapper.is-minimized .kpi-mini-summary {
  display: flex !important;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.5rem;
  transition: max-height 0.3s ease, opacity 0.25s ease, margin 0.25s ease;
}

.kpi-section-wrapper .kpi-grid {
  margin-bottom: 0;
}

.kpi-card {
  background: var(--bg-surface);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.55rem 0.8rem;
  position: relative;
  overflow: hidden;
  transition: var(--transition-smooth);
}

.kpi-card:hover {
  border-color: var(--border-light);
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

.kpi-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.2rem;
  gap: 0.35rem;
}

.kpi-title {
  font-size: 0.68rem;
  color: var(--text-secondary);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.kpi-icon-pill {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  flex-shrink: 0;
}

.kpi-value {
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  line-height: 1.1;
  margin-bottom: 0.15rem;
  transition: transform 0.2s ease, color 0.2s ease;
}

@keyframes kpiBump {
  0% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.08);
    color: #38bdf8;
  }

  100% {
    transform: scale(1);
  }
}

.kpi-value.bump {
  animation: kpiBump 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.btn-quick-status {
  padding: 0.32rem 0.65rem;
  border-radius: var(--radius-md);
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  border: none;
  transition: var(--transition-smooth);
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  white-space: nowrap;
}

.btn-quick-call {
  background: rgba(14, 165, 233, 0.18);
  color: #38bdf8;
  border: 1px solid rgba(14, 165, 233, 0.4);
}

.btn-quick-call:hover {
  background: #0ea5e9;
  color: #ffffff;
  box-shadow: 0 0 12px rgba(14, 165, 233, 0.4);
}

.btn-quick-done {
  background: rgba(16, 185, 129, 0.18);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.4);
}

.btn-quick-done:hover {
  background: #10b981;
  color: #ffffff;
  box-shadow: 0 0 12px rgba(16, 185, 129, 0.4);
}

.btn-quick-checkin {
  background: rgba(168, 85, 247, 0.18);
  color: #c084fc;
  border: 1px solid rgba(168, 85, 247, 0.4);
}

.btn-quick-checkin:hover {
  background: #a855f7;
  color: #ffffff;
  box-shadow: 0 0 12px rgba(168, 85, 247, 0.4);
}

.kpi-footer {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.68rem;
  color: var(--text-muted);
  line-height: 1.15;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.kpi-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 3px 9px;
  border-radius: var(--radius-full);
  font-weight: 700;
  font-size: 0.74rem;
  white-space: nowrap !important;
  flex-shrink: 0 !important;
  line-height: 1.25;
}

.tag-new {
  background: var(--accent-new-bg);
  color: var(--accent-new);
  border: 1px solid var(--accent-new-border);
}

.tag-followup {
  background: var(--accent-followup-bg);
  color: var(--accent-followup);
  border: 1px solid var(--accent-followup-border);
}

.tag-warning {
  background: var(--accent-warning-bg);
  color: var(--accent-warning);
}

/* ==========================================================================
   Patient Intake Search Bar & Live Dropdown
   ========================================================================== */
.patient-search-section {
  position: relative;
  margin-bottom: 1.5rem;
}

.search-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.search-icon {
  position: absolute;
  left: 1.1rem;
  color: var(--text-muted);
  font-size: 1.25rem;
  pointer-events: none;
}

.patient-search-input {
  width: 100%;
  padding: 0.85rem 1.1rem 0.85rem 3rem;
  background: var(--bg-surface-elevated);
  border: 1.5px solid var(--border-light);
  border-radius: var(--radius-lg);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.95rem;
  transition: var(--transition-smooth);
  box-shadow: var(--shadow-sm);
}

.patient-search-input:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 4px var(--primary-glow);
}

.search-quick-actions {
  position: absolute;
  right: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.search-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  background: #0f172a !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  border: 1px solid rgba(255, 255, 255, 0.18) !important;
  border-radius: var(--radius-lg);
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.85);
  z-index: 90;
  max-height: 420px;
  overflow-y: auto;
  display: none;
}

[data-theme="light"] .search-dropdown {
  background: #ffffff !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  border: 1px solid #cbd5e1 !important;
  box-shadow: 0 18px 42px rgba(15, 23, 42, 0.2);
}

.search-dropdown.active {
  display: block;
}

.dropdown-header {
  padding: 0.75rem 1.25rem;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  justify-content: space-between;
}

.search-item {
  padding: 0.85rem 1.15rem;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  cursor: pointer;
  transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

.search-item:last-child {
  border-bottom: none;
}

.search-item:hover {
  background: var(--bg-surface-hover);
}

[data-theme="light"] .search-item:hover {
  background: #f8fafc;
}

.search-item-top {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
}

.search-item-avatar {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.9rem;
  flex-shrink: 0;
}

.search-item-title-group {
  flex: 1;
  min-width: 0;
}

.search-item-name {
  font-weight: 800;
  font-size: 0.98rem;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.search-item-sub {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 2px;
}

.search-item-id {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 600;
}

.search-item-badge-wrap {
  flex-shrink: 0;
}

.search-item-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  padding-left: 46px;
}

@media (max-width: 480px) {
  .search-item-bottom {
    padding-left: 0;
  }
}

.search-item-details {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.search-meta-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.78rem;
  color: var(--text-muted);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  padding: 3px 8px;
  border-radius: 6px;
  white-space: nowrap;
}

[data-theme="light"] .search-meta-pill {
  background: #f1f5f9;
  border-color: #e2e8f0;
  color: #475569;
}

.search-meta-pill .meta-text {
  font-weight: 600;
}

.book-this-patient-btn {
  white-space: nowrap;
  flex-shrink: 0;
  padding: 0.4rem 0.85rem;
  font-size: 0.82rem;
  font-weight: 700;
  border-radius: var(--radius-md);
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.not-found-prompt {
  padding: 2rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}

/* ==========================================================================
   Today's Queue List & Cards
   ========================================================================== */
.queue-container {
  background: var(--bg-surface-elevated, #1e293b);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  overflow: visible;
  box-shadow: var(--shadow-md);
  transition: background-color 0.2s ease, border-color 0.2s ease;
  position: relative;
  margin-bottom: 2.5rem;
}

.queue-container:has(.custom-status-dropdown.open),
.queue-container.has-open-menu {
  z-index: 90;
}

[data-theme="light"] .queue-container {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  box-shadow: 0 4px 20px rgba(15, 23, 42, 0.05);
}

.queue-table-header {
  display: grid;
  grid-template-columns: 80px 2.4fr 1.2fr 1.2fr 1.8fr 90px;
  padding: 1rem 1.5rem;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-subtle);
  background: rgba(15, 23, 42, 0.4);
  border-top-left-radius: var(--radius-xl);
  border-top-right-radius: var(--radius-xl);
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

[data-theme="light"] .queue-table-header {
  background: #f1f5f9;
  border-bottom: 1px solid #e2e8f0;
  color: #334155;
}

[data-theme="light"] .queue-table-header div {
  color: #334155;
  font-weight: 800;
  letter-spacing: 0.05em;
}

.queue-list {
  display: flex;
  flex-direction: column;
  overflow: visible;
}

.queue-row {
  position: relative;
  display: grid;
  grid-template-columns: 80px 2.4fr 1.2fr 1.2fr 1.8fr 90px;
  padding: 1.1rem 1.5rem;
  align-items: center;
  border-bottom: 1px solid var(--border-subtle);
  transition: background-color 0.18s ease, border-color 0.18s ease;
  background: transparent;
  overflow: visible !important;
  contain: none !important;
}

.queue-row:last-child {
  border-bottom: none;
  border-bottom-left-radius: var(--radius-xl);
  border-bottom-right-radius: var(--radius-xl);
}

.queue-placeholder {
  border-radius: var(--radius-xl);
}

/* Elevate queue row when its status dropdown menu is open */
.queue-row:has(.custom-status-dropdown.open),
.queue-row.menu-open {
  z-index: 1000 !important;
  overflow: visible !important;
  contain: none !important;
  -webkit-backface-visibility: visible !important;
  backface-visibility: visible !important;
}

.queue-row:hover {
  background: rgba(255, 255, 255, 0.02);
}

[data-theme="light"] .queue-row:hover {
  background: #f8fafc;
}

.queue-row.in-consultation {
  background: rgba(14, 165, 233, 0.08);
  border-left: 4px solid var(--primary);
}

[data-theme="light"] .queue-row.in-consultation {
  background: #f0f9ff;
  border-left: 4px solid #0284c7;
}

.token-badge {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-light);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1.1rem;
  color: var(--primary);
  line-height: 1;
}

.token-label {
  font-size: 0.55rem;
  color: var(--text-muted);
  text-transform: uppercase;
}

[data-theme="light"] .token-badge {
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  color: #0284c7;
}

[data-theme="light"] .token-label {
  color: #64748b;
}

.patient-info-col {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.patient-name,
.patient-name-link {
  font-weight: 700;
  font-size: 0.98rem;
  color: var(--text-primary);
}

.patient-name-link {
  cursor: pointer;
}

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

.patient-demographics {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.complaint-text {
  font-size: 0.82rem;
  color: var(--text-secondary);
  font-style: italic;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 280px;
}

/* Visit Type Badges */
.badge-visit-type {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  width: fit-content;
}

.badge-visit-type.type-new {
  background: var(--accent-new-bg);
  color: var(--accent-new);
  border: 1px solid var(--accent-new-border);
}

.badge-visit-type.type-followup {
  background: var(--accent-followup-bg);
  color: var(--accent-followup);
  border: 1px solid var(--accent-followup-border);
}

.col-status {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  flex-wrap: wrap;
}

/* ==========================================================================
   Custom Glassmorphism Status Dropdown Component
   ========================================================================== */
.custom-status-dropdown {
  position: relative;
  display: inline-flex;
  flex: 0 0 auto;
  width: auto;
  max-width: fit-content;
  overflow: visible !important;
}

.custom-status-dropdown.open {
  z-index: 1001 !important;
}

.custom-status-trigger {
  display: inline-flex;
  align-items: center;
  width: auto;
  max-width: fit-content;
  flex: 0 0 auto;
  gap: 0.4rem;
  padding: 0.38rem 0.75rem;
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  outline: none;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-light);
  color: var(--text-primary);
  transition: var(--transition-smooth);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
  user-select: none;
  white-space: nowrap;
  overflow: hidden;
  box-sizing: border-box;
}

.custom-status-trigger:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
  filter: brightness(1.08);
}

.custom-status-trigger.status-in_queue {
  color: #f59e0b;
  background: rgba(245, 158, 11, 0.12);
  border-color: rgba(245, 158, 11, 0.45);
}

.custom-status-trigger.status-in_consultation {
  color: #38bdf8;
  background: rgba(14, 165, 233, 0.14);
  border-color: rgba(14, 165, 233, 0.5);
}

.custom-status-trigger.status-completed {
  color: #10b981;
  background: rgba(16, 185, 129, 0.12);
  border-color: rgba(16, 185, 129, 0.45);
  width: auto !important;
  max-width: fit-content !important;
  flex: 0 0 auto !important;
}

.custom-status-trigger.status-scheduled {
  color: #c084fc;
  background: rgba(168, 85, 247, 0.12);
  border-color: rgba(168, 85, 247, 0.45);
}

.custom-status-trigger.status-cancelled {
  color: #ef4444;
  background: rgba(239, 68, 68, 0.12);
  border-color: rgba(239, 68, 68, 0.45);
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 6px currentColor;
  flex-shrink: 0;
}

.status-trigger-text {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  letter-spacing: 0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.status-trigger-arrow {
  font-size: 0.65rem;
  opacity: 0.7;
  transition: transform 0.2s ease;
  margin-left: 2px;
}

.custom-status-dropdown.open .status-trigger-arrow {
  transform: rotate(180deg);
}

/* Dropdown Menu Popup */
.custom-status-menu {
  position: absolute;
  top: calc(100% + 5px);
  left: 0;
  z-index: 9999 !important;
  min-width: 235px;
  max-width: calc(100vw - 2rem);
  max-height: min(280px, 60vh);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: rgba(14, 165, 233, 0.5) transparent;
  background: #0f172a !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  border: 1px solid rgba(255, 255, 255, 0.18) !important;
  border-radius: var(--radius-lg);
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.85), 0 0 0 1px rgba(255, 255, 255, 0.08);
  padding: 0.35rem;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-6px) scale(0.97);
  transform-origin: top left;
  transition: all 0.16s cubic-bezier(0.16, 1, 0.3, 1);
}

.custom-status-menu::-webkit-scrollbar {
  width: 4px;
}

.custom-status-menu::-webkit-scrollbar-thumb {
  background: rgba(14, 165, 233, 0.4);
  border-radius: 4px;
}

[data-theme="light"] .custom-status-menu {
  background: #ffffff !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  border: 1px solid #cbd5e1 !important;
  box-shadow: 0 16px 36px rgba(15, 23, 42, 0.18), 0 0 0 1px rgba(0, 0, 0, 0.06);
}

[data-theme="light"] .custom-status-menu::-webkit-scrollbar-thumb {
  background: #cbd5e1;
}

.custom-status-dropdown.open .custom-status-menu {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

/* Dropup Menu Popup */
.custom-status-dropdown.dropup .custom-status-menu {
  top: auto;
  bottom: calc(100% + 5px);
  transform-origin: bottom left;
  transform: translateY(6px) scale(0.97);
  box-shadow: 0 -16px 36px rgba(0, 0, 0, 0.85), 0 0 0 1px rgba(255, 255, 255, 0.08);
}

[data-theme="light"] .custom-status-dropdown.dropup .custom-status-menu {
  box-shadow: 0 -16px 36px rgba(15, 23, 42, 0.18);
}

.custom-status-dropdown.dropup.open .custom-status-menu {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

.status-menu-header {
  padding: 0.3rem 0.55rem 0.25rem;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 0.25rem;
}

.status-menu-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.55rem;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition-smooth);
  color: var(--text-primary);
  min-height: 32px;
  box-sizing: border-box;
}

.status-menu-item:hover {
  background: rgba(255, 255, 255, 0.07);
}

[data-theme="light"] .status-menu-item:hover {
  background: rgba(0, 0, 0, 0.05);
}

.status-menu-item.selected {
  background: rgba(14, 165, 233, 0.12);
}

.status-item-badge {
  width: 22px;
  height: 22px;
  border-radius: 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  flex-shrink: 0;
}

.status-item-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  flex: 1;
  min-width: 0;
  line-height: 1.2;
}

.status-item-title {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
}

.status-item-desc {
  font-size: 0.68rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.status-item-check {
  font-size: 0.8rem;
  font-weight: 900;
  color: var(--primary);
  margin-left: 0.25rem;
  flex-shrink: 0;
}

.row-actions-group {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  justify-content: flex-end;
}

/* ==========================================================================
   Analytics Dashboard Styles
   ========================================================================== */
.time-range-pills {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  padding: 0.35rem;
  overflow-x: auto;
  margin-bottom: 1.5rem;
}

.time-pill-btn {
  padding: 0.45rem 1rem;
  border-radius: var(--radius-full);
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: var(--transition-smooth);
}

.time-pill-btn:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.05);
}

.time-pill-btn.active {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 2px 10px rgba(14, 165, 233, 0.4);
}

.charts-grid-2x2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

@media (max-width: 1024px) {
  .charts-grid-2x2 {
    grid-template-columns: 1fr;
  }
}

.chart-card {
  background: var(--bg-surface);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: 1.5rem;
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
}

.chart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}

.chart-title-box h3 {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
}

.chart-subtitle {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.chart-toggle-group {
  display: flex;
  align-items: center;
  background: var(--bg-surface-elevated);
  border-radius: var(--radius-sm);
  padding: 2px;
  border: 1px solid var(--border-subtle);
}

.chart-toggle-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.25rem 0.6rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition-smooth);
}

.chart-toggle-btn.active {
  background: var(--primary);
  color: #fff;
}

.canvas-container {
  position: relative;
  flex: 1;
  min-height: 280px;
  width: 100%;
}

/* Analytics Table */
.analytics-table-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: 1.5rem;
  margin-top: 1.5rem;
}

/* Dedicated Analytics Dashboard Spacing & Breathing Room */
#view-analytics .time-range-pills {
  margin-bottom: 1.65rem;
  padding: 0.45rem;
  gap: 0.45rem;
}

#view-analytics .time-pill-btn {
  padding: 0.48rem 1.05rem;
  font-size: 0.82rem;
  font-weight: 600;
}

#view-analytics .kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 1.15rem;
  margin-bottom: 1.5rem;
}

#view-analytics .earnings-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.15rem;
  margin-bottom: 1.5rem;
}

@media (max-width: 960px) {
  #view-analytics .earnings-kpi-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 0.85rem !important;
  }

  #view-analytics .kpi-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 0.85rem !important;
  }
}

@media (max-width: 520px) {
  #view-analytics .earnings-kpi-grid {
    grid-template-columns: 1fr !important;
    gap: 0.75rem !important;
  }

  #view-analytics .kpi-grid {
    grid-template-columns: 1fr !important;
    gap: 0.75rem !important;
  }
}

#view-analytics .kpi-card {
  padding: 1.1rem 1.15rem !important;
  min-height: 116px !important;
  height: auto !important;
  border-radius: var(--radius-lg) !important;
  display: flex !important;
  flex-direction: column !important;
  justify-content: space-between !important;
  box-shadow: 0 4px 16px -2px rgba(0, 0, 0, 0.08) !important;
  transition: var(--transition-smooth) !important;
  min-width: 0 !important;
  overflow: hidden !important;
}

#view-analytics .kpi-header {
  display: flex !important;
  align-items: flex-start !important;
  justify-content: space-between !important;
  margin-bottom: 0.5rem !important;
  gap: 0.4rem !important;
  min-width: 0 !important;
}

#view-analytics .kpi-title {
  font-size: 0.72rem !important;
  font-weight: 700 !important;
  text-transform: uppercase !important;
  letter-spacing: 0.025em !important;
  color: var(--text-secondary) !important;
  line-height: 1.25 !important;
  white-space: normal !important;
  overflow: visible !important;
  text-overflow: unset !important;
  word-break: normal !important;
  overflow-wrap: break-word !important;
  display: block !important;
  min-height: 2.3em !important;
  flex: 1 1 auto !important;
  min-width: 0 !important;
}

#view-analytics .kpi-icon-pill {
  width: 28px !important;
  height: 28px !important;
  font-size: 0.95rem !important;
  border-radius: 8px !important;
  flex-shrink: 0 !important;
  margin-top: 1px !important;
}

#view-analytics .kpi-value {
  font-size: 1.65rem !important;
  font-weight: 800 !important;
  line-height: 1.15 !important;
  margin-bottom: 0.4rem !important;
  word-break: normal !important;
}

#view-analytics .kpi-footer {
  font-size: 0.75rem !important;
  color: var(--text-muted) !important;
  line-height: 1.3 !important;
  word-break: normal !important;
  display: block !important;
}

#view-analytics .kpi-tag {
  padding: 4px 10px;
  font-size: 0.76rem;
  border-radius: var(--radius-full);
  display: inline-block;
  max-width: 100%;
  white-space: normal;
  word-break: break-word;
}

#view-analytics .charts-grid-2x2 {
  gap: 1.65rem;
  margin-bottom: 2rem;
}

#view-analytics .chart-card {
  padding: 1.65rem 1.75rem;
  border-radius: var(--radius-xl);
}

#view-analytics .chart-header {
  margin-bottom: 1.35rem;
}

#view-analytics .chart-title-box h3 {
  font-size: 1.15rem;
  font-weight: 700;
}

#view-analytics .chart-subtitle {
  font-size: 0.82rem;
  margin-top: 2px;
}

#view-analytics .canvas-container {
  min-height: 290px;
}

#view-analytics .analytics-table-card {
  padding: 1.65rem 1.75rem;
  margin-top: 2rem;
  border-radius: var(--radius-xl);
}

[data-theme="light"] #view-analytics .kpi-card {
  background: #ffffff;
  border-color: #e2e8f0;
  box-shadow: 0 4px 16px -2px rgba(15, 23, 42, 0.06);
}

/* ==========================================================================
   Laptop / Desktop Browser UI Spacing Enhancements (min-width: 992px)
   ========================================================================== */
@media (min-width: 992px) {
  .main-viewport {
    padding: 1.75rem 2rem;
  }

  .view-header {
    margin-bottom: 1.75rem;
  }

  /* Queue View: roomier KPI & search spacing on laptop */
  #queue-kpi-grid {
    gap: 0.95rem;
  }

  #queue-kpi-grid .kpi-card {
    padding: 0.85rem 1.1rem;
    border-radius: var(--radius-lg);
  }

  .patient-search-section {
    margin-bottom: 1.65rem;
  }

  /* Patient Records: roomier KPI & directory spacing on laptop */
  .patients-kpi-grid {
    gap: 1.15rem;
    margin-bottom: 1.35rem;
  }

  .patients-kpi-grid .kpi-card {
    padding: 0.95rem 1.15rem;
    border-radius: var(--radius-lg);
  }

  /* Analytics View: 5-column clinical volume row & 4-column earnings row */
  #view-analytics .kpi-grid:not(.earnings-kpi-grid) {
    grid-template-columns: repeat(5, 1fr) !important;
    gap: 1.25rem !important;
    margin-bottom: 2.25rem !important;
  }

  #view-analytics .earnings-kpi-grid {
    grid-template-columns: repeat(4, 1fr) !important;
    gap: 1.25rem !important;
    margin-bottom: 1.75rem !important;
  }

  #view-analytics .kpi-card {
    padding: 1.1rem 1.15rem !important;
    min-height: 118px !important;
  }

  #view-analytics .charts-grid-2x2 {
    gap: 1.75rem;
    margin-bottom: 2.25rem;
  }

  /* Admin Oversight KPI Grid on laptop */
  #view-clinics .kpi-grid {
    gap: 1.25rem;
    margin-bottom: 2rem;
  }

  #view-clinics .kpi-card {
    padding: 1.15rem 1.35rem;
    border-radius: var(--radius-lg);
  }
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
  margin-top: 1rem;
}

.data-table th {
  text-align: left;
  padding: 0.75rem 1rem;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-subtle);
}

.data-table td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-primary);
}

.data-table tr:last-child td {
  border-bottom: none;
}

/* ==========================================================================
   Admin Clinic Management Grid
   ========================================================================== */
.clinics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 1.25rem;
}

.clinic-card {
  background: var(--bg-surface);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: 1.5rem;
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
  gap: 1rem;
  transition: var(--transition-smooth);
}

.clinic-card:hover {
  border-color: var(--border-light);
  transform: translateY(-2px);
}

.clinic-card.inactive {
  opacity: 0.75;
  filter: grayscale(0.3);
}

.clinic-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
}

.clinic-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-primary);
}

.doctor-pill {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(14, 165, 233, 0.1);
  border: 1px solid rgba(14, 165, 233, 0.25);
  border-radius: var(--radius-md);
  padding: 0.5rem 0.75rem;
  font-size: 0.85rem;
  color: var(--text-primary);
}

.clinic-meta-row {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.82rem;
  color: var(--text-secondary);
}

.receptionist-credentials-box {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.75rem;
  font-size: 0.82rem;
}

/* ==========================================================================
   Modals & Drawers
   ========================================================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 50000 !important;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.modal-overlay.active,
.modal-overlay.open {
  opacity: 1 !important;
  pointer-events: auto !important;
  z-index: 50000 !important;
}

.modal-card {
  background: #111827 !important;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 640px;
  max-height: 90vh;
  display: flex !important;
  flex-direction: column !important;
  overflow: hidden !important;
  padding: 0 !important;
  box-shadow: 0 20px 48px -8px rgba(0, 0, 0, 0.45);
  transform: scale(0.96);
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

[data-theme="light"] .modal-card {
  background: #ffffff !important;
  border-color: #cbd5e1;
  box-shadow: 0 20px 48px -8px rgba(15, 23, 42, 0.2);
}

.modal-overlay.active .modal-card,
.modal-overlay.open .modal-card {
  transform: scale(1) !important;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.6rem 1rem !important;
  border-bottom: 1px solid var(--border-subtle);
  background: #111827 !important;
  flex-shrink: 0 !important;
  margin: 0 !important;
  position: relative;
  z-index: 5;
}

[data-theme="light"] .modal-header {
  background: #ffffff !important;
  border-color: #e2e8f0;
}

.modal-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
}

.modal-close-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
  line-height: 1;
}

.modal-close-btn:hover {
  color: var(--text-primary);
}

.modal-content {
  padding: 1.25rem 1.6rem !important;
  overflow-y: auto !important;
  -webkit-overflow-scrolling: touch;
  flex: 1 1 auto !important;
  min-height: 0 !important;
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
  padding: 1rem 1.6rem 1.25rem !important;
  border-top: 1px solid var(--border-subtle);
  background: #111827 !important;
  flex-shrink: 0 !important;
  margin: 0 !important;
}

[data-theme="light"] .modal-footer {
  background: #ffffff !important;
  border-color: #e2e8f0;
}

/* Form Styles */
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}

.form-group-full {
  grid-column: span 2;
}

.form-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 0.35rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.form-control {
  width: 100%;
  padding: 0.65rem 0.95rem;
  background: var(--bg-surface-elevated);
  border: 1.5px solid var(--border-light);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.9rem;
  transition: var(--transition-smooth);
}

.form-control:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

textarea.form-control {
  min-height: 90px;
  resize: vertical;
}

/* Date Picker Input Interactive Styles */
.form-control[type="date"] {
  cursor: pointer;
  position: relative;
  font-family: inherit;
}

.form-control[type="date"]::-webkit-calendar-picker-indicator {
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  filter: invert(0.85);
  transition: transform 0.15s ease, filter 0.15s ease;
}

.form-control[type="date"]::-webkit-calendar-picker-indicator:hover {
  transform: scale(1.15);
  filter: invert(1);
}

[data-theme="light"] .form-control[type="date"]::-webkit-calendar-picker-indicator {
  filter: none;
}

[data-theme="light"] .form-control[type="date"]::-webkit-calendar-picker-indicator:hover {
  filter: brightness(0.6);
}

/* Date of Birth Enhanced UI & Auto-computed Badge */
.dob-input-wrap {
  position: relative;
  width: 100%;
}

.dob-input {
  color-scheme: dark;
  letter-spacing: 0.02em;
  font-weight: 500;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

[data-theme="light"] .dob-input {
  color-scheme: light;
}

.dob-computed-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 9px;
  border-radius: 9999px;
  font-size: 0.72rem;
  font-weight: 700;
  background: rgba(16, 185, 129, 0.16);
  color: #10b981;
  border: 1px solid rgba(16, 185, 129, 0.35);
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.18);
  animation: dobBadgePop 0.22s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

[data-theme="light"] .dob-computed-badge {
  background: rgba(16, 185, 129, 0.12);
  color: #059669;
  border-color: rgba(16, 185, 129, 0.3);
}

.dob-helper-text {
  font-size: 0.73rem;
  color: var(--text-muted);
  margin-top: 5px;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: color 0.2s ease;
}

.dob-helper-text.is-calculated {
  color: #10b981;
  font-weight: 600;
}

[data-theme="light"] .dob-helper-text.is-calculated {
  color: #059669;
}

@keyframes dobBadgePop {
  0% {
    opacity: 0;
    transform: scale(0.85);
  }

  100% {
    opacity: 1;
    transform: scale(1);
  }
}

/* Time Input Interactive Styling */
.form-control[type="time"] {
  cursor: pointer;
  position: relative;
  font-family: inherit;
  color-scheme: dark;
  letter-spacing: 0.02em;
  font-weight: 500;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

[data-theme="light"] .form-control[type="time"] {
  color-scheme: light;
}

.form-control[type="time"]::-webkit-calendar-picker-indicator {
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  filter: invert(0.85);
  transition: transform 0.15s ease, filter 0.15s ease;
}

.form-control[type="time"]::-webkit-calendar-picker-indicator:hover {
  transform: scale(1.15);
  filter: invert(1);
}

[data-theme="light"] .form-control[type="time"]::-webkit-calendar-picker-indicator {
  filter: none;
}

[data-theme="light"] .form-control[type="time"]::-webkit-calendar-picker-indicator:hover {
  filter: brightness(0.6);
}

/* Clinic Operating Hours Preview Badge */
.clinic-hours-preview-badge {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0.75rem 1rem;
  background: rgba(14, 165, 233, 0.08);
  border: 1px solid rgba(14, 165, 233, 0.25);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 0.84rem;
  transition: all 0.25s ease;
}

[data-theme="light"] .clinic-hours-preview-badge {
  background: rgba(14, 165, 233, 0.06);
  border-color: rgba(14, 165, 233, 0.25);
}

.clinic-hours-preview-badge .badge-icon {
  font-size: 1.25rem;
  line-height: 1;
}

.clinic-hours-preview-badge strong {
  color: #38bdf8;
  font-weight: 700;
}

[data-theme="light"] .clinic-hours-preview-badge strong {
  color: #0284c7;
}

.clinic-hours-preview-badge.is-warning {
  background: rgba(245, 158, 11, 0.12);
  border-color: rgba(245, 158, 11, 0.35);
  color: #f59e0b;
}

.clinic-hours-preview-badge.is-warning strong {
  color: #f59e0b;
}


/* ==========================================================================
   Modern Interactive Timeslot Picker
   ========================================================================== */
.timeslot-section {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 0.85rem 1rem;
  transition: var(--transition-smooth);
}

[data-theme="light"] .timeslot-section {
  background: #f8fafc;
  border-color: #e2e8f0;
}

.timeslot-selected-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  background: rgba(14, 165, 233, 0.12);
  border: 1px solid rgba(14, 165, 233, 0.3);
  color: #38bdf8;
  padding: 0.2rem 0.65rem;
  border-radius: var(--radius-full);
  font-size: 0.76rem;
  font-weight: 600;
}

[data-theme="light"] .timeslot-selected-badge {
  background: #e0f2fe;
  border-color: #bae6fd;
  color: #0284c7;
}

.timeslot-badge-pulse {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 6px #10b981;
  animation: pulseSlot 1.8s infinite;
}

@keyframes pulseSlot {
  0% {
    transform: scale(0.95);
    opacity: 0.8;
  }

  50% {
    transform: scale(1.3);
    opacity: 1;
  }

  100% {
    transform: scale(0.95);
    opacity: 0.8;
  }
}

/* Session Filter Pills */
.timeslot-session-filter {
  display: flex;
  gap: 0.4rem;
  margin-bottom: 0.75rem;
  background: rgba(0, 0, 0, 0.2);
  padding: 0.25rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
}

[data-theme="light"] .timeslot-session-filter {
  background: #f1f5f9;
  border-color: #e2e8f0;
}

.timeslot-session-pill {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.74rem;
  font-weight: 600;
  padding: 0.35rem 0.5rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.18s ease;
  text-align: center;
  white-space: nowrap;
}

.timeslot-session-pill:hover {
  color: var(--text-primary);
}

.timeslot-session-pill.active {
  background: var(--bg-surface-elevated);
  color: var(--text-primary);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
  font-weight: 700;
}

[data-theme="light"] .timeslot-session-pill.active {
  background: #ffffff;
  color: #0f172a;
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.1);
}

/* Session Group Headers */
.timeslot-group-block {
  transition: all 0.2s ease;
}

.timeslot-group-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 0.45rem;
}

.timeslot-group-range {
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: none;
}

/* Chip Grid */
.timeslot-chips-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.45rem;
}

@media (max-width: 500px) {
  .timeslot-chips-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 0.4rem;
  }
}

@media (max-width: 360px) {
  .timeslot-chips-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.timeslot-chip {
  background: rgba(255, 255, 255, 0.04);
  border: 1.5px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.82rem;
  font-weight: 600;
  font-family: inherit;
  padding: 0.45rem 0.35rem;
  min-height: 36px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

[data-theme="light"] .timeslot-chip {
  background: #ffffff;
  border-color: #cbd5e1;
  color: #334155;
}

.timeslot-chip:hover {
  border-color: var(--primary);
  color: var(--text-primary);
  transform: translateY(-1px);
}

.timeslot-chip.selected {
  background: rgba(14, 165, 233, 0.18) !important;
  border-color: var(--primary) !important;
  color: #38bdf8 !important;
  font-weight: 800 !important;
  box-shadow: 0 0 14px rgba(14, 165, 233, 0.3) !important;
  transform: scale(1.02);
}

[data-theme="light"] .timeslot-chip.selected {
  background: #e0f2fe !important;
  border-color: #0284c7 !important;
  color: #0369a1 !important;
  box-shadow: 0 2px 10px rgba(2, 132, 199, 0.22) !important;
}

/* Current Active Time Slot Highlight & Badge (Active only when selected) */
.timeslot-chip.is-current-slot.selected {
  position: relative;
  background: rgba(16, 185, 129, 0.22) !important;
  border-color: #10b981 !important;
  color: #10b981 !important;
  font-weight: 800 !important;
  box-shadow: 0 0 18px rgba(16, 185, 129, 0.45) !important;
  transform: scale(1.02);
}

.timeslot-chip.is-current-slot.selected::after {
  content: "⚡ NOW";
  position: absolute;
  top: -7px;
  right: -4px;
  background: #10b981;
  color: #ffffff;
  font-size: 0.58rem;
  font-weight: 800;
  padding: 1px 4px;
  border-radius: 4px;
  letter-spacing: 0.03em;
  line-height: 1;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
  pointer-events: none;
}

[data-theme="light"] .timeslot-chip.is-current-slot.selected {
  background: #d1fae5 !important;
  border-color: #059669 !important;
  color: #065f46 !important;
  box-shadow: 0 2px 12px rgba(16, 185, 129, 0.28) !important;
}

/* Callout when all slots today have ended */
.timeslots-ended-callout {
  background: rgba(245, 158, 11, 0.08);
  border: 1px solid rgba(245, 158, 11, 0.25);
  border-radius: var(--radius-md);
  padding: 1rem 1.15rem;
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
  margin-top: 0.5rem;
}

[data-theme="light"] .timeslots-ended-callout {
  background: #fffbeb;
  border-color: #fde68a;
}

.timeslots-ended-callout .callout-icon {
  font-size: 1.5rem;
  line-height: 1;
  flex-shrink: 0;
}

.timeslots-ended-callout .callout-content {
  flex: 1;
}

.timeslots-ended-callout .callout-title {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.25rem;
}

.timeslots-ended-callout .callout-desc {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.4;
  margin-bottom: 0.75rem;
}

.btn-select-tomorrow {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  font-weight: 700;
  padding: 0.45rem 0.95rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  background: var(--primary);
  color: #ffffff;
  border: none;
  transition: all 0.2s ease;
}

.btn-select-tomorrow:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(14, 165, 233, 0.35);
}

/* Appointment Type Selector Radio Pill */
.type-radio-group {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.type-radio-label {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.85rem 0.75rem;
  border: 2px solid var(--border-light);
  border-radius: var(--radius-lg);
  cursor: pointer;
  text-align: center;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  background: var(--bg-surface-elevated);
  height: 100%;
}

.type-radio-title {
  font-weight: 800;
  font-size: 0.92rem;
  line-height: 1.25;
}

.type-radio-desc {
  display: block;
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--text-muted);
  line-height: 1.25;
}

[data-theme="light"] .type-radio-label {
  background: #f8fafc;
  border-color: #cbd5e1;
  color: #1e293b;
}

.type-radio-input {
  display: none;
}

.type-radio-input:checked+.type-radio-label.new-option {
  border-color: var(--accent-new);
  background: var(--accent-new-bg);
  color: var(--accent-new);
  box-shadow: 0 0 16px rgba(16, 185, 129, 0.25);
}

[data-theme="light"] .type-radio-input:checked+.type-radio-label.new-option {
  background: #ecfdf5;
  border-color: #10b981;
  color: #047857;
}

[data-theme="light"] .type-radio-input:checked+.type-radio-label.new-option .type-radio-desc {
  color: #065f46;
}

.type-radio-input:checked+.type-radio-label.followup-option {
  border-color: var(--accent-followup);
  background: var(--accent-followup-bg);
  color: var(--accent-followup);
  box-shadow: 0 0 16px rgba(99, 102, 241, 0.25);
}

[data-theme="light"] .type-radio-input:checked+.type-radio-label.followup-option {
  background: #eef2ff;
  border-color: #6366f1;
  color: #4338ca;
}

[data-theme="light"] .type-radio-input:checked+.type-radio-label.followup-option .type-radio-desc {
  color: #3730a3;
}

/* Vitals Inputs Grid */
.vitals-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
  background: rgba(14, 165, 233, 0.05);
  border: 1px solid rgba(14, 165, 233, 0.15);
  border-radius: var(--radius-md);
  padding: 1rem;
}

@media (max-width: 640px) {
  .vitals-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Visit Completion & Billing Modal Styles */
#visit-completion-modal .modal-card {
  width: 95%;
  max-width: 480px;
  border: 1px solid var(--border-light);
  box-shadow: 0 12px 35px rgba(0, 0, 0, 0.45);
  box-sizing: border-box;
  overflow: hidden;
}

[data-theme="light"] #visit-completion-modal .modal-card {
  background: #ffffff;
  border-color: #cbd5e1;
  box-shadow: 0 12px 35px rgba(15, 23, 42, 0.12);
}

.completion-patient-banner {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-light);
  border-radius: 12px;
}

[data-theme="light"] .completion-patient-banner {
  background: #f8fafc;
  border-color: #e2e8f0;
}

.completion-preset-btn {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-light);
  color: var(--text-secondary);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.completion-preset-btn:hover {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
}

[data-theme="light"] .completion-preset-btn {
  background: #f1f5f9;
  border-color: #cbd5e1;
  color: #334155;
}

[data-theme="light"] .completion-preset-btn:hover {
  background: #0284c7;
  color: #ffffff;
  border-color: #0284c7;
}

/* ==========================================================================
   Modern Sleek Multi-Entry Billing Interface & Non-Overlapping Currency Addon
   ========================================================================== */
.billing-patient-summary {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-light);
  border-radius: 12px;
  padding: 0.65rem 0.95rem;
  margin-bottom: 0.95rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

[data-theme="light"] .billing-patient-summary {
  background: #ffffff;
  border-color: #e2e8f0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.billing-patient-details {
  flex: 1;
  min-width: 0;
}

.billing-patient-name {
  font-weight: 800;
  font-size: 0.98rem;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: -0.01em;
}

.billing-patient-sub {
  font-size: 0.76rem;
  color: var(--text-muted);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.billing-patient-token-badge {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0.3rem 0.65rem;
  background: rgba(14, 165, 233, 0.12);
  border: 1.5px solid rgba(14, 165, 233, 0.35);
  border-radius: 10px;
  min-width: 58px;
}

.billing-token-prefix {
  font-size: 0.62rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--primary);
  line-height: 1;
}

.billing-token-number {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--primary);
  line-height: 1.15;
  margin-top: 2px;
}

/* Header bar for line items */
.billing-items-header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.55rem;
  padding: 0 2px;
}

.billing-items-count-tag {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
}

.billing-count-pill {
  font-size: 0.7rem;
  padding: 1px 7px;
  border-radius: 999px;
  background: rgba(14, 165, 233, 0.15);
  color: var(--primary);
  font-weight: 700;
}

.billing-add-custom-btn {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-light);
  color: var(--primary);
  font-size: 0.76rem;
  font-weight: 700;
  padding: 0.3rem 0.65rem;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.billing-add-custom-btn:hover {
  background: rgba(14, 165, 233, 0.12);
  border-color: var(--primary);
}

/* Line items list */
.billing-items-container {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  margin-bottom: 0.95rem;
  overflow: visible;
  padding-right: 2px;
}

/* Single compact line item card */
.billing-item-card {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-light);
  border-radius: 10px;
  padding: 0.45rem 0.65rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  transition: all 0.2s ease;
  position: relative;
}

[data-theme="light"] .billing-item-card {
  background: #ffffff;
  border-color: #e2e8f0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.billing-item-card:hover {
  border-color: rgba(14, 165, 233, 0.45);
}

/* Elevate card when its billing dropdown is open */
.billing-item-card:has(.custom-billing-dropdown.open),
.billing-item-card.dropdown-open {
  z-index: 500 !important;
  overflow: visible !important;
  border-color: rgba(14, 165, 233, 0.5);
}

.billing-item-row-single {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  width: 100%;
}

.billing-item-service-col {
  flex: 1;
  min-width: 0;
  position: relative;
}

/* Custom Glassmorphism Service Dropdown Component */
.custom-billing-dropdown {
  position: relative;
  width: 100%;
}

.custom-billing-trigger {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  width: 100% !important;
  padding: 0.45rem 0.65rem !important;
  border-radius: 8px !important;
  font-family: inherit !important;
  font-size: 0.85rem !important;
  font-weight: 700 !important;
  cursor: pointer !important;
  outline: none !important;
  background: var(--bg-surface) !important;
  border: 1px solid var(--border-light) !important;
  color: var(--text-primary) !important;
  transition: all 0.18s ease !important;
  height: 38px !important;
  min-height: 38px !important;
  user-select: none !important;
  box-shadow: none !important;
}

[data-theme="light"] .custom-billing-trigger {
  background: #f8fafc !important;
  border-color: #cbd5e1 !important;
  color: #0f172a !important;
}

.custom-billing-trigger:hover {
  border-color: var(--primary) !important;
}

.custom-billing-dropdown.open .custom-billing-trigger {
  border-color: var(--primary) !important;
  box-shadow: 0 0 0 2px rgba(14, 165, 233, 0.2) !important;
}

.custom-billing-trigger-text {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  min-width: 0;
  text-align: left;
}

.custom-billing-trigger-arrow {
  font-size: 0.65rem;
  opacity: 0.7;
  transition: transform 0.2s ease;
  margin-left: 4px;
  flex-shrink: 0;
}

.custom-billing-dropdown.open .custom-billing-trigger-arrow {
  transform: rotate(180deg);
}

/* Dropdown Menu Popup matching .custom-status-menu */
.custom-billing-menu {
  position: absolute;
  top: calc(100% + 5px);
  left: 0;
  z-index: 300;
  min-width: 250px;
  width: 100%;
  background: #0f172a !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  border: 1px solid rgba(255, 255, 255, 0.18) !important;
  border-radius: 12px;
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.85), 0 0 0 1px rgba(255, 255, 255, 0.08);
  padding: 0.35rem;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-6px) scale(0.97);
  transform-origin: top left;
  transition: all 0.16s cubic-bezier(0.16, 1, 0.3, 1);
}

[data-theme="light"] .custom-billing-menu {
  background: #ffffff !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  border: 1px solid #cbd5e1 !important;
  box-shadow: 0 18px 42px rgba(15, 23, 42, 0.2), 0 0 0 1px rgba(0, 0, 0, 0.06);
}

.custom-billing-dropdown.open .custom-billing-menu {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

.billing-menu-header {
  padding: 0.35rem 0.6rem 0.25rem;
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 0.25rem;
}

.billing-menu-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.42rem 0.65rem;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s ease;
  color: var(--text-primary);
  user-select: none;
}

.billing-menu-item:hover {
  background: rgba(14, 165, 233, 0.12);
}

[data-theme="light"] .billing-menu-item:hover {
  background: rgba(14, 165, 233, 0.1);
}

.billing-menu-item.selected {
  background: rgba(14, 165, 233, 0.16);
  color: var(--primary);
  font-weight: 700;
}

.billing-menu-item-left {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  flex: 1;
  min-width: 0;
}

.billing-menu-item-icon {
  font-size: 1.05rem;
  flex-shrink: 0;
}

.billing-menu-item-label {
  font-size: 0.84rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.billing-menu-item-price {
  font-size: 0.74rem;
  font-weight: 800;
  color: var(--primary);
  padding: 1px 6px;
  border-radius: 6px;
  background: rgba(14, 165, 233, 0.12);
  flex-shrink: 0;
}

.billing-menu-item-check {
  color: var(--primary);
  font-weight: 900;
  font-size: 0.85rem;
  margin-left: 2px;
  flex-shrink: 0;
}

/* Price group in row */
.billing-item-price-col {
  width: 110px;
  flex-shrink: 0;
}

.billing-price-input-group {
  display: flex !important;
  align-items: stretch !important;
  border: 1px solid var(--border-light) !important;
  border-radius: 8px !important;
  background: var(--bg-surface) !important;
  overflow: hidden !important;
  height: 38px !important;
  min-height: 38px !important;
  max-height: 38px !important;
  transition: all 0.2s ease !important;
}

[data-theme="light"] .billing-price-input-group {
  background: #f8fafc !important;
  border-color: #cbd5e1 !important;
}

.billing-price-input-group:focus-within {
  border-color: var(--primary) !important;
  box-shadow: 0 0 0 2px rgba(14, 165, 233, 0.2) !important;
}

.billing-currency-addon {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 0 0.55rem !important;
  background: rgba(14, 165, 233, 0.12) !important;
  color: var(--primary) !important;
  font-weight: 800 !important;
  font-size: 0.95rem !important;
  border-right: 1px solid var(--border-light) !important;
  user-select: none !important;
  flex-shrink: 0 !important;
}

[data-theme="light"] .billing-currency-addon {
  background: #e0f2fe !important;
  color: #0284c7 !important;
  border-right-color: #cbd5e1 !important;
}

.billing-price-input-group .billing-item-amount {
  flex: 1 !important;
  width: 100% !important;
  border: none !important;
  background: transparent !important;
  padding: 0 0.5rem !important;
  margin: 0 !important;
  font-size: 0.95rem !important;
  font-weight: 800 !important;
  color: var(--text-primary) !important;
  box-shadow: none !important;
  outline: none !important;
  min-width: 0 !important;
  height: 100% !important;
  font-variant-numeric: tabular-nums !important;
}

[data-theme="light"] .billing-price-input-group .billing-item-amount {
  color: #0f172a !important;
}

.billing-item-remove-btn {
  width: 32px;
  height: 38px;
  min-width: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s ease;
  font-size: 1.15rem;
  padding: 0;
  line-height: 1;
}

.billing-item-remove-btn:hover:not(:disabled) {
  background: rgba(239, 68, 68, 0.12);
  border-color: rgba(239, 68, 68, 0.25);
  color: var(--accent-danger);
}

.billing-item-remove-btn:disabled {
  opacity: 0.25;
  cursor: not-allowed;
}

/* Custom note/description sub-row (shows when Custom is chosen or expanded) */
.billing-item-custom-name-wrap {
  margin-top: 0.1rem;
}

.billing-item-desc-input {
  width: 100%;
  font-size: 0.8rem;
  padding: 0.35rem 0.6rem !important;
  height: 32px !important;
  min-height: 32px !important;
  border-radius: 6px;
  border: 1px dashed var(--border-light);
  background: var(--bg-surface);
  color: var(--text-primary);
  outline: none;
}

[data-theme="light"] .billing-item-desc-input {
  background: #f8fafc;
  border-color: #cbd5e1;
  color: #0f172a;
}

.billing-item-desc-input:focus {
  border-style: solid;
  border-color: var(--primary);
}

/* Quick Add Service Section */
.billing-quick-add-section {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 0.6rem 0.75rem;
  margin-bottom: 0.85rem;
}

[data-theme="light"] .billing-quick-add-section {
  background: #f8fafc;
  border-color: #e2e8f0;
}

.billing-section-subhead {
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 0.45rem;
}

.billing-chips-scroll {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.billing-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.38rem 0.8rem;
  font-size: 0.82rem;
  font-weight: 600;
  border-radius: var(--radius-full);
  border: 1.5px solid var(--border-light);
  background: var(--bg-surface-elevated);
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
  white-space: nowrap;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

[data-theme="light"] .billing-chip {
  background: #ffffff;
  border-color: #cbd5e1;
  color: #1e293b;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.billing-chip:hover {
  background: rgba(14, 165, 233, 0.14);
  border-color: var(--primary);
  color: var(--primary);
  transform: translateY(-1.5px);
  box-shadow: 0 3px 10px rgba(14, 165, 233, 0.2);
}

[data-theme="light"] .billing-chip:hover {
  background: #f0f9ff;
  border-color: #0284c7;
  color: #0284c7;
  box-shadow: 0 3px 8px rgba(2, 132, 199, 0.15);
}

.billing-chip-price {
  font-weight: 800;
  color: #38bdf8;
  font-size: 0.76rem;
  margin-left: 2px;
  background: rgba(14, 165, 233, 0.12);
  padding: 1px 6px;
  border-radius: 6px;
}

[data-theme="light"] .billing-chip-price {
  color: #0284c7;
  background: #e0f2fe;
}

/* Grand Total Card */
.billing-grand-total-card {
  background: linear-gradient(135deg, rgba(14, 165, 233, 0.12), rgba(99, 102, 241, 0.05));
  border: 1.5px solid rgba(14, 165, 233, 0.3);
  border-radius: 12px;
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.35rem;
}

[data-theme="light"] .billing-grand-total-card {
  background: linear-gradient(135deg, #f0f9ff, #f8fafc);
  border-color: #bae6fd;
}

.billing-total-title {
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--primary);
}

.billing-total-subtitle {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 1px;
}

.billing-grand-total-amount {
  font-size: 1.45rem;
  font-weight: 800;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

[data-theme="light"] .billing-grand-total-amount {
  color: #0284c7;
}

/* Payment Method Selection Cards (Cash vs. Online) */
.billing-payment-method-section {
  margin: 0.85rem 0 0.4rem;
  padding-top: 0.75rem;
  border-top: 1px dashed var(--border-subtle);
}

.payment-method-badge {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 99px;
  background: rgba(16, 185, 129, 0.12);
  color: #10b981;
  border: 1px solid rgba(16, 185, 129, 0.25);
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  transition: all 0.2s ease;
}

.payment-method-badge.badge-online {
  background: rgba(14, 165, 233, 0.12);
  color: #0284c7;
  border-color: rgba(14, 165, 233, 0.25);
}

.payment-methods-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 0.65rem;
  width: 100%;
  box-sizing: border-box;
}

.payment-method-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.65rem 0.75rem;
  border: 1.5px solid var(--border-light);
  border-radius: 12px;
  background: var(--bg-surface-elevated);
  cursor: pointer;
  transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
  user-select: none;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
  overflow: hidden;
}

.payment-method-card:hover {
  border-color: var(--primary);
  transform: translateY(-1px);
}

.payment-method-card.active {
  border-color: var(--primary);
  background: rgba(14, 165, 233, 0.08);
  box-shadow: 0 0 0 1px var(--primary), 0 3px 12px rgba(14, 165, 233, 0.15);
}

[data-theme="light"] .payment-method-card.active {
  background: #f0f9ff;
  border-color: #0284c7;
  box-shadow: 0 0 0 1px #0284c7, 0 3px 12px rgba(2, 132, 199, 0.12);
}

.pay-card-icon {
  font-size: 1.35rem;
  line-height: 1;
  flex-shrink: 0;
}

.pay-card-text {
  display: flex;
  flex-direction: column;
  flex: 1 1 0%;
  min-width: 0;
  overflow: hidden;
}

.pay-card-title {
  font-size: 0.86rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pay-card-sub {
  font-size: 0.68rem;
  color: var(--text-muted);
  margin-top: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  display: block;
}

.pay-card-check {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 1.5px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 900;
  color: transparent;
  flex-shrink: 0;
  transition: all 0.15s ease;
}

.payment-method-card.active .pay-card-check {
  background: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
}

/* Payment Mini Chips on Queue rows */
.payment-mini-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 99px;
  white-space: nowrap;
}

.payment-mini-chip.chip-cash {
  background: rgba(16, 185, 129, 0.12);
  color: #10b981;
  border: 1px solid rgba(16, 185, 129, 0.25);
}

.payment-mini-chip.chip-online {
  background: rgba(14, 165, 233, 0.12);
  color: #0284c7;
  border: 1px solid rgba(14, 165, 233, 0.25);
}

/* Mobile responsive adjustments */
@media (max-width: 440px) {
  .payment-methods-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 0.45rem;
  }

  .payment-method-card {
    padding: 0.55rem 0.55rem;
    gap: 0.4rem;
  }

  .pay-card-icon {
    font-size: 1.15rem;
  }

  .pay-card-title {
    font-size: 0.8rem;
  }

  .pay-card-sub {
    font-size: 0.64rem;
  }

  .billing-item-price-col {
    width: 95px !important;
  }

  .billing-currency-addon {
    padding: 0 0.4rem !important;
  }

  .billing-service-select {
    font-size: 0.82rem !important;
    padding: 0.35rem 0.45rem !important;
  }
}

/* ==========================================================================
   Printable Prescription & Official Cash Invoice Slip Styles (@media print)
   ========================================================================== */
#print-slip-container {
  display: none;
}

@media print {
  @page {
    size: A4 portrait;
    margin: 6mm 10mm;
  }

  *,
  html,
  body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif !important;
  }

  html,
  body {
    width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    background: #ffffff !important;
    color: #000000 !important;
    overflow: visible !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  /* CRITICAL: Completely remove all top-level UI and interactive elements from the print tree.
     Using display: none completely removes their dimensions from the layout flow,
     preventing trailing blank pages created by invisible elements! */
  body>*:not(#print-slip-container),
  #app,
  header,
  nav,
  .top-header,
  .navigation-tabs,
  .main-content,
  .toast-container,
  .modal-overlay,
  .no-print {
    display: none !important;
    visibility: hidden !important;
    height: 0 !important;
    max-height: 0 !important;
    overflow: hidden !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  /* Exclusively display the print container in standard static document flow */
  #print-slip-container {
    display: block !important;
    visibility: visible !important;
    position: static !important;
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
    margin: 0 auto !important;
    padding: 0 !important;
    background: #ffffff !important;
    color: #000000 !important;
    page-break-after: avoid !important;
    page-break-before: avoid !important;
    page-break-inside: avoid !important;
    break-after: avoid !important;
    break-before: avoid !important;
    break-inside: avoid !important;
  }

  #print-slip-container:empty {
    display: none !important;
  }

  #print-slip-container * {
    visibility: visible !important;
  }

  #print-slip-container .official-invoice-sheet {
    box-shadow: none !important;
    border: none !important;
    margin: 0 auto !important;
    padding: 0.25rem 0.5rem !important;
    max-width: 680px !important;
    width: 100% !important;
    box-sizing: border-box !important;
    page-break-after: avoid !important;
    page-break-before: avoid !important;
    page-break-inside: avoid !important;
    break-after: avoid !important;
    break-before: avoid !important;
    break-inside: avoid !important;
  }
}

.prescription-slip {
  background: #ffffff;
  color: #1e293b;
  border-radius: var(--radius-md);
  padding: 2rem;
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.15);
  font-family: inherit;
}

.slip-clinic-header {
  border-bottom: 2px solid #0284c7;
  padding-bottom: 1.25rem;
  margin-bottom: 1.25rem;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.slip-doctor-name {
  font-size: 1.4rem;
  font-weight: 800;
  color: #0369a1;
}

.slip-clinic-name {
  font-size: 1.1rem;
  font-weight: 700;
  color: #0f172a;
}

.slip-patient-bar {
  background: #f1f5f9;
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.5rem;
  font-size: 0.85rem;
  margin-bottom: 1.25rem;
}

.rx-symbol {
  font-size: 2rem;
  font-family: serif;
  font-weight: bold;
  color: #0284c7;
  line-height: 1;
  margin-bottom: 0.5rem;
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.toast {
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 0.85rem 1.25rem;
  color: var(--text-primary);
  font-size: 0.88rem;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 280px;
  animation: slideInToast 0.25s ease forwards;
}

.toast.success {
  border-left: 4px solid var(--accent-new);
}

.toast.error {
  border-left: 4px solid var(--accent-danger);
}

.toast.info {
  border-left: 4px solid var(--primary);
}

@keyframes slideInToast {
  from {
    transform: translateX(100%);
    opacity: 0;
  }

  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* Footer Security Tag */
.app-footer {
  margin-top: auto;
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  padding: 0.85rem 1.5rem;
  font-size: 0.78rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.security-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--accent-new);
  font-weight: 600;
}

/* ==========================================================================
   Mobile App Compatibility & Responsive Design System
   Optimized for iOS & Android Viewports (<= 768px and <= 480px)
   ========================================================================== */

@media (max-width: 768px) {

  /* 1. Global Viewport & Safe Area */
  body {
    -webkit-tap-highlight-color: transparent;
    padding-bottom: max(4.5rem, calc(4.5rem + env(safe-area-inset-bottom)));
  }

  .main-viewport {
    padding: 0.85rem 0.75rem 5rem 0.75rem;
  }

  /* 2. Mobile App Header */
  .top-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    padding: max(0.45rem, env(safe-area-inset-top)) 0.65rem 0.45rem;
    gap: 0.35rem;
  }

  .brand-wrapper {
    order: 1;
    flex: 0 1 auto;
    min-width: 0;
    gap: 0.45rem;
    align-items: center;
  }

  .brand-icon {
    width: 30px;
    height: 30px;
    font-size: 1rem;
    flex-shrink: 0;
  }

  .brand-title {
    font-size: 0.92rem;
    gap: 0.25rem;
    white-space: nowrap;
    align-items: center;
  }

  .brand-subtitle {
    display: none;
    /* Hide subtitle on mobile so header is compact */
  }

  .brand-name {
    white-space: nowrap;
    font-size: 0.9rem;
  }

  .brand-badge {
    font-size: 0.58rem;
    padding: 2px 5px;
    white-space: nowrap;
  }

  /* Header Actions Bar */
  .header-actions {
    order: 2;
    margin-left: auto;
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 0.35rem;
  }

  /* User profile pill: compact icon-only avatar on mobile */
  .header-user-profile {
    padding: 0;
    background: transparent;
    border: none;
  }

  .header-user-profile .user-info-text {
    display: none;
    /* Hide user name/role text on mobile to avoid horizontal crowding */
  }

  .user-avatar-circle {
    width: 28px;
    height: 28px;
    font-size: 0.72rem;
  }

  /* Hide live clock on mobile - system clock is already visible in mobile status bar */
  .header-live-clock {
    display: none;
  }

  .theme-toggle-btn {
    width: 30px;
    height: 30px;
    font-size: 0.9rem;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .logout-btn {
    padding: 0.3rem 0.52rem;
    font-size: 0.72rem;
    gap: 0.2rem;
    white-space: nowrap;
  }

  /* Active Clinic Chip - Streamlined on mobile */
  .clinic-context-chip {
    width: 100%;
    order: 3;
    justify-content: flex-start;
    padding: 0.3rem 0.75rem;
    font-size: 0.75rem;
    border-radius: var(--radius-full);
    margin-top: 0.2rem;
    box-sizing: border-box;
    box-shadow: none;
  }

  .clinic-chip-icon-box {
    width: 24px;
    height: 24px;
    font-size: 0.85rem;
  }

  .clinic-context-text {
    flex: 1 1 auto;
    overflow: hidden;
    min-width: 0;
  }

  .clinic-context-title {
    max-width: 220px;
    font-size: 0.82rem;
  }

  .clinic-context-doctor {
    max-width: 220px;
    font-size: 0.72rem;
  }

  .clinic-chip-config-badge {
    margin-left: auto;
  }
}

/* Tablet & Medium Breakpoint (769px to 1024px) - Clean Single-Row Navbar */
@media (min-width: 769px) and (max-width: 1024px) {
  .top-header {
    flex-wrap: nowrap;
    padding: 0.65rem 1.15rem;
    gap: 0.85rem;
  }

  .brand-wrapper {
    flex: 0 0 auto;
  }

  .clinic-context-chip {
    flex: 0 1 auto;
    max-width: 380px;
    margin-top: 0;
  }

  .clinic-context-title {
    max-width: 180px;
  }

  .clinic-context-doctor {
    max-width: 200px;
  }

  .header-actions {
    margin-left: auto;
    flex: 0 0 auto;
    gap: 0.5rem;
  }

  /* Tablet Master-Detail & Grids */
.patients-grid {
  grid-template-columns: repeat(2, 1fr) !important;
  gap: 1rem !important;
}

.patients-kpi-grid {
  grid-template-columns: repeat(4, 1fr) !important;
  gap: 0.85rem !important;
}

#view-analytics .earnings-kpi-grid {
  grid-template-columns: repeat(2, 1fr) !important;
  gap: 0.85rem !important;
}

#view-analytics .kpi-grid:not(.earnings-kpi-grid) {
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)) !important;
  gap: 0.85rem !important;
}

.clinics-grid {
  grid-template-columns: repeat(2, 1fr) !important;
  gap: 1.15rem !important;
}

.patient-search-section {
  max-width: 100% !important;
}
}

/* Compact Mobile Phones (<= 480px) */
@media (max-width: 480px) {
  .top-header {
    padding: max(0.45rem, env(safe-area-inset-top)) 0.65rem 0.45rem;
    gap: 0.35rem;
  }

  .brand-wrapper {
    gap: 0.45rem;
  }

  .brand-icon {
    width: 40px !important;
    height: 27px !important;
    padding: 2px !important;
    border-radius: 6px !important;
  }

  .brand-title {
    font-size: 0.92rem !important;
    white-space: nowrap !important;
  }

  .brand-name-clinic {
    display: inline !important;
  }

  .brand-badge {
    font-size: 0.58rem;
    padding: 2px 4px;
  }

  .user-avatar-circle {
    width: 28px;
    height: 28px;
    font-size: 0.72rem;
  }

  .theme-toggle-btn {
    width: 30px;
    height: 30px;
    font-size: 0.9rem;
  }

  .logout-btn {
    padding: 0.32rem 0.55rem;
    font-size: 0.72rem;
  }
}

/* Extra-small mobile screens (<= 360px) */
@media (max-width: 360px) {
  .brand-name {
    font-size: 0.86rem;
  }

  .brand-badge {
    font-size: 0.54rem;
    padding: 1px 3px;
  }

  .logout-btn span:last-child {
    display: none;
    /* Icon-only exit on <= 360px */
  }

  .logout-btn {
    padding: 0.32rem 0.45rem;
  }
}

@media (max-width: 900px) {

  /* 3. Mobile & Tablet Native-Style Bottom Navigation Bar */
  .nav-tabs-bar {
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    top: auto !important;
    z-index: 1000 !important;
    background: rgba(15, 23, 42, 0.96) !important;
    backdrop-filter: blur(24px) !important;
    -webkit-backdrop-filter: blur(24px) !important;
    border-top: 1px solid rgba(255, 255, 255, 0.1) !important;
    border-bottom: none !important;
    padding: 0.35rem 0.5rem calc(0.45rem + env(safe-area-inset-bottom)) 0.5rem !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-around !important;
    gap: 0.2rem !important;
    box-shadow: 0 -6px 24px rgba(0, 0, 0, 0.35) !important;
    overflow: visible !important;
  }

  [data-theme="light"] .nav-tabs-bar {
    background: rgba(255, 255, 255, 0.96) !important;
    border-top: 1px solid #e2e8f0 !important;
    box-shadow: 0 -6px 20px rgba(15, 23, 42, 0.08) !important;
  }

  .nav-tab-btn {
    flex: 1 !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 2px !important;
    padding: 0.35rem 0.2rem !important;
    font-size: 0.72rem !important;
    font-weight: 700 !important;
    border: none !important;
    border-radius: 12px !important;
    position: relative !important;
    transition: transform 0.12s ease, background-color 0.15s ease !important;
    min-height: 48px !important;
    white-space: nowrap !important;
  }

  .nav-tab-btn.role-hidden,
  #tab-btn-clinics.role-hidden,
  [data-role="receptionist"] #tab-btn-clinics,
  [data-role="receptionist"] [data-tab="clinics"],
  [data-role="receptionist"] #view-clinics,
  body[data-role="receptionist"] #tab-btn-clinics,
  body[data-role="receptionist"] [data-tab="clinics"],
  body[data-role="receptionist"] #view-clinics,
  html[data-role="receptionist"] #tab-btn-clinics,
  html[data-role="receptionist"] [data-tab="clinics"],
  html[data-role="receptionist"] #view-clinics {
    display: none !important;
  }

  [data-role="admin"] #tab-btn-queue,
  [data-role="admin"] [data-tab="queue"],
  [data-role="admin"] #view-queue,
  body[data-role="admin"] #tab-btn-queue,
  body[data-role="admin"] [data-tab="queue"],
  body[data-role="admin"] #view-queue,
  html[data-role="admin"] #tab-btn-queue,
  html[data-role="admin"] [data-tab="queue"],
  html[data-role="admin"] #view-queue {
    display: none !important;
  }

  .nav-tab-btn:active {
    transform: scale(0.92) !important;
  }

  .nav-tab-btn.active {
    color: var(--primary) !important;
    background: rgba(14, 165, 233, 0.12) !important;
  }

  .tab-label-long {
    display: none !important;
  }

  .tab-label-short {
    display: inline !important;
  }

  .nav-tab-icon {
    font-size: 1.25rem !important;
    line-height: 1 !important;
  }

  /* Center Floating Action Button on Bottom Nav */
  .nav-tab-action-btn {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    flex: 0 0 auto !important;
    width: 58px !important;
    padding: 0 !important;
  }

  .nav-action-circle {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, #0284c7, #2563eb);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 14px rgba(2, 132, 199, 0.45);
    margin-top: -14px;
    border: 2.5px solid var(--bg-surface);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
  }

  [data-theme="light"] .nav-action-circle {
    border-color: #ffffff;
  }

  .nav-tab-action-btn:active .nav-action-circle {
    transform: scale(0.92);
  }

  .nav-action-plus {
    font-size: 1.5rem;
    font-weight: 900;
    line-height: 1;
  }

  .mobile-only-tab {
    display: flex !important;
  }

  /* Tab Badges: absolute corner pill */
  .nav-tab-btn .tab-badge {
    position: absolute !important;
    top: 2px !important;
    right: calc(50% - 22px) !important;
    font-size: 0.62rem !important;
    padding: 1px 5px !important;
    border-radius: 9999px !important;
    line-height: 1.2 !important;
  }

  .badge-long {
    display: none !important;
  }

  .badge-short {
    display: inline !important;
  }

  /* Main Viewport Safe Padding Bottom so fixed bottom bar does not clip content */
  .main-viewport {
    padding-bottom: calc(78px + env(safe-area-inset-bottom)) !important;
  }

  /* Floating Action Button (FAB) on Today's Queue */
  .mobile-fab {
    display: inline-flex !important;
    align-items: center !important;
    gap: 0.45rem !important;
    position: fixed !important;
    right: 1.1rem !important;
    bottom: calc(70px + env(safe-area-inset-bottom)) !important;
    z-index: 950 !important;
    padding: 0.7rem 1.15rem !important;
    border-radius: 9999px !important;
    background: linear-gradient(135deg, #0284c7, #1d4ed8) !important;
    color: #ffffff !important;
    font-family: inherit !important;
    font-size: 0.88rem !important;
    font-weight: 800 !important;
    border: 1px solid rgba(255, 255, 255, 0.25) !important;
    box-shadow: 0 8px 24px rgba(2, 132, 199, 0.45), 0 2px 6px rgba(0, 0, 0, 0.2) !important;
    cursor: pointer !important;
    user-select: none !important;
    transition: transform 0.16s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.16s ease !important;
  }

  .mobile-fab:active {
    transform: scale(0.94) !important;
  }

  .mobile-fab-icon {
    font-size: 1.25rem !important;
    font-weight: 900 !important;
    line-height: 1 !important;
  }

  .tab-badge {
    font-size: 0.65rem;
    padding: 1px 5px;
  }
}

@media (max-width: 680px) {
  .patients-grid {
    grid-template-columns: 1fr !important;
    gap: 0.85rem !important;
  }

  .patients-kpi-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 0.65rem !important;
  }

  #view-analytics .earnings-kpi-grid,
  #view-analytics .kpi-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 0.65rem !important;
  }

  .clinics-grid {
    grid-template-columns: 1fr !important;
    gap: 0.85rem !important;
  }

  /* Prevent iOS Safari auto-zooming on form input focus */
  input,
  select,
  textarea,
  .form-control,
  .form-input,
  .patient-search-input {
    font-size: 16px !important;
  }
}

@media (max-width: 900px) {
  /* 4. Mobile KPI Grid (Minimised, Compact & Horizontal Swipe Ribbon) */
  .kpi-section-wrapper {
  margin-bottom: 0.75rem;
}

.kpi-section-header {
  background: var(--bg-surface) !important;
  border: 1px solid var(--border-subtle) !important;
  border-radius: 14px !important;
  padding: 0.55rem 0.75rem !important;
  margin-bottom: 0.55rem !important;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04) !important;
}

[data-theme="light"] .kpi-section-header {
  background: #ffffff !important;
  border-color: #e2e8f0 !important;
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.04) !important;
}

.kpi-header-top-row {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  width: 100% !important;
}

.kpi-header-title-wrap {
  display: flex !important;
  align-items: center !important;
  gap: 0.4rem !important;
}

.kpi-section-heading {
  font-size: 0.78rem !important;
  font-weight: 800 !important;
  letter-spacing: 0.04em !important;
  white-space: nowrap !important;
  color: var(--text-primary) !important;
}

.kpi-toggle-btn {
  padding: 0.22rem 0.6rem !important;
  font-size: 0.7rem !important;
  border-radius: 999px !important;
  flex-shrink: 0 !important;
}

.kpi-mini-summary {
  display: none !important;
}

.kpi-section-wrapper.is-minimized .kpi-mini-summary {
  display: grid !important;
  grid-template-columns: repeat(4, 1fr) !important;
  gap: 0.35rem !important;
  margin-top: 0.5rem !important;
  padding-top: 0.5rem !important;
  border-top: 1px solid var(--border-subtle) !important;
}

.mini-chip {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 0.22rem !important;
  padding: 0.3rem 0.2rem !important;
  font-size: 0.68rem !important;
  border-radius: 7px !important;
  text-align: center !important;
  white-space: nowrap !important;
}

.mini-chip .chip-icon {
  font-size: 0.75rem !important;
  line-height: 1 !important;
}

.mini-chip .chip-text strong {
  font-weight: 800 !important;
}

@media (max-width: 380px) {
  .mini-chip {
    font-size: 0.62rem !important;
    padding: 0.25rem 0.15rem !important;
  }

  .mini-chip .chip-icon {
    font-size: 0.7rem !important;
  }
}

/* When Expanded on mobile: A sleek, 1-row horizontal swipe ribbon taking only ~62px height */
.kpi-section-wrapper .kpi-grid,
.kpi-grid:not(#view-analytics .kpi-grid):not(.patients-kpi-grid) {
  display: flex !important;
  overflow-x: auto !important;
  -webkit-overflow-scrolling: touch !important;
  scroll-snap-type: x mandatory !important;
  gap: 0.55rem !important;
  margin-bottom: 0.5rem !important;
  padding: 0.1rem 0.1rem 0.4rem 0.1rem !important;
}

.kpi-section-wrapper .kpi-grid::-webkit-scrollbar,
.kpi-grid::-webkit-scrollbar {
  display: none;
}

.kpi-section-wrapper .kpi-card,
.kpi-card:not(#view-analytics .kpi-card):not(.patients-kpi-grid .kpi-card) {
  flex: 0 0 145px !important;
  min-width: 135px !important;
  max-width: 160px !important;
  scroll-snap-align: start !important;
  padding: 0.6rem 0.75rem !important;
  border-radius: 14px !important;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04) !important;
}

[data-theme="light"] .kpi-card:not(#view-analytics .kpi-card) {
  background: #ffffff !important;
  border-color: #e2e8f0 !important;
}

.kpi-header:not(#view-analytics .kpi-header) {
  margin-bottom: 0.2rem !important;
}

.kpi-title:not(#view-analytics .kpi-title) {
  font-size: 0.68rem !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}

.kpi-icon-pill:not(#view-analytics .kpi-icon-pill) {
  width: 24px !important;
  height: 24px !important;
  font-size: 0.85rem !important;
}

.kpi-value:not(#view-analytics .kpi-value) {
  font-size: 1.25rem !important;
  line-height: 1.1 !important;
}

/* Hide verbose paragraph footers on mobile to eliminate vertical bloat (except analytics)! */
.kpi-footer:not(#view-analytics .kpi-footer) {
  display: none !important;
}

/* 5. Mobile Queue Container & Native Appointment Cards */
.queue-container {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  border-radius: 0 !important;
  overflow: visible !important;
}

.queue-table-header {
  display: none !important;
  /* Hide desktop table headers on mobile */
}

.queue-list {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

/* Transform each queue row into a sleek, compact, touch-ergonomic mobile card */
.queue-row {
  display: grid !important;
  grid-template-columns: 46px 1fr auto !important;
  grid-template-rows: auto auto auto !important;
  grid-template-areas:
    "token   patient  type"
    "token   patient  time"
    "status  status   actions" !important;
  background: var(--bg-surface) !important;
  border: 1px solid var(--border-subtle) !important;
  border-radius: 16px !important;
  padding: 0.9rem 1rem !important;
  gap: 0.35rem 0.65rem !important;
  align-items: center !important;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.04) !important;
  position: relative !important;
  transition: transform 0.12s ease, box-shadow 0.18s ease, border-color 0.18s ease, background-color 0.18s ease;
  overflow: visible !important;
  contain: none !important;
  border-left: 4.5px solid var(--border-subtle) !important;
}

[data-theme="light"] .queue-row {
  background: #ffffff !important;
  border: 1px solid #e2e8f0 !important;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04) !important;
}

.queue-row:active {
  transform: scale(0.99);
}

/* Status accent color indicators on left edge */
.queue-row.status-in_queue {
  border-left-color: #f59e0b !important;
}

.queue-row.status-in_consultation,
.queue-row.in-consultation {
  border-left-color: #0284c7 !important;
  background: rgba(2, 132, 199, 0.04) !important;
}

[data-theme="light"] .queue-row.status-in_consultation,
[data-theme="light"] .queue-row.in-consultation {
  background: #f0f9ff !important;
}

.queue-row.status-completed {
  border-left-color: #10b981 !important;
}

.queue-row.status-scheduled {
  border-left-color: #8b5cf6 !important;
}

.queue-row.status-cancelled {
  border-left-color: #ef4444 !important;
  opacity: 0.88;
}

/* Elevate card when its status dropdown menu is open */
.queue-row:has(.custom-status-dropdown.open),
.queue-row.menu-open {
  z-index: 1000 !important;
  overflow: visible !important;
  contain: none !important;
  -webkit-backface-visibility: visible !important;
  backface-visibility: visible !important;
  transform: none !important;
}

/* 1. Token Badge in Top-Left Column */
.col-token,
.queue-row>div:nth-child(1) {
  grid-area: token !important;
  position: static !important;
  align-self: start !important;
  margin-top: 2px !important;
}

.token-badge {
  width: 44px !important;
  height: 44px !important;
  border-radius: 12px !important;
  background: var(--bg-surface-elevated) !important;
  border: 1.5px solid rgba(2, 132, 199, 0.25) !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  font-weight: 800 !important;
  font-size: 1.05rem !important;
  color: var(--primary) !important;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04) !important;
}

[data-theme="light"] .token-badge {
  background: #f0f9ff !important;
  border-color: #bae6fd !important;
  color: #0284c7 !important;
}

/* 2. Patient Identity & Demographics in Middle Column */
.patient-info-col {
  grid-area: patient !important;
  padding-left: 0 !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 0.2rem !important;
  min-width: 0 !important;
}

.patient-name {
  font-size: 1.02rem !important;
  font-weight: 800 !important;
  color: var(--text-primary) !important;
  line-height: 1.25 !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}

[data-theme="light"] .patient-name {
  color: #0f172a !important;
}

.patient-demographics {
  font-size: 0.77rem !important;
  color: var(--text-muted) !important;
  line-height: 1.3 !important;
  display: flex !important;
  align-items: center !important;
  flex-wrap: wrap !important;
  gap: 0.35rem !important;
}

[data-theme="light"] .patient-demographics {
  color: #64748b !important;
}

.patient-phone-link {
  color: inherit !important;
  text-decoration: none !important;
  font-weight: 600 !important;
  transition: color 0.15s ease;
}

.patient-phone-link:active {
  color: var(--primary) !important;
}

.demo-bullet {
  opacity: 0.5;
}

.complaint-text {
  font-size: 0.78rem !important;
  color: var(--text-secondary) !important;
  background: transparent !important;
  border: none !important;
  padding: 0 !important;
  margin-top: 0.15rem !important;
  line-height: 1.3 !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  font-style: italic !important;
}

[data-theme="light"] .complaint-text {
  background: transparent !important;
  border: none !important;
  color: #475569 !important;
}

/* 3. Visit Type Badge pinned to Top-Right */
.col-type,
.queue-row>div:nth-child(3) {
  grid-area: type !important;
  padding-left: 0 !important;
  justify-self: end !important;
  align-self: start !important;
}

.badge-visit-type {
  font-size: 0.68rem !important;
  padding: 0.22rem 0.55rem !important;
  border-radius: 999px !important;
  font-weight: 700 !important;
  letter-spacing: 0.03em !important;
  white-space: nowrap !important;
}

/* 4. Time Slot Pill right below Visit Type Badge */
.col-time,
.queue-row>div:nth-child(4) {
  grid-area: time !important;
  justify-self: end !important;
  align-self: center !important;
  background: transparent !important;
  border: none !important;
  padding: 0 !important;
}

.time-slot-pill {
  font-size: 0.78rem !important;
  font-weight: 700 !important;
  color: var(--text-muted) !important;
  white-space: nowrap !important;
  background: transparent !important;
  border: none !important;
}

[data-theme="light"] .time-slot-pill {
  color: #64748b !important;
}

/* 5. Status Dropdown & Contextual Action (Left portion of Bottom Action Bar) */
.col-status,
.queue-row>div:nth-child(5) {
  grid-area: status !important;
  display: flex !important;
  align-items: center !important;
  gap: 0.85rem !important;
  width: 100% !important;
  min-width: 0 !important;
  margin-top: 0.35rem !important;
  padding-top: 0.5rem !important;
  border-top: 1px solid var(--border-subtle) !important;
  overflow: visible !important;
  position: relative !important;
}

[data-theme="light"] .col-status,
[data-theme="light"] .queue-row>div:nth-child(5) {
  border-top: 1px solid #f1f5f9 !important;
}

.custom-status-dropdown {
  flex: 0 0 auto !important;
  width: auto !important;
  min-width: 0 !important;
  max-width: fit-content !important;
  position: relative !important;
  overflow: visible !important;
}

.custom-status-dropdown.open {
  z-index: 1001 !important;
}

.custom-status-trigger {
  width: auto !important;
  max-width: fit-content !important;
  flex: 0 0 auto !important;
  min-height: 36px !important;
  padding: 0.35rem 0.8rem !important;
  gap: 0.35rem !important;
  border-radius: 10px !important;
  font-size: 0.78rem !important;
  font-weight: 700 !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  box-sizing: border-box !important;
  display: inline-flex !important;
}

.custom-status-trigger.status-completed {
  width: auto !important;
  max-width: fit-content !important;
  flex: 0 0 auto !important;
  padding: 0.35rem 0.8rem !important;
}

.status-trigger-text {
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  min-width: 0 !important;
  font-size: 0.78rem !important;
}

.quick-status-btn {
  min-height: 38px !important;
  padding: 0.35rem 0.65rem !important;
  border-radius: 10px !important;
  font-size: 0.78rem !important;
  font-weight: 700 !important;
  white-space: nowrap !important;
  flex-shrink: 0 !important;
}

/* 6. Slip Action Button (Right portion of Bottom Action Bar - Side-by-side with Status!) */
.row-actions-group {
  grid-area: actions !important;
  width: auto !important;
  margin-top: 0.35rem !important;
  padding-top: 0.5rem !important;
  border-top: 1px solid var(--border-subtle) !important;
  display: flex !important;
  align-items: center !important;
  justify-content: flex-end !important;
  flex-shrink: 0 !important;
}

[data-theme="light"] .row-actions-group {
  border-top: 1px solid #f1f5f9 !important;
}

.action-slip-btn {
  min-height: 38px !important;
  padding: 0.35rem 0.75rem !important;
  border-radius: 10px !important;
  font-size: 0.78rem !important;
  font-weight: 700 !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 0.3rem !important;
  white-space: nowrap !important;
  border: 1.5px solid var(--border-subtle) !important;
  background: var(--bg-surface-elevated) !important;
  color: var(--text-primary) !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05) !important;
  transition: all 0.15s ease !important;
  flex-shrink: 0 !important;
}

[data-theme="light"] .action-slip-btn {
  background: #ffffff !important;
  border-color: #cbd5e1 !important;
  color: #1e293b !important;
}

.action-slip-btn:active {
  transform: scale(0.97) !important;
}


/* 6. Mobile Patient Intake Card & Search */
.intake-card {
  padding: 1.1rem !important;
  border-radius: var(--radius-lg) !important;
  margin-bottom: 1.25rem !important;
}

.intake-header {
  flex-direction: column !important;
  align-items: stretch !important;
  gap: 0.75rem !important;
}

.intake-header button {
  width: 100% !important;
  min-height: 46px !important;
  justify-content: center !important;
  font-size: 0.92rem !important;
}

.patient-search-input {
  font-size: 16px !important;
  /* Prevents auto-zoom on iOS Safari */
  min-height: 48px !important;
  padding-left: 2.5rem !important;
}

.search-dropdown {
  max-height: 60vh !important;
  border-radius: var(--radius-md) !important;
}

.dropdown-item {
  padding: 0.85rem 1rem !important;
  min-height: 52px !important;
}

/* 7. Mobile Bottom-Sheet Modals & Full Viewport Backdrop */
.modal-overlay {
  position: fixed !important;
  inset: 0 !important;
  z-index: 50000 !important;
  align-items: flex-end !important;
  justify-content: center !important;
  padding: 0 !important;
  background: rgba(0, 0, 0, 0.78) !important;
  backdrop-filter: blur(8px) !important;
  -webkit-backdrop-filter: blur(8px) !important;
}

/* Automatically hide mobile bottom nav and floating action buttons when any modal is open */
body:has(.modal-overlay.active) .nav-tabs-bar,
body:has(.modal-overlay.open) .nav-tabs-bar,
body.modal-open .nav-tabs-bar,
body:has(.modal-overlay.active) .mobile-fab,
body:has(.modal-overlay.open) .mobile-fab,
body.modal-open .mobile-fab {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

body.modal-open {
  overflow: hidden !important;
}

.modal-card {
  width: 100% !important;
  max-width: 100% !important;
  max-height: calc(100dvh - 28px) !important;
  border-radius: 22px 22px 0 0 !important;
  margin: 0 !important;
  display: flex !important;
  flex-direction: column !important;
  overflow: hidden !important;
  padding: 0 !important;
  background: #111827 !important;
  border: 1px solid var(--border-light) !important;
  border-bottom: none !important;
  animation: mobileSheetUp 0.22s cubic-bezier(0.16, 1, 0.3, 1) forwards !important;
  box-shadow: 0 -12px 48px rgba(0, 0, 0, 0.65) !important;
}

/* Native Mobile Bottom Sheet Grab Handle */
.modal-card::before {
  content: '';
  display: block;
  width: 40px;
  height: 4px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.25);
  margin: 8px auto 2px auto;
  flex-shrink: 0;
}

[data-theme="light"] .modal-card::before {
  background: rgba(0, 0, 0, 0.18);
}

[data-theme="light"] .modal-card {
  background: #ffffff !important;
  border-color: #cbd5e1 !important;
  box-shadow: 0 -12px 48px rgba(15, 23, 42, 0.22) !important;
}

@keyframes mobileSheetUp {
  from {
    transform: translateY(100%);
  }

  to {
    transform: translateY(0);
  }
}

.modal-header {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  padding: 0.85rem 1.25rem 0.85rem !important;
  position: relative !important;
  top: auto !important;
  z-index: 10 !important;
  flex-shrink: 0 !important;
  background: #111827 !important;
  border-bottom: 1px solid var(--border-subtle) !important;
  margin: 0 !important;
}

[data-theme="light"] .modal-header {
  background: #ffffff !important;
  border-color: #e2e8f0 !important;
}

.modal-title {
  font-size: 1.12rem !important;
  font-weight: 700 !important;
  line-height: 1.25 !important;
  color: var(--text-primary) !important;
}

.modal-close-btn {
  width: 36px !important;
  height: 36px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  font-size: 1.4rem !important;
  border-radius: 50% !important;
  background: rgba(255, 255, 255, 0.08) !important;
  color: var(--text-muted) !important;
  flex-shrink: 0 !important;
}

[data-theme="light"] .modal-close-btn {
  background: #f1f5f9 !important;
  color: #475569 !important;
}

.modal-content {
  padding: 1rem 1.25rem !important;
  overflow-y: auto !important;
  -webkit-overflow-scrolling: touch !important;
  flex: 1 1 auto !important;
  min-height: 0 !important;
}

.modal-footer {
  display: flex !important;
  padding: 0.85rem 1.25rem calc(0.85rem + env(safe-area-inset-bottom, 12px)) !important;
  flex-direction: column-reverse !important;
  gap: 0.55rem !important;
  flex-shrink: 0 !important;
  background: #111827 !important;
  border-top: 1px solid var(--border-subtle) !important;
  z-index: 10 !important;
  margin: 0 !important;
  width: 100% !important;
  box-sizing: border-box !important;
}

[data-theme="light"] .modal-footer {
  background: #ffffff !important;
  border-color: #e2e8f0 !important;
}

.modal-footer button,
.modal-footer .btn {
  width: 100% !important;
  min-height: 48px !important;
  justify-content: center !important;
  font-size: 0.95rem !important;
  font-weight: 700 !important;
  border-radius: 12px !important;
  margin: 0 !important;
}

/* Mobile Classification Radio Cards */
.type-radio-group {
  display: grid !important;
  grid-template-columns: 1fr 1fr !important;
  gap: 0.5rem !important;
}

.type-radio-label {
  padding: 0.75rem 0.5rem !important;
  min-height: 68px !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  text-align: center !important;
  gap: 0.25rem !important;
  border-radius: 12px !important;
}

.type-radio-title {
  font-size: 0.82rem !important;
  font-weight: 800 !important;
  line-height: 1.2 !important;
  display: block !important;
}

.type-radio-desc {
  font-size: 0.68rem !important;
  font-weight: 500 !important;
  line-height: 1.2 !important;
  display: block !important;
}

.form-row,
.form-grid {
  grid-template-columns: 1fr !important;
  gap: 0.85rem !important;
}

.form-group-full {
  grid-column: span 1 !important;
}

.form-input,
.form-select,
.form-textarea,
.form-control {
  font-size: 16px !important;
  /* Prevents iOS auto-zoom */
  min-height: 48px !important;
  padding: 0.75rem 0.95rem !important;
  border-radius: 10px !important;
}

.form-textarea {
  min-height: 80px !important;
}

/* 8. Mobile Analytics & Reporting */
.time-range-pills {
  padding: 0.3rem !important;
  gap: 0.35rem !important;
  overflow-x: auto !important;
  -webkit-overflow-scrolling: touch !important;
  scrollbar-width: none !important;
}

.time-range-pills::-webkit-scrollbar {
  display: none !important;
}

.time-pill-btn {
  padding: 0.4rem 0.8rem !important;
  font-size: 0.78rem !important;
  white-space: nowrap !important;
  flex-shrink: 0 !important;
  min-height: 38px !important;
}

.chart-grid-2col {
  grid-template-columns: 1fr !important;
  gap: 1rem !important;
}

.chart-card {
  padding: 1rem !important;
}

.chart-header {
  flex-direction: column !important;
  align-items: flex-start !important;
  gap: 0.65rem !important;
}

.chart-actions {
  width: 100% !important;
  justify-content: space-between !important;
}

.chart-toggle-btn {
  flex: 1 !important;
  text-align: center !important;
  min-height: 36px !important;
}

.chart-canvas-wrapper {
  height: 260px !important;
}

.view-header {
  flex-direction: column !important;
  align-items: flex-start !important;
  gap: 0.75rem !important;
}

.view-title-group h1 {
  font-size: 1.35rem !important;
}

/* 8. Mobile Action Bar (Side-by-Side Ergonomic Layout: Refresh + New Patient) */
.actions-group {
  width: 100% !important;
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  gap: 0.6rem !important;
}

.btn-refresh-enhanced {
  flex: 0 0 auto !important;
  width: auto !important;
  min-height: 44px !important;
  padding: 0.55rem 0.95rem !important;
  border-radius: 12px !important;
  font-size: 0.82rem !important;
}

.btn-new-patient-enhanced {
  flex: 1 !important;
  width: auto !important;
  min-height: 44px !important;
  padding: 0.55rem 1rem !important;
  border-radius: 12px !important;
  white-space: nowrap !important;
  font-size: 0.88rem !important;
  justify-content: center !important;
}


/* 9. Mobile Clinics Grid */
.clinics-grid {
  grid-template-columns: 1fr !important;
  gap: 1rem !important;
}

.clinic-card {
  padding: 1.1rem !important;
}

.clinic-card-actions {
  flex-direction: column !important;
  gap: 0.5rem !important;
}

.clinic-card-actions button {
  width: 100% !important;
  min-height: 44px !important;
  justify-content: center !important;
}

/* 10. Mobile Toast Position */
.toast-container {
  bottom: 5.5rem !important;
  left: 1rem !important;
  right: 1rem !important;
  min-width: 0 !important;
  z-index: 10000 !important;
}

body:has(.modal-overlay.active) .toast-container,
.modal-overlay.active~.toast-container {
  top: max(1rem, env(safe-area-inset-top)) !important;
  bottom: auto !important;
}

.toast {
  min-width: 0 !important;
  width: 100% !important;
}

/* Footer on Mobile */
.app-footer {
  display: none !important;
  /* Replaced by bottom bar on phones */
}

/* Invoice Modal on Mobile */
#slip-preview-modal .modal-card {
  width: 98% !important;
  padding: 0 !important;
}

#slip-preview-modal .modal-content {
  padding: 0.75rem !important;
  overflow-x: auto !important;
  -webkit-overflow-scrolling: touch !important;
}

.official-invoice-sheet {
  min-width: 540px !important;
  padding: 1.25rem 1rem !important;
}
}

/* Extra small devices (<= 380px) */
@media (max-width: 380px) {
  .brand-title {
    font-size: 0.95rem;
  }

  .clinic-context-title {
    max-width: 120px;
  }

  .clinic-context-doctor {
    max-width: 100px;
  }

  .nav-tab-btn {
    font-size: 0.65rem;
  }
}

/* ==========================================================================
   PATIENT RECORDS & MEDICAL DIRECTORY MODULE STYLES
   ========================================================================== */
.patients-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.65rem;
  margin-bottom: 0.85rem;
  transition: opacity 0.25s ease, max-height 0.25s ease, margin 0.25s ease;
}

.patients-kpi-grid.is-collapsed {
  display: none !important;
}

.patients-kpi-grid .kpi-card {
  padding: 0.55rem 0.75rem;
}

@media (max-width: 900px) {
  .patients-kpi-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 0.5rem !important;
    margin-bottom: 0.65rem !important;
  }
}

@media (max-width: 480px) {
  .patients-kpi-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 0.4rem !important;
    margin-bottom: 0.5rem !important;
  }

  .patients-kpi-grid .kpi-card {
    padding: 0.45rem 0.6rem !important;
    flex: initial !important;
    min-width: 0 !important;
    max-width: none !important;
  }

  .patients-kpi-grid .kpi-title {
    font-size: 0.62rem !important;
  }

  .patients-kpi-grid .kpi-value {
    font-size: 1.2rem !important;
    margin-bottom: 0 !important;
  }

  .patients-kpi-grid .kpi-footer {
    display: none !important;
  }
}

.btn-kpi-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.45rem 0.75rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-light);
  background: var(--bg-surface);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.btn-kpi-toggle:hover {
  background: var(--border-subtle);
  color: var(--text-primary);
  border-color: var(--border-medium);
}

.btn-kpi-toggle.is-collapsed {
  background: rgba(14, 165, 233, 0.1);
  border-color: rgba(14, 165, 233, 0.4);
  color: var(--accent-primary);
}

.btn-kpi-toggle svg {
  transition: transform 0.2s ease;
}

.btn-kpi-toggle.is-collapsed svg {
  transform: rotate(180deg);
}

.patients-toolbar-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 1.35rem 1.5rem 1.75rem 1.5rem;
  margin-bottom: 1.85rem;
  display: flex;
  flex-direction: column;
  gap: 1.35rem;
  box-shadow: 0 4px 16px -2px rgba(0, 0, 0, 0.12);
  position: relative;
  z-index: 10;
}

@media (min-width: 900px) {
  .patients-toolbar-card {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    padding: 1.35rem 1.5rem 1.75rem 1.5rem;
    margin-bottom: 1.85rem;
  }
}

.patients-search-box {
  position: relative;
  display: flex;
  align-items: center;
  flex: 1;
  max-width: 100%;
  margin-bottom: 0.35rem;
}

@media (min-width: 900px) {
  .patients-search-box {
    max-width: 520px;
  }
}

.patients-search-box .search-icon {
  position: absolute;
  left: 14px;
  color: var(--text-muted);
  pointer-events: none;
}

.patients-search-field {
  width: 100%;
  padding: 0.72rem 2.4rem 0.72rem 2.6rem;
  font-size: 0.9rem;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--border-light);
  background: var(--bg-surface-elevated);
  color: var(--text-primary);
  font-family: inherit;
  transition: all 0.2s ease;
}

.patients-search-field:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.2);
  background: var(--bg-surface);
}

.patients-clear-btn {
  position: absolute;
  right: 12px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: none;
  background: var(--border-light);
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  line-height: 1;
  transition: all 0.2s ease;
}

.patients-clear-btn:hover {
  background: var(--text-muted);
  color: #ffffff;
}

.patients-filters-row {
  display: flex;
  align-items: center;
  gap: 1.35rem;
  flex-wrap: wrap;
  margin-bottom: 0.25rem;
}

.gender-filter-group {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
}

.gender-filter-label {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.gender-pill-filters {
  display: inline-flex;
  background: var(--bg-surface-elevated);
  padding: 3px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-light);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
}

.gender-pill-filters .filter-pill-btn {
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all 0.2s ease;
}

.gender-pill-filters .filter-pill-btn:hover:not(.active) {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.06);
}

.gender-pill-filters .filter-pill-btn.active {
  background: var(--primary);
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(14, 165, 233, 0.35);
}

.patients-sort-wrap {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  position: relative;
}

.patients-sort-label {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  white-space: nowrap;
}

/* Custom Beautified Sort Dropdown Component (matches queue status dropdown) */
.custom-sort-dropdown {
  position: relative;
  display: inline-flex;
}

.custom-sort-dropdown.open {
  z-index: 1002 !important;
}

.custom-sort-trigger {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.42rem 0.85rem;
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  outline: none;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-light);
  color: var(--text-primary);
  transition: var(--transition-smooth);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
  user-select: none;
  white-space: nowrap;
  box-sizing: border-box;
}

.custom-sort-trigger:hover {
  transform: translateY(-1px);
  border-color: var(--primary);
  box-shadow: 0 4px 12px rgba(14, 165, 233, 0.22);
}

.custom-sort-dropdown.open .custom-sort-trigger {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.25);
}

.custom-sort-trigger .sort-trigger-icon {
  font-size: 0.95rem;
  line-height: 1;
}

.custom-sort-trigger .sort-trigger-arrow {
  font-size: 0.68rem;
  opacity: 0.7;
  transition: transform 0.2s ease;
  margin-left: 2px;
}

.custom-sort-dropdown.open .sort-trigger-arrow {
  transform: rotate(180deg);
}

/* Custom Sort Menu Dropdown Popup */
.custom-sort-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 9999 !important;
  min-width: 250px;
  max-width: calc(100vw - 2rem);
  background: #0f172a !important;
  border: 1px solid rgba(255, 255, 255, 0.18) !important;
  border-radius: var(--radius-lg);
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.85), 0 0 0 1px rgba(255, 255, 255, 0.08);
  padding: 0.4rem;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-6px) scale(0.97);
  transform-origin: top right;
  transition: all 0.16s cubic-bezier(0.16, 1, 0.3, 1);
}

.custom-sort-dropdown.open .custom-sort-menu {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

[data-theme="light"] .custom-sort-menu {
  background: #ffffff !important;
  border: 1px solid #cbd5e1 !important;
  box-shadow: 0 16px 36px rgba(15, 23, 42, 0.18), 0 0 0 1px rgba(0, 0, 0, 0.06);
}

@media (max-width: 600px) {
  .patients-toolbar-card {
    padding: 1.2rem 1.15rem 1.65rem 1.15rem !important;
    gap: 1.25rem !important;
    margin-bottom: 1.75rem !important;
  }

  .patients-search-box {
    margin-bottom: 0.35rem !important;
  }

  .patients-filters-row {
    flex-direction: column;
    align-items: stretch;
    gap: 0.95rem;
    margin-bottom: 0.25rem !important;
  }

  .gender-filter-group {
    justify-content: space-between;
  }

  .gender-pill-filters {
    flex: 1;
    justify-content: center;
  }

  .gender-pill-filters .filter-pill-btn {
    flex: 1;
    text-align: center;
  }

  .patients-sort-wrap {
    justify-content: space-between;
    width: 100%;
  }

  .custom-sort-dropdown {
    flex: 1;
  }

  .custom-sort-trigger {
    width: 100%;
    justify-content: space-between;
  }

  .custom-sort-menu {
    left: 0;
    right: 0;
    min-width: unset;
  }
}

.patients-status-row {
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.patients-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 1.15rem;
}

/* Patient Directory Card */
.patient-directory-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 1.15rem;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 3px 12px -2px rgba(0, 0, 0, 0.1);
  position: relative;
  overflow: hidden;
}

.patient-directory-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--primary), #818cf8);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.patient-directory-card:hover {
  transform: translateY(-3px);
  border-color: var(--border-hover);
  box-shadow: 0 10px 24px -4px rgba(0, 0, 0, 0.22);
}

.patient-directory-card:hover::before {
  opacity: 1;
}

.patient-card-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
}

.patient-avatar {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1rem;
  flex-shrink: 0;
}

.patient-avatar.gender-female {
  background: rgba(236, 72, 153, 0.15);
  color: #ec4899;
  border: 1px solid rgba(236, 72, 153, 0.3);
}

.patient-avatar.gender-male {
  background: rgba(14, 165, 233, 0.15);
  color: var(--primary);
  border: 1px solid rgba(14, 165, 233, 0.3);
}

.patient-avatar-lg {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1.25rem;
  flex-shrink: 0;
}

.patient-avatar-lg.gender-female {
  background: rgba(236, 72, 153, 0.18);
  color: #ec4899;
  border: 1.5px solid rgba(236, 72, 153, 0.4);
}

.patient-avatar-lg.gender-male {
  background: rgba(14, 165, 233, 0.18);
  color: var(--primary);
  border: 1.5px solid rgba(14, 165, 233, 0.4);
}

.patient-card-title-group {
  overflow: hidden;
  flex: 1;
}

.patient-card-name {
  font-size: 1.02rem;
  font-weight: 800;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.patient-card-submeta {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 4px;
  flex-wrap: wrap;
}

.patient-gender-tag {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
}

.patient-gender-tag.gender-female {
  background: rgba(236, 72, 153, 0.12);
  color: #ec4899;
}

.patient-gender-tag.gender-male {
  background: rgba(14, 165, 233, 0.12);
  color: var(--primary);
}

.patient-id-tag {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-weight: 600;
}

.patient-card-body {
  margin-bottom: 1rem;
  flex: 1;
}

.patient-card-contact-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  margin-bottom: 0.4rem;
}

.contact-link {
  color: var(--text-primary);
  text-decoration: none;
  font-weight: 600;
  transition: color 0.15s ease;
}

.contact-link:hover {
  color: var(--primary);
  text-decoration: underline;
}

.patient-card-metrics-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 0.6rem 0.75rem;
  margin-top: 0.65rem;
}

.metric-cell {
  display: flex;
  flex-direction: column;
}

.metric-cell-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 0.3px;
}

.metric-cell-val {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.patient-card-notes-preview {
  margin-top: 0.65rem;
  padding: 0.45rem 0.65rem;
  background: rgba(245, 158, 11, 0.1);
  border-left: 3px solid #f59e0b;
  border-radius: 4px;
  font-size: 0.75rem;
  color: #f59e0b;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.patient-card-footer {
  display: flex;
  gap: 0.5rem;
  border-top: 1px solid var(--border-subtle);
  padding-top: 0.85rem;
}

.patient-card-footer button {
  flex: 1;
  font-size: 0.78rem;
  padding: 0.45rem 0.5rem;
  justify-content: center;
}

/* Patient Empty State */
.patients-empty-state {
  text-align: center;
  padding: 3.5rem 1.5rem;
  background: var(--bg-surface);
  border: 1.5px dashed var(--border-light);
  border-radius: var(--radius-xl);
  margin-top: 1rem;
}

/* Patient History Modal */
.patient-info-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.75rem;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 0.85rem 1rem;
  margin-bottom: 1rem;
}

.info-item {
  display: flex;
  flex-direction: column;
}

.info-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 0.3px;
}

.info-val {
  font-size: 0.88rem;
  color: var(--text-primary);
  font-weight: 600;
  margin-top: 2px;
}

.patient-medical-alert-box {
  background: rgba(245, 158, 11, 0.08);
  border: 1px solid rgba(245, 158, 11, 0.25);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
}

/* Patient Timeline Visits */
.patient-visits-timeline {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.timeline-visit-card {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-light);
  border-radius: 10px;
  padding: 0.85rem 1rem;
  position: relative;
  transition: all 0.2s ease;
}

.timeline-visit-card:hover {
  border-color: var(--border-hover);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.15);
}

.timeline-visit-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 0.6rem;
  margin-bottom: 0.6rem;
}

.timeline-date-badge {
  font-size: 0.8rem;
  font-weight: 800;
  color: var(--text-primary);
}

.timeline-token-badge {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  background: var(--bg-surface);
  padding: 2px 7px;
  border-radius: 4px;
}

.timeline-visit-body {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.timeline-field {
  display: flex;
  gap: 0.5rem;
  font-size: 0.82rem;
}

.timeline-label {
  font-weight: 700;
  color: var(--text-muted);
  min-width: 105px;
  flex-shrink: 0;
}

.timeline-val {
  color: var(--text-primary);
  flex: 1;
}

.timeline-vitals-row {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin: 0.25rem 0;
}

.vital-pill {
  font-size: 0.74rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  padding: 2px 8px;
  border-radius: 4px;
  color: var(--text-muted);
}

.vital-pill strong {
  color: var(--text-primary);
}

.timeline-rx-box {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  padding: 0.5rem 0.75rem;
  font-size: 0.8rem;
  font-family: monospace;
  color: var(--text-primary);
  white-space: pre-wrap;
  flex: 1;
}

.patient-clinic-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 4px;
  background: rgba(99, 102, 241, 0.12);
  color: #818cf8;
  border: 1px solid rgba(99, 102, 241, 0.25);
  white-space: nowrap;
  max-width: 100%;
}

.patient-clinic-tag.clinic-1 {
  background: rgba(14, 165, 233, 0.12);
  color: #38bdf8;
  border-color: rgba(14, 165, 233, 0.3);
}

.patient-clinic-tag.clinic-2 {
  background: rgba(16, 185, 129, 0.12);
  color: #34d399;
  border-color: rgba(16, 185, 129, 0.3);
}

.patient-clinic-tag.clinic-3 {
  background: rgba(245, 158, 11, 0.12);
  color: #fbbf24;
  border-color: rgba(245, 158, 11, 0.3);
}

.patient-clinic-tag.clinic-4 {
  background: rgba(168, 85, 247, 0.12);
  color: #c084fc;
  border-color: rgba(168, 85, 247, 0.3);
}

.patients-clinic-wrap {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  max-width: 100%;
  flex-wrap: wrap;
}

#patients-clinic-select {
  background: var(--bg-card) !important;
  color: var(--text-primary) !important;
  border: 1px solid var(--border-color) !important;
  max-width: 100%;
  min-width: 180px;
}

/* ==========================================================================
   AUTHENTICATION: FULL LOGIN SCREEN & DEMO CARDS
   ========================================================================== */
.login-screen-wrapper {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 50% 15%, rgba(14, 165, 233, 0.12) 0%, rgba(10, 14, 23, 0.98) 75%), var(--bg-primary);
  overflow-y: auto;
  padding: 1.5rem;
}

[data-theme="light"] .login-screen-wrapper {
  background: radial-gradient(circle at 50% 15%, rgba(14, 165, 233, 0.1) 0%, rgba(248, 250, 252, 0.98) 75%), var(--bg-primary);
}

.login-top-controls {
  position: absolute;
  top: 1.25rem;
  right: 1.25rem;
  z-index: 10;
}

.login-theme-btn {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-full);
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  transition: transform 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}

.login-theme-btn:hover {
  transform: scale(1.08);
  border-color: var(--primary);
}

.login-container {
  width: 100%;
  max-width: 540px;
  margin: auto;
}

.login-card {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-xl);
  padding: 2.25rem 2rem;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5), 0 0 30px rgba(14, 165, 233, 0.15);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.login-brand {
  text-align: center;
  margin-bottom: 1.75rem;
}

.login-logo-wrap {
  width: 140px;
  height: 90px;
  margin: 0 auto 0.85rem;
  background: #ffffff;
  border-radius: 16px;
  padding: 8px 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25), 0 0 24px rgba(14, 165, 233, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.2);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  animation: pulseBrand 3.5s infinite ease-in-out;
}

.login-logo-wrap:hover {
  transform: scale(1.04);
}

.login-logo-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

@keyframes pulseBrand {

  0%,
  100% {
    transform: scale(1);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25), 0 0 24px rgba(14, 165, 233, 0.25);
  }

  50% {
    transform: scale(1.03);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.3), 0 0 32px rgba(14, 165, 233, 0.4);
  }
}

.login-title {
  font-size: 1.6rem;
  font-weight: 800;
  margin: 0;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, #ffffff 30%, var(--primary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

[data-theme="light"] .login-title {
  background: linear-gradient(135deg, #0f172a 30%, var(--primary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.login-subtitle {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin: 0.35rem 0 0 0;
}

.login-security-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-top: 0.75rem;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  background: rgba(14, 165, 233, 0.1);
  border: 1px solid rgba(14, 165, 233, 0.25);
  font-size: 0.72rem;
  color: var(--primary);
  font-weight: 600;
}

.login-alert {
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.35);
  color: #fca5a5;
  font-size: 0.85rem;
  font-weight: 500;
  margin-bottom: 1.25rem;
  text-align: center;
}

.login-form .form-group {
  margin-bottom: 1.15rem;
}

.input-with-icon {
  position: relative;
  display: flex;
  align-items: center;
}

.input-prefix-icon {
  position: absolute;
  left: 0.9rem;
  font-size: 1rem;
  color: var(--text-muted);
  pointer-events: none;
}

.input-with-icon .form-control {
  padding-left: 2.5rem;
}

.text-toggle-btn {
  background: transparent;
  border: none;
  color: var(--primary);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  padding: 2px 4px;
}

.text-toggle-btn:hover {
  text-decoration: underline;
}

.login-btn {
  width: 100%;
  padding: 0.85rem 1rem;
  font-size: 0.95rem;
  font-weight: 700;
  border-radius: var(--radius-md);
  margin-top: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  box-shadow: 0 4px 16px rgba(14, 165, 233, 0.35);
  transition: var(--transition-smooth);
}

.login-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 22px rgba(14, 165, 233, 0.5);
}

/* Fast Demo Access Drawer */
.login-demo-helper {
  margin-top: 1.75rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-subtle);
}

.demo-helper-title {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
  text-align: center;
}

.demo-creds-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem;
}

@media (max-width: 520px) {
  .demo-creds-grid {
    grid-template-columns: 1fr;
  }
}

.demo-cred-card {
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.75rem;
  cursor: pointer;
  transition: var(--transition-smooth);
  display: flex;
  flex-direction: column;
}

[data-theme="light"] .demo-cred-card {
  background: rgba(241, 245, 249, 0.7);
}

.demo-cred-card:hover {
  border-color: var(--primary);
  background: rgba(14, 165, 233, 0.08);
  transform: translateY(-2px);
}

.demo-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.25rem;
}

.demo-card-role {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
}

.demo-card-role.role-admin {
  background: rgba(99, 102, 241, 0.18);
  color: #818cf8;
}

.demo-card-role.role-recep {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
}

.demo-card-copy-hint {
  font-size: 0.65rem;
  color: var(--text-muted);
}

.demo-card-name {
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--text-primary);
  margin-top: 2px;
}

.demo-card-meta {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin: 0.35rem 0 0.5rem 0;
  word-break: break-all;
}

.demo-card-meta code {
  color: var(--primary);
  background: rgba(0, 0, 0, 0.25);
  padding: 1px 4px;
  border-radius: 3px;
}

.btn-fast-login {
  margin-top: auto;
  width: 100%;
  padding: 0.35rem 0.5rem;
  border-radius: 6px;
  background: rgba(14, 165, 233, 0.15);
  border: 1px solid rgba(14, 165, 233, 0.3);
  color: var(--primary);
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.btn-fast-login:hover {
  background: var(--primary);
  color: #ffffff;
}


/* ==========================================================================
   ADMIN CREDENTIALS & PASSWORD VAULT TABLE
   ========================================================================== */
.credentials-vault-section {
  margin-top: 2rem;
}

.vault-section-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.credentials-vault-card {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-md);
}

.table-responsive {
  width: 100%;
  overflow-x: auto;
}

.credentials-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.credentials-table th {
  background: rgba(0, 0, 0, 0.25);
  padding: 0.85rem 1.15rem;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-subtle);
}

[data-theme="light"] .credentials-table th {
  background: rgba(241, 245, 249, 0.9);
}

.credentials-table td {
  padding: 0.95rem 1.15rem;
  font-size: 0.85rem;
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: middle;
}

.credentials-table tr:last-child td {
  border-bottom: none;
}

.credentials-table tr:hover td {
  background: var(--bg-surface-hover);
}

/* Password reveal controls */
.cred-pass-wrap {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border-subtle);
  padding: 3px 8px;
  border-radius: 6px;
  font-family: monospace;
}

[data-theme="light"] .cred-pass-wrap {
  background: rgba(241, 245, 249, 0.8);
}

.cred-pass-text {
  font-family: 'SF Mono', Monaco, Consolas, monospace;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  color: var(--primary);
  min-width: 75px;
}

.cred-pass-text.masked {
  letter-spacing: 0.15em;
  color: var(--text-muted);
}

.btn-cred-toggle,
.btn-cred-copy {
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 0.85rem;
  padding: 2px 4px;
  border-radius: 4px;
  opacity: 0.7;
  transition: opacity 0.15s ease;
}

.btn-cred-toggle:hover,
.btn-cred-copy:hover {
  opacity: 1;
  background: rgba(255, 255, 255, 0.1);
}

.cred-user-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.cred-user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(14, 165, 233, 0.3) 0%, rgba(99, 102, 241, 0.3) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.78rem;
  color: var(--text-primary);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.cred-email-copy {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-family: monospace;
  font-size: 0.82rem;
  color: var(--text-secondary);
}

.cred-email-copy button {
  background: transparent;
  border: none;
  cursor: pointer;
  opacity: 0.6;
  font-size: 0.75rem;
}

.cred-email-copy button:hover {
  opacity: 1;
}

/* ==========================================================================
   SUPER ADMIN RECORDS DATA & CLINIC METRICS BREAKDOWN
   ========================================================================== */
.admin-privacy-banner {
  grid-column: 1 / -1;
  background: rgba(14, 165, 233, 0.08);
  border: 1px solid rgba(14, 165, 233, 0.25);
  border-radius: var(--radius-lg);
  padding: 0.85rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 0.5rem;
}

.privacy-banner-icon {
  font-size: 1.6rem;
  flex-shrink: 0;
}

.privacy-banner-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--accent-primary);
  margin-bottom: 0.15rem;
}

.privacy-banner-desc {
  font-size: 0.78rem;
  color: var(--text-secondary);
  line-height: 1.35;
}

.admin-record-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 1.15rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.admin-record-card:hover {
  border-color: var(--accent-primary);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(14, 165, 233, 0.15);
}

.admin-record-card.is-selected {
  border-color: var(--accent-primary);
  background: rgba(14, 165, 233, 0.04);
}

.admin-record-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
}

.admin-record-name {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
}

.admin-record-doctor {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
}

.admin-record-stats-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.65rem;
  background: rgba(255, 255, 255, 0.03);
  border-radius: var(--radius-md);
  padding: 0.75rem;
  border: 1px solid var(--border-subtle);
}

[data-theme="light"] .admin-record-stats-row {
  background: #f8fafc;
  border-color: #e2e8f0;
}

.admin-stat-item {
  display: flex;
  flex-direction: column;
}

.admin-stat-label {
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.03em;
}

.admin-stat-val {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.1;
  margin-top: 0.15rem;
}

.admin-record-progress-wrap {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.admin-record-progress-bar {
  height: 6px;
  background: var(--border-subtle);
  border-radius: 999px;
  overflow: hidden;
}

.admin-record-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #0ea5e9, #6366f1);
  border-radius: 999px;
}

/* ==========================================================================
   ROLE-BASED RESTRICTIONS: SUPER ADMIN VS RECEPTIONIST
   Super admin does not have individual patient listing, search, or empty states.
   ========================================================================== */
[data-role="admin"] #patients-toolbar-card,
[data-role="admin"] .patients-toolbar-card,
[data-role="admin"] #patients-empty-state,
[data-role="admin"] .patients-empty-state,
[data-role="admin"] #btn-directory-new-patient,
[data-role="admin"] .patients-search-box,
[data-role="admin"] #patients-gender-filters,
[data-role="admin"] .patients-sort-wrap,
[data-role="admin"] #patients-status-row,
[data-role="admin"] .patients-status-row,
[data-role="admin"] #patients-count-indicator {
  display: none !important;
}

[data-role="receptionist"] #patients-clinic-wrap {
  display: none !important;
}

/* ==========================================================================
   EMAIL TODAY'S EXCEL REPORT MODAL & ACTION BUTTON
   ========================================================================== */
.btn-email-excel {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  background: rgba(14, 165, 233, 0.12);
  color: var(--accent-primary);
  border: 1px solid rgba(14, 165, 233, 0.3);
  font-weight: 600;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-email-excel:hover {
  background: rgba(14, 165, 233, 0.22);
  color: #38bdf8;
  border-color: rgba(14, 165, 233, 0.55);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(14, 165, 233, 0.2);
}

.doctor-email-recipient-card {
  background: rgba(14, 165, 233, 0.05);
  border: 1px solid rgba(14, 165, 233, 0.25);
  border-radius: var(--radius-lg);
  padding: 1.15rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

[data-theme="light"] .doctor-email-recipient-card {
  background: rgba(14, 165, 233, 0.04);
  border-color: rgba(14, 165, 233, 0.25);
}

.recipient-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.recipient-tag {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--accent-primary);
}

.verified-email-badge {
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
  border: 1px solid rgba(16, 185, 129, 0.35);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  white-space: nowrap;
  line-height: 1.2;
}

[data-theme="light"] .verified-email-badge {
  background: #ecfdf5;
  color: #059669;
  border-color: #a7f3d0;
}

.recipient-doctor-details {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.recipient-doctor-details .doctor-name {
  font-size: 1.18rem;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.2;
}

.recipient-doctor-details .doctor-specialty {
  font-size: 0.84rem;
  color: var(--text-muted);
}

.recipient-email-box {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  padding: 0.65rem 0.95rem;
  border-radius: var(--radius-md);
  transition: all 0.2s ease;
}

[data-theme="light"] .recipient-email-box {
  background: #ffffff;
  border-color: #cbd5e1;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.recipient-email-box:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.18);
}

.recipient-email-box .email-icon {
  font-size: 1.35rem;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.email-input-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 0;
}

.email-field-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.email-field-label {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin: 0;
}

.doctor-email-field {
  background: transparent !important;
  border: none !important;
  color: var(--text-primary) !important;
  font-weight: 600;
  font-size: 0.94rem;
  padding: 0;
  width: 100%;
  box-shadow: none !important;
}

.doctor-email-field:focus {
  outline: none !important;
}

.email-excel-data-summary {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1rem;
}

.data-summary-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.75rem;
}

.data-summary-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.5rem;
  margin-bottom: 0.85rem;
}

@media (max-width: 540px) {
  .data-summary-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 380px) {
  .data-summary-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.summary-metric-item {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.55rem 0.6rem;
  text-align: center;
}

.summary-metric-item .metric-num {
  display: block;
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.1;
}

.summary-metric-item .metric-lbl {
  display: block;
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-top: 0.2rem;
  text-transform: uppercase;
}

.attachment-preview-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: rgba(16, 185, 129, 0.06);
  border: 1px dashed rgba(16, 185, 129, 0.35);
  border-radius: var(--radius-md);
  padding: 0.6rem 0.85rem;
}

.attachment-preview-row .file-icon {
  font-size: 1.6rem;
}

.attachment-preview-row .file-name {
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--text-primary);
}

.attachment-preview-row .file-meta {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.email-confirmation-callout {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  background: rgba(14, 165, 233, 0.08);
  border: 1px solid rgba(14, 165, 233, 0.2);
  border-radius: var(--radius-md);
  padding: 0.75rem 0.95rem;
  font-size: 0.82rem;
  color: var(--text-primary);
  line-height: 1.45;
}

.email-confirmation-callout .callout-icon {
  font-size: 1.1rem;
  margin-top: -1px;
}

.email-success-result-card {
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.3);
  border-radius: var(--radius-lg);
  padding: 1.1rem;
  text-align: center;
  animation: fadeInModal 0.3s ease-out;
}

.email-success-result-card .success-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}

.email-success-result-card .success-check-icon {
  width: 26px;
  height: 26px;
  border-radius: 999px;
  background: #10b981;
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 0.9rem;
}

.email-success-result-card .success-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: #10b981;
}

.email-success-result-card .success-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 0.85rem;
}

.email-success-result-card .success-actions {
  display: flex;
  justify-content: center;
  gap: 0.75rem;
}

/* ==========================================================================
   MOBILE-FIRST MODAL ENHANCEMENTS & CLINIC REGISTRATION BOTTOM SHEET
   ========================================================================== */

/* Mobile Sheet Drag Handle Indicator */
.mobile-sheet-drag-handle {
  display: none;
  width: 44px;
  height: 5px;
  background: rgba(148, 163, 184, 0.4);
  border-radius: 99px;
  margin: 10px auto 4px;
  flex-shrink: 0;
}

[data-theme="light"] .mobile-sheet-drag-handle {
  background: rgba(100, 116, 139, 0.35);
}

/* Modal Card Enhanced */
.modal-card-enhanced {
  display: flex !important;
  flex-direction: column !important;
  border-radius: var(--radius-xl);
  max-height: 90vh;
  overflow: hidden;
  box-shadow: 0 24px 60px -12px rgba(0, 0, 0, 0.5);
  background: #111827 !important;
}

[data-theme="light"] .modal-card-enhanced {
  background: #ffffff !important;
  box-shadow: 0 24px 60px -12px rgba(15, 23, 42, 0.18);
  border-color: #cbd5e1;
}

/* Header Branding */
.modal-header-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.modal-header-icon-box {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: rgba(14, 165, 233, 0.15);
  color: #0284c7;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(14, 165, 233, 0.15);
}

[data-theme="light"] .modal-header-icon-box {
  background: rgba(14, 165, 233, 0.12);
  color: #0284c7;
}

.modal-subtitle {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 2px;
  line-height: 1.3;
}

/* Content Area */
.modal-content-enhanced {
  padding: 1.25rem 1.6rem 2rem !important;
  overflow-y: auto !important;
  -webkit-overflow-scrolling: touch !important;
  overscroll-behavior: contain;
}

/* Grouped Form Section Cards */
.form-section-card {
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid var(--border-light);
  border-radius: 14px;
  padding: 1.15rem;
  margin-bottom: 1rem;
  transition: border-color 0.15s ease;
}

[data-theme="light"] .form-section-card {
  background: #f8fafc;
  border-color: #e2e8f0;
}

.form-section-card.receptionist-section-card {
  border-color: rgba(14, 165, 233, 0.25);
  background: rgba(14, 165, 233, 0.025);
}

[data-theme="light"] .form-section-card.receptionist-section-card {
  border-color: #cbd5e1;
  background: #f1f5f9;
}

.form-section-header {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  margin-bottom: 0.95rem;
  padding-bottom: 0.65rem;
  border-bottom: 1px solid var(--border-subtle);
}

.section-icon {
  font-size: 1.25rem;
  line-height: 1;
}

.section-header-text {
  display: flex;
  flex-direction: column;
}

.section-title {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.25;
}

.section-desc {
  font-size: 0.74rem;
  color: var(--text-muted);
  margin-top: 2px;
  line-height: 1.3;
}

/* Inputs with Icons */
.input-with-icon,
.password-input-wrapper {
  position: relative;
  width: 100%;
}

.input-with-icon .field-icon,
.password-input-wrapper .field-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1rem;
  line-height: 1;
  pointer-events: none;
  opacity: 0.75;
  user-select: none;
}

.input-with-icon .form-control,
.password-input-wrapper .form-control {
  padding-left: 2.45rem !important;
  min-height: 46px;
  border-radius: 10px;
  font-size: 0.92rem;
}

.password-input-wrapper .form-control.has-toggle-btn {
  padding-right: 2.85rem !important;
}

/* Password Toggle Button */
.btn-input-password-toggle {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1.15rem;
  padding: 6px 10px;
  line-height: 1;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.btn-input-password-toggle:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.08);
}

[data-theme="light"] .btn-input-password-toggle:hover {
  background: rgba(0, 0, 0, 0.06);
}

/* Field Label Split & Auto-Generate Button */
.field-label-split {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.35rem;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.btn-quick-generate-pass {
  background: rgba(14, 165, 233, 0.12);
  color: var(--primary);
  border: 1px solid rgba(14, 165, 233, 0.28);
  border-radius: 6px;
  font-size: 0.74rem;
  font-weight: 700;
  padding: 3px 8px;
  cursor: pointer;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.btn-quick-generate-pass:hover {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
}

.field-hint-text {
  font-size: 0.73rem;
  color: var(--text-muted);
  margin-top: 5px;
  line-height: 1.35;
}

.required-star {
  color: #ef4444;
  font-weight: 800;
}

.btn-create-clinic-submit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  font-weight: 700;
}

/* ==========================================================================
   MOBILE VIEWPORT ADAPTATIONS (<= 768px and <= 520px)
   ========================================================================== */
@media (max-width: 768px) {
  .mobile-sheet-drag-handle {
    display: block;
  }

  .modal-card-enhanced {
    max-height: 94vh !important;
    max-height: 94dvh !important;
    border-radius: 22px 22px 0 0 !important;
    border-bottom: none !important;
  }

  .modal-content-enhanced {
    padding: 1rem 1.15rem 2.25rem !important;
  }

  .form-section-card {
    padding: 1rem 0.95rem !important;
    border-radius: 12px !important;
  }

  .modal-header-icon-box {
    width: 36px;
    height: 36px;
    font-size: 1.2rem;
  }

  .modal-title {
    font-size: 1.1rem !important;
  }

  .modal-footer-enhanced {
    flex-direction: column-reverse !important;
    padding: 0.85rem 1.15rem max(1rem, env(safe-area-inset-bottom)) !important;
    gap: 0.65rem !important;
    background: #111827 !important;
    border-top: 1px solid var(--border-subtle) !important;
    z-index: 20 !important;
  }

  [data-theme="light"] .modal-footer-enhanced {
    background: #ffffff !important;
    border-color: #e2e8f0 !important;
  }

  .modal-footer-enhanced .btn {
    width: 100% !important;
    min-height: 48px !important;
    font-size: 0.95rem !important;
    font-weight: 700 !important;
    border-radius: 12px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
  }
}

@media (max-width: 480px) {
  .modal-content-enhanced {
    padding: 0.85rem 0.95rem 2.5rem !important;
  }

  .section-title {
    font-size: 0.84rem !important;
  }

  .form-label {
    font-size: 0.78rem !important;
  }
}

/* ==========================================================================
   SUBSCRIPTION SYSTEM & PRICING PLANS (TRIAL vs ₹2,999 PACK)
   ========================================================================== */

/* Header Subscription Pill Button */
.subscription-pill-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.85rem;
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  border: 1px solid transparent;
  outline: none;
  background: transparent;
  white-space: nowrap;
}

.subscription-pill-btn:hover {
  transform: translateY(-1px);
}

.subscription-pill-btn.tier-trial {
  background: rgba(245, 158, 11, 0.12);
  border-color: rgba(245, 158, 11, 0.35);
  color: #f59e0b;
}

.subscription-pill-btn.tier-trial:hover {
  background: rgba(245, 158, 11, 0.2);
  box-shadow: 0 0 15px rgba(245, 158, 11, 0.25);
}

.subscription-pill-btn.tier-pro {
  background: linear-gradient(135deg, rgba(14, 165, 233, 0.15), rgba(99, 102, 241, 0.15));
  border-color: rgba(14, 165, 233, 0.45);
  color: #38bdf8;
}

.subscription-pill-btn.tier-pro:hover {
  background: linear-gradient(135deg, rgba(14, 165, 233, 0.25), rgba(99, 102, 241, 0.25));
  box-shadow: 0 0 18px rgba(14, 165, 233, 0.3);
}

.sub-pill-tag {
  font-size: 0.68rem;
  padding: 2px 7px;
  border-radius: 9999px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.subscription-pill-btn.tier-trial .sub-pill-tag {
  background: #f59e0b;
  color: #1e1b4b;
}

.subscription-pill-btn.tier-pro .sub-pill-tag {
  background: #0284c7;
  color: #ffffff;
}

[data-theme="light"] .subscription-pill-btn.tier-pro {
  background: #f0f9ff;
  border-color: #bae6fd;
  color: #0284c7;
}

[data-theme="light"] .subscription-pill-btn.tier-trial {
  background: #fffbeb;
  border-color: #fde68a;
  color: #d97706;
}

/* Receptionist role strictly hides the subscription button across all media queries */
[data-role="receptionist"] #header-subscription-btn,
body[data-role="receptionist"] #header-subscription-btn {
  display: none !important;
}

/* Subscription Modal Layout */
.subscription-modal-card {
  max-width: 840px !important;
  width: 95% !important;
  border: 1px solid rgba(255, 255, 255, 0.15) !important;
  background: var(--bg-card) !important;
  border-radius: 20px !important;
  overflow: hidden;
}

.subscription-modal-title-box {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.sub-modal-icon-badge {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(14, 165, 233, 0.2), rgba(99, 102, 241, 0.2));
  border: 1px solid rgba(14, 165, 233, 0.4);
  color: #38bdf8;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
}

.sub-upgrade-alert {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.75rem 1rem;
  border-radius: 12px;
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.3);
  color: #f59e0b;
  font-size: 0.88rem;
  font-weight: 600;
  margin-bottom: 1.25rem;
  animation: fadeIn 0.2s ease-out;
}

.sub-alert-icon {
  font-size: 1.2rem;
}

/* Pricing Grid */
.pricing-comparison-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  margin: 0.5rem 0 0.5rem 0;
}

@media (max-width: 700px) {
  .pricing-comparison-grid {
    grid-template-columns: 1fr;
  }
}

.pricing-card {
  position: relative;
  background: rgba(30, 41, 59, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  transition: all 0.25s ease;
}

[data-theme="light"] .pricing-card {
  background: #ffffff;
  border-color: #e2e8f0;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.05);
}

.pricing-card.current-active-plan {
  border-color: rgba(14, 165, 233, 0.4);
}

.pricing-card.pro-card {
  background: linear-gradient(180deg, rgba(14, 165, 233, 0.08) 0%, rgba(15, 23, 42, 0.65) 100%);
  border: 2px solid #0284c7;
  box-shadow: 0 0 30px rgba(14, 165, 233, 0.18);
}

[data-theme="light"] .pricing-card.pro-card {
  background: linear-gradient(180deg, #f0f9ff 0%, #ffffff 100%);
  border-color: #0284c7;
  box-shadow: 0 8px 24px rgba(2, 132, 199, 0.12);
}

.pricing-card-badge {
  position: absolute;
  top: -11px;
  right: 16px;
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  padding: 3px 10px;
  border-radius: 9999px;
  text-transform: uppercase;
}

.trial-badge {
  background: #475569;
  color: #f1f5f9;
}

.pro-badge {
  background: linear-gradient(135deg, #0284c7 0%, #2563eb 100%);
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(2, 132, 199, 0.4);
}

.pricing-tier-name {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 0.4rem;
}

.pricing-price-wrap {
  display: flex;
  align-items: baseline;
  gap: 3px;
  margin-bottom: 0.5rem;
}

.pricing-currency {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-muted);
}

.pricing-amount {
  font-size: 2.3rem;
  font-weight: 900;
  color: var(--text-primary);
  line-height: 1;
}

.pricing-period {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-left: 3px;
}

.pricing-tier-desc {
  font-size: 0.84rem;
  color: var(--text-secondary);
  line-height: 1.45;
  margin-bottom: 1.15rem;
}

.pricing-features-list {
  list-style: none;
  padding: 0;
  margin: 0 0 1.5rem 0;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  flex: 1;
}

.pricing-features-list li {
  font-size: 0.84rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  line-height: 1.35;
}

.feature-included {
  color: var(--text-primary);
}

.feature-highlight {
  font-weight: 700;
  color: #38bdf8;
}

[data-theme="light"] .feature-highlight {
  color: #0284c7;
}

.feature-locked {
  color: var(--text-muted);
  text-decoration: line-through;
  opacity: 0.7;
}

.lock-tag {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 4px;
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
  text-decoration: none !important;
  display: inline-block;
}

.pricing-card-action {
  margin-top: auto;
}

.btn-upgrade-pro {
  background: linear-gradient(135deg, #0284c7 0%, #2563eb 100%) !important;
  border: none !important;
  color: #ffffff !important;
  font-weight: 700 !important;
  box-shadow: 0 4px 14px rgba(2, 132, 199, 0.35) !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 0.5rem !important;
  padding: 0.75rem 1rem !important;
  transition: all 0.2s ease !important;
}

.btn-upgrade-pro:hover:not(:disabled) {
  transform: translateY(-1px) scale(1.02);
  box-shadow: 0 6px 20px rgba(2, 132, 199, 0.5) !important;
}

.btn-outline-warning {
  border: 1px solid rgba(245, 158, 11, 0.4) !important;
  color: #f59e0b !important;
  background: transparent !important;
}

.btn-outline-warning:hover {
  background: rgba(245, 158, 11, 0.1) !important;
}

/* Time Pills Locked state for Analytics */
.time-pill-btn.locked-pill {
  position: relative;
  opacity: 0.75;
}

.time-pill-btn.locked-pill::after {
  content: " 🔒";
  font-size: 0.75rem;
}

/* ==========================================================================
   BEAUTIFUL FEATURE LOCKED PRO ALERT BOX (PURCHASE 2,999 PLAN)
   ========================================================================== */

.feature-alert-overlay {
  z-index: 1050 !important;
  backdrop-filter: blur(12px) !important;
  -webkit-backdrop-filter: blur(12px) !important;
}

.feature-alert-card {
  max-width: 520px !important;
  width: 92% !important;
  padding: 0 !important;
  border-radius: 24px !important;
  background: linear-gradient(160deg, rgba(15, 23, 42, 0.95) 0%, rgba(30, 41, 59, 0.92) 100%) !important;
  border: 1.5px solid rgba(14, 165, 233, 0.45) !important;
  box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.7), 0 0 45px rgba(14, 165, 233, 0.25) !important;
  position: relative !important;
  overflow: hidden !important;
  animation: alertCardPop 0.28s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

[data-theme="light"] .feature-alert-card {
  background: linear-gradient(160deg, #ffffff 0%, #f0fdf4 100%) !important;
  border-color: #0284c7 !important;
  box-shadow: 0 25px 60px -15px rgba(15, 23, 42, 0.2), 0 0 35px rgba(2, 132, 199, 0.2) !important;
}

@keyframes alertCardPop {
  0% {
    opacity: 0;
    transform: scale(0.92) translateY(12px);
  }

  100% {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.feature-alert-close {
  position: absolute !important;
  top: 16px !important;
  right: 18px !important;
  z-index: 10 !important;
  font-size: 1.5rem !important;
  background: rgba(255, 255, 255, 0.08) !important;
  border-radius: 50% !important;
  width: 32px !important;
  height: 32px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  color: var(--text-muted) !important;
  border: none !important;
  cursor: pointer !important;
  transition: all 0.2s ease !important;
}

.feature-alert-close:hover {
  background: rgba(239, 68, 68, 0.2) !important;
  color: #ef4444 !important;
}

.feature-alert-body {
  padding: 2.2rem 2rem 2rem !important;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

/* Glowing Pulsing Icon Ring */
.feature-alert-icon-wrap {
  position: relative;
  width: 68px;
  height: 68px;
  margin-bottom: 1.1rem;
}

.feature-alert-icon-ring {
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(14, 165, 233, 0.6), rgba(99, 102, 241, 0.6));
  filter: blur(10px);
  opacity: 0.75;
  animation: faPulseGlow 2.5s infinite alternate;
}

@keyframes faPulseGlow {
  0% {
    transform: scale(0.95);
    opacity: 0.55;
  }

  100% {
    transform: scale(1.15);
    opacity: 0.95;
  }
}

.feature-alert-icon-inner {
  position: relative;
  width: 68px;
  height: 68px;
  border-radius: 50%;
  background: linear-gradient(135deg, #0284c7 0%, #2563eb 50%, #4f46e5 100%);
  border: 2px solid rgba(255, 255, 255, 0.25);
  box-shadow: 0 8px 24px rgba(2, 132, 199, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  color: #ffffff;
}

/* Badge Header */
.feature-alert-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.32rem 0.85rem;
  border-radius: 9999px;
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid rgba(245, 158, 11, 0.4);
  color: #f59e0b;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 0.75rem;
}

.feature-alert-title {
  font-size: 1.45rem !important;
  font-weight: 900 !important;
  color: var(--text-primary) !important;
  margin-bottom: 0.5rem !important;
  line-height: 1.25 !important;
}

.feature-alert-desc {
  font-size: 0.9rem !important;
  color: var(--text-secondary) !important;
  line-height: 1.5 !important;
  margin-bottom: 1.25rem !important;
  max-width: 440px !important;
}

.feature-alert-desc strong {
  color: var(--text-primary);
}

/* Feature Spotlight Box */
.feature-spotlight-box {
  width: 100%;
  background: rgba(14, 165, 233, 0.08);
  border: 1px solid rgba(14, 165, 233, 0.25);
  border-left: 4px solid #0284c7;
  border-radius: 14px;
  padding: 0.95rem 1.15rem;
  text-align: left;
  margin-bottom: 1.15rem;
}

[data-theme="light"] .feature-spotlight-box {
  background: #f0f9ff;
  border-color: #bae6fd;
  border-left-color: #0284c7;
}

.spotlight-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.35rem;
}

.spotlight-tag {
  font-size: 0.68rem;
  font-weight: 800;
  color: #0284c7;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.spotlight-badge {
  font-size: 0.65rem;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 6px;
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
}

.spotlight-name {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 0.2rem;
}

.spotlight-detail {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.4;
}

/* Perks List */
.feature-perks-list {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem 0.75rem;
  margin-bottom: 1.25rem;
  text-align: left;
}

@media (max-width: 480px) {
  .feature-perks-list {
    grid-template-columns: 1fr;
  }
}

.perk-item {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.8rem;
  color: var(--text-secondary);
  font-weight: 600;
}

.perk-check {
  color: #10b981;
  font-weight: 900;
  font-size: 0.9rem;
}

/* Price Banner */
.feature-price-banner {
  width: 100%;
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.75), rgba(15, 23, 42, 0.85));
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 14px;
  padding: 0.75rem 1.15rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.35rem;
}

[data-theme="light"] .feature-price-banner {
  background: #f8fafc;
  border-color: #e2e8f0;
}

.price-banner-lbl {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  display: block;
}

.price-banner-val {
  display: flex;
  align-items: baseline;
  gap: 2px;
}

.price-banner-val .currency {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-muted);
}

.price-banner-val .amount {
  font-size: 1.7rem;
  font-weight: 900;
  color: var(--text-primary);
  line-height: 1;
}

.price-banner-val .unit {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-left: 2px;
}

.instant-chip {
  font-size: 0.72rem;
  font-weight: 800;
  padding: 4px 9px;
  border-radius: 9999px;
  background: rgba(16, 185, 129, 0.18);
  border: 1px solid rgba(16, 185, 129, 0.4);
  color: #10b981;
}

/* Actions */
.feature-alert-actions {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  align-items: center;
}

.btn-purchase-2999,
.btn-purchase-249 {
  width: 100% !important;
  min-height: 48px !important;
  font-size: 0.98rem !important;
  font-weight: 800 !important;
  border-radius: 14px !important;
  background: linear-gradient(135deg, #0284c7 0%, #2563eb 50%, #4f46e5 100%) !important;
  border: none !important;
  color: #ffffff !important;
  box-shadow: 0 6px 20px rgba(2, 132, 199, 0.45) !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 0.55rem !important;
  cursor: pointer !important;
  transition: all 0.22s ease !important;
}

.btn-purchase-2999:hover:not(:disabled),
.btn-purchase-249:hover:not(:disabled) {
  transform: translateY(-2px) scale(1.015);
  box-shadow: 0 10px 28px rgba(2, 132, 199, 0.6) !important;
}

.btn-purchase-2999:active,
.btn-purchase-249:active {
  transform: scale(0.99);
}

.feature-alert-subactions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.82rem;
}

.btn-link-view-plans,
.btn-link-dismiss {
  background: transparent;
  border: none;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  padding: 2px 6px;
  transition: color 0.15s ease;
}

.btn-link-view-plans {
  color: var(--primary);
  text-decoration: underline;
}

.btn-link-view-plans:hover {
  color: #38bdf8;
}

.btn-link-dismiss {
  color: var(--text-muted);
}

.btn-link-dismiss:hover {
  color: var(--text-primary);
}

.subaction-sep {
  color: var(--text-muted);
  opacity: 0.6;
}

/* ==========================================================================
   LIGHTWEIGHT LOADERS & SPINNERS DESIGN SYSTEM
   ========================================================================== */

/* 1. Global Slim Top Progress Bar (Hardware-Accelerated GPU scaleX) */
#global-top-progress-bar {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 2.5px;
  background: linear-gradient(90deg, #0ea5e9, #38bdf8, #818cf8);
  box-shadow: 0 1px 6px rgba(14, 165, 233, 0.4);
  z-index: 999999;
  pointer-events: none;
  opacity: 0;
  transform-origin: left center;
  transform: scaleX(0);
  transition: transform 0.35s cubic-bezier(0.1, 0.9, 0.2, 1), opacity 0.2s ease;
  will-change: transform, opacity;
}

#global-top-progress-bar.is-active {
  opacity: 1;
  transform: scaleX(0.72);
}

#global-top-progress-bar.is-finished {
  opacity: 1;
  transform: scaleX(1);
  transition: transform 0.15s ease, opacity 0.2s ease 0.1s;
}

/* 2. Lightweight CSS Spinner Rings */
.loader-spinner-ring {
  width: 26px;
  height: 26px;
  border: 2.5px solid rgba(14, 165, 233, 0.18);
  border-top-color: #0ea5e9;
  border-radius: 50%;
  animation: appSpinnerRotate 0.65s linear infinite;
  display: inline-block;
  box-sizing: border-box;
  flex-shrink: 0;
  will-change: transform;
}

.loader-spinner-ring-sm {
  width: 15px;
  height: 15px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: appSpinnerRotate 0.6s linear infinite;
  display: inline-block;
  box-sizing: border-box;
  vertical-align: middle;
  flex-shrink: 0;
  margin-right: 6px;
  will-change: transform;
}

.btn-secondary .loader-spinner-ring-sm {
  border-color: rgba(14, 165, 233, 0.25);
  border-top-color: #0ea5e9;
}

.loader-spinner-ring-lg {
  width: 38px;
  height: 38px;
  border-width: 3px;
}

@keyframes appSpinnerRotate {
  0% {
    transform: rotate(0deg);
  }

  100% {
    transform: rotate(360deg);
  }
}

/* 3. Reusable Lightweight Section Loader Card */
.app-section-loader {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 42px 20px;
  color: var(--text-muted, #64748b);
  font-size: 0.88rem;
  font-weight: 500;
  letter-spacing: -0.01em;
  animation: appLoaderFadeIn 0.2s ease;
}

.app-section-loader span {
  color: var(--text-secondary, #475569);
  font-size: 0.88rem;
}

@keyframes appLoaderFadeIn {
  from {
    opacity: 0;
    transform: translateY(4px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* 4. Semi-Transparent Glass Overlay Loader for Charts/Containers */
.app-glass-loading-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.76);
  backdrop-filter: blur(2.5px);
  -webkit-backdrop-filter: blur(2.5px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  z-index: 45;
  border-radius: inherit;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease;
}

[data-theme="dark"] .app-glass-loading-overlay {
  background: rgba(15, 23, 42, 0.8);
}

.app-glass-loading-overlay.is-loading {
  opacity: 1;
  pointer-events: auto;
}

.app-glass-loading-overlay span {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary, #475569);
}

/* 5. Button In-Flight Loading State */
.btn.is-btn-loading {
  position: relative;
  pointer-events: none;
  opacity: 0.88;
  cursor: wait !important;
}

/* 6. Pulse Shimmer for Skeleton States */
.skeleton-shimmer {
  background: linear-gradient(90deg, rgba(226, 232, 240, 0.6) 25%, rgba(241, 245, 249, 0.9) 50%, rgba(226, 232, 240, 0.6) 75%);
  background-size: 200% 100%;
  animation: skeletonShimmerAnim 1.4s infinite ease-in-out;
  border-radius: 6px;
}

[data-theme="dark"] .skeleton-shimmer {
  background: linear-gradient(90deg, rgba(30, 41, 59, 0.6) 25%, rgba(51, 65, 85, 0.9) 50%, rgba(30, 41, 59, 0.6) 75%);
  background-size: 200% 100%;
}

@keyframes skeletonShimmerAnim {
  0% {
    background-position: 200% 0;
  }

  100% {
    background-position: -200% 0;
  }
}

/* ==========================================================================
   MOBILE & ANDROID HIGH-PERFORMANCE FLICKER-FREE STYLES
   ========================================================================== */

/* 1. Prevent login screen flash when user has active session */
html.has-auth-session #login-screen {
  display: none !important;
}

html.has-auth-session #app {
  display: block !important;
}

/* 2. Global Android Gesture & Scroll Stabilization */
html,
body {
  -webkit-tap-highlight-color: transparent !important;
  overscroll-behavior-y: contain;
}

/* 3. Disable heavy backdrop-filter blurs on mobile/touch screens to stop GPU tile tearing & lag */
@media (max-width: 1024px),
(pointer: coarse) {

  .top-header,
  .nav-tabs-bar,
  .kpi-card,
  .queue-container,
  .chart-card,
  .clinic-card,
  .patient-card,
  .patient-detail-card,
  .app-glass-loading-overlay,
  .modal-overlay,
  .modal-dialog,
  .custom-status-dropdown-menu,
  .custom-billing-dropdown-menu {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
  }

  /* Solid, opaque, non-stuttering surfaces for mobile */
  .top-header {
    background: #0f172a !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
  }

  [data-theme="light"] .top-header {
    background: #ffffff !important;
    border-bottom: 1px solid #e2e8f0 !important;
  }

  .nav-tabs-bar {
    background: #0f172a !important;
    border-top: 1px solid rgba(255, 255, 255, 0.08) !important;
  }

  [data-theme="light"] .nav-tabs-bar {
    background: #ffffff !important;
    border-top: 1px solid #e2e8f0 !important;
  }

  .kpi-card {
    background: #1e293b !important;
    border-color: rgba(255, 255, 255, 0.08) !important;
  }

  [data-theme="light"] .kpi-card {
    background: #ffffff !important;
    border-color: #e2e8f0 !important;
  }

  .queue-container {
    background: transparent !important;
    box-shadow: none !important;
    border: none !important;
  }

  .queue-row {
    background: #1e293b !important;
    border-color: rgba(255, 255, 255, 0.08) !important;
    overflow: visible !important;
    contain: none !important;
    content-visibility: visible !important;
  }

  [data-theme="light"] .queue-row {
    background: #ffffff !important;
    border-color: #e2e8f0 !important;
  }

  .patient-card {
    background: #1e293b !important;
    contain: layout style paint;
    content-visibility: auto;
    contain-intrinsic-size: 110px;
    border-color: rgba(255, 255, 255, 0.08) !important;
  }

  [data-theme="light"] .patient-card {
    background: #ffffff !important;
    border-color: #e2e8f0 !important;
  }

  .chart-card,
  .clinic-card {
    background: #1e293b !important;
    border-color: rgba(255, 255, 255, 0.08) !important;
  }

  [data-theme="light"] .chart-card,
  [data-theme="light"] .clinic-card {
    background: #ffffff !important;
    border-color: #e2e8f0 !important;
  }

  .app-glass-loading-overlay {
    background: rgba(15, 23, 42, 0.88) !important;
  }

  [data-theme="light"] .app-glass-loading-overlay {
    background: rgba(255, 255, 255, 0.92) !important;
  }

  /* Simplify infinite pulsing animations on mobile to reduce continuous layer repainting */
  .pulse-indicator {
    animation: none !important;
    transform: none !important;
    box-shadow: 0 0 6px #10b981 !important;
  }

  .refresh-indicator-dot {
    animation: none !important;
    transform: none !important;
    box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.25) !important;
  }
}

/* ===================================================================
   DOCTOR ROSTER & MULTI-DOCTOR MANAGEMENT STYLES
   =================================================================== */
.doctor-roster-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.85rem;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.85rem 1rem;
  transition: all 0.2s ease;
}

[data-theme="light"] .doctor-roster-card {
  background: #ffffff;
  border-color: #e2e8f0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.doctor-roster-card.is-primary {
  border-color: rgba(59, 130, 246, 0.45);
  background: rgba(59, 130, 246, 0.04);
}

[data-theme="light"] .doctor-roster-card.is-primary {
  background: #f0f7ff;
  border-color: #93c5fd;
}

.doctor-roster-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

.doctor-roster-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.doctor-roster-name {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text-primary);
}

.doctor-badge-primary {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 0.68rem;
  font-weight: 700;
  background: #3b82f6;
  color: #ffffff;
  padding: 2px 7px;
  border-radius: 9999px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.doctor-roster-sub {
  font-size: 0.8rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.doctor-roster-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.doctor-badge-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.72rem;
  font-weight: 600;
  color: #2563eb;
  background: rgba(37, 99, 235, 0.1);
  padding: 2px 7px;
  border-radius: 9999px;
  margin-top: 3px;
  width: fit-content;
}

[data-theme="light"] .doctor-badge-chip {
  color: #1d4ed8;
  background: #eff6ff;
  border: 1px solid #dbeafe;
}

/* ===================================================================
   PREMIUM CUSTOM CONSULTING DOCTOR SELECTOR DROPDOWN (BOOK APPT MODAL)
   =================================================================== */

.custom-doctor-dropdown-section {
  position: relative;
}

.custom-doctor-dropdown {
  position: relative;
  width: 100%;
}

.custom-doctor-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 0.65rem 0.95rem;
  background: var(--bg-surface-elevated);
  border: 1.5px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  cursor: pointer;
  outline: none;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  user-select: none;
}

[data-theme="light"] .custom-doctor-trigger {
  background: #ffffff;
  border-color: #cbd5e1;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.custom-doctor-trigger:hover,
.custom-doctor-trigger:focus-visible,
.custom-doctor-dropdown.is-open .custom-doctor-trigger {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.18), 0 2px 8px rgba(14, 165, 233, 0.12);
}

.custom-doctor-trigger-left {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  min-width: 0;
  flex: 1;
}

.custom-doctor-avatar-circle {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(14, 165, 233, 0.25), rgba(99, 102, 241, 0.3));
  border: 1.5px solid rgba(14, 165, 233, 0.4);
  color: #38bdf8;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.86rem;
  letter-spacing: 0.02em;
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

[data-theme="light"] .custom-doctor-avatar-circle {
  background: linear-gradient(135deg, #e0f2fe, #ede9fe);
  border-color: #93c5fd;
  color: #0284c7;
}

.custom-doctor-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}

.custom-doctor-name-line {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.custom-doctor-name {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.custom-doctor-sub-line {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.custom-doctor-sub-spec {
  font-weight: 600;
  color: var(--primary);
}

[data-theme="light"] .custom-doctor-sub-spec {
  color: #0284c7;
}

.custom-doctor-dot {
  color: var(--text-muted);
  opacity: 0.6;
}

.custom-doctor-sub-fee {
  font-weight: 600;
  color: var(--text-secondary);
}

.custom-doctor-chevron-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  transition: transform 0.24s cubic-bezier(0.16, 1, 0.3, 1), color 0.2s ease;
  margin-left: 0.5rem;
  flex-shrink: 0;
}

.custom-doctor-dropdown.is-open .custom-doctor-chevron-icon {
  transform: rotate(180deg);
  color: var(--primary);
}

/* Floating Dropdown Menu Panel */
.custom-doctor-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 9999;
  background: var(--bg-surface-elevated);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1.5px solid rgba(14, 165, 233, 0.35);
  border-radius: var(--radius-md);
  padding: 6px;
  max-height: 280px;
  overflow-y: auto;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5), 0 4px 12px rgba(0, 0, 0, 0.25);
  display: none;
  flex-direction: column;
  gap: 4px;
  animation: dropdownFadeSlideIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

[data-theme="light"] .custom-doctor-menu {
  background: #ffffff;
  border-color: #93c5fd;
  box-shadow: 0 14px 34px rgba(15, 23, 42, 0.12), 0 3px 8px rgba(15, 23, 42, 0.06);
}

.custom-doctor-dropdown.is-open .custom-doctor-menu {
  display: flex;
}

@keyframes dropdownFadeSlideIn {
  from {
    opacity: 0;
    transform: translateY(-6px) scale(0.98);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Individual Doctor Option Card */
.custom-doctor-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-sm);
  background: transparent;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.18s ease;
  user-select: none;
}

.custom-doctor-option:hover {
  background: rgba(14, 165, 233, 0.1);
  border-color: rgba(14, 165, 233, 0.25);
}

[data-theme="light"] .custom-doctor-option:hover {
  background: #f0f7ff;
  border-color: #bfdbfe;
}

.custom-doctor-option.is-selected {
  background: rgba(14, 165, 233, 0.16);
  border-color: rgba(14, 165, 233, 0.45);
}

[data-theme="light"] .custom-doctor-option.is-selected {
  background: #e0f2fe;
  border-color: #7dd3fc;
}

.custom-doctor-opt-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
  flex: 1;
}

.custom-doctor-opt-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(14, 165, 233, 0.15);
  border: 1px solid rgba(14, 165, 233, 0.3);
  color: #38bdf8;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.78rem;
  flex-shrink: 0;
}

[data-theme="light"] .custom-doctor-opt-avatar {
  background: #f1f5f9;
  border-color: #cbd5e1;
  color: #0369a1;
}

.custom-doctor-option.is-selected .custom-doctor-opt-avatar {
  background: #0ea5e9;
  color: #ffffff;
  border-color: #0ea5e9;
}

.custom-doctor-opt-details {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}

.custom-doctor-opt-name-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.custom-doctor-opt-name {
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.custom-doctor-opt-sub {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.custom-doctor-opt-spec {
  color: var(--primary);
  font-weight: 600;
}

[data-theme="light"] .custom-doctor-opt-spec {
  color: #0284c7;
}

.custom-doctor-opt-email {
  color: var(--text-muted);
}

.custom-doctor-opt-right {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-shrink: 0;
}

.custom-doctor-opt-fee-pill {
  font-size: 0.75rem;
  font-weight: 700;
  color: #10b981;
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.3);
  padding: 2px 7px;
  border-radius: 9999px;
  font-variant-numeric: tabular-nums;
}

[data-theme="light"] .custom-doctor-opt-fee-pill {
  color: #047857;
  background: #ecfdf5;
  border-color: #a7f3d0;
}

.custom-doctor-opt-check {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 1.5px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  color: transparent;
  transition: all 0.15s ease;
}

[data-theme="light"] .custom-doctor-opt-check {
  border-color: #cbd5e1;
}

.custom-doctor-option.is-selected .custom-doctor-opt-check {
  background: #0ea5e9;
  border-color: #0ea5e9;
  color: #ffffff;
  box-shadow: 0 0 8px rgba(14, 165, 233, 0.4);
}

/* ==========================================================================
   Queue Doctor Filter Dropdown Component
   ========================================================================== */
.queue-doc-filter-dropdown {
  position: relative;
  display: inline-flex;
  align-items: center;
  user-select: none;
}

.queue-doc-filter-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  height: 38px;
  min-width: 175px;
  max-width: 250px;
  padding: 0 0.85rem;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  outline: none;
}

[data-theme="light"] .queue-doc-filter-trigger {
  background: #ffffff;
  border-color: #cbd5e1;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
}

.queue-doc-filter-trigger:hover {
  border-color: var(--primary);
  background: var(--bg-surface-hover);
  box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.12);
}

[data-theme="light"] .queue-doc-filter-trigger:hover {
  background: #f8fafc;
  border-color: #0284c7;
}

.queue-doc-filter-dropdown.is-open .queue-doc-filter-trigger {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.2);
  background: var(--bg-surface-hover);
}

.queue-doc-filter-trigger.has-filter {
  border-color: var(--primary);
  background: rgba(14, 165, 233, 0.08);
}

[data-theme="light"] .queue-doc-filter-trigger.has-filter {
  background: #f0f9ff;
  border-color: #0284c7;
}

.qdf-trigger-left {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  min-width: 0;
  flex: 1;
}

.qdf-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(14, 165, 233, 0.15);
  border: 1px solid rgba(14, 165, 233, 0.3);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 800;
  flex-shrink: 0;
  transition: all 0.2s ease;
}

[data-theme="light"] .qdf-avatar {
  background: #e0f2fe;
  border-color: #bae6fd;
  color: #0284c7;
}

.qdf-text-block {
  min-width: 0;
  flex: 1;
  text-align: left;
}

.qdf-label {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-primary);
}

.qdf-filter-active-badge {
  font-size: 0.65rem;
  font-weight: 800;
  padding: 1px 6px;
  border-radius: 9999px;
  background: rgba(14, 165, 233, 0.2);
  color: var(--primary);
  border: 1px solid rgba(14, 165, 233, 0.35);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  flex-shrink: 0;
}

[data-theme="light"] .qdf-filter-active-badge {
  background: #0284c7;
  color: #ffffff;
  border-color: #0284c7;
}

.qdf-chevron {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  transition: transform 0.24s cubic-bezier(0.16, 1, 0.3, 1), color 0.2s ease;
  flex-shrink: 0;
}

.queue-doc-filter-dropdown.is-open .qdf-chevron {
  transform: rotate(180deg);
  color: var(--primary);
}

/* Custom Floating Popover Menu */
.queue-doc-filter-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 1000;
  min-width: 290px;
  max-width: 380px;
  max-height: 340px;
  overflow-y: auto;
  background: var(--bg-surface-elevated);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1.5px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 6px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5), 0 4px 12px rgba(0, 0, 0, 0.25);
  display: none;
  flex-direction: column;
  gap: 3px;
  animation: dropdownFadeSlideIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

[data-theme="light"] .queue-doc-filter-menu {
  background: #ffffff;
  border-color: #cbd5e1;
  box-shadow: 0 16px 36px rgba(15, 23, 42, 0.14), 0 4px 10px rgba(15, 23, 42, 0.06);
}

.queue-doc-filter-dropdown.is-open .queue-doc-filter-menu {
  display: flex;
}

.qdf-menu-header {
  padding: 6px 10px 4px;
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.qdf-menu-divider {
  height: 1px;
  background: var(--border-subtle);
  margin: 3px 4px;
}

[data-theme="light"] .qdf-menu-divider {
  background: #e2e8f0;
}

.qdf-option-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.6rem 0.75rem;
  border-radius: var(--radius-sm);
  background: transparent;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.16s ease;
  user-select: none;
}

.qdf-option-item:hover {
  background: rgba(14, 165, 233, 0.1);
  border-color: rgba(14, 165, 233, 0.25);
}

[data-theme="light"] .qdf-option-item:hover {
  background: #f0f7ff;
  border-color: #bfdbfe;
}

.qdf-option-item.is-selected {
  background: rgba(14, 165, 233, 0.16);
  border-color: rgba(14, 165, 233, 0.45);
}

[data-theme="light"] .qdf-option-item.is-selected {
  background: #e0f2fe;
  border-color: #7dd3fc;
}

.qdf-opt-left {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-width: 0;
  flex: 1;
}

.qdf-opt-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(14, 165, 233, 0.15);
  border: 1px solid rgba(14, 165, 233, 0.3);
  color: #38bdf8;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.75rem;
  flex-shrink: 0;
}

[data-theme="light"] .qdf-opt-avatar {
  background: #f1f5f9;
  border-color: #cbd5e1;
  color: #0369a1;
}

.qdf-option-item.is-selected .qdf-opt-avatar {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
}

.qdf-opt-avatar-all {
  font-size: 0.95rem;
}

.qdf-opt-meta {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
  flex: 1;
}

.qdf-opt-name-row {
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
}

.qdf-opt-name {
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.qdf-opt-badge-primary {
  font-size: 0.62rem;
  font-weight: 800;
  padding: 1px 5px;
  border-radius: 4px;
  background: rgba(245, 158, 11, 0.2);
  color: #f59e0b;
  border: 1px solid rgba(245, 158, 11, 0.4);
  flex-shrink: 0;
}

.qdf-opt-sub {
  font-size: 0.72rem;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.qdf-opt-check {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--primary);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.68rem;
  font-weight: 900;
  flex-shrink: 0;
}

/* ===================================================================
   APPLICABLE SERVICE FEES CONFIGURATION (SETTINGS MODAL)
   =================================================================== */
.fee-config-item {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 0.75rem 0.85rem;
  transition: all 0.2s ease;
}

.fee-config-item:focus-within {
  border-color: rgba(16, 185, 129, 0.5);
  background: rgba(16, 185, 129, 0.04);
}

[data-theme="light"] .fee-config-item {
  background: #ffffff;
  border-color: #e2e8f0;
}

[data-theme="light"] .fee-config-item:focus-within {
  border-color: #10b981;
  background: #f0fdf4;
}

.fee-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.fee-status-pill {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 0.15rem 0.55rem;
  border-radius: 9999px;
  background: rgba(148, 163, 184, 0.12);
  color: var(--text-muted);
  border: 1px solid rgba(148, 163, 184, 0.22);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  white-space: nowrap;
}

.fee-status-pill.is-active {
  background: rgba(16, 185, 129, 0.16);
  color: #10b981;
  border-color: rgba(16, 185, 129, 0.4);
}

[data-theme="light"] .fee-status-pill {
  background: #f1f5f9;
  color: #64748b;
  border-color: #cbd5e1;
}

[data-theme="light"] .fee-status-pill.is-active {
  background: #ecfdf5;
  color: #059669;
  border-color: #a7f3d0;
}

/* Modal Target Section Highlight Pulse */
@keyframes sectionHighlightPulse {
  0% {
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
    border-color: rgba(16, 185, 129, 0.9);
  }
  35% {
    box-shadow: 0 0 0 10px rgba(16, 185, 129, 0.28);
    border-color: #10b981;
  }
  100% {
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
    border-color: rgba(16, 185, 129, 0.35);
  }
}

.section-highlight-pulse {
  animation: sectionHighlightPulse 2s cubic-bezier(0.16, 1, 0.3, 1) !important;
}