/* Sampark CRM. Framed sheet: one tinted L frame, the work on a white sheet.
   Frame tint is a low-chroma step of the teal data hue. Grid: canvas padding 24, one 24px gutter. */
:root {
  --ground: #f1f6f6; --surface: #ffffff; --raised: #f4f6f8; --active: #e3ebec;
  --border: #e8eaec; --rule: #f0f1f2; --control: #cdced1;
  --text: #131416; --muted: #5d5f60; --faint: #666869;
  --accent: #1b6c80; --primary: #1d1f20; --primary-ink: #ffffff;
  --positive: #1e7b4f; --negative: #c4242a; --warning: #92400e;
  --chart-1: #1b6c80; --chart-2: #2f70bb; --chart-3: #a86f0c; --chart-muted: #cfd3d6; --chart-mark: var(--text); --chart-span: .06;
  --grid: #eceef0; --axis-ink: var(--muted); --ink: var(--text);
  --pill-positive-bg: #dcfae5; --pill-positive-ink: #04250e;
  --pill-negative-bg: #ffedea; --pill-negative-ink: #831c1e;
  --pill-warning-bg: #fffbeb; --pill-warning-ink: #92400e;
  --pill-neutral-bg: #ebedee; --pill-neutral-ink: #353736;
  --radius-card: 8px; --radius-control: 6px; --radius-sheet: 16px; --sheet-inset: 8px;
  --row-height: 48px; --sidebar-width: 228px; --gap: 24px; --pad: 24px; --control-height: 32px; --card-pad: 20px;
  --fs-title: 22px; --fs-section: 16px; --fs-kpi: 28px; --fs-body: 14px; --fs-small: 12px;
  --font: "IBM Plex Sans", Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, Consolas, monospace;
  --ease: cubic-bezier(.22,1,.36,1);
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--ground); color: var(--text); font: var(--fs-body)/20px var(--font); -webkit-font-smoothing: antialiased; }
h1, h2, h3, p, ul, ol, dl, dd, figure { margin: 0; }
ul[class], ol[class] { padding: 0; list-style: none; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
svg { display: block; max-width: 100%; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
table, .num, .kpi-value { font-variant-numeric: tabular-nums; }
[hidden] { display: none !important; }

/* shell */
.app { display: grid; grid-template-columns: var(--sidebar-width) minmax(0, 1fr); grid-template-rows: 48px minmax(0, 1fr); height: 100svh; }
.brand { display: flex; align-items: center; gap: 10px; padding: 0 16px; font-weight: 600; font-size: 15px; }
.mark { width: 24px; height: 24px; flex: none; }
.topbar { display: flex; align-items: center; gap: 12px; padding-right: 16px; min-width: 0; }
.search { flex: 1; max-width: 548px; margin: 0 auto; height: 32px; position: relative; }
.search input { width: 100%; height: 32px; padding: 0 12px 0 34px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); }
.search input::placeholder { color: var(--faint); }
.search svg { position: absolute; left: 11px; top: 9px; width: 14px; height: 14px; color: var(--muted); }
.who { display: flex; align-items: center; gap: 8px; color: var(--muted); white-space: nowrap; }
.sidebar { display: flex; flex-direction: column; gap: 2px; padding: 8px 8px 12px; overflow: auto; }
.group-label { margin: 18px 8px 6px; font-size: var(--fs-small); color: var(--muted); }
.nav-item { display: flex; align-items: center; gap: 10px; height: 34px; padding: 0 8px; border-radius: 8px; color: var(--muted); transition: background-color .15s, color .15s; }
.nav-item svg { width: 16px; height: 16px; flex: none; }
.nav-item:hover { background: var(--active); color: var(--text); }
.nav-item[aria-current="page"] { background: var(--active); color: var(--text); font-weight: 500; }
.nav-item .count { margin-left: auto; font-size: var(--fs-small); color: var(--text); font-variant-numeric: tabular-nums; }
.sidebar .bottom { margin-top: auto; padding-top: 12px; }
.sheet { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sheet); margin: 0 var(--sheet-inset) var(--sheet-inset) 0; min-width: 0; min-height: 0; overflow: auto; }
.canvas { padding: var(--pad); min-width: 0; }
.btn.menu-toggle { display: none; }
@media (min-width: 761px) { .btn.phone-only { display: none; } }

/* title */
.title-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.title-row h1 { font-size: var(--fs-title); line-height: 28px; font-weight: 600; letter-spacing: -.01em; }
.title-row .sub { margin-top: 4px; color: var(--muted); }
.title-row .sub strong { color: var(--text); font-weight: 500; }
.actions { display: flex; gap: 8px; flex: none; flex-wrap: wrap; justify-content: flex-end; }
.crumb { color: var(--muted); margin-bottom: 4px; display: inline-block; }
.crumb:hover { color: var(--text); }

/* panels */
.grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: var(--gap); }
.grid.top { align-items: start; }
.stack.fill { grid-template-rows: auto 1fr; }
.span-8 { grid-column: span 8; } .span-7 { grid-column: span 7; } .span-5 { grid-column: span 5; } .span-4 { grid-column: span 4; } .span-12 { grid-column: span 12; }
.stack { display: grid; gap: var(--gap); min-width: 0; }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-card); padding: var(--card-pad); min-width: 0; }
.panel > header { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.panel h2 { font-size: var(--fs-section); line-height: 22px; font-weight: 600; }
.meta { color: var(--muted); font-size: var(--fs-small); }
.link { color: var(--text); font-weight: 500; background: none; border: 0; padding: 0; cursor: pointer; text-underline-offset: 3px; }
.link:hover { text-decoration: underline; }
.mono { font-family: var(--mono); font-size: 13px; }

/* waiting queue: the product's own element. Bar length is how long the buyer has waited, against a day. */
.queue-row { display: grid; grid-template-columns: 76px minmax(0, 1fr) 28px; gap: 12px; align-items: center; min-height: 64px; padding: 10px 0; border-top: 1px solid var(--rule); }
.queue-row:first-child { border-top: 0; }
.queue-row:hover .who-line { text-decoration: underline; text-underline-offset: 3px; }
.wait { font-weight: 500; font-variant-numeric: tabular-nums; }
.wait.late { color: var(--negative); }
.wait-track { height: 3px; margin-top: 6px; border-radius: 2px; background: var(--rule); overflow: hidden; }
.wait-track span { display: block; height: 100%; background: var(--accent); }
.wait.late + .wait-track span { background: var(--negative); }
.who-line { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.who-line .co { color: var(--muted); font-weight: 400; }
.snippet { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.snippet b { color: var(--text); font-weight: 500; }

.avatar { width: 24px; height: 24px; border-radius: 50%; display: inline-grid; place-items: center; font-size: 11px; font-weight: 600; flex: none; color: #2b2f31; }
.rows { display: grid; grid-template-columns: minmax(0, 1fr); }
.row { display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 8px 0; border-top: 1px solid var(--rule); }
.row:first-child { border-top: 0; }
.row .grow { flex: 1; min-width: 0; }
.row .right { margin-left: auto; text-align: right; flex: none; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; background: var(--chart-muted); }
.dot.ok { background: var(--positive); } .dot.bad { background: var(--negative); }

/* stage funnel */
.funnel { display: grid; gap: 10px; }
.funnel a { display: grid; grid-template-columns: 112px minmax(0, 1fr) 28px; gap: 10px; align-items: center; }
.funnel .bar { height: 8px; background: var(--rule); border-radius: 4px; overflow: hidden; }
.funnel .bar span { display: block; height: 100%; background: var(--accent); }
.funnel .n { text-align: right; font-variant-numeric: tabular-nums; }

/* lists */
.counts { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; margin-bottom: 16px; }
.count-card { display: block; text-align: left; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-card); background: var(--surface); cursor: pointer; transition: border-color .15s; }
.count-card:hover { border-color: var(--control); }
.count-card .l { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.count-card .v { font-size: 16px; font-weight: 600; font-variant-numeric: tabular-nums; display: block; }
.count-card[aria-pressed="true"] { border: 1.5px solid var(--accent); background: #eef5f7; padding: 9.5px 11.5px; }
.filters { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.filters .spacer { flex: 1; }
.select, .input, .textarea { border: 1px solid var(--control); border-radius: var(--radius-control); background: var(--surface); }
.select { height: var(--control-height); padding: 0 8px; max-width: 200px; }
.input { height: 38px; padding: 0 12px; width: 100%; }
.input.small { height: 32px; }
.textarea { width: 100%; padding: 8px 12px; min-height: 120px; resize: vertical; line-height: 20px; }
.input::placeholder, .textarea::placeholder { color: var(--faint); }
table { width: 100%; border-collapse: collapse; }
th { height: 36px; padding: 0 12px; text-align: left; font-weight: 400; font-size: var(--fs-small); color: var(--muted); border-bottom: 1px solid var(--border); white-space: nowrap; background: var(--surface); position: sticky; top: 0; z-index: 1; }
td { padding: 8px 12px; border-bottom: 1px solid var(--rule); vertical-align: middle; height: 56px; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr.clickable { cursor: pointer; }
tbody tr.clickable:hover td { background: var(--raised); }
th.n, td.n { text-align: right; }
th.check, td.check { width: 36px; padding-right: 0; }
td .sub { display: block; font-size: var(--fs-small); color: var(--muted); max-width: 32ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
td .main { font-weight: 500; display: block; max-width: 32ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bulkbar { display: flex; align-items: center; gap: 8px; padding: 8px 12px; margin-bottom: 12px; background: var(--raised); border-radius: var(--radius-card); flex-wrap: wrap; }
.pill { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 999px; font-size: var(--fs-small); font-weight: 500; background: var(--pill-neutral-bg); color: var(--pill-neutral-ink); white-space: nowrap; flex: none; }
.pill.pos { background: var(--pill-positive-bg); color: var(--pill-positive-ink); }
.pill.neg { background: var(--pill-negative-bg); color: var(--pill-negative-ink); }
.pill.warn { background: var(--pill-warning-bg); color: var(--pill-warning-ink); }

/* controls */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: var(--control-height); padding: 0 12px; border-radius: var(--radius-control); border: 1px solid var(--control); background: var(--surface); font-weight: 500; cursor: pointer; white-space: nowrap; transition: background-color .15s, transform .12s var(--ease); }
.btn:hover { background: var(--raised); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--primary); color: var(--primary-ink); border-color: transparent; }
.btn.primary:hover { background: #33373a; }
.btn.danger { color: var(--negative); }
.btn[disabled] { opacity: .6; cursor: progress; }
.field { display: grid; gap: 8px; }
.field label, .label { font-weight: 500; }
.hint { color: var(--muted); font-size: var(--fs-small); line-height: 16px; }
.form { display: grid; gap: 16px; }
.two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.three { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.check-row { display: flex; align-items: flex-start; gap: 8px; }
.check-row input { margin: 3px 0 0; }
.tabs { display: flex; gap: 24px; border-bottom: 1px solid var(--border); margin-bottom: var(--gap); overflow-x: auto; }
.tabs a, .tabs button { position: relative; padding: 10px 0; color: var(--muted); background: none; border: 0; cursor: pointer; white-space: nowrap; }
.tabs [aria-selected="true"] { color: var(--text); font-weight: 500; box-shadow: inset 0 -2px 0 var(--text); }
.empty { display: grid; place-items: center; min-height: 72px; padding: 16px; border: 1px dashed var(--control); border-radius: var(--radius-control); color: var(--muted); text-align: center; gap: 8px; }
.notice { padding: 8px 12px; border: 1px solid #fde68a; background: var(--pill-warning-bg); color: var(--pill-warning-ink); border-radius: var(--radius-control); font-size: 13px; }
.error-box { padding: 12px; color: var(--pill-negative-ink); background: var(--pill-negative-bg); border-radius: var(--radius-control); }

/* lead workspace */
.workspace { display: grid; grid-template-columns: minmax(0, 1fr) 320px; height: 100%; min-height: 0; }
.convo { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.convo-head { display: flex; align-items: center; gap: 12px; padding: 12px 20px; border-bottom: 1px solid var(--border); min-height: 64px; }
.convo-head h1, .convo-head h2 { font-size: var(--fs-section); line-height: 22px; font-weight: 600; }
.timeline { flex: 1; overflow: auto; padding: 20px; display: flex; flex-direction: column; gap: 12px; background: var(--surface); min-height: 160px; }
.msg { max-width: 76%; padding: 10px 12px; border-radius: 8px; background: var(--raised); align-self: flex-start; }
.msg.out { align-self: flex-end; background: #e8f1f3; }
.msg.note { align-self: center; max-width: 88%; background: var(--pill-warning-bg); color: #4d2a0a; }
.msg .head { display: flex; gap: 8px; color: var(--muted); font-size: var(--fs-small); margin-bottom: 4px; flex-wrap: wrap; }
.msg .subject { font-weight: 500; margin-bottom: 2px; }
.msg .body { white-space: pre-wrap; overflow-wrap: anywhere; }
.composer { border-top: 1px solid var(--border); padding: 0 20px 16px; }
.composer .tabs { margin-bottom: 12px; }
.composer .textarea { min-height: 88px; }
.composer .row-end { display: flex; align-items: center; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.composer .row-end .spacer { flex: 1; }
.details { border-left: 1px solid var(--border); overflow: auto; padding: 16px; display: grid; gap: 20px; align-content: start; min-height: 0; }
.details h3 { font-size: 14px; font-weight: 600; margin-bottom: 8px; }
.kv { display: grid; grid-template-columns: 76px minmax(0, 1fr); align-items: center; gap: 4px 8px; }
.kv label { color: var(--muted); }
.kv .input, .kv .select { height: 30px; width: 100%; max-width: none; padding: 0 8px; border-color: transparent; background: transparent; }
.kv .input:hover, .kv .select:hover { border-color: var(--border); }
.kv .input:focus { border-color: var(--control); background: var(--surface); outline: none; }
.task { display: flex; gap: 8px; align-items: flex-start; padding: 6px 0; }
.task input { margin: 3px 0 0; }
.task.done .t { text-decoration: line-through; color: var(--muted); }

/* inbox */
.inbox { display: grid; grid-template-columns: 340px minmax(0, 1fr); height: 100%; min-height: 0; }
.inbox-list { border-right: 1px solid var(--border); display: flex; flex-direction: column; min-height: 0; }
.inbox-tools { padding: 16px 16px 0; }
.inbox-tools h1 { font-size: var(--fs-title); line-height: 28px; font-weight: 600; margin-bottom: 8px; }
.inbox-tools .tabs { margin-bottom: 0; gap: 20px; }
.conv-list { overflow: auto; flex: 1; }
.conv { display: block; padding: 10px 16px; border-bottom: 1px solid var(--rule); }
.conv:hover { background: var(--raised); }
.conv[aria-current="true"] { background: var(--active); }
.conv .l1 { display: flex; justify-content: space-between; gap: 8px; }
.conv .nm { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv.unread .nm { font-weight: 600; }
.conv .tm { color: var(--muted); font-size: var(--fs-small); flex: none; }
.conv .l2 { display: flex; gap: 8px; align-items: center; color: var(--muted); }
.conv .l2 span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chan { flex: none; font-size: 11px; line-height: 16px; color: var(--pill-neutral-ink); background: var(--pill-neutral-bg); padding: 0 5px; border-radius: 3px; }
.pane-empty { display: grid; place-items: center; height: 100%; color: var(--muted); padding: 24px; text-align: center; }

/* pipeline */
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(216px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 8px; align-items: start; }
.lane { background: var(--raised); border-radius: var(--radius-card); padding: 8px; min-height: 240px; transition: background-color .15s; }
.lane.over { background: var(--active); }
.lane header { display: flex; justify-content: space-between; padding: 4px 4px 8px; font-weight: 500; }
.lane header .meta { font-variant-numeric: tabular-nums; }
.deal { display: block; background: var(--surface); border: 1px solid var(--border); border-radius: 6px; padding: 8px 10px; margin-bottom: 8px; cursor: grab; }
.deal:hover { border-color: var(--control); }
.deal .nm { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.deal .ln { display: flex; justify-content: space-between; gap: 8px; align-items: center; color: var(--muted); font-size: var(--fs-small); margin-top: 2px; }

/* campaign */
.step { border: 1px solid var(--border); border-radius: var(--radius-card); padding: 16px; display: grid; gap: 12px; }
.step header { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.tags { display: flex; flex-wrap: wrap; gap: 4px; }
.tag { font-family: var(--mono); font-size: 12px; background: var(--raised); border: 0; border-radius: 4px; padding: 2px 6px; cursor: pointer; }
.tag:hover { background: var(--active); }
.progress { height: 8px; border-radius: 4px; background: var(--rule); overflow: hidden; }
.progress span { display: block; height: 100%; background: var(--accent); }
.kpis { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); border: 1px solid var(--border); border-radius: var(--radius-card); margin-bottom: var(--gap); }
.kpi { padding: 14px var(--card-pad); }
.kpi + .kpi { border-left: 1px solid var(--border); }
.kpi-label { color: var(--muted); }
.kpi-value { margin-top: 4px; font-size: var(--fs-kpi); line-height: 34px; font-weight: 400; }
.preview { background: var(--raised); border-radius: var(--radius-card); padding: 12px; white-space: pre-wrap; overflow-wrap: anywhere; }

/* settings */
.settings { max-width: 1152px; }
.setting { display: grid; grid-template-columns: minmax(0, 360px) minmax(0, 1fr); gap: 32px; padding: 32px 0; border-top: 1px solid var(--border); }
.setting:first-of-type { border-top: 0; padding-top: 8px; }
.setting h2 { font-size: var(--fs-section); line-height: 22px; font-weight: 500; margin-bottom: 4px; }
.setting .desc { color: var(--muted); }
.setting .desc ol { padding-left: 18px; margin: 8px 0 0; }
.setting .desc li { margin-bottom: 4px; }
.setting .desc a { text-decoration: underline; text-underline-offset: 2px; }
.setting-panel { background: #fafbfb; border-radius: var(--radius-sheet); padding: 16px; display: grid; gap: 16px; min-width: 0; }
.setting-panel .end { display: flex; justify-content: flex-end; gap: 8px; }
.status-line { display: flex; align-items: center; gap: 8px; }
.copy-row { display: flex; }
.copy-row .input { border-radius: 6px 0 0 6px; font-family: var(--mono); font-size: 13px; min-width: 0; background: var(--surface); }
.copy-row .btn { height: 38px; border-radius: 0 6px 6px 0; border-left: 0; }

/* sign in */
.auth { min-height: 100svh; display: grid; place-items: center; padding: 16px; }
.auth-card { width: 100%; max-width: 380px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sheet); padding: 28px; display: grid; gap: 20px; }
.auth-card h1 { font-size: var(--fs-title); line-height: 28px; font-weight: 600; }
.auth-card .btn { height: 38px; width: 100%; }

/* dialog and toast */
dialog { border: 1px solid var(--border); border-radius: 12px; padding: 0; width: min(560px, calc(100vw - 32px)); box-shadow: 0 16px 48px rgba(0,0,0,.16); color: var(--text); }
dialog::backdrop { background: rgba(19,20,22,.35); }
.dialog-body { padding: 20px; display: grid; gap: 16px; }
.dialog-body h2 { font-size: var(--fs-section); font-weight: 600; }
.dialog-foot { display: flex; justify-content: flex-end; gap: 8px; }
dialog.pdf-dialog { width: min(980px, calc(100vw - 32px)); }
.pdf-dialog .dialog-body { gap: 12px; }
.pdf-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.pdf-head h2 { margin-right: auto; }
.pdf-frame { width: 100%; height: min(78vh, 1100px); border: 1px solid var(--border); border-radius: 8px; background: #525659; }
#toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 50; display: grid; gap: 8px; width: max-content; max-width: calc(100vw - 32px); pointer-events: none; }
.toast { padding: 10px 14px; border-radius: 8px; background: var(--primary); color: #fff; box-shadow: 0 4px 16px rgba(0,0,0,.2); }
.toast.bad { background: var(--pill-negative-ink); }

/* colour: status is read at a glance. Pending amber, closed green, cancelled red, sales teal, not spoken blue. */
:root {
  --primary: #0f6b7d;
  --pending: #b26a00; --pending-bg: #fff3d6; --pending-line: #f2c14e;
  --closed: #12703f; --closed-bg: #daf5e4; --closed-line: #5cc98a;
  --cancelled: #b3261e; --cancelled-bg: #ffe3e0; --cancelled-line: #f08a82;
  --unspoken: #1c5fb8; --unspoken-bg: #e1edff; --unspoken-line: #82b1f0;
  --sales: #0f6b7d; --sales-bg: #d9f1f5; --sales-line: #5cbccb;
  --head-bg: #e4f1f3;
}
.btn.primary:hover { background: #0b5766; }
.btn.big { height: 40px; padding: 0 18px; font-size: 15px; }
.stats { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; margin-bottom: var(--gap); }
.stat { display: grid; gap: 2px; text-align: left; padding: 14px 16px; border: 1px solid; border-left-width: 5px; border-radius: 10px; cursor: pointer; font: inherit; transition: transform .12s var(--ease); }
.stat:hover { transform: translateY(-2px); }
.stat[aria-pressed="true"] { outline: 2px solid currentColor; outline-offset: 1px; }
.stat-label { font-weight: 600; }
.stat-value { font-size: 30px; line-height: 36px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat-sub { font-size: 12px; color: var(--text); opacity: .8; }
.stat-pending { color: var(--pending); background: var(--pending-bg); border-color: var(--pending-line); }
.stat-closed { color: var(--closed); background: var(--closed-bg); border-color: var(--closed-line); }
.stat-cancelled { color: var(--cancelled); background: var(--cancelled-bg); border-color: var(--cancelled-line); }
.stat-unspoken { color: var(--unspoken); background: var(--unspoken-bg); border-color: var(--unspoken-line); }
.stat-sales { color: var(--sales); background: var(--sales-bg); border-color: var(--sales-line); }
/* Leads desk: the counts sit on one slim line, label, number and note side by side */
.stats.strip { display: flex; flex-wrap: wrap; gap: 8px; }
.stats.strip .stat { display: inline-flex; align-items: baseline; gap: 8px; padding: 6px 12px; border-left-width: 4px; border-radius: 8px; }
.stats.strip .stat:hover { transform: none; filter: brightness(.97); }
.stats.strip .stat-value { font-size: 18px; line-height: 24px; }
.stats.strip button.stat .stat-sub { display: none; }
.stats.strip .stat-sales { margin-left: auto; }
.front-table td { height: 44px; }
.greeting-frame { width: 100%; height: 640px; border: 1px solid var(--border); border-radius: 8px; background: #f3f4f7; }
.lead-table .sno { width: 48px; color: var(--muted); font-variant-numeric: tabular-nums; }
.front-table td .dot { margin-right: 4px; }

.sheet-section { min-width: 0; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.section-head h2 { font-size: var(--fs-section); line-height: 22px; font-weight: 600; }
.table-frame { border: 1px solid var(--border); border-radius: 10px; overflow: auto; }
.lead-table th, .sales-table th { background: var(--head-bg); color: #0b4552; font-size: 13px; font-weight: 600; border-bottom: 0; height: 40px; position: static; }
.lead-table td, .sales-table td { height: 58px; padding: 6px 10px; }
.lead-table th, .sales-table th { padding: 0 10px; }
.lead-table tbody tr { box-shadow: inset 4px 0 0 var(--pending-line); }
.lead-table tbody tr.row-closed { box-shadow: inset 4px 0 0 var(--closed-line); }
.lead-table tbody tr.row-cancelled { box-shadow: inset 4px 0 0 var(--cancelled-line); }
.lead-table tbody tr:hover td { background: #f6fafb; }
.lead-table .main { max-width: 22ch; }
.lead-table .sub { max-width: 24ch; }
.name-link { color: var(--primary); }
.name-link:hover { text-decoration: underline; text-underline-offset: 3px; }
.plain { display: block; }
.clip { max-width: 18ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.late { color: var(--negative); font-weight: 600; }
.lead-table td.n { white-space: nowrap; }
.src { display: inline-block; font-size: 11px; line-height: 16px; padding: 0 5px; border-radius: 3px; background: var(--pill-neutral-bg); color: var(--pill-neutral-ink); }
.src-indiamart { background: #ffe6d1; color: #93400a; }
.src-whatsapp { background: #d6f5dd; color: #11612c; }
.src-gmail { background: #fde0dd; color: #a02018; }
.src-yahoo { background: #eee2fb; color: #5a2b9a; }
.cell-select, .cell-input { height: 32px; width: 100%; min-width: 112px; padding: 0 6px; border: 1px solid var(--control); border-radius: 6px; background: var(--surface); }
.cell-input::placeholder { color: var(--faint); }
.status { height: 32px; min-width: 104px; padding: 0 6px; border: 1px solid; border-radius: 6px; font-weight: 600; cursor: pointer; }
.status-pending { color: var(--pending); background: var(--pending-bg); border-color: var(--pending-line); }
.status-closed { color: var(--closed); background: var(--closed-bg); border-color: var(--closed-line); }
.status-cancelled { color: var(--cancelled); background: var(--cancelled-bg); border-color: var(--cancelled-line); }
.status option { color: var(--text); background: #fff; }
.tick { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.tick input { width: 18px; height: 18px; margin: 0; accent-color: var(--closed); }
.sales-table tr.this-month td { background: #f0f9fa; font-weight: 500; }
.sales-table .target-input { min-width: 104px; max-width: 128px; margin-left: auto; display: block; text-align: right; }
.sales-table td.up { color: var(--closed); font-weight: 600; }
.sales-table td.down { color: var(--cancelled); font-weight: 600; }
.achieve { display: flex; align-items: center; gap: 8px; min-width: 120px; }
.achieve-bar { flex: 1; height: 10px; border-radius: 5px; background: var(--rule); overflow: hidden; }
.achieve-bar span { display: block; height: 100%; background: var(--pending-line); }
.achieve-bar span.met { background: var(--closed-line); }
.card-won .v { color: var(--closed); } .card-lost .v { color: var(--cancelled); } .card-new .v { color: var(--unspoken); }
.lane header.lane-won { color: var(--closed); } .lane header.lane-lost { color: var(--cancelled); }
.phone-row { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 8px; }
.combo-list { position: fixed; z-index: 100; max-width: min(420px, calc(100vw - 24px)); overflow: auto; padding: 4px; background: var(--surface); border: 1px solid var(--control); border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.14); }
.combo-item { padding: 7px 10px; border-radius: 5px; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.combo-item:hover, .combo-item.on { background: var(--head-bg); }
.combo-none { padding: 7px 10px; color: var(--muted); font-size: var(--fs-small); }

.brand-sub { display: block; font-size: 11px; line-height: 13px; font-weight: 400; color: var(--muted); }
.product-group { margin-bottom: var(--gap); max-width: 900px; }
.product-group tbody td { height: 44px; }
.quote-kpis { grid-auto-flow: row; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.quote-kpis .kpi { display: grid; gap: 4px; align-content: start; }
.quote-kpis .kpi-label { color: var(--muted); font-size: var(--fs-small); }
.line-table td { vertical-align: top; }
.chart-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(360px, 1fr)); gap: 16px; }
@media (max-width: 420px) { .chart-grid { grid-template-columns: minmax(0, 1fr); } }
.chart-card { margin: 0; padding: 16px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); min-width: 0; }
.chart-card.wide { grid-column: 1 / -1; }
.chart-card figcaption { font-weight: 600; margin-bottom: 10px; }
.donut { display: grid; grid-template-columns: 132px minmax(0, 1fr); gap: 16px; align-items: center; }
.donut svg { width: 132px; height: 132px; }
.donut-total { font-size: 17px; font-weight: 600; fill: var(--text); }
.donut-sub { font-size: 11px; fill: var(--muted); }
.donut-legend { display: grid; gap: 4px; padding: 0; margin: 0; list-style: none; font-size: 13px; }
.donut-legend li > a, .donut-legend li { display: flex; align-items: center; gap: 8px; min-width: 0; }
.donut-legend li > a { flex: 1; border-radius: 4px; }
.donut-legend li > a:hover { background: var(--raised); }
.donut-legend li { align-items: flex-start; }
.donut-legend .swatch { margin-top: 4px; }
.donut-legend .grow { flex: 1; min-width: 0; overflow-wrap: anywhere; line-height: 17px; }
.donut-legend .swatch { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.donut-legend .num { font-variant-numeric: tabular-nums; }
.donut-legend .pct { width: 36px; text-align: right; }
@media (max-width: 420px) { .donut { grid-template-columns: minmax(0, 1fr); justify-items: center; } }
.product-rows { display: grid; gap: 6px; }
.product-row { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr) 64px 36px; gap: 6px; }
.product-row .btn { padding: 0; justify-content: center; }
.details .product-row { grid-template-columns: minmax(0, 1fr) 60px 32px; padding-bottom: 6px; border-bottom: 1px solid var(--rule); }
.details .product-row [data-k=product_name] { grid-column: 1 / -1; }
.details .product-row .input { min-width: 0; }
.kv > * { min-width: 0; }
.details { grid-template-columns: minmax(0, 1fr); }
.details #task > div { flex-wrap: wrap; }
.details #task input[type=date] { flex: 1; min-width: 130px; }
.kv textarea.input { resize: vertical; font: inherit; line-height: 18px; }
.help { max-width: 860px; }
.help-block { padding: 20px 0; border-top: 1px solid var(--border); }
.help-block:first-of-type { border-top: 0; padding-top: 0; }
.help-block h2 { font-size: var(--fs-section); line-height: 22px; font-weight: 600; margin-bottom: 10px; }
.help-block ul { padding-left: 18px; margin: 0; }
.help-block li { margin-bottom: 6px; }
ol.help-steps { padding-left: 22px; margin: 0; list-style: decimal; }
.help-steps li { margin-bottom: 8px; }
.help-colours { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.help-colours .stat { cursor: default; }
.help-colours .stat:hover { transform: none; }
.help-faq dt { font-weight: 600; margin-top: 12px; }
.help-faq dt:first-child { margin-top: 0; }

/* tablet and phone: the frame goes, the sheet is the screen */
@media (max-width: 1100px) {
  .app { grid-template-columns: minmax(0, 1fr); grid-template-rows: 48px minmax(0, 1fr); }
  .app .brand { display: none; }
  .topbar { padding: 0 12px; }
  .btn.menu-toggle { display: inline-flex; width: 36px; padding: 0; border: 0; background: none; }
  .btn.menu-toggle svg { width: 18px; height: 18px; }
  .sidebar { position: fixed; inset: 0; z-index: 20; background: var(--surface); transform: translateX(-100%); transition: transform .2s var(--ease); padding: 16px; }
  .sidebar.open { transform: none; }
  .sheet { margin: 0; border: 0; border-radius: 0; }
  .span-8, .span-7, .span-5, .span-4 { grid-column: 1 / -1; }
  .counts { display: flex; overflow-x: auto; }
  .count-card { flex: none; min-width: 112px; }
  .setting { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .workspace { grid-template-columns: minmax(0, 1fr); height: auto; }
  .workspace .convo { min-height: 70svh; }
  .details { border-left: 0; border-top: 1px solid var(--border); }
  .timeline { max-height: 56svh; }
}
@media (max-width: 760px) {
  .canvas { padding: 16px; }
  .who span { display: none; }
  .inbox { grid-template-columns: minmax(0, 1fr); }
  .inbox.open .inbox-list { display: none; }
  .inbox:not(.open) .inbox-pane { display: none; }
  .title-row { flex-wrap: wrap; }
  .kpis { grid-auto-flow: row; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi { border-left: 0 !important; border-top: 1px solid var(--border); }
  .kpi:nth-child(-n+2) { border-top: 0; }
  .kpi:nth-child(2n) { border-left: 1px solid var(--border) !important; }
  .kpi:last-child:nth-child(odd) { grid-column: 1 / -1; }
  .two, .three { grid-template-columns: minmax(0, 1fr); }
  .msg { max-width: 92%; }
  .btn, .select, .input.small { min-height: 40px; }
  .setting-panel .row, .panel .row:has(.btn) { flex-wrap: wrap; }
  .setting-panel .row .grow, .panel .row:has(.btn) .grow { flex-basis: 60%; }
  .nav-item { height: 44px; }
  .stats:not(.strip) { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stats:not(.strip) .stat-sales { grid-column: 1 / -1; }
  .stats.strip .stat-sub { display: none; }
  .stats.strip .stat-sales { margin-left: 0; }
  /* tables stay tables: one line per row, swipe sideways, the first column stays in view */
  .lead-table, .sales-table { width: max-content; min-width: 100%; }
  .lead-table td, .sales-table td { height: auto; min-height: 44px; }
  .lead-table :is(th, td):first-child, .sales-table :is(th, td):first-child { position: sticky; left: 0; z-index: 1; background: var(--surface); box-shadow: 1px 0 0 var(--border); }
  .lead-table th:first-child, .sales-table th:first-child { background: var(--head-bg); }
  .lead-table .main, .lead-table .sub { max-width: 18ch; }
  .phone-row { grid-template-columns: 124px minmax(0, 1fr); }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition-duration: .01ms !important; animation: none !important; } }
.line-table td:first-child { min-width: 340px; width: 46%; }
.line-table textarea[data-k=description] { min-height: 110px; }
.msg.earlier { opacity: .78; }
.msg.earlier .pill { font-size: 11px; line-height: 16px; }
.filters.more { flex-wrap: wrap; gap: 8px; }
.filters.more .input.small, .filters.more .select { width: auto; min-width: 130px; }
.insight { border: 1px solid var(--border); border-radius: 10px; padding: 14px 16px; background: var(--surface); display: grid; gap: 6px; }
.insight.act { border-left: 4px solid var(--warning); }
.insight.good { border-left: 4px solid var(--positive); }
.insight.note { border-left: 4px solid var(--accent); }
.insight h3 { font-size: 15px; font-weight: 600; margin: 0; }
.voice-btn.listening { background: #fde8e8; border-color: var(--negative); color: var(--negative); }
.voice-btn.listening::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--negative); display: inline-block; margin-right: 6px; animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .3; } }

/* ---------- Bioline colours: the navy of the name and the red of the drop ---------- */
:root {
  --brand-navy: #1f2766; --brand-red: #d71f2b;
  --ground: #f2f3f8; --active: #e4e6f2; --accent: #1f2766; --primary: #1f2766;
  --chart-1: #1f2766; --head-bg: #eceef7;
  --sales: #1f2766; --sales-bg: #e8eaf6; --sales-line: #8f96cc;
  --tone-ok: #1e8a4f; --tone-warn: #d48806; --tone-bad: #d71f2b; --tone-new: #b8bcc6;
}
.btn.primary { background: var(--brand-navy); border-color: var(--brand-navy); }
.btn.primary:hover { background: #151b4d; }
.lead-table th, .sales-table th { color: var(--brand-navy); }
.brand { color: var(--brand-navy); }
.nav-item[aria-current="page"] { background: #fff; color: var(--brand-navy); box-shadow: inset 3px 0 0 var(--brand-red); }
.group-label { text-transform: uppercase; letter-spacing: .06em; font-size: 11px; font-weight: 600; color: #8a8fa6; }

/* enquiry colours */
.lead-table tbody tr.tone-ok { box-shadow: inset 4px 0 0 var(--tone-ok); }
.lead-table tbody tr.tone-warn { box-shadow: inset 4px 0 0 var(--tone-warn); }
.lead-table tbody tr.tone-bad { box-shadow: inset 4px 0 0 var(--tone-bad); }
.lead-table tbody tr.tone-new { box-shadow: inset 4px 0 0 var(--tone-new); }
.lead-table tbody tr.row-pending { box-shadow: inset 4px 0 0 var(--tone-warn); }
.lead-table tbody tr.row-closed { box-shadow: inset 4px 0 0 var(--tone-ok); }
.lead-table tbody tr.row-cancelled { box-shadow: inset 4px 0 0 var(--tone-bad); }
.tone-label { display: block; margin-top: 4px; font-size: 11px; font-weight: 600; }
.tone-label.tone-ok { color: var(--tone-ok); } .tone-label.tone-warn { color: #9a6200; } .tone-label.tone-bad { color: var(--tone-bad); } .tone-label.tone-new { color: var(--muted); }
.dot.warn { background: var(--tone-warn); }
.colour-key { display: flex; flex-wrap: wrap; gap: 10px 22px; }
.colour-chip { display: flex; align-items: center; gap: 8px; }
.colour-chip .dot { width: 12px; height: 12px; }

/* checks while typing */
.input.invalid, .cell-input.invalid { border-color: var(--negative); background: #fff7f7; }
.field-error { color: var(--negative); font-size: var(--fs-small); margin-top: 4px; }

/* team members: no selecting or copying, and their name faintly across screen and paper */
body.protected { -webkit-user-select: none; user-select: none; }
body.protected input, body.protected textarea, body.protected [contenteditable] { -webkit-user-select: text; user-select: text; }
body.protected a[href*="download=1"]:not([href*="send=1"]), body.protected a[href*="export.csv"], body.protected a[href*="format=csv"], body.protected a[href*="download.zip"], body.protected a[href*="register.csv"] { display: none !important; }
.watermark { position: fixed; inset: -20%; z-index: 9999; pointer-events: none; display: flex; flex-wrap: wrap; gap: 90px 120px; align-content: center; justify-content: center;
  transform: rotate(-24deg); opacity: .06; font-size: 15px; font-weight: 600; color: var(--brand-navy); white-space: nowrap; }
@media print { .watermark { opacity: .12; position: fixed; } }

/* panels that ask for action */
.panel.attention { border-left: 4px solid var(--brand-red); }
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; background: var(--surface); }
.seg button { border: 0; background: none; padding: 6px 14px; cursor: pointer; color: var(--muted); }
.seg button[aria-selected="true"] { background: var(--brand-navy); color: #fff; }

/* team activity */
.people { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; margin-top: 8px; }
.person-card { border: 1px solid var(--border); border-radius: 12px; padding: 16px; display: grid; gap: 10px; background: var(--surface); }
.person-card header { display: flex; gap: 10px; align-items: center; }
.person-card h3 { font-size: 15px; font-weight: 600; }
.person-card .summary { line-height: 1.5; }
.mini-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.mini-stats span { display: grid; font-size: 11px; color: var(--muted); background: var(--raised); border-radius: 8px; padding: 6px 8px; }
.mini-stats strong { font-size: 16px; color: var(--text); }
.person-card summary { cursor: pointer; color: var(--accent); font-size: var(--fs-small); }

/* guide */
.cycle { display: grid; gap: 10px; counter-reset: step; margin-bottom: 28px; }
.cycle a { display: flex; gap: 14px; align-items: flex-start; padding: 14px 16px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); transition: border-color .15s, transform .15s var(--ease); }
.cycle a:hover { border-color: var(--brand-navy); transform: translateX(3px); }
.cycle-n { flex: none; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--brand-navy); color: #fff; font-weight: 600; }
.cycle li:last-child .cycle-n { background: var(--tone-ok); }
.cycle-text { display: block; color: var(--muted); margin-top: 2px; }
.guide-block { margin-top: 28px; }
.guide-block h2 { font-size: var(--fs-section); font-weight: 600; margin-bottom: 12px; }
.guide-block h3 { font-size: 14px; font-weight: 600; margin-bottom: 6px; }
.guide-block ul { padding-left: 18px; display: grid; gap: 6px; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.faq dt { font-weight: 600; margin-top: 14px; }
.faq dd { color: var(--muted); margin-top: 4px; line-height: 1.55; }
.faq code { background: var(--raised); padding: 1px 5px; border-radius: 4px; font-family: var(--mono); font-size: 12px; color: var(--text); }
@media (max-width: 760px) { .two-col { grid-template-columns: 1fr; } .mini-stats { grid-template-columns: repeat(2, 1fr); } }

/* product page */
.spec-list { display: grid; gap: 12px; }
.spec { border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; background: var(--surface); border-left: 4px solid var(--brand-navy); }
.spec.off { opacity: .6; border-left-color: var(--tone-new); }
.spec header { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; flex-wrap: wrap; margin-bottom: 8px; }
.spec h3 { font-size: 15px; font-weight: 600; }
.spec-text { white-space: pre-wrap; font: inherit; line-height: 1.55; margin: 0; }

/* two-step sign-in setup */
.steps { margin: 0; padding-left: 20px; list-style: decimal; display: grid; gap: 10px; }
.setup-key { margin-top: 6px; padding: 10px 12px; background: var(--pill-neutral-bg); border-radius: var(--radius-control); font-size: 15px; letter-spacing: .04em; word-break: break-all; user-select: all; }
.setup-key.recovery { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px 16px; }
.or { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: var(--fs-small); }
.or::before, .or::after { content: ''; flex: 1; border-top: 1px solid var(--border); }
.choice { padding: 14px; border: 1px solid var(--border); border-radius: 10px; display: grid; gap: 8px; }
.choice h3 { margin: 0; }
