:root {
    color-scheme: light;
    --page: #edf4ee;
    --surface: #fff;
    --ink: #182e25;
    --muted: #52675c;
    --border: #d4e0d7;
    --green: #216044;
    --green-hover: #164b34;
    font-family: system-ui, sans-serif;
    color: var(--ink);
    background: var(--page);
}

*, *::before, *::after { box-sizing: border-box; }

body { margin: 0; }

.page {
    width: min(100% - 2rem, 60rem);
    margin: 0 auto;
    padding: clamp(2rem, 7vw, 5rem) 0;
}

h1, h2 { margin: 0; }

h1 {
    margin-bottom: 1.5rem;
    font-size: clamp(2rem, 5vw, 3rem);
    line-height: 1.12;
    letter-spacing: -0.04em;
}

h2 {
    font-size: 1.2rem;
    letter-spacing: -0.015em;
}

.panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 1rem;
    padding: clamp(1rem, 3vw, 1.5rem);
}

.add-form { box-shadow: 0 0.3rem 1rem #182e250a; }

.add-fields {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) auto;
    align-items: end;
    gap: 0.75rem;
}

label {
    display: grid;
    gap: 0.4rem;
    font-weight: 650;
}

.optional, .item-quantity, .empty { color: var(--muted); }
.optional { font-weight: 400; }

input, .button {
    min-height: 2.75rem;
    font: inherit;
    border-radius: 0.6rem;
}

input {
    width: 100%;
    min-width: 0;
    padding: 0.6rem 0.75rem;
    border: 1px solid #9db3a4;
    color: var(--ink);
    background: #fbfdfb;
}

.button {
    padding: 0.55rem 0.9rem;
    border: 1px solid transparent;
    font-weight: 650;
    cursor: pointer;
}

.button-primary {
    background: var(--green);
    color: #fff;
}

.button-primary:hover { background: var(--green-hover); }

.button-secondary {
    background: #f0f6f1;
    color: var(--green-hover);
    border-color: #c2d7c9;
    font-size: 0.875rem;
}

.button-secondary:hover { background: #dfede3; }

:focus-visible {
    outline: 3px solid #276e51;
    outline-offset: 3px;
}

.lists {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
    gap: 1rem;
    margin-top: 1rem;
}

.list-bought { background: #f7faf7; }

.list ul {
    padding: 0;
    margin: 0.6rem 0 0;
    list-style: none;
}

.item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    padding: 0.8rem 0;
    border-bottom: 1px solid var(--border);
}

.item:last-child { border-bottom: 0; padding-bottom: 0; }

.item-description {
    display: grid;
    gap: 0.16rem;
    min-width: 0;
    overflow-wrap: anywhere;
}

.item-name { font-weight: 650; }
.item-quantity { font-size: 0.875rem; }
.item form { flex-shrink: 0; }
.empty { margin: 0.8rem 0 0; line-height: 1.5; }

.error {
    margin: 0 0 0.8rem;
    color: #a52b20;
    font-weight: 650;
}

@media (max-width: 42rem) {
    .lists { grid-template-columns: 1fr; }
}

@media (max-width: 34rem) {
    .add-fields { grid-template-columns: minmax(0, 1fr) auto; }
    .name-field { grid-column: 1 / -1; }
}
