:root {
  --bg: #f6f7f4;
  --card: #ffffff;
  --text: #1d231f;
  --muted: #6b746e;
  --line: #e2e6e1;
  --accent: #2f7d4f;
  --accent-soft: #e3f1e8;
  --danger: #b4483c;
  --warn: #a8621a;
  --warn-soft: #fbeedd;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141815;
    --card: #1e2420;
    --text: #e8ece9;
    --muted: #97a19a;
    --line: #2d3530;
    --accent: #5cbf83;
    --accent-soft: #233a2b;
    --danger: #e07a6e;
    --warn: #e6a35c;
    --warn-soft: #3d2e1c;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 17px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
}
button { font: inherit; color: inherit; cursor: pointer; }
a { color: var(--accent); }

.top {
  position: sticky; top: 0; z-index: 10;
  display: flex; justify-content: space-between; align-items: center;
  padding: calc(env(safe-area-inset-top) + 12px) 16px 12px;
  background: var(--accent); color: #fff;
}
.top a { color: #fff; text-decoration: none; }
.brand { font-weight: 700; font-size: 1.2rem; }
.top nav a { padding: 6px 12px; border-radius: 999px; background: rgb(255 255 255 / .18); }

main {
  max-width: 560px; margin: 0 auto;
  padding: 16px 16px calc(env(safe-area-inset-bottom) + 32px);
}

.add { display: flex; gap: 8px; }
.add input {
  flex: 1; min-width: 0;
  padding: 14px 16px; font-size: 1.05rem;
  border: 1px solid var(--line); border-radius: 14px;
  background: var(--card); color: var(--text);
}
.add input:focus { outline: 2px solid var(--accent); border-color: transparent; }
.add button {
  width: 54px; border: 0; border-radius: 14px;
  background: var(--accent); color: #fff; font-size: 1.6rem; line-height: 1;
}

#suggestions { margin: 12px 0 4px; }
.hint { margin: 0 0 8px; font-size: .85rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  padding: 8px 14px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--card);
  font-size: .95rem;
}
.chip.new { background: var(--accent); border-color: var(--accent); color: #fff; }
.chip.on { color: var(--muted); border-style: dashed; }
.chip-group { display: inline-flex; }
.chip-group .chip { border-top-right-radius: 0; border-bottom-right-radius: 0; border-right: 0; }
.chip-del {
  padding: 8px 12px 8px 8px; border-radius: 0 999px 999px 0;
  border: 1px solid var(--line); border-left: 0; background: var(--card);
  color: var(--muted); font-size: .8rem;
}
.chip-del:active { color: var(--danger); }

.items { list-style: none; margin: 16px 0 0; padding: 0; }
.items li {
  display: flex; align-items: stretch;
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  margin-bottom: 8px; overflow: hidden;
}
.toggle {
  flex: 1; min-width: 0;
  display: flex; align-items: center; gap: 14px;
  padding: 14px; border: 0; background: none; text-align: left;
}
.box {
  flex: none; width: 28px; height: 28px; border-radius: 50%;
  border: 2px solid var(--accent);
  display: grid; place-items: center;
  color: #fff; font-weight: 700;
}
.name { overflow-wrap: anywhere; }
.name small { display: block; color: var(--muted); font-size: .85rem; }
.icon {
  flex: none; width: 48px; border: 0; background: none;
  color: var(--muted); font-size: 1.1rem;
}
.icon:last-child:active { color: var(--danger); }

.items li.taken { background: var(--accent-soft); border-color: transparent; }
.taken .box { background: var(--accent); }
.taken .name { color: var(--muted); text-decoration: line-through; }

.items li.missing { background: var(--warn-soft); border-color: transparent; }
.missing .box { border-color: var(--warn); }
.missing .icon.nf { color: var(--warn); }
.tag { color: var(--warn); font-size: .8rem; font-weight: 600; }
.name small.tag { color: var(--warn); }

.finish {
  display: block; width: 100%; margin-top: 16px; padding: 16px;
  border: 0; border-radius: 14px;
  background: var(--accent); color: #fff; font-weight: 600;
}
.items li.removing { opacity: .35; }

#toast {
  position: fixed; left: 0; right: 0; z-index: 20;
  bottom: calc(env(safe-area-inset-bottom) + 16px);
  display: flex; justify-content: center; padding: 0 16px;
  pointer-events: none;
}
.toast {
  display: flex; align-items: center; gap: 12px;
  width: 100%; max-width: 528px; padding: 12px 12px 12px 16px;
  border-radius: 14px; background: var(--text); color: var(--bg);
  box-shadow: 0 6px 24px rgb(0 0 0 / .25);
  pointer-events: auto;
}
.toast span { flex: 1; font-size: .95rem; }
.toast button {
  flex: none; padding: 8px 14px; border: 0; border-radius: 10px;
  background: var(--accent); color: #fff; font-weight: 600;
}
.empty { margin: 40px 0; text-align: center; color: var(--muted); }

h1 { font-size: 1.3rem; margin: 4px 0 16px; }
.trip {
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  margin-bottom: 8px;
}
.trip summary {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 14px; list-style: none; cursor: pointer;
}
.trip summary::-webkit-details-marker { display: none; }
.trip summary span:first-child::first-letter { text-transform: uppercase; }
.trip summary small { color: var(--muted); margin-left: 6px; }
.counts { display: flex; gap: 6px; flex: none; }
.count {
  min-width: 32px; padding: 2px 10px; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent); text-align: center; font-weight: 600;
}
.trip ul { margin: 0; padding: 0 14px 14px 34px; }
.trip li { padding: 3px 0; }
.trip li small { color: var(--muted); }
.count.missing { background: var(--warn-soft); color: var(--warn); }
.trip li.missing { color: var(--muted); }
.pager { display: flex; justify-content: space-between; align-items: center; margin-top: 16px; color: var(--muted); }

.htmx-request.toggle, .htmx-request.chip, .add.htmx-request button { opacity: .6; }
