/* =====================================================================
   MASAR — التصميم | شركة عبر الشرق النفطية
   هوية بترولية: أخضر نفطي عميق + ذهبي
   ===================================================================== */
:root {
  --green-900: #082c21;
  --green-800: #0b3d2e;
  --green-700: #0f4f3b;
  --green-600: #15664c;
  --green-500: #1f8a66;
  --gold: #c9a227;
  --gold-light: #e6c757;

  --bg: #f4f6f5;
  --surface: #ffffff;
  --surface-2: #f8faf9;
  --border: #e2e8e5;
  --text: #1a2b25;
  --muted: #6b7d76;
  --shadow: 0 1px 3px rgba(8,44,33,.08), 0 1px 2px rgba(8,44,33,.04);
  --shadow-lg: 0 10px 30px rgba(8,44,33,.15);
  --radius: 12px;
  --radius-sm: 8px;

  --blue: #2563eb; --violet: #7c3aed; --amber: #d97706; --green: #16a34a;
  --red: #dc2626; --cyan: #0891b2; --slate: #475569; --gray: #6b7280;
  --sidebar-w: 256px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: 'Cairo', system-ui, 'Segoe UI', Tahoma, sans-serif;
  background: var(--bg); color: var(--text); line-height: 1.6; font-size: 15px;
}
a { color: inherit; text-decoration: none; }
.link { color: var(--green-600); cursor: pointer; font-weight: 600; font-size: 14px; }
.link:hover { text-decoration: underline; }
.muted { color: var(--muted); font-size: 13px; }
.req { color: var(--red); }

/* ---------- التحميل ---------- */
.boot-loading, .loading { display: flex; justify-content: center; align-items: center; padding: 60px; }
.spinner {
  width: 42px; height: 42px; border: 4px solid var(--border);
  border-top-color: var(--green-600); border-radius: 50%; animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- الأزرار ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 18px; border: 1px solid transparent; border-radius: var(--radius-sm);
  font-family: inherit; font-size: 14px; font-weight: 600; cursor: pointer;
  transition: all .15s; white-space: nowrap;
}
.btn:disabled { opacity: .6; cursor: not-allowed; }
.btn-primary { background: var(--green-700); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--green-800); }
.btn-ghost { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover:not(:disabled) { background: #b91c1c; }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-block { width: 100%; }
.icon-btn {
  background: none; border: none; cursor: pointer; font-size: 16px; padding: 4px 6px;
  border-radius: 6px; transition: background .15s;
}
.icon-btn:hover { background: var(--surface-2); }

/* ---------- شاشات المصادقة ---------- */
.auth-wrap {
  min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--green-900), var(--green-700));
  padding: 20px; gap: 16px;
}
.auth-card {
  background: var(--surface); border-radius: 16px; box-shadow: var(--shadow-lg);
  width: 100%; max-width: 410px; padding: 36px 30px;
}
.auth-brand { text-align: center; margin-bottom: 26px; }
.auth-logo { font-size: 46px; }
.auth-logo img { max-width: 96px; height: auto; }
.brand-logo img { width: 34px; height: 34px; object-fit: contain; background:#fff; border-radius:8px; padding:2px; }
.auth-brand h1 { font-size: 30px; color: var(--green-800); letter-spacing: 1px; margin-top: 4px; }
.auth-brand p { color: var(--text); font-weight: 600; }
.auth-sub { color: var(--muted); font-size: 13px; }
.auth-form .field { margin-bottom: 16px; }
.auth-foot { text-align: center; margin-top: 16px; }
.auth-foot a { color: var(--muted); font-size: 13px; }
.auth-foot a:hover { color: var(--green-600); }
.auth-credit { color: rgba(255,255,255,.6); font-size: 12px; }

/* ---------- القشرة ---------- */
.shell { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w); background: var(--green-800); color: #e7f0ec;
  display: flex; flex-direction: column; position: fixed; top: 0; bottom: 0; right: 0; z-index: 50;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 20px 18px; border-bottom: 1px solid rgba(255,255,255,.1); }
.brand-logo { font-size: 30px; }
.brand-name { font-size: 22px; font-weight: 800; letter-spacing: 1px; }
.brand-org { font-size: 12px; color: rgba(255,255,255,.65); }
.nav { flex: 1; padding: 14px 10px; display: flex; flex-direction: column; gap: 4px; }
.nav-item {
  display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-radius: var(--radius-sm);
  color: rgba(255,255,255,.82); font-weight: 600; font-size: 14.5px; transition: all .15s;
}
.nav-item:hover { background: rgba(255,255,255,.08); color: #fff; }
.nav-item.active { background: var(--green-600); color: #fff; box-shadow: inset 3px 0 0 var(--gold); }
.nav-icon { font-size: 18px; }
.sidebar-foot { padding: 14px 18px; font-size: 11px; color: rgba(255,255,255,.5); border-top: 1px solid rgba(255,255,255,.1); }

.main { flex: 1; margin-right: var(--sidebar-w); display: flex; flex-direction: column; min-width: 0; }
.topbar {
  height: 62px; background: var(--surface); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 12px; padding: 0 22px; position: sticky; top: 0; z-index: 40;
}
.topbar-spacer { flex: 1; }
.hamburger { display: none; background: none; border: none; font-size: 22px; cursor: pointer; }
.topbar-btn { position: relative; background: none; border: none; font-size: 20px; cursor: pointer; padding: 6px; border-radius: 8px; }
.topbar-btn:hover { background: var(--surface-2); }
.notif-badge {
  position: absolute; top: 0; left: 0; background: var(--red); color: #fff; font-size: 10px;
  min-width: 17px; height: 17px; border-radius: 9px; display: flex; align-items: center; justify-content: center; padding: 0 4px;
}
.user-menu { position: relative; }
.user-btn { display: flex; align-items: center; gap: 10px; background: none; border: none; cursor: pointer; padding: 4px 6px; border-radius: 8px; }
.user-btn:hover { background: var(--surface-2); }
.user-avatar {
  width: 38px; height: 38px; border-radius: 50%; background: var(--green-600); color: #fff;
  display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 17px;
}
.user-info { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.2; }
.user-name { font-weight: 700; font-size: 14px; }
.user-role { font-size: 12px; color: var(--muted); }
.dropdown {
  position: absolute; top: calc(100% + 8px); left: 0; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius-sm); box-shadow: var(--shadow-lg);
  min-width: 180px; overflow: hidden; z-index: 60;
}
.dropdown a { display: block; padding: 11px 16px; font-size: 14px; font-weight: 600; }
.dropdown a:hover { background: var(--surface-2); }

.content { padding: 26px; flex: 1; max-width: 1280px; width: 100%; margin: 0 auto; }

/* ---------- رؤوس الصفحات ---------- */
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head h1 { font-size: 25px; font-weight: 800; color: var(--green-800); }
.page-actions { display: flex; gap: 10px; }
.back-link { color: var(--muted); font-size: 13px; font-weight: 600; }
.back-link:hover { color: var(--green-600); }
.head-meta { display: flex; align-items: center; gap: 8px; margin-top: 8px; flex-wrap: wrap; }

/* ---------- البطاقات ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 20px; overflow: hidden; }
.card-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.card-head h2 { font-size: 16px; font-weight: 700; color: var(--green-800); }
.card-body { padding: 20px; }
.card-foot { padding: 16px 20px; border-top: 1px solid var(--border); background: var(--surface-2); }
.stack > .card:last-child { margin-bottom: 0; }
.section-title { font-size: 14px; color: var(--green-700); margin: 18px 0 12px; padding-bottom: 6px; border-bottom: 2px solid var(--surface-2); }
.section-title:first-child { margin-top: 0; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start; }

/* ---------- البطاقات الإحصائية ---------- */
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 22px; }
.stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; display: flex; align-items: center; gap: 14px; }
.stat-icon { font-size: 30px; width: 54px; height: 54px; border-radius: 12px; display: flex; align-items: center; justify-content: center; background: var(--surface-2); }
.stat-value { font-size: 26px; font-weight: 800; color: var(--green-800); line-height: 1; }
.stat-label { font-size: 13px; color: var(--muted); margin-top: 4px; }
.stat-blue .stat-icon { background: #dbeafe; } .stat-violet .stat-icon { background: #ede9fe; }
.stat-amber .stat-icon { background: #fef3c7; } .stat-green .stat-icon { background: #dcfce7; }

/* ---------- الجداول ---------- */
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: right; padding: 11px 14px; font-size: 12.5px; font-weight: 700; color: var(--muted); border-bottom: 2px solid var(--border); white-space: nowrap; }
.table td { padding: 12px 14px; border-bottom: 1px solid var(--border); font-size: 14px; }
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr.clickable { cursor: pointer; transition: background .12s; }
.table tbody tr.clickable:hover { background: var(--surface-2); }
.table.compact td, .table.compact th { padding: 8px 10px; font-size: 13px; }
.row-inactive { opacity: .5; }
.row-actions { display: flex; gap: 2px; white-space: nowrap; }
.list-foot { padding: 12px 4px 2px; color: var(--muted); font-size: 13px; }
.pager { display: flex; align-items: center; justify-content: center; gap: 16px; padding: 16px 4px 4px; }
.pager-info { font-size: 13px; color: var(--muted); }

/* ---------- الشارات ---------- */
.badge { display: inline-block; padding: 3px 11px; border-radius: 20px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.badge-blue { background: #dbeafe; color: #1e40af; } .badge-violet { background: #ede9fe; color: #5b21b6; }
.badge-amber { background: #fef3c7; color: #92400e; } .badge-green { background: #dcfce7; color: #166534; }
.badge-red { background: #fee2e2; color: #991b1b; } .badge-cyan { background: #cffafe; color: #155e75; }
.badge-slate { background: #e2e8f0; color: #334155; } .badge-gray { background: #f1f5f9; color: #475569; }

/* ---------- النماذج ---------- */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13.5px; font-weight: 600; margin-bottom: 6px; color: var(--text); }
.field input, .field select, .field textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-family: inherit; font-size: 14px; background: var(--surface); color: var(--text); transition: border .15s;
}
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--green-500); box-shadow: 0 0 0 3px rgba(31,138,102,.12); }
.field input[readonly] { background: var(--surface-2); color: var(--muted); }
.field textarea { resize: vertical; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.form-actions { display: flex; gap: 10px; margin-top: 8px; }

/* ---------- الفلاتر ---------- */
.filters { display: flex; gap: 10px; margin-bottom: 18px; flex-wrap: wrap; }
.filters input, .filters select { padding: 9px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); font-family: inherit; font-size: 14px; background: var(--surface); }
.filters input[type=search] { flex: 1; min-width: 200px; }

/* ---------- التفاصيل ---------- */
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0; }
.dr { display: flex; justify-content: space-between; gap: 10px; padding: 9px 0; border-bottom: 1px dashed var(--border); }
.dr-l { color: var(--muted); font-size: 13.5px; }
.dr-v { font-weight: 600; font-size: 14px; text-align: left; }
.detail-note { margin-top: 14px; padding: 12px; background: var(--surface-2); border-radius: var(--radius-sm); font-size: 14px; }
.mini-stats { display: flex; gap: 24px; }
.mini-stats > div { display: flex; flex-direction: column; }
.ms-l { font-size: 12.5px; color: var(--muted); }
.ms-v { font-size: 20px; font-weight: 800; color: var(--green-800); }

/* ---------- تدفّق الحالة ---------- */
.status-flow-card { padding: 20px; }
.status-flow.cancelled { display: flex; align-items: center; gap: 12px; }
.flow { display: flex; align-items: center; justify-content: space-between; gap: 4px; }
.flow-step { display: flex; flex-direction: column; align-items: center; gap: 6px; flex-shrink: 0; }
.flow-dot { width: 34px; height: 34px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 14px; background: var(--surface-2); color: var(--muted); border: 2px solid var(--border); }
.flow-step.done .flow-dot { background: var(--green-500); color: #fff; border-color: var(--green-500); }
.flow-step.current .flow-dot { background: var(--gold); color: #fff; border-color: var(--gold); box-shadow: 0 0 0 4px rgba(201,162,39,.2); }
.flow-label { font-size: 12px; color: var(--muted); text-align: center; }
.flow-step.current .flow-label { color: var(--text); font-weight: 700; }
.flow-line { flex: 1; height: 2px; background: var(--border); margin-bottom: 22px; min-width: 12px; }
.flow-actions { display: flex; gap: 10px; margin-top: 18px; justify-content: center; flex-wrap: wrap; }

/* ---------- المستندات ---------- */
.doc-list { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.doc-list li { display: flex; align-items: center; gap: 10px; padding: 10px; background: var(--surface-2); border-radius: var(--radius-sm); }
.doc-type { background: var(--green-700); color: #fff; font-size: 11px; padding: 2px 9px; border-radius: 12px; font-weight: 700; white-space: nowrap; }
.doc-name { font-weight: 600; color: var(--green-700); flex: 1; cursor: pointer; }
.doc-name:hover { text-decoration: underline; }
.doc-meta { font-size: 12px; }

/* ---------- التعليقات ---------- */
.comments { display: flex; flex-direction: column; gap: 12px; margin-bottom: 14px; max-height: 320px; overflow-y: auto; }
.comment { padding: 12px; background: var(--surface-2); border-radius: var(--radius-sm); }
.comment-head { display: flex; justify-content: space-between; margin-bottom: 4px; }
.comment-body { font-size: 14px; }
.comment-form { display: flex; gap: 8px; align-items: flex-end; }
.comment-form textarea { flex: 1; padding: 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); font-family: inherit; resize: vertical; }

/* ---------- المسار الزمني ---------- */
.timeline { list-style: none; position: relative; padding-right: 8px; }
.timeline li { display: flex; gap: 12px; padding-bottom: 16px; position: relative; }
.timeline li::before { content: ""; position: absolute; right: 5px; top: 14px; bottom: -2px; width: 2px; background: var(--border); }
.timeline li:last-child::before { display: none; }
.tl-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--green-500); flex-shrink: 0; margin-top: 4px; z-index: 1; }
.tl-body { font-size: 14px; }
.tl-time { font-size: 12px; margin-top: 2px; }

/* ---------- أشرطة الإحصاء ---------- */
.bars { display: flex; flex-direction: column; gap: 12px; }
.bar-row { display: flex; align-items: center; gap: 12px; }
.bar-label { width: 110px; font-size: 13px; color: var(--muted); }
.bar-track { flex: 1; height: 10px; background: var(--surface-2); border-radius: 6px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 6px; background: var(--green-500); transition: width .5s; min-width: 2px; }
.bar-value { width: 32px; text-align: left; font-weight: 700; font-size: 14px; }
.bar-opened { background: var(--blue); } .bar-at_port { background: var(--cyan); }
.bar-customs_clearance { background: var(--amber); } .bar-in_transport { background: var(--violet); }
.bar-delivered { background: var(--green); } .bar-closed { background: var(--slate); }

/* ---------- آخر تحديث (بانر) ---------- */
.latest-update { margin-top: 8px; padding: 8px 12px; background: #fff8e6; border: 1px solid #f5e2a8; border-radius: var(--radius-sm); font-size: 13.5px; }

/* ---------- المحطات الزمنية ---------- */
.ms-track { display: flex; gap: 0; overflow-x: auto; padding: 6px 2px 14px; }
.ms-step { flex: 0 0 96px; display: flex; flex-direction: column; align-items: center; gap: 8px; position: relative; }
.ms-step::before { content: ""; position: absolute; top: 13px; right: 50%; width: 100%; height: 2px; background: var(--border); z-index: 0; }
.ms-step:first-child::before { display: none; }
.ms-dot { width: 26px; height: 26px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; background: var(--surface-2); color: var(--muted); border: 2px solid var(--border); z-index: 1; }
.ms-done .ms-dot { background: var(--green-500); color: #fff; border-color: var(--green-500); }
.ms-info { text-align: center; }
.ms-label { font-size: 11px; color: var(--muted); line-height: 1.3; }
.ms-done .ms-label { color: var(--text); font-weight: 600; }
.ms-date { font-size: 11px; color: var(--green-700); font-weight: 700; margin-top: 2px; }
.ms-foot { padding-top: 10px; border-top: 1px solid var(--border); font-size: 13px; }

/* ---------- تحديثات الحالة ---------- */
.update-form { display: flex; gap: 8px; align-items: flex-start; margin-bottom: 14px; flex-wrap: wrap; }
.update-form input[type=date] { padding: 9px; border: 1px solid var(--border); border-radius: var(--radius-sm); font-family: inherit; }
.update-form textarea { flex: 1; min-width: 200px; padding: 9px; border: 1px solid var(--border); border-radius: var(--radius-sm); font-family: inherit; resize: vertical; }
.updates-list { display: flex; flex-direction: column; gap: 10px; max-height: 360px; overflow-y: auto; }
.update-item { padding: 10px 12px; background: var(--surface-2); border-radius: var(--radius-sm); border-right: 3px solid var(--green-500); }
.update-meta { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 3px; }
.update-note { font-size: 14px; }

/* ---------- الحاويات ---------- */
.cont-row { display: flex; flex-wrap: wrap; gap: 8px; }
.cont-chip { background: var(--surface-2); border: 1px solid var(--border); border-radius: 20px; padding: 4px 12px; font-size: 13px; }
.cargo-foot { margin-top: 14px; }

/* ---------- المساعد الذكي ---------- */
.ai-card { padding: 0; overflow: hidden; }
.ai-messages { height: 52vh; min-height: 320px; overflow-y: auto; padding: 18px; display: flex; flex-direction: column; gap: 12px; background: var(--surface-2); }
.ai-msg { max-width: 85%; padding: 11px 15px; border-radius: 14px; font-size: 14.5px; line-height: 1.7; white-space: normal; }
.ai-bot { background: #fff; border: 1px solid var(--border); align-self: flex-start; border-bottom-right-radius: 4px; }
.ai-user { background: var(--green-700); color: #fff; align-self: flex-start; margin-right: auto; align-self: flex-end; border-bottom-left-radius: 4px; }
.ai-results { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.ai-result { display: block; padding: 8px 10px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; font-size: 13px; }
.ai-result:hover { background: #eef5f1; }
.ai-suggest { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px 14px 0; }
.ai-chip { background: var(--surface-2); border: 1px solid var(--border); border-radius: 18px; padding: 6px 14px; font-family: inherit; font-size: 13px; cursor: pointer; color: var(--green-700); }
.ai-chip:hover { background: var(--green-700); color: #fff; }
.ai-input { display: flex; gap: 8px; padding: 14px; border-top: 1px solid var(--border); }
.ai-input input { flex: 1; padding: 11px 14px; border: 1px solid var(--border); border-radius: 24px; font-family: inherit; font-size: 14px; }
.ai-input input:focus { outline: none; border-color: var(--green-500); }
.ai-dots { color: var(--muted); font-style: italic; }

/* ---------- سجل تغييرات المزامنة (من غيّر ماذا) ---------- */
.changes { display: flex; flex-direction: column; gap: 10px; max-height: 520px; overflow-y: auto; }
.chg-row { padding: 10px 12px; background: var(--surface-2); border-radius: var(--radius-sm); border-right: 3px solid var(--green-500); }
.chg-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.chg-who { font-weight: 700; color: var(--green-800); }
.chg-ent { color: var(--muted); font-size: 13px; }
.chg-time { margin-right: auto; }
.chg-fields { margin-top: 6px; display: flex; flex-direction: column; gap: 3px; font-size: 13px; }
.chg { padding: 2px 0; }
.chg-old { color: var(--red); text-decoration: line-through; }
.chg-new { color: var(--green); font-weight: 600; }

/* ---------- التنبيهات داخل البطاقات ---------- */
.alert { padding: 11px 14px; border-radius: var(--radius-sm); font-size: 13.5px; margin-top: 14px; }
.alert-info { background: #eff6ff; color: #1e40af; border: 1px solid #bfdbfe; }
.alert-danger { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }

/* ---------- عناصر العمليات (نقل/قوائم) ---------- */
.stack-list { display: flex; flex-direction: column; gap: 10px; }
.op-item { padding: 12px; background: var(--surface-2); border-radius: var(--radius-sm); border: 1px solid var(--border); }
.op-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.op-head strong { font-size: 15px; }
.op-actions { margin-right: auto; display: flex; gap: 2px; }
.op-meta { font-size: 13px; color: var(--muted); line-height: 1.8; }

/* ---------- الحالة الفارغة ---------- */
.empty { text-align: center; padding: 40px 20px; color: var(--muted); }
.empty-icon { font-size: 42px; margin-bottom: 10px; }

/* ---------- النوافذ المنبثقة ---------- */
.modal-overlay { position: fixed; inset: 0; background: rgba(8,44,33,.5); display: flex; align-items: center; justify-content: center; z-index: 100; padding: 20px; animation: fade .15s; }
@keyframes fade { from { opacity: 0; } }
.modal { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow-lg); width: 100%; max-width: 520px; max-height: 90vh; overflow-y: auto; animation: pop .2s; }
.modal-wide { max-width: 760px; }
@keyframes pop { from { transform: scale(.96); opacity: 0; } }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--surface); }
.modal-head h3 { font-size: 17px; color: var(--green-800); }
.modal-close { background: none; border: none; font-size: 26px; cursor: pointer; color: var(--muted); line-height: 1; }
.modal-body { padding: 20px; }

/* ---------- التنبيهات (Toast) ---------- */
#toast-wrap { position: fixed; bottom: 20px; left: 20px; z-index: 200; display: flex; flex-direction: column; gap: 10px; }
.toast { padding: 13px 20px; border-radius: var(--radius-sm); color: #fff; font-weight: 600; font-size: 14px; box-shadow: var(--shadow-lg); transform: translateY(20px); opacity: 0; transition: all .3s; max-width: 360px; }
.toast.show { transform: translateY(0); opacity: 1; }
.toast-info { background: var(--slate); } .toast-success { background: var(--green); }
.toast-error { background: var(--red); } .toast-warning { background: var(--amber); }

/* ---------- لوحة الإشعارات ---------- */
.notif-panel { position: fixed; top: 62px; left: 20px; width: 360px; max-width: calc(100vw - 40px); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg); z-index: 70; max-height: 70vh; overflow: hidden; display: flex; flex-direction: column; }
.notif-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.notif-list { overflow-y: auto; }
.notif-item { display: block; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.notif-item:hover { background: var(--surface-2); }
.notif-item.unread { background: #f0f7f4; border-right: 3px solid var(--green-500); }
.notif-title { font-weight: 700; font-size: 14px; }
.notif-body { font-size: 13px; color: var(--muted); margin-top: 2px; }
.notif-time { font-size: 11px; color: var(--muted); margin-top: 4px; }

/* ---------- الاستجابة (موبايل) ---------- */
@media (max-width: 900px) {
  .grid-2, .form-grid, .detail-grid { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 768px) {
  .sidebar { transform: translateX(100%); transition: transform .25s; box-shadow: var(--shadow-lg); }
  .sidebar.open { transform: translateX(0); }
  .main { margin-right: 0; }
  .hamburger { display: block; }
  .content { padding: 18px 14px; }
  .flow-label { display: none; }
  .user-info { display: none; }
  .table { display: block; overflow-x: auto; white-space: nowrap; }
}
@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .page-head h1 { font-size: 21px; }
}
