/* Sanghavi Jewels — Lead Pipeline. Clean white with subtle gold accents. */
:root {
  --bg: #ffffff;
  --surface: #ffffff;
  --soft: #faf8f4;
  --soft-2: #f4f0e8;
  --line: #ebe6dc;
  --line-2: #ddd5c6;
  --ink: #1d1b18;
  --ink-2: #4a463f;
  --muted: #857e72;
  --gold: #b08a45;
  --gold-d: #8f6d31;
  --gold-l: #f3ead8;
  --gold-xl: #fbf7ee;
  --ok: #2f7d4f; --ok-bg: #e9f5ee;
  --warn: #a86a12; --warn-bg: #fdf3e2;
  --bad: #b23b3b; --bad-bg: #fbecec;
  --info: #3b5f8f; --info-bg: #ecf2fa;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(29, 27, 24, .04), 0 2px 10px rgba(29, 27, 24, .04);
  --shadow-lg: 0 12px 40px rgba(29, 27, 24, .16);
  --serif: "Cormorant Garamond", "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
  --side: 236px;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font: 14px/1.45 var(--sans); -webkit-font-smoothing: antialiased; }
body.modal-open { overflow: hidden; }
a { color: var(--gold-d); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; font-weight: 600; }
h1 { font-family: var(--serif); font-size: 30px; font-weight: 600; letter-spacing: .2px; line-height: 1.15; }
h2 { font-size: 15px; }
h3 { font-size: 13px; }
code { font: 12px ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--soft-2); padding: 1px 5px; border-radius: 4px; }
small { display: block; color: var(--muted); font-size: 12px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.right { text-align: right; }
.warn-text { color: var(--bad); font-weight: 600; }
.ic { width: 16px; height: 16px; flex: none; vertical-align: -3px; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 36px; padding: 0 14px; border-radius: 8px; border: 1px solid var(--line-2);
  background: #fff; color: var(--ink); font: 600 13px var(--sans); cursor: pointer; white-space: nowrap; text-decoration: none !important; transition: background .12s, border-color .12s, box-shadow .12s; }
.btn:hover { background: var(--soft); border-color: var(--gold); }
.btn:disabled, .btn[disabled] { opacity: .45; cursor: not-allowed; }
.btn.primary { background: linear-gradient(180deg, #bf9a55, var(--gold)); border-color: var(--gold-d); color: #fff; box-shadow: 0 1px 0 rgba(255,255,255,.25) inset, 0 1px 2px rgba(143,109,49,.3); }
.btn.primary:hover { background: linear-gradient(180deg, #b48f4a, var(--gold-d)); }
.btn.ghost { background: #fff; }
.btn.danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.sm { height: 30px; padding: 0 10px; font-size: 12.5px; }
.btn.block { width: 100%; height: 42px; font-size: 14px; }
.btn.link { border: 0; background: none; color: var(--gold-d); padding: 0 4px; height: auto; font-weight: 600; }
.btn.link:hover { text-decoration: underline; background: none; }
.btn.action { height: 34px; }
.btn.gold-outline { border-color: var(--gold); color: var(--gold-d); }
.btn.wa { background: #1f8f4e; border-color: #1a7a42; color: #fff; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: 8px; border: 1px solid transparent; background: none; color: var(--ink-2); cursor: pointer; font-size: 20px; line-height: 1; }
.icon-btn:hover { background: var(--soft-2); border-color: var(--line); text-decoration: none; }
.chip-btn { border: 1px solid var(--line-2); background: #fff; border-radius: 999px; padding: 3px 10px; font: 500 12px var(--sans); color: var(--ink-2); cursor: pointer; }
.chip-btn:hover { border-color: var(--gold); }
.chip-btn.on { background: var(--gold-l); border-color: var(--gold); color: var(--gold-d); }

/* ---------- Layout ---------- */
.boot { padding: 40px; color: var(--muted); }
.layout { display: flex; min-height: 100vh; }
.sidebar { width: var(--side); flex: none; border-right: 1px solid var(--line); background: var(--soft); display: flex; flex-direction: column; padding: 18px 14px; position: sticky; top: 0; height: 100vh; z-index: 40; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none !important; }
.brand .ic { width: 30px; height: 30px; color: var(--gold); }
.brand strong { display: block; font: 600 19px var(--serif); letter-spacing: .3px; }
.brand span { display: block; font-size: 10.5px; text-transform: uppercase; letter-spacing: 1.6px; color: var(--gold-d); }
.brand.big .ic { width: 40px; height: 40px; }
.brand.big strong { font-size: 26px; }
.sidebar .add-lead { margin: 22px 0 14px; height: 42px; font-size: 14px; }
.sidebar nav { display: flex; flex-direction: column; gap: 2px; }
.sidebar nav a { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 8px; color: var(--ink-2); font-weight: 500; text-decoration: none; }
.sidebar nav a .ic { width: 18px; height: 18px; color: var(--muted); }
.sidebar nav a:hover { background: #fff; }
.sidebar nav a.active { background: #fff; color: var(--ink); box-shadow: var(--shadow); border-left: 3px solid var(--gold); padding-left: 7px; }
.sidebar nav a.active .ic { color: var(--gold); }
.count { margin-left: auto; font-style: normal; font-size: 11px; font-weight: 700; background: var(--gold-l); color: var(--gold-d); border-radius: 999px; padding: 1px 7px; }
.count.alert { background: var(--bad); color: #fff; }
.me { margin-top: auto; display: flex; align-items: center; gap: 8px; padding-top: 14px; border-top: 1px solid var(--line); }
.me > div { flex: 1; min-width: 0; }
.me strong { display: block; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me span { font-size: 11px; color: var(--muted); }
.me .icon-btn .ic { width: 16px; height: 16px; }
.avatar { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: 50%; background: var(--gold-l); color: var(--gold-d); font-weight: 700; font-size: 12px; flex: none; border: 1px solid #e8dcc2; }
.avatar.xs { width: 22px; height: 22px; font-size: 9.5px; }
.main-col { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 12px; padding: 10px 28px; background: rgba(255,255,255,.94); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.topbar .menu-btn, .topbar .brand.small { display: none; }
.global-search { flex: 1; max-width: 520px; display: flex; align-items: center; gap: 8px; height: 36px; padding: 0 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--soft); }
.global-search:focus-within { border-color: var(--gold); background: #fff; }
.global-search .ic { color: var(--muted); }
.global-search input { border: 0; background: none; outline: none; flex: 1; font: inherit; min-width: 0; }
.reminder { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; color: var(--gold-d); background: var(--gold-xl); border: 1px solid #ecdcb9; padding: 5px 10px; border-radius: 999px; margin-left: auto; text-decoration: none !important; }
.reminder.alert { color: var(--bad); background: var(--bad-bg); border-color: #efc9c9; }
.add-lead-top { margin-left: 0; height: 38px; padding: 0 16px; font-size: 14px; }
.reminder[hidden] + .add-lead-top { margin-left: auto; }
.demo-banner { background: var(--gold-xl); border-bottom: 1px solid #efe3c9; color: var(--gold-d); font-size: 12px; padding: 6px 28px; }
#view { outline: none; }
.scrim { display: none; }

/* ---------- Page ---------- */
.page { max-width: 1240px; margin: 0 auto; padding: 26px 28px 60px; }
.page.wide { max-width: none; }
.page.narrow { max-width: 640px; }
.page.loading { display: flex; justify-content: center; padding-top: 80px; }
.spinner { width: 28px; height: 28px; border: 3px solid var(--gold-l); border-top-color: var(--gold); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head .sub { margin: 6px 0 0; color: var(--muted); display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.head-actions { display: flex; gap: 8px; }
.back { display: inline-block; font-size: 12.5px; color: var(--muted); margin-bottom: 6px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); margin-bottom: 16px; }
.card > h2 { margin-bottom: 12px; }
.card h2 + h2, .details-card h2 { margin-top: 4px; }
.details-card h2:not(:first-child) { margin-top: 18px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }

/* ---------- Badges ---------- */
.badge { display: inline-flex; align-items: center; height: 21px; padding: 0 8px; border-radius: 999px; font-size: 11.5px; font-weight: 600; background: var(--soft-2); color: var(--ink-2); white-space: nowrap; vertical-align: middle; font-family: var(--sans); letter-spacing: 0; }
.stage-new { background: #eef1f5; color: #4b5a6e; }
.stage-contacted { background: var(--info-bg); color: var(--info); }
.stage-qualified { background: #eef3e6; color: #557033; }
.stage-quote_sent { background: var(--gold-l); color: var(--gold-d); }
.stage-negotiation { background: #f6eadf; color: #9a5a22; }
.stage-won { background: var(--ok-bg); color: var(--ok); }
.stage-lost { background: #f1efec; color: #8a837a; }
.stage-nurture { background: #f2ecf6; color: #6c4a86; }
.prio-high-badge { background: var(--bad-bg); color: var(--bad); font-size: 11px; }
.prio { display: inline-block; width: 9px; height: 9px; border-radius: 50%; vertical-align: 1px; flex: none; }
.prio-high { background: #c9503f; }
.prio-medium { background: #d7a64a; }
.prio-low { background: #c9c2b5; }
.perm { display: inline-flex; padding: 1px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 600; }
.perm-allowed { background: var(--ok-bg); color: var(--ok); }
.perm-unknown { background: var(--soft-2); color: var(--muted); }
.perm-do_not_contact { background: var(--bad-bg); color: var(--bad); }
.outcome-spoke { background: var(--ok-bg); color: var(--ok); }
.outcome-callback_requested { background: var(--gold-l); color: var(--gold-d); }
.outcome-no_answer, .outcome-voicemail { background: var(--soft-2); color: var(--ink-2); }
.outcome-wrong_number, .outcome-not_interested { background: var(--bad-bg); color: var(--bad); }
.tags { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 10px; }
.tag { display: inline-block; padding: 2px 8px; border-radius: 6px; background: var(--gold-xl); border: 1px solid #efe4cc; color: var(--ink-2); font-size: 11.5px; }
.tags.xs { margin: 6px 0 0; }
.tags.xs .tag { font-size: 10.5px; padding: 1px 6px; }

/* ---------- Forms ---------- */
input, select, textarea { font: inherit; color: var(--ink); }
.field input, .field select, .field textarea, .filters input, .filters select, .modal input:not([type=checkbox]):not([type=radio]), .modal select, .modal textarea, .card input:not([type=checkbox]):not([type=radio]), .login input, .inline-select select {
  width: 100%; height: 38px; padding: 0 11px; border: 1px solid var(--line-2); border-radius: 8px; background: #fff; outline: none; transition: border-color .12s, box-shadow .12s; }
textarea, .field textarea, .modal textarea { height: auto !important; padding: 9px 11px !important; resize: vertical; line-height: 1.45; }
input:focus, select:focus, textarea:focus { border-color: var(--gold) !important; box-shadow: 0 0 0 3px rgba(176,138,69,.15); }
input.invalid { border-color: var(--bad) !important; background: #fffafa; }
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 14px; min-width: 0; }
.lbl { font-size: 12px; font-weight: 600; color: var(--ink-2); }
.lbl em { color: var(--gold-d); font-style: normal; }
.grid { display: grid; gap: 0 16px; }
.grid.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.span2 { grid-column: span 2; }
.with-btn { display: flex; gap: 6px; }
.with-btn .btn { height: 38px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { position: relative; cursor: pointer; }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip span { display: inline-flex; align-items: center; height: 32px; padding: 0 13px; border: 1px solid var(--line-2); border-radius: 999px; background: #fff; font-size: 13px; color: var(--ink-2); transition: all .12s; user-select: none; }
.chip:hover span { border-color: var(--gold); }
.chip input:checked + span { background: var(--gold-l); border-color: var(--gold); color: var(--gold-d); font-weight: 600; }
.chip input:checked + span::before { content: "✓"; margin-right: 5px; font-size: 11px; }
.chip input:focus-visible + span { outline: 2px solid var(--gold); outline-offset: 2px; }
.chips.big .chip span { height: 38px; padding: 0 16px; }
.presets { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 6px; }
.segmented { display: inline-flex; border: 1px solid var(--line-2); border-radius: 8px; overflow: hidden; background: #fff; }
.segmented label { position: relative; cursor: pointer; }
.segmented input { position: absolute; opacity: 0; }
.segmented span, .segmented button { display: inline-flex; align-items: center; height: 34px; padding: 0 14px; font: 500 13px var(--sans); border: 0; border-right: 1px solid var(--line); background: #fff; color: var(--ink-2); cursor: pointer; }
.segmented label:last-child span, .segmented button:last-child { border-right: 0; }
.segmented input:checked + .seg-unknown, .segmented button.on.seg-unknown { background: var(--soft-2); color: var(--ink); font-weight: 600; }
.segmented input:checked + .seg-allowed, .segmented button.on.seg-allowed { background: var(--ok-bg); color: var(--ok); font-weight: 600; }
.segmented input:checked + .seg-do_not_contact, .segmented button.on.seg-do_not_contact { background: var(--bad-bg); color: var(--bad); font-weight: 600; }
.segmented input:focus-visible + span { outline: 2px solid var(--gold); outline-offset: -2px; }
.segmented.tiny button { height: 26px; padding: 0 8px; font-size: 11.5px; }
.perm-field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 8px; }
.cap { color: var(--muted); }
.cap.on { color: var(--ok); font-weight: 600; }
.check, .radio-row { display: flex; align-items: center; gap: 8px; margin: 8px 0; font-size: 13px; cursor: pointer; }
.check input, .radio-row input { width: 16px; height: 16px; accent-color: var(--gold); }
.form-error { background: var(--bad-bg); color: var(--bad); border: 1px solid #f0caca; padding: 9px 12px; border-radius: 8px; font-size: 13px; margin: 10px 0; }
.callout { padding: 10px 14px; border-radius: 8px; border: 1px solid var(--line); background: var(--soft); margin-bottom: 14px; }
.callout.warn { background: var(--warn-bg); border-color: #f1dbb2; color: #6f4a10; }
.callout.error { background: var(--bad-bg); border-color: #f0caca; color: var(--bad); }
.callout.muted-callout { color: var(--muted); }
.callout.small { font-size: 12.5px; }
.dup-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 6px; }
.dup-list .dup-row { padding: 8px 0; border-top: 1px solid var(--line); }

/* Lead form */
.form-page { max-width: 1000px; }
.lead-form .card h2 { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; font-size: 16px; }
.step { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; border-radius: 50%; background: var(--gold-l); color: var(--gold-d); font-size: 11.5px; font-weight: 700; }
.req-note { margin-left: auto; font-weight: 500; color: var(--gold-d); font-size: 11.5px; display: inline; }
.sticky-actions { position: sticky; bottom: 0; display: flex; justify-content: flex-end; gap: 10px; padding: 12px 0; background: linear-gradient(transparent, #fff 30%); z-index: 5; }
.sticky-actions .btn { height: 42px; padding: 0 22px; font-size: 14px; }

/* ---------- Login ---------- */
.login { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; background: radial-gradient(1200px 500px at 50% -10%, var(--gold-xl), #fff 60%); }
.login-card { width: 100%; max-width: 380px; background: #fff; border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-lg); padding: 30px; display: flex; flex-direction: column; gap: 14px; border-top: 3px solid var(--gold); }
.login-card h1 { font-size: 22px; margin-top: 8px; }
.login-card label { display: flex; flex-direction: column; gap: 5px; font-size: 12px; font-weight: 600; color: var(--ink-2); }
.hint { margin: 0; font-size: 12px; color: var(--muted); text-align: center; }

/* ---------- Filters & tables ---------- */
.filters { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 12px; }
.filters.slim { padding: 10px; }
.filters select, .filters input { width: auto; min-width: 140px; height: 36px; }
.filters .search-box { flex: 1 1 260px; display: flex; align-items: center; gap: 8px; border: 1px solid var(--line-2); border-radius: 8px; padding: 0 10px; height: 36px; }
.filters .search-box:focus-within { border-color: var(--gold); }
.filters .search-box input { border: 0 !important; box-shadow: none !important; padding: 0; height: 34px; flex: 1; min-width: 0; }
.filters .search-box .ic { color: var(--muted); }
.custom-range { display: inline-flex; align-items: center; gap: 6px; }
.more-filters { position: relative; }
.more-filters summary { cursor: pointer; list-style: none; height: 36px; display: inline-flex; align-items: center; padding: 0 12px; border: 1px solid var(--line-2); border-radius: 8px; font-weight: 500; }
.more-filters summary::-webkit-details-marker { display: none; }
.more-filters[open] summary { border-color: var(--gold); }
.more-grid { position: absolute; top: 42px; left: 0; z-index: 20; display: grid; gap: 8px; width: 260px; padding: 12px; background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow-lg); }
.more-grid select, .more-grid input { width: 100%; }
.legend { margin: -4px 2px 10px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.legend .ic { width: 13px; height: 13px; }
.pdot-legend { display: inline-block; width: 8px; height: 8px; border-radius: 50%; }
.pdot-legend.allowed { background: var(--ok); } .pdot-legend.unknown { background: #c9c2b5; } .pdot-legend.do_not_contact { background: var(--bad); }
.table-card { padding: 0; overflow: hidden; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); padding: 10px 12px; border-bottom: 1px solid var(--line); background: var(--soft); white-space: nowrap; }
td { padding: 11px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
tbody tr:last-child td { border-bottom: 0; }
.leads-table tbody tr, .simple tbody tr[data-id] { cursor: pointer; }
.leads-table tbody tr:hover, .simple tbody tr[data-id]:hover { background: var(--gold-xl); }
th.sortable { cursor: pointer; user-select: none; }
th.sortable:hover { color: var(--ink); }
th.sorted { color: var(--gold-d); }
th.sorted.asc::after { content: " ↑"; } th.sorted.desc::after { content: " ↓"; }
.co { font-weight: 600; color: var(--ink); }
.due.overdue { color: var(--bad); font-weight: 600; }
.due.today { color: var(--gold-d); font-weight: 600; }
.due small { font-weight: 400; }
table.simple td, table.simple th { padding: 9px 10px; }
table.simple.compact td, table.simple.compact th { padding: 7px 8px; font-size: 12.5px; }
table.simple input { height: 32px; }

/* Mini checklist */
.mini-check { display: inline-flex; align-items: center; gap: 3px; padding: 3px 6px; border: 1px solid var(--line); border-radius: 7px; background: #fff; white-space: nowrap; }
.mini-check .ic { width: 14px; height: 14px; color: var(--ink); }
.mini-check.missing .ic { color: #cfc8bc; }
.mini-check .pdot { width: 7px; height: 7px; border-radius: 50%; background: #c9c2b5; margin-right: 2px; }
.mini-check.p-allowed .pdot { background: var(--ok); }
.mini-check.p-do_not_contact .pdot { background: var(--bad); }
.mini-check.p-do_not_contact { background: var(--bad-bg); border-color: #f0caca; }
.mini-check.missing .pdot { opacity: .4; }
.mini-check i { font-style: normal; font-size: 10px; font-weight: 700; width: 15px; height: 15px; border-radius: 4px; display: inline-flex; align-items: center; justify-content: center; color: #c9c2b5; background: var(--soft-2); }
.mini-check i.on { background: var(--gold); color: #fff; }
.cards-mobile { display: none; }

/* ---------- Dashboard ---------- */
.metrics { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.metric { text-align: left; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 14px 12px; cursor: pointer; box-shadow: var(--shadow); font-family: var(--sans); display: flex; flex-direction: column; gap: 2px; transition: border-color .12s, transform .12s; }
.metric:hover { border-color: var(--gold); }
.metric.on { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(176,138,69,.14), var(--shadow); background: var(--gold-xl); }
.m-label { font-size: 12px; font-weight: 600; color: var(--ink-2); }
.m-value { font: 600 34px/1.1 var(--serif); color: var(--ink); }
.m-hint { font-size: 11px; color: var(--muted); }
.m-overdue_followups .m-value { color: var(--bad); }
.m-won .m-value { color: var(--ok); }
.dash-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; align-items: start; }
.bars { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.bars a { display: grid; grid-template-columns: 130px 1fr 28px; align-items: center; gap: 8px; color: var(--ink-2); text-decoration: none; font-size: 12.5px; padding: 2px 0; }
.bars a:hover .b-label { color: var(--gold-d); }
.b-track { height: 10px; background: var(--soft-2); border-radius: 99px; overflow: hidden; }
.b-fill { display: block; height: 100%; border-radius: 99px; background: var(--gold); min-width: 2px; }
.b-fill.s-won { background: var(--ok); } .b-fill.s-lost { background: #c9c2b5; } .b-fill.s-nurture { background: #9c7fb3; }
.b-n { text-align: right; font-weight: 600; }

/* ---------- Kanban ---------- */
.kanban { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(250px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 12px; align-items: start; }
.col { background: var(--soft); border: 1px solid var(--line); border-radius: var(--radius); display: flex; flex-direction: column; min-height: 300px; transition: background .12s, border-color .12s; }
.col.over { background: var(--gold-xl); border-color: var(--gold); border-style: dashed; }
.col header { display: flex; align-items: center; justify-content: space-between; padding: 11px 12px; border-bottom: 1px solid var(--line); border-top: 3px solid var(--line-2); border-radius: var(--radius) var(--radius) 0 0; }
.col-quote_sent header, .col-negotiation header { border-top-color: var(--gold); }
.col-won header { border-top-color: var(--ok); } .col-lost header { border-top-color: #c9c2b5; } .col-nurture header { border-top-color: #9c7fb3; }
.col h2 { font-size: 13px; }
.col .n { font-size: 11.5px; font-weight: 700; color: var(--muted); background: #fff; border: 1px solid var(--line); border-radius: 99px; padding: 0 7px; }
.col-body { padding: 8px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.col-empty { color: var(--muted); font-size: 12px; text-align: center; padding: 20px 0; border: 1px dashed var(--line-2); border-radius: 8px; }
.k-card { display: block; background: #fff; border: 1px solid var(--line); border-radius: 9px; padding: 10px 11px; color: var(--ink); cursor: grab; box-shadow: var(--shadow); text-decoration: none !important; }
.k-card:hover { border-color: var(--gold); }
.k-card.dragging { opacity: .5; }
.k-top { display: flex; align-items: center; gap: 7px; }
.k-top a { flex: 1; color: var(--ink); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.k-top strong { font-size: 13px; }
.k-card .sizes { margin-top: 4px; color: var(--ink-2); }
.k-foot { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-top: 8px; font-size: 11.5px; color: var(--muted); }
.k-foot .ic { width: 12px; height: 12px; }
.k-move { height: 24px; font-size: 11px; border: 1px solid var(--line); border-radius: 6px; background: #fff; max-width: 110px; color: var(--muted); }

/* ---------- Lead detail ---------- */
.local-time { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--gold-d); background: var(--gold-xl); padding: 1px 8px; border-radius: 99px; }
.local-time .ic { width: 12px; height: 12px; }
.stepper { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 12px; align-items: center; }
.step-btn { position: relative; border: 1px solid var(--line-2); background: #fff; color: var(--ink-2); height: 32px; padding: 0 14px 0 18px; font: 500 12.5px var(--sans); cursor: pointer; clip-path: polygon(0 0, calc(100% - 9px) 0, 100% 50%, calc(100% - 9px) 100%, 0 100%, 9px 50%); padding-right: 20px; }
.step-btn:first-child { clip-path: polygon(0 0, calc(100% - 9px) 0, 100% 50%, calc(100% - 9px) 100%, 0 100%); border-radius: 7px 0 0 7px; padding-left: 14px; }
.step-btn.done { background: var(--gold-l); color: var(--gold-d); border-color: var(--gold-l); }
.step-btn.current { background: var(--gold); color: #fff; border-color: var(--gold); font-weight: 600; }
.step-btn.s-won.current { background: var(--ok); border-color: var(--ok); }
.step-btn:hover:not(.current) { background: var(--gold-xl); }
.step-btn.side { clip-path: none; border-radius: 7px; padding: 0 12px; }
.step-btn.side.s-lost.current { background: #8a837a; border-color: #8a837a; }
.step-btn.side.s-nurture.current { background: #6c4a86; border-color: #6c4a86; }
.step-sep { width: 12px; }
.action-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 16px; padding: 10px; background: var(--soft); border: 1px solid var(--line); border-radius: var(--radius); }
.bar-sep { width: 1px; height: 24px; background: var(--line-2); margin: 0 4px; }
.detail-grid { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 16px; align-items: start; }
.contact-strip { display: grid; grid-template-columns: 1fr 1fr auto; gap: 16px; align-items: center; border-left: 3px solid var(--gold); }
.contact-strip .lbl { display: block; text-transform: uppercase; font-size: 10.5px; letter-spacing: .6px; color: var(--muted); }
.contact-strip strong { display: block; font-size: 15px; margin-top: 2px; }
.contact-strip .overdue strong { color: var(--bad); }
.contact-strip .today strong { color: var(--gold-d); }
.strip-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.filter-chips { display: flex; flex-wrap: wrap; gap: 5px; }
.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline::before { content: ""; position: absolute; left: 15px; top: 6px; bottom: 6px; width: 1px; background: var(--line); }
.t-item { position: relative; display: flex; gap: 12px; padding: 10px 0; }
.t-icon { position: relative; z-index: 1; width: 31px; height: 31px; border-radius: 50%; background: #fff; border: 1px solid var(--line-2); display: inline-flex; align-items: center; justify-content: center; flex: none; color: var(--muted); }
.t-call .t-icon { color: var(--info); border-color: #cddbee; background: var(--info-bg); }
.t-email .t-icon, .t-quote .t-icon { color: var(--gold-d); border-color: #ead9b5; background: var(--gold-xl); }
.t-whatsapp .t-icon { color: #1f8f4e; border-color: #cbe7d6; background: #edf8f1; }
.t-stage_change .t-icon, .t-customer .t-icon { color: var(--ok); border-color: #cfe6d8; background: var(--ok-bg); }
.t-body { flex: 1; min-width: 0; }
.t-title { font-weight: 600; font-size: 13.5px; display: flex; flex-wrap: wrap; align-items: center; gap: 5px; }
.t-title .hl { color: var(--gold-d); }
.t-extra { font-size: 12.5px; color: var(--ink-2); margin-top: 2px; }
.t-text { font-size: 13px; color: var(--ink-2); margin-top: 4px; white-space: pre-wrap; background: var(--soft); border-radius: 7px; padding: 7px 10px; }
.t-meta { font-size: 11.5px; color: var(--muted); margin-top: 4px; }
.empty-line { color: var(--muted); padding: 10px 0 10px 44px; }
.channel-block + .channel-block { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.channel-block h3 { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; font-size: 13.5px; }
.ch-email h3 .ic { color: var(--gold-d); } .ch-whatsapp h3 .ic { color: #1f8f4e; }
.checklist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 9px; }
.checklist li { display: flex; align-items: flex-start; gap: 9px; font-size: 13px; }
.checklist li > div { flex: 1; min-width: 0; }
.checklist small { overflow-wrap: anywhere; }
.box { width: 18px; height: 18px; border-radius: 5px; border: 1.5px solid var(--line-2); display: inline-flex; align-items: center; justify-content: center; flex: none; margin-top: 1px; background: #fff; }
.box .ic { width: 12px; height: 12px; color: #fff; }
li.done > .box, .box.done { background: var(--gold); border-color: var(--gold); }
.perm-box.p-allowed { background: var(--ok); border-color: var(--ok); }
.perm-box.p-do_not_contact { background: var(--bad); border-color: var(--bad); }
.perm-row .segmented { margin-top: 5px; }
.task-mini { list-style: none; padding: 0; margin: 0; }
.task-mini li { display: flex; gap: 8px; align-items: center; padding: 8px 0; border-top: 1px solid var(--line); }
.task-mini li:first-child { border-top: 0; }
.task-mini li > div:first-child { flex: 1; min-width: 0; }
.task-mini li.overdue small { color: var(--bad); font-weight: 600; }
.task-mini .icon-btn .ic { width: 15px; height: 15px; }
.row-actions { display: flex; }
.dl { display: grid; grid-template-columns: 92px 1fr; gap: 5px 10px; margin: 0; font-size: 13px; }
.dl dt { color: var(--muted); }
.dl dd { margin: 0; overflow-wrap: anywhere; }
.notes { background: var(--soft); border-radius: 8px; padding: 8px 10px; font-size: 13px; margin: 10px 0 0; white-space: pre-wrap; }
.contact-block + .contact-block { border-top: 1px solid var(--line); margin-top: 10px; padding-top: 10px; }
.contact-block .dl { margin-top: 6px; }

/* ---------- Follow-ups ---------- */
.inline-select { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.inline-select select { width: auto; }
.fu-tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 20px; }
.fu-tab { display: flex; align-items: baseline; gap: 8px; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; color: var(--ink-2); font-weight: 600; box-shadow: var(--shadow); text-decoration: none !important; }
.fu-tab b { font: 600 28px var(--serif); color: var(--ink); }
.fu-tab.overdue { border-left: 3px solid var(--bad); } .fu-tab.overdue b { color: var(--bad); }
.fu-tab.today { border-left: 3px solid var(--gold); } .fu-tab.today b { color: var(--gold-d); }
.fu-tab.upcoming { border-left: 3px solid var(--line-2); }
.fu-section { margin-bottom: 22px; scroll-margin-top: 70px; }
.fu-h { display: flex; align-items: center; gap: 8px; font-size: 14px; margin-bottom: 10px; text-transform: uppercase; letter-spacing: .6px; color: var(--ink-2); }
.fu-h span { font-size: 11px; background: var(--soft-2); border-radius: 99px; padding: 1px 8px; }
.fu-h.overdue { color: var(--bad); } .fu-h.today { color: var(--gold-d); }
.fu-row { display: grid; grid-template-columns: 140px minmax(0, 1fr) auto; gap: 16px; align-items: center; padding: 14px 16px; margin-bottom: 8px; }
.fu-row.overdue { border-left: 3px solid var(--bad); }
.fu-row.today { border-left: 3px solid var(--gold); }
.fu-when strong { font-size: 13.5px; }
.fu-row.overdue .fu-when strong { color: var(--bad); }
.fu-title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.fu-title a { color: var(--ink); }
.fu-task { margin: 3px 0; font-size: 13.5px; }
.fu-actions { display: flex; flex-direction: column; gap: 6px; align-items: flex-end; }
.fu-actions .quick { display: flex; gap: 2px; }
.fu-actions .main-actions { display: flex; gap: 6px; }
.fu-none { padding: 4px 2px 6px; }
.done-card summary { cursor: pointer; font-weight: 600; }
.done-list { list-style: none; margin: 10px 0 0; padding: 0; }
.done-list li { display: flex; gap: 10px; padding: 7px 0; border-top: 1px solid var(--line); font-size: 13px; }

/* ---------- Modal ---------- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(29, 27, 24, .36); display: flex; align-items: flex-start; justify-content: center; padding: 6vh 16px 16px; z-index: 100; overflow-y: auto; animation: fade .12s; }
@keyframes fade { from { opacity: 0; } }
.modal { width: 100%; max-width: 480px; background: #fff; border-radius: 14px; box-shadow: var(--shadow-lg); border-top: 3px solid var(--gold); animation: rise .16s ease-out; }
.modal.wide { max-width: 680px; }
@keyframes rise { from { transform: translateY(8px); opacity: .6; } }
.modal header { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px 6px; }
.modal header h2 { font: 600 21px var(--serif); }
.modal-body { padding: 10px 20px 4px; }
.modal-body p { margin: 0 0 12px; }
.modal .form-error { margin: 0 20px 10px; }
.modal footer { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 20px 18px; border-top: 1px solid var(--line); margin-top: 8px; }
.sub-section { border: 1px solid var(--line); border-radius: 9px; padding: 10px 12px; margin: 10px 0; background: var(--soft); }
.sub-section summary { cursor: pointer; font-weight: 600; font-size: 13px; color: var(--gold-d); }
.sub-section[open] summary { margin-bottom: 10px; }
.draft-open { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 12px; border: 1px dashed var(--gold); border-radius: 9px; background: var(--gold-xl); margin-bottom: 8px; }
.confirm-sent { border: 1px solid var(--ok); background: #f6fbf8; border-radius: 9px; padding: 12px; margin-top: 10px; }
.confirm-sent h3 { margin-bottom: 8px; color: var(--ok); font-size: 14px; }

/* ---------- Toast ---------- */
#toasts { position: fixed; right: 18px; bottom: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 200; }
.toast { display: flex; align-items: center; gap: 12px; background: var(--ink); color: #fff; padding: 11px 14px; border-radius: 9px; box-shadow: var(--shadow-lg); font-size: 13px; max-width: 380px; animation: rise .18s; transition: opacity .3s, transform .3s; border-left: 3px solid var(--gold); }
.toast.warn { border-left-color: #e2a53c; } .toast.error { border-left-color: #e26a6a; }
.toast button { background: none; border: 1px solid rgba(255,255,255,.35); color: #fff; border-radius: 6px; padding: 3px 9px; cursor: pointer; font: 600 12px var(--sans); }
.toast.out { opacity: 0; transform: translateY(6px); }

/* ---------- Misc ---------- */
.empty { text-align: center; padding: 34px 16px; color: var(--muted); }
.empty-mark { font-size: 28px; color: var(--gold); }
.empty h3 { color: var(--ink); font-size: 15px; margin: 6px 0 4px; }
.empty p { margin: 0 0 12px; }
.tpl-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.tpl { border: 1px solid var(--line); border-radius: 9px; padding: 10px 12px 2px; margin: 0; }
.tpl legend { font-weight: 600; font-size: 12px; text-transform: capitalize; color: var(--gold-d); padding: 0 4px; }
.auto-status { display: flex; gap: 12px; align-items: flex-start; padding: 10px 0; }
.auto-status p { margin: 2px 0 0; }
.lock { width: 34px; height: 34px; border-radius: 50%; background: var(--soft-2); display: inline-flex; align-items: center; justify-content: center; flex: none; color: var(--muted); }
.lock.on { background: var(--gold-l); color: var(--gold-d); }
.card h3 { margin: 16px 0 8px; }
.plain { margin: 0; padding-left: 18px; font-size: 13px; }
.plain li { margin: 4px 0; }
.event-counts { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 10px; }

/* ---------- Responsive ---------- */
@media (max-width: 1180px) {
  .metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .dash-grid, .detail-grid { grid-template-columns: minmax(0, 1fr); }
  .col-side { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; }
}
@media (max-width: 900px) {
  .sidebar { position: fixed; left: 0; top: 0; transform: translateX(-100%); transition: transform .2s; box-shadow: var(--shadow-lg); }
  .sidebar.open { transform: none; }
  .scrim.show { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.25); z-index: 35; }
  .topbar { padding: 8px 14px; gap: 8px; }
  .topbar .menu-btn { display: inline-flex; }
  .topbar .brand.small { display: flex; }
  .topbar .brand.small .ic { width: 22px; height: 22px; }
  .topbar .brand.small strong { font-size: 17px; }
  .global-search { display: none; }
  .reminder span { display: none; }
  .demo-banner { padding: 6px 14px; }
  .page { padding: 18px 14px 90px; }
  .grid.g3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .col-side { display: block; }
  .tpl-grid { grid-template-columns: 1fr; }
  .fu-row { grid-template-columns: 1fr; gap: 8px; }
  .fu-actions { align-items: stretch; flex-direction: row; justify-content: space-between; flex-wrap: wrap; }
  .contact-strip { grid-template-columns: 1fr 1fr; }
  .strip-actions { grid-column: 1 / -1; justify-content: flex-start; }
}
@media (max-width: 640px) {
  h1 { font-size: 25px; }
  .add-lead-top span { display: none; }
  .add-lead-top { width: 40px; padding: 0; }
  .grid.g2, .grid.g3 { grid-template-columns: 1fr; }
  .span2 { grid-column: auto; }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .m-value { font-size: 28px; }
  .filters select, .filters input { flex: 1 1 140px; min-width: 0; }
  .leads-table { display: none; }
  .table-card .cards-mobile { display: flex; flex-direction: column; }
  .lead-card { display: block; padding: 12px 14px; border-bottom: 1px solid var(--line); color: var(--ink); text-decoration: none !important; }
  .lc-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
  .lc-checks { display: flex; gap: 6px; margin: 8px 0 6px; }
  .lc-dates { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); }
  .action-bar .btn.action { flex: 1 1 30%; }
  .bar-sep { display: none; }
  .fu-tabs { gap: 6px; }
  .fu-tab { flex-direction: column; gap: 0; padding: 10px; font-size: 12px; }
  .fu-tab b { font-size: 22px; }
  .modal-backdrop { padding: 0; align-items: flex-end; }
  .modal { border-radius: 14px 14px 0 0; max-height: 94vh; overflow-y: auto; }
  .page-head .head-actions .btn.primary { display: none; }
  .stepper { overflow-x: auto; flex-wrap: nowrap; padding-bottom: 4px; }
  .step-btn { flex: none; }
  .kanban { grid-auto-columns: 82vw; scroll-snap-type: x mandatory; }
  .col { scroll-snap-align: start; }
  .sticky-actions .btn { flex: 1; }
  .bars a { grid-template-columns: 110px 1fr 24px; }
}
@media print { .sidebar, .topbar, .action-bar { display: none; } }

/* ---------- Polish overrides ---------- */
.card.filters input:not([type=checkbox]):not([type=radio]), .card.filters select { width: auto; flex: 0 1 auto; }
.card.filters .search-box input:not([type=checkbox]) { flex: 1 1 auto; width: auto; border: 0; box-shadow: none; height: 34px; padding: 0; }
.card.filters input[name=location] { width: 170px; }
.more-grid input:not([type=checkbox]), .more-grid select { width: 100% !important; }
.perm-field .segmented, .perm-row .segmented { align-self: flex-start; }
.k-foot .due { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.k-move { max-width: 92px; flex: none; }
.sub-line { display: inline; }
@media (min-width: 901px) { .add-lead-top { display: none; } }
@media (max-width: 640px) { .card.filters input:not([type=checkbox]):not([type=radio]), .card.filters select { flex: 1 1 140px; min-width: 0; } }
