:root {
  --bg: #f6f7f9; --card: #fff; --ink: #1d2330; --muted: #6b7280; --line: #e3e6eb; --accent: #2457d6;
  --green: #1f8a4c; --green-bg: #e3f4ea; --amber: #a86400; --amber-bg: #fdf0d9; --red: #b42318; --red-bg: #fde7e5;
  --grey: #5b6270; --grey-bg: #eceef2;
}
* { box-sizing: border-box; }
body { margin: 0; font: 14px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif; color: var(--ink); background: var(--bg); }
a { color: var(--accent); }
main { max-width: 1400px; margin: 0 auto; padding: 16px; }
button { font: inherit; padding: 6px 12px; border: 1px solid var(--accent); background: var(--accent); color: #fff;
  border-radius: 6px; cursor: pointer; }
button[disabled] { opacity: .45; cursor: not-allowed; }
input, textarea, select { font: inherit; padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; background: #fff; }
textarea { width: 100%; }
label { display: block; margin: 6px 0; }
.muted, .hint { color: var(--muted); font-size: 12px; }

#topbar { display: flex; flex-wrap: wrap; gap: 8px 20px; align-items: center; justify-content: space-between;
  padding: 10px 16px; background: var(--card); border-bottom: 1px solid var(--line); }
#topbar .brand a { font-weight: 700; font-size: 16px; text-decoration: none; color: var(--ink); }
#topbar .meters { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 13px; }
#topbar .who a { margin-left: 10px; }

.badge { display: inline-block; padding: 1px 7px; border-radius: 10px; font-size: 12px; font-weight: 600; }
.role-admin { background: #ece6fd; color: #5b33c4; } .role-user { background: var(--grey-bg); color: var(--grey); }
.grade-A, .grade-B { background: var(--green-bg); color: var(--green); }
.grade-C { background: var(--amber-bg); color: var(--amber); }
.grade-F { background: var(--grey-bg); color: var(--grey); }
.grade-D { background: var(--red-bg); color: var(--red); }

.panel { background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 12px 16px; position: relative; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 10px; }
.tab { background: none; color: var(--ink); border: none; border-bottom: 2px solid transparent; border-radius: 0; }
.tab.active { border-bottom-color: var(--accent); color: var(--accent); font-weight: 600; }
.tabpane { display: none; } .tabpane.active { display: block; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.row2 input { width: 100%; }
.multis { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; }
details.multi { position: relative; border: 1px solid var(--line); border-radius: 6px; padding: 4px 10px; background: #fff; }
details.multi summary { cursor: pointer; }
details.multi .opts { position: absolute; z-index: 10; top: calc(100% + 4px); left: 0; max-height: 300px; overflow: auto;
  padding: 6px 10px; min-width: 240px; background: #fff; border: 1px solid var(--line); border-radius: 6px;
  box-shadow: 0 6px 20px rgba(0,0,0,.12); }
details.multi label { margin: 2px 0; }
#recent { list-style: none; padding: 0; margin: 0; } #recent li { margin: 3px 0; }
.htmx-indicator { display: none; position: absolute; right: 16px; top: 14px; color: var(--muted); }
.htmx-request .htmx-indicator, .htmx-request.htmx-indicator { display: inline; }

.banner { padding: 8px 12px; border-radius: 6px; margin: 10px 0; }
.banner.info { background: #e8effd; } .banner.warn { background: var(--amber-bg); color: #6b3f00; }
#results { margin-top: 16px; }
.tablewrap { overflow-x: auto; background: var(--card); border: 1px solid var(--line); border-radius: 8px; }
table { border-collapse: collapse; width: 100%; }
th, td { padding: 6px 8px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { background: #fafbfc; font-size: 12px; color: var(--muted); font-weight: 600; white-space: nowrap; }
tr.dead td { color: #a0a5ae; background: #fafafa; }
td.email { white-space: nowrap; }
.note { font-size: 11px; color: var(--muted); background: var(--grey-bg); border-radius: 8px; padding: 0 6px; }
.bb-deliverable { color: var(--green); font-weight: 600; } .bb-undeliverable { color: var(--red); font-weight: 600; }
.bb-risky { color: var(--amber); font-weight: 600; } .bb-verifying, .bb-checking, .bb-pending { color: var(--muted); font-style: italic; }
.actions, .pager { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 10px 0; }
.empty { color: var(--muted); }

.login { max-width: 340px; margin: 12vh auto; background: var(--card); padding: 24px; border: 1px solid var(--line); border-radius: 8px; }
.login input { width: 100%; } .err { color: var(--red); }
.admin section { margin-bottom: 28px; }
form.inline { display: inline-flex; gap: 4px; align-items: center; margin: 2px 0; }
.addrow { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
table.log td.input { max-width: 420px; overflow-wrap: anywhere; font-size: 12px; }

@media (max-width: 700px) { .row2 { grid-template-columns: 1fr; } }
.demo-bar { background: #b42318; color: #fff; text-align: center; padding: 4px; font-weight: 600; font-size: 13px; }
#leads { margin-top: 24px; } #leads h2 { font-size: 16px; margin: 0 0 6px; } #leads h2 .muted { font-weight: 400; font-size: 13px; }
form.caps label { display: inline; margin: 0 4px 0 0; font-size: 12px; color: var(--muted); }
