/* ==========================================================================
   Prospects — internal outreach board. Deliberately plain: system fonts, flat
   surfaces, dense rows. Built to be scanned fast, not admired.
   ========================================================================== */
:root {
  --ink: #e7e9ec;
  --ink-2: #aeb4bc;
  --ink-3: #797f88;
  --line: #33383f;
  --line-2: #262a30;
  --paper: #121417;
  --card: #1b1f24;
  --field: #20252b;
  --strong: #2b3038;
  --brand: #2f8c68;
  --brand-2: #45b489;
  --warn: #d99a3e;
  --bad: #e2665c;
  --ok: #45b489;
  --radius: 6px;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--paper);
  color: var(--ink);
  font: 14px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--brand-2); }
h1, h2, h3 { margin: 0; font-weight: 600; }

/* ------------------------------------------------------------------ login */
#login-view {
  min-height: 100vh; display: grid; place-items: center; padding: 24px;
}
#login-view.hidden { display: none; }
.login-card {
  width: 100%; max-width: 340px; background: var(--card);
  border: 1px solid var(--line); border-radius: var(--radius); padding: 26px 24px;
}
.login-card h1 { font-size: 20px; letter-spacing: -.01em; }
.login-card .sub { margin: 6px 0 20px; color: var(--ink-3); font-size: 13px; }
.login-label { display: block; font-size: 12px; color: var(--ink-2); margin-bottom: 6px; }
.login-foot { margin-top: 18px; font-size: 11px; color: var(--ink-3); text-align: center; }

/* ------------------------------------------------------------------ forms */
input, select, textarea, .field {
  width: 100%; font: inherit; color: var(--ink); background: var(--field);
  border: 1px solid var(--line); border-radius: 4px; padding: 6px 8px;
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid rgba(69,180,137,.35); outline-offset: -1px; border-color: var(--brand-2);
}
textarea { resize: vertical; min-height: 34px; font-size: 13px; }

.btn {
  font: inherit; font-size: 13px; line-height: 1; cursor: pointer;
  border: 1px solid var(--line); background: var(--field); color: var(--ink);
  border-radius: 4px; padding: 8px 12px; text-decoration: none; display: inline-block;
}
.btn:hover { border-color: var(--ink-3); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-2); }
.btn.block { width: 100%; padding: 10px; }
.btn.sm { padding: 5px 8px; font-size: 12px; }
/* Destructive-ish, and rarely the thing you meant to click: readable but never
   the loudest control in its row. */
.btn.danger { color: var(--bad); border-color: rgba(226,102,92,.35); }
.btn.danger:hover { border-color: var(--bad); background: rgba(226,102,92,.12); }
.btn[disabled] { opacity: .55; cursor: default; }

.alert { display: none; font-size: 12px; margin: 8px 0; color: var(--bad); }
.alert.on { display: block; }
.alert.info { color: var(--ink-2); }

/* -------------------------------------------------------------------- app */
#app { display: none; max-width: 1400px; margin: 0 auto; padding: 0 16px 80px; }
#app.on { display: block; }

.top { padding: 18px 0 10px; border-bottom: 1px solid var(--line); }
.top-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.wordmark { font-size: 18px; letter-spacing: -.01em; }
.top-actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }

/* view tabs — Prospects / Campaigns */
.views { display: flex; gap: 2px; background: var(--field); border: 1px solid var(--line); border-radius: 5px; padding: 2px; }
.tab {
  font: inherit; font-size: 12.5px; line-height: 1; cursor: pointer; border: 0; background: none;
  color: var(--ink-2); border-radius: 3px; padding: 7px 12px;
}
.tab:hover { color: var(--ink); }
.tab.on { background: var(--strong); color: #fff; }

.summary { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.pill {
  background: var(--card); border: 1px solid var(--line); border-radius: 999px;
  padding: 5px 11px; font-size: 12px; color: var(--ink-2); cursor: pointer;
}
.pill:hover { border-color: var(--ink-3); }
.pill b { color: var(--ink); font-variant-numeric: tabular-nums; margin-right: 5px; }
.pill.total { background: var(--strong); border-color: var(--strong); color: #fff; cursor: default; }
.pill.total b { color: #fff; }
.pill.on { border-color: var(--brand); box-shadow: inset 0 0 0 1px var(--brand); }

/* --------------------------------------------------------------- controls */
.controls {
  display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap;
  padding: 14px 0; position: sticky; top: 0; background: var(--paper); z-index: 5;
  border-bottom: 1px solid var(--line-2);
}
.ctl { display: block; font-size: 11px; color: var(--ink-3); }
.ctl span { display: block; margin-bottom: 4px; text-transform: uppercase; letter-spacing: .06em; }
.ctl select, .ctl input { min-width: 150px; font-size: 13px; }
.ctl.grow { flex: 1 1 200px; }
.ctl.grow input { width: 100%; }
.controls .btn { margin-bottom: 1px; }

/* --------------------------------------------------------------- add form */
.add-form {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; margin: 14px 0;
}
.add-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; }
/* display:grid would otherwise beat the UA's [hidden] rule */
.add-grid[hidden] { display: none; }
.add-grid label { display: block; font-size: 11px; color: var(--ink-3); }
.add-grid label span { display: block; margin-bottom: 4px; text-transform: uppercase; letter-spacing: .06em; }
.add-grid .wide { grid-column: span 2; }
.add-grid .wide2 { grid-column: 1 / -1; }
.add-foot { display: flex; align-items: center; gap: 10px; margin-top: 14px; }
.add-foot .alert { margin: 0; flex: 1; }
.add-grid label.check { display: flex; align-items: center; gap: 7px; align-self: end; padding-bottom: 7px; }
.add-grid label.check input { width: 15px; height: 15px; }
.add-grid label.check span { margin: 0; }
.panel-head { font-size: 13px; font-weight: 600; margin-bottom: 12px; display: flex; gap: 8px; align-items: baseline; }

/* --------------------------------------------------------- selection bar */
.selbar {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 10px 12px; margin: 12px 0 0;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
}
.selall { display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--ink-2); cursor: pointer; }
.selall input { width: 15px; height: 15px; }
.sel-count { font-size: 12px; color: var(--ink-3); font-variant-numeric: tabular-nums; margin-right: auto; }
.sel-count.on { color: var(--brand-2); }
.selset { display: flex; align-items: center; gap: 7px; font-size: 11px; color: var(--ink-3); }
.selset span { text-transform: uppercase; letter-spacing: .06em; white-space: nowrap; }
.selset select { width: auto; min-width: 130px; font-size: 12.5px; padding: 5px 8px; }

/* channel toggle on the campaign form */
.chan { display: flex; flex-wrap: wrap; gap: 16px; margin: 12px 0 2px; font-size: 12.5px; color: var(--ink-2); }
.chan label { display: flex; align-items: center; gap: 7px; cursor: pointer; }
.chan input { width: 15px; height: 15px; }
.cf-note {
  margin-top: 10px; padding: 10px 12px; font-size: 12.5px; color: var(--ink-2);
  border: 1px solid rgba(217,154,62,.35); background: rgba(217,154,62,.10); border-radius: 4px;
}

/* campaign creation result — deliberately loud, never a disappearing toast */
.cf-result {
  margin-top: 14px; padding: 12px; border: 1px solid var(--line);
  border-radius: 4px; background: var(--paper); font-size: 12.5px;
}
.cf-result h3 { font-size: 13px; margin-bottom: 8px; }
.cf-result ul { margin: 6px 0 0; padding-left: 18px; color: var(--ink-2); }
.cf-result li { margin-bottom: 3px; }
.cf-result .why { color: var(--warn); }

/* ------------------------------------------------------------------ board */
.region { margin: 22px 0 0; }
.region-head {
  display: flex; align-items: baseline; gap: 10px;
  padding: 8px 0; border-bottom: 2px solid var(--ink);
}
.region-head h2 { font-size: 14px; letter-spacing: .02em; text-transform: uppercase; }
.region-head .count { font-size: 12px; color: var(--ink-3); font-variant-numeric: tabular-nums; }

.row {
  display: grid; gap: 10px 14px; align-items: start;
  grid-template-columns: 24px 1.4fr 1.3fr 1.6fr 1fr;
  background: var(--card); border: 1px solid var(--line); border-top: 0;
  padding: 12px 14px;
}
.region .row:first-of-type { border-top: 1px solid var(--line); }
.row.busy { opacity: .55; }
.row.sel { box-shadow: inset 0 0 0 1px var(--brand); }
.p-sel { padding-top: 2px; }
.p-sel input { width: 15px; height: 15px; cursor: pointer; }

.p-name { font-weight: 600; font-size: 14px; }
.p-where { color: var(--ink-3); font-size: 12px; margin-top: 2px; }
.p-issue { font-size: 12.5px; color: var(--ink-2); }
.p-site { font-size: 12.5px; word-break: break-word; }
.p-contact { font-size: 12.5px; color: var(--ink-2); margin-top: 4px; }
.p-contact a { display: inline-block; margin-right: 8px; }

.badge {
  display: inline-block; font-size: 10.5px; text-transform: uppercase; letter-spacing: .05em;
  border: 1px solid var(--line); border-radius: 3px; padding: 1px 5px; color: var(--ink-2);
  background: var(--field); margin-right: 5px; white-space: nowrap;
}
.badge.no_site, .badge.broken, .badge.broken_domain, .badge.expired_domain { color: var(--bad); border-color: rgba(226,102,92,.35); background: rgba(226,102,92,.12); }
.badge.outdated, .badge.city_subpage { color: var(--warn); border-color: rgba(217,154,62,.35); background: rgba(217,154,62,.12); }

/* "queued in a campaign" — deliberately NOT one of the status colours and not a
   .badge: a dashed violet chip that reads as a temporary claim on the row, not
   as pipeline progress. Sits above the status select so the two can't be
   confused, and vanishes by itself when the send goes out. */
.qbadge {
  display: block; margin-bottom: 7px;
  font-size: 10.5px; text-transform: uppercase; letter-spacing: .05em; line-height: 1.5;
  padding: 3px 7px; border-radius: 4px;
  color: #c3a4ec; border: 1px dashed rgba(163,124,224,.55); background: rgba(163,124,224,.13);
}
/* The campaign name wraps rather than being clipped — the last board column is
   narrow and a truncated-to-nothing name would be worse than two lines. */
.qbadge b {
  font-weight: 700; text-transform: none; letter-spacing: 0; color: #ddcaf7;
  overflow-wrap: anywhere;
}
.qb-ico { margin-right: 4px; }

.field-row { display: flex; gap: 6px; align-items: center; margin-bottom: 6px; }
.field-row select { font-size: 12.5px; }
.field-row input { font-size: 12.5px; font-family: var(--mono); }
.mini { font-size: 10.5px; color: var(--ink-3); text-transform: uppercase; letter-spacing: .06em; }
.demo-link { font-size: 11.5px; }
.row-del {
  border: 0; background: none; color: var(--ink-3); cursor: pointer; font-size: 12px; padding: 2px 4px;
}
.row-del:hover { color: var(--bad); }

/* Status colour: the left stripe reads the state at the edge, the low-saturation
   full-row tint lets a long list be scanned by colour alone. Kept dark and
   desaturated so a screen of rows stays calm. */
.st-new         { border-left: 3px solid #565c64; background: #1b1f24; }
/* reviewed and approved by Cem, not yet written to — a muted sage between the
   grey of untouched and the blue of contacted */
.st-checked     { border-left: 3px solid #86a07e; background: #1a2019; }
/* queued in a campaign, nothing sent yet — violet, matching the "Queued" chip,
   so the two read as the same fact told twice */
.st-campaigned  { border-left: 3px solid #a37ce0; background: #1e1a26; }
.st-contacted   { border-left: 3px solid #7d9bc4; background: #1e242c; }
.st-mailed      { border-left: 3px solid #6d93d6; background: #182131; }
/* we mailed them and it came back — a rust red that reads as "broken", clearly
   apart from the greys of not_interested/dead, which mean the business is out */
.st-bounced     { border-left: 3px solid #c26a55; background: #261a17; }
.st-replied     { border-left: 3px solid #d8a33a; background: #262015; }
.st-demo_built  { border-left: 3px solid #4dae82; background: #16251f; }
.st-won         { border-left: 3px solid var(--ok); background: #122a1f; }
.st-not_interested { border-left: 3px solid #565c64; background: #1a1a1d; }
.st-dead        { border-left: 3px solid #3d424a; background: #141618; }

/* ------------------------------------------------------- socials + email */
.p-socials { display: flex; align-items: center; gap: 6px; margin-top: 4px; }
.soc {
  display: inline-flex; align-items: center; justify-content: center;
  width: 20px; height: 20px; border: 1px solid var(--line); border-radius: 4px;
  color: var(--ink-2); background: var(--field); text-decoration: none;
}
.soc:hover { color: var(--ink); border-color: var(--ink-3); }
.soc svg { display: block; }

.vdot {
  display: inline-block; width: 7px; height: 7px; border-radius: 50%;
  margin-left: 4px; vertical-align: middle; background: var(--ink-3);
}
.vdot.v-valid { background: var(--ok); }
.vdot.v-invalid { background: var(--bad); }

/* contact-group badge — which outreach channel this row actually has */
.badge.cgroup { font-weight: 600; }
.badge.cg-verified { color: var(--ok); border-color: rgba(69,180,137,.4); background: rgba(69,180,137,.14); }
.badge.cg-unverified { color: var(--warn); border-color: rgba(217,154,62,.4); background: rgba(217,154,62,.14); }
.badge.cg-invalid { color: var(--bad); border-color: rgba(226,102,92,.4); background: rgba(226,102,92,.14); }
.badge.cg-social { color: #7ea3e0; border-color: rgba(126,163,224,.4); background: rgba(126,163,224,.14); }
.badge.cg-none { color: var(--ink-3); border-color: var(--line); background: var(--field); }

.badge.channel {
  color: var(--warn); border-color: rgba(217,154,62,.35); background: rgba(217,154,62,.12);
  text-transform: none; letter-spacing: 0; font-size: 10.5px; margin-top: 4px;
}
.soc-edit { display: grid; gap: 5px; margin-top: 6px; }
.soc-edit input { font-size: 11.5px; font-family: var(--mono); padding: 4px 6px; }
/* Contact fields are edited straight on the row — a lot of prospects have no
   address yet and finding one is the daily job. */
.contact-edit { display: grid; gap: 5px; margin-top: 6px; }
.contact-edit input { font-size: 11.5px; font-family: var(--mono); padding: 4px 6px; }

.empty { padding: 40px 0; text-align: center; color: var(--ink-3); }

/* -------------------------------------------------------------- campaigns */
.poll-note { font-size: 11.5px; color: var(--ink-3); margin-left: auto; align-self: center; }
.crow {
  background: var(--card); border: 1px solid var(--line); border-top: 0; padding: 12px 14px;
}
#campaigns .crow:first-child { border-top: 1px solid var(--line); border-radius: var(--radius) var(--radius) 0 0; }
#campaigns .crow:last-child { border-radius: 0 0 var(--radius) var(--radius); }
.chead { display: grid; grid-template-columns: 1.6fr auto 1.4fr 1.2fr auto; gap: 12px; align-items: center; }
.cname {
  font: inherit; font-size: 14px; font-weight: 600; text-align: left; color: var(--ink);
  background: none; border: 0; padding: 0; cursor: pointer;
}
.cname:hover { color: var(--brand-2); }
.cwhen { font-size: 11px; color: var(--ink-3); margin-top: 2px; }
.cbadge {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: .05em; white-space: nowrap;
  border: 1px solid var(--line); border-radius: 3px; padding: 2px 6px; background: var(--field); color: var(--ink-2);
}
.cbadge.cs-running { color: var(--ok); border-color: rgba(69,180,137,.4); background: rgba(69,180,137,.12); }
/* started by Cem, held behind the one email campaign that is actually sending */
.cbadge.cs-waiting { color: #c3a4ec; border-color: rgba(163,124,224,.45); background: rgba(163,124,224,.13); }
.cwait { font-size: 11.5px; color: #c3a4ec; margin-top: 4px; }
.cwait b { color: #ddcaf7; }
.cbadge.cs-paused { color: var(--warn); border-color: rgba(217,154,62,.35); background: rgba(217,154,62,.12); }
.cbadge.cs-completed { color: var(--brand-2); }
.cprog { min-width: 120px; }
.bar { height: 6px; border-radius: 3px; background: var(--strong); overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--brand-2); }
.cnum { display: block; font-size: 11.5px; color: var(--ink-3); margin-top: 4px; font-variant-numeric: tabular-nums; }
.cnext { font-size: 11.5px; color: var(--ink-2); }
.cdetail { margin-top: 12px; border-top: 1px solid var(--line-2); padding-top: 10px; overflow-x: auto; }
table.sends { width: 100%; border-collapse: collapse; font-size: 12px; }
table.sends th {
  text-align: left; font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--ink-3); font-weight: 500; padding: 4px 8px 6px; border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
table.sends td { padding: 6px 8px; border-bottom: 1px solid var(--line-2); vertical-align: top; color: var(--ink-2); }
table.sends td.who { color: var(--ink); }
.sd { font-size: 10.5px; text-transform: uppercase; letter-spacing: .05em; }
.sd-sent { color: var(--ok); }
.sd-failed { color: var(--bad); }
.sd-skipped { color: var(--ink-3); }
.sd-queued { color: var(--ink-2); }

.cbadge.ch-manual { color: var(--warn); border-color: rgba(217,154,62,.35); background: rgba(217,154,62,.12); }
.cbadge.ch-email { color: var(--ink-2); }
/* manual sends: the reach-them-by-hand column plus its two actions */
td.reach a { display: inline-block; margin-right: 8px; }
td.acts { white-space: nowrap; }
td.acts .btn { margin-right: 6px; }

/* -------------------------------------------------------------- templates */
/* The outreach copy, edited in place: the fields on the left, what they produce
   on the right. Same surfaces and the same tokens as the rest of the board —
   this is a form and a <pre>, not a new visual language. */
.tpl-wrap {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 14px; align-items: start; margin-top: 14px;
}
.tpl-form, .tpl-preview {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px;
}
.tpl-field { display: block; margin-bottom: 14px; }
.tpl-field span {
  display: block; margin-bottom: 4px; font-size: 11px; color: var(--ink-3);
  text-transform: uppercase; letter-spacing: .06em;
}
.tpl-field textarea { font-size: 12.5px; line-height: 1.5; }
.fhint { display: block; margin-top: 4px; font-size: 11.5px; color: var(--ink-3); font-style: normal; }

/* The placeholder cheat-sheet: always on screen, never a tooltip you have to
   find — these seven tokens are the whole contract. */
.tokens {
  display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: baseline;
  padding: 10px 12px; margin-bottom: 16px;
  background: var(--paper); border: 1px solid var(--line-2); border-radius: 4px;
}
.tokens b { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); }
.tok { display: inline-flex; align-items: baseline; gap: 6px; font-size: 11.5px; }
.tok code { font: 11.5px var(--mono); color: var(--brand-2); }
.tok i { font-style: normal; color: var(--ink-3); font-size: 11px; }

/* Which row is in play: the fallback, an inherited view of it, or a real override. */
.t-state { font-size: 12px; color: var(--ink-2); align-self: center; margin-right: auto; }
.t-state.inh { color: var(--warn); }

.tpl-preview { position: sticky; top: 66px; }
.tpl-preview .views { margin: 0 0 10px; }
#t-preview {
  margin: 0; white-space: pre-wrap; word-break: break-word; max-height: 62vh; overflow: auto;
  font: 12.5px/1.55 var(--mono); color: var(--ink-2);
  background: var(--paper); border: 1px solid var(--line-2); border-radius: 4px; padding: 12px;
}

/* ---------------------------------------------------------------- preview */
#preview {
  position: fixed; inset: 0; z-index: 60; background: rgba(0,0,0,.6);
  display: grid; place-items: center; padding: 20px;
}
#preview[hidden] { display: none; }
.pv-card {
  width: 100%; max-width: 700px; max-height: 82vh; display: flex; flex-direction: column;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
}
.pv-head {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 12px 14px; border-bottom: 1px solid var(--line);
}
.pv-head h2 { font-size: 14px; }
.pv-head .views { margin-left: auto; }
.pv-body { overflow: auto; padding: 14px; }
.pv-body pre {
  margin: 0; white-space: pre-wrap; word-break: break-word;
  font: 12.5px/1.55 var(--mono); color: var(--ink-2);
}

/* ----------------------------------------------------------------- toasts */
#toasts { position: fixed; right: 14px; bottom: 14px; display: grid; gap: 8px; z-index: 50; }
.toast {
  background: var(--strong); color: #fff; font-size: 12.5px; padding: 9px 13px;
  border-radius: 4px; max-width: 320px; border: 1px solid var(--line);
}
.toast.bad { background: var(--bad); }

@media (max-width: 1100px) {
  .chead { grid-template-columns: 1fr auto auto; }
  .cnext { grid-column: 1 / -1; }
  /* Two narrow columns would make both the textareas and the preview unreadable;
     stack them and let the preview stop being sticky. */
  .tpl-wrap { grid-template-columns: minmax(0, 1fr); }
  .tpl-preview { position: static; }
}
@media (max-width: 900px) {
  .row { grid-template-columns: 24px 1fr 1fr; }
}
@media (max-width: 620px) {
  .row { grid-template-columns: 24px 1fr; }
  .add-grid .wide, .add-grid .wide2 { grid-column: auto; }
  .controls { position: static; }
}
