:root {
  --navy: #062a4f;
  --blue: #0152b1;
  --cyan: #1fbbed;
  --ink: #1d2733;
  --muted: #5f6d7c;
  --line: #e3e8ef;
  --bg: #f4f6f9;
  --card: #ffffff;
  --green: #16a34a;
  --red: #dc2626;
  --amber: #d97706;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif; }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 26px; margin: 0; }
h2 { font-size: 18px; margin: 0 0 12px; }
h3 { font-size: 16px; margin: 0; }
code { background: #eef3f8; border-radius: 5px; padding: 1px 6px; font-size: 13px; }
.wrap { max-width: 1240px; margin: 0 auto; padding: 0 16px; }
main.wrap { padding-top: 22px; padding-bottom: 60px; }

/* top bar */
.top { background: var(--navy); color: #fff; position: sticky; top: 0; z-index: 5; }
.top-in { display: flex; align-items: center; gap: 18px; min-height: 60px; flex-wrap: wrap; }
.brand { color: #fff; font-weight: 800; font-size: 19px; letter-spacing: .2px; display: inline-flex; align-items: center; gap: 8px; }
.brand:hover { text-decoration: none; }
.brand .dot { width: 12px; height: 12px; border-radius: 50%; background: var(--cyan); box-shadow: 0 0 0 4px rgba(31,187,237,.25); }
.brand.big { color: var(--navy); font-size: 24px; margin-bottom: 18px; }
.nav { display: flex; gap: 2px; flex-wrap: wrap; flex: 1; }
.nav a { color: #c9d8ea; padding: 8px 12px; border-radius: 8px; font-weight: 600; font-size: 14px; }
.nav a:hover { background: rgba(255,255,255,.08); color: #fff; text-decoration: none; }
.nav a.on { background: rgba(31,187,237,.18); color: #fff; }
.top-right { display: flex; align-items: center; gap: 14px; }
.signout { color: #c9d8ea; font-size: 14px; }
.pausebar { background: #fde8e8; color: #9b1c1c; text-align: center; padding: 8px 16px; font-weight: 600; }

/* layout */
.head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.head-actions { margin-left: auto; display: flex; gap: 8px; }
.back { font-weight: 600; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 20px; margin-bottom: 18px; overflow-x: auto; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.card-head h2 { margin: 0; }
.card.danger { border-color: #f3c7c7; }
.cols { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 18px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.end { display: flex; align-items: flex-end; }
.mt { margin-top: 12px; }
.mb { margin-bottom: 12px; }
.scroll { overflow-x: auto; }
.muted { color: var(--muted); }
.red-t { color: var(--red); }
.err-t { color: var(--red); font-size: 12px; max-width: 360px; }
.nowrap { white-space: nowrap; }
.note { background: #eaf7fd; border-radius: 10px; padding: 10px 14px; }

/* stats */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat { background: linear-gradient(135deg, var(--blue), var(--navy)); color: #fff; border-radius: 14px; padding: 16px; }
.stat .n { font-size: 28px; font-weight: 800; line-height: 1.1; }
.stat .l { font-weight: 600; color: #d2f3fb; }
.stat .s { font-size: 13px; color: #a9cbe6; }
.stat .s a, .stat .n.red-t { color: #ffb4b4; }

/* forms */
label { display: block; font-weight: 600; font-size: 14px; }
label.inline { display: inline-flex; align-items: center; gap: 8px; font-weight: 500; }
label.chk { display: inline-flex; align-items: center; gap: 6px; font-weight: 500; }
input[type=text], input[type=email], input[type=password], input[type=url], input[type=number], input[type=search], select, textarea {
  display: block; width: 100%; margin-top: 4px; padding: 10px 12px; border: 1px solid #cfd8e3; border-radius: 9px; font: inherit; background: #fff; color: var(--ink);
}
label.inline input, .row > input[type=text], .row > input[type=search] { display: inline-block; width: auto; margin-top: 0; }
.row > input[type=text], .row > input[type=search] { flex: 1; min-width: 220px; }
input.num { width: 90px !important; }
input.short { max-width: 160px; }
textarea { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 14px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--cyan); outline-offset: 0; border-color: var(--cyan); }
.days { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; margin-top: 14px; font-weight: 600; }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid #cfd8e3; background: #fff; color: var(--ink); border-radius: 10px; padding: 10px 16px; font: inherit; font-weight: 700; cursor: pointer; white-space: nowrap; }
.btn:hover { text-decoration: none; background: #f0f4f8; }
.btn.small { padding: 6px 12px; font-size: 13px; border-radius: 8px; }
.btn.go { background: var(--cyan); border-color: var(--cyan); color: #fff; }
.btn.go:hover { background: #12a6d6; }
.btn.warn { background: #fff; border-color: #f0b4b4; color: var(--red); }
.btn.ghost { background: transparent; }
.top .btn.ghost { color: #fff; border-color: rgba(255,255,255,.35); }
.top .btn.ghost:hover { background: rgba(255,255,255,.1); }
.btn.wide { width: 100%; margin-top: 8px; }

/* tables */
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl .r { text-align: right; }
.tbl tr.link { cursor: pointer; }
.tbl tr.link:hover td { background: #f6fafd; }
.tbl tr.off td { color: #9aa6b2; }
.snippet { color: var(--muted); max-width: 360px; }

/* pills */
.pill { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; background: #e9eef4; color: #3b4a5a; white-space: nowrap; }
.pill.green, .pill.k-interested { background: #dcfce7; color: #166534; }
.pill.red, .pill.k-bounce, .pill.c-bounced { background: #fee2e2; color: #991b1b; }
.pill.amber, .pill.k-soft_bounce { background: #fef3c7; color: #92400e; }
.pill.blue, .pill.k-reply, .pill.c-replied { background: #dbeafe; color: #1e40af; }
.pill.k-not_interested, .pill.k-unsubscribe, .pill.c-unsubscribed { background: #f3e8ff; color: #6b21a8; }
.pill.k-auto, .pill.c-skipped { background: #e9eef4; color: #3b4a5a; }
.pill.c-active { background: #e0f7fd; color: #075985; }
.pill.c-completed { background: #dcfce7; color: #166534; }

/* tabs */
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.tabs a { padding: 7px 12px; border-radius: 999px; background: #fff; border: 1px solid var(--line); color: var(--ink); font-weight: 600; font-size: 14px; }
.tabs a b { color: var(--muted); font-weight: 700; margin-left: 4px; }
.tabs a.on { background: var(--navy); border-color: var(--navy); color: #fff; }
.tabs a.on b { color: var(--cyan); }
.tabs a:hover { text-decoration: none; }
.pager { display: flex; gap: 12px; align-items: center; justify-content: center; margin-top: 14px; }

/* help + steps */
.help { background: #f3f9fd; border: 1px solid #d6ecf8; border-radius: 12px; padding: 12px 16px; margin-bottom: 16px; }
.help ol { margin: 0; padding-left: 20px; }
.help li { margin: 4px 0; }
.help p { margin: 8px 0 0; }
ol.steps { margin: 0; padding: 0; list-style: none; counter-reset: s; }
ol.steps li { counter-increment: s; position: relative; padding: 9px 0 9px 44px; border-bottom: 1px solid var(--line); }
ol.steps li:last-child { border-bottom: 0; }
ol.steps li::before { content: counter(s); position: absolute; left: 0; top: 6px; width: 30px; height: 30px; border-radius: 50%; background: var(--navy); color: #fff; font-weight: 800; display: flex; align-items: center; justify-content: center; }
ol.steps li.done::before { content: "✓"; background: var(--green); }
ol.steps li.done { color: var(--muted); }

/* email steps + previews */
.step { border: 1px solid var(--line); border-radius: 12px; padding: 14px; margin: 14px 0; display: flex; flex-direction: column; gap: 10px; }
.step-head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.step-head .btn { margin-left: auto; }
.preview { border: 1px solid var(--line); border-radius: 12px; padding: 14px; margin: 12px 0; background: #fbfcfe; }
.preview.mine { background: #f3f9fd; }
.pv-label { font-size: 12px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); font-weight: 700; }
.pv-subject { font-weight: 700; margin: 4px 0 8px; }
.pv-body { white-space: pre-wrap; word-break: break-word; font: 14px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif; margin: 0; }
pre.code { background: var(--navy); color: #d2f3fb; padding: 12px 14px; border-radius: 10px; }
dl.meta { display: grid; grid-template-columns: 110px 1fr; gap: 6px 12px; margin: 0 0 14px; }
dl.meta dt { color: var(--muted); font-weight: 600; }
dl.meta dd { margin: 0; word-break: break-word; }
details summary { cursor: pointer; font-weight: 700; color: var(--blue); }

/* flash */
.flash { padding: 11px 14px; border-radius: 10px; margin-bottom: 14px; font-weight: 600; }
.flash.ok { background: #dcfce7; color: #166534; }
.flash.err { background: #fee2e2; color: #991b1b; }

/* sign in */
main.bare { min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.authbox { width: 100%; max-width: 400px; background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 30px 26px; }
.authbox h1 { font-size: 22px; margin-bottom: 8px; }
.authbox form { display: flex; flex-direction: column; gap: 12px; margin-top: 12px; }

@media (max-width: 860px) {
  .cols, .grid3, .grid2 { grid-template-columns: 1fr; }
  .top-in { padding: 10px 16px; }
  .nav { order: 3; flex-basis: 100%; overflow-x: auto; flex-wrap: nowrap; }
  .top-right { margin-left: auto; }
  h1 { font-size: 22px; }
  .card { padding: 16px; }
  .tbl { font-size: 13px; }
  .tbl td, .tbl th { padding: 8px 7px; }
}
