/* ==============================================================
   نظام تعبئة المستند الإلكتروني - التنسيقات العامة (CSS)
   ============================================================== */

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

/* ── مساعدات Bootstrap المتوافقة (Utility Classes) ── */
.d-none { display: none !important; }
.d-block { display: block !important; }
.d-flex { display: flex !important; }
.d-inline-flex { display: inline-flex !important; }
.text-end { text-align: right !important; }
.text-start { text-align: left !important; }
.ms-2 { margin-inline-start: 0.5rem !important; }
.me-2 { margin-inline-end: 0.5rem !important; }
.align-items-center { align-items: center !important; }
.text-decoration-none { text-decoration: none !important; }
.flex-wrap { flex-wrap: wrap !important; }
.gap-2 { gap: 0.5rem !important; }
.navbar-brand { display: inline-flex; align-items: center; text-decoration: none; }

/* على الشاشات ≥ 768px: عرض عناصر d-md-block */
@media (min-width: 768px) {
  .d-md-block { display: block !important; }
  .d-md-flex { display: flex !important; }
  .d-md-none { display: none !important; }
}

/* على الشاشات < 768px: إخفاء d-md-block */
@media (max-width: 767.98px) {
  .d-md-block { display: none !important; }
  .d-md-flex { display: none !important; }
}

body {
  font-family: 'Cairo', 'Segoe UI', Tahoma, Arial, sans-serif;
  background-color: #f8fafc;
  color: #1e293b;
  direction: rtl;
  text-align: right;
  min-height: 100vh;
  padding: 20px;
}

.page-wrapper {
  max-width: 1380px;
  margin: 0 auto;
}

header {
  background: linear-gradient(135deg, #0f172a, #1e3a8a);
  color: #fff;
  padding: 22px 28px;
  border-radius: 16px 16px 0 0;
  border-bottom: 3px solid #f59e0b;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

header h1 {
  font-size: 1.5rem;
  font-weight: 700;
}

header p {
  font-size: 0.85rem;
  opacity: .88;
  margin-top: 4px;
}

/* ======= شريط التقدم (8 مراحل) ======= */
.progress-bar {
  display: flex;
  background: #dde3ea;
  padding: 10px 16px;
  gap: 4px;
  align-items: center;
  border-bottom: 1px solid #c9d2dc;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}

.step-label {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: .72rem;
  color: #777;
  white-space: nowrap;
  padding: 3px 5px;
  border-radius: 4px;
  transition: all .2s;
  flex-shrink: 0;
}

.step-label.active {
  color: #1a3a5c;
  font-weight: 700;
  background: rgba(26, 58, 92, .08);
}

.step-label.done {
  color: #2e7d32;
}

.step-num {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #bbb;
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: .72rem;
  font-weight: 700;
  flex-shrink: 0;
}

.step-label.active .step-num {
  background: #1a3a5c;
}

.step-label.done .step-num {
  background: #2e7d32;
}

.step-divider {
  color: #bbb;
  font-size: .9rem;
  flex-shrink: 0;
}

/* ======= البطاقة العامة ======= */
.card {
  background: #fff;
  border-radius: 0 0 8px 8px;
  padding: 30px 28px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, .08);
}

.section-title {
  font-size: 1.05rem;
  font-weight: 800;
  color: #1a3a5c;
  margin-bottom: 8px;
  margin-top: 18px;
  padding: 10px 14px 10px 14px;
  border-right: 4px solid #1e3a8a;
  background: linear-gradient(90deg, rgba(239,246,255,0.9) 0%, rgba(248,250,252,0.4) 100%);
  border-radius: 0 8px 8px 0;
  display: flex;
  align-items: center;
  gap: 8px;
  letter-spacing: -0.2px;
}

.section-title:first-child {
  margin-top: 0;
}

.section-desc {
  font-size: .88rem;
  color: #666;
  margin-bottom: 20px;
}

/* ======= شريط الأزرار والمقسّم ======= */

.section-sep {
  border: none;
  border-top: 2px solid #e8ecf1;
  margin: 22px 0;
}

/* ======= شارة الموظف المشتركة فوق شريط التقدم ======= */
.shared-emp-badge-wrap {
  background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
  border: 1.5px solid #bae6fd;
  border-radius: 12px;
  padding: 10px 16px;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 2px 8px rgba(14, 165, 233, 0.1);
}

.shared-emp-badge-wrap .badge-icon {
  font-size: 28px;
  flex-shrink: 0;
}

.shared-emp-badge-wrap .badge-name {
  font-size: 0.95rem;
  font-weight: 800;
  color: #0c4a6e;
}

.shared-emp-badge-wrap .badge-sub {
  font-size: 0.78rem;
  color: #0369a1;
  margin-top: 2px;
}

/* ======= زر الخطوة التالية ======= */
#btn-next-step {
  display: none;
  align-items: center;
  gap: 8px;
  background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 100%);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 11px 22px;
  font-size: 0.95rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
  margin-top: 12px;
  width: 100%;
  justify-content: center;
}

#btn-next-step:hover {
  background: linear-gradient(135deg, #1e40af 0%, #3b82f6 100%);
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.35);
}

/* ======= زر الانتقال السفلي للخطوة التالية ======= */
.btn-next-step-bottom {
  display: none;
  align-items: center;
  gap: 10px;
  background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 100%);
  color: #ffffff !important;
  border: none;
  border-radius: 10px;
  padding: 12px 26px;
  font-size: 0.98rem;
  font-weight: 800;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.3);
}

.btn-next-step-bottom:hover {
  background: linear-gradient(135deg, #1e40af 0%, #3b82f6 100%);
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(37, 99, 235, 0.4);
}

/* ======= عداد الزوجات / الأبناء ======= */
.count-display-badge {
  display: inline-block;
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
  border-radius: 20px;
  padding: 1px 8px;
  font-size: 0.78rem;
  font-weight: 700;
  margin-right: 6px;
}

/* ======= بطاقات تجميع الحقول ذات الغرض الموحد (Form Field Cards / Groups) ======= */
.form-field-card {
  background: #ffffff;
  border: 1.5px solid #e2e8f0;
  border-radius: 12px;
  padding: 18px 20px;
  margin-bottom: 20px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-field-card:hover {
  border-color: #cbd5e1;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.05);
}

.form-field-card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.98rem;
  font-weight: 800;
  color: #1e3a8a;
  padding-bottom: 10px;
  margin-bottom: 14px;
  border-bottom: 1.5px solid #f1f5f9;
}

.form-field-card-header .card-header-icon {
  font-size: 1.25rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #eff6ff;
  border-radius: 8px;
  width: 32px;
  height: 32px;
}

.form-field-card-header .card-header-title {
  font-weight: 800;
  color: #1e3a8a;
  letter-spacing: -0.2px;
}


/* ======= الحقول والمدخلات ======= */
.field-group {
  margin-bottom: 18px;
}

.field-group label {
  display: block;
  font-size: .9rem;
  font-weight: 600;
  color: #333;
  margin-bottom: 5px;
}

.field-group label .required {
  color: #c00;
  margin-right: 3px;
}

.field-group input,
.field-group select,
.field-group textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #ccd3dc;
  border-radius: 5px;
  font-size: .95rem;
  font-family: inherit;
  direction: rtl;
  text-align: right;
  color: #222;
  background: #fff;
  transition: border-color .2s;
}

.field-group input:focus,
.field-group select:focus,
.field-group textarea:focus {
  outline: none;
  border-color: #1a3a5c;
  box-shadow: 0 0 0 3px rgba(26, 58, 92, .12);
}

.field-group input[readonly],
.field-group input:disabled {
  background: #eef2f6;
  color: #444;
  cursor: not-allowed;
  border-color: #c5d0dc;
  font-weight: 600;
}

.field-group textarea {
  min-height: 80px;
  resize: vertical;
}

.field-error {
  color: #c00;
  font-size: .8rem;
  margin-top: 4px;
  display: none;
}

.field-group.has-error input,
.field-group.has-error select,
.field-group.has-error textarea {
  border-color: #c00;
}

.field-group.has-error .field-error {
  display: block;
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.field-grid-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 14px;
}

@media (max-width: 600px) {
  .field-row,
  .field-grid-3 {
    grid-template-columns: 1fr;
  }
}

/* ======= الأزرار والإجراءات ======= */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 28px;
  border: none;
  border-radius: 5px;
  font-size: .95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .2s, transform .1s;
  font-family: inherit;
}

.btn:active {
  transform: scale(.98);
}

.btn-primary {
  background: #1a3a5c;
  color: #fff;
}

.btn-primary:hover {
  background: #122947;
}

.btn-secondary {
  background: #e8ecf1;
  color: #333;
}

.btn-secondary:hover {
  background: #d9dfe8;
}

.btn-success {
  background: #2e7d32;
  color: #fff;
}

.btn-success:hover {
  background: #225c25;
}

.btn-warning {
  background: #f57c00;
  color: #fff;
}

.btn-warning:hover {
  background: #e65100;
}

.btn:disabled {
  opacity: .5;
  cursor: not-allowed;
}

.form-actions {
  display: flex;
  gap: 12px;
  margin-top: 28px;
  flex-wrap: wrap;
}

.step-nav-actions {
  display: flex;
  gap: 10px;
  margin: 16px 0;
  flex-wrap: wrap;
}

/* ======= التنبيهات والرسائل الفاخرة ======= */
.alert {
  padding: 14px 18px;
  border-radius: 12px;
  font-size: .92rem;
  margin-bottom: 18px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, .04);
  transition: all .25s ease;
  line-height: 1.5;
}

.alert-info {
  background: linear-gradient(135deg, #eff6ff, #dbeafe);
  border-right: 5px solid #2563eb;
  color: #1e40af;
  border-top: 1px solid rgba(37,99,235,0.1);
  border-bottom: 1px solid rgba(37,99,235,0.1);
}

.alert-success {
  background: linear-gradient(135deg, #f0fdf4, #dcfce7);
  border-right: 5px solid #16a34a;
  color: #166534;
  border-top: 1px solid rgba(22,163,74,0.1);
  border-bottom: 1px solid rgba(22,163,74,0.1);
}

.alert-error {
  background: linear-gradient(135deg, #fef2f2, #fee2e2);
  border-right: 5px solid #dc2626;
  color: #991b1b;
  border-top: 1px solid rgba(220,38,38,0.1);
  border-bottom: 1px solid rgba(220,38,38,0.1);
}

.alert-warning {
  background: linear-gradient(135deg, #fffbeb, #fef3c7);
  border-right: 5px solid #d97706;
  color: #92400e;
  border-top: 1px solid rgba(217,119,6,0.15);
  border-bottom: 1px solid rgba(217,119,6,0.15);
}

.alert-icon {
  font-size: 1.3rem;
  flex-shrink: 0;
  line-height: 1;
}

/* ======= مكون تاريخ الميلاد الذكي ======= */
.smart-dob-wrapper {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.smart-dob-inputs {
  display: grid;
  grid-template-columns: 1fr 1.3fr 1.2fr;
  gap: 8px;
}

.smart-dob-select {
  padding: 9px 10px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-size: 0.92rem;
  background: #ffffff;
  color: #1e293b;
  font-weight: 600;
  transition: all 0.2s ease;
}

.smart-dob-select:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37,99,235,0.15);
  outline: none;
}

.smart-age-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  background: linear-gradient(135deg, #f0fdf4, #dcfce7);
  border: 1px solid #86efac;
  border-radius: 20px;
  color: #166534;
  font-size: 0.85rem;
  font-weight: 700;
  width: fit-content;
  box-shadow: 0 2px 5px rgba(22,163,74,0.08);
}

/* ======= بطاقة وشارات الموظف ======= */
.employee-card {
  background: #f0f5fc;
  border: 1px solid #c2d4ea;
  border-radius: 6px;
  padding: 14px 18px;
  margin-bottom: 20px;
}

.employee-card .emp-name {
  font-size: 1.1rem;
  font-weight: 700;
  color: #1a3a5c;
}

.employee-card .emp-id {
  font-size: .85rem;
  color: #555;
  margin-top: 3px;
}

.step-emp-badge {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #f0f5fc;
  border: 1px solid #c2d4ea;
  border-radius: 6px;
  padding: 10px 16px;
  margin-bottom: 20px;
}

.step-emp-badge .badge-icon {
  font-size: 1.4rem;
}

.step-emp-badge .badge-name {
  font-size: .95rem;
  font-weight: 700;
  color: #1a3a5c;
}

.step-emp-badge .badge-sub {
  font-size: .78rem;
  color: #555;
}

/* ======= نموذج الفرد المشمول ======= */
.child-card {
  background: #fafbfc;
  border: 1px solid #dcdfe4;
  border-right: 4px solid #1a3a5c;
  border-radius: 6px;
  padding: 18px;
  margin-bottom: 20px;
}

.child-card-header {
  font-size: 1rem;
  font-weight: 700;
  color: #1a3a5c;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

/* ======= رسائل الإشعار العائمة (Toast Notifications) ======= */
.toast-container {
  position: fixed;
  top: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 999999;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  pointer-events: none;
  width: auto;
  max-width: 95vw;
}

.toast-message {
  pointer-events: auto;
  min-width: 330px;
  max-width: 580px;
  width: auto;
  padding: 13px 20px;
  border-radius: 14px;
  font-size: 0.96rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 12px;
  color: #ffffff;
  direction: rtl;
  text-align: right;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 16px 36px -6px rgba(0, 0, 0, 0.35), 0 0 0 1px rgba(255, 255, 255, 0.15) inset;
  animation: toastSlideDown 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

/* نجاح / حفظ / اكتمال - أخضر زمردي بارز */
.toast-message.toast-success,
.toast-success {
  background: linear-gradient(135deg, #059669 0%, #10b981 100%) !important;
  border: 1px solid rgba(167, 243, 208, 0.5) !important;
  color: #ffffff !important;
  box-shadow: 0 12px 30px rgba(5, 150, 105, 0.4), 0 0 20px rgba(16, 185, 129, 0.25) !important;
}

/* فشل / حذف / خطأ - أحمر ناصع بارز */
.toast-message.toast-error,
.toast-message.toast-delete,
.toast-error {
  background: linear-gradient(135deg, #dc2626 0%, #ef4444 100%) !important;
  border: 1px solid rgba(254, 202, 202, 0.5) !important;
  color: #ffffff !important;
  box-shadow: 0 12px 30px rgba(220, 38, 38, 0.4), 0 0 20px rgba(239, 68, 68, 0.25) !important;
}

/* تنبيه / إلغاء / تجميد - برتقالي / عنبري دافئ بارز */
.toast-message.toast-warning,
.toast-message.toast-cancel,
.toast-warning {
  background: linear-gradient(135deg, #d97706 0%, #f59e0b 100%) !important;
  border: 1px solid rgba(253, 230, 138, 0.5) !important;
  color: #ffffff !important;
  box-shadow: 0 12px 30px rgba(217, 119, 6, 0.4), 0 0 20px rgba(245, 158, 11, 0.25) !important;
}

/* معلومات / تنقل / ملاحظات - أزرق ملكي / سماوي مميز */
.toast-message.toast-info,
.toast-info {
  background: linear-gradient(135deg, #0284c7 0%, #2563eb 100%) !important;
  border: 1px solid rgba(191, 219, 254, 0.5) !important;
  color: #ffffff !important;
  box-shadow: 0 12px 30px rgba(37, 99, 235, 0.4), 0 0 20px rgba(56, 189, 248, 0.25) !important;
}

@keyframes toastSlideDown {
  from {
    opacity: 0;
    transform: translateY(-24px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.age-display-badge {
  background: #e8f5e9;
  color: #1b5e20;
  border: 1px solid #a5d6a7;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: .85rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 6px;
}

.readonly-tag {
  font-size: .72rem;
  background: #e0e0e0;
  color: #555;
  padding: 2px 6px;
  border-radius: 3px;
  margin-right: 4px;
}

/* ======= قسم رفع المستندات والوثائق ======= */
.upload-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  margin-top: 10px;
}

.upload-card {
  background: #fafbfc;
  border: 1px solid #d7dde4;
  border-radius: 6px;
  padding: 12px 14px;
}

.upload-card label {
  display: block;
  font-size: .9rem;
  font-weight: 700;
  color: #1a3a5c;
  margin-bottom: 6px;
}

.upload-card input[type="file"] {
  width: 100%;
  font-size: .9rem;
  padding: 6px 0;
}

.file-input-wrapper {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.cam-upload-actions {
  display: flex;
  gap: 6px;
  align-items: center;
}

.cam-upload-btn {
  background: #f0f4f8;
  border: 1px solid #c0d1e5;
  color: #1a3a5c;
  padding: 6px 12px;
  border-radius: 4px;
  font-size: .8rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.cam-upload-btn:hover {
  background: #dbe7f5;
}

/* ======= جدول المشمولين والمراجعة ======= */
.insured-table-container {
  overflow-x: auto;
  margin: 16px 0;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  background: #ffffff;
  box-shadow: 0 4px 16px rgba(0, 0, 0, .06);
}

.insured-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .92rem;
  text-align: right;
}

.insured-table th {
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  color: #ffffff;
  padding: 13px 16px;
  font-weight: 700;
  white-space: nowrap;
  letter-spacing: 0.2px;
  border-bottom: 2px solid #1d4ed8;
  box-shadow: inset 0 -1px 0 rgba(255, 255, 255, 0.15);
}

.insured-table td {
  padding: 14px 16px;
  border-bottom: 1px solid #f1f5f9;
  color: #1e293b;
  vertical-align: middle;
}

.insured-table tbody tr:nth-child(even) {
  background-color: #f8fafc;
}

.insured-table tbody tr:hover {
  background-color: #eff6ff;
  transition: background-color 0.15s ease-in-out;
}

.badge-relation {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: .8rem;
  font-weight: 700;
}

.badge-subscriber {
  background: #dbeafe;
  color: #1e40af;
  border: 1px solid #bfdbfe;
}

.badge-father {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fde68a;
}

.badge-mother {
  background: #fce7f3;
  color: #9d174d;
  border: 1px solid #fbcfe8;
}

.badge-wife {
  background: #f3e8ff;
  color: #6b21a8;
  border: 1px solid #e9d5ff;
}

.badge-child {
  background: #dcfce7;
  color: #166534;
  border: 1px solid #bbf7d0;
}

/* شارات حالة الاستمارة الفرعية */
.badge-status-completed {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: .78rem;
  font-weight: 700;
  background: #d1fae5;
  color: #065f46;
  border: 1px solid #a7f3d0;
}

.badge-status-initialized {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: .78rem;
  font-weight: 700;
  background: #fef3c7;
  color: #b45309;
  border: 1px solid #fcd34d;
  animation: pulse-border 2s infinite;
}

.badge-status-draft {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: .78rem;
  font-weight: 700;
  background: #e0f2fe;
  color: #0369a1;
  border: 1px solid #bae6fd;
}

@keyframes pulse-border {
  0%, 100% { border-color: #fcd34d; }
  50% { border-color: #f59e0b; box-shadow: 0 0 6px rgba(245, 158, 11, 0.4); }
}

.btn-sm-action {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  font-size: .82rem;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  font-weight: 700;
  margin-left: 6px;
  transition: all 0.15s ease-in-out;
}

.btn-edit {
  background: linear-gradient(135deg, #3b82f6, #1d4ed8);
  color: #ffffff;
  box-shadow: 0 2px 4px rgba(59, 130, 246, 0.25);
}

.btn-edit:hover {
  background: linear-gradient(135deg, #2563eb, #1e40af);
  transform: translateY(-1px);
}

.btn-complete-action {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #ffffff;
  box-shadow: 0 2px 4px rgba(245, 158, 11, 0.25);
}

.btn-complete-action:hover {
  background: linear-gradient(135deg, #d97706, #b45309);
  transform: translateY(-1px);
}

.btn-delete {
  background: #fee2e2;
  color: #b91c1c;
  border: 1px solid #fca5a5;
}

.btn-delete:hover {
  background: #ef4444;
  color: #ffffff;
  transform: translateY(-1px);
}

/* ======= شاشة النجاح ======= */
.success-screen {
  text-align: center;
  padding: 40px 20px;
}

.success-screen .icon {
  font-size: 3.5rem;
}

.success-screen h2 {
  color: #2e7d32;
  margin: 12px 0 8px;
  font-size: 1.4rem;
}

.success-screen p {
  color: #555;
  font-size: .95rem;
  max-width: 440px;
  margin: 0 auto 20px;
}

/* ======= المساعدات والتذييل ======= */
footer {
  text-align: center;
  margin-top: 20px;
  font-size: .78rem;
  color: #aaa;
}

.hidden {
  display: none !important;
}

.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, .4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .7s linear infinite;
  vertical-align: middle;
  margin-left: 6px;
}

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

/* ======= مؤشر الانتظار المتطور الفاخر (Luxury Spinner) ======= */
.luxury-spinner-wrap {
  position: relative;
  width: 64px;
  height: 64px;
  margin: 0 auto 16px auto;
  display: flex;
  align-items: center;
  justify-content: center;
}

.luxury-spinner {
  width: 58px;
  height: 58px;
  border: 4px solid rgba(14, 165, 233, 0.15);
  border-top-color: #0284c7;
  border-right-color: #0ea5e9;
  border-radius: 50%;
  animation: luxurySpin 0.9s cubic-bezier(0.6, 0.2, 0.4, 0.9) infinite;
  box-shadow: 0 0 16px rgba(14, 165, 233, 0.25);
}

.luxury-spinner-inner {
  position: absolute;
  width: 38px;
  height: 38px;
  border: 3px solid rgba(59, 130, 246, 0.1);
  border-bottom-color: #2563eb;
  border-radius: 50%;
  animation: luxurySpinRev 1.2s linear infinite;
}

.luxury-spinner-icon {
  position: absolute;
  font-size: 20px;
  animation: pulseIcon 1.8s ease-in-out infinite;
}

@keyframes luxurySpin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

@keyframes luxurySpinRev {
  0% { transform: rotate(360deg); }
  100% { transform: rotate(0deg); }
}

@keyframes pulseIcon {
  0%, 100% { transform: scale(1); opacity: 0.9; }
  50% { transform: scale(1.15); opacity: 1; }
}

/* ======= طبقة الانتظار المعتمة والزجاجية الفاخرة (App Loading Overlay) ======= */
.app-loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 999999;
  background: rgba(15, 23, 42, 0.76);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  direction: rtl;
  opacity: 1;
  visibility: visible;
  transition: opacity 0.4s ease, visibility 0.4s ease;
}

.app-loading-overlay.fade-out {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.app-loading-card {
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: 20px;
  padding: 32px 28px;
  width: 100%;
  max-width: 440px;
  text-align: center;
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.35), 0 0 0 1px rgba(255, 255, 255, 0.2);
  animation: slideUpFade 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.app-loading-title {
  font-size: 1.25rem;
  font-weight: 800;
  color: #0f172a;
  margin-bottom: 8px;
  letter-spacing: -0.2px;
}

.app-loading-desc {
  font-size: 0.92rem;
  color: #64748b;
  line-height: 1.6;
  margin: 0;
}

.app-loading-bar {
  width: 100%;
  height: 4px;
  background: #e2e8f0;
  border-radius: 999px;
  overflow: hidden;
  margin-top: 20px;
  position: relative;
}

.app-loading-bar-inner {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 45%;
  background: linear-gradient(90deg, #0284c7, #38bdf8);
  border-radius: 999px;
  animation: loadingBarSlide 1.5s ease-in-out infinite;
}

@keyframes loadingBarSlide {
  0% { left: -45%; width: 30%; }
  50% { width: 60%; }
  100% { left: 100%; width: 30%; }
}

@keyframes slideUpFade {
  from {
    opacity: 0;
    transform: translateY(18px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}



/* ======= رسائل وصناديق التنبيه (Alert Boxes) ======= */
.alert {
  padding: 14px 18px;
  border-radius: 12px;
  margin-bottom: 18px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  font-size: 0.94rem;
  line-height: 1.5;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
  animation: fadeIn 0.25s ease-out;
  direction: rtl;
  text-align: right;
}

.alert.hidden {
  display: none !important;
}

.alert-icon {
  font-size: 1.4rem;
  line-height: 1;
  flex-shrink: 0;
  margin-top: 2px;
}

.alert-error, .insured-card-alert.alert-error {
  background: rgba(254, 242, 242, 0.95);
  border: 1px solid #fca5a5;
  border-right: 5px solid #ef4444;
  color: #991b1b;
}

.insured-card-alert.alert-error {
  cursor: pointer;
  transition: all 0.25s ease;
}

.insured-card-alert.alert-error:hover {
  box-shadow: 0 4px 14px rgba(239, 68, 68, 0.16);
}

.alert-err-list {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.alert-err-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 12px;
  border-radius: 6px;
  background: rgba(254, 226, 226, 0.55);
  border: 1px solid rgba(252, 165, 165, 0.45);
  cursor: pointer;
  transition: all 0.2s ease;
}

.alert-err-item:hover {
  background: rgba(254, 202, 202, 0.9);
  border-color: #ef4444;
  transform: translateX(-4px);
}

.alert-err-item .err-bullet {
  margin-left: 8px;
  flex-shrink: 0;
}

.alert-err-item .err-text {
  flex-grow: 1;
  font-weight: 600;
  color: #991b1b;
}

.alert-err-item .err-action-hint {
  font-size: 0.8rem;
  color: #b91c1c;
  background: rgba(255, 255, 255, 0.8);
  padding: 2px 8px;
  border-radius: 4px;
  margin-right: 8px;
  white-space: nowrap;
  font-weight: 600;
  opacity: 0.9;
  transition: all 0.2s ease;
}

.alert-err-item:hover .err-action-hint {
  background: #ef4444;
  color: #ffffff;
  opacity: 1;
}

/* ======= وميض ونبض التركيز على الحقل (Field Focus Pulse Animation) ======= */
@keyframes fieldFocusPulse {
  0% {
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.75);
    border-color: #ef4444 !important;
  }
  50% {
    box-shadow: 0 0 0 10px rgba(239, 68, 68, 0.25);
    border-color: #dc2626 !important;
    background-color: rgba(254, 242, 242, 0.35);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
  }
}

.field-focus-pulse {
  animation: fieldFocusPulse 1.8s ease-in-out !important;
  border-radius: 8px;
}

.alert-warning, .insured-card-alert.alert-warning {
  background: rgba(255, 251, 235, 0.95);
  border: 1px solid #fde68a;
  border-right: 5px solid #f59e0b;
  color: #92400e;
}

.alert-success, .insured-card-alert.alert-success {
  background: rgba(240, 253, 244, 0.95);
  border: 1px solid #bbf7d0;
  border-right: 5px solid #10b981;
  color: #166534;
}

.alert-info, .insured-card-alert.alert-info {
  background: rgba(239, 246, 255, 0.95);
  border: 1px solid #bfdbfe;
  border-right: 5px solid #3b82f6;
  color: #1e40af;
}

/* ======= نافذة التأكيد المخصصة الفاخرة (Themed Confirm Modal) ======= */
.app-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.72);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 100000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  animation: modalFadeIn 0.2s ease forwards;
}

.app-modal-card {
  background: #ffffff;
  border-radius: 20px;
  width: 100%;
  max-width: 480px;
  padding: 28px 24px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.8);
  animation: modalScaleIn 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  direction: rtl;
  text-align: right;
  overflow: hidden;
  position: relative;
}

.app-modal-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 16px;
}

.app-modal-icon {
  font-size: 1.8rem;
  line-height: 1;
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.app-modal-title {
  font-size: 1.2rem;
  font-weight: 800;
  margin: 0;
}

.app-modal-body {
  font-size: 0.96rem;
  color: #475569;
  line-height: 1.65;
  margin-bottom: 24px;
  white-space: pre-line;
}

.app-modal-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}

.app-modal-actions .btn {
  padding: 10px 20px;
  border-radius: 10px;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}

/* 🔴 سمة الحذف والأخطاء (Delete / Danger Theme) */
.modal-theme-delete, .modal-theme-danger {
  border-top: 6px solid #ef4444;
}
.modal-theme-delete .app-modal-icon, .modal-theme-danger .app-modal-icon {
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.3);
}
.modal-theme-delete .app-modal-title, .modal-theme-danger .app-modal-title {
  color: #b91c1c;
}
.modal-theme-delete .modal-btn-confirm, .modal-theme-danger .modal-btn-confirm {
  background: linear-gradient(135deg, #dc2626, #ef4444) !important;
  color: #ffffff !important;
  border: 1px solid #b91c1c !important;
  box-shadow: 0 4px 14px rgba(220, 38, 38, 0.35);
}
.modal-theme-delete .modal-btn-confirm:hover, .modal-theme-danger .modal-btn-confirm:hover {
  background: linear-gradient(135deg, #b91c1c, #dc2626) !important;
  transform: translateY(-1px);
}

/* 🟠 سمة الإلغاء والتنبيه (Cancel / Warning Theme) */
.modal-theme-cancel, .modal-theme-warning {
  border-top: 6px solid #f59e0b;
}
.modal-theme-cancel .app-modal-icon, .modal-theme-warning .app-modal-icon {
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.3);
}
.modal-theme-cancel .app-modal-title, .modal-theme-warning .app-modal-title {
  color: #b45309;
}
.modal-theme-cancel .modal-btn-confirm, .modal-theme-warning .modal-btn-confirm {
  background: linear-gradient(135deg, #d97706, #f59e0b) !important;
  color: #ffffff !important;
  border: 1px solid #b45309 !important;
  box-shadow: 0 4px 14px rgba(245, 158, 11, 0.35);
}
.modal-theme-cancel .modal-btn-confirm:hover, .modal-theme-warning .modal-btn-confirm:hover {
  background: linear-gradient(135deg, #b45309, #d97706) !important;
  transform: translateY(-1px);
}

/* 🔵 سمة الرفع النهائي والحفظ (Submit / Success Theme) */
.modal-theme-submit, .modal-theme-primary {
  border-top: 6px solid #2563eb;
}
.modal-theme-submit .app-modal-icon, .modal-theme-primary .app-modal-icon {
  background: rgba(37, 99, 235, 0.12);
  border: 1px solid rgba(37, 99, 235, 0.3);
}
.modal-theme-submit .app-modal-title, .modal-theme-primary .app-modal-title {
  color: #1e40af;
}
.modal-theme-submit .modal-btn-confirm, .modal-theme-primary .modal-btn-confirm {
  background: linear-gradient(135deg, #1d4ed8, #2563eb) !important;
  color: #ffffff !important;
  border: 1px solid #1d4ed8 !important;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.35);
}
.modal-theme-submit .modal-btn-confirm:hover, .modal-theme-primary .modal-btn-confirm:hover {
  background: linear-gradient(135deg, #1e40af, #1d4ed8) !important;
  transform: translateY(-1px);
}

/* ℹ️ سمة المعلومات (Info Theme) */
.modal-theme-info {
  border-top: 6px solid #0284c7;
}
.modal-theme-info .app-modal-icon {
  background: rgba(2, 132, 199, 0.12);
  border: 1px solid rgba(2, 132, 199, 0.3);
}
.modal-theme-info .app-modal-title {
  color: #0369a1;
}
.modal-theme-info .modal-btn-confirm {
  background: linear-gradient(135deg, #0284c7, #2563eb) !important;
  color: #ffffff !important;
  border: 1px solid #0284c7 !important;
  box-shadow: 0 4px 14px rgba(2, 132, 199, 0.35);
}

@keyframes modalFadeIn {
  0% { opacity: 0; }
  100% { opacity: 1; }
}

@keyframes modalScaleIn {
  0% { transform: scale(0.92) translateY(10px); opacity: 0; }
  100% { transform: scale(1) translateY(0); opacity: 1; }
}

/* ======= مفتاح التبديل الثلاثي للاستبيان الصحي (Tri-State Switch Button) ======= */
.health-switch-container {
  display: inline-flex;
  align-items: center;
  background: #f1f5f9;
  padding: 3px;
  border-radius: 24px;
  border: 1px solid #cbd5e1;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.06);
  user-select: none;
  gap: 2px;
}

.health-switch-btn {
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  border: none;
  background: transparent;
  color: #64748b;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  line-height: 1.2;
}

.health-switch-btn:hover:not(:disabled) {
  color: #0f172a;
}

.health-switch-btn.active-yes {
  background: linear-gradient(135deg, #16a34a, #15803d);
  color: #ffffff !important;
  box-shadow: 0 2px 6px rgba(22, 163, 74, 0.35);
}

.health-switch-btn.active-neutral {
  background: #94a3b8;
  color: #ffffff !important;
  box-shadow: 0 2px 4px rgba(148, 163, 184, 0.3);
}

.health-switch-btn.active-no {
  background: linear-gradient(135deg, #dc2626, #b91c1c);
  color: #ffffff !important;
  box-shadow: 0 2px 6px rgba(220, 38, 38, 0.35);
}

.health-switch-btn:disabled {
  cursor: not-allowed;
  opacity: 0.65;
}

/* ================================================================
   التجاوب مع الجوال والشاشات المختلفة (Responsive Design)
   ================================================================ */

/* ── تابلت كبير (≤ 1024px) ── */
@media (max-width: 1024px) {
  .page-wrapper {
    max-width: 100%;
  }

  .field-grid-3 {
    grid-template-columns: 1fr 1fr;
  }

  .upload-grid {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  }
}

/* ── تابلت صغير (≤ 768px) ── */
@media (max-width: 768px) {
  body {
    padding: 10px;
  }

  .page-wrapper {
    padding: 0;
  }

  .card {
    padding: 18px 14px;
    border-radius: 0 0 6px 6px;
  }

  .section-title {
    font-size: 1rem;
  }

  /* شريط التقدم */
  .progress-bar {
    padding: 8px 10px;
    gap: 2px;
  }

  .step-label {
    font-size: .65rem;
    padding: 4px 6px;
    gap: 3px;
  }

  .step-num {
    width: 20px;
    height: 20px;
    font-size: .65rem;
  }

  .step-divider {
    font-size: .75rem;
  }

  /* الشبكات */
  .field-row,
  .field-grid-3 {
    grid-template-columns: 1fr;
  }

  /* تاريخ الميلاد */
  .smart-dob-inputs {
    grid-template-columns: 1fr 1fr;
  }

  /* أزرار الإجراءات */
  .form-actions {
    flex-direction: column;
  }

  .form-actions .btn {
    width: 100%;
  }

  .step-nav-actions {
    flex-direction: column;
  }

  .step-nav-actions .btn {
    width: 100%;
  }

  /* جدول المشمولين */
  .insured-table-container {
    font-size: .8rem;
  }

  .insured-table th,
  .insured-table td {
    padding: 10px 10px;
    font-size: .8rem;
  }

  /* بطاقة الطفل/الزوجة */
  .child-card {
    padding: 14px 12px;
  }

  .child-card-header {
    font-size: .9rem;
  }

  /* بطاقة رفع المستندات */
  .upload-grid {
    grid-template-columns: 1fr;
  }

  /* مودال التأكيد */
  .app-modal-card {
    padding: 20px 16px;
    border-radius: 14px;
  }

  .app-modal-actions {
    flex-direction: column-reverse;
  }

  .app-modal-actions .btn {
    width: 100%;
  }
}

/* ── جوال (≤ 480px) ── */
@media (max-width: 480px) {
  body {
    padding: 8px;
    font-size: 0.9rem;
  }

  .page-wrapper {
    padding: 0;
  }

  /* شريط التقدم — نص مختصر */
  .progress-bar {
    padding: 6px 8px;
    gap: 1px;
  }

  .step-label {
    font-size: .6rem;
    padding: 3px 4px;
  }

  .step-num {
    width: 18px;
    height: 18px;
    font-size: .6rem;
  }

  /* الحقول */
  .field-group input,
  .field-group select,
  .field-group textarea {
    font-size: .88rem;
    padding: 9px 10px;
  }

  .field-group label {
    font-size: .85rem;
  }

  /* الأزرار */
  .btn {
    padding: 10px 16px;
    font-size: .88rem;
  }

  /* تاريخ الميلاد */
  .smart-dob-inputs {
    grid-template-columns: 1fr;
  }

  /* التنبيهات */
  .alert {
    font-size: .85rem;
    padding: 12px 14px;
  }

  /* بطاقة الموظف */
  .step-emp-badge {
    padding: 10px 12px;
    gap: 8px;
  }

  .step-emp-badge .badge-name {
    font-size: .85rem;
  }

  /* إشعارات Toast */
  .toast-message {
    min-width: 280px;
    font-size: .88rem;
    padding: 12px 16px;
  }

  .section-title {
    font-size: .95rem;
  }

  /* مودال */
  .app-modal-backdrop {
    padding: 10px;
  }
}

/* ── للشاشات الكبيرة جداً (≥ 1400px) ── */
@media (min-width: 1400px) {
  .page-wrapper {
    max-width: 1380px;
  }

  .field-grid-3 {
    grid-template-columns: 1fr 1fr 1fr;
  }
}

/* ── بطاقة النص الافتتاحي للجهة المشتركة (الخطوة 1) ── */
.org-opening-banner {
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.08) 0%, rgba(6, 182, 212, 0.08) 100%), #ffffff;
  border: 1.5px solid rgba(59, 130, 246, 0.35);
  border-right: 5px solid #2563eb;
  border-radius: var(--radius-md, 12px);
  padding: 16px 20px;
  margin-bottom: 24px;
  box-shadow: 0 4px 16px rgba(37, 99, 235, 0.08);
  animation: fadeInDown 0.35s ease;
}

.org-opening-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.org-opening-icon {
  font-size: 1.4rem;
  line-height: 1;
  filter: drop-shadow(0 2px 4px rgba(37, 99, 235, 0.2));
}

.org-opening-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: #1e3a8a;
}

.org-opening-text {
  font-size: 0.95rem;
  line-height: 1.7;
  color: #1e293b;
  white-space: pre-wrap;
  word-break: break-word;
}

/* ── بطاقة نص التعهد والإقرار (الخطوة 6) ── */
.pledge-card {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.04) 0%, rgba(217, 119, 6, 0.06) 100%), #ffffff;
  border: 1.5px solid rgba(245, 158, 11, 0.35);
  border-radius: var(--radius-md, 14px);
  padding: 20px;
  margin-top: 24px;
  margin-bottom: 20px;
  box-shadow: 0 4px 20px rgba(217, 119, 6, 0.08);
  transition: all 0.25s ease;
}

.pledge-card.has-error {
  border-color: #ef4444 !important;
  background: #fef2f2 !important;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.25) !important;
  animation: shakeAlert 0.4s ease;
}

.pledge-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.pledge-icon {
  font-size: 1.4rem;
  line-height: 1;
}

.pledge-title {
  font-size: 1.1rem;
  font-weight: 800;
  color: #92400e;
}

.pledge-content-box {
  background: #fffbeb;
  border: 1px solid rgba(245, 158, 11, 0.25);
  border-radius: var(--radius-sm, 8px);
  padding: 14px 16px;
  font-size: 0.93rem;
  line-height: 1.7;
  color: #78350f;
  max-height: 220px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-word;
  margin-bottom: 16px;
}

.pledge-checkbox-label {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  cursor: pointer;
  user-select: none;
  padding: 10px 12px;
  border-radius: 8px;
  transition: background 0.2s ease;
}

.pledge-checkbox-label:hover {
  background: rgba(245, 158, 11, 0.08);
}

.pledge-checkbox-label.has-error {
  background: rgba(239, 68, 68, 0.08);
  border-radius: 8px;
}

.pledge-checkbox {
  position: absolute;
  opacity: 0;
  cursor: pointer;
  height: 0;
  width: 0;
}

.pledge-checkbox-custom {
  position: relative;
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  margin-top: 2px;
  border: 2px solid #d97706;
  border-radius: 6px;
  background: #fff;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.pledge-checkbox:checked ~ .pledge-checkbox-custom {
  background: #d97706;
  border-color: #d97706;
  box-shadow: 0 2px 8px rgba(217, 119, 6, 0.35);
}

.pledge-checkbox:checked ~ .pledge-checkbox-custom::after {
  content: '';
  position: absolute;
  left: 6px;
  top: 2px;
  width: 6px;
  height: 11px;
  border: solid white;
  border-width: 0 2.5px 2.5px 0;
  transform: rotate(45deg);
}

.pledge-checkbox-label.has-error .pledge-checkbox-custom {
  border-color: #ef4444;
  box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.25);
}

.pledge-checkbox-text {
  font-size: 0.95rem;
  line-height: 1.5;
  color: #1e293b;
}

.pledge-checkbox-text strong {
  color: #b45309;
}

/* ── نافذة الكاميرا الحية (Live Camera Modal) ── */
.camera-modal-backdrop,
.cropper-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(11, 15, 26, 0.88);
  backdrop-filter: blur(8px);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: fadeIn 0.25s ease;
}

.camera-modal-card,
.cropper-modal-card {
  background: #111827;
  border: 1px solid #1e2d4a;
  border-radius: 20px;
  width: 100%;
  max-width: 640px;
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.7);
  overflow: hidden;
  position: relative;
  animation: scaleUp 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}

.cropper-modal-card {
  max-width: 720px;
}

.camera-modal-header,
.cropper-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: #1a2236;
  border-bottom: 1px solid #1e2d4a;
}

.camera-modal-title,
.cropper-modal-title {
  font-size: 1.1rem;
  font-weight: 800;
  color: #f1f5f9;
  display: flex;
  align-items: center;
  gap: 8px;
}

.camera-modal-close,
.cropper-modal-close {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #fca5a5;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 16px;
  font-weight: bold;
  transition: all 0.2s ease;
}

.camera-modal-close:hover,
.cropper-modal-close:hover {
  background: #ef4444;
  color: #fff;
}

.camera-viewport {
  position: relative;
  width: 100%;
  height: 440px;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.camera-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* إطار الدرع فوق الكاميرا */
.camera-shield-guide {
  position: absolute;
  inset: 0;
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
}

.camera-shield-img {
  width: auto;
  height: 86%;
  max-width: 82%;
  object-fit: contain;
  opacity: 0.65;
  filter: drop-shadow(0 0 16px rgba(32, 156, 211, 0.4));
}

.camera-doc-guide {
  position: absolute;
  width: 88%;
  height: 72%;
  border: 2px dashed #38bdf8;
  border-radius: 12px;
  pointer-events: none;
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.45);
}

.camera-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding: 16px 20px;
  background: #111827;
  border-top: 1px solid #1e2d4a;
}

.camera-btn-shutter {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  background: #ffffff;
  border: 5px solid #3b82f6;
  box-shadow: 0 0 24px rgba(59, 130, 246, 0.6);
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
}

.camera-btn-shutter:hover {
  transform: scale(1.08);
  box-shadow: 0 0 32px rgba(59, 130, 246, 0.9);
}

.camera-btn-shutter:active {
  transform: scale(0.94);
}

.camera-btn-flip {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #f1f5f9;
  padding: 10px 16px;
  border-radius: 12px;
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ── مساحة المحرر والمقتص (Cropper Workspace) ── */
.cropper-workspace {
  position: relative;
  width: 100%;
  height: 420px;
  background: #090d16;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
  touch-action: none;
  cursor: grab;
}

.cropper-workspace:active {
  cursor: grabbing;
}

.cropper-canvas-layer {
  position: absolute;
  transform-origin: center center;
}

.cropper-shield-frame-overlay {
  position: absolute;
  pointer-events: none;
  z-index: 10;
  border: 1.5px dashed rgba(56, 189, 248, 0.65);
  border-radius: 6px;
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.55);
}

.cropper-shield-frame-img {
  width: 100%;
  height: 100%;
  object-fit: fill;
  display: block;
  opacity: 0.65;
}

.cropper-doc-cropbox {
  position: absolute;
  border: 2px solid #38bdf8;
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.55);
  pointer-events: none;
  z-index: 10;
}

.cropper-doc-cropbox::before,
.cropper-doc-cropbox::after {
  content: '';
  position: absolute;
  inset: 0;
  border: 1px dashed rgba(255, 255, 255, 0.35);
  pointer-events: none;
}

.cropper-toolbar {
  padding: 12px 18px;
  background: #1a2236;
  border-top: 1px solid #1e2d4a;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.cropper-tools-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}

.cropper-zoom-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 220px;
}

.cropper-zoom-wrap span {
  font-size: 13px;
  color: #94a3b8;
  font-weight: 600;
}

.cropper-zoom-slider {
  flex: 1;
  accent-color: #3b82f6;
  cursor: pointer;
}

.cropper-btn-group {
  display: flex;
  gap: 8px;
}

.cropper-tool-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #f1f5f9;
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  gap: 5px;
}

.cropper-tool-btn:hover {
  background: rgba(59, 130, 246, 0.25);
  border-color: #3b82f6;
  color: #ffffff;
}

.cropper-footer {
  padding: 14px 20px;
  background: #111827;
  border-top: 1px solid #1e2d4a;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.cropper-info-hint {
  font-size: 12px;
  color: #94a3b8;
}

.cropper-actions {
  display: flex;
  gap: 10px;
}

/* ── بطاقات المرفقات المحفوظة في وضع القراءة فقط ── */
.readonly-docs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
  margin-top: 10px;
}

.readonly-doc-card {
  background: #1a2236;
  border: 1px solid #1e2d4a;
  border-radius: 12px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 8px;
  transition: all 0.2s ease;
}

.readonly-doc-card:hover {
  border-color: #3b82f6;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
}

.readonly-doc-thumb {
  width: 100%;
  height: 140px;
  object-fit: cover;
  border-radius: 8px;
  background: #0b0f1a;
  border: 1px solid rgba(255, 255, 255, 0.08);
  cursor: pointer;
  transition: transform 0.2s ease;
}

.readonly-doc-thumb:hover {
  transform: scale(1.02);
}

.readonly-doc-title {
  font-size: 13.5px;
  font-weight: 700;
  color: #f1f5f9;
}

.readonly-doc-btn {
  background: rgba(59, 130, 246, 0.15);
  border: 1px solid rgba(59, 130, 246, 0.35);
  color: #60a5fa;
  padding: 4px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
}

.readonly-doc-btn:hover {
  background: #3b82f6;
  color: #ffffff;
}

/* ── طباعة ── */
@media print {
  body {
    padding: 0;
    background: #fff;
  }

  .progress-bar,
  .step-nav-actions,
  .form-actions,
  .toast-container,
  .app-modal-backdrop {
    display: none !important;
  }

  .card {
    box-shadow: none;
    border: 1px solid #ddd;
  }
}
