/* ===========================================================
   DefinitionListPage — shared visual pattern for all
   "Definitions" listing screens (Groups, Items, Employees,
   Customers, Tables, Suppliers, Users).

   Used together with the Razor partials under
   Views/Shared/DefinitionListPage/*
   =========================================================== */

:root {
    --nk-primary: #1F7A3A;
    --nk-primary-light: #E8F2E6;
    --nk-text: #1a2e22;
    --nk-muted: #8a96a3;
    --nk-border: #ecefe5;
    --nk-bg: #FAFBF7;
    --nk-surface: #ffffff;
}

/* ---------- Dark mode (data-bs-theme="dark" — يُفعَّل من زر تبديل المظهر بالهيدر) ---------- */
[data-bs-theme="dark"] {
    --nk-primary: #35a35c;
    --nk-primary-light: #163722;
    --nk-text: #e6ebe7;
    --nk-muted: #8b978f;
    --nk-border: #2a332c;
    --nk-bg: #171c19;
    --nk-surface: #1e2420;
}
[data-bs-theme="dark"] body { background: var(--nk-bg); }
[data-bs-theme="dark"] .kpi-card,
[data-bs-theme="dark"] .list-card,
[data-bs-theme="dark"] .nk-modal .modal-content,
[data-bs-theme="dark"] .icon-uploader,
[data-bs-theme="dark"] .modal-content {
    background: var(--nk-surface);
    box-shadow: 0 1px 2px rgba(0,0,0,0.3), 0 8px 20px -12px rgba(0,0,0,0.4);
}
[data-bs-theme="dark"] .nk-input,
[data-bs-theme="dark"] .nk-select,
[data-bs-theme="dark"] .nk-btn {
    background: var(--nk-surface);
    color: var(--nk-text);
    border-color: var(--nk-border);
}
[data-bs-theme="dark"] .nk-btn-primary { background: var(--nk-primary); border-color: var(--nk-primary); color: #fff; }
[data-bs-theme="dark"] .nk-table thead th { background: #232b25; color: var(--nk-muted); }
[data-bs-theme="dark"] .nk-table tbody td { border-color: #262f28; }
[data-bs-theme="dark"] .nk-table tbody tr:hover { background: var(--nk-primary-light); }
[data-bs-theme="dark"] .badge-active,
[data-bs-theme="dark"] .badge-yes { background: #163722; color: #4fc27f; }
[data-bs-theme="dark"] .badge-hidden,
[data-bs-theme="dark"] .badge-neutral { background: #2a332c; color: #a9b3ac; }
[data-bs-theme="dark"] .badge-no { background: #3a2020; color: #e8837a; }
[data-bs-theme="dark"] .badge-pending { background: #3a2e14; color: #e8b45f; }
[data-bs-theme="dark"] .row-icon-btn { background: var(--nk-surface); border-color: var(--nk-border); color: var(--nk-muted); }
[data-bs-theme="dark"] .list-pagination .pager-btn { background: var(--nk-surface); border-color: var(--nk-border); color: var(--nk-text); }
[data-bs-theme="dark"] .dataTables_wrapper .dataTables_processing { background: rgba(23,28,25,0.85); }
[data-bs-theme="dark"] .list-card.nk-loading::after { background: rgba(23,28,25,0.7); }
[data-bs-theme="dark"] .nk-table-empty i { color: #3a453d; }
[data-bs-theme="dark"] .icon-uploader { background: #1a201c; border-color: #33403654; }
[data-bs-theme="dark"] .nk-input.input-validation-error,
[data-bs-theme="dark"] .nk-select.input-validation-error { background-color: #3a2020 !important; }

/* ---------- Typography scale (استخدمها لأي عنوان/تسمية جديدة بدل قيم rem حرة) ---------- */
.nk-h1 { font-size: 1.5rem; font-weight: 800; color: var(--nk-text); line-height: 1.2; margin: 0; }
.nk-h2 { font-size: 1.15rem; font-weight: 700; color: var(--nk-text); line-height: 1.25; margin: 0; }
.nk-h3 { font-size: 0.98rem; font-weight: 700; color: var(--nk-text); line-height: 1.3; margin: 0; }
.nk-label { font-size: 0.82rem; font-weight: 600; color: var(--nk-text); }
.nk-caption { font-size: 0.75rem; font-weight: 500; color: var(--nk-muted); }
.nk-body { font-size: 0.88rem; color: var(--nk-text); }

/* ---------- Page heading + breadcrumb ---------- */
.nk-page-head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 1rem;
}
.nk-page-head h1 {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--nk-text);
    margin: 0;
    line-height: 1.15;
}
.nk-page-head .subtitle {
    font-size: 0.85rem;
    color: var(--nk-muted);
    font-weight: 500;
    margin-top: 2px;
}
.nk-breadcrumb {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.82rem;
    color: var(--nk-muted);
}
.nk-breadcrumb a { color: var(--nk-muted); text-decoration: none; }
.nk-breadcrumb a:hover { color: var(--nk-primary); }
.nk-breadcrumb .sep { color: #c8d1c2; font-size: 0.7rem; }
.nk-breadcrumb .current { color: var(--nk-primary); font-weight: 600; }

/* ---------- KPI cards ---------- */
.kpi-card {
    background: #fff;
    border: 1px solid var(--nk-border);
    border-radius: 14px;
    padding: 1rem 1.15rem;
    display: flex;
    align-items: center;
    gap: 0.9rem;
    min-width: 0;
    overflow: hidden;
    box-shadow: 0 1px 2px rgba(20, 40, 25, 0.04), 0 8px 20px -12px rgba(20, 40, 25, 0.10);
    transition: box-shadow 0.18s ease, transform 0.18s ease;
}
.kpi-card:hover {
    box-shadow: 0 2px 4px rgba(20, 40, 25, 0.06), 0 14px 28px -14px rgba(20, 40, 25, 0.16);
    transform: translateY(-1px);
}
.kpi-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
}
.ki-bg-green  { background: #E8F2E6; color: var(--nk-primary); }
.ki-bg-blue   { background: #e3f0fc; color: #3793e6; }
.ki-bg-gray   { background: #f1f3f5; color: #6b7280; }
.ki-bg-orange { background: #fff1e0; color: #ff8c2c; }
.ki-bg-purple { background: #efe9fc; color: #7c5ce6; }
.ki-bg-red    { background: #fde8ec; color: #d9534f; }
.kpi-body { min-width: 0; }
[dir="rtl"] .kpi-body { text-align: right; }
[dir="ltr"] .kpi-body { text-align: left; }
.kpi-label { color: var(--nk-text); font-size: 0.88rem; font-weight: 600; }
.kpi-value { font-size: 1.45rem; font-weight: 800; color: var(--nk-primary); margin-top: 2px; line-height: 1; }
/* رقم المؤشر ياخذ لون دلالته (أخضر=إيجابي/أحمر=سلبي...) بدل نفس اللون الأساسي دائمًا */
.kpi-card:has(.ki-bg-blue)   .kpi-value { color: #3793e6; }
.kpi-card:has(.ki-bg-gray)   .kpi-value { color: #6b7280; }
.kpi-card:has(.ki-bg-orange) .kpi-value { color: #ff8c2c; }
.kpi-card:has(.ki-bg-purple) .kpi-value { color: #7c5ce6; }
.kpi-card:has(.ki-bg-red)    .kpi-value { color: #d9534f; }

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 16px;
}
@media (max-width: 1199px) { .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 575px)  { .kpi-grid { grid-template-columns: minmax(0, 1fr); } }

/* ---------- Listing card ---------- */
.list-card {
    background: #fff;
    border: 1px solid var(--nk-border);
    border-radius: 14px;
    padding: 1rem 1.15rem;
    box-shadow: 0 1px 2px rgba(20, 40, 25, 0.04), 0 8px 20px -12px rgba(20, 40, 25, 0.10);
}

.list-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.6rem;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.list-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    align-items: center;
    flex: 1;
    min-width: 0;
}

/* ---------- Inputs / selects ---------- */
.nk-input,
.nk-select {
    border: 1px solid var(--nk-border);
    background: #fff;
    border-radius: 10px;
    padding: 0.5rem 0.85rem;
    font-size: 0.88rem;
    color: var(--nk-text);
    min-height: 40px;
}
.nk-input:focus,
.nk-select:focus { outline: none; border-color: var(--nk-primary); box-shadow: 0 0 0 3px rgba(31,122,58,0.08); }

.search-wrap { position: relative; flex: 1 1 260px; max-width: 360px; min-width: 0; }
.search-wrap .nk-input { width: 100%; padding-inline-start: 2.25rem; }
.search-wrap .ki-outline {
    position: absolute;
    top: 50%; transform: translateY(-50%);
    color: var(--nk-muted);
    font-size: 1rem;
}
[dir="rtl"] .search-wrap .ki-outline { right: 0.7rem; }
[dir="ltr"] .search-wrap .ki-outline { left: 0.7rem; }

/* ---------- Buttons ---------- */
.nk-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 0.95rem;
    border-radius: 10px;
    font-size: 0.85rem;
    font-weight: 600;
    border: 1px solid var(--nk-border);
    background: #fff;
    color: var(--nk-text);
    cursor: pointer;
    min-height: 40px;
    white-space: nowrap;
    text-decoration: none;
    transition: border-color 0.15s ease, background-color 0.15s ease, color 0.15s ease, transform 0.1s ease;
}
.nk-btn:hover { border-color: var(--nk-primary); color: var(--nk-primary); }
.nk-btn:active { transform: scale(0.97); }
.nk-btn-primary { background: var(--nk-primary); color: #fff; border-color: var(--nk-primary); }
.nk-btn-primary:hover { background: #176330; border-color: #176330; color: #fff; }
.nk-btn-danger  { background: #fff; color: #d9534f; border-color: #f3d4d3; }
.nk-btn-danger:hover { background: #d9534f; color: #fff; border-color: #d9534f; }
.nk-btn-ghost   { background: transparent; border-color: transparent; }
.nk-btn-ghost:hover { background: var(--nk-primary-light); }

.toolbar-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }

/* Bulk-delete button is hidden until selection happens */
.nk-bulk-delete { display: none; }
.nk-bulk-delete.is-visible { display: inline-flex; }

/* ---------- Table ---------- */
.nk-table { width: 100% !important; border-collapse: collapse; }
.nk-table thead th {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--nk-muted);
    background: #fafbfa;
    border-bottom: 1px solid var(--nk-border);
    padding: 0.7rem 0.65rem;
    white-space: nowrap;
}
[dir="rtl"] .nk-table thead th { text-align: right; }
[dir="ltr"] .nk-table thead th { text-align: left; }
.nk-table tbody td {
    padding: 0.8rem 0.65rem;
    font-size: 0.88rem;
    color: var(--nk-text);
    border-bottom: 1px solid #f4f6f1;
    vertical-align: middle;
}
.nk-table tbody tr { transition: background-color 0.12s ease; }
.nk-table tbody tr:hover { background: var(--nk-primary-light); }

/* ---------- Empty state (no rows) ---------- */
.nk-table-empty {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--nk-muted);
}
.nk-table-empty i {
    display: block;
    font-size: 2.25rem;
    color: #c8d1c2;
    margin-bottom: 0.6rem;
}
.nk-table-empty .msg { font-size: 0.92rem; font-weight: 600; }
.nk-table-empty .hint {
    font-size: 0.8rem;
    font-weight: 400;
    color: var(--nk-muted);
    margin-top: 0.25rem;
    opacity: 0.85;
}
.nk-table-empty .retry-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    margin-top: 1rem;
    padding: 0.5rem 1.1rem;
    border-radius: 8px;
    border: 1px solid var(--nk-border);
    background: var(--nk-surface, #fff);
    color: var(--nk-text);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.15s ease, border-color 0.15s ease;
}
.nk-table-empty .retry-btn:hover { border-color: var(--nk-primary); color: var(--nk-primary); }

/* حالة خطأ فعلي (تعذّر الاتصال/فشل الخادم) — مختلفة بصريًا عن "لا توجد بيانات" حتى لا يظن
   المستخدم أن الشاشة فارغة فعلًا بينما السبب فشل التحميل */
.nk-table-empty.is-error i { color: #e0a45f; }
.nk-table-empty.is-error .msg { color: #c47a16; }
[data-bs-theme="dark"] .nk-table-empty.is-error i { color: #e0a45f; }
[data-bs-theme="dark"] .nk-table-empty.is-error .msg { color: #e8b45f; }
[data-bs-theme="dark"] .nk-table-empty .retry-btn { background: var(--nk-surface); border-color: var(--nk-border); color: var(--nk-text); }

/* ---------- Loading skeleton (shown while a table's ajax request is in flight) ---------- */
.nk-skeleton-row td {
    padding: 0.9rem 0.65rem;
    border-bottom: 1px solid #f4f6f1;
}
.nk-skeleton-bar {
    height: 14px;
    border-radius: 6px;
    width: 100%;
    background: linear-gradient(90deg, #eef1ec 25%, #f7f9f5 37%, #eef1ec 63%);
    background-size: 400% 100%;
    animation: nk-skeleton-shimmer 1.4s ease infinite;
}
@keyframes nk-skeleton-shimmer {
    0% { background-position: 100% 50%; }
    100% { background-position: 0 50%; }
}

/* Color chip (used by Groups, Items, etc.) */
.nk-color-chip {
    width: 22px;
    height: 22px;
    border-radius: 6px;
    display: inline-block;
    vertical-align: middle;
}

/* Avatar (used by Employees, Customers, Users, etc.) */
.nk-avatar {
    width: 34px; height: 34px;
    border-radius: 50%;
    background: var(--nk-primary-light);
    color: var(--nk-primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
    margin-inline-end: 0.55rem;
    vertical-align: middle;
}
.nk-name-wrap { display: inline-flex; align-items: center; min-width: 0; }
.nk-name { font-weight: 600; color: var(--nk-text); }
.nk-name-sub { font-size: 0.72rem; color: var(--nk-muted); }

/* Status badges */
.badge-status {
    font-size: 0.72rem;
    font-weight: 600;
    padding: 0.25rem 0.65rem;
    border-radius: 6px;
    display: inline-block;
}
.badge-active  { background: #E8F2E6; color: var(--nk-primary); }
.badge-hidden  { background: #f1f3f5; color: #6b7280; }
.badge-yes     { background: #E8F2E6; color: var(--nk-primary); }
.badge-no      { background: #fde8ec; color: #d9534f; }
.badge-pending { background: #fff1e0; color: #ff8c2c; }
.badge-neutral { background: #f1f3f5; color: #6b7280; }

/* Row action icon buttons */
.row-actions { display: flex; gap: 0.35rem; justify-content: flex-end; }
.row-icon-btn {
    width: 32px; height: 32px;
    border-radius: 8px;
    border: 1px solid var(--nk-border);
    background: #fff;
    color: var(--nk-muted);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.95rem;
    transition: border-color 0.15s ease, background-color 0.15s ease, color 0.15s ease, transform 0.1s ease;
}
.row-icon-btn:hover { border-color: var(--nk-primary); color: var(--nk-primary); transform: translateY(-1px); }
.row-icon-btn:active { transform: translateY(0); }
.row-icon-btn.danger:hover { border-color: #d9534f; color: #d9534f; }

/* ---------- Pagination ---------- */
.list-pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
    padding: 0.9rem 0.25rem 0.25rem;
}
.list-pagination:empty { display: none; }
.list-pagination .pager-info {
    font-size: 0.85rem;
    color: var(--nk-muted);
    font-weight: 500;
}
.list-pagination .pager-controls {
    display: flex;
    align-items: center;
    gap: 0.3rem;
}
.list-pagination .pager-btn {
    min-width: 34px;
    height: 34px;
    padding: 0 0.5rem;
    border-radius: 8px;
    border: 1px solid var(--nk-border);
    background: #fff;
    color: var(--nk-text);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: border-color .15s, background .15s, color .15s;
}
.list-pagination .pager-btn:hover:not([disabled]):not(.active) {
    border-color: var(--nk-primary);
    color: var(--nk-primary);
}
.list-pagination .pager-btn.active {
    background: var(--nk-primary);
    border-color: var(--nk-primary);
    color: #fff;
    cursor: default;
}
.list-pagination .pager-btn[disabled] {
    opacity: 0.45;
    cursor: not-allowed;
}
.list-pagination .pager-ellipsis {
    color: var(--nk-muted);
    padding: 0 0.2rem;
}

/* ---------- Modal — Nakha style ---------- */
.nk-modal .modal-dialog {
    max-width: 900px;
    width: calc(100% - 32px);
}
.nk-modal .modal-content {
    border: none;
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0,0,0,0.12);
}
/* Lighter backdrop so the page stays visible behind the modal */
.modal-backdrop.show { opacity: 0.45 !important; }
.modal-backdrop { transition: opacity 0.2s ease !important; }

/* انتقال دخول/خروج أنعم لكل المودالز بالبرنامج — تكبير+تلاشي بدل الانزلاق الافتراضي من الأعلى */
.modal.fade .modal-dialog {
    transform: scale(0.96) translateY(6px) !important;
    opacity: 0;
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.2s ease !important;
}
.modal.show .modal-dialog { transform: scale(1) translateY(0) !important; opacity: 1; }

.nk-modal .modal-header {
    border-bottom: 1px solid var(--nk-border);
    padding: 1rem 1.25rem;
    align-items: flex-start;
}
.nk-modal .modal-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--nk-text);
    line-height: 1.2;
}
.nk-modal .modal-body { padding: 1.25rem; }
.nk-modal .modal-footer { border-top: 1px solid var(--nk-border); padding: 0.85rem 1.25rem; gap: 0.5rem; }

/* Form grid inside modals */
.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.85rem 1rem;
}
[dir="rtl"] .form-grid { direction: rtl; }
[dir="ltr"] .form-grid { direction: ltr; }
.form-grid .full { grid-column: 1 / -1; }
@media (max-width: 575px) { .form-grid { grid-template-columns: minmax(0, 1fr); } }

.nk-field label {
    display: block;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--nk-text);
    margin-bottom: 0.3rem;
}
.nk-field label .req { color: #d9534f; }
.nk-field .nk-input { width: 100%; }
.nk-field textarea.nk-input { min-height: 70px; resize: vertical; }

/* حقول إلزامية — تمييز الحقل نفسه (مو بس علامة *) بلون مختلف عن الحقول الاختيارية،
   عبر :has() فحص وجود span.req داخل الـlabel — ينطبق تلقائيًا على كل الشاشات بدون
   لمس أي ملف view. أصفر/ذهبي (مو أحمر) عشان ما يتلخبط مع لون خطأ التحقق الفعلي. */
.nk-field:has(.req) .nk-input:not(.input-validation-error),
.nk-field:has(.req) .nk-select:not(.input-validation-error) {
    border-color: #c9a961;
}
.nk-field:has(.req) .nk-input:not(.input-validation-error):focus,
.nk-field:has(.req) .nk-select:not(.input-validation-error):focus {
    border-color: var(--nk-primary);
    box-shadow: 0 0 0 3px rgba(31, 122, 58, 0.12);
}
[data-bs-theme="dark"] .nk-field:has(.req) .nk-input:not(.input-validation-error),
[data-bs-theme="dark"] .nk-field:has(.req) .nk-select:not(.input-validation-error) {
    border-color: #d9bd7e;
}

/* ---------- Validation messages (asp-validation-for + jquery.validate.unobtrusive) ---------- */
.nk-input.input-validation-error,
.nk-select.input-validation-error {
    border-color: #c0392b !important;
    background-color: #FBE9E7 !important;
}
.nk-input.input-validation-error:focus,
.nk-select.input-validation-error:focus {
    box-shadow: 0 0 0 3px rgba(192, 57, 43, 0.14) !important;
}
.field-validation-error,
.validation-target {
    display: block;
    font-size: 0.78rem;
    font-weight: 600;
    color: #c0392b;
    margin-top: 0.35rem;
}
.field-validation-error:empty,
.validation-target:empty { display: none; margin-top: 0; }
.field-validation-error:not(:empty),
.validation-target:not(:empty) {
    display: flex;
    align-items: flex-start;
    gap: 0.4rem;
    animation: nk-validation-in 0.15s ease;
}
.field-validation-error:not(:empty)::before,
.validation-target:not(:empty)::before {
    content: "!";
    flex-shrink: 0;
    width: 15px; height: 15px;
    border-radius: 50%;
    background: #c0392b;
    color: #fff;
    font-size: 0.68rem;
    font-weight: 800;
    line-height: 15px;
    text-align: center;
    margin-top: 1px;
}
@keyframes nk-validation-in {
    from { opacity: 0; transform: translateY(-3px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Color picker (Groups/Items) */
.color-picker-wrap { display: flex; align-items: center; gap: 0.55rem; }
.color-picker-wrap input[type="color"] {
    width: 40px; height: 40px;
    border: 1px solid var(--nk-border);
    border-radius: 10px;
    padding: 0;
    background: #fff;
    cursor: pointer;
}

/* Switch */
.switch-row { display: flex; align-items: center; gap: 0.6rem; }
.nk-switch {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 22px;
}
.nk-switch input { opacity: 0; width: 0; height: 0; }
.nk-switch .slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: #d0d6cf;
    border-radius: 22px;
    transition: 0.2s;
}
.nk-switch .slider::before {
    content: "";
    position: absolute;
    height: 18px; width: 18px;
    top: 2px;
    background: #fff;
    border-radius: 50%;
    transition: 0.2s;
}
[dir="rtl"] .nk-switch .slider::before { right: 2px; }
[dir="ltr"] .nk-switch .slider::before { left: 2px; }
.nk-switch input:checked + .slider { background: var(--nk-primary); }
[dir="rtl"] .nk-switch input:checked + .slider::before { transform: translateX(-18px); }
[dir="ltr"] .nk-switch input:checked + .slider::before { transform: translateX(18px); }

/* Icon / file uploader */
.icon-uploader {
    border: 1px dashed #cfd6c9;
    border-radius: 12px;
    padding: 0.85rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: #fafbf7;
}
.icon-uploader .preview {
    width: 56px; height: 56px;
    border-radius: 12px;
    background: #fff;
    border: 1px solid var(--nk-border);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--nk-muted);
    font-size: 1.5rem;
}
.icon-uploader .hint { font-size: 0.78rem; color: var(--nk-muted); }

/* ---------- Modal sections + scrollable body (item modal) ---------- */
/* جسم النافذة قابل للتمرير داخليًا فقط حتى لا تتجاوز النافذة الشاشة */
.nk-modal.nk-modal-lg .modal-dialog { max-width: 960px; }
.nk-modal .modal-body.nk-scroll-body {
    max-height: calc(100vh - 220px);
    overflow-y: auto;
}

/* قسم داخل النافذة بعنوان */
.nk-section { margin-bottom: 1.1rem; }
.nk-section:last-child { margin-bottom: 0; }
.nk-section-title {
    display: flex; align-items: center; gap: 0.5rem;
    font-size: 0.92rem; font-weight: 800; color: var(--nk-primary);
    margin: 0 0 0.7rem;
    padding-bottom: 0.45rem;
    border-bottom: 1px solid var(--nk-border);
}
.nk-section-title i { font-size: 1.1rem; }
.nk-section-title .nk-section-num {
    width: 22px; height: 22px; border-radius: 6px;
    background: var(--nk-primary); color: #fff;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 0.78rem; font-weight: 800;
}

/* ---------- SimpleReport.js loading overlay ---------- */
.list-card.nk-loading { position: relative; }
.list-card.nk-loading::after {
    content: "";
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.7);
    border-radius: 14px;
    z-index: 5;
}
.list-card.nk-loading::before {
    content: "";
    position: absolute;
    top: 50%; left: 50%;
    width: 30px; height: 30px;
    margin: -15px 0 0 -15px;
    border-radius: 50%;
    border: 3px solid var(--nk-border);
    border-top-color: var(--nk-primary);
    animation: nk-spin 0.7s linear infinite;
    z-index: 6;
}

/* ---------- Toastr — نكهة identity (بدل الألوان الصارخة الافتراضية) -----------
   ملاحظة: النسخة المستخدمة بهذا التطبيق نسخة toastr معدّلة محليًا بأسماء أصناف
   مختلفة عن toastr القياسية (toastr-container/.toastr/.toastr-success... بدل
   toast-container/.toast/.toast-success...) — تأكّدنا من هذا عبر فحص الـ DOM
   الفعلي وقت ظهور تنبيه حقيقي، مش من توثيق toastr القياسي. */
#toastr-container > div {
    border-radius: 12px !important;
    box-shadow: 0 6px 24px rgba(20, 40, 25, 0.16) !important;
    opacity: 1 !important;
    padding: 14px 40px 14px 16px !important;
    background-image: none !important;
    font-family: inherit !important;
}
[dir="rtl"] #toastr-container > div { padding: 14px 16px 14px 40px !important; }
#toastr-container .toastr-title { font-weight: 700 !important; font-size: 0.92rem !important; margin-bottom: 2px; }
#toastr-container .toastr-message { font-size: 0.86rem !important; opacity: 0.92; }
#toastr-container > div .toastr-close-button {
    inset-inline-end: 10px; inset-inline-start: auto;
    top: 8px; position: absolute;
    opacity: 0.6; text-shadow: none; font-weight: 400;
}
#toastr-container > div .toastr-close-button:hover { opacity: 1; }

#toastr-container > .toastr-success {
    background-color: #E8F2E6 !important;
    color: #14401f !important;
    border-inline-start: 4px solid #1F7A3A !important;
}
#toastr-container > .toastr-error {
    background-color: #FBE9E7 !important;
    color: #7a2318 !important;
    border-inline-start: 4px solid #c0392b !important;
}
#toastr-container > .toastr-warning {
    background-color: #FFF4E0 !important;
    color: #7a4b06 !important;
    border-inline-start: 4px solid #d97706 !important;
}
#toastr-container > .toastr-info {
    background-color: #EAF1FB !important;
    color: #1c3a5e !important;
    border-inline-start: 4px solid #3793e6 !important;
}
[data-bs-theme="dark"] #toastr-container > .toastr-success { background-color: #163722 !important; color: #b6e3c6 !important; }
[data-bs-theme="dark"] #toastr-container > .toastr-error   { background-color: #3a2020 !important; color: #f0bdb6 !important; }
[data-bs-theme="dark"] #toastr-container > .toastr-warning { background-color: #3a2e14 !important; color: #f0d9a6 !important; }
[data-bs-theme="dark"] #toastr-container > .toastr-info    { background-color: #16273a !important; color: #b6d3f0 !important; }

/* ---------- DataTables loading overlay ---------- */
/* While skeleton placeholder rows are shown (see DefinitionListPage.js showSkeleton),
   hide the opaque spinner overlay so the skeleton rows are visible instead. */
.dataTables_wrapper.dt-skeleton-active .dataTables_processing { display: none !important; }
.dataTables_wrapper .dataTables_processing {
    background: rgba(255, 255, 255, 0.85);
    box-shadow: none;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
}
.nk-dt-spinner {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 3px solid var(--nk-border);
    border-top-color: var(--nk-primary);
    animation: nk-spin 0.7s linear infinite;
}
@keyframes nk-spin { to { transform: rotate(360deg); } }

/* ---------- DataTables overrides ---------- */
.dataTables_wrapper .dataTables_length select,
.dataTables_wrapper .dataTables_filter input {
    border: 1px solid var(--nk-border) !important;
    border-radius: 10px !important;
    height: 36px;
    padding: 0 0.6rem !important;
}
.dataTables_wrapper .dataTables_paginate .paginate_button.current,
.dataTables_wrapper .dataTables_paginate .paginate_button.current:hover {
    background: var(--nk-primary) !important;
    color: #fff !important;
    border-color: var(--nk-primary) !important;
    border-radius: 8px !important;
}
.dataTables_wrapper .dataTables_filter { display: none; } /* we use our own search */

/* ---------- البحث الموحّد (Cmd/Ctrl+K) ---------- */
.nk-cmdk-backdrop {
    position: fixed; inset: 0;
    background: rgba(15, 22, 17, 0.5);
    z-index: 10500;
    opacity: 0; visibility: hidden;
    transition: opacity 0.15s ease;
}
.nk-cmdk-backdrop.show { opacity: 1; visibility: visible; }

.nk-cmdk {
    position: fixed;
    top: 14vh; left: 50%;
    transform: translateX(-50%) translateY(-8px);
    width: 100%; max-width: 560px;
    background: var(--nk-surface);
    border: 1px solid var(--nk-border);
    border-radius: 16px;
    box-shadow: 0 30px 70px -18px rgba(10, 25, 16, 0.35);
    z-index: 10501;
    opacity: 0; visibility: hidden;
    transition: opacity 0.15s ease, transform 0.15s ease;
    overflow: hidden;
    max-height: 70vh;
    display: flex;
    flex-direction: column;
}
.nk-cmdk.show { opacity: 1; visibility: visible; transform: translateX(-50%) translateY(0); }

.nk-cmdk-input-wrap {
    display: flex; align-items: center; gap: 0.6rem;
    padding: 0.9rem 1.1rem;
    border-bottom: 1px solid var(--nk-border);
    flex: 0 0 auto;
}
.nk-cmdk-input-wrap i { color: var(--nk-muted); font-size: 1.1rem; }
.nk-cmdk-input {
    flex: 1 1 auto;
    border: none; outline: none;
    background: transparent;
    font-size: 1rem;
    color: var(--nk-text);
    font-family: inherit;
}
.nk-cmdk-input::placeholder { color: var(--nk-muted); }
.nk-cmdk-esc {
    font-size: 0.72rem; font-weight: 700;
    color: var(--nk-muted);
    border: 1px solid var(--nk-border);
    border-radius: 6px;
    padding: 0.1rem 0.4rem;
}

.nk-cmdk-list { overflow-y: auto; padding: 0.5rem; }
.nk-cmdk-group {
    font-size: 0.72rem; font-weight: 700;
    color: var(--nk-muted);
    padding: 0.6rem 0.7rem 0.3rem;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}
.nk-cmdk-item {
    display: flex; align-items: center; gap: 0.7rem;
    padding: 0.6rem 0.7rem;
    border-radius: 10px;
    cursor: pointer;
    color: var(--nk-text);
}
.nk-cmdk-item-icon {
    flex: 0 0 auto;
    width: 30px; height: 30px;
    border-radius: 8px;
    background: var(--nk-primary-light, #e8f2e6);
    color: var(--nk-primary);
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 0.95rem;
}
.nk-cmdk-item-title { flex: 1 1 auto; font-size: 0.92rem; font-weight: 600; }
.nk-cmdk-item-go { color: var(--nk-muted); font-size: 0.85rem; opacity: 0; transition: opacity 0.1s; }
.nk-cmdk-item.active { background: var(--nk-primary-light, #e8f2e6); }
.nk-cmdk-item.active .nk-cmdk-item-go { opacity: 1; }
.nk-cmdk-item.active .nk-cmdk-item-title { color: var(--nk-primary); }

.nk-cmdk-empty {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 0.5rem; padding: 2.5rem 1rem;
    color: var(--nk-muted);
}
.nk-cmdk-empty i { font-size: 2rem; }

/* ---------- مركز الإشعارات ---------- */
.nk-notif-badge {
    position: absolute;
    top: -4px; inset-inline-end: -4px;
    min-width: 18px; height: 18px;
    border-radius: 999px;
    background: #d64545;
    color: #fff;
    font-size: 0.65rem;
    font-weight: 800;
    display: inline-flex; align-items: center; justify-content: center;
    padding: 0 4px;
    border: 2px solid var(--nk-surface, #fff);
}
.nk-notif-panel {
    position: absolute;
    top: 62px;
    inset-inline-end: 20px;
    width: 360px;
    max-height: 420px;
    background: var(--nk-surface);
    border: 1px solid var(--nk-border);
    border-radius: 14px;
    box-shadow: 0 20px 50px -14px rgba(10, 25, 16, 0.28);
    z-index: 10400;
    display: none;
    flex-direction: column;
    overflow: hidden;
}
.nk-notif-panel.show { display: flex; }
.nk-notif-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 0.8rem 1rem;
    border-bottom: 1px solid var(--nk-border);
    font-weight: 700;
    font-size: 0.92rem;
    color: var(--nk-text);
}
.nk-notif-head button {
    border: none; background: transparent;
    color: var(--nk-primary);
    font-size: 0.78rem;
    font-weight: 700;
    cursor: pointer;
}
.nk-notif-list { overflow-y: auto; }
.nk-notif-item {
    display: flex; align-items: flex-start; gap: 0.7rem;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--nk-border);
    text-decoration: none;
    color: inherit;
}
.nk-notif-item:last-child { border-bottom: none; }
.nk-notif-item:hover { background: var(--nk-bg); }
.nk-notif-item-icon {
    flex: 0 0 auto;
    width: 32px; height: 32px;
    border-radius: 9px;
    background: var(--nk-primary-light, #e8f2e6);
    color: var(--nk-primary);
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 1rem;
}
.nk-notif-item-body { flex: 1 1 auto; min-width: 0; }
.nk-notif-item-msg { font-size: 0.86rem; font-weight: 600; color: var(--nk-text); line-height: 1.4; }
.nk-notif-item.unread .nk-notif-item-msg { font-weight: 700; }
.nk-notif-item-time { font-size: 0.72rem; color: var(--nk-muted); margin-top: 2px; }
.nk-notif-item-dot {
    flex: 0 0 auto;
    width: 8px; height: 8px; border-radius: 50%;
    background: var(--nk-primary);
    margin-top: 6px;
}
.nk-notif-empty {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 0.5rem; padding: 2.5rem 1rem;
    color: var(--nk-muted);
}
.nk-notif-empty i { font-size: 2rem; }
.nk-notif-footer {
    border-top: 1px solid var(--nk-border);
    padding: 0.6rem 1rem;
    text-align: center;
}
.nk-notif-footer a {
    font-size: 0.8rem; font-weight: 700; color: var(--nk-primary); text-decoration: none;
}
.nk-notif-footer a:hover { text-decoration: underline; }

/* زر تشغيل البحث بالهيدر */
.nk-cmdk-trigger-hint {
    font-size: 0.7rem; font-weight: 700;
    border: 1px solid var(--nk-border);
    border-radius: 6px;
    padding: 0.05rem 0.4rem;
    color: var(--nk-muted);
}
