/* Lead page "Look 2" (prototype: docs/prototypes/lead-page): a pinned Client card beside Needs, Offers and Activity.
   The page wrapper is a container, so the two columns follow the page width (drawer open or closed), not the screen. Tokens only. */

/* Log activity (shared with My day, styles md-dw* in css/home.css) opens in the middle over the page (DECISIONS #287); a side drawer that is not
   centred still makes room at 1280px+ instead of covering the page. */
.lead-page { transition: padding-inline-end .34s var(--md-ease); }
@media (min-width: 1280px) {
  body.md-dw-open:not(.md-dw-modal) .lead-page { padding-inline-end: calc(var(--md-dw) + 24px); }
}
@media (prefers-reduced-motion: reduce) { .lead-page { transition: none; } }

/* Dialogs (shared with the plan / schedule pop-ups) */
.dialog-hint { margin: var(--sp-4) 0 0; font-size: var(--fs-table); color: var(--c-muted); }
.next-step { margin-top: 12px; }
.next-step[hidden] { display: none; }

.lp { container: lp / inline-size; }
.lp-split { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--sp-4); align-items: start; }
.lp-split > * { min-width: 0; }
.lp-main { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--sp-4); }
/* 790px of PAGE width = pinned client card (~320) + gap + a main column wide enough for one 280px Needs card; chosen from the page, not the screen, so the side menu being open cannot cramp it */
@container lp (min-width: 790px) {
  .lp-split { grid-template-columns: 320px minmax(0, 1fr); }
  /* the whole side column (client card + salesperson card) sticks and scrolls as one */
  .lp-side { position: sticky; top: calc(var(--head-h, var(--topbar-h)) + var(--sp-4)); max-height: calc(100dvh - var(--head-h, var(--topbar-h)) - var(--sp-6) - var(--sp-4)); /* under the sticky title row (#395) */ overflow: auto; }
}

/* Page head (Sami 2026-11-08): name + stage on the start side, Edit + "+ Log activity" on the end side, like every screen's add button */
.lp-top { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: var(--sp-3); margin-bottom: var(--sp-4); }
.lp-top-t { min-width: 0; display: grid; gap: var(--sp-2); }
.lp-name-row { display: flex; align-items: center; flex-wrap: wrap; gap: var(--sp-2); }
.lp-name { margin: 0; font-size: var(--fs-title); font-weight: var(--fw-semibold); color: var(--c-ink); line-height: 1.2; overflow-wrap: anywhere; }
.lp-acts { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); margin-inline-start: auto; }
.lp-acts .btn { min-height: 40px; }
.lp-acts .ac-slot:empty { display: none; }
@media (max-width: 560px) { .lp-acts { width: 100%; } .lp-acts .btn.primary { flex: 1; } }

/* who owns the lead: a small card of its own under the client card, as tall as the people in it */
.lp-side { display: grid; gap: var(--sp-3); align-content: start; }
.lp-own { gap: var(--sp-2); padding-block: var(--sp-3); }
.lp-own-h { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2); }
/* one row per salesperson (a shared lead later = more rows, split by a hairline): avatar, name, and under it the team by its leader */
.lp-own-list { display: grid; }
.lp-own-p { display: flex; align-items: center; gap: var(--sp-3); min-width: 0; padding-block: var(--sp-2); }
.lp-own-p + .lp-own-p { border-top: 1px solid var(--c-line); }
.lp-own-p i { width: 34px; height: 34px; flex: none; display: grid; place-items: center; border-radius: 50%; background: var(--c-ink); color: var(--c-card); font-size: var(--fs-hint); font-style: normal; font-weight: var(--fw-semibold); }
.lp-own-t { min-width: 0; display: grid; gap: 2px; }
.lp-own-t b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--fs-body); font-weight: var(--fw-semibold); color: var(--c-ink); }
.lp-own-t > span { display: inline-flex; align-items: center; gap: 5px; min-width: 0; font-size: var(--fs-hint); color: var(--c-muted); }
.lp-own-t > span > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lp-own-t svg { flex: none; color: var(--c-faint); }

/* Client card: the client's own data only (numbers, email, where they came from) */
.lp-card { background: var(--c-card); border: 1px solid var(--c-card-line); box-shadow: var(--card-shadow); border-radius: var(--r-lg); padding: var(--sp-4); display: grid; gap: var(--sp-3); align-content: start; }
.lp-chip { display: inline-flex; align-items: center; gap: 6px; padding-block: 2px; padding-inline: 2px var(--sp-2); border: 1px solid var(--c-line); border-radius: var(--r-pill); background: var(--c-tile); color: var(--c-ink); font-size: var(--fs-hint); min-width: 0; }
.lp-chip i { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: var(--c-ink); color: var(--c-card); font-style: normal; font-weight: var(--fw-semibold); flex: none; }
.lp-lost { display: grid; gap: 2px; border: 1px solid var(--c-danger-line); background: var(--c-danger-soft); border-radius: var(--r-md); padding: var(--sp-3); color: var(--c-text); }
.lp-lost b { color: var(--c-danger); }
.lp-lost .btn { justify-self: start; margin-top: var(--sp-2); }
.lp-phones { display: grid; gap: var(--sp-2); }
.lp-phone { display: flex; align-items: center; gap: var(--sp-2); padding-block: var(--sp-2); padding-inline: var(--sp-3) var(--sp-2); border: 1px solid var(--c-line); border-radius: var(--r-lg); background: var(--c-tile); min-height: 48px; }
.lp-ph-t { flex: 1; min-width: 0; display: grid; }
.lp-lbl { font-size: var(--fs-hint); color: var(--c-muted); }
.lp-num { font-weight: var(--fw-medium); color: var(--c-ink); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.lp-phone .md-act { flex: none; width: 32px; height: 32px; } /* Sami 2026-11-09: 32 on the lead page (40 looked the same as 44); Log activity is the main action here. My day and the Log panel keep 44 */
.lp-phone .md-act svg { width: 15px; height: 15px; }
@media (max-width: 560px) { .lp-phone .md-act { width: 40px; height: 40px; } .lp-phone .md-act svg { width: 18px; height: 18px; } } /* a finger on a phone */
.lp-phone .md-act.wa { display: grid; } /* home.css hides the WhatsApp button on phones, here it stays */
.lp-mail { display: flex; align-items: center; gap: 6px; font-size: var(--fs-hint); color: var(--c-muted); text-decoration: none; overflow-wrap: anywhere; }
.lp-mail:hover { color: var(--c-ink); }
.lp-div { height: 1px; border: 0; margin: 0; background: var(--c-line); }
.lp-facts { display: grid; gap: var(--sp-2); }
.lp-fact .lp-lbl { display: block; }
.lp-val { color: var(--c-ink); font-weight: var(--fw-medium); overflow-wrap: anywhere; }
.lp-wait { border: 1px solid var(--c-warning-line); background: var(--c-warning-soft); border-radius: var(--r-md); padding: var(--sp-2) var(--sp-3); display: grid; gap: var(--sp-2); font-size: var(--fs-hint); color: var(--c-text); }
.lp-wait b { color: var(--c-ink); }
.lp-wait ul { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--sp-2); }
.lp-wait li { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2); }

/* Zones */
.lp-zone { background: var(--c-card); border: 1px solid var(--c-card-line); box-shadow: var(--card-shadow); border-radius: var(--r-lg); }
.lp-zh { display: flex; align-items: center; gap: var(--sp-2); padding: var(--sp-3) var(--sp-4); min-height: 56px; }
.lp-zh h2 { margin: 0; font-size: var(--fs-section); font-weight: var(--fw-semibold); color: var(--c-ink); display: flex; align-items: center; gap: var(--sp-2); }
.lp-zi { width: 28px; height: 28px; border-radius: var(--r-md); background: var(--c-select); color: var(--c-ink); display: grid; place-items: center; }
.lp-count { font-size: var(--fs-hint); font-weight: var(--fw-semibold); color: var(--c-muted); background: var(--c-tile); border: 1px solid var(--c-line); border-radius: var(--r-pill); padding: 0 var(--sp-2); }
.lp-zh .lp-grow { flex: 1; }
.lp-zb { padding: 0 var(--sp-4) var(--sp-4); }
.lp-empty { margin: 0; color: var(--c-muted); }

/* Needs */
.ip-chips { display: flex; flex-wrap: wrap; gap: 6px; direction: rtl; }
.ip-chip { display: inline-flex; gap: 6px; align-items: baseline; font-size: var(--fs-hint); padding: 3px var(--sp-2); border-radius: var(--r-pill); background: var(--c-card); border: 1px solid var(--c-line-strong); color: var(--c-ink); font-weight: var(--fw-medium); }
.ip-chip em { font-style: normal; color: var(--c-muted); font-weight: var(--fw-regular); }
.ip-meta { font-size: var(--fs-hint); color: var(--c-muted); }
.ip-hist summary { font-size: var(--fs-hint); color: var(--c-muted); cursor: pointer; min-height: 24px; }
.ip-hist summary:hover { color: var(--c-accent-text); } /* hover (said-once #4, 2026-11-14) */
.ip-hist ul { list-style: none; margin: 6px 0 0; padding: 0; padding-inline-start: var(--sp-2); display: grid; gap: 6px; }
.ip-hist li { display: grid; gap: 2px; justify-items: start; }
.ip-hist li.ip-old .la-vi { text-decoration: line-through; opacity: .7; }

/* Opportunities */
.lp-opps { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: var(--sp-3); }
/* One offer card (offerActions.js, Sami 2026-11-11): unit = headline, offer number = a chip, price + discount, plan chips, a foot with
   the salesperson and the icon buttons. Hover lifts the border only, the card never moves. */
.lp-opp { border: 1px solid var(--c-line); border-radius: var(--r-lg); background: var(--c-card); box-shadow: var(--card-shadow); padding: var(--sp-4); display: grid; gap: 10px; align-content: start; transition: border-color .15s; }
.lp-opp:hover { border-color: var(--c-line-strong); }
.lp-opp-t { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--sp-2); }
.lp-opp-unit { min-width: 0; font-size: var(--fs-title); line-height: 1.2; font-weight: var(--fw-semibold); color: var(--c-ink); }
.lp-opp-unit .rec-num { color: var(--c-ink); font-weight: var(--fw-semibold); }
.lp-opp-unit .rec-num:hover { color: var(--c-accent-text); }
.lp-opp-s { display: flex; flex-wrap: wrap; align-items: center; gap: 6px var(--sp-2); margin-top: -4px; }
.lp-opp-no { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px 2px 7px; border: 1px solid var(--c-line); border-radius: var(--r-pill); background: var(--c-tile); font-size: var(--fs-table); font-variant-numeric: tabular-nums; }
.lp-opp-no .ico { width: 13px; height: 13px; color: var(--c-faint); }
.lp-opp-no .rec-num { font-weight: var(--fw-semibold); letter-spacing: .02em; }
.lp-opp-proj { font-size: var(--fs-hint); color: var(--c-muted); }
.lp-opp-proj .rec-link { font-weight: var(--fw-medium); color: var(--c-muted); }
.lp-opp-money { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px var(--sp-2); padding-top: 2px; }
.lp-price { font-size: var(--fs-section); font-weight: var(--fw-semibold); color: var(--c-ink); font-variant-numeric: tabular-nums; }
.lp-opp-was { display: inline-flex; align-items: baseline; gap: 6px; font-size: var(--fs-hint); font-variant-numeric: tabular-nums; }
.lp-opp-was s { color: var(--c-faint); }
.lp-opp-was b { color: var(--c-danger); font-weight: var(--fw-semibold); }
.lp-opp-plan { display: flex; flex-wrap: wrap; gap: 6px; }
.lp-opp-plan span { padding: 2px var(--sp-2); border-radius: var(--r-pill); background: var(--c-select); font-size: var(--fs-hint); color: var(--c-text); white-space: nowrap; }
.lp-opp-m b { color: var(--c-text); font-weight: var(--fw-medium); font-variant-numeric: tabular-nums; }
.lp-opp-m b.lp-opp-left { color: var(--c-warning); font-weight: var(--fw-semibold); } /* the amount still to pay stands out (Sami 2026-11-21) */
.lp-opp-m b.lp-opp-done { color: var(--c-success); }
:is(.lp-opp-m, .lp-opp-w, .lp-opp-r) { display: flex; align-items: center; gap: 6px; }
:is(.lp-opp-m, .lp-opp-w, .lp-opp-r) .ico { width: 14px; height: 14px; color: var(--c-faint); }
.lp-opp-w.late .ico { color: currentColor; }
.lp-opp-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--sp-2); margin-top: 2px; padding-top: 10px; border-top: 1px solid var(--c-line); }
.lp-opp-who { display: inline-flex; align-items: center; gap: 5px; min-width: 0; font-size: var(--fs-hint); color: var(--c-muted); }
.lp-opp-who .ico { width: 14px; height: 14px; color: var(--c-faint); }
.lp-opp-who > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--c-text); font-weight: var(--fw-medium); }
.lp-opp-who i { font-style: normal; color: var(--c-faint); }
.lp-opp .btn { justify-self: start; text-decoration: none; }

/* Next follow-up card (side column, under Salesperson): the date and type dark; on time = a blue icon and blue "in 12 hours";
   overdue (Sami 2026-11-08) = no red fill, the clock icon and "Overdue · 3 hours ago" in red; nothing planned = grey */
.lp-fu { display: flex; align-items: center; gap: var(--sp-3); color: var(--c-info); }
.lp-fu.over { color: var(--c-danger); }
.lp-fu.none { color: var(--c-muted); }
.lp-fu-i { width: 32px; height: 32px; border-radius: 50%; background: var(--c-info-soft); display: grid; place-items: center; flex: none; }
.lp-fu.over .lp-fu-i { background: var(--c-danger-soft); }
.lp-fu.none .lp-fu-i { background: var(--c-select); }
.lp-fu-t { flex: 1; min-width: 0; display: grid; }
.lp-fu-t b { color: var(--c-ink); font-weight: var(--fw-semibold); overflow-wrap: anywhere; }
.lp-fu-t span { font-size: var(--fs-hint); color: var(--c-info); }
.lp-fu.over .lp-fu-t span { color: var(--c-danger); font-weight: var(--fw-semibold); }
.lp-fu.none .lp-fu-t span { color: var(--c-muted); }
.lp-tl { padding: 0 var(--sp-4) var(--sp-4); }
.lp-tl .ls-list { margin-top: 0; grid-template-columns: minmax(0, 1fr); }
.lp-tl .ls-empty { margin: 0; color: var(--c-muted); }

/* Fixed-size pop-ups (stage, reassign, note) */
dialog.modal.lp-pop { width: min(480px, 94vw); height: min(520px, 92vh); }
.lp-pop textarea, .lp-pop select { width: 100%; font: inherit; border: 1px solid var(--c-line-strong); border-radius: var(--r-md); padding: var(--sp-2) var(--sp-3); background: var(--c-card); color: var(--c-ink); }
.lp-pop textarea { min-height: 120px; resize: vertical; }
.lp-name-row .badge { min-height: 28px; padding-inline: var(--sp-3); font-size: var(--fs-body); font-weight: var(--fw-semibold); }

/* Interest cards on the lead page: the same compact card as the Log activity screen, side by side (never one long row) */
.ip-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 300px)); gap: var(--sp-3); align-items: start; }
.ip-card { min-width: 0; margin: 0; }
.ls-need + .ip-card, .ip-cards > .ls-need + .ls-need { margin-top: 0; }
.ip-kv .full { grid-column: 1 / -1; font-weight: var(--fw-semibold); color: var(--c-ink); }
.ip-card .ip-hist { margin-top: var(--sp-2); }

/* One column (tablet held upright, phone): a shorter client card, so the next follow-up shows sooner. Two numbers side by side, facts in a row. */
@container lp (max-width: 789.98px) {
  .lp-phones { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
  .lp-facts { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); column-gap: var(--sp-4); }
}
/* The timeline filters stay on one line (they scroll sideways when the column is narrow); Log note sits in the Timeline header. */
.lp-tl .ls-filters { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
.lp-tl .ls-filters::-webkit-scrollbar { display: none; }
.lp-tl .ls-f { flex: none; }
.lp-nophone { margin: 0; font-size: var(--fs-hint); color: var(--c-muted); }

/* The three main section heads (Interests, Offers, Timeline) (quiet look B, Sami 2026-11-13, DECISIONS #238): the same quiet head as every section box (ui.css .sbox):
   plain white, a small grey icon, the title in dark ink, a grey count. Colour stays for what means something (late, states). */
.lp-zone { --k: var(--tint-blue); --ks: var(--tint-blue-soft); --kl: var(--tint-blue-line); overflow: hidden; }
#lpOpps { --k: color-mix(in srgb, var(--tint-amber) 88%, #000); --ks: var(--tint-amber-soft); --kl: var(--tint-amber-line); }
#lpAct { --k: var(--tint-pink); --ks: var(--tint-pink-soft); --kl: var(--tint-pink-line); }
.lp-zh { min-height: 48px; margin-bottom: var(--sp-3); background: var(--c-card); border-bottom: 1px solid var(--c-line); }
.lp-zh h2 { gap: var(--sp-2); font-size: var(--fs-body); font-weight: var(--fw-semibold); }
.lp-zi { width: 20px; height: 20px; flex: none; display: grid; place-items: center; color: var(--c-muted);; background: none; }
.lp-zi svg { width: 18px; height: 18px; }
.lp-zh .lp-count { color: var(--c-muted); background: var(--c-page); border-color: var(--c-line); }
/* every zone folds from its head and opens folded; the count stays on the head (Sami 2026-11-13, DECISIONS #238) */
.lp-zh { cursor: pointer; }
.lp-zh:hover { background: var(--c-select); }
.lp-zh:hover .lp-fold { border-color: var(--c-accent); color: var(--c-accent); }
.lp-fold { width: 30px; min-width: 30px; height: 30px; padding: 0; font: inherit; cursor: pointer; /* hover: on .lp-zh:hover .lp-fold */ }
.lp-zone.shut > :not(.lp-zh) { display: none; }
.lp-zone.shut > .lp-zh { margin-bottom: 0; border-bottom-color: transparent; }
.lp-zone.shut .lp-fold { transform: rotate(-90deg); }
.lp-main { gap: var(--sp-5); }
/* Offers on the lead page (S3c): state, waiting time, reason and the buttons the server allows */
.lp-lock { margin: 0; font-size: var(--fs-hint); color: var(--c-muted); }
.lp-lostnote { margin-bottom: var(--sp-3); }
.lp-opp-s, .lp-opp-m, .lp-opp-r { font-size: var(--fs-hint); color: var(--c-muted); }
.lp-opp-w { font-size: var(--fs-hint); color: var(--c-text); font-variant-numeric: tabular-nums; }
.lp-opp-w.late { color: var(--c-danger); font-weight: var(--fw-semibold); }
.lp-opp-acts { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.lp-opp.hl { border-color: var(--c-accent, var(--c-ink)); box-shadow: 0 0 0 2px var(--c-accent-soft, var(--c-line)); }
.lp-opp-wait { color: var(--c-muted); } /* slice 6: the payments line while Odoo is read, or when it is not reachable */
