:root {
  --bg: #f5f6f4; --card: #ffffff; --ink: #0b0b0b; --ink-2: #52514e; --muted: #7a7974; --line: #e7e6e2; --line-2: #f0efec;
  --brand: #14808f; --brand-2: #0f6470; --brand-soft: #e4f2f4; --brand-ink: #fff;
  --critical: #d03b3b; --critical-soft: #fdeeee; --warning: #fab219; --warning-soft: #fff6e0; --good: #0ca30c; --good-soft: #e9f7e9;
  /* chart / status palette (validated categorical order) */
  --c-done: #2a78d6; --c-already: #eb6834; --c-noans: #1baf7a; --c-junk: #eda100; --c-fresher: #e87ba4; --c-none: #c3c2b7;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 1px 3px rgba(16, 24, 40, .06);
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font-size: 14px; line-height: 1.45; -webkit-font-smoothing: antialiased; }
a { color: var(--brand); text-decoration: none; }
h1 { font-size: 22px; margin: 0; letter-spacing: -.01em; }
h2 { font-size: 15px; margin: 0; font-weight: 600; }
h3 { font-size: 13px; margin: 0; font-weight: 600; color: var(--ink-2); }
button, input, select, textarea { font: inherit; color: inherit; }
input, select, textarea { border: 1px solid var(--line); border-radius: 10px; padding: 8px 11px; background: #fff; min-width: 0; }
textarea { resize: vertical; width: 100%; }
input:focus, select:focus, textarea:focus { outline: 3px solid var(--brand-soft); border-color: var(--brand); }

.btn { border: 1px solid var(--line); background: #fff; border-radius: 10px; padding: 8px 14px; cursor: pointer; font-weight: 500; white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; }
.btn:hover { background: #fafaf8; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn.primary:hover { background: var(--brand-2); }
.btn.big { padding: 12px 22px; font-size: 15px; font-weight: 600; }
.btn.sm { padding: 5px 10px; font-size: 13px; border-radius: 8px; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn:disabled { opacity: .5; cursor: default; }

/* ---------- shell ---------- */
.topbar { background: #fff; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 24px; padding: 0 24px; height: 60px; position: sticky; top: 0; z-index: 5; }
.logo { display: flex; align-items: center; gap: 9px; font-weight: 700; font-size: 16px; white-space: nowrap; }
.logo .brand { height: 24px; width: auto; display: block; }
.logo .crm { font-size: 11px; font-weight: 700; letter-spacing: .08em; color: var(--brand); background: var(--brand-soft); border-radius: 6px; padding: 2px 6px; }
.login .brand-lg { height: 40px; width: auto; display: block; margin: 0 auto 6px; }
.login .crm-sub { text-align: center; font-weight: 600; letter-spacing: .14em; font-size: 12px; color: var(--muted); margin-bottom: 14px; }
.nav { display: flex; gap: 2px; flex: 1; overflow-x: auto; }
.nav a { padding: 8px 13px; border-radius: 9px; color: var(--ink-2); font-weight: 500; white-space: nowrap; position: relative; }
.nav a:hover { background: var(--line-2); }
.nav a.on { background: var(--brand-soft); color: var(--brand); }
.nav a .dot { position: absolute; top: 6px; right: 5px; width: 7px; height: 7px; background: var(--critical); border-radius: 50%; }
.who { color: var(--ink-2); display: flex; gap: 10px; align-items: center; white-space: nowrap; }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; font-weight: 700; font-size: 13px; }
main { max-width: 1320px; margin: 0 auto; padding: 24px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.sub { color: var(--muted); margin-top: 3px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.section-title { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin: 28px 0 12px; flex-wrap: wrap; }
.section-title h2 { font-size: 17px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 16px; box-shadow: var(--shadow); }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.grid { display: grid; gap: 14px; }
.g-kpi { grid-template-columns: repeat(8, 1fr); margin-bottom: 16px; }
.g-kpi.five { grid-template-columns: repeat(5, 1fr); }
@media (max-width: 1180px) { .g-kpi { grid-template-columns: repeat(4, 1fr); } .g-kpi.five { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 640px) { .g-kpi, .g-kpi.five { grid-template-columns: repeat(2, 1fr); } .kpi .v { font-size: 24px; } }
.g-2 { grid-template-columns: 2fr 1fr; }
.g-2e { grid-template-columns: 1fr 1fr; }
@media (max-width: 980px) { .g-2, .g-2e { grid-template-columns: 1fr; } }

.kpi { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); position: relative; overflow: hidden; }
.kpi .k { color: var(--ink-2); font-size: 12px; font-weight: 500; display: flex; align-items: center; gap: 6px; }
.kpi .v { font-size: 28px; font-weight: 700; margin-top: 4px; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.kpi .d { color: var(--muted); font-size: 12px; margin-top: 1px; }
.swatch { width: 9px; height: 9px; border-radius: 3px; display: inline-block; flex: none; }

/* live / today */
.live { display: grid; grid-template-columns: 1.1fr 1.6fr; gap: 0; padding: 0; overflow: hidden; }
.live > div { padding: 20px; }
.live .today { background: linear-gradient(135deg, #14808f, #0d5964); color: #fff; }
.live .today .big { font-size: 46px; font-weight: 700; letter-spacing: -.03em; line-height: 1.1; }
.live .today .lbl { opacity: .85; font-weight: 500; }
.live .today .split { display: flex; gap: 16px; margin-top: 10px; flex-wrap: wrap; opacity: .95; font-size: 13px; }
.live .today .pulse { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #5eead4; margin-right: 6px; box-shadow: 0 0 0 0 rgba(94, 234, 212, .7); animation: pulse 2s infinite; }
@keyframes pulse { 70% { box-shadow: 0 0 0 8px rgba(94, 234, 212, 0); } 100% { box-shadow: 0 0 0 0 rgba(94, 234, 212, 0); } }
.live .send { display: flex; flex-direction: column; gap: 12px; justify-content: space-between; }
.live .state { font-size: 15px; }
.mini-stats { display: flex; gap: 22px; flex-wrap: wrap; }
.mini-stats div b { display: block; font-size: 20px; font-variant-numeric: tabular-nums; }
.mini-stats div span { color: var(--muted); font-size: 12px; }
@media (max-width: 820px) { .live { grid-template-columns: 1fr; } }

/* alerts */
.alerts { display: grid; gap: 10px; margin-bottom: 16px; }
.alert { border-radius: 12px; padding: 12px 14px; border: 1px solid; display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: start; }
.alert.error { background: var(--critical-soft); border-color: #f5c2c2; }
.alert.warn { background: var(--warning-soft); border-color: #f6dfa4; }
.alert.ok { background: var(--good-soft); border-color: #bfe5bf; grid-template-columns: auto 1fr; }
.alert .ic { font-size: 16px; line-height: 1.3; }
.alert b { display: block; }
.alert .det { color: var(--ink-2); font-size: 13px; }
.alert ul { margin: 6px 0 0; padding-left: 18px; font-size: 13px; color: var(--ink-2); }
.alert ul li span { color: var(--muted); }

/* range chips */
.seg { display: inline-flex; background: #fff; border: 1px solid var(--line); border-radius: 11px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg button { border: 0; background: transparent; padding: 6px 12px; border-radius: 8px; cursor: pointer; color: var(--ink-2); font-weight: 500; white-space: nowrap; }
.seg button.on { background: var(--ink); color: #fff; }

/* charts */
.chart-box { position: relative; height: 290px; }
.chart-box.tall { height: 340px; }
.chart-box.short { height: 240px; }
.donut-wrap { display: grid; grid-template-columns: 1fr; gap: 10px; }
.legend { display: flex; gap: 6px 14px; flex-wrap: wrap; font-size: 12px; color: var(--ink-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend b { color: var(--ink); font-variant-numeric: tabular-nums; }

/* tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 10px; border-bottom: 1px solid var(--line-2); vertical-align: top; }
th { font-size: 11.5px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; white-space: nowrap; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tbody tr:hover td { background: #fbfbfa; }
tr.click { cursor: pointer; }
tr.off td { opacity: .5; }
.err { color: var(--critical); font-size: 12px; }
.bar-cell { display: flex; height: 8px; border-radius: 4px; overflow: hidden; background: var(--line-2); min-width: 120px; gap: 2px; }
.bar-cell i { display: block; height: 100%; }

/* status tags & chips */
.tag { display: inline-flex; align-items: center; gap: 5px; border-radius: 999px; padding: 2px 9px; font-size: 12px; font-weight: 500; background: var(--line-2); color: var(--ink-2); white-space: nowrap; }
.tag i { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }
.tag.warn { background: var(--warning-soft); color: #8a5a00; }
.tag.bad { background: var(--critical-soft); color: var(--critical); }
.tag.on { background: var(--good-soft); color: #067306; }
.tag.src-Meta { background: #e8f1fc; color: #1c5cab; }
.tag.src-Google { background: #fdeee7; color: #b2471d; }
.tag.src-WA, .tag.src-WhatsApp { background: #e8f8ee; color: #128c4b; }
.pills { display: flex; flex-wrap: wrap; gap: 6px; font-weight: 400; }
.pills label { display: inline-flex !important; cursor: pointer; }
.pills input { position: absolute; opacity: 0; pointer-events: none; }
.pills span { border: 1.5px solid var(--line); border-radius: 999px; padding: 6px 12px; font-size: 13px; color: var(--ink-2); background: #fff; }
.pills input:checked + span { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 600; }
.pills.st span { display: inline-flex; align-items: center; gap: 6px; }
.pills.st span::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--sc); }
.pills.st input:checked + span { background: var(--sc); border-color: var(--sc); }
.pills.st input:checked + span::before { background: #fff; }
.pills input:focus-visible + span { outline: 3px solid var(--brand-soft); }
.chips { display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: 6px; }
.chip { border: 1.5px solid var(--line); background: #fff; border-radius: 10px; padding: 9px 6px; cursor: pointer; font-size: 13px; font-weight: 600; color: var(--ink-2); display: flex; align-items: center; justify-content: center; gap: 6px; }
.chip:hover { border-color: var(--sc); }
.chip i { width: 8px; height: 8px; border-radius: 50%; background: var(--sc); }
.chip.on { background: var(--sc); border-color: var(--sc); color: #fff; }
.chip.on i { background: #fff; }

/* ---------- telecaller ---------- */
.hello { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.tc-tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 16px; }
.tc-tab { border: 1.5px solid var(--line); background: #fff; border-radius: 14px; padding: 12px 14px; text-align: left; cursor: pointer; box-shadow: var(--shadow); }
.tc-tab .n { font-size: 26px; font-weight: 700; display: block; letter-spacing: -.02em; }
.tc-tab .l { color: var(--ink-2); font-weight: 500; font-size: 13px; }
.tc-tab .due { display: inline-block; margin-left: 6px; background: var(--critical); color: #fff; border-radius: 999px; font-size: 11px; padding: 1px 7px; vertical-align: middle; }
.tc-tab.on { border-color: var(--brand); background: var(--brand-soft); }
.tc-tab.on .n { color: var(--brand); }
@media (max-width: 520px) { .tc-tab { padding: 10px; } .tc-tab .n { font-size: 22px; } .tc-tab .l { font-size: 12px; } }
.help { background: #fff; border: 1px dashed #b9d9d4; border-radius: 12px; padding: 12px 14px; margin-bottom: 16px; display: flex; gap: 12px; align-items: flex-start; }
.help ol { margin: 4px 0 0; padding-left: 18px; color: var(--ink-2); }
.toolbar { display: flex; gap: 10px; align-items: center; justify-content: space-between; margin-bottom: 12px; flex-wrap: wrap; }
.toolbar input[type=search] { flex: 1; min-width: 200px; max-width: 420px; }

.leads { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); }
.lead { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; gap: 10px; box-shadow: var(--shadow); transition: opacity .25s, transform .25s; }
.lead.gone { opacity: 0; transform: scale(.97); }
.lead.overdue { border-color: #f5c2c2; box-shadow: 0 0 0 3px var(--critical-soft); }
.lead .top { display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; }
.lead .name { font-weight: 600; font-size: 16px; }
.lead .phone { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.lead .phone a.call { font-size: 17px; font-weight: 700; color: var(--ink); background: var(--line-2); padding: 6px 12px; border-radius: 10px; }
.lead .phone a.wa { background: #e8f8ee; color: #128c4b; padding: 6px 12px; border-radius: 10px; font-weight: 600; }
.lead dl { margin: 0; display: grid; gap: 7px; font-size: 13px; background: #fafaf8; border-radius: 10px; padding: 10px 12px; }
.lead dl > div { display: grid; gap: 1px; }
.lead dt { color: var(--muted); font-size: 12px; }
.lead dd { margin: 0; font-weight: 500; overflow-wrap: anywhere; }
.fu { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 13px; background: var(--warning-soft); border-radius: 10px; padding: 8px 12px; }
.fu.late { background: var(--critical-soft); color: var(--critical); }
.extra { font-size: 12px; color: var(--muted); }
.empty { text-align: center; padding: 40px 20px; color: var(--muted); }
.empty .e { font-size: 34px; }

/* sheet view (familiar for people coming from Google Sheets) */
.sheet td, .sheet th { border: 1px solid var(--line); padding: 6px 8px; font-size: 13px; }
.sheet th { background: #f3f3f1; position: sticky; top: 0; }
.sheet select, .sheet input { padding: 4px 6px; border-radius: 6px; font-size: 13px; width: 100%; }
.sheet .q { max-width: 180px; min-width: 110px; font-size: 12px; }
.sheet td.idx { color: var(--muted); background: #f8f8f6; text-align: center; }

/* ---------- modal & toast ---------- */
.modal-bg { position: fixed; inset: 0; background: rgba(15, 23, 42, .45); display: grid; place-items: center; z-index: 20; padding: 16px; }
.modal { background: #fff; border-radius: 16px; padding: 22px; width: 100%; max-width: 480px; max-height: 92vh; overflow: auto; box-shadow: 0 20px 50px rgba(0,0,0,.2); }
.modal.wide { max-width: 760px; }
.modal h2 { margin-bottom: 14px; font-size: 17px; }
.form { display: grid; gap: 12px; }
.form label { display: grid; gap: 5px; font-weight: 500; font-size: 13px; }
.form .fld { display: grid; gap: 6px; font-weight: 500; font-size: 13px; }
.form label.check { display: flex; gap: 8px; align-items: center; font-weight: 400; }
.form .actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; }
.opt-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.opt-grid .btn { justify-content: center; padding: 12px; }
.timeline { list-style: none; margin: 0; padding: 0; border-left: 2px solid var(--line); }
.timeline li { padding: 0 0 12px 14px; position: relative; font-size: 13px; }
.timeline li::before { content: ""; position: absolute; left: -6px; top: 4px; width: 10px; height: 10px; border-radius: 50%; background: var(--brand); border: 2px solid #fff; }
.kv { display: grid; grid-template-columns: 150px 1fr; gap: 6px 12px; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 11px 18px; border-radius: 12px; z-index: 30; max-width: 92vw; box-shadow: 0 8px 24px rgba(0,0,0,.25); display: flex; gap: 14px; align-items: center; }
.toast.bad { background: var(--critical); }
.toast button { background: transparent; border: 1px solid rgba(255,255,255,.4); color: #fff; border-radius: 8px; padding: 3px 10px; cursor: pointer; font-weight: 600; }

/* login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; background: radial-gradient(circle at 20% 10%, #dff1ee, transparent 50%), var(--bg); }
.login .card { width: 100%; max-width: 380px; padding: 30px; }

.switch { position: relative; display: inline-block; width: 38px; height: 22px; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: #cfcfca; border-radius: 22px; cursor: pointer; transition: .15s; }
.switch span::before { content: ""; position: absolute; width: 16px; height: 16px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .15s; }
.switch input:checked + span { background: var(--brand); }
.switch input:checked + span::before { transform: translateX(16px); }

.pager { display: flex; justify-content: space-between; align-items: center; margin-top: 12px; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.search-big { display: flex; gap: 8px; margin-bottom: 12px; }
.search-big input { flex: 1; font-size: 15px; padding: 11px 14px; }

@media (max-width: 720px) {
  .topbar { flex-wrap: wrap; height: auto; padding: 10px 16px; gap: 8px; }
  .logo { flex: 1; }
  .nav { order: 3; flex: 0 0 100%; }
  .who .nm { display: none; }
  main { padding: 16px; }
  .leads { grid-template-columns: 1fr; }
  .kv { grid-template-columns: 1fr; }
}

/* dashboard channel tabs */
.kind-tabs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-bottom: 16px; max-width: 640px; }
.kind-tabs button { border: 1.5px solid var(--line); background: #fff; border-radius: 12px; padding: 11px 14px; font-weight: 600; cursor: pointer; color: var(--ink-2); box-shadow: var(--shadow); }
.kind-tabs button:hover { border-color: #cfcfca; }
.kind-tabs button.on { background: var(--ink); border-color: var(--ink); color: #fff; }
.live .today.wa { background: linear-gradient(135deg, #128c4b, #0b6b39); }
.live .send h3 { margin-bottom: 4px; }

/* telecaller: leads received by segment */
.seg-card { padding: 14px 16px; }
.segs { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.segbox { border: 1.5px solid var(--line); background: #fff; border-radius: 12px; padding: 10px 12px; text-align: left; cursor: pointer; display: grid; gap: 1px; }
.segbox:hover { border-color: #cfcfca; }
.segbox .nm { font-weight: 600; color: var(--ink-2); font-size: 13px; }
.segbox .n { font-size: 22px; font-weight: 700; letter-spacing: -.02em; }
.segbox .mini { font-size: 11.5px; color: var(--muted); }
.segbox.on { border-color: var(--brand); background: var(--brand-soft); }
.segbox.on .n { color: var(--brand); }
@media (max-width: 520px) { .segs { grid-template-columns: repeat(2, 1fr); } }

/* lead quality */
.q-poor { background: var(--critical-soft); color: var(--critical); }
.q-watch { background: var(--warning-soft); color: #8a5a00; }
.q-good { background: var(--good-soft); color: #067306; }
.q-na { background: var(--line-2); color: var(--muted); }
.q-reasons { font-size: 11.5px; color: var(--ink-2); margin-top: 3px; }
.pct { font-variant-numeric: tabular-nums; }
.pct.bad { color: var(--critical); font-weight: 600; }
table.tight th, table.tight td { padding: 8px 6px; }
/* ---------- phones: tables become cards, nothing wider than the screen ---------- */
.grid > * { min-width: 0; }
@media (max-width: 640px) {
  .seg { flex-wrap: nowrap; overflow-x: auto; max-width: 100%; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
  .seg::-webkit-scrollbar { display: none; }
  .row > .seg, .toolbar > *, .row > * { min-width: 0; max-width: 100%; }
  .row > .seg { flex: 1 1 auto; }
  .page-head .row, .section-title .row { width: 100%; }
  .card { padding: 14px; }
  .table-wrap:has(> table.mstack), .card.table-wrap:has(table.mstack) { overflow: visible; }
  table.mstack, table.mstack tbody, table.mstack tfoot { display: block; width: 100%; }
  table.mstack thead { display: none; }
  table.mstack tr { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 12px; padding: 8px 12px; margin-bottom: 10px; background: #fff; }
  /* label on the left, everything in the cell stacked on the right */
  table.mstack td { display: grid; grid-template-columns: minmax(0, 38%) minmax(0, 1fr); column-gap: 12px; row-gap: 2px; align-items: start;
    padding: 5px 0; border: 0; text-align: right; min-width: 0 !important; max-width: none !important; }
  table.mstack td > * { grid-column: 2; justify-self: end; max-width: 100%; }
  table.mstack td::before { content: attr(data-label); grid-column: 1; grid-row: 1 / span 6; text-align: left; color: var(--muted); font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .03em; padding-top: 2px; }
  table.mstack td[data-label=""] { display: block; }
  table.mstack td[data-label=""]::before { display: none; }
  table.mstack td.row { display: flex; justify-content: flex-end; gap: 8px; }
  table.mstack td.row::before { display: none; }
  table.mstack td:empty, table.mstack td.row:empty { display: none; }
  table.mstack td.mtitle { order: -1; display: block; text-align: left; font-size: 15px; padding-bottom: 8px; margin-bottom: 4px; border-bottom: 1px solid var(--line-2); }
  table.mstack td.mtitle::before { display: none; }
  table.mstack td.mtitle > * { max-width: none; justify-self: auto; }
  table.mstack td[colspan] { display: block; text-align: center; }
  table.mstack td[colspan]::before { display: none; }
  table.mstack tbody tr:hover td { background: transparent; }
  table.mstack tr.click:active { background: var(--line-2); }
  table.mstack tfoot tr.tot { background: #f6f6f3; }
  table.mstack tfoot tr.tot td { background: transparent; border-top: 0; }
  table.mstack .bar-cell { min-width: 140px; }
  table.mstack select { max-width: 100%; }
  .modal { padding: 16px; }
  .modal .kv { grid-template-columns: 1fr; }
  .toolbar input[type=search] { min-width: 0; max-width: none; width: 100%; }
  .search-big { flex-wrap: wrap; }
}
/* table footer totals */
tfoot tr.tot td { font-weight: 700; background: #f6f6f3; border-top: 2px solid var(--line); border-bottom: 0; }
tfoot tr.tot:hover td { background: #f6f6f3; }
/* settings: lead quality limits */
.qgrid { display: grid; grid-template-columns: minmax(180px, 1.3fr) 1fr 1fr; gap: 8px 14px; align-items: center; font-size: 13px; }
.qgrid .qh { font-weight: 600; }
.qgrid .ql { color: var(--ink-2); }
.qin { display: inline-flex; align-items: center; gap: 4px; }
.qin input { width: 70px; padding: 6px 8px; }
@media (max-width: 600px) { .qgrid { grid-template-columns: 1fr 1fr 1fr; } }
/* distribution editor rows */
.drow { display: flex; gap: 8px; align-items: center; margin-bottom: 6px; }
.drow select, .drow input { flex: 1; min-width: 0; }
.drow .pctin { display: inline-flex; align-items: center; gap: 4px; flex: 0 0 auto; }
.drow .pctin input { width: 70px; flex: none; }
.drow input[data-cap] { flex: 0 0 100px; }
.drow [data-op] { flex: 0 0 120px; }
@media (max-width: 600px) { .drow { flex-wrap: wrap; } }
table.tight select { max-width: 120px; padding: 5px 6px; }
table.tight td:nth-child(2) { min-width: 150px; }
table.tight .q-reasons { max-width: 170px; }
