:root {
  --green: #1f5c46; --bg: #f4f5f2; --card: #fff; --ink: #1c2420; --muted: #6b756f; --line: #e2e6e1; --red: #a8322a;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #111512; --card: #1b211d; --ink: #e9eeea; --muted: #98a39c; --line: #2c342f; --red: #f08a80; }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 17px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; }
:focus-visible { outline: 3px solid #4d9c7c; outline-offset: 2px; }
input, select { width: 100%; padding: 12px 14px; background: var(--card); border: 1px solid var(--line); border-radius: 10px; }

header { position: sticky; top: 0; z-index: 2; background: var(--green); color: #fff; padding: calc(10px + env(safe-area-inset-top)) 14px 10px; }
header > *, main { max-width: 640px; margin-inline: auto; }
.bar { display: flex; align-items: center; gap: 10px; }
h1 { font-size: 20px; margin: 0; }
#status { margin-left: auto; font-size: 13px; opacity: .85; }
.icon-btn { display: grid; place-items: center; width: 44px; height: 44px; padding: 0; }
#add { display: flex; gap: 8px; margin-top: 8px; }
#add input { color: var(--ink); border: 0; min-width: 0; }
.add-btn { flex: 0 0 50px; display: grid; place-items: center; border-radius: 10px; background: #fff; color: #1f5c46; }
#suggest { display: flex; gap: 6px; overflow-x: auto; margin-top: 8px; scrollbar-width: none; }
.chip { flex: none; padding: 6px 12px; border: 1px solid rgb(255 255 255 / .4); border-radius: 99px; color: #fff; font-size: 15px; }

main { padding: 4px 14px calc(100px + env(safe-area-inset-bottom)); }
h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 20px 4px 6px; }
ul { list-style: none; margin: 0; padding: 0; background: var(--card); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
li { display: flex; align-items: center; }
li + li { border-top: 1px solid var(--line); }
.tick { flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; padding: 14px 4px 14px 14px; text-align: left; }
.box { flex: none; width: 24px; height: 24px; border: 2px solid var(--muted); border-radius: 7px; }
[aria-pressed="true"] .box { border-color: var(--green); background: var(--green) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E") center/16px no-repeat; }
.label { overflow-wrap: anywhere; }
.qty { flex: none; font-size: 14px; font-weight: 600; background: var(--bg); border-radius: 6px; padding: 1px 8px; }
.who { margin-left: auto; font-size: 12px; color: var(--muted); text-transform: capitalize; }
.more { color: var(--muted); margin-right: 4px; }
.more svg { width: 18px; height: 18px; }
.is-done .label { text-decoration: line-through; color: var(--muted); }
#empty { text-align: center; color: var(--muted); margin-top: 48px; }
.trolley-head { display: flex; align-items: baseline; justify-content: space-between; }
.text-btn { padding: 8px 10px; font-weight: 600; }
.danger { color: var(--red); }
.primary { padding: 12px 20px; border-radius: 10px; background: var(--green); color: #fff; font-weight: 600; }

label { display: block; font-size: 14px; color: var(--muted); }
label input, label select { display: block; margin-top: 4px; font-size: 17px; color: var(--ink); }
dialog { width: min(420px, calc(100% - 24px)); padding: 16px; border: 1px solid var(--line); border-radius: 14px; background: var(--bg); color: var(--ink); }
dialog::backdrop { background: rgb(0 0 0 / .5); }
#edit, .login form { display: grid; gap: 14px; }
.actions { display: grid; grid-template-columns: auto 1fr auto auto; gap: 6px; align-items: center; }

#toast { position: fixed; left: 50%; bottom: calc(16px + env(safe-area-inset-bottom)); translate: -50% 0; display: flex; align-items: center; gap: 16px; width: max-content; max-width: calc(100% - 24px); padding: 10px 10px 10px 16px; border-radius: 10px; background: #1c2420; color: #fff; }
#toast button { color: #8fe0bd; font-weight: 700; padding: 6px 8px; }

.login { max-width: 360px; padding-top: 14vh; text-align: center; }
.login h1 { margin: 12px 0 24px; }
.login label { text-align: left; }
.error { color: var(--red); }
