/* =====================================================================
   Pipeline CRM — "deal temperature"
   One family (Archivo, using its width axis for money figures) and one
   bold idea: stages run cold → hot as win probability rises. Everything
   else stays quiet.
   ===================================================================== */

:root {
  /* Base palette */
  --chalk: #f4f5f2;      /* page */
  --sheet: #ffffff;      /* surfaces */
  --graphite: #22262b;   /* ink */
  --ledger: #1e6b57;     /* primary action + won */
  --ledger-hover: #175746;

  --bg: var(--chalk);
  --surface: var(--sheet);
  --surface-2: #eceeea;
  --border: #dfe2dc;
  --rule: #e8eae5;
  --text: var(--graphite);
  --text-2: #565c63;
  --text-3: #868c93;
  --accent: var(--ledger);
  --accent-hover: var(--ledger-hover);
  --accent-soft: #e3efe9;
  --danger: #b42318;
  --danger-soft: #fdeceb;
  --success: var(--ledger);
  --success-soft: #e3efe9;
  --focus: #2f6fd6;

  /* Deal temperature: stage colour tracks win probability */
  /* Validated with the dataviz palette checker: adjacent pairs clear the
     colour-blind and normal-vision floors in both modes. Amber and orange
     sit under 3:1 on white, so every use carries a text label. */
  --stage-new: #2a6fd6;          /* cobalt (cold) */
  --stage-intro: #14a3b8;    /* glacier */
  --stage-talks: #d9a800;    /* amber */
  --stage-onboarding: #e5582a;     /* orange */
  --stage-integration: #a82a5e;  /* crimson (hot) */
  --stage-live: #2f9e5f;          /* won green */
  --stage-lost: #a3a8ae;         /* ash */

  /* Charts */
  --viz-created: var(--stage-new);
  --viz-live: var(--stage-live);
  --viz-grid: #e6e8e3;
  --viz-axis: #868c93;

  --r-sm: 4px;   /* chips, inline bars */
  --r-md: 6px;   /* controls, deal cards */
  --r-lg: 10px;  /* panels */
  --lift: 0 6px 18px -6px rgba(34, 38, 43, .28);

  --font: "Archivo", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141619;
    --surface: #1c1f23;
    --surface-2: #24282d;
    --border: #2f343a;
    --rule: #272b30;
    --text: #e9ebed;
    --text-2: #a9aeb5;
    --text-3: #7c828a;
    --accent: #3f9b80;
    --accent-hover: #4fb394;
    --accent-soft: #1d3029;
    --danger: #f97066;
    --danger-soft: #3a1d1b;
    --success: #4fb394;
    --success-soft: #1d3029;
    --focus: #7aa7ff;

    --stage-new: #5872d2;
    --stage-intro: #10a6ad;
    --stage-talks: #ad9000;
    --stage-onboarding: #b14d00;
    --stage-integration: #d861aa;
    --stage-live: #0e9254;
    --stage-lost: #7d838a;

    --viz-grid: #2a2e33;
    --viz-axis: #7c828a;
    --lift: 0 8px 22px -6px rgba(0, 0, 0, .7);
    color-scheme: dark;
  }
}

/* ---------- Base ---------- */
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); text-decoration: underline; text-underline-offset: 3px; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: var(--r-sm); }
h1, h2, h3 { margin: 0; letter-spacing: -.01em; }
h1 { font-size: 30px; font-weight: 700; font-stretch: 112%; line-height: 1.15; }
h2 { font-size: 15px; font-weight: 650; }
.muted { color: var(--text-2); }
.subtle { color: var(--text-3); font-size: 12.5px; }
.num { font-variant-numeric: tabular-nums; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.figure { font-stretch: 118%; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }

/* ---------- Top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: stretch; gap: 32px;
  height: 56px; padding: 0 32px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.wordmark {
  display: flex; align-items: center;
  font-size: 18px; font-weight: 800; font-stretch: 125%; letter-spacing: -.02em;
  color: var(--text);
}
.wordmark:hover { color: var(--text); text-decoration: none; }
.wordmark i { /* the "hot" dot: the one place the ramp appears as a mark */
  width: 8px; height: 8px; border-radius: 50%; margin-left: 3px; align-self: center; translate: 0 5px;
  background: var(--stage-integration);
}
.tabs { display: flex; gap: 4px; }
.tabs a {
  display: flex; align-items: center; padding: 0 12px;
  color: var(--text-2); font-weight: 550; font-size: 14.5px;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tabs a:hover { color: var(--text); text-decoration: none; }
.tabs a.active { color: var(--text); border-bottom-color: var(--text); }
.account { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.account .name { font-weight: 550; }
.linklike { background: none; border: 0; padding: 0; color: var(--text-2); font: inherit; cursor: pointer; }
.linklike:hover { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }

.main { max-width: 1440px; margin: 0 auto; padding: 32px 32px 64px; }
.main.wide { max-width: none; }
.page-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px 24px; margin-bottom: 24px; flex-wrap: wrap; }
.page-header > * { min-width: 0; max-width: 100%; }
.page-header p { margin: 6px 0 0; color: var(--text-2); max-width: 60ch; }
.crumb { display: inline-block; margin-bottom: 6px; color: var(--text-2); font-weight: 550; }
.actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* ---------- Panels ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); }
.card-header { display: flex; justify-content: space-between; align-items: baseline; padding: 16px 20px 12px; gap: 12px; flex-wrap: wrap; }
.card-body { padding: 4px 20px 20px; }
.card-footer { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--rule); }

/* ---------- Controls ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 36px; padding: 0 14px; border-radius: var(--r-md);
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  font: inherit; font-weight: 600; cursor: pointer; white-space: nowrap;
}
.btn:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: #fff; }
.btn-danger { color: var(--danger); }
.btn-danger:hover { background: var(--danger-soft); color: var(--danger); }
.btn-sm { height: 30px; padding: 0 10px; font-size: 13px; }

input[type=text], input[type=email], input[type=url], input[type=tel], input[type=number], input[type=date], input[type=password], input[type=search], select, textarea {
  width: 100%; height: 38px; padding: 0 10px;
  border: 1px solid var(--border); border-radius: var(--r-md);
  background: var(--surface); color: var(--text); font: inherit;
}
textarea { height: auto; padding: 9px 10px; resize: vertical; line-height: 1.5; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--focus); outline-offset: -1px; border-color: transparent; }
input[type=checkbox] { accent-color: var(--accent); width: 16px; height: 16px; }

/* Stage chip: ink text, the coloured mark carries the stage */
.badge {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 2px 8px 2px 7px; border-radius: var(--r-sm);
  font-size: 12.5px; font-weight: 550; white-space: nowrap;
  background: var(--surface-2); color: var(--text);
}
.badge .dot { width: 8px; height: 8px; border-radius: 2px; background: var(--c, var(--text-3)); }
.stage-new { --c: var(--stage-new); }
.stage-intro { --c: var(--stage-intro); }
.stage-talks { --c: var(--stage-talks); }
.stage-onboarding { --c: var(--stage-onboarding); }
.stage-integration { --c: var(--stage-integration); }
.stage-live { --c: var(--stage-live); }
.stage-lost { --c: var(--stage-lost); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }

.avatar {
  width: 28px; height: 28px; border-radius: 50%;
  display: inline-grid; place-items: center; flex-shrink: 0;
  background: var(--surface-2); color: var(--text-2);
  font-size: 11px; font-weight: 700; font-stretch: 110%;
}
.avatar-sm { width: 22px; height: 22px; font-size: 9.5px; }

.messages { list-style: none; margin: 0 0 20px; padding: 0; }
.messages li { padding: 10px 14px; border-radius: var(--r-md); background: var(--success-soft); color: var(--text); border-left: 3px solid var(--success); margin-bottom: 8px; }
.messages li.error { background: var(--danger-soft); border-left-color: var(--danger); }

/* ---------- Leads table ---------- */
.filters { display: grid; grid-template-columns: minmax(220px, 2fr) repeat(3, minmax(140px, 1fr)) auto; gap: 8px; padding: 16px 20px; }
.summary-bar { display: flex; gap: 8px 32px; padding: 4px 20px 16px; flex-wrap: wrap; align-items: baseline; }
.summary-bar .stat { display: flex; flex-direction: column; }
.summary-bar .stat b { font-size: 20px; }
.summary-bar .stat span { color: var(--text-2); font-size: 12.5px; }
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 11px 20px; text-align: left; border-top: 1px solid var(--rule); white-space: nowrap; }
.table th { font-size: 12.5px; font-weight: 600; color: var(--text-2); background: var(--surface); }
.table th a { color: inherit; }
.table th a:hover { color: var(--text); }
.table tbody tr { cursor: pointer; }
.table tbody tr:hover { background: color-mix(in srgb, var(--surface-2) 60%, transparent); }
.table td.right, .table th.right { text-align: right; }
.lead-cell { display: flex; align-items: center; gap: 10px; }
.lead-cell .name { font-weight: 600; color: var(--text); }
.owner-cell { display: flex; align-items: center; gap: 8px; }
.empty { padding: 48px 20px; text-align: center; color: var(--text-2); white-space: normal !important; }
.empty a { font-weight: 600; }
.pagination { display: flex; justify-content: space-between; align-items: center; padding: 12px 20px; border-top: 1px solid var(--rule); color: var(--text-2); font-size: 13px; gap: 12px; flex-wrap: wrap; }

/* ---------- Lead detail ---------- */
.detail-grid { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 20px; align-items: start; }
.lead-hero { display: flex; gap: 16px; align-items: flex-end; }
.lead-hero .avatar { width: 56px; height: 56px; font-size: 19px; }
.lead-hero .role { color: var(--text-2); margin-top: 4px; }
.deal-strip { display: flex; gap: 40px; flex-wrap: wrap; align-items: baseline; margin: 0 0 16px; }
.deal-strip .figure { font-size: 28px; display: block; line-height: 1.1; }
.deal-strip .lbl { display: block; color: var(--text-2); font-size: 12.5px; }
.stage-track { display: flex; gap: 3px; }
.stage-track form { flex: 1; margin: 0; }
.stage-step {
  width: 100%; height: 38px; border: 0; cursor: pointer; font: inherit; font-size: 12.5px; font-weight: 600;
  background: var(--surface-2); color: var(--text-2);
  border-radius: 0;
}
.stage-track form:first-child .stage-step { border-radius: var(--r-md) 0 0 var(--r-md); }
.stage-track form:last-child .stage-step { border-radius: 0 var(--r-md) var(--r-md) 0; }
.stage-step:hover { color: var(--text); box-shadow: inset 0 -3px 0 var(--c); }
.stage-step.done { background: color-mix(in srgb, var(--c) 16%, var(--surface)); color: var(--text-2); }
/* Ink text on a strong tint keeps every stage readable; the bar carries the colour. */
.stage-step.current { background: color-mix(in srgb, var(--c) 34%, var(--surface)); color: var(--text); font-weight: 700; box-shadow: inset 0 -4px 0 var(--c); }
dl.props { display: grid; grid-template-columns: 110px 1fr; gap: 10px 12px; margin: 0; }
dl.props dt { color: var(--text-2); }
dl.props dd { margin: 0; overflow-wrap: anywhere; }
dl.props dd a[href^=mailto] { word-break: break-all; }
.timeline { list-style: none; margin: 8px 0 0; padding: 0; }
.timeline li { display: flex; gap: 12px; padding: 12px 0; border-top: 1px solid var(--rule); }
.tl-icon { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); flex-shrink: 0; color: var(--text-2); }
.tl-icon svg { width: 15px; height: 15px; }
.tl-body { flex: 1; min-width: 0; }
.tl-meta { font-size: 12.5px; color: var(--text-3); margin-top: 2px; }
.activity-form { display: grid; gap: 8px; }
.activity-form .row { display: flex; gap: 8px; }
.activity-form select { width: 160px; }

/* ---------- Forms ---------- */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 20px; }
.field label { display: block; font-weight: 600; margin-bottom: 6px; font-size: 13px; }
.field .help { font-size: 12.5px; color: var(--text-3); margin-top: 4px; }
.field .errorlist { list-style: none; margin: 4px 0 0; padding: 0; color: var(--danger); font-size: 12.5px; }
.field.full { grid-column: 1 / -1; }
.form-section-title { grid-column: 1 / -1; font-size: 16px; font-weight: 650; padding-top: 8px; }
.form-section-title:not(:first-child) { border-top: 1px solid var(--rule); padding-top: 20px; margin-top: 4px; }

/* ---------- Pipeline board ---------- */
.pipeline-stats { display: flex; gap: 12px 36px; flex-wrap: wrap; }
.pipeline-stats > div { display: flex; flex-direction: column; }
.pipeline-stats .figure { font-size: 24px; line-height: 1.15; }
.pipeline-stats .lbl { display: block; color: var(--text-2); font-size: 12.5px; }
.board-tools { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.board-tools label { display: flex; align-items: center; gap: 6px; cursor: pointer; color: var(--text-2); }
.board { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 12px; align-items: flex-start; }
.column {
  flex: 0 0 272px; display: flex; flex-direction: column;
  max-height: calc(100vh - 230px); min-height: 300px;
  background: color-mix(in srgb, var(--surface-2) 70%, var(--bg));
  border-radius: var(--r-lg);
}
.column-header { padding: 14px 14px 10px; }
.column-title { display: flex; justify-content: space-between; align-items: baseline; font-weight: 650; font-size: 15px; }
.column-count { font-size: 12.5px; color: var(--text-2); font-weight: 550; }
.column-total { font-size: 18px; margin-top: 2px; }
/* thermometer: fill = win probability, in the stage's temperature */
.thermo { display: flex; align-items: center; gap: 8px; margin-top: 8px; font-size: 12px; color: var(--text-2); }
.thermo-track { flex: 1; height: 4px; border-radius: 2px; background: var(--border); overflow: hidden; }
.thermo-track span { display: block; height: 100%; background: var(--c); border-radius: 2px; }
.column-cards { padding: 2px 8px 10px; overflow-y: auto; flex: 1; min-height: 80px; display: flex; flex-direction: column; gap: 6px; border-radius: var(--r-md); }
.column-cards.drag-over { background: color-mix(in srgb, var(--c) 10%, transparent); }
.deal-card {
  position: relative;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md);
  padding: 10px 12px 10px 14px; cursor: grab; user-select: none;
}
.deal-card::before { /* temperature edge */
  content: ""; position: absolute; left: -1px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 2px 2px 0; background: var(--c);
}
.deal-card:hover { border-color: color-mix(in srgb, var(--text) 25%, var(--border)); }
.deal-card.dragging { box-shadow: var(--lift); cursor: grabbing; }
.deal-card.ghost { opacity: .35; }
.deal-card .company { font-weight: 650; color: var(--text); display: block; }
.deal-card .contact { font-size: 12.5px; color: var(--text-2); display: block; }
.deal-card .foot { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; }
.deal-card .value { font-weight: 700; font-stretch: 110%; font-variant-numeric: tabular-nums; }
.deal-card .date { font-size: 12px; color: var(--text-2); }
.deal-card .date.overdue { color: var(--danger); font-weight: 600; }
.column-add { margin: 0 8px 10px; font-size: 13px; color: var(--text-2); padding: 7px 8px; border-radius: var(--r-md); font-weight: 550; }
.column-add:hover { background: var(--surface); color: var(--accent); text-decoration: none; }
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translate(-50%, 12px);
  background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: var(--r-md);
  opacity: 0; transition: opacity .18s, transform .18s; pointer-events: none; z-index: 50; font-weight: 550;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { background: var(--danger); color: #fff; }

/* ---------- Analytics ---------- */
.period-tabs { display: inline-flex; gap: 2px; border-bottom: 1px solid var(--border); max-width: 100%; overflow-x: auto; }
.period-tabs a { padding: 6px 12px; color: var(--text-2); font-weight: 550; white-space: nowrap; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.period-tabs a:hover { color: var(--text); text-decoration: none; }
.period-tabs a.active { color: var(--text); border-bottom-color: var(--text); }

.kpi-band { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: 8px; }
.kpi-band .kpi { padding: 4px 24px 4px 0; }
.kpi-band .kpi + .kpi { padding-left: 24px; border-left: 1px solid var(--border); }
.kpi .label { color: var(--text-2); font-weight: 550; }
.kpi .value { font-size: 38px; line-height: 1.1; margin-top: 4px; }
.kpi .foot { font-size: 12.5px; color: var(--text-2); margin-top: 6px; }
.kpi-minor { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0 24px; padding: 16px 0 0; margin: 20px 0 28px; border-top: 1px solid var(--border); }
.kpi-minor div { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.kpi-minor span { color: var(--text-2); }
.kpi-minor b { font-size: 17px; font-stretch: 110%; font-variant-numeric: tabular-nums; }
.delta { font-weight: 650; }
.delta.up { color: var(--success); }
.delta.down { color: var(--danger); }

.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; margin-bottom: 20px; }
.grid-3-1 { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 20px; margin-bottom: 20px; }
.chart-box { position: relative; height: 260px; }
.funnel-row { display: grid; grid-template-columns: 96px 1fr 76px; gap: 12px; align-items: center; padding: 5px 0; }
.funnel-row .stage-name { display: flex; align-items: center; gap: 7px; }
.funnel-row .stage-name i { width: 8px; height: 8px; border-radius: 2px; background: var(--c); }
.funnel-bar-track { height: 22px; }
.funnel-bar { height: 100%; background: var(--c); border-radius: 0 var(--r-sm) var(--r-sm) 0; min-width: 2px; }
.funnel-meta { text-align: right; line-height: 1.25; }
.funnel-meta b { font-variant-numeric: tabular-nums; }
.funnel-meta small { display: block; color: var(--text-3); font-size: 11.5px; }
.bar-inline { height: 6px; background: var(--surface-2); border-radius: 3px; overflow: hidden; margin-top: 5px; }
.bar-inline span { display: block; height: 100%; background: var(--text-3); border-radius: 3px; }
.feed { list-style: none; margin: 0; padding: 0 20px 8px; }
.feed li { display: flex; gap: 10px; padding: 10px 0; border-top: 1px solid var(--rule); }
.rank { display: inline-block; width: 18px; color: var(--text-3); font-variant-numeric: tabular-nums; }

/* ---------- Auth ---------- */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.auth-card { width: 100%; max-width: 380px; padding: 32px; }
.auth-card .wordmark { margin-bottom: 28px; }
.auth-card .field { margin-bottom: 14px; }
.password-wrap { position: relative; }
.password-wrap input { padding-right: 42px; }
.password-toggle {
  position: absolute; top: 0; right: 0; width: 40px; height: 38px;
  display: grid; place-items: center; padding: 0;
  border: 0; background: none; color: var(--text-3); cursor: pointer; border-radius: var(--r-md);
}
.password-toggle:hover { color: var(--text); }
.password-toggle:focus-visible { outline: 2px solid var(--focus); outline-offset: -4px; }
.password-toggle .icon-hide, .password-toggle[aria-pressed="true"] .icon-show { display: none; }
.password-toggle[aria-pressed="true"] .icon-hide { display: block; }

/* ---------- GEO picker ---------- */
.geo-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 6px; }
.geo-head label { margin: 0; }
.geo-total { font-size: 13px; }
.geo-search { margin-left: auto; width: 200px !important; height: 32px !important; }
.geo-regions { display: grid; gap: 6px; margin-top: 8px; }
.geo-region { border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface); }
.geo-region.has-selection { border-color: var(--text-3); }
.geo-region > summary { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 12px; cursor: pointer; list-style: none; }
.geo-region > summary::-webkit-details-marker { display: none; }
.geo-region > summary::after { content: "▾"; color: var(--text-3); margin-left: 6px; transition: transform .15s; }
.geo-region[open] > summary::after { transform: rotate(180deg); }
.geo-region-toggle { display: inline-flex !important; align-items: center; gap: 8px; margin: 0 !important; font-weight: 600 !important; cursor: pointer; }
.geo-count { margin-left: auto; font-size: 13px; }
.geo-countries { padding: 4px 12px 12px; }
@media (max-width: 700px) { .geo-search { margin-left: 0; width: 100% !important; } }

/* ---------- Dictation ---------- */
.dictate-card { max-width: 760px; }
.dictate-label { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 6px; }
.dictate-label label { margin: 0; }
.dictate-card textarea { font-size: 16px; }
.mic-btn { display: inline-flex; align-items: center; gap: 6px; }
.mic-btn.is-recording { border-color: var(--danger); color: var(--danger); background: var(--danger-soft); }
.mic-btn.is-recording svg { animation: mic-pulse 1.2s ease-in-out infinite; }
@keyframes mic-pulse { 50% { opacity: .35; } }
.quick-actions { margin-left: auto; display: flex; gap: 8px; align-items: center; flex-shrink: 0; }
.quick-actions + .account { margin-left: 0; }
.ask-link, .dictate-link { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.ask-link.active, .dictate-link.active { border-color: var(--text); }
@media (max-width: 700px) { .quick-actions { gap: 6px; } .ask-link span, .dictate-link span { display: none; } .ask-link, .dictate-link { padding: 0 8px; } }
.contact-row { border: 1px solid var(--rule); border-radius: var(--r-md); padding: 14px 16px; }
.contact-row-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; gap: 12px; }
.contact-remove { display: inline-flex; gap: 6px; align-items: center; font-weight: 500; font-size: 13px; color: var(--text-2); }
.transcript { color: var(--text-2); }
.transcript summary { cursor: pointer; font-weight: 600; color: var(--text); }
.transcript p { margin: 8px 0 0; }

/* ---------- Ask ---------- */
.ask-card { max-width: 760px; }
.ask-card textarea { font-size: 16px; }
.ask-thread { max-width: 760px; display: grid; gap: 14px; margin-top: 20px; }
.ask-item { padding: 16px 20px; }
.ask-q { font-weight: 650; margin: 0 0 8px; }
.ask-a { white-space: pre-line; line-height: 1.55; margin: 0; }
.ask-links { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.ask-links a { font-size: 13px; padding: 3px 9px; border: 1px solid var(--border); border-radius: var(--r-md); }
.ask-thread-head { display: flex; justify-content: space-between; align-items: center; }
.ask-thread-head h2 { font-size: 16px; margin: 0; }

/* ---------- Telegram ---------- */
.tg-section { margin-bottom: 20px; }
details.tg-section > summary { list-style: none; cursor: pointer; }
.tg-row { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; align-items: center; padding: 12px 0; border-top: 1px solid var(--rule); }
.tg-row:first-child { border-top: 0; padding-top: 0; }
.tg-title { font-weight: 650; }
.tg-meta { font-size: 13px; margin: 2px 0 0; }
.tg-link-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.tg-link-form select { width: auto; max-width: 260px; height: 32px; }
.tg-ignore { display: inline-flex; gap: 6px; align-items: center; font-size: 13px; color: var(--text-2); }
.tg-block { display: grid; gap: 16px; }
.tg-block-chat + .tg-block-chat { border-top: 1px solid var(--rule); padding-top: 16px; }
.tg-block-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.tg-block-actions { display: inline-flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.tg-compose-label { display: block; font-weight: 600; margin-bottom: 6px; }
.tg-compose textarea { font-size: 16px; }
.tg-link-form input[type=text] { width: 180px; height: 32px; }
.tg-summary { white-space: pre-line; line-height: 1.55; margin: 8px 0 0; }
.tg-feed { display: grid; gap: 10px; }
.tg-day { text-align: center; font-size: 12.5px; color: var(--text-3); margin: 8px 0 2px; }
.tg-msg { max-width: 85%; padding: 8px 12px; border-radius: var(--r-md); background: var(--surface-2); }
.tg-msg.mine { justify-self: end; background: var(--accent-soft); }
.tg-msg-head { font-size: 13px; margin-bottom: 2px; }
.tg-msg-text { white-space: pre-wrap; overflow-wrap: anywhere; }
@media (max-width: 900px) { .tg-row { grid-template-columns: minmax(0, 1fr); } .tg-link-form select { max-width: 100%; flex: 1 1 200px; } }

/* ---------- Motion ---------- */
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* ---------- Responsive ---------- */
@media (max-width: 1200px) {
  .detail-grid, .grid-3-1 { grid-template-columns: minmax(0, 1fr); }
  .kpi-minor { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 24px; }
}
@media (max-width: 900px) {
  .topbar { padding: 0 16px; gap: 16px; }
  .main { padding: 20px 16px 48px; }
  .kpi-band { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px 0; }
  .kpi-band .kpi:nth-child(3) { padding-left: 0; border-left: 0; }
  .kpi .value { font-size: 30px; }
  .filters { grid-template-columns: 1fr 1fr; }
  .filters > :first-child { grid-column: 1 / -1; }
  .grid-2, .form-grid { grid-template-columns: minmax(0, 1fr); }
  .column { max-height: none; min-height: 0; }
  h1 { font-size: 26px; }
}
@media (max-width: 560px) {
  .wordmark { display: none; }
  .tabs a { padding: 0 8px; }
  .kpi-minor { grid-template-columns: minmax(0, 1fr); }
  .funnel-row { grid-template-columns: 90px 1fr 60px; }
  .deal-strip { gap: 20px; }
}

/* ---------- Introducer additions ---------- */
.kind-chip { display: inline-block; padding: 1px 7px; border-radius: var(--r-sm); border: 1px solid var(--border); font-size: 12px; font-weight: 600; color: var(--text-2); white-space: nowrap; }
.tags { display: flex; flex-wrap: wrap; gap: 4px; }
.tag { display: inline-block; padding: 1px 7px; border-radius: var(--r-sm); background: var(--surface-2); font-size: 12px; color: var(--text); white-space: nowrap; }
.tag.miss { background: transparent; color: var(--text-3); text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--text-3) 60%, transparent); }
.tag.ok { background: color-mix(in srgb, var(--stage-live) 16%, var(--surface)); }
.table td.wrap { white-space: normal; min-width: 180px; }
.cell-title { font-weight: 600; color: var(--text); }
.flow { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.flow .arrow { color: var(--text-3); }
.section-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.section-tabs a { padding: 6px 12px; border-radius: var(--r-md); border: 1px solid var(--border); color: var(--text-2); font-weight: 550; background: var(--surface); }
.section-tabs a:hover { color: var(--text); text-decoration: none; }
.section-tabs a.active { background: var(--text); border-color: var(--text); color: var(--bg); }
.due-list { list-style: none; margin: 0; padding: 0; }
.due-list li { display: grid; grid-template-columns: 110px minmax(0, 1fr) auto; gap: 12px; align-items: baseline; padding: 9px 20px; border-top: 1px solid var(--rule); }
.due-list li:first-child { border-top: 0; }
.due-date { font-weight: 650; font-variant-numeric: tabular-nums; }
.due-date.overdue { color: var(--danger); }
.match { display: grid; grid-template-columns: 52px minmax(0, 1fr) auto; gap: 14px; align-items: start; padding: 14px 20px; border-top: 1px solid var(--rule); }
.match:first-of-type { border-top: 0; }
.score { font-size: 20px; font-weight: 700; font-stretch: 115%; font-variant-numeric: tabular-nums; line-height: 1; }
.score small { display: block; font-size: 11px; font-weight: 500; font-stretch: 100%; color: var(--text-3); margin-top: 3px; }
.match .why { display: grid; gap: 5px; margin-top: 6px; font-size: 12.5px; }
.match .why > div { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.match .why b { color: var(--text-2); font-weight: 550; min-width: 72px; }
.contact-list { list-style: none; margin: 0; padding: 0; }
.contact-list li { padding: 10px 0; border-top: 1px solid var(--rule); }
.contact-list li:first-child { border-top: 0; padding-top: 0; }
.contact-list .links { display: flex; gap: 12px; flex-wrap: wrap; font-size: 13px; margin-top: 2px; }
.chips-input { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; padding: 0; margin: 0; }
.chips-input > div, .chips-input > li { display: contents; }
.chips-input label { display: inline-flex !important; align-items: center; gap: 6px; margin: 0 !important; padding: 5px 10px; border: 1px solid var(--border); border-radius: var(--r-md); font-weight: 500 !important; cursor: pointer; background: var(--surface); }
.chips-input label:has(input:checked) { border-color: var(--text); background: var(--surface-2); }
.chips-input input { margin: 0; }
select[multiple] { height: auto; padding: 4px; }
.gap-flag { color: var(--danger); font-weight: 600; font-size: 12px; }
.stat-row { display: flex; gap: 32px; flex-wrap: wrap; }
.stat-row > div { display: flex; flex-direction: column; }
.stat-row .figure { font-size: 22px; line-height: 1.15; }
.stat-row .lbl { color: var(--text-2); font-size: 12.5px; }
.deal-card .flow-line { font-size: 12.5px; color: var(--text-2); display: block; }
.deal-card .next { font-size: 12px; color: var(--text-2); margin-top: 6px; display: block; }
.deal-card .next.overdue { color: var(--danger); font-weight: 600; }
.deal-card .next.today { color: var(--text); font-weight: 600; }
.stack { display: grid; gap: 20px; grid-template-columns: minmax(0, 1fr); align-content: start; min-width: 0; }
h1.flow { display: flex; }
.tabs { min-width: 0; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a { white-space: nowrap; }
@media (max-width: 700px) {
  .topbar { gap: 8px; }
  .account .name { display: none; }
  .due-list li { grid-template-columns: 76px minmax(0, 1fr); }
  .due-list li .badge { display: none; }
}
.filters.filters-wide { grid-template-columns: minmax(200px, 2fr) repeat(4, minmax(120px, 1fr)) auto; }
.stage-track form { min-width: 0; }
.stage-step { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 0 4px; }
@media (max-width: 1100px) {
  .filters.filters-wide { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .filters.filters-wide > :first-child { grid-column: 1 / -1; }
}
@media (max-width: 700px) {
  .filters.filters-wide { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stage-track { flex-wrap: wrap; }
  .stage-track form { flex: 1 1 30%; }
  .stage-track form .stage-step { border-radius: var(--r-md) !important; }
  h1.flow { font-size: 22px; }
}
