:root {
  --page:#fafafb; --canvas:#f1f2f3; --surface:#fff; --inset:#f7f8f9;
  --hover:#f4f5f6; --hover-2:#e7e9eb;
  --ink:#1f2124; --ink-2:#62656b; --ink-3:#9a9da3;
  --line:#ecedef; --line-strong:#e0e2e5; --field:#f2f2f3; --stripe:#f5f5f5;
  --accent:#0285ff; --accent-ink:#0170dd; --accent-tint:#e9f3ff;
  --green:#189a4d; --green-tint:#e8f5ed;
  --orange:#ef720c; --orange-tint:#fdf1e5;
  --red:#e3474c; --red-tint:#fcecec;
  --texture:rgba(16,20,40,.024);
  --radius-card:12px; --radius-control:8px; --radius-chip:6px;
  --shadow-card:0 0 0 1px var(--line), 0 1px 2px #1018280a, 0 2px 6px #10182808;
  --shadow-btn:0 0 0 1px var(--line-strong), 0 1px 2px #1018280d;
  --shadow-hairline:0 0 0 1px var(--line);
  --sans:"Inter", ui-sans-serif, system-ui, -apple-system, sans-serif;
  --mono:"JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
}
html.dark {
  --page:#0f1011; --canvas:#1c1d1f; --surface:#161719; --inset:#1c1d20;
  --hover:#1f2124; --hover-2:#282a2e;
  --ink:#f2f3f4; --ink-2:#a5a8ad; --ink-3:#6c6f75;
  --line:#26282b; --line-strong:#33363a; --field:#1f2124; --stripe:#161719;
  --accent:#3d9aff; --accent-ink:#7ec0ff; --accent-tint:#3d9aff26;
  --green:#3dbb72; --green-tint:#3dbb7222;
  --orange:#f68f3c; --orange-tint:#f68f3c22;
  --red:#ee5c61; --red-tint:#ee5c6122;
  --texture:rgba(255,255,255,.016);
  --shadow-card:0 0 0 1px var(--line), 0 1px 2px #0004, 0 2px 6px #0004;
  --shadow-btn:0 0 0 1px var(--line-strong), 0 1px 2px #0006;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background:
    repeating-linear-gradient(-45deg, transparent 0 7px, var(--texture) 7px 8px),
    var(--page);
  color: var(--ink); font-family: var(--sans); font-size: 14px; line-height: 1.5;
  -webkit-font-smoothing: antialiased; transition: background .15s, color .15s;
}
a { color: var(--accent-ink); text-decoration: none; }
a:hover { text-decoration: underline; }
.app { display: grid; grid-template-columns: 272px 1fr; min-height: 100vh; }
@media (max-width: 820px) { .app { grid-template-columns: 1fr; } }

/* sidebar */
.side { position: sticky; top: 0; align-self: start; height: 100vh; overflow: auto;
  border-right: 1px solid var(--line); padding: 26px 22px; display: flex; flex-direction: column; gap: 20px; }
@media (max-width: 820px) { .side { position: static; height: auto; border-right: none; border-bottom: 1px solid var(--line); } }
.brand-row { display: flex; align-items: center; justify-content: space-between; }
.brand { display: flex; align-items: center; gap: 10px; }
.mark { width: 32px; height: 32px; border-radius: 9px; background: var(--ink); color: var(--surface);
  display: grid; place-items: center; font-weight: 700; font-size: 12px; letter-spacing: -.02em; }
.brand b { font-size: 14px; font-weight: 600; }
.headline { font-size: 22px; font-weight: 600; letter-spacing: -.02em; line-height: 1.2; }
.headline .sub { display: block; margin-top: 6px; font-size: 12px; color: var(--ink-3); font-family: var(--mono); font-weight: 400; letter-spacing: 0; }
.rule { height: 1px; background: var(--line); border: 0; margin: 2px 0; }
.rule.dash { height: 0; border-top: 1px dashed var(--line-strong); background: none; }
.eyebrow { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-3); font-weight: 500; }
nav { display: flex; flex-direction: column; gap: 2px; }
nav a { display: flex; align-items: center; justify-content: space-between; padding: 8px 11px; border-radius: var(--radius-control);
  color: var(--ink-2); font-size: 13.5px; font-weight: 500; }
nav a:hover { background: var(--hover); text-decoration: none; color: var(--ink); }
nav a.on { background: var(--hover-2); color: var(--ink); }
nav a .n { font-family: var(--mono); font-size: 11px; color: var(--ink-3); }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 12px; }
.status { display: inline-flex; align-items: center; gap: 8px; font-size: 12px; color: var(--ink-2); font-family: var(--mono); }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 3px var(--green-tint); }
.dot.off { background: var(--red); box-shadow: 0 0 0 3px var(--red-tint); }
.row { display: flex; gap: 8px; align-items: center; }
button, input { font: inherit; color: inherit; }
.btn { display: inline-flex; align-items: center; gap: 7px; background: var(--surface); color: var(--ink);
  box-shadow: var(--shadow-btn); padding: 7px 11px; border-radius: var(--radius-control); border: 0; cursor: pointer;
  transition: background .15s; font-size: 12.5px; font-weight: 500; }
.btn:hover { background: var(--hover); }
.btn.primary { background: var(--accent); color: #fff; box-shadow: none; }
.seg { display: inline-flex; background: var(--inset); box-shadow: var(--shadow-hairline); border-radius: 999px; padding: 2px; }
.seg button { border: 0; background: none; cursor: pointer; width: 30px; height: 24px; border-radius: 999px; color: var(--ink-3); font-size: 12px; display: grid; place-items: center; }
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-hairline); }
.keybox { display: none; flex-direction: column; gap: 8px; }
.keybox.open { display: flex; }
.keybox input { background: var(--field); border: 0; box-shadow: var(--shadow-hairline); border-radius: var(--radius-control);
  padding: 8px 10px; color: var(--ink); font-family: var(--mono); font-size: 12px; }
.muted { color: var(--ink-3); font-size: 11.5px; line-height: 1.45; }

/* content */
.main { padding: 30px clamp(18px, 4vw, 46px) 80px; max-width: 1200px; }
.err { display: none; margin: 0 0 20px; padding: 11px 15px; border-radius: var(--radius-control);
  background: var(--red-tint); color: var(--red); box-shadow: var(--shadow-hairline); font-size: 13px; }
.err.show { display: block; }
section { scroll-margin-top: 20px; }
section + section { margin-top: 30px; padding-top: 30px; border-top: 1px dashed var(--line-strong); }
.sec-head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.sec-head .num { font-family: var(--mono); font-size: 12px; color: var(--ink-3); font-weight: 500; }
.sec-head h2 { margin: 0; font-size: 15px; font-weight: 600; letter-spacing: -.01em; }
.sec-head .desc { color: var(--ink-3); font-size: 13px; }
.sec-head .chip { margin-left: auto; }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.card { background: var(--surface); box-shadow: var(--shadow-card); border-radius: var(--radius-card); padding: 15px 16px; }
.card .k { color: var(--ink-3); font-size: 11px; font-weight: 500; text-transform: uppercase; letter-spacing: .05em; }
.card .v { font-size: 27px; font-weight: 600; margin-top: 8px; font-family: var(--mono); letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.card.accent .v { color: var(--accent); }
.card.red .v { color: var(--red); }
.card.green .v { color: var(--green); }
.card.warn .v { color: var(--orange); }

.board { background: var(--surface); box-shadow: var(--shadow-card); border-radius: var(--radius-card); overflow: hidden; }
.scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; color: var(--ink-3); font-weight: 500; font-size: 11px; text-transform: uppercase; letter-spacing: .05em;
  padding: 12px 18px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 13px 18px; border-bottom: 1px solid var(--line); vertical-align: middle; white-space: nowrap; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--hover); }
.co .nm { font-weight: 550; }
.co .dm { color: var(--ink-3); font-size: 12px; font-family: var(--mono); }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.chip { color: var(--ink-2); font-size: 11.5px; font-family: var(--mono); background: var(--inset);
  box-shadow: var(--shadow-hairline); padding: 1px 8px; border-radius: 999px; }
.badge { display: inline-block; padding: 2px 9px; border-radius: var(--radius-chip); font-size: 11px; font-weight: 600; text-transform: capitalize; }
.badge.hot { background: var(--red-tint); color: var(--red); }
.badge.warm { background: var(--orange-tint); color: var(--orange); }
.badge.ok { background: var(--green-tint); color: var(--green); }
.badge.src { background: var(--accent-tint); color: var(--accent-ink); text-transform: uppercase; font-size: 10px; letter-spacing: .04em; }
.score { display: flex; align-items: center; gap: 10px; min-width: 130px; }
.bar { flex: 1; height: 6px; border-radius: 999px; background: var(--inset); box-shadow: var(--shadow-hairline); overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--accent); }
.empty { padding: 46px 18px; text-align: center; color: var(--ink-3); font-size: 13px; }
.empty .big { font-size: 14px; color: var(--ink-2); margin-bottom: 4px; font-weight: 550; }

/* workbench additions */
[hidden] { display: none !important; }
.btn.sm { padding: 4px 8px; font-size: 11.5px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.danger { color: var(--red); }
.card a, a.card { color: inherit; }
a.card:hover { text-decoration: none; background: var(--hover); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips button { border: 0; cursor: pointer; font: inherit; font-size: 12px; font-weight: 500; padding: 4px 10px;
  border-radius: 999px; background: var(--inset); color: var(--ink-2); box-shadow: var(--shadow-hairline); }
.chips button .n { font-family: var(--mono); font-size: 11px; color: var(--ink-3); margin-left: 5px; }
.chips button.on { background: var(--accent-tint); color: var(--accent-ink); box-shadow: 0 0 0 1px var(--accent); }
.chips button.on .n { color: var(--accent-ink); }
.chips .sep { width: 1px; background: var(--line-strong); margin: 2px 4px; }
.filters { margin-bottom: 14px; }
tbody tr.rowlink { cursor: pointer; }
.sig { color: var(--ink-2); font-size: 12px; white-space: normal; min-width: 150px; }
.next { color: var(--ink-3); font-size: 12px; white-space: normal; min-width: 120px; }
#accBody .score { min-width: 110px; }
.badge.st-new { background: var(--accent-tint); color: var(--accent-ink); }
.badge.st-contacted { background: var(--orange-tint); color: var(--orange); }
.badge.st-replied, .badge.st-qualified, .badge.st-won { background: var(--green-tint); color: var(--green); }
.badge.st-lost, .badge.st-ignored, .badge.st-draft { background: var(--inset); color: var(--ink-3); }
.badge.st-sent { background: var(--orange-tint); color: var(--orange); }
.badge.dnc { background: var(--red-tint); color: var(--red); }

/* drawer */
.backdrop { position: fixed; inset: 0; z-index: 19; background: #0008; opacity: 0; pointer-events: none; transition: opacity .2s; }
.backdrop.show { opacity: 1; pointer-events: auto; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(720px, 100vw); z-index: 20; background: var(--surface);
  box-shadow: -1px 0 0 var(--line), -16px 0 40px #10182818; transform: translateX(100%); transition: transform .2s ease;
  display: flex; flex-direction: column; }
.drawer.open { transform: none; }
.d-head { display: flex; gap: 14px; align-items: flex-start; padding: 18px 22px; border-bottom: 1px solid var(--line); }
.d-title { min-width: 0; }
.d-name { font-size: 16px; font-weight: 600; letter-spacing: -.01em; }
.d-head .d-score { margin-left: auto; min-width: 150px; }
.d-ctl { padding: 12px 22px; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 10px; }
.row.wrap { flex-wrap: wrap; align-items: flex-end; gap: 12px; }
.fld { display: flex; flex-direction: column; gap: 4px; font-size: 11.5px; color: var(--ink-3); }
.fld .row { gap: 4px; }
.fld input, .d-body input, .d-body select, .d-body textarea, .keybox input {
  background: var(--field); border: 0; box-shadow: var(--shadow-hairline); border-radius: var(--radius-control);
  padding: 7px 10px; font: inherit; font-size: 13px; color: var(--ink); }
.fld input { width: 150px; }
.fld input[type=date] { width: 150px; font-family: var(--mono); font-size: 12px; }
.d-body textarea { font-family: var(--sans); line-height: 1.5; resize: vertical; min-height: 220px; width: 100%; }
.d-body textarea.short { min-height: 72px; }
.tabs { display: flex; flex-direction: row; gap: 2px; padding: 0 22px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tabs button { border: 0; background: none; font: inherit; font-size: 13px; font-weight: 500; color: var(--ink-2); padding: 10px 12px;
  cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs button.on { color: var(--ink); border-bottom-color: var(--ink); }
.tabs .n { font-family: var(--mono); font-size: 11px; color: var(--ink-3); }
.d-body { flex: 1; overflow: auto; padding: 18px 22px; display: flex; flex-direction: column; gap: 18px; }
.d-body h3 { margin: 0 0 8px; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); font-weight: 500; }
.d-body .board { overflow-x: auto; }
.d-body .board td, .d-body .board th { padding: 9px 12px; }
#dSubject { width: 100%; }
.d-body .board td { white-space: normal; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: grid; grid-template-columns: 64px 1fr auto; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--line); font-size: 12.5px; }
.timeline li:last-child { border-bottom: none; }
.timeline .when { color: var(--ink-3); font-family: var(--mono); font-size: 11.5px; }
.timeline .meta { color: var(--ink-3); font-size: 11.5px; font-family: var(--mono); white-space: nowrap; }
.composer { display: grid; grid-template-columns: 1fr 1fr auto; gap: 8px; align-items: end; }
.composer .fld { min-width: 0; }
.composer select, .composer input { width: 100%; }
.seg.ch { align-self: flex-start; }
.seg.ch button { width: auto; padding: 0 10px; font-size: 12px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.actions .spacer { flex: 1; }
.form { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 8px; align-items: end; }
.log { list-style: none; margin: 0; padding: 0; }
.log li { padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.log li:last-child { border-bottom: none; }
.log .who { color: var(--ink-3); font-size: 11.5px; font-family: var(--mono); margin-top: 3px; }
.log .body { white-space: pre-wrap; }
.toast { position: absolute; bottom: 16px; left: 22px; right: 22px; padding: 9px 12px; border-radius: var(--radius-control);
  background: var(--ink); color: var(--surface); font-size: 12.5px; z-index: 2; }
.hint { color: var(--ink-3); font-size: 12px; }
.copy { cursor: copy; }
.copy:hover { text-decoration: underline; }
@media (max-width: 820px) {
  .composer { grid-template-columns: 1fr; }
  .d-head .d-score { display: none; }
  #accBody th:nth-child(2), #accBody td:nth-child(2), #accBody th:nth-child(3), #accBody td:nth-child(3),
  #accBody th:nth-child(4), #accBody td:nth-child(4), #accBody th:nth-child(6), #accBody td:nth-child(6),
  #accBody th:nth-child(7), #accBody td:nth-child(7) { display: none; }
}
