:root {
    color-scheme: light;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: #f4f1ea;
    color: #17201a;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    background:
        linear-gradient(135deg, rgba(40, 117, 82, 0.12), transparent 34%),
        linear-gradient(315deg, rgba(213, 88, 55, 0.10), transparent 32%),
        #f4f1ea;
}

button,
input {
    font: inherit;
}

.app {
    width: min(720px, 100%);
    min-height: 100vh;
    margin: 0 auto;
    padding: 22px 18px 34px;
}

.topbar {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 26px;
}

.eyebrow {
    margin: 0 0 3px;
    color: #546058;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0;
    text-transform: uppercase;
}

h1 {
    margin: 0;
    font-size: 2.15rem;
    line-height: 1;
}

.ghost-button,
.link-button,
.delete {
    border: 0;
    background: transparent;
    color: #335342;
    cursor: pointer;
}

.ghost-button {
    padding: 10px 0;
    font-weight: 700;
}

.add-form,
.group-save-form {
    margin-bottom: 16px;
}

.login-form {
    margin-top: 34px;
}

.add-form label,
.login-form label {
    display: block;
    margin-bottom: 8px;
    color: #344139;
    font-weight: 700;
}

.add-row,
.group-save-form,
.group-item-form {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 10px;
}

.add-row input,
.item-name,
.group-save-form input,
.group-name,
.group-item-form input,
.group-item-name {
    min-width: 0;
    width: 100%;
    border: 1px solid #d7d0c3;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.86);
    color: #17201a;
}

.add-row input,
.group-save-form input,
.group-item-form input {
    min-height: 52px;
    padding: 0 14px;
    font-size: 1.05rem;
}

.add-row button,
.group-save-form button,
.group-item-form button {
    min-width: 82px;
    min-height: 52px;
    border: 0;
    border-radius: 8px;
    background: #287552;
    color: #fff;
    font-weight: 800;
    cursor: pointer;
}

.status-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    min-height: 34px;
    margin-bottom: 10px;
    color: #58655d;
    font-size: 0.92rem;
}

.toolbar {
    display: flex;
    justify-content: flex-end;
    margin: -18px 0 8px;
}

.error-message {
    margin: 10px 0 0;
    color: #a13d2d;
    font-weight: 700;
}

.link-button {
    flex: 0 0 auto;
    padding: 7px 0;
    font-weight: 800;
}

.items {
    display: grid;
    gap: 9px;
}

.groups-panel {
    margin-top: 28px;
    padding-top: 22px;
    border-top: 1px solid rgba(37, 54, 44, 0.14);
}

.section-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

h2 {
    margin: 0;
    font-size: 1.18rem;
}

.groups {
    display: grid;
    gap: 9px;
}

.group {
    padding: 9px;
    border: 1px solid rgba(37, 54, 44, 0.10);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.64);
    box-shadow: 0 10px 30px rgba(40, 42, 37, 0.05);
}

.group-summary {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 9px;
}

.group-add {
    min-height: 44px;
    padding: 0 13px;
    border: 0;
    border-radius: 8px;
    background: #2e6349;
    color: #fff;
    font-weight: 800;
    text-align: left;
    cursor: pointer;
}

.group-edit {
    min-width: 64px;
    min-height: 44px;
    border: 1px solid #c8d0c9;
    border-radius: 8px;
    background: #fff;
    color: #335342;
    font-weight: 800;
    cursor: pointer;
}

.group-editor {
    display: grid;
    gap: 9px;
    margin-top: 10px;
}

.group-editor[hidden] {
    display: none;
}

.group-name,
.group-item-name {
    min-height: 42px;
    padding: 0 10px;
    font-weight: 700;
}

.group-items {
    display: grid;
    gap: 7px;
}

.group-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
}

.group-delete {
    justify-self: end;
}

.item {
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr) auto;
    align-items: center;
    gap: 9px;
    min-height: 58px;
    padding: 7px;
    border: 1px solid rgba(37, 54, 44, 0.10);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.74);
    box-shadow: 0 10px 30px rgba(40, 42, 37, 0.06);
}

.check {
    width: 38px;
    height: 38px;
    border: 2px solid #8d9b91;
    border-radius: 50%;
    background: #fff;
    cursor: pointer;
}

.item.checked .check {
    border-color: #287552;
    background: #287552;
}

.item.checked .check::after {
    content: "";
    display: block;
    width: 13px;
    height: 7px;
    margin: 12px auto 0;
    border-left: 3px solid #fff;
    border-bottom: 3px solid #fff;
    transform: rotate(-45deg);
}

.item-name {
    min-height: 42px;
    padding: 0 10px;
    font-weight: 700;
}

.item.checked .item-name {
    color: #758178;
    text-decoration: line-through;
}

.delete {
    min-width: 60px;
    min-height: 42px;
    font-weight: 800;
}

.empty {
    padding: 36px 10px;
    color: #5f6b63;
    text-align: center;
}

.compact-empty {
    padding: 18px 10px;
}

@media (max-width: 760px) {
    .app {
        padding: 18px 12px 26px;
    }

    h1 {
        font-size: 1.85rem;
    }

    .item {
        grid-template-columns: 36px minmax(0, 1fr) 34px;
        gap: 6px;
        min-height: 50px;
        padding: 5px;
    }

    .check {
        width: 34px;
        height: 34px;
    }

    .item.checked .check::after {
        margin-top: 10px;
    }

    .item-name {
        min-height: 38px;
        padding: 0 8px;
    }

    .group-save-form,
    .group-item-form,
    .group-summary {
        grid-template-columns: 1fr;
    }

    .item > .delete {
        width: 34px;
        min-width: 34px;
        max-width: 34px;
        min-height: 34px;
        height: 34px;
        padding: 0;
        overflow: hidden;
        color: transparent;
        font-size: 0;
        white-space: nowrap;
    }

    .item > .delete::before {
        content: "×";
        color: #335342;
        font-size: 1.35rem;
        line-height: 1;
    }

    .group-item {
        grid-template-columns: minmax(0, 1fr) 42px;
    }

    .group-item-delete {
        min-width: 42px;
        padding: 0;
        overflow: hidden;
        color: transparent;
        font-size: 0;
    }

    .group-item-delete::before {
        content: "×";
        color: #335342;
        font-size: 1.25rem;
        line-height: 1;
    }
}
