/* نظام مجمع الحسين - التصميم الفاخر */
:root {
    --font-primary: 'Tajawal', sans-serif;
    --font-size-base: 14px;
    --font-size-sm: 13px;
    --font-size-xs: 12px;
    --font-weight-normal: 500;
    --font-weight-medium: 600;
    --font-weight-bold: 700;
    --font-weight-heavy: 800;
    --gold: #d4af37;
    --gold-light: #f4e4bc;
    --gold-dark: #b8960c;
    --navy: #1a1f3c;
    --navy-light: #2d3561;
    --cream: #faf8f5;
    --white: #ffffff;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;
    --whatsapp: #25d366;
    
    /* Light Mode */
    --bg-primary: var(--cream);
    --bg-secondary: var(--white);
    --bg-card: var(--white);
    --text-primary: var(--navy);
    --text-secondary: var(--navy-light);
    --border-color: #e5e7eb;
    --shadow-color: rgba(0,0,0,0.08);
    --shadow-soft: 0 2px 12px rgba(0,0,0,0.06);
    --shadow-hover: 0 12px 40px rgba(0,0,0,0.12);
    --radius-card: 20px;
    --radius-btn: 12px;
}

/* Light Mode Only - No Dark Mode */

* { margin: 0; padding: 0; box-sizing: border-box; }

/* شريط التمرير الحديث والمتناسق */
* {
    scrollbar-width: thin;
    scrollbar-color: rgba(212, 175, 55, 0.5) transparent;
}

*::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

*::-webkit-scrollbar-track {
    background: transparent;
}

*::-webkit-scrollbar-thumb {
    background: rgba(212, 175, 55, 0.35);
    border-radius: 10px;
    border: 2px solid transparent;
    background-clip: padding-box;
}

*::-webkit-scrollbar-thumb:hover {
    background: rgba(212, 175, 55, 0.55);
    background-clip: padding-box;
}

*::-webkit-scrollbar-thumb:active {
    background: var(--gold);
    background-clip: padding-box;
}

*::-webkit-scrollbar-corner {
    background: transparent;
}

/* شريط تمرير الشريط الجانبي — لون داكن */
.app-sidebar ::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
}

.app-sidebar ::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.35);
}

.app-sidebar .nav-tabs {
    scrollbar-color: rgba(255, 255, 255, 0.25) transparent;
}

body {
    font-family: var(--font-primary);
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-normal);
    background: var(--bg-primary);
    min-height: 100vh;
    min-height: 100dvh;
    color: var(--text-primary);
    transition: background 0.3s, color 0.3s;
}

@media (max-width: 1024px) {
    html, body {
        -webkit-overflow-scrolling: touch;
        overflow-x: hidden;
        max-width: 100vw;
        /* منع قطع المحتوى بسبب شريط المتصفح على الهاتف */
        height: auto;
        min-height: -webkit-fill-available;
    }
    .app-layout {
        overflow-x: hidden;
        max-width: 100%;
        min-height: -webkit-fill-available;
        min-height: 100dvh;
    }
    .app-main {
        overflow-x: hidden;
        max-width: 100%;
        min-height: unset;
    }
    .app-main .page-content { overflow-x: hidden; max-width: 100%; min-width: 0; }
    .page-section { overflow-x: hidden; max-width: 100%; }
    .page-section .card { max-width: 100%; min-width: 0; overflow-x: hidden; }
    #expensesList, #contractsList, #receiptsList, #bankList {
        max-width: 100%; min-width: 0; overflow-x: hidden;
        overflow-wrap: break-word; word-wrap: break-word;
        contain: layout style;
    }
    .sort-filters { flex-wrap: wrap; max-width: 100%; }
    .list-item { max-width: 100%; min-width: 0; overflow-wrap: break-word; }
    .list-item-title, .list-item-subtitle { overflow-wrap: break-word; word-break: break-word; }
}

/* ═══════════════════════════════════════════════════════════════
   TOP NAVBAR — الشريط العلوي الرئيسي (بديل الشريط الجانبي)
   ═══════════════════════════════════════════════════════════════ */
.app-topbar {
    position: fixed;
    top: 0;
    right: 0;
    left: 0;
    height: 64px;
    background: #1a1f3c;
    display: flex;
    align-items: center;
    gap: 8px;
    z-index: 300;
    box-shadow: 0 2px 16px rgba(0,0,0,0.2);
    padding: 0 16px;
}

.topbar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding-right: 20px;
    border-right: 1px solid rgba(255,255,255,0.12);
    margin-right: 20px;
    min-width: 0;
    flex-shrink: 0;
}

.topbar-logo {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    overflow: hidden;
    border: 2px solid var(--gold);
    flex-shrink: 0;
    box-shadow: 0 0 0 3px rgba(212,175,55,0.2);
}
.topbar-logo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center center;
    display: block;
}
.topbar-logo-placeholder {
    width: 38px;
    height: 38px;
    background: var(--navy-light);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: 800;
    color: var(--gold);
}

.topbar-title {
    font-size: 15px;
    font-weight: 800;
    color: #fff;
    white-space: nowrap;
}
.topbar-subtitle {
    font-size: 11px;
    color: var(--gold-light);
    font-weight: 500;
    white-space: nowrap;
}

/* زر فتح القائمة الجانبية على الجوال */
.sidebar-toggle {
    display: none;
    width: 42px;
    height: 42px;
    border: none;
    background: rgba(255,255,255,0.1);
    color: #fff;
    border-radius: 10px;
    cursor: pointer;
    font-size: 20px;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    flex-shrink: 0;
    margin-right: 12px;
}
.sidebar-toggle:hover { background: rgba(255,255,255,0.2); }
.sidebar-toggle:active { opacity: 0.8; transform: scale(0.96); }

/* wrapper للتنقل مع أزرار السكرول */
.topbar-nav-wrapper {
    display: flex;
    align-items: center;
    flex: 1;
    min-width: 0;
    position: relative;
}

/* شريط التنقل الأفقي داخل topbar */
.topbar-nav {
    display: flex;
    align-items: center;
    gap: 2px;
    flex: 1;
    overflow-x: auto;
    scroll-behavior: smooth;
    scrollbar-width: none;
    flex-wrap: nowrap;
    padding: 0 4px;
    min-width: 0;
    -webkit-overflow-scrolling: touch;
}
.topbar-nav::-webkit-scrollbar { display: none; }

.nav-tab {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border: none;
    background: transparent;
    color: rgba(255,255,255,0.7);
    border-radius: 8px;
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.18s ease;
    position: relative;
    flex-shrink: 0;
}
.nav-tab i { font-size: 15px; }
.nav-tab:hover {
    background: rgba(255,255,255,0.1);
    color: #fff;
}
.nav-tab.active {
    background: var(--gold);
    color: #1a1f3c;
    font-weight: 700;
    box-shadow: 0 2px 10px rgba(212,175,55,0.4);
}

/* شريط التنقل على الجوال — قائمة جانبية منسدلة */
.app-sidebar {
    position: fixed;
    top: 64px;
    right: 0;
    width: min(280px, 78vw);
    height: calc(100dvh - 64px);
    background: #1a1f3c;
    z-index: 250;
    transform: translateX(100%);
    transition: transform 0.22s cubic-bezier(0.32,0.72,0,1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: none;
}
.app-sidebar.open {
    transform: translateX(0);
    box-shadow: -6px 0 30px rgba(0,0,0,0.3);
}
.sidebar-close {
    position: absolute;
    top: 12px;
    left: 12px;
    width: 44px;
    height: 44px;
    border: none;
    background: rgba(255,255,255,0.15);
    color: #fff;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}
.sidebar-close:hover { background: rgba(255,255,255,0.2); }

.app-sidebar .nav-tabs {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 16px 10px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    scrollbar-width: none;
}
.app-sidebar .nav-tabs::-webkit-scrollbar { display: none; }

.nav-group { margin-bottom: 16px; }
.nav-group-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(255,255,255,0.4);
    padding: 0 10px 6px;
}

.app-sidebar .nav-tab {
    width: 100%;
    padding: 11px 14px;
    border-radius: 10px;
    background: transparent;
    color: rgba(255,255,255,0.8);
    font-size: 14px;
    font-weight: 500;
    justify-content: flex-end;
    text-align: right;
    margin-bottom: 2px;
    gap: 10px;
}
.app-sidebar .nav-tab i { font-size: 18px; opacity: 0.9; }
.app-sidebar .nav-tab span { flex: 1; }
.app-sidebar .nav-tab:hover {
    background: rgba(255,255,255,0.09);
    color: #fff;
}
.app-sidebar .nav-tab.active {
    background: var(--gold);
    color: #1a1f3c;
    font-weight: 700;
    box-shadow: 0 2px 10px rgba(212,175,55,0.3);
}
.app-sidebar .nav-tab.active i { opacity: 1; }

.sidebar-footer {
    padding: 14px 10px;
    border-top: 1px solid rgba(255,255,255,0.1);
}

.user-info-compact {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    background: rgba(255,255,255,0.07);
    border-radius: 10px;
    margin-bottom: 8px;
}
.user-meta { flex: 1; min-width: 0; }
.sidebar-footer .user-name { font-size: 13px; font-weight: 700; color: #fff; }
.sidebar-footer .user-role { font-size: 11px; color: var(--gold-light); }

.user-avatar {
    width: 36px;
    height: 36px;
    background: var(--gold);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    color: #1a1f3c;
    flex-shrink: 0;
}

.logout-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px;
    background: rgba(239,68,68,0.15);
    color: #fca5a5;
    border: 1px solid rgba(239,68,68,0.25);
    border-radius: 10px;
    cursor: pointer;
    font-family: inherit;
    font-size: 13px;
    font-weight: 700;
    transition: all 0.2s;
}
.logout-btn:hover { background: rgba(239,68,68,0.3); color: #fff; }

/* حاوية معلومات المستخدم في topbar */
.topbar-user {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
    padding-left: 16px;
    border-left: 1px solid rgba(255,255,255,0.12);
    margin-left: 16px;
}
.topbar-user .user-name { font-size: 13px; font-weight: 700; color: #fff; }
.topbar-user .user-role { font-size: 11px; color: var(--gold-light); }

/* زر الخروج في topbar */
.topbar-logout {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: rgba(239,68,68,0.18);
    color: #fca5a5;
    border: 1px solid rgba(239,68,68,0.3);
    border-radius: 8px;
    cursor: pointer;
    font-family: inherit;
    font-size: 13px;
    font-weight: 700;
    transition: all 0.2s;
    flex-shrink: 0;
}
.topbar-logout:hover { background: rgba(239,68,68,0.35); color: #fff; }

/* badge متصل */
.live-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 600;
    color: #4ade80;
    padding: 6px 12px;
    background: rgba(74,222,128,0.12);
    border-radius: 8px;
    border: 1px solid rgba(74,222,128,0.2);
    flex-shrink: 0;
}
.live-badge .live-dot {
    width: 7px;
    height: 7px;
    background: #4ade80;
    border-radius: 50%;
    animation: pulse 1.5s infinite;
}

.header-btn {
    background: rgba(255,255,255,0.1);
    border: none;
    color: white;
    padding: 8px 14px;
    border-radius: 8px;
    cursor: pointer;
    font-family: inherit;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
    flex-shrink: 0;
}
.header-btn:hover { background: rgba(255,255,255,0.18); }

/* عنوان الصفحة الحالية تحت الـ topbar */
.main-header {
    background: #fff;
    padding: 12px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
.main-header-compact {
    padding: 10px 20px !important;
    display: flex;
    align-items: center;
    gap: 12px;
}
.header-spacer { flex: 1; }

/* ═══════════════════════════════════════════════════════════════
   LAYOUT الرئيسي — تحت الـ topbar
   ═══════════════════════════════════════════════════════════════ */
.app-layout {
    min-height: 100vh;
    min-height: 100dvh;
    background: var(--bg-primary);
    padding-top: 64px;
    overflow-x: hidden;
}

.app-main {
    min-height: calc(100vh - 64px);
    min-height: calc(100dvh - 64px);
    display: flex;
    flex-direction: column;
}

/* المحتوى داخل التطبيق */
.app-main .page-content {
    flex: 1;
    max-width: 980px;
    width: 100%;
    margin: 0 auto;
    padding: 28px 24px 60px;
    box-sizing: border-box;
}

.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    z-index: 240;
    opacity: 0;
    transition: opacity 0.18s ease;
    pointer-events: none;
}
.sidebar-backdrop.visible {
    display: block;
    opacity: 1;
    pointer-events: all;
}

/* انتقال الصفحات */
.page-section {
    display: none;
    animation: fadeSlide 0.22s ease-out;
}
.page-section.active {
    display: block;
    animation: fadeSlide 0.22s ease-out;
}
@keyframes fadeSlide {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* الجوال */
@media (max-width: 1024px) {
    .sidebar-toggle { display: flex; }
    .topbar-nav { display: none; }
    .topbar-user { display: none; }
    .topbar-logout { display: none; }
    .live-badge { display: none; }
    .topbar-brand { border-right: none; margin-right: 0; padding-right: 0; }
    .app-main .page-content {
        padding: 16px 12px 80px;
        max-width: 100%;
        box-sizing: border-box;
    }
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    .quick-actions {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    .dash-extra-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .app-sidebar .nav-tab span { display: inline !important; }
}

@media (min-width: 1025px) {
    .app-sidebar { display: none; }
    .sidebar-backdrop { display: none !important; }
    .sidebar-toggle { display: none !important; }
    .topbar-nav { display: flex; }
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeInMobile {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* الجوال: تحسينات إضافية */
@media (max-width: 1024px) {
    .sidebar-close { display: flex; }
    .sidebar-toggle {
        touch-action: manipulation;
        -webkit-tap-highlight-color: transparent;
    }
    .app-sidebar .nav-tab {
        touch-action: manipulation;
        -webkit-tap-highlight-color: transparent;
        user-select: none;
    }
    .app-sidebar .nav-tab:active {
        background: rgba(255,255,255,0.12);
        transform: scale(0.98);
    }
    .app-sidebar .nav-tab span {
        display: inline !important;
        flex: 1;
        color: #fff;
        font-size: 15px;
        font-weight: 600;
        white-space: nowrap;
    }
    .app-sidebar .nav-tab.active span { color: #1a1f3c; }
    .app-main .page-content {
        -webkit-overflow-scrolling: touch;
        padding-bottom: max(env(safe-area-inset-bottom, 0px), 80px);
    }
}

/* Stats */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
    margin-bottom: 20px;
}

.stat-card {
    background: var(--bg-card);
    border-radius: 18px;
    padding: 20px;
    text-align: center;
    box-shadow: var(--shadow-soft);
    position: relative;
    overflow: hidden;
    transition: background 0.3s, transform 0.25s ease, box-shadow 0.25s ease;
    border: 1px solid rgba(0,0,0,0.04);
}
.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 16px 40px rgba(0,0,0,0.1), 0 0 0 1px rgba(212,175,55,0.1);
}
.stat-card::before {
    content: '';
    position: absolute;
    top: 0; right: 0;
    width: 50px; height: 50px;
    background: var(--gold-light);
    border-radius: 0 18px 0 50px;
    opacity: 0.5;
}
.stat-value { font-size: 28px; font-weight: 900; color: var(--text-primary); }
.stat-label { font-size: 13px; color: var(--navy-light); margin-top: 5px; }
.stat-change { font-size: 11px; padding: 3px 10px; border-radius: 15px; display: inline-block; margin-top: 8px; }
.stat-change.up { background: #d1fae5; color: #065f46; }
.stat-change.down { background: #fee2e2; color: #991b1b; }

/* Quick Actions */
.quick-actions {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
    margin-bottom: 20px;
}

.quick-action {
    background: var(--bg-card);
    border-radius: 18px;
    padding: 25px 15px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px var(--shadow-color);
    border: 2px solid transparent;
    position: relative;
    overflow: hidden;
}

/* خط هوية بلون كل حقل */
.quick-action::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    left: 0;
    height: 4px;
    border-radius: 18px 18px 0 0;
}
.quick-action.contract::before { background: linear-gradient(90deg, var(--gold-dark), var(--gold)); }
.quick-action.receipt::before { background: linear-gradient(90deg, #059669, var(--success)); }
.quick-action.bank::before { background: linear-gradient(90deg, #2563eb, var(--info)); }
.quick-action.expense::before { background: linear-gradient(90deg, #b91c1c, var(--danger)); }

.quick-action:hover {
    transform: translateY(-6px) scale(1.02);
    border-color: transparent;
    box-shadow: 0 16px 40px rgba(0,0,0,0.12);
}
.quick-action:hover.contract { box-shadow: 0 16px 40px rgba(212,175,55,0.22); }
.quick-action:hover.receipt { box-shadow: 0 16px 40px rgba(16,185,129,0.22); }
.quick-action:hover.bank { box-shadow: 0 16px 40px rgba(59,130,246,0.22); }
.quick-action:hover.expense { box-shadow: 0 16px 40px rgba(239,68,68,0.22); }
.quick-action:active {
    transform: translateY(-2px) scale(1);
}

.quick-action i {
    font-size: 32px;
    margin-bottom: 10px;
    display: block;
    transition: transform 0.25s ease;
}
.quick-action:hover i { transform: scale(1.08); }
.quick-action span { font-size: 14px; font-weight: 700; color: var(--text-primary); }
.quick-action.contract i { color: var(--gold); }
.quick-action.receipt i { color: var(--success); }
.quick-action.bank i { color: var(--info); }
.quick-action.expense i { color: var(--danger); }

/* Card */
.card {
    background: var(--bg-card);
    border-radius: var(--radius-card);
    padding: 25px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-soft);
    transition: background 0.3s, box-shadow 0.3s ease;
    border: 1px solid var(--border-color);
}

.card:hover {
    box-shadow: var(--shadow-hover);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.card-title {
    font-size: 16px;
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-title i { color: var(--gold); }

/* Live Chart */
.live-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
}

.live-dot {
width: 8px; height: 8px;
background: var(--success);
border-radius: 50%;
animation: pulse 1.5s infinite;
}

@keyframes pulse {
0%, 100% { opacity: 1; transform: scale(1); }
50% { opacity: 0.5; transform: scale(1.3); }
}

.chart-container {
    background: var(--bg-secondary);
    border-radius: 15px;
    padding: 20px;
    height: 150px;
    display: flex;
    flex-direction: column;
    transition: background 0.3s;
}

.chart-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 15px;
}

.chart-value { color: var(--success); font-weight: 800; font-size: 18px; }

.chart-bars {
    flex: 1;
    display: flex;
    align-items: flex-end;
    justify-content: space-around;
    gap: 8px;
}

.chart-bar {
    width: 30px;
    background: linear-gradient(to top, var(--gold), var(--gold-light));
    border-radius: 6px 6px 0 0;
    transition: height 0.5s ease;
}

/* overlay — position/display/z-index يُضاف بـ rc-dialog أو rc-bottom-sheet */
.modal-overlay {
    display: none;
    background: rgba(0, 0, 0, 0.6);
    overscroll-behavior: contain;
}

.modal-content {
    background: var(--bg-card);
    border-radius: 20px;
    padding: 25px;
    width: 100%;
    max-width: 560px;
    max-height: 82dvh;
    overflow-y: auto;
    overflow-x: hidden;
    box-sizing: border-box;
    animation: slideUp 0.25s ease;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    flex-shrink: 0;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}


.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--border-color);
}

.modal-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
}

/* form-modal — position/display/z-index يُضاف بـ rc-dialog أو rc-bottom-sheet */
.form-modal {
    display: none;
    background: rgba(0,0,0,0.55);
    overscroll-behavior: contain;
}

.form-content {
    background: var(--bg-card);
    border-radius: 24px;
    padding: 30px;
    width: 100%;
    max-width: 500px;
    max-height: 82dvh;
    overflow-y: auto;
    overflow-x: hidden;
    box-shadow: 0 8px 32px rgba(0,0,0,0.18);
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    will-change: auto;
}


@keyframes slideUp {
    from { opacity: 0; transform: translateY(50px); }
    to { opacity: 1; transform: translateY(0); }
}

.form-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
}

.form-title {
    font-size: 20px;
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 10px;
}

.close-btn {
    width: 35px; height: 35px;
    border-radius: 10px;
    border: none;
    background: var(--cream);
    cursor: pointer;
    font-size: 18px;
}

.input-group { margin-bottom: 18px; }
.input-group label { font-weight: 600; font-size: 14px; margin-bottom: 8px; display: block; color: var(--text-secondary); }

.input-group input,
.input-group select,
.input-group textarea {
    width: 100%;
    padding: 15px;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    font-family: inherit;
    font-size: 15px;
    transition: all 0.3s;
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.input-group input:focus,
.input-group select:focus,
.input-group textarea:focus {
    outline: none;
    border-color: var(--gold);
    box-shadow: 0 0 0 4px rgba(212, 175, 55, 0.15);
}

.input-status { font-size: 12px; margin-top: 5px; }

.submit-btn {
    width: 100%;
    padding: 16px;
    background: linear-gradient(135deg, var(--gold), var(--gold-dark));
    color: var(--navy);
    border: none;
    border-radius: 12px;
    font-family: inherit;
    font-size: 16px;
    font-weight: 800;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 8px 25px rgba(212, 175, 55, 0.4);
    transition: all 0.3s;
}

.submit-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 14px 40px rgba(212, 175, 55, 0.45);
}
.submit-btn:active {
    transform: translateY(0);
}


/* Toast */
.toast-container {
    position: fixed;
    bottom: 20px;
    left: 50%;
    z-index: 9999999;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 90%;
    max-width: 400px;
}

.toast {
    background: rgba(32, 33, 36, 0.95);
    color: white;
    padding: 12px 20px;
    border-radius: 12px;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    animation: toastIn 0.3s ease;
}

.toast.success { border-right: 4px solid var(--success); }
.toast.error { border-right: 4px solid var(--danger); }
.toast.info { border-right: 4px solid var(--info); }

@keyframes toastIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Responsive - Mobile First */
@media (max-width: 768px) {
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .quick-actions { grid-template-columns: repeat(2, 1fr); }
    .stat-value { font-size: 22px; }
    .main-header { padding: 12px 15px; }
    .user-name { font-size: 12px; }
    .card { padding: 18px; border-radius: 16px; }
}

@media (max-width: 480px) {
    .nav-tabs { padding: 8px 10px; gap: 6px; }
    .nav-tab { padding: 8px 10px; font-size: 10px; }
    .nav-tab i { font-size: 12px; }
    .page-content { padding: 12px; }
    .stats-grid { gap: 10px; }
    .stat-card { padding: 15px; border-radius: 14px; }
    .stat-value { font-size: 20px; }
    .stat-label { font-size: 11px; }
    .quick-actions { gap: 10px; }
    .quick-action { padding: 18px 10px; border-radius: 14px; }
    .quick-action i { font-size: 26px; }
    .quick-action span { font-size: 12px; }
    .card { padding: 15px; border-radius: 14px; }
    .card-title { font-size: 14px; }
    .form-content { padding: 20px; border-radius: 18px; }
    .input-group input, .input-group select { padding: 12px; font-size: 14px; }
    .submit-btn { padding: 14px; font-size: 14px; }
    .header-btn { padding: 8px 10px; font-size: 11px; }
    .user-avatar { width: 35px; height: 35px; font-size: 16px; }
}

/* Filter chips for search */
.filter-container {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 15px;
}

.filter-chip {
    padding: 8px 14px;
    background: var(--bg-secondary);
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    color: var(--text-secondary);
    border: 2px solid transparent;
    transition: all 0.3s;
}

.filter-chip.active {
    background: linear-gradient(135deg, var(--gold), var(--gold-dark));
    color: var(--navy);
    font-weight: 700;
}

/* Search Results */
.result-card {
    background: var(--bg-card);
    padding: 15px;
    margin-bottom: 10px;
    border-radius: 14px;
    border-right: 4px solid var(--gold);
    box-shadow: 0 2px 10px var(--shadow-color);
    transition: all 0.3s;
}

.result-card:hover {
    transform: translateX(-5px);
}

/* List Item - Unified Style */
.list-item {
    padding: 14px;
    background: var(--bg-card);
    border-radius: 14px;
    margin-bottom: 10px;
    border-right: 4px solid var(--gold);
    box-shadow: 0 2px 10px var(--shadow-color);
    cursor: pointer;
    transition: all 0.3s ease;
}

.list-item:hover {
    transform: translateX(-3px);
    box-shadow: 0 4px 15px var(--shadow-color);
}

.list-item-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.list-item-content {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.list-item-title {
    font-weight: 700;
    font-size: 14px;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.list-item-subtitle {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.5;
}

.list-item-amount {
    text-align: left;
    min-width: 90px;
}

.list-item-amount-value {
    font-weight: 800;
    font-size: 14px;
}

.list-item-amount-date {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 2px;
}

/* تاغ سبب الصرف (مصاريف) والاسم (عقود) — نفس أسلوب البحث الشامل */
.list-item-badge-pill {
    display: inline-block;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    color: #fff;
    margin-left: 6px;
    white-space: nowrap;
}
.list-item-badge-pill.reason {
    background: linear-gradient(135deg, #e57373, #ef5350);
    box-shadow: 0 1px 4px rgba(239, 83, 80, 0.3);
}
.list-item-badge-pill.name {
    background: linear-gradient(135deg, #b8960c, #d4af37);
    box-shadow: 0 1px 4px rgba(212, 175, 55, 0.3);
}

.list-item-type {
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 10px;
    margin-right: 6px;
}

/* Photo Button - Unified */
.photo-icon-btn {
    padding: 8px 12px;
    background: linear-gradient(135deg, var(--gold), var(--gold-dark));
    color: var(--navy);
    border: none;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: all 0.3s;
}

.photo-icon-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(212, 175, 55, 0.4);
}

/* Action Buttons - Unified */
.action-btns {
    display: none;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px dashed var(--border-color);
}

.action-btn-edit {
    padding: 5px 12px;
    background: transparent;
    color: var(--gold-dark);
    border: 1.5px solid var(--gold);
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: background 0.18s, color 0.18s;
}
.action-btn-edit:hover {
    background: var(--gold);
    color: var(--navy);
}

.action-btn-delete {
    padding: 5px 12px;
    background: transparent;
    color: #ef4444;
    border: 1.5px solid #ef444488;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: background 0.18s, color 0.18s;
}
.action-btn-delete:hover {
    background: #ef4444;
    color: white;
}

.action-btn-auth-sale {
    padding: 5px 12px;
    background: transparent;
    color: #7c3aed;
    border: 1.5px solid #8b5cf688;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: background 0.18s, color 0.18s;
}
.action-btn-auth-sale:hover {
    background: #8b5cf6;
    color: white;
}

.action-btn-ownership {
    padding: 5px 12px;
    background: transparent;
    color: #0891b2;
    border: 1.5px solid #06b6d488;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: background 0.18s, color 0.18s;
}
.action-btn-ownership:hover {
    background: #06b6d4;
    color: white;
}

.action-btn-cancel {
    padding: 5px 12px;
    background: transparent;
    color: #dc2626;
    border: 1.5px solid #ef444488;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: background 0.18s, color 0.18s;
}
.action-btn-cancel:hover {
    background: #ef4444;
    color: white;
}

.action-btn-refund {
    padding: 5px 12px;
    background: transparent;
    color: #d97706;
    border: 1.5px solid #f59e0b88;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: background 0.18s, color 0.18s;
}
.action-btn-refund:hover {
    background: #f59e0b;
    color: white;
}

/* أزرار سجل العمليات / آخر العمليات — نفس ستايل أزرار التعديل والحذف */
.action-btn-goto {
    padding: 5px 12px;
    background: transparent;
    color: var(--gold-dark);
    border: 1.5px solid var(--gold);
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: background 0.18s, color 0.18s;
}

.action-btn-goto:hover {
    background: var(--gold);
    color: var(--navy);
}

.action-btn-revert {
    padding: 8px 14px;
    background: linear-gradient(135deg, var(--navy-light), var(--navy));
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.action-btn-revert:hover {
    filter: brightness(1.1);
}

.operation-card-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px dashed var(--border-color);
}

/* Summary Header - Unified */
.list-summary {
    background: linear-gradient(135deg, var(--gold), var(--gold-dark));
    color: var(--navy);
    padding: 14px 18px;
    border-radius: 14px;
    margin-bottom: 15px;
    text-align: center;
    font-weight: 700;
    font-size: 14px;
    box-shadow: 0 4px 15px rgba(212, 175, 55, 0.3);
}

/* Date inputs row */
.date-row {
    display: flex;
    gap: 8px;
    align-items: center;
}

.date-row input, .date-row select {
    flex: 1;
    padding: 10px;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-family: inherit;
}

/* Print & Sort controls */
.controls-row {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.control-btn {
    padding: 10px 16px;
    border-radius: 10px;
    border: none;
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.3s;
}

.control-btn:hover {
    background: var(--gold-light);
}

.control-btn.primary {
    background: linear-gradient(135deg, var(--gold), var(--gold-dark));
    color: var(--navy);
}

/* Camera Modal */
#cameraModal {
    display: none;
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: #000;
    z-index: 99999;
    flex-direction: column;
    justify-content: flex-end;
    align-items: center;
}

#cameraModal.active { display: flex; }

#cameraVideo {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    object-fit: cover;
}

.camera-controls {
    position: relative;
    z-index: 2;
    padding: 30px;
    display: flex;
    justify-content: center;
    gap: 30px;
    background: linear-gradient(to top, rgba(0,0,0,0.8), transparent);
    width: 100%;
}

.snap-btn {
    width: 70px; height: 70px;
    border-radius: 50%;
    border: 4px solid white;
    background: transparent;
    cursor: pointer;
}

.snap-btn::after {
    content: '';
    display: block;
    width: 54px; height: 54px;
    background: white;
    border-radius: 50%;
    margin: 4px;
}

.close-cam-btn {
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    padding: 12px 20px;
    border-radius: 10px;
    font-family: inherit;
    cursor: pointer;
}

/* Photo Buttons */
.photo-btns {
    display: flex;
    gap: 12px;
}

.photo-btn {
    flex: 1;
    padding: 18px;
    border: 2px dashed var(--border-color);
    border-radius: 14px;
    background: var(--bg-secondary);
    color: var(--text-secondary);
    font-weight: 600;
    cursor: pointer;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    transition: all 0.3s;
}

.photo-btn i {
    font-size: 24px;
}

.photo-btn:hover {
    border-color: var(--gold);
    color: var(--gold);
}

.photo-btn.active {
    border-color: var(--success);
    color: var(--success);
    background: rgba(16, 185, 129, 0.1);
}

/* Status indicators */
.field-status {
    font-size: 12px;
    margin-top: 5px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.field-status.checking { color: #888; }
.field-status.success { color: var(--success); }
.field-status.error { color: var(--danger); }

/* تفاصيل العملية (من نفذها + الوقت) */
.operation-card-clickable { transition: transform 0.2s ease, box-shadow 0.2s ease; }
.operation-card-clickable:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(0,0,0,0.1); }
.op-detail-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-color);
    gap: 12px;
}
.op-detail-row:last-child { border-bottom: none; }
.op-detail-label {
    font-size: 13px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 8px;
}
.op-detail-value {
    font-weight: 700;
    color: var(--text-primary);
    text-align: left;
}
.op-detail-badge {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
}
.op-detail-badge-add { background: #d1fae5; color: #065f46; }
.op-detail-badge-edit { background: #fef3c7; color: #92400e; }
.op-detail-user-fine { font-size: 11px; font-weight: 400; color: var(--text-secondary); margin-right: 6px; }
/* تفاصيل التعديل: تمييز الحقل المعدل عن غير المعدل */
.op-detail-row-modified { background: linear-gradient(90deg, rgba(245,158,11,0.12), transparent); border-right: 3px solid #f59e0b; margin: 0 -8px; padding: 10px 8px; border-radius: 8px; }
.op-detail-row-unchanged .op-detail-value { font-weight: 500; color: var(--text-secondary); }
.op-detail-was-now { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-weight: 700; }
.op-detail-was-now .was { color: #b45309; text-decoration: line-through; }
.op-detail-was-now .arrow { color: #92400e; font-size: 14px; }
.op-detail-was-now .now { color: #065f46; }
.op-detail-modified-badge { font-size: 10px; background: #f59e0b; color: #fff; padding: 2px 6px; border-radius: 4px; margin-right: 6px; }
.op-detail-unchanged-badge { font-size: 10px; color: var(--text-secondary); margin-right: 6px; }

/* من أدخله في البطاقات والقوائم */
.op-card-user-fine { font-size: 11px; font-weight: 400; color: var(--text-secondary); }
.list-item-entry { font-size: 11px; color: var(--text-secondary); margin-top: 6px; padding-top: 6px; border-top: 1px dashed var(--border-color); }
.list-item-entry .entry-by-name { unicode-bidi: isolate; display: inline; margin-inline-start: 4px; }

/* Summary item */
.summary-item {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px dashed var(--border-color);
}

.summary-item:last-child {
    border-bottom: none;
}

/* Sort Option Hover */
.sort-option:hover {
    background: var(--gold-light) !important;
}

/* Fancy Select - القوائم المنسدلة الفاخرة */
.fancy-select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    padding: 12px 30px 12px 12px;
    border-radius: 12px;
    border: 2px solid var(--border-color);
    background: linear-gradient(135deg, var(--bg-primary), var(--bg-secondary));
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23d4af37' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: left 12px center;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    font-family: inherit;
    width: 100%;
    text-align: center;
}

.fancy-select:hover {
    border-color: var(--gold);
    box-shadow: 0 4px 12px rgba(212, 175, 55, 0.2);
}

.fancy-select:focus {
    outline: none;
    border-color: var(--gold);
    box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.15);
}

.fancy-select option {
    padding: 12px;
    background: var(--bg-primary);
    color: var(--text-primary);
}

/* Fancy Dropdown Container */
.fancy-dropdown {
    position: relative;
}

.fancy-dropdown-btn {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 12px 16px;
    background: linear-gradient(135deg, var(--bg-secondary), var(--bg-primary));
    border: 2px solid var(--border-color);
    border-radius: 14px;
    cursor: pointer;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    min-width: 180px;
}

.fancy-dropdown-btn:hover {
    border-color: var(--gold);
    box-shadow: 0 4px 12px rgba(212, 175, 55, 0.2);
}

.fancy-dropdown-btn i:first-child {
    color: var(--gold);
    font-size: 18px;
}

.fancy-dropdown-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    left: 0;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.15);
    z-index: 1000;
    overflow: hidden;
    display: none;
}

.fancy-dropdown-menu.active {
    display: block;
}

.fancy-dropdown-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    cursor: pointer;
    font-weight: 500;
    transition: background 0.2s;
    border-bottom: 1px solid var(--border-color);
}

.fancy-dropdown-item:last-child {
    border-bottom: none;
}

.fancy-dropdown-item:hover {
    background: var(--gold-light);
}

.fancy-dropdown-item i {
    color: var(--gold);
    font-size: 18px;
}

/* ========== Filter Buttons ========== */
.sort-filters {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-end;
    margin-bottom: 15px;
}

.filter-btn {
    padding: 10px 16px;
    border: none;
    border-radius: 25px;
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    color: #495057;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    font-family: inherit;
}

.filter-btn:hover {
    background: linear-gradient(135deg, #fff3cd, #ffeeba);
    color: #856404;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(212, 175, 55, 0.3);
}

.filter-btn.active {
    background: linear-gradient(135deg, var(--gold), var(--gold-dark));
    color: var(--navy);
    box-shadow: 0 4px 15px rgba(212, 175, 55, 0.4);
    transform: translateY(-1px);
}

.filter-btn i {
    font-size: 15px;
}

/* ========== تبويبات العقود الداخلية ========== */
.contracts-sub-tab {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 16px;
    border: 1.5px solid var(--border-color);
    border-radius: 25px;
    background: var(--bg-card);
    color: var(--text-secondary);
    cursor: pointer;
    font-family: inherit;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
    transition: all 0.2s ease;
    flex-shrink: 0;
}
.contracts-sub-tab:hover {
    border-color: #8b5cf6;
    color: #8b5cf6;
    background: #8b5cf615;
}
.contracts-sub-tab.active {
    background: linear-gradient(135deg, #8b5cf6, #6d28d9);
    color: #fff;
    border-color: #8b5cf6;
    font-weight: 700;
    box-shadow: 0 4px 12px #8b5cf640;
}
.contracts-sub-tab i { font-size: 14px; }

/* ========== Loading Spinner - Interactive ========== */
.loading-spinner {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    gap: 15px;
}

.loading-spinner .spinner-icon {
    width: 50px;
    height: 50px;
    border: 4px solid var(--border-color);
    border-top-color: var(--gold);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.loading-spinner .spinner-text {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    animation: spinnerPulse 1.5s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

@keyframes spinnerPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* ========== Responsive - Mobile ========== */
@media (max-width: 768px) {
    .header {
        padding: 12px 15px;
    }
    
    .nav-tabs {
        padding: 10px;
        gap: 6px;
    }
    
    .nav-tab {
        padding: 8px 12px;
        font-size: 11px;
    }
    
    .page-content {
        padding: 15px;
    }
    
    .card {
        padding: 15px;
        border-radius: 16px;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    
    .stat-card {
        padding: 15px;
    }
    
    .stat-value {
        font-size: 22px;
    }
    
    .action-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    
    .action-btn {
        padding: 18px 12px;
    }
    
    .filter-container {
        gap: 6px;
    }
    
    .filter-chip {
        padding: 8px 12px;
        font-size: 11px;
    }
    
    .fancy-select {
        padding: 10px 25px 10px 10px;
        font-size: 13px;
    }
    
    .submit-btn {
        padding: 14px;
        font-size: 15px;
    }
    
    #sortDropdown {
        min-width: 220px;
        right: -20px;
    }
    
    .sort-option {
        padding: 12px 14px;
        font-size: 13px;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }
    
    .action-grid {
        grid-template-columns: 1fr 1fr;
    }
    
    .nav-tab span {
        display: none;
    }
    
    .nav-tab i {
        font-size: 18px;
    }
    
    .nav-tab {
        padding: 10px 14px;
    }
    
    .quick-actions {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .main-header {
        padding: 10px 15px;
        flex-wrap: wrap;
        gap: 10px;
    }
    
    .header-actions {
        width: 100%;
        justify-content: center;
    }
    
    .header-btn {
        padding: 8px 12px;
        font-size: 12px;
    }
    
    .user-info {
        width: 100%;
        justify-content: center;
    }
    
    .page-content {
        padding: 10px;
    }
    
    .card {
        padding: 15px;
        border-radius: 15px;
    }
    
    .card-title {
        font-size: 14px;
    }
    
    .list-item {
        padding: 12px;
    }
    
    .list-item-title {
        font-size: 13px;
    }
    
    .list-item-amount-value {
        font-size: 14px;
    }
    
    .modal-content {
        margin: 0 auto;
        padding: 16px;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
        overflow-x: hidden;
    }
    
    .input-group label {
        font-size: 12px;
    }
    
    .input-group input,
    .input-group select,
    .input-group textarea {
        padding: 12px;
        font-size: 14px;
    }
    
    .result-card {
        padding: 12px;
    }
    
    .filter-container {
        flex-wrap: wrap;
    }
    
    .search-box {
        flex-direction: column;
    }
    
    .search-box input {
        width: 100%;
    }
    
    .search-box button {
        width: 100%;
    }
}

/* Extra small screens */
@media (max-width: 360px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .action-grid {
        grid-template-columns: 1fr;
    }
    
    .quick-actions {
        grid-template-columns: 1fr;
    }
    
    .nav-tabs {
        justify-content: flex-start;
    }
    
    .stat-value {
        font-size: 20px;
    }
    
    .stat-label {
        font-size: 11px;
    }
}

/* ═══════════════ المخزن الذكي ═══════════════ */
#page-warehouse .warehouse-section {
    margin-bottom: 28px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
}
#page-warehouse .warehouse-section:last-of-type { border-bottom: none; }
#page-warehouse .warehouse-section-title {
    font-size: 16px;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}
#page-warehouse .warehouse-form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 14px;
    margin-bottom: 14px;
}
#page-warehouse .warehouse-alerts-box {
    border-radius: 14px;
    padding: 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
}
#page-warehouse .wh-alerts-header {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 800;
    font-size: 15px;
    color: var(--text-primary);
    margin-bottom: 14px;
}
#page-warehouse .wh-alerts-count {
    background: #ef4444;
    color: #fff;
    font-size: 12px;
    padding: 2px 8px;
    border-radius: 20px;
    margin-right: 4px;
}
#page-warehouse .wh-alerts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 10px;
}
#page-warehouse .wh-alert-card {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    padding: 12px;
    border-radius: 10px;
    border: 1px solid transparent;
}
#page-warehouse .wh-alert-zero {
    background: #fef2f2;
    border-color: #fecaca;
}
#page-warehouse .wh-alert-low {
    background: #fffbeb;
    border-color: #fde68a;
}
#page-warehouse .wh-alert-icon {
    font-size: 20px;
    flex-shrink: 0;
    margin-top: 2px;
}
#page-warehouse .wh-alert-zero .wh-alert-icon { color: #ef4444; }
#page-warehouse .wh-alert-low .wh-alert-icon { color: #f59e0b; }
#page-warehouse .wh-alert-body { flex: 1; min-width: 0; }
#page-warehouse .wh-alert-name { font-weight: 700; font-size: 14px; color: var(--text-primary); }
#page-warehouse .wh-alert-type { font-size: 11px; color: #64748b; margin-top: 1px; }
#page-warehouse .wh-alert-status { font-size: 12px; font-weight: 700; margin-top: 4px; }
#page-warehouse .wh-status-zero { color: #ef4444; }
#page-warehouse .wh-alert-qty { font-size: 12px; color: var(--text-secondary); margin-top: 4px; }
#page-warehouse .wh-alert-min { color: #94a3b8; }
#page-warehouse .wh-alert-bar-wrap {
    height: 5px;
    background: #e2e8f0;
    border-radius: 99px;
    margin-top: 6px;
    overflow: hidden;
}
#page-warehouse .wh-alert-bar {
    height: 100%;
    border-radius: 99px;
    transition: width 0.4s ease;
}
#page-warehouse .wh-alert-pct { font-size: 11px; font-weight: 700; margin-top: 3px; }
#page-warehouse .warehouse-balance-list,
#page-warehouse .warehouse-movements-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
#page-warehouse .warehouse-balance-item {
    display: grid;
    grid-template-columns: 1fr 120px 200px;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    background: var(--bg-secondary);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    border-right: 4px solid var(--info);
}
#page-warehouse .warehouse-balance-item#page-warehouse .warehouse-low {
    border-right-color: var(--warning);
    background: linear-gradient(135deg, #fffbeb, #fef3c7);
}
#page-warehouse .warehouse-balance-info { min-width: 0; line-height: 1.6; }
#page-warehouse .warehouse-balance-name { font-weight: 700; color: var(--text-primary); display: block; font-size: 15px; }
#page-warehouse .warehouse-balance-type { font-size: 12px; color: var(--text-secondary); display: inline-block; margin-top: 2px; }
#page-warehouse .warehouse-balance-type i { margin-left: 3px; opacity: 0.6; }
#page-warehouse .warehouse-balance-unit { font-size: 12px; color: var(--info); }
#page-warehouse .warehouse-balance-qty {
    font-weight: 800;
    font-size: 18px;
    color: var(--info);
    white-space: nowrap;
    text-align: center;
    min-width: 0;
}
#page-warehouse .warehouse-balance-item#page-warehouse .warehouse-low #page-warehouse .warehouse-balance-qty { color: var(--warning); }
#page-warehouse .warehouse-balance-actions {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 6px;
    justify-content: flex-end;
    min-width: 0;
}
#page-warehouse .warehouse-min-label {
    font-size: 12px;
    color: var(--text-secondary);
    display: inline-flex;
    align-items: center;
    gap: 5px;
    white-space: nowrap;
}
#page-warehouse .warehouse-min-label input {
    width: 70px;
    padding: 6px 8px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    font-size: 13px;
    font-family: inherit;
}
@media (max-width: 600px) {
    #page-warehouse .warehouse-balance-item {
        grid-template-columns: 1fr auto;
        grid-template-rows: auto auto;
    }
    #page-warehouse .warehouse-balance-qty {
        grid-column: 2;
        grid-row: 1;
        font-size: 18px;
    }
    #page-warehouse .warehouse-balance-actions {
        grid-column: 1 / -1;
        grid-row: 2;
        justify-content: flex-start;
        border-top: 1px solid var(--border-color);
        padding-top: 8px;
        margin-top: 4px;
    }
}
#page-warehouse .warehouse-search-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    margin-bottom: 10px;
}
#page-warehouse .warehouse-search-input {
    flex: 1;
    min-width: 200px;
    padding: 12px 14px;
    border-radius: 12px;
    border: 2px solid var(--border-color);
    font-size: 14px;
    font-family: inherit;
}
#page-warehouse .warehouse-search-mode { min-width: 180px; }
#page-warehouse .warehouse-movement-item {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border-radius: 10px;
    font-size: 13px;
    border-right: 4px solid var(--border-color);
}
#page-warehouse .warehouse-movement-in { background: #ecfdf5; border-right-color: var(--success); }
#page-warehouse .warehouse-movement-out { background: #fef2f2; border-right-color: var(--danger); }
#page-warehouse .warehouse-mov-badge {
    font-size: 11px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 6px;
}
#page-warehouse .warehouse-movement-in #page-warehouse .warehouse-mov-badge { background: #d1fae5; color: #065f46; }
#page-warehouse .warehouse-movement-out #page-warehouse .warehouse-mov-badge { background: #fee2e2; color: #991b1b; }
#page-warehouse .warehouse-mov-material { font-weight: 700; min-width: 140px; }
#page-warehouse .warehouse-mov-qty { font-weight: 800; }
#page-warehouse .warehouse-mov-person,
#page-warehouse .warehouse-mov-extra { color: var(--text-secondary); }
#page-warehouse .warehouse-mov-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    margin-top: 4px;
    gap: 8px;
}
#page-warehouse .warehouse-mov-executor { font-size: 11px; color: #64748b; }
#page-warehouse .warehouse-mov-date { font-size: 11px; color: #64748b; }
#page-warehouse .warehouse-empty {
    text-align: center;
    color: var(--text-secondary);
    padding: 24px 16px;
    font-size: 14px;
}
#warehouseMaterialLogModal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
    overflow: hidden;
    overscroll-behavior: contain;
}
#warehouseMaterialLogModal .modal-content {
    max-height: 82dvh;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}
@media (max-width: 768px) {
    #page-warehouse .warehouse-form-grid { grid-template-columns: 1fr; }
    #page-warehouse .warehouse-balance-item { flex-direction: column; align-items: flex-start; }
    #page-warehouse .warehouse-search-row { flex-direction: column; align-items: stretch; }
}

/* ═══════════════ سلة المحذوفات ═══════════════ */
.trash-count-bar {
    background: linear-gradient(135deg, var(--navy), #1e293b);
    color: var(--gold);
    padding: 12px 18px;
    border-radius: 12px;
    margin-bottom: 16px;
    text-align: center;
    font-weight: 800;
    font-size: 14px;
    letter-spacing: 0.5px;
    border: 1px solid var(--gold-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.trash-action-btns {
    display: flex;
    gap: 8px;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px dashed var(--border-color);
}

.trash-btn-restore {
    padding: 5px 12px;
    background: transparent;
    color: #059669;
    border: 1.5px solid #10b98188;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: background 0.18s, color 0.18s;
}
.trash-btn-restore:hover {
    background: #10b981;
    color: white;
}

.trash-btn-delete {
    padding: 5px 12px;
    background: transparent;
    color: #ef4444;
    border: 1.5px solid #ef444488;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: background 0.18s, color 0.18s;
}
.trash-btn-delete:hover {
    background: #ef4444;
    color: white;
}

/* ═══════════════ modal تأكيد عمليات المخزن ═══════════════ */
#page-warehouse .wh-confirm-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 9px 14px;
    border-radius: 10px;
    background: var(--bg-secondary);
    gap: 12px;
}
#page-warehouse .wh-confirm-row:nth-child(even) {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
}
#page-warehouse .wh-confirm-label {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 600;
    white-space: nowrap;
}
#page-warehouse .wh-confirm-value {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-primary);
    text-align: left;
    word-break: break-word;
}

/* ══════════════════════════════════════════════════════════════════
   نظام الحضور والانصراف - Attendance System CSS
══════════════════════════════════════════════════════════════════ */

/* ── بطاقة الرأس ── */
.att-header-card {
    padding: 18px 20px;
    margin-bottom: 0;
    border-radius: 16px 16px 0 0;
    border-bottom: 1px solid var(--border-color);
}
.att-icon-box {
    width: 48px; height: 48px;
    border-radius: 14px;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}

/* ── أزرار التبويبات الداخلية ── */
.att-tab-btn {
    display: flex; align-items: center; gap: 6px;
    padding: 8px 16px;
    border-radius: 10px;
    border: 1.5px solid var(--border-color);
    background: var(--bg-secondary);
    color: var(--text-secondary);
    font-size: 13px; font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}
.att-tab-btn:hover { border-color: #6366f1; color: #6366f1; background: #6366f108; }
.att-tab-btn.active { background: #6366f1; color: #fff; border-color: #6366f1; }

/* ── محتوى التبويبات ── */
.att-tab-content { display: none; }
.att-tab-content.active { display: block; }

/* ── منطقة الكاميرا ── */
.att-camera-wrap {
    position: relative;
    width: 100%; max-width: 340px;
    margin: 0 auto;
    border-radius: 16px;
    overflow: hidden;
    background: #0f172a;
    aspect-ratio: 4/3;
}
.att-camera-wrap video {
    width: 100%; height: 100%;
    object-fit: cover;
    display: block;
    transform: scaleX(-1);
}
.att-face-overlay {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: 160px; height: 160px;
    border-radius: 50%;
    border: 3px solid rgba(99,102,241,0.7);
    box-shadow: 0 0 0 2000px rgba(0,0,0,0.35);
    pointer-events: none;
    transition: border-color 0.3s;
}
.att-face-preview {
    width: 80px; height: 80px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid #10b981;
    display: none;
}

/* ── أزرار الحضور ── */
.att-btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 10px 20px;
    border-radius: 10px;
    border: none;
    font-size: 14px; font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}
.att-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.att-btn-primary { background: #6366f1; color: #fff; }
.att-btn-primary:hover:not(:disabled) { background: #4f46e5; transform: translateY(-1px); }
.att-btn-success { background: #10b981; color: #fff; }
.att-btn-success:hover:not(:disabled) { background: #059669; transform: translateY(-1px); }
.att-btn-warning { background: #f59e0b; color: #fff; }
.att-btn-warning:hover:not(:disabled) { background: #d97706; transform: translateY(-1px); }
.att-btn-danger  { background: #ef4444; color: #fff; }
.att-btn-danger:hover:not(:disabled)  { background: #dc2626; transform: translateY(-1px); }
.att-btn-outline { background: transparent; color: var(--text-primary); border: 1.5px solid var(--border-color); }
.att-btn-outline:hover:not(:disabled) { border-color: #6366f1; color: #6366f1; }

/* ── الشارات ── */
.att-badge {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 12px; font-weight: 700;
}
.att-badge.in         { background: #d1fae5; color: #065f46; }
.att-badge.out        { background: #e0e7ff; color: #3730a3; }
.att-badge.late       { background: #fef3c7; color: #92400e; }
.att-badge.absent     { background: #fee2e2; color: #991b1b; }
.att-badge.holiday    { background: rgba(139,92,246,0.15); color: #6d28d9; border: 1px solid rgba(139,92,246,0.3); }
.att-badge.leave      { background: rgba(59,130,246,0.15); color: #1d4ed8; border: 1px solid rgba(59,130,246,0.3); }
.att-day-row-holiday  { background: rgba(139,92,246,0.05); }
.att-day-row-leave    { background: rgba(59,130,246,0.05); }
.att-day-row-absent   { background: rgba(239,68,68,0.05); }

/* ── بطاقات الموظفين ── */
.att-emp-card {
    display: flex; align-items: flex-start; justify-content: space-between;
    gap: 14px;
    padding: 16px;
    border-radius: 14px;
    border: 1.5px solid var(--border-color);
    background: var(--bg-secondary);
    transition: border-color 0.2s, box-shadow 0.2s;
}
.att-emp-card:hover { border-color: #6366f1; box-shadow: 0 4px 16px rgba(99,102,241,0.1); }
.att-emp-card-info { display: flex; align-items: flex-start; gap: 14px; flex: 1; min-width: 0; }
.att-emp-avatar-lg {
    width: 48px; height: 48px;
    border-radius: 14px;
    background: linear-gradient(135deg, #6366f1, #4f46e5);
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: 18px; font-weight: 800;
    flex-shrink: 0;
}
.att-emp-avatar {
    border-radius: 50%;
    background: linear-gradient(135deg, #6366f1, #4f46e5);
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; flex-shrink: 0;
}
.att-emp-name { font-size: 15px; font-weight: 800; margin-bottom: 3px; }
.att-emp-meta { font-size: 12px; color: var(--text-secondary); }
.att-cfg-pill {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 3px 8px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    font-size: 11px; font-weight: 600;
    background: var(--bg-primary);
}

/* ── ملخص اليوم ── */
.att-stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
    gap: 10px;
    margin-bottom: 4px;
}
.att-stat-box {
    text-align: center;
    padding: 14px 10px;
    border-radius: 12px;
    border: 2px solid var(--border-color);
    background: var(--bg-secondary);
}
.att-stat-num { font-size: 28px; font-weight: 800; line-height: 1; }
.att-stat-lbl { font-size: 12px; color: var(--text-secondary); margin-top: 4px; font-weight: 600; }

.att-today-row {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    background: var(--bg-secondary);
    gap: 10px;
}

/* ── سجلات الحضور ── */
.att-record-row {
    display: flex; align-items: center; gap: 12px;
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    background: var(--bg-secondary);
    transition: border-color 0.2s;
}
.att-record-row:hover { border-color: #6366f1; }

/* ── حالة الموظف ── */
.att-status-pill {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 13px; font-weight: 600;
    border: 1.5px solid var(--border-color);
    background: var(--bg-secondary);
}
.att-status-pill.success { border-color: #10b981; color: #10b981; background: #d1fae522; }
.att-status-pill.danger  { border-color: #ef4444; color: #ef4444; background: #fee2e222; }
.att-status-pill.neutral { color: var(--text-secondary); }

/* ── فارغ ── */
.att-empty {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-secondary);
    display: flex; flex-direction: column; align-items: center; gap: 8px;
}

/* ── التقرير الشهري ── */
.att-report-header {
    padding: 20px;
    border-radius: 14px;
    background: linear-gradient(135deg, #6366f108, #4f46e508);
    border: 1.5px solid #6366f133;
    margin-bottom: 16px;
}
.att-report-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}
.att-report-card {
    padding: 16px;
    border-radius: 14px;
    border: 2px solid var(--border-color);
    background: var(--bg-secondary);
    text-align: center;
    transition: transform 0.2s;
}
.att-report-card:hover { transform: translateY(-2px); }
.att-report-card-icon {
    width: 40px; height: 40px;
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 20px;
    margin: 0 auto 10px;
}
.att-report-card-val { font-size: 30px; font-weight: 800; line-height: 1; }
.att-report-card-lbl { font-size: 12px; color: var(--text-secondary); margin-top: 6px; font-weight: 600; }
.att-report-card-cmp { font-size: 11px; color: var(--text-secondary); margin-top: 6px; }

/* ── الملخص المالي ── */
.att-financial-box {
    background: var(--bg-secondary);
    border-radius: 14px;
    border: 1.5px solid var(--border-color);
    padding: 18px;
    margin-bottom: 16px;
}
.att-fin-row {
    display: flex; justify-content: space-between; align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-color);
    font-size: 14px;
}
.att-fin-row:last-child { border-bottom: none; }
.att-fin-total {
    font-size: 16px; font-weight: 800;
    border-top: 2px solid #6366f1;
    margin-top: 8px; padding-top: 12px;
}

/* ── جدول المقارنة ── */
.att-compare-box {
    background: var(--bg-secondary);
    border-radius: 14px;
    border: 1.5px solid var(--border-color);
    padding: 18px;
    margin-bottom: 16px;
}
.att-compare-table { display: grid; gap: 0; border-radius: 10px; overflow: hidden; border: 1px solid var(--border-color); }
.att-compare-header {
    display: grid; grid-template-columns: 2fr 1fr 1fr 1fr;
    background: #6366f1; color: #fff;
    padding: 10px 14px; font-weight: 700; font-size: 13px; gap: 8px;
}
.att-compare-row {
    display: grid; grid-template-columns: 2fr 1fr 1fr 1fr;
    padding: 10px 14px; font-size: 13px; gap: 8px;
    border-top: 1px solid var(--border-color);
    background: var(--bg-secondary);
    transition: background 0.15s;
}
.att-compare-row:hover { background: var(--bg-primary); }
.att-compare-row-total { font-weight: 800; background: #6366f108; }

/* ── جدول التفاصيل اليومية ── */
.att-day-table {
    width: 100%; border-collapse: collapse;
    font-size: 13px;
    border-radius: 12px; overflow: hidden;
    border: 1px solid var(--border-color);
}
.att-day-table th {
    background: #6366f1; color: #fff;
    padding: 10px 12px; text-align: right;
    font-weight: 700; font-size: 12px;
}
.att-day-table td {
    padding: 9px 12px;
    border-bottom: 1px solid var(--border-color);
}
.att-day-table tr:last-child td { border-bottom: none; }
.att-day-table tr:hover td { background: var(--bg-primary); }
.att-day-row-holiday td { color: var(--text-secondary); background: var(--bg-primary); }
.att-day-row-absent  td { background: #fee2e210; }
.att-day-row-late    td { background: #fef3c710; }
.att-day-row-present td { background: transparent; }

/* ── Modal الموظف ── */
#attEmpModal {
    position: fixed; inset: 0; z-index: 9999;
    background: rgba(0,0,0,0.5);
    display: none; align-items: center; justify-content: center;
    padding: 16px;
    backdrop-filter: blur(4px);
}
.att-modal-box {
    background: var(--bg-primary);
    border-radius: 20px;
    padding: 24px;
    width: 100%; max-width: 560px;
    max-height: 90vh; overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    animation: attModalIn 0.25s ease;
}
@keyframes attModalIn {
    from { opacity: 0; transform: scale(0.95) translateY(10px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}
.att-modal-title {
    font-size: 17px; font-weight: 800;
    margin-bottom: 20px;
    display: flex; align-items: center; gap: 10px;
}
.att-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}
.att-form-grid .full { grid-column: 1 / -1; }
.att-form-group { display: flex; flex-direction: column; gap: 6px; }
.att-form-group label { font-size: 12px; font-weight: 700; color: var(--text-secondary); }
.att-form-group input,
.att-form-group select,
.att-form-group textarea {
    padding: 10px 12px;
    border-radius: 10px;
    border: 1.5px solid var(--border-color);
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 13px; font-family: inherit;
    transition: border-color 0.2s;
    width: 100%; box-sizing: border-box;
}
.att-form-group input:focus,
.att-form-group select:focus,
.att-form-group textarea:focus {
    outline: none; border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99,102,241,0.15);
}
.att-form-hint { font-size: 11px; color: var(--text-secondary); margin-top: 2px; }

/* ── حقل الموقع ── */
.att-location-wrap {
    display: flex; gap: 8px; align-items: center;
}
.att-location-wrap input {
    flex: 1;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1.5px solid var(--border-color);
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 13px; font-family: inherit;
}

/* ── الإعدادات ── */
.att-settings-section {
    background: var(--bg-secondary);
    border-radius: 14px;
    border: 1.5px solid var(--border-color);
    padding: 20px;
    margin-bottom: 16px;
}
.att-settings-title {
    font-size: 14px; font-weight: 800;
    margin-bottom: 16px;
    display: flex; align-items: center; gap: 8px;
    color: #6366f1;
}

/* ══════════════════════════════════════════════
   واجهة الحضور اللحظية التفاعلية
══════════════════════════════════════════════ */

/* ── البانر الحي ── */
.att-live-banner {
    background: linear-gradient(135deg, #1e1b4b 0%, #312e81 50%, #1e1b4b 100%);
    border-radius: 20px;
    padding: 24px 28px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    position: relative;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(99,102,241,0.3);
}
.att-live-banner::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -20%;
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(99,102,241,0.2) 0%, transparent 70%);
    pointer-events: none;
}
.att-live-dot-wrap {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(16,185,129,0.15);
    padding: 6px 12px;
    border-radius: 20px;
    border: 1px solid rgba(16,185,129,0.3);
}
.att-live-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    background: #10b981;
    display: inline-block;
    animation: attPulse 1.5s infinite;
}
@keyframes attPulse {
    0%, 100% { opacity: 1; transform: scale(1); box-shadow: 0 0 0 0 rgba(16,185,129,0.4); }
    50% { opacity: 0.8; transform: scale(1.2); box-shadow: 0 0 0 6px rgba(16,185,129,0); }
}
.att-live-time {
    font-size: 42px;
    font-weight: 900;
    color: #fff;
    letter-spacing: 2px;
    font-variant-numeric: tabular-nums;
    text-shadow: 0 2px 20px rgba(99,102,241,0.5);
    flex: 1;
    text-align: center;
}
.att-live-date {
    font-size: 14px;
    color: rgba(255,255,255,0.7);
    font-weight: 600;
    text-align: left;
    min-width: 160px;
}

/* ── البطاقات الزجاجية ── */
.att-glass-card {
    background: var(--bg-primary);
    border-radius: 20px;
    border: 1.5px solid var(--border-color);
    padding: 20px;
    transition: box-shadow 0.3s, transform 0.2s;
    position: relative;
    overflow: hidden;
}
.att-glass-card:hover {
    box-shadow: 0 8px 32px rgba(99,102,241,0.12);
    transform: translateY(-2px);
}
.att-glass-card-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 15px;
    font-weight: 800;
    margin-bottom: 16px;
}

/* ── Pills الأيقونات ── */
.att-icon-pill {
    width: 36px; height: 36px;
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}
.att-icon-pill.purple { background: rgba(99,102,241,0.15); color: #6366f1; }
.att-icon-pill.green  { background: rgba(16,185,129,0.15);  color: #10b981; }
.att-icon-pill.yellow { background: rgba(245,158,11,0.15);  color: #f59e0b; }
.att-icon-pill.red    { background: rgba(239,68,68,0.15);   color: #ef4444; }
.att-icon-pill.blue   { background: rgba(59,130,246,0.15);  color: #3b82f6; }

/* ── منطقة الكاميرا ── */
.att-camera-wrap { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.att-video-ring {
    position: relative;
    width: 100%;
    max-width: 300px;
    aspect-ratio: 1;
    border-radius: 50%;
    overflow: hidden;
    border: 4px solid var(--border-color);
    background: #0a0a0a;
    transition: border-color 0.3s, box-shadow 0.3s;
}
.att-video-ring.active {
    border-color: #6366f1;
    box-shadow: 0 0 0 4px rgba(99,102,241,0.2), 0 0 30px rgba(99,102,241,0.3);
    animation: attRingPulse 2s infinite;
}
.att-video-ring.captured {
    border-color: #10b981;
    box-shadow: 0 0 0 4px rgba(16,185,129,0.2), 0 0 30px rgba(16,185,129,0.3);
}
@keyframes attRingPulse {
    0%, 100% { box-shadow: 0 0 0 4px rgba(99,102,241,0.2), 0 0 20px rgba(99,102,241,0.2); }
    50%       { box-shadow: 0 0 0 8px rgba(99,102,241,0.1), 0 0 40px rgba(99,102,241,0.4); }
}
.att-video-ring video {
    width: 100%; height: 100%;
    object-fit: cover;
    display: block;
    border-radius: 50%;
}
.att-face-ring {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: 70%; height: 70%;
    border: 2.5px dashed rgba(99,102,241,0.6);
    border-radius: 50%;
    pointer-events: none;
    animation: attFaceSpin 8s linear infinite;
}
@keyframes attFaceSpin {
    from { transform: translate(-50%,-50%) rotate(0deg); }
    to   { transform: translate(-50%,-50%) rotate(360deg); }
}
.att-camera-idle {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    background: #0a0a0a;
    border-radius: 50%;
}
.att-face-status-msg {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-secondary);
    text-align: center;
    padding: 8px 16px;
    border-radius: 20px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    transition: all 0.3s;
}
.att-face-status-msg.success { background: rgba(16,185,129,0.1); color: #10b981; border-color: #10b98133; }
.att-face-status-msg.error   { background: rgba(239,68,68,0.1);  color: #ef4444; border-color: #ef444433; }
.att-face-status-msg.active  { background: rgba(99,102,241,0.1); color: #6366f1; border-color: #6366f133; }
.att-camera-btns {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: center;
}
.att-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 16px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 700;
    border: none;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s;
    position: relative;
    overflow: hidden;
}
.att-action-btn::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(255,255,255,0.15);
    opacity: 0;
    transition: opacity 0.2s;
}
.att-action-btn:hover::after { opacity: 1; }
.att-action-btn:active { transform: scale(0.96); }
.att-action-btn.purple { background: #6366f1; color: #fff; }
.att-action-btn.green  { background: #10b981; color: #fff; }
.att-action-btn.red    { background: #ef4444; color: #fff; }
.att-action-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.att-action-btn:disabled::after { display: none; }

/* ── حقول الإدخال ── */
.att-field-group { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.att-field-label { font-size: 12px; font-weight: 700; color: var(--text-secondary); display: flex; align-items: center; gap: 5px; }
.att-select,
.att-input {
    padding: 10px 14px;
    border-radius: 12px;
    border: 1.5px solid var(--border-color);
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 13px;
    font-family: inherit;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
    transition: border-color 0.2s, box-shadow 0.2s;
    -webkit-appearance: none;
    appearance: none;
}
/* إصلاح iOS Safari — حقول التاريخ والوقت */
input[type="date"].att-input,
input[type="month"].att-input,
input[type="time"].att-input {
    -webkit-appearance: none;
    appearance: none;
    min-width: 0;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow: hidden;
    text-overflow: ellipsis;
    padding-left: 8px;
    padding-right: 8px;
}
/* منع spinner أزرار الأرقام من التسبب في overflow */
input[type="number"].att-input {
    -webkit-appearance: none;
    appearance: textfield;
    min-width: 0;
}
input[type="number"].att-input::-webkit-inner-spin-button,
input[type="number"].att-input::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
/* حقول التاريخ المنفصلة */
.att-date-part {
    text-align: center;
    padding: 10px 6px;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.5px;
}
.att-date-part::placeholder {
    font-size: 11px;
    font-weight: 600;
    opacity: 0.5;
    letter-spacing: 0;
}
/* الـ att-field-group داخل grid دائماً min-width:0 */
.att-field-group {
    min-width: 0;
}
.att-select:focus,
.att-input:focus {
    outline: none;
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99,102,241,0.12);
}
.att-location-row { display: flex; gap: 8px; align-items: center; }
.att-location-row .att-input { flex: 1; }
.att-loc-btn {
    width: 42px; height: 42px;
    border-radius: 12px;
    border: 1.5px solid var(--border-color);
    background: var(--bg-secondary);
    color: #6366f1;
    font-size: 18px;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    transition: all 0.2s;
}
.att-loc-btn:hover { background: #6366f1; color: #fff; border-color: #6366f1; }
.att-loc-btn.loading { animation: attSpin 1s linear infinite; }
@keyframes attSpin { to { transform: rotate(360deg); } }

/* ── حالة الموظف اللحظية ── */
.att-emp-live-status {
    border-radius: 14px;
    padding: 12px 14px;
    margin-bottom: 12px;
    background: var(--bg-secondary);
    border: 1.5px solid var(--border-color);
    animation: attSlideDown 0.3s ease;
    font-size: 13px;
}
@keyframes attSlideDown {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── أزرار التسجيل الكبيرة ── */
.att-register-btns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 4px;
}
.att-reg-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    border-radius: 16px;
    border: none;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.25s;
    position: relative;
    overflow: hidden;
}
.att-reg-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(255,255,255,0);
    transition: background 0.2s;
}
.att-reg-btn:hover::before { background: rgba(255,255,255,0.12); }
.att-reg-btn:active { transform: scale(0.97); }
.att-reg-btn.loading { pointer-events: none; opacity: 0.7; }
.att-reg-in  { background: linear-gradient(135deg, #059669, #10b981); color: #fff; box-shadow: 0 4px 16px rgba(16,185,129,0.35); }
.att-reg-out { background: linear-gradient(135deg, #dc2626, #ef4444); color: #fff; box-shadow: 0 4px 16px rgba(239,68,68,0.35); }
.att-reg-in:hover  { box-shadow: 0 6px 24px rgba(16,185,129,0.5); transform: translateY(-1px); }
.att-reg-out:hover { box-shadow: 0 6px 24px rgba(239,68,68,0.5);  transform: translateY(-1px); }
.att-reg-btn-icon {
    width: 40px; height: 40px;
    border-radius: 12px;
    background: rgba(255,255,255,0.2);
    display: flex; align-items: center; justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}
.att-reg-btn-text { display: flex; flex-direction: column; gap: 2px; text-align: right; }
.att-reg-btn-main { font-size: 14px; font-weight: 800; }
.att-reg-btn-sub  { font-size: 11px; opacity: 0.8; font-weight: 600; }

/* ── بطاقة ملخص اليوم ── */
.att-today-card {
    background: var(--bg-primary);
    border-radius: 20px;
    border: 1.5px solid var(--border-color);
    margin-top: 16px;
    overflow: hidden;
}
.att-today-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-secondary);
}
.att-today-body { padding: 16px 20px; }
.att-refresh-btn {
    width: 36px; height: 36px;
    border-radius: 10px;
    border: 1.5px solid var(--border-color);
    background: var(--bg-primary);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    font-size: 16px;
    transition: all 0.2s;
}
.att-refresh-btn:hover { background: #6366f1; color: #fff; border-color: #6366f1; }
.att-refresh-btn.spinning i { animation: attSpin 0.8s linear infinite; }

/* ── بطاقات حضور اليوم ── */
.att-today-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    margin-bottom: 8px;
    background: var(--bg-secondary);
    transition: all 0.2s;
    animation: attFadeIn 0.3s ease both;
}
.att-today-row:hover { border-color: #6366f133; background: var(--bg-primary); transform: translateX(-2px); }
@keyframes attFadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── صف التبويبات ── */
.att-tabs-row {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

/* ── شبكة تسجيل الحضور ── */
.att-checkin-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

/* ── أيام الدوام ── */
#att_emp_workdays_grid label.wd-active {
    background: #6366f1 !important;
    color: #fff !important;
    border-color: #6366f1 !important;
}

/* ── حالة الموظف ── */
.att-emp-status-box {
    background: var(--bg-secondary);
    border-radius: 12px;
    border: 1.5px solid var(--border-color);
    padding: 12px 14px;
    margin-bottom: 12px;
    font-size: 13px;
}

/* ── رسالة الحالة ── */
.att-status-msg {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 600;
    text-align: center;
}

/* ── صف الإجازة في جدول التقرير ── */
.att-day-row-leave td { background: rgba(59,130,246,0.06) !important; }
.att-day-row-leave td:first-child { border-right: 3px solid #3b82f6; }

/* ── تبويب المقارنة بتصميم موحد ── */
#att-tab-compare .card,
#att-tab-compare .att-glass-card { margin-bottom: 0; }

/* ── shake animation ── */
@keyframes attShake {
    0%, 100% { transform: translateX(0); }
    20%       { transform: translateX(-6px); }
    40%       { transform: translateX(6px); }
    60%       { transform: translateX(-4px); }
    80%       { transform: translateX(4px); }
}
.att-shake { animation: attShake 0.4s ease; border-color: #ef4444 !important; box-shadow: 0 0 0 3px rgba(239,68,68,0.2) !important; }

/* ── نافذة تفاصيل التسجيل ── */
@keyframes attPopIn {
    from { opacity: 0; transform: scale(0.85) translateY(20px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}
.att-sp-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 8px 12px;
    border-radius: 10px;
    background: var(--bg-secondary, #0f172a);
    font-size: 13px;
}
.att-sp-lbl { color: var(--text-secondary, #94a3b8); font-weight: 600; display: flex; align-items: center; gap: 5px; flex-shrink: 0; }
.att-sp-val { font-weight: 700; color: var(--text-primary, #f1f5f9); text-align: left; direction: ltr; word-break: break-all; }
.att-sp-warn { background: #f59e0b11; border: 1px solid #f59e0b22; }
.att-sp-danger { background: #ef444411; border: 1px solid #ef444422; }

/* ══════════════════════════════════════════════
   تجاوب الهاتف — تبويب الحضور كامل
══════════════════════════════════════════════ */

/* ── 768px: تابلت صغير وهاتف كبير ── */
@media (max-width: 768px) {
    /* البانر الحي */
    .att-live-banner {
        padding: 16px 18px;
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    .att-live-time { font-size: 32px; letter-spacing: 1px; text-align: right; }
    .att-live-date { font-size: 12px; min-width: unset; text-align: right; }

    /* شبكة تسجيل الحضور: عمود واحد */
    .att-checkin-grid { grid-template-columns: 1fr; gap: 12px; }

    /* أزرار التسجيل: عمود واحد */
    .att-register-btns { grid-template-columns: 1fr; gap: 8px; }

    /* التبويبات: تمتد بالكامل */
    .att-tabs-row { width: 100%; gap: 4px; overflow-x: auto; flex-wrap: nowrap; padding-bottom: 4px; }
    .att-tab-btn  { flex-shrink: 0; white-space: nowrap; }

    /* البطاقات الزجاجية */
    .att-glass-card { padding: 14px; border-radius: 14px; }
    .att-glass-card:hover { transform: none; }

    /* كاميرا */
    .att-video-ring { max-width: 220px; }

    /* modal الإجازة */
    #attLeaveModal > div { padding: 18px; }
    #attLeaveModal > div > div:nth-child(3) { grid-template-columns: 1fr !important; }

    /* modal الموظف */
    #attEmpModal > div { padding: 18px; }

    /* جدول التقرير */
    .att-day-table { font-size: 11px; }
    .att-day-table th, .att-day-table td { padding: 6px 8px; }

    /* بطاقات التقرير */
    .att-report-cards { grid-template-columns: repeat(2, 1fr); gap: 10px; }

    /* الملخص المالي */
    .att-fin-row { flex-direction: column; gap: 2px; }
    .att-fin-row span:last-child { font-size: 14px; }

    /* جدول المقارنة */
    .att-compare-table { font-size: 11px; }
    .att-compare-header, .att-compare-row { grid-template-columns: 1.5fr 1fr 1fr 1fr; }

    /* إعدادات — حقول جنب بعض على التابلت */
    #att-tab-settings .att-glass-card div[style*="grid-template-columns:1fr 1fr"] {
        grid-template-columns: 1fr 1fr !important;
    }

    /* زر حفظ الإعدادات */
    #att-tab-settings .att-btn { width: 100%; justify-content: center; }
}

/* ── 640px: هاتف متوسط ── */
@media (max-width: 640px) {
    /* البانر */
    .att-live-time { font-size: 26px; }
    .att-live-banner { border-radius: 14px; padding: 14px 16px; }

    /* التبويبات: أيقونة فقط */
    .att-tab-btn { padding: 8px 10px; font-size: 12px; }
    .att-tab-btn .att-tab-label { display: none; }

    /* بطاقة الموظف */
    .att-emp-card { flex-direction: column; gap: 10px; }
    .att-emp-card > div:last-child { align-self: stretch; justify-content: flex-end; width: 100%; }
    .att-emp-card-info { flex-direction: row; align-items: flex-start; width: 100%; }
    .att-emp-card-info > div:last-child { flex: 1; min-width: 0; }
    .att-emp-name { font-size: 14px !important; }
    .att-emp-meta { word-break: break-word; }
    .att-cfg-pill { font-size: 10px !important; padding: 2px 6px !important; }

    /* أيام الدوام في modal */
    #att_emp_workdays_grid { grid-template-columns: repeat(4, 1fr) !important; }

    /* إحصائيات اليوم */
    .att-stats-row { grid-template-columns: repeat(3, 1fr); gap: 8px; }
    .att-stat-num  { font-size: 22px; }
    .att-stat-lbl  { font-size: 10px; }

    /* بطاقات التقرير */
    .att-report-cards { grid-template-columns: repeat(2, 1fr); }
    .att-report-card  { padding: 12px; }
    .att-report-card-val { font-size: 24px; }

    /* جدول التقرير: إخفاء أعمدة ثانوية */
    .att-day-table th:nth-child(4),
    .att-day-table td:nth-child(4),
    .att-day-table th:nth-child(5),
    .att-day-table td:nth-child(5) { display: none; }

    /* جدول المقارنة: إخفاء أعمدة ثانوية */
    .att-day-table.att-cmp-table th:nth-child(7),
    .att-day-table.att-cmp-table td:nth-child(7),
    .att-day-table.att-cmp-table th:nth-child(8),
    .att-day-table.att-cmp-table td:nth-child(8) { display: none; }

    /* صف سجل الحضور */
    .att-record-row { flex-wrap: wrap; gap: 6px; }

    /* صف ملخص اليوم */
    .att-today-row { flex-wrap: wrap; gap: 6px; padding: 8px 10px; }

    /* أزرار التسجيل */
    .att-reg-btn { padding: 12px 14px; }
    .att-reg-btn-icon { width: 34px; height: 34px; font-size: 17px; }
    .att-reg-btn-main { font-size: 13px; }

    /* حقل الموقع */
    .att-location-row { flex-wrap: wrap; }
    .att-location-row .att-input { min-width: 0; }

    /* سجل الإجازات */
    #att_leaves_list .att-today-row { flex-direction: column; align-items: flex-start; }
    #att_leaves_list .att-today-row > div:last-child { width: 100%; justify-content: flex-start; }
}

/* ── 480px: هاتف صغير ── */
@media (max-width: 480px) {
    /* البانر */
    .att-live-time { font-size: 22px; }
    .att-live-banner { padding: 12px 14px; border-radius: 12px; }
    .att-live-dot-wrap { padding: 4px 8px; font-size: 11px; }

    /* التبويبات */
    .att-tabs-row { gap: 3px; }
    .att-tab-btn  { padding: 7px 8px; font-size: 11px; }

    /* البطاقات */
    .att-glass-card { padding: 12px; border-radius: 12px; }
    .att-glass-card-title { font-size: 13px; }
    .att-icon-pill { width: 30px; height: 30px; font-size: 15px; }

    /* كاميرا */
    .att-video-ring { max-width: 180px; }
    .att-camera-btns { gap: 6px; }
    .att-action-btn  { padding: 8px 12px; font-size: 12px; }

    /* إحصائيات */
    .att-stats-row { grid-template-columns: repeat(3, 1fr); gap: 6px; }
    .att-stat-box  { padding: 10px 6px; border-radius: 10px; }
    .att-stat-num  { font-size: 20px; }
    .att-stat-lbl  { font-size: 9px; }

    /* بطاقات التقرير */
    .att-report-cards { grid-template-columns: 1fr 1fr; gap: 8px; }
    .att-report-card  { padding: 10px; border-radius: 12px; }
    .att-report-card-val { font-size: 20px; }
    .att-report-card-lbl { font-size: 10px; }
    .att-report-card-cmp { display: none; }

    /* جدول التقرير */
    .att-day-table { font-size: 10px; }
    .att-day-table th, .att-day-table td { padding: 5px 6px; }

    /* أزرار التسجيل */
    .att-reg-btn { padding: 10px 12px; border-radius: 12px; }
    .att-reg-btn-icon { width: 30px; height: 30px; font-size: 15px; border-radius: 8px; }
    .att-reg-btn-main { font-size: 12px; }
    .att-reg-btn-sub  { font-size: 10px; }

    /* modal */
    #attLeaveModal, #attEmpModal {
        padding: 16px;
        overflow: hidden;
        align-items: center;
    }
    #attLeaveModal > div, #attEmpModal .modal-content {
        border-radius: 14px;
        padding: 14px;
        width: 100%;
        max-width: 100%;
        max-height: 85dvh;
        overflow-y: auto;
        overflow-x: hidden;
        box-sizing: border-box;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
    }

    /* أيام الدوام */
    #att_emp_workdays_grid { grid-template-columns: repeat(4, 1fr) !important; gap: 4px !important; }
    #att_emp_workdays_grid label { padding: 6px 2px !important; font-size: 10px !important; min-width: 0 !important; }

    /* ملخص اليوم */
    .att-today-header { padding: 12px 14px; }
    .att-today-body   { padding: 12px 14px; }
    .att-today-row    { padding: 8px; border-radius: 10px; }

    /* حالة الموظف */
    .att-emp-status-box { padding: 10px 12px; }
    .att-emp-live-status { padding: 10px 12px; }

    /* الملخص المالي */
    .att-financial-box, .att-compare-box { padding: 12px; border-radius: 12px; }
    .att-fin-row { font-size: 12px; }
    .att-fin-total { font-size: 14px; }
}

/* ═══════════════════════════════════════════════════════════════
   GLOBAL MODAL SYSTEM — قواعد موحدة لكل النوافذ المنبثقة
   تضمن: التمركز في منتصف الشاشة المرئية + التمرير الداخلي
   ═══════════════════════════════════════════════════════════════ */

/* القاعدة الذهبية: الـ overlay يكون ثابتاً لا يتمرر */
.modal-overlay,
.form-modal,
#editModal,
#permissionsModal,
#attLeaveModal,
#attEmpModal,
#warehouseMaterialLogModal,
#whEditModal,
#whConfirmModal,
#whInventoryModal,
#operationDetailModal,
#successModal {
    position: fixed !important;
    inset: 0 !important;
    overflow: hidden !important;
    overscroll-behavior: contain;
    z-index: 9999 !important;
}

/* confirmModal و toastContainer يجب أن يكونا فوق كل شيء دائماً */
#confirmModal {
    z-index: 999999 !important;
}
.toast-container {
    z-index: 9999999 !important;
}

/* التمركز الافتراضي (يُلغى بواسطة rc-bottom-sheet على الموبايل) */
.modal-overlay:not(.rc-bottom-sheet),
.form-modal:not(.rc-bottom-sheet),
#editModal:not(.rc-bottom-sheet),
#permissionsModal:not(.rc-bottom-sheet),
#attLeaveModal:not(.rc-bottom-sheet),
#attEmpModal:not(.rc-bottom-sheet),
#warehouseMaterialLogModal:not(.rc-bottom-sheet),
#whEditModal:not(.rc-bottom-sheet),
#whConfirmModal:not(.rc-bottom-sheet),
#whInventoryModal:not(.rc-bottom-sheet),
#operationDetailModal:not(.rc-bottom-sheet),
#successModal:not(.rc-bottom-sheet) {
    align-items: center;
    justify-content: center;
    padding: 24px;
}

/* المحتوى الداخلي: له حد أقصى للارتفاع ويتمرر بداخله */
.modal-content,
.form-content,
#editModal > div,
#permissionsModal > div,
#attLeaveModal > div,
#attEmpModal .modal-content,
#warehouseMaterialLogModal .modal-content,
#whEditModal .modal-content,
#whConfirmModal .modal-content,
#whInventoryModal .modal-content,
#operationDetailModal .form-content,
#successModal > div {
    max-height: 82dvh !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}

/* عند الفتح */
.modal-overlay.active  { display: flex !important; }
.form-modal.active     { display: flex !important; }

/* موبايل: padding أصغر للنوافذ المتمركزة (ليست bottom sheet) */
@media (max-width: 1024px) {
    .modal-overlay:not(.rc-bottom-sheet),
    .form-modal:not(.rc-bottom-sheet),
    #editModal:not(.rc-bottom-sheet),
    #permissionsModal:not(.rc-bottom-sheet),
    #attLeaveModal:not(.rc-bottom-sheet),
    #attEmpModal:not(.rc-bottom-sheet),
    #warehouseMaterialLogModal:not(.rc-bottom-sheet),
    #whEditModal:not(.rc-bottom-sheet),
    #whConfirmModal:not(.rc-bottom-sheet),
    #whInventoryModal:not(.rc-bottom-sheet),
    #operationDetailModal:not(.rc-bottom-sheet),
    #successModal:not(.rc-bottom-sheet) {
        padding: 16px;
    }

    .modal-content,
    .form-content,
    #editModal > div,
    #permissionsModal > div,
    #attLeaveModal > div,
    #attEmpModal .modal-content,
    #warehouseMaterialLogModal .modal-content,
    #whEditModal .modal-content,
    #whConfirmModal .modal-content,
    #whInventoryModal .modal-content,
    #operationDetailModal .form-content,
    #successModal > div {
        max-height: 85dvh !important;
        max-width: 100% !important;
    }
}

/* ====== لوحة التحكم — الإحصائيات الإضافية ====== */
.dash-extra-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 16px;
}
.dash-extra-card {
    background: var(--bg-card);
    border-radius: 14px;
    border-right: 4px solid #ccc;
    padding: 12px 14px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: var(--shadow-soft);
    transition: transform 0.15s, box-shadow 0.15s;
}
.dash-extra-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}
.dash-extra-icon {
    width: 36px;
    height: 36px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.dash-extra-body {
    flex: 1;
    min-width: 0;
}
.dash-extra-label {
    font-size: 11px;
    color: var(--text-secondary);
    font-weight: 600;
    margin-bottom: 2px;
}
.dash-extra-value {
    font-size: 15px;
    font-weight: 800;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ====== الصف الأوسط: تقرير اليوم + الرسم البياني ====== */
.dash-mid-row {
    display: grid;
    grid-template-columns: 1fr 1.4fr;
    gap: 16px;
    margin-bottom: 16px;
}
.dash-today-card { padding: 16px; }
.dash-today-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-right: 3px solid #ccc;
    border-radius: 8px;
    margin-bottom: 6px;
    background: #f9fafb;
}
.dash-today-icon {
    width: 28px;
    height: 28px;
    border-radius: 7px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
}
.dash-today-lbl {
    flex: 1;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
}
.dash-today-right {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
    margin-inline-start: auto;
}
.dash-today-val {
    font-size: 12px;
    font-weight: 800;
    color: var(--text-primary);
    white-space: nowrap;
}
.dash-today-sub {
    font-size: 12px;
    font-weight: 800;
    color: #d4af37;
    white-space: nowrap;
}
.dash-today-detail-btn {
    flex-shrink: 0;
    width: 26px;
    height: 26px;
    background: transparent;
    border: 1.5px solid #e2e8f0;
    border-radius: 7px;
    cursor: pointer;
    color: #94a3b8;
    font-size: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
    padding: 0;
}
.dash-today-detail-btn:hover {
    border-color: #8b5cf6;
    color: #8b5cf6;
    background: #f5f3ff;
}
.dash-today-net {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 10px;
    padding: 9px 12px;
    background: linear-gradient(135deg, #f0fdf4, #dcfce7);
    border-radius: 10px;
    font-size: 13px;
    font-weight: 700;
    color: #065f46;
}

/* ====== الرسم البياني ====== */
.dash-chart-card { padding: 16px; }
.dash-chart-wrap {
    height: 130px;
    display: flex;
    align-items: flex-end;
}
.dash-chart-bars {
    display: flex;
    align-items: flex-end;
    gap: 6px;
    width: 100%;
    height: 100%;
}
.dash-chart-bars .chart-bar {
    flex: 1;
    background: linear-gradient(180deg, #10b981, #059669);
    border-radius: 5px 5px 0 0;
    min-height: 6px;
    transition: height 0.4s ease;
    cursor: pointer;
    opacity: 0.85;
}
.dash-chart-bars .chart-bar:last-child {
    background: linear-gradient(180deg, #d4af37, #b8960c);
    opacity: 1;
}
.dash-chart-bars .chart-bar:hover { opacity: 1; filter: brightness(1.1); }

/* ====== الروابط السريعة المحدّثة ====== */
.quick-actions-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 16px;
}

.qab {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    border: none;
    border-radius: 16px;
    cursor: pointer;
    font-family: inherit;
    text-align: right;
    direction: rtl;
    transition: all 0.2s;
    position: relative;
    overflow: hidden;
}
.qab::before {
    content: '';
    position: absolute;
    inset: 0;
    opacity: 0;
    transition: opacity 0.2s;
}
.qab:hover::before { opacity: 1; }
.qab:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(0,0,0,0.12); }
.qab:active { transform: translateY(0); }

.qab-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
}

.qab-body {
    flex: 1;
    min-width: 0;
}
.qab-label {
    font-size: 13px;
    font-weight: 800;
    line-height: 1.2;
}
.qab-count {
    font-size: 11px;
    font-weight: 600;
    margin-top: 2px;
    opacity: 0.7;
}
.qab-plus {
    font-size: 18px;
    flex-shrink: 0;
    opacity: 0.5;
}

/* ألوان كل زر */
.qab-contract {
    background: linear-gradient(135deg, #fef9ec, #fef3c7);
    color: #92400e;
    border: 1.5px solid #fde68a;
}
.qab-contract .qab-icon { background: linear-gradient(135deg, #d4af37, #b8960c); color: white; }
.qab-contract:hover { background: linear-gradient(135deg, #fde68a, #fbbf24); border-color: #d4af37; }

.qab-receipt {
    background: linear-gradient(135deg, #f0fdf4, #dcfce7);
    color: #065f46;
    border: 1.5px solid #bbf7d0;
}
.qab-receipt .qab-icon { background: linear-gradient(135deg, #10b981, #059669); color: white; }
.qab-receipt:hover { background: linear-gradient(135deg, #dcfce7, #86efac); border-color: #10b981; }

.qab-bank {
    background: linear-gradient(135deg, #eff6ff, #dbeafe);
    color: #1e40af;
    border: 1.5px solid #bfdbfe;
}
.qab-bank .qab-icon { background: linear-gradient(135deg, #3b82f6, #1d4ed8); color: white; }
.qab-bank:hover { background: linear-gradient(135deg, #dbeafe, #93c5fd); border-color: #3b82f6; }

.qab-expense {
    background: linear-gradient(135deg, #fff1f2, #fee2e2);
    color: #991b1b;
    border: 1.5px solid #fecaca;
}
.qab-expense .qab-icon { background: linear-gradient(135deg, #ef4444, #dc2626); color: white; }
.qab-expense:hover { background: linear-gradient(135deg, #fee2e2, #fca5a5); border-color: #ef4444; }

@media (max-width: 700px) {
    .quick-actions-grid { grid-template-columns: repeat(2, 1fr); }
    .qab-count { display: none; }
}
@media (max-width: 400px) {
    .quick-actions-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
    .qab { padding: 11px 12px; gap: 8px; }
    .qab-icon { width: 36px; height: 36px; font-size: 18px; }
    .qab-label { font-size: 12px; }
}

/* ====== إدارة المستخدمين ====== */
.user-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
    background: var(--bg-secondary);
    border-radius: 14px;
    margin-bottom: 10px;
    border-right: 4px solid #e2e8f0;
    transition: box-shadow 0.2s, transform 0.15s;
    flex-wrap: wrap;
}
.user-card:hover {
    box-shadow: 0 4px 16px rgba(0,0,0,0.08);
    transform: translateY(-1px);
}

.user-card-btns {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    align-items: center;
    flex-shrink: 0;
}

/* أزرار بطاقة المستخدم */
.ucb {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 12px;
    border: none;
    border-radius: 9px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.15s;
    white-space: nowrap;
}
.ucb span { font-size: 11px; }
.ucb:hover { filter: brightness(0.9); transform: translateY(-1px); }
.ucb:active { transform: translateY(0); }

.ucb-edit   { background: #fef3c7; color: #92400e; }
.ucb-perm   { background: #dbeafe; color: #1e40af; }
.ucb-logout { background: #ede9fe; color: #5b21b6; }
.ucb-del    { background: #fee2e2; color: #991b1b; }

@media (max-width: 600px) {
    .user-card { flex-direction: column; align-items: flex-start; }
    .user-card-btns { width: 100%; justify-content: flex-start; }
    .ucb span { display: none; }
    .ucb { padding: 7px 10px; }
}

/* ====== كاشف التكرار التفاعلي ====== */
.dash-dup-card {
    padding: 14px 16px;
    margin-bottom: 16px;
}

.dup-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 12px;
}

.dup-tabs {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.dup-tab {
    padding: 4px 12px;
    border-radius: 20px;
    border: 1.5px solid #e2e8f0;
    background: transparent;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    color: #64748b;
    transition: all 0.2s;
}
.dup-tab:hover { border-color: var(--tc, #8b5cf6); color: var(--tc, #8b5cf6); }
.dup-tab.active { background: var(--tc, #8b5cf6); border-color: var(--tc, #8b5cf6); color: white; }

/* ملخص الأرقام */
.dup-summary {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}
.dup-sum-chip {
    flex: 1;
    min-width: 80px;
    border: 1.5px solid #e2e8f0;
    border-radius: 10px;
    padding: 7px 10px;
    text-align: center;
    transition: border-color 0.2s;
}
.dup-sum-num { display: block; font-size: 20px; font-weight: 800; line-height: 1.2; }
.dup-sum-lbl { display: block; font-size: 10px; color: #888; margin-top: 2px; }

/* قائمة التكرارات */
.dup-list {
    max-height: 420px;
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    gap: 8px;
    -webkit-overflow-scrolling: touch;
}

.dup-group {
    border: 1.5px solid #e2e8f0;
    border-radius: 10px;
    border-right: 3px solid var(--gc, #8b5cf6);
    background: var(--bg-secondary, #fff);
}
.dup-group-title {
    background: #f8fafc;
    padding: 8px 12px;
    font-size: 12px;
    font-weight: 800;
    color: #1a1f3c;
    display: flex;
    align-items: center;
    gap: 6px;
    border-radius: 8px 8px 0 0;
}
.dup-count {
    font-size: 10px;
    background: var(--gc, #8b5cf6);
    color: white;
    border-radius: 10px;
    padding: 1px 7px;
    margin-right: auto;
}
.dup-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 12px;
    border-top: 1px solid #e5e7eb;
    direction: rtl;
    min-height: 40px;
    background: #ffffff;
}
.dup-row:hover { background: #f9fafb; }
.dup-row-info {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 1;
    flex-wrap: wrap;
    min-width: 0;
}
.dup-tag {
    border-radius: 6px;
    padding: 2px 7px;
    font-size: 11px;
    font-weight: 700;
    white-space: nowrap;
}
.dup-name {
    font-size: 12px;
    font-weight: 600;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 130px;
}
.dup-meta {
    font-size: 10px;
    color: #999;
    white-space: nowrap;
}
.dup-goto-btn {
    flex-shrink: 0;
    padding: 3px 10px;
    background: transparent;
    border-radius: 7px;
    border-width: 1.5px;
    border-style: solid;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s;
}
.dup-goto-btn:hover { opacity: 0.75; }

.dup-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 16px;
    font-size: 13px;
    font-weight: 700;
    color: #10b981;
    background: #f0fdf4;
    border-radius: 10px;
}

@keyframes dupPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

/* ====== Responsive ====== */
@media (max-width: 700px) {
    .dash-extra-grid { grid-template-columns: repeat(2, 1fr); }
    .dash-mid-row { grid-template-columns: 1fr; }
    .dup-name { max-width: 80px; }
    .dup-meta { display: none; }
}

/* ══════════════════════════════════════════
   Loading Skeleton — موحد لكل أنحاء التطبيق
   ══════════════════════════════════════════ */
.app-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    gap: 14px;
    color: var(--text-secondary);
}
.app-loading-spinner {
    width: 38px;
    height: 38px;
    border: 3px solid var(--border-color, #e2e8f0);
    border-top-color: var(--accent, #d4af37);
    border-radius: 50%;
    animation: appSpinRotate 0.75s linear infinite;
}
.app-loading-text {
    font-size: 13px;
    font-weight: 600;
    opacity: 0.7;
    animation: appSpinPulse 1.2s ease-in-out infinite;
}
@keyframes appSpinRotate {
    to { transform: rotate(360deg); }
}
@keyframes appSpinPulse {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}
/* Skeleton bars */
.skeleton-bar {
    height: 14px;
    border-radius: 8px;
    background: linear-gradient(90deg, var(--bg-secondary, #f1f5f9) 25%, var(--border-color, #e2e8f0) 50%, var(--bg-secondary, #f1f5f9) 75%);
    background-size: 200% 100%;
    animation: skeletonShimmer 1.4s ease-in-out infinite;
}
@keyframes skeletonShimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}
