/* ===========================================================================
   نظام إدارة المهام اللوجستية — التصميم (عربي RTL)
   =========================================================================== */

:root {
  --bg: #f1f5f9;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --text: #0f172a;
  --muted: #64748b;
  --muted-2: #94a3b8;
  --border: #e2e8f0;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-soft: #eff6ff;

  --sidebar-bg: #1e293b;
  --sidebar-bg-2: #0f172a;
  --sidebar-text: #cbd5e1;
  --sidebar-muted: #64748b;

  /* ألوان الحالات */
  --pending-bg: #fef3c7;  --pending-tx: #92400e;  --pending-bd: #fcd34d; --pending: #f59e0b;
  --progress-bg: #dbeafe; --progress-tx: #1e40af; --progress-bd: #93c5fd; --progress: #3b82f6;
  --done-bg: #dcfce7;     --done-tx: #166534;     --done-bd: #86efac;     --done: #16a34a;
  --overdue-bg: #fee2e2;  --overdue-tx: #991b1b;  --overdue-bd: #fca5a5;  --overdue: #dc2626;

  /* الأولويات */
  --prio-low: #64748b; --prio-medium: #3b82f6; --prio-high: #ea580c; --prio-urgent: #dc2626;

  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 3px rgba(15,23,42,.08), 0 1px 2px rgba(15,23,42,.04);
  --shadow-md: 0 4px 16px rgba(15,23,42,.10);
  --shadow-lg: 0 10px 30px rgba(15,23,42,.14);
}

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

html, body { height: 100%; }

body {
  font-family: 'Tajawal', 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
}

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

.icon { width: 20px; height: 20px; flex: 0 0 auto; }

/* ===========================  التخطيط  ============================= */
.layout { display: flex; min-height: 100vh; }

.sidebar {
  width: 260px;
  flex: 0 0 260px;
  background: linear-gradient(180deg, var(--sidebar-bg), var(--sidebar-bg-2));
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 18px 14px;
  z-index: 40;
}

.brand { display: flex; align-items: center; gap: 12px; padding: 8px 8px 20px; }
.brand-logo {
  width: 42px; height: 42px; border-radius: 12px;
  background: var(--primary); display: grid; place-items: center; font-size: 20px;
  box-shadow: 0 4px 12px rgba(37,99,235,.4);
}
.brand-name { font-weight: 800; font-size: 16px; color: #fff; line-height: 1.3; }

.nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.sidebar-foot { display: flex; flex-direction: column; gap: 4px; padding-top: 14px;
  border-top: 1px solid rgba(255,255,255,.08); }

.nav-link {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 14px; border-radius: var(--radius-sm);
  color: var(--sidebar-text); font-weight: 500; font-size: 14.5px;
  transition: all .15s ease; white-space: nowrap;
}
.nav-link:hover { background: rgba(255,255,255,.07); color: #fff; }
.nav-link.active { background: var(--primary); color: #fff; box-shadow: 0 4px 12px rgba(37,99,235,.35); }
.nav-link .icon { width: 19px; height: 19px; }

.sidebar-overlay {
  display: none; position: fixed; inset: 0; background: rgba(15,23,42,.5); z-index: 35;
}

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

/* ===========================  الشريط العلوي  ============================= */
.topbar {
  position: sticky; top: 0; z-index: 30;
  background: rgba(255,255,255,.85); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 16px;
  padding: 12px 22px; min-height: 64px;
}
.page-title { font-size: 19px; font-weight: 700; flex: 1; }

.icon-btn {
  background: transparent; border: none; cursor: pointer; color: var(--muted);
  width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center;
  transition: all .15s;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.menu-btn { display: none; }

.topbar-actions { display: flex; align-items: center; gap: 12px; }

.notif-wrap { position: relative; }
.notif-btn { position: relative; }
.notif-badge {
  position: absolute; top: 2px; left: 2px;
  background: var(--overdue); color: #fff; font-size: 11px; font-weight: 700;
  min-width: 18px; height: 18px; border-radius: 9px; padding: 0 5px;
  display: grid; place-items: center; border: 2px solid var(--surface);
}
.notif-badge.hidden { display: none; }

.notif-dropdown {
  position: absolute; left: 0; top: 50px; width: 340px; max-width: 90vw;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-lg);
  overflow: hidden; display: none; z-index: 50;
}
.notif-dropdown.open { display: block; animation: pop .15s ease; }
@keyframes pop { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
.notif-dd-head { display: flex; justify-content: space-between; align-items: center;
  padding: 14px 16px; border-bottom: 1px solid var(--border); font-weight: 700; }
.notif-dd-head a { color: var(--primary); font-size: 13px; font-weight: 500; }
.notif-dd-list { max-height: 380px; overflow-y: auto; }
.notif-item {
  display: block; padding: 12px 16px; border-bottom: 1px solid var(--border);
  transition: background .15s;
}
.notif-item:hover { background: var(--surface-2); }
.notif-item.unread { background: var(--primary-soft); }
.notif-item .ni-title { font-weight: 700; font-size: 13.5px; }
.notif-item .ni-msg { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.notif-item .ni-time { color: var(--muted-2); font-size: 11.5px; margin-top: 4px; }
.notif-empty { padding: 26px 16px; text-align: center; color: var(--muted); font-size: 13px; }

.user-chip { display: flex; align-items: center; gap: 10px; padding-right: 6px; }
.user-avatar {
  width: 40px; height: 40px; border-radius: 12px; background: var(--primary);
  color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 17px;
}
.user-meta { display: flex; flex-direction: column; line-height: 1.25; }
.user-meta strong { font-size: 14px; }
.user-meta small { color: var(--muted); font-size: 12px; }

/* ===========================  المحتوى  ============================= */
.content { padding: 24px; max-width: 1400px; width: 100%; margin: 0 auto; }

.page-head { display: flex; align-items: center; justify-content: space-between;
  gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head h2 { font-size: 22px; font-weight: 800; }
.page-head .sub { color: var(--muted); font-size: 14px; margin-top: 2px; }

/* ===========================  الرسائل  ============================= */
.flash-area { display: flex; flex-direction: column; gap: 10px; margin-bottom: 18px; }
.flash { padding: 13px 18px; border-radius: var(--radius-sm); font-weight: 500;
  border: 1px solid transparent; animation: pop .2s ease; }
.flash-success { background: var(--done-bg); color: var(--done-tx); border-color: var(--done-bd); }
.flash-error { background: var(--overdue-bg); color: var(--overdue-tx); border-color: var(--overdue-bd); }
.flash-info { background: var(--progress-bg); color: var(--progress-tx); border-color: var(--progress-bd); }

/* ===========================  البطاقات  ============================= */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px;
}
.card-title { font-size: 16px; font-weight: 700; margin-bottom: 16px;
  display: flex; align-items: center; gap: 8px; }
.card-title .icon { color: var(--primary); }

/* بطاقات الإحصائيات */
.stats-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px; margin-bottom: 22px;
}
.stat-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: 6px; position: relative; overflow: hidden;
}
.stat-card .stat-ic {
  position: absolute; left: 14px; top: 14px; width: 40px; height: 40px;
  border-radius: 11px; display: grid; place-items: center; opacity: .9;
}
.stat-card .stat-ic .icon { width: 22px; height: 22px; }
.stat-value { font-size: 30px; font-weight: 800; line-height: 1.1; }
.stat-label { color: var(--muted); font-size: 13.5px; font-weight: 500; }
.stat-card.accent-total .stat-ic { background: var(--primary-soft); color: var(--primary); }
.stat-card.accent-pending .stat-ic { background: var(--pending-bg); color: var(--pending-tx); }
.stat-card.accent-progress .stat-ic { background: var(--progress-bg); color: var(--progress-tx); }
.stat-card.accent-done .stat-ic { background: var(--done-bg); color: var(--done-tx); }
.stat-card.accent-overdue .stat-ic { background: var(--overdue-bg); color: var(--overdue-tx); }
.stat-card.accent-rate .stat-ic { background: #f3e8ff; color: #7e22ce; }
.stat-card.accent-time .stat-ic { background: #ccfbf1; color: #0f766e; }

/* ===========================  الشارات  ============================= */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 11px; border-radius: 999px; font-size: 12.5px; font-weight: 700;
  border: 1px solid transparent; white-space: nowrap;
}
.badge .icon { width: 13px; height: 13px; }
.status-pending { background: var(--pending-bg); color: var(--pending-tx); border-color: var(--pending-bd); }
.status-progress { background: var(--progress-bg); color: var(--progress-tx); border-color: var(--progress-bd); }
.status-done { background: var(--done-bg); color: var(--done-tx); border-color: var(--done-bd); }
.status-overdue { background: var(--overdue-bg); color: var(--overdue-tx); border-color: var(--overdue-bd); }

.badge.prio { font-size: 12px; padding: 3px 10px; }
.prio-low { background: #f1f5f9; color: var(--prio-low); border-color: #e2e8f0; }
.prio-medium { background: #eff6ff; color: var(--prio-medium); border-color: #bfdbfe; }
.prio-high { background: #fff7ed; color: var(--prio-high); border-color: #fed7aa; }
.prio-urgent { background: #fef2f2; color: var(--prio-urgent); border-color: #fecaca; }

.meta-chip { display: inline-flex; align-items: center; gap: 5px; color: var(--muted);
  font-size: 12.5px; font-weight: 500; }
.meta-chip .icon { width: 14px; height: 14px; }
.meta-chip.danger { color: var(--overdue); font-weight: 700; }

/* ===========================  الأزرار  ============================= */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 18px; border-radius: var(--radius-sm); border: 1px solid transparent;
  font-family: inherit; font-size: 14.5px; font-weight: 700; cursor: pointer;
  transition: all .15s ease; background: var(--surface); color: var(--text);
  border-color: var(--border);
}
.btn:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.btn:active { transform: none; }
.btn .icon { width: 18px; height: 18px; }
.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); }
.btn-success { background: var(--done); color: #fff; border-color: var(--done); }
.btn-danger { background: var(--overdue); color: #fff; border-color: var(--overdue); }
.btn-ghost { background: transparent; }
.btn-sm { padding: 7px 13px; font-size: 13px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; box-shadow: none; }

/* ===========================  النماذج  ============================= */
.form-grid { display: grid; gap: 18px; }
.field { display: flex; flex-direction: column; gap: 7px; }
.field label { font-weight: 700; font-size: 14px; }
.field .hint { color: var(--muted); font-size: 12.5px; }
.input, .select, .textarea {
  width: 100%; padding: 11px 14px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); font-family: inherit; font-size: 14.5px;
  background: var(--surface); color: var(--text); transition: border .15s, box-shadow .15s;
}
.input:focus, .select:focus, .textarea:focus {
  outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}
.textarea { resize: vertical; min-height: 110px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.form-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 6px; }

/* اختيار الأولوية */
.prio-select { display: flex; gap: 10px; flex-wrap: wrap; }
.prio-select input { position: absolute; opacity: 0; }
.prio-select label {
  padding: 9px 16px; border-radius: 999px; border: 2px solid var(--border);
  cursor: pointer; font-weight: 700; font-size: 13.5px; transition: all .15s;
}
.prio-select input:checked + label { color: #fff; }
.prio-select input[value=low]:checked + label { background: var(--prio-low); border-color: var(--prio-low); }
.prio-select input[value=medium]:checked + label { background: var(--prio-medium); border-color: var(--prio-medium); }
.prio-select input[value=high]:checked + label { background: var(--prio-high); border-color: var(--prio-high); }
.prio-select input[value=urgent]:checked + label { background: var(--prio-urgent); border-color: var(--prio-urgent); }

/* رفع الملفات */
.file-drop {
  border: 2px dashed var(--border); border-radius: var(--radius); padding: 22px;
  text-align: center; cursor: pointer; transition: all .15s; background: var(--surface-2);
}
.file-drop:hover { border-color: var(--primary); background: var(--primary-soft); }
.file-drop .icon { width: 32px; height: 32px; color: var(--muted); margin-bottom: 8px; }
.file-drop input { display: none; }
.file-preview { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.file-preview img { width: 80px; height: 80px; object-fit: cover; border-radius: 10px;
  border: 1px solid var(--border); }

/* ===========================  شريط الفلاتر  ============================= */
.filters {
  display: flex; gap: 12px; flex-wrap: wrap; align-items: center;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px 16px; margin-bottom: 20px;
  box-shadow: var(--shadow);
}
.search-box { position: relative; flex: 1; min-width: 200px; }
.search-box .icon { position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  color: var(--muted-2); width: 18px; height: 18px; }
.search-box input { padding-right: 40px; }
.filters .select { width: auto; min-width: 130px; }

/* ===========================  شبكة المهام  ============================= */
.task-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px;
}
.task-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px 18px; box-shadow: var(--shadow); display: flex; flex-direction: column;
  gap: 10px; transition: all .18s ease; border-right: 4px solid var(--border);
}
.task-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.task-card.is-overdue { border-right-color: var(--overdue); }
.prio-border-low { border-right-color: var(--prio-low); }
.prio-border-medium { border-right-color: var(--prio-medium); }
.prio-border-high { border-right-color: var(--prio-high); }
.prio-border-urgent { border-right-color: var(--prio-urgent); }
.task-card-head { display: flex; justify-content: space-between; align-items: center; }
.task-num { color: var(--muted); font-weight: 700; font-size: 13px; }
.task-card-title { font-size: 16px; font-weight: 700; }
.task-card-desc { color: var(--muted); font-size: 13.5px; }
.task-card-foot { display: flex; justify-content: space-between; align-items: center;
  gap: 8px; margin-top: auto; }

.empty-state { text-align: center; padding: 60px 20px; color: var(--muted); }
.empty-state .icon { width: 56px; height: 56px; color: var(--muted-2); margin-bottom: 14px; }
.empty-state h3 { font-size: 18px; color: var(--text); margin-bottom: 6px; }

/* ===========================  تفاصيل المهمة  ============================= */
.detail-layout { display: grid; grid-template-columns: 1fr 320px; gap: 22px; align-items: start; }
.detail-main { display: flex; flex-direction: column; gap: 20px; }
.detail-side { display: flex; flex-direction: column; gap: 20px; position: sticky; top: 84px; }
.detail-header { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.detail-header h2 { font-size: 24px; font-weight: 800; flex: 1; min-width: 200px; }
.detail-desc { white-space: pre-wrap; color: #334155; line-height: 1.8; }

.info-list { display: flex; flex-direction: column; gap: 2px; }
.info-row { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0;
  border-bottom: 1px dashed var(--border); font-size: 14px; }
.info-row:last-child { border-bottom: none; }
.info-row .k { color: var(--muted); font-weight: 500; }
.info-row .v { font-weight: 700; text-align: left; }

.gallery { display: flex; flex-wrap: wrap; gap: 12px; }
.gallery a { display: block; }
.gallery img { width: 130px; height: 130px; object-fit: cover; border-radius: 12px;
  border: 1px solid var(--border); cursor: zoom-in; transition: transform .15s; }
.gallery img:hover { transform: scale(1.03); box-shadow: var(--shadow-md); }
.gallery .att-file {
  display: flex; align-items: center; gap: 8px; padding: 10px 14px; background: var(--surface-2);
  border: 1px solid var(--border); border-radius: 10px; font-size: 13.5px; font-weight: 600;
}

/* الجدول الزمني */
.timeline { display: flex; flex-direction: column; gap: 0; }
.tl-item { display: flex; gap: 12px; padding-bottom: 18px; position: relative; }
.tl-item:not(:last-child)::before { content: ''; position: absolute; right: 9px; top: 22px;
  bottom: 0; width: 2px; background: var(--border); }
.tl-dot { width: 20px; height: 20px; border-radius: 50%; background: var(--primary);
  flex: 0 0 auto; display: grid; place-items: center; z-index: 1; }
.tl-dot.done { background: var(--done); }
.tl-dot.muted { background: var(--muted-2); }
.tl-dot .icon { width: 11px; height: 11px; color: #fff; }
.tl-body .tl-t { font-weight: 700; font-size: 14px; }
.tl-body .tl-d { color: var(--muted); font-size: 12.5px; }

/* التعليقات */
.comment { display: flex; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--border); }
.comment:last-child { border-bottom: none; }
.comment .c-avatar { width: 38px; height: 38px; border-radius: 11px; flex: 0 0 auto;
  display: grid; place-items: center; font-weight: 700; color: #fff; background: var(--primary); }
.comment.role-employee .c-avatar { background: var(--done); }
.comment .c-body { flex: 1; }
.comment .c-head { display: flex; gap: 10px; align-items: center; margin-bottom: 3px; }
.comment .c-name { font-weight: 700; font-size: 14px; }
.comment .c-time { color: var(--muted-2); font-size: 12px; }
.comment .c-text { color: #334155; font-size: 14px; white-space: pre-wrap; }

/* التقييم بالنجوم */
.stars { display: inline-flex; gap: 3px; direction: ltr; }
.stars .icon { width: 18px; height: 18px; color: #d1d5db; }
.stars .icon.filled { color: #f59e0b; fill: #f59e0b; }
.rate-input { display: inline-flex; flex-direction: row-reverse; gap: 4px; }
.rate-input input { display: none; }
.rate-input label { cursor: pointer; color: #d1d5db; }
.rate-input label .icon { width: 28px; height: 28px; }
.rate-input input:checked ~ label .icon,
.rate-input label:hover .icon, .rate-input label:hover ~ label .icon { color: #f59e0b; fill: #f59e0b; }

/* ===========================  الجداول  ============================= */
.table-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--border); }
table.data { width: 100%; border-collapse: collapse; background: var(--surface); font-size: 14px; }
table.data th { background: var(--surface-2); text-align: right; padding: 13px 16px;
  font-weight: 700; color: var(--muted); font-size: 13px; border-bottom: 1px solid var(--border); white-space: nowrap; }
table.data td { padding: 13px 16px; border-bottom: 1px solid var(--border); }
table.data tr:last-child td { border-bottom: none; }
table.data tbody tr { transition: background .12s; }
table.data tbody tr:hover { background: var(--surface-2); }

/* ===========================  التقويم  ============================= */
.cal-head { display: flex; align-items: center; justify-content: center; gap: 18px; margin-bottom: 18px; }
.cal-head h2 { font-size: 20px; font-weight: 800; min-width: 180px; text-align: center; }
.calendar { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; }
.cal-wd { text-align: center; font-weight: 700; color: var(--muted); padding: 8px 0; font-size: 13px; }
.cal-day { background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  min-height: 96px; padding: 8px; display: flex; flex-direction: column; gap: 4px; }
.cal-day.empty { background: transparent; border: none; }
.cal-day.today { border-color: var(--primary); box-shadow: 0 0 0 2px rgba(37,99,235,.18); }
.cal-day .cd-num { font-weight: 700; font-size: 13px; color: var(--muted); }
.cal-day.today .cd-num { color: var(--primary); }
.cal-task { font-size: 11.5px; padding: 3px 7px; border-radius: 6px; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ===========================  الإشعارات (صفحة)  ============================= */
.notif-page-item { display: flex; gap: 14px; padding: 16px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
  align-items: flex-start; }
.notif-page-item.unread { border-right: 4px solid var(--primary); }
.notif-ic { width: 42px; height: 42px; border-radius: 12px; flex: 0 0 auto; display: grid;
  place-items: center; background: var(--primary-soft); color: var(--primary); }
.wa-status { font-size: 11px; padding: 2px 8px; border-radius: 999px; font-weight: 700; }
.wa-sent { background: var(--done-bg); color: var(--done-tx); }
.wa-pending { background: var(--pending-bg); color: var(--pending-tx); }
.wa-failed { background: var(--overdue-bg); color: var(--overdue-tx); }
.wa-skipped { background: #f1f5f9; color: var(--muted); }

/* ===========================  تسجيل الدخول  ============================= */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px;
  background: linear-gradient(135deg, #1e293b, #2563eb); }
.login-card { background: var(--surface); border-radius: 20px; box-shadow: var(--shadow-lg);
  padding: 40px; width: 100%; max-width: 410px; }
.login-card .brand { justify-content: center; padding: 0 0 8px; }
.login-card h1 { text-align: center; font-size: 22px; margin-bottom: 4px; }
.login-card .sub { text-align: center; color: var(--muted); margin-bottom: 26px; font-size: 14px; }
.login-hint { margin-top: 18px; padding: 12px 14px; background: var(--surface-2);
  border-radius: 10px; font-size: 12.5px; color: var(--muted); text-align: center; }

/* ===========================  مساعدات  ============================= */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.section-gap { display: flex; flex-direction: column; gap: 22px; }
.muted { color: var(--muted); }
.text-center { text-align: center; }
.mt-1 { margin-top: 12px; } .mt-2 { margin-top: 20px; }
.flex-between { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.chart-box { position: relative; height: 280px; }
.progress-bar { height: 10px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.progress-bar > span { display: block; height: 100%; background: var(--primary); border-radius: 999px; }
.divider { height: 1px; background: var(--border); margin: 4px 0; }
.wa-group { display: grid; gap: 16px; }

/* احترام مناطق الأمان في الجوالات ذات الحافة (notch) عند التثبيت كتطبيق */
@supports (padding: env(safe-area-inset-top)) {
  .topbar { padding-top: max(12px, env(safe-area-inset-top)); }
  .sidebar { padding-top: max(18px, env(safe-area-inset-top)); }
  .content { padding-bottom: max(24px, env(safe-area-inset-bottom)); }
}

/* ===========================  استجابة الجوال  ============================= */
@media (max-width: 980px) { .detail-layout { grid-template-columns: 1fr; }
  .detail-side { position: static; } }
@media (max-width: 768px) {
  .sidebar { position: fixed; right: 0; top: 0; transform: translateX(100%);
    transition: transform .25s ease; box-shadow: var(--shadow-lg); }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay.open { display: block; }
  .menu-btn { display: grid; }
  .user-meta { display: none; }
  .form-row, .grid-2 { grid-template-columns: 1fr; }
  .content { padding: 16px; }
  .calendar { gap: 4px; }
  .cal-day { min-height: 70px; padding: 5px; }
  .cal-task { font-size: 10px; }
  .page-title { font-size: 16px; }
}
@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .stat-value { font-size: 24px; }
  .task-grid { grid-template-columns: 1fr; }
}

/* ===========================  الطباعة  ============================= */
@media print {
  .no-print, .sidebar, .topbar, .sidebar-overlay { display: none !important; }
  body { background: #fff; }
  .content { padding: 0; max-width: none; }
  .card, table.data { box-shadow: none; border: 1px solid #ccc; }
  .print-only { display: block !important; }
}
.print-only { display: none; }
