:root {
  --bg: #f6f7f9; --fg: #1c2430; --muted: #6b7785; --line: #d8dee6;
  --card: #fff; --accent: #0a7d6b; --accent-d: #086658;
  --ok: #1f8f3a; --ok-bg: #e7f6ea; --warn: #b4451d; --warn-bg: #fbece4;
  --danger: #b3261e; --radius: 12px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg); color: var(--fg);
  -webkit-text-size-adjust: 100%;
}
main { max-width: 720px; margin: 0 auto; padding: 16px 16px 64px; }
h1 { font-size: 1.5rem; margin: 14px 0 6px; }
h2 { font-size: 1.15rem; margin: 0 0 10px; }
a { color: var(--accent-d); }
code { background: #eef1f4; padding: 1px 5px; border-radius: 5px; font-size: .9em; }
.muted { color: var(--muted); }
.small { font-size: .9rem; }
.error { color: var(--danger); font-weight: 600; }
.flash { background: var(--ok-bg); border: 1px solid #bfe4c7; color: #15601f; padding: 10px 12px; border-radius: var(--radius); }

.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 16px; background: var(--card); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 5;
}
.topbar .brand { font-weight: 700; text-decoration: none; color: var(--fg); }
.topbar nav { font-size: .92rem; color: var(--muted); }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin: 16px 0; }
.card.narrow { max-width: 380px; margin: 48px auto; }
.card.howto { max-width: 560px; margin: 0 auto 48px; }
.card.howto h2 { font-size: 1.05rem; margin: 0 0 10px; }
.howto-steps { padding-left: 1.25em; margin: 0; }
.howto-steps li { margin: 0 0 12px; }
.howto-steps li:last-child { margin-bottom: 6px; }

label { display: block; margin: 12px 0; font-weight: 600; }
label.inline { display: inline-flex; align-items: center; gap: 8px; font-weight: 500; margin: 8px 0 12px; }
label.inline input { width: auto; display: inline-block; margin: 0; }
input[type=text], input[type=password], input[type=number], input[type=file], select, textarea {
  display: block; width: 100%; margin-top: 6px; padding: 10px 12px; font: inherit;
  border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--fg); font-weight: 400;
}
textarea { resize: vertical; }
button, .btn {
  display: inline-block; font: inherit; font-weight: 600; cursor: pointer;
  padding: 11px 16px; border-radius: 10px; border: 1px solid var(--line);
  background: #fff; color: var(--fg); text-decoration: none; text-align: center;
}
button:hover, .btn:hover { background: #f0f2f5; }
button.primary, button[type=submit] { background: var(--accent); border-color: var(--accent); color: #fff; }
button.primary:hover, button[type=submit]:hover { background: var(--accent-d); }
button.ok { background: var(--ok-bg); border-color: #bfe4c7; color: var(--ok); }
button.warn { background: var(--warn-bg); border-color: #f0cdbb; color: var(--warn); }
button.danger { background: #fff; border-color: #e3b6b3; color: var(--danger); }
button.danger:hover { background: #fbecec; }
button.small { padding: 5px 10px; font-size: .85rem; }
button:disabled, .btn[disabled] { opacity: .5; cursor: not-allowed; }
button.link { background: none; border: none; padding: 0 4px; color: var(--accent-d); text-decoration: underline; font-weight: 500; }
.btn.opened { background: var(--ok-bg); border-color: #bfe4c7; color: var(--ok); }

table.grid { width: 100%; border-collapse: collapse; margin: 8px 0; font-size: .95rem; }
table.grid th, table.grid td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.grid th { color: var(--muted); font-weight: 600; font-size: .85rem; }

.copyrow { display: flex; gap: 8px; align-items: center; }
.sharelink { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .9rem; }
.bigstats { display: flex; flex-wrap: wrap; gap: 6px 18px; }
.bigstats span { white-space: nowrap; }
.bigstats b { font-size: 1.15rem; }

/* volunteer queue */
.progress { position: relative; background: #e7ebef; border-radius: 999px; height: 26px; margin: 14px 0 18px; overflow: hidden; }
.progress-fill { position: absolute; inset: 0 auto 0 0; background: var(--accent); transition: width .3s; }
.progress-label { position: relative; display: block; text-align: center; line-height: 26px; font-size: .85rem; font-weight: 600; color: #18313b; mix-blend-mode: luminosity; }

.contact-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: 0 1px 3px rgba(0,0,0,.05); }
.contact-card h2 { margin-bottom: 2px; }
.contact-card .phone { margin: 0 0 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.contact-card .msg { width: 100%; font: inherit; line-height: 1.45; background: #fbfcfd; }
.btnrow { display: flex; gap: 10px; margin: 12px 0 6px; flex-wrap: wrap; }
.btnrow > * { flex: 1 1 160px; }
.hint { font-size: .85rem; color: var(--muted); margin: 6px 0 14px; }
.statusrow { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (min-width: 520px) { .statusrow { grid-template-columns: repeat(4, 1fr); } }
.notebox { margin-top: 12px; }
.notebox summary { cursor: pointer; color: var(--muted); font-size: .9rem; }
.notebox input { margin-top: 8px; }

.done-all { text-align: center; }

.listbox { margin: 16px 0; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 16px; }
.listbox summary { cursor: pointer; font-weight: 600; }
.listbox ol, .listbox ul { margin: 10px 0 6px; padding-left: 22px; }
.donelist { list-style: none; padding-left: 0; }
.donelist li { padding: 4px 0; border-bottom: 1px solid #eef1f4; }
.badge { display: inline-block; font-size: .72rem; font-weight: 700; padding: 2px 7px; border-radius: 999px; text-transform: uppercase; letter-spacing: .03em; }
.badge-queued { background: #eef1f4; color: var(--muted); }
.badge-sent { background: #fff6dd; color: #876200; }
.badge-replied { background: var(--ok-bg); color: var(--ok); }
.badge-no_reply { background: #eef1f4; color: var(--muted); }
.badge-bad_number { background: #f3eef4; color: #7a4f86; }
.badge-opt_out { background: var(--warn-bg); color: var(--warn); }

.bucket-h { font-size: .95rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 24px 0 6px; }
.bucket-blurb { margin: 0 0 10px; }

/* notes field — promoted to a first-class textarea inside every action panel */
.notelabel { display: block; font-weight: 600; font-size: .9rem; margin: 14px 0 4px; color: var(--fg); }
textarea.note { width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; font: inherit; background: #fbfcfd; }

/* phone / name lookup */
.lookup { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; margin: 8px 0 16px; }
.lookup-label { display: block; font-weight: 600; font-size: 1rem; margin: 0 0 10px; }
.lookup input { margin: 0; font-size: 1.15rem; padding: 14px 16px; }
.lookup-results { margin-top: 8px; display: flex; flex-direction: column; gap: 6px; }
.lookup-hit { width: 100%; text-align: left; padding: 8px 10px; background: #fbfcfd; border: 1px solid var(--line); border-radius: 8px; font: inherit; font-weight: 500; cursor: pointer; }
.lookup-hit:hover { background: #f0f2f5; }
.lookup-hit .badge { margin-left: 6px; vertical-align: middle; }
.lookup-empty { color: var(--muted); font-size: .9rem; padding: 4px 2px; }

/* awaiting-reply list */
.awaitlist { list-style: none; padding: 0; margin: 0; }
.await-row { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px; margin: 8px 0; transition: box-shadow .2s, border-color .2s; }
.await-row.is-focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(10, 125, 107, .18); }
.await-summary { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.await-who { flex: 1 1 220px; min-width: 0; }
.await-note { display: block; color: var(--muted); font-size: .88rem; margin-top: 2px; }
.await-toggle { white-space: nowrap; }
.await-body { display: none; padding-top: 8px; border-top: 1px dashed var(--line); margin-top: 10px; }
.await-row.is-open .await-body { display: block; }
.await-row.is-open .await-toggle::after { content: ""; }
.await-statusrow { grid-template-columns: 1fr 1fr; }
@media (min-width: 520px) { .await-statusrow { grid-template-columns: repeat(4, 1fr); } }
