/* Console styling. Dense and legible — this is a working tool, not a landing page.
   Served as a file rather than inlined because the CSP forbids inline styles. */

:root {
  --ink: #1c1a17;
  --ash: #5b5249;
  --dim: #8a8175;
  --line: #e7e0d4;
  --paper: #fbf7f0;
  --card: #ffffff;
  --accent: #e0501e;
  --good: #2f7d3f;
  --warn: #b3411b;
  --mono: ui-monospace, SFMono-Regular, Menlo, monospace;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 14px/1.5 -apple-system, "Segoe UI", Roboto, "Noto Sans Thai", Helvetica, Arial, sans-serif;
}

body.centred { display: grid; place-items: center; min-height: 100vh; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 32px 36px; max-width: 420px; }

.top {
  display: flex; align-items: center; gap: 24px;
  padding: 12px 22px; background: var(--card); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 5;
}
.brand { font-weight: 700; letter-spacing: .5px; }
.brand span { color: var(--accent); font-weight: 600; }
.top nav { display: flex; gap: 4px; flex: 1; }
.nav { padding: 5px 11px; border-radius: 999px; color: var(--ash); text-decoration: none; }
.nav:hover { background: var(--paper); }
.nav.on { background: var(--ink); color: #fff; }
.who { display: flex; align-items: center; gap: 10px; color: var(--ash); font-size: 13px; }
.who form { display: inline; }
.role { font-size: 11px; text-transform: uppercase; letter-spacing: .5px; color: var(--dim); border: 1px solid var(--line); border-radius: 4px; padding: 1px 5px; }
.link { background: none; border: 0; color: var(--ash); cursor: pointer; text-decoration: underline; font: inherit; padding: 0; }

main { padding: 22px; max-width: 1400px; margin: 0 auto; }

.head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 14px; flex-wrap: wrap; }
h1 { font-size: 21px; margin: 0; }
h2 { font-size: 14px; margin: 0 0 10px; text-transform: uppercase; letter-spacing: .6px; color: var(--ash); }
.counts { color: var(--ash); font-size: 13px; }
.back { margin: 0 0 12px; }
.back a, a { color: var(--accent); }

.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.filters input, .filters select, .filters button {
  font: inherit; padding: 6px 9px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); color: var(--ink);
}
.filters input[type="search"] { min-width: 220px; }
.filters .minscore { color: var(--ash); font-size: 13px; display: flex; align-items: center; gap: 6px; }
.filters .minscore input { width: 68px; }
.filters button { background: var(--ink); color: #fff; border-color: var(--ink); cursor: pointer; }
.filters .clear { color: var(--ash); font-size: 13px; }

table { border-collapse: collapse; width: 100%; background: var(--card); }
.leads { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .6px; color: var(--dim); padding: 9px 12px; border-bottom: 1px solid var(--line); font-weight: 600; }
td { padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
.row:hover { background: #fcfaf6; }
.row.suppressed { opacity: .55; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.contact { max-width: 320px; overflow-wrap: anywhere; }
.mono { font-family: var(--mono); font-size: 12.5px; }
.wrap { overflow-wrap: anywhere; }
.dim { color: var(--dim); }
.warn { color: var(--warn); }
.empty { color: var(--ash); padding: 28px; text-align: center; background: var(--card); border: 1px dashed var(--line); border-radius: 10px; }

.chip { display: inline-block; font-size: 11px; padding: 1px 7px; border-radius: 999px; border: 1px solid var(--line); color: var(--ash); white-space: nowrap; }
.chip.chain { border-color: #e6c9b8; color: var(--warn); }
.chip.supp { border-color: #d9b3a8; background: #fdeee8; color: var(--warn); }
.chip.line { border-color: #bfe3c4; color: var(--good); }
.chip.c-high { border-color: #bfe3c4; color: var(--good); }
.chip.c-medium { border-color: #e8dcb0; color: #8a6d1f; }
.chip.c-low { border-color: var(--line); color: var(--dim); }
.chip.s-new { border-color: var(--line); }
.chip.s-contacted, .chip.s-queued, .chip.s-approved { border-color: #c9d8ea; color: #2a557f; }
.chip.s-replied, .chip.s-meeting, .chip.s-won { border-color: #bfe3c4; color: var(--good); }
.chip.s-lost, .chip.s-unqualified, .chip.s-do_not_contact { border-color: #d9b3a8; color: var(--warn); }

.pager { margin-top: 14px; }
.next { font-weight: 600; }

.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 900px) { .cols { grid-template-columns: 1fr; } }
section { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 16px 18px; margin-bottom: 18px; }
.score { float: right; font-size: 20px; font-weight: 700; color: var(--accent); }
.reasons { margin: 0 0 12px; padding-left: 18px; color: var(--ash); }
.reasons li { margin: 2px 0; }
dl { display: grid; grid-template-columns: 110px 1fr; gap: 4px 12px; margin: 0; }
dt { color: var(--dim); font-size: 12.5px; }
dd { margin: 0; }
.mini td, .mini th { padding: 5px 8px; font-size: 13px; }
.notice { background: #fdf6e8; border: 1px solid #e8dcb0; color: #6b5518; padding: 10px 14px; border-radius: 8px; }

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: flex; gap: 10px; align-items: baseline; padding: 6px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.timeline li:last-child { border-bottom: 0; }
.when { font-family: var(--mono); font-size: 12px; color: var(--dim); min-width: 118px; }
.timeline .body { color: var(--ash); }

.btn { display: inline-block; padding: 9px 18px; border-radius: 8px; background: var(--ink); color: #fff; text-decoration: none; font-weight: 600; }
.err { color: var(--warn); }

/* Import page */
.field { display: block; margin-bottom: 18px; max-width: 720px; }
.field > span { display: block; font-weight: 600; margin-bottom: 5px; }
.field input[type="file"], .field textarea {
  font: inherit; width: 100%; padding: 8px 10px; border: 1px solid var(--line);
  border-radius: 8px; background: var(--paper); color: var(--ink);
}
.field small { display: block; color: var(--ash); margin-top: 6px; line-height: 1.45; }
code { font-family: var(--mono); font-size: 12.5px; background: var(--paper); padding: 1px 5px; border-radius: 4px; }
button.primary { font: inherit; font-weight: 600; padding: 9px 18px; border-radius: 8px; background: var(--ink); color: #fff; border: 0; cursor: pointer; }
.notice.err { background: #fdeee8; border-color: #d9b3a8; color: var(--warn); }

/* Copy editor */
.cols.wide { grid-template-columns: 1fr 1fr; align-items: start; }
.field input[type="text"], .field input[type="number"] {
  font: inherit; width: 100%; padding: 8px 10px; border: 1px solid var(--line);
  border-radius: 8px; background: var(--paper); color: var(--ink);
}
.field input[type="number"] { width: 100px; }
.field textarea { font-family: inherit; line-height: 1.6; }
.problems { border-color: #d9b3a8; background: #fdeee8; }
.problems h2 { color: var(--warn); }
.blocks { color: var(--ash); border-left: 3px solid var(--line); padding-left: 14px; margin: 10px 0 14px; }
.blocks p, .blocks ul { margin: 0 0 9px; }
.blocks ul { padding-left: 18px; }
.mailpreview { width: 100%; height: 460px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.mailpreview.tall { height: 720px; }
.textpart { white-space: pre-wrap; font-family: var(--mono); font-size: 12.5px; line-height: 1.6;
  background: var(--paper); border: 1px solid var(--line); border-radius: 8px; padding: 12px; overflow-x: auto; }
.chip.v-live { border-color: #bfe3c4; color: var(--good); }
.chip.v-draft { border-color: #e8dcb0; color: #8a6d1f; }
.chip.v-retired { border-color: var(--line); color: var(--dim); }
.chip.v-active { border-color: #bfe3c4; color: var(--good); }
form.inline { display: inline; }
.actions { margin: 12px 0 0; color: var(--dim); }
.funnel td { font-variant-numeric: tabular-nums; }
