/* VRB CRM v2 — light workspace, quiet surfaces, one teal signal for replies and clients.
   Replaces app.css (kept on the server untouched for rollback). Class names are unchanged. */
:root {
  --bg: #F6F7F9;
  --surface: #FFFFFF;
  --side: #FBFBFC;
  --ink: #101828;
  --text: #1D2939;
  --muted: #667085;
  --faint: #98A2B3;
  --line: #E4E7EC;
  --line-soft: #F0F2F5;
  --hover: #F5F6F8;
  --signal: #0F7B6C;
  --signal-2: #14A38F;
  --signal-soft: #E7F5F2;
  --signal-line: #BFE3DB;
  --warn: #B54708;
  --warn-soft: #FEF6E7;
  --warn-line: #F7D9A4;
  --bad: #B42318;
  --bad-soft: #FEF0EE;
  --bad-line: #F6CFC9;
  --live: #3538CD;
  --live-soft: #EEF2FF;
  --live-line: #C7D2FE;
  --chart-sent: #98A2B3;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04);
  --shadow-lg: 0 12px 32px -8px rgba(16, 24, 40, .18), 0 2px 6px rgba(16, 24, 40, .06);
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 400 14px/1.5 var(--font); font-variant-numeric: tabular-nums; -webkit-font-smoothing: antialiased; }
a { color: var(--ink); text-underline-offset: 2px; }
a:hover { color: var(--signal); }
:focus-visible { outline: 2px solid var(--signal); outline-offset: 2px; }
h1, h2 { margin: 0; letter-spacing: -0.015em; color: var(--ink); }
h1 { font-size: 22px; font-weight: 600; }
h2, .h2like { font-size: 15px; font-weight: 600; margin-bottom: 12px; }
code, pre.code { font-family: var(--mono); font-size: 12.5px; }
pre.code { background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 12px; overflow-x: auto; white-space: pre; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--ink); color: #fff; padding: 8px 12px; border-radius: 6px; z-index: 50; }
.skip:focus { left: 8px; }
.ico { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }

/* Shell */
.shell { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; }
.side { background: var(--side); border-right: 1px solid var(--line); display: flex; flex-direction: column; padding: 16px 12px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; color: var(--ink); }
.brand-mark { width: 34px; height: 34px; border-radius: 9px; background: var(--ink); display: grid; place-items: center; flex: none; }
.brand-mark span { width: 14px; height: 14px; border-radius: 3px; background: linear-gradient(135deg, var(--signal-2) 0 50%, #fff 50% 100%); }
.brand-text { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.brand-text strong { font-size: 15px; font-weight: 600; }
.brand-text small { color: var(--faint); font-size: 12px; }
.mark { width: 18px; height: 18px; border-radius: 4px; background: linear-gradient(135deg, var(--signal) 0 50%, var(--ink) 50% 100%); }
.side-group { margin-top: 14px; }
.side-label { display: block; font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--faint); padding: 0 10px 6px; }
.side nav { display: flex; flex-direction: column; gap: 1px; }
.side nav a { display: flex; align-items: center; gap: 10px; color: var(--muted); text-decoration: none; padding: 7px 10px; border-radius: var(--radius-sm); font-weight: 500; }
.side nav a .lbl { flex: 1; min-width: 0; }
.side nav a:hover { background: var(--hover); color: var(--ink); }
.side nav a.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(16,24,40,.06), 0 0 0 1px var(--line); }
.side nav a.on .ico { color: var(--signal); }
.count { background: var(--surface); color: var(--muted); border: 1px solid var(--line); font-size: 11.5px; font-weight: 600; border-radius: 6px; padding: 0 6px; line-height: 18px; }
.side nav a.hot .count { background: var(--signal); border-color: var(--signal); color: #fff; }
.side-foot { margin-top: auto; padding-top: 14px; display: flex; flex-direction: column; gap: 10px; }
.side-foot .stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 12px; font-size: 12.5px; }
.side-foot .stat div { display: flex; justify-content: space-between; color: var(--muted); }
.side-foot .stat strong { color: var(--ink); font-weight: 600; }
.side-foot .stat .meter { margin-top: 8px; }
.user { display: flex; align-items: center; gap: 10px; padding: 8px 6px; border-top: 1px solid var(--line); padding-top: 12px; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--signal-soft); color: var(--signal); font-weight: 600; font-size: 13px; display: grid; place-items: center; flex: none; }
.user .who-name { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.3; }
.user .who-name strong { color: var(--ink); font-weight: 600; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user .who-name small { color: var(--faint); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user a { color: var(--faint); display: grid; place-items: center; padding: 6px; border-radius: 6px; }
.user a:hover { color: var(--ink); background: var(--hover); }
.main-wrap { min-width: 0; }
.top { display: flex; align-items: center; gap: 12px; padding: 18px 32px; flex-wrap: wrap; border-bottom: 1px solid var(--line); background: var(--surface); margin-bottom: 24px; }
.top-title { flex: 1; min-width: 0; }
.top h1 { overflow-wrap: anywhere; }
.top .sub { color: var(--muted); font-size: 13.5px; margin: 2px 0 0; }
.top-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.menu-btn { display: none; }
main { padding: 0 32px 48px; max-width: 1440px; }

/* Buttons and forms */
.btn { display: inline-flex; align-items: center; gap: 6px; font: 500 13.5px/1 var(--font); color: var(--text); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 9px 14px; cursor: pointer; text-decoration: none; white-space: nowrap; box-shadow: var(--shadow); }
.btn:hover { background: var(--hover); color: var(--ink); }
.btn .ico { width: 16px; height: 16px; }
.btn.primary { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn.primary:hover { background: #283447; }
.btn.small { padding: 6px 10px; font-size: 12.5px; }
.btn.ghost { background: transparent; border-color: transparent; box-shadow: none; }
.btn.ghost:hover { background: var(--hover); }
.btn.danger { color: var(--bad); border-color: var(--bad-line); }
.btn.danger:hover { background: var(--bad-soft); }
.btn.block { width: 100%; justify-content: center; }
.btn:disabled { opacity: .45; cursor: default; }
.link { color: var(--muted); font-size: 13px; }
.danger-text { color: var(--bad) !important; }
form.inline { display: inline; }
.form { display: flex; flex-direction: column; gap: 14px; }
.form label, .filters label, .inline-form label { display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; font-weight: 500; color: var(--muted); }
input:not([type=checkbox]):not([type=radio]):not([type=file]), select, textarea {
  font: 400 14px/1.4 var(--font); color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 8px 11px; width: 100%; min-width: 0; box-shadow: var(--shadow);
}
select { appearance: none; padding-right: 30px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23667085' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; }
textarea { resize: vertical; line-height: 1.55; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--signal); box-shadow: 0 0 0 3px var(--signal-soft); }
input::placeholder, textarea::placeholder { color: var(--faint); }
label.check { flex-direction: row !important; align-items: center; gap: 8px !important; font-weight: 500 !important; color: var(--text) !important; font-size: 13.5px !important; }
label.check.inline, label.inline { display: inline-flex; flex-direction: row; align-items: center; gap: 6px; }
input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--ink); }
fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin: 0; }
legend { font-weight: 600; padding: 0 6px; color: var(--ink); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid3 { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 14px; }
.span2 { grid-column: span 2; }
.inline-form { display: flex; gap: 8px; align-items: flex-end; margin-top: 10px; }
.inline-form.wrap { flex-wrap: wrap; margin: 0; }
.grow { flex: 1; min-width: 200px; }
.row-gap { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 6px; }
.drop { border: 1.5px dashed #C9CFD8; border-radius: var(--radius); padding: 24px; background: var(--bg); }
details > summary { cursor: pointer; color: var(--muted); font-weight: 500; font-size: 13px; }
details[open] > summary { margin-bottom: 10px; }
summary.h2like { color: var(--ink); font-size: 15px; }

/* Flash */
.flash { border-radius: var(--radius-sm); padding: 10px 14px; margin-bottom: 16px; border: 1px solid; font-weight: 500; }
.flash.ok { background: var(--signal-soft); border-color: var(--signal-line); color: #0B5B50; }
.flash.err { background: var(--bad-soft); border-color: var(--bad-line); color: #912018; }
.flash.warn { background: var(--warn-soft); border-color: var(--warn-line); color: #93370D; }

/* Panels */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin-bottom: 20px; box-shadow: var(--shadow); min-width: 0; }
.panel.narrow { max-width: 640px; }
.panel.flush { padding: 0; overflow: hidden; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; }
.panel-head h2 { margin: 0; }
.panel-head a { font-size: 13px; color: var(--muted); text-decoration: none; display: inline-flex; align-items: center; gap: 2px; }
.panel-head a:hover { color: var(--ink); }
.cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.cols > .panel { margin-bottom: 0; }
.cols + .cols, .cols + .panel, .panel + .cols { margin-top: 20px; }
.hint { color: var(--muted); font-size: 13px; margin: 0 0 14px; }
.empty { color: var(--muted); text-align: center; padding: 28px 12px !important; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.strong { font-weight: 600; }
.nowrap { white-space: nowrap; }
.good-text { color: var(--signal); font-weight: 600; }
.warn-text { color: var(--warn); }
.bad-text { color: var(--bad); font-weight: 600; }
.err-text { color: var(--bad); font-size: 12.5px; margin-top: 3px; }

/* Dashboard: KPI tiles */
.kpi-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 20px; }
.kpi { padding: 18px 20px; display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-rows: auto auto auto; column-gap: 12px; border-left: 1px solid var(--line-soft); min-width: 0; }
.kpi:first-child { border-left: 0; }
.kpi .k-label { color: var(--muted); font-size: 13px; font-weight: 500; grid-column: 1 / -1; }
.kpi .k-val { display: flex; align-items: baseline; gap: 8px; margin-top: 6px; flex-wrap: wrap; }
.kpi .k-val strong { font-size: 26px; font-weight: 600; letter-spacing: -.02em; color: var(--ink); line-height: 1.15; }
.kpi .k-spark { grid-row: 2; grid-column: 2; align-self: end; width: 96px; height: 36px; }
.kpi .k-foot { color: var(--faint); font-size: 12px; margin-top: 6px; grid-column: 1 / -1; }
.delta { display: inline-flex; align-items: center; gap: 2px; font-size: 12.5px; font-weight: 600; }
.delta.up { color: var(--signal); }
.delta.down { color: var(--bad); }
.delta.flat { color: var(--faint); font-weight: 500; }
.delta.bad-up { color: var(--bad); }
.delta.good-down { color: var(--signal); }
.spark-line { fill: none; stroke-width: 1.75; stroke-linejoin: round; stroke-linecap: round; }
.spark-area { stroke: none; }
.s-sent .spark-line { stroke: var(--ink); } .s-sent .spark-area { fill: url(#g-ink); }
.s-good .spark-line { stroke: var(--signal); } .s-good .spark-area { fill: url(#g-signal); }
.s-bad .spark-line { stroke: var(--bad); } .s-bad .spark-area { fill: url(#g-bad); }

/* Dashboard: layout */
.dash-a { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 20px; margin-bottom: 20px; }
.dash-a > .panel { margin: 0; }

/* Activity chart */
.chart-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; margin-bottom: 8px; }
.chart-head h2 { margin: 0 0 4px; }
.chart-totals { display: flex; gap: 28px; }
.chart-totals div { display: flex; flex-direction: column; color: var(--muted); font-size: 12.5px; }
.chart-totals strong { font-size: 20px; font-weight: 600; color: var(--ink); letter-spacing: -.01em; }
.legend { font-size: 12.5px; color: var(--muted); display: flex; align-items: center; gap: 14px; margin: 0; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.sw { display: inline-block; width: 8px; height: 8px; border-radius: 2px; }
.sw.sent { background: var(--chart-sent); } .sw.reply { background: var(--signal); }
.chart { width: 100%; height: auto; display: block; overflow: visible; }
.chart .grid { stroke: var(--line-soft); }
.chart .axis-t { fill: var(--faint); font-size: 11px; font-family: var(--font); }
.chart .l-sent { fill: none; stroke: var(--chart-sent); stroke-width: 2; stroke-linejoin: round; }
.chart .l-reply { fill: none; stroke: var(--signal); stroke-width: 2; stroke-linejoin: round; }
.chart .a-sent { fill: url(#g-sent); }
.chart .hit rect.col { fill: transparent; }
.chart .hit:hover rect.col { fill: rgba(16, 24, 40, .035); }
.chart .tip { opacity: 0; pointer-events: none; transition: opacity .12s; }
.chart .hit:hover .tip { opacity: 1; }
.chart .tip rect { fill: var(--ink); }
.chart .tip text { fill: #fff; font-size: 11.5px; font-family: var(--font); }
.chart .tip .t-dim { fill: #A6B0BF; }
.chart .dot { stroke: var(--surface); stroke-width: 2; opacity: 0; }
.chart .hit:hover .dot { opacity: 1; }
.chart .dot.sent { fill: var(--ink); } .chart .dot.reply { fill: var(--signal); }
/* the old bar sparkline, still used elsewhere */
.spark { width: 100%; height: auto; display: block; }
.spark .b-sent { fill: #D0D5DD; }
.spark .b-reply { fill: var(--signal); }
.spark .axis { stroke: var(--line); }
.spark text { fill: var(--faint); font-size: 10px; font-family: var(--font); }

/* Today card */
.today-cap { display: flex; align-items: baseline; gap: 6px; margin: 2px 0 6px; }
.today-cap strong { font-size: 26px; font-weight: 600; color: var(--ink); letter-spacing: -.02em; }
.today-cap span { color: var(--muted); }
.meter { height: 6px; background: var(--line-soft); border-radius: 3px; overflow: hidden; margin-top: 4px; }
.meter span { display: block; height: 100%; background: var(--ink); border-radius: 3px; }
.meter.big { height: 8px; margin: 4px 0 16px; }
.meter.big span { background: linear-gradient(90deg, var(--signal), var(--signal-2)); }
.status-line { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12.5px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line-soft); }
.pulse { width: 8px; height: 8px; border-radius: 50%; background: var(--signal-2); box-shadow: 0 0 0 3px var(--signal-soft); flex: none; }
.pulse.stale { background: var(--warn); box-shadow: 0 0 0 3px var(--warn-soft); }
dl.kv { margin: 0; display: grid; gap: 0; }
dl.kv > div { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line-soft); }
dl.kv > div:last-child { border-bottom: 0; }
dl.kv dt { color: var(--muted); }
dl.kv dd { margin: 0; font-weight: 600; color: var(--ink); }
dl.kv small { color: var(--muted); font-weight: 400; }
.mb-mini { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.mb-mini li { display: flex; flex-direction: column; gap: 4px; }
.mb-mini .row { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; }
.mb-mini .row span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.sec-label { font-size: 12px; font-weight: 600; color: var(--faint); text-transform: uppercase; letter-spacing: .05em; margin: 18px 0 10px; }

/* Funnel — stage cards */
.funnel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin-bottom: 20px; box-shadow: var(--shadow); }
.funnel .panel-head { margin-bottom: 14px; }
.stages { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; }
.stage { border: 1px solid var(--line); border-radius: 10px; padding: 14px 14px 12px; display: flex; flex-direction: column; gap: 2px; min-width: 0; position: relative; }
.stage::before { content: ""; width: 18px; height: 3px; border-radius: 2px; background: var(--faint); margin-bottom: 8px; }
.stage:nth-child(1)::before { background: var(--ink); }
.stage:nth-child(2)::before { background: #475467; }
.stage:nth-child(3)::before { background: var(--signal-2); }
.stage:nth-child(4)::before, .stage:nth-child(5)::before { background: var(--signal); }
.stage.key { background: var(--signal-soft); border-color: var(--signal-line); }
.stage .s-label { color: var(--muted); font-size: 12.5px; font-weight: 500; }
.stage .s-num { font-size: 22px; font-weight: 600; color: var(--ink); letter-spacing: -.02em; }
.stage.key .s-num, .stage.key .s-label { color: #0B5B50; }
.stage .s-rate { color: var(--faint); font-size: 12px; }
.stage .s-rate b { color: var(--muted); font-weight: 600; }
/* legacy funnel rows (unused by the new dashboard, kept for safety) */
.f-row { display: grid; grid-template-columns: 190px 1fr 90px 150px; align-items: center; gap: 16px; padding: 7px 0; }
.f-label { font-weight: 600; }
.f-track { height: 10px; background: var(--line-soft); border-radius: 5px; overflow: hidden; }
.f-bar { height: 100%; background: var(--faint); border-radius: 5px; }
.f-key .f-bar { background: var(--signal); }
.f-num { font-size: 18px; font-weight: 600; text-align: right; }
.f-rate { color: var(--muted); font-size: 12.5px; }

/* Country share bars */
.share { display: flex; align-items: center; gap: 8px; justify-content: flex-end; }
.share i { display: block; height: 6px; border-radius: 3px; background: #D0D5DD; min-width: 2px; }

/* Tables */
.tbl-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 16px; box-shadow: var(--shadow); }
.tbl { width: 100%; border-collapse: collapse; }
.tbl th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 500; padding: 11px 14px; border-bottom: 1px solid var(--line); background: #FAFAFB; white-space: nowrap; }
.tbl th a { color: var(--muted); text-decoration: none; }
.tbl th a:hover { color: var(--ink); }
.tbl td { padding: 12px 14px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tbody tr:hover td { background: #FAFAFB; }
.tbl td a { text-decoration: none; font-weight: 500; }
.tbl td a:hover { text-decoration: underline; }
.tbl .num { text-align: right; }
.tbl .chk { width: 40px; }
.tbl.compact td, .tbl.compact th { padding: 8px 10px; }
.panel .tbl th { background: transparent; padding-left: 0; }
.panel .tbl td { padding-left: 0; }
.panel .tbl th.num, .panel .tbl td.num { padding-right: 0; padding-left: 10px; }
.tbl td.actions { text-align: right; }
.tbl.map td { vertical-align: middle; }

.badge { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 500; padding: 2px 9px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); color: var(--text); white-space: nowrap; line-height: 18px; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--faint); }
.stage-new::before { background: var(--faint); }
.stage-contacted::before { background: #475467; }
.stage-active-client, .stage-won { background: var(--signal-soft); border-color: var(--signal-line); color: #0B5B50; }
.stage-active-client::before, .stage-won::before { background: var(--signal); }
.stage-proposal-sent { background: var(--live-soft); border-color: var(--live-line); color: #2D31A6; }
.stage-proposal-sent::before { background: var(--live); }
.stage-nurture { background: var(--warn-soft); border-color: var(--warn-line); color: #93370D; }
.stage-nurture::before { background: var(--warn); }
.stage-lost, .stage-do-not-contact { color: var(--muted); }
.stage-lost::before, .stage-do-not-contact::before { background: var(--bad); }
.pill { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 500; padding: 1px 9px; border-radius: 999px; white-space: nowrap; border: 1px solid transparent; line-height: 20px; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .85; }
.pill.live { background: var(--live-soft); border-color: var(--live-line); color: #2D31A6; }
.pill.good { background: var(--signal-soft); border-color: var(--signal-line); color: #0B5B50; }
.pill.warn { background: var(--warn-soft); border-color: var(--warn-line); color: #93370D; }
.pill.bad { background: var(--bad-soft); border-color: var(--bad-line); color: #912018; }
.pill.muted { background: var(--line-soft); border-color: var(--line); color: var(--muted); }
.tags { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 4px; }
.tag { font-size: 11.5px; background: var(--line-soft); border-radius: 999px; padding: 0 8px; color: var(--muted); line-height: 18px; }

/* Filters and bulk */
.filters { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.filters select, .filters input { width: auto; }
.filters .grow input { width: 100%; }
.bulkbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 8px 10px 8px 16px; background: var(--ink); color: #fff; border-radius: 12px; margin: 0 auto 12px; position: sticky; bottom: 16px; z-index: 20; box-shadow: var(--shadow-lg); width: fit-content; max-width: 100%; }
.bulkbar[hidden] { display: none; }
.bulkbar select, .bulkbar input { width: auto; background-color: #1F2A3C; border-color: #344054; color: #fff; box-shadow: none; }
.bulkbar select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23D0D5DD' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); }
.bulkbar label.check { color: #fff !important; }
.bulkbar .btn { box-shadow: none; }
.bulkbar .btn.primary { background: #fff; border-color: #fff; color: var(--ink); }
.bulkbar .btn.primary:hover { background: #E4E7EC; }
.list-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.pager { display: flex; gap: 6px; align-items: center; font-size: 13px; color: var(--muted); }
.pager a { border: 1px solid var(--line); background: var(--surface); border-radius: var(--radius-sm); padding: 6px 12px; text-decoration: none; color: var(--text); box-shadow: var(--shadow); }
.pager a:hover { background: var(--hover); }
.pager span { padding: 0 6px; }

/* Detail layout */
.detail { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 20px; align-items: start; }
.head-panel { display: flex; justify-content: space-between; gap: 16px; align-items: center; flex-wrap: wrap; }
.head-panel .inline-form { margin: 0; }
.who { color: var(--muted); margin-bottom: 6px; overflow-wrap: anywhere; }
.enr { padding: 10px 0; border-bottom: 1px solid var(--line-soft); display: flex; flex-direction: column; gap: 4px; }
.side-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 12px; }
.danger-zone { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line-soft); }
.custom .grid2 { margin-bottom: 6px; }

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { border-left: 1.5px solid var(--line); padding: 2px 0 16px 18px; position: relative; }
.timeline li::before { content: ""; position: absolute; left: -6px; top: 6px; width: 10px; height: 10px; border-radius: 50%; background: var(--surface); border: 2px solid #C9CFD8; }
.timeline li.in.kind-reply::before, .timeline li.in.kind-unsubscribe::before { background: var(--signal); border-color: var(--signal); }
.timeline li.in.kind-bounce::before { border-color: var(--bad); }
.timeline li.in.kind-reply .tl-body { background: var(--signal-soft); border-color: var(--signal-line); }
.tl-meta { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; font-size: 13px; }
.tl-meta time { margin-left: auto; color: var(--faint); font-size: 12.5px; }
.tl-subj { font-weight: 500; margin: 2px 0 4px; color: var(--ink); }
.tl-body { background: var(--bg); border: 1px solid var(--line-soft); border-radius: 10px; padding: 10px 12px; font-size: 13.5px; overflow-wrap: anywhere; }
.tl-act .tl-body { background: transparent; border: 0; padding: 0; color: var(--muted); }
.tl-act.type-note .tl-body { color: var(--text); background: var(--warn-soft); border: 1px solid var(--warn-line); padding: 8px 12px; }

/* Sequence editor */
.statline { display: flex; gap: 28px; align-items: baseline; flex-wrap: wrap; margin: 0 0 20px; }
.statline div { color: var(--muted); font-size: 13px; }
.statline span { display: block; font-size: 22px; font-weight: 600; color: var(--ink); }
.statline .good span { color: var(--signal); }
.step-head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 4px; }
.step-head h2 { margin: 0; }
.step-tools { margin-left: auto; display: flex; gap: 2px; }
input.days { width: 64px !important; padding: 5px 8px !important; }
.preview { margin-top: 4px; }
.mail-preview { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.mp-subj { font-weight: 600; padding: 9px 12px; border-bottom: 1px solid var(--line-soft); background: #FAFAFB; color: var(--ink); }
.mp-body { padding: 12px; font-family: Arial, Helvetica, sans-serif; font-size: 14px; line-height: 1.5; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font: 500 12px/1 var(--mono); background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 6px 8px; cursor: pointer; color: var(--text); }
.chip:hover { background: var(--hover); }
.chip.copied { background: var(--signal-soft); border-color: var(--signal); }

/* Pipeline */
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(240px, 1fr); gap: 14px; overflow-x: auto; padding-bottom: 12px; }
.col { background: #EEF0F3; border-radius: var(--radius); padding: 10px; min-height: 320px; display: flex; flex-direction: column; }
.col header { display: flex; justify-content: space-between; align-items: baseline; padding: 4px 6px 10px; }
.col h2 { font-size: 13.5px; margin: 0; }
.col .n { font-weight: 600; color: var(--muted); font-size: 12.5px; background: var(--surface); border-radius: 6px; padding: 0 7px; }
.col.stage-active-client { background: var(--signal-soft); box-shadow: inset 0 3px 0 var(--signal); }
.col.stage-active-client h2 { color: #0B5B50; }
.cards { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; flex: 1; min-height: 60px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; display: flex; flex-direction: column; gap: 2px; cursor: grab; box-shadow: var(--shadow); }
.card:hover { border-color: #C9CFD8; }
.card a { font-weight: 600; text-decoration: none; overflow-wrap: anywhere; }
.card.dragging { opacity: .5; }
.cards.over { outline: 2px dashed var(--signal); outline-offset: 2px; border-radius: 10px; }
.more { font-size: 12.5px; color: var(--muted); padding: 8px 4px 0; }

/* Replies */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 16px; flex-wrap: wrap; }
.tabs a { padding: 9px 12px; text-decoration: none; font-weight: 500; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a:hover { color: var(--ink); }
.tabs a.on { color: var(--ink); border-bottom-color: var(--ink); }
.inbox, .reply-list { list-style: none; margin: 0; padding: 0; }
.inbox { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.inbox li { border-bottom: 1px solid var(--line-soft); }
.inbox li:last-child { border-bottom: 0; }
.inbox a { display: block; padding: 14px 18px; text-decoration: none; color: var(--text); }
.inbox a:hover { background: #FAFAFB; }
.inbox li.unread { box-shadow: inset 3px 0 0 var(--signal); }
.inbox li.unread strong { color: var(--signal); }
.ib-top { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.ib-top strong { color: var(--ink); font-weight: 600; }
.ib-top time { margin-left: auto; color: var(--faint); font-size: 12.5px; }
.ib-subj { font-weight: 500; margin-top: 3px; color: var(--ink); }
.ib-snip { color: var(--muted); font-size: 13.5px; margin: 2px 0; }
.reply-list li { display: flex; gap: 12px; justify-content: space-between; padding: 11px 0; border-bottom: 1px solid var(--line-soft); }
.reply-list li:last-child { border-bottom: 0; }
.reply-list a { text-decoration: none; min-width: 0; }
.reply-list strong { color: var(--ink); font-weight: 600; }
.reply-list .snip { display: block; color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.reply-list li.unread strong { color: var(--signal); }
.reply-list time { color: var(--faint); font-size: 12.5px; white-space: nowrap; }

/* Auth pages */
body.auth { display: grid; place-items: center; min-height: 100vh; padding: 16px; background: radial-gradient(1200px 600px at 50% -10%, #E7F5F2 0%, var(--bg) 55%); }
.auth-card { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 32px; width: 100%; max-width: 400px; box-shadow: var(--shadow-lg); }
.auth-card.wide { max-width: 640px; }
.auth-card .brand { padding: 0 0 22px; }
.auth-card h1 { margin-bottom: 4px; }
.auth-card .sub { color: var(--muted); margin: 0 0 20px; }

/* v1.1: reply sorting, approvals, domain health */
nav.chips { margin: 0 0 16px; background: var(--line-soft); border-radius: 10px; padding: 3px; display: inline-flex; flex-wrap: wrap; gap: 2px; }
nav.chips .chip { font: 500 13px/1 var(--font); padding: 8px 12px; text-decoration: none; background: transparent; border-color: transparent; color: var(--muted); }
nav.chips .chip:hover { color: var(--ink); }
nav.chips .chip.on { background: var(--surface); border-color: var(--line); color: var(--ink); box-shadow: var(--shadow); }
nav.chips .chip.on .muted { color: var(--muted); }
.badge.intent-interested { background: var(--signal-soft); border-color: var(--signal-line); color: #0B5B50; }
.badge.intent-interested::before { background: var(--signal); }
.badge.intent-question, .badge.intent-referral { background: var(--live-soft); border-color: var(--live-line); color: #2D31A6; }
.badge.intent-question::before, .badge.intent-referral::before { background: var(--live); }
.badge.intent-not_now { background: var(--warn-soft); border-color: var(--warn-line); color: #93370D; }
.badge.intent-not_now::before { background: var(--warn); }
.badge.intent-not_interested, .badge.intent-other { color: var(--muted); }
.ib-top .badge + .badge { margin-left: 4px; }
.health { list-style: none; margin: 0; padding: 0; }
.health li { display: grid; grid-template-columns: 22px 170px 1fr; gap: 8px; padding: 9px 0; border-top: 1px solid var(--line-soft); align-items: baseline; }
.health li:first-child { border-top: 0; }
.health .ok { color: var(--signal); font-weight: 700; }
.health .no { color: var(--bad); font-weight: 700; }
.health .unk { color: var(--warn); font-weight: 700; }
.health .det { word-break: break-word; color: var(--muted); font-size: 13px; }
.preview-mail { white-space: pre-wrap; background: var(--bg); border: 1px solid var(--line-soft); border-radius: 10px; padding: 10px 12px; font-size: 13px; margin: 6px 0 0; max-height: 240px; overflow: auto; }

/* v1.2: business panel, WhatsApp */
.biz .biz-info { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px 20px; margin-bottom: 14px; }
.biz .biz-info div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.biz .biz-info strong { font-weight: 600; color: var(--ink); overflow-wrap: anywhere; }
.biz .biz-info .wide { grid-column: span 1; }
.btn.wa { background: #1F8F4E; border-color: #1F8F4E; color: #fff; }
.btn.wa:hover { background: #18773F; color: #fff; }

/* v1.3: sequence KPI bar */
.kpis { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); margin: 0 0 8px; box-shadow: var(--shadow); }
.kpis > div { padding: 16px 18px; border-left: 1px solid var(--line-soft); display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.kpis > div:first-child { border-left: 0; }
.kpis small { color: var(--muted); font-size: 12.5px; font-weight: 500; }
.kpis strong { font-size: 22px; font-weight: 600; line-height: 1.2; color: var(--ink); letter-spacing: -.01em; }
.kpis span { color: var(--faint); font-size: 12px; overflow-wrap: anywhere; }
.kpis .good strong { color: var(--signal); }
.kpis .off strong { color: var(--faint); font-size: 16px; font-weight: 500; padding: 3px 0; }
.kpi-note { margin: 0 0 20px; }

/* v2: Contacts list */
.views { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin: -6px 0 18px; overflow-x: auto; scrollbar-width: none; }
.views a { display: inline-flex; align-items: center; gap: 8px; padding: 10px 12px; text-decoration: none; color: var(--muted); font-weight: 500; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.views a:hover { color: var(--ink); }
.views a span { font-size: 12px; color: var(--faint); background: var(--line-soft); border-radius: 999px; padding: 0 8px; line-height: 20px; font-weight: 500; }
.views a.on { color: var(--ink); border-bottom-color: var(--signal); }
.views a.on span { background: var(--signal-soft); color: var(--signal); }
.list-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 20px; }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--line); position: relative; }
.toolbar select { width: auto; max-width: 200px; }
.toolbar .search { position: relative; flex: 1 1 260px; min-width: 200px; }
.toolbar .search .ico { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--faint); width: 16px; height: 16px; pointer-events: none; }
.toolbar .search input[type=search] { padding-left: 34px; }
details.more { position: static; }
details.more > summary { list-style: none; color: var(--text); font-size: 13.5px; }
details.more > summary::-webkit-details-marker { display: none; }
details.more[open] > summary { margin: 0; background: var(--hover); }
.dot-n { background: var(--ink); color: #fff; font-size: 11px; font-weight: 600; border-radius: 999px; min-width: 18px; height: 18px; display: inline-grid; place-items: center; padding: 0 5px; }
.more-body { position: absolute; left: 16px; right: 16px; top: calc(100% - 6px); z-index: 15; display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; align-items: end; padding: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-lg); }
.more-body label { font-size: 12px; }
.more-body label.check { padding-bottom: 8px; }
.tbl-scroll { overflow-x: auto; }
.tbl.people th { background: #FAFAFB; }
.tbl.people td { vertical-align: middle; }
.tbl.people th, .tbl.people td { padding-left: 11px; padding-right: 11px; }
.tbl.people tbody tr.sel td { background: var(--signal-soft); }
.tbl.people .chk { padding-left: 16px; }
.sort { display: inline-flex; align-items: center; gap: 4px; }
.sort .ico { width: 13px; height: 13px; opacity: .45; }
.sort.on { color: var(--ink) !important; font-weight: 600; }
.sort.on .ico { opacity: 1; color: var(--signal); }
.person { display: flex; align-items: center; gap: 10px; min-width: 200px; }
.av { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font-weight: 600; font-size: 13px; flex: none; }
.pn { display: flex; flex-direction: column; min-width: 0; line-height: 1.35; }
.pn a { color: var(--ink); font-weight: 500; }
.pn small, .tbl .sub { color: var(--muted); font-size: 12.5px; display: block; }
.co { color: var(--text); }
.tbl.people td:nth-child(3) { min-width: 170px; }
.seq { display: block; font-size: 13px; margin-bottom: 3px; max-width: 190px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-card .list-foot { padding: 12px 16px; border-top: 1px solid var(--line); }
.list-card .bulkbar { position: fixed; bottom: 20px; left: calc(50% + 124px); transform: translateX(-50%); margin: 0; z-index: 25; padding: 8px 8px 8px 16px; gap: 10px; width: max-content; max-width: calc(100vw - 280px); }
.list-card .bulkbar .sel { font-size: 13.5px; }
.list-card .bulkbar .div { width: 1px; align-self: stretch; background: #344054; margin: 2px 2px; }
.list-card .bulkbar label.check { font-size: 13px !important; color: #D0D5DD !important; }
.list-card .bulkbar .btn.x { color: #D0D5DD; padding: 7px; }
.list-card .bulkbar .btn.x:hover { background: #283447; color: #fff; }
.list-card .bulkbar input:not([type=checkbox]) { width: 200px; }
.list-card .bulkbar input[type=checkbox] { accent-color: #fff; }

/* Responsive */
@media (max-width: 1200px) {
  .stages { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .kpis > div:nth-child(5) { border-left: 0; }
  .kpis > div:nth-child(n+5) { border-top: 1px solid var(--line-soft); }
}
@media (max-width: 1100px) {
  .detail, .dash-a { grid-template-columns: minmax(0, 1fr); }
  .kpi-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi:nth-child(3) { border-left: 0; }
  .kpi:nth-child(n+3) { border-top: 1px solid var(--line-soft); }
  .f-row { grid-template-columns: 130px 1fr 70px; }
  .f-rate { display: none; }
}
@media (max-width: 860px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .side { position: fixed; inset: 0 auto 0 0; width: 264px; transform: translateX(-100%); transition: transform .2s ease; z-index: 40; box-shadow: var(--shadow-lg); }
  body.nav-open .side { transform: none; }
  body.nav-open::after { content: ""; position: fixed; inset: 0; background: rgba(16, 24, 40, .3); z-index: 30; }
  .menu-btn { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); color: var(--ink); padding: 0; cursor: pointer; }
  .top { padding: 12px 16px; margin-bottom: 16px; display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; }
  .top h1 { font-size: 19px; }
  .top .sub { display: none; }
  .top-actions { grid-column: 1 / -1; }
  main { padding: 0 16px 40px; }
  .cols, .grid2, .grid3 { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .tbl-wrap { -webkit-overflow-scrolling: touch; }
  .span2 { grid-column: auto; }
  .f-row { grid-template-columns: 1fr 64px; gap: 4px 12px; }
  .f-track { grid-column: 1 / -1; grid-row: 2; }
  .panel, .funnel { padding: 16px; }
  .stages { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .chart-totals { gap: 18px; }
  .biz .biz-info { grid-template-columns: 1fr 1fr; }
  .biz .biz-info .wide { grid-column: 1 / -1; }
  .toolbar { padding: 12px; }
  .toolbar label:not(.search):not(.check) { flex: 1 1 140px; }
  .toolbar select { max-width: none; width: 100%; }
  .list-card .bulkbar { left: 50%; max-width: calc(100vw - 24px); flex-wrap: wrap; justify-content: center; bottom: 12px; }
  .list-card .bulkbar .div { display: none; }
}
@media (max-width: 560px) {
  .kpi-row { grid-template-columns: minmax(0, 1fr); }
  .kpi { border-left: 0 !important; }
  .kpi:nth-child(n+2) { border-top: 1px solid var(--line-soft); }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpis > div:nth-child(odd) { border-left: 0; }
  .kpis > div:nth-child(n+3) { border-top: 1px solid var(--line-soft); }
  .health li { grid-template-columns: 22px 1fr; }
  .health .det { grid-column: 2; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
