:root {
  --bg: #f4f3ee;
  --card: #fbfaf6;
  --field: #ffffff;
  --ink: #1d2a24;
  --muted: #55645c;
  --line: #cfd3c8;
  --accent: #a8441f;
  --accent-ink: #ffffff;
  --link: #7e3216;
  --warn-bg: #fbeed8;
  --warn-ink: #5e3a06;
  --good: #2a6f4c;
  --error: #a3231b;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #131b17;
    --card: #1b2520;
    --field: #222e28;
    --ink: #e9efea;
    --muted: #a9b8af;
    --line: #34443b;
    --accent: #e58b62;
    --accent-ink: #2a1705;
    --link: #f0ad8d;
    --warn-bg: #3a2c12;
    --warn-ink: #f5d9a8;
    --good: #6bcb9c;
    --error: #ff9c94;
  }
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 1rem/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--link); }
h1, h2, h3 { line-height: 1.2; margin: 0; }
h1 { font-size: 1.6rem; overflow-wrap: anywhere; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; overflow-wrap: anywhere; }
p { margin: 0; }
:focus-visible { outline: 3px solid var(--link); outline-offset: 2px; }
main:focus { outline: none; }

.top {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .25rem .75rem;
  padding: calc(.5rem + env(safe-area-inset-top)) max(1rem, env(safe-area-inset-right)) .5rem max(1rem, env(safe-area-inset-left));
  border-bottom: 1px solid var(--line);
  background: var(--card);
}
.brand { font-weight: 800; font-size: 1.2rem; color: var(--ink); text-decoration: none; }
.top-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .25rem .5rem; }
.page {
  max-width: 48rem; margin: 0 auto;
  padding: 1rem max(1rem, env(safe-area-inset-right)) calc(3rem + env(safe-area-inset-bottom)) max(1rem, env(safe-area-inset-left));
  display: grid; gap: 1rem;
}
.page > * { min-width: 0; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.pre { white-space: pre-wrap; overflow-wrap: anywhere; }
.stack { display: grid; gap: .75rem; min-width: 0; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.spread { justify-content: space-between; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: .9rem; display: grid; gap: .75rem; min-width: 0; }
.banner { background: var(--warn-bg); color: var(--warn-ink); border-radius: 8px; padding: .7rem .9rem; display: grid; gap: .5rem; }
.error { color: var(--error); }
.badge { display: inline-block; font-size: .8rem; font-weight: 600; border: 1px solid var(--line); border-radius: 999px; padding: .05rem .55rem; color: var(--muted); }

button, .button {
  font: inherit; font-weight: 600; min-height: 2.75rem; padding: .4rem .9rem; border-radius: 6px; cursor: pointer;
  background: var(--accent); color: var(--accent-ink); border: 1px solid transparent;
  display: inline-flex; align-items: center; justify-content: center; text-decoration: none;
}
button.ghost, .button.ghost { background: transparent; color: var(--ink); border-color: var(--line); }
button.link { background: none; border: 0; color: var(--link); text-decoration: underline; font-weight: 400; padding: .4rem .25rem; }
button:disabled { opacity: .5; cursor: default; }
button.step { width: 2.75rem; padding: 0; font-size: 1.25rem; }

label { display: grid; gap: .25rem; font-weight: 600; min-width: 0; }
label.check { display: flex; align-items: center; gap: .5rem; font-weight: 400; min-height: 2.75rem; }
.search { flex: 1 1 14rem; }
label.check input { width: 1.25rem; height: 1.25rem; }
/* 16px stops iOS Safari from zooming the page when a field gets focus. */
input:not([type=checkbox]), textarea, select {
  width: 100%; font: inherit; font-size: 16px; font-weight: 400; color: var(--ink); background: var(--field);
  border: 1px solid var(--line); border-radius: 6px; padding: .55rem .65rem; min-height: 2.75rem;
}
textarea { resize: vertical; min-height: 5rem; }
.hint { font-size: .875rem; font-weight: 400; color: var(--muted); }
.fields-2 { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) minmax(0, 1fr); gap: .75rem; }

.list-link { display: grid; gap: .1rem; text-decoration: none; color: inherit; background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: .7rem .9rem; min-height: 2.75rem; }
.list-link strong { color: var(--link); overflow-wrap: anywhere; }

.item-head { display: grid; grid-template-columns: 5.5rem minmax(0, 1fr); gap: .75rem; align-items: start; }
.item-head.no-image { grid-template-columns: minmax(0, 1fr); }
.item-image { width: 5.5rem; height: 5.5rem; object-fit: contain; background: var(--field); border: 1px solid var(--line); border-radius: 6px; }
.item.done { opacity: .75; }
.claim-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); gap: .75rem; }
.stepper { display: flex; align-items: center; gap: .5rem; }
.stepper output { min-width: 2rem; text-align: center; font-weight: 700; font-variant-numeric: tabular-nums; }
.note-box { border-top: 1px solid var(--line); padding-top: .75rem; display: grid; gap: .5rem; }

.toast {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(1rem + env(safe-area-inset-bottom));
  background: var(--ink); color: var(--bg); padding: .6rem .9rem; border-radius: 8px; max-width: min(92vw, 34rem); z-index: 10;
}
@media (max-width: 30rem) {
  .fields-2 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .fields-2 > :first-child { grid-column: 1 / -1; }
}
