  :root {
    --bg: #f5f7fa; --card: #ffffff; --text: #14213d; --muted: #5b6b7f;
    --line: #dde3ea; --accent: #0f9d7a; --accent-soft: #e3f6f0;
    --warn: #b45309; --warn-soft: #fef3c7; --bad: #b42318; --bad-soft: #fee4e2;
    --info: #1d4ed8; --info-soft: #e0e9ff;
  }
  @media (prefers-color-scheme: dark) {
    :root {
      --bg: #0e1621; --card: #162231; --text: #e6edf5; --muted: #9bacbf;
      --line: #263548; --accent: #2dd4a4; --accent-soft: #123b33;
      --warn: #fbbf24; --warn-soft: #3b2f0b; --bad: #fda29b; --bad-soft: #3d1613;
      --info: #93b4ff; --info-soft: #1a2a52;
    }
  }
  * { box-sizing: border-box; }
  body { margin: 0; background: var(--bg); color: var(--text);
         font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
  header { padding: 20px 24px 8px; display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
  h1 { font-size: 20px; margin: 0; }
  .sub { color: var(--muted); }
  main { padding: 0 24px 40px; max-width: 1280px; margin: 0 auto; }
  .cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin: 12px 0 20px; }
  .card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; }
  .card .num { font-size: 26px; font-weight: 700; }
  .card .lbl { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
  .tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--line); margin-bottom: 14px; }
  .tab { background: none; border: 0; padding: 10px 14px; cursor: pointer; color: var(--muted);
         font: inherit; border-bottom: 2px solid transparent; margin-bottom: -1px; }
  .tab.active { color: var(--text); border-bottom-color: var(--accent); font-weight: 600; }
  .tab:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible { outline: 2px solid var(--info); outline-offset: 2px; }
  .toolbar { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; align-items: center; }
  input[type=search], select { background: var(--card); color: var(--text); border: 1px solid var(--line);
         border-radius: 8px; padding: 8px 10px; font: inherit; }
  input[type=search] { min-width: 240px; flex: 1; max-width: 360px; }
  button.btn { background: var(--card); color: var(--text); border: 1px solid var(--line); border-radius: 8px;
         padding: 8px 12px; cursor: pointer; font: inherit; }
  button.btn:hover:not(:disabled) { border-color: var(--accent); }
  button.btn:disabled { opacity: .45; cursor: default; }
  .tablewrap { background: var(--card); border: 1px solid var(--line); border-radius: 10px; overflow-x: auto; }
  table { border-collapse: collapse; width: 100%; min-width: 900px; }
  th, td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
  th { position: sticky; top: 0; background: var(--card); color: var(--muted); font-size: 12px;
       text-transform: uppercase; letter-spacing: .04em; }
  tr:last-child td { border-bottom: 0; }
  td.muted { color: var(--muted); }
  .badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
  .b-sent, .b-success, .b-likely { background: var(--accent-soft); color: var(--accent); }
  .b-failed { background: var(--bad-soft); color: var(--bad); }
  .b-not-sent, .b-verify-manually { background: var(--warn-soft); color: var(--warn); }
  .b-no-email { background: var(--line); color: var(--muted); }
  .b-npi, .b-hunter, .b-google, .b-excel, .b-test { background: var(--info-soft); color: var(--info); }
  .pager { display: flex; gap: 10px; align-items: center; margin-top: 12px; color: var(--muted); }
  .empty { padding: 28px; text-align: center; color: var(--muted); }
  .err { background: var(--bad-soft); color: var(--bad); padding: 12px 14px; border-radius: 8px; margin: 12px 0; }

  .nav { display: flex; gap: 4px; margin-left: 8px; }
  .nav a { color: var(--muted); text-decoration: none; padding: 6px 12px; border-radius: 8px; }
  .nav a:hover { color: var(--text); background: var(--card); }
  .nav a[aria-current=page] { color: var(--text); background: var(--card); border: 1px solid var(--line); font-weight: 600; }
  .nav a:focus-visible { outline: 2px solid var(--info); outline-offset: 2px; }
  .chk { display: inline-flex; gap: 6px; align-items: center; color: var(--muted); cursor: pointer; }
  button.exp { background: none; border: 0; cursor: pointer; color: var(--muted); font-size: 14px; padding: 2px 6px; border-radius: 6px; }
  button.exp:hover { color: var(--text); background: var(--line); }
  button.exp:focus-visible { outline: 2px solid var(--info); outline-offset: 2px; }
  tr.hist > td { background: var(--bg); padding: 12px 16px 14px 44px; }
  .hist table { min-width: 0; width: auto; background: var(--card); border: 1px solid var(--line); border-radius: 8px; }
  .hist th, .hist td { padding: 6px 14px; font-size: 13px; }
  .hist .none { color: var(--muted); }
  tr.has-hist > td { border-bottom-color: transparent; }
  .sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  dialog { background: var(--card); color: var(--text); border: 1px solid var(--line); border-radius: 12px; padding: 20px; width: min(680px, 92vw); }
  dialog::backdrop { background: rgba(0, 0, 0, .55); }
  dialog h2 { margin: 0 0 6px; font-size: 18px; }
  dialog label { display: block; margin: 12px 0 0; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
  dialog input, dialog textarea { display: block; width: 100%; margin-top: 4px; background: var(--bg); color: var(--text); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; font: inherit; text-transform: none; letter-spacing: 0; }
  dialog textarea { resize: vertical; min-height: 220px; line-height: 1.45; }
  dialog input[readonly] { opacity: .75; }
  dialog .note { color: var(--muted); font-size: 13px; margin: 8px 0 0; }
  dialog .actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 16px; }
  button.btn.primary { background: var(--accent); color: #04221a; border-color: var(--accent); font-weight: 600; }
  .res-ok { color: var(--accent); font-weight: 600; margin: 10px 0 0; }
  .res-bad { color: var(--bad); font-weight: 600; margin: 10px 0 0; }
  .bulkbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }
  input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--accent); cursor: pointer; }
  .recips { max-height: 220px; overflow: auto; border: 1px solid var(--line); border-radius: 8px; margin-top: 10px; padding: 6px 12px; font-size: 13px; background: var(--bg); }
  .recips div { padding: 4px 0; border-bottom: 1px solid var(--line); }
  .recips div:last-child { border-bottom: 0; }
  .tag-warn { background: var(--warn-soft); color: var(--warn); border-radius: 999px; padding: 1px 8px; font-size: 11px; font-weight: 600; margin-left: 6px; }
  .warn-note { color: var(--warn); font-weight: 600; margin: 8px 0 0; }
  #bulk-progress { margin: 10px 0 0; min-height: 1.4em; overflow-wrap: anywhere; }
  a.tel { color: var(--info); text-decoration: none; font-weight: 600; white-space: nowrap; }
  a.tel:hover { text-decoration: underline; }
  .b-dental, .b-vision, .b-lab, .b-chiropractic, .b-other, .b-call { background: var(--info-soft); color: var(--info); }
  .b-agreed-to-email, .b-spoke-to-decision-maker { background: var(--accent-soft); color: var(--accent); }
  .b-not-interested, .b-wrong-number { background: var(--bad-soft); color: var(--bad); }
  .b-no-answer, .b-voicemail, .b-gatekeeper---no-contact, .b-call-back-later { background: var(--warn-soft); color: var(--warn); }
