/* Finance › Sales › Leads & Proposals (#leads). Colours come from styles.css's tokens, so light and dark both work;
   the charts reuse Finance's chart classes (.pf-grid, .pf-axis) with their own series colours (.ld-s0 … .ld-s7). */
[data-page="leads"] {
  --ld-s0: var(--pma-blue); --ld-s1: var(--ty-co); --ld-s2: var(--ty-ind); --ld-s3: var(--ty-st);
  --ld-s4: var(--ty-other); --ld-s5: var(--green); --ld-s6: var(--orange); --ld-s7: var(--violet);
}
.ld-s0 { fill: var(--ld-s0); background: var(--ld-s0); } .ld-s1 { fill: var(--ld-s1); background: var(--ld-s1); }
.ld-s2 { fill: var(--ld-s2); background: var(--ld-s2); } .ld-s3 { fill: var(--ld-s3); background: var(--ld-s3); }
.ld-s4 { fill: var(--ld-s4); background: var(--ld-s4); } .ld-s5 { fill: var(--ld-s5); background: var(--ld-s5); }
.ld-s6 { fill: var(--ld-s6); background: var(--ld-s6); } .ld-s7 { fill: var(--ld-s7); background: var(--ld-s7); }

[data-page="leads"] .page-actions { flex-direction: row; flex-wrap: wrap; align-items: center; justify-content: flex-end; }
#ld-body { display: grid; gap: 18px; min-width: 0; }
.ld-kpis .kpi b { font-size: 32px; }
.ld-ksub { display: block; margin-top: 4px; font-style: normal; font-size: 11.5px; color: var(--muted); }
.ld-tabs { margin-top: 2px; }
.ld-tabn { display: inline-block; min-width: 18px; padding: 0 5px; margin-left: 4px; border-radius: 99px; background: var(--red); color: #fff; font-size: 10.5px; line-height: 16px; }
.ld-ind { font-size: 10px; font-weight: 600; letter-spacing: .03em; text-transform: uppercase; color: var(--muted); }
.linkish { border: 0; background: none; padding: 0; font: inherit; color: var(--pma-blue); cursor: pointer; text-align: left; }
.linkish:hover { text-decoration: underline; }
.ld-acts { display: inline-flex; flex-wrap: wrap; gap: 6px; align-items: center; justify-content: flex-end; }
.ld-filters { margin-bottom: 10px; }
.ld-key { margin: 12px 0 0; }

/* The board: columns scroll sideways; on a phone they stack. */
.ld-board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(190px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 6px; margin-top: 10px; }
.ld-col { background: var(--line-2); border: 1px solid var(--line); border-radius: 10px; padding: 10px; min-width: 0; display: flex; flex-direction: column; gap: 8px; transition: box-shadow .12s, border-color .12s; }
.ld-col > header { display: grid; grid-template-columns: 1fr auto; gap: 2px 8px; align-items: baseline; }
.ld-col h3 { font-size: 14px; }
.ld-cn { font: 700 12px var(--font); background: var(--panel); border: 1px solid var(--line); border-radius: 99px; padding: 0 8px; }
.ld-col header small { grid-column: 1 / -1; font-size: 12px; color: var(--ink-2); }
.ld-lock { grid-column: 1 / -1; font-style: normal; font-size: 11px; color: var(--muted); }
.ld-lock::before { content: "🔒 "; filter: grayscale(1); }
.ld-col.locked { background: var(--bg); border-style: dashed; }
.ld-col.over { border-color: var(--pma-blue); box-shadow: 0 0 0 2px var(--pma-blue) inset; }
.ld-col.refuse { border-color: var(--red); box-shadow: 0 0 0 2px var(--red-soft) inset; }
.ld-cards { display: grid; gap: 8px; }
.ld-empty { margin: 4px 2px; }
.ld-card { position: relative; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; box-shadow: var(--shadow); cursor: pointer; display: grid; gap: 4px; font-size: 12.5px; }
.ld-card:hover { border-color: var(--muted); }
.ld-card:focus-visible { outline: 2px solid var(--pma-blue); outline-offset: 1px; }
.ld-card.dragging { opacity: .5; }
.ld-card-top { display: flex; gap: 6px; align-items: flex-start; justify-content: space-between; }
.ld-card-top b { font-size: 13px; line-height: 1.3; overflow-wrap: anywhere; }
.ld-kebab { border: 0; background: transparent; color: var(--muted); font-size: 18px; line-height: 1; padding: 0 4px; border-radius: 6px; cursor: pointer; }
.ld-kebab:hover, .ld-kebab[aria-expanded="true"] { background: var(--line-2); color: var(--ink); }
.ld-who { color: var(--ink-2); overflow-wrap: anywhere; }
.ld-chips { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.ld-temp, .ld-src, .ld-val { font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 99px; background: var(--grey-soft); color: var(--ink-2); }
.ld-temp.hot { background: var(--red-soft); color: var(--red); }
.ld-temp.warm { background: var(--amber-soft); color: var(--amber); }
.ld-temp.cold { background: var(--pma-blue-soft); color: var(--pma-blue-ink); }
.ld-val { background: transparent; padding: 0; }
.ld-age { font-size: 11.5px; color: var(--muted); }
.ld-age.amber { color: var(--amber); font-weight: 600; }
.ld-age.red { color: var(--red); font-weight: 600; }
.ld-next { font-size: 11.5px; color: var(--ink-2); display: flex; gap: 4px; align-items: center; }
.ld-next.today { color: var(--amber); } .ld-next.late { color: var(--red); }
.ld-prop { justify-self: start; font-size: 11px; font-weight: 700; color: var(--violet); background: var(--violet-soft); padding: 1px 7px; border-radius: 4px; text-decoration: none; }
.ld-prop:hover { text-decoration: underline; }
.ld-ticon { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.ld-menu { position: absolute; z-index: 5; right: 6px; top: 32px; min-width: 210px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 10px 30px rgba(0,0,0,.18); padding: 4px; display: grid; }
.ld-menu [role=menuitem] { display: block; text-align: left; border: 0; background: none; font: 500 13px var(--font); color: var(--ink); padding: 7px 10px; border-radius: 6px; cursor: pointer; text-decoration: none; }
.ld-menu [role=menuitem]:hover, .ld-menu [role=menuitem]:focus-visible { background: var(--line-2); outline: none; }
.ld-menu [aria-disabled="true"] { color: var(--muted); cursor: not-allowed; }
.ld-drafts .cl-rows small { display: block; font-size: 11.5px; color: var(--muted); }

/* Follow-ups */
.ld-sec { font-size: 13px; margin: 16px 0 6px; display: flex; gap: 6px; align-items: center; }
.ld-sec span { font: 700 11px var(--font); background: var(--grey-soft); border-radius: 99px; padding: 0 7px; }
.ld-sec.overdue { color: var(--red); } .ld-sec.overdue span { background: var(--red-soft); }
.ld-sec.today { color: var(--amber); } .ld-sec.today span { background: var(--amber-soft); }
.ld-fulist { list-style: none; margin: 0; padding: 0; display: grid; }
.ld-fu { display: grid; grid-template-columns: 22px minmax(0, 1fr) auto auto; gap: 10px; align-items: center; padding: 9px 0; border-bottom: 1px solid var(--line-2); }
.ld-fu:last-child { border-bottom: 0; }
.ld-fu-ic { color: var(--muted); display: inline-grid; }
.ld-fu-main { display: grid; gap: 1px; min-width: 0; }
.ld-fu-main b { font-weight: 600; overflow-wrap: anywhere; }
.ld-fu-main small, .ld-fu-due small { font-size: 11.5px; color: var(--muted); }
.ld-fu-lead { font-size: 12px; font-weight: 600; }
.ld-fu-due { font-size: 12.5px; white-space: nowrap; display: grid; text-align: right; }
.ld-fu-due.late { color: var(--red); font-weight: 600; } .ld-fu-due.today { color: var(--amber); font-weight: 600; }
.ld-fu.greyed { opacity: .55; }
.ld-fu.done .ld-fu-main b { text-decoration: line-through; color: var(--muted); }
.ld-snooze { min-height: 30px; padding: 4px 8px; font-size: 12px; }
.ld-nocopy { font-size: 11.5px; font-weight: 600; color: var(--amber); }
.ld-recent { margin-top: 14px; }
.ld-recent summary { cursor: pointer; font-size: 12px; font-weight: 600; color: var(--muted); }

/* Proposals */
.ld-pnote { margin: 0 0 10px; }
.ld-ptbl td small { display: block; font-size: 11.5px; }
.ld-ptbl td, .ld-ptbl th { white-space: nowrap; padding-left: 8px; padding-right: 8px; }
.ld-ptbl td:nth-child(2), .ld-ptbl td:nth-child(3), .ld-ptbl th:nth-child(2), .ld-ptbl th:nth-child(3) { white-space: normal; min-width: 120px; }
@media (max-width: 1600px) { .ld-xl { display: none; } }
.ld-flags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 3px; }
.ld-flag { font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 4px; text-decoration: none; white-space: nowrap; }
.ld-flag.amber { background: var(--amber-soft); color: var(--amber); }
.ld-flag.red { background: var(--red-soft); color: var(--red); }
.ld-flag.blue { background: var(--pma-blue-soft); color: var(--pma-blue-ink); }
.ld-pst { font-size: 11.5px; font-weight: 600; padding: 2px 8px; border-radius: 99px; background: var(--grey-soft); color: var(--ink-2); white-space: nowrap; }
.ld-pst.sent { background: var(--violet-soft); color: var(--violet); }
.ld-pst.accepted { background: var(--green-soft); color: var(--green); }
.ld-pst.declined, .ld-pst.expired { background: var(--red-soft); color: var(--red); }

/* Insights and Lost */
.ld-months { margin-bottom: -4px; }
.ld-ikpis { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.ld-ikpis .kpi b { font-size: 30px; }
.ld-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 8px; font-size: 12px; color: var(--ink-2); }
.ld-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }
.ld-grid { gap: 18px; }
.ld-wr td, .ld-wr th { padding-top: 7px; padding-bottom: 7px; }
.ld-hbars { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.ld-hbars li { display: grid; grid-template-columns: minmax(110px, 30%) 1fr 36px; gap: 10px; align-items: center; font-size: 12.5px; }
.ld-hb-l { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ld-hb-t { height: 12px; border-radius: 99px; background: var(--line-2); overflow: hidden; }
.ld-hb-t i { display: block; height: 100%; background: var(--pma-blue); border-radius: 99px; }
.ld-hbars b { text-align: right; }

/* The lead panel: a drawer on the right; full screen on a phone. */
.ld-panel { position: fixed; z-index: 40; top: 0; right: 0; bottom: 0; width: min(460px, 100vw); overflow-y: auto; background: var(--panel); color: var(--ink); border-left: 1px solid var(--line); box-shadow: -12px 0 40px rgba(0,0,0,.18); padding: 18px 20px 40px; display: grid; align-content: start; gap: 14px; }
.ld-panel:focus { outline: none; }
.ld-ph { display: flex; gap: 10px; align-items: flex-start; justify-content: space-between; }
.ld-ph h2 { font-size: 20px; overflow-wrap: anywhere; }
.ld-x { border: 1px solid var(--line); background: var(--panel); color: var(--ink); border-radius: 8px; width: 34px; height: 34px; cursor: pointer; flex: none; }
.ld-pacts { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.ld-pacts > a { font-weight: 600; font-size: 13px; }
.ld-pacts select { width: auto; max-width: 220px; min-height: 30px; padding: 4px 8px; font-size: 12px; }
.ld-dl { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 6px 14px; margin: 0; font-size: 13px; }
.ld-dl dt { color: var(--muted); font-weight: 600; font-size: 12px; }
.ld-dl dd { margin: 0; overflow-wrap: anywhere; }
.ld-prospect { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; padding: 1px 6px; border-radius: 4px; background: var(--amber-soft); color: var(--amber); }
.ld-psec { border-top: 1px solid var(--line); padding-top: 12px; display: grid; gap: 8px; }
.ld-psec > header { display: flex; align-items: center; justify-content: space-between; }
.ld-psec h3 { font-size: 14px; }
.ld-psec .ld-fu { grid-template-columns: 22px minmax(0, 1fr) auto; }
.ld-psec .ld-fu .ld-acts { grid-column: 2 / -1; justify-content: flex-start; }
#ld-note { display: grid; gap: 8px; }
#ld-note .btn { justify-self: start; }
.ld-notes { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.ld-notes li { display: grid; gap: 2px; padding: 10px 12px; border-radius: 8px; background: var(--line-2); }
.ld-notes p { margin: 4px 0 0; white-space: pre-line; font-size: 12.5px; color: var(--ink-2); }

/* Dialogs: the forms */
dialog.ld-wide { width: min(720px, calc(100vw - 32px)); }
.ld-fgrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 12px; margin-top: 12px; }
.ld-fgrid3 { display: grid; grid-template-columns: 120px minmax(0, 1fr) 150px; gap: 8px; }
.ld-fgrid .span2 { grid-column: 1 / -1; }
.ld-fgrid .field select, .ld-fgrid .field input, .ld-fgrid .field textarea, .ld-fgrid3 > *, [id^="ld-"] .field select, [id^="ld-"] .field textarea { width: 100%; }
dialog[id^="ld-"] .field textarea, dialog[id^="ld-"] .field select { width: 100%; }
dialog[id^="ld-"] input[type=tel], dialog[id^="ld-"] input[type=time], #ld-note input, #ld-note textarea { font: 13px var(--font); color: var(--ink); background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; min-height: 36px; width: 100%; }
.ld-inline { display: flex; gap: 6px; }
.ld-inline input { flex: 1; min-width: 0; }
.ld-biz, .ld-first { border: 0; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 6px 18px; align-items: center; }
.ld-first { display: grid; gap: 6px; }
.ld-biz legend, .ld-first legend { padding: 0; margin-bottom: 4px; width: 100%; }
.ld-biz label { font-size: 13px; display: inline-flex; gap: 6px; align-items: center; }
.ld-n-existing, .ld-n-new { display: grid; gap: 8px; }
.ld-hits { display: flex; flex-wrap: wrap; gap: 6px; }
.ld-hit { display: grid; text-align: left; gap: 1px; border: 1px solid var(--line); background: var(--panel); color: var(--ink); border-radius: 8px; padding: 6px 10px; cursor: pointer; font: 13px var(--font); }
.ld-hit:hover, .ld-hit[aria-pressed="true"] { border-color: var(--pma-blue); }
.ld-hit small { font-size: 11px; color: var(--muted); }
.ld-send { margin: 12px 0; }

@media (max-width: 1100px) {
  .ld-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .ld-ikpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .ld-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ld-kpis .kpi b, .ld-ikpis .kpi b { font-size: 26px; }
  .ld-tabs { display: flex; overflow-x: auto; max-width: 100%; }
  .ld-tabs button { white-space: nowrap; }
  .ld-board { grid-auto-flow: row; grid-auto-columns: auto; overflow-x: visible; }
  .ld-fu { grid-template-columns: 22px minmax(0, 1fr) auto; }
  .ld-fu .ld-acts { grid-column: 2 / -1; justify-content: flex-start; }
  .ld-fgrid, .ld-fgrid3 { grid-template-columns: minmax(0, 1fr); }
  .ld-hbars li { grid-template-columns: minmax(90px, 38%) 1fr 30px; }
  .ld-panel { padding: 16px 16px 40px; }
  .page-head .page-actions { flex-wrap: wrap; }
}
