/* LOC HR & Finance — interface styles (works in RTL and LTR via logical properties) */
:root {
    --loc-primary: #0f4c5c;
    --loc-primary-600: #0b3a47;
    --loc-accent: #e36414;
    --loc-bg: #f4f6f8;
    --loc-sidebar: #0d2c36;
    --loc-sidebar-hover: rgba(255, 255, 255, .07);
    --loc-border: #e3e7eb;
    --bs-primary: #0f4c5c;
    --bs-primary-rgb: 15, 76, 92;
    --bs-link-color: #0f4c5c;
    --bs-link-color-rgb: 15, 76, 92;
    --bs-link-hover-color: #0b3a47;
    --bs-border-radius: .6rem;
    --sidebar-width: 260px;
}

html, body { font-family: 'Cairo', system-ui, -apple-system, 'Segoe UI', Tahoma, sans-serif; }
body.app-body { background: var(--loc-bg); color: #1d2a33; font-size: .95rem; }

.btn-primary {
    --bs-btn-bg: var(--loc-primary); --bs-btn-border-color: var(--loc-primary);
    --bs-btn-hover-bg: var(--loc-primary-600); --bs-btn-hover-border-color: var(--loc-primary-600);
    --bs-btn-active-bg: var(--loc-primary-600); --bs-btn-active-border-color: var(--loc-primary-600);
    --bs-btn-disabled-bg: var(--loc-primary); --bs-btn-disabled-border-color: var(--loc-primary);
}
.btn-outline-primary {
    --bs-btn-color: var(--loc-primary); --bs-btn-border-color: var(--loc-primary);
    --bs-btn-hover-bg: var(--loc-primary); --bs-btn-hover-border-color: var(--loc-primary);
    --bs-btn-active-bg: var(--loc-primary); --bs-btn-active-border-color: var(--loc-primary);
}
.text-primary { color: var(--loc-primary) !important; }
.bg-primary { background-color: var(--loc-primary) !important; }
.form-control:focus, .form-select:focus, .form-check-input:focus {
    border-color: #5d97a6; box-shadow: 0 0 0 .2rem rgba(15, 76, 92, .15);
}
.form-check-input:checked { background-color: var(--loc-primary); border-color: var(--loc-primary); }
.page-link { color: var(--loc-primary); }
.active > .page-link { background-color: var(--loc-primary); border-color: var(--loc-primary); }

/* ---------- Shell ---------- */
.app-shell { display: flex; min-height: 100vh; }
.sidebar {
    width: var(--sidebar-width); background: var(--loc-sidebar) !important; color: #cfe0e5;
    display: flex; flex-direction: column;
}
@media (min-width: 992px) {
    .sidebar { position: sticky; top: 0; height: 100vh; flex-shrink: 0; overflow-y: auto; }
}
@media (max-width: 991.98px) {
    .sidebar.offcanvas-lg { --bs-offcanvas-width: 280px; background: var(--loc-sidebar); }
}
.sidebar-brand { display: flex; align-items: center; justify-content: space-between; padding: 1.1rem 1rem; border-bottom: 1px solid rgba(255,255,255,.08); }
.brand-link { display: flex; align-items: center; gap: .7rem; text-decoration: none; }
.brand-mark {
    display: inline-flex; align-items: center; justify-content: center; width: 42px; height: 42px; border-radius: 10px;
    background: linear-gradient(135deg, var(--loc-accent), #f6a04d); color: #fff; font-weight: 700; font-size: .85rem; letter-spacing: .5px;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-title { color: #fff; font-weight: 700; font-size: 1rem; }
.brand-sub { color: #8fb3bd; font-size: .75rem; }
.sidebar-nav { padding: .75rem .6rem; flex: 1; }
.nav-section { color: #6f97a2; font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; padding: 1rem .75rem .35rem; }
.nav-item {
    display: flex; align-items: center; gap: .7rem; padding: .55rem .75rem; margin-bottom: 2px;
    color: #cfe0e5; text-decoration: none; border-radius: .5rem; font-weight: 500;
}
.nav-item i { font-size: 1.1rem; width: 1.3rem; text-align: center; opacity: .85; }
.nav-item:hover { background: var(--loc-sidebar-hover); color: #fff; }
.nav-item.active { background: rgba(227, 100, 20, .16); color: #fff; box-shadow: inset 3px 0 0 var(--loc-accent); }
[dir="rtl"] .nav-item.active { box-shadow: inset -3px 0 0 var(--loc-accent); }
.sidebar-foot { display: flex; justify-content: space-between; padding: .8rem 1rem; font-size: .75rem; color: #8fb3bd; border-top: 1px solid rgba(255,255,255,.08); }

.app-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
    position: sticky; top: 0; z-index: 1020; display: flex; align-items: center; gap: .75rem;
    background: #fff; border-bottom: 1px solid var(--loc-border); padding: .6rem 1.25rem; min-height: 60px;
}
.topbar-title { font-size: 1.1rem; font-weight: 700; margin: 0; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-actions { display: flex; align-items: center; gap: .5rem; }
.btn-icon { border: 0; background: transparent; padding: .25rem .4rem; }
.user-menu { display: flex; align-items: center; gap: .5rem; border: 1px solid var(--loc-border); background: #fff; }
.avatar-sm {
    display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: 50%;
    background: var(--loc-primary); color: #fff; font-weight: 700; font-size: .85rem;
}
.content { padding: 1.25rem; flex: 1; }
@media (min-width: 1200px) { .content { padding: 1.5rem 2rem; } }

/* ---------- Components ---------- */
.card { border: 1px solid var(--loc-border); border-radius: .8rem; }
.card-header { background: #fff; border-bottom: 1px solid var(--loc-border); font-weight: 700; padding: .85rem 1.1rem; }
.page-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: 1rem; }
.page-head h2 { font-size: 1.25rem; font-weight: 700; margin: 0; }
.page-head .sub { color: #6b7a86; font-size: .875rem; }

.stat-card { display: flex; align-items: center; gap: .9rem; padding: 1rem 1.1rem; height: 100%; }
.stat-icon { width: 46px; height: 46px; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; font-size: 1.35rem; flex-shrink: 0; }
.stat-value { font-size: 1.6rem; font-weight: 700; line-height: 1; }
.stat-label { color: #6b7a86; font-size: .85rem; margin-top: .25rem; }
.tint-primary { background: rgba(15, 76, 92, .1); color: var(--loc-primary); }
.tint-success { background: rgba(25, 135, 84, .1); color: #198754; }
.tint-warning { background: rgba(255, 193, 7, .18); color: #a07800; }
.tint-danger { background: rgba(220, 53, 69, .1); color: #dc3545; }
.tint-accent { background: rgba(227, 100, 20, .12); color: var(--loc-accent); }
.tint-info { background: rgba(13, 202, 240, .14); color: #087990; }

.table { --bs-table-hover-bg: #f6f9fa; margin-bottom: 0; }
.table > thead th { background: #f8fafb; color: #4f5f6b; font-weight: 700; font-size: .8rem; white-space: nowrap; border-bottom-width: 1px; }
.table td { vertical-align: middle; }
.table-actions { white-space: nowrap; text-align: end; }

.emp-photo { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; background: #e9eef1; flex-shrink: 0; }
.emp-photo-lg { width: 112px; height: 112px; border-radius: 1rem; object-fit: cover; background: #e9eef1; }
.emp-initial {
    width: 40px; height: 40px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
    background: #dbe8ec; color: var(--loc-primary); font-weight: 700; flex-shrink: 0;
}
.emp-initial-lg { width: 112px; height: 112px; border-radius: 1rem; font-size: 2.6rem; }

.detail-list { margin: 0; }
.detail-list dt { color: #6b7a86; font-weight: 500; font-size: .85rem; }
.detail-list dd { font-weight: 600; margin-bottom: .9rem; word-break: break-word; }

.bar-row { display: flex; align-items: center; gap: .6rem; margin-bottom: .6rem; }
.bar-label { width: 40%; font-size: .875rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-track { flex: 1; height: 10px; background: #edf1f3; border-radius: 6px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--loc-primary); border-radius: 6px; }
.bar-value { width: 2.5rem; text-align: end; font-weight: 700; font-size: .875rem; }

.perm-group { border: 1px solid var(--loc-border); border-radius: .6rem; padding: .9rem 1rem; height: 100%; }
.perm-group h6 { font-weight: 700; margin-bottom: .6rem; }

.empty-state { text-align: center; padding: 2.5rem 1rem; color: #6b7a86; }
.empty-state i { font-size: 2.4rem; color: #b6c5cc; display: block; margin-bottom: .5rem; }

.required::after { content: " *"; color: #dc3545; }
.form-label { font-weight: 600; font-size: .9rem; }
.form-text { font-size: .8rem; }
.ltr-field { direction: ltr; }
[dir="rtl"] .ltr-field { text-align: right; }
code { color: #a3360b; }
.temp-password-value { font-size: 1.05rem; background: #fff; padding: .15rem .5rem; border-radius: .35rem; letter-spacing: .5px; }
.json-cell { max-width: 360px; white-space: pre-wrap; word-break: break-word; font-size: .8rem; }

/* ---------- Attendance ---------- */
.check-card { border-radius: 1.1rem; }
.check-clock { font-size: 2.6rem; font-weight: 700; letter-spacing: 1px; line-height: 1.1; color: var(--loc-primary); font-variant-numeric: tabular-nums; }
.check-btn { font-size: 1.25rem; font-weight: 700; border-radius: .9rem; box-shadow: 0 6px 18px rgba(0,0,0,.08); }
.check-stat { background: #f6f9fa; border-radius: .7rem; padding: .6rem; }
.emp-checklist { max-height: 420px; overflow-y: auto; }
.today-card .btn { font-weight: 700; }

/* ---------- Auth & installer ---------- */
body.auth-body { background: radial-gradient(1200px 500px at 50% -10%, #dcebef 0%, var(--loc-bg) 60%); min-height: 100vh; }
.auth-wrap { max-width: 560px; margin: 0 auto; padding: 1.5rem 1rem 2rem; }
.auth-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.25rem; }
.auth-card { border-radius: 1rem; }
.auth-foot { text-align: center; color: #8a99a4; font-size: .8rem; margin-top: 1.25rem; }
.install-steps { display: flex; gap: .5rem; margin-bottom: 1.5rem; }
.install-steps .s { flex: 1; height: 6px; border-radius: 4px; background: #e3e7eb; }
.install-steps .s.on { background: var(--loc-primary); }
.check-list li { padding: .35rem 0; border-bottom: 1px dashed #e7ecef; }

@media print {
    .sidebar, .topbar, .btn, form { display: none !important; }
    .content { padding: 0; }
}

/* Phase 3 — leaves & documents */
.badge-leave { background: #6f42c1; color: #fff; }
.badge-leave-unpaid { background: #a98eda; color: #fff; }
.badge-excused { background: #6c757d; color: #fff; }
.day-tags { display: flex; flex-wrap: wrap; gap: .25rem; margin-top: .2rem; }
.day-tag { font-size: .72rem; background: #f1ecfb; color: #4b2d83; border-radius: 1rem; padding: .05rem .5rem; white-space: nowrap; }
.day-tag-warn { background: #fff3cd; color: #7a5a00; }
.balance-card { border-radius: .9rem; border: 1px solid #e7e9ee; background: #fff; padding: 1rem 1.1rem; height: 100%; }
.balance-card .big { font-size: 2rem; font-weight: 700; line-height: 1.1; color: #0f4c5c; }
.balance-card .bar { height: .45rem; border-radius: 1rem; background: #edf0f4; overflow: hidden; margin: .5rem 0 .35rem; }
.balance-card .bar > span { display: block; height: 100%; background: #0f766e; }
.balance-card .bar > span.pending { background: #f2b705; }
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { position: relative; padding: 0 1.4rem .9rem 0; border-inline-start: 0; }
[dir="ltr"] .timeline li { padding: 0 0 .9rem 1.4rem; }
.timeline li::before { content: ""; position: absolute; inset-inline-start: 0; top: .35rem; width: .65rem; height: .65rem; border-radius: 50%; background: #adb5bd; }
.timeline li.ok::before { background: #198754; }
.timeline li.no::before { background: #dc3545; }
.timeline li.wait::before { background: #f2b705; }
.timeline li::after { content: ""; position: absolute; inset-inline-start: .29rem; top: 1.1rem; bottom: .1rem; width: 2px; background: #e5e7eb; }
.timeline li:last-child::after { display: none; }
.doc-icon { width: 2.4rem; height: 2.4rem; border-radius: .6rem; display: inline-flex; align-items: center; justify-content: center; background: #eef4f6; color: #0f4c5c; font-size: 1.2rem; flex-shrink: 0; }
