/*
 * Theme Name: EME Medical — Flutter Style
 * Theme URI: https://emecenter.co
 * Description: تطبيق طبي متكامل بتصميم Flutter Material — حجوزات | بورتال | طبيب | متجر
 * Version: 3.1.0
 * Author: EME Dev Team
 * Text Domain: eme-flutter
 * Requires at least: 6.0
 * WC requires at least: 7.0
 */

/* ═══════════════════════════════════════════════════════════════
   🎨 DESIGN TOKENS — MediGo Flutter Medical
═══════════════════════════════════════════════════════════════ */
:root {
  /* ─ Brand Colors ─ */
  --eme-primary:        #00BFA5;
  --eme-primary-dark:   #00897B;
  --eme-primary-light:  #64FFDA;
  --eme-primary-bg:     #E0F7FA;
  --eme-primary-grad:   linear-gradient(135deg, #00BFA5 0%, #00897B 100%);

  --eme-blue:           #2196F3;
  --eme-blue-dark:      #1565C0;
  --eme-blue-grad:      linear-gradient(135deg, #2196F3, #1565C0);

  --eme-purple:         #7C3AED;
  --eme-pink:           #EC4899;
  --eme-orange:         #F97316;
  --eme-yellow:         #FBBF24;
  --eme-green:          #10B981;
  --eme-red:            #EF4444;

  /* ─ Neutrals ─ */
  --eme-bg:             #F0F4F8;
  --eme-surface:        #FFFFFF;
  --eme-surface-2:      #F8FAFC;
  --eme-border:         #E8EDF2;
  --eme-divider:        #F1F5F9;

  /* ─ Text ─ */
  --eme-text-1:         #0F172A;
  --eme-text-2:         #475569;
  --eme-text-3:         #94A3B8;
  --eme-text-on-prim:   #FFFFFF;

  /* ─ Shadows ─ */
  --eme-shadow-sm:      0 2px 8px rgba(0,0,0,0.06);
  --eme-shadow-md:      0 4px 20px rgba(0,0,0,0.08);
  --eme-shadow-lg:      0 8px 32px rgba(0,0,0,0.10);
  --eme-shadow-teal:    0 8px 24px rgba(0,191,165,0.30);
  --eme-shadow-blue:    0 8px 24px rgba(33,150,243,0.25);

  /* ─ Radius ─ */
  --eme-r-sm:           10px;
  --eme-r-md:           16px;
  --eme-r-lg:           20px;
  --eme-r-xl:           28px;
  --eme-r-pill:         999px;

  /* ─ Spacing ─ */
  --eme-gap-xs:   6px;
  --eme-gap-sm:   12px;
  --eme-gap-md:   20px;
  --eme-gap-lg:   28px;
  --eme-gap-xl:   40px;

  /* ─ Layout ─ */
  --eme-topbar:         64px;
  --eme-bottomnav:      68px;
  --eme-sidebar-w:      260px;
  --eme-max-w:          1200px;
  --eme-content-pad:    20px;

  /* ─ Transitions ─ */
  --eme-ease:           cubic-bezier(0.4, 0, 0.2, 1);
  --eme-dur:            0.2s;
}

/* ═══ RESET & BASE ══════════════════════════════════════════════ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; touch-action: manipulation; }

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
  -moz-text-size-adjust: 100%;
  text-size-adjust: 100%;
  overflow-x: hidden;
}

body {
  font-family: 'Tajawal', 'Cairo', -apple-system, sans-serif;
  background: var(--eme-bg);
  color: var(--eme-text-1);
  direction: rtl;
  line-height: 1.6;
  overflow-x: hidden;
  min-height: 100vh;
}

a { text-decoration: none; color: inherit; }
img { max-width: 100%; height: auto; display: block; }
button { font-family: inherit; cursor: pointer; }
h1,h2,h3,h4,h5,h6 { font-weight: 800; line-height: 1.3; }

.material-icons-round { font-family: 'Material Icons Round'; font-style: normal; font-size: 24px; line-height: 1; display: inline-flex; align-items: center; justify-content: center; }

/* ═══ APP SHELL ═════════════════════════════════════════════════ */
#eme-app {
  display: flex;
  min-height: 100vh;
}

/* ─ Sidebar (Desktop) ─ */
#eme-sidebar {
  position: fixed;
  top: 0; right: 0;
  width: var(--eme-sidebar-w);
  height: 100vh;
  background: var(--eme-surface);
  border-left: 1px solid var(--eme-border);
  display: flex;
  flex-direction: column;
  z-index: 200;
  overflow-y: auto;
  overflow-x: hidden;
  transition: transform var(--eme-dur) var(--eme-ease);
}

.eme-sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 22px 20px 18px;
  border-bottom: 1px solid var(--eme-border);
  text-decoration: none;
}
.eme-sidebar-logo {
  width: 42px; height: 42px;
  border-radius: 12px;
  background: var(--eme-primary-grad);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.eme-sidebar-logo .material-icons-round { color: #fff; font-size: 22px; }
.eme-sidebar-name { font-size: 16px; font-weight: 900; color: var(--eme-text-1); line-height: 1.2; }
.eme-sidebar-tag  { font-size: 11px; color: var(--eme-text-3); font-weight: 400; }

.eme-sidebar-nav { padding: 12px 12px 0; flex: 1; }
.eme-sidebar-section { font-size: 10px; font-weight: 800; color: var(--eme-text-3); text-transform: uppercase; letter-spacing: 1px; padding: 14px 10px 6px; }

.eme-nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: var(--eme-r-md);
  color: var(--eme-text-2);
  font-size: 14px;
  font-weight: 600;
  transition: var(--eme-dur) var(--eme-ease);
  cursor: pointer;
  text-decoration: none;
  margin-bottom: 2px;
  position: relative;
}
.eme-nav-item:hover { background: var(--eme-primary-bg); color: var(--eme-primary-dark); }
.eme-nav-item.active {
  background: var(--eme-primary-bg);
  color: var(--eme-primary-dark);
  font-weight: 800;
}
.eme-nav-item.active::before {
  content: '';
  position: absolute;
  right: 0; top: 20%; bottom: 20%;
  width: 3px;
  background: var(--eme-primary);
  border-radius: 3px 0 0 3px;
}
.eme-nav-item .material-icons-round { font-size: 20px; flex-shrink: 0; }
.eme-nav-item .eme-nav-badge {
  margin-right: auto;
  background: var(--eme-red);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: var(--eme-r-pill);
  min-width: 18px;
  text-align: center;
}

.eme-sidebar-user {
  padding: 14px 16px;
  border-top: 1px solid var(--eme-border);
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 8px;
  border-radius: var(--eme-r-md);
  background: var(--eme-surface-2);
}
.eme-sidebar-avatar {
  width: 38px; height: 38px; border-radius: 50%;
  background: var(--eme-primary-grad);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 900; font-size: 15px;
  flex-shrink: 0;
  overflow: hidden;
}
.eme-sidebar-avatar img { width: 100%; height: 100%; object-fit: cover; }
.eme-sidebar-user-name { font-size: 13px; font-weight: 700; color: var(--eme-text-1); }
.eme-sidebar-user-role { font-size: 11px; color: var(--eme-text-3); }

/* ─ Main Content ─ */
#eme-main {
  flex: 1;
  margin-right: var(--eme-sidebar-w);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ─ Top AppBar ─ */
#eme-topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--eme-topbar);
  background: rgba(255,255,255,0.95);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--eme-border);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 var(--eme-content-pad);
}

.eme-topbar-menu-btn {
  display: none;
  width: 40px; height: 40px;
  border: none; background: none;
  border-radius: var(--eme-r-sm);
  align-items: center; justify-content: center;
  color: var(--eme-text-2);
  transition: var(--eme-dur) var(--eme-ease);
}
.eme-topbar-menu-btn:hover { background: var(--eme-primary-bg); }
.eme-topbar-menu-btn .material-icons-round { font-size: 22px; }

.eme-topbar-brand {
  display: flex; align-items: center; gap: 10px;
  text-decoration: none; margin-left: auto;
}
.eme-topbar-logo {
  width: 36px; height: 36px;
  border-radius: 10px;
  background: var(--eme-primary-grad);
  display: flex; align-items: center; justify-content: center;
}
.eme-topbar-logo .material-icons-round { color: #fff; font-size: 20px; }
.eme-topbar-title { font-size: 17px; font-weight: 900; color: var(--eme-text-1); }
.eme-topbar-subtitle { font-size: 11px; color: var(--eme-text-3); font-weight: 400; }

.eme-topbar-actions { display: flex; align-items: center; gap: 6px; }
.eme-topbar-btn {
  width: 40px; height: 40px;
  border: none; background: none;
  border-radius: var(--eme-r-sm);
  display: flex; align-items: center; justify-content: center;
  color: var(--eme-text-2);
  transition: var(--eme-dur) var(--eme-ease);
  position: relative;
  text-decoration: none;
}
.eme-topbar-btn:hover { background: var(--eme-primary-bg); color: var(--eme-primary-dark); }
.eme-topbar-btn .material-icons-round { font-size: 22px; }
.eme-topbar-badge {
  position: absolute; top: 6px; right: 6px;
  width: 8px; height: 8px;
  background: var(--eme-red);
  border-radius: 50%;
  border: 2px solid #fff;
}

/* ─ Page Wrapper ─ */
#eme-page {
  flex: 1;
  padding: var(--eme-gap-md) var(--eme-content-pad) calc(var(--eme-bottomnav) + 20px);
  max-width: var(--eme-max-w);
  width: 100%;
  margin: 0 auto;
}

/* ─ Bottom Nav (Mobile) ─ */
#eme-bottom-nav {
  display: none;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: var(--eme-bottomnav);
  background: rgba(255,255,255,0.97);
  backdrop-filter: blur(16px);
  border-top: 1px solid var(--eme-border);
  z-index: 200;
  padding: 0 8px;
}
.eme-bnav-inner {
  display: flex;
  align-items: center;
  justify-content: space-around;
  height: 100%;
}
.eme-bnav-item {
  flex: 1;
  display: flex; flex-direction: column; align-items: center;
  gap: 3px;
  padding: 8px 4px;
  border: none; background: none;
  color: var(--eme-text-3);
  font-size: 10px; font-weight: 600;
  font-family: inherit;
  text-decoration: none;
  transition: var(--eme-dur) var(--eme-ease);
  cursor: pointer;
  border-radius: 12px;
  position: relative;
}
.eme-bnav-item .material-icons-round { font-size: 23px; transition: var(--eme-dur) var(--eme-ease); }
.eme-bnav-item.active { color: var(--eme-primary-dark); }
.eme-bnav-item.active .eme-bnav-pip {
  display: block;
}
.eme-bnav-pip {
  display: none;
  position: absolute;
  top: 6px;
  width: 32px; height: 32px;
  background: var(--eme-primary-bg);
  border-radius: 50%;
  z-index: -1;
}
.eme-bnav-dot {
  position: absolute; top: 7px; right: calc(50% - 14px);
  width: 8px; height: 8px;
  background: var(--eme-red);
  border-radius: 50%;
  border: 2px solid #fff;
}

/* ─ Overlay for mobile sidebar ─ */
#eme-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 150;
  backdrop-filter: blur(2px);
}
#eme-overlay.show { display: block; }

/* ═══ LAYOUT UTILITIES ══════════════════════════════════════════ */
.eme-container { max-width: var(--eme-max-w); margin: 0 auto; padding: 0 var(--eme-content-pad); }
.eme-row { display: flex; gap: var(--eme-gap-md); }
.eme-col { flex: 1; min-width: 0; }
.eme-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--eme-gap-sm); }
.eme-grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--eme-gap-sm); }
.eme-grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--eme-gap-sm); }
.eme-scroll-x { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
.eme-scroll-x::-webkit-scrollbar { display: none; }

/* ═══ TYPOGRAPHY ════════════════════════════════════════════════ */
.eme-page-title { font-size: clamp(20px,3vw,28px); font-weight: 900; color: var(--eme-text-1); margin-bottom: 4px; }
.eme-page-sub   { font-size: 14px; color: var(--eme-text-3); margin-bottom: 20px; }
.eme-section-title { font-size: 17px; font-weight: 800; color: var(--eme-text-1); margin-bottom: 12px; }
.eme-label      { font-size: 12px; font-weight: 700; color: var(--eme-text-3); text-transform: uppercase; letter-spacing: 0.5px; }

/* ═══ CARDS ═════════════════════════════════════════════════════ */
.eme-card {
  background: var(--eme-surface);
  border-radius: var(--eme-r-lg);
  padding: 20px;
  box-shadow: var(--eme-shadow-sm);
  border: 1px solid var(--eme-border);
}
.eme-card-sm  { padding: 14px; border-radius: var(--eme-r-md); }
.eme-card-lg  { padding: 28px; border-radius: var(--eme-r-xl); }
.eme-card-hover { transition: var(--eme-dur) var(--eme-ease); }
.eme-card-hover:hover { transform: translateY(-3px); box-shadow: var(--eme-shadow-md); border-color: var(--eme-primary); }

/* ═══ BUTTONS ═══════════════════════════════════════════════════ */
.eme-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: var(--eme-r-pill);
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  border: none;
  cursor: pointer;
  transition: var(--eme-dur) var(--eme-ease);
  text-decoration: none;
  white-space: nowrap;
  line-height: 1;
}
.eme-btn .material-icons-round { font-size: 18px; }

.eme-btn-primary {
  background: var(--eme-primary-grad);
  color: #fff;
  box-shadow: var(--eme-shadow-teal);
}
.eme-btn-primary:hover { transform: translateY(-1px); box-shadow: 0 12px 28px rgba(0,191,165,0.4); color: #fff; }

.eme-btn-blue {
  background: var(--eme-blue-grad);
  color: #fff;
  box-shadow: var(--eme-shadow-blue);
}
.eme-btn-blue:hover { transform: translateY(-1px); color: #fff; }

.eme-btn-outline {
  background: transparent;
  color: var(--eme-primary-dark);
  border: 2px solid var(--eme-primary);
}
.eme-btn-outline:hover { background: var(--eme-primary-bg); }

.eme-btn-ghost {
  background: var(--eme-surface-2);
  color: var(--eme-text-2);
  border: 1px solid var(--eme-border);
}
.eme-btn-ghost:hover { background: var(--eme-primary-bg); color: var(--eme-primary-dark); border-color: var(--eme-primary); }

.eme-btn-sm  { padding: 8px 18px; font-size: 13px; }
.eme-btn-sm .material-icons-round { font-size: 16px; }
.eme-btn-lg  { padding: 16px 32px; font-size: 16px; }
.eme-btn-full { width: 100%; }
.eme-btn-icon { width: 44px; height: 44px; padding: 0; border-radius: var(--eme-r-md); }
.eme-btn-icon-sm { width: 36px; height: 36px; padding: 0; border-radius: var(--eme-r-sm); }

.eme-btn[disabled], .eme-btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none !important; }

/* ═══ BADGES & CHIPS ═══════════════════════════════════════════ */
.eme-badge {
  display: inline-flex; align-items: center;
  padding: 4px 10px;
  border-radius: var(--eme-r-pill);
  font-size: 11px; font-weight: 700;
  line-height: 1;
}
.eme-badge-teal    { background: var(--eme-primary-bg); color: var(--eme-primary-dark); }
.eme-badge-blue    { background: #EFF6FF; color: #1D4ED8; }
.eme-badge-green   { background: #F0FDF4; color: #16A34A; }
.eme-badge-red     { background: #FEF2F2; color: #DC2626; }
.eme-badge-orange  { background: #FFF7ED; color: #EA580C; }
.eme-badge-purple  { background: #F5F3FF; color: #7C3AED; }

.eme-chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 7px 16px;
  border-radius: var(--eme-r-pill);
  border: 1.5px solid var(--eme-border);
  background: var(--eme-surface);
  font-size: 13px; font-weight: 600;
  color: var(--eme-text-2);
  cursor: pointer;
  transition: var(--eme-dur) var(--eme-ease);
  white-space: nowrap;
  text-decoration: none;
}
.eme-chip:hover,
.eme-chip.active {
  background: var(--eme-primary);
  border-color: var(--eme-primary);
  color: #fff;
  box-shadow: var(--eme-shadow-teal);
}
.eme-chip .material-icons-round { font-size: 16px; }

/* ═══ FORM INPUTS ═══════════════════════════════════════════════ */
.eme-field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.eme-field label { font-size: 13px; font-weight: 700; color: var(--eme-text-2); }
.eme-field label .req { color: var(--eme-red); margin-right: 2px; }

.eme-input {
  width: 100%;
  padding: 13px 16px;
  border: 1.5px solid var(--eme-border);
  border-radius: var(--eme-r-md);
  background: var(--eme-surface);
  font-family: inherit;
  font-size: 16px;
  color: var(--eme-text-1);
  outline: none;
  transition: var(--eme-dur) var(--eme-ease);
  direction: rtl;
}
.eme-input::placeholder { color: var(--eme-text-3); }
.eme-input:focus { border-color: var(--eme-primary); background: #fff; box-shadow: 0 0 0 3px rgba(0,191,165,0.12); }
/* ✅ GLOBAL iOS Zoom Fix: all native inputs must be ≥16px */
input:not([type="checkbox"]):not([type="radio"]):not([type="range"]),
textarea,
select {
  font-size: 16px;
}
.eme-input-icon { position: relative; }
.eme-input-icon .material-icons-round {
  position: absolute; top: 50%; right: 14px;
  transform: translateY(-50%);
  color: var(--eme-text-3); font-size: 20px; pointer-events: none;
}
.eme-input-icon .eme-input { padding-right: 46px; }

.eme-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L6 7L11 1' stroke='%2394A3B8' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: left 14px center;
  padding-left: 36px;
}

/* ═══ STAT CARDS ════════════════════════════════════════════════ */
.eme-stat-card {
  background: var(--eme-surface);
  border-radius: var(--eme-r-lg);
  padding: 20px;
  border: 1px solid var(--eme-border);
  display: flex; flex-direction: column;
  gap: 12px;
  position: relative;
  overflow: hidden;
}
.eme-stat-card::after {
  content: '';
  position: absolute; top: -20px; left: -20px;
  width: 80px; height: 80px;
  border-radius: 50%;
  opacity: 0.08;
}
.eme-stat-teal  { border-top: 3px solid var(--eme-primary); }
.eme-stat-teal::after  { background: var(--eme-primary); }
.eme-stat-blue  { border-top: 3px solid var(--eme-blue); }
.eme-stat-blue::after  { background: var(--eme-blue); }
.eme-stat-green { border-top: 3px solid var(--eme-green); }
.eme-stat-green::after { background: var(--eme-green); }
.eme-stat-orange{ border-top: 3px solid var(--eme-orange); }
.eme-stat-orange::after{ background: var(--eme-orange); }

.eme-stat-icon {
  width: 48px; height: 48px;
  border-radius: var(--eme-r-md);
  display: flex; align-items: center; justify-content: center;
}
.eme-stat-icon .material-icons-round { font-size: 24px; }
.eme-stat-teal  .eme-stat-icon { background: var(--eme-primary-bg); }
.eme-stat-teal  .eme-stat-icon .material-icons-round { color: var(--eme-primary-dark); }
.eme-stat-blue  .eme-stat-icon { background: #EFF6FF; }
.eme-stat-blue  .eme-stat-icon .material-icons-round { color: var(--eme-blue); }
.eme-stat-green .eme-stat-icon { background: #F0FDF4; }
.eme-stat-green .eme-stat-icon .material-icons-round { color: var(--eme-green); }
.eme-stat-orange .eme-stat-icon { background: #FFF7ED; }
.eme-stat-orange .eme-stat-icon .material-icons-round { color: var(--eme-orange); }

.eme-stat-num { font-size: 28px; font-weight: 900; color: var(--eme-text-1); line-height: 1; }
.eme-stat-lbl { font-size: 13px; color: var(--eme-text-3); font-weight: 600; }
.eme-stat-trend { font-size: 12px; font-weight: 700; display: flex; align-items: center; gap: 3px; }
.eme-stat-trend.up   { color: var(--eme-green); }
.eme-stat-trend.down { color: var(--eme-red); }

/* ═══ HERO SEARCH (Home) ════════════════════════════════════════ */
.eme-hero {
  background: var(--eme-primary-grad);
  border-radius: var(--eme-r-xl);
  padding: 28px 24px;
  margin-bottom: var(--eme-gap-md);
  position: relative;
  overflow: hidden;
}
.eme-hero::before {
  content: '';
  position: absolute; top: -40px; left: -40px;
  width: 200px; height: 200px;
  border-radius: 50%;
  background: rgba(255,255,255,0.06);
  pointer-events: none;
}
.eme-hero::after {
  content: '';
  position: absolute; bottom: -60px; right: -40px;
  width: 160px; height: 160px;
  border-radius: 50%;
  background: rgba(255,255,255,0.06);
  pointer-events: none;
}
.eme-hero-greeting { font-size: 13px; color: rgba(255,255,255,0.8); font-weight: 600; margin-bottom: 4px; }
.eme-hero-title    { font-size: clamp(18px,4vw,26px); font-weight: 900; color: #fff; margin-bottom: 4px; }
.eme-hero-sub      { font-size: 13px; color: rgba(255,255,255,0.75); margin-bottom: 20px; }

/* Search Box inside Hero */
.eme-hero-search {
  background: rgba(255,255,255,0.15);
  border: 1.5px solid rgba(255,255,255,0.3);
  border-radius: var(--eme-r-pill);
  display: flex; align-items: center;
  gap: 8px;
  padding: 6px 6px 6px 14px;
  backdrop-filter: blur(8px);
}
.eme-hero-search input {
  flex: 1; background: none; border: none; outline: none;
  font-family: inherit; font-size: 14px; color: #fff;
  direction: rtl;
}
.eme-hero-search input::placeholder { color: rgba(255,255,255,0.65); }
.eme-hero-search .material-icons-round { color: rgba(255,255,255,0.7); font-size: 20px; }
.eme-hero-search-btn {
  background: #fff;
  color: var(--eme-primary-dark);
  border: none; border-radius: var(--eme-r-pill);
  padding: 9px 20px;
  font-family: inherit; font-size: 13px; font-weight: 800;
  cursor: pointer;
  transition: var(--eme-dur) var(--eme-ease);
  display: flex; align-items: center; gap: 5px;
  white-space: nowrap;
}
.eme-hero-search-btn:hover { transform: scale(1.02); }
.eme-hero-search-btn .material-icons-round { font-size: 16px; }

/* Search Results */
.eme-search-results {
  background: var(--eme-surface);
  border-radius: var(--eme-r-lg);
  margin-top: 8px;
  overflow: hidden;
  box-shadow: var(--eme-shadow-md);
  border: 1px solid var(--eme-border);
}
.eme-search-result-item {
  display: flex; align-items: center; gap: 12px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--eme-divider);
  text-decoration: none; color: var(--eme-text-1);
  transition: var(--eme-dur) var(--eme-ease);
  cursor: pointer;
}
.eme-search-result-item:last-child { border-bottom: none; }
.eme-search-result-item:hover { background: var(--eme-primary-bg); }
.eme-search-result-avatar {
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--eme-primary-grad);
  color: #fff; font-weight: 900; font-size: 16px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.eme-search-result-name { font-size: 14px; font-weight: 700; }
.eme-search-result-id   { font-size: 12px; color: var(--eme-text-3); }
.eme-search-result-arrow { margin-right: auto; color: var(--eme-primary); }
.eme-search-result-error {
  padding: 14px 16px;
  font-size: 13px; color: var(--eme-text-2);
  text-align: center;
}
.eme-search-result-error a { color: var(--eme-primary-dark); font-weight: 700; }

/* ═══ QUICK ACTION CARDS ════════════════════════════════════════ */
.eme-quick-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: var(--eme-gap-md);
}
.eme-quick-btn {
  background: var(--eme-surface);
  border-radius: var(--eme-r-lg);
  padding: 18px 12px;
  display: flex; flex-direction: column;
  align-items: center; gap: 10px;
  text-align: center;
  text-decoration: none;
  border: 1px solid var(--eme-border);
  transition: var(--eme-dur) var(--eme-ease);
  cursor: pointer;
  font-family: inherit;
  min-width: 0;
  overflow: hidden;
}
.eme-quick-btn:hover { transform: translateY(-3px); box-shadow: var(--eme-shadow-md); border-color: transparent; }
.eme-quick-icon {
  width: 52px; height: 52px;
  border-radius: var(--eme-r-md);
  display: flex; align-items: center; justify-content: center;
}
.eme-quick-icon .material-icons-round { font-size: 26px; color: #fff; }
.eme-quick-teal   .eme-quick-icon { background: var(--eme-primary-grad); box-shadow: var(--eme-shadow-teal); }
.eme-quick-blue   .eme-quick-icon { background: var(--eme-blue-grad); box-shadow: var(--eme-shadow-blue); }
.eme-quick-purple .eme-quick-icon { background: linear-gradient(135deg, #8B5CF6, #6D28D9); box-shadow: 0 6px 20px rgba(124,58,237,0.3); }
.eme-quick-orange .eme-quick-icon { background: linear-gradient(135deg, #FB923C, #EA580C); box-shadow: 0 6px 20px rgba(249,115,22,0.3); }
.eme-quick-green  .eme-quick-icon { background: linear-gradient(135deg, #34D399, #059669); box-shadow: 0 6px 20px rgba(16,185,129,0.3); }
.eme-quick-pink   .eme-quick-icon { background: linear-gradient(135deg, #F472B6, #DB2777); box-shadow: 0 6px 20px rgba(236,72,153,0.3); }
.eme-quick-label { font-size: 12px; font-weight: 700; color: var(--eme-text-2); line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.eme-quick-sub   { font-size: 10px; color: var(--eme-text-3); margin-top: -4px; }

/* ═══ DOCTOR CARDS ══════════════════════════════════════════════ */
.eme-doctors-scroll { display: flex; gap: 14px; overflow-x: auto; padding-bottom: 6px; scrollbar-width: none; }
.eme-doctors-scroll::-webkit-scrollbar { display: none; }

.eme-doctor-card {
  flex-shrink: 0; width: 160px;
  background: var(--eme-surface);
  border-radius: var(--eme-r-lg);
  padding: 18px 14px;
  border: 1px solid var(--eme-border);
  display: flex; flex-direction: column;
  align-items: center; gap: 8px;
  text-align: center;
  text-decoration: none; color: var(--eme-text-1);
  transition: var(--eme-dur) var(--eme-ease);
}
.eme-doctor-card:hover { box-shadow: var(--eme-shadow-md); border-color: var(--eme-primary); transform: translateY(-2px); }

.eme-doctor-avatar-wrap { position: relative; }
.eme-doctor-avatar {
  width: 72px; height: 72px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--eme-primary-bg);
  display: block;
}
.eme-doctor-initials {
  width: 72px; height: 72px;
  border-radius: 50%;
  background: var(--eme-primary-grad);
  color: #fff; font-size: 22px; font-weight: 900;
  display: flex; align-items: center; justify-content: center;
  border: 3px solid var(--eme-primary-bg);
}
.eme-doctor-online {
  position: absolute; bottom: 3px; right: 3px;
  width: 14px; height: 14px;
  background: var(--eme-green);
  border-radius: 50%;
  border: 2px solid #fff;
}
.eme-doctor-name  { font-size: 13px; font-weight: 800; color: var(--eme-text-1); }
.eme-doctor-spec  { font-size: 11px; color: var(--eme-text-3); font-weight: 600; }
.eme-doctor-rating {
  display: flex; align-items: center; gap: 3px;
  font-size: 12px; font-weight: 700; color: var(--eme-yellow);
}
.eme-doctor-rating .material-icons-round { font-size: 14px; }
.eme-doctor-book {
  width: 100%;
  padding: 8px;
  border-radius: var(--eme-r-pill);
  border: 1.5px solid var(--eme-primary);
  background: transparent;
  color: var(--eme-primary-dark);
  font-size: 12px; font-weight: 700;
  font-family: inherit; cursor: pointer;
  transition: var(--eme-dur) var(--eme-ease);
  text-decoration: none; display: block; text-align: center;
}
.eme-doctor-book:hover { background: var(--eme-primary); color: #fff; }

/* ═══ SERVICE CHIPS ═════════════════════════════════════════════ */
.eme-services-chips { display: flex; gap: 10px; overflow-x: auto; padding: 4px 0 10px; scrollbar-width: none; }
.eme-services-chips::-webkit-scrollbar { display: none; }
.eme-service-chip {
  flex-shrink: 0;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 14px 16px;
  border-radius: var(--eme-r-lg);
  border: 1.5px solid var(--eme-border);
  background: var(--eme-surface);
  cursor: pointer;
  transition: var(--eme-dur) var(--eme-ease);
  text-decoration: none; color: var(--eme-text-2);
  min-width: 90px; text-align: center;
}
.eme-service-chip:hover, .eme-service-chip.active {
  border-color: var(--eme-primary);
  background: var(--eme-primary-bg);
  color: var(--eme-primary-dark);
  box-shadow: var(--eme-shadow-teal);
}
.eme-service-chip-icon {
  width: 44px; height: 44px;
  border-radius: var(--eme-r-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
}
.eme-service-chip-name { font-size: 12px; font-weight: 700; line-height: 1.3; }

/* ═══ APPOINTMENT CARDS ═════════════════════════════════════════ */
.eme-appt-card {
  background: var(--eme-surface);
  border-radius: var(--eme-r-lg);
  padding: 16px;
  border: 1px solid var(--eme-border);
  display: flex; align-items: center; gap: 14px;
  margin-bottom: 10px;
  transition: var(--eme-dur) var(--eme-ease);
}
.eme-appt-card:hover { border-color: var(--eme-primary); box-shadow: var(--eme-shadow-sm); }
.eme-appt-card-left {
  width: 4px;
  min-height: 60px;
  border-radius: 4px;
  flex-shrink: 0;
}
.eme-appt-card-left.teal   { background: var(--eme-primary); }
.eme-appt-card-left.blue   { background: var(--eme-blue); }
.eme-appt-card-left.orange { background: var(--eme-orange); }
.eme-appt-card-left.red    { background: var(--eme-red); }
.eme-appt-card-left.green  { background: var(--eme-green); }
.eme-appt-body { flex: 1; min-width: 0; }
.eme-appt-service { font-size: 15px; font-weight: 800; color: var(--eme-text-1); margin-bottom: 3px; }
.eme-appt-meta { font-size: 12px; color: var(--eme-text-3); display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.eme-appt-meta .material-icons-round { font-size: 14px; }
.eme-appt-time { 
  background: var(--eme-primary-bg);
  color: var(--eme-primary-dark);
  padding: 6px 12px;
  border-radius: var(--eme-r-md);
  font-size: 12px; font-weight: 800;
  text-align: center; flex-shrink: 0;
  line-height: 1.5;
  direction: ltr;
}

/* ═══ BOOKING STEPS ═════════════════════════════════════════════ */
.eme-steps {
  display: flex;
  align-items: center;
  gap: 0;
  margin-bottom: var(--eme-gap-md);
  background: var(--eme-surface);
  border-radius: var(--eme-r-pill);
  padding: 6px;
  border: 1px solid var(--eme-border);
}
.eme-step {
  flex: 1;
  display: flex; flex-direction: column; align-items: center;
  gap: 2px; padding: 10px 8px;
  border-radius: var(--eme-r-pill);
  font-size: 11px; font-weight: 700;
  color: var(--eme-text-3);
  text-align: center;
  transition: var(--eme-dur) var(--eme-ease);
  cursor: pointer;
}
.eme-step.done {
  color: var(--eme-primary-dark);
}
.eme-step.done .eme-step-num { background: var(--eme-primary); color: #fff; }
.eme-step.active {
  background: var(--eme-primary-bg);
  color: var(--eme-primary-dark);
}
.eme-step.active .eme-step-num { background: var(--eme-primary); color: #fff; }
.eme-step-num {
  width: 26px; height: 26px;
  border-radius: 50%;
  background: var(--eme-surface-2);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 800;
  transition: var(--eme-dur) var(--eme-ease);
}
.eme-step-label { font-size: 10px; }

/* ═══ TIME SLOTS GRID ═══════════════════════════════════════════ */
.eme-slots-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: 10px;
}
.eme-slot {
  padding: 10px 6px;
  border-radius: var(--eme-r-md);
  border: 1.5px solid var(--eme-border);
  background: var(--eme-surface);
  text-align: center;
  font-size: 13px; font-weight: 700;
  color: var(--eme-text-2);
  cursor: pointer;
  transition: var(--eme-dur) var(--eme-ease);
  direction: ltr;
  font-family: inherit;
}
.eme-slot:hover { border-color: var(--eme-primary); color: var(--eme-primary-dark); background: var(--eme-primary-bg); }
.eme-slot.selected { background: var(--eme-primary-grad); color: #fff; border-color: transparent; box-shadow: var(--eme-shadow-teal); }
.eme-slot.busy { opacity: 0.3; cursor: not-allowed; text-decoration: line-through; }

/* ═══ CALENDAR ══════════════════════════════════════════════════ */
.eme-calendar {
  background: var(--eme-surface);
  border-radius: var(--eme-r-lg);
  padding: 16px;
  border: 1px solid var(--eme-border);
  margin-bottom: 16px;
}
.eme-cal-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px;
}
.eme-cal-month { font-size: 15px; font-weight: 800; color: var(--eme-text-1); }
.eme-cal-nav-btn {
  width: 32px; height: 32px;
  border: 1px solid var(--eme-border);
  border-radius: var(--eme-r-sm);
  background: var(--eme-surface-2);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: var(--eme-dur) var(--eme-ease);
  color: var(--eme-text-2);
}
.eme-cal-nav-btn:hover { background: var(--eme-primary-bg); border-color: var(--eme-primary); color: var(--eme-primary-dark); }
.eme-cal-nav-btn .material-icons-round { font-size: 18px; }
.eme-cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.eme-cal-weekday { text-align: center; font-size: 11px; font-weight: 700; color: var(--eme-text-3); padding: 6px 0; }
.eme-cal-day {
  aspect-ratio: 1;
  border-radius: var(--eme-r-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 600;
  color: var(--eme-text-2);
  cursor: pointer;
  transition: var(--eme-dur) var(--eme-ease);
  border: 1.5px solid transparent;
}
.eme-cal-day:hover { background: var(--eme-primary-bg); color: var(--eme-primary-dark); }
.eme-cal-day.today { border-color: var(--eme-primary); color: var(--eme-primary-dark); font-weight: 800; }
.eme-cal-day.selected { background: var(--eme-primary-grad); color: #fff; border-color: transparent; box-shadow: var(--eme-shadow-teal); }
.eme-cal-day.has-appt::after { content: ''; display: block; width: 4px; height: 4px; background: var(--eme-primary); border-radius: 50%; position: absolute; bottom: 2px; }
.eme-cal-day.other-month { opacity: 0.3; }
.eme-cal-day.disabled { opacity: 0.2; cursor: not-allowed; }
.eme-cal-day { position: relative; }

/* ═══ DOCTOR PANEL LAYOUT ═══════════════════════════════════════ */
.eme-panel-header {
  background: var(--eme-primary-grad);
  border-radius: var(--eme-r-xl);
  padding: 24px;
  margin-bottom: var(--eme-gap-md);
  color: #fff;
  display: flex; align-items: center; gap: 16px;
}
.eme-panel-doc-avatar {
  width: 64px; height: 64px;
  border-radius: 50%; border: 3px solid rgba(255,255,255,0.3);
  object-fit: cover; flex-shrink: 0;
  background: rgba(255,255,255,0.2);
  display: flex; align-items: center; justify-content: center;
  font-size: 24px; font-weight: 900; color: #fff;
  overflow: hidden;
}
.eme-panel-doc-avatar img { width: 100%; height: 100%; object-fit: cover; }
.eme-panel-doc-name { font-size: 20px; font-weight: 900; margin-bottom: 2px; }
.eme-panel-doc-spec { font-size: 13px; opacity: 0.85; }
.eme-panel-doc-stats { display: flex; gap: 20px; margin-top: 10px; }
.eme-panel-doc-stat-num { font-size: 20px; font-weight: 900; display: block; }
.eme-panel-doc-stat-lbl { font-size: 11px; opacity: 0.8; }

/* Patient Row in Doctor Panel */
.eme-patient-row {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid var(--eme-divider);
  cursor: pointer;
  transition: var(--eme-dur) var(--eme-ease);
  text-decoration: none; color: inherit;
}
.eme-patient-row:last-child { border-bottom: none; }
.eme-patient-row:hover { color: var(--eme-primary-dark); }
.eme-patient-avatar {
  width: 44px; height: 44px; border-radius: 50%;
  background: var(--eme-primary-bg);
  color: var(--eme-primary-dark);
  font-size: 16px; font-weight: 900;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; overflow: hidden;
}
.eme-patient-avatar img { width: 100%; height: 100%; object-fit: cover; }
.eme-patient-name  { font-size: 14px; font-weight: 800; }
.eme-patient-meta  { font-size: 12px; color: var(--eme-text-3); }
.eme-patient-time  {
  margin-right: auto;
  background: var(--eme-primary-bg);
  color: var(--eme-primary-dark);
  padding: 5px 10px;
  border-radius: var(--eme-r-pill);
  font-size: 12px; font-weight: 700;
  direction: ltr; flex-shrink: 0;
}

/* ═══ PORTAL PAGE ════════════════════════════════════════════════ */
.eme-portal-hero {
  background: var(--eme-primary-grad);
  border-radius: var(--eme-r-xl);
  padding: 24px;
  display: flex; align-items: center; gap: 16px;
  margin-bottom: var(--eme-gap-md);
  color: #fff;
}
.eme-portal-avatar {
  width: 64px; height: 64px;
  border-radius: 50%;
  border: 3px solid rgba(255,255,255,0.3);
  background: rgba(255,255,255,0.2);
  display: flex; align-items: center; justify-content: center;
  font-size: 24px; font-weight: 900;
  flex-shrink: 0; overflow: hidden;
}
.eme-portal-avatar img { width: 100%; height: 100%; object-fit: cover; }
.eme-portal-name { font-size: 20px; font-weight: 900; }
.eme-portal-id   { font-size: 13px; opacity: 0.8; }
.eme-portal-wallet {
  margin-right: auto;
  text-align: center;
  background: rgba(255,255,255,0.15);
  padding: 10px 16px;
  border-radius: var(--eme-r-md);
  border: 1px solid rgba(255,255,255,0.2);
  flex-shrink: 0;
}
.eme-portal-wallet-num { font-size: 18px; font-weight: 900; display: block; }
.eme-portal-wallet-lbl { font-size: 10px; opacity: 0.8; }

/* Portal Tabs */
.eme-tabs {
  display: flex; gap: 6px; flex-wrap: wrap;
  margin-bottom: var(--eme-gap-md);
  background: var(--eme-surface);
  padding: 6px;
  border-radius: var(--eme-r-pill);
  border: 1px solid var(--eme-border);
}
.eme-tab {
  flex: 1;
  padding: 9px 12px;
  border-radius: var(--eme-r-pill);
  border: none; background: none;
  font-family: inherit; font-size: 13px; font-weight: 700;
  color: var(--eme-text-3); cursor: pointer;
  transition: var(--eme-dur) var(--eme-ease);
  white-space: nowrap; text-align: center;
  display: flex; align-items: center; justify-content: center; gap: 5px;
}
.eme-tab .material-icons-round { font-size: 16px; }
.eme-tab.active { background: var(--eme-primary-grad); color: #fff; box-shadow: var(--eme-shadow-teal); }
.eme-tab-panel { display: none; }
.eme-tab-panel.active { display: block; }

/* Financial Card */
.eme-finance-card {
  display: flex; flex-wrap: wrap; gap: 10px;
  padding: 16px;
  background: var(--eme-surface);
  border-radius: var(--eme-r-lg);
  border: 1px solid var(--eme-border);
  margin-bottom: 12px;
}
.eme-finance-item {
  flex: 1; min-width: 100px;
  display: flex; flex-direction: column;
  align-items: center;
  padding: 12px;
  border-radius: var(--eme-r-md);
  text-align: center;
}
.eme-finance-item.debt   { background: #FEF2F2; }
.eme-finance-item.paid   { background: #F0FDF4; }
.eme-finance-item.checks { background: #FFF7ED; }
.eme-finance-num  { font-size: 20px; font-weight: 900; }
.eme-finance-item.debt   .eme-finance-num { color: var(--eme-red); }
.eme-finance-item.paid   .eme-finance-num { color: var(--eme-green); }
.eme-finance-item.checks .eme-finance-num { color: var(--eme-orange); }
.eme-finance-lbl  { font-size: 11px; color: var(--eme-text-3); font-weight: 700; margin-top: 4px; }

/* ═══ PRESCRIPTION ITEM ═════════════════════════════════════════ */
.eme-rx-item {
  display: flex; gap: 12px; padding: 14px 0;
  border-bottom: 1px solid var(--eme-divider);
}
.eme-rx-item:last-child { border-bottom: none; }
.eme-rx-icon {
  width: 40px; height: 40px;
  border-radius: var(--eme-r-md);
  background: #EFF6FF;
  color: var(--eme-blue);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.eme-rx-icon .material-icons-round { font-size: 20px; }
.eme-rx-name  { font-size: 14px; font-weight: 700; }
.eme-rx-date  { font-size: 12px; color: var(--eme-text-3); }
.eme-rx-meds  { font-size: 12px; color: var(--eme-text-2); margin-top: 2px; }

/* ═══ SNACKBAR / TOAST ══════════════════════════════════════════ */
.eme-snackbar-wrap { position: fixed; bottom: calc(var(--eme-bottomnav) + 12px); left: 16px; right: 16px; z-index: 9999; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.eme-snack {
  background: #1E293B;
  color: #fff;
  padding: 14px 18px;
  border-radius: var(--eme-r-md);
  font-size: 14px;
  box-shadow: var(--eme-shadow-lg);
  display: flex; align-items: center; gap: 10px;
  pointer-events: auto;
  animation: emeSnackIn 0.3s var(--eme-ease);
  max-width: 420px;
  margin: 0 auto;
  width: 100%;
}
.eme-snack.success { border-right: 4px solid var(--eme-green); }
.eme-snack.error   { border-right: 4px solid var(--eme-red); }
.eme-snack.info    { border-right: 4px solid var(--eme-primary); }
@keyframes emeSnackIn { from { transform: translateY(20px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ═══ LOADING SPINNER ═══════════════════════════════════════════ */
.eme-spinner {
  width: 24px; height: 24px;
  border-radius: 50%;
  border: 3px solid rgba(255,255,255,0.3);
  border-top-color: currentColor;
  animation: emeSpin 0.7s linear infinite;
  display: inline-block;
}
@keyframes emeSpin { to { transform: rotate(360deg); } }

/* ═══ SECTION WRAPPER ═══════════════════════════════════════════ */
.eme-section { margin-bottom: var(--eme-gap-lg); }
.eme-section-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px;
}
/* ── Layout Helpers (Added for Mobile Fix) ── */
.eme-stats-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.eme-contact-wrap { display: flex; flex-wrap: wrap; gap: 10px; padding: 16px; }

/* ═══ EMPTY STATE ═══════════════════════════════════════════════ */
.eme-empty {
  text-align: center; padding: 32px 20px;
  color: var(--eme-text-3);
}
.eme-empty-icon { font-size: 48px; margin-bottom: 10px; }
.eme-empty p  { font-size: 14px; }

/* ═══ FAB ═══════════════════════════════════════════════════════ */
.eme-fab {
  position: fixed; bottom: calc(var(--eme-bottomnav) + 16px); left: 20px;
  width: 56px; height: 56px;
  border-radius: var(--eme-r-pill);
  background: var(--eme-primary-grad);
  color: #fff; font-size: 26px;
  border: none; cursor: pointer;
  box-shadow: var(--eme-shadow-teal);
  display: flex; align-items: center; justify-content: center;
  transition: var(--eme-dur) var(--eme-ease);
  z-index: 50;
  text-decoration: none;
}
.eme-fab:hover { transform: scale(1.08); }
.eme-fab .material-icons-round { font-size: 26px; color: #fff; }

/* ═══ RESPONSIVE ════════════════════════════════════════════════ */
@media (max-width: 1024px) {
  #eme-sidebar { transform: translateX(100%); }
  #eme-sidebar.open { transform: translateX(0); box-shadow: var(--eme-shadow-lg); }
  #eme-main { margin-right: 0; min-width: 0; width: 100%; max-width: 100%; }
  .eme-topbar-menu-btn { display: flex; }
  #eme-bottom-nav { display: flex; }
  #eme-page { padding-bottom: calc(var(--eme-bottomnav) + 16px); }
  .eme-quick-grid { grid-template-columns: repeat(4, 1fr); }
  #eme-topbar     { z-index: 300; }
  #eme-bottom-nav { z-index: 300; }
  .eme-services-chips,
  .eme-doctors-scroll,
  .eme-scroll-x {
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
}

@media (max-width: 640px) {
  :root { --eme-content-pad: 14px; }

  /* ── Hero mobile ── */
  .eme-hero { padding: 20px 16px; border-radius: var(--eme-r-lg); overflow: hidden; }
  .eme-hero-title { font-size: 18px; }
  .eme-hero-sub { font-size: 12px; margin-bottom: 14px; }
  .eme-hero-search { padding: 5px 5px 5px 10px; gap: 5px; width: 100%; }
  /* ✅ FIX iOS zoom: font-size >= 16px prevents auto-zoom on focus */
  .eme-hero-search input { font-size: 16px; min-width: 0; flex: 1; }
  /* ✅ FIX: أيقونة فقط على الشاشات الصغيرة */
  .eme-hero-search-btn { padding: 9px 14px; font-size: 0; gap: 0; }
  .eme-hero-search-btn .material-icons-round { font-size: 18px; }
  #eme-fileid-form, #eme-phone-form { width: 100%; }

  /* ✅ FIX iOS zoom on all inputs */
  .eme-input, input, textarea, select { font-size: 16px !important; }

 /* ── Quick actions (تصحيح لعمودين بدلاً من 4) ── */
  .eme-quick-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .eme-quick-btn { padding: 14px 10px; min-width: 0; overflow: visible; }
  .eme-quick-icon { width: 48px; height: 48px; border-radius: var(--eme-r-sm); }
  .eme-quick-icon .material-icons-round { font-size: 24px; }
  .eme-quick-label { font-size: 13px; white-space: normal; line-height: 1.4; overflow: visible; text-overflow: clip; }

  /* ── Services chips: wrap instead of endless scroll ── */
  .eme-services-chips {
    flex-wrap: wrap;
    overflow-x: visible;
    contain: none;
  }
  .eme-service-chip {
    min-width: calc(33.33% - 8px);
    flex: 1 1 calc(33.33% - 8px);
  }

  /* ── Doctors ── */
  .eme-doctors-scroll { gap: 10px; }
  .eme-doctor-card { width: 140px; }

  /* ── Shop cards ── */
  .eme-fpc { width: 140px; }
  .eme-fpc-img { height: 110px; }

  /* ── Appointment card ── */
  .eme-appt-time { min-width: 56px; font-size: 13px; }

  /* ── Misc ── */
  .eme-steps { gap: 2px; }
  .eme-step { padding: 8px 4px; font-size: 10px; }
  .eme-eme-grid-4 { grid-template-columns: repeat(2, 1fr); }
}

/* ── Ultra-small screens ── */
@media (max-width: 380px) {
  :root { --eme-content-pad: 12px; }
  .eme-hero { padding: 16px 12px; }
  .eme-hero-title { font-size: 16px; }
  .eme-hero-search-btn { padding: 9px 12px; }  /* icon-only already from 640px */
  .eme-service-chip { min-width: calc(50% - 6px); flex: 1 1 calc(50% - 6px); }
/* ✅ Ultra-small (iPhone SE 320px): عمودين للأزرار السريعة لتجنب التشوه */
  .eme-quick-grid { gap: 10px; grid-template-columns: repeat(2, 1fr); }
  .eme-quick-icon { width: 42px; height: 42px; }
  .eme-quick-icon .material-icons-round { font-size: 20px; }
  .eme-quick-btn { padding: 12px 8px; gap: 8px; }

  /* ترتيب الإحصائيات وأزرار الاتصال فوق بعضها لضمان عدم خروجها عن الشاشة */
  .eme-stats-grid { grid-template-columns: 1fr; }
  .eme-contact-wrap { flex-direction: column; }
  .eme-contact-wrap .eme-btn { width: 100%; justify-content: center; }
  
  /* qbook modal step4 — single column on tiny screens */
  #qb-step-4 [style*="grid-template-columns:1fr 1fr"] {
    grid-template-columns: 1fr !important;
  }
}

@media (min-width: 768px) {
  .eme-quick-grid { grid-template-columns: repeat(4, 1fr); }
}

@media (min-width: 1024px) {
  #eme-page { padding: var(--eme-gap-lg) var(--eme-gap-lg) var(--eme-gap-xl); }
}

/* ══ SIDEBAR COLLAPSE — Desktop ════════════════════════════════ */
.eme-sidebar-brand-wrap {
  border-bottom: 1px solid var(--eme-border);
}
.eme-sidebar-brand-wrap .eme-sidebar-brand {
  border-bottom: none;
}
.eme-sidebar-name-wrap { min-width: 0; overflow: hidden; }

/* ── Floating collapse tab — OUTSIDE sidebar overflow context ── */
.eme-sidebar-collapse-btn {
  display: none;      /* hidden on mobile */
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  /* Right side: sidebar (260px) minus half the button (14px) = 246px from right */
  right: calc(var(--eme-sidebar-w) - 14px);
  z-index: 201;
  width: 28px; height: 28px;
  border: 1.5px solid var(--eme-border);
  background: var(--eme-surface);
  border-radius: 50%;
  align-items: center; justify-content: center;
  cursor: pointer;
  color: var(--eme-text-3);
  box-shadow: -3px 0 10px rgba(0,0,0,0.10);
  transition: background var(--eme-dur) var(--eme-ease),
              color     var(--eme-dur) var(--eme-ease),
              right     var(--eme-dur) var(--eme-ease);
}
.eme-sidebar-collapse-btn:hover {
  background: var(--eme-primary-bg);
  color: var(--eme-primary-dark);
  box-shadow: -3px 0 14px rgba(0,191,165,0.25);
}
.eme-sidebar-collapse-btn .material-icons-round {
  font-size: 16px;
  transition: transform var(--eme-dur) var(--eme-ease);
}

/* Button collapsed state — JS adds .sidebar-is-collapsed directly on button */
.eme-sidebar-collapse-btn.sidebar-is-collapsed {
  right: calc(72px - 14px);
}
.eme-sidebar-collapse-btn.sidebar-is-collapsed .material-icons-round {
  transform: scaleX(-1);
}

@media (min-width: 1025px) {
  .eme-sidebar-collapse-btn { display: flex; }

  /* Smooth transitions */
  #eme-sidebar { transition: width var(--eme-dur) var(--eme-ease), transform var(--eme-dur) var(--eme-ease); }
  #eme-main    { transition: margin-right var(--eme-dur) var(--eme-ease); }

  /* Collapsed state */
  #eme-sidebar.collapsed { width: 72px; }
  #eme-sidebar.collapsed .eme-sidebar-brand-wrap { justify-content: center; }
  #eme-sidebar.collapsed .eme-sidebar-brand { justify-content: center; padding: 14px 16px; }
  #eme-sidebar.collapsed .eme-sidebar-name-wrap { display: none; }
  #eme-sidebar.collapsed .eme-sidebar-nav { padding: 8px; }
  #eme-sidebar.collapsed .eme-nav-item { justify-content: center; padding: 11px; gap: 0; }
  #eme-sidebar.collapsed .eme-nav-item span:not(.material-icons-round):not(.eme-nav-badge) { display: none; }
  #eme-sidebar.collapsed .eme-nav-item .eme-nav-badge { display: none; }
  #eme-sidebar.collapsed .eme-sidebar-section { display: none; }
  #eme-sidebar.collapsed .eme-sidebar-user { justify-content: center; }
  #eme-sidebar.collapsed .eme-sidebar-user > div:last-child { display: none; }
  #eme-main.sidebar-collapsed { margin-right: 72px; }
}

/* ══ DUAL CLINIC NAME SLIDER ════════════════════════════════════ */
.eme-name-slider {
  position: relative;
  height: 22px;
  overflow: hidden;
}
.eme-name-slide {
  display: block;
  font-size: 16px; font-weight: 900;
  color: var(--eme-text-1); line-height: 1.2;
  position: absolute;
  top: 0; right: 0; left: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  opacity: 0; /* ✅ FIX: إخفاء مبدئي قبل بدء الأنيميشن */
  animation: emeNameSlide var(--eme-slider-dur, 8s) ease-in-out infinite;
}
.eme-name-slide-1 { animation-delay: 0s; }
.eme-name-slide-2 { animation-delay: calc(-1 * var(--eme-slider-dur, 8s) / 2); }

@keyframes emeNameSlide {
  0%        { opacity: 0; transform: translateY(8px); }
  8%, 42%   { opacity: 1; transform: translateY(0);   }
  50%, 100% { opacity: 0; transform: translateY(-8px);}
}

/* Logo slider */
.eme-logo-slider { position: relative; overflow: hidden; }
.eme-logo-slide {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; /* ✅ FIX: إخفاء مبدئي */
  animation: emeNameSlide var(--eme-slider-dur, 8s) ease-in-out infinite;
}
.eme-logo-slide-1 { animation-delay: 0s; }
.eme-logo-slide-2 { animation-delay: calc(-1 * var(--eme-slider-dur, 8s) / 2); }
.eme-logo-slide .material-icons-round { color: #fff; font-size: 22px; }

/* ══════════════════════════════════════════════════════════════
   ✅ iOS OVERFLOW FIX — منع تجاوز الصفحة عرض الشاشة
   المشكلة: 3 عناصر كانت تتجاوز الـ viewport وتسبب horizontal shift
════════════════════════════════════════════════════════════════ */

/* ① زر العنوان في قسم التواصل — white-space:nowrap + نص طويل */
@media (max-width: 768px) {
  .eme-card.eme-section .eme-btn {
    white-space: normal;
    word-break: break-word;
    max-width: 100%;
    flex: 1 1 auto;
  }
  .eme-card.eme-section .eme-btn .material-icons-round {
    flex-shrink: 0;
  }
}

/* ② Quick Grid — minmax(0,1fr) يمنع columns من التوسع لحجم محتواها */
@media (max-width: 1024px) {
  .eme-quick-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

/* ③ Doctor Scroll + Shop Scroll — تأكيد الاحتواء الكامل */
@media (max-width: 1024px) {
  .eme-doctors-scroll,
  .eme-scroll-x {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }
  /* ✅ منع أي عنصر مباشر داخل الصفحة من تجاوز 100% */
  #eme-page > * {
    max-width: 100%;
    box-sizing: border-box;
  }
}

/* ④ الحماية الشاملة — containment على مستوى الصفحة */
#eme-page {
  overflow-x: hidden;
  position: relative;
}

/* ⑤ منع أي grid داخلي inline-style من الـ overflow */
@media (max-width: 640px) {
  [style*="grid-template-columns:repeat(2"] {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
  [style*="grid-template-columns: repeat(2"] {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
}


/* ═══ DARK MODE ═════════════════════════════════════════════════ */
@media (prefers-color-scheme: dark) {
  :root {
    --eme-bg: #0F172A;
    --eme-surface: #1E293B;
    --eme-surface-2: #0F172A;
    --eme-border: #334155;
    --eme-divider: #1E293B;
    --eme-text-1: #bdc3c7;
    --eme-text-2: #94A3B8;
    --eme-text-3: #64748B;
    --eme-primary-bg: rgba(0,191,165,0.12);
  }
  #eme-topbar, #eme-bottom-nav { background: rgba(30,41,59,0.97); }
  #eme-sidebar { background: #1E293B; border-color: #334155; }
}

/* ═══════════════════════════════════════════════════════════════
   ✅ v3.1 SURGICAL ADDITIONS
   1. Flutter Product Cards (.eme-fpc)
   2. Quick Booking Modal (#eme-qbook-overlay)
   3. Quick Booking item rows (.eme-qb-item / .eme-qb-dot)
═══════════════════════════════════════════════════════════════ */

/* ── 1. FLUTTER PRODUCT CARDS ──────────────────────────────────
   شكل Material / Flutter حقيقي مع elevation + badge + cart FAB
─────────────────────────────────────────────────────────────── */
.eme-fpc {
  flex-shrink: 0;
  width: 160px;
  border-radius: var(--eme-r-xl);
  background: var(--eme-surface);
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0,0,0,0.09);
  border: 1px solid var(--eme-border);
  text-decoration: none;
  color: var(--eme-text-1);
  display: flex;
  flex-direction: column;
  transition: transform 0.25s var(--eme-ease), box-shadow 0.25s var(--eme-ease);
  position: relative;
}
.eme-fpc:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 32px rgba(0,0,0,0.14);
}

/* Image container with gradient overlay */
.eme-fpc-img {
  position: relative;
  height: 130px;
  background: var(--eme-surface-2);
  overflow: hidden;
}
.eme-fpc-img img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.4s var(--eme-ease);
}
.eme-fpc:hover .eme-fpc-img img { transform: scale(1.06); }
.eme-fpc-img::after {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.3) 0%, transparent 55%);
  pointer-events: none;
}
.eme-fpc-no-img {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  font-size: 42px;
  background: var(--eme-primary-bg);
}

/* Sale & Rating chips overlaid on image */
.eme-fpc-badge-sale {
  position: absolute; top: 10px; right: 10px; z-index: 2;
  background: var(--eme-red);
  color: #fff;
  font-size: 10px; font-weight: 800;
  padding: 3px 9px;
  border-radius: var(--eme-r-pill);
  box-shadow: 0 2px 8px rgba(239,68,68,0.4);
}
.eme-fpc-badge-rtg {
  position: absolute; top: 10px; left: 10px; z-index: 2;
  background: rgba(0,0,0,0.55);
  color: #fff;
  font-size: 10px; font-weight: 700;
  padding: 3px 8px;
  border-radius: var(--eme-r-pill);
  backdrop-filter: blur(4px);
}

/* Body */
.eme-fpc-body {
  padding: 12px 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
  position: relative;
}
.eme-fpc-name {
  font-size: 13px; font-weight: 800;
  color: var(--eme-text-1);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.4;
}
.eme-fpc-price {
  font-size: 13px; font-weight: 900;
  color: var(--eme-primary-dark);
  line-height: 1;
}
.eme-fpc-price ins  { text-decoration: none; }
.eme-fpc-price del  { font-size: 11px; color: var(--eme-text-3); font-weight: 500; margin-right: 4px; }

/* Add-to-cart FAB button */
.eme-fpc-cart {
  position: absolute;
  bottom: 10px;
  left: 10px;
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--eme-primary-grad);
  border: none;
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--eme-shadow-teal);
  cursor: pointer;
  transition: transform 0.2s var(--eme-ease), box-shadow 0.2s var(--eme-ease);
  z-index: 2;
}
.eme-fpc-cart:hover  { transform: scale(1.12); box-shadow: 0 6px 20px rgba(0,191,165,0.5); }
.eme-fpc-cart:active { transform: scale(0.94); }
.eme-fpc-cart .material-icons-round { font-size: 18px; color: #fff; }

/* "View All" card at end of scroll */
.eme-fpc-more-card {
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 10px;
  background: var(--eme-primary-bg);
  border: 2px dashed var(--eme-primary);
  color: var(--eme-primary-dark);
  font-size: 13px; font-weight: 800;
  min-height: 200px;
}
.eme-fpc-more-card .material-icons-round { font-size: 32px; color: var(--eme-primary-dark); }

/* ── 2. QUICK BOOKING MODAL ────────────────────────────────────
   Bottom-sheet style — مستوحى من بورتال المريض
─────────────────────────────────────────────────────────────── */
#eme-qbook-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 8000;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  align-items: flex-end;
  justify-content: center;
}
#eme-qbook-overlay.open {
  display: flex;
  animation: qbFadeIn 0.2s var(--eme-ease);
}
@keyframes qbFadeIn { from { opacity: 0; } to { opacity: 1; } }

#eme-qbook-sheet {
  background: var(--eme-surface);
  border-radius: var(--eme-r-xl) var(--eme-r-xl) 0 0;
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: qbSlideUp 0.3s var(--eme-ease);
  box-shadow: 0 -8px 40px rgba(0,0,0,0.15);
}
@keyframes qbSlideUp { from { transform: translateY(40px); opacity:0; } to { transform: none; opacity:1; } }

.eme-qbook-handle {
  width: 40px; height: 4px;
  background: var(--eme-border);
  border-radius: 2px;
  margin: 12px auto 0;
  flex-shrink: 0;
}
.eme-qbook-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px 10px;
  flex-shrink: 0;
}
.eme-qbook-body {
  overflow-y: auto;
  padding: 14px 20px 32px;
  flex: 1;
  -webkit-overflow-scrolling: touch;
}

/* ── 3. QUICK BOOKING: Items / Progress ────────────────────── */
.eme-qb-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--eme-border);
  transition: all 0.2s var(--eme-ease);
  flex-shrink: 0;
}
.eme-qb-dot.active {
  width: 24px;
  border-radius: 4px;
  background: var(--eme-primary);
}
.eme-qb-dot.done { background: var(--eme-green); }

/* Item rows in modal (service / doctor) */
.eme-qb-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 13px 14px;
  border-radius: var(--eme-r-lg);
  border: 1.5px solid var(--eme-border);
  background: var(--eme-surface);
  cursor: pointer;
  font-family: inherit;
  text-align: right;
  width: 100%;
  transition: all 0.18s var(--eme-ease);
}
.eme-qb-item:hover  { border-color: var(--eme-primary); background: var(--eme-primary-bg); }
.eme-qb-item.selected { border-color: var(--eme-primary); background: var(--eme-primary-bg); }

.eme-qb-item-icon {
  width: 44px; height: 44px;
  border-radius: var(--eme-r-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}
.eme-qb-item-avatar {
  width: 44px; height: 44px;
  border-radius: 50%;
  background: var(--eme-primary-bg);
  color: var(--eme-primary-dark);
  font-weight: 900; font-size: 16px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
}
.eme-qb-item-info { flex: 1; min-width: 0; }
.eme-qb-item-name {
  font-size: 14px; font-weight: 800;
  color: var(--eme-text-1);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.eme-qb-item-sub {
  font-size: 12px; color: var(--eme-text-3);
  margin-top: 2px;
}

/* Desktop: modal centered instead of bottom-sheet */
@media (min-width: 600px) {
  #eme-qbook-overlay { align-items: center; }
  #eme-qbook-sheet {
    border-radius: var(--eme-r-xl);
    max-height: 85vh;
    margin: 20px;
  }
}

/* ── 4. STEP PANEL (booking page) ──────────────────────────── */
.eme-step-panel { animation: stepFadeIn 0.22s var(--eme-ease); }
@keyframes stepFadeIn { from { opacity:0; transform:translateY(8px); } to { opacity:1; transform:none; } }
/* ==================================================================
   🚀 التحديث الشامل النهائي للشاشات الصغيرة (Mobile Fix V5)
   الهدف: جعل جميع الأقسام تنقسم إلى نصفين (عمودين) بدون قص أو تمرير أفقي
================================================================== */
@media (max-width: 768px) {

  /* 1. ضبط الحاوية الرئيسية لمنع الخروج عن الشاشة */
  #eme-page {
    overflow-x: hidden !important;
    padding: 16px 12px calc(var(--eme-bottomnav) + 20px) !important;
  }

  /* 2. الأزرار السريعة (حجز موعد، ملفي..) -> شبكة من عمودين */
  .eme-quick-grid {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 10px !important;
  }
  .eme-quick-btn {
    width: 100% !important;
    padding: 14px 8px !important;
    height: auto !important;
  }
  .eme-quick-icon {
    width: 44px !important; height: 44px !important;
  }
  .eme-quick-label {
    white-space: normal !important; /* يسمح بنزول النص لسطر جديد */
    font-size: 13px !important;
    line-height: 1.4 !important;
  }

  /* 3. فريقنا الطبي -> إلغاء التمرير الأفقي وجعله شبكة من عمودين */
  .eme-doctors-scroll {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 10px !important;
    overflow: hidden !important;
  }
  .eme-doctor-card {
    width: 100% !important; /* التمدد لملء نصف الشاشة */
    margin: 0 !important;
    padding: 14px 8px !important;
  }
  .eme-doctor-avatar, .eme-doctor-initials {
    width: 60px !important; height: 60px !important;
    font-size: 18px !important;
  }

  /* 4. المتجر الطبي -> إلغاء التمرير الأفقي وجعله شبكة من عمودين */
  .eme-scroll-x {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 10px !important;
    overflow: hidden !important;
  }
  .eme-fpc {
    width: 100% !important; /* التمدد لملء نصف الشاشة */
    margin: 0 !important;
  }
  .eme-fpc-img { height: 120px !important; }
  .eme-fpc-name { font-size: 12px !important; white-space: normal !important; }

  /* 5. نظرة عامة (الإحصائيات) -> إجبارها على عمودين وتصغير الخط */
  div[style*="grid-template-columns:repeat(2,1fr)"],
  .eme-stats-grid {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 10px !important;
    width: 100% !important;
  }
  .eme-stat-card {
    padding: 14px 10px !important;
  }
  .eme-stat-num {
    font-size: 18px !important; /* تصغير الرقم ليتسع */
  }
  .eme-stat-lbl {
    font-size: 11px !important;
    white-space: normal !important; /* السماح بنزول النص */
  }

  /* 6. التخصصات الطبية -> شبكة من عمودين */
  .eme-services-chips {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 8px !important;
    overflow: hidden !important;
  }
  .eme-service-chip {
    width: 100% !important;
    min-width: 0 !important;
  }

  /* 7. أرقام التواصل في الأسفل -> ترتيب طولي لتجنب اختفاء الأرقام */
  div[style*="flex-wrap:wrap;gap:10px;padding:16px;"],
  .eme-contact-wrap {
    display: flex !important;
    flex-direction: column !important;
    padding: 14px !important;
    gap: 8px !important;
  }
  .eme-contact-wrap .eme-btn,
  div[style*="flex-wrap:wrap"] > .eme-btn {
    width: 100% !important;
    justify-content: center !important;
    font-size: 14px !important;
  }
}
/* إصلاح لون أيقونة زر البحث لتكون مرئية (ليست بيضاء على خلفية بيضاء) */
.eme-hero-search-btn .material-icons-round {
  color: var(--eme-primary-dark) !important;
}