/* عقارات وادي مكة — نظام التصميم (مستمد من حزمة التسليم design_handoff_wadi_makkah_tracker) */

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: 'IBM Plex Sans Arabic', sans-serif;
  background: #F7F6FA;
  direction: rtl;
  color: #241B2E;
}
::selection { background: #E3D3F0; }
input, select, button, textarea { font-family: inherit; }
a { color: #6E3A93; }
a:hover { color: #55296F; }

@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
@keyframes dialogIn { from { opacity: 0; transform: scale(0.96); } to { opacity: 1; transform: scale(1); } }

/* ---------- شاشة الدخول ---------- */
.login-screen {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  position: relative; overflow: hidden;
  background: linear-gradient(180deg, #FBFAFD 0%, #F3EEF8 100%);
}
.login-blob-1 { position: absolute; top: -120px; right: -100px; width: 420px; height: 420px; border-radius: 50%; background: radial-gradient(circle, #6E3A9322, transparent 70%); }
.login-blob-2 { position: absolute; bottom: -140px; left: -120px; width: 460px; height: 460px; border-radius: 50%; background: radial-gradient(circle, #2F6FB022, transparent 70%); }
.login-card {
  position: relative; width: 420px; max-width: 92vw; background: #FFFFFF;
  border-radius: 20px; box-shadow: 0 24px 60px -20px rgba(40,20,60,0.25);
  padding: 40px 36px; animation: fadeIn 0.4s ease;
}
.login-logo { display: flex; justify-content: center; margin-bottom: 28px; }
.login-logo img { width: 220px; height: auto; object-fit: contain; }
.login-form { display: flex; flex-direction: column; gap: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field-label { font-size: 13px; font-weight: 600; color: #6E6678; }
.field input, .field select {
  height: 46px; border-radius: 10px; border: 1.5px solid #E3DFEA;
  padding: 0 14px; font-size: 15px; color: #241B2E; background: #FBFAFD; outline: none;
}
.field input:focus, .field select:focus { border-color: #6E3A93; }
.btn-primary {
  height: 48px; border-radius: 10px; border: none; background: #6E3A93; color: #fff;
  font-size: 16px; font-weight: 600; cursor: pointer;
}
.login-form .btn-primary { margin-top: 8px; box-shadow: 0 10px 24px -8px #6E3A9377; }
.btn-primary:hover { background: #55296F; }
.login-error { background: #FBEAE8; color: #C0392B; border-radius: 10px; padding: 10px 14px; font-size: 13.5px; font-weight: 600; }

/* ---------- هيكل التطبيق ---------- */
.shell { display: flex; min-height: 100vh; }
.shell-main { flex: 1; display: flex; flex-direction: column; min-width: 0; order: 2; }

.topbar {
  height: 72px; flex-shrink: 0; background: #FFFFFF; border-bottom: 1px solid #E3DFEA;
  display: flex; align-items: center; justify-content: space-between; padding: 0 28px;
}
.topbar-logo { height: 40px; width: auto; object-fit: contain; cursor: pointer; order: 2; }
.topbar-actions { display: flex; align-items: center; gap: 10px; order: 1; }
.topbar-divider { width: 1px; height: 26px; background: #E3DFEA; margin: 0 4px; }
.role-badge { display: flex; align-items: center; gap: 8px; background: #F7F6FA; border-radius: 20px; padding: 6px 14px; }
.role-avatar { width: 26px; height: 26px; border-radius: 50%; background: #6E3A93; color: #fff; font-size: 12px; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.role-name { font-size: 13px; font-weight: 600; color: #6E6678; }

.btn-toolbar {
  height: 40px; padding: 0 18px; border-radius: 9px; border: 1.5px solid #E3DFEA;
  background: #FBFAFD; color: #241B2E; font-size: 14px; font-weight: 600; cursor: pointer;
  display: flex; align-items: center; gap: 6px;
}
.btn-toolbar:hover { border-color: #6E3A93; }
.btn-toolbar:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-toolbar:disabled:hover { border-color: #E3DFEA; }
.btn-toolbar-primary {
  height: 40px; padding: 0 18px; border-radius: 9px; border: none;
  background: #6E3A93; color: #fff; font-size: 14px; font-weight: 600; cursor: pointer;
}
.btn-toolbar-primary:hover { background: #55296F; }

.export-wrap { position: relative; }
.export-menu {
  position: absolute; top: 46px; left: 0; width: 230px; background: #fff;
  border: 1px solid #E3DFEA; border-radius: 12px;
  box-shadow: 0 16px 40px -12px rgba(40,20,60,0.25); padding: 8px; z-index: 20;
  animation: fadeIn 0.15s ease;
}
.export-item { width: 100%; text-align: right; padding: 10px 12px; border-radius: 8px; border: none; background: transparent; cursor: pointer; font-size: 14px; color: #241B2E; display: block; }
.export-item:hover { background: #F5EEFA; }
.export-item .hint { font-size: 11.5px; color: #9A93A8; font-weight: 400; margin-top: 2px; }

.page-header { padding: 22px 28px 0; }
.page-header h1 { margin: 0; font-size: 22px; font-weight: 700; color: #241B2E; }
.content { flex: 1; padding: 16px 28px 28px; overflow: auto; }

/* شريط التنقل الأيمن */
.nav-rail {
  width: 88px; flex-shrink: 0; background: #FFFFFF; border-left: 1px solid #E3DFEA;
  display: flex; flex-direction: column; align-items: center; padding: 18px 0; gap: 4px; order: 1;
}
.nav-item {
  width: 72px; display: flex; flex-direction: column; align-items: center; gap: 5px;
  padding: 10px 4px; border-radius: 12px; border: none; background: transparent; cursor: pointer;
  color: #9A93A8;
}
.nav-item:hover { background: #F7F6FA; }
.nav-item.active { background: #F5EEFA; color: #6E3A93; }
.nav-item .nav-icon { width: 22px; height: 22px; }
.nav-item .nav-label { font-size: 10.5px; font-weight: 600; text-align: center; line-height: 1.3; }

/* ---------- الجداول ---------- */
.table-card {
  background: #fff; border: 1px solid #E3DFEA; border-radius: 14px; overflow: hidden;
  box-shadow: 0 2px 10px -6px rgba(40,20,60,0.08);
}
.table-scroll { overflow-x: auto; }
table.data { border-collapse: collapse; width: 100%; font-size: 13.5px; }
/* جدول حالة المواقع: الأعمدة من "م" إلى "نسبة المسدد" تملأ الشاشة كاملة (زوم تلقائي
   تكبيراً أو تصغيراً)، وعمود الملاحظات خارج الشاشة يُصل إليه بالتمرير */
/* التمرير داخل إطار الجدول: الشريط الأفقي ظاهر دائماً والرؤوس مثبتة أثناء النزول */
.status-fit { overflow: auto; }
.status-fit::-webkit-scrollbar { height: 12px; width: 12px; }
.status-fit::-webkit-scrollbar-thumb { background: #C9BFD6; border-radius: 6px; }
.status-fit::-webkit-scrollbar-thumb:hover { background: #6E3A93; }
.status-fit::-webkit-scrollbar-track { background: #F0EEF4; }
table.data.status-table { width: max-content; min-width: 100%; font-size: 12px; border-collapse: separate; border-spacing: 0; }
table.data.status-table thead th { position: sticky; z-index: 6; }
table.data.status-table thead tr.group-row th { top: 0; z-index: 7; background-clip: padding-box; }
table.data.status-table thead tr.group-row th.group { background: #F7F6FA; }
table.data.status-table thead tr.group-row th.g-tenant { background: #EEF4FA; }
table.data.status-table thead tr.group-row th.g-fin { background: #F5EEFA; }
table.data.status-table thead tr.label-row th { background: #FBFAFD; }
table.data.status-table thead tr.label-row th.g-tenant { background: #EEF4FA; }
table.data.status-table thead tr.label-row th.g-fin { background: #F5EEFA; }
table.data.status-table th {
  white-space: normal; text-align: center; vertical-align: middle;
  line-height: 1.35; padding: 6px 4px; font-size: 11.5px;
}
table.data.status-table td { padding: 7px 5px; }
table.data.status-table .company-inner {
  white-space: normal; max-width: 185px; min-width: 120px; line-height: 1.4; font-weight: 600;
}
table.data.status-table .notes-inner { white-space: normal; max-width: 300px; min-width: 110px; }
table.data.full-table { min-width: 2400px; font-size: 13px; }

table.data thead tr.group-row { background: #F7F6FA; }
table.data thead tr.label-row { background: #FBFAFD; }
table.data th {
  padding: 9px 8px; border-bottom: 1px solid #E3DFEA; border-left: 1px solid #F0EEF4;
  font-weight: 600; color: #6E6678; white-space: nowrap;
}
table.data th.group { font-weight: 700; border-left: 1px solid #E3DFEA; }
table.data th.g-tenant { color: #2F6FB0; background: #EEF4FA; }
table.data th.g-fin { color: #6E3A93; background: #F5EEFA; }
table.data th.fin-border { border-left: 1px solid #F0E4F7; }
table.data th .sort { cursor: pointer; margin-right: 4px; user-select: none; }
table.data th .sort:hover { color: #6E3A93; }

table.data td {
  padding: 9px 8px; border-bottom: 1px solid #F0EEF4; border-left: 1px solid #F0EEF4;
  white-space: nowrap; background-clip: padding-box;
}
table.data td:last-child, table.data th:last-child { border-left: none; }
table.data td.m-cell { color: #9A93A8; text-align: center; }
table.data td.company-cell { font-weight: 600; }
table.data td.muted { color: #6E6678; }
table.data td.due-cell { font-weight: 700; background: #FDF4E4; }
table.data td.notes-cell { color: #9A93A8; }
table.data tr.selected td { background: #F5EEFA; }
table.data td.check-cell { text-align: center; }
table.data input[type="checkbox"] { width: 16px; height: 16px; accent-color: #6E3A93; cursor: pointer; }

/* خلايا التعديل داخل الجدول */
table.data td input.cell-input {
  width: 100%; min-width: 90px; height: 30px; border-radius: 6px; border: 1.5px solid #D3CADF;
  padding: 0 8px; font-size: 13px; font-family: inherit; outline: none; background: #FBFAFD;
}
table.data td input.cell-input:focus { border-color: #6E3A93; background: #fff; }

.selection-hint { font-size: 12.5px; color: #9A93A8; padding-top: 8px; outline: none; }
.table-actions { display: flex; gap: 12px; align-items: center; padding-top: 12px; }
.btn-danger { height: 44px; padding: 0 22px; border-radius: 9px; border: none; background: #C0392B; color: #fff; font-size: 14px; font-weight: 700; cursor: pointer; }
.btn-danger:hover { background: #A02E22; }
.btn-action-primary { height: 44px; padding: 0 22px; border-radius: 9px; border: none; background: #6E3A93; color: #fff; font-size: 14px; font-weight: 700; cursor: pointer; }
.btn-action-primary:hover { background: #55296F; }
.btn-back { height: 44px; padding: 0 22px; border-radius: 9px; border: 1.5px solid #E3DFEA; background: #fff; font-size: 14px; font-weight: 600; cursor: pointer; }
.btn-back:hover { border-color: #6E3A93; }

.banner-success {
  background: #EAF6EC; color: #2C7A3D; border-radius: 10px; padding: 10px 14px;
  font-size: 13.5px; font-weight: 600; width: fit-content; margin-top: 12px; animation: fadeIn 0.2s ease;
}
.banner-error {
  background: #FBEAE8; color: #C0392B; border-radius: 10px; padding: 10px 14px;
  font-size: 13.5px; font-weight: 600; width: fit-content; margin-top: 12px; animation: fadeIn 0.2s ease;
}

/* ---------- تحصيل مبلغ ---------- */
.collect-wrap { max-width: 640px; display: flex; flex-direction: column; gap: 20px; }
.card { background: #fff; border: 1px solid #E3DFEA; border-radius: 14px; padding: 22px; }
.collect-inputs { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.collect-inputs .field input { height: 44px; border-radius: 9px; padding: 0 12px; font-size: 14px; background: #fff; }
.combo-wrap { position: relative; }
.combo-menu {
  position: absolute; top: 74px; right: 0; left: 0; background: #fff; border: 1px solid #E3DFEA;
  border-radius: 10px; box-shadow: 0 14px 30px -10px rgba(40,20,60,0.2); z-index: 10;
  max-height: 220px; overflow: auto;
}
.combo-item { padding: 10px 12px; font-size: 14px; cursor: pointer; border-bottom: 1px solid #F0EEF4; }
.combo-item:last-child { border-bottom: none; }
.combo-item:hover { background: #F5EEFA; }
.combo-item .site { color: #9A93A8; font-size: 12px; }
.multi-select { background: #F7F6FA; border-radius: 10px; padding: 12px; display: flex; flex-direction: column; gap: 8px; margin-top: 14px; }
.multi-select .hint { font-size: 12.5px; font-weight: 600; color: #6E6678; }
.multi-option { text-align: right; padding: 10px 12px; border-radius: 8px; border: 1.5px solid #E3DFEA; background: #fff; cursor: pointer; font-size: 13.5px; }
.multi-option:hover { border-color: #6E3A93; }

.summary-card { animation: fadeIn 0.25s ease; }
.summary-title { font-size: 14px; font-weight: 700; color: #6E3A93; margin-bottom: 14px; }
.summary-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 20px; font-size: 13.5px; }
.summary-grid .k { color: #9A93A8; }
.summary-grid .v { font-weight: 600; margin-top: 2px; }
.summary-grid .v.danger { color: #C0392B; }
.summary-sep { height: 1px; background: #F0EEF4; margin: 18px 0; }
.amount-input {
  height: 56px; border-radius: 12px; border: 2px solid #6E3A93; padding: 0 16px;
  font-size: 22px; font-weight: 700; outline: none; color: #6E3A93; width: 100%;
}
.collect-submit { margin-top: 16px; width: 100%; height: 48px; border-radius: 10px; border: none; background: #6E3A93; color: #fff; font-size: 15px; font-weight: 700; cursor: pointer; }
.collect-submit:hover { background: #55296F; }

/* ---------- إضافة موقع ---------- */
.upload-wrap { max-width: 640px; }
.dropzone {
  border: 2px dashed #D3CADF; border-radius: 16px; background: #FBFAFD;
  padding: 48px 24px; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 14px; cursor: pointer; transition: all 0.15s ease; min-height: 260px; text-align: center;
}
.dropzone.hover { border-color: #6E3A93; background: #F5EEFA; }
.dropzone.success { border-color: #2C7A3D; cursor: default; }
.dropzone.error { border-color: #C0392B; cursor: default; }
.dz-title { font-size: 16px; font-weight: 700; color: #241B2E; }
.dz-sub { font-size: 13px; color: #9A93A8; }
.dz-spinner { animation: spin 1s linear infinite; }
.dz-summary {
  width: 100%; background: #F7F6FA; border-radius: 10px; padding: 14px 16px;
  font-size: 13px; color: #6E6678; text-align: right; display: flex; flex-direction: column; gap: 6px;
}
.dz-summary b { color: #241B2E; }
.dz-flag { color: #B8860B; }
.dz-complete { width: 100%; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; text-align: right; }
.dz-complete .field select, .dz-complete .field input { height: 40px; font-size: 13.5px; background: #fff; }
.btn-small { height: 38px; padding: 0 18px; border-radius: 8px; border: 1.5px solid #E3DFEA; background: #fff; font-size: 13.5px; font-weight: 600; cursor: pointer; }
.btn-small:hover { border-color: #6E3A93; }
.btn-small-primary { height: 38px; padding: 0 18px; border-radius: 8px; border: none; background: #6E3A93; color: #fff; font-size: 13.5px; font-weight: 600; cursor: pointer; }
.btn-small-primary:hover { background: #55296F; }

/* ---------- إضافة حي / مدينة ---------- */
.district-wrap { max-width: 560px; display: flex; flex-direction: column; gap: 20px; }
.district-form { display: flex; flex-direction: column; gap: 16px; }
.district-form p { margin: 0; font-size: 14.5px; line-height: 1.9; color: #6E6678; }
.district-form input { height: 48px; border-radius: 10px; border: 1.5px solid #E3DFEA; padding: 0 14px; font-size: 14.5px; outline: none; }
.district-form input:focus { border-color: #6E3A93; }
.district-form .btn-primary { height: 46px; font-size: 14.5px; font-weight: 700; }
.chips-title { font-size: 13px; font-weight: 700; color: #6E6678; margin-bottom: 10px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { background: #F5EEFA; color: #6E3A93; font-size: 13px; font-weight: 600; padding: 6px 14px; border-radius: 20px; animation: fadeIn 0.2s ease; }

/* ---------- حوار التأكيد ---------- */
.dialog-overlay {
  position: fixed; inset: 0; background: rgba(30,15,45,0.45);
  display: flex; align-items: center; justify-content: center; z-index: 100;
}
.dialog {
  background: #fff; border-radius: 16px; padding: 28px; width: 360px; max-width: 90vw;
  animation: dialogIn 0.15s ease; text-align: center;
}
.dialog-icon { width: 52px; height: 52px; border-radius: 50%; background: #FBEAE8; display: flex; align-items: center; justify-content: center; margin: 0 auto 16px; }
.dialog-title { font-size: 17px; font-weight: 700; color: #241B2E; margin-bottom: 8px; }
.dialog-sub { font-size: 13.5px; color: #9A93A8; margin-bottom: 22px; }
.dialog-actions { display: flex; gap: 10px; }
.dialog-actions .btn-danger { flex: 1; }
.dialog-actions .btn-back { flex: 1; }

/* إشعار عائم (toast) */
.toast {
  position: fixed; bottom: 24px; right: 50%; transform: translateX(50%);
  background: #241B2E; color: #fff; border-radius: 10px; padding: 12px 20px;
  font-size: 13.5px; font-weight: 600; z-index: 200; animation: fadeIn 0.2s ease;
  box-shadow: 0 14px 30px -10px rgba(40,20,60,0.4);
}
.toast.error { background: #C0392B; }
