/* ===== «عميل محتمل» ===== list (status tabs, filter bar, rows) · lead drawer · add/edit form. GITA green + gold. */
.ld, .ld-drawer, .ld-form { --ld-g: #0a5e52; --ld-gd: #074a41; --ld-gold: #b0853b; --ld-gl: #f6efdf; --ld-cream: #f6f2e9;
  --ld-hot: #c2410c; --ld-hot-l: #fff0e6; --ld-warm: #a16207; --ld-warm-l: #fdf5df; --ld-cold: #1d5fbf; --ld-cold-l: #eaf2fd; }
.ld .ico, .ld-drawer .ico, .ld-form .ico { width: 16px; height: 16px; flex: none; vertical-align: -3px; }
.ld { display: flex; flex-direction: column; gap: 12px; }
.ld-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding: 16px 18px; border-radius: 16px; color: #fff;
  background: radial-gradient(90% 130% at 0% 0%, rgba(198,161,91,.45), transparent 60%), linear-gradient(150deg, var(--ld-gd), var(--ld-g)); }
.ld-head b { display: block; font-size: 1.08rem; }
.ld-head span { color: rgba(255,255,255,.8); font-size: .88rem; }
.ld-tabs { display: inline-flex; gap: 4px; padding: 4px; border-radius: 12px; background: #eef0ee; align-self: flex-start; }
.ld-tabs button { display: inline-flex; align-items: center; gap: 8px; padding: .45rem 1rem; border: 0; border-radius: 9px; background: transparent; font: inherit; font-weight: 700; color: var(--muted); cursor: pointer; transition: background .15s, color .15s; }
.ld-tabs button em { font-style: normal; min-width: 22px; padding: 0 6px; border-radius: 999px; background: rgba(0,0,0,.06); font-size: .78rem; text-align: center; }
.ld-tabs button.is-on { background: #fff; color: var(--ld-gd); box-shadow: 0 1px 4px rgba(0,0,0,.08); }
.ld-tabs button.is-on em { background: var(--ld-g); color: #fff; }
.ld-list { display: grid; gap: 8px; }
.ld-row { display: grid; grid-template-columns: minmax(150px, 1.1fr) minmax(0, 2fr) auto minmax(150px, .9fr) 86px; align-items: center; gap: 14px; width: 100%;
  padding: 12px 16px; border: 1px solid var(--line); border-inline-start: 4px solid var(--ld-warm); border-radius: 14px; background: #fff; font: inherit; color: var(--ink);
  text-align: start; cursor: pointer; transition: box-shadow .18s, transform .18s; }
.ld-row:hover, .ld-row:focus-visible { box-shadow: 0 10px 24px rgba(7,74,65,.1); transform: translateY(-1px); outline: 0; }
.ld-row--hot { border-inline-start-color: var(--ld-hot); }
.ld-row--cold { border-inline-start-color: var(--ld-cold); }
.ld-row.is-closed { background: #fafaf9; }
.ld-row.is-closed .ld-row__who b { color: var(--muted); }
.ld-row__who { display: grid; min-width: 0; }
.ld-row__who b { font-size: .98rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ld-row__who small { color: var(--muted); font-size: .82rem; justify-self: start; }
.ld-row__req { color: #374151; font-size: .88rem; line-height: 1.6; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.ld-row__tags { display: flex; flex-wrap: wrap; gap: 4px; justify-content: flex-end; }
.ld-row__meta { display: grid; gap: 1px; color: var(--muted); font-size: .8rem; }
.ld-row__meta span { display: inline-flex; align-items: center; gap: 5px; }
.ld-row__meta .ico { width: 13px; height: 13px; }
.ld-tag { padding: 1px 9px; border-radius: 999px; background: var(--ld-gl); color: #7a5a1f; font-size: .76rem; font-weight: 700; white-space: nowrap; }
.ld-tag--soft { background: #f1f3f2; color: #4b5563; }
.ld-temp { display: inline-flex; align-items: center; gap: 5px; padding: 1px 10px; border-radius: 999px; font-size: .76rem; font-weight: 800; white-space: nowrap; border: 1px solid transparent; }
.ld-temp::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.ld-temp--hot { background: var(--ld-hot-l); color: var(--ld-hot); }
.ld-temp--warm { background: var(--ld-warm-l); color: var(--ld-warm); }
.ld-temp--cold { background: var(--ld-cold-l); color: var(--ld-cold); }
.ld-st { justify-self: end; padding: 3px 12px; border-radius: 999px; font-size: .78rem; font-weight: 800; white-space: nowrap; }
.ld-st--open { background: #eaf2fd; color: #1d5fbf; }
.ld-st--in_progress { background: #fdf5df; color: #a16207; }
.ld-st--closed { background: #e3f3ec; color: #13795b; }
.ld-empty { display: grid; place-items: center; gap: 6px; padding: 48px 16px; border: 1px dashed var(--line); border-radius: 16px; color: var(--muted); text-align: center; }
.ld-empty .ico { width: 34px; height: 34px; color: var(--ld-gold); }
.ld-empty b { color: var(--ink); }
@media (max-width: 860px) {
  .ld-row { grid-template-columns: 1fr auto; gap: 6px 10px; }
  .ld-row__req, .ld-row__tags, .ld-row__meta { grid-column: 1 / -1; }
  .ld-row__tags { justify-content: flex-start; }
  .ld-row__meta { display: flex; flex-wrap: wrap; gap: 4px 12px; }
  .ld-st { grid-row: 1; grid-column: 2; }
}

/* the lead's drawer */
.ld-scrim { position: fixed; inset: 0; z-index: 90; background: rgba(15,23,22,.38); animation: ld-fade .18s ease; }
.ld-drawer { position: fixed; z-index: 91; inset-block: 0 auto; inset-inline-end: 0; width: min(560px, 100%); height: 100vh; height: 100dvh; display: flex; flex-direction: column; background: #fff;
  box-shadow: 0 0 40px rgba(0,0,0,.18); animation: ld-in .22s ease; }
@keyframes ld-fade { from { opacity: 0; } }
@keyframes ld-in { from { transform: translateX(-24px); opacity: 0; } }
.ld-dr__head { display: flex; align-items: flex-start; gap: 12px; padding: 18px 20px 16px; color: #fff;
  background: radial-gradient(90% 140% at 0% 0%, rgba(198,161,91,.4), transparent 60%), linear-gradient(150deg, var(--ld-gd), var(--ld-g)); }
.ld-dr__id { flex: 1; min-width: 0; }
.ld-dr__id > span { color: #e6c98b; font-size: .78rem; font-weight: 800; }
.ld-dr__id h3 { margin: 2px 0 8px; font-size: 1.3rem; line-height: 1.4; }
.ld-dr__phone { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ld-dr__phone b { font-size: 1rem; letter-spacing: .3px; margin-inline-end: 4px; }
.ld-act { display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px; border-radius: 999px; background: rgba(255,255,255,.14); color: #fff; font-size: .82rem; font-weight: 700; text-decoration: none; transition: background .15s; }
.ld-act:hover { background: rgba(255,255,255,.26); }
.ld-act--wa { background: #25d366; }
.ld-act--wa:hover { background: #1fb457; }
.ld-x { display: grid; place-items: center; width: 34px; height: 34px; border: 0; border-radius: 10px; background: rgba(255,255,255,.14); color: inherit; cursor: pointer; }
.ld-dr__body { flex: 1; overflow-y: auto; padding: 16px 20px 24px; display: flex; flex-direction: column; gap: 14px; }
.ld-dr__foot { display: flex; align-items: center; gap: 8px; padding: 10px 20px calc(10px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: #fbfbfa; }
.ld-dr__tools { display: flex; gap: 6px; }
.ld-dirty { display: none; margin-inline-start: auto; color: var(--ld-warm); font-size: .8rem; font-weight: 700; }
.ld-dr__foot.is-dirty .ld-dirty { display: inline; }
.ld-save { margin-inline-start: auto; min-width: 128px; justify-content: center; }
.ld-dr__foot.is-dirty .ld-save { margin-inline-start: 0; box-shadow: 0 0 0 3px rgba(176,133,59,.3); }

/* status cards: open · in progress · completed */
.ld-h { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 0 0 8px; font-size: .9rem; color: var(--ld-gd); }
.ld-h em { font-style: normal; font-weight: 600; color: var(--muted); font-size: .8rem; }
.ld-att .ld-h em { min-width: 22px; padding: 0 7px; border-radius: 999px; background: var(--ld-gl); color: #7a5a1f; font-weight: 800; text-align: center; }
.ld-stages { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.ld-stg { --c: #0f766e; --cl: #e6f4f1; position: relative; display: grid; align-content: start; gap: 3px; padding: 10px 12px; border: 1.5px solid var(--line); border-radius: 12px;
  background: #fff; cursor: pointer; transition: border-color .15s, background .15s, box-shadow .15s; }
.ld-stg--open { --c: #1d5fbf; --cl: #eaf2fd; }
.ld-stg--in_progress { --c: #a16207; --cl: #fdf5df; }
.ld-stg--closed { --c: #13795b; --cl: #e3f3ec; }
.ld-seen { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 10px; font-size: .8rem; color: var(--muted); }
.ld-seen > span:first-child { display: inline-flex; align-items: center; gap: 4px; font-weight: 700; }
.ld-seen__u { padding: 2px 10px; border-radius: 999px; background: #f1f3f2; }
.ld-seen__u b { color: var(--ink); }
.ld-ev--view { opacity: .75; }
.ld-stg input { position: absolute; opacity: 0; pointer-events: none; }
.ld-stg__t { display: flex; align-items: baseline; justify-content: space-between; gap: 6px; flex-wrap: wrap; }
.ld-stg__t b { display: inline-flex; align-items: center; gap: 6px; font-size: .9rem; color: var(--ink); }
.ld-stg__t b::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--c); flex: none; }
.ld-stg__t small { color: var(--muted); font-size: .72rem; font-weight: 700; }
.ld-stg__d { color: var(--muted); font-size: .78rem; line-height: 1.6; }
.ld-stg:hover { border-color: var(--c); }
.ld-stg:has(input:checked) { border-color: var(--c); background: var(--cl); box-shadow: 0 0 0 3px color-mix(in srgb, var(--c) 15%, transparent); }
.ld-stg:has(input:checked) .ld-stg__t b, .ld-stg:has(input:checked) .ld-stg__t small { color: var(--c); }
.ld-stg:has(input:focus-visible) { outline: 2px solid var(--c); outline-offset: 2px; }

/* attachments */
.ld-att { padding: 12px 14px; border: 1px solid var(--line); border-radius: 14px; }
.ld-att__h { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.ld-att__h .ld-h { margin: 0; }
.ld-att label, .ld-fatt label { cursor: pointer; }
.ld-att .ld-files { margin-top: 10px; }
.ld-muted { margin: 8px 0 0; color: var(--muted); font-size: .82rem; line-height: 1.6; }
.ld-att .ld-pend { align-items: center; margin: 10px 0 0; }
.ld-pend small { flex-basis: 100%; display: flex; align-items: center; gap: 5px; color: var(--ld-warm); font-size: .78rem; font-weight: 700; }
.ld-fatt { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.ld-fatt small { color: var(--muted); font-size: .78rem; }
.ld-form .ld-pend { margin: 6px 0 0; }
.ld-props { margin: 0; display: grid; gap: 2px; padding: 6px 14px; border: 1px solid var(--line); border-radius: 14px; }
.ld-props > div { display: grid; grid-template-columns: 140px 1fr; align-items: center; gap: 10px; min-height: 40px; }
.ld-props > div + div { border-top: 1px dashed var(--line); }
.ld-props dt { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: .85rem; font-weight: 700; }
.ld-props dt .ico { color: var(--ld-gold); }
.ld-props dd { margin: 0; font-size: .92rem; }
.ld-props select { width: 100%; max-width: 260px; padding: .35rem .6rem; border: 1px solid transparent; border-radius: 8px; background: #f6f7f6; font: inherit; cursor: pointer; transition: border-color .15s; }
.ld-props select:hover, .ld-props select:focus { border-color: var(--line); outline: 0; }
.ld-temps { display: flex; gap: 6px; flex-wrap: wrap; }
.ld-temps .ld-temp { padding: .3rem .85rem; font-size: .82rem; cursor: pointer; opacity: .55; font-family: inherit; transition: opacity .15s, border-color .15s; }
.ld-temps .ld-temp:hover { opacity: .85; }
.ld-temps .ld-temp.is-on, .ld-temps .ld-temp:has(input:checked) { opacity: 1; border-color: currentColor; }
.ld-temps input { position: absolute; opacity: 0; pointer-events: none; }
.ld-req h4, .ld-tl__h { margin: 0 0 6px; font-size: .9rem; color: var(--ld-gd); }
.ld-req p { margin: 0; padding: 12px 14px; border-radius: 12px; background: var(--ld-cream); white-space: pre-wrap; line-height: 1.75; font-size: .93rem; }
.ld-warn { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 10px; background: #fff8e6; color: #8a5a00; font-size: .85rem; }
.ld-compose { padding: 10px; border: 1px solid var(--line); border-radius: 14px; background: #fff; transition: border-color .15s, box-shadow .15s; }
.ld-compose:focus-within { border-color: var(--ld-gold); box-shadow: 0 0 0 3px rgba(198,161,91,.15); }
.ld-compose textarea { width: 100%; border: 0; outline: 0; resize: vertical; font: inherit; line-height: 1.7; background: transparent; }
.ld-pend { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
.ld-pend:empty { display: none; }
.ld-pchip { display: inline-flex; align-items: center; gap: 5px; padding: 2px 4px 2px 10px; border-radius: 999px; background: var(--ld-gl); font-size: .8rem; max-width: 100%; }
.ld-pchip button { display: grid; place-items: center; width: 20px; height: 20px; border: 0; border-radius: 50%; background: rgba(0,0,0,.06); cursor: pointer; }
.ld-pchip .ico { width: 12px; height: 12px; }
.ld-pchip > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ld-tl { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.ld-note { display: flex; gap: 10px; }
.ld-av { flex: none; display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: var(--ld-g); color: #fff; font-weight: 800; font-size: .9rem; }
.ld-note__c { flex: 1; min-width: 0; padding: 8px 12px; border-radius: 4px 14px 14px 14px; background: #f6f7f6; }
.ld-note__h { display: flex; justify-content: space-between; gap: 8px; font-size: .84rem; }
.ld-note__h time, .ld-ev time { color: var(--muted); font-size: .78rem; white-space: nowrap; }
.ld-note p { margin: 2px 0 0; white-space: pre-wrap; line-height: 1.7; font-size: .92rem; }
.ld-files { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.ld-file { display: inline-flex; align-items: center; gap: 6px; max-width: 220px; padding: 4px 10px; border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink); font-size: .8rem; text-decoration: none; transition: border-color .15s; }
.ld-file:hover { border-color: var(--ld-gold); }
.ld-file span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ld-file--img { flex-direction: column; align-items: stretch; padding: 4px; width: 120px; }
.ld-file--img img { width: 100%; height: 80px; object-fit: cover; border-radius: 7px; background: #eee; }
.ld-ev { display: flex; align-items: center; gap: 10px; padding-inline-start: 12px; font-size: .84rem; color: var(--muted); }
.ld-ev i { width: 8px; height: 8px; border-radius: 50%; background: #cfd5d3; flex: none; }
.ld-ev span { flex: 1; }
.ld-ev b { color: #374151; }

/* add / edit form (inside the shared #modal) */
.ld-form { display: grid; gap: 12px; padding: 18px 20px 0; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
.ld-form__h { display: flex; justify-content: space-between; align-items: center; }
.ld-form__h b { font-size: 1.1rem; color: var(--ld-gd); }
.ld-form .ld-x { background: #f1f3f2; }
.ld-f { display: grid; gap: 4px; }
.ld-f > span { font-size: .84rem; font-weight: 700; color: #374151; }
.ld-f input, .ld-f select, .ld-f textarea { width: 100%; padding: .55rem .75rem; border: 1px solid var(--line); border-radius: 10px; font: inherit; background: #fff; transition: border-color .15s, box-shadow .15s; }
.ld-f input:focus, .ld-f select:focus, .ld-f textarea:focus { outline: 0; border-color: var(--ld-gold); box-shadow: 0 0 0 3px rgba(198,161,91,.15); }
.ld-f textarea { resize: vertical; line-height: 1.7; }
.ld-f2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.ld-form .ld-temps .ld-temp { position: relative; }
.ld-form__bar { position: sticky; bottom: 0; display: flex; justify-content: flex-end; gap: 8px; margin: 0 -20px; padding: 12px 20px calc(12px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line); background: #fff; }
@media (max-width: 560px) {
  .ld-f2 { grid-template-columns: 1fr; }
  .ld-props > div { grid-template-columns: 1fr; gap: 4px; padding: 8px 0; }
  .ld-props select { max-width: none; }
  /* 16px stops iPhone zooming into the field */
  .ld-drawer select, .ld-drawer textarea, .ld-form input, .ld-form select, .ld-form textarea { font-size: 16px; }
  .ld-dr__head { padding: 14px 16px 12px; }
  .ld-dr__id h3 { font-size: 1.15rem; }
  .ld-dr__body { padding: 14px 16px 20px; }
  .ld-dr__foot { flex-wrap: wrap; padding-inline: 16px; }
  .ld-save { order: -1; flex: 1 0 100%; min-height: 46px; font-size: 1rem; }
  .ld-dr__foot.is-dirty .ld-save { margin-inline-start: 0; }
  .ld-dr__foot.is-dirty .ld-dirty { display: none; }
  .ld-form { padding: 14px 16px 0; }
  .ld-form__bar { margin: 0 -16px; padding-inline: 16px; }
  .ld-form__bar .btn { flex: 1; justify-content: center; min-height: 44px; }
  .ld-head { padding: 14px; }
  .ld-head .btn { width: 100%; justify-content: center; }
  .ld-tabs { align-self: stretch; }
  .ld-tabs button { flex: 1; justify-content: center; padding-inline: .5rem; }
  .ld-file { max-width: 100%; }
}
@media (max-width: 560px) { .ld-stages { grid-template-columns: 1fr; } }
