[hidden] { display: none !important; }

/* Layout: one working column — counters, filters, then leads as folded rows that open into a work sheet (message, advice, conversation, status). */
:root {
  --bg: #eef0ec; --surface: #fbfcfa; --ink: #18201c; --muted: #5a665f; --line: #d3d9d3;
  --accent: #17644f; --accent-ink: #ffffff; --accent-soft: #dbeae3; --pin: #c2412d;
  --warn: #9a5b12; --warn-soft: #f6e8d3; --good: #2d6a2f; --good-soft: #dfeedd;
  --bad: #a3271f; --bad-soft: #f5dedb; --quote: #f2f4f0;
  --font-display: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-body: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: ui-monospace, "SFMono-Regular", Menlo, monospace;
  --r: 10px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #101412; --surface: #171d1a; --ink: #e4eae6; --muted: #98a59e; --line: #2b3430;
    --accent: #5cc2a2; --accent-ink: #0d1411; --accent-soft: #1d3329; --pin: #ef7a65;
    --warn: #e2a65a; --warn-soft: #33281a; --good: #8bcb88; --good-soft: #1f2e1f;
    --bad: #f0857b; --bad-soft: #3a1f1c; --quote: #1d2420; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #101412; --surface: #171d1a; --ink: #e4eae6; --muted: #98a59e; --line: #2b3430;
  --accent: #5cc2a2; --accent-ink: #0d1411; --accent-soft: #1d3329; --pin: #ef7a65;
  --warn: #e2a65a; --warn-soft: #33281a; --good: #8bcb88; --good-soft: #1f2e1f;
  --bad: #f0857b; --bad-soft: #3a1f1c; --quote: #1d2420; color-scheme: dark;
}
* { box-sizing: border-box; }
body { background: var(--bg); color: var(--ink); font-family: var(--font-body); font-size: 15px; line-height: 1.5; }
.wrap { max-width: 900px; margin: 0 auto; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); padding-block: 24px 48px; display: flex; flex-direction: column; gap: 18px; }
header { display: flex; flex-direction: column; gap: 6px; }
.eyebrow { font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.eyebrow::before { content: ""; width: 9px; height: 9px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg); background: var(--pin); display: inline-block; }
h1 { font-family: var(--font-display); font-weight: 600; font-size: clamp(24px, 5vw, 34px); line-height: 1.1; margin: 0; text-wrap: balance; letter-spacing: -.01em; }
.lede { color: var(--muted); margin: 0; max-width: 64ch; }
.counters { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 150px), 1fr)); gap: 10px; }
.counter { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 10px 14px; display: flex; flex-direction: column; gap: 2px; }
.counter .n { font-family: var(--font-display); font-size: 24px; font-weight: 500; font-variant-numeric: tabular-nums; line-height: 1.15; }
.counter .l { font-size: 12px; color: var(--muted); }
.counter.hot .n { color: var(--pin); }
.toolbar { display: flex; flex-direction: column; gap: 10px; }
.pipeline { display: flex; flex-wrap: wrap; gap: 6px; }
.pipeline button { font: inherit; font-size: 13px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 999px; padding: 6px 12px; cursor: pointer; display: inline-flex; gap: 6px; align-items: baseline; }
.pipeline button .n { font-family: var(--font-mono); font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.pipeline button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.pipeline button[aria-pressed="true"] .n { color: var(--accent-ink); opacity: .8; }
.search { display: flex; flex-wrap: wrap; gap: 8px; }
.search input { flex: 1 1 220px; min-width: 0; }
.search select { flex: 0 1 180px; width: auto; }
button:focus-visible, select:focus-visible, input:focus-visible, textarea:focus-visible, summary:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
details.rules { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 12px 16px; }
details.rules summary { cursor: pointer; font-weight: 600; }
details.rules ul { margin: 10px 0 2px; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; }
details.rules li { max-width: 70ch; }
.list { display: flex; flex-direction: column; gap: 8px; }
details.lead { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); min-width: 0; }
details.lead[open] { border-color: var(--accent); }
details.lead > summary { list-style: none; cursor: pointer; padding: 12px 14px; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; align-items: center; }
details.lead > summary::-webkit-details-marker { display: none; }
.s-main { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 8px; min-width: 0; }
.s-name { font-weight: 600; font-size: 16px; overflow-wrap: anywhere; }
.s-sub { grid-column: 1 / -1; font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }
.s-when { font-family: var(--font-mono); font-size: 12px; color: var(--muted); white-space: nowrap; }
.s-when.late { color: var(--pin); font-weight: 500; }
.chip { font-size: 12px; border-radius: 6px; padding: 1px 8px; font-weight: 500; white-space: nowrap; }
.chip.pA { background: var(--accent-soft); color: var(--accent); }
.chip.pB { background: var(--warn-soft); color: var(--warn); }
.chip.pC { background: var(--quote); color: var(--muted); border: 1px solid var(--line); }
.chip.st-new { background: var(--quote); color: var(--muted); border: 1px solid var(--line); }
.chip.st-sent, .chip.st-noanswer { background: var(--warn-soft); color: var(--warn); }
.chip.st-replied, .chip.st-agreed { background: var(--accent-soft); color: var(--accent); }
.chip.st-paid { background: var(--good-soft); color: var(--good); }
.chip.st-declined { background: var(--bad-soft); color: var(--bad); }
.chip.gp { background: var(--warn-soft); color: var(--warn); }
.chip.new-advice { background: var(--pin); color: #fff; }
.body { padding: 0 14px 16px; display: flex; flex-direction: column; gap: 14px; }
.block { display: flex; flex-direction: column; gap: 8px; }
.block h3 { margin: 0; font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.stats { font-family: var(--font-mono); font-size: 13px; font-variant-numeric: tabular-nums; }
.stats .star { color: var(--pin); }
.findings { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 4px; }
.findings li { max-width: 72ch; }
.note-agent { font-size: 13px; color: var(--warn); background: var(--warn-soft); border-radius: 6px; padding: 6px 10px; margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg { background: var(--quote); border-radius: 8px; padding: 12px 14px; display: flex; flex-direction: column; gap: 10px; }
.msg p { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; max-width: 72ch; }
.advice { border-left: 3px solid var(--accent); }
.advice .when { font-size: 12px; color: var(--muted); }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.btn { font: inherit; font-size: 14px; font-weight: 500; border-radius: 8px; padding: 7px 12px; cursor: pointer; border: 1px solid var(--line); background: var(--surface); color: var(--ink); text-decoration: none; display: inline-flex; align-items: center; gap: 6px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn[disabled] { opacity: .5; cursor: default; }
.btn small { font-size: 11px; opacity: .75; font-weight: 400; }
.phone { font-family: var(--font-mono); font-size: 14px; user-select: all; }
.log { display: flex; flex-direction: column; gap: 6px; margin: 0; padding: 0; list-style: none; }
.log li { background: var(--quote); border-radius: 8px; padding: 8px 10px; display: flex; flex-direction: column; gap: 2px; max-width: 72ch; }
.log li.k-client { border-left: 3px solid var(--warn); }
.log li.k-me { border-left: 3px solid var(--accent); }
.log li.k-question { border-left: 3px solid var(--pin); }
.log .who { font-size: 12px; color: var(--muted); }
.log .txt { white-space: pre-wrap; overflow-wrap: anywhere; }
.controls { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 170px), 1fr)); gap: 10px; border-top: 1px solid var(--line); padding-top: 12px; }
label.f { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); letter-spacing: .02em; min-width: 0; }
select, input[type="date"], input[type="search"], input[type="number"], textarea { font: inherit; font-size: 14px; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 7px 9px; width: 100%; }
textarea { min-height: 64px; resize: vertical; }
.saved { font-size: 12px; color: var(--muted); min-height: 1em; }
details.paid { border: 1px dashed var(--line); border-radius: 8px; padding: 8px 12px; }
details.paid summary { cursor: pointer; font-weight: 500; }
details.paid pre { white-space: pre-wrap; overflow-wrap: anywhere; font-family: var(--font-body); font-size: 14px; margin: 8px 0 0; }
.lock { font-size: 13px; color: var(--bad); margin: 6px 0 0; }
.empty { background: var(--surface); border: 1px dashed var(--line); border-radius: var(--r); padding: 24px; color: var(--muted); }
.empty strong { color: var(--ink); display: block; margin-bottom: 4px; }
footer { color: var(--muted); font-size: 13px; }

.topbar { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.who-am-i { font-size: 13px; color: var(--muted); display: flex; gap: 8px; align-items: center; }
.login { max-width: 360px; margin: 12vh auto 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 24px; display: flex; flex-direction: column; gap: 12px; }
.login input { font: inherit; font-size: 15px; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 9px 10px; width: 100%; }
.err { color: var(--bad); font-size: 14px; min-height: 1.2em; margin: 0; }
.chat-pre { white-space: pre-wrap; overflow-wrap: anywhere; background: var(--quote); border-radius: 8px; padding: 10px 12px; margin: 0; font-family: inherit; font-size: 14px; max-width: 72ch; }

.chip.free { background: var(--quote); color: var(--accent); border: 1px dashed var(--accent); }
.chip.owner { background: var(--quote); color: var(--muted); border: 1px solid var(--line); }

/* Сотрудники и оплата */
.team { display: flex; flex-direction: column; gap: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; }
.team h2 { font-family: var(--font-display); font-size: 18px; font-weight: 600; margin: 8px 0 0; }
.team-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.team-head h2 { margin: 0; }
.f.inline { display: inline-flex; flex-direction: row; align-items: center; gap: 6px; }
.f.inline input, .f.inline select { width: auto; }
#period .btn[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.lede.small { font-size: 13px; }
.table-wrap { overflow-x: auto; }
table.report { border-collapse: collapse; width: 100%; font-size: 14px; }
table.report th, table.report td { border-bottom: 1px solid var(--line); padding: 7px 8px; text-align: left; vertical-align: top; }
table.report th { font-size: 12px; color: var(--muted); font-weight: 500; white-space: nowrap; }
table.report td.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.report tr.total td { font-weight: 600; }
table.report tr.sub td { background: var(--quote); font-size: 13px; color: var(--muted); }
table.report .tag { font-size: 12px; color: var(--muted); }
table.report button { font-size: 12px; padding: 3px 8px; }
.team input, .team select { font: inherit; font-size: 14px; border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; background: var(--surface); color: var(--ink); }

.report td.pay { font-weight: 600; }

/* Памятка для звонка */
.call-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; justify-content: space-between; background: var(--surface); border: 1px solid var(--accent); border-radius: var(--r); padding: 10px 14px; margin: 12px 0; font-weight: 600; }
dialog.call { max-width: 760px; width: calc(100% - 24px); max-height: calc(100vh - 32px); border: 1px solid var(--line); border-radius: var(--r); padding: 18px; background: var(--surface); color: var(--ink); }
dialog.call::backdrop { background: rgba(0,0,0,.45); }
.call-head { display: flex; flex-wrap: wrap; gap: 8px; justify-content: space-between; align-items: center; position: sticky; top: -18px; background: var(--surface); padding: 6px 0; z-index: 1; }
.call-head h2 { margin: 0; }
.call-lead { border: 1px dashed var(--line); border-radius: 8px; padding: 10px 12px; margin: 10px 0; font-size: 14px; white-space: pre-wrap; }
.call-goal { font-size: 15px; }
.call-funnel { counter-reset: st; list-style: none; padding: 0; margin: 14px 0; }
.call-funnel > li { counter-increment: st; position: relative; padding: 10px 12px 10px 46px; border-left: 3px solid var(--accent); margin-bottom: 10px; background: var(--accent-soft); border-radius: 0 8px 8px 0; }
.call-funnel > li::before { content: counter(st); position: absolute; left: 10px; top: 10px; width: 26px; height: 26px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); font-weight: 700; display: flex; align-items: center; justify-content: center; font-size: 14px; }
.call-funnel h3, .call-step h3 { margin: 2px 0 6px; font-size: 15px; }
.call .say { margin: 4px 0; font-size: 15px; }
.call .if { margin: 4px 0; font-size: 13px; color: var(--muted); }
.call-step { margin: 14px 0; }
.call-step ul, .call-step ol { margin: 4px 0; padding-left: 20px; }
.call-step.warn { border-left: 3px solid var(--pin); padding-left: 12px; }
.call-obj { width: 100%; border-collapse: collapse; font-size: 14px; }
.call-obj th, .call-obj td { text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); padding: 6px 8px; }
.call-obj td:first-child { width: 38%; font-weight: 600; }
@media (max-width: 560px) { .call-obj td:first-child { width: auto; } .call-obj tr { display: block; padding: 6px 0; } .call-obj th { display: none; } .call-obj td { display: block; border: 0; padding: 2px 0; } }
@media print { body > .wrap { display: none !important; } dialog.call:not([open]) { display: none !important; } dialog.call { position: static; display: block; max-height: none; border: 0; width: 100%; max-width: none; } .call-head .row { display: none; } }
details.paid h4 { margin: 12px 0 2px; font-size: 14px; }
details.lead.pinned { border-color: var(--accent); }
details.lead.flash { box-shadow: 0 0 0 3px var(--accent-soft), 0 0 0 5px var(--accent); transition: box-shadow .3s; }
