/* لوحة التحكم — هاتف (<768) | iPad/لابتوب (≥768) */
html, body {
  -webkit-text-size-adjust: 100%;
  touch-action: manipulation;
}

.h-screen {
  height: 100dvh;
  min-height: -webkit-fill-available;
}

@supports (padding: env(safe-area-inset-bottom)) {
  .h-screen {
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
  }
}

/* ─── بطاقة البنك ─── */
.visitor-card-visual {
  box-sizing: border-box;
  overflow: visible !important;
  width: 100%;
  min-height: 228px !important;
  display: block;
}

.visitor-card-body {
  position: relative;
  z-index: 1;
  min-height: 190px;
  height: auto !important;
}

.visitor-card-footer {
  flex-shrink: 0;
  width: 100%;
}

.visitor-card-expiry-cvv {
  flex-shrink: 0;
  display: flex !important;
  align-items: flex-start;
  gap: 1rem;
}

.visitor-card-field {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex-shrink: 0;
}

.visitor-card-label {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
  font-size: 10px !important;
  line-height: 1.2 !important;
  font-weight: 600;
  letter-spacing: 0.06em;
}

.visitor-card-value {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
  font-size: 13px !important;
  line-height: 1.3 !important;
  font-weight: 700;
}

.visitor-card-field .visitor-card-label {
  color: #64748b;
}

.visitor-card-field .visitor-card-value {
  color: #1e293b;
}

.visitor-card-number {
  max-width: 100%;
  white-space: nowrap;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.visitor-card-number::-webkit-scrollbar {
  display: none;
}

/* شريط الإحصائيات */
.select-none > div:first-child {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.select-none > div:first-child::-webkit-scrollbar {
  display: none;
}

/* ═══════════════════════════════════════════════════════
   iPad + لابتوب (768px+) — نفس تجربة سطح المكتب
   ═══════════════════════════════════════════════════════ */
@media (min-width: 768px) {
  .dash-main-split {
    flex-direction: row !important;
    flex: 1 1 auto;
    min-height: 0;
  }

  /* قائمة العملاء — يمين (RTL) */
  .dash-inbox-panel {
    display: flex !important;
    flex: 0 0 300px !important;
    width: 300px !important;
    min-width: 280px !important;
    max-width: 320px !important;
  }

  /* منطقة البيانات — يسار (RTL) */
  .visitor-detail-panel {
    flex: 1 1 0 !important;
    min-width: 0 !important;
    width: auto !important;
    height: auto !important;
    overflow: hidden;
  }

  .visitor-detail-panel .flex-1.overflow-y-auto.bg-gray-50 {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 1rem 1.25rem !important;
  }

  /* بيانات العميل — عرض اللابتوب الكلاسيكي 360px */
  .visitor-data-panel {
    width: 360px !important;
    max-width: 360px !important;
    flex-shrink: 0;
  }

  /* الإحصائيات تبقى ظاهرة دائماً (ليس وضع هاتف) */
  .dash-client-open > .select-none {
    display: block !important;
  }

  /* رأس العميل — سطر واحد مثل اللابتوب */
  .visitor-detail-header {
    flex-wrap: nowrap;
  }

  .visitor-detail-header select {
    max-width: 160px;
    flex: 0 1 auto;
  }

  /* أزرار الإجراءات — أفقية مثل اللابتوب */
  .visitor-detail-panel .flex.gap-2.mt-3 {
    flex-direction: row;
    flex-wrap: wrap;
  }

  .visitor-detail-panel .flex.gap-2.mt-3 button {
    flex: 1 1 auto;
    min-height: 40px;
    font-size: 0.8125rem !important;
  }

  /* بطاقة البنك */
  .visitor-card-visual {
    min-height: 232px !important;
  }

  .visitor-card-body {
    min-height: 196px;
  }

  .visitor-card-label {
    font-size: 11px !important;
  }

  .visitor-card-value {
    font-size: 14px !important;
  }
}

@media (min-width: 1024px) {
  .dash-inbox-panel {
    flex: 0 0 320px !important;
    width: 320px !important;
  }

  .visitor-detail-panel .flex-1.overflow-y-auto.bg-gray-50 {
    padding: 1rem 1.5rem !important;
  }
}

/* ═══════════════════════════════════════
   الهاتف فقط (<768)
   ═══════════════════════════════════════ */
@media (max-width: 767px) {
  .dash-client-open > .select-none {
    display: none !important;
  }

  .dash-client-open .dash-main-split {
    flex: 1 1 auto;
    min-height: 0;
    height: 100%;
  }

  .visitor-detail-panel {
    flex: 1 1 auto !important;
    width: 100% !important;
    min-height: 0 !important;
    height: 100% !important;
  }

  .visitor-detail-header {
    flex-wrap: wrap;
    row-gap: 0.5rem;
  }

  .visitor-detail-header select {
    flex: 1 1 100%;
    max-width: 100% !important;
    min-height: 40px;
    font-size: 12px !important;
  }

  .visitor-detail-panel .flex-1.overflow-y-auto.bg-gray-50 {
    flex: 1 1 auto !important;
    min-height: 0 !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
    padding: 12px 10px calc(16px + env(safe-area-inset-bottom, 0px)) !important;
  }

  .visitor-data-panel {
    width: 100% !important;
    max-width: 100% !important;
    gap: 0.75rem !important;
  }

  .visitor-card-visual {
    min-height: 200px;
    padding: 16px 14px 18px !important;
  }

  .visitor-card-number {
    font-size: 13px !important;
    letter-spacing: 0.05em !important;
  }

  .visitor-data-panel > .bg-gray-50.rounded-lg {
    width: 100%;
    box-sizing: border-box;
  }

  .visitor-detail-panel .flex.gap-2.mt-3 {
    flex-direction: column;
    gap: 0.5rem;
  }

  .visitor-detail-panel .flex.gap-2.mt-3 button {
    width: 100%;
    min-height: 46px;
    font-size: 0.875rem !important;
  }

  .overflow-x-auto.scrollbar-hide {
    -webkit-overflow-scrolling: touch;
  }
}
