:root {
    --hr-primary: #5d78ff;
    --hr-primary-dark: #3d5afe;
    --hr-side: #1e1e2d;
    --hr-side-brand: #1a1a27;
    --hr-side-text: #a2a3b7;
    --hr-side-icon: #494b74;
    --hr-side-hover: #1b1b28;
    --hr-bg: #f2f3f8;
    --hr-card: #ffffff;
    --hr-border: #ebedf2;
    --hr-input-border: #e2e5ec;
    --hr-text: #646c9a;
    --hr-title: #48465b;
    --hr-dark: #212529;
    --hr-muted: #74788d;
    --hr-success: #0abb87;
    --hr-warning: #ffb822;
    --hr-danger: #fd397a;
    --hr-info: #5578eb;
    --hr-radius: 4px;
}

* { font-family: 'Tajawal', 'DroidSans', Tahoma, sans-serif; }
body { background: var(--hr-bg); color: var(--hr-text); font-size: 13px; font-weight: 400; }
a { color: var(--hr-primary); text-decoration: none; }
a:hover { color: var(--hr-primary-dark); }
h1, h2, h3, h4, h5, h6 { color: var(--hr-title); font-weight: 500; }

/* ===== الهيكل ===== */
.hr-shell { display: flex; min-height: 100vh; }
.hr-side {
    width: 265px; background: var(--hr-side); color: var(--hr-side-text);
    position: fixed; inset-block: 0; inset-inline-start: 0; overflow-y: auto; z-index: 1030;
    transition: transform .2s ease; scrollbar-width: thin; scrollbar-color: #2c2c40 transparent;
}
.hr-main { flex: 1; margin-inline-start: 265px; min-width: 0; }
.hr-brand { display: flex; align-items: center; justify-content: center; gap: 10px; height: 65px; padding: 0 25px; background: var(--hr-side-brand); color: #fff; }
.hr-brand:hover { color: #fff; }
.hr-brand img { max-height: 38px; max-width: 180px; }
.hr-brand .mark {
    width: 34px; height: 34px; border-radius: 8px; display: grid; place-items: center;
    background: linear-gradient(135deg, #0abb87, #5d78ff); font-weight: 700; font-size: 17px; color: #fff;
}
.hr-brand strong { font-size: 14px; font-weight: 700; color: #fff; }

.hr-nav { list-style: none; margin: 0; padding: 15px 0 40px; }
.hr-nav ul { list-style: none; margin: 0; padding: 0; background: rgba(0, 0, 0, .08); }
.hr-nav a, .hr-nav button {
    display: flex; align-items: center; gap: 0; width: 100%; padding: 9px 25px; min-height: 44px;
    color: var(--hr-side-text); background: none; border: 0; text-align: start; font-size: 13px; font-weight: 400;
}
.hr-nav ul a, .hr-nav ul button { padding-inline-start: 60px; min-height: 40px; }
.hr-nav ul ul a, .hr-nav ul ul button { padding-inline-start: 75px; }
.hr-nav ul a::before { content: ""; width: 4px; height: 4px; border-radius: 50%; background: #525672; margin-inline-end: 12px; flex-shrink: 0; }
.hr-nav a:hover, .hr-nav button:hover { background: var(--hr-side-hover); color: #fff; }
.hr-nav a:hover .bi, .hr-nav button:hover .bi:not(.chev) { color: var(--hr-primary); }
.hr-nav a.active { background: var(--hr-side-hover); color: #fff; }
.hr-nav a.active .bi { color: var(--hr-primary); }
.hr-nav a.active::before { background: var(--hr-primary); }
.hr-nav button[aria-expanded="true"] { color: #fff; background: var(--hr-side-hover); }
.hr-nav button[aria-expanded="true"] > .bi:not(.chev) { color: var(--hr-primary); }
.hr-nav .bi { font-size: 16.9px; width: 35px; color: var(--hr-side-icon); flex-shrink: 0; }
.hr-nav .chev { margin-inline-start: auto; width: auto; font-size: 10px; color: #5c5e81; transition: transform .2s; }
.hr-nav button[aria-expanded="true"] .chev { transform: rotate(-90deg); }
.hr-nav .badge { margin-inline-start: auto; margin-inline-end: 6px; background: var(--hr-primary) !important; border-radius: 4px; font-weight: 400; font-size: 10.4px; }

.hr-top {
    background: #fff; border-bottom: 1px solid #eff0f6; height: 65px;
    display: flex; align-items: center; gap: 6px; padding: 0 25px; position: sticky; top: 0; z-index: 1020;
}
.hr-top .btn-light { background: transparent; border: 0; color: #74788d; }
.hr-top .btn-light:hover { background: #f0f3ff; color: var(--hr-primary); }
.hr-top .top-company img { max-height: 44px; }
.hr-sub {
    background: #fff; height: 54px; display: flex; align-items: center; gap: 10px; padding: 0 25px;
    border-bottom: 1px solid #eff0f6; box-shadow: 0 0 13px 0 rgba(82, 63, 105, .05);
}
.hr-sub .crumb { display: flex; align-items: center; gap: 8px; color: #959cb6; font-size: 13px; }
.hr-sub .crumb a { color: #959cb6; }
.hr-sub .crumb a:hover { color: var(--hr-primary); }
.hr-sub .crumb .cur { color: var(--hr-title); }
.hr-sub .crumb .bi { font-size: 11px; }
.hr-content { padding: 25px; }

@media (max-width: 991px) {
    .hr-side { transform: translateX(100%); }
    .hr-side.open { transform: none; box-shadow: 0 0 40px rgba(0, 0, 0, .4); }
    .hr-main { margin-inline-start: 0; }
    .hr-content { padding: 15px; }
    .hr-top, .hr-sub { padding: 0 15px; }
}

/* ===== البطاقات (portlet) ===== */
.card { border: 0; border-radius: var(--hr-radius); box-shadow: 0 0 13px 0 rgba(82, 63, 105, .05); background: #fff; }
.card-header {
    background: transparent; border-bottom: 1px solid var(--hr-border); min-height: 60px; padding: 0 25px;
    display: flex; align-items: center; gap: 8px; font-size: 15.6px; font-weight: 500; color: var(--hr-title);
}
.card-header small, .card-header .text-muted { font-size: 13px; font-weight: 400; }
.card-body { padding: 25px; }
.card-footer { background: transparent; border-top: 1px solid var(--hr-border); padding: 15px 25px; }
.portlet-dots { margin-inline-start: auto; color: #a2a5b9; font-size: 18px; line-height: 1; }

/* شريط أدوات أعلى القوائم = رأس الكارت */
.toolbar {
    display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 0;
    background: #fff; padding: 12px 25px; min-height: 60px; border-radius: 4px 4px 0 0; border-bottom: 1px solid var(--hr-border);
    box-shadow: 0 0 13px 0 rgba(82, 63, 105, .05);
}
.toolbar .title { font-size: 15.6px; font-weight: 500; margin-inline-end: auto; color: var(--hr-title); }
.toolbar + .card, .toolbar + .collapse + .card, .toolbar + .collapse + .collapse + .card { border-radius: 0 0 4px 4px; }
.toolbar + .row, .toolbar + .collapse + .row, .toolbar + form, .toolbar + .alert { margin-top: 20px; }
.filter-panel { background: #fff; border-bottom: 1px solid var(--hr-border); padding: 20px 25px; margin-bottom: 0; }
.hr-content > .filter-panel { border-radius: 4px; margin-bottom: 20px; border: 0; box-shadow: 0 0 13px 0 rgba(82, 63, 105, .05); }

/* ===== الجداول ===== */
.table { margin: 0; color: var(--hr-dark); }
.table > :not(caption) > * > * { padding: 10px 10px; border-bottom-color: var(--hr-border); }
.table thead th { background: #fff; color: var(--hr-title); font-weight: 500; font-size: 13px; white-space: nowrap; border-bottom: 1px solid var(--hr-border); padding-top: 13px; padding-bottom: 13px; }
.table thead th a { color: var(--hr-title); }
.table-hover tbody tr:hover { background: #fafbfc; }
.table td { vertical-align: middle; }

/* ===== الأزرار والنماذج ===== */
.btn { border-radius: 3px; font-size: 13px; padding: 7px 15px; }
.btn-sm { font-size: 11.4px; padding: 6px 12px; }
.btn-primary, .btn-brand { background: var(--hr-primary); border-color: var(--hr-primary); color: #fff; }
.btn-primary:hover, .btn-primary:focus, .btn-brand:hover { background: #384ad7; border-color: #2e40d4; color: #fff; }
.btn-outline-primary { color: var(--hr-primary); border-color: var(--hr-primary); }
.btn-outline-primary:hover { background: var(--hr-primary); border-color: var(--hr-primary); color: #fff; }
.btn-success { background: var(--hr-success); border-color: var(--hr-success); }
.btn-warning { background: var(--hr-warning); border-color: var(--hr-warning); color: #111; }
.btn-danger { background: var(--hr-danger); border-color: var(--hr-danger); }
.btn-light { background: #f7f8fa; border-color: #f7f8fa; color: #6c7293; }
.btn-light:hover { background: #ebedf2; border-color: #ebedf2; color: var(--hr-title); }
.btn-outline-secondary { color: #6c7293; border-color: #e2e5ec; }
.btn-outline-secondary:hover { background: #f7f8fa; color: var(--hr-title); border-color: #e2e5ec; }
.text-primary { color: var(--hr-primary) !important; }
.form-label { font-weight: 400; font-size: 13px; color: var(--hr-title); margin-bottom: 6px; }
.form-control, .form-select { border-radius: 4px; border-color: var(--hr-input-border); font-size: 13px; color: #495057; min-height: 38px; }
.form-control:focus, .form-select:focus { border-color: #9aabff; box-shadow: none; }
.req::after { content: " *"; color: var(--hr-danger); }
.ts-control { border-radius: 4px !important; border-color: var(--hr-input-border) !important; min-height: 38px; }
.form-check-input:checked { background-color: var(--hr-primary); border-color: var(--hr-primary); }

/* شارات الحالة: خلفية فاتحة ونص ملون */
.badge { font-weight: 500; border-radius: 4px; padding: 5px 9px; font-size: 11px; }
.text-bg-success { background: rgba(10, 187, 135, .1) !important; color: var(--hr-success) !important; }
.text-bg-warning { background: rgba(255, 184, 34, .12) !important; color: #c98d00 !important; }
.text-bg-danger { background: rgba(253, 57, 122, .1) !important; color: var(--hr-danger) !important; }
.text-bg-info { background: rgba(85, 120, 235, .1) !important; color: var(--hr-info) !important; }
.text-bg-secondary, .text-bg-light { background: #f0f1f6 !important; color: #74788d !important; }
.text-bg-dark { background: #2a2a3c !important; color: #fff !important; }

/* ===== إحصائيات ===== */
.stat { padding: 20px 25px; display: flex; gap: 15px; align-items: center; }
.stat .ico { width: 48px; height: 48px; border-radius: 6px; display: grid; place-items: center; font-size: 22px; background: rgba(93, 120, 255, .1); color: var(--hr-primary); }
.stat .num { font-size: 22px; font-weight: 700; line-height: 1.1; color: var(--hr-title); }
.stat .lbl { color: var(--hr-muted); font-size: 12.5px; }

/* ===== الأفاتار (حروف ملونة) ===== */
.avatar { width: 40px; height: 40px; border-radius: 50%; display: inline-grid; place-items: center; font-weight: 700; font-size: 13px; flex-shrink: 0; object-fit: cover;
    background: rgba(10, 187, 135, .1); color: var(--hr-success); text-transform: uppercase; }
.avatar.c1 { background: rgba(10, 187, 135, .1); color: #0abb87; }
.avatar.c2 { background: rgba(253, 57, 122, .1); color: #fd397a; }
.avatar.c3 { background: rgba(93, 120, 255, .1); color: #5d78ff; }
.avatar.c4 { background: rgba(255, 184, 34, .15); color: #e0a000; }
.avatar.c5 { background: rgba(85, 120, 235, .1); color: #5578eb; }
.avatar.lg { width: 84px; height: 84px; font-size: 26px; }
.avatar.xl { width: 110px; height: 110px; font-size: 30px; }

/* كروت الموظفين */
.emp-tile { text-align: center; padding: 15px 15px 0; height: 100%; position: relative; }
.emp-tile .top { display: flex; align-items: center; gap: 8px; font-weight: 700; color: var(--hr-title); }
.emp-tile .top .tag { font-size: 10.5px; font-weight: 500; }
.emp-tile .top .dots { margin-inline-start: auto; color: #a2a5b9; }
.emp-tile .avatar { width: 84px; height: 84px; font-size: 22px; margin: 12px auto 10px; }
.emp-tile .name { font-weight: 700; color: var(--hr-title); font-size: 14px; }
.emp-tile .job { color: var(--hr-muted); font-size: 12px; margin-bottom: 12px; }
.emp-tile .meta { border-top: 1px solid var(--hr-border); padding: 10px 0; color: var(--hr-muted); font-size: 11.5px; line-height: 1.7; }
.emp-tile a.stretched { position: absolute; inset: 0; z-index: 1; }
.emp-tile .echk { position: relative; z-index: 2; }

.emp-card { display: flex; gap: 12px; align-items: center; padding: 12px; color: inherit; height: 100%; }
.emp-card:hover { background: #fafbfc; }
.emp-card small { color: var(--hr-muted); }

/* ملف الموظف */
.emp-profile-nav .nav-link { display: flex; align-items: center; gap: 12px; color: #6c7293; padding: 11px 20px; border-radius: 0; border-inline-end: 3px solid transparent; font-size: 13px; }
.emp-profile-nav .nav-link .bi { color: #a2a5b9; font-size: 15px; width: 18px; }
.emp-profile-nav .nav-link:hover { background: #f7f8fa; color: var(--hr-primary); }
.emp-profile-nav .nav-link.active { background: #f7f8fa; color: var(--hr-primary); border-inline-end-color: var(--hr-primary); font-weight: 500; }
.emp-profile-nav .nav-link.active .bi { color: var(--hr-primary); }
.emp-photo { position: relative; width: 110px; margin: 0 auto; }
.emp-photo .edit { position: absolute; top: 2px; inset-inline-end: 2px; width: 28px; height: 28px; border-radius: 50%; background: #fff; box-shadow: 0 2px 8px rgba(0,0,0,.15); display: grid; place-items: center; color: var(--hr-primary); font-size: 13px; }
.section-title { font-size: 15px; font-weight: 500; color: var(--hr-title); margin: 10px 0 15px; padding-bottom: 10px; border-bottom: 1px dashed var(--hr-border); }

/* تاريخ من/إلى */
.drange { display: inline-flex; align-items: center; gap: 10px; white-space: nowrap; }
.drange .d { text-align: center; line-height: 1.1; }
.drange .d b { font-size: 20px; font-weight: 500; color: var(--hr-title); display: block; }
.drange .d small { font-size: 10.5px; color: var(--hr-muted); }
.drange .arrow { color: #a2a5b9; }

/* مربعات الطلبات */
.ess-grid { max-width: 820px; margin: 0 auto; }
.ess-tile { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; height: 140px; background: #fff; border-radius: 4px;
    box-shadow: 0 0 13px 0 rgba(82, 63, 105, .05); color: var(--hr-title); font-weight: 700; font-size: 14px; text-align: center; padding: 10px; transition: box-shadow .15s, transform .15s; }
.ess-tile .bi { font-size: 30px; color: #8b8fa8; }
.ess-tile:hover { color: var(--hr-primary); box-shadow: 0 6px 20px rgba(82, 63, 105, .12); transform: translateY(-2px); }
.ess-tile:hover .bi { color: var(--hr-primary); }

/* شبكة الحضور */
.att-grid { font-size: 12px; }
.att-grid th, .att-grid td { padding: 4px 3px !important; text-align: center; min-width: 38px; }
.att-grid td.emp { text-align: start; min-width: 190px; position: sticky; inset-inline-start: 0; background: #fff; z-index: 1; }
.att-cell { display: block; border-radius: 4px; padding: 3px 0; line-height: 1.2; font-size: 11px; }
.st-present { background: rgba(10, 187, 135, .12); color: #088f68; }
.st-late, .st-early, .st-missing_out, .st-missing_in { background: rgba(255, 184, 34, .16); color: #a87500; }
.st-absent { background: rgba(253, 57, 122, .12); color: #d81b60; }
.st-leave, .st-remote { background: rgba(93, 120, 255, .12); color: #3d5afe; }
.st-holiday, .st-exempt { background: rgba(136, 84, 208, .12); color: #7041c2; }
.st-weekend { background: #f2f3f8; color: #8b8fa8; }
.st-suspended { background: #2a2a3c; color: #fff; }
.st-future, .st-not_employed { background: transparent; color: #cbd5e1; }

.nav-tabs { border-bottom-color: var(--hr-border); }
.nav-tabs .nav-link { color: var(--hr-muted); font-size: 13px; border: 0; border-bottom: 2px solid transparent; }
.nav-tabs .nav-link.active { color: var(--hr-primary); font-weight: 500; border-bottom-color: var(--hr-primary); background: transparent; }
.nav-pills .nav-link.active { background: var(--hr-primary); }

.kv dt { color: var(--hr-muted); font-weight: 400; font-size: 12.5px; }
.kv dd { margin-bottom: 14px; font-weight: 500; color: var(--hr-dark); }

.punch-btn { width: 190px; height: 190px; border-radius: 50%; font-size: 20px; font-weight: 700; border: 0; color: #fff;
    background: radial-gradient(circle at 30% 30%, #7d93ff, var(--hr-primary)); box-shadow: 0 12px 30px rgba(93, 120, 255, .35); }
.punch-btn.out { background: radial-gradient(circle at 30% 30%, #ff7aa6, var(--hr-danger)); box-shadow: 0 12px 30px rgba(253, 57, 122, .35); }

.login-wrap { min-height: 100vh; display: grid; place-items: center; background: #1e1e2d url() center/cover; padding: 16px; }
.login-card { width: 100%; max-width: 440px; border-radius: 6px; }

.tree ul { list-style: none; padding-inline-start: 22px; border-inline-start: 1px dashed #c5cae9; margin-inline-start: 10px; }
.tree li { margin: 6px 0; }
.tree .node { display: inline-flex; gap: 8px; align-items: center; background: #fff; border: 1px solid var(--hr-border); border-radius: 4px; padding: 6px 10px; }

.empty { padding: 40px; text-align: center; color: var(--hr-muted); }
.alert { border-radius: 4px; border: 0; }
.alert-success { background: rgba(10, 187, 135, .1); color: #077a58; }
.alert-danger { background: rgba(253, 57, 122, .1); color: #c2185b; }
.alert-warning { background: rgba(255, 184, 34, .14); color: #8a6100; }
.alert-info { background: rgba(93, 120, 255, .08); color: #3d5afe; }
.offcanvas-header .nav-tabs .nav-link { padding: 8px 10px; }
.pagination .page-link { color: var(--hr-primary); border-color: var(--hr-border); }
.pagination .active > .page-link { background: var(--hr-primary); border-color: var(--hr-primary); }

.assistant-fab { position: fixed; bottom: 22px; inset-inline-end: 22px; width: 52px; height: 52px; border-radius: 50%; background: var(--hr-primary);
    color: #fff; display: grid; place-items: center; font-size: 22px; box-shadow: 0 8px 22px rgba(93, 120, 255, .45); z-index: 1040; }
.assistant-fab:hover { color: #fff; transform: scale(1.05); }

@media print {
    .hr-side, .hr-top, .hr-sub, .no-print, .toolbar, .assistant-fab { display: none !important; }
    .hr-main { margin: 0; }
    .card { border: 0; box-shadow: none; }
}

/* الواجهة الإنجليزية (من اليسار لليمين) */
[dir="ltr"] .hr-nav .bi-chevron-left, [dir="ltr"] .hr-sub .bi-chevron-left, [dir="ltr"] .drange .arrow, [dir="ltr"] .bi-arrow-left, [dir="ltr"] .bi-arrow-right { transform: scaleX(-1); display: inline-block; }
[dir="ltr"] .hr-nav button[aria-expanded="true"] .chev { transform: rotate(90deg) scaleX(-1); }
@media (max-width: 991px) { [dir="ltr"] .hr-side { transform: translateX(-100%); } [dir="ltr"] .hr-side.open { transform: none; } }
