* { box-sizing: border-box; }
body { margin: 0; padding: 16px; background: #e8eee6; color: #1c3027; font: 16px system-ui, sans-serif; }
main, dialog { width: min(100%, 420px); margin: auto; border: 1px solid #d0dbcf; border-radius: 22px; background: #faf9f4; color: inherit; }
main { min-height: 460px; }
main[data-theme] {
  --list-tint: hsl(var(--list-hue) 42% 91%);
  background:
    linear-gradient(180deg, hsl(var(--list-hue) 42% 94% / .78), #faf9f4 275px),
    var(--list-picture) top right / auto 300px no-repeat,
    linear-gradient(155deg, var(--list-tint), #faf9f4 72%);
}
main[data-theme] header { background: #ffffff38; }
main[data-theme] .primary { background: hsl(var(--list-hue) 40% 28%); border-color: hsl(var(--list-hue) 40% 28%); }
main[data-theme] #navigation [aria-current] { background: var(--list-tint); }
header { min-height: 60px; display: flex; align-items: center; justify-content: space-between; padding: 8px 12px; border-bottom: 1px solid #d0dbcf; }
.header-brand { display: flex; align-items: center; gap: 6px; }
section, dialog { padding: 20px; }
h1 { font: 32px Georgia, serif; margin: 0 0 14px; }
h2 { margin-top: 0; }
p, small { color: #53645b; }
label { display: grid; gap: 6px; margin-bottom: 14px; }
input, button, select { font: inherit; min-height: 44px; border: 1px solid #aabaaa; border-radius: 10px; background: #fff; color: inherit; padding: 8px 12px; }
input { width: 100%; min-width: 0; }
button { cursor: pointer; }
.primary { background: #215944; color: white; border-color: #215944; }
.row { display: flex; gap: 8px; }
.add-form { display: flex; align-items: flex-start; gap: 8px; }
.add-fields { display: grid; grid-template-columns: minmax(0, 1fr) 48px; flex: 1; min-width: 0; }
.add-fields input:first-child { border-radius: 10px 0 0 10px; }
.add-fields input:last-child { border-radius: 0 10px 10px 0; border-left: 0; padding-inline: 4px; text-align: center; }
#groceries.custom-list .add-fields { grid-template-columns: minmax(0, 1fr); }
#groceries.custom-list .add-fields input:first-child { border-radius: 10px; }
.list-heading { display: flex; align-items: center; gap: 4px; margin-bottom: 14px; }
.list-heading h1 { overflow-wrap: anywhere; margin: 0; }
.list-heading .icon-button { flex-shrink: 0; }
#groceries.custom-list:not([hidden]) { display: flex; flex-direction: column; flex: 1; }
main { display: flex; flex-direction: column; }
#list-footer { display: flex; justify-content: flex-end; margin-top: auto; padding-top: 16px; }
ul { list-style: none; padding: 0; }
li { display: flex; align-items: center; border-bottom: 1px solid #d0dbcf; touch-action: pan-y pinch-zoom; }
li label { margin: 0; width: 44px; min-height: 44px; place-items: center; }
input[type=checkbox] { width: 19px; min-height: 19px; accent-color: #215944; }
li .item-name { flex: 1; min-width: 0; overflow-wrap: anywhere; }
li .item-action { display: grid; place-items: center; flex: 0 0 44px; background: transparent; border: 0; padding: 0; }
.icon-button { display: grid; place-items: center; width: 44px; border: 0; background: transparent; padding: 0; }
.icon-button svg, .item-action svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.danger { color: #8a2929; }
nav { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px 20px; border-top: 1px solid #d0dbcf; }
nav button { overflow-wrap: anywhere; min-width: 0; max-width: 100%; }
nav button { flex: 1; }
nav [aria-current] { background: #dceadd; border-color: #537a61; }
li small { display: block; }
summary { padding: 10px 0; cursor: pointer; }
#status { margin: 12px 20px; }
dialog { max-width: calc(100% - 32px); }
dialog::backdrop { background: #182b21a0; }
#menu { position: fixed; inset: 0 auto 0 0; margin: 0; width: min(300px, 85vw); max-width: none; max-height: none; height: 100%; height: 100dvh; border-radius: 0 20px 20px 0; padding: 0; overflow-y: auto; }
.menu-header { display: flex; align-items: center; justify-content: space-between; padding: 12px 12px 12px 18px; }
.menu-header h2 { margin: 0; font-size: 20px; }
.menu-links, #activities { display: grid; gap: 4px; }
.menu-links { padding: 12px; }
.menu-links section { margin-block: 6px; padding: 12px 0; border-block: 1px solid #d0dbcf; }
.menu-links h3 { margin: 0 10px 6px; font-size: 15px; font-weight: 700; color: #1c3027; }
#activities { padding-left: 10px; }
.menu-links button { text-align: left; border-color: transparent; background: transparent; }
.menu-links [aria-current] { background: #dceadd; }
@media (max-width: 480px) {
  body { padding: 0; background: #faf9f4; }
  main { width: 100%; min-height: 100vh; min-height: 100dvh; border: 0; border-radius: 0; }
  section { padding: 16px; }
  #navigation { padding-inline: 16px; }
}
[hidden] { display: none !important; }
