@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@400;600;700;800;900&family=Inter:wght@400;600;700;800;900&display=swap');

:root{
  /* Brand palette (from Al Majed logo) */
  --brand-navy:#0b2f3d;      /* dark teal from logo */
  --brand-gold:#eda21a;      /* gold from logo */
  --brand-sky:#38bdf8;
  --brand-green:#22c55e;

  --bg:#f5f8fb;
  --card:rgba(255,255,255,.92);
  --text:#0b1220;
  --muted:#5b6474;
  --border:rgba(15, 23, 42, .12);
  --shadow:0 14px 40px rgba(2, 6, 23, .10);
  --shadow-sm:0 8px 18px rgba(2, 6, 23, .08);
  --radius:18px;

  --primary: var(--brand-navy);
  --primary-2: var(--brand-gold);
  --success: var(--brand-green);
  --danger: #dc2626;

  --grad-brand: linear-gradient(135deg, rgba(11,47,61,.18), rgba(237,162,26,.14), rgba(56,189,248,.10));
  --grad-primary: linear-gradient(135deg, rgba(11,47,61,1), rgba(237,162,26,1));
  --grad-soft: linear-gradient(135deg, rgba(11,47,61,.10), rgba(237,162,26,.10), rgba(56,189,248,.06));
}

*{ box-sizing:border-box; min-width:0; }
html,body{
  height:100%;
  margin:0;
  font-family: "Cairo", "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  color:var(--text);
  background: radial-gradient(1200px 600px at 10% 10%, rgba(56,189,248,.12), transparent 55%), radial-gradient(900px 520px at 90% 20%, rgba(34,197,94,.10), transparent 55%), radial-gradient(900px 520px at 20% 90%, rgba(237,162,26,.10), transparent 55%), var(--bg);
  overflow-x: hidden !important;
  max-width: 100%;
}

a{ color:#1e70b8; text-decoration:none; }
a:hover{ text-decoration:underline; }

.container{
  width:min(1280px,100%);
  margin:18px auto;
  padding:0 14px;
}
.container.wide{ width:min(1600px,100%); margin:10px auto; padding:0 6px; }

.card{
  background: var(--card);
  border:1px solid var(--border);
  border-radius:var(--radius);
  box-shadow: var(--shadow);
  padding:14px;
}

.row{ display:flex; gap:10px; align-items:center; flex-wrap:wrap; }
.rowBetween{ display:flex; justify-content:space-between; gap:12px; align-items:center; flex-wrap:wrap; }

.divider{ height:1px; background:var(--border); margin:12px 0; }
.muted{ color:var(--muted); }
.small{ font-size:12px; }

.topbar{
  position: sticky;
  top:0;
  z-index:50;
  background: rgba(255,255,255,.85);
  border-bottom:1px solid var(--border);
  backdrop-filter: blur(12px);
}
.topbar::after{
  content:"";
  display:block;
  height:3px;
  background: var(--grad-primary);
}

.topbarPro{
  padding:10px 14px;
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:12px;
  flex-wrap:wrap;
}
.topbarLeft{ display:flex; align-items:center; gap:12px; }
.topbarRight{ display:flex; align-items:center; gap:10px; flex-wrap:wrap; }

.topbarLogo{
  width:44px; height:44px; object-fit:contain;
  border-radius:12px;
  background:#fff;
  border:1px solid var(--border);
  padding:6px;
}
.topbarTitle{ font-weight:900; font-size:15px; line-height:1.2; }
.topbarSubtitle{ color:var(--muted); font-size:12px; }

.chip{
  border:1px solid var(--border);
  background:#fff;
  border-radius:999px;
  padding:8px 12px;
  font-weight:900;
  font-size:12px;
}
.badge{
  border:1px solid var(--border);
  background:#fff;
  border-radius:999px;
  padding:6px 10px;
  font-weight:900;
  font-size:12px;
}
.badge.ok{
  border-color: rgba(22,163,74,.35);
  background: rgba(22,163,74,.10);
}
.iconPill{
  border:1px solid var(--border);
  border-radius:999px;
  padding:8px 12px;
  background: var(--grad-brand);
  font-weight:900;
  font-size:12px;
  display:inline-flex;
  align-items:center;
  gap:10px;
}


.btn{
  border:1px solid var(--border);
  background:#fff;
  color:var(--text);
  border-radius:14px;
  padding:10px 14px;
  font-weight:900;
  cursor:pointer;
  box-shadow: var(--shadow-sm);
  display:inline-flex;
  align-items:center;
  gap:10px;
}
.btn i{
  font-size:14px;
  width:28px;
  height:28px;
  display:grid;
  place-items:center;
  border-radius:10px;
  background: rgba(237,162,26,.12);
  border:1px solid rgba(237,162,26,.14);
  color: var(--brand-navy);
}
.btn.danger i{ background: rgba(220,38,38,.10); border-color: rgba(220,38,38,.10); }
.btn.primary i{ background: rgba(11,47,61,.10); border-color: rgba(11,47,61,.12); color: var(--brand-navy); }

.btn.primary{
  border-color: rgba(37,99,235,.28);
  background: var(--grad-soft);
}
.btn.primary:hover{ filter: brightness(1.02); }

.btn.danger{
  border-color: rgba(220,38,38,.28);
  background: rgba(220,38,38,.10);
  color:#991b1b;
}

.btn:disabled{ opacity:.6; cursor:not-allowed; }
.linkBtn{ background:transparent !important; }

label{ display:block; font-weight:900; margin:10px 0 6px; }
input,select,textarea{
  width:100%;
  border:1px solid var(--border);
  background:#fff;
  border-radius:14px;
  padding:12px;
  font-size:16px; /* ✅ يمنع iOS zoom */
}
textarea{ min-height:120px; resize:vertical; line-height:1.6; display:block; }

.tabs{ display:flex; gap:10px; flex-wrap:wrap; margin-bottom:12px; }
.tab{
  border:1px solid var(--border);
  background:#fff;
  border-radius:999px;
  padding:10px 14px;
  font-weight:900;
  cursor:pointer;
}
.tab.active{
  border-color: rgba(11,47,61,.28);
  background: linear-gradient(135deg, rgba(11,47,61,.10), rgba(237,162,26,.10), rgba(56,189,248,.06));
}

.hidden{ display:none !important; }

/* ✅ السكرول الأفقي داخل جدول التقرير فقط */
.tableWrap{
  width:100%;
  overflow-x:auto !important;
  overflow-y:hidden;
  -webkit-overflow-scrolling: touch;
  border:1px solid var(--border);
  border-radius:16px;
  background:#fff;
}
table{
  width:100%;
  border-collapse:collapse;
  min-width: 980px; /* ✅ الجوال يسكرول داخل tableWrap */
}
th,td{
  padding:10px 12px;
  border-bottom:1px solid var(--border);
  text-align:right;
  white-space:nowrap;
  font-size:14px;
}

/* ✅ Report table look (more "planned" / styled) */
.reportTable{
  border-collapse:collapse;
  width:100%;
}
.reportTable thead th{
  background:#f2f4f7;
  color: var(--text);
  font-weight:800;
  border-bottom:2px solid rgba(15, 23, 42, .14);
}
.reportTable tbody tr:nth-child(even){ background:#fafbfc; }
.reportTable tbody tr:hover{ background: rgba(2, 6, 23, .03); }
.reportTable td, .reportTable th{
  border:1px solid rgba(15, 23, 42, .10);
  padding:12px 12px;
  vertical-align:top;
  font-size:15px;
  line-height:1.4;
}

/* Notes + location sizing */
.reportTable th.notesHead, .reportTable td.notesCell{ width: 46%; min-width: 320px; }
.reportTable th.countHead, .reportTable td.countCell{ width: 90px; max-width: 90px; text-align:center; }
.reportTable th.locHead, .reportTable td.locCell{ width: 70px; text-align:center; }
.reportTable td.notesCell{ white-space:normal; word-break:break-word; }
.reportTable td.locCell a{ display:inline-flex; align-items:center; justify-content:center; width:28px; height:28px; border-radius:10px; border:1px solid rgba(15,23,42,.12); background:#fff; }

/* ✅ التقارير */
.tableWrap.fit{ overflow-x:hidden !important; }
.tableWrap.fit table{ min-width:0 !important; table-layout:fixed; }
.tableWrap.fit:not(.reportFit) th,
.tableWrap.fit:not(.reportFit) td{
  white-space:normal;
  word-break:break-word;
  overflow-wrap:anywhere;
}

/* تقرير الزيارات/التقارير: يظهر كامل على الشاشات المتوسطة،
   وعند صغر الشاشة نسمح بسكرول أفقي داخل الجدول فقط */
.tableWrap.reportFit{
  overflow-x:auto !important;
  overflow-y:hidden;
  -webkit-overflow-scrolling:touch;
}
.tableWrap.reportFit table{
  min-width:1100px !important;
  table-layout:auto !important;
}
.tableWrap.reportFit th,
.tableWrap.reportFit td{
  white-space:nowrap;
}

@media (max-width: 1024px){
  .reportLayout{ grid-template-columns: 1fr; }
  .tableWrap.reportFit table{ min-width:980px !important; }
}

@media (max-width: 720px){
  th,td{ font-size:12px; padding:8px 10px; }
  .tableWrap.reportFit table{ min-width:900px !important; }
}

@media (max-width: 520px){
  .tableWrap.reportFit table{ min-width:860px !important; }
}

/* Layouts */
.repLayout{
  display:grid;
  grid-template-columns: 360px 1fr;
  gap:14px;
  align-items:start;
}
.repLeft,.repRight{
  border:1px solid var(--border);
  border-radius:16px;
  padding:12px;
  background: rgba(255,255,255,.7);
}
.clientRow{
  display:flex;
  justify-content:space-between;
  gap:10px;
  padding:12px;
  border:1px solid var(--border);
  border-radius:14px;
  background:#fff;
  cursor:pointer;
}
.clientRow.active{
  outline:2px solid rgba(11,47,61,.22);
  background: linear-gradient(135deg, rgba(11,47,61,.08), rgba(237,162,26,.10));
}
.detailHeader{
  display:flex;
  justify-content:space-between;
  gap:12px;
  align-items:flex-start;
  flex-wrap:wrap;
}
.detailTitle{ font-size:18px; font-weight:900; }
.detailGrid{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap:12px;
}
.detailBox{
  border:1px solid var(--border);
  border-radius:14px;
  padding:12px;
  background:#fff;
}
.detailValue{ font-weight:900; margin-top:6px; }

/* Reports layout */
.reportLayout{
  display:grid;
  grid-template-columns: 360px 1fr;
  gap:12px;
  align-items:start;
}

/* Auth */
.authBody{
  min-height:100%;
  display:flex;
  align-items:center;
  justify-content:center;
  padding: 26px 14px;
}
.authShell{ width:min(520px,100%); }

.loginLogoWide{
  display:flex;
  justify-content:center;
  align-items:center;
  margin-bottom:14px;
}
.loginLogoWide img{
  width:min(320px, 84vw); /* ✅ عرض أفقي أكبر */
  height:auto;
  object-fit:contain;
  filter: drop-shadow(0 14px 24px rgba(2,6,23,.18));
}

.authCardPro{
  position:relative;
  padding-top:24px;
  background: linear-gradient(180deg, rgba(11,47,61,.06), rgba(255,255,255,.96));
  border: 1px solid rgba(11,47,61,.14);
}
.floatingLogo{
  position:absolute;
  top:-66px;
  left:50%;
  transform:translateX(-50%);
  width:132px; height:132px;
  border-radius:24px;
  background: transparent;
  border:none;
  box-shadow: 0 18px 50px rgba(2, 6, 23, .16);
  display:flex;
  align-items:center;
  justify-content:center;
  overflow:hidden;
}
.floatingLogo img{ width:94%; height:94%; object-fit:contain; filter: drop-shadow(0 10px 18px rgba(2,6,23,.18)); }
.authHeadline{ text-align:center; margin-top:28px; }
.brandTitleBig{ font-weight:950; font-size:18px; margin-top:6px; }
.brandSub{ color:var(--muted); font-size:12px; }
.rememberMe{ display:flex; align-items:center; gap:10px; font-weight:900; cursor:pointer; }

/* ✅ Mobile: نفس التصميم لكن ترتيب مناسب */
@media (max-width: 980px){
  .container,.container.wide{ width:min(1600px,100%); margin:10px auto; padding:0 6px; }
  .topbarPro{ gap:10px; }
  .reportLayout{ grid-template-columns: 1fr; }
  .repLayout{ grid-template-columns: 1fr; }
  .detailGrid{ grid-template-columns: 1fr; }
}

input:focus, select:focus, textarea:focus{ outline: none; border-color: rgba(37,99,235,.45); box-shadow: 0 0 0 4px rgba(56,189,248,.14); }

.tableWrap thead th{ position: sticky; top:0; background:#fff; z-index:1; }

.authCardPro::before{
  content:"";
  position:absolute;
  inset:-1px;
  border-radius: var(--radius);
  background: var(--grad-brand);
  z-index:-1;
  filter: blur(18px);
  opacity:.65;
}


/* =========================
   Toast Notifications
   ========================= */
.toastHost{
  position:fixed;
  top:14px;
  left:14px; /* RTL: من الشمال */
  z-index:120;
  display:flex;
  flex-direction:column;
  gap:10px;
  width:min(420px, 92vw);
  pointer-events:none;
}
.toast{
  pointer-events:auto;
  display:flex;
  gap:10px;
  align-items:flex-start;
  padding:12px 12px;
  border-radius:16px;
  border:1px solid var(--border);
  background: rgba(255,255,255,.96);
  box-shadow: 0 18px 46px rgba(2,6,23,.14);
  transform: translateX(-12px);
  opacity:0;
  transition: transform .18s ease, opacity .18s ease;
}
.toast.show{ transform: translateX(0); opacity:1; }
.toastIcon{
  width:34px; height:34px;
  border-radius:12px;
  display:flex; align-items:center; justify-content:center;
  background: rgba(11,47,61,.08);
  border:1px solid rgba(11,47,61,.14);
  flex:0 0 auto;
}
.toast.success .toastIcon{ background: rgba(34,197,94,.12); border-color: rgba(34,197,94,.28); }
.toast.error .toastIcon{ background: rgba(220,38,38,.10); border-color: rgba(220,38,38,.22); }
.toast.warning .toastIcon{ background: rgba(237,162,26,.14); border-color: rgba(237,162,26,.30); }
.toastTitle{ font-weight:950; margin:0; line-height:1.2; }
.toastMsg{ margin:2px 0 0; color:var(--muted); font-size:12px; }
.toastClose{
  margin-right:auto;
  border:none;
  background:transparent;
  cursor:pointer;
  color:var(--muted);
  padding:6px;
  border-radius:10px;
}
.toastClose:hover{ background: rgba(15,23,42,.06); }


/* =========================
   Drawer / Side Panel (بديل الـ prompt وفتح tabs)
   ========================= */
.drawerBackdrop{
  position:fixed;
  inset:0;
  background: rgba(2,6,23,.35);
  backdrop-filter: blur(4px);
  z-index:99990;
  display:none;
}
.drawerBackdrop.show{ display:block; }

 .drawer{
  position:fixed;
  top:50%;
  left:50%;
  width:min(620px, 94vw);
  max-height:90vh;
  height:auto;
  background: rgba(255,255,255,.98);
  border:1px solid var(--border);
  border-radius:22px;
  box-shadow: 0 26px 70px rgba(2,6,23,.22);
  transform: translate(-50%, -50%) scale(.98);
  opacity:0;
  pointer-events:none;
  transition: transform .18s ease, opacity .18s ease;
  z-index:99999;
  display:flex;
  flex-direction:column;
  overflow:hidden;
}
.drawer.show{
  transform: translate(-50%, -50%) scale(1);
  opacity:1;
  pointer-events:auto;
}

.drawerTitle{ font-weight:950; font-size:16px; }
.drawerBody{ padding:14px; overflow:auto; }
.drawerFooter{
  padding:14px;
  border-top:1px solid var(--border);
  background:#fff;
  display:flex;
  gap:10px;
  justify-content:flex-start;
  flex-wrap:wrap;
}

.daysGrid{
  display:grid;
  grid-template-columns: repeat(3, minmax(0,1fr));
  gap:8px;
}
.checkPill{
  border:1px solid var(--border);
  background:#fff;
  border-radius:999px;
  padding:10px 12px;
  display:flex;
  align-items:center;
  gap:10px;
  cursor:pointer;
  font-weight:900;
  user-select:none;
}
.checkPill input{ width:auto; }



/* =========================
   Tables Pro (مخطط مميز)
   ========================= */
.tablePro table{
  border-collapse:separate;
  border-spacing:0;
  overflow:hidden;
}
.tablePro thead th{
  background:#f2f4f7;
  color: var(--text) !important;
  border-bottom:1px solid rgba(15,23,42,.14);
  font-weight:900;
}
.tablePro tbody tr:nth-child(odd){ background: #fff; }
.tablePro tbody tr:nth-child(even){ background: #fafbfc; }
.tablePro tbody tr:hover{ background: rgba(2, 6, 23, .03); }
.tablePro td, .tablePro th{ padding:12px 12px; border-bottom:1px solid rgba(15,23,42,.10); }
.tablePro td:first-child, .tablePro th:first-child{ border-top-right-radius:14px; }
.tablePro td:last-child, .tablePro th:last-child{ border-top-left-radius:14px; }


/* ===== Report cell behavior ===== */
.tableWrap.reportFit{
  display:block;
  width:100%;
  max-width:100%;
}
.tableWrap.reportFit table{ table-layout:auto !important; }
.tableWrap.reportFit th, .tableWrap.reportFit td{
  white-space:nowrap;
  word-break:normal;
  overflow-wrap:normal;
}
.tableWrap.reportFit td.notesCell{
  white-space:normal;
  overflow:visible;
}
#reportResult, #trackingReportResult{ min-width:0; width:100%; }
.reportLayout > *{ min-width:0; }



/* Tabs panels (JS toggles by adding/removing .hidden) */
.tabPanel{ display:block; }
.tabPanel.hidden{ display:none; }


/* === Admin clients actions (CSV / add) === */
.clientActions{ gap:10px; flex-wrap:wrap; justify-content:flex-end; align-items:center; }
.filePick{ display:flex; align-items:center; gap:10px; padding:6px 10px; border:1px solid var(--border); border-radius:14px; background:var(--card); }
.filePick input{ display:none; }
.filePickBtn{ display:inline-flex; align-items:center; gap:8px; padding:8px 12px; border-radius:12px; border:1px solid var(--border); background:var(--btn); cursor:pointer; }
.filePickBtn i{ opacity:.9; }
.filePickName{ font-size:13px; color:var(--muted); max-width:220px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
@media (max-width:520px){
  .filePickName{ max-width:140px; }
}


.liveMapCard{
  border:1px solid var(--border);
  border-radius:16px;
  background:#fff;
  overflow:hidden;
}
.liveMapToolbar{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  padding:10px 12px;
  border-bottom:1px solid var(--border);
  flex-wrap:wrap;
}
.liveMapStats{
  color:var(--muted);
  font-size:13px;
  font-weight:700;
}
.liveTrackingMap{
  width:100%;
  height:380px;
  background:#eef2f7;
}
.liveTrackingMap .leaflet-popup-content{
  direction:rtl;
  text-align:right;
  margin:10px 12px;
}
@media (max-width: 768px){
  .liveTrackingMap{ height:300px; }
  .trackingMapLarge{ height:420px; min-height:300px; }
}


.trackingSummaryGrid{display:grid;grid-template-columns:repeat(auto-fit,minmax(180px,1fr));gap:12px;margin:12px 0}
.statCard{background:#fff;border:1px solid var(--border);border-radius:16px;padding:14px;box-shadow:var(--shadow-sm)}
.statCard .label{color:var(--muted);font-size:13px}
.statCard .value{font-size:24px;font-weight:900;margin-top:6px}
.trackingLayout{display:grid;grid-template-columns:350px 1fr;gap:14px}
@media (max-width: 980px){.trackingLayout{grid-template-columns:1fr}}
.trackingMapLarge{height:520px;border-radius:16px;border:1px solid var(--border);overflow:hidden;background:#eef2f7;resize:vertical;min-height:360px;max-height:85vh}
.permissionOn{color:#166534;font-weight:800}
.permissionOff{color:#991b1b;font-weight:800}


.notifList{display:grid;gap:10px}
.notifItem{
  background:#fff;
  border:1px solid var(--border);
  border-radius:14px;
  padding:12px 14px;
  box-shadow:var(--shadow-sm);
}
.notifItem.unread{
  border-color:rgba(237,162,26,.45);
  background:linear-gradient(135deg, rgba(237,162,26,.08), rgba(11,47,61,.04));
}
.notifText{font-weight:800}
.notifTime{color:var(--muted);font-size:12px;margin-top:6px}


.notifBellWrap{position:relative; z-index:100000}
.notifDropdown{
  position:fixed;
  top:84px;
  inset-inline-end:18px;
  width:min(400px, calc(100vw - 24px));
  max-height:min(70vh, 460px);
  overflow:auto;
  background:#fff;
  border:1px solid var(--border);
  border-radius:18px;
  box-shadow:0 30px 80px rgba(0,0,0,.18);
  padding:10px;
  z-index:100001;
}
.notifDropdownHead{
  position:sticky;
  top:0;
  z-index:2;
  background:#fff;
  font-weight:900;
  padding:8px 10px 10px;
  border-bottom:1px solid var(--border);
  margin-bottom:8px;
}
.notifCount{
  min-width:22px;
  height:22px;
  padding:0 6px;
  border-radius:999px;
  display:inline-grid;
  place-items:center;
  background:#dc2626;
  color:#fff;
  font-size:11px;
  font-weight:900;
}
.live-current-pin{
  background:transparent;
  border:none;
}
.liveCurrentDot{
  width:22px;
  height:22px;
  border-radius:999px;
  background:#dc2626;
  border:3px solid #fff;
  box-shadow:0 0 0 4px rgba(220,38,38,.18);
}
.statCardPrimary .value{
  font-size:36px;
}


.btn{
  position:relative;
  transition:transform .15s ease, filter .15s ease, box-shadow .15s ease, opacity .15s ease;
}
.btn:hover{ transform:translateY(-1px); }
.btn:active{ transform:translateY(0) scale(.985); }
.btn.isBusy{
  opacity:.86;
  pointer-events:none;
}
.btn.isBusy::after{
  content:"";
  width:14px;
  height:14px;
  border-radius:999px;
  border:2px solid currentColor;
  border-left-color: transparent;
  display:inline-block;
  animation:spinBtn .8s linear infinite;
  margin-inline-start:6px;
}
@keyframes spinBtn{
  to{ transform:rotate(360deg); }
}


/* Visit focus card for reps */
.visitFocusCard{
  margin-top: 4px;
  margin-bottom: 12px;
  padding: 16px;
  border-radius: 22px;
  border: 1px solid rgba(56, 189, 248, .22);
  background: linear-gradient(135deg, rgba(56,189,248,.08), rgba(237,162,26,.07), rgba(255,255,255,.94));
  box-shadow: 0 14px 34px rgba(11,47,61,.08);
}
.visitFocusHead{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  margin-bottom:14px;
  flex-wrap:wrap;
}
.visitFocusTitle{
  font-size: 20px;
  font-weight: 900;
  color: var(--text);
}
.visitFocusBadge{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-height: 38px;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(255,255,255,.82);
  border: 1px solid rgba(11,47,61,.12);
  color: #6b7280;
  font-weight: 800;
}
.visitFocusBadge.is-ready{
  background: rgba(34,197,94,.12);
  border-color: rgba(34,197,94,.28);
  color: #166534;
}
.visitFocusBadge.is-done{
  background: rgba(59,130,246,.12);
  border-color: rgba(59,130,246,.24);
  color: #1d4ed8;
}
.visitFocusCard .detailBox{
  background: rgba(255,255,255,.78);
  border: 1px solid rgba(11,47,61,.08);
}
.visitFocusGrid{
  margin-bottom: 12px;
}
.visitMiniBox, .visitNotesBox{
  box-shadow: inset 0 1px 0 rgba(255,255,255,.35);
}
.visitActionBar, .visitActionRow{
  gap: 10px;
  flex-wrap: wrap;
}
.visitFocusCard.location-ready{
  border-color: rgba(34,197,94,.28);
  box-shadow: 0 16px 36px rgba(34,197,94,.12);
}
.visitFocusCard.location-ready .locationBox{
  border-color: rgba(34,197,94,.24);
  background: rgba(240,253,244,.88);
}
@media (max-width: 768px){
  .visitFocusCard{ padding: 14px; border-radius: 18px; }
  .visitFocusTitle{ font-size: 18px; }
}


/* إضافات إصلاح الزيارة / إضافة عميل / الجداول */
#clientsWrap{
  max-height:68vh;
  overflow:auto;
  padding-inline-end:4px;
}
.clientRow{
  width:100%;
  border:1px solid var(--border);
  background:#fff;
  margin-bottom:10px;
  padding:12px;
  align-items:flex-start;
}
.clientRow.active{
  border-color:rgba(37,99,235,.28);
  background:linear-gradient(135deg, rgba(11,47,61,.06), rgba(237,162,26,.08));
}
.clientRow > div:last-child{
  min-width:84px;
}
.drawer, .drawer *{
  filter:none !important;
}
.drawer input, .drawer select, .drawer textarea, .drawer button, .drawer label{
  position:relative;
  z-index:1;
}
.drawerBody{
  overscroll-behavior:contain;
}
#reportResult .tableWrap, #trackingReportResult .tableWrap{
  margin-inline:auto;
}
@media (min-width: 1025px){
  .tableWrap.reportFit table{ min-width:100% !important; }
}

/* تحديث شكل قائمة العملاء في صفحة الزيارات */
#clientsWrap{
  display:flex;
  flex-direction:column;
  gap:12px;
  max-height:68vh;
  overflow:auto;
  padding:4px 4px 4px 2px;
}

.clientRow{
  width:100%;
  margin:0;
  padding:16px 18px;
  border:1px solid rgba(15,23,42,.10);
  border-radius:20px;
  background:linear-gradient(180deg, rgba(255,255,255,.98), rgba(248,250,252,.95));
  box-shadow:0 10px 24px rgba(2,6,23,.06);
  align-items:center;
  transition:transform .18s ease, box-shadow .18s ease, border-color .18s ease, background .18s ease;
}
.clientRow:hover{
  transform:translateY(-1px);
  box-shadow:0 14px 28px rgba(2,6,23,.08);
  border-color:rgba(11,47,61,.18);
}
.clientRow.active{
  border-color:rgba(37,99,235,.30);
  background:linear-gradient(135deg, rgba(11,47,61,.07), rgba(237,162,26,.10), rgba(255,255,255,.96));
  box-shadow:0 0 0 3px rgba(56,189,248,.12), 0 16px 32px rgba(2,6,23,.10);
}
.clientRowMain{
  display:flex;
  flex-direction:column;
  gap:6px;
  text-align:right;
}
.clientRowTitle{
  font-size:20px;
  line-height:1.25;
  font-weight:900;
  color:var(--brand-navy);
  letter-spacing:-.2px;
}
.clientRowMeta{
  font-size:14px;
  font-weight:700;
  color:var(--text);
}
.clientRowSub{
  font-size:13px;
  color:var(--muted);
  line-height:1.6;
}
.clientRowSide{
  min-width:132px;
  display:flex;
  flex-direction:column;
  align-items:flex-start;
  gap:10px;
  text-align:left;
}
.clientRowBadge{
  border:1px solid rgba(15,23,42,.10);
  background:#fff;
  color:var(--text);
  border-radius:999px;
  padding:8px 14px;
  font-size:13px;
  font-weight:900;
  white-space:nowrap;
}
.clientRowBadge.ok{
  border-color:rgba(22,163,74,.34);
  background:rgba(22,163,74,.10);
  color:#166534;
}
.clientRowDate{
  font-size:12px;
  color:var(--muted);
  font-weight:700;
  white-space:nowrap;
}

@media (max-width: 900px){
  .clientRow{
    padding:14px 15px;
    border-radius:18px;
  }
  .clientRowTitle{ font-size:18px; }
}

@media (max-width: 640px){
  .clientRow{
    align-items:flex-start;
    gap:12px;
  }
  .clientRowSide{
    min-width:110px;
    gap:8px;
  }
  .clientRowTitle{ font-size:17px; }
  .clientRowMeta{ font-size:13px; }
  .clientRowSub, .clientRowDate{ font-size:12px; }
}


/* === 2026-03 layout refinements === */
.repPageCard{ overflow: visible; }
.repStickyTop{
  position: sticky;
  top: 86px;
  z-index: 40;
  background: rgba(255,255,255,.96);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(15,23,42,.06);
  border-radius: 18px;
  padding: 12px 12px 10px;
  margin: -2px -2px 12px;
  box-shadow: 0 10px 28px rgba(2,6,23,.06);
}
.repHeaderBar{ gap: 12px; align-items: center; }
.repHeaderBar h3{ margin: 0 0 4px; }
.repSearchRow input{
  background: #fff;
  border-radius: 16px;
  min-height: 48px;
  box-shadow: 0 8px 20px rgba(2,6,23,.04);
}
.repTabs{ margin-bottom: 0; }

/* اجعل تقرير الزيارات يظهر كاملاً على المتصفح، ومع الشاشات الأصغر فقط يظهر سكرول */
.tableWrap.reportFit{
  overflow-x: visible !important;
}
.tableWrap.reportFit table{
  width: 100% !important;
  min-width: 0 !important;
  table-layout: fixed !important;
}
.tableWrap.reportFit th,
.tableWrap.reportFit td{
  white-space: normal !important;
  word-break: break-word;
  overflow-wrap: anywhere;
  vertical-align: top;
  font-size: 13px;
  padding: 10px 8px;
}
.tableWrap.reportFit .notesHead,
.tableWrap.reportFit .notesCell{
  width: 28% !important;
  min-width: 0 !important;
}
.tableWrap.reportFit .countHead,
.tableWrap.reportFit .countCell{
  width: 7% !important;
  max-width: none !important;
}
.tableWrap.reportFit .locHead,
.tableWrap.reportFit .locCell{
  width: 6% !important;
}
#reportResult .reportTable th,
#reportResult .reportTable td{
  line-height: 1.5;
}

/* التابلت: نفس التصميم لكن أصغر قليلاً */
@media (min-width: 768px) and (max-width: 1100px){
  body{ font-size: 15px; }
  .container,.container.wide{ width:min(1400px, 98%); padding:0 4px; }
  .card{ padding: 14px; border-radius: 18px; }
  .topbarPro{ min-height: 64px; }
  .repLayout{ grid-template-columns: 330px 1fr; gap: 12px; }
  .trackingLayout{ grid-template-columns: 320px 1fr; }
  .repStickyTop{ top: 78px; padding: 10px; }
}

@media (max-width: 1100px){
  .tableWrap.reportFit{
    overflow-x: auto !important;
  }
  .tableWrap.reportFit table{
    min-width: 980px !important;
    table-layout: auto !important;
  }
  .tableWrap.reportFit th,
  .tableWrap.reportFit td{
    white-space: nowrap !important;
    font-size: 13px;
    padding: 10px 10px;
  }
}

@media (max-width: 980px){
  .repStickyTop{ top: 74px; }
}

@media (max-width: 768px){
  .repStickyTop{
    top: 70px;
    padding: 10px;
    border-radius: 16px;
  }
  .repHeaderBar{
    align-items: stretch;
  }
  .repSearchRow{
    width: 100%;
  }
}


/* ===== Header Compact Fix ===== */
.visits-header {
  padding: 10px 16px !important;
  min-height: 60px !important;
}

.visits-header h2 {
  font-size: 18px !important;
  margin: 0 !important;
}

.visits-actions {
  display: flex !important;
  align-items: flex-start !important;
  gap: 8px !important;
  margin-top: -5px !important;
}

.visits-header * {
  line-height: 1.2 !important;
}
