/* ═══════════════════════════════════════════════════════════
   CRM قرطاسية خالد
   التوكنز مأخوذة من khs.ac/css/style.css عشان الهوية تبقى واحدة.
   الفرق: هنا شاشة شغل كثيفة، فالمسافات والحواف أصغر من الموقع.
   ═══════════════════════════════════════════════════════════ */

:root {
  --teal:       #2BBFBF;
  --teal-dark:  #1A9898;
  --teal-light: #9EE3E3;
  --teal-pale:  #E0F7F7;
  --navy:       #1E3A4C;
  --navy-mid:   #2C546A;
  --navy-soft:  #5A7383;
  --gray-cool:  #B8C4CA;
  --white:      #FFFFFF;
  --off-white:  #F7FAFA;

  --green:  #8DC63F;
  --yellow: #F5A623;
  --pink:   #E91E8C;
  --coral:  #F05A28;

  --line:      #E3EAEC;
  --line-soft: #EFF4F5;

  --font-ar: 'Cairo', 'Segoe UI', Tahoma, sans-serif;
  --font-en: 'Cormorant Garamond', Georgia, serif;
  --font-mono: 'DM Mono', 'SF Mono', Consolas, monospace;

  --radius: 14px;
  --radius-sm: 8px;
  --radius-pill: 50px;
  --shadow: 0 2px 16px rgba(30, 58, 76, 0.06);
  --shadow-lift: 0 10px 34px rgba(30, 58, 76, 0.12);
  --transition: 0.28s cubic-bezier(0.16, 1, 0.3, 1);

  --bar-h: 62px;
}

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

html { font-size: 16px; }

body {
  background: var(--off-white);
  color: var(--navy);
  font-family: var(--font-ar);
  font-size: 14px;
  line-height: 1.6;
  direction: rtl;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
ul { list-style: none; }
img { display: block; max-width: 100%; }
button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
button { cursor: pointer; border: none; background: none; }

/* رقم بخط ثابت العرض — الأعمدة الرقمية تفضل متسقة */
.num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

/* التوقيع البصري بتاع khs: سطر صغير monospace قبله شرطة teal */
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--teal-dark);
  font-weight: 500;
}
.eyebrow::before {
  content: '';
  width: 18px;
  height: 1.5px;
  background: var(--teal);
  flex: none;
}

/* ═══ شريط علوي ═══════════════════════════════════════════ */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--bar-h);
  background: var(--navy);
  display: flex;
  align-items: center;
  gap: 30px;
  padding: 0 26px;
}
.topbar-logo img { height: 30px; width: auto; filter: brightness(0) invert(1); }

.topnav { display: flex; gap: 4px; margin-inline-start: 8px; }
.topnav a {
  padding: 8px 16px;
  border-radius: var(--radius-pill);
  color: rgba(255, 255, 255, 0.62);
  font-size: 13.5px;
  font-weight: 600;
  transition: color var(--transition), background var(--transition);
}
.topnav a:hover { color: #fff; background: rgba(255, 255, 255, 0.07); }
.topnav a.on { color: var(--navy); background: var(--teal-light); }

.topbar-end { margin-inline-start: auto; display: flex; align-items: center; gap: 16px; }
.topbar-user {
  font-family: var(--font-mono);
  font-size: 11px;
  color: rgba(255, 255, 255, 0.45);
  letter-spacing: 0.06em;
}
.btn-logout {
  color: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.22);
  padding: 6px 15px;
  border-radius: var(--radius-pill);
  font-size: 12.5px;
  font-weight: 600;
  transition: var(--transition);
}
.btn-logout:hover { color: #fff; border-color: rgba(255, 255, 255, 0.6); background: rgba(255,255,255,0.08); }

/* ═══ تخطيط الصفحة ════════════════════════════════════════ */
.wrap { padding: 26px; max-width: 1760px; margin: 0 auto; }

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 22px;
  flex-wrap: wrap;
}
.page-title {
  font-size: 27px;
  font-weight: 800;
  line-height: 1.2;
  margin-top: 7px;
  letter-spacing: -0.01em;
}
.page-sub {
  direction: ltr;
  font-family: var(--font-en);
  font-style: italic;
  font-size: 15px;
  color: var(--gray-cool);
  font-weight: 300;
}

.layout {
  display: grid;
  grid-template-columns: 262px minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

/* ═══ بطاقات ══════════════════════════════════════════════ */
.card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card-head {
  padding: 15px 18px;
  border-bottom: 1px solid var(--line-soft);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}
.card-title { font-size: 14.5px; font-weight: 700; }
.card-body { padding: 18px; }

/* ═══ الشريط الجانبي (الفلاتر) ════════════════════════════ */
.rail {
  position: sticky;
  top: calc(var(--bar-h) + 18px);
  max-height: calc(100vh - var(--bar-h) - 38px);
  overflow-y: auto;
  overscroll-behavior: contain;
}
.rail::-webkit-scrollbar { width: 7px; }
.rail::-webkit-scrollbar-thumb { background: var(--line); border-radius: 4px; }
.rail::-webkit-scrollbar-thumb:hover { background: var(--gray-cool); }

.rail-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line-soft);
}
.rail-clear { font-size: 11.5px; color: var(--coral); font-weight: 600; }
.rail-clear:hover { text-decoration: underline; }

.fgroup { border-bottom: 1px solid var(--line-soft); }
.fgroup:last-child { border-bottom: none; }
.fgroup > summary {
  padding: 11px 16px;
  cursor: pointer;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--navy-mid);
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  user-select: none;
}
.fgroup > summary::-webkit-details-marker { display: none; }
.fgroup > summary::after {
  content: '';
  width: 6px; height: 6px;
  border-right: 1.6px solid var(--gray-cool);
  border-bottom: 1.6px solid var(--gray-cool);
  transform: rotate(45deg);
  transition: transform var(--transition);
  margin-bottom: 3px;
}
.fgroup[open] > summary::after { transform: rotate(-135deg); margin-bottom: -3px; }
.fgroup > summary:hover { background: var(--off-white); }
.fgroup-body { padding: 2px 16px 14px; }
.fgroup-scroll { max-height: 232px; overflow-y: auto; margin-inline-end: -6px; padding-inline-end: 6px; }

.opt {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 5px 0;
  cursor: pointer;
  font-size: 13px;
  color: var(--navy-mid);
}
.opt:hover { color: var(--navy); }
.opt input { accent-color: var(--teal-dark); width: 15px; height: 15px; cursor: pointer; flex: none; }
.opt-label { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.opt-count {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--gray-cool);
  flex: none;
}
.opt input:checked ~ .opt-label { font-weight: 700; color: var(--navy); }

.search-box {
  width: 100%;
  padding: 10px 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--off-white);
  transition: var(--transition);
}
.search-box:focus {
  outline: none;
  border-color: var(--teal);
  background: #fff;
  box-shadow: 0 0 0 3px var(--teal-pale);
}

/* ═══ أزرار ═══════════════════════════════════════════════ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 19px;
  border-radius: var(--radius-pill);
  font-size: 13px;
  font-weight: 700;
  transition: var(--transition);
  border: 1px solid transparent;
  white-space: nowrap;
}
.btn-primary { background: var(--navy); color: #fff; }
.btn-primary:hover { background: var(--navy-mid); transform: translateY(-1px); box-shadow: 0 6px 18px rgba(30,58,76,.22); }
.btn-teal { background: var(--teal); color: #fff; }
.btn-teal:hover { background: var(--teal-dark); transform: translateY(-1px); box-shadow: 0 6px 18px rgba(43,191,191,.3); }
.btn-ghost { border-color: var(--line); color: var(--navy-mid); background: #fff; }
.btn-ghost:hover { border-color: var(--gray-cool); color: var(--navy); }
.btn-sm { padding: 6px 13px; font-size: 12px; }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; box-shadow: none; }

/* ═══ شارات ═══════════════════════════════════════════════ */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  font-size: 11.5px;
  font-weight: 700;
  white-space: nowrap;
  line-height: 1.7;
}
.chip-navy   { background: #E8EDEF; color: var(--navy); }
.chip-teal   { background: var(--teal-pale); color: var(--teal-dark); }
.chip-green  { background: #EDF7DC; color: #5C8A16; }
.chip-yellow { background: #FDF0DA; color: #A4690B; }
.chip-gray   { background: #F0F3F4; color: #7E939D; }
.chip-coral  { background: #FDE9E1; color: #C2431A; }

/* أولوية — مربع صغير بحرف واحد */
.prio {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 23px; height: 23px;
  border-radius: 7px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 500;
  flex: none;
}
.prio-A { background: var(--teal); color: #fff; }
.prio-B { background: var(--teal-pale); color: var(--teal-dark); }
.prio-C { background: #F0F3F4; color: var(--navy-soft); }
.prio-D { background: #F7F9F9; color: var(--gray-cool); }

/* ═══ الجدول ══════════════════════════════════════════════ */
.table-scroll { overflow-x: auto; }
table.leads { width: 100%; border-collapse: collapse; }

table.leads thead th {
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--white);
  text-align: start;
  font-size: 10.5px;
  font-family: var(--font-mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--navy-soft);
  font-weight: 500;
  padding: 12px 12px;
  border-bottom: 1.5px solid var(--line);
  white-space: nowrap;
}
table.leads thead th a { display: inline-flex; align-items: center; gap: 4px; }
table.leads thead th a:hover { color: var(--teal-dark); }
th .sorted { color: var(--teal-dark); }

table.leads tbody td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--line-soft);
  vertical-align: middle;
}
table.leads tbody tr { transition: background 0.15s; }
table.leads tbody tr:hover { background: #FBFDFD; }
table.leads tbody tr.picked { background: var(--teal-pale); }
table.leads tbody tr:last-child td { border-bottom: none; }

.lead-name {
  font-weight: 700;
  font-size: 13.5px;
  display: block;
  max-width: 320px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.lead-name:hover { color: var(--teal-dark); }
.lead-cat {
  font-size: 11.5px;
  color: var(--navy-soft);
  max-width: 320px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cell-city { font-size: 13px; }
.cell-city small { display: block; font-size: 11px; color: var(--gray-cool); }

.contact-row { display: flex; align-items: center; gap: 6px; }
.ico {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 27px; height: 27px;
  border-radius: 8px;
  background: var(--off-white);
  border: 1px solid var(--line);
  color: var(--navy-soft);
  transition: var(--transition);
}
.ico:hover { background: var(--teal); border-color: var(--teal); color: #fff; transform: translateY(-1px); }
.ico svg { width: 14px; height: 14px; }

.phone-link { font-family: var(--font-mono); font-size: 12.5px; direction: ltr; display: inline-block; }
.phone-link:hover { color: var(--teal-dark); }

.rating-cell { display: inline-flex; align-items: baseline; gap: 3px; font-family: var(--font-mono); font-size: 12.5px; }
.rating-cell .star { color: var(--yellow); font-size: 11px; }

/* قوائم منسدلة داخل الجدول — تعديل سريع بدون فتح الليد */
.inline-select {
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  padding: 4px 26px 4px 11px;
  font-size: 11.5px;
  font-weight: 700;
  background-color: #fff;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='9' height='6' viewBox='0 0 9 6'%3E%3Cpath d='M1 1l3.5 3.5L8 1' stroke='%23B8C4CA' stroke-width='1.6' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: left 9px center;
  appearance: none;
  cursor: pointer;
  transition: var(--transition);
  max-width: 128px;
}
.inline-select:hover { border-color: var(--gray-cool); }
.inline-select:focus { outline: none; border-color: var(--teal); box-shadow: 0 0 0 3px var(--teal-pale); }
.inline-select.saving { opacity: .5; }
.inline-select.saved { border-color: var(--green); box-shadow: 0 0 0 3px #EDF7DC; }

.sel-navy   { color: var(--navy);      background-color: #E8EDEF; border-color: #DCE4E7; }
.sel-teal   { color: var(--teal-dark); background-color: var(--teal-pale); border-color: #C5EDED; }
.sel-green  { color: #5C8A16;          background-color: #EDF7DC; border-color: #DCEDC0; }
.sel-yellow { color: #A4690B;          background-color: #FDF0DA; border-color: #F7E2BE; }
.sel-gray   { color: #7E939D;          background-color: #F0F3F4; border-color: #E3EAEC; }

.note-dot {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--navy-soft);
}

/* ═══ شريط الأدوات فوق الجدول ═════════════════════════════ */
.toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 13px 16px;
  border-bottom: 1px solid var(--line-soft);
}
.result-count { font-size: 13px; color: var(--navy-soft); }
.result-count b { color: var(--navy); font-family: var(--font-mono); font-size: 15px; }
.toolbar-end { margin-inline-start: auto; display: flex; align-items: center; gap: 9px; }

/* شرائح الفلاتر الفعّالة */
.pills { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 16px 13px; }
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--teal-pale);
  color: var(--teal-dark);
  border-radius: var(--radius-pill);
  padding: 3px 6px 3px 11px;
  font-size: 11.5px;
  font-weight: 600;
}
.pill a { color: var(--teal-dark); opacity: .55; font-size: 14px; line-height: 1; padding: 0 2px; }
.pill a:hover { opacity: 1; }

/* شريط التعديل الجماعي */
.bulkbar {
  display: none;
  align-items: center;
  gap: 11px;
  flex-wrap: wrap;
  padding: 12px 16px;
  background: var(--navy);
  color: #fff;
}
.bulkbar.on { display: flex; }
.bulkbar b { font-family: var(--font-mono); }
.bulkbar select {
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.22);
  color: #fff;
  border-radius: var(--radius-pill);
  padding: 6px 13px;
  font-size: 12.5px;
}
.bulkbar select option { color: var(--navy); background: #fff; }
.bulkbar .btn-teal { padding: 6px 16px; font-size: 12.5px; }
.bulkbar-clear { color: rgba(255,255,255,.6); font-size: 12px; text-decoration: underline; }

/* ═══ ترقيم الصفحات ═══════════════════════════════════════ */
.pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 18px;
  flex-wrap: wrap;
}
.pager a, .pager span {
  min-width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 10px;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 12.5px;
  border: 1px solid var(--line);
  background: #fff;
  transition: var(--transition);
}
.pager a:hover { border-color: var(--teal); color: var(--teal-dark); }
.pager .cur { background: var(--navy); color: #fff; border-color: var(--navy); }
.pager .gap { border: none; background: none; color: var(--gray-cool); }

/* ═══ لوحة المؤشرات ═══════════════════════════════════════ */
.kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(178px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}
.kpi {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 17px 19px;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}
.kpi::after {
  content: '';
  position: absolute;
  inset-block-start: 0;
  inset-inline-start: 0;
  width: 3px;
  height: 100%;
  background: var(--teal);
}
.kpi.k-navy::after  { background: var(--navy); }
.kpi.k-green::after { background: var(--green); }
.kpi.k-coral::after { background: var(--coral); }
.kpi-label {
  font-size: 11.5px;
  color: var(--navy-soft);
  font-weight: 600;
  margin-bottom: 5px;
}
.kpi-value {
  font-family: var(--font-mono);
  font-size: 29px;
  font-weight: 500;
  line-height: 1.1;
  letter-spacing: -0.02em;
}
.kpi-foot { font-size: 11.5px; color: var(--gray-cool); margin-top: 3px; }

.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 18px; }

/* قمع المراحل */
.funnel-row {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 9px 0;
  border-bottom: 1px dashed var(--line-soft);
}
.funnel-row:last-child { border-bottom: none; }
.funnel-name { width: 88px; font-size: 13px; font-weight: 600; flex: none; }
.funnel-bar { flex: 1; height: 9px; background: var(--off-white); border-radius: 5px; overflow: hidden; }
.funnel-fill { height: 100%; border-radius: 5px; transition: width .6s cubic-bezier(0.16,1,0.3,1); }
.f-navy   { background: var(--navy-mid); }
.f-teal   { background: var(--teal); }
.f-yellow { background: var(--yellow); }
.f-green  { background: var(--green); }
.f-gray   { background: var(--gray-cool); }
.funnel-num { width: 62px; text-align: end; font-family: var(--font-mono); font-size: 13px; flex: none; }
.funnel-num small { color: var(--gray-cool); font-size: 10.5px; }

/* جدول مدمج للوحة */
table.mini { width: 100%; border-collapse: collapse; }
table.mini th {
  text-align: start;
  font-size: 10.5px;
  font-family: var(--font-mono);
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--navy-soft);
  font-weight: 500;
  padding: 0 8px 9px;
  border-bottom: 1px solid var(--line);
}
table.mini td { padding: 8px; border-bottom: 1px solid var(--line-soft); font-size: 13px; }
table.mini tr:last-child td { border-bottom: none; }
table.mini tr:hover td { background: #FBFDFD; }
table.mini .n { font-family: var(--font-mono); font-size: 12.5px; text-align: end; }

.act-list li {
  display: flex;
  gap: 11px;
  padding: 9px 0;
  border-bottom: 1px dashed var(--line-soft);
  font-size: 12.5px;
}
.act-list li:last-child { border-bottom: none; }
.act-when { font-family: var(--font-mono); font-size: 10.5px; color: var(--gray-cool); flex: none; width: 74px; }
.act-body { flex: 1; }
.act-body b { font-weight: 700; }
.act-body span { color: var(--navy-soft); }

/* ═══ صفحة الليد ══════════════════════════════════════════ */
.lead-layout { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 18px; align-items: start; }

.lead-hero {
  background: var(--navy);
  color: #fff;
  border-radius: var(--radius);
  padding: 24px 26px;
  margin-bottom: 18px;
  position: relative;
  overflow: hidden;
}
.lead-hero::after {
  content: '';
  position: absolute;
  inset-block-start: -60px;
  inset-inline-end: -40px;
  width: 190px; height: 190px;
  border-radius: 50%;
  background: rgba(43, 191, 191, 0.09);
}
.lead-hero h1 { font-size: 24px; font-weight: 800; line-height: 1.3; position: relative; }
.lead-hero .lead-meta {
  display: flex;
  gap: 9px;
  flex-wrap: wrap;
  align-items: center;
  margin-top: 12px;
  position: relative;
}
.lead-hero .chip-dark {
  background: rgba(255,255,255,.11);
  color: rgba(255,255,255,.88);
  border: 1px solid rgba(255,255,255,.16);
}
.lead-actions { display: flex; gap: 9px; margin-top: 18px; flex-wrap: wrap; position: relative; }
.lead-actions .btn-ghost { background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.24); color: #fff; }
.lead-actions .btn-ghost:hover { background: rgba(255,255,255,.16); border-color: rgba(255,255,255,.5); color: #fff; }

.dl { display: grid; grid-template-columns: 128px minmax(0, 1fr); gap: 1px 14px; }
.dl dt {
  font-size: 11.5px;
  color: var(--navy-soft);
  font-weight: 600;
  padding: 9px 0;
  border-bottom: 1px solid var(--line-soft);
}
.dl dd {
  font-size: 13.5px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line-soft);
  word-break: break-word;
}
.dl dt:last-of-type, .dl dd:last-of-type { border-bottom: none; }
.dl a { color: var(--teal-dark); font-weight: 600; }
.dl a:hover { text-decoration: underline; }
.dl .muted { color: var(--gray-cool); }

.field { margin-bottom: 14px; }
.field label {
  display: block;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--navy-soft);
  margin-bottom: 6px;
}
.field select, .field input[type="date"], .field textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
  transition: var(--transition);
}
.field select:focus, .field input:focus, .field textarea:focus {
  outline: none;
  border-color: var(--teal);
  box-shadow: 0 0 0 3px var(--teal-pale);
}
.field textarea { resize: vertical; min-height: 84px; line-height: 1.7; }

.note {
  padding: 12px 14px;
  background: var(--off-white);
  border-radius: var(--radius-sm);
  border-inline-start: 3px solid var(--teal);
  margin-bottom: 9px;
}
.note-body { font-size: 13.5px; white-space: pre-wrap; line-height: 1.75; }
.note-when { font-family: var(--font-mono); font-size: 10.5px; color: var(--gray-cool); margin-top: 6px; }

.timeline { position: relative; padding-inline-start: 17px; }
.timeline::before {
  content: '';
  position: absolute;
  inset-block: 6px;
  inset-inline-start: 4px;
  width: 1.5px;
  background: var(--line);
}
.timeline li { position: relative; padding: 7px 0; font-size: 12.5px; }
.timeline li::before {
  content: '';
  position: absolute;
  inset-inline-start: -17px;
  top: 14px;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--teal);
  border: 2px solid #fff;
  box-shadow: 0 0 0 1.5px var(--teal-light);
}
.timeline .t-when { font-family: var(--font-mono); font-size: 10px; color: var(--gray-cool); display: block; }

/* ═══ صفحة الدخول ═════════════════════════════════════════ */
/* بطاقة واحدة في نص الشاشة — من غير اللوحة الجانبية. */
.login-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  background: var(--off-white);
  padding: 40px 20px;
}

.login-card {
  width: 100%;
  max-width: 384px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 6px 34px rgba(30, 58, 76, 0.07);
  padding: 40px 38px 34px;
  /* شريط teal رفيع على السطر العلوي — نفس لمسة الهوية */
  border-top: 3px solid var(--teal);
}

.login-logo {
  height: 46px;
  width: auto;
  object-fit: contain;
  margin: 0 auto 26px;
}

.login-card h1 { font-size: 25px; font-weight: 800; margin: 9px 0 5px; }
.login-card p.hint { font-size: 13px; color: var(--navy-soft); margin-bottom: 26px; }

.login-card .field input[type="text"],
.login-card .field input[type="password"] {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
  transition: var(--transition);
}
.login-card .field input:focus {
  outline: none;
  border-color: var(--teal);
  box-shadow: 0 0 0 3px var(--teal-pale);
}

.login-card .btn { width: 100%; justify-content: center; margin-top: 8px; padding: 12px; }

.login-foot {
  margin-top: 22px;
  font-size: 11px;
  color: var(--gray-cool);
  text-align: center;
  line-height: 1.9;
}

/* ═══ تنبيهات ═════════════════════════════════════════════ */
.flashes { margin-bottom: 16px; display: grid; gap: 8px; }
.flash {
  padding: 11px 15px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  border-inline-start: 3px solid;
}
.flash-ok    { background: #EDF7DC; color: #4F7A11; border-color: var(--green); }
.flash-error { background: #FDE9E1; color: #B33C15; border-color: var(--coral); }

.empty { padding: 62px 24px; text-align: center; color: var(--navy-soft); }
.empty h3 { font-size: 17px; font-weight: 700; margin-bottom: 7px; color: var(--navy); }
.empty p { font-size: 13.5px; }

.banner-note {
  display: flex;
  gap: 11px;
  align-items: flex-start;
  padding: 12px 16px;
  background: #FDF0DA;
  border: 1px solid #F7E2BE;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  color: #7A4E06;
  line-height: 1.7;
  margin-bottom: 18px;
}
.banner-note b { font-weight: 700; }

/* ═══ شاشات أصغر ══════════════════════════════════════════ */
@media (max-width: 1180px) {
  .lead-layout { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 980px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .rail { position: static; max-height: none; }
}
@media (max-width: 640px) {
  .wrap { padding: 16px; }
  .topbar { padding: 0 14px; gap: 14px; }
  .topnav a { padding: 7px 11px; font-size: 12.5px; }
  .topbar-user { display: none; }
  .page-title { font-size: 22px; }
}

@media print {
  .topbar, .rail, .toolbar, .pager, .bulkbar, .lead-actions { display: none !important; }
  body { background: #fff; }
  .card { box-shadow: none; border-color: #ccc; }
}

/* ═══ الحذف وسلة المحذوفات ════════════════════════════════ */

/* عدّاد المحذوفات جنب لينك السلة في الهيدر */
.nav-badge {
  display: inline-block;
  min-width: 18px;
  padding: 1px 6px;
  margin-inline-start: 4px;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.16);
  font-size: 10.5px;
  line-height: 1.5;
  text-align: center;
}
.topnav a.on .nav-badge { background: rgba(30, 58, 76, 0.16); }

/* زرار الخطر — نفس شكل باقي الأزرار بس بلون التحذير */
.btn-danger {
  background: var(--coral);
  color: #fff;
  border-color: var(--coral);
}
.btn-danger:hover {
  background: #D64A1C;
  border-color: #D64A1C;
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(240, 90, 40, 0.28);
}
.bulkbar .btn-danger { padding: 6px 16px; font-size: 12.5px; }

/* زرار الحذف في صف الجدول — باهت لحد ما تعدّي على الصف */
.row-del,
.row-restore {
  border: 1px solid transparent;
  background: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  padding: 5px 7px;
  color: var(--gray-cool);
  transition: color var(--transition), background var(--transition), border-color var(--transition);
}
.row-del:hover { color: var(--coral); background: #FDE9E1; border-color: #F7C9B5; }
.row-del:disabled { opacity: 0.4; cursor: default; }
tr:hover .row-del { color: var(--navy-soft); }

.row-restore {
  color: var(--teal-dark);
  font-size: 12px;
  font-weight: 700;
  font-family: var(--font-ar);
}
.row-restore:hover { background: var(--teal-pale); border-color: var(--teal-light); }

/* الصف بيسيح لما يتحذف بدل ما يختفي فجأة */
.leads tr.row-gone {
  opacity: 0;
  transform: translateX(-12px);
  transition: opacity 0.24s ease, transform 0.24s ease;
}

/* شريط تنبيه فوق صفحة ليد محذوف */
.deleted-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 18px;
  padding: 14px 18px;
  border: 1px solid var(--coral);
  border-inline-start-width: 4px;
  border-radius: var(--radius);
  background: #FDE9E1;
  color: #B33C15;
}
.deleted-banner strong { display: block; font-size: 14px; margin-bottom: 3px; }
.deleted-banner span { font-size: 12.5px; opacity: 0.86; }

.lead-hero.is-deleted { opacity: 0.72; }

/* كارت الحذف في العمود الجانبي */
.danger-zone { border-color: #F7C9B5; }
.danger-note {
  font-size: 12.5px;
  line-height: 1.85;
  color: var(--navy-soft);
  margin-bottom: 14px;
}

/* شريط الشرح فوق جدول السلة */
.note-strip {
  padding: 11px 16px;
  border-bottom: 1px solid var(--line-soft);
  background: var(--off-white);
  font-size: 12.5px;
  line-height: 1.8;
  color: var(--navy-soft);
}
