.efm-table-root {
  width: 100%;
  box-sizing: border-box;
  direction: rtl;
  font-family: inherit;
}

.efm-search-wrap {
  margin-bottom: 12px;
}

.efm-search-input {
  width: 100%;
  max-width: 520px;
  display: block;
  padding: 10px 12px;
  border: 1px solid #e3e3e3;
  border-radius: 8px;
  outline: none;
}
.efm-search-input:focus {
  border-color: #c9c9c9;
}

.efm-table-wrap {
  width: 100%;
  overflow-x: auto;
}

.efm-empty {
  padding: 16px 0;
  color: #666;
  text-align: center;
}

.efm-table {
  width: 100%;
  border-collapse: collapse;
  border: 1px solid #e9e9e9;
  background: #fff;
}
.efm-table th, .efm-table td {
  border-bottom: 1px solid #f0f0f0;
  padding: 10px 12px;
  text-align: right;
  vertical-align: top;
  white-space: nowrap;
}
.efm-table th {
  background: #fafafa;
  font-weight: 600;
}

.efm-pagination {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  margin-top: 12px;
}
.efm-page-btn {
  border: 1px solid #e3e3e3;
  background: #fff;
  padding: 6px 10px;
  border-radius: 6px;
  cursor: pointer;
}
.efm-page-btn.is-active {
  border-color: #bbb;
  background: #f5f5f5;
  font-weight: 600;
}
.efm-page-btn.is-disabled {
  opacity: 0.5;
  cursor: default;
}
.efm-ellipsis {
  padding: 0 2px;
}

/* موبایل: جدول کارت‌شده با لیبل ستون‌ها */
@media (max-width: 640px) {
  .efm-table thead {
    display: none;
  }
  .efm-table, .efm-table tbody, .efm-table tr, .efm-table td {
    display: block;
    width: 100%;
  }
  .efm-table tr {
    border-bottom: 1px solid #efefef;
    padding: 8px 0;
  }
  .efm-table td {
    border: none;
    white-space: normal;
    position: relative;
    min-height: 28px;
  }
  .efm-table td::before {
    content: attr(data-label);
    position: absolute;
    right: 8px;
    top: 8px;
    font-weight: 600;
    color: #444;
    width: 38%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
}

/* موبایل: جدول همون جدول می‌مونه + اسکرول افقی */
@media (max-width: 640px) {
  .efm-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  /* برگردوندن دیسپلی‌های پیش‌فرض جدول */
  .efm-table { display: table !important; width: max-content; min-width: 900px; }
  .efm-table thead { display: table-header-group !important; }
  .efm-table tbody { display: table-row-group !important; }
  .efm-table tr    { display: table-row !important; }
  .efm-table td    { display: table-cell !important; }

  /* جلوگیری از استایل کارت‌شدن قبلی */
  .efm-table td::before { display: none !important; content: ""; }

  /* برای خوانایی بهتر در اسکرول افقی */
  .efm-table th, .efm-table td { white-space: nowrap; }
}

/* موبایل: جدول واقعی + هم‌ترازی دقیق هدر/بدنه */
@media (max-width: 640px) {
  .efm-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* اجبار به رفتار جدول و هم‌ترازی ستون‌ها */
  .efm-table {
    display: table !important;
    border-collapse: collapse;
    table-layout: auto;           /* اگر همچنان ناهماهنگ بود: fixed بگذار */
    width: max-content;           /* اسکرول افقی */
    min-width: 720px;             /* حداقل عرض برای شکست‌نخوردن ستون‌ها */
  }
  .efm-table thead { display: table-header-group !important; }
  .efm-table tbody { display: table-row-group !important; }
  .efm-table tr    { display: table-row !important; }
  .efm-table th,
  .efm-table td    {
    display: table-cell !important;
    vertical-align: middle;
    white-space: nowrap;
    box-sizing: border-box;
  }

  /* اگر از نسخه کارت‌شده استفاده می‌کردی، کاملاً خاموشش می‌کنیم */
  .efm-table thead { visibility: visible !important; }
  .efm-table td::before { content: none !important; display: none !important; }
  .efm-table { table-layout: fixed; } /* جای auto */
  .efm-table th:nth-child(1),
  .efm-table td:nth-child(1) { min-width: 160px; } /* نام و نام‌خانوادگی */


}

@media (max-width: 640px) {
  .efm-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .efm-table {
    display: table !important;
    border-collapse: collapse;
    table-layout: fixed !important; /* تا colgroup اعمال شود */
    width: max-content;              /* برای اسکرول افقی */
    min-width: 720px;
  }
  .efm-table thead { display: table-header-group !important; visibility: visible !important; }
  .efm-table tbody { display: table-row-group !important; }
  .efm-table tr    { display: table-row !important; }
  .efm-table th,
  .efm-table td    { display: table-cell !important; white-space: nowrap; vertical-align: middle; }

  /* مطمئن شو نسخه کارت‌شده خاموش است */
  .efm-table td::before { content: none !important; display: none !important; }
}

