/* ══════════════════════════════════════════
   قطون — style.css
   ══════════════════════════════════════════ */

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

html, body { max-width: 100%; overflow-x: hidden; }

:root {
  --brand:       #CFC07B;
  --brand-dark:  #A89A52;
  --brand-light: #F0EBD4;
  --secondary:   #8C8082;
  --dark:        #111827;
  --text:        #1F2937;
  --muted:       #6B7280;
  --border:      #E5E7EB;
  --bg:          #F9FAFB;
  --white:       #FFFFFF;
  --sidebar-w:   230px;
  --radius:      12px;
  --shadow:      0 1px 3px rgba(0,0,0,.1), 0 1px 2px rgba(0,0,0,.06);
  --shadow-md:   0 4px 12px rgba(0,0,0,.1);
}

body {
  font-family: 'Cairo', sans-serif;
  background: var(--bg);
  color: var(--text);
  direction: rtl;
  min-height: 100vh;
}

.hidden  { display: none !important; }
.w-full  { width: 100%; }
.mt      { margin-top: 8px; }

/* ══════ تسجيل الدخول ══════ */
#login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #F5F0E8;
  background-image: url('logo.svg');
  background-repeat: no-repeat;
  background-position: center center;
  background-size: 55%;
  padding: 20px;
  position: relative;
}
#login-screen::before {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(245, 240, 232, 0.82);
}

.login-box {
  background: var(--white);
  border-radius: 20px;
  padding: 44px 40px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 10px 40px rgba(0,0,0,.12);
  position: relative;
  z-index: 1;
}

.login-logo {
  font-size: 26px;
  font-weight: 800;
  color: var(--dark);
  margin-bottom: 28px;
  overflow: hidden;
  height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-logo .dot, .sidebar-logo .dot { color: var(--brand); }

.logo-img         { height: 260px; width: auto; object-fit: contain; mix-blend-mode: multiply; }
.logo-img-sidebar { height: 110px; width: auto; object-fit: contain; } /* v26 */

.login-box h1   { font-size: 22px; font-weight: 800; margin-bottom: 6px; }
.login-sub      { color: var(--muted); font-size: 14px; margin-bottom: 28px; }

/* حقول الإدخال */
.field             { margin-bottom: 16px; }
.field label       { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.field input       { width: 100%; height: 44px; border: 1.5px solid var(--border); border-radius: 10px;
                     padding: 0 14px; font-family: 'Cairo', sans-serif; font-size: 14px;
                     color: var(--text); outline: none; transition: border-color .2s; }
.field input:focus { border-color: var(--brand); }

.pass-wrap         { position: relative; }
.pass-wrap input   { padding-left: 40px; }
.pass-wrap button  { position: absolute; left: 10px; top: 50%; transform: translateY(-50%);
                     background: none; border: none; cursor: pointer; color: var(--muted);
                     display: flex; align-items: center; padding: 0; }
.pass-wrap button:hover { color: var(--text); }

.forgot-btn { background: none; border: none; color: var(--muted); font-family: 'Cairo', sans-serif;
              font-size: 12px; cursor: pointer; padding: 0; text-decoration: underline; }
.forgot-btn:hover { color: var(--brand-dark); }

.login-row        { display: flex; align-items: center; justify-content: space-between;
                    margin-top: -4px; margin-bottom: 6px; }
.remember-label   { display: flex; align-items: center; gap: 6px; font-size: 13px;
                    color: var(--muted); cursor: pointer; }
.remember-label input { width: auto; height: auto; accent-color: var(--brand); cursor: pointer; }

.error-msg { background: #FEF2F2; border: 1px solid #FECACA; color: #DC2626;
             font-size: 13px; padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; }

/* ══════ أزرار ══════ */
.btn-primary {
  background: var(--brand); color: var(--dark); border: none;
  border-radius: 10px; height: 44px; padding: 0 20px;
  font-family: 'Cairo', sans-serif; font-size: 14px; font-weight: 700;
  cursor: pointer; transition: background .2s, transform .1s; display: inline-flex;
  align-items: center; justify-content: center; gap: 6px;
}
.btn-primary:hover  { background: var(--brand-dark); }
.btn-primary:active { transform: scale(.98); }

.btn-secondary {
  background: var(--white); color: var(--text); border: 1.5px solid var(--border);
  border-radius: 10px; height: 44px; padding: 0 20px;
  font-family: 'Cairo', sans-serif; font-size: 14px; font-weight: 600;
  cursor: pointer; transition: all .2s;
}
.btn-secondary:hover { border-color: var(--brand); color: var(--brand-dark); }

.btn-danger {
  background: #FEF2F2; color: #DC2626; border: none;
  border-radius: 8px; height: 36px; padding: 0 14px;
  font-family: 'Cairo', sans-serif; font-size: 13px; font-weight: 600;
  cursor: pointer; transition: background .2s;
}
.btn-danger:hover { background: #FEE2E2; }

.btn-sm { height: 36px; padding: 0 16px; font-size: 13px; border-radius: 9px; }

.btn-approve {
  background: #F0FDF4; color: #16A34A; border: 1.5px solid #BBF7D0;
  border-radius: 10px; height: 40px; padding: 0 20px;
  font-family: 'Cairo', sans-serif; font-size: 14px; font-weight: 700; cursor: pointer;
}
.btn-approve:hover { background: #DCFCE7; }

.btn-reject {
  background: #FEF2F2; color: #DC2626; border: 1.5px solid #FECACA;
  border-radius: 10px; height: 40px; padding: 0 20px;
  font-family: 'Cairo', sans-serif; font-size: 14px; font-weight: 700; cursor: pointer;
}
.btn-reject:hover { background: #FEE2E2; }

/* ══════ تخطيط التطبيق ══════ */
#app { display: flex; min-height: 100vh; width: 100%; max-width: 100vw; overflow: hidden; }

/* الشريط الجانبي */
#sidebar {
  width: var(--sidebar-w);
  background: var(--white);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  right: 0; top: 0; bottom: 0;
  z-index: 50;
  overflow: hidden;
  box-shadow: -2px 0 12px rgba(0,0,0,.06);
}

.sidebar-top  { flex: 1; padding: 0 14px 16px; overflow-y: auto; min-height: 0; }

.sidebar-logo {
  display: flex; align-items: center; justify-content: center;
  background: #ffffff;
  margin: 0 -14px 24px;
  padding: 26px 24px;
  border-bottom: 1px solid var(--border);
}

#sidebar-nav  { display: flex; flex-direction: column; gap: 3px; }

.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 12px; border-radius: 10px;
  color: var(--muted); text-decoration: none;
  font-size: 14px; font-weight: 500;
  transition: all .2s;
}
.nav-item svg    { flex-shrink: 0; }
.nav-item:hover  { background: var(--bg); color: var(--text); }
.nav-item.active { background: var(--brand-light); color: var(--brand-dark); font-weight: 700; }
.nav-item { position: relative; }
.nav-badge { position:absolute; top:6px; left:8px; min-width:18px; height:18px; background:#DC2626; color:#fff; border-radius:999px; font-size:11px; font-weight:700; display:flex; align-items:center; justify-content:center; padding:0 4px; }

.sidebar-bottom {
  padding: 14px;
  border-top: 1px solid var(--border);
}

.user-card  { display: flex; align-items: center; gap: 10px; padding: 10px 12px; margin-bottom: 8px; }
.user-info  { min-width: 0; }
.user-name  { color: var(--text); font-size: 13px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role  { color: var(--muted); font-size: 11px; margin-top: 1px; }

.logout-btn {
  display: flex; align-items: center; gap: 8px; width: 100%;
  padding: 10px 12px; background: none; border: none; border-radius: 10px;
  color: var(--muted); font-family: 'Cairo', sans-serif; font-size: 13px;
  font-weight: 500; cursor: pointer; transition: all .2s;
}
.logout-btn:hover { background: #FEF2F2; color: #EF4444; }

/* المحتوى الرئيسي */
#main-content {
  margin-right: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-width: 0;
  max-width: 100%;
}

#main-header {
  background: var(--white); border-bottom: 1px solid var(--border);
  padding: 16px 28px; display: flex; align-items: center;
  justify-content: space-between; position: sticky; top: 0; z-index: 40;
}
#page-title      { font-size: 18px; font-weight: 800; }
#header-actions  { display: flex; gap: 8px; }

.page-section { padding: 28px; flex: 1; }

/* Avatar */
.avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--brand); color: var(--dark);
  font-weight: 800; font-size: 15px;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.avatar-lg { width: 48px; height: 48px; font-size: 20px; }
.avatar-xl { width: 60px; height: 60px; font-size: 26px; }

/* ══════ بطاقات الإحصائيات ══════ */
#page-dashboard {
  position: relative;
  background: var(--bg);
}
#page-dashboard::before {
  content: '';
  position: fixed;
  top: 0;
  bottom: 0;
  right: var(--sidebar-w);
  left: 0;
  background-image: url('logo.svg');
  background-repeat: no-repeat;
  background-position: center center;
  background-size: 52%;
  opacity: 0.13;
  pointer-events: none;
  z-index: 0;
}
#page-dashboard > * {
  position: relative;
  z-index: 1;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--white); border-radius: var(--radius);
  border: 1px solid var(--border); padding: 20px 20px 20px 16px;
  display: flex; align-items: center; gap: 14px;
  box-shadow: var(--shadow); overflow: hidden; position: relative;
}

.stat-bar {
  width: 4px; height: 42px; border-radius: 4px; flex-shrink: 0;
}

.stat-num   { font-size: 30px; font-weight: 800; line-height: 1; color: var(--dark); }
.stat-label { font-size: 12px; color: var(--muted); margin-top: 4px; font-weight: 500; }

/* ══════ الشارات ══════ */
.badge {
  display: inline-flex; align-items: center;
  padding: 3px 11px; border-radius: 999px;
  font-size: 12px; font-weight: 600;
}
.badge-new       { background: var(--bg); color: var(--muted); }
.badge-review    { background: var(--bg); color: var(--muted); }
.badge-approved  { background: var(--bg); color: var(--muted); }
.badge-rejected  { background: var(--bg); color: var(--muted); }
.badge-admin     { background: var(--bg); color: var(--muted); }
.badge-return    { background: var(--bg); color: var(--muted); }
.badge-resubmit  { background: #EFF6FF; color: #1D4ED8; }
.badge-cancelled { background: #F3F4F6; color: #6B7280; }

/* ══════ الطلبات ══════ */
.req-tabs {
  display: flex; gap: 8px; margin-bottom: 18px;
}
.req-tab {
  padding: 7px 20px; border-radius: 20px; border: 1.5px solid var(--border);
  background: var(--white); color: var(--muted); font-family: 'Cairo', sans-serif;
  font-size: 13px; font-weight: 600; cursor: pointer; transition: all .18s;
}
.req-tab:hover { border-color: #CFC07B; color: #8C8082; }
.req-tab.active { background: #CFC07B; border-color: #CFC07B; color: #fff; }
.req-tab-urgent { border-color: #FECACA; color: #DC2626; }
.req-tab-urgent:hover { border-color: #DC2626; color: #DC2626; }
.req-tab-urgent.active { background: #DC2626; border-color: #DC2626; color: #fff; }

.requests-list { display: flex; flex-direction: column; gap: 12px; }

.request-card {
  background: var(--white); border-radius: var(--radius);
  border: 1px solid var(--border); padding: 16px 20px;
  display: flex; align-items: center; gap: 14px;
  cursor: pointer; transition: all .2s; box-shadow: var(--shadow);
}
.request-card:hover { box-shadow: var(--shadow-md); border-color: var(--brand); }

.req-abbr {
  width: 40px; height: 40px; border-radius: 10px;
  background: var(--brand-light); color: var(--brand-dark);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 800; flex-shrink: 0; letter-spacing: 0;
}

.req-info   { flex: 1; min-width: 0; }
.req-title  { font-size: 14px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.req-meta   { font-size: 12px; color: var(--muted); margin-top: 3px; }
.req-stage  { font-size: 11px; color: var(--brand); margin-top: 3px; font-weight: 500; }
.req-badge  { flex-shrink: 0; }

/* ══════ الموظفون ══════ */
.employees-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(255px, 1fr));
  gap: 16px;
}

.employee-card {
  background: var(--white); border-radius: var(--radius);
  border: 1px solid var(--border); padding: 20px;
  box-shadow: var(--shadow); transition: box-shadow .2s;
}
.employee-card:hover { box-shadow: var(--shadow-md); }

.emp-name   { font-size: 15px; font-weight: 700; margin-top: 12px; }
.emp-title  { font-size: 12px; color: var(--muted); margin-top: 2px; }

.emp-details { margin-top: 12px; display: flex; flex-direction: column; gap: 5px; }
.emp-details span { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 6px; }

.emp-actions { margin-top: 16px; display: flex; gap: 8px; }

/* ══════ الإعلانات ══════ */
.ann-card {
  background: var(--white); border-radius: var(--radius);
  border: 1px solid var(--border); border-right: 4px solid var(--brand);
  padding: 18px 20px; margin-bottom: 12px; box-shadow: var(--shadow);
}
.ann-card.important { border-right-color: #EF4444; }
.ann-title  { font-size: 14px; font-weight: 700; margin-bottom: 6px; }
.ann-body   { font-size: 13px; color: var(--muted); line-height: 1.8; }
.ann-meta   { font-size: 11px; color: #9CA3AF; margin-top: 10px; }

/* ══════ المودال ══════ */
#modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.45);
  display: flex; align-items: center; justify-content: center;
  z-index: 100; padding: 20px;
}

#modal-box {
  background: var(--white); border-radius: 18px;
  width: 100%; max-width: 520px;
  max-height: 90vh; overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,.2);
}

.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 24px 16px; border-bottom: 1px solid var(--border);
  position: sticky; top: 0; background: var(--white); z-index: 1;
}
.modal-header h3 { font-size: 16px; font-weight: 800; }
.modal-close {
  background: none; border: none; font-size: 18px; color: var(--muted);
  cursor: pointer; width: 30px; height: 30px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 6px; transition: background .2s;
}
.modal-close:hover { background: var(--bg); }

#modal-body { padding: 20px 24px 28px; }

/* حقول المودال */
.mfield             { margin-bottom: 14px; }
.mfield label       { display: block; font-size: 13px; font-weight: 600; margin-bottom: 5px; }
.mfield input,
.mfield select,
.mfield textarea    { width: 100%; border: 1.5px solid var(--border); border-radius: 10px;
                       padding: 9px 12px; font-family: 'Cairo', sans-serif; font-size: 14px;
                       color: var(--text); outline: none; background: var(--white); transition: border-color .2s; }
.mfield input:focus,
.mfield select:focus,
.mfield textarea:focus { border-color: var(--brand); }
.mfield textarea    { min-height: 90px; resize: vertical; line-height: 1.7; }
.mfield textarea::placeholder { color: #B8B8B8; font-size: 13px; line-height: 1.7; }
.file-upload-area { display:flex; align-items:center; gap:10px; border:1.5px dashed var(--border); border-radius:10px; padding:12px 14px; cursor:pointer; font-size:13px; color:var(--muted); background:var(--bg); transition:border-color .2s; }
.file-upload-area:hover { border-color:var(--brand); color:var(--text); }
.mfield textarea:focus::placeholder { opacity: 0.45; transition: opacity .25s; }

.form-row    { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.modal-foot  { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }

/* التفاصيل */
.detail-row   { display: flex; gap: 12px; margin-bottom: 12px; font-size: 14px; }
.detail-label { font-weight: 700; min-width: 130px; flex-shrink: 0; }
.detail-value { color: var(--muted); }
.approve-row  { display: flex; gap: 10px; margin-top: 20px; padding-top: 20px; border-top: 1px solid var(--border); }

/* ══════ timeline الطلب ══════ */
.timeline { margin: 20px 0 8px; padding-top: 16px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 0; }
.tl-item  { display: flex; gap: 12px; position: relative; padding-bottom: 16px; }
.tl-item:last-child { padding-bottom: 0; }
.tl-item:not(:last-child)::before {
  content: ''; position: absolute; right: 9px; top: 20px;
  width: 2px; bottom: 0; background: var(--border);
}
.tl-dot {
  width: 20px; height: 20px; border-radius: 50%; flex-shrink: 0;
  border: 2px solid var(--border); background: var(--white); margin-top: 1px;
}
.tl-done .tl-dot      { background: #16A34A; border-color: #16A34A; }
.tl-rejected .tl-dot  { background: #DC2626; border-color: #DC2626; }
.tl-pending .tl-dot   { background: var(--white); border-color: var(--brand); }
.tl-waiting .tl-dot   { background: var(--white); border-color: var(--border); }
.tl-cancelled .tl-dot { background: #9CA3AF; border-color: #9CA3AF; }
.tl-content { flex: 1; }
.tl-title   { font-size: 13px; font-weight: 700; color: var(--text); }
.tl-time    { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* فارغ */
.empty {
  text-align: center; padding: 56px 20px; color: var(--muted);
}
.empty p { font-size: 14px; font-weight: 600; margin-bottom: 16px; }

/* تحميل */
.loading-state {
  text-align: center; padding: 56px 20px; color: var(--muted);
}
.loading-spinner {
  width: 28px; height: 28px; border-radius: 50%;
  border: 3px solid var(--border); border-top-color: var(--brand);
  animation: spin .7s linear infinite;
  margin: 0 auto 14px;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-state p { font-size: 13px; margin: 0; }

/* الحساب */
.profile-card {
  background: var(--white); border-radius: var(--radius);
  border: 1px solid var(--border); padding: 28px;
  box-shadow: var(--shadow); max-width: 540px;
}
.profile-top   { display: flex; align-items: center; gap: 18px; margin-bottom: 24px; padding-bottom: 24px; border-bottom: 1px solid var(--border); }
.profile-name  { font-size: 20px; font-weight: 800; }
.profile-title { font-size: 13px; color: var(--muted); margin-top: 3px; }

/* قسم على الداش */
.section-label { font-size: 16px; font-weight: 800; margin-bottom: 16px; color: var(--text); }

/* ══════ شريط التنقل السفلي (جوال فقط) ══════ */
#bottom-nav {
  position: fixed; bottom: 0; right: 0; left: 0;
  background: var(--white); border-top: 1px solid var(--border);
  display: none; z-index: 50; padding-bottom: env(safe-area-inset-bottom);
  box-shadow: 0 -2px 12px rgba(0,0,0,.06);
}

/* فوتر الدعم */
#app-footer {
  text-align: center; padding: 14px 20px;
  font-size: 12px; color: var(--muted);
  border-top: 1px solid var(--border);
  background: var(--white);
  margin-top: auto;
}
#app-footer a { color: var(--brand-dark); font-weight: 600; text-decoration: none; }
#app-footer a:hover { text-decoration: underline; }

.bnav-item {
  flex: 1; display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 3px; padding: 8px 2px;
  color: var(--muted); text-decoration: none; font-size: 10px; font-weight: 600;
  transition: color .2s; min-width: 0;
}
.bnav-item span:last-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.bnav-item.active { color: var(--brand-dark); }
.bnav-item:hover  { color: var(--text); }

/* ══════ داشبورد — تحسينات ══════ */
.dash-welcome {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}
.dash-greeting { font-size: 22px; font-weight: 800; }
.dash-date     { font-size: 13px; color: var(--muted); margin-top: 2px; }
.quick-actions { display: flex; gap: 10px; flex-wrap: wrap; }

.dash-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 24px;
}

.dash-section {
  background: var(--white);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 20px;
  box-shadow: var(--shadow);
  margin-bottom: 20px;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.section-view-all {
  font-size: 12px; color: var(--brand-dark); cursor: pointer;
  font-weight: 600; background: none; border: none;
  font-family: 'Cairo', sans-serif; padding: 0;
}
.section-view-all:hover { text-decoration: underline; }

.dash-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.dash-table th {
  text-align: right; font-weight: 700; color: var(--muted); font-size: 11px;
  padding: 0 8px 10px; border-bottom: 1px solid var(--border);
}
.dash-table td { padding: 10px 8px; border-bottom: 1px solid var(--border); color: var(--text); vertical-align: middle; }
.dash-table tr:last-child td { border-bottom: none; }
.dash-table tr:hover td { background: var(--bg); }

.action-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 0; border-bottom: 1px solid var(--border);
  transition: background .15s;
}
.action-item:last-child { border-bottom: none; padding-bottom: 0; }
.action-info  { flex: 1; min-width: 0; }
.action-title { font-size: 13px; font-weight: 700; }
.action-meta  { font-size: 11px; color: var(--muted); margin-top: 2px; }
.action-btns  { display: flex; gap: 6px; flex-shrink: 0; }


.badge-urgent { background: #FFF7ED; color: #C2410C; }

/* ══════ الأرشيف ══════ */
.archive-filters {
  display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px;
}
.archive-filters input,
.archive-filters select {
  flex: 1 1 160px; height: 38px; border: 1.5px solid var(--border);
  border-radius: 9px; padding: 0 12px; font-size: 13px;
  font-family: 'Cairo', sans-serif; color: var(--text); background: var(--white);
}
.archive-filters input:focus,
.archive-filters select:focus {
  outline: none; border-color: var(--brand);
}
.date-range-label {
  display: flex; align-items: center; gap: 6px; flex: 1 1 160px;
}
.date-range-label span {
  font-size: 13px; color: var(--muted); white-space: nowrap;
}
.date-range-label input {
  flex: 1; height: 38px; border: 1.5px solid var(--border);
  border-radius: 9px; padding: 0 10px; font-size: 13px;
  font-family: 'Cairo', sans-serif; color: var(--text); background: var(--white);
}
.date-range-label input:focus { outline: none; border-color: var(--brand); }
.archive-range-badge {
  display: inline-block; background: #EFF6FF; color: #1D4ED8;
  border-radius: 8px; padding: 6px 14px; font-size: 13px;
  margin-bottom: 14px; border: 1px solid #BFDBFE;
}

/* ══════ صفحة الإحصائيات ══════ */
.stats-charts-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px;
}
.stats-chart-box {
  background: var(--white); border: 1px solid var(--border); border-radius: 14px;
  padding: 20px; display: flex; flex-direction: column; gap: 10px;
}
.stats-chart-title {
  font-size: 13px; font-weight: 700; color: var(--text); margin-bottom: 4px;
}
.sbar-row {
  display: flex; align-items: center; gap: 10px;
}
.sbar-label {
  min-width: 90px; font-size: 12px; color: var(--text); text-align: right; flex-shrink: 0;
}
.sbar-track {
  flex: 1; height: 10px; background: var(--border); border-radius: 5px; overflow: hidden;
}
.sbar-fill {
  height: 100%; border-radius: 5px; transition: width 0.4s;
}
.sbar-count {
  min-width: 28px; font-size: 12px; font-weight: 700; color: var(--muted); text-align: left;
}
.month-bars {
  display: flex; align-items: flex-end; gap: 8px; height: 130px; padding-top: 8px;
}
.month-bar-col {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px;
}
.month-bar-wrap {
  width: 100%; flex: 1; background: var(--border); border-radius: 4px 4px 0 0;
  display: flex; align-items: flex-end; overflow: hidden;
}
.month-bar-fill {
  width: 100%; border-radius: 4px 4px 0 0; transition: height 0.4s; min-height: 2px;
}
.month-bar-count { font-size: 11px; font-weight: 700; color: var(--text); }
.month-bar-label { font-size: 10px; color: var(--muted); }
.mini-stat {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  background: var(--bg); border-radius: 10px; padding: 10px 16px; min-width: 80px;
}
.mini-stat-num { font-size: 22px; font-weight: 800; color: var(--text); }
.mini-stat-label { font-size: 11px; color: var(--muted); }

.stat-card-urgent   { border-color: #FED7AA; }
.stat-card-approved { border-color: #BBF7D0; }
.stat-card-rejected { border-color: #FECACA; }
.stat-card-pending  { border-color: #FDE68A; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.stat-card   { animation: fadeIn .25s ease both; }
.dash-section { animation: fadeIn .3s ease both; }

/* Tooltip لشرح الأدوار */
.tooltip-wrap { position: relative; display: inline-flex; align-items: center; gap: 5px; width: 100%; }
.tooltip-wrap label { flex: 1; margin: 0; }
.tooltip-icon {
  width: 17px; height: 17px; border-radius: 50%;
  background: var(--border); color: var(--muted);
  font-size: 10px; font-weight: 800; font-style: normal;
  display: inline-flex; align-items: center; justify-content: center;
  cursor: help; flex-shrink: 0; user-select: none;
}
.tooltip-box {
  position: absolute; bottom: calc(100% + 6px); right: 0;
  background: var(--dark); color: #fff;
  font-size: 11px; line-height: 1.8;
  padding: 10px 13px; border-radius: 9px;
  width: 230px; opacity: 0; pointer-events: none;
  transition: opacity .18s; z-index: 200;
  text-align: right;
}
.tooltip-icon:hover .tooltip-box,
.tooltip-wrap:hover .tooltip-box { opacity: 1; }

/* إشعار النجاح */
.toast {
  position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: #fff; color: #1a1a1a; border: 1.5px solid #e5e0d5;
  padding: 13px 24px; border-radius: 12px;
  font-size: 14px; font-weight: 600; white-space: nowrap;
  box-shadow: 0 8px 24px rgba(0,0,0,.18);
  z-index: 9999; opacity: 0; transition: opacity .25s, transform .25s;
  pointer-events: none;
}
.toast.show {
  opacity: 1; transform: translateX(-50%) translateY(0);
}
.toast.hidden { display: none; }

/* رقم الطلب */
.req-num {
  font-size: 11px; font-weight: 700; color: var(--brand-dark);
  background: var(--brand-light); padding: 2px 7px; border-radius: 5px;
  letter-spacing: 0.5px; font-family: monospace;
}
.req-num-banner {
  text-align: center; font-size: 13px; font-weight: 800;
  color: var(--brand-dark); background: var(--brand-light);
  border: 1.5px solid var(--brand); border-radius: 10px;
  padding: 10px 0; letter-spacing: 1px; font-family: monospace;
  margin-bottom: 14px;
}
.stage-banner {
  background: #EFF6FF; border: 1.5px solid #BFDBFE;
  border-radius: 8px; padding: 10px 14px;
  font-size: 13px; color: #1e40af; font-weight: 600;
  margin-bottom: 14px; text-align: center;
}

/* ملاحظة المالية */
.finance-note {
  background: #FFFBEB; border: 1px solid #FDE68A; border-radius: 8px;
  padding: 10px 14px; font-size: 12px; color: #92400E;
  margin-top: 8px; line-height: 1.8;
}

/* خيار عاجل */
.urgent-toggle {
  display: flex; align-items: center; gap: 8px; cursor: pointer;
  padding: 10px 14px; border: 1.5px solid var(--border);
  border-radius: 10px; font-size: 14px; transition: all .2s;
  font-weight: 600; width: 100%; margin: 0;
}
.urgent-toggle:has(input:checked) {
  border-color: #F97316; background: #FFF7ED; color: #C2410C;
}

/* ══════ الإشعارات ══════ */
.header-right {
  display: flex; align-items: center; gap: 10px;
}

.notif-wrap { position: relative; }

.notif-bell {
  background: none; border: none; cursor: pointer;
  width: 38px; height: 38px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 10px; color: var(--text); position: relative;
  transition: background .15s;
}
.notif-bell:hover { background: var(--border); }

.notif-badge {
  position: absolute; top: 3px; right: 3px;
  background: #DC2626; color: #fff;
  border-radius: 999px; font-size: 10px; font-weight: 700;
  min-width: 16px; height: 16px;
  display: flex; align-items: center; justify-content: center;
  padding: 0 3px; line-height: 1;
}

.notif-panel {
  position: absolute; top: calc(100% + 8px); left: 0;
  width: 300px; max-height: 380px;
  background: #fff; border-radius: 14px;
  border: 1.5px solid var(--border);
  box-shadow: 0 8px 30px rgba(0,0,0,.13);
  z-index: 500; overflow: hidden;
  display: flex; flex-direction: column;
}

.notif-panel-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 16px; border-bottom: 1px solid var(--border);
  font-weight: 700; font-size: 14px; flex-shrink: 0;
}
.notif-panel-head button {
  font-size: 12px; color: var(--brand-dark); background: none;
  border: none; cursor: pointer; font-weight: 600; font-family: inherit;
}

#notif-list { overflow-y: auto; }

.notif-item {
  padding: 12px 16px; border-bottom: 1px solid var(--border);
  cursor: pointer; transition: background .15s;
}
.notif-item:last-child { border-bottom: none; }
.notif-item:hover { background: var(--bg); }
.notif-item.unread { background: #FFFBEB; }
.notif-item.unread:hover { background: #FFF3CD; }

.notif-msg { font-size: 13px; line-height: 1.6; font-weight: 500; }
.notif-item.unread .notif-msg { font-weight: 700; }
.notif-date { font-size: 11px; color: var(--muted); margin-top: 4px; }

.notif-empty {
  padding: 36px 16px; text-align: center;
  color: var(--muted); font-size: 13px;
}

/* ══════ الاستجابة للشاشات الصغيرة ══════ */
@media (max-width: 640px) {
  :root { --sidebar-w: 0px; }

  #sidebar      { display: none; }
  #bottom-nav   { display: flex !important; }
  #app-footer   { display: block; font-size: 11px; padding: 10px 16px 16px; margin-top: 0; }
  #main-content { margin-right: 0 !important; padding-bottom: 80px; }
  #page-content { }

  .stats-grid   { grid-template-columns: 1fr 1fr; }
  .form-row     { grid-template-columns: 1fr; }
  .page-section { padding: 12px; }
  .dash-grid    { grid-template-columns: 1fr; }
  .dash-greeting { font-size: 15px; }
  .dash-welcome { flex-direction: column; gap: 10px; }
  .quick-actions { display: flex; gap: 8px; width: 100%; }
  .quick-actions .btn-primary,
  .quick-actions .btn-secondary { flex: 1; justify-content: center; }

  /* الهيدر */
  #main-header { padding: 10px 14px; gap: 6px; min-height: 0; }
  #main-header h2 { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; }
  .header-right { gap: 6px; flex-shrink: 0; }
  .btn-sm { height: 30px; padding: 0 10px; font-size: 12px; }

  /* التبويبات — سكرول أفقي */
  .req-tabs {
    overflow-x: auto; flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .req-tabs::-webkit-scrollbar { display: none; }
  .req-tab { white-space: nowrap; flex-shrink: 0; padding: 6px 14px; font-size: 12px; }

  /* المودال — وسط الشاشة على الجوال */
  #modal-overlay { padding: 12px !important; align-items: center !important; }
  #modal-box {
    width: 100% !important; max-width: 100% !important;
    border-radius: 16px !important;
    max-height: 90vh !important;
    overflow-y: auto !important;
  }
  #modal-body { padding: 14px 16px 24px; }
  .modal-header { padding: 14px 16px 12px; }
  .mfield label { font-size: 13px; }
  .mfield input, .mfield select, .mfield textarea { font-size: 14px; }

  /* الجدول في الداشبورد */
  .dash-table { font-size: 12px; }
  .dash-table th:nth-child(2),
  .dash-table td:nth-child(2) { display: none; }
  .dash-table th:nth-child(4),
  .dash-table td:nth-child(4) { display: none; }
  .dash-section { overflow-x: hidden; }

  /* بطاقات الطلبات */
  .req-meta { font-size: 11px; flex-wrap: wrap; }
  .req-badge { max-width: 120px; }

  /* تفاصيل الطلب */
  .detail-label { min-width: 100px; font-size: 13px; }
  .detail-value { font-size: 13px; word-break: break-word; }

  /* أزرار الإجراء — تلتف لو ضيقت */
  .approve-row { flex-wrap: wrap; }
  .approve-row button { flex: 1 1 auto; min-width: 80px; }

  /* "تحتاج إجراء" في الداشبورد — الأزرار تنزل للسطر الثاني */
  .action-item { flex-wrap: wrap; }
  .action-btns { width: 100%; justify-content: flex-end; margin-top: 6px; }

  /* حقل التعليقات — عمودي على الجوال */
  .comment-input-row { flex-direction: column; }
  .comment-input-row textarea { min-height: 50px; }
  .comment-input-row .btn-primary { align-self: flex-end; min-width: 80px; }

  /* لوحة الإشعارات */
  .notif-panel {
    position: fixed !important;
    top: 58px !important;
    right: 14px !important;
    left: 14px !important;
    width: auto !important;
  }

  /* إحصائيات — عمود واحد */
  .stats-charts-grid { grid-template-columns: 1fr; }

  /* بطاقات الإحصائيات الرئيسية */
  .stat-card { padding: 14px 14px 14px 10px; gap: 10px; }
  .stat-num  { font-size: 24px; }

  /* تأكد كل شيء داخل الشاشة */
  .page-section, .dash-section, .stat-card, .request-card, .profile-card { max-width: 100%; }
  img, svg { max-width: 100%; }

  /* iOS fix: منع التكبير التلقائي عند الضغط على حقول الإدخال */
  input, select, textarea { font-size: 16px !important; }

  /* تصغير الأزرار على الجوال */
  .btn-primary, .btn-secondary { height: 38px; padding: 0 14px; font-size: 13px; }
  .btn-approve, .btn-reject    { height: 36px; padding: 0 12px; font-size: 13px; }
  .btn-sm { height: 28px; padding: 0 10px; font-size: 12px; }
}

/* ══════ الوضع المظلم ══════ */
[data-theme="dark"] {
  --bg:     #111827;
  --white:  #1F2937;
  --text:   #F3F4F6;
  --muted:  #9CA3AF;
  --border: #374151;
  --dark:   #F9FAFB;
  --brand-light: #2D2A1E;
}
[data-theme="dark"] body            { background: var(--bg); }
[data-theme="dark"] .login-logo    { background: #F5F0E8; border-radius: 14px; }
[data-theme="dark"] .logo-img      { mix-blend-mode: normal; }
[data-theme="dark"] #sidebar        { background: #1F2937; border-color: #374151; }
[data-theme="dark"] .sidebar-logo   { background: #F5F0E8; border-color: #374151; }
[data-theme="dark"] #main-header    { background: #1F2937; border-color: #374151; }
[data-theme="dark"] .request-card   { background: #1F2937; border-color: #374151; }
[data-theme="dark"] .dash-section   { background: #1F2937; border-color: #374151; }
[data-theme="dark"] .stat-card      { background: #1F2937; border-color: #374151; }
[data-theme="dark"] #modal-overlay  { background: rgba(0,0,0,.7); }
[data-theme="dark"] #modal-box      { background: #1F2937; border-color: #374151; }
[data-theme="dark"] .mfield input,
[data-theme="dark"] .mfield select,
[data-theme="dark"] .mfield textarea { background: #111827; color: #F3F4F6; border-color: #374151; }
[data-theme="dark"] .notif-panel    { background: #1F2937; border-color: #374151; }
[data-theme="dark"] .notif-item     { border-color: #374151; }
[data-theme="dark"] .login-box      { background: #1F2937; }
[data-theme="dark"] #login-screen   { background-color: #111827; }
[data-theme="dark"] .user-card      { border-color: #374151; }
[data-theme="dark"] .dash-table thead tr { background: #111827; }
[data-theme="dark"] .dash-table tbody tr:hover { background: #374151; }
[data-theme="dark"] .action-item    { background: #111827; border-color: #374151; }
[data-theme="dark"] .file-upload-area { background: #111827; border-color: #374151; }
[data-theme="dark"] #bottom-nav     { background: #1F2937; border-color: #374151; }
[data-theme="dark"] .bnav-item      { color: #9CA3AF; }
[data-theme="dark"] .bnav-item.active { color: var(--brand); }

/* زر التبديل */
.dark-toggle { background:none; border:none; cursor:pointer; width:36px; height:36px; border-radius:10px; display:flex; align-items:center; justify-content:center; color:var(--text); transition:background .15s; }
.dark-toggle:hover { background: var(--border); }

/* ══════ تعليقات الطلب ══════ */
.comments-section { margin-top: 20px; border-top: 1px solid var(--border); padding-top: 16px; }
.comments-section h4 { font-size: 13px; font-weight: 700; color: var(--muted); margin-bottom: 12px; }
.comment-item { display:flex; gap:10px; margin-bottom:12px; }
.comment-avatar { width:32px; height:32px; border-radius:50%; background:var(--brand); color:#fff; display:flex; align-items:center; justify-content:center; font-size:13px; font-weight:700; flex-shrink:0; }
.comment-bubble { flex:1; background:var(--bg); border-radius:10px; padding:10px 12px; border:1px solid var(--border); }
.comment-meta { font-size:11px; color:var(--muted); margin-bottom:4px; }
.comment-text { font-size:13px; color:var(--text); line-height:1.7; }
.comment-input-row { display:flex; gap:8px; margin-top:12px; }
.comment-input-row textarea { flex:1; border:1.5px solid var(--border); border-radius:10px; padding:9px 12px; font-family:'Cairo',sans-serif; font-size:13px; resize:none; min-height:60px; background:var(--white); color:var(--text); }
.comment-input-row textarea:focus { outline:none; border-color:var(--brand); }

/* ══════ حقول التاريخ — أرقام إنجليزية دائماً ══════ */
input[type="date"] { font-family: Arial, sans-serif !important; }

/* ══════ تاريخ الاستحقاق ══════ */
.due-badge { display:inline-flex; align-items:center; gap:4px; font-size:11px; font-weight:600; padding:2px 8px; border-radius:999px; }
.due-badge-ok      { background:#F0FDF4; color:#16A34A; }
.due-badge-soon    { background:#FEF9EC; color:#D97706; }
.due-badge-overdue { background:#FEF2F2; color:#DC2626; }

/* ══════ طباعة PDF ══════ */
@media print {
  #sidebar, #bottom-nav, #main-header, #page-content, #login-screen,
  .modal-close, .action-btns, .approve-row, #return-section, .modal-foot,
  #app-footer, .no-print, .comments-section { display:none !important; }
  #main-content { margin:0 !important; padding:0 !important; }
  #modal-overlay { position:static !important; background:none !important; display:block !important; }
  #modal-box { box-shadow:none !important; border:none !important; max-height:none !important; overflow:visible !important; width:100% !important; max-width:100% !important; padding:0 !important; }
  body { background:#fff !important; color:#000 !important; }
}
