:root {
    --brand-primary: #0b5566;
    --brand-primary-dark: #083c48;
    --brand-accent: #0f8b8d;
    --brand-bg: #f5f8f9;
    --brand-border: #e2e8ec;
    --sidebar-width: 260px;
}

body {
    background-color: var(--brand-bg);
    font-family: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
    color: #1f2d33;
}

[dir="rtl"] body,
.rtl-field {
    font-family: "Segoe UI", Tahoma, Arial, sans-serif;
}

a {
    color: var(--brand-primary);
}

/* ---------- Buttons ---------- */
.btn-brand {
    background-color: var(--brand-primary);
    border-color: var(--brand-primary);
    color: #fff;
}
.btn-brand:hover,
.btn-brand:focus {
    background-color: var(--brand-primary-dark);
    border-color: var(--brand-primary-dark);
    color: #fff;
}
.btn-outline-brand {
    color: var(--brand-primary);
    border-color: var(--brand-primary);
}
.btn-outline-brand:hover {
    background-color: var(--brand-primary);
    color: #fff;
}

/* ---------- Auth / error pages ---------- */
.auth-page, .error-page {
    min-height: 100vh;
    background: linear-gradient(135deg, var(--brand-primary) 0%, var(--brand-primary-dark) 100%);
}
.auth-card {
    background: #fff;
    border-radius: 0.75rem;
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
    max-width: 420px;
    width: 100%;
}
.error-code {
    font-size: 5rem;
    font-weight: 700;
    color: var(--brand-primary);
    line-height: 1;
}

/* ---------- App shell ---------- */
.app-shell {
    display: flex;
    min-height: 100vh;
}
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--brand-primary-dark);
    color: #eaf4f4;
    flex-shrink: 0;
    transition: margin-left 0.2s ease, margin-right 0.2s ease;
}
.sidebar .brand-block {
    padding: 1.25rem 1rem;
    border-bottom: 1px solid rgba(255,255,255,0.12);
}
.sidebar .nav-link {
    color: #cfe6e6;
    padding: 0.65rem 1rem;
    border-radius: 0.4rem;
    margin: 0.15rem 0.6rem;
    display: flex;
    align-items: center;
    gap: 0.6rem;
}
.sidebar .nav-link:hover {
    background-color: rgba(255,255,255,0.08);
    color: #fff;
}
.sidebar .nav-link.active {
    background-color: var(--brand-accent);
    color: #fff;
}
.main-content {
    flex-grow: 1;
    min-width: 0;
}
.topbar {
    background-color: #fff;
    border-bottom: 1px solid var(--brand-border);
    padding: 0.75rem 1.25rem;
}
.page-body {
    padding: 1.5rem;
}
.card {
    border: 1px solid var(--brand-border);
    box-shadow: 0 1px 2px rgba(0,0,0,0.03);
}
.stat-card {
    border-left: 4px solid var(--brand-primary);
}
.stat-card .stat-value {
    font-size: 1.9rem;
    font-weight: 700;
    color: var(--brand-primary-dark);
}

@media (max-width: 991.98px) {
    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        z-index: 1050;
        margin-left: calc(-1 * var(--sidebar-width));
    }
    .sidebar.show {
        margin-left: 0;
    }
    .sidebar-backdrop {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.4);
        z-index: 1040;
    }
    .sidebar-backdrop.show {
        display: block;
    }
}

/* ---------- Photo / thumbnails ---------- */
.employee-photo-thumb {
    width: 42px;
    height: 42px;
    object-fit: cover;
    border-radius: 50%;
    border: 1px solid var(--brand-border);
}
.employee-photo-lg {
    width: 160px;
    height: 160px;
    object-fit: cover;
    border-radius: 0.5rem;
    border: 1px solid var(--brand-border);
    background: #fff;
}

/* ---------- RTL helpers ---------- */
.dir-rtl {
    direction: rtl;
    text-align: right;
}

/* ---------- Required field indicator ---------- */
.required-mark {
    color: #c0392b;
    margin-left: 0.15rem;
}

/* ---------- Employee ID card (portrait CR80: 53.98mm x 85.6mm) ---------- */
.card-preview-wrap {
    display: flex;
    flex-wrap: wrap;
    gap: 2rem;
    justify-content: center;
}
.id-card {
    width: 53.98mm;
    height: 85.6mm;
    border-radius: 2.5mm;
    box-shadow: 0 4px 14px rgba(0,0,0,0.18);
    position: relative;
    overflow: hidden;
    background: #fff;
    font-size: 8px;
    color: #1a1a1a;
}
.id-card-front,
.id-card-back {
    background: #ffffff;
}
.id-card .card-pad {
    height: 100%;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    align-items: center;
}
.id-card .card-logo-row {
    padding: 3mm 3mm 1.5mm 3mm;
    width: 100%;
    box-sizing: border-box;
    display: flex;
    justify-content: center;
}
.id-card .card-logo-full {
    max-width: 100%;
    max-height: 11mm;
    object-fit: contain;
}

/* --- Front --- */
.id-card .card-name-banner {
    background: #c8102e;
    color: #fff;
    width: 100%;
    box-sizing: border-box;
    padding: 1.8mm 2mm;
    text-align: center;
}
.id-card .card-name-banner .name-ar {
    font-size: 9.5px;
    font-weight: 700;
    direction: rtl;
    line-height: 1.25;
}
.id-card .card-name-banner .name-en {
    font-size: 8px;
    font-weight: 700;
    text-transform: uppercase;
    line-height: 1.25;
    margin-top: 0.5mm;
}
.id-card .card-photo-wrap {
    position: relative;
    width: 32mm;
    height: 32mm;
    margin: 4mm auto 2mm auto;
    flex-shrink: 0;
}
.id-card .card-photo-decoration {
    position: absolute;
    inset: -3mm;
    width: calc(100% + 6mm);
    height: calc(100% + 6mm);
    background: url('../images/photo-accent.svg') center / contain no-repeat;
}
.id-card .card-photo {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    background: #f0f3f4;
}
.id-card .card-title-section {
    width: 100%;
    box-sizing: border-box;
    padding: 0 3mm;
    text-align: center;
}
.id-card .card-category-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    font-size: 6.5px;
    font-weight: 600;
    color: #1a1a1a;
}
.id-card .card-category-row .ar {
    direction: rtl;
}
.id-card .card-department {
    margin-top: 1.5mm;
    font-size: 7px;
    color: #1a1a1a;
    line-height: 1.35;
}
.id-card .card-department .ar {
    direction: rtl;
    display: block;
}
.id-card .card-department .en {
    display: block;
}

/* --- Back --- */
.id-card .card-qr-wrap {
    margin: 4mm auto 3mm auto;
}
.id-card .card-qr {
    width: 32mm;
    height: 32mm;
    display: block;
}
.id-card .card-ids-block {
    width: 100%;
    box-sizing: border-box;
    padding: 0 3mm;
    font-size: 7px;
    font-weight: 700;
    line-height: 1.7;
    color: #1a1a1a;
}
.id-card .card-statement {
    width: 100%;
    box-sizing: border-box;
    padding: 0 3mm;
    font-size: 4.8px;
    color: #5a6a6e;
    margin-top: 2mm;
    line-height: 1.3;
    text-align: center;
}
.id-card .card-meta {
    width: 100%;
    box-sizing: border-box;
    padding: 0 3mm;
    font-size: 5px;
    color: #45585d;
    margin-top: 1.5mm;
    text-align: center;
}

@media print {
    .no-print {
        display: none !important;
    }
}
