/* ============================================================
   نظام إدارة الرواتب — Modern UI v2
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@300;400;500;600;700;800;900&display=swap');

/* ─── CSS Variables ───────────────────────────────────────────*/
:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #e0e7ff;
    --secondary: #8b5cf6;
    --success: #10b981;
    --success-light: #d1fae5;
    --warning: #f59e0b;
    --warning-light: #fef3c7;
    --danger: #ef4444;
    --danger-light: #fee2e2;
    --info: #06b6d4;
    --info-light: #cffafe;

    --bg: #f1f5f9;
    --surface: #ffffff;
    --surface-2: #f8fafc;
    --border: #e2e8f0;
    --border-light: #f1f5f9;

    --text-primary: #0f172a;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;

    --sidebar-bg: #0f172a;
    --sidebar-w: 270px;
    --navbar-h: 64px;

    --radius-sm: 8px;
    --radius: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;

    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -1px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -2px rgba(0, 0, 0, 0.04);
    --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);

    --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ─── Reset & Base ────────────────────────────────────────────*/
*,
*::before,
*::after {
    box-sizing: border-box;
}

body {
    font-family: 'Cairo', 'Segoe UI', sans-serif;
    background: var(--bg);
    color: var(--text-primary);
    padding-top: var(--navbar-h);
    min-height: 100vh;
    font-size: 14.5px;
    line-height: 1.6;
}

::-webkit-scrollbar {
    width: 5px;
    height: 5px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 999px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* ─── Navbar ──────────────────────────────────────────────────*/
.app-navbar {
    height: var(--navbar-h);
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: fixed;
    top: 0;
    right: 0;
    left: 0;
    z-index: 1030;
    display: flex;
    align-items: center;
    padding: 0 1.25rem;
    gap: 1rem;
    box-shadow: var(--shadow-sm);
}

.navbar-toggler-custom {
    width: 40px;
    height: 40px;
    border: none;
    background: var(--bg);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 1.2rem;
    transition: all var(--transition);
    flex-shrink: 0;
}

.navbar-toggler-custom:hover {
    background: var(--primary-light);
    color: var(--primary);
}

.navbar-brand-custom {
    flex: 1;
    text-align: center;
    font-weight: 800;
    font-size: 1.05rem;
    color: var(--text-primary);
}

.navbar-user {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-shrink: 0;
}

.user-avatar {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 700;
    font-size: 0.85rem;
}

.user-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    display: none;
}

@media (min-width: 768px) {
    .user-name {
        display: block;
    }
}

.btn-logout {
    width: 36px;
    height: 36px;
    border: none;
    background: var(--danger-light);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--danger);
    cursor: pointer;
    transition: all var(--transition);
    text-decoration: none;
    font-size: 1rem;
}

.btn-logout:hover {
    background: var(--danger);
    color: #fff;
    transform: scale(1.05);
}

/* ─── Sidebar ─────────────────────────────────────────────────*/
.app-sidebar {
    width: var(--sidebar-w) !important;
    background: var(--sidebar-bg) !important;
    border: none !important;
}

.sidebar-header {
    padding: 1.1rem 1.4rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.sidebar-logo {
    width: 38px;
    height: 38px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.sidebar-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: #fff;
    line-height: 1.3;
}

.sidebar-subtitle {
    font-size: 0.72rem;
    color: rgba(255, 255, 255, 0.3);
}

.sidebar-body {
    padding: 0.75rem 0;
    overflow-y: auto;
    height: calc(100% - 72px);
}

.sidebar-section {
    padding: 0.9rem 1.25rem 0.3rem;
    font-size: 0.67rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.22);
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.6rem 0.75rem;
    color: rgba(255, 255, 255, 0.55);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all var(--transition);
    margin: 1px 0.6rem;
    border-radius: var(--radius-sm);
    position: relative;
    border: none;
    background: transparent;
    width: calc(100% - 1.2rem);
    text-align: right;
    cursor: pointer;
}

.sidebar-link .link-icon {
    width: 30px;
    height: 30px;
    border-radius: 7px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    flex-shrink: 0;
    background: rgba(255, 255, 255, 0.06);
    transition: all var(--transition);
}

.sidebar-link:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.07);
}

.sidebar-link:hover .link-icon {
    background: rgba(255, 255, 255, 0.12);
}

.sidebar-link.active {
    color: #fff;
    background: rgba(99, 102, 241, 0.18);
}

.sidebar-link.active .link-icon {
    background: var(--primary);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.45);
}

.sidebar-link.active::after {
    content: '';
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 55%;
    background: var(--primary);
    border-radius: 999px 0 0 999px;
}

.sidebar-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.05);
    margin: 0.4rem 1.2rem;
}

.sidebar-link.link-danger {
    color: rgba(248, 113, 113, 0.65);
}

.sidebar-link.link-danger .link-icon {
    background: rgba(239, 68, 68, 0.1);
    color: #f87171;
}

.sidebar-link.link-danger:hover {
    color: #fff;
    background: rgba(239, 68, 68, 0.15);
}

.sidebar-link.link-danger:hover .link-icon {
    background: var(--danger);
}

/* ─── Main ────────────────────────────────────────────────────*/
main {
    padding: 1.5rem 1.25rem !important;
    min-height: calc(100vh - var(--navbar-h));
}

/* ─── Page Header ─────────────────────────────────────────────*/
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
    padding: 1rem 1.4rem;
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-light);
}

.page-header h2 {
    font-size: 1.15rem;
    font-weight: 800;
    margin: 0;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

/* ─── Cards ───────────────────────────────────────────────────*/
.card {
    background: var(--surface);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    transition: box-shadow var(--transition);
    overflow: hidden;
}

.card:hover {
    box-shadow: var(--shadow);
}

.card-header {
    background: var(--surface);
    border-bottom: 1px solid var(--border-light);
    padding: 0.85rem 1.25rem;
    font-weight: 700;
    font-size: 0.88rem;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.card-body {
    padding: 1.25rem;
}

/* ─── Stat Cards ──────────────────────────────────────────────*/
.stat-card {
    border-radius: var(--radius-lg);
    padding: 1.2rem 1.4rem;
    position: relative;
    overflow: hidden;
    transition: transform var(--transition), box-shadow var(--transition);
    border: none;
    box-shadow: var(--shadow);
    color: #fff;
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

.stat-card::after {
    content: '';
    position: absolute;
    bottom: -25px;
    left: -25px;
    width: 110px;
    height: 110px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.07);
    pointer-events: none;
}

.stat-card .stat-label {
    font-size: 0.75rem;
    font-weight: 600;
    opacity: 0.8;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.35rem;
}

.stat-card .stat-value {
    font-size: 1.6rem;
    font-weight: 800;
    line-height: 1.2;
}

/* gradient backgrounds */
.stat-card.bg-primary,
.stat-card.primary {
    background: linear-gradient(135deg, #6366f1, #818cf8) !important;
}

.stat-card.bg-success,
.stat-card.success {
    background: linear-gradient(135deg, #10b981, #34d399) !important;
}

.stat-card.bg-warning,
.stat-card.warning {
    background: linear-gradient(135deg, #f59e0b, #fbbf24) !important;
}

.stat-card.bg-danger,
.stat-card.danger {
    background: linear-gradient(135deg, #ef4444, #f87171) !important;
}

.stat-card.bg-info,
.stat-card.info {
    background: linear-gradient(135deg, #06b6d4, #22d3ee) !important;
}

.stat-card.bg-secondary,
.stat-card.secondary {
    background: linear-gradient(135deg, #475569, #64748b) !important;
}

/* ─── Tables ──────────────────────────────────────────────────*/
.table {
    font-size: 0.875rem;
    color: var(--text-primary);
    border-color: var(--border-light);
}

.table thead th {
    background: var(--surface-2);
    font-weight: 700;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border);
    padding: 0.85rem 1rem;
    white-space: nowrap;
    border-top: none;
    text-align: center;
    vertical-align: middle;
    position: sticky;
    top: 0;
    z-index: 2;
}

.table tbody td {
    padding: 0.6rem 1rem;
    border-color: var(--border-light);
    vertical-align: middle;
    text-align: center;
    height: 52px;
    box-sizing: border-box;
}

/* داخل الخلية — الفقرات والروابط تبقى محاذاة مركزية */
.table tbody td .d-flex:not(.justify-content-center) {
    justify-content: center;
}

/* حالة الجدول الفارغ — ارتفاع منخفض */
.table tbody td.dataTables_empty,
.table tbody tr:only-child td[colspan] {
    height: auto !important;
    padding: 1.5rem 1rem !important;
}

/* لف الجدول بتمرير داخلي */
.table-scroll-wrap {
    overflow-x: auto;
    overflow-y: auto;
    max-height: 70vh;
    border-radius: var(--radius);
    border: 1px solid var(--border);
}
.table-scroll-wrap .table {
    margin-bottom: 0;
}
.table-scroll-wrap .table thead th {
    position: sticky;
    top: 0;
    z-index: 3;
    box-shadow: 0 1px 0 var(--border);
}

.table-hover tbody tr {
    transition: background var(--transition);
}

.table-hover tbody tr:hover {
    background: #f8faff;
}

/* ─── Custom table classes — same rules as .table ─────────────*/
/* u-tbl (lider/users), sal-tbl (lider/salaries), al-table (activity_logs),
   changes-table (change_requests), se-tbl (salary_entry/users),
   ee-table (employee_entries), emp-tbl (data_entry/users) */
.u-tbl, .sal-tbl, .al-table, .changes-table,
.se-tbl, .ee-table, .emp-tbl {
    font-size: 0.875rem;
    color: var(--text-primary);
    border-color: var(--border-light);
    width: 100%;
    border-collapse: collapse;
}

.u-tbl thead th, .sal-tbl thead th, .al-table thead th,
.changes-table thead th, .se-tbl thead th, .ee-table thead th,
.emp-tbl thead th {
    background: var(--surface-2);
    font-weight: 700;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border);
    padding: 0.85rem 1rem;
    white-space: nowrap;
    border-top: none;
    text-align: center;
    vertical-align: middle;
    position: sticky;
    top: 0;
    z-index: 2;
    box-shadow: 0 1px 0 var(--border);
}

.u-tbl tbody td, .sal-tbl tbody td, .al-table tbody td,
.changes-table tbody td, .se-tbl tbody td, .ee-table tbody td,
.emp-tbl tbody td {
    padding: 0.6rem 1rem;
    border-color: var(--border-light);
    border-bottom: 1px solid var(--border-light);
    vertical-align: middle;
    text-align: center;
    height: 52px;
    box-sizing: border-box;
}

.u-tbl tbody tr:hover, .sal-tbl tbody tr:hover, .al-table tbody tr:hover,
.changes-table tbody tr:hover, .se-tbl tbody tr:hover, .ee-table tbody tr:hover,
.emp-tbl tbody tr:hover {
    background: #f8faff;
    transition: background var(--transition);
}

/* لفّ التمرير لجميع أنواع الجداول */
.u-tbl-scroll, .sal-tbl-scroll, .se-table-wrap > .card-body,
.emp-table-wrap > .card-body {
    overflow-x: auto;
    overflow-y: auto;
    max-height: 70vh;
}
.u-tbl-scroll .u-tbl,
.sal-tbl-scroll .sal-tbl,
.se-table-wrap .se-tbl,
.emp-table-wrap .emp-tbl {
    margin-bottom: 0;
}

/* ─── Badges ──────────────────────────────────────────────────*/
.badge {
    font-size: 0.72rem;
    font-weight: 600;
    padding: 0.28em 0.65em;
    border-radius: 999px;
}

/* ─── Buttons ─────────────────────────────────────────────────*/
.btn {
    font-family: 'Cairo', sans-serif;
    font-weight: 600;
    font-size: 0.875rem;
    border-radius: var(--radius-sm);
    transition: all var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    border: none;
    cursor: pointer;
}

.btn:active {
    transform: scale(0.97);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-dark), #4338ca);
    box-shadow: 0 6px 18px rgba(99, 102, 241, 0.42);
    transform: translateY(-1px);
    color: #fff;
}

.btn-success {
    background: linear-gradient(135deg, var(--success), #059669);
    color: #fff;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.btn-success:hover {
    box-shadow: 0 6px 18px rgba(16, 185, 129, 0.42);
    transform: translateY(-1px);
    color: #fff;
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger), #dc2626);
    color: #fff;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.25);
}

.btn-danger:hover {
    transform: translateY(-1px);
    color: #fff;
}

.btn-warning {
    background: linear-gradient(135deg, var(--warning), #d97706);
    color: #fff;
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
}

.btn-warning:hover {
    transform: translateY(-1px);
    color: #fff;
}

.btn-outline-primary {
    border: 1.5px solid var(--primary);
    color: var(--primary);
    background: transparent;
}

.btn-outline-primary:hover {
    background: var(--primary-light);
    color: var(--primary-dark);
}

.btn-outline-secondary {
    border: 1.5px solid var(--border);
    color: var(--text-secondary);
    background: transparent;
}

.btn-outline-secondary:hover {
    background: var(--bg);
    color: var(--text-primary);
}

.btn-outline-danger {
    border: 1.5px solid var(--danger);
    color: var(--danger);
    background: transparent;
}

.btn-outline-danger:hover {
    background: var(--danger-light);
}

.btn-icon {
    width: 34px;
    height: 34px;
    padding: 0 !important;
    border-radius: var(--radius-sm);
    justify-content: center;
}

.btn-group .btn {
    border-radius: 0;
}

.btn-group .btn:first-child {
    border-radius: var(--radius-sm) 0 0 var(--radius-sm);
}

/* .btn-group .btn:last-child {
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
} */

.btn-group.btn-group-sm .btn {
    padding: 0.32rem 0.8rem;
    font-size: 0.82rem;
}

/* ─── Forms ───────────────────────────────────────────────────*/
.form-label {
    font-weight: 600;
    font-size: 0.82rem;
    color: var(--text-secondary);
    margin-bottom: 0.35rem;
}

.form-control,
.form-select {
    font-family: 'Cairo', sans-serif;
    font-size: 0.875rem;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    background: var(--surface);
    transition: all var(--transition);
    padding: 0.52rem 0.85rem;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
    outline: none;
}

.form-control::placeholder {
    color: var(--text-muted);
}

.form-control-sm,
.form-select-sm {
    padding: 0.32rem 0.7rem;
    font-size: 0.82rem;
}

.input-group-text {
    background: var(--surface-2);
    border: 1.5px solid var(--border);
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.form-text {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

/* ─── Alerts ──────────────────────────────────────────────────*/
.alert {
    border: none;
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-weight: 500;
    padding: 0.85rem 1.1rem;
}

.alert-success {
    background: var(--success-light);
    color: #065f46;
}

.alert-danger {
    background: var(--danger-light);
    color: #991b1b;
}

.alert-warning {
    background: var(--warning-light);
    color: #92400e;
}

.alert-info {
    background: var(--info-light);
    color: #0e7490;
}

.alert-light {
    background: var(--surface-2);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

/* ─── Login ───────────────────────────────────────────────────*/
body.login-body {
    padding-top: 0;
    background: #0f172a;
}

.login-bg {
    position: fixed;
    inset: 0;
    overflow: hidden;
    z-index: 0;
}

.login-bg::before {
    content: '';
    position: absolute;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.3) 0%, transparent 70%);
    top: -200px;
    right: -200px;
    border-radius: 50%;
    animation: float1 8s ease-in-out infinite;
}

.login-bg::after {
    content: '';
    position: absolute;
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(139, 92, 246, 0.2) 0%, transparent 70%);
    bottom: -150px;
    left: -150px;
    border-radius: 50%;
    animation: float2 10s ease-in-out infinite;
}

@keyframes float1 {

    0%,
    100% {
        transform: translate(0, 0);
    }

    50% {
        transform: translate(-30px, 25px);
    }
}

@keyframes float2 {

    0%,
    100% {
        transform: translate(0, 0);
    }

    50% {
        transform: translate(25px, -20px);
    }
}

.login-wrapper {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}

.login-card {
    width: 100%;
    max-width: 420px;
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-xl);
    padding: 2.5rem;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
    animation: slideUp 0.45s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(28px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.login-logo-wrap {
    width: 70px;
    height: 70px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: #fff;
    margin: 0 auto 1.25rem;
    box-shadow: 0 8px 28px rgba(99, 102, 241, 0.5);
    animation: glow 2.5s ease infinite;
}

@keyframes glow {

    0%,
    100% {
        box-shadow: 0 8px 28px rgba(99, 102, 241, 0.5);
    }

    50% {
        box-shadow: 0 8px 40px rgba(139, 92, 246, 0.7);
    }
}

.login-title {
    font-size: 1.4rem;
    font-weight: 800;
    color: #fff;
    text-align: center;
    margin-bottom: 0.25rem;
}

.login-subtitle {
    font-size: 0.83rem;
    color: rgba(255, 255, 255, 0.4);
    text-align: center;
    margin-bottom: 2rem;
}

.login-card .form-label {
    color: rgba(255, 255, 255, 0.65);
    font-size: 0.82rem;
}

.login-card .form-control {
    background: rgba(255, 255, 255, 0.07);
    border: 1.5px solid rgba(255, 255, 255, 0.1);
    color: #fff;
}

.login-card .form-control::placeholder {
    color: rgba(255, 255, 255, 0.22);
}

.login-card .form-control:focus {
    background: rgba(255, 255, 255, 0.11);
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
    color: #fff;
}

.login-card .input-group-text {
    background: rgba(255, 255, 255, 0.06);
    border: 1.5px solid rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.35);
}

.login-card .form-check-label {
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.82rem;
}

.login-card .form-check-input {
    background-color: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.18);
}

.login-card .form-check-input:checked {
    background-color: var(--primary);
    border-color: var(--primary);
}

.btn-login {
    width: 100%;
    padding: 0.72rem;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-weight: 700;
    font-family: 'Cairo', sans-serif;
    cursor: pointer;
    transition: all var(--transition);
    box-shadow: 0 8px 22px rgba(99, 102, 241, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-login:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 30px rgba(99, 102, 241, 0.55);
}

/* ─── Calc Preview ────────────────────────────────────────────*/
.calc-preview {
    background: linear-gradient(135deg, var(--primary-light), rgba(139, 92, 246, 0.07));
    border: 1.5px solid rgba(99, 102, 241, 0.18);
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 1.25rem;
}

.calc-preview .calc-label {
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.88rem;
}

.calc-preview .calc-value {
    font-size: 1.45rem;
    font-weight: 800;
    color: var(--primary);
}

/* ─── Empty State ─────────────────────────────────────────────*/
.empty-state {
    text-align: center;
    padding: 3.5rem 2rem;
    color: var(--text-muted);
}

.empty-state .empty-icon {
    width: 70px;
    height: 70px;
    background: var(--bg);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    margin: 0 auto 1rem;
    color: var(--text-muted);
}

/* ─── Modal ───────────────────────────────────────────────────*/
.modal-content {
    border: none;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
}

.modal-header {
    border-bottom: 1px solid var(--border-light);
    padding: 1.1rem 1.4rem;
}

.modal-title {
    font-weight: 700;
    font-size: 1rem;
}

.modal-footer {
    border-top: 1px solid var(--border-light);
}

/* ─── DataTables ──────────────────────────────────────────────*/
.dataTables_wrapper .dataTables_filter input,
.dataTables_wrapper .dataTables_length select {
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.32rem 0.7rem;
    font-size: 0.85rem;
    font-family: 'Cairo', sans-serif;
    color: var(--text-primary);
    background: var(--surface);
}

.dataTables_wrapper .dataTables_filter input:focus,
.dataTables_wrapper .dataTables_length select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
    outline: none;
}

.dataTables_wrapper .dataTables_info {
    font-size: 0.82rem;
    color: var(--text-muted);
    padding: 0.75rem 1rem;
}

.dataTables_wrapper .dataTables_paginate {
    padding: 0.5rem 1rem;
}

/* ─── Select2 ─────────────────────────────────────────────────*/
.select2-container--bootstrap-5 .select2-selection {
    border: 1.5px solid var(--border) !important;
    border-radius: var(--radius-sm) !important;
    font-family: 'Cairo', sans-serif !important;
}

.select2-container--bootstrap-5.select2-container--focus .select2-selection {
    border-color: var(--primary) !important;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12) !important;
}

/* ─── Table Search Input ──────────────────────────────────────*/
.tbl-search-wrap {
    position: relative;
    flex-shrink: 0;
    width: 280px;
}

.tbl-search-wrap .bi-search {
    position: absolute;
    inset-inline-start: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
    font-size: 0.9rem;
}

.tbl-search-input {
    width: 100%;
    padding: 0.48rem 0.85rem; padding-inline-start: 2.2rem;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: 'Cairo', sans-serif;
    font-size: 0.875rem;
    color: var(--text-primary);
    background: var(--surface);
    transition: all var(--transition);
}

.tbl-search-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12);
}

.tbl-search-input::placeholder {
    color: var(--text-muted);
}

/* ─── Animations ──────────────────────────────────────────────*/
.fade-in {
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(6px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes spin {
    to {
        transform: translate(-50%, -50%) rotate(360deg);
    }
}

.btn-loading {
    position: relative;
    color: transparent !important;
    pointer-events: none;
}

.btn-loading::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

/* ─── Utilities ───────────────────────────────────────────────*/
.fw-500 {
    font-weight: 500;
}

.fw-600 {
    font-weight: 600;
}

.fw-700 {
    font-weight: 700;
}

.fw-800 {
    font-weight: 800;
}

.text-primary {
    color: var(--primary) !important;
}

.text-success {
    color: var(--success) !important;
}

.text-warning {
    color: var(--warning) !important;
}

.text-danger {
    color: var(--danger) !important;
}

.text-info {
    color: var(--info) !important;
}

.text-muted {
    color: var(--text-muted) !important;
}

/* ─── Responsive ──────────────────────────────────────────────*/

/* ── Tablet (≤768px) ── */
@media (max-width: 768px) {
    main {
        padding: 1rem 0.85rem !important;
    }

    .page-header {
        flex-direction: column;
        align-items: stretch;
        gap: 0.6rem;
        padding: 0.85rem 1rem;
    }

    .page-header h2 {
        font-size: 1.05rem;
        justify-content: center;
    }

    .page-header .btn,
    .page-header a.btn {
        width: 100%;
        justify-content: center;
    }

    .tbl-search-wrap {
        width: 100%;
    }

    .card-header {
        padding: 0.75rem 1rem;
        font-size: 0.84rem;
        flex-wrap: wrap;
        gap: 0.4rem;
    }

    .card-body {
        padding: 1rem;
    }

    .modal-dialog {
        margin: 0.5rem;
    }

    /* stat cards row */
    .row > [class*="col-md-"],
    .row > [class*="col-lg-"] {
        flex: 0 0 50%;
        max-width: 50%;
    }

    /* forms */
    .row.g-3 > [class*="col-md-"],
    .row.g-4 > [class*="col-md-"] {
        flex: 0 0 100%;
        max-width: 100%;
    }

    /* filter bars */
    .d-flex.gap-2,
    .d-flex.gap-3 {
        flex-wrap: wrap;
    }

    .btn-group {
        flex-wrap: wrap;
    }

    .btn-group .btn {
        font-size: 0.78rem;
        padding: 0.3rem 0.6rem;
    }

    .calc-preview {
        flex-direction: column;
        gap: 0.4rem;
        text-align: center;
    }
}

/* ── Mobile (≤576px) ── */
@media (max-width: 576px) {
    main {
        padding: 0.75rem 0.5rem !important;
    }

    .page-header {
        padding: 0.7rem 0.75rem;
        margin-bottom: 0.8rem;
        border-radius: var(--radius);
    }

    .page-header h2 {
        font-size: 0.95rem;
        gap: 0.4rem;
    }

    .page-header h2 i {
        font-size: 0.9rem;
    }

    /* ── Cards ── */
    .card {
        border-radius: var(--radius);
    }

    .card-body {
        padding: 0.75rem;
    }

    .card-header {
        padding: 0.65rem 0.75rem;
        font-size: 0.82rem;
    }

    /* ── Stat Cards ── */
    .stat-card {
        padding: 0.9rem 1rem;
        border-radius: var(--radius);
    }

    .stat-card .stat-value {
        font-size: 1.15rem;
    }

    .stat-card .stat-label {
        font-size: 0.68rem;
    }

    .stat-card::after {
        width: 70px;
        height: 70px;
        bottom: -15px;
        left: -15px;
    }

    /* ── Tables ── */
    .table-scroll-wrap,
    .u-tbl-scroll,
    .sal-tbl-scroll {
        max-height: 60vh;
        border-radius: var(--radius-sm);
    }

    .table,
    .u-tbl, .sal-tbl, .al-table,
    .changes-table, .se-tbl, .ee-table, .emp-tbl {
        font-size: 0.78rem;
    }

    .table thead th,
    .u-tbl thead th, .sal-tbl thead th, .al-table thead th,
    .changes-table thead th, .se-tbl thead th, .ee-table thead th,
    .emp-tbl thead th {
        padding: 0.55rem 0.5rem;
        font-size: 0.65rem;
        letter-spacing: 0.03em;
    }

    .table tbody td,
    .u-tbl tbody td, .sal-tbl tbody td, .al-table tbody td,
    .changes-table tbody td, .se-tbl tbody td, .ee-table tbody td,
    .emp-tbl tbody td {
        padding: 0.45rem 0.5rem;
        height: 42px;
        font-size: 0.78rem;
    }

    /* ── Buttons ── */
    .btn {
        font-size: 0.8rem;
        padding: 0.35rem 0.7rem;
    }

    .btn-icon {
        width: 30px;
        height: 30px;
    }

    .btn-icon i {
        font-size: 0.8rem;
    }

    .btn-sm {
        padding: 0.25rem 0.5rem;
        font-size: 0.75rem;
    }

    /* ── Forms ── */
    .form-control,
    .form-select {
        font-size: 0.82rem;
        padding: 0.42rem 0.7rem;
    }

    .form-label {
        font-size: 0.78rem;
        margin-bottom: 0.25rem;
    }

    .form-control-sm,
    .form-select-sm {
        padding: 0.28rem 0.55rem;
        font-size: 0.78rem;
    }

    .input-group-text {
        font-size: 0.8rem;
        padding: 0.4rem 0.6rem;
    }

    /* ── Search ── */
    .tbl-search-wrap {
        width: 100%;
    }

    .tbl-search-input {
        font-size: 0.82rem;
        padding: 0.4rem 0.7rem;
        padding-inline-start: 2rem;
    }

    /* ── Badges ── */
    .badge {
        font-size: 0.65rem;
        padding: 0.2em 0.5em;
    }

    /* ── Navbar ── */
    .app-navbar {
        padding: 0 0.75rem;
        gap: 0.5rem;
    }

    .navbar-brand-custom {
        font-size: 0.88rem;
    }

    .navbar-toggler-custom {
        width: 36px;
        height: 36px;
        font-size: 1.05rem;
    }

    .user-avatar {
        width: 32px;
        height: 32px;
        font-size: 0.75rem;
    }

    .btn-logout {
        width: 32px;
        height: 32px;
        font-size: 0.9rem;
    }

    /* ── Login ── */
    .login-card {
        padding: 1.5rem 1rem;
        border-radius: var(--radius-lg);
    }

    .login-logo-wrap {
        width: 58px;
        height: 58px;
        font-size: 1.6rem;
        margin-bottom: 1rem;
    }

    .login-title {
        font-size: 1.15rem;
    }

    .login-subtitle {
        font-size: 0.78rem;
        margin-bottom: 1.5rem;
    }

    .btn-login {
        padding: 0.6rem;
        font-size: 0.88rem;
    }

    /* ── Alerts ── */
    .alert {
        font-size: 0.82rem;
        padding: 0.7rem 0.9rem;
    }

    /* ── Modals ── */
    .modal-dialog {
        margin: 0.35rem;
    }

    .modal-header {
        padding: 0.85rem 1rem;
    }

    .modal-title {
        font-size: 0.92rem;
    }

    .modal-body {
        padding: 0.85rem 1rem;
    }

    .modal-footer {
        padding: 0.6rem 1rem;
    }

    /* ── Calc Preview ── */
    .calc-preview {
        flex-direction: column;
        gap: 0.3rem;
        text-align: center;
        padding: 0.75rem 1rem;
    }

    .calc-preview .calc-value {
        font-size: 1.2rem;
    }

    /* ── Empty State ── */
    .empty-state {
        padding: 2rem 1rem;
    }

    .empty-state .empty-icon {
        width: 55px;
        height: 55px;
        font-size: 1.5rem;
    }

    /* ── DataTables ── */
    .dataTables_wrapper .dataTables_filter,
    .dataTables_wrapper .dataTables_length {
        text-align: center !important;
        float: none !important;
        margin-bottom: 0.5rem;
    }

    .dataTables_wrapper .dataTables_filter input {
        width: 100% !important;
        margin: 0.3rem 0 !important;
    }

    .dataTables_wrapper .dataTables_info {
        text-align: center;
        font-size: 0.75rem;
        padding: 0.5rem;
    }

    .dataTables_wrapper .dataTables_paginate {
        text-align: center;
        padding: 0.4rem 0.5rem;
    }

    .dataTables_wrapper .dataTables_paginate .paginate_button {
        padding: 0.2rem 0.5rem !important;
        font-size: 0.78rem;
    }

    /* ── Select2 ── */
    .select2-container {
        width: 100% !important;
    }

    /* ── SweetAlert ── */
    .swal2-popup {
        font-size: 0.85rem !important;
        padding: 1rem !important;
        width: 90vw !important;
        max-width: 340px !important;
    }

    /* ── flex helpers for mobile ── */
    .d-flex.flex-wrap-mobile {
        flex-wrap: wrap !important;
    }

    /* ── force grid 2-col for stat rows ── */
    .row > [class*="col-md-3"],
    .row > [class*="col-lg-3"],
    .row > [class*="col-xl-3"] {
        flex: 0 0 50%;
        max-width: 50%;
    }

    .row > [class*="col-md-4"],
    .row > [class*="col-lg-4"] {
        flex: 0 0 100%;
        max-width: 100%;
    }

    .row > [class*="col-md-6"],
    .row > [class*="col-lg-6"] {
        flex: 0 0 100%;
        max-width: 100%;
    }
}

/* ── Very small screens (≤400px) ── */
@media (max-width: 400px) {
    main {
        padding: 0.5rem 0.35rem !important;
    }

    .page-header {
        padding: 0.6rem 0.65rem;
        margin-bottom: 0.6rem;
        border-radius: var(--radius-sm);
        gap: 0.4rem;
    }

    .page-header h2 {
        font-size: 0.85rem;
        gap: 0.3rem;
    }

    .page-header h2 i {
        font-size: 0.8rem;
    }

    .page-header .btn {
        font-size: 0.73rem;
        padding: 0.25rem 0.5rem;
    }

    .stat-card {
        padding: 0.65rem 0.75rem;
        border-radius: var(--radius-sm);
    }

    .stat-card .stat-value {
        font-size: 0.95rem;
    }

    .stat-card .stat-label {
        font-size: 0.6rem;
    }

    .stat-card::after {
        width: 55px;
        height: 55px;
        bottom: -12px;
        left: -12px;
    }

    .card {
        border-radius: var(--radius-sm);
        margin-bottom: 0.5rem;
    }

    .card-body {
        padding: 0.55rem;
    }

    .card-header {
        padding: 0.55rem 0.65rem;
        font-size: 0.78rem;
    }

    .navbar-brand-custom {
        font-size: 0.78rem;
    }

    .btn {
        font-size: 0.73rem;
        padding: 0.28rem 0.5rem;
    }

    .btn-icon {
        width: 26px;
        height: 26px;
    }

    .btn-icon i {
        font-size: 0.75rem;
    }

    .btn-sm {
        padding: 0.2rem 0.4rem;
        font-size: 0.7rem;
    }

    .form-control,
    .form-select {
        font-size: 0.78rem;
        padding: 0.36rem 0.5rem;
        border-radius: var(--radius-sm);
    }

    .form-label {
        font-size: 0.72rem;
    }

    .badge {
        font-size: 0.6rem;
        padding: 0.15em 0.4em;
    }

    .table,
    .u-tbl, .sal-tbl, .al-table,
    .changes-table, .se-tbl, .ee-table, .emp-tbl {
        font-size: 0.74rem;
    }

    .table thead th,
    .u-tbl thead th, .sal-tbl thead th {
        padding: 0.45rem 0.4rem;
        font-size: 0.6rem;
    }

    .table tbody td,
    .u-tbl tbody td, .sal-tbl tbody td {
        padding: 0.4rem 0.4rem;
        height: 38px;
    }

    .modal-dialog {
        margin: 0.25rem;
    }

    .modal-header {
        padding: 0.7rem 0.85rem;
    }

    .modal-title {
        font-size: 0.85rem;
    }

    .modal-body {
        padding: 0.7rem 0.85rem;
    }

    .alert {
        font-size: 0.78rem;
        padding: 0.6rem 0.75rem;
        border-radius: var(--radius-sm);
    }

    .swal2-popup {
        max-width: 300px !important;
        padding: 0.85rem !important;
    }

    /* force stat cards single column on very small */
    .row > [class*="col-md-3"],
    .row > [class*="col-lg-3"],
    .row > [class*="col-xl-3"] {
        flex: 0 0 50%;
        max-width: 50%;
    }

    .empty-state {
        padding: 1.5rem 0.8rem;
    }

    .empty-state .empty-icon {
        width: 48px;
        height: 48px;
        font-size: 1.3rem;
    }

    .empty-state h5 {
        font-size: 0.88rem;
    }

    .empty-state p {
        font-size: 0.75rem;
    }
}