:root {
  --bg: #fafafa; --card: #ffffff; --text: #111318; --muted: #6b7079; --line: #ebecef;
  --accent: #c9961f; --accent-soft: #f3e6c4; --ink: #111318; --ink-text: #ffffff;
  --danger: #c4372b; --warn-bg: #fbf3e0; --warn: #8a5a00;
  --ok: #c9961f; --chip: #f2f3f5; --code: #f2f3f5;
  --s2: #8b909a; --s3: #c3c7ce; --s4: #e1e3e7;
  /* the brand frame (Odin Tech logo): navy with the raven's yellow and the cream of its letters */
  --brand-bg: #0c1220; --brand-raise: #16203a; --brand-text: #efe8d6; --brand-muted: #8d97ad; --brand-line: #222c45;
  --brand-yellow: #f2b52d;
  color-scheme: light dark;
}
/* dark: the device's setting (auto), unless the theme button chose light; or chosen by the button */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b0d14; --card: #11141c; --text: #e9eaee; --muted: #8c919c; --line: #1f2330;
    --accent: #e8b43c; --accent-soft: #3a3020; --ink: #e9eaee; --ink-text: #0b0d14;
    --danger: #f0786c; --warn-bg: #2a2214; --warn: #f0c060;
    --ok: #e8b43c; --chip: #1a1e28; --code: #1a1e28;
    --s2: #9aa0ab; --s3: #5a606c; --s4: #2c313d;
  }
}
:root[data-theme="dark"] {
  --bg: #0b0d14; --card: #11141c; --text: #e9eaee; --muted: #8c919c; --line: #1f2330;
  --accent: #e8b43c; --accent-soft: #3a3020; --ink: #e9eaee; --ink-text: #0b0d14;
  --danger: #f0786c; --warn-bg: #2a2214; --warn: #f0c060;
  --ok: #e8b43c; --chip: #1a1e28; --code: #1a1e28;
  --s2: #9aa0ab; --s3: #5a606c; --s4: #2c313d;
  color-scheme: dark;
}
:root[data-theme="light"] { color-scheme: light; }
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; -webkit-font-smoothing: antialiased; }
h1 { font-size: 1.4rem; margin: 0 0 .25rem; }
h2 { font-size: 1rem; font-weight: 600; margin: 0 0 .9rem; }
h3 { font-size: .95rem; margin: 0 0 .5rem; }
code, pre { background: var(--code); border-radius: 4px; padding: 0 .3em; font-size: .85em; }
pre { padding: .5rem; white-space: pre-wrap; margin: .3rem 0 0; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.error { color: var(--danger); min-height: 1.2em; }
.grow { flex: 1; }
[hidden] { display: none !important; }

input, select, textarea, button, .button {
  font: inherit; color: inherit; background: var(--card); border: 1px solid var(--line);
  border-radius: 8px; padding: .45rem .7rem;
}
input, select, textarea { width: 100%; }
textarea { resize: vertical; }
button, .button { cursor: pointer; white-space: nowrap; display: inline-block; }
button:hover, .button:hover { border-color: var(--muted); }
button.primary { background: var(--ink); color: var(--ink-text); border-color: var(--ink); }
button.danger { color: var(--danger); }
button.ghost { background: transparent; }
button.small, .small button { padding: .2rem .5rem; font-size: .85rem; }
button.chip { background: var(--chip); border: 0; padding: .05rem .4rem; font-size: .85rem; }
label { display: block; font-size: .9rem; }
label input, label select, label textarea { margin-top: .2rem; }
label input[type=checkbox], label input[type=radio] { width: auto; margin: 0 .4rem 0 0; vertical-align: middle; }

.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 1.2rem 1.3rem; margin-bottom: 1rem; }
.narrow { width: 100%; max-width: 380px; display: grid; gap: .6rem; }

.top { display: flex; align-items: center; gap: .75rem; padding: .7rem 16px; background: var(--card); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: .55rem; font-weight: 650; letter-spacing: -.01em; }
.logo { width: 34px; height: 34px; display: none; }
.logo-big { width: 190px; height: auto; justify-self: center; }
.login h1 { text-align: center; }
.top select { width: auto; }
.theme-btn { width: 2.2rem; height: 2.1rem; padding: 0; display: inline-grid; place-items: center; }
.top .theme-btn { padding: 0; }
.theme-fixed { position: fixed; top: 12px; right: 16px; }
.banner { background: var(--warn-bg); color: var(--warn); padding: .6rem 16px; font-weight: 600; }
.tabs { display: flex; flex-wrap: wrap; gap: .1rem 2rem; padding: .6rem 16px 0; max-width: 1360px; margin: 0 auto; }
.tab-group { display: flex; align-items: baseline; gap: .15rem; }
.tab-group:not(:has(button[data-tab]:not([hidden]))) { display: none; }
.tab-group-label { color: var(--muted); font-size: .78rem; margin-right: .2rem; }
.tabs button { border: 0; background: transparent; border-bottom: 2px solid transparent; border-radius: 0; color: var(--muted); }
.tabs button:hover { color: var(--text); }
.tabs button.active { border-bottom-color: var(--accent); color: var(--text); font-weight: 600; }
main { padding: 1rem 16px; max-width: 1360px; margin: 0 auto; }

.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(210px, 100%), 1fr)); gap: 1rem; }
.stat { display: grid; gap: .15rem; }
.label { display: block; font-size: .9rem; font-weight: 600; color: var(--text); margin-bottom: .6rem; }
.stat .big { font-size: 1.8rem; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.stat .label { margin-bottom: 0; }
.rules { margin: 0; padding-left: 1.2rem; }
.events { list-style: none; margin: 0; padding: 0; max-height: 300px; overflow: auto; font-size: .9rem; }
.events li { padding: .25rem 0; border-bottom: 1px solid var(--line); }

.row { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; margin: .5rem 0; }
.row input { flex: 1; min-width: 160px; width: auto; }
.row input[type=checkbox], .row input[type=radio] { flex: none; min-width: 0; width: auto; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(200px, 100%), 1fr)); gap: .6rem 1rem; }

.qr { text-align: center; padding: 1rem; }
.qr img { width: 288px; height: 288px; max-width: 100%; background: #fff; padding: 16px; border-radius: 12px; image-rendering: pixelated;
  box-shadow: 0 0 0 1px var(--line); }   /* a white quiet zone: phones read it faster */

.compose-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 1.5rem; }
@media (max-width: 800px) { .compose-grid { grid-template-columns: minmax(0, 1fr); } }
.lead-list { max-height: 340px; overflow: auto; border: 1px solid var(--line); border-radius: 8px; }
.lead-list:empty { display: none; }
.lead { display: flex; gap: .5rem; align-items: baseline; padding: .35rem .6rem; border-bottom: 1px solid var(--line); font-size: .9rem; overflow-wrap: anywhere; }
.lead input { width: auto; flex: none; }
.previews { display: grid; gap: .5rem; max-height: 480px; overflow: auto; }
.preview-item { border-left: 3px solid var(--ok); padding-left: .6rem; }
.preview-item.rejected { border-left-color: var(--danger); }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { text-align: left; padding: .4rem .5rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: .8rem; }
td.detail { max-width: 320px; color: var(--muted); overflow-wrap: anywhere; }
.pill { padding: .05rem .5rem; border-radius: 99px; background: var(--chip); font-size: .8rem; white-space: nowrap; }
.pill.sent { color: var(--ok); }
.pill.opened { color: var(--ok); font-weight: 600; }
.pill.score.good { color: var(--ok); } .pill.score.ok { color: var(--warn); } .pill.score.risky { color: var(--danger); }
.t-perf .perf-text { max-width: 28rem; white-space: pre-line; font-size: .9rem; }
.pill.failed, .pill.not_on_whatsapp { color: var(--danger); }
.secret { background: var(--warn-bg); color: var(--warn); padding: .6rem; border-radius: 8px; word-break: break-all; font-family: ui-monospace, monospace; }
.pill.pending { color: var(--warn); }
.pill.done { color: var(--ok); font-weight: 600; }
.pill.no_reply, .pill.opted_out { color: var(--muted); }

/* guided setup */
.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: .6rem; }
.steps li { display: flex; align-items: center; gap: .8rem; padding: .6rem; border: 1px solid var(--line); border-radius: 10px; }
.steps li div { flex: 1; }
.steps .tick { width: 1.6rem; height: 1.6rem; border-radius: 50%; border: 2px solid var(--line); flex: none; display: grid; place-items: center; }
.steps li.done .tick { background: var(--ok); border-color: var(--ok); }
.steps li.done .tick::after { content: "✓"; color: var(--card); font-weight: 700; }
.steps li.done button { display: none; }
.ok-box { padding: .5rem 0; }
.big-ok { font-size: 1.35rem; font-weight: 700; color: var(--ok); }
.choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr)); gap: .8rem; margin: .8rem 0; }
.choice { display: grid; gap: .25rem; text-align: left; padding: 1rem; white-space: normal; border-radius: 12px; }
.choice .icon { font-size: 1.6rem; line-height: 1; }
.flow { border-top: 1px solid var(--line); padding-top: .8rem; margin-top: .4rem; display: grid; gap: .6rem; max-width: 520px; }
.howto { margin: 0; padding-left: 1.3rem; display: grid; gap: .3rem; }
.code { font: 700 2rem/1.2 ui-monospace, monospace; letter-spacing: .15em; padding: .6rem 1rem; background: var(--chip); border-radius: 10px; text-align: center; }
.connect { display: grid; gap: .7rem; max-width: 460px; }
.provider { background: var(--chip); border-radius: 10px; padding: .6rem .8rem; }
.provider p { margin: .3rem 0; }
.big-btn { padding: .7rem 1rem; font-size: 1.05rem; }
.result-box { padding: .6rem .8rem; border-radius: 8px; background: var(--chip); }
.result-box.ok { color: var(--ok); font-weight: 600; }
.result-box.bad { color: var(--danger); }
/* email score */
.score-box { border: 1px solid var(--line); border-radius: 10px; padding: .8rem .9rem; margin-top: .6rem; display: grid; gap: .4rem; }
.score-problems { margin: 0; padding-left: 1.2rem; display: grid; gap: .2rem; }

/* charts */
.grid.two { grid-template-columns: repeat(auto-fit, minmax(min(320px, 100%), 1fr)); }
.grid.tiles { margin-bottom: 1rem; }
.grid.tiles .card { margin-bottom: 0; }
.grid + .grid, .grid + .card { margin-top: 0; }
.grid > .card { margin-bottom: 0; }
.grid { margin-bottom: 1rem; }
.today { display: grid; justify-items: center; gap: .3rem; text-align: center; }
.today .label { justify-self: start; }
.ring { width: 150px; height: 150px; display: block; }
.ring circle { fill: none; stroke-width: 7; }
.ring .track { stroke: var(--chip); }
.ring .fill { stroke: var(--accent); stroke-linecap: round; }
.ring-num { fill: var(--text); font-size: 19px; font-weight: 600; font-variant-numeric: tabular-nums; }
.dot { display: inline-block; width: .5rem; height: .5rem; border-radius: 50%; background: var(--s3); margin-right: .4rem; vertical-align: middle; }
.dot.on { background: var(--accent); }
.dot.bad { background: var(--danger); }
.meters { display: grid; gap: 1.1rem; }
.row-meters { grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr)); gap: 1.1rem 2rem; }
.meter { display: grid; gap: .35rem; }
.meter-head { display: flex; justify-content: space-between; align-items: baseline; font-size: .9rem; }
.meter-head strong { font-size: 1.6rem; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.bar { height: 6px; background: var(--chip); border-radius: 99px; overflow: hidden; }
.bar span { display: block; height: 100%; width: 0; background: var(--accent); border-radius: 99px; }
.total { font-size: 1.8rem; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: -.02em; margin-bottom: .5rem; }
.stack { display: flex; height: 10px; border-radius: 99px; overflow: hidden; gap: 2px; background: var(--chip); }
.seg { display: block; min-width: 3px; }
.legend { list-style: none; margin: .8rem 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: .35rem 1.1rem; font-size: .82rem; color: var(--muted); }
.legend strong { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
.sw { display: inline-block; width: .6rem; height: .6rem; border-radius: 2px; margin-right: .35rem; vertical-align: baseline; background: var(--s4); }
.s-sent, .s-done { background: var(--accent); }
.s-pending { background: var(--ink); }
.s-queued { background: var(--s2); }
.s-no_reply, .s-skipped, .s-stopped { background: var(--s3); }
.s-opted_out, .s-cancelled { background: var(--s4); }
.s-failed, .s-not_on_whatsapp { background: var(--danger); }
.alloc-row { display: grid; gap: .35rem; margin-top: 1rem; }
.a-0 { background: var(--accent); } .a-1 { background: var(--ink); } .a-2 { background: var(--s2); } .a-3 { background: var(--s3); }
.a-free { background: var(--s4); }
.uc-rings { margin: .4rem 0 1.2rem; }
.mix-row { display: flex; flex-wrap: wrap; align-items: center; gap: 1.2rem 2rem; margin-top: .6rem; }
.donut { width: 170px; height: 170px; flex: none; }
.donut circle { fill: none; stroke-width: 14; }
.donut .track { stroke: var(--chip); }
.donut-num { font-size: 15px; font-weight: 700; fill: var(--text); }
.donut-sub { font-size: 7px; fill: var(--muted); }
.mix-legend { flex-direction: column; margin: 0; }
.m-confirmed { background: var(--accent); stroke: var(--accent); }
.m-unknown { background: var(--warn); stroke: var(--warn); }
.m-pending { background: var(--s2); stroke: var(--s2); }
.m-unconfirmed { background: var(--s3); stroke: var(--s3); }
.m-invalid { background: var(--danger); stroke: var(--danger); }
.m-email { background: var(--ink); stroke: var(--ink); }
.cat-0 { background: var(--accent); stroke: var(--accent); }
.cat-1 { background: var(--ink); stroke: var(--ink); }
.cat-2 { background: #2f8f83; stroke: #2f8f83; }
.cat-3 { background: #c4372b; stroke: #c4372b; }
.cat-4 { background: #4a6fd1; stroke: #4a6fd1; }
.cat-5 { background: #8a5cc4; stroke: #8a5cc4; }
.cat-6 { background: #d97a2b; stroke: #d97a2b; }
.cat-7 { background: #5aa457; stroke: #5aa457; }
.cat-8 { background: var(--s3); stroke: var(--s3); }
.empty-chart { margin: 0; }
.columns { width: 100%; height: auto; display: block; }
.columns .axis { stroke: var(--line); stroke-width: 1; }
.columns .tick { fill: var(--muted); font-size: 11px; }
.c-wa { fill: var(--accent); background: var(--accent); }
.c-em { fill: var(--s2); background: var(--s2); }
.pill.checking, .pill.rechecking { color: var(--warn); }
.pill.not_reachable { color: var(--danger); }
.pill.unconfirmed { color: var(--muted); }

/* pipeline board: columns scroll sideways inside the board, never the page */
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(190px, 1fr); gap: .8rem; overflow-x: auto; padding-bottom: .6rem; align-items: start; }
.pcol { background: var(--chip); border-radius: 12px; padding: .6rem; min-height: 120px; border: 1px dashed transparent; border-top: 3px solid var(--stage, var(--line)); }
.pcol.over { border-color: var(--accent); }
.pcol header { display: flex; justify-content: space-between; font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; font-weight: 600; padding: .1rem .2rem .5rem; }
.pcol.st-won header span:first-child { color: var(--accent); }
.pcol.st-lost header span:first-child { color: var(--muted); }
.pcards { display: grid; gap: .5rem; max-height: 65vh; overflow-y: auto; }
.pcard { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: .55rem .65rem; display: grid; gap: .3rem; cursor: grab; }
.pcard.dragging { opacity: .5; }
.chips { display: flex; flex-wrap: wrap; gap: .25rem; }
.chips:empty { display: none; }
.pcard-fields { display: grid; gap: .3rem; font-size: .85rem; }
.pl-summary { display: grid; gap: .3rem; margin: .4rem 0 .7rem; }
.pl-strip { display: flex; gap: 2px; height: 8px; border-radius: 99px; overflow: hidden; }
.pl-strip span { flex: 1 1 0; min-width: 4px; background: var(--stage, var(--accent)); }
dialog.crm { max-width: 720px; width: calc(100% - 32px); max-height: calc(100vh - 32px); overflow-y: auto; border: 1px solid var(--line); border-radius: 10px; padding: 16px; background: var(--card); color: inherit; }
dialog.crm::backdrop { background: rgba(0, 0, 0, .45); }
dialog.crm h3 { margin: 1rem 0 .4rem; }
.cz-row { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; padding: .25rem 0; }
.cz-row input:not([type=checkbox]):not([type=color]), .cz-row select { flex: 1 1 130px; width: auto; min-width: 0; margin: 0; }
.cz-row input.cz-num { flex: 0 0 72px; }
.cz-row input[type=color] { flex: none; width: 32px; height: 32px; padding: 2px; }
.cz-add { border-top: 1px solid var(--line); margin-top: .3rem; padding-top: .5rem; }
.cz-move { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; padding: .25rem 0 .5rem; }
.cz-move select { width: auto; }
.wf-slot { display: contents; }
.wf-item { border-top: 1px solid var(--line); padding: .5rem 0; }
label.check { display: inline-flex; gap: .3rem; align-items: center; }
.tasks { list-style: none; margin: 0; padding: 0; }
.task { display: flex; gap: .6rem; align-items: center; padding: .4rem 0; border-top: 1px solid var(--line); }
.rp-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(160px, 100%), 1fr)); gap: .8rem; margin-bottom: 1rem; }
.rp-tiles .card { margin: 0; padding: .8rem 1rem; }
.rp-tiles .big { font-size: 1.3rem; overflow-wrap: anywhere; }
.rp-bars { display: grid; gap: .35rem; }
.rp-row { display: grid; grid-template-columns: minmax(90px, 200px) 1fr minmax(70px, auto); gap: .6rem; align-items: center; }
.rp-bar { height: 12px; background: var(--chip); border-radius: 99px; overflow: hidden; }
.rp-bar span { display: block; height: 100%; min-width: 2px; background: var(--stage, var(--accent)); }
.pcard-head { display: flex; justify-content: space-between; gap: .5rem; align-items: baseline; }
.pcard-head strong { font-size: .9rem; overflow-wrap: anywhere; }
.pvalue { font-size: .8rem; font-weight: 600; color: var(--accent); white-space: nowrap; }
.pnote { margin: 0; white-space: pre-wrap; }
.preply { margin: 0; color: var(--muted); font-style: italic; }
.pcard-foot { display: grid; gap: .35rem; }
.pcard-foot select { width: 100%; }
.pcard details { display: grid; gap: .35rem; }
.pcard details[open] > * + * { margin-top: .35rem; }
.filters select { flex: 1; min-width: 140px; width: auto; }
.fu-when input { width: 4.5rem; min-width: 0; flex: none; }
.fu { border: 1px solid var(--line); border-radius: 10px; padding: .3rem .8rem .7rem; margin: .6rem 0; min-width: 0; }
.fu legend { padding: 0 .3rem; font-weight: 600; }
.fu-opts { display: grid; gap: .5rem; }
.fu-opts p, .fu-off-note { margin: 0; }
label select.fu-count { width: auto; margin: 0 0 0 .4rem; }
.known { margin: .2rem 0 .8rem; }
.known p { margin: .3rem 0; }
.known ul { margin: .2rem 0; padding-left: 1.2rem; display: grid; gap: .15rem; }
.edit-row td { background: var(--chip); }
.edit-row input { min-width: 140px; }
.tag { display: inline-block; font-size: .7rem; font-weight: 600; padding: 0 .4rem; border-radius: 99px; margin-left: .25rem; vertical-align: middle; white-space: nowrap; border: 1px solid var(--line); color: var(--muted); }
.tag-you { color: var(--accent); border-color: var(--accent); }
.cat-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(220px, 100%), 1fr)); gap: .2rem .8rem; max-height: 320px; overflow: auto; margin-bottom: .6rem; }
.cat { display: flex; align-items: center; gap: .3rem; font-size: .88rem; }
.cat input { width: auto; }
.cat-remove { padding: 0 .4rem; margin-left: .2rem; line-height: 1.3; }
#ext-form select { flex: 1; min-width: 150px; width: auto; }

/* sending limits: the risk scale (the level colours the bar and the label) */
.risk { display: grid; gap: .4rem; margin-bottom: 1rem; }
.risk-head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; flex-wrap: wrap; }
.risk-head strong { font-size: 1.3rem; font-weight: 650; text-transform: capitalize; }
.risk .bar { height: 10px; }
.risk-scale { display: flex; justify-content: space-between; font-size: .75rem; color: var(--muted); }
.risk-low { --risk: var(--accent); }
.risk-medium { --risk: var(--warn); }
.risk-high, .risk-very-high { --risk: var(--danger); }
.risk .bar span { background: var(--risk); }
.risk-head strong { color: var(--risk); }
.risk ul { margin: .2rem 0 0; padding-left: 1.2rem; font-size: .9rem; }
#lim-form fieldset { border: 1px solid var(--line); border-radius: 10px; padding: .6rem .9rem .9rem; margin: 0 0 .8rem; min-width: 0; }
#lim-form legend { font-weight: 600; font-size: .9rem; padding: 0 .3rem; }
#lim-form input:disabled { opacity: .7; }
.days { display: flex; flex-wrap: wrap; gap: .3rem 1rem; margin-top: .7rem; }
.days label { display: flex; align-items: center; gap: .3rem; }
.days input { width: auto; margin: 0; }
.send-state { color: var(--muted); max-width: 22em; }
.send-state.blocked { color: var(--warn); font-weight: 600; }
.danger-zone h2 { color: var(--danger); }
/* lead details */
#lead-dialog { max-width: 640px; width: calc(100% - 32px); border: 1px solid var(--line, #ccc); border-radius: 10px; padding: 16px; background: var(--card, #fff); color: inherit; }
#lead-dialog::backdrop { background: rgba(0, 0, 0, .45); }
#rec-dialog { max-width: 720px; width: calc(100% - 32px); max-height: calc(100vh - 32px); overflow-y: auto; border: 1px solid var(--line);
  border-radius: 10px; padding: 16px; background: var(--card); color: var(--text); }
#rec-dialog::backdrop { background: rgba(0, 0, 0, .45); }
#rec-dialog h3 { margin: 1rem 0 .4rem; }
#rec-dialog .form-grid + label { margin-top: .6rem; }
#rec-dialog label .row { margin: .2rem 0 0; flex-wrap: nowrap; }
#rec-dialog label .row input { margin-top: 0; min-width: 0; }
#rec-msg.error { color: var(--danger); }
.ul-filters select, .ul-bulk select { width: auto; max-width: 100%; }
.t-ul a.tel { white-space: nowrap; }
.pill.callback { color: var(--warn); }
.rec-cell { min-width: 12rem; }
.rec-cell .rec-note { max-width: 18rem; overflow-wrap: anywhere; }
.rec-gaps { display: flex; flex-wrap: wrap; gap: .25rem; margin-top: .25rem; }
button.link { background: none; border: 1px dashed var(--line); color: var(--muted); padding: .05rem .4rem; }
button.link:hover { color: var(--text); border-style: solid; }
.pill.callback.due { color: var(--danger); font-weight: 600; }
#lead-body dl { display: grid; grid-template-columns: max-content 1fr; gap: 4px 12px; margin: 8px 0; }
#lead-body dt { color: var(--muted, #777); }
#lead-body dd { margin: 0; overflow-wrap: anywhere; }
#lead-body h3 { margin: 14px 0 4px; font-size: 1em; }
#lead-body .locked { border-left: 3px solid var(--warn, #8a5a00); padding: 6px 10px; background: var(--warn-bg, #fbf3e0); }
button.info { padding: 0 6px; min-width: 0; line-height: 1.4; font-size: .9em; }
.msg-body { white-space: pre-wrap; max-height: 40vh; overflow: auto; margin: 0; padding: .6rem; }
.acts { display: flex; gap: .4rem; flex: 1 1 100%; }
.acts button { flex: 1 1 0; }
.remember-note { margin: -.3rem 0 0; }
.dev-banner { background: var(--danger); color: #fff; }
.card.history { border-color: var(--accent); background: var(--accent-soft); }
.card.history p { margin: .3rem 0; }
.dev-hours { margin: .3rem 0 0 1.6rem; }
.row.dev-hours > input { flex: none; width: 5.5rem; min-width: 0; }
.optout-admin { border: 1px dashed var(--line); border-radius: 10px; padding: .5rem .8rem; margin-bottom: .8rem; }
.optout-admin p { margin: .2rem 0 0; }

/* phones: header on one line, tabs wrap, toolbars stack, tables become one card per row */
@media (max-width: 640px) {
  body { font-size: 15px; }
  input, select, textarea { font-size: 16px; }   /* 16px: iPhone does not zoom in on focus */
  main { padding: .8rem 12px; }
  .card { padding: 1rem; border-radius: 12px; }

  .top { gap: .4rem; padding: .5rem 12px; flex-wrap: nowrap; }
  .top .brand-name, #who { display: none; }
  .top button { padding: .35rem .6rem; font-size: .88rem; }
  .top select { min-width: 0; flex: 1 1 auto; font-size: .9rem; padding: .35rem .5rem; }
  .top:has(#client-pick:not([hidden])) { flex-wrap: wrap; }
  .top #client-pick { order: 5; flex: 1 1 100%; }                 /* the admin's client picker: its own line */
  .top button, .row > button { white-space: normal; }
  .theme-fixed { top: 8px; right: 12px; }

  .tabs { flex-wrap: wrap; gap: .35rem; padding: .6rem 12px .2rem; overflow: visible; }
  .tab-group { flex-wrap: wrap; gap: .35rem; }
  .tabs button { border: 1px solid var(--line); border-radius: 99px; padding: .3rem .8rem; font-size: .9rem; background: var(--card); }
  .tabs button.active { border-color: var(--accent); background: var(--accent-soft); color: var(--text); }

  .row > h2.grow, .row > h2 { flex: 1 1 100%; margin-bottom: 0; }
  .row > input, .row > input[type=search] { flex: 1 1 100%; min-width: 0; }
  .row > select, .filters select, #ext-form select { flex: 1 1 calc(50% - .5rem); min-width: 0; }
  .row > button { flex: 1 1 auto; }
  .row.small > button { flex: 0 1 auto; }
  .fu-when { gap: .3rem .4rem; }
  .row.fu-when > input { flex: none; width: 3.6rem; }
  .row > input.lead-q[type=search] { flex: 1 1 0; }
  .row > .lead-search { flex: none; }

  .steps li { flex-wrap: wrap; gap: .5rem .8rem; }
  .steps li div { flex: 1 1 calc(100% - 2.6rem); }
  .steps li button { flex: 1 1 100%; }

  .stat .big, .total, .meter-head strong { font-size: 1.5rem; }
  .ring { width: 130px; height: 130px; }
  .qr img { width: 240px; height: 240px; }
  .code { font-size: 1.6rem; }


  .lead { flex-wrap: wrap; }
  .board { grid-auto-columns: minmax(78%, 1fr); scroll-snap-type: x mandatory; }
  .pcol { scroll-snap-align: start; }
  #lead-dialog { width: calc(100% - 16px); padding: 12px; }
  #rec-dialog { width: calc(100% - 16px); padding: 12px; }
  #lead-body dl { grid-template-columns: minmax(0, 1fr); gap: 0; }
  #lead-body dd { margin-bottom: .4rem; }
}

/* a table wider than its box (app.js fitTables): one card per row, the column name before each value */
.table-wrap.cards { overflow: visible; }
.table-wrap.cards table, .table-wrap.cards tbody, .table-wrap.cards tr { display: block; width: 100%; }
.table-wrap.cards thead { display: none; }
.table-wrap.cards tr { border: 1px solid var(--line); border-radius: 10px; padding: .45rem .75rem; margin-bottom: .6rem; background: var(--card); }
.table-wrap.cards td { display: flex; flex-wrap: wrap; align-items: baseline; gap: .25rem .5rem; border: 0; padding: .2rem 0; max-width: none; overflow-wrap: anywhere; }
.table-wrap.cards td::before { content: attr(data-label); flex: 0 0 6.2rem; color: var(--muted); font-size: .78rem; font-weight: 600; }
.table-wrap.cards td[data-label=""]::before, .table-wrap.cards td[colspan]::before { display: none; }
.table-wrap.cards td:first-child { font-weight: 600; }
.table-wrap.cards td:empty { display: none; }
.table-wrap.cards td[data-label=""]:not(:empty) { padding-top: .45rem; }
.table-wrap.cards td select, .table-wrap.cards td input { width: auto; flex: 1 1 8rem; min-width: 0; }
.table-wrap.cards tr.edit-row { background: var(--chip); }
.table-wrap.cards .edit-row td { background: transparent; }

/* phone cards, shaped per table: what a person scans first goes first */
.table-wrap.cards tr:has(td) { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: .75rem; position: relative; overflow: hidden; padding-left: 1rem; }
.table-wrap.cards tr.edit-row { display: block; padding-left: .75rem; }
.table-wrap.cards td { grid-column: 1 / -1; }
.table-wrap.cards tr::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 4px; background: var(--s4); }
.table-wrap.cards tr:has(.pill.pending)::before, .table-wrap.cards tr:has(.pill.queued)::before, .table-wrap.cards tr:has(.pill.checking)::before { background: var(--warn); }
.table-wrap.cards tr:has(.pill.done)::before, .table-wrap.cards tr:has(.pill.sent)::before { background: var(--accent); }
.table-wrap.cards tr:has(.pill.failed)::before, .table-wrap.cards tr:has(.pill.not_on_whatsapp)::before, .table-wrap.cards tr:has(.pill.not_reachable)::before { background: var(--danger); }

/* contacts: name + status / number / first sent + follow-ups / next step / reply bubble / actions */
.t-contacts td::before, .t-messages td::before, .t-optouts td::before { display: none; }
.cards .t-contacts td:nth-child(1) { grid-column: 1; font-size: 1rem; }
.cards .t-contacts td:nth-child(3) { grid-column: 2; grid-row: 1; justify-content: flex-end; }
.cards .t-contacts td:nth-child(2) { font-variant-numeric: tabular-nums; color: var(--muted); padding-top: 0; }
.cards .t-contacts td:nth-child(4), .cards .t-contacts td:nth-child(5) { display: block; grid-column: auto; font-size: .82rem; color: var(--muted); }
.cards .t-contacts td:nth-child(5) { text-align: right; }
.cards .t-contacts td:nth-child(5).zero, .cards .t-contacts td:nth-child(4):empty { display: none; }
.cards .t-contacts td:nth-child(4):has(+ td.zero) { grid-column: 1 / -1; }
.cards .t-contacts td:nth-child(4)::before { display: inline; content: "First sent "; font-weight: 400; font-size: inherit; color: inherit; }
.cards .t-contacts td:nth-child(5)::before { display: inline; content: "Follow-ups "; font-weight: 400; font-size: inherit; color: inherit; }
.cards .t-contacts td:nth-child(6) { color: var(--accent); font-weight: 600; font-size: .85rem; }
.cards .t-contacts td:nth-child(7) { display: block; justify-self: start; max-width: 92%; margin: .35rem 0 .1rem; padding: .45rem .7rem; background: var(--chip); color: var(--text); border-radius: 4px 14px 14px 14px; white-space: pre-wrap; }
.cards .t-contacts td:nth-child(7):empty { display: none; }
.cards .t-contacts td:nth-child(8) { gap: .4rem; padding-top: .5rem; }
.cards .t-contacts td:nth-child(8) button { flex: 1 1 0; padding: .45rem .5rem; }

/* messages: name + status / number + channel / detail / time + number in the queue / cancel */
.cards .t-messages td:nth-child(4) { grid-column: 1; grid-row: 1; font-size: 1rem; font-weight: 600; }
.cards .t-messages td:nth-child(5) { grid-column: 2; grid-row: 1; justify-content: flex-end; }
.cards .t-messages td:nth-child(1) { grid-column: 2; grid-row: 4; justify-content: flex-end; font-weight: 400; color: var(--muted); font-size: .82rem; }
.cards .t-messages td:nth-child(1)::before { display: inline; content: "#"; flex: none; font-size: inherit; }
.cards .t-messages td:nth-child(3) { grid-column: 1; grid-row: 2; font-variant-numeric: tabular-nums; color: var(--muted); }
.cards .t-messages td:nth-child(2) { grid-column: 2; grid-row: 2; justify-content: flex-end; color: var(--muted); font-size: .82rem; }
.cards .t-messages td:nth-child(6) { grid-row: 3; font-size: .85rem; }
.cards .t-messages td:nth-child(7) { grid-column: 1; grid-row: 4; color: var(--muted); font-size: .82rem; }
.cards .t-messages td:nth-child(8) { grid-row: 5; }
.cards .t-messages td:nth-child(8) button { flex: 1 1 0; }

/* opt-outs: contact + channel / reason / since */
.cards .t-optouts td:nth-child(2) { grid-column: 1; grid-row: 1; font-weight: 600; font-variant-numeric: tabular-nums; }
.cards .t-optouts td:nth-child(1) { grid-column: 2; grid-row: 1; justify-content: flex-end; font-weight: 400; color: var(--muted); font-size: .82rem; }
.cards .t-optouts td:nth-child(3) { font-size: .85rem; }
.cards .t-optouts td:nth-child(4) { color: var(--muted); font-size: .82rem; }
.cards .t-optouts td:nth-child(5) { padding-top: .45rem; }
.cards .t-optouts td:nth-child(5) button { flex: 1 1 0; }

/* recipient picker on a phone: tick box, name on top, number / category / city below */
@media (max-width: 640px) {
  .lead { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; column-gap: .6rem; row-gap: .1rem; align-items: center; padding: .55rem .7rem; }
  .lead > input { grid-row: 1 / 3; align-self: center; }
  .lead > span:nth-of-type(1) { grid-column: 2; font-weight: 600; }
  .lead > .tag { grid-column: 3; grid-row: 1; justify-self: end; margin: 0; }
  .lead > span.muted { grid-column: 2; grid-row: 2; font-size: .82rem; }
  .lead > button.info { grid-column: 3; grid-row: 2; justify-self: end; }
}

/* health cards and the spam score: a ring coloured by the verdict, then the checks */
.health-body { display: flex; align-items: center; gap: 1.2rem; flex-wrap: wrap; margin-bottom: .6rem; }
.health-info { flex: 1 1 9rem; min-width: 0; display: grid; gap: .3rem; }
.health-info p { margin: 0; }
.health-verdict, .score-verdict { font-size: 1.15rem; }
.score-ring { width: 120px; height: 120px; flex: none; }
.score-ring .ring-num { font-size: 26px; font-weight: 650; }
.ring-sub { fill: var(--muted); font-size: 10px; }
.score-ring.v-good .fill { stroke: var(--accent); }
.score-ring.v-ok .fill { stroke: var(--warn); }
.score-ring.v-risky .fill { stroke: var(--danger); }
[data-verdict="good"] .health-verdict, [data-verdict="good"] .score-verdict { color: var(--accent); }
[data-verdict="ok"] .health-verdict, [data-verdict="ok"] .score-verdict { color: var(--warn); }
[data-verdict="risky"] .health-verdict, [data-verdict="risky"] .score-verdict { color: var(--danger); }
.checks { list-style: none; margin: 0 0 .6rem; padding: 0; display: grid; }
.chk { display: flex; justify-content: space-between; align-items: baseline; gap: .3rem 1rem; flex-wrap: wrap; padding: .4rem 0 .4rem 1.1rem; border-bottom: 1px solid var(--line); position: relative; font-size: .9rem; }
.chk::before { content: ""; position: absolute; left: 0; top: .85em; width: .5rem; height: .5rem; border-radius: 50%; background: var(--s3); }
.chk-ok::before { background: var(--accent); }
.chk-bad::before { background: var(--danger); }
.chk-what { overflow-wrap: anywhere; }
.chk-result { color: var(--muted); white-space: nowrap; }
.chk-bad .chk-result { color: var(--danger); font-weight: 600; }
.health h3 { margin-top: .8rem; }
.health-problems:empty { display: none; }
.row > #lead-close { flex: none; width: auto; padding: .2rem .6rem; }
.admin-only h3 { margin-top: 1.2rem; }

/* Manual tab */
.manual { max-width: 860px; line-height: 1.55; }
.manual h2 { font-size: 1.3rem; }
.manual h3 { font-size: 1.05rem; margin: 1.6rem 0 .6rem; }
.manual h4 { font-size: .95rem; margin: 1.2rem 0 .4rem; }
.manual hr { border: 0; border-top: 1px solid var(--line); margin: 1.4rem 0; }
.manual ul, .manual ol { padding-left: 1.3rem; }
.manual li { margin: .2rem 0; }
.manual-toc { border: 1px solid var(--line); border-radius: 10px; padding: .8rem 1rem; margin-bottom: 1rem; font-size: .9rem; }
.manual-toc ol { margin: .4rem 0 0; columns: 2 220px; }
.manual-toc a { color: inherit; }
.manual-table { overflow-x: auto; margin: .6rem 0; }
.manual-table td, .manual-table th { text-align: left; vertical-align: top; }

/* the page's own confirm window (a browser can block confirm() for a page) */
dialog.ask { border: 1px solid var(--line); border-radius: 14px; padding: 1.2rem 1.3rem 1rem; max-width: min(480px, calc(100vw - 32px));
  background: var(--card); color: var(--text); box-shadow: 0 20px 60px rgba(0, 0, 0, .25); }
dialog.ask::backdrop { background: rgba(10, 12, 18, .45); }
dialog.ask p { margin: 0 0 .7rem; white-space: pre-line; line-height: 1.45; }
dialog.ask input { width: 100%; margin: .2rem 0 .8rem; }
.ask-buttons { justify-content: flex-end; gap: .5rem; margin-top: .4rem; }
/* notices: what just happened (added, sent, replied), bottom right */
#notices { position: fixed; right: 16px; bottom: 16px; display: grid; gap: 8px; z-index: 50; max-width: min(380px, calc(100vw - 32px)); }
.notice { background: var(--ink); color: var(--ink-text); padding: .7rem .9rem; border-radius: 10px; font-size: .9rem; line-height: 1.35;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .2); cursor: pointer; border-left: 4px solid var(--accent); }
.notice.bad { border-left-color: var(--danger); }
.notice.good { border-left-color: #5aa457; }
@media (prefers-reduced-motion: no-preference) { .notice { animation: notice-in .18s ease-out; } }
@keyframes notice-in { from { opacity: 0; transform: translateY(6px); } }

/* ---------- space and phones ---------- */
.tab-menu { display: none; }
/* filters sit side by side (not one per line) */
.row > select { width: auto; flex: 0 1 auto; max-width: 100%; }
/* wide screens: two cards side by side where one alone left half the width empty */
.split { display: grid; gap: 0 1rem; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 1000px) { .split { grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); align-items: start; } }
/* long legends spread into columns */
.mix-legend { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(210px, 100%), 1fr)); gap: .3rem 1.2rem; flex: 1 1 280px; }
/* getting started: the three steps in one row on wide screens */
@media (min-width: 900px) {
  .steps { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .steps li { flex-wrap: wrap; align-content: flex-start; }
  .steps li div { flex: 1 1 calc(100% - 2.6rem); }
  .steps li button { margin-left: 2.4rem; }
}
/* the activity list: when, what, details */
.events li { display: grid; grid-template-columns: 7.5rem 11rem minmax(0, 1fr); gap: .1rem .8rem; padding: .35rem 0; }
.ev-what { font-weight: 600; }
.ev-detail { color: var(--muted); overflow-wrap: anywhere; }
@media (max-width: 640px) {
  /* one menu for the sections, right under the header */
  .tabs { display: none; }
  .tab-menu { display: block; padding: .6rem 12px 0; position: sticky; top: 0; z-index: 20; background: var(--bg); }
  .tab-menu select { width: 100%; font-weight: 600; border: 1px solid var(--accent); background: var(--card); padding: .6rem .8rem; border-radius: 10px; }
  .events li { grid-template-columns: minmax(0, 1fr); }
  .ev-when { font-size: .8rem; }
}
@media (min-width: 641px) { .row > input[type=search] { min-width: 240px; } }
.checker-line { margin: .2rem 0 1rem; padding: .6rem .8rem; border-radius: 10px; background: var(--warn-bg); color: var(--warn); font-size: .9rem; }
.checker-line.on { background: var(--accent-soft); color: var(--text); }

/* a conversation: their answers left, ours right, then the box to answer */
dialog.convo { border: 1px solid var(--line); border-radius: 14px; padding: 0; width: min(560px, calc(100vw - 24px));
  background: var(--card); color: var(--text); box-shadow: 0 20px 60px rgba(0, 0, 0, .25); }
dialog.convo::backdrop { background: rgba(10, 12, 18, .45); }
.convo-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; padding: 1rem 1.1rem .7rem; border-bottom: 1px solid var(--line); }
.convo-list { display: flex; flex-direction: column; gap: .5rem; padding: 1rem 1.1rem; max-height: min(55vh, 460px); overflow-y: auto; background: var(--bg); }
.bubble { max-width: 82%; padding: .5rem .75rem; border-radius: 14px; line-height: 1.4; }
.bubble.in { align-self: flex-start; background: var(--card); border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.bubble.out { align-self: flex-end; background: var(--accent-soft); border-bottom-right-radius: 4px; }
.bubble-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.bubble-meta { font-size: .75rem; color: var(--muted); margin-top: .2rem; }
.convo-form { padding: .8rem 1.1rem 1rem; border-top: 1px solid var(--line); }
.convo-actions { justify-content: space-between; margin-bottom: 0; }
.convo-actions p { flex: 1 1 14rem; margin: 0; }
button:disabled { opacity: .45; cursor: not-allowed; }

/* admin, leads by category: numbers right-aligned, a scrolling list with the header and totals always in view */
#lc-wrap { max-height: 70vh; overflow: auto; }
#lc-table { white-space: nowrap; }
#lc-table .num { text-align: right; font-variant-numeric: tabular-nums; }
#lc-table thead th { position: sticky; top: 0; background: var(--card); }
#lc-table tfoot th { position: sticky; bottom: 0; background: var(--card); }

/* the PDFs a first message can carry: one line each, Delete at the end */
.pdf-list { display: flex; flex-direction: column; gap: 4px; margin: 6px 0; }
.pdf-item { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.pdf-item label { overflow-wrap: anywhere; }

/* Best leads (admin): catalogue cards, fit badges */
.cat-cards { display: grid; gap: .8rem; }
.cat-card { border: 1px solid var(--line); border-radius: 10px; padding: .8rem 1rem; }
.cat-card p { margin: .35rem 0; }
.chips { display: flex; flex-wrap: wrap; gap: .35rem; margin: .4rem 0; }
.pill.w3 { background: var(--accent-soft); font-weight: 600; } .pill.w1 { color: var(--muted); }
.pill.cat-ready { color: var(--ok); } .pill.cat-failed { color: var(--danger); } .pill.cat-reading { color: var(--warn); }
.grid.three-cols { grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr)); gap: .8rem; margin: .6rem 0; }
.grid.three-cols textarea { width: 100%; margin-top: .3rem; }
.fit { display: inline-block; min-width: 2.4rem; text-align: center; padding: .05rem .4rem; border-radius: 6px;
  font-weight: 600; font-variant-numeric: tabular-nums; background: var(--chip); }
.fit-good { background: var(--accent); color: var(--ink-text); } .fit-ok { background: var(--accent-soft); } .fit-low { color: var(--muted); }
/* Scraper (admin) */
pre.log { max-height: 340px; overflow: auto; background: var(--code); border-radius: 8px; font-size: .8rem; }
#sc-queries { width: 100%; }

/* ---------- CRM board and own fields (round 2) ---------- */
.pcol header { flex-wrap: wrap; align-items: center; gap: .2rem .5rem; text-transform: none; letter-spacing: 0; font-size: .88rem; }
.pcol header .pcol-name { flex: 1 1 auto; display: inline-flex; align-items: center; gap: .4rem; color: var(--text); }
.pcol header .muted { text-transform: none; letter-spacing: 0; font-weight: 500; font-variant-numeric: tabular-nums; }
.pcount { min-width: 1.5rem; padding: 0 .4rem; border-radius: 99px; background: var(--card); color: var(--muted); font-size: .75rem; text-align: center; font-variant-numeric: tabular-nums; }
.pcol.kind-won { background: color-mix(in srgb, var(--accent-soft) 45%, var(--chip)); }
.pcol.kind-lost { opacity: .85; }
.pcol.kind-lost .pcol-name { color: var(--muted); }
.pempty { margin: 0; padding: 1rem .5rem; text-align: center; border: 1px dashed var(--line); border-radius: 10px; }
.pcard { border-left: 3px solid var(--stage, var(--line)); }
.pcard:hover { border-color: var(--s3); border-left-color: var(--stage, var(--s3)); }
.pcard:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.pcard-meta { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .2rem .6rem; }
.pcard-meta .late { color: var(--danger); font-weight: 600; }
.pvalue { font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.pcard.is-stale { border-color: var(--warn); border-left-color: var(--warn); background: color-mix(in srgb, var(--warn-bg) 60%, var(--card)); }
.stale-text { color: var(--warn); font-weight: 600; }
.pill.stale { background: var(--warn-bg); color: var(--warn); text-transform: none; letter-spacing: 0; font-weight: 600; }

.multi { display: flex; flex-wrap: wrap; gap: .3rem; }
.chip-check { display: inline-flex; align-items: center; gap: .3rem; padding: .15rem .55rem; border: 1px solid var(--line); border-radius: 99px; background: var(--chip); font-size: .85rem; cursor: pointer; }
.chip-check:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.chip-check input { margin: 0; }
.field-multi { display: grid; gap: .3rem; }
.hint { display: block; font-size: .78rem; margin-top: .1rem; font-weight: 400; }
.cz-row input.cz-hint { flex: 2 1 160px; }
#cz-body h3 { margin-top: 1rem; padding-top: .6rem; border-top: 1px solid var(--line); }
#cz-body h3:first-child { margin-top: 0; padding-top: 0; border-top: 0; }
@media (max-width: 640px) {
  .cz-row { padding: .45rem 0; border-bottom: 1px solid var(--line); }
  .cz-row input.cz-hint { flex-basis: 100%; }
}
.empty-state { display: grid; justify-items: start; gap: .4rem; padding: 1rem; border: 1px dashed var(--line); border-radius: 10px; }
.empty-state p { margin: 0; }
#rp-field-card .row { margin-bottom: .6rem; }
#rp-field-card select { width: auto; }

/* ---------- team (a team owner) ---------- */
.team-head { align-items: center; gap: .6rem; flex-wrap: wrap; margin-bottom: .8rem; }
.team-head h2 { margin: 0; font-size: 1.15rem; }
.team-head select { width: auto; }
.team-charts { display: grid; gap: 1rem; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 1000px) { .team-charts { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); } }
.team-charts .card { margin: 0; }
.chart-box .chart { width: 100%; height: auto; display: block; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .tick { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart .bar-sent { fill: var(--accent); opacity: .85; }
.chart .line-replies { fill: none; stroke: var(--ink); stroke-width: 2; stroke-linejoin: round; }
.chart .dot-replies { fill: var(--ink); }
.legend { display: flex; align-items: center; gap: .4rem; margin: .4rem 0 0; color: var(--muted); }
.legend .key { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-left: .6rem; }
.legend .key:first-child { margin-left: 0; }
.legend .key.sent { background: var(--accent); }
.legend .key.replies { background: var(--ink); height: 3px; }
.people-bars { display: grid; gap: .55rem; }
.people-row { display: grid; grid-template-columns: minmax(80px, 150px) 1fr; gap: .15rem .7rem; align-items: center; }
.people-name { font-weight: 600; font-size: .9rem; overflow-wrap: anywhere; }
.people-num { grid-column: 2; }
.pbar { position: relative; height: 14px; background: var(--chip); border-radius: 99px; overflow: hidden; }
.pbar span { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 99px; }
.pbar-sent { background: var(--accent); opacity: .55; }
.pbar-replies { background: var(--accent); }
.tm-acts { white-space: nowrap; }
.tm-acts > * + * { margin-left: .3rem; }
.more { display: inline-block; position: relative; }
.more summary { cursor: pointer; list-style: none; padding: .25rem .6rem; border: 1px solid var(--line); border-radius: 8px; }
.more summary::-webkit-details-marker { display: none; }
.more[open] .more-menu { position: absolute; right: 0; z-index: 5; display: grid; gap: .25rem; padding: .4rem; min-width: 170px;
  background: var(--card); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 8px 24px rgb(0 0 0 / .12); }
.more-menu button { text-align: left; }
.team-banner { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem 1rem; justify-content: space-between;
  max-width: 1360px; margin: .6rem auto 0; padding: .6rem 16px; background: var(--accent-soft); border-left: 4px solid var(--accent); }
#tm-add-key { font-family: ui-monospace, monospace; flex: 1; }
@media (max-width: 640px) {
  .people-row { grid-template-columns: 1fr; }
  .people-num { grid-column: 1; }
  .team-banner { margin: .4rem 12px 0; }
}


/* ---------- the brand frame: navy header and, on wide screens, a navy side menu ---------- */
.top { background: var(--brand-bg); color: var(--brand-text); border-bottom: 1px solid var(--brand-line); padding: .6rem 16px; }
.top .brand { color: var(--brand-text); font-size: 1.02rem; }
.top .logo-wide { height: 52px; width: auto; display: block; margin: -10px 0 -10px -8px; }
.top #who { color: var(--brand-muted); padding-left: .8rem; border-left: 1px solid var(--brand-line); }
.top button, .top select { background: transparent; color: var(--brand-text); border-color: var(--brand-line); }
.top button:hover, .top select:hover { border-color: var(--brand-muted); }
.top select option { color: var(--text); background: var(--card); }
.top :focus-visible { outline: 2px solid var(--brand-yellow); outline-offset: 2px; }
.tabs button:focus-visible, .tab-menu select:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

@media (min-width: 1100px) {
  #app:not([hidden]) { display: grid; grid-template-columns: 228px minmax(0, 1fr); align-items: start; min-height: 100vh; }
  #app > * { grid-column: 2; min-width: 0; }
  #app > .top { grid-column: 1 / -1; position: sticky; top: 0; z-index: 30; }
  #app > .tabs { grid-column: 1; grid-row: 2 / span 30; align-self: stretch; position: sticky; top: 55px; height: calc(100vh - 55px);
    overflow-y: auto; margin: 0; max-width: none; padding: 1rem .7rem 2rem; display: flex; flex-direction: column; flex-wrap: nowrap;
    gap: 1.1rem; background: var(--brand-bg); border-right: 1px solid var(--brand-line); }
  .tabs .tab-group { flex-direction: column; align-items: stretch; gap: .1rem; }
  .tabs .tab-group-label { color: var(--brand-muted); font-size: .78rem; padding: 0 .7rem .25rem; margin: 0; }
  .tabs button { text-align: left; color: var(--brand-text); opacity: .78; border: 0; border-left: 3px solid transparent; border-radius: 0 8px 8px 0;
    padding: .42rem .7rem; white-space: normal; }
  .tabs button:hover { opacity: 1; background: var(--brand-raise); }
  .tabs button.active { opacity: 1; background: var(--brand-raise); border-left-color: var(--brand-yellow); color: #fff; font-weight: 600; }
  .tabs button:focus-visible { outline-color: var(--brand-yellow); }
  main { margin: 0; max-width: 1240px; padding: 1.4rem 28px 2rem; }
  .team-banner { margin: 1rem 28px 0; max-width: none; }
  #app > .banner { margin: 0; }
}

/* calmer cards: one radius for cards, a hairline, a touch more air; headings carry the card */
.card { border-radius: 12px; padding: 1.25rem 1.4rem; }
.card > h2:first-child, .card > .row:first-child h2 { font-size: 1.05rem; letter-spacing: -.005em; }
.stat .big { letter-spacing: -.03em; }
button.primary:hover { filter: brightness(1.15); }
.login { background: var(--brand-bg); color: var(--brand-text); }
.login .card { color: var(--text); }
/* sign in: a navy panel, so the logo's cream letters read */
.login .card { background: var(--brand-raise); color: var(--brand-text); border-color: var(--brand-line); }
.login .card h1 { color: var(--brand-text); font-size: 1.05rem; font-weight: 500; }
.login .card .muted, .login .card label { color: var(--brand-muted); }
.login .card input { background: var(--brand-bg); color: var(--brand-text); border-color: var(--brand-line); }
.login .card input:focus-visible { outline: 2px solid var(--brand-yellow); outline-offset: 1px; }
.login .card button.primary { background: var(--brand-yellow); color: var(--brand-bg); border-color: var(--brand-yellow); font-weight: 600; }

/* the Scraper's small number boxes (no inline styles: the CSP blocks them) */
#sc-max { width: 5rem; } #sc-workers { width: 4rem; } #sc-assign-fit { width: 4.5rem; } #sc-assign-since { width: auto; } #sc-job-max { width: 6rem; }

@media (max-width: 640px) { .top .logo-wide { display: none; } .top .logo { display: block; } }

/* ---------- the menu's groups open and close; Pipeline opens to its pipelines ---------- */
.tab-group-toggle { border: 0; background: transparent; padding: 0; cursor: default; }
.tab-sub { display: none; }
@media (min-width: 1100px) {
  .tabs .tab-group-toggle { cursor: pointer; display: flex; align-items: center; justify-content: space-between; width: 100%;
    padding: .2rem .7rem; border-radius: 6px; opacity: 1; color: var(--brand-muted); font-size: .78rem; border: 0; }
  .tabs .tab-group-toggle:hover { color: var(--brand-text); background: transparent; }
  .tabs .tab-group-toggle::after { content: ""; width: 7px; height: 7px; border-right: 1.5px solid currentColor;
    border-bottom: 1.5px solid currentColor; transform: rotate(45deg) translate(-2px, -2px); transition: transform .15s; }
  .tabs .tab-group.closed .tab-group-toggle::after { transform: rotate(-45deg); }
  .tabs .tab-group.closed > button[data-tab], .tabs .tab-group.closed > .tab-sub { display: none; }
  .tabs .tab-group:has(#pipeline-tab:not([hidden])) .tab-sub:not(:empty) { display: grid; gap: .05rem; margin: .1rem 0 .3rem .9rem;
    padding-left: .5rem; border-left: 1px solid var(--brand-line); }
  .tabs .tab-sub-link { text-align: left; background: transparent; border: 0; color: var(--brand-muted); padding: .28rem .6rem;
    border-radius: 6px; font-size: .88rem; white-space: normal; }
  .tabs .tab-sub-link:hover { color: var(--brand-text); background: var(--brand-raise); }
  .tabs .tab-sub-link.active { color: var(--brand-yellow); font-weight: 600; }
  .tabs .tab-sub-link.pipe-new { color: var(--brand-muted); font-style: normal; }
  .tabs .tab-sub-link:focus-visible { outline: 2px solid var(--brand-yellow); outline-offset: 1px; }
}
@media (prefers-reduced-motion: reduce) { .tabs .tab-group-toggle::after { transition: none; } }

/* the pipelines above the board: Contacts and each deal pipeline */
.pipe-switch { display: flex; flex-wrap: wrap; gap: .4rem; margin: 0 0 .9rem; }
.pipe-switch:empty { display: none; }
.pipe-pill { border-radius: 99px; padding: .32rem .85rem; background: var(--card); border: 1px solid var(--line); color: var(--muted); }
.pipe-pill:hover { color: var(--text); }
.pipe-pill.active { background: var(--ink); color: var(--ink-text); border-color: var(--ink); font-weight: 600; }
.pipe-pill.pipe-new { border-style: dashed; color: var(--text); }

/* import deals */
.imp-where { border: 1px solid var(--line); border-radius: 10px; padding: .6rem .8rem; margin: .8rem 0; display: grid; gap: .6rem; }
.imp-where legend { font-size: .85rem; color: var(--muted); padding: 0 .3rem; }
.imp-where label.check { display: grid; gap: .3rem; }
.imp-where label.check input[type=radio] { margin-right: .4rem; }
.imp-preview p { margin: .4rem 0; }
.imp-stages { margin: .2rem 0 0; padding-left: 1.3rem; display: grid; gap: .2rem; }
.imp-stages .pill { margin-left: .4rem; }

/* language: EN / PT */
.lang-btn { min-width: 2.6rem; padding: .3rem .5rem; font-weight: 600; font-size: .85rem; letter-spacing: .02em; }
.lang-fixed { position: fixed; top: 12px; right: 60px; color: var(--brand-text); border-color: var(--brand-line); }
