:root {
  --navy: #1a2238;
  --orange: #ff6b35;
  --bg: #f4f5f7;
  --card: #ffffff;
  --text: #1a2238;
  --muted: #6b7280;
  --line: #e5e7eb;
  --red: #dc2626;
  --green: #16a34a;
  --yellow: #ca8a04;
  --grey: #9ca3af;
  --radius: 10px;
}
* { box-sizing: border-box; }
body { margin: 0; font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif; background: var(--bg); color: var(--text); }
a { color: var(--navy); }
header.top { background: var(--navy); color: #fff; display: flex; align-items: center; gap: 24px; padding: 0 20px; height: 56px; position: sticky; top: 0; z-index: 5; }
header.top .brand { font-weight: 700; letter-spacing: .3px; white-space: nowrap; }
header.top .brand span { color: var(--orange); }
header.top nav { display: flex; gap: 4px; overflow-x: auto; flex: 1; }
header.top nav a { color: #cbd2e1; text-decoration: none; padding: 8px 12px; border-radius: 8px; white-space: nowrap; }
header.top nav a.active, header.top nav a:hover { background: rgba(255,255,255,.1); color: #fff; }
header.top .badge { background: var(--orange); color: #fff; border-radius: 999px; padding: 0 7px; font-size: 12px; margin-left: 4px; }
header.top button.link { background: none; border: 0; color: #cbd2e1; cursor: pointer; font: inherit; }
main { max-width: 1180px; margin: 0 auto; padding: 24px 16px 64px; }
h1 { font-size: 24px; margin: 0 0 16px; }
h2 { font-size: 18px; margin: 28px 0 12px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.stack > * + * { margin-top: 12px; }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.grow { flex: 1; min-width: 0; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 8px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; }
.stat b { display: block; font-size: 24px; }
.stat span { color: var(--muted); font-size: 13px; }
.banner { background: #fff7ed; border: 1px solid #fed7aa; color: #7c2d12; padding: 12px 16px; border-radius: var(--radius); margin-bottom: 16px; }
.banner.ok { background: #f0fdf4; border-color: #bbf7d0; color: #14532d; }
.banner.err { background: #fef2f2; border-color: #fecaca; color: #7f1d1d; }
button, .btn { background: var(--navy); color: #fff; border: 0; border-radius: 8px; padding: 8px 14px; font: inherit; cursor: pointer; text-decoration: none; display: inline-block; }
button.primary, .btn.primary { background: var(--orange); }
button.ghost, .btn.ghost { background: #fff; color: var(--navy); border: 1px solid var(--line); }
button.danger { background: var(--red); }
button:disabled { opacity: .5; cursor: default; }
input, select, textarea { font: inherit; border: 1px solid #d1d5db; border-radius: 8px; padding: 8px 10px; background: #fff; color: var(--text); width: 100%; }
textarea { min-height: 260px; font-family: ui-monospace, Consolas, monospace; font-size: 14px; }
label { display: block; font-weight: 600; font-size: 13px; margin-bottom: 4px; }
label.inline { display: flex; gap: 8px; align-items: center; font-weight: 400; font-size: 15px; }
label.inline input { width: auto; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 720px) { .grid2 { grid-template-columns: 1fr; } }
table { width: 100%; border-collapse: collapse; background: #fff; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); background: #fafafa; }
tr.click { cursor: pointer; }
tr.click:hover td { background: #f9fafb; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); }
.pill { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 12px; background: #eef2f7; color: var(--navy); white-space: nowrap; }
.pill.new { background: #eef2ff; }
.pill.contacted { background: #e0f2fe; }
.pill.replied { background: #dcfce7; }
.pill.bounced, .pill.failed { background: #fee2e2; }
.pill.unsubscribed, .pill.do_not_contact, .pill.skipped { background: #f3f4f6; color: var(--muted); }
.pill.active { background: #dcfce7; }
.pill.paused { background: #fef9c3; }
.pill.done { background: #f3f4f6; }
.item { display: flex; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--line); align-items: flex-start; }
.item:last-child { border-bottom: 0; }
.item .dot { font-size: 18px; line-height: 1.3; }
.item .title { font-weight: 600; }
.item .reason { font-weight: 700; }
.reason.urgent { color: var(--red); }
.reason.lead { color: var(--green); }
.reason.follow_up { color: var(--yellow); }
.reason.info { color: var(--muted); }
.item blockquote { margin: 6px 0 0; padding: 6px 10px; background: #f9fafb; border-left: 3px solid var(--line); color: #374151; font-size: 14px; white-space: pre-wrap; }
.item .actions { display: flex; gap: 6px; flex-wrap: wrap; }
@media (max-width: 640px) {
  header.top { gap: 10px; padding: 0 12px; }
  header.top .brand { font-size: 14px; }
  .item { flex-wrap: wrap; }
  .item .grow { flex-basis: calc(100% - 48px); }
  .item .actions { width: 100%; padding-left: 30px; }
}
.list { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); }
.empty { padding: 24px; text-align: center; color: var(--muted); }
pre.email { white-space: pre-wrap; background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 12px; font-size: 14px; margin: 0; }
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { padding: 8px 0; border-bottom: 1px solid var(--line); }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--navy); color: #fff; padding: 10px 16px; border-radius: 8px; z-index: 50; max-width: calc(100% - 32px); }
.toast.err { background: var(--red); }
.vars code { background: #eef2f7; padding: 1px 6px; border-radius: 4px; margin: 2px; display: inline-block; cursor: pointer; }
.login { max-width: 380px; margin: 12vh auto; }
