@font-face {
    font-family: 'Sahel';
    src: url('Sahel.woff2') format('woff2');
    font-display: swap;
    font-weight:normal;
}
@font-face {
    font-family: 'Sahel';
    src: url('Sahel-Bold.woff2') format('woff2');
    font-display: swap;
    font-weight:bold;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
    background: #fff;
    color: #1e293b;
    font-family: 'Sahel', Tahoma, Arial, sans-serif;
    font-size: 12.5px;
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
}

.wrap {
    max-width: 1400px;
    margin: 0 auto;
    padding: 18px 20px 40px;
}

/* ---------- هدر ---------- */
.hero {
    text-align: center;
    padding: 14px 0 18px;
    margin-bottom: 16px;
}
.hero h1 {
    font-size: 16px;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 2px;
    letter-spacing: -.2px;
}
.hero p {
    font-size: 11.5px;
    color: #94a3b8;
}

/* ---------- تب ها ---------- */
.tabs {
    display: flex;
    gap: 2px;
    margin-bottom: 14px;
    flex-wrap: wrap;
    border-bottom: 1px solid #e2e8f0;
}
.tab {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: none;
    border: none;
    color: #64748b;
    cursor: pointer;
    border-radius: 0;
    font-family: inherit;
    font-size: 12px;
    font-weight: 500;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    transition: color .15s, border-color .15s;
    white-space: nowrap;
}
.tab:hover { color: #4f46e5; }
.tab.active {
    color: #4f46e5;
    font-weight: 600;
    border-bottom-color: #4f46e5;
}
.tab svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

/* ---------- نوار ابزار ---------- */
.toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 2px 14px;
    flex-wrap: wrap;
}

.search-box {
    position: relative;
    flex: 1;
    min-width: 200px;
    max-width: 360px;
}
.search-box svg.search-icon {
    position: absolute;
    right: 11px;
    top: 50%;
    transform: translateY(-50%);
    width: 15px;
    height: 15px;
    color: #94a3b8;
    pointer-events: none;
}
.search-box input {
    width: 100%;
    padding: 8px 34px 8px 32px;
    border: 1px solid #e2e8f0;
    border-radius: 7px;
    font-family: inherit;
    font-size: 12.5px;
    background: #fff;
    color: #1e293b;
    transition: border-color .15s, box-shadow .15s;
    outline: none;
}
.search-box input:focus {
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99,102,241,.08);
}
.search-box .clear {
    position: absolute;
    left: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: none;
    background: #e2e8f0;
    color: #64748b;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 0;
}
.search-box .clear.show { display: flex; }
.search-box .clear svg { width: 10px; height: 10px; }

.stat {
    font-size: 11.5px;
    color: #94a3b8;
    margin-right: auto;
}
.stat strong { color: #1e293b; font-weight: 700; }

/* ---------- جدول ---------- */
.table-wrap {
    position: relative;
    overflow-x: auto;
    min-height: 200px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
}
table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 12.5px;
}
thead th {
    background: #fafbfc;
    color: #475569;
    font-weight: 600;
    padding: 10px 14px;
    text-align: right;
    white-space: nowrap;
    border-bottom: 1px solid #e2e8f0;
    position: sticky;
    top: 0;
    cursor: pointer;
    user-select: none;
    font-size: 11.5px;
    transition: color .15s;
}
thead th:hover { color: #4f46e5; }
thead th .sort-icon {
    display: inline-block;
    margin-right: 4px;
    opacity: .3;
    width: 9px;
    height: 9px;
    vertical-align: middle;
    transition: opacity .15s;
}
thead th.sorted .sort-icon { opacity: 1; color: #4f46e5; }

tbody tr { transition: background .1s; }
tbody tr + tr { border-top: 1px solid #f1f5f9; }
tbody tr:hover { background: #fafbff; }
tbody td {
    padding: 9px 14px;
    color: #334155;
    vertical-align: top;
    line-height: 1.7;
}
tbody td:first-child {
    font-weight: 600;
    color: #4f46e5;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.empty {
    padding: 50px 20px;
    text-align: center;
    color: #94a3b8;
    font-size: 12.5px;
}
.empty svg {
    width: 32px;
    height: 32px;
    display: block;
    margin: 0 auto 10px;
    opacity: .4;
}

/* ---------- لودینگ ---------- */
.loading-overlay {
    position: absolute;
    inset: 0;
    background: rgba(255,255,255,.75);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 5;
}
.loading-overlay.show { display: flex; }
.spinner {
    width: 22px;
    height: 22px;
    border: 2px solid #e0e7ff;
    border-top-color: #6366f1;
    border-radius: 50%;
    animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- صفحه بندی ---------- */
.pagination-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 2px 4px;
    flex-wrap: wrap;
}
.per-page {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11.5px;
    color: #94a3b8;
}
.per-page select {
    padding: 5px 8px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-family: inherit;
    font-size: 11.5px;
    background: #fff;
    color: #1e293b;
    cursor: pointer;
    outline: none;
}
.per-page select:focus { border-color: #6366f1; }

.pagination {
    display: flex;
    gap: 3px;
    align-items: center;
    flex-wrap: wrap;
}
.pagination button {
    min-width: 28px;
    height: 28px;
    padding: 0 7px;
    border: 1px solid #e2e8f0;
    background: #fff;
    color: #475569;
    border-radius: 6px;
    cursor: pointer;
    font-family: inherit;
    font-size: 11.5px;
    font-weight: 500;
    transition: all .12s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.pagination button:hover:not(:disabled):not(.active) {
    border-color: #6366f1;
    color: #4f46e5;
}
.pagination button.active {
    background: #4f46e5;
    border-color: #4f46e5;
    color: #fff;
    font-weight: 700;
}
.pagination button:disabled {
    opacity: .4;
    cursor: not-allowed;
}
.pagination .dots {
    color: #cbd5e1;
    padding: 0 3px;
    user-select: none;
    font-size: 12px;
}

.page-info {
    text-align: center;
    font-size: 11.5px;
    color: #94a3b8;
    padding: 10px 0 0;
}
.page-info strong { color: #475569; font-weight: 600; }

/* ---------- موبایل ---------- */
@media (max-width: 640px) {
    .wrap { padding: 12px 12px 30px; }
    .hero h1 { font-size: 14px; }
    .hero p { font-size: 11px; }
    .tab { padding: 7px 10px; font-size: 11.5px; }
    .tab .label { display: none; }
    .tab svg { width: 16px; height: 16px; }
    thead th, tbody td { padding: 8px 10px; }
    .pagination-bar { flex-direction: column; align-items: stretch; }
    .pagination { justify-content: center; }
    .per-page { justify-content: center; }
}