:root {
  color-scheme: light dark;
  --ink: #1f1f1f;
  --muted: #666;
  --rule: #e2e2e2;
  --bg: #fcfbf8;
  --paper: #fff;          /* inputs, checkboxes, raised surfaces */
  --border: #c9c9c9;
  --press: #f1efe9;       /* a row while pressed */
  --chip: #efede7;        /* expansion-source and who chips */
  --chip-done: #ececec;
  --bubble: #e9f3ea;
  --accent: #2f6b3a;
  --on-accent: #fff;
  --user-bubble: #2b7a3b;
  --error: #a3261f;
  --shadow: rgba(0, 0, 0, 0.25);
}
/* Dark mode (Nov 1, 2026): same tokens, night values. Follows the phone's setting; there is no toggle. */
@media (prefers-color-scheme: dark) {
  :root {
    --ink: #ececea;
    --muted: #a3a39e;
    --rule: #33332f;
    --bg: #17171a;
    --paper: #232326;
    --border: #4a4a46;
    --press: #2a2a2e;
    --chip: #2e2e32;
    --chip-done: #2a2a2e;
    --bubble: #223526;
    --accent: #7fc48f;
    --on-accent: #10210f;
    --user-bubble: #2b7a3b;
    --error: #ff8a7a;
    --shadow: rgba(0, 0, 0, 0.6);
  }
  .toast { background: #ececea; color: #17171a; }
  .toast button { background: #17171a; color: #ececea; }
}
* { box-sizing: border-box; }
body {
  margin: 0;
  padding: 1.5rem 1.25rem 3rem;
  font: 17px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
  background: var(--bg);
}
header, main, footer { max-width: 36rem; margin: 0 auto; }
header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding-bottom: 1rem;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--rule);
}
header.compact { padding-bottom: 0.6rem; margin-bottom: 1rem; }
header .brand { display: inline-flex; align-items: center; gap: 0.4rem; font-weight: 700; text-decoration: none; font-size: 1.1rem; }
header .brand .logo { width: 30px; height: 30px; }
header nav a { margin-left: 1rem; color: var(--muted); }
h1 { font-size: 2.25rem; margin: 0 0 0.5rem; letter-spacing: -0.01em; }
h2 { font-size: 1.35rem; margin: 2rem 0 0.5rem; }
h3 { font-size: 1.05rem; margin: 1.25rem 0 0.25rem; }
.lede { font-size: 1.25rem; margin-top: 0; }
.muted { color: var(--muted); }
.error { color: var(--error); font-weight: 600; }
a { color: inherit; }
ol.steps { padding-left: 1.25rem; }
ol.steps li { margin: 0.5rem 0; }

/* Text-message samples */
.sms {
  display: inline-block;
  margin: 0.5rem 0 0;
  padding: 0.75rem 1rem;
  border-radius: 1rem 1rem 1rem 0.25rem;
  background: var(--bubble);
  font: 0.95rem/1.45 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  white-space: pre;
}
.sms-inline {
  padding: 0.05rem 0.4rem;
  border-radius: 0.5rem;
  background: var(--bubble);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.95em;
}

/* Buttons and forms */
.button, button {
  display: inline-block;
  padding: 0.6rem 1.2rem;
  border: 0;
  border-radius: 0.5rem;
  background: var(--accent);
  color: var(--on-accent);
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}
form.signup label { display: block; font-weight: 600; margin-top: 1rem; }
form.signup input[type="tel"] {
  display: block;
  width: 100%;
  max-width: 20rem;
  margin: 0.35rem 0 0;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  font: inherit;
}
form.signup label.consent {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.6rem;
  align-items: start;
  font-weight: 400;
  margin: 1.25rem 0;
}
form.signup label.consent input { margin-top: 0.35rem; width: 1.1rem; height: 1.1rem; }

/* Support command table */
table.commands { border-collapse: collapse; width: 100%; margin: 0.5rem 0 1rem; }
table.commands td { padding: 0.45rem 0.5rem 0.45rem 0; vertical-align: top; border-top: 1px solid var(--rule); }
table.commands td:first-child { white-space: nowrap; padding-right: 1rem; }
code {
  padding: 0.05rem 0.4rem;
  border-radius: 0.35rem;
  background: var(--bubble);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.95em;
}

footer {
  margin-top: 3rem;
  padding-top: 1rem;
  border-top: 1px solid var(--rule);
  color: var(--muted);
  font-size: 0.9rem;
}
footer p { margin: 0.25rem 0; }
footer a + a { margin-left: 0.75rem; }

/* List page */
h1.list-title { font-size: 1.5rem; margin: 0 0 0.6rem; }
.add { display: flex; gap: 0.5rem; margin: 0.25rem 0 1rem; }
.add button:disabled { opacity: 0.7; cursor: default; }
.add input {
  flex: 1;
  min-width: 0;
  padding: 0.7rem 0.9rem;
  font: inherit;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: 0.6rem;
}
.add input:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }
.add button { flex: none; }
.summary { margin: 0.25rem 0 0; color: var(--muted); font-size: 0.95rem; }
.small { font-size: 0.9rem; }
.group h2 {
  margin: 1.25rem 0 0.1rem;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted);
}
ul.items { list-style: none; margin: 0.25rem 0 0.5rem; padding: 0; }
ul.items li { display: flex; align-items: center; border-top: 1px solid var(--rule); }
ul.items li > form:first-child { flex: 1; min-width: 0; }
a.edit {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.6rem;
  height: 2.6rem;
  border-radius: 0.5rem;
  color: var(--muted);
  opacity: 0.7;
}
a.edit:active { background: var(--press); }
form.editor { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; width: 100%; padding: 0.5rem 0; }
form.editor input[type="text"] {
  flex: 1;
  min-width: 10rem;
  padding: 0.55rem 0.75rem;
  font: inherit;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: 0.6rem;
}
form.editor .editor-buttons { display: flex; gap: 0.4rem; }
form.editor button { padding: 0.5rem 0.9rem; }
ul.items li:last-child { border-bottom: 1px solid var(--rule); }
ul.items form { margin: 0; }
button.item {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  width: 100%;
  min-height: 3.1rem;
  padding: 0.65rem 0.15rem;
  background: none;
  border: 0;
  border-radius: 0;
  color: var(--ink);
  font: inherit;
  font-weight: 400;
  text-align: left;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
button.item:active { background: var(--press); }
button.item .box {
  flex: none;
  width: 1.45rem;
  height: 1.45rem;
  border: 2px solid var(--border);
  border-radius: 0.4rem;
  background: var(--paper);
}
button.item .body { flex: 1; min-width: 0; line-height: 1.35; overflow-wrap: anywhere; }
button.item .name { font-size: 1.05rem; }
.qty {
  display: inline-block;
  margin-left: 0.3rem;
  padding: 0.05rem 0.55rem;
  border-radius: 1rem;
  background: var(--bubble);
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 600;
  vertical-align: 0.12em;
  white-space: nowrap;
}
.src {
  display: inline-block;
  margin-left: 0.3rem;
  padding: 0.05rem 0.5rem;
  border-radius: 1rem;
  background: var(--chip);
  color: var(--muted);
  font-size: 0.78rem;
  vertical-align: 0.12em;
  white-space: nowrap;
}
.who {
  display: inline-block;
  margin-left: 0.3rem;
  padding: 0.05rem 0.5rem;
  border-radius: 1rem;
  border: 1px solid var(--rule);
  color: var(--muted);
  font-size: 0.74rem;
  vertical-align: 0.12em;
  white-space: nowrap;
}
li.new button.item { animation: arrived 2.5s ease-out; }
@keyframes arrived { 0%, 30% { background: var(--bubble); } 100% { background: transparent; } }
li.done button.item { color: var(--muted); }
li.done button.item .name { text-decoration: line-through; }
li.done .qty { background: var(--chip-done); color: var(--muted); }
li.done button.item .box { background: var(--accent); border-color: var(--accent); position: relative; }
li.done button.item .box::after {
  content: "";
  position: absolute;
  left: 0.45rem; top: 0.15rem;
  width: 0.35rem; height: 0.75rem;
  border: solid var(--on-accent);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
.donebar {
  position: sticky;
  bottom: 0;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 1rem 0 0;
  padding: 0.75rem 0 calc(0.75rem + env(safe-area-inset-bottom, 0px));
  background: var(--bg);
  border-top: 1px solid var(--rule);
}
.donebar button { white-space: nowrap; }
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(1rem + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  max-width: calc(100vw - 2rem);
  padding: 0.6rem 0.75rem 0.6rem 1rem;
  border-radius: 0.6rem;
  background: var(--ink);
  color: var(--bg);
  font-size: 0.95rem;
  white-space: nowrap;
  box-shadow: 0 4px 16px var(--shadow);
}
.toast button { padding: 0.35rem 0.8rem; background: var(--bg); color: var(--ink); }
.hidden { display: none; }

/* Opt-in proof page: a text thread */
.thread {
  max-width: 24rem;
  margin: 1rem 0 1.25rem;
  padding: 0.75rem;
  border: 1px solid var(--rule);
  border-radius: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.thread p {
  margin: 0;
  max-width: 85%;
  padding: 0.6rem 0.85rem;
  font: 0.92rem/1.4 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.thread .from-user { align-self: flex-end; background: var(--user-bubble); color: #fff; border-radius: 1rem 1rem 0.25rem 1rem; }
.thread .from-maude { align-self: flex-start; background: var(--bubble); border-radius: 1rem 1rem 1rem 0.25rem; }
ol.steps li { margin: 0.35rem 0; }

/* Settings page (/s/:token) */
.flash { padding: 0.6rem 0.9rem; border-radius: 0.6rem; background: var(--bubble); color: var(--accent); font-weight: 600; }
section.settings { margin-top: 1.5rem; padding-top: 0.25rem; border-top: 1px solid var(--rule); }
section.settings h2 { font-size: 1.15rem; margin: 1rem 0 0.5rem; }
section.settings p.small { margin: 0.25rem 0 1rem; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 0.75rem; margin: 0.5rem 0; }
.row form { margin: 0; }
.row .label, .row label { font-weight: 600; }
.row .value { overflow-wrap: anywhere; }
.row input[type="text"] {
  flex: 1;
  min-width: 8rem;
  padding: 0.55rem 0.75rem;
  font: inherit;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: 0.6rem;
}
.row input[type="text"]:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }
.row.check label { display: flex; align-items: start; gap: 0.5rem; font-weight: 400; flex: 1; }
.row.check input { margin-top: 0.3rem; width: 1.1rem; height: 1.1rem; }
.row.stack { flex-direction: column; align-items: stretch; gap: 0.4rem; }
.row.stack button { align-self: flex-start; }
form.rule label { display: flex; flex-direction: column; gap: 0.25rem; font-weight: 600; }
form.rule .choices { display: flex; gap: 1rem; }
form.rule .choices label { flex-direction: row; align-items: center; gap: 0.4rem; font-weight: 400; }
ul.rules .value { flex: 1; min-width: 10rem; overflow-wrap: anywhere; }
button.secondary { background: var(--paper); color: var(--accent); border: 1px solid var(--accent); padding: 0.5rem 1rem; }
button.danger { background: var(--paper); color: var(--error); border: 1px solid var(--error); padding: 0.5rem 1rem; }
ul.members { list-style: none; margin: 0; padding: 0; }
ul.members li { border-top: 1px solid var(--rule); padding: 0.4rem 0; }
ul.members li:first-child { border-top: 0; }
