/* ================= «پیگیری لید» (leads-page.js) — the panel's own tokens (app.css) ================= */
.ld-head { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.ld-tabs { margin: 0; flex: 1 1 auto; }
.ld-tools { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.ld-search { display: flex; align-items: center; gap: 6px; height: 38px; padding: 0 10px; border: 1px solid var(--line-strong); border-radius: var(--r-sm); background: var(--surface); color: var(--text-3); }
.ld-search input { border: 0; outline: none; background: transparent; width: 170px; font: inherit; color: var(--text); }
.ld-offline { margin: 0 0 12px; }
.ld-sub { display: flex; align-items: center; gap: 10px; font-size: 13.5px; color: var(--text-2); margin: 0 2px 10px; }
.ld-prog { flex: 1; height: 6px; border-radius: 99px; background: var(--surface-3); overflow: hidden; max-width: 280px; }
.ld-prog i { display: block; height: 100%; background: var(--brand-accent); border-radius: 99px; }
.ld-today { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 14px; align-items: start; }
.ld-q { padding: 6px; display: flex; flex-direction: column; gap: 2px; max-height: calc(100vh - 210px); overflow: auto; position: sticky; top: 76px; }
.ld-q + .card { margin-top: 0; }
.ld-qh { font-size: 12.5px; color: var(--text-3); margin: 10px 8px 4px; font-weight: 500; }
.ld-empty-q { padding: 18px 10px; text-align: center; }
.ld-qi { display: flex; align-items: center; gap: 10px; text-align: start; border: 0; background: transparent; border-radius: var(--r-sm); padding: 8px 10px; color: var(--text); width: 100%; border-inline-start: 3px solid transparent; font: inherit; cursor: pointer; }
.ld-qi:hover { background: var(--surface-2); }
.ld-qi.on { background: var(--primary-soft); }
.ld-qi.wait { opacity: .65; }
.ld-qi.k-urgent { border-inline-start-color: var(--bad); }
.ld-qi.k-timed, .ld-qi.k-new { border-inline-start-color: var(--brand-accent); }
.ld-qi.k-na, .ld-qi.k-recall { border-inline-start-color: var(--warn); }
.ld-qtx { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.ld-qtx b { font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ld-qtx span { font-size: 12.5px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ld-av { flex: none; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary); font-weight: 700; font-size: 14px; }
.ld-av.lg { width: 46px; height: 46px; font-size: 18px; }
.ld-cardwrap { padding: 18px 20px; }
.ld-done { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 56px 10px; text-align: center; }
.ld-done .icon { width: 34px; height: 34px; color: var(--brand-accent-ink); }
.ld-hd { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.ld-hd-t { flex: 1; min-width: 140px; }
.ld-hd-t h2 { margin: 0; font-size: 19px; }
.ld-ph { color: var(--text-3); font-size: 13.5px; text-align: end; unicode-bidi: plaintext; }
.ld-hd-a { display: flex; gap: 6px; flex-wrap: wrap; }
.btn.ld-call { background: var(--brand-accent); border-color: var(--brand-accent); color: var(--on-accent); }
.ld-chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 12px 0 4px; }
.ld-pill { display: inline-flex; align-items: center; padding: 2px 10px; border-radius: 99px; font-size: 12.5px; background: var(--surface-2); color: var(--text-2); white-space: nowrap; }
.ld-pill.t-buyer { background: var(--primary-soft); color: var(--primary); }
.ld-pill.t-seller { background: var(--dealer-soft); color: var(--dealer); }
.ld-pill.t-trade { background: var(--brand-accent-soft); color: var(--brand-accent-ink); }
.ld-pill.urgent { background: var(--bad-soft); color: var(--bad); font-weight: 600; }
.ld-pill.sms, .ld-pill.warn { background: var(--warn-soft); color: var(--warn); }
.ld-pill.done { background: var(--good-soft); color: var(--good); }
.ld-pill.lost { background: var(--surface-3); color: var(--text-3); text-decoration: line-through; }
.ld-why { font-size: 13px; color: var(--text-2); }
.ld-why.k-urgent { color: var(--bad); font-weight: 600; }
.ld-need { margin: 10px 0 0; display: flex; flex-direction: column; gap: 6px; }
.ld-want b { font-size: 15px; }
.ld-want-x { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 13px; color: var(--text-2); }
.ld-own { font-size: 14px; }
.ld-inc { display: flex; gap: 6px; align-items: flex-start; font-size: 13px; color: var(--warn); background: var(--warn-soft); border-radius: var(--r-sm); padding: 6px 10px; }
.ld-inc .icon { flex: none; margin-top: 2px; }
.ld-req { margin: 10px 0 0; padding: 8px 12px; border-inline-start: 3px solid var(--line-strong); background: var(--surface-2); border-radius: var(--r-sm); font-size: 13.5px; color: var(--text-2); line-height: 1.8; }
.ld-facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 12px 0 4px; }
.ld-facts div { background: var(--surface-2); border-radius: var(--r-sm); padding: 7px 10px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ld-facts span { font-size: 12px; color: var(--text-3); }
.ld-facts b { font-size: 13.5px; font-weight: 600; overflow-wrap: anywhere; }
.ld-stp { display: flex; gap: 4px; margin: 12px 0 0; flex-wrap: wrap; align-items: center; }
.ld-stp-l { font-size: 12.5px; color: var(--text-3); margin-inline-end: 4px; width: 100%; }
.ld-stp button { flex: 1 1 0; min-width: 0; border: 1px solid var(--line); background: var(--surface); border-radius: var(--r-sm); padding: 6px 4px; font: inherit; font-size: 12.5px; color: var(--text-3); display: flex; flex-direction: column; align-items: center; gap: 4px; cursor: pointer; }
.ld-stp button i { width: 100%; height: 4px; border-radius: 99px; background: var(--surface-3); }
.ld-stp button.on { color: var(--text); }
.ld-stp button.on i { background: var(--primary); }
.ld-stp button.cur { border-color: var(--primary); font-weight: 700; }
.ld-stp button:disabled { cursor: default; }
.ld-cad { display: flex; align-items: center; gap: 4px; margin: 12px 0 0; font-size: 12.5px; color: var(--text-2); flex-wrap: wrap; }
.ld-cad i { width: 24px; height: 24px; display: grid; place-items: center; border-radius: 50%; background: var(--surface-2); color: var(--text-3); font-style: normal; font-size: 12px; }
.ld-cad i.f { background: var(--warn); color: #fff; }
.ld-cad i.n { outline: 2px solid var(--warn); }
.ld-cad i.s { box-shadow: inset 0 -3px 0 var(--brand-accent); }
.ld-cad span { margin-inline-start: 8px; }
.ld-cols { display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; margin-top: 6px; }
@media (min-width: 1400px) { .ld-cols { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }
.ld-tl { max-height: 380px; overflow: auto; }
.ld-tl li.k-call .tl-dot { background: var(--primary); }
.ld-tl li.na .tl-dot { background: var(--warn); }
.ld-tl li.k-sms .tl-dot { background: var(--brand-accent); }
.ld-tl li.k-info .tl-dot { background: var(--text-3); }
.ld-tl .tl-text { font-size: 13.5px; white-space: pre-wrap; overflow-wrap: anywhere; }
.ld-cmp textarea, .ld-dialog textarea, .ld-edit textarea, .ld-settings textarea { width: 100%; border: 1px solid var(--line-strong); border-radius: var(--r-sm); padding: 8px 10px; font: inherit; background: var(--surface); color: var(--text); resize: vertical; }
.ld-nx { margin: 8px 0 4px; }
.ld-nx .chip-btn { min-height: 30px; font-size: 12.5px; }
.ld-nxl { font-size: 13px; margin-bottom: 8px; }
.ld-acts { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 6px; }
.ld-act { border: 1px solid var(--line-strong); background: var(--surface); border-radius: var(--r-sm); padding: 8px 6px; font: inherit; font-size: 14px; font-weight: 600; color: var(--text); display: flex; flex-direction: column; align-items: center; gap: 2px; min-height: 52px; justify-content: center; cursor: pointer; }
.ld-act small { font-size: 11.5px; color: var(--text-3); font-weight: 400; }
.ld-act:hover { border-color: var(--primary); }
.ld-act.primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.ld-act.primary small { color: rgba(255, 255, 255, .75); }
.ld-act.lost { color: var(--bad); }
.ld-act.ghost { border-style: dashed; color: var(--text-2); }
.ld-edit { margin: 12px 0 0; background: var(--surface-2); box-shadow: none; }
.ld-edit .d-h { margin-top: 12px; }
.ld-eg { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; margin: 8px 0; }
.ld-eg .field.wide { grid-column: 1 / -1; }
.ld-edit .chips { margin: 4px 0; gap: 16px; }
.ld-edit-a { display: flex; gap: 8px; align-items: center; margin-top: 10px; flex-wrap: wrap; }
.ld-del { color: var(--bad); }
.ld-filters { margin: 0 0 10px; }
.ld-rows { display: flex; flex-direction: column; gap: 6px; }
.ld-row { display: flex; align-items: center; gap: 12px; text-align: start; width: 100%; font: inherit; color: var(--text); cursor: pointer; padding: 10px 14px; }
.card.ld-row + .card.ld-row { margin-top: 0; }
.ld-row:hover { border-color: var(--line-strong); }
.ld-row-m { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.ld-row-m b { font-size: 14.5px; display: flex; align-items: center; gap: 6px; }
.ld-row-m .muted { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ld-row-s { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.ld-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--bad); display: inline-block; }
.ld-nxc { font-size: 12.5px; color: var(--text-2); white-space: nowrap; }
.ld-nxc.late { color: var(--bad); }
.ld-more { margin: 12px auto 0; display: flex; }
.ld-dialog { width: min(640px, calc(100vw - 32px)); max-height: calc(100vh - 40px); overflow: auto; }
.ld-dialog h2 { margin: 0; font-size: 18px; }
.ld-help { font-size: 13px; margin: 0; }
.ld-dupline:empty { display: none; }
.ld-dupline span { display: flex; align-items: center; gap: 6px; color: var(--warn); font-size: 13.5px; flex-wrap: wrap; }
.ld-imp-info { font-size: 14px; }
.ld-settings { display: flex; flex-direction: column; gap: 16px; }
.ld-settings .card + .card { margin-top: 0; }
.ld-settings .card-h { font-size: 16px; }
.ld-settings .field { margin: 8px 0; }
.ld-warn { color: var(--warn); }
.ld-key { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--r-sm); }
.ld-key b { min-width: 140px; }
.ld-fresh { align-items: flex-start; }
.ld-fresh pre { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 8px 10px; font-size: 12.5px; overflow: auto; white-space: pre-wrap; word-break: break-all; margin: 6px 0; }
.ld-in-drawer { padding: 16px 18px; }
.ld-in-drawer .ld-cols { grid-template-columns: 1fr; }
@media (max-width: 1099px) {
  .ld-today { grid-template-columns: 1fr; }
  .ld-today .ld-cardwrap { display: none; }
  .ld-q { position: static; max-height: none; }
  .ld-search input { width: 120px; }
}
@media (max-width: 640px) {
  .ld-head { flex-direction: column; align-items: stretch; }
  .ld-tools { justify-content: space-between; }
  .ld-search { flex: 1 1 100%; min-width: 0; }
  .ld-search input { width: 100%; min-width: 0; }
  .ld-tools .btn { flex: 1 1 0; justify-content: center; }
  .ld-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ld-cols { grid-template-columns: 1fr; }
  .ld-row { align-items: flex-start; flex-wrap: wrap; }
  .ld-row-s { width: 100%; justify-content: flex-start; padding-inline-start: 46px; }
  .ld-stp button { font-size: 11.5px; }
}

/* phase 2: matched ads, health, reports */
.ld-mt { margin: 14px 0 0; display: flex; flex-direction: column; gap: 8px; }
.ld-mt-h { display: flex; align-items: baseline; gap: 4px; flex-wrap: wrap; margin: 0; }
.ld-usual { font-size: 13px; }
.ld-unc { margin: 0; flex-wrap: wrap; }
.ld-mrows { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; }
.ld-mrow { display: flex; gap: 10px; align-items: center; padding: 8px 12px; cursor: pointer; }
.ld-mrow + .ld-mrow { border-top: 1px solid var(--line); }
.ld-mrow.good { background: color-mix(in srgb, var(--good-soft) 55%, transparent); }
.ld-mrow input { width: 18px; height: 18px; accent-color: var(--primary); flex: none; }
.ld-mrow-m { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.ld-mrow-m a, .ld-mrow-m b { font-size: 14px; font-weight: 600; color: var(--text); text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ld-mrow-m a:hover { color: var(--primary); text-decoration: underline; }
.ld-mrow-m small { font-size: 12.5px; }
.ld-mrow-s { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; text-align: end; }
.ld-mrow-s b { font-size: 14px; }
.ld-z { font-size: 12px; color: var(--text-3); white-space: nowrap; }
.ld-z.z-great, .ld-z.z-good { color: var(--good); font-weight: 600; }
.ld-z.z-high { color: var(--bad); }
.ld-z.z-suspect { color: var(--warn); }
.ld-mt-a { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; font-size: 13px; }
.ld-kpis { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
.kpi.ld-ok .kpi-v { color: var(--good); }
.kpi.ld-bad .kpi-v { color: var(--bad); }
.ld-report { display: flex; flex-direction: column; gap: 14px; }
.ld-report .card + .card { margin-top: 0; }
.ld-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.ld-table th, .ld-table td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: start; }
.ld-table th { font-size: 12.5px; color: var(--text-3); font-weight: 500; }
.ld-demand { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 24px; }
.ld-bar { display: grid; grid-template-columns: minmax(90px, 160px) 1fr 32px; gap: 8px; align-items: center; font-size: 13px; margin: 5px 0; }
.ld-bar > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ld-bar i { display: block; height: 10px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.ld-bar i b { display: block; height: 100%; background: var(--primary); border-radius: 99px; }
.ld-days { gap: 14px; margin: 8px 0; }
@media (max-width: 640px) {
  .ld-demand { grid-template-columns: 1fr; }
  .ld-mrow { align-items: flex-start; }
  .ld-mrow-m a, .ld-mrow-m b { white-space: normal; }
}

/* the PC panel's door to the online panel; the Chinese makes list */
.ld-door { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.ld-door p { margin: 0 0 6px; }
.ld-cn { margin: 8px 0; }
.ld-cn .tag .btn.icon-only { min-height: 0; width: 22px; height: 22px; padding: 0; }

/* ===== payment and services on the lead card (phase 2A) ===== */
.ld-stp button { flex: 1 1 84px; }
.ld-pay { margin-top: 14px; padding: 12px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface-2); display: flex; flex-direction: column; gap: 10px; }
.ld-paystate { display: flex; align-items: center; gap: 8px; font-weight: 600; color: var(--warn); }
.ld-paystate.ok { color: var(--good); }
.ld-svc { display: flex; flex-direction: column; gap: 6px; }
.ld-paylist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.ld-payrow { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; padding: 8px 10px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-sm); }
.ld-payrow.s-rejected { opacity: .6; }
.ld-payact { margin-inline-start: auto; display: inline-flex; gap: 6px; }
.ld-refund { display: flex; justify-content: space-between; align-items: center; padding: 8px 10px; border-radius: var(--r-sm); background: var(--brand-accent-soft); color: var(--brand-accent-ink); }
.ld-payact-row { display: flex; flex-wrap: wrap; gap: 6px; }

/* ===== visits page and inspections (phase 2B) ===== */
.vs-page { display: flex; flex-direction: column; gap: 12px; }
.vs-groups { display: flex; flex-direction: column; gap: 12px; }
.vs-sec.warn { border-color: var(--warn); }
.vs-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.vs-row { display: grid; grid-template-columns: 76px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); }
.vs-row:first-child { border-top: 0; }
.vs-row.ad { opacity: .85; }
.vs-when { display: flex; flex-direction: column; align-items: center; }
.vs-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.vs-main b { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.vs-act { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.vs-calhead { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.vs-cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.vs-wd { text-align: center; font-size: 12px; color: var(--text-3); }
.vs-cell { min-height: 74px; padding: 4px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface); display: flex; flex-direction: column; gap: 2px; overflow: hidden; }
.vs-cell.empty { border: 0; background: none; }
.vs-cell.today { border-color: var(--brand-accent); background: var(--brand-accent-soft); }
.vs-ev { font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; background: var(--primary-soft); border-radius: 4px; padding: 0 4px; }
.vs-ev.off { opacity: .5; text-decoration: line-through; }
.ld-insp { display: flex; flex-direction: column; gap: 6px; }
.ld-insprow { display: flex; flex-direction: column; gap: 2px; padding: 8px 10px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-sm); }
@media (max-width: 560px) {
  .vs-row { grid-template-columns: 60px minmax(0, 1fr); }
  .vs-act { grid-column: 1 / -1; justify-content: flex-start; }
  .vs-cell { min-height: 56px; }
  .vs-ev { display: none; }
}

/* ===== money pages (phase 3A) ===== */
.fn-page { display: flex; flex-direction: column; gap: 12px; }
.fn-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; }
.fn-kpi { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface); }
.fn-kpi span { font-size: 12.5px; color: var(--text-3); }
.fn-kpi b { font-size: 16px; direction: ltr; unicode-bidi: plaintext; text-align: right; }
.fn-kpi.bad b, .bad.num { color: var(--bad); }
.fn-kpi.good b, .good.num, b.good { color: var(--good); }
.fn-kpi.warn b { color: var(--warn); }
.fn-list { list-style: none; margin: 0; padding: 0; }
.fn-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.fn-row:first-child { border-top: 0; }
.fn-row[role="button"] { cursor: pointer; }
.fn-row.late { box-shadow: inset 3px 0 0 var(--bad); padding-inline-start: 8px; }
.fn-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.fn-main b { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.fn-nums { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.fn-act { display: inline-flex; gap: 4px; }
.fn-funds { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; }
.fn-fund { border: 1px solid var(--line); border-radius: var(--r-md); padding: 10px 12px; background: var(--surface); }
.fn-fund.off { opacity: .6; }
.fn-fund dl { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; margin: 8px 0 0; font-size: 13px; }
.fn-fund dt { color: var(--text-3); }
.fn-fund dd { margin: 0; text-align: left; direction: ltr; }
.fn-tb { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.fn-tb th, .fn-tb td { padding: 6px 8px; border-bottom: 1px solid var(--line); text-align: right; }
.fn-tb td.num { direction: ltr; text-align: left; }
.fn-printhead { display: none; }
.ld-refund.bad { background: var(--bad-soft); color: var(--bad); }
@media (max-width: 560px) { .fn-nums { align-items: flex-start; } }
@media print {
  body.fn-printing .side, body.fn-printing .topbar, body.fn-printing .bottom-nav, body.fn-printing .live-bar, body.fn-printing .fn-noprint, body.fn-printing .page-head select, body.fn-printing .side-scrim { display: none !important; }
  body.fn-printing .shell { display: block; }
  body.fn-printing .fn-printhead { display: flex; align-items: center; gap: 12px; border-bottom: 1.5px solid var(--text); padding-bottom: 8px; }
  body.fn-printing .fn-printhead img { height: 48px; }
  body.fn-printing .card { break-inside: avoid; box-shadow: none; }
}
.fn-tile { text-decoration: none; color: inherit; }
a.fn-tile:hover { border-color: var(--brand-accent); }
.fn-tile small { font-size: 12px; }
