/* mailwarmups.com: the one stylesheet.
   A quiet utility: system type, one accent, no gradients, no imagery.
   Every text pair below is held to 4.5:1 or better by test/tokens.test.mjs, in both schemes. */

:root {
  color-scheme: light;
  --bg: #f8f8f6;
  --surface: #ffffff;
  --ink: #1b1c1e;
  --muted: #54575c;
  --line: #d6d7d3;
  --accent: #1d5a85;
  --on-accent: #ffffff;
  --ok: #1c6b3a;
  --bad: #a3271e;
  --notice-bg: #fdf6e3;
  --notice-ink: #5e4200;
  --focus: #1d5a85;
  --chart-sent: #7b7f85;
  --chart-inbox: #2f7d4f;
  --chart-spam: #b8452f;
  --radius: 8px;
  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --serif: ui-serif, Georgia, Cambria, "Times New Roman", serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #121315;
    --surface: #1b1d20;
    --ink: #ebebe8;
    --muted: #a7abb1;
    --line: #383b40;
    --accent: #8ec5ec;
    --on-accent: #0b1a26;
    --ok: #7fd09b;
    --bad: #f19085;
    --notice-bg: #2e2612;
    --notice-ink: #f0d58c;
    --focus: #8ec5ec;
    --chart-sent: #8a8f97;
    --chart-inbox: #5fbf85;
    --chart-spam: #e8806d;
  }
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 17px/1.6 var(--sans);
  overflow-wrap: break-word;
}

.wrap { max-width: 760px; margin: 0 auto; padding: 0 16px; }

h1, h2, h3 { font-family: var(--serif); font-weight: 600; line-height: 1.25; margin: 1.6em 0 0.5em; }
h1 { font-size: 2rem; margin-top: 1.2em; }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.1rem; }
p { margin: 0 0 1em; }
.lede { font-size: 1.1rem; }
.aside { margin-top: 1.25em; color: var(--muted); }
.beta { color: var(--muted); }
.break { word-break: break-all; }

a { color: var(--accent); text-underline-offset: 0.15em; }
a:hover { text-decoration-thickness: 2px; }

:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 2px; }

.skip-link { position: absolute; left: 8px; top: -48px; background: var(--surface); color: var(--ink); padding: 8px 12px; border: 1px solid var(--line); border-radius: var(--radius); z-index: 10; }
.skip-link:focus { top: 8px; }

.vh { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* Header and footer */
.site-header { border-bottom: 1px solid var(--line); background: var(--surface); }
.header-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; min-height: 56px; padding-top: 8px; padding-bottom: 8px; }
/* Every header target is at least 44 px tall (the brand, each link, Sign out): measured at
   360 px by scripts/smoke-ui.mjs. */
.brand { font-family: var(--serif); font-weight: 600; font-size: 1.15rem; color: var(--ink); text-decoration: none; display: inline-flex; align-items: center; min-height: 44px; }
.site-nav { display: flex; flex-wrap: wrap; align-items: center; gap: 0 16px; }
.site-nav a { text-decoration: none; display: inline-flex; align-items: center; min-height: 44px; }
.site-nav a[aria-current="page"] { color: var(--ink); text-decoration: underline; text-decoration-thickness: 2px; }
.site-footer { margin-top: 64px; border-top: 1px solid var(--line); color: var(--muted); font-size: 0.95rem; padding: 16px 0 32px; }
/* The footer's links wrap onto as many lines as the width needs; each is a 44 px target. */
.footer-links { list-style: none; margin: 0 0 8px; padding: 0; display: flex; flex-wrap: wrap; gap: 0 20px; }
.footer-links a { display: inline-flex; align-items: center; min-height: 44px; }
.footer-links a[aria-current="page"] { color: var(--ink); text-decoration-thickness: 2px; }
.footer-beta { margin: 0; }

/* Public pages: plain prose, short lists, the draft notice on the legal pages */
ul.points { padding-left: 1.25em; margin: 0 0 1em; }
ul.points li + li { margin-top: 6px; }
.draft { margin-top: 24px; font-weight: 600; }
.effective { color: var(--muted); }
address { font-style: normal; margin: 0 0 1em; }
.plan { margin: 16px 0 8px; }
.plan h2 { margin-top: 0; }
.plan-price { font-size: 1.35rem; font-weight: 600; margin-bottom: 0.5em; }

/* Buttons */
.btn, .btn-quiet, .link-button {
  font: inherit; cursor: pointer; border-radius: var(--radius); min-height: 44px;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
.btn { background: var(--accent); color: var(--on-accent); border: 1px solid var(--accent); padding: 8px 18px; text-decoration: none; font-weight: 600; }
.btn:hover { filter: brightness(1.08); }
.btn-quiet { background: var(--surface); color: var(--ink); border: 1px solid var(--line); padding: 6px 14px; }
.btn-quiet:hover { border-color: var(--muted); }
.btn-danger { color: var(--bad); }
.link-button { background: none; border: 0; padding: 0; color: var(--accent); text-decoration: underline; text-underline-offset: 0.15em; min-height: 44px; }
form.inline { display: inline; margin: 0; }

/* The CSS-only busy state: htmx puts .htmx-request on the element making the request. */
.busy { display: none; }
.htmx-request .idle, .htmx-request.btn-quiet .idle { display: none; }
.htmx-request .busy { display: inline; }
button[disabled] { opacity: 0.7; cursor: progress; }

/* Forms */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 16px; }
.stack > * + * { margin-top: 16px; }
.field { border: 0; padding: 0; min-width: 0; }
fieldset.field, fieldset.field-pair { border: 0; padding: 0; margin-inline: 0; min-width: 0; }
.stack > * + * { margin-top: 22px; }
legend { font-weight: 600; padding: 0; margin-bottom: 6px; }
label { display: block; font-weight: 600; margin-bottom: 6px; }
.choice { margin-bottom: 12px; }
/* The label is the whole row and at least 44 px tall, so the radio's target is the row. */
.choice-row { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 44px; margin: 0; cursor: pointer; }
.choice .hint { margin: 0 0 0 30px; }
input[type="text"], input[type="email"], input[type="password"], input[type="number"], input[type="time"], select, textarea {
  display: block; width: 100%; max-width: 100%; min-height: 44px; padding: 8px 12px;
  font: inherit; color: var(--ink); background: var(--surface);
  border: 1px solid var(--muted); border-radius: var(--radius);
}
input[type="radio"] { width: 20px; height: 20px; margin: 0; flex: none; accent-color: var(--accent); }
textarea { min-height: 112px; resize: vertical; }
.hint { color: var(--muted); font-size: 0.95rem; margin: 6px 0 0; }
.field-error { color: var(--bad); font-size: 0.95rem; margin: 6px 0 0; font-weight: 600; }
.field-error:empty { display: none; }
[aria-invalid="true"] { border-color: var(--bad); }
.field-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field-pair legend { grid-column: 1 / -1; }

/* Notices */
.flash { background: var(--surface); border: 1px solid var(--ok); color: var(--ok); border-radius: var(--radius); padding: 10px 14px; margin-top: 24px; font-weight: 600; }
.notice { background: var(--notice-bg); color: var(--notice-ink); border-radius: var(--radius); padding: 10px 14px; }
.refusal { border: 1px solid var(--bad); border-radius: var(--radius); background: var(--surface); padding: 4px 16px 12px; margin: 16px 0 24px; }
.refusal h2 { margin-top: 0.8em; font-size: 1.15rem; }
.refusal-line { color: var(--bad); font-weight: 600; }
.row-error { color: var(--bad); font-weight: 600; margin: 8px 0 0; }
.row-error:empty { display: none; }

/* KPI strip */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin: 16px 0 8px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; }
.kpi dt { color: var(--muted); font-size: 0.9rem; }
.kpi dd { margin: 4px 0 0; font-size: 1.5rem; font-weight: 600; line-height: 1.2; }
.kpi-sub, .kpi-none { font-size: 0.9rem; font-weight: 400; color: var(--muted); }

/* Mailbox list */
.section-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; margin-top: 32px; }
.section-head h2 { margin: 0; }
.mailbox-list { list-style: none; margin: 16px 0 0; padding: 0; }
.mailbox { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 12px; }
.mailbox-address { margin: 0; font-size: 1.1rem; word-break: break-all; }
.mailbox-meta { margin: 4px 0 8px; color: var(--muted); font-size: 0.95rem; }
.mailbox-line { margin: 0 0 4px; }
.mailbox-line.notice { margin: 8px 0; }
.status-paused, .status-credential-failed { color: var(--bad); }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.empty { background: var(--surface); border: 1px dashed var(--muted); border-radius: var(--radius); padding: 4px 16px 8px; margin-top: 16px; }

/* DNS */
.checklist { list-style: none; padding: 0; margin: 12px 0 16px; }
.check { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; padding: 8px 0; border-bottom: 1px solid var(--line); }
.check:last-child { border-bottom: 0; }
.badge { display: inline-block; min-width: 7.5em; font-size: 0.85rem; font-weight: 700; padding: 1px 8px; border-radius: 4px; border: 1px solid currentColor; text-align: center; }
.check.ok .badge, .verdict.ok { color: var(--ok); }
.check.bad .badge, .verdict.bad { color: var(--bad); }
.check.unknown .badge { color: var(--muted); }
.verdict { font-weight: 700; }
.why { display: block; color: var(--muted); font-size: 0.9rem; margin-top: 4px; }

/* Tables: a wide one scrolls inside its own box, never the page. */
.table-wrap { overflow-x: auto; max-width: 100%; margin: 8px 0 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
table { border-collapse: collapse; width: 100%; font-size: 0.95rem; }
caption { text-align: left; font-weight: 600; padding: 10px 12px 4px; }
th, td { text-align: left; padding: 8px 12px; border-top: 1px solid var(--line); vertical-align: top; }
thead th { border-top: 0; color: var(--muted); font-weight: 600; white-space: nowrap; }
code { font-family: var(--mono); font-size: 0.9em; }
code.value { word-break: break-all; }
.records td:nth-child(3) { min-width: 12em; }

/* Chart */
.chart { margin: 12px 0; }
.chart svg { display: block; width: 100%; height: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.chart .axis { stroke: var(--line); stroke-width: 1; }
.bar-sent, .swatch-sent { fill: var(--chart-sent); background: var(--chart-sent); }
.bar-inbox, .swatch-inbox { fill: var(--chart-inbox); background: var(--chart-inbox); }
.bar-spam, .swatch-spam { fill: var(--chart-spam); background: var(--chart-spam); }
.chart-range { display: flex; justify-content: space-between; color: var(--muted); font-size: 0.9rem; margin: 4px 0; }
.legend { list-style: none; padding: 0; margin: 4px 0 0; display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 0.95rem; }
.swatch { display: inline-block; width: 12px; height: 12px; border-radius: 2px; vertical-align: -1px; }
details.numbers summary { cursor: pointer; color: var(--accent); min-height: 44px; display: flex; align-items: center; }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

@media (max-width: 480px) {
  h1 { font-size: 1.6rem; }
  .field-pair { grid-template-columns: 1fr; }
  /* The records table becomes one block per record, each cell under its own label, so a long
     DKIM or SPF value wraps instead of scrolling out of sight. */
  .records thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .records tr, .records td { display: block; }
  .records tr { border-top: 1px solid var(--line); padding: 6px 0; }
  .records td { border-top: 0; padding: 4px 12px; }
  .records td::before { content: attr(data-label); display: block; color: var(--muted); font-size: 0.85rem; font-weight: 600; }
  .records td:nth-child(3) { min-width: 0; }
}
