:root {
    --primary: #1e3a5f;
    --primary-dark: #142a47;
    --primary-light: #2c568c;
    --accent: #c9a227;
    --accent-light: #e6c558;
    --success: #2e7d32;
    --danger: #c62828;
    --warning: #ef6c00;
    --info: #1976d2;
    --bg: #f0f3f7;
    --card: #ffffff;
    --sidebar-bg: #142a47;
    --sidebar-text: #cbd5e1;
    --text: #1e293b;
    --text-light: #64748b;
    --border: #e2e8f0;
    --shadow: 0 6px 30px rgba(20, 42, 71, 0.10);
    --radius: 14px;
    --topbar-h: 68px;
    --sidebar-w: 260px;
}

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

html, body { height: 100%; }

body {
    font-family: 'Tajawal', 'Cairo', 'Segoe UI', Tahoma, sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 15px;
    line-height: 1.6;
}

.hidden { display: none !important; }
.muted { color: var(--text-light); }
.login-version {
    margin-top: 6px;
    font-size: 11.5px;
    color: #8b9bb4;
    text-align: center;
    background: rgba(30,58,95,0.06);
    border: 1px dashed #cbd5e1;
    border-radius: 8px;
    padding: 5px 8px;
}
.version-chip {
    font-size: 11px;
    font-weight: 800;
    color: #c9a227;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(201,162,39,0.5);
    border-radius: 20px;
    padding: 3px 10px;
    margin-left: 6px;
    white-space: nowrap;
    direction: ltr;
}
.mb-16 { margin-bottom: 16px; }
.mt-16 { margin-top: 16px; }

/* ============ شاشة الدخول ============ */
.login-screen {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background:
        radial-gradient(circle at 15% 20%, rgba(201,162,39,0.10), transparent 40%),
        radial-gradient(circle at 85% 80%, rgba(44,86,140,0.20), transparent 45%),
        linear-gradient(135deg, #142a47 0%, #1e3a5f 50%, #2c568c 100%);
    padding: 20px;
    position: relative;
    overflow: hidden;
}
.login-screen::before, .login-screen::after {
    content: '';
    position: absolute;
    width: 500px; height: 500px;
    border: 2px solid rgba(255,255,255,0.04);
    border-radius: 50%;
}
.login-screen::before { top: -150px; right: -150px; }
.login-screen::after { bottom: -150px; left: -150px; }

.login-card {
    background: #fff;
    border-radius: 24px;
    padding: 40px 44px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 25px 60px rgba(0,0,0,0.35);
    text-align: center;
    position: relative;
    z-index: 2;
    border-top: 5px solid var(--accent);
}

.login-logo { margin-bottom: 16px; }
.logo-badge {
    width: 84px; height: 84px;
    margin: 0 auto;
    border-radius: 24px;
    background: linear-gradient(135deg, var(--sidebar-bg), var(--primary-light));
    display: flex; align-items: center; justify-content: center;
    font-size: 40px;
    color: var(--accent);
    box-shadow: 0 12px 30px rgba(20,42,71,0.35);
    overflow: hidden;
}
.logo-img {
    width: 100%; height: 100%;
    object-fit: cover;
    border-radius: 24px;
}
.app-title {
    font-family: 'Cairo', sans-serif;
    font-weight: 900;
    font-size: 30px;
    color: var(--primary-dark);
    letter-spacing: -0.5px;
    line-height: 1.3;
}
.app-subtitle {
    color: var(--text-light);
    margin: 6px 0 24px;
    font-size: 14px;
}

.login-card form { text-align: right; }

.field { margin-bottom: 16px; }
.field > label {
    display: block;
    font-weight: 700;
    font-size: 13px;
    color: var(--text);
    margin-bottom: 6px;
}
.input-icon {
    position: relative;
    display: flex;
    align-items: center;
}
.input-icon > i {
    position: absolute;
    right: 14px;
    color: var(--text-light);
    font-size: 14px;
}
.input-icon > input {
    width: 100%;
    padding: 12px 42px 12px 42px;
    border: 2px solid var(--border);
    border-radius: 10px;
    font-family: inherit;
    font-size: 14px;
    color: var(--text);
    background: #f8fafc;
    transition: all 0.2s;
}
.input-icon > input:focus {
    outline: none;
    border-color: var(--primary-light);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(44,86,140,0.12);
}
.toggle-pass {
    position: absolute;
    left: 10px;
    background: none;
    border: none;
    color: var(--text-light);
    cursor: pointer;
    font-size: 14px;
}
.alert {
    padding: 12px 16px;
    border-radius: 10px;
    font-size: 13px;
    margin-bottom: 16px;
    text-align: center;
}
.alert-error { background: #fdecea; color: var(--danger); border: 1px solid #f5c6cb; }
.alert-success { background: #e8f5e9; color: var(--success); border: 1px solid #c8e6c9; }
.alert-info { background: #e3f2fd; color: var(--info); border: 1px solid #bbdefb; }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 18px;
    border: none;
    border-radius: 10px;
    font-family: inherit;
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-light); }
.btn-accent { background: var(--accent); color: #1a1a1a; }
.btn-accent:hover { background: var(--accent-light); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #b71c1c; }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #1b5e20; }
.btn-outline { background: transparent; color: var(--primary); border: 2px solid var(--primary); }
.btn-outline:hover { background: rgba(30,58,95,0.06); }
.btn-light { background: #f1f5f9; color: var(--text); border: 1px solid var(--border); }
.btn-light:hover { background: #e2e8f0; }
.btn-sm { padding: 6px 12px; font-size: 12px; border-radius: 8px; }
.btn-lg { padding: 13px 22px; font-size: 16px; border-radius: 12px; }
.btn-block { width: 100%; }

.login-hint {
    margin-top: 20px;
    font-size: 12px;
    color: var(--text-light);
}

.login-reset {
    margin-top: 10px;
    background: none;
    border: none;
    color: var(--text-light);
    font-family: inherit;
    font-size: 12px;
    cursor: pointer;
    opacity: .8;
    transition: opacity .2s, color .2s;
}
.login-reset:hover { opacity: 1; color: var(--danger); }

.login-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 18px;
    background: #f1f5f9;
    padding: 5px;
    border-radius: 12px;
}
.login-tab {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 10px 0;
    border: none;
    background: transparent;
    border-radius: 9px;
    font-family: inherit;
    font-weight: 700;
    font-size: 14px;
    color: var(--text-light);
    cursor: pointer;
    transition: all 0.2s;
}
.login-tab.active {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 4px 12px rgba(30,58,95,0.3);
}
.login-mode-hint {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 12.5px;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 8px 10px;
    margin-bottom: 14px;
    color: #475569;
}
.login-mode-hint.highlight {
    background: #eef2ff;
    border-color: #c7d2fe;
    color: #3730a3;
}
.login-mode-hint b { font-weight: 800; }
.login-panel .field:last-of-type { margin-bottom: 4px; }

.field-hint {
    display: block;
    margin-top: 4px;
    font-size: 11px;
    color: var(--text-light);
}

/* ============ التطبيق ============ */
.app { min-height: 100vh; display: flex; flex-direction: column; }

.topbar {
    height: var(--topbar-h);
    background: var(--sidebar-bg);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    color: #fff;
    box-shadow: 0 2px 15px rgba(0,0,0,0.15);
    position: sticky;
    top: 0;
    z-index: 200;
}
.topbar-right, .topbar-left { display: flex; align-items: center; gap: 12px; }
.icon-btn {
    width: 40px; height: 40px;
    border-radius: 10px;
    border: none;
    background: rgba(255,255,255,0.08);
    color: #fff;
    font-size: 16px;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: all 0.2s;
}
.icon-btn:hover { background: rgba(255,255,255,0.18); }
.brand { display: flex; align-items: center; gap: 12px; }
.brand-badge {
    width: 42px; height: 42px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--accent), var(--accent-light));
    color: #142a47;
    display: flex; align-items: center; justify-content: center;
    font-size: 22px;
    overflow: hidden;
}
.brand-img {
    width: 100%; height: 100%;
    object-fit: cover;
    border-radius: 12px;
}
.brand-name {
    display: block;
    font-family: 'Cairo', sans-serif;
    font-weight: 800;
    font-size: 17px;
    line-height: 1.2;
}
.brand-tag {
    display: inline-block;
    font-size: 11px;
    background: rgba(255,255,255,0.14);
    padding: 1px 10px;
    border-radius: 20px;
    color: var(--accent-light);
}

.user-chip { display: flex; align-items: center; gap: 10px; }
.user-avatar {
    width: 40px; height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), var(--accent-light));
    color: #142a47;
    font-weight: 800;
    font-size: 17px;
    display: flex; align-items: center; justify-content: center;
}
.user-info { text-align: right; line-height: 1.2; }
.user-name { display: block; font-weight: 700; font-size: 13px; }
.user-role { display: block; font-size: 11px; color: rgba(255,255,255,0.7); }
.logout-btn { background: rgba(198,40,40,0.2); }
.logout-btn:hover { background: var(--danger); }

.layout { display: flex; flex: 1; min-height: calc(100vh - var(--topbar-h)); }

.sidebar {
    width: var(--sidebar-w);
    background: var(--sidebar-bg);
    padding: 20px 12px;
    flex-shrink: 0;
    transition: margin 0.3s ease;
    overflow-y: auto;
}
.sidebar.collapsed { margin-right: calc(-1 * var(--sidebar-w)); }

.nav-section-title {
    color: rgba(255,255,255,0.4);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    padding: 14px 12px 6px;
}
.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 14px;
    border-radius: 10px;
    color: var(--sidebar-text);
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 3px;
    transition: all 0.2s;
    cursor: pointer;
}
.nav-item i { width: 22px; text-align: center; font-size: 15px; }
.nav-item:hover { background: rgba(255,255,255,0.07); color: #fff; }
.nav-item.active {
    background: linear-gradient(90deg, var(--accent), var(--accent-light));
    color: #142a47;
    font-weight: 700;
}
.nav-item .count-badge {
    margin-right: auto;
    background: rgba(255,255,255,0.15);
    border-radius: 20px;
    padding: 0 9px;
    font-size: 11px;
}
.nav-item.active .count-badge { background: rgba(20,42,71,0.2); }

.main {
    flex: 1;
    padding: 24px;
    overflow-x: hidden;
}
.page-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}
.page-head h2 {
    font-family: 'Cairo', sans-serif;
    font-weight: 800;
    font-size: 24px;
    color: var(--primary-dark);
}
.page-head p { color: var(--text-light); font-size: 13px; margin-top: 2px; }

/* ============ البطاقات والإحصائيات ============ */
.card {
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px;
    border: 1px solid var(--border);
}
.card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}
.card-head h3 { font-family: 'Cairo', sans-serif; font-weight: 800; font-size: 17px; }

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}
.stat-card {
    background: var(--card);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 16px;
    border-right: 4px solid var(--primary);
}
.stat-card .stat-icon {
    width: 52px; height: 52px;
    border-radius: 14px;
    display: flex; align-items: center; justify-content: center;
    font-size: 22px;
    color: #fff;
    flex-shrink: 0;
}
.stat-card .stat-value {
    font-family: 'Cairo', sans-serif;
    font-weight: 900;
    font-size: 26px;
    line-height: 1.1;
    color: var(--primary-dark);
}
.stat-card .stat-label { color: var(--text-light); font-size: 13px; }

/* ============ الجداول ============ */
.table-wrap { overflow-x: auto; }
.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}
.table th {
    text-align: right;
    padding: 12px 14px;
    background: #f8fafc;
    color: var(--text-light);
    font-weight: 700;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    border-bottom: 2px solid var(--border);
    white-space: nowrap;
}
.table td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}
.table tbody tr:hover { background: #f8fafc; }
.table tbody tr:last-child td { border-bottom: none; }
.cell-user { display: flex; align-items: center; gap: 10px; }
.cell-avatar {
    width: 34px; height: 34px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700;
    font-size: 14px;
    flex-shrink: 0;
}
.cell-name { font-weight: 700; }
.cell-sub { font-size: 12px; color: var(--text-light); }

/* ============ الشارات ============ */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 11px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    gap: 5px;
}
.badge-role { background: #eef2ff; color: #4338ca; }
.badge-role.admin { background: #fef3c7; color: #92400e; }
.badge-role.supervisor { background: #e3f2fd; color: #1565c0; }
.badge-role.viewer { background: #f3f4f6; color: #4b5563; }
.badge-status { background: #e8f5e9; color: var(--success); }
.badge-status.inactive { background: #fdecea; color: var(--danger); }
.badge-danger { background: #fdecea; color: var(--danger); }
.badge-success { background: #e8f5e9; color: var(--success); }
.badge-warning { background: #fff3e0; color: var(--warning); }

/* ============ الرقم السري ============ */
.secret-code-cell { display: flex; align-items: center; gap: 6px; }
.secret-code {
    display: inline-block;
    background: #f0f2f5;
    border: 1px solid #dde0e4;
    border-radius: 6px;
    padding: 3px 8px;
    font-family: monospace;
    font-size: 13px;
    font-weight: 700;
    color: var(--primary);
    letter-spacing: 1px;
    min-width: 48px;
    text-align: center;
}
.field-inline { display: flex; gap: 8px; align-items: center; }
.field-inline input, .field-inline select { flex: 1; }

/* ============ الأزرار داخل الجدول ============ */
.actions { display: flex; gap: 6px; }
.icon-btn-sm {
    width: 32px; height: 32px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 13px;
    transition: all 0.2s;
}
.icon-btn-sm.edit { background: #eef2ff; color: #4338ca; }
.icon-btn-sm.edit:hover { background: #e0e7ff; }
.icon-btn-sm.delete { background: #fdecea; color: var(--danger); }
.icon-btn-sm.delete:hover { background: #f5c6cb; }
.icon-btn-sm.view { background: #e3f2fd; color: #1565c0; }
.icon-btn-sm.view:hover { background: #bbdefb; }
.icon-btn-sm.perms { background: #f3e5f5; color: #7b1fa2; }
.icon-btn-sm.perms:hover { background: #e1bee7; }
.icon-btn-sm.approve { background: #e8f5e9; color: var(--success); }
.icon-btn-sm.approve:hover { background: #c8e6c9; }
.icon-btn-sm.reject { background: #fdecea; color: var(--danger); }
.icon-btn-sm.reject:hover { background: #f5c6cb; }
.icon-btn-sm.revive { background: #fff3e0; color: var(--warning); }
.icon-btn-sm.revive:hover { background: #ffe0b2; }

/* ============ الصور ============ */
.table-thumb {
    width: 52px; height: 52px;
    object-fit: cover;
    border-radius: 10px;
    cursor: pointer;
    border: 1px solid var(--border);
    display: inline-block;
}
.img-preview { margin-top: 10px; }
.img-preview img, .preview-img {
    max-width: 170px; max-height: 170px;
    border-radius: 12px;
    border: 1px solid var(--border);
    display: block;
}
.preview-video {
    width: 100%;
    max-width: 420px;
    max-height: 340px;
    border-radius: 12px;
    border: 1px solid var(--border);
    display: block;
    background: #000;
}
.media-viewer-body { text-align: center; padding: 16px; }
.media-viewer {
    width: 100%;
    max-height: 82vh;
    border-radius: 12px;
    display: block;
    margin: 0 auto;
    background: #000;
}
.media-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 12px;
    border-radius: 10px;
    border: none;
    background: #fef3c7;
    color: #92400e;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
}
.media-chip:hover { background: #fde68a; }
.media-wait { display:inline-flex; align-items:center; gap:6px; color:var(--text-light); font-size:13px; }
.data-form input[type="file"] {
    padding: 10px;
    background: #f8fafc;
    border: 1px dashed var(--border);
    border-radius: 10px;
    width: 100%;
    font-size: 13px;
}

/* ============ شريط البحث والأدوات ============ */
.toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}
.toolbar .search-box { position: relative; flex: 1; min-width: 220px; max-width: 380px; }
.toolbar .search-box i { position: absolute; right: 13px; top: 50%; transform: translateY(-50%); color: var(--text-light); font-size: 14px; }
.toolbar .search-box input {
    width: 100%;
    padding: 10px 38px 10px 14px;
    border: 2px solid var(--border);
    border-radius: 10px;
    font-family: inherit;
    font-size: 14px;
}
.toolbar .search-box input:focus { outline: none; border-color: var(--primary-light); }
.toolbar-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ============ مودال ============ */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(20, 42, 71, 0.5);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 500;
    padding: 20px;
}
.modal {
    background: #fff;
    border-radius: 18px;
    width: 100%;
    max-width: 640px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 25px 60px rgba(0,0,0,0.3);
    animation: modalIn 0.25s ease;
}
.modal-lg { max-width: 800px; }
.modal-sm { max-width: 420px; }
@keyframes modalIn {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}
.modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 24px;
    border-bottom: 1px solid var(--border);
}
.modal-head h3 { font-family: 'Cairo', sans-serif; font-weight: 800; font-size: 18px; color: var(--primary-dark); }
.modal-close {
    width: 34px; height: 34px;
    border: none; border-radius: 8px;
    background: #f1f5f9;
    cursor: pointer;
    font-size: 15px;
    color: var(--text);
}
.modal-close:hover { background: #e2e8f0; }
.modal-body { padding: 24px; }
.modal-foot {
    padding: 16px 24px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 18px; }
.form-grid .full { grid-column: 1 / -1; }
.form-grid textarea { width: 100%; min-height: 90px; }

input[type="text"], input[type="password"], input[type="date"], input[type="number"], select, textarea {
    width: 100%;
    padding: 11px 14px;
    border: 2px solid var(--border);
    border-radius: 10px;
    font-family: inherit;
    font-size: 14px;
    color: var(--text);
    background: #fff;
    transition: border-color 0.2s;
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(44,86,140,0.10);
}
label.form-label { display: block; font-weight: 700; font-size: 13px; margin-bottom: 6px; color: var(--text); }
input[type="date"] { direction: ltr; text-align: left; }

/* ============ حقول ديناميكية للقوائم ============ */
.json-array-item {
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 14px;
    margin-bottom: 10px;
    position: relative;
}
.json-array-item .item-head {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 10px;
}
.json-array-item .item-head span { font-weight: 700; font-size: 13px; color: var(--primary); }
.json-array-item .item-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* ============ قائمة السجلات الصغيرة ============ */
.recent-list-holder { max-height: 360px; overflow-y: auto; }
.recent-list { display: flex; flex-direction: column; gap: 6px; }
.recent-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 10px;
    background: #f8fafc;
    border: 1px solid var(--border);
}
.recent-item .recent-icon { width: 38px; height: 38px; border-radius: 10px; background: #eef2ff; color: #4338ca; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.recent-item .recent-body { flex: 1; min-width: 0; }
.recent-item .recent-title { font-weight: 700; font-size: 13px; }
.recent-item .recent-sub { font-size: 12px; color: var(--text-light); }
.recent-item .recent-time { font-size: 11px; color: var(--text-light); white-space: nowrap; }
.empty-state { text-align: center; padding: 40px 20px; color: var(--text-light); }
.empty-state i { font-size: 46px; display: block; margin-bottom: 12px; color: #cbd5e1; }

/* ============ بطاقات إدارة القوائم ============ */
.list-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.list-manage-card {
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    transition: all 0.2s;
}
.list-manage-card:hover { box-shadow: var(--shadow); border-color: var(--primary-light); }
.list-manage-card .lc-head { display: flex; align-items: center; gap: 12px; }
.lc-icon {
    width: 44px; height: 44px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}
.lc-title { font-family: 'Cairo', sans-serif; font-weight: 800; font-size: 15px; color: var(--primary-dark); }
.lc-count { font-size: 12px; color: var(--text-light); }
.lc-actions { display: flex; gap: 6px; margin-top: auto; }

/* ============ تفاصيل القائمة / نموذج البيانات ============ */
.data-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px 18px; }
.data-form .full { grid-column: 1 / -1; }
.data-form .wide { grid-column: span 2; }

.title-row { display: flex; align-items: center; gap: 14px; margin-bottom: 20px; }
.title-row .t-icon { width: 52px; height: 52px; border-radius: 14px; background: linear-gradient(135deg, var(--primary), var(--primary-light)); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 24px; }
.title-row h2 { font-family: 'Cairo', sans-serif; font-weight: 800; font-size: 22px; color: var(--primary-dark); }
.title-row p { color: var(--text-light); font-size: 13px; }

.tag { display: inline-block; background: #f1f5f9; color: var(--text); border-radius: 6px; padding: 2px 8px; font-size: 12px; margin: 2px; border: 1px solid var(--border); }

/* ============ التوست ============ */
.toast-container {
    position: fixed;
    top: 84px;
    left: 20px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.toast {
    background: var(--primary-dark);
    color: #fff;
    padding: 12px 18px;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.25);
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    font-weight: 600;
    animation: toastIn 0.3s ease;
    max-width: 340px;
}
.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }
.toast.warning { background: var(--warning); }
@keyframes toastIn {
    from { transform: translateX(80px); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}
.toast.out { animation: toastOut 0.3s ease forwards; }
@keyframes toastOut {
    to { transform: translateX(80px); opacity: 0; }
}

/* ============ شاشة داخلية للقائمة ============ */
.back-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--primary);
    font-weight: 700;
    font-size: 13px;
    cursor: pointer;
    margin-bottom: 16px;
    border: none;
    background: none;
}
.back-link:hover { text-decoration: underline; }

.list-tools {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
    margin-bottom: 18px;
}
.filter-select { width: auto; min-width: 160px; }

.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-top: 20px;
}
.pagination button {
    min-width: 36px; height: 36px;
    padding: 0 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #fff;
    color: var(--text);
    font-family: inherit;
    font-weight: 600;
    cursor: pointer;
}
.pagination button.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.pagination button:disabled { opacity: 0.4; cursor: not-allowed; }

.checkbox-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.checkbox-row:last-child { border-bottom: none; }
.checkbox-row input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--primary); }
.checkbox-row label { flex: 1; font-weight: 600; font-size: 14px; cursor: pointer; }
.checkbox-row small { display: block; color: var(--text-light); font-weight: 400; font-size: 12px; }

.hint-text { font-size: 12px; color: var(--text-light); margin-top: 6px; }

/* ============ الحقول المخصصة في السجلات ============ */
.record-actions { display: flex; gap: 6px; }

.empty-fields-hint { text-align: center; color: var(--text-light); font-size: 13px; padding: 20px; }

/* ============ طلبات الدخول ============ */
.nav-badge {
    margin-right: auto;
    background: var(--danger);
    color: #fff;
    border-radius: 20px;
    padding: 0 8px;
    font-size: 11px;
    font-weight: 700;
    line-height: 1.7;
    min-width: 20px;
    text-align: center;
}
.nav-item.active .nav-badge { background: rgba(20,42,71,0.55); }

.military-wait {
    display: flex;
    align-items: center;
    gap: 12px;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 14px;
    font-size: 13.5px;
}
.military-wait .mw-icon { font-size: 20px; color: var(--info); }
.military-wait.state-approved { background: #e8f5e9; border-color: #a5d6a7; color: #1b5e20; }
.military-wait.state-approved .mw-icon { color: var(--success); }
.military-wait.state-rejected { background: #fdecea; border-color: #f5b5b1; color: #b71c1c; }
.military-wait.state-rejected .mw-icon { color: var(--danger); }
.military-wait.state-error { background: #fff3e0; border-color: #ffcc80; color: #bf360c; }
.military-wait.state-error .mw-icon { color: var(--warning); }
.military-wait.state-pending .mw-icon { animation: waitPulse 1.4s ease-in-out infinite; }
@keyframes waitPulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.45; } }
.military-wait .btn { margin-right: auto; white-space: nowrap; }

.request-list-holder { display: flex; flex-direction: column; gap: 10px; }
.request-item {
    display: flex;
    align-items: center;
    gap: 14px;
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 14px 16px;
}
.request-item .req-avatar {
    width: 42px; height: 42px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-weight: 800; font-size: 17px;
    flex-shrink: 0;
}
.request-item .req-info { flex: 1; min-width: 0; }
.request-item .req-name { font-weight: 700; font-size: 15px; }
.request-item .req-time { font-size: 12px; color: var(--text-light); }
.request-item .req-status-tag {
    font-size: 11.5px; font-weight: 700;
    padding: 3px 10px; border-radius: 20px;
}
.request-item .req-status-tag.approved { background: #e8f5e9; color: #1b5e20; }
.request-item .req-status-tag.rejected { background: #fdecea; color: #b71c1c; }
.request-item .req-actions { display: flex; gap: 8px; flex-shrink: 0; }
.request-item.handled { opacity: 0.72; }
.request-empty { text-align: center; color: var(--text-light); font-size: 13px; padding: 18px; }

/* ============ طلبات رفع التعميم ولوحة التعميمات (ورقة رسمية) ============ */
.req-status-bar {
    display: flex; align-items: center; gap: 10px;
    padding: 12px 16px; border-radius: 10px; font-size: 13.5px; font-weight: 700;
}
.req-status-bar.pending { background: #fff8e1; color: #8d6e00; border: 1px solid #ffd54f; }
.req-status-bar.approved { background: #e8f5e9; color: #1b5e20; border: 1px solid #a5d6a7; }
.req-status-bar.rejected { background: #fdecea; color: #b71c1c; border: 1px solid #ef9a9a; }

.env-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 18px; padding: 4px; }

.env-doc {
    position: relative;
    background: #fffdf5;
    border: 2px solid #1a1a1a;
    border-radius: 6px;
    padding: 20px 22px 18px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
    font-family: 'Tajawal', sans-serif;
}
.env-doc::before {
    content: '';
    position: absolute;
    inset: 5px;
    border: 1px solid #8a8a7a;
    border-radius: 3px;
    pointer-events: none;
}
.danger-stamp {
    position: absolute;
    top: 18px;
    left: 18px;
    width: 82px; height: 82px;
    border: 3px solid #b71c1c;
    color: #b71c1c;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-weight: 900; font-size: 16px;
    transform: rotate(-14deg);
    opacity: 0.7;
    z-index: 2;
}
.env-doc-head { border-bottom: 2px solid #1a1a1a; padding-bottom: 10px; margin-bottom: 12px; text-align: center; }
.env-org { font-size: 12px; color: #555; margin-bottom: 4px; }
.env-title { font-size: 19px; font-weight: 800; color: #1a1a1a; letter-spacing: 0.5px; }
.env-meta {
    display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap;
    font-size: 12.5px; color: #333;
    border-bottom: 1px dashed #9e9e8e; padding-bottom: 8px; margin-bottom: 8px;
}
.env-row { display: flex; gap: 8px; padding: 7px 2px; border-bottom: 1px solid #ecece2; font-size: 14px; }
.env-row .env-label { min-width: 150px; font-weight: 700; color: #444; flex-shrink: 0; }
.env-row .env-value { flex: 1; color: #111; }
.env-photo { text-align: center; margin: 12px 0 4px; }
.env-photo img { max-height: 220px; max-width: 100%; border: 1px solid #bbb; border-radius: 4px; }
.env-actions { display: flex; gap: 10px; justify-content: center; margin-top: 14px; position: relative; z-index: 2; }
.env-foot {
    display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap;
    margin-top: 16px; padding-top: 10px; border-top: 1px solid #ccc;
    font-size: 12px; color: #555;
}
.env-footer-note { font-weight: 700; }

/* ============ استجابة ============ */
@media (max-width: 900px) {
    .sidebar { position: fixed; right: 0; top: var(--topbar-h); bottom: 0; z-index: 150; margin-right: 0; }
    .sidebar.collapsed { margin-right: calc(-1 * var(--sidebar-w)); }
    .main { padding: 16px; }
    .stats-grid { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
    .form-grid, .json-array-item .item-fields { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
    .brand-name { display: none; }
    .user-info { display: none; }
    .user-chip { gap: 4px; }
    .login-card { padding: 28px 22px; }
    .data-form { grid-template-columns: 1fr; }
    .data-form .wide { grid-column: auto; }
}
