/* ════════════════════════════════════════════════
   موعد — CSS لوحة الإدارة
   Mobile-First | RTL | Cairo Font
   ════════════════════════════════════════════════ */

/* ─── 1. متغيرات ──────────────────────────────── */
:root {
  /* ألوان أساسية */
  --primary:        #1B6B5A;
  --primary-light:  #2A8A75;
  --primary-xlight: #E6F4F0;
  --secondary:      #C9A84C;

  /* خلفيات */
  --bg:             #F0F4F2;
  --bg-card:        #FFFFFF;
  --bg-subtle:      #F7FAF8;

  /* Sidebar — أفتح وأوضح */
  --sidebar-bg:     #16503F;
  --sidebar-top:    #0F3D2F;
  --sidebar-hover:  rgba(255,255,255,.09);
  --sidebar-active: rgba(255,255,255,.14);
  --sidebar-border: rgba(255,255,255,.1);

  /* نصوص */
  --text:           #18302A;
  --text-muted:     #5A7A6E;

  /* حدود وظلال */
  --border:         #D8EDE6;
  --border-hard:    #B8D8CE;
  --shadow:         rgba(27,107,90,.07);
  --shadow-md:      rgba(27,107,90,.14);
  --shadow-lg:      rgba(27,107,90,.2);

  /* حالات */
  --danger:         #E53E3E;
  --success:        #2F9E63;
  --warning:        #C88A1A;
  --info:           #2B7FC2;

  /* شكل */
  --radius:         10px;
  --radius-lg:      16px;
  --trans:          .2s ease;
  --sidebar-w:      232px;
  --heading:        var(--text);
  --table-border:   #e5e7eb;
  --table-even:     #f9fafb;
  --table-hover:    #ecfdf5;
  --table-handled:  #f9f9f9;
  --table-handled-hover: #f3f3f3;
}

/* ── الثيم الداكن ── */
html.dark-theme {
  --bg:             #0E1620;
  --bg-card:        #19232F;
  --bg-subtle:      #141D29;
  --text:           #EAE7E1;
  --text-muted:     #9AA7B8;
  --border:         rgba(255,255,255,.08);
  --border-hard:    rgba(255,255,255,.16);
  --shadow:         rgba(0,0,0,.35);
  --shadow-md:      rgba(0,0,0,.45);
  --shadow-lg:      rgba(0,0,0,.55);
  --primary-xlight: rgba(42,138,117,.15);
  --heading:        #F3F0EA;
  --table-border:   rgba(255,255,255,.08);
  --table-even:     #141D29;
  --table-hover:    rgba(47,158,99,.12);
  --table-handled:  #161F2A;
  --table-handled-hover: #1c2731;
}

/* ─── 2. Reset ────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html  { scroll-behavior: smooth; }
body  {
  overflow-x: hidden;
  font-family: 'Cairo', sans-serif;
  background: var(--bg);
  color: var(--text);
  direction: rtl;
  text-align: right;
  -webkit-font-smoothing: antialiased;
  transition: background .35s ease, color .35s ease;
}
a       { color: inherit; text-decoration: none; }
button  { cursor: pointer; border: none; background: none; font-family: inherit; }
ul      { list-style: none; }

/* ─── 3. Buttons ──────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .45rem;
  padding: .6rem 1.4rem;
  border-radius: var(--radius);
  font-family: 'Cairo', sans-serif;
  font-size: .92rem;
  font-weight: 600;
  transition: all var(--trans);
  white-space: nowrap;
  cursor: pointer;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-light); transform: translateY(-1px);
                     box-shadow: 0 5px 16px var(--shadow-md); }
.btn-outline { background: transparent; color: var(--primary);
               border: 2px solid var(--primary); }
.btn-outline:hover { background: var(--primary-xlight); }
.btn-danger  { background: var(--danger); color: #fff; }
.btn-danger:hover  { background: #c53030; }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #2f855a; }
.btn-large   { padding: .85rem 2rem; font-size: 1rem; }
.btn-full    { width: 100%; }
.btn-sm      { padding: .35rem .9rem; font-size: .82rem; }
.btn:disabled{ opacity: .5; cursor: not-allowed; transform: none !important; }

/* ─── 4. صفحة تسجيل الدخول ──────────────────── */
.auth-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(150deg, #0A2E23 0%, #1B6B5A 55%, #22876C 100%);
  padding: 1.5rem;
}
.auth-box {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 2.5rem 2rem;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 20px 60px rgba(0,0,0,.25);
}
.auth-logo {
  text-align: center;
  margin-bottom: 2rem;
}
.auth-logo-img {
  width: 56px; height: 56px; border-radius: 12px;
  object-fit: cover; display: block; margin: 0 auto .75rem;
}
.auth-logo-title { font-size: 1.75rem; font-weight: 800; color: var(--primary); }
.auth-logo-sub   { color: var(--text-muted); font-size: .88rem; margin-top: .2rem; }
.auth-error {
  background: rgba(229,62,62,.08);
  border: 1px solid rgba(229,62,62,.3);
  color: var(--danger);
  padding: .55rem .9rem;
  border-radius: var(--radius);
  font-size: .85rem;
  margin-bottom: 1rem;
}

/* ─── 5. تخطيط لوحة الإدارة ─────────────────── */
.admin-layout {
  display: flex;
  min-height: 100vh;
  direction: rtl;
}

/* ─── 6. Sidebar ──────────────────────────────── */
.admin-sidebar {
  width: var(--sidebar-w);
  background: linear-gradient(180deg, var(--sidebar-top) 0%, var(--sidebar-bg) 100%);
  color: #fff;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  z-index: 200;
  box-shadow: -2px 0 20px rgba(0,0,0,.18);
}
.admin-content {
  flex: 1;
  min-width: 0;
  overflow-y: auto;
}
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: 1.25rem 1rem 1rem;
  border-bottom: 1px solid var(--sidebar-border);
}

.sidebar-brand-img {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  object-fit: cover;
  flex-shrink: 0;
}

.sidebar-brand-name { font-size: 1rem; font-weight: 700; }
.sidebar-brand-sub  { font-size: .72rem; opacity: .6; }

.sidebar-nav {
  flex: 1;
  padding: .75rem 0;
  overflow-y: auto;
}
.nav-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: .65rem;
  padding: .75rem 1rem;
  font-size: .9rem;
  font-weight: 600;
  color: rgba(255,255,255,.82);
  transition: all var(--trans);
  text-align: right;
  border-right: 3px solid transparent;
  position: relative;
}
.nav-btn:hover  { background: var(--sidebar-hover); color: #fff; }
.nav-btn.active {
  background: var(--sidebar-active);
  color: #fff;
  border-right-color: var(--secondary);
  font-weight: 700;
}
.nav-btn.active .nav-btn-icon { color: var(--secondary); }
.nav-btn-icon { font-size: 1.05rem; flex-shrink: 0; }
.nav-badge {
  margin-right: auto;
  background: var(--danger);
  color: #fff;
  font-size: .72rem;
  font-weight: 700;
  min-width: 20px;
  height: 20px;
  border-radius: 50px;
  display: flex; align-items: center; justify-content: center;
  padding: 0 5px;
}

.sidebar-footer {
  border-top: 1px solid rgba(255,255,255,.08);
  padding: .9rem 1rem;
}
.sidebar-user {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-size: .8rem;
  opacity: .75;
  margin-bottom: .6rem;
  overflow: hidden;
}
.sidebar-user-email { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.logout-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .5rem .75rem;
  background: rgba(229,62,62,.12);
  color: rgba(255,255,255,.8);
  border-radius: var(--radius);
  font-size: .87rem;
  font-weight: 600;
  transition: all var(--trans);
}
.logout-btn:hover { background: rgba(229,62,62,.25); color: #fff; }

/* ─── 7. المحتوى الرئيسي ─────────────────────── */
.admin-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-width: 0;
}

/* ─── 8. Topbar ───────────────────────────────── */
.admin-topbar {
  background: var(--bg-card);
  border-bottom: 2px solid var(--border);
  padding: .75rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 16px var(--shadow);
  min-height: 58px;
}
.mobile-menu-btn {
  font-size: 1.25rem;
  color: var(--text-muted);
  display: none;
}
.topbar-title  { font-size: 1rem; font-weight: 800; flex: 1; color: var(--text); }
.topbar-right  { display: flex; align-items: center; gap: .75rem; }
.topbar-clinic { font-size: .82rem; color: var(--text-muted); }

/* ─── 9. صفحات ───────────────────────────────── */
.admin-page {
  display: none;
  padding: 1.25rem 1rem;
  flex: 1;
  max-width: 100%;
}
.admin-page.active { display: block; }

/* ─── 10. بطاقات الإحصاء ────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px,1fr));
  gap: 1.1rem;
  margin-bottom: 1.75rem;
}
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  box-shadow: 0 2px 10px var(--shadow);
  transition: box-shadow var(--trans);
  border-top: 3px solid var(--primary);
}
.stat-card:hover { box-shadow: 0 4px 18px var(--shadow-md); }
.stat-icon-wrap {
  width: 52px; height: 52px;
  border-radius: var(--radius);
  background: var(--primary-xlight);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem;
  flex-shrink: 0;
}
.stat-icon--blue   { background: rgba(49,130,206,.1); }
.stat-icon--yellow { background: rgba(214,158,46,.1); }
.stat-icon--green  { background: rgba(56,161,105,.1); }
.stat-label { font-size: .8rem; color: var(--text-muted); font-weight: 500; margin-bottom: .2rem; }
.stat-value { font-size: 1.85rem; font-weight: 900; color: var(--text); line-height: 1; }

/* ─── 11. بطاقات الإدارة ────────────────────── */
.admin-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: 0 2px 16px var(--shadow);
  margin-bottom: 1.5rem;
  transition: box-shadow var(--trans);
}
.admin-card:hover { box-shadow: 0 4px 24px var(--shadow-md); }
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  gap: 1rem;
  flex-wrap: wrap;
}
.card-title { font-size: 1.05rem; font-weight: 700; margin-bottom: .4rem; }
.card-desc  { color: var(--text-muted); font-size: .87rem; margin-bottom: 1.25rem; }

/* ─── 12. فلاتر ───────────────────────────────── */
.filter-tabs {
  display: flex;
  gap: .35rem;
  flex-wrap: wrap;
}
.filter-tab {
  padding: .35rem .9rem;
  border-radius: 50px;
  font-size: .82rem;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--bg);
  border: 1px solid var(--border);
  transition: all var(--trans);
  font-family: 'Cairo', sans-serif;
}
.filter-tab:hover  { border-color: var(--primary); color: var(--primary); }
.filter-tab.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ─── 13. جدول الحجوزات ─────────────────────── */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}
.bookings-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .86rem;
  min-width: 700px;
}
.bookings-table th {
  background: var(--bg);
  padding: .75rem 1rem;
  font-weight: 700;
  color: var(--text-muted);
  text-align: right;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.bookings-table td {
  padding: .75rem 1rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.bookings-table tr:last-child td { border-bottom: none; }
.bookings-table tr:hover td { background: var(--bg); }

/* الصف المعالج */
.bookings-table tr.handled td {
  color: var(--text);
  text-decoration: line-through;
  text-decoration-color: rgba(0,0,0,.5);
  background: rgba(0,0,0,.015);
  opacity: 1;
}
.bookings-table tr.handled:hover td { background: rgba(0,0,0,.03); }

/* شارة الحالة في الجدول */
.status-pill {
  display: inline-block;
  padding: .2rem .7rem;
  border-radius: 50px;
  font-size: .78rem;
  font-weight: 700;
}
.status-pill.pending { background: rgba(214,158,46,.12); color: var(--warning); }
.status-pill.handled { background: rgba(56,161,105,.1);  color: var(--success); }

/* زر المعالجة */
.handle-btn {
  padding: .3rem .8rem;
  border-radius: var(--radius);
  font-size: .8rem;
  font-weight: 600;
  background: var(--primary-xlight);
  color: var(--primary);
  border: 1px solid var(--border);
  transition: all var(--trans);
  font-family: 'Cairo', sans-serif;
  cursor: pointer;
  white-space: nowrap;
}
.handle-btn:hover { background: var(--primary); color: #fff; }

/* حالة فارغة */
.empty-state {
  text-align: center;
  color: var(--text-muted);
  padding: 2rem;
  font-size: .9rem;
}

/* ─── 14. إدارة حالة العيادة ────────────────── */
.mode-selector {
  display: flex;
  gap: .75rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}
.mode-opt { cursor: pointer; }
.mode-opt input { display: none; }
.mode-opt-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .35rem;
  padding: 1rem 1.5rem;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  transition: all var(--trans);
  min-width: 100px;
}
.mode-opt:has(input:checked) .mode-opt-body {
  border-color: var(--primary);
  background: var(--primary-xlight);
}
.mode-opt-icon  { font-size: 1.5rem; }
.mode-opt-label { font-size: .85rem; font-weight: 700; color: var(--text); }

.mode-panel { margin-bottom: 1.25rem; }
.panel-hint { color: var(--text-muted); font-size: .88rem; margin-bottom: 1rem; }

.manual-btns {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

/* جدول الجلسات */
.sessions-config { display: flex; flex-direction: column; gap: .75rem; margin-bottom: 1.25rem; }
.session-row     { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.session-row-label {
  font-size: .88rem;
  font-weight: 600;
  min-width: 170px;
  flex-shrink: 0;
}
.session-row-label small { color: var(--text-muted); font-weight: 400; }
.time-pair   { display: flex; align-items: center; gap: .5rem; }
.time-field  { width: 115px; text-align: center; }
.time-sep    { color: var(--text-muted); font-size: .85rem; flex-shrink: 0; }

/* أيام العمل */
.days-selector { display: flex; gap: .5rem; flex-wrap: wrap; }
.day-opt {
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: .35rem;
  padding: .4rem .85rem;
  border: 1.5px solid var(--border);
  border-radius: 50px;
  font-size: .83rem;
  font-weight: 600;
  transition: all var(--trans);
  user-select: none;
}
.day-opt:has(input:checked) {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.day-opt input { display: none; }

/* العطلة */
.vacation-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }

/* ملاحظة الحفظ */
.card-actions { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; margin-top: 1.25rem; }
.save-feedback {
  font-size: .85rem;
  font-weight: 600;
  transition: opacity .3s;
}
.save-feedback.success { color: var(--success); }
.save-feedback.error   { color: var(--danger); }

/* ─── 15. حقول ────────────────────────────────── */
.field-group    { margin-bottom: 1.1rem; }
.field-label    { display: block; font-size: .88rem; font-weight: 600; margin-bottom: .38rem; }
.field-input,
.field-textarea {
  width: 100%;
  padding: .6rem .9rem;
  border: 2px solid #9ca3af;
  border-radius: var(--radius);
  font-family: 'Cairo', sans-serif;
  font-size: .9rem;
  color: var(--text);
  background: var(--bg);
  direction: rtl;
  transition: border-color var(--trans);
}
.field-input:focus,
.field-textarea:focus {
  outline: none;
  border-color: var(--primary);
  background: var(--bg-card);
  box-shadow: 0 0 0 3px rgba(var(--primary-rgb, 22,101,52), .12);
}
.field-textarea { resize: vertical; min-height: 100px; line-height: 1.65; }

/* ─── 16. Modal ──────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.52);
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  backdrop-filter: blur(4px);
}
.modal-box {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 500px;
  max-height: 88vh;
  overflow-y: auto;
  animation: fadeIn .22s ease;
}
@media (max-width: 520px) {
  .modal-box {
    max-width: calc(100% - 1.5rem);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    margin-bottom: 0;
    position: fixed;
    bottom: 0;
    left: .75rem;
    right: .75rem;
    max-height: 90vh;
  }
  .modal-overlay {
    padding: 0;
    align-items: flex-end;
  }
  .detail-key { min-width: 100px; font-size: .82rem; }
  .admin-page { padding: 1rem .75rem; }
}
@keyframes fadeIn {
  from { transform: scale(.96); opacity: 0; }
  to   { transform: scale(1);   opacity: 1; }
}
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.1rem 1.5rem;
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0;
  background: var(--bg-card);
}
.modal-title     { font-size: 1.05rem; font-weight: 700; }
.modal-close-btn { font-size: 1.1rem; color: var(--text-muted); padding: .2rem .4rem; }
.modal-close-btn:hover { color: var(--danger); }
.modal-body      { padding: 1.5rem; }

/* تفاصيل الحجز في المودال */
.detail-row {
  display: flex;
  gap: .75rem;
  align-items: flex-start;
  padding: .65rem 0;
  border-bottom: 1px solid var(--border);
  font-size: .9rem;
}
.detail-row:last-child { border-bottom: none; }
.detail-key   { color: var(--text-muted); font-weight: 600; min-width: 130px; flex-shrink: 0; }
.detail-val   { font-weight: 600; }

/* ─── 17. شريط PWA ────────────────────────────── */
.pwa-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg-card, #fff);
  border-top: 1px solid var(--border, #e0ede8);
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  z-index: 999;
  box-shadow: 0 -4px 24px rgba(0,0,0,0.08);
}
.pwa-install-btn {
  flex: 1;
  font-weight: 600;
  letter-spacing: 0.01em;
}
.pwa-close-btn {
  background: none;
  border: none;
  font-size: 1.1rem;
  cursor: pointer;
  color: var(--text-muted);
  padding: 0.25rem;
  line-height: 1;
}
.pwa-close-btn:hover { color: var(--danger); }

/* ─── 18. Responsive ──────────────────────────── */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 999;
  -webkit-tap-highlight-color: transparent;
}
.sidebar-overlay.active { display: block; }

@media (max-width: 900px) {
  :root { --sidebar-w: 280px; }
  .admin-layout {
    display: block;
  }
  .admin-sidebar {
    position: fixed;
    top: 0;
    right: -300px;
    width: 280px;
    height: 100vh;
    z-index: 1000;
    transition: right 0.3s ease;
    overflow-y: auto;
    box-shadow: none;
  }
  .admin-sidebar.open {
    right: 0;
    box-shadow: -8px 0 40px rgba(0,0,0,.35);
  }
  .admin-content {
    width: 100%;
    min-width: 0;
  }
  .mobile-menu-btn { display: block; }
}
@media (max-width: 768px) {
  .table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .bookings-table {
    min-width: 600px;
  }
}
@media (max-width: 600px) {
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .vacation-grid { grid-template-columns: 1fr; }
  .session-row  { flex-direction: column; align-items: flex-start; }
  .mode-selector { flex-direction: row; }
  .admin-page   { padding: 1.25rem 1rem; }
}

/* ─── 19. عناصر المرحلة 4 ──────────────────── */

/* آخر الحجوزات في الداشبورد */
.recent-booking-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: .85rem 1rem;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background var(--trans);
  border-radius: var(--radius);
}
.recent-booking-row:last-child { border-bottom: none; }
.recent-booking-row:hover { background: var(--bg); }

.rb-num {
  font-size: 1rem;
  font-weight: 800;
  color: var(--primary);
  min-width: 36px;
  text-align: center;
  background: var(--primary-xlight);
  border-radius: 50%;
  width: 36px;
  height: 36px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.rb-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: .1rem;
  min-width: 0;
}
.rb-name    { font-weight: 700; font-size: .9rem;
              white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rb-service { font-size: .78rem; color: var(--text-muted); }
.rb-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: .2rem;
  flex-shrink: 0;
}
.rb-date { font-size: .72rem; color: var(--text-muted); }

/* جدول الحجوزات — صف المعالَج */
.bookings-table tr.handled td {
  color: var(--text-muted);
  text-decoration: line-through;
  text-decoration-color: rgba(107,128,112,.4);
}
.bookings-table tr.handled:hover td { background: rgba(0,0,0,.02); }

/* علامة الإنجاز */
.done-check {
  color: var(--success);
  font-size: .85rem;
  font-weight: 600;
}

/* روابط الهاتف في الجدول */
.bookings-table a {
  color: var(--primary);
  font-weight: 600;
}
.bookings-table a:hover { text-decoration: underline; }

/* مودال التفاصيل */
.detail-row {
  display: flex;
  gap: 1rem;
  padding: .7rem 0;
  border-bottom: 1px solid var(--border);
  font-size: .9rem;
  align-items: flex-start;
}
.detail-row:last-of-type { border-bottom: none; }
.detail-key {
  color: var(--text-muted);
  font-weight: 600;
  min-width: 140px;
  flex-shrink: 0;
  font-size: .85rem;
}
.detail-val { font-weight: 600; flex: 1; }

/* ════════════════════════════════════════════
   نظام الجدولين — معلق / منتهي
════════════════════════════════════════════ */

/* زر التراجع */
.undo-btn {
  padding: .3rem .8rem;
  border-radius: var(--radius);
  font-size: .8rem;
  font-weight: 600;
  background: rgba(214,158,46,.1);
  color: #b7791f;
  border: 1px solid rgba(214,158,46,.3);
  transition: all var(--trans);
  font-family: 'Cairo', sans-serif;
  cursor: pointer;
  white-space: nowrap;
}
.undo-btn:hover { background: rgba(214,158,46,.2); }

/* قسم المنتهية القابل للطي */
.handled-section {
  margin-bottom: 1.5rem;
}
.handled-section-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .9rem 1.25rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  cursor: pointer;
  font-weight: 700;
  font-size: .95rem;
  color: var(--text-muted);
  list-style: none;
  transition: background var(--trans);
  user-select: none;
}
.handled-section[open] .handled-section-summary {
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
  border-bottom-color: transparent;
  background: var(--bg);
}
.handled-section-summary::-webkit-details-marker { display: none; }
.handled-section-summary:hover { background: var(--bg); }
.handled-arrow { font-size: .85rem; transition: transform .2s; }
.handled-section[open] .handled-arrow { transform: rotate(180deg); }

.handled-card {
  border-top-left-radius: 0 !important;
  border-top-right-radius: 0 !important;
  margin-bottom: 0 !important;
}

/* الصفوف المنتهية مشطوبة */
.bookings-table tr.handled td {
  color: var(--text-muted);
  text-decoration: line-through;
  text-decoration-color: rgba(107,128,112,.4);
  background: rgba(0,0,0,.012);
}
.bookings-table tr.handled:hover td { background: rgba(0,0,0,.025); }

/* ════════════════════════════════════════════
   الحجوزات كـ cards على الهاتف
════════════════════════════════════════════ */
@media (max-width: 640px) {
  .stats-grid { grid-template-columns: 1fr 1fr; gap: .75rem; }
  .stat-card { padding: 1rem; }
  .stat-value { font-size: 1.5rem; }

  .table-wrap { border: none; border-radius: 0; overflow: visible; }

  /* ─── نقطة 10: إلغاء min-width من 768px block ─ */
  .bookings-table { min-width: 0; }

  .bookings-table thead { display: none; }

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

  .bookings-table tr {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: .75rem;
    padding: .9rem 1rem;
    box-shadow: 0 1px 6px var(--shadow);
    position: relative;
  }

  .bookings-table tr.handled {
    opacity: 1;
  }

  .bookings-table td {
    padding: .2rem 0;
    border: none;
    font-size: .87rem;
  }

  /* ─── نقطة 10: عناوين البيانات من data-label ─── */
  .bookings-table td::before {
    content: attr(data-label);
    display: block;
    font-size: .72rem;
    font-weight: 700;
    color: var(--text-muted);
    margin-bottom: .1rem;
  }

  /* إخفاء الـ td الفارغة */
  .bookings-table td:empty { display: none; }

  /* الرقم — بارز في الزاوية */
  .bookings-table td:first-child {
    font-size: 1rem;
    font-weight: 800;
    color: var(--primary);
    margin-bottom: .3rem;
  }

  /* زر الإجراء يأخذ العرض الكامل */
  .bookings-table td:last-child {
    margin-top: .6rem;
    padding-top: .6rem;
    border-top: 1px solid var(--border);
  }
  .handle-btn, .undo-btn {
    width: 100%;
    text-align: center;
    padding: .5rem;
  }
}

/* ─── إصلاحات موبايل إضافية ─────────────────── */
@media (max-width: 400px) {
  :root { --sidebar-w: 100%; }
  .admin-page { padding: .9rem .6rem; }
  .stats-grid { grid-template-columns: 1fr 1fr; gap: .6rem; }
  .stat-card { padding: .85rem .75rem; gap: .75rem; }
  .stat-icon-wrap { width: 40px; height: 40px; font-size: 1.2rem; }
  .admin-topbar { padding: .65rem 1rem; }
  .topbar-title { font-size: .92rem; }
  .card-title { font-size: .95rem; }
  .filter-tab { padding: .3rem .7rem; font-size: .78rem; }
  .vacation-grid { grid-template-columns: 1fr; }
  .session-row { flex-direction: column; }
}

/* ─── زر الإشعارات في Topbar ─────────────────── */
.notif-toggle-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--primary-xlight);
  border: 1.5px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  cursor: pointer;
  transition: all var(--trans);
  flex-shrink: 0;
}
.notif-toggle-btn:hover { background: var(--border); }
.notif-toggle-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  filter: none;
}
.notif-toggle-btn.denied {
  opacity: .4;
  cursor: not-allowed;
}

/* زر تبديل الثيم */
.theme-toggle-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--primary-xlight);
  border: 1.5px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  cursor: pointer;
  transition: all var(--trans);
  flex-shrink: 0;
}
.theme-toggle-btn:hover { background: var(--border); transform: rotate(15deg); }
.theme-toggle-btn .icon-moon { display: none; }
html.dark-theme .theme-toggle-btn .icon-sun  { display: none; }
html.dark-theme .theme-toggle-btn .icon-moon { display: block; }

/* ─── شريط بحث الحجوزات ── المهمة 11 ─────────── */
.bookings-toolbar {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  flex-wrap: wrap;
}
@media (max-width: 600px) {
  .bookings-toolbar { flex-direction: column; }
  .bookings-toolbar .field-input,
  .bookings-toolbar .btn { width: 100%; }
}

/* ─── شبكة الرسوم البيانية ── المهمة 12 ──────── */
.stats-charts-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-top: 1rem;
}
@media (max-width: 768px) {
  .stats-charts-grid { grid-template-columns: 1fr; }
}

/* ─── نقطة 11: رفع صورة الطبيب ──────────────── */
.photo-upload-wrap {
  display: flex;
  flex-direction: column;
  gap: .75rem;
}
.photo-preview {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  border: 2px dashed var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: var(--bg);
  font-size: .78rem;
  color: var(--text-muted);
  text-align: center;
}
.photo-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.photo-upload-label {
  cursor: pointer;
  width: fit-content;
}

/* ─── نقطة 14: معرض الإدارة ──────────────────── */
.gallery-admin-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: .75rem 0;
  border-bottom: 1px solid var(--border);
}
.gallery-admin-item:last-child { border-bottom: none; }
.gallery-admin-imgs {
  display: flex;
  align-items: center;
  gap: .5rem;
  flex: 1;
}
.gallery-admin-imgs img {
  width: 90px;
  height: 90px;
  object-fit: cover;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}
.gallery-admin-arrow {
  color: var(--text-muted);
  font-size: 1.2rem;
}
.gallery-admin-caption {
  font-size: .85rem;
  color: var(--text-muted);
  min-width: 80px;
}
.btn-sm {
  padding: .3rem .75rem;
  font-size: .8rem;
}

/* ─── جدول Google Sheets ────────────────────────── */
.table-scroll-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.gs-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .85rem;
  min-width: 520px;
  table-layout: fixed;
}
.gs-table thead {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--sidebar-bg);
}
.gs-table th {
  padding: .55rem .75rem;
  text-align: right;
  font-weight: 600;
  color: var(--text-muted);
  border-bottom: 2px solid var(--border);
  border-left: 1px solid var(--border);
  white-space: nowrap;
  font-size: .8rem;
  letter-spacing: .02em;
}
.gs-table th:last-child { border-left: none; }
.gs-table td {
  padding: .5rem .75rem;
  border-bottom: 1px solid var(--border);
  border-left: 1px solid var(--border);
  vertical-align: middle;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.gs-table td:last-child { border-left: none; }
.gs-table tbody tr:hover td { background: var(--bg); }
.gs-table tbody tr.handled td { opacity: 1; text-decoration: line-through; text-decoration-color: rgba(120,120,120,.5); color: var(--text); background: var(--table-handled); }

/* عرض الأعمدة */
.col-num     { width: 52px; text-align: center; }
.col-name    { width: 140px; }
.col-phone   { width: 120px; }
.col-service { width: 150px; }
.col-date    { width: 110px; color: var(--text-muted); font-size: .78rem; }
.col-action  { width: 130px; }

/* col-name: no sticky */

/* ─── Gallery upload ────────────────────────────── */
.gallery-upload-wrap {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: .6rem;
}
.gallery-preview {
  width: 120px;
  height: 120px;
  border-radius: var(--radius);
  border: 2px dashed var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: var(--bg);
  font-size: .72rem;
  color: var(--text-muted);
  text-align: center;
  flex-shrink: 0;
}
.gallery-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ═══ جدول Google Sheets ═══════════════════════ */
.table-scroll-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.gs-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .85rem;
  min-width: 500px;
  table-layout: fixed;
}
.gs-table thead {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #f1f5f1;
}
.gs-table th {
  padding: .6rem .75rem;
  text-align: right;
  font-weight: 700;
  color: #374151;
  border-bottom: 2px solid var(--primary);
  border-left: 1px solid #d1d5db;
  white-space: nowrap;
  font-size: .8rem;
  background: #f1f5f1;
}
.gs-table th:last-child { border-left: none; }
.gs-table td {
  padding: .5rem .75rem;
  border-bottom: 1px solid var(--table-border);
  border-left: 1px solid var(--table-border);
  vertical-align: middle;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  background: var(--bg-card);
}
.gs-table td:last-child { border-left: none; }
.gs-table tbody tr:nth-child(even) td { background: var(--table-even); }
.gs-table tbody tr:hover td { background: var(--table-hover) !important; }
.gs-table tbody tr.handled td { opacity: 1; text-decoration: line-through; text-decoration-color: rgba(120,120,120,.5); color: var(--text); background: var(--table-handled); }
.gs-table tbody tr.handled:hover td { background: var(--table-handled-hover); }
.col-num     { width: 50px;  text-align: center; }
.col-name    { width: 130px; }
.col-phone   { width: 120px; }
.col-service { width: 140px; }
.col-date    { width: 100px; color: #6b7280; font-size: .78rem; }
.col-action  { width: 130px; }


/* ═══ Gallery upload ════════════════════════════ */
.gallery-upload-wrap {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: .6rem;
}
.gallery-preview {
  width: 80px; height: 80px;
  border-radius: var(--radius);
  border: 2px dashed var(--border);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
  background: var(--bg);
  font-size: .72rem; color: var(--text-muted); text-align: center;
  flex-shrink: 0;
}
.gallery-preview img { width: 100%; height: 100%; object-fit: cover; }

/* ═══ photo-upload-wrap ════════════════════════ */
.photo-upload-wrap { display: flex; flex-direction: column; gap: .75rem; }
.photo-preview {
  width: 100px; height: 100px; border-radius: 50%;
  border: 2px dashed var(--border);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden; background: var(--bg);
  font-size: .78rem; color: var(--text-muted); text-align: center;
}
.photo-preview img { width: 100%; height: 100%; object-fit: cover; }
.photo-upload-label { cursor: pointer; width: fit-content; }
.btn-danger { background: #fee2e2; color: #b91c1c; border: 1px solid #fca5a5; }
.btn-danger:hover { background: #fca5a5; }

/* ═══ إلغاء card-mode للـ gs-table ════════════ */
@media (max-width: 640px) {
  .gs-table { min-width: 500px !important; }
  .gs-table thead { display: table-header-group !important; }
  .gs-table,
  .gs-table tbody,
  .gs-table tr,
  .gs-table td { display: revert !important; width: revert !important; }
  .gs-table tr { background: unset !important; border: none !important; border-radius: 0 !important; margin-bottom: 0 !important; padding: 0 !important; box-shadow: none !important; }
  .gs-table td { padding: .5rem .75rem !important; border-bottom: 1px solid #e5e7eb !important; border-left: 1px solid #e5e7eb !important; }
  .gs-table td::before { display: none !important; }
  .gs-table td:last-child { border-left: none !important; margin-top: 0 !important; padding-top: .5rem !important; border-top: none !important; }
  .handle-btn, .undo-btn { width: auto; }
}

/* ─── field-hint ──────────────────────────────── */
.field-hint {
  font-size: .82rem;
  color: var(--text-muted);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .5rem .75rem;
}

/* ─── handle/undo buttons في الجدول ─────────── */
.handle-btn,
.undo-btn {
  padding: .3rem .7rem;
  font-size: .78rem;
  border-radius: 6px;
  cursor: pointer;
  border: 1px solid;
  white-space: nowrap;
  font-family: 'Cairo', sans-serif;
}
.handle-btn {
  background: #dcfce7;
  color: #166534;
  border-color: #86efac;
}
.handle-btn:hover { background: #bbf7d0; }
.undo-btn {
  background: #f3f4f6;
  color: #6b7280;
  border-color: #d1d5db;
}
.undo-btn:hover { background: #e5e7eb; }

/* ─── إخفاء اسم العيادة في topbar على الموبايل ── */
@media (max-width: 640px) {
  .topbar-clinic { display: none; }
  .topbar-title { font-size: .88rem; }
}

/* ─── FAQ admin ───────────────────────────────── */
.faq-admin-item {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  padding: .85rem 0;
  border-bottom: 1px solid var(--border);
}
.faq-admin-item:last-child { border-bottom: none; }
.faq-admin-content { flex: 1; }
.faq-admin-q { font-size: .9rem; color: var(--text); margin-bottom: .25rem; }
.faq-admin-a { font-size: .82rem; color: var(--text-muted); line-height: 1.5; }

/* ─── FAQ edit mode ───────────────────────────── */
.faq-admin-edit {
  display: flex;
  flex-direction: column;
  gap: .5rem;
  flex: 1;
}

/* ─── إدارة الخدمات ──────────────────────────── */
.service-admin-item {
  display: flex;
  align-items: flex-start;
  gap: .75rem;
  padding: .85rem 0;
  border-bottom: 1px solid var(--border);
}
.service-admin-item:last-child { border-bottom: none; }
.service-admin-item.inactive { opacity: .5; }
.service-admin-content { flex: 1; }
.service-admin-name { font-size: .9rem; font-weight: 700; color: var(--text); margin-bottom: .25rem; }
.service-admin-desc { font-size: .82rem; color: var(--text-muted); line-height: 1.5; }
.service-admin-actions { display: flex; gap: .4rem; margin-top: .5rem; flex-wrap: wrap; align-items: center; }
.service-admin-order { display: flex; flex-direction: column; gap: .2rem; }
.order-btn {
  width: 26px; height: 22px;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-subtle, var(--bg));
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: .75rem;
  color: var(--text-muted);
  cursor: pointer;
  transition: background var(--trans);
}
.order-btn:hover { background: var(--border); }
.order-btn:disabled { opacity: .3; cursor: not-allowed; }

/* مفتاح تبديل (Active/Inactive) */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 42px; height: 24px;
  flex-shrink: 0;
}
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute; inset: 0;
  background: var(--border-hard);
  border-radius: 24px;
  cursor: pointer;
  transition: background var(--trans);
}
.toggle-slider::before {
  content: '';
  position: absolute;
  width: 18px; height: 18px;
  right: 3px; top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform var(--trans);
}
.toggle-switch input:checked + .toggle-slider { background: var(--success); }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(-18px); }

/* ─── FAQ edit mode ───────────────────────────── */
.faq-admin-edit {
  display: flex;
  flex-direction: column;
  gap: .5rem;
  flex: 1;
}

/* ════════════════════════════════════════════════ */
/*  لوحة المالك (mawid-owner) — أنماط خاصّة          */
/* ════════════════════════════════════════════════ */
.owner-main {
  max-width: 880px;
  margin: 0 auto;
  padding: 1.5rem 1rem 4rem;
}
.owner-badge {
  display: inline-block;
  font-size: .7rem;
  font-weight: 700;
  padding: .12rem .5rem;
  border-radius: 999px;
  margin-inline-start: .4rem;
  vertical-align: middle;
}
.owner-badge.badge-success { background: rgba(47,158,99,.14);  color: var(--success); }
.owner-badge.badge-warn    { background: rgba(200,138,26,.16); color: var(--warning); }
.owner-badge.badge-danger  { background: rgba(229,62,62,.14);  color: var(--danger); }