:root {
    --app-bg: #f5f7fb;
    --app-surface: #ffffff;
    --app-border: #e2e8f0;
    --app-primary: #334155;
    --app-primary-hover: #1e293b;
    --app-accent: #2563eb;
    --app-success: #198754;
    --app-danger: #dc3545;
    --app-warning: #f59e0b;
    --app-text: #1f2937;
    --app-text-muted: #64748b;
    --app-radius: 0.625rem;
    --app-shadow: 0 0.125rem 0.625rem rgb(0 0 0 / 6%);
}

/* =========================
   BASE
========================= */

html,
body {
    margin: 0;
    min-height: 100%;
    background: var(--app-bg);
    color: var(--app-text);
    font-family: Arial, "Segoe UI", sans-serif;
}

body {
    font-size: 0.875rem;
}

/* =========================
   APPLICATION LAYOUT
========================= */

.app-layout {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--app-bg);
}


/* =========================
   HEADER
========================= */

.app-header {
    width: 100%;
    min-height: 4.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 2%;
    background: var(--app-surface);
    border-bottom: 0.0625rem solid var(--app-border);
    box-shadow: 0 0.125rem 0.5rem rgb(0 0 0 / 5%);
    box-sizing: border-box;
}


/* =========================
   HEADER BRAND
========================= */

.app-header-brand {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    min-width: 0;
}

.app-header-logo {
    width: auto;
    height: 3rem;
    object-fit: contain;
    flex-shrink: 0;
}

.app-header-system {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.app-header-system-name {
    color: var(--app-text);
    font-size: 1.05rem;
    font-weight: 600;
    white-space: nowrap;
}

.app-header-system-name-en {
    color: var(--app-text-muted);
    font-size: 0.75rem;
    white-space: nowrap;
}


/* =========================
   HEADER USER
========================= */

.app-header-user {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.app-header-user-icon {
    width: 2.3rem;
    height: 2.3rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: #f1f5f9;
    font-size: 1.1rem;
}

.app-header-user-info {
    display: flex;
    flex-direction: column;
}

.app-header-user-name {
    color: var(--app-text);
    font-weight: 600;
    white-space: nowrap;
}

.app-header-user-role {
    color: var(--app-text-muted);
    font-size: 0.75rem;
}



/* Keep the contents themselves in the correct writing direction */
.app-body.arabic-layout .app-menu,
.app-body.arabic-layout .app-content {
    direction: rtl;
}

.app-body.english-layout .app-menu,
.app-body.english-layout .app-content {
    direction: ltr;
}

/* =========================
   MAIN CONTENT
========================= */

.app-main {
    width: 100%;
    box-sizing: border-box;
}


/* =========================
   MOBILE HEADER
========================= */

@media (max-width: 48rem) {

    .app-header {
        padding-inline: 4%;
    }

    .app-header-logo {
        height: 2.5rem;
    }

    .app-header-system-name {
        font-size: 0.9rem;
    }

    .app-header-system-name-en {
        display: none;
    }

    .app-header-user-role {
        display: none;
    }

    .app-header-user-name {
        font-size: 0.8rem;
    }
}

/* =========================
   PAGE
========================= */

.page-container {
    padding: 1.5rem;
}

.page-title {
    margin: 0;
    font-size: 1.375rem;
    font-weight: 600;
    color: var(--app-text);
}

.page-subtitle {
    margin-top: 0.25rem;
    color: var(--app-text-muted);
}

/* =========================
   TOOLBAR
========================= */

.page-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.875rem 1.125rem;
    margin-bottom: 1rem;
    background: var(--app-surface);
    border: 0.0625rem solid var(--app-border);
    border-radius: var(--app-radius);
    box-shadow: var(--app-shadow);
}

    .page-toolbar h3 {
        margin: 0;
        font-size: 1.125rem;
        font-weight: 600;
    }

/* =========================
   BUTTONS
========================= */

.btn-add,
.btn-app-primary {
    padding: 0.5rem 1rem;
    background: var(--app-accent);
    color: white;
    border: 0.0625rem solid var(--app-accent);
    border-radius: 0.4375rem;
    cursor: pointer;
    transition: background-color .2s ease, border-color .2s ease, transform .1s ease;
}

    .btn-add:hover,
    .btn-app-primary:hover {
        background: #1d4ed8;
        border-color: #1d4ed8;
    }

    .btn-add:active,
    .btn-app-primary:active {
        transform: scale(.98);
    }

.btn-app-secondary {
    padding: 0.5rem 1rem;
    background: white;
    color: var(--app-text);
    border: 0.0625rem solid var(--app-border);
    border-radius: 0.4375rem;
    cursor: pointer;
}

    .btn-app-secondary:hover {
        background: #f8fafc;
    }

.btn-app-danger {
    padding: 0.5rem 1rem;
    background: var(--app-danger);
    color: white;
    border: 0.0625rem solid var(--app-danger);
    border-radius: 0.4375rem;
    cursor: pointer;
}

    .btn-app-danger:hover {
        background: #bb2d3b;
    }

.btn-icon {
    padding: 0.3125rem 0.5rem;
    border: 0;
    border-radius: 0.375rem;
    background: transparent;
    cursor: pointer;
}

    .btn-icon:hover {
        background: #f1f5f9;
    }


/* =========================
   ICON ACTION BUTTONS
========================= */

.btn-icon-action {
    width: 2.2rem;
    height: 2.2rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    background: var(--app-surface);
    color: var(--app-text);
    border: 0.0625rem solid var(--app-border);
    border-radius: 0.5rem;
    cursor: pointer;
    transition: background-color .2s ease, color .2s ease, border-color .2s ease, transform .15s ease, box-shadow .2s ease;
}

    .btn-icon-action i {
        font-size: 0.95rem;
        line-height: 1;
    }

    .btn-icon-action:hover {
        transform: translateY(-0.0625rem);
        box-shadow: 0 0.125rem 0.375rem rgb(0 0 0 / 8%);
    }

    .btn-icon-action:active {
        transform: scale(.95);
    }

    .btn-icon-action.add,
    .btn-icon-action.edit {
        color: #1d4ed8;
        background: #e8efff;
        border-color: #b8c8f5;
    }

        .btn-icon-action.add:hover,
        .btn-icon-action.edit:hover {
            background: #dce7ff;
            border-color: #8eabec;
        }

    .btn-icon-action.save {
        color: #157347;
        background: #e2f3e9;
        border-color: #acd5bb;
    }

        .btn-icon-action.save:hover {
            background: #d4eadc;
            border-color: #8cc29f;
        }

    .btn-icon-action.delete {
        color: #b91c1c;
        background: #fbe7e7;
        border-color: #e7b2b2;
    }

        .btn-icon-action.delete:hover {
            background: #f6d8d8;
            border-color: #d99191;
        }

    .btn-icon-action.cancel {
        color: #475569;
        background: #e9edf2;
        border-color: #cbd5e1;
    }

        .btn-icon-action.cancel:hover {
            background: #dce2e9;
            border-color: #aebaca;
        }

/* =========================
   CARD
========================= */

.app-card {
    background: var(--app-surface);
    border: 0.0625rem solid var(--app-border);
    border-radius: var(--app-radius);
    box-shadow: var(--app-shadow);
}

/* =========================
   TABLE
========================= */

.table-container {
    width: 100%;
    overflow-x: auto;
    background: var(--app-surface);
    border: 0.0625rem solid var(--app-border);
    border-radius: var(--app-radius);
    box-shadow: var(--app-shadow);
}

.app-table {
    width: 100%;
    border-collapse: collapse;
    margin: 0;
}

    .app-table thead th {
        padding: 0.6rem 0.75rem;
        background: #f8fafc;
        color: #475569;
        font-weight: 600;
        border-bottom: 0.0625rem solid var(--app-border);
        text-align: start;
        white-space: nowrap;
    }

    .app-table tbody td {
        padding: 0.52rem 0.75rem;
        border-bottom: 0.0625rem solid #edf1f5;
        vertical-align: middle;
        text-align: start;
    }

    .app-table tbody tr {
        transition: background-color .15s ease;
    }

        .app-table tbody tr:hover {
            background: #fafcff;
        }

        .app-table tbody tr:last-child td {
            border-bottom: 0;
        }

.actions,
.table-actions {
    width: 1%;
    white-space: nowrap;
    text-align: end;
}

    .actions button {
        margin-inline-start: 0.375rem;
    }

/* =========================
   FORM
========================= */

.form-label {
    display: block;
    margin-bottom: 0.375rem;
    color: #374151;
    font-weight: 500;
}

.form-control,
.form-select,
.app-input {
    width: 100%;
    padding: 0.5625rem 0.6875rem;
    border: 0.0625rem solid #cbd5e1;
    border-radius: 0.4375rem;
    background: white;
    color: var(--app-text);
    outline: none;
    box-sizing: border-box;
    transition: border-color .2s ease, box-shadow .2s ease;
}

    .form-control:focus,
    .form-select:focus,
    .app-input:focus {
        border-color: var(--app-accent);
        box-shadow: 0 0 0 0.2rem rgb(37 99 235 / 12%);
    }

.checkbox-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.625rem;
}

/* =========================
   DYNAMIC DRAWER
========================= */

.app-drawer-overlay {
    position: fixed;
    inset: 0;
    background: rgb(15 23 42 / 40%);
    z-index: 1040;
    opacity: 0;
    animation: appFadeIn .2s ease forwards;
}

.app-drawer {
    position: fixed;
    background: var(--app-surface);
    z-index: 1050;
    display: flex;
    flex-direction: column;
    box-shadow: 0 0.5rem 1.875rem rgb(0 0 0 / 18%);
    opacity: 1;
    box-sizing: border-box;
    overflow: hidden;
}

    .app-drawer *,
    .app-drawer *::before,
    .app-drawer *::after {
        box-sizing: border-box;
        max-width: 100%;
    }

    /* RIGHT */

    .app-drawer.right {
        top: 0;
        right: 0;
        width: var(--drawer-width, 45vw);
        max-width: 100vw;
        height: 100vh;
        animation: drawerFromRight .3s ease;
    }

    /* LEFT */

    .app-drawer.left {
        top: 0;
        left: 0;
        width: var(--drawer-width, 45vw);
        max-width: 100vw;
        height: 100vh;
        animation: drawerFromLeft .3s ease;
    }

    /* TOP */

    .app-drawer.top {
        top: 0;
        left: 0;
        width: 100%;
        height: var(--drawer-height, 40vh);
        max-height: 100vh;
        animation: drawerFromTop .3s ease;
    }

    /* BOTTOM */

    .app-drawer.bottom {
        bottom: 0;
        left: 0;
        width: 100%;
        height: var(--drawer-height, 40vh);
        max-height: 100vh;
        animation: drawerFromBottom .3s ease;
    }

/* =========================
   DRAWER HEADER
========================= */

.app-drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.125rem 1.25rem;
    border-bottom: 0.0625rem solid var(--app-border);
    flex-shrink: 0;
}

    .app-drawer-header h3,
    .app-drawer-header h4 {
        margin: 0;
        font-size: 1.125rem;
        font-weight: 600;
    }

/* =========================
   DRAWER BODY
========================= */


.app-drawer-body {
    flex: 1;
    padding: 1.25rem;
    overflow-y: auto;
    overflow-x: visible;
    min-width: 0;
    box-sizing: border-box;
}

    .app-drawer-body .form-group {
        margin-bottom: 1rem;
    }

/* =========================
   DRAWER FOOTER
========================= */

.app-drawer-footer {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 0.5rem;
    padding: 0.875rem 1.25rem;
    border-top: 0.0625rem solid var(--app-border);
    flex-shrink: 0;
}

/* =========================
   CONFIRM / MODAL
========================= */

.confirm-overlay,
.app-modal-overlay {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgb(15 23 42 / 40%);
    z-index: 1060;
    animation: appFadeIn .2s ease;
}

.confirm-box,
.app-modal {
    width: 30vw;
    max-width: 92vw;
    background: white;
    border-radius: var(--app-radius);
    box-shadow: 0 0.9375rem 2.5rem rgb(0 0 0 / 18%);
    animation: appModalIn .2s ease;
}

.confirm-box {
    padding: 1.5rem;
}

.app-modal-header {
    padding: 1.125rem 1.25rem;
    border-bottom: 0.0625rem solid var(--app-border);
}

.app-modal-body {
    padding: 1.25rem;
}

.app-modal-footer,
.confirm-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.625rem;
}

.app-modal-footer {
    padding: 0.875rem 1.25rem;
    border-top: 0.0625rem solid var(--app-border);
}

.confirm-actions {
    margin-top: 1.25rem;
}

/* =========================
   NOTIFICATION
========================= */

.notification,
.app-notification {
    position: fixed;
    top: 2vh;
   
    min-width: 18rem;
    max-width: 35vw;
    padding: 0.8125rem 1rem;
    border-radius: 0.5rem;
    color: white;
    box-shadow: 0 0.5rem 1.5625rem rgb(0 0 0 / 15%);
    z-index: 2000;
    animation: notificationIn .25s ease;
}

    .notification.success,
    .app-notification-success {
        background: var(--app-success);
    }

    .notification.error,
    .app-notification-error {
        background: var(--app-danger);
    }
/* Arabic -> Left */
html[dir="rtl"] .app-notification {
    left: 1.5rem;
    right: auto;
}

/* English -> Right */
html[dir="ltr"] .app-notification {
    right: 1.5rem;
    left: auto;
}
/* =========================
   STATUS
========================= */

.status-active {
    display: inline-block;
    padding: 0.25rem 0.5625rem;
    border-radius: 1.25rem;
    background: #dcfce7;
    color: #166534;
    font-size: 0.75rem;
    font-weight: 600;
}

.status-inactive {
    display: inline-block;
    padding: 0.25rem 0.5625rem;
    border-radius: 1.25rem;
    background: #fee2e2;
    color: #991b1b;
    font-size: 0.75rem;
    font-weight: 600;
}

/* =========================
   SIDEBAR
========================= */

.app-sidebar {
    background: var(--app-primary);
    color: white;
}

    .app-sidebar a {
        color: #cbd5e1;
        text-decoration: none;
    }

        .app-sidebar a:hover {
            color: white;
        }

        .app-sidebar a.active {
            background: rgb(255 255 255 / 10%);
            color: white;
        }

/* =========================
   TOPBAR
========================= */

.app-topbar {
    height: 3.625rem;
    display: flex;
    align-items: center;
    padding: 0 1.25rem;
    background: white;
    border-bottom: 0.0625rem solid var(--app-border);
}

/* =========================
   ANIMATIONS
========================= */

@keyframes appFadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes drawerFromRight {
    from {
        transform: translateX(100%);
    }

    to {
        transform: translateX(0);
    }
}

@keyframes drawerFromLeft {
    from {
        transform: translateX(-100%);
    }

    to {
        transform: translateX(0);
    }
}

@keyframes drawerFromTop {
    from {
        transform: translateY(-100%);
    }

    to {
        transform: translateY(0);
    }
}

@keyframes drawerFromBottom {
    from {
        transform: translateY(100%);
    }

    to {
        transform: translateY(0);
    }
}

@keyframes appModalIn {
    from {
        opacity: 0;
        transform: scale(.96);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes notificationIn {
    from {
        opacity: 0;
        transform: translateY(-10%);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}
/* =========================
   DRAWER CLOSE ANIMATIONS
========================= */

.app-drawer.right.closing {
    animation: drawerToRight .3s ease forwards;
}

.app-drawer.left.closing {
    animation: drawerToLeft .3s ease forwards;
}

.app-drawer.top.closing {
    animation: drawerToTop .3s ease forwards;
}

.app-drawer.bottom.closing {
    animation: drawerToBottom .3s ease forwards;
}

.app-drawer-overlay.closing {
    animation: appFadeOut .3s ease forwards;
}

@keyframes drawerToRight {
    from {
        transform: translateX(0);
    }

    to {
        transform: translateX(100%);
    }
}

@keyframes drawerToLeft {
    from {
        transform: translateX(0);
    }

    to {
        transform: translateX(-100%);
    }
}

@keyframes drawerToTop {
    from {
        transform: translateY(0);
    }

    to {
        transform: translateY(-100%);
    }
}

@keyframes drawerToBottom {
    from {
        transform: translateY(0);
    }

    to {
        transform: translateY(100%);
    }
}

@keyframes appFadeOut {
    from {
        opacity: 1;
    }

    to {
        opacity: 0;
    }
}
/* =========================
   RESPONSIVE
========================= */

@media (max-width: 48rem) {

    .page-container {
        padding: 0.875rem;
    }

    .page-toolbar {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
    }

    .app-drawer.right,
    .app-drawer.left {
        width: 95vw;
        max-width: 95vw;
    }

    .app-drawer.top,
    .app-drawer.bottom {
        height: 90vh;
        max-height: 90vh;
    }

    .confirm-box,
    .app-modal {
        width: 90vw;
        max-width: 90vw;
    }

    .notification,
    .app-notification {
        left: 4vw;
        right: 4vw;
        min-width: auto;
        max-width: none;
    }
}


/* =========================
   HEADER ACTIONS
========================= */

.app-header-actions,
.app-header-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}


/* =========================
   LANGUAGE BUTTON
========================= */

.app-language-button {
    min-width: 2.35rem;
    height: 2.35rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    padding: 0 0.65rem;
    border: 0.0625rem solid #cbd5e1;
    border-radius: 0.5rem;
    background: #e2e8f0;
    color: var(--app-primary);
    font-weight: 700;
    cursor: pointer;
    transition: background-color .2s ease, border-color .2s ease, transform .15s ease;
}

    .app-language-button:hover {
        background: #cbd5e1;
        border-color: #94a3b8;
        transform: translateY(-0.0625rem);
    }

    .app-language-button:active {
        transform: scale(.95);
    }


/* =========================
   FOOTER
========================= */

.app-footer {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    padding: 0.75rem 2%;
    background: var(--app-surface);
    color: var(--app-text-muted);
    border-top: 0.0625rem solid var(--app-border);
    text-align: center;
    font-size: 0.8rem;
    box-sizing: border-box;
}

/* =========================
   MAIN LAYOUT BODY
========================= */

.app-body {
    display: flex;
    flex-direction: row;
    direction: ltr;
    width: 100%;
    flex: 1;
    min-height: 0;
}

    /* English: menu LEFT */
    .app-body.english-layout {
        flex-direction: row;
    }

    /* Arabic: menu RIGHT */
    .app-body.arabic-layout {
        flex-direction: row-reverse;
    }

/* =========================
   MAIN MENU - RIGHT SIDE
========================= */

.app-menu {
    width: 0;
    flex-shrink: 0;
    overflow: hidden;
    background: var(--app-primary);
    color: white;
    transition: width .3s ease;
}

    .app-menu.open {
        width: 22vw;
    }

.app-menu-inner {
    width: 22vw;
    min-height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
}


/* Keep the contents themselves in the correct writing direction */
.app-body.arabic-layout .app-menu,
.app-body.arabic-layout .app-content {
    direction: rtl;
}

.app-body.english-layout .app-menu,
.app-body.english-layout .app-content {
    direction: ltr;
}

/* =========================
   MAIN CONTENT
========================= */

.app-content {
    flex: 1;
    min-width: 0;
    box-sizing: border-box;
    transition: width .3s ease;
}

/* =========================
   HEADER RIGHT / MENU BUTTON
========================= */

.app-header-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.app-menu-button {
    width: 2.45rem;
    height: 2.45rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border: 0;
    border-radius: 0.5rem;
    background: #f1f5f9;
    color: var(--app-text);
    font-size: 1.25rem;
    cursor: pointer;
    transition: background-color .2s ease, transform .2s ease;
}

    .app-menu-button:hover {
        background: #e2e8f0;
    }

    .app-menu-button:active {
        transform: scale(.95);
    }

@media (max-width: 48rem) {
    .app-menu.open {
        width: 75vw;
    }

    .app-menu-inner {
        width: 75vw;
    }
}

/* =========================
   NAV MENU
========================= */

.nav-menu {
    display: flex;
    flex-direction: column;
    gap: 0.12rem;
    padding: 0.65rem 0.6rem;
}

.nav-menu-item {
    width: 100%;
}

.nav-menu-link,
.nav-menu-parent {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 0.55rem;
    padding-block: 0.48rem;
    padding-inline-start: calc(0.65rem + (var(--menu-level) * 0.9rem));
    padding-inline-end: 0.65rem;
    box-sizing: border-box;
    border-radius: 0.5rem;
    color: rgb(255 255 255 / 82%);
    text-decoration: none;
    font-size: 0.84rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color .2s ease, color .2s ease;
}

    .nav-menu-link:hover,
    .nav-menu-parent:hover {
        background: rgb(255 255 255 / 8%);
        color: white;
    }

    .nav-menu-link.active {
        background: rgb(255 255 255 / 12%);
        color: white;
    }

.nav-menu-icon {
    width: 1.15rem;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
}

.nav-menu-text {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.nav-menu-arrow {
    flex-shrink: 0;
    margin-inline-start: auto;
    margin-inline-end: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1rem;
    font-size: 0.65rem;
    opacity: 0.75;
}

.nav-submenu {
    display: flex;
    flex-direction: column;
    gap: 0.08rem;
}

/* =========================
   PAGER
========================= */

.app-pager {
    width: auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 0.85rem;
    /* نفس مستوى الجدول من اليمين واليسار */
    margin-inline: 2rem;
}


/* Page Size */

.pager-page-size {
    display: flex;
    align-items: center;
    gap: 0.45rem;
}

.pager-page-size-label {
    color: var(--app-text-muted);
    font-size: 0.82rem;
    font-weight: 600;
}

.pager-page-size-select {
    height: 2.2rem;
    min-width: 4rem;
    padding-inline: 0.6rem;
    border: 0.0625rem solid var(--app-border);
    border-radius: 0.5rem;
    background: var(--app-surface);
    color: var(--app-text);
    font-size: 0.82rem;
    outline: none;
    cursor: pointer;
}

    .pager-page-size-select:focus {
        border-color: var(--app-accent);
    }


/* Navigation */

.pager-navigation {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    direction: ltr;
}


/* Buttons */

.pager-button {
    width: 2.2rem;
    height: 2.2rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 0.0625rem solid #b8c8f5;
    border-radius: 0.5rem;
    background: #e8efff;
    color: #1d4ed8;
    cursor: pointer;
    transition: background-color .2s ease, border-color .2s ease, transform .15s ease, box-shadow .2s ease;
}

    .pager-button i {
        font-size: 0.8rem;
    }

    .pager-button:hover:not(:disabled) {
        background: #dce7ff;
        border-color: #8eabec;
        transform: translateY(-0.0625rem);
        box-shadow: 0 0.125rem 0.375rem rgb(0 0 0 / 8%);
    }

    .pager-button:active:not(:disabled) {
        transform: scale(.95);
    }

    .pager-button:disabled {
        background: #f1f5f9;
        border-color: #e2e8f0;
        color: #94a3b8;
        cursor: default;
        box-shadow: none;
    }


/* Page Number */

.pager-info {
    min-width: 4.5rem;
    height: 2.2rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    padding-inline: 0.75rem;
    background: var(--app-surface);
    border: 0.0625rem solid var(--app-border);
    border-radius: 0.5rem;
    color: var(--app-text-muted);
    font-size: 0.82rem;
    font-weight: 600;
}

.pager-current {
    color: var(--app-accent);
    font-weight: 700;
}

.pager-separator {
    color: #94a3b8;
}

.toolbar-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

    .toolbar-actions .toolbar-btn {
        position: static;
        width: 2.75rem;
        height: 2.75rem;
        padding: 0;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        border-radius: 0.65rem;
        flex-shrink: 0;
    }

        .toolbar-actions .toolbar-btn i {
            font-size: 1.15rem;
        }

    /* Search */
    .toolbar-actions .filter {
        background: #ffffff;
        border: 0.0625rem solid #d8e0eb;
        color: #334155;
    }

        .toolbar-actions .filter:hover {
            background: #f8fafc;
        }

    /* Clear active filters */
    .toolbar-actions .clear-filter {
        background: #fff5f5;
        border: 0.0625rem solid #fecaca;
        color: #dc2626;
    }

        .toolbar-actions .clear-filter:hover {
            background: #fee2e2;
        }

.clear-filter {
    position: relative !important;
}

.clear-filter-x {
    position: absolute;
    right: 0.15rem;
    bottom: 0.1rem;
    font-size: 0.9rem !important;
    font-weight: 700;
}

/* ================================
   RESPONSIVE TABLE VISIBILITY
   ================================ */

/* Desktop: كل الأعمدة ظاهرة */
.hide-tablet,
.hide-mobile,
.mobile-only,
.tablet-only {
    display: table-cell;
}

/* Tablet */
@media (max-width: 64rem) {

    .hide-tablet {
        display: none !important;
    }

    .tablet-only {
        display: table-cell !important;
    }
}

/* Mobile */
@media (max-width: 48rem) {

    .hide-mobile,
    .hide-tablet {
        display: none !important;
    }

    .mobile-only {
        display: table-cell !important;
    }

    .app-table {
        width: 100%;
        table-layout: auto;
    }

        .app-table th,
        .app-table td {
            white-space: nowrap;
        }

    .table-container {
        width: 100%;
        overflow-x: auto;
    }
}

/* Desktop فقط */
@media (min-width: 48.01rem) {

    .mobile-only {
        display: none !important;
    }
}

/* خارج التابلت */
@media (min-width: 64.01rem) {

    .tablet-only {
        display: none !important;
    }
}

/* =========================================================
   RESPONSIVE MAIN LAYOUT - TABLET & MOBILE
   ========================================================= */

@media (max-width: 64rem) {

    /* منع الصفحة بالكامل من التوسع خارج عرض الجهاز */
    html,
    body {
        width: 100%;
        max-width: 100%;
        overflow-x: hidden;
    }

    .app-layout {
        width: 100%;
        max-width: 100%;
        overflow-x: hidden;
    }

    /* =========================
       HEADER
       ========================= */

    .app-header {
        width: 100%;
        max-width: 100%;
        min-width: 0;
        padding: 0.65rem 0.75rem;
        gap: 0.5rem;
        overflow: hidden;
    }

    .app-header-brand {
        min-width: 0;
        flex: 0 1 auto;
        gap: 0.5rem;
    }

    .app-header-logo {
        height: 2.4rem;
        max-width: 5rem;
        flex-shrink: 0;
    }

    .app-header-system {
        min-width: 0;
        overflow: hidden;
    }

    .app-header-system-name {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .app-header-system-name-en {
        display: none;
    }

    .app-header-actions,
    .app-header-right {
        min-width: 0;
        flex-shrink: 0;
        gap: 0.4rem;
    }

    .app-header-user {
        min-width: 0;
        gap: 0.35rem;
    }

    .app-header-user-info {
        min-width: 0;
    }

    .app-header-user-name {
        max-width: 6rem;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .app-header-user-role {
        display: none;
    }

    .app-header-user-icon {
        width: 2.15rem;
        height: 2.15rem;
        flex-shrink: 0;
    }

    .app-language-button {
        min-width: 2.2rem;
        height: 2.2rem;
        padding-inline: 0.45rem;
    }

    .app-menu-button {
        width: 2.2rem;
        height: 2.2rem;
    }


    /* =========================
       BODY
       ========================= */

    .app-body,
    .app-body.english-layout,
    .app-body.arabic-layout {
        position: relative;
        width: 100%;
        max-width: 100%;
        flex-direction: row;
        overflow-x: hidden;
    }


    /* =========================
       CONTENT
       ========================= */

    .app-content {
        width: 100%;
        max-width: 100%;
        min-width: 0;
        flex: 1 1 100%;
        overflow-x: hidden;
    }

    .app-main {
        width: 100%;
        max-width: 100%;
        min-width: 0;
    }


    /* =========================
       MENU AS OVERLAY
       ========================= */

    .app-menu {
        position: fixed;
        top: 4.5rem;
        bottom: 0;
        width: 0;
        max-width: 80vw;
        z-index: 1030;
        overflow: hidden;
        box-shadow: 0 0.5rem 1.5rem rgb(0 0 0 / 18%);
        transition: width .3s ease;
    }

    /* Arabic -> menu from right */
    .app-body.arabic-layout .app-menu {
        right: 0;
        left: auto;
    }

    /* English -> menu from left */
    .app-body.english-layout .app-menu {
        left: 0;
        right: auto;
    }

    .app-menu.open {
        width: 75vw;
    }

    .app-menu-inner {
        width: 75vw;
        height: 100%;
        min-height: 100%;
        overflow-y: auto;
        overflow-x: hidden;
    }


    /* =========================
       PAGE
       ========================= */

    .page-container {
        width: 100%;
        max-width: 100%;
        padding: 1rem;
        box-sizing: border-box;
        overflow-x: hidden;
    }

    .page-toolbar {
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }

    .table-container {
        width: 100%;
        max-width: 100%;
        overflow-x: auto;
        box-sizing: border-box;
    }


    /* =========================
       PAGER
       ========================= */

    .app-pager {
        width: 100%;
        margin-inline: 0;
        padding-inline: 0.5rem;
        box-sizing: border-box;
        gap: 0.5rem;
    }
}


/* =========================================================
   MOBILE ONLY
   ========================================================= */

@media (max-width: 48rem) {

    /* بالموبايل نخلي الهيدر أخف */
    .app-header {
        min-height: 4rem;
        padding: 0.55rem 0.6rem;
    }

    .app-header-logo {
        height: 2.15rem;
        max-width: 4.5rem;
    }

    /*
       نخفي اسم النظام بالموبايل.
       اللوقو يبقى ظاهر ويعطينا مساحة للأزرار.
    */
    /*.app-header-system {
        display: none;
    }*/

    /*
       اسم المستخدم مو ضروري بالموبايل،
       الأيقونة تبقى ظاهرة.
    */
    /*.app-header-user-info {
        display: none;
    }*/

    .app-header-actions,
    .app-header-right {
        gap: 0.3rem;
    }

    .app-menu {
        top: 4rem;
        max-width: 82vw;
    }

        .app-menu.open {
            width: 82vw;
        }

    .app-menu-inner {
        width: 82vw;
    }

    .page-container {
        padding: 0.75rem;
    }

    /*
       لا نخلي toolbar يصير عمودي.
       العنوان وزر الإضافة يظلون بنفس السطر.
    */
    .page-toolbar {
        flex-direction: row;
        align-items: center;
        gap: 0.5rem;
        padding: 0.75rem;
    }

        .page-toolbar h3 {
            min-width: 0;
            font-size: 1rem;
        }

    /* Pager يبقى داخل الشاشة */
    .app-pager {
        flex-wrap: wrap;
        justify-content: space-between;
    }

    .pager-navigation {
        flex-shrink: 0;
    }

    .pager-page-size {
        flex-shrink: 0;
    }
}

@media (max-width: 48rem) {

    .responsive-card-table thead {
        display: none;
    }

    .responsive-card-table,
    .responsive-card-table tbody {
        display: block;
        width: 100%;
    }

        .responsive-card-table tbody tr {
            display: grid;
            grid-template-columns: minmax(0, 1fr) auto;
            width: 100%;
            padding: 1rem;
            margin-bottom: 0.75rem;
            background: #fff;
            border: 0.0625rem solid #e2e8f0;
            border-radius: 0.9rem;
            box-sizing: border-box;
        }

        .responsive-card-table td {
            border: 0;
        }

        .responsive-card-table .card-main {
            display: block !important;
            grid-column: 1;
            grid-row: 1;
            padding: 0;
            font-size: 1rem;
            font-weight: 700;
            white-space: normal;
        }

        .responsive-card-table .card-status {
            display: flex !important;
            grid-column: 2;
            grid-row: 1;
            align-items: center;
            justify-content: center;
            padding: 0;
        }

        .responsive-card-table .card-detail {
            display: grid !important;
            grid-template-columns: auto minmax(0, 1fr);
            gap: 0.5rem;
            grid-column: 1 / -1;
            width: 100%;
            padding: 0.35rem 0;
            white-space: normal;
            box-sizing: border-box;
        }

            .responsive-card-table .card-detail::before {
                content: attr(data-label) ":";
                font-weight: 700;
                white-space: nowrap;
            }

            .responsive-card-table .card-main + .card-detail,
            .responsive-card-table .card-detail:first-of-type {
                margin-top: 0.7rem;
            }

        .responsive-card-table .card-actions {
            display: flex !important;
            grid-column: 1 / -1;
            justify-content: flex-end;
            align-items: center;
            gap: 0.5rem;
            width: 100%;
            margin-top: 0.75rem;
            padding: 0.75rem 0 0;
            border-top: 0.0625rem solid #edf1f5;
            box-sizing: border-box;
        }

            .responsive-card-table .card-actions .btn-icon-action {
                position: static !important;
                flex-shrink: 0;
            }

        /* أعمدة hide-tablet لازم ترجع تظهر داخل Card بالموبايل */
        .responsive-card-table .hide-tablet.card-detail,
        .responsive-card-table .hide-tablet.card-status {
            display: grid !important;
        }

        .responsive-card-table .hide-tablet.card-status {
            display: flex !important;
        }
}

