@import url('https://fonts.googleapis.com/css2?family=Tajawal:wght@300;400;500;700;800;900&display=swap');

/* ============ أنيميشن الانتقال بين الصفحات ============ */
/* Chrome/Edge (111+): كروس-فيد سلس تلقائي بين أي صفحتين بنفس الدومين، بدون أي جافاسكربت */
@view-transition {
    navigation: auto;
}

/* دخول ناعم للمحتوى بكل الصفحات (يشتغل بكل المتصفحات) */
@keyframes pageFadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}
.wrap, .login-page, body.has-bottom-nav > .wrap {
    animation: pageFadeIn .35s ease-out;
}
/* البطاقات تدخل بتتابع خفيف (stagger) يعطي إحساس حركة أرقى */
.card, .stat, .chart-card, .icon-stat-card {
    animation: pageFadeIn .4s ease-out backwards;
}
.card:nth-of-type(1), .stat:nth-of-type(1) { animation-delay: .02s; }
.card:nth-of-type(2), .stat:nth-of-type(2) { animation-delay: .06s; }
.card:nth-of-type(3), .stat:nth-of-type(3) { animation-delay: .1s; }
.card:nth-of-type(4), .stat:nth-of-type(4) { animation-delay: .14s; }


:root {
    --navy: #0E2238;
    --navy-2: #1C3F5E;
    --navy-soft: #16314A;
    --gold: #C79A44;
    --gold-light: #E8CD8A;
    --gold-dark: #9C7726;
    --bg: #F7F5EF;
    --card: #FFFFFF;
    --border: #E9E3D4;
    --text: #1D2430;
    --text-muted: #7C7566;
    --green: #1E8E5A;
    --green-bg: #E7F6EE;
    --red: #C23A3A;
    --red-bg: #FBEAEA;
    --amber: #B4790A;
    --amber-bg: #FBF1DF;
    --panel-alt: #F8F6F0;
    --chip-bg: #F0EDE3;
    --radius: 12px;
    --shadow: 0 2px 10px rgba(14,34,56,.06);
    --shadow-lg: 0 16px 40px rgba(14,34,56,.14);
}

/* ============ الوضع الداكن (Dark Mode) ============ */
[data-theme="dark"] {
    --bg: #10161F;
    --card: #1A2230;
    --border: #2A3546;
    --text: #E7EAF0;
    --text-muted: #8D97A8;
    --shadow: 0 2px 14px rgba(0,0,0,.35);
    --shadow-lg: 0 20px 50px rgba(0,0,0,.5);
    --green-bg: rgba(30,142,90,.16);
    --red-bg: rgba(194,58,58,.16);
    --amber-bg: rgba(180,121,10,.18);
}
[data-theme="dark"] body { background: var(--bg); color: var(--text); }
[data-theme="dark"] input,
[data-theme="dark"] select,
[data-theme="dark"] textarea {
    background: #212B3B;
    border-color: var(--border);
    color: var(--text);
}
[data-theme="dark"] .balance-card,
[data-theme="dark"] .demo-org-node,
[data-theme="dark"] .org-node {
    background: #212B3B;
}
[data-theme="dark"] tbody tr:hover { background: rgba(255,255,255,.03); }
[data-theme="dark"] .login-form-panel { background: var(--card); }
[data-theme="dark"] .btn.ghost { color: var(--text); border-color: var(--border); }
[data-theme="dark"] .bottom-nav { background: var(--card); border-top-color: var(--border); }
[data-theme="dark"] .filter-tab { background: #212B3B; color: var(--text-muted); }
[data-theme="dark"] .field-box.gray { background: #212B3B; color: var(--text); }
[data-theme="dark"] code { background: #212B3B !important; color: var(--text); }

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: 'Tajawal', sans-serif;
    background: var(--bg);
    color: var(--text);
    direction: rtl;
    text-align: right;
    -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }

/* ============ الشريط العلوي ============ */
.topbar {
    background: linear-gradient(180deg, var(--navy) 0%, #0A1B2C 100%);
    color: #fff;
    padding: 16px 28px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    border-bottom: 2px solid transparent;
    border-image: linear-gradient(90deg, var(--gold-dark), var(--gold) 40%, var(--gold-light) 60%, var(--gold-dark)) 1;
}

.brand-row { display: flex; align-items: center; gap: 13px; }

.logo {
    height: 42px;
    width: 42px;
    object-fit: contain;
    background: #fff;
    border-radius: 9px;
    padding: 3px;
    box-shadow: 0 4px 12px rgba(0,0,0,.25);
}

.login-logo {
    display: block;
    height: 68px;
    margin: 0 auto 16px;
    object-fit: contain;
    filter: drop-shadow(0 6px 16px rgba(199,154,68,.25));
}

.topbar .brand {
    font-weight: 900;
    font-size: 19px;
    letter-spacing: .3px;
    background: linear-gradient(90deg, #fff 30%, var(--gold-light));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.topbar .brand span {
    color: #9FB4C7;
    font-weight: 400;
    font-size: 12.5px;
    display: block;
    margin-top: 2px;
    -webkit-text-fill-color: #9FB4C7;
}

.topbar nav { display: flex; align-items: center; flex-wrap: wrap; gap: 2px; }

.topbar nav a {
    color: #C7D4E0;
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 13.5px;
    font-weight: 500;
    transition: all .18s;
}
.topbar nav a:hover { color: #fff; background: rgba(255,255,255,.08); }

.topbar .logout {
    background: rgba(199,154,68,.14);
    color: var(--gold-light) !important;
    padding: 8px 18px;
    border-radius: 20px;
    font-size: 13px;
    margin-inline-start: 10px;
    border: 1px solid rgba(199,154,68,.3);
}
.topbar .logout:hover { background: rgba(199,154,68,.26); }

/* ============ الحاوية العامة ============ */
.wrap { max-width: 1040px; margin: 32px auto; padding: 0 20px; }

.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 26px;
    margin-bottom: 22px;
    box-shadow: var(--shadow);
    transition: box-shadow .2s;
}
.card:hover {
    box-shadow: 0 4px 16px rgba(14,34,56,.09);
}

.card h2 {
    margin: 0 0 5px;
    font-size: 18.5px;
    font-weight: 800;
    color: var(--navy);
    position: relative;
    padding-inline-start: 14px;
}
.card h2::before {
    content: '';
    position: absolute;
    right: 0;
    top: 3px;
    bottom: 3px;
    width: 4px;
    border-radius: 4px;
    background: linear-gradient(180deg, var(--gold), var(--gold-dark));
}
.card .sub { color: var(--text-muted); font-size: 13px; margin-bottom: 20px; }

/* ============ إحصائيات ============ */
.stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 16px;
    margin-bottom: 22px;
}
.stat {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
    position: relative;
    overflow: hidden;
}
.stat::after {
    content: '';
    position: absolute;
    inset-inline-end: -20px;
    top: -20px;
    width: 70px;
    height: 70px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(199,154,68,.14), transparent 70%);
}
.stat .num { font-size: 28px; font-weight: 900; color: var(--navy); position: relative; }
.stat .label { color: var(--text-muted); font-size: 12.5px; margin-top: 4px; position: relative; }
.stat-icon { position: absolute; top: 14px; left: 14px; font-size: 17px; opacity: .55; }

.balance-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 14px;
}
.balance-card {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px;
    background: linear-gradient(160deg, #FDFCFA, #F7F5EF);
}
.balance-title { font-size: 13px; font-weight: 700; color: var(--navy); margin-bottom: 8px; }
.balance-remaining { font-size: 27px; font-weight: 900; color: var(--gold-dark); }
.balance-remaining span { font-size: 13px; font-weight: 500; color: var(--text-muted); }
.balance-meta { font-size: 12px; color: var(--text-muted); margin: 6px 0 10px; }
.progress { height: 6px; background: var(--border); border-radius: 10px; overflow: hidden; }
.progress-fill { height: 100%; background: linear-gradient(90deg, var(--gold-dark), var(--gold)); border-radius: 10px; }

/* ============ عناصر النماذج ============ */
label { display: block; font-size: 13px; font-weight: 700; margin-bottom: 6px; color: var(--navy); }

input, select, textarea {
    width: 100%;
    padding: 11px 13px;
    border: 1.5px solid var(--border);
    border-radius: 9px;
    font-family: inherit;
    font-size: 14px;
    margin-bottom: 16px;
    background: #FCFBF8;
    transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--gold);
    box-shadow: 0 0 0 3px rgba(199,154,68,.15);
}
textarea { resize: vertical; min-height: 80px; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }

/* ============ أزرار ============ */
.btn {
    display: inline-block;
    background: linear-gradient(135deg, var(--gold), var(--gold-dark));
    color: #fff;
    border: none;
    padding: 12px 24px;
    border-radius: 9px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: transform .15s, box-shadow .15s;
    box-shadow: 0 3px 10px rgba(199,154,68,.3);
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(199,154,68,.4); }
.btn.secondary { background: linear-gradient(135deg, var(--navy-2), var(--navy)); box-shadow: 0 3px 10px rgba(14,34,56,.25); }
.btn.success { background: linear-gradient(135deg, #2FAE6E, var(--green)); box-shadow: 0 3px 10px rgba(30,142,90,.3); }
.btn.danger { background: linear-gradient(135deg, #D24C4C, var(--red)); box-shadow: 0 3px 10px rgba(194,58,58,.25); }
.btn.ghost { background: transparent; color: var(--navy); border: 1.5px solid var(--border); box-shadow: none; }
.btn.ghost:hover { border-color: var(--gold); background: rgba(199,154,68,.06); transform: none; }
.btn.small { padding: 7px 15px; font-size: 13px; }

/* ============ جداول ============ */
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 12px 10px; border-bottom: 1px solid var(--border); text-align: right; }
th { color: var(--text-muted); font-weight: 700; font-size: 12px; text-transform: uppercase; letter-spacing: .3px; }
tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #FBF9F4; }

.badge {
    display: inline-block;
    padding: 4px 13px;
    border-radius: 20px;
    font-size: 12.5px;
    font-weight: 700;
}
.badge.pending { background: var(--amber-bg); color: var(--amber); }
.badge.approved { background: var(--green-bg); color: var(--green); }
.badge.rejected { background: var(--red-bg); color: var(--red); }

/* ============ صفحة تسجيل الدخول (Split Screen) ============ */
.login-page {
    min-height: 100vh;
    display: flex;
    background: var(--bg);
}

.login-brand-panel {
    flex: 1.1;
    position: relative;
    background:
        linear-gradient(160deg, rgba(14,34,56,.94) 0%, rgba(7,19,32,.97) 100%),
        url('/assets/login-banner.jpg');
    background-size: cover;
    background-position: center;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
    padding: 60px 70px;
    color: #fff;
    overflow: hidden;
}
.login-brand-panel::before {
    content: '';
    position: absolute; inset: 0;
    background:
        linear-gradient(135deg, transparent 46%, rgba(199,154,68,.10) 47%, rgba(199,154,68,.10) 48.5%, transparent 49.5%),
        linear-gradient(135deg, transparent 58%, rgba(199,154,68,.07) 59%, rgba(199,154,68,.07) 60.3%, transparent 61.3%),
        radial-gradient(ellipse 700px 500px at 15% 85%, rgba(199,154,68,.22), transparent 60%);
    pointer-events: none;
}
.login-brand-panel .logo-big {
    height: 74px; width: 74px;
    object-fit: contain;
    background: #fff;
    border-radius: 16px;
    padding: 8px;
    box-shadow: 0 10px 30px rgba(0,0,0,.3);
    position: relative; z-index: 1;
    margin-bottom: 28px;
}
.login-brand-panel h1 {
    font-size: 30px; font-weight: 900; margin: 0 0 10px; position: relative; z-index: 1;
    background: linear-gradient(90deg, #fff 25%, var(--gold-light));
    -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
    line-height: 1.3;
}
.login-brand-panel .tagline { font-size: 15px; color: #A9BFD1; max-width: 340px; line-height: 1.8; position: relative; z-index: 1; }
.login-brand-panel .brand-features { margin-top: 40px; display: flex; flex-direction: column; gap: 14px; position: relative; z-index: 1; }
.login-brand-panel .brand-feature { display: flex; align-items: center; gap: 12px; font-size: 13.5px; color: #C7D4E0; }
.login-brand-panel .brand-feature .fi {
    width: 34px; height: 34px; border-radius: 10px;
    background: rgba(199,154,68,.14); border: 1px solid rgba(199,154,68,.25);
    display: flex; align-items: center; justify-content: center; font-size: 15px; flex-shrink: 0;
}

.login-form-panel { flex: 1; display: flex; align-items: center; justify-content: center; padding: 40px 30px; background: var(--card); }
.login-form-inner { width: 100%; max-width: 360px; }
.login-form-inner h2 { font-size: 22px; font-weight: 900; color: var(--navy); margin: 0 0 6px; }
.login-form-inner .sub { color: var(--text-muted); font-size: 13.5px; margin-bottom: 30px; }

@media (max-width: 860px) {
    .login-page { flex-direction: column; }
    .login-brand-panel { flex: none; padding: 40px 28px; align-items: center; text-align: center; }
    .login-brand-panel .tagline { max-width: none; }
    .login-brand-panel .brand-features { display: none; }
    .login-form-panel { flex: none; }
}

/* ============ تنبيهات ============ */
.alert { padding: 13px 17px; border-radius: 9px; font-size: 13.5px; margin-bottom: 16px; }
.alert.error { background: var(--red-bg); color: var(--red); }
.alert.success { background: var(--green-bg); color: var(--green); }

.empty-state {
    text-align: center;
    padding: 42px 20px;
    color: var(--text-muted);
}
.empty-state::before {
    content: '🗂️';
    display: block;
    font-size: 30px;
    margin-bottom: 10px;
    opacity: .45;
}

/* ============ لوحة المعلومات (تحليلات) ============ */
.chart-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.chart-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 22px;
    box-shadow: var(--shadow);
}
.chart-card h3 { margin: 0 0 4px; font-size: 15px; font-weight: 800; color: var(--navy); }
.chart-card .sub { color: var(--text-muted); font-size: 12.5px; margin-bottom: 16px; }
.chart-card canvas { max-height: 260px; }

.rank-list { list-style: none; margin: 0; padding: 0; }
.rank-list li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
    font-size: 13.5px;
}
.rank-list li:last-child { border-bottom: none; }
.rank-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px; height: 22px;
    border-radius: 50%;
    background: var(--gold);
    color: #fff;
    font-size: 11px;
    font-weight: 800;
    margin-inline-end: 8px;
}

.code-chip {
    background: var(--chip-bg);
    padding: 3px 9px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 700;
    color: var(--navy);
}

@media (max-width: 700px) {
    .chart-grid { grid-template-columns: 1fr; }
    .grid-2 { grid-template-columns: 1fr; }
    .topbar { flex-direction: column; gap: 10px; align-items: flex-start; }
    .topbar .logout { margin-top: 6px; }
}

/* ============ شريط تنقل سفلي (واجهة الموظف على الموبايل) ============ */
body.has-bottom-nav { padding-bottom: 78px; }

.bottom-nav {
    position: fixed;
    bottom: 0; right: 0; left: 0;
    background: #fff;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: space-around;
    padding: 9px 0 calc(9px + env(safe-area-inset-bottom, 0px));
    box-shadow: 0 -6px 24px rgba(14,34,56,.08);
    z-index: 60;
}
.bottom-nav a {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    padding: 4px 14px;
    border-radius: 12px;
    transition: color .15s;
}
.bottom-nav a .icon { font-size: 20px; line-height: 1; }
.bottom-nav a.active { color: var(--gold-dark); }

/* ============ بطاقات الأرصدة الملونة بأيقونات (نمط تطبيقات الموبايل) ============ */
.icon-stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.icon-stat-card {
    border-radius: 16px;
    padding: 18px 16px;
    position: relative;
    min-height: 92px;
}
.icon-stat-card .icon-badge {
    width: 34px; height: 34px;
    border-radius: 50%;
    background: rgba(255,255,255,.65);
    display: flex; align-items: center; justify-content: center;
    font-size: 16px;
    position: absolute;
    left: 14px; top: 14px;
}
.icon-stat-card .label { font-size: 12.5px; font-weight: 700; margin-bottom: 3px; opacity: .8; }
.icon-stat-card .value { font-size: 23px; font-weight: 900; }
.icon-stat-card .value span { font-size: 12px; font-weight: 600; opacity: .7; }

/* ============ Hero لوحة الموظف ============ */
.emp-hero {
    background: linear-gradient(135deg, var(--navy) 0%, #081522 100%);
    border-radius: 20px;
    padding: 26px 24px;
    color: #fff;
    position: relative;
    overflow: hidden;
    margin-bottom: 22px;
}
.emp-hero::before {
    content: '';
    position: absolute; inset: 0;
    background:
        linear-gradient(135deg, transparent 55%, rgba(199,154,68,.12) 56%, rgba(199,154,68,.12) 57.3%, transparent 58.3%),
        radial-gradient(ellipse 500px 300px at 90% 110%, rgba(199,154,68,.18), transparent 65%);
    pointer-events: none;
}
.emp-hero-top { display: flex; justify-content: space-between; align-items: flex-start; position: relative; z-index: 1; }
.emp-hero-avatar {
    width: 52px; height: 52px; border-radius: 50%;
    background: linear-gradient(135deg, var(--gold), var(--gold-dark));
    display: flex; align-items: center; justify-content: center;
    font-size: 20px; font-weight: 900; color: #fff;
    box-shadow: 0 6px 16px rgba(199,154,68,.35);
    flex-shrink: 0;
}
.emp-hero-greeting { font-size: 19px; font-weight: 900; margin-bottom: 2px; }
.emp-hero-date { font-size: 12.5px; color: #9FB4C7; }
.emp-hero-checkin {
    position: relative; z-index: 1;
    margin-top: 20px;
    background: rgba(255,255,255,.06);
    border: 1px solid rgba(255,255,255,.1);
    border-radius: 13px;
    padding: 14px 16px;
    display: flex; justify-content: space-between; align-items: center;
}
.emp-hero-checkin .cin-label { font-size: 11.5px; color: #9FB4C7; margin-bottom: 3px; }
.emp-hero-checkin .cin-value { font-size: 16px; font-weight: 800; }
.emp-hero-checkin .cin-empty { font-size: 13px; color: #C7D4E0; }

.type-monthly { background: linear-gradient(135deg, #FDEEE3, #FBD9BF); color: #7A4420; }
.type-hourly  { background: linear-gradient(135deg, #EEE8FB, #DBCCF6); color: #4B2E85; }
.type-sick    { background: linear-gradient(135deg, #FFF3D6, #FCE1A0); color: #7A5A0A; }
.type-marriage{ background: linear-gradient(135deg, #E3F5EC, #C4EBD9); color: #1B6E4A; }

/* ============ فلاتر شرائط (Pills) ============ */
.filter-tabs { display: flex; gap: 8px; overflow-x: auto; margin-bottom: 16px; padding-bottom: 2px; }
.filter-tab {
    padding: 8px 18px;
    border-radius: 22px;
    background: #F1EDE2;
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 700;
    white-space: nowrap;
    border: none;
    font-family: inherit;
    cursor: pointer;
}
.filter-tab.active { background: var(--navy); color: #fff; }

/* ============ بطاقة طلب إجازة (نمط سجل الطلبات الجديد) ============ */
.request-card { background: #fff; border: 1px solid var(--border); border-radius: 14px; padding: 16px; margin-bottom: 12px; }
.request-card .req-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.request-card .req-type { font-weight: 800; font-size: 14.5px; color: var(--navy); }
.request-card .req-date { font-size: 11.5px; color: var(--text-muted); margin-top: 2px; }
.field-box { border-radius: 10px; padding: 10px 12px; font-size: 12.5px; }
.field-box .fb-label { display: flex; align-items: center; gap: 5px; opacity: .75; margin-bottom: 3px; }
.field-box .fb-value { font-weight: 800; font-size: 13.5px; }
.field-box.green { background: var(--green-bg); color: var(--green); }
.field-box.red { background: var(--red-bg); color: var(--red); }
.field-box.gray { background: #F1EDE2; color: var(--navy); }

/* ============ الشريط الجانبي للوحة الآدمن ============ */
body.admin-page { background: var(--bg); }
body.admin-page .topbar { display: none; }

.admin-sidebar {
    position: fixed;
    top: 0; bottom: 0; right: 0;
    width: 232px;
    background: linear-gradient(180deg, var(--navy) 0%, #081522 100%);
    display: flex;
    flex-direction: column;
    padding: 22px 14px 16px;
    overflow-y: auto;
    z-index: 70;
    transition: transform .25s ease;
    border-inline-start: 1px solid rgba(199,154,68,.15);
}
.admin-sidebar::-webkit-scrollbar { width: 5px; }
.admin-sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,.15); border-radius: 10px; }

.sidebar-brand { display: flex; align-items: center; gap: 10px; padding: 0 6px 18px; border-bottom: 1px solid rgba(255,255,255,.08); margin-bottom: 14px; }
.sidebar-brand .logo { height: 38px; width: 38px; }
.sidebar-brand-name {
    font-weight: 900; font-size: 14.5px;
    background: linear-gradient(90deg, #fff 30%, var(--gold-light));
    -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.sidebar-brand-sub { color: #8FA6BA; font-size: 11px; margin-top: 1px; }

.admin-sidebar nav { display: flex; flex-direction: column; gap: 1px; flex: 1; }

.nav-group-label {
    color: #55708A; font-size: 10.5px; font-weight: 800;
    text-transform: uppercase; letter-spacing: .6px;
    margin: 16px 10px 5px;
}
.nav-group-label:first-child { margin-top: 2px; }

.admin-sidebar nav a {
    display: flex; align-items: center; gap: 10px;
    padding: 9px 11px; border-radius: 9px;
    color: #C7D4E0; font-size: 13.2px; font-weight: 600;
    transition: background .15s, color .15s;
}
.admin-sidebar nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.admin-sidebar nav a.active {
    background: linear-gradient(90deg, rgba(199,154,68,.24), rgba(199,154,68,.05));
    color: var(--gold-light);
    font-weight: 800;
    box-shadow: inset 3px 0 0 var(--gold);
}
.nav-icon { font-size: 15px; width: 18px; text-align: center; }

.sidebar-logout {
    display: flex; align-items: center; gap: 10px;
    padding: 11px; border-radius: 9px;
    color: #E9A9A9; font-size: 13px; font-weight: 700;
    margin-top: 12px; padding-top: 16px;
    border-top: 1px solid rgba(255,255,255,.08);
}
.sidebar-logout:hover { color: #fff; }

.sidebar-toggle-checkbox { display: none; }
.sidebar-hamburger { display: none; }
.sidebar-overlay { display: none; }

body.admin-page .wrap { max-width: none; margin: 28px 232px 32px 24px; }

.admin-page-header { margin-bottom: 22px; }
.admin-page-header h1 { font-size: 22px; font-weight: 900; color: var(--navy); margin: 0 0 3px; }
.admin-page-header .sub { color: var(--text-muted); font-size: 13.5px; }

@media (max-width: 900px) {
    .admin-sidebar { transform: translateX(105%); box-shadow: -24px 0 50px rgba(0,0,0,.35); }
    .sidebar-toggle-checkbox:checked ~ .admin-sidebar { transform: translateX(0); }
    .sidebar-hamburger {
        display: flex; align-items: center; justify-content: center;
        position: fixed; top: 16px; left: 16px; z-index: 80;
        width: 42px; height: 42px;
        background: linear-gradient(135deg, var(--navy), #0A1B2C);
        color: var(--gold-light); border-radius: 11px;
        cursor: pointer; font-size: 18px;
        box-shadow: var(--shadow-lg);
    }
    .sidebar-toggle-checkbox:checked ~ .sidebar-overlay {
        display: block; position: fixed; inset: 0;
        background: rgba(8,21,34,.5); z-index: 65;
        backdrop-filter: blur(2px);
    }
    body.admin-page .wrap { margin: 68px 16px 32px 16px; }
}

/* ============ أزرار تبديل اللغة والمود ============ */
.settings-row { display: flex; gap: 12px; flex-wrap: wrap; }
.toggle-group { display: inline-flex; background: var(--bg); border: 1.5px solid var(--border); border-radius: 12px; padding: 4px; gap: 4px; }
.toggle-option {
    padding: 9px 20px; border-radius: 9px; font-size: 13.5px; font-weight: 700;
    color: var(--text-muted); cursor: pointer; border: none; background: transparent;
    font-family: inherit; transition: all .15s;
}
.toggle-option.active { background: linear-gradient(135deg, var(--gold), var(--gold-dark)); color: #fff; box-shadow: 0 3px 10px rgba(199,154,68,.3); }

/* ============ تايمر مباشر بعد البصمة ============ */
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .55; } }
#liveTimer { font-variant-numeric: tabular-nums; letter-spacing: .5px; }

/* ============ تنسيق الطباعة / حفظ PDF ============ */
@media print {
    .admin-sidebar, .sidebar-hamburger, .sidebar-overlay, .card form, .demo-switcher, .btn, .bottom-nav { display: none !important; }
    body { background: #fff !important; }
    .wrap { margin: 0 !important; padding: 10px !important; max-width: 100% !important; }
    .card { box-shadow: none !important; border: 1px solid #ccc !important; page-break-inside: avoid; margin-bottom: 14px !important; }
    table { page-break-inside: auto; }
    tr { page-break-inside: avoid; }
    .admin-page-header { margin-bottom: 10px !important; }
}

/* ============ تنسيق الطباعة / حفظ PDF ============ */
@media print {
    .admin-sidebar, .sidebar-hamburger, .sidebar-overlay, .card form, .demo-switcher, .btn, .bottom-nav { display: none !important; }
    body { background: #fff !important; }
    .wrap { margin: 0 !important; padding: 10px !important; max-width: 100% !important; }
    .card { box-shadow: none !important; border: 1px solid #ccc !important; page-break-inside: avoid; margin-bottom: 14px !important; }
    table { page-break-inside: auto; }
    tr { page-break-inside: avoid; }
    .admin-page-header { margin-bottom: 10px !important; }
}
