/* ==========================================================================
   Leads CRM — stage 1 styles
   ========================================================================== */
:root {
  /* AutoLeads — graphite & champagne. Old token names kept so every rule maps across. */
  --graphite: #1a1e23;     /* paint / cluster band */
  --gunmetal: #2a3038;     /* dark panels, hover */
  --platinum: #eef0f2;     /* page */
  --pearl: #ffffff;        /* cards, table */
  --champagne: #b89a63;    /* brand trim — used sparingly */
  --champagne-600: #9a7f4d;
  --champagne-50: #f6f1e7;
  --steel: #6b7480;

  --navy-900: var(--graphite);
  --navy-800: #23282f;
  --navy-700: var(--gunmetal);
  --accent: var(--champagne);
  --accent-600: var(--champagne-600);
  --accent-50: var(--champagne-50);
  --bg: var(--platinum);
  --surface: var(--pearl);
  --surface-2: #f6f7f8;
  --border: #e3e6ea;
  --border-strong: #cdd2d8;
  --text: #15191e;
  --text-2: #3b434d;
  --muted: var(--steel);
  --focus: #3b6fd8;

  --prospect-bg: #e9eef5; --prospect-fg: #2e4a70;
  --converted-bg: #e3f3ea; --converted-fg: #17734a;
  --cold-bg: #eef0f2;     --cold-fg: #5d6672;

  --hot: #1f9a5a; --warm: #e0961f; --cool: #d24343;   /* high = green, mid = amber, low = red */

  --radius: 14px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(20, 24, 29, .05), 0 6px 20px rgba(20, 24, 29, .06);
  --shadow-lg: 0 24px 64px rgba(15, 18, 22, .35);
  --font: "Archivo", system-ui, -apple-system, "Segoe UI", sans-serif;
  --wide: "wdth" 125;      /* expanded width for headings and figures */
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  font-family: var(--font);
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--navy-700); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ── Top bar ─────────────────────────────────────────────────────────────── */
.topbar {
  background: var(--surface);
  border-top: 4px solid var(--navy-900);
  box-shadow: 0 1px 0 var(--border);
  position: sticky; top: 0; z-index: 30;
}
.topbar__inner {
  max-width: 1600px; margin: 0 auto; padding: 14px 32px;
  display: flex; align-items: center; gap: 28px;
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--navy-900); }
.brand__mark {
  width: 34px; height: 34px; border-radius: 9px; background: var(--navy-900);
  display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 15px; position: relative;
}
.brand__mark::after {
  content: ""; position: absolute; right: -3px; bottom: -3px; width: 12px; height: 12px;
  border-radius: 50%; background: var(--accent); border: 2px solid #fff;
}
.brand__name { font-weight: 700; font-size: 17px; letter-spacing: -.01em; }
.brand__name span { color: var(--muted); font-weight: 500; }
.nav { display: flex; gap: 4px; margin-left: 12px; }
.nav a {
  text-decoration: none; color: var(--text-2); font-weight: 500; padding: 8px 14px; border-radius: 8px;
}
.nav a:hover { background: var(--surface-2); }
.nav a.is-active { color: var(--navy-900); background: var(--bg); font-weight: 600; }
.nav a.is-disabled { color: #a3aebd; pointer-events: none; }
.nav a.is-disabled small { font-size: 10px; font-weight: 600; margin-left: 4px; color: var(--muted);
  background: var(--bg); padding: 2px 6px; border-radius: 10px; }
.topbar__right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.pill-badge {
  font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase;
  background: var(--accent-50); color: var(--accent-600); padding: 5px 10px; border-radius: 20px;
}

/* ── Page ────────────────────────────────────────────────────────────────── */
.page { max-width: 1600px; margin: 0 auto; padding: 26px 32px 60px; }
.page-head { display: flex; align-items: flex-end; gap: 16px; margin-bottom: 18px; }
.page-head h1 { margin: 0; font-size: 26px; letter-spacing: -.02em; }
.page-head p { margin: 4px 0 0; color: var(--muted); }
.page-head__actions { margin-left: auto; display: flex; gap: 10px; align-items: center; }

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border-radius: 999px; border: 1.5px solid transparent; padding: 9px 18px;
  font-weight: 600; cursor: pointer; transition: background .15s, border-color .15s, color .15s;
  white-space: nowrap; text-decoration: none;
}
.btn:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn--primary { background: var(--navy-900); color: #fff; }
.btn--primary:hover:not([disabled]) { background: var(--navy-700); }
.btn--accent { background: var(--accent); color: #fff; }
.btn--accent:hover:not([disabled]) { background: var(--accent-600); }
.btn--ghost { background: var(--surface); border-color: var(--navy-900); color: var(--navy-900); }
.btn--ghost:hover:not([disabled]) { background: var(--surface-2); }
.btn--subtle { background: transparent; color: var(--text-2); }
.btn--subtle:hover:not([disabled]) { background: var(--bg); }
.btn--sm { padding: 6px 13px; font-size: 13px; }
.btn--icon { width: 36px; height: 36px; padding: 0; border-radius: 50%; }
.btn-plus {
  width: 46px; height: 46px; border-radius: 50%; border: 0; background: var(--accent); color: #fff;
  font-size: 26px; line-height: 1; cursor: pointer; box-shadow: 0 6px 18px rgba(242, 107, 33, .35);
  display: grid; place-items: center; transition: transform .15s, background .15s;
}
.btn-plus:hover { background: var(--accent-600); transform: rotate(90deg); }
.btn-plus:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }

/* ── KPI strip ───────────────────────────────────────────────────────────── */
.kpis { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 14px; margin-bottom: 16px; }
.kpi--link { cursor: pointer; transition: box-shadow .15s, transform .15s; }
.kpi--link:hover { box-shadow: 0 0 0 2px var(--accent-50), var(--shadow); transform: translateY(-1px); }
.kpi--link:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.kpi--link .kpi__sub { color: var(--accent-600); }
.kpi { background: var(--surface); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); }
.kpi__label { color: var(--muted); font-size: 12px; font-weight: 500; }
.kpi__value { font-size: 26px; font-weight: 700; letter-spacing: -.02em; margin-top: 4px; }
.kpi__sub { color: var(--muted); font-size: 12px; margin-top: 2px; }

/* ── Filter card ─────────────────────────────────────────────────────────── */
.card { background: var(--surface); border-radius: 22px; box-shadow: var(--shadow); }
.filters { padding: 16px 20px; display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 18px; }
.search {
  position: relative; flex: 1 1 260px; max-width: 360px;
}
.search svg { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.input, .select, .textarea {
  width: 100%; border: 1.5px solid var(--border); background: var(--surface); border-radius: var(--radius-sm);
  padding: 9px 12px; outline: none; transition: border-color .15s, box-shadow .15s;
}
.input:focus, .select:focus, .textarea:focus { border-color: var(--focus); box-shadow: 0 0 0 3px rgba(47, 111, 237, .12); }
.search .input { padding-left: 38px; }
.filters .select { width: auto; min-width: 128px; max-width: 200px; background-color: var(--surface-2); }
.filters .select.is-set { border-color: var(--navy-700); background: #eef3fb; font-weight: 500; }
.filters__count { margin-left: auto; color: var(--muted); font-size: 13px; }

/* ── Table ───────────────────────────────────────────────────────────────── */
.table-card { overflow: hidden; }
.table-wrap { overflow: auto; max-height: 680px; overscroll-behavior: contain; }  /* JS sets exact height for 10 rows */
.table-wrap::-webkit-scrollbar { width: 10px; height: 10px; }
.table-wrap::-webkit-scrollbar-thumb { background: #c9d1dd; border-radius: 6px; border: 2px solid var(--surface); }
.table-wrap::-webkit-scrollbar-track { background: var(--surface-2); }
table.leads { width: 100%; border-collapse: collapse; min-width: 1300px; }
.leads > thead th {
  background: var(--navy-900); color: #fff; text-align: left; font-size: 11.5px; font-weight: 600;
  letter-spacing: .03em; text-transform: uppercase; padding: 15px 7px; white-space: nowrap;
  position: sticky; top: 0; z-index: 4; user-select: none;
}
.leads thead th.sortable { cursor: pointer; }
.leads thead th.sortable:hover { background: var(--navy-800); }
.leads thead th .arrow { display: none; margin-left: 3px; font-size: 9px; }
.leads thead th.is-sorted .arrow { display: inline; color: #ffb38a; }
.leads thead th.sortable:hover:not(.is-sorted) .arrow { display: inline; opacity: .4; }
.leads tbody td { padding: 12px 7px; border-bottom: 1px solid var(--border); vertical-align: top; font-size: 13px; }
.leads tbody tr.lead-row:hover td { background: #fafbfd; }
.leads tbody tr.lead-row.is-new td { animation: flash 2.2s ease-out; }
@keyframes flash { 0% { background: #fff1e6; } 100% { background: transparent; } }

.cell-name { font-weight: 600; color: var(--text); cursor: pointer; background: none; border: 0; padding: 0; text-align: left; }
.cell-name:hover { color: var(--accent-600); text-decoration: underline; }
.cell-sub { color: var(--muted); font-size: 12.5px; margin-top: 3px; }
.cell-muted { color: #b3bccb; }
.cell-email { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 140px; }
.cell-wrap { min-width: 110px; max-width: 160px; }
.cell-email a { color: var(--text-2); text-decoration: none; }
.cell-email a:hover { color: var(--accent-600); text-decoration: underline; }
.leads td .cell-name { white-space: normal; overflow-wrap: anywhere; }
.nowrap { white-space: nowrap; }

.check { display: flex !important; gap: 8px; align-items: center; font-weight: 500 !important; cursor: pointer; margin-top: 26px; }
.check input { width: 16px; height: 16px; accent-color: var(--navy-900); }
.field label .opt { font-weight: 400; color: var(--muted); font-size: 11.5px; margin-left: 4px; }
.drawer-controls .btn { text-decoration: none; }

.score { display: flex; align-items: center; gap: 6px; min-width: 84px; background: none; border: 0; padding: 4px 0; cursor: pointer; width: 100%; }
.score:hover .score__num { color: var(--accent-600); }
.score:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
.score__num { font-weight: 700; width: 24px; text-align: right; font-variant-numeric: tabular-nums; }
.score__bar { flex: 1; height: 6px; border-radius: 3px; background: #edf0f4; overflow: hidden; min-width: 44px; }
.score__bar span { display: block; height: 100%; border-radius: 3px; }
.score--hot .score__bar span { background: var(--hot); }
.score--warm .score__bar span { background: var(--warm); }
.score--cool .score__bar span { background: var(--cool); }

.status-select, .owner-select {
  border: 0; border-radius: 999px; padding: 5px 24px 5px 10px; font-size: 12px; font-weight: 600;
  cursor: pointer; appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%2356657a' stroke-width='1.5' fill='none'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center;
}
.status-select:focus-visible, .owner-select:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
.status--prospect { background-color: var(--prospect-bg); color: var(--prospect-fg); }
.status--converted { background-color: var(--converted-bg); color: var(--converted-fg); }
.status--cold { background-color: var(--cold-bg); color: var(--cold-fg); }
.owner-select { background-color: transparent; font-weight: 500; color: var(--text-2); padding-left: 0; max-width: 190px; }
.owner-select.is-empty { color: var(--accent-600); }

.method { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: var(--muted); margin-top: 3px; }

.pill { display: inline-block; font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 999px; }

/* empty / loading */
.table-state { padding: 60px 20px; text-align: center; color: var(--muted); }
.table-state strong { display: block; color: var(--text); font-size: 15px; margin-bottom: 4px; }
.skeleton { height: 14px; border-radius: 6px; background: linear-gradient(90deg, #eef1f5 25%, #f6f8fa 50%, #eef1f5 75%); background-size: 200% 100%; animation: shimmer 1.2s infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* pagination */
.pager { display: flex; align-items: center; gap: 10px; padding: 14px 20px; color: var(--muted); font-size: 13px; }
.pager__btns { margin-left: auto; display: flex; gap: 6px; align-items: center; }
.pager .select { width: auto; padding: 5px 8px; }

/* ── Modal ───────────────────────────────────────────────────────────────── */
.overlay {
  position: fixed; inset: 0; background: rgba(13, 34, 64, .45); z-index: 50;
  display: none; align-items: flex-start; justify-content: center; padding: 5vh 16px; overflow-y: auto;
}
.overlay.is-open { display: flex; }
.modal {
  background: var(--surface); border-radius: 20px; width: 100%; max-width: 860px; box-shadow: var(--shadow-lg);
  animation: pop .18s ease-out;
}
@keyframes pop { from { transform: translateY(8px) scale(.99); opacity: 0; } }
.modal__head { display: flex; align-items: center; padding: 20px 24px 0; }
.modal__head h2 { margin: 0; font-size: 20px; letter-spacing: -.01em; }
.modal__close { margin-left: auto; }
.tabs { display: flex; gap: 4px; padding: 16px 24px 0; border-bottom: 1px solid var(--border); }
.tab {
  background: none; border: 0; padding: 10px 14px 12px; font-weight: 600; color: var(--muted); cursor: pointer;
  border-bottom: 2.5px solid transparent; margin-bottom: -1px; display: inline-flex; align-items: center; gap: 7px;
}
.tab:hover { color: var(--text); }
.tab.is-active { color: var(--navy-900); border-bottom-color: var(--accent); }
.tab:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; border-radius: 6px; }
.modal__body { padding: 20px 24px; max-height: 66vh; overflow-y: auto; }
.modal__foot { display: flex; align-items: center; gap: 10px; padding: 16px 24px; border-top: 1px solid var(--border); }
.modal__foot .spacer { flex: 1; }

.form-section { margin-bottom: 18px; }
.form-section__title { font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin: 0 0 10px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 14px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px 14px; }
.span-2 { grid-column: span 2; }
.span-3 { grid-column: 1 / -1; }
.field label { display: block; font-size: 12.5px; font-weight: 600; color: var(--text-2); margin-bottom: 5px; }
.field label .req { color: var(--accent); }
.field .hint { font-size: 12px; color: var(--muted); margin-top: 4px; }
.field.is-prefilled .input, .field.is-prefilled .select { background: #fffaf3; border-color: #f4c99d; }
.field.has-error .input { border-color: #d93a3a; }
.field .error { font-size: 12px; color: #c62f2f; margin-top: 4px; }
.textarea { min-height: 74px; resize: vertical; }

.notice {
  display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: 12px;
  font-size: 13px; margin-bottom: 16px; line-height: 1.45;
}
.notice--info { background: #eef4ff; color: #1f468f; }
.notice--warn { background: #fff5e8; color: #8a4c06; border: 1px solid #f6d5a8; }
.notice--error { background: #fdeeee; color: #9d2222; }
.notice--ok { background: #e7f6ee; color: #145c38; }
.notice img { width: 92px; border-radius: 6px; border: 1px solid var(--border); }
.notice ul { margin: 6px 0 0; padding-left: 18px; }

/* scan */
.dropzone {
  border: 2px dashed var(--border-strong); border-radius: 16px; padding: 34px 20px; text-align: center;
  background: var(--surface-2); transition: border-color .15s, background .15s; cursor: pointer;
}
.dropzone:hover, .dropzone.is-drag { border-color: var(--accent); background: var(--accent-50); }
.dropzone:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.dropzone__icon { width: 52px; height: 52px; border-radius: 14px; background: #fff; display: grid; place-items: center; margin: 0 auto 12px; box-shadow: var(--shadow); color: var(--accent); }
.dropzone strong { display: block; font-size: 15px; margin-bottom: 4px; }
.dropzone p { margin: 0; color: var(--muted); font-size: 13px; }
.dropzone__actions { display: flex; gap: 10px; justify-content: center; margin-top: 14px; }
.scan-preview { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start; }
.scan-preview img { width: 100%; border-radius: 12px; border: 1px solid var(--border); box-shadow: var(--shadow); max-height: 340px; object-fit: contain; background: var(--surface-2); }
.scan-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.scan-steps li { display: flex; gap: 10px; align-items: flex-start; color: var(--text-2); }
.scan-steps .n { width: 22px; height: 22px; border-radius: 50%; background: var(--bg); display: grid; place-items: center; font-size: 12px; font-weight: 700; flex: none; }
.spinner { width: 16px; height: 16px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, .4); border-top-color: #fff; animation: spin .7s linear infinite; }
.spinner--dark { border-color: rgba(13, 34, 64, .15); border-top-color: var(--navy-900); }
@keyframes spin { to { transform: rotate(360deg); } }

/* import */
.import-result { width: 100%; border-collapse: collapse; font-size: 13px; margin-top: 10px; }
.import-result th, .import-result td { padding: 7px 10px; border-bottom: 1px solid var(--border); text-align: left; }
.import-result th { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .05em; }
.import-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 6px 0 4px; }
.import-stats div { background: var(--surface-2); border-radius: 10px; padding: 10px 12px; }
.import-stats b { display: block; font-size: 20px; }
.import-stats span { color: var(--muted); font-size: 12px; }
.mapping { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.mapping span { font-size: 12px; background: var(--surface-2); border: 1px solid var(--border); padding: 3px 8px; border-radius: 6px; }
.mapping span.unmapped { background: #fff5e8; border-color: #f6d5a8; color: #8a4c06; }

/* ── Drawer (lead preview) ───────────────────────────────────────────────── */
.drawer-overlay { position: fixed; inset: 0; background: rgba(13, 34, 64, .3); z-index: 40; display: none; }
.drawer-overlay.is-open { display: block; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(520px, 100vw); background: var(--surface); z-index: 41;
  box-shadow: var(--shadow-lg); transform: translateX(100%); transition: transform .22s ease-out;
  display: flex; flex-direction: column;
}
.drawer.is-open { transform: translateX(0); }
.drawer__head { padding: 22px 24px 18px; border-bottom: 1px solid var(--border); display: flex; gap: 14px; align-items: flex-start; }
.avatar { width: 48px; height: 48px; border-radius: 50%; background: var(--navy-900); color: #fff; display: grid; place-items: center; font-weight: 700; flex: none; }
.drawer__head h2 { margin: 0; font-size: 19px; }
.drawer__head p { margin: 3px 0 0; color: var(--muted); }
.drawer__body { padding: 20px 24px 40px; overflow-y: auto; flex: 1; }
.drawer h4 { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 22px 0 10px; }
.drawer h4:first-child { margin-top: 0; }
.dl { display: grid; grid-template-columns: 120px 1fr; gap: 8px 12px; margin: 0; font-size: 13.5px; }
.dl dt { color: var(--muted); }
.dl dd { margin: 0; word-break: break-word; }
.score-big { display: flex; gap: 18px; align-items: center; background: var(--surface-2); border-radius: 14px; padding: 16px; }
.ring { --p: 0; --c: var(--cool); width: 74px; height: 74px; border-radius: 50%; flex: none;
  background: conic-gradient(var(--c) calc(var(--p) * 1%), #e6eaf0 0); display: grid; place-items: center; }
.ring b { width: 58px; height: 58px; border-radius: 50%; background: var(--surface-2); display: grid; place-items: center; font-size: 20px; }
.breakdown { flex: 1; display: grid; gap: 7px; font-size: 12.5px; }
.breakdown__row { display: grid; grid-template-columns: 92px 1fr 40px; gap: 8px; align-items: center; }
.breakdown__row .bar { height: 5px; border-radius: 3px; background: #e6eaf0; overflow: hidden; }
.breakdown__row .bar span { display: block; height: 100%; background: var(--navy-700); }
.breakdown__row em { font-style: normal; color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; }
.timeline { list-style: none; margin: 0; padding: 0 0 0 18px; border-left: 2px solid var(--border); }
.timeline li { position: relative; padding: 0 0 16px 14px; }
.timeline li::before { content: ""; position: absolute; left: -25px; top: 3px; width: 12px; height: 12px; border-radius: 50%; background: #fff; border: 2.5px solid var(--navy-700); }
.timeline li.t-captured::before { border-color: var(--accent); }
.timeline li.t-status_change::before { border-color: var(--converted-fg); }
.timeline time { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }
.card-thumb { width: 100%; max-width: 300px; border-radius: 10px; border: 1px solid var(--border); }
.drawer-controls { display: flex; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
.drawer-controls .select { width: auto; }

/* ── Toast ───────────────────────────────────────────────────────────────── */
.toasts { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); z-index: 70; display: grid; gap: 8px; }
.toast { background: var(--navy-900); color: #fff; padding: 11px 18px; border-radius: 12px; box-shadow: var(--shadow-lg); font-weight: 500; animation: pop .2s ease-out; }
.toast--error { background: #a52323; }

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 1500px) {
  .page, .topbar__inner { padding-left: 20px; padding-right: 20px; }
}
@media (max-width: 1250px) {
  .kpis { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 720px) {
  .topbar__inner, .page { padding-left: 16px; padding-right: 16px; }
  .nav { display: none; }
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .grid-2, .grid-3, .scan-preview { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .import-stats { grid-template-columns: repeat(2, 1fr); }
  .page-head { flex-wrap: wrap; }
}

/* ── Stage 1b: LinkedIn scoring + inline edits ─────────────────────────── */
.sticky-col { position: sticky; left: 0; z-index: 2; }
.leads > thead th.sticky-col { z-index: 5; }   /* top-left corner above both sticky header and column */
.leads tbody td.sticky-col { background: var(--surface); box-shadow: 1px 0 0 var(--border); }
.leads tbody tr.lead-row:hover td.sticky-col { background: #fafbfd; }
.leads tbody td.sticky-col { min-width: 120px; max-width: 150px; padding-right: 12px; }
.plain-link { color: var(--text-2); text-decoration: none; }
.plain-link:hover { color: var(--accent-600); text-decoration: underline; }

.inline-select {
  border: 1px solid transparent; border-radius: 8px; padding: 5px 24px 5px 8px; font-size: 13px;
  background-color: transparent; color: var(--text-2); cursor: pointer; width: 122px; font-size: 12.5px; text-overflow: ellipsis;
  appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%2356657a' stroke-width='1.5' fill='none'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 8px center;
}
.inline-select:hover { border-color: var(--border); background-color: var(--surface-2); }
.inline-select:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
.inline-select.is-empty { color: var(--muted); font-style: italic; }
.inline-select.is-warn { color: var(--accent-600); font-style: normal; }

.source-tag { display: inline-block; font-size: 11.5px; padding: 3px 7px; border-radius: 6px; max-width: 108px; line-height: 1.35;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text-2); }
.source-tag--business_card { background: #fff3ec; border-color: #fbd3bb; color: var(--accent-600); }
.source-tag--manual { background: #eef3fb; border-color: #d3dff2; color: var(--navy-700); }

.score-cell { min-width: 100px; }
.btn--score {
  background: var(--navy-900); color: #fff; border-radius: 8px; padding: 6px 14px; font-size: 12.5px;
}
.btn--score:hover:not([disabled]) { background: var(--navy-700); }
.score-pending { display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.score-msg { font-size: 12.5px; color: var(--muted); }
.score-msg--err { color: #b42318; }
.link-btn { background: none; border: 0; padding: 0; color: #0a66c2; font-weight: 600; font-size: 12.5px; cursor: pointer; }
.link-btn:hover { text-decoration: underline; }
.link-btn:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 3px; }

.auto-note { margin: 12px 0 0; font-size: 12.5px; color: var(--muted); background: var(--surface-2);
  border-radius: 10px; padding: 10px 12px; line-height: 1.5; }

.li-card { border: 1px solid var(--border); border-radius: 14px; padding: 16px; background: var(--surface-2); }
.li-card--empty { display: flex; flex-direction: column; gap: 10px; align-items: flex-start; color: var(--text-2); font-size: 13.5px; line-height: 1.5; }
.li-card--empty p { margin: 0; }
.score-big__text { flex: 1; min-width: 0; }
.score-big__text strong { font-size: 15px; }
.score-big__text p { margin: 4px 0 6px; color: var(--text-2); font-size: 13px; line-height: 1.45; }
.chip { display: inline-block; font-size: 12px; padding: 2px 8px; border-radius: 6px; background: var(--surface-2);
  border: 1px solid var(--border); margin: 0 4px 4px 0; }
.chip--demo { background: #fff5e8; border-color: #f6d5a8; color: #8a4c06; }
.meter { display: inline-block; width: 90px; height: 6px; border-radius: 3px; background: #e6eaf0; overflow: hidden; vertical-align: middle; margin-right: 6px; }
.meter span { display: block; height: 100%; background: #0a66c2; }
.timeline li.t-scored::before { border-color: #0a66c2; }
.drawer-controls { margin: 0 0 6px; }


/* ==========================================================================
   Premium automotive theme
   ========================================================================== */
body { font-variation-settings: "wdth" 100; font-size: 14px; letter-spacing: .005em; }
a { color: var(--gunmetal); }

/* ── Instrument-cluster band (header + title + readouts) ─────────────────── */
.cluster {
  background:
    radial-gradient(120% 140% at 85% -20%, rgba(184, 154, 99, .16), transparent 55%),
    linear-gradient(180deg, #1f242a 0%, var(--graphite) 100%);
  color: #e9ecef;
  padding-bottom: 64px;               /* table card overlaps this edge */
  border-bottom: 1px solid #0f1215;
}
.topbar { background: transparent; border-top: 0; box-shadow: 0 1px 0 rgba(255, 255, 255, .06); position: static; }
.topbar__inner { padding-top: 16px; padding-bottom: 16px; }
.brand { color: #fff; gap: 12px; }
.brand__mark {
  width: 34px; height: 34px; border-radius: 50%;
  background: transparent; border: 1.5px solid var(--champagne); color: var(--champagne);
  font-variation-settings: var(--wide); font-weight: 700; font-size: 14px;
}
.brand__mark::after { content: none; }
.brand__name { font-variation-settings: var(--wide); font-weight: 700; font-size: 17px; letter-spacing: .01em; color: #fff; }
.brand__name span { color: var(--champagne); font-weight: 500; }
.nav a { color: #aeb5be; }
.nav a:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.nav a.is-active { color: #fff; background: rgba(255, 255, 255, .08); }
.nav a.is-disabled { color: #67707b; }
.nav a.is-disabled small { background: rgba(255, 255, 255, .06); color: #8b939d; }

.cluster__body {
  max-width: 1600px; margin: 0 auto; padding: 34px 32px 0;
  display: grid; grid-template-columns: minmax(260px, 1.1fr) auto minmax(0, 2.6fr); gap: 36px; align-items: center;
}
.cluster__intro h1 {
  margin: 0; font-variation-settings: var(--wide); font-weight: 700; font-size: 34px; letter-spacing: -.005em; color: #fff;
}
.cluster__intro p { margin: 8px 0 18px; color: #9aa2ac; line-height: 1.5; max-width: 42ch; }
.cluster__intro p b { color: #dfe3e8; font-weight: 600; }
.btn-add {
  display: inline-flex; align-items: center; gap: 8px; border: 0; cursor: pointer;
  background: var(--champagne); color: var(--graphite); font-weight: 700; font-size: 14px;
  padding: 11px 20px 11px 16px; border-radius: 999px; letter-spacing: .01em;
  box-shadow: 0 8px 24px rgba(184, 154, 99, .25); transition: background .15s, transform .15s;
}
.btn-add span { font-size: 20px; line-height: 1; margin-top: -2px; }
.btn-add:hover { background: #c9ad78; transform: translateY(-1px); }
.btn-add:focus-visible { outline: 2px solid #fff; outline-offset: 3px; }

/* the dial */
.gauge { display: block; transform: rotate(135deg); }
.gauge circle { fill: none; }
.gauge__ticks { stroke: rgba(255, 255, 255, .22); stroke-width: 4; stroke-dasharray: 1.2 7.6; }
.gauge__track { stroke: rgba(255, 255, 255, .08); stroke-width: 9; stroke-linecap: round; }
.gauge__value {
  stroke: var(--champagne); stroke-width: 9; stroke-linecap: round; stroke-dasharray: 0 999;
  transition: stroke-dasharray .9s cubic-bezier(.2, .8, .2, 1);
}
.gauge[data-band="hot"] .gauge__value { stroke: var(--hot); }
.gauge[data-band="warm"] .gauge__value { stroke: var(--warm); }
.gauge[data-band="cool"] .gauge__value { stroke: var(--cool); }
.gauge--lg { width: 132px; height: 132px; }
.gauge--md { width: 96px; height: 96px; }
@media (prefers-reduced-motion: reduce) { .gauge__value { transition: none; } }

.gauge-readout { position: relative; width: 132px; height: 132px; }
.gauge-readout__text { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; padding-top: 6px; }
.gauge-readout__num { font-variation-settings: var(--wide); font-weight: 700; font-size: 34px; color: #fff; line-height: 1; font-variant-numeric: tabular-nums; }
.gauge-readout__label { font-size: 11.5px; color: #9aa2ac; margin-top: 6px; }

.readouts { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); }
.readout { padding: 6px 20px; border-left: 1px solid rgba(255, 255, 255, .09); display: flex; flex-direction: column; gap: 4px; }
.readout__label { font-size: 12.5px; color: #9aa2ac; }
.readout__value { font-variation-settings: var(--wide); font-weight: 650; font-size: 30px; color: #fff; line-height: 1.1; font-variant-numeric: tabular-nums; }
.readout__sub { font-size: 12px; color: #7d8691; }
.readout--link { cursor: pointer; border-radius: 0 10px 10px 0; transition: background .15s; }
.readout--link:hover { background: rgba(255, 255, 255, .04); }
.readout--link .readout__sub { color: var(--champagne); }
.readout--link:focus-visible { outline: 2px solid var(--champagne); outline-offset: 2px; }

/* ── Work area overlaps the band ─────────────────────────────────────────── */
.page { margin-top: -44px; position: relative; padding-top: 0; }
.card { border-radius: var(--radius); }
.filters { box-shadow: 0 10px 30px rgba(15, 18, 22, .12); margin-bottom: 14px; padding: 14px 16px; }
.filters .select { background-color: var(--surface); }
.filters .select.is-set { border-color: var(--graphite); background: #f3f4f6; }
.input, .select, .textarea { border-width: 1px; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--gunmetal); box-shadow: 0 0 0 3px rgba(42, 48, 56, .12); }

/* table: graphite header, sentence-case labels */
.table-card { border-radius: var(--radius); }
.leads > thead th {
  background: var(--graphite); color: #c4cad1; text-transform: none; letter-spacing: .01em;
  font-size: 12.5px; font-weight: 600; border-bottom: 1px solid #0f1215;
}
.leads thead th.sortable:hover { background: var(--gunmetal); color: #fff; }
.leads thead th.is-sorted { color: #fff; }
.leads thead th.is-sorted .arrow { color: var(--champagne); }
.leads tbody tr.lead-row:hover td, .leads tbody tr.lead-row:hover td.sticky-col { background: #f8f8f6; }
.leads tbody tr.lead-row.is-new td { animation: flash-new 2.2s ease-out; }
@keyframes flash-new { 0% { background: var(--champagne-50); } 100% { background: transparent; } }
.cell-name { font-weight: 650; }
.cell-name:hover { color: var(--champagne-600); }

/* score: segmented, like an LED bar on a dash */
.score__num { font-variation-settings: var(--wide); font-weight: 700; width: 28px; }
.score__bar {
  height: 8px; border-radius: 1px; background: #e7e9ec;
  -webkit-mask: repeating-linear-gradient(90deg, #000 0 5px, transparent 5px 7px);
          mask: repeating-linear-gradient(90deg, #000 0 5px, transparent 5px 7px);
}
.score__bar span { border-radius: 0; }
.score--hot .score__num { color: var(--hot); }
.score--warm .score__num { color: #b77408; }
.score--cool .score__num { color: var(--cool); }
.score:hover .score__num { text-decoration: underline; }
.btn--score { background: var(--graphite); color: #fff; border-radius: 999px; padding: 6px 15px; font-weight: 600; }
.btn--score:hover:not([disabled]) { background: var(--gunmetal); }
.link-btn { color: var(--gunmetal); text-decoration: underline; text-underline-offset: 2px; }
.score-msg--err { color: var(--cool); }

.source-tag { background: var(--surface-2); border-color: var(--border); color: var(--text-2); border-radius: 6px; padding: 3px 8px; max-width: 118px; }
.source-tag--business_card { background: var(--champagne-50); border-color: #e6d7b8; color: #7a6235; }
.source-tag--walk_in { background: #eef0f3; border-color: #d9dde2; color: var(--gunmetal); }
.inline-select.is-warn { color: #a5541a; }

.pager { border-top: 1px solid var(--border); }

/* buttons inside modal / drawer */
.btn--primary { background: var(--graphite); }
.btn--primary:hover:not([disabled]) { background: var(--gunmetal); }
.btn--ghost { border-color: #c9ced5; border-width: 1px; color: var(--graphite); }
.btn--accent { background: var(--champagne); color: var(--graphite); }
.btn--accent:hover:not([disabled]) { background: #c9ad78; }

/* modal */
.modal { border-radius: 16px; overflow: hidden; }
.modal__head { background: var(--graphite); color: #fff; padding: 20px 24px; }
.modal__head h2 { font-variation-settings: var(--wide); font-weight: 700; font-size: 19px; }
.modal__head .btn--subtle { color: #c4cad1; }
.modal__head .btn--subtle:hover { background: rgba(255, 255, 255, .08); }
.tabs { background: var(--graphite); border-bottom: 0; padding-top: 0; }
.tab { color: #8f98a2; }
.tab:hover { color: #fff; }
.tab.is-active { color: #fff; border-bottom-color: var(--champagne); }
.form-section__title { text-transform: none; letter-spacing: 0; font-size: 13px; color: var(--graphite); font-variation-settings: var(--wide); }
.field.is-prefilled .input, .field.is-prefilled .select { background: #fbf8f2; border-color: #dcc9a2; }
.dropzone:hover, .dropzone.is-drag { border-color: var(--champagne); background: var(--champagne-50); }
.dropzone__icon { color: var(--champagne-600); }
.auto-note { background: var(--surface-2); border: 1px solid var(--border); }

/* drawer */
.drawer__head { background: var(--graphite); color: #fff; border-bottom: 0; }
.drawer__head h2 { font-variation-settings: var(--wide); font-weight: 700; }
.drawer__head p { color: #9aa2ac; }
.drawer__head .btn--subtle { color: #c4cad1; }
.drawer__head .btn--subtle:hover { background: rgba(255, 255, 255, .08); }
.avatar { background: transparent; border: 1.5px solid var(--champagne); color: var(--champagne); font-variation-settings: var(--wide); }
.drawer h4 { text-transform: none; letter-spacing: 0; font-size: 13px; color: var(--graphite); font-variation-settings: var(--wide); }
.score-big { background: var(--graphite); color: #fff; border-radius: var(--radius); gap: 16px; padding: 14px 18px; }
.score-big__text strong { color: #fff; font-variation-settings: var(--wide); }
.score-big__text p { color: #c4cad1; }
.score-big__text .cell-sub { color: #8f98a2; }
.dial { position: relative; width: 96px; height: 96px; flex: none; }
.dial b { position: absolute; inset: 0; display: grid; place-items: center; font-variation-settings: var(--wide); font-size: 26px; color: #fff; padding-top: 4px; }
.meter span { background: var(--champagne); }
.chip--demo { background: var(--champagne-50); border-color: #e6d7b8; color: #7a6235; }
.timeline li::before { border-color: var(--gunmetal); }
.timeline li.t-captured::before { border-color: var(--champagne); }
.timeline li.t-scored::before { border-color: var(--hot); }

.toast { background: var(--graphite); border: 1px solid rgba(255, 255, 255, .08); }
.toast--error { background: #7f1f1f; }

/* responsive cluster */
@media (max-width: 1250px) {
  .cluster__body { grid-template-columns: 1fr auto; }
  .readouts { grid-column: 1 / -1; }
}
@media (max-width: 720px) {
  .cluster__body { grid-template-columns: 1fr; padding: 24px 16px 0; gap: 22px; }
  .gauge-readout { margin: 0 auto; }
  .readouts { grid-template-columns: repeat(2, 1fr); row-gap: 16px; }
  .readout { padding: 4px 14px; }
  .cluster__intro h1 { font-size: 28px; }
}

/* ── Modal / drawer separation from the dark band ─────────────────────────── */
.overlay {
  background: rgba(8, 10, 13, .72);
  -webkit-backdrop-filter: blur(6px) saturate(.8);
          backdrop-filter: blur(6px) saturate(.8);
}
.modal {
  border: 1px solid rgba(184, 154, 99, .45);            /* champagne hairline edge */
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, .06),
    0 0 0 6px rgba(184, 154, 99, .08),                  /* soft halo so edges read on dark */
    0 40px 90px rgba(0, 0, 0, .6);
}
.modal__head { border-bottom: 0; }
.tabs { box-shadow: inset 0 -1px 0 rgba(255, 255, 255, .08); }
.drawer-overlay {
  background: rgba(8, 10, 13, .6);
  -webkit-backdrop-filter: blur(4px);
          backdrop-filter: blur(4px);
}
.drawer { border-left: 1px solid rgba(184, 154, 99, .45); box-shadow: -30px 0 80px rgba(0, 0, 0, .45); }
@media (prefers-reduced-transparency: reduce) {
  .overlay, .drawer-overlay { -webkit-backdrop-filter: none; backdrop-filter: none; background: rgba(8, 10, 13, .82); }
}

/* stage under the status pill */
.stage-select { display: block; margin-top: 4px; width: auto; max-width: 128px; font-size: 12px; padding: 3px 22px 3px 8px; color: var(--muted); }
.timeline li.t-stage_change::before { border-color: #2a78d6; }

/* ── Edit contact details in the lead panel ── */
.h4-row { display: flex; align-items: center; justify-content: space-between; }
.edit-btn { display: inline-flex; align-items: center; gap: 5px; color: var(--graphite); font-size: 12.5px; padding: 6px 8px; border-radius: 8px; }
.edit-btn:hover { background: var(--surface-2); text-decoration: none; }
.contact-edit { border: 1px solid var(--border); border-radius: 14px; padding: 16px; background: var(--surface-2); display: grid; gap: 12px; }
.contact-edit .grid-2 { gap: 12px 14px; }
.contact-edit .field { margin: 0; }
.contact-edit .input { background: #fff; }
.contact-edit__foot { display: flex; justify-content: flex-end; gap: 8px; }

/* ── Filters set from Insights (industry, company, score range) ── */
.filter-chips { flex-basis: 100%; display: flex; flex-wrap: wrap; gap: 8px; }
.filter-chips[hidden] { display: none; }
.filter-chip { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; color: var(--graphite);
  background: var(--champagne-50); border: 1px solid #e6d3ad; border-radius: 999px; padding: 4px 6px 4px 12px; }
.filter-chip button { width: 22px; height: 22px; border-radius: 50%; border: 0; background: transparent; color: var(--text-2); cursor: pointer; font-size: 11px; }
.filter-chip button:hover { background: rgba(0, 0, 0, .06); }

/* company logo in the top bar (replaces the letter mark) */
.brand__logo { display: block; width: 38px; height: auto; flex: none; }