:root {
    --green: #306b4f;
    --green-dark: #24533e;
    --green-soft: #e7f1eb;
    --cream: #f7f6f1;
    --card: #fff;
    --ink: #183029;
    --muted: #6f7c76;
    --line: #dfe4e0;
    --danger: #b44c43;
    --shadow: 0 8px 30px rgba(33, 60, 48, .08);
    --radius: 18px;
    --nav-height: 74px;
    color-scheme: light
}

* {
    box-sizing: border-box
}

html {
    scroll-behavior: smooth
}

body {
    margin: 0;
    background: var(--cream);
    color: var(--ink);
    font: 15px/1.45 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    -webkit-tap-highlight-color: transparent
}

button,
input,
select,
textarea {
    font: inherit
}

button {
    color: inherit
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 3px solid rgba(48, 107, 79, .25);
    outline-offset: 2px
}

.app-header {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: calc(14px + env(safe-area-inset-top)) 18px 12px;
    background: rgba(247, 246, 241, .94);
    backdrop-filter: blur(14px);
    border-bottom: 1px solid rgba(223, 228, 224, .8)
}

.app-header-actions {
    display: flex;
    align-items: center;
    gap: 8px
}

h1,
h2,
p {
    margin-top: 0
}

h1 {
    margin-bottom: 0;
    font-size: 25px;
    letter-spacing: -.6px
}

h2 {
    font-size: 20px;
    letter-spacing: -.3px
}

.eyebrow {
    margin: 0 0 1px;
    text-transform: uppercase;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 1.4px;
    color: var(--green)
}

.icon-button {
    width: 44px;
    height: 44px;
    border: 1px solid var(--line);
    border-radius: 50%;
    background: var(--card);
    font-size: 21px;
    cursor: pointer
}

.quick-list-button {
    position: relative;
    display: grid;
    place-items: center;
    color: var(--green);
    background: var(--green-soft);
    border-color: rgba(48, 107, 79, .18);
    box-shadow: 0 6px 16px rgba(48, 107, 79, .1)
}

.quick-list-button svg {
    width: 21px;
    height: 21px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round
}

.quick-list-button:hover {
    background: #dcebe2
}

.quick-list-button:active {
    transform: translateY(1px);
    box-shadow: 0 3px 10px rgba(48, 107, 79, .12)
}

.quick-list-badge {
    position: absolute;
    top: -3px;
    right: -3px;
    min-width: 18px;
    height: 18px;
    padding: 1px 5px;
    border: 2px solid var(--cream);
    border-radius: 99px;
    background: var(--danger);
    color: #fff;
    font: 800 10px/13px system-ui
}

main {
    max-width: 760px;
    margin: auto;
    padding: 16px 15px calc(var(--nav-height) + env(safe-area-inset-bottom) + 38px)
}

.screen {
    display: none
}

.screen.active {
    display: block;
    animation: fade .18s ease
}

@keyframes fade {
    from {
        opacity: .25;
        transform: translateY(3px)
    }
}

.hero-card {
    padding: 22px;
    background: linear-gradient(140deg, var(--green-dark), var(--green));
    border-radius: 24px;
    color: #fff;
    box-shadow: var(--shadow)
}

.quick-hero {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px
}

.quick-hero strong {
    flex: 0 0 auto;
    padding: 6px 10px;
    border-radius: 99px;
    background: rgba(255, 255, 255, .16);
    font-size: 12px
}

.hero-icon {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    margin-bottom: 14px;
    border-radius: 12px;
    background: rgba(255, 255, 255, .14);
    font-size: 24px
}

.hero-card h2 {
    margin-bottom: 5px;
    font-size: 22px
}

.hero-card p {
    margin-bottom: 20px;
    color: rgba(255, 255, 255, .75)
}

.progress-copy {
    display: flex;
    justify-content: space-between;
    margin-bottom: 7px;
    font-size: 12px;
    font-weight: 700
}

.progress {
    height: 6px;
    overflow: hidden;
    border-radius: 10px;
    background: rgba(255, 255, 255, .18)
}

.progress span {
    display: block;
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: #d5e9b7;
    transition: width .25s
}

.toolbar {
    display: flex;
    gap: 9px;
    align-items: center;
    margin: 16px 0
}

.quick-add-form {
    display: flex;
    gap: 9px;
    align-items: center;
    margin: 16px 0
}

.sticky-toolbar {
    position: sticky;
    top: 79px;
    z-index: 10;
    padding: 7px 0;
    background: var(--cream)
}

.search {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    height: 46px;
    padding: 0 13px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--card);
    box-shadow: 0 2px 10px rgba(30, 50, 43, .03)
}

.search span {
    font-size: 22px;
    color: var(--muted)
}

.search input {
    min-width: 0;
    width: 100%;
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--ink)
}

.standalone {
    margin: 14px 0
}

.primary,
.secondary,
.text-button {
    border: 0;
    border-radius: 13px;
    font-weight: 750;
    cursor: pointer
}

.primary {
    min-height: 46px;
    padding: 0 18px;
    background: var(--green);
    color: #fff;
    box-shadow: 0 5px 14px rgba(48, 107, 79, .18)
}

.primary:active {
    background: var(--green-dark);
    transform: translateY(1px)
}

.secondary {
    min-height: 46px;
    padding: 0 18px;
    border: 1px solid var(--line);
    background: var(--card)
}

.small {
    white-space: nowrap
}

.wide {
    width: 100%
}

.text-button {
    padding: 8px;
    background: transparent;
    color: var(--green)
}

.text-button.active {
    background: var(--green-soft)
}

.group {
    margin: 20px 0
}

.group-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 0 4px 9px
}

.group-header h3 {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    font-size: 14px
}

.group-header h3 span {
    display: grid;
    place-items: center;
    width: 29px;
    height: 29px;
    border-radius: 9px;
    background: var(--green-soft)
}

.group-header small {
    color: var(--muted)
}

.item-row {
    display: flex;
    align-items: center;
    gap: 11px;
    min-height: 66px;
    padding: 9px 11px;
    margin-bottom: 7px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: var(--card);
    box-shadow: 0 2px 8px rgba(30, 50, 43, .025)
}

.quick-list {
    margin: 15px 0
}

.quick-item-row {
    display: flex;
    align-items: center;
    gap: 11px;
    min-height: 58px;
    padding: 9px 11px;
    margin-bottom: 7px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: var(--card);
    box-shadow: 0 2px 8px rgba(30, 50, 43, .025)
}

.quick-item-row.is-bought .item-copy {
    opacity: .55;
    text-decoration: line-through
}

.need-toggle,
.bought-toggle {
    flex: 0 0 27px;
    width: 27px;
    height: 27px;
    padding: 0;
    border: 2px solid #a8b4ae;
    border-radius: 9px;
    background: #fff;
    cursor: pointer
}

.need-toggle.checked,
.bought-toggle.checked {
    border-color: var(--green);
    background: var(--green);
    color: #fff
}

.item-copy {
    min-width: 0;
    flex: 1
}

.item-copy strong {
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis
}

.item-copy small {
    display: block;
    color: var(--muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis
}

.item-row.is-active {
    border-color: #9fc3ad;
    background: #fbfffc
}

.item-row.is-bought {
    opacity: .56
}

.item-row.is-bought strong {
    text-decoration: line-through
}

.quantity-stepper {
    display: flex;
    align-items: center;
    border: 1px solid var(--line);
    border-radius: 10px;
    overflow: hidden
}

.quantity-stepper button {
    width: 31px;
    height: 34px;
    border: 0;
    background: var(--cream);
    cursor: pointer
}

.quantity-stepper span {
    min-width: 27px;
    text-align: center;
    font-size: 13px;
    font-weight: 750
}

.more-button {
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    font-size: 20px;
    color: var(--muted);
    cursor: pointer
}

.store-actions {
    display: flex;
    gap: 6px
}

.couldnt-get {
    padding: 8px;
    border: 1px solid #e2b4af;
    border-radius: 10px;
    background: #fff7f6;
    color: var(--danger);
    font-size: 12px;
    font-weight: 750;
    cursor: pointer
}

.moved-status {
    display: inline-block;
    margin-top: 3px;
    padding: 2px 7px;
    border-radius: 99px;
    background: #fff0cf;
    color: #7b5710;
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .3px
}

.floating-action-wrap {
    position: sticky;
    bottom: calc(var(--nav-height) + env(safe-area-inset-bottom) + 12px);
    z-index: 10;
    padding: 12px 0 2px;
    background: linear-gradient(transparent, var(--cream) 28%)
}

.floating-action-wrap button {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 19px
}

.summary-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: var(--card)
}

.summary-card>div {
    display: flex;
    align-items: center;
    gap: 11px
}

.summary-icon {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: var(--green-soft);
    font-size: 23px
}

.summary-card strong,
.summary-card small {
    display: block
}

.summary-card small {
    color: var(--muted)
}

.filter-row {
    display: flex;
    gap: 7px;
    overflow: auto;
    margin: -3px 0 14px;
    padding-bottom: 3px;
    scrollbar-width: none
}

.filter-chip {
    padding: 8px 12px;
    border: 1px solid var(--line);
    border-radius: 99px;
    background: var(--card);
    white-space: nowrap;
    font-size: 12px;
    font-weight: 700
}

.filter-chip.active {
    border-color: var(--green);
    background: var(--green-soft);
    color: var(--green-dark)
}

.item-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 13px;
    margin-bottom: 8px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: var(--card)
}

.item-avatar {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    border-radius: 13px;
    background: var(--green-soft);
    font-weight: 800;
    color: var(--green)
}

.item-card .item-copy small+small {
    margin-top: 2px
}

.card-actions {
    display: flex;
    gap: 4px
}

.card-actions button {
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: 10px;
    background: var(--cream);
    cursor: pointer
}

.favorite {
    color: #c89125
}

.empty-state {
    padding: 34px 20px;
    text-align: center;
    border: 1px dashed #c6d0ca;
    border-radius: 18px;
    color: var(--muted)
}

.empty-state span {
    display: block;
    margin-bottom: 8px;
    font-size: 32px
}

.empty-state strong {
    display: block;
    margin-bottom: 4px;
    color: var(--ink)
}

.segmented {
    display: flex;
    padding: 4px;
    margin-bottom: 17px;
    border-radius: 14px;
    background: #e7e9e5
}

.segmented button {
    flex: 1;
    height: 39px;
    border: 0;
    border-radius: 11px;
    background: transparent;
    font-weight: 700
}

.segmented button.active {
    background: var(--card);
    box-shadow: 0 2px 8px rgba(30, 50, 43, .08)
}

.section-intro {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px
}

.section-intro h2 {
    margin-bottom: 2px
}

.section-intro p {
    margin-bottom: 14px;
    color: var(--muted);
    font-size: 13px
}

.location-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px;
    margin-bottom: 8px;
    border: 1px solid var(--line);
    border-radius: 15px;
    background: var(--card)
}

.route-number {
    display: grid;
    place-items: center;
    width: 31px;
    height: 31px;
    flex: 0 0 31px;
    border-radius: 9px;
    background: var(--green-soft);
    color: var(--green);
    font-weight: 800
}

.location-row strong {
    min-width: 0;
    flex: 1
}

.move-buttons {
    display: flex
}

.move-buttons button,
.location-row>.location-action {
    width: 34px;
    height: 34px;
    border: 0;
    background: transparent;
    color: var(--muted);
    cursor: pointer
}

.move-buttons button:disabled {
    opacity: .2
}

.intro-actions {
    display: flex;
    gap: 7px
}

.settings-block {
    margin-bottom: 18px;
    padding: 17px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: var(--card)
}

.settings-block h2 {
    margin-bottom: 10px;
    font-size: 15px
}

.setting-row {
    display: flex;
    align-items: center;
    justify-content: space-between
}

.setting-row strong,
.setting-row small,
.setting-action strong,
.setting-action small {
    display: block
}

.setting-row small,
.setting-action small {
    color: var(--muted);
    font-weight: 400
}

.switch input {
    position: absolute;
    opacity: 0
}

.switch span {
    display: block;
    width: 48px;
    height: 28px;
    padding: 3px;
    border-radius: 99px;
    background: #bec7c2;
    transition: .2s
}

.switch span:after {
    content: "";
    display: block;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 4px #777;
    transition: .2s
}

.switch input:checked+span {
    background: var(--green)
}

.switch input:checked+span:after {
    transform: translateX(20px)
}

.setting-action {
    display: flex;
    align-items: center;
    gap: 11px;
    width: 100%;
    padding: 12px 0;
    border: 0;
    border-top: 1px solid var(--line);
    background: transparent;
    text-align: left;
    cursor: pointer
}

.setting-action-icon {
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: var(--green-soft);
    font-size: 20px
}

.setting-action span:nth-child(2) {
    flex: 1
}

.setting-action b {
    font-size: 21px;
    color: var(--muted)
}

.danger-zone p {
    margin: 9px 0 0;
    color: var(--muted);
    font-size: 12px;
    text-align: center
}

.offline-note {
    text-align: center;
    color: var(--muted);
    font-size: 12px
}

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

.settings-heading h2 {
    margin-bottom: 1px
}

.settings-heading small {
    color: var(--muted)
}

.category-row {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 9px 0;
    border-top: 1px solid var(--line)
}

.category-row strong {
    min-width: 0;
    flex: 1
}

.category-row small {
    color: var(--muted)
}

.category-row button {
    width: 34px;
    height: 34px;
    border: 0;
    border-radius: 9px;
    background: var(--cream);
    cursor: pointer
}

.bottom-nav {
    position: fixed;
    z-index: 30;
    bottom: 0;
    left: 0;
    right: 0;
    height: calc(var(--nav-height) + env(safe-area-inset-bottom));
    display: flex;
    justify-content: center;
    padding: 6px max(6px, env(safe-area-inset-left)) env(safe-area-inset-bottom);
    border-top: 1px solid var(--line);
    background: rgba(255, 255, 255, .96);
    backdrop-filter: blur(16px)
}

.bottom-nav button {
    position: relative;
    display: flex;
    min-width: 0;
    flex: 1;
    max-width: 150px;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1px;
    border: 0;
    border-radius: 12px;
    background: transparent;
    color: #7a8580
}

.bottom-nav button>span {
    display: grid;
    place-items: center;
    width: 28px;
    height: 28px;
    flex: 0 0 28px;
    line-height: 1
}

.bottom-nav button>span svg {
    display: block;
    width: 22px;
    height: 22px;
    overflow: visible;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round
}

.bottom-nav small {
    display: block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 10px;
    line-height: 13px;
    font-weight: 700
}

.bottom-nav button.active {
    color: var(--green);
    background: var(--green-soft)
}

.bottom-nav i {
    position: absolute;
    top: 4px;
    right: calc(50% - 20px);
    min-width: 17px;
    height: 17px;
    padding: 1px 4px;
    border: 2px solid #fff;
    border-radius: 99px;
    background: var(--danger);
    color: #fff;
    font: 700 9px/12px system-ui
}

dialog {
    width: min(620px, calc(100% - 22px));
    max-height: calc(100dvh - 30px);
    padding: 0;
    border: 0;
    border-radius: 22px;
    background: var(--card);
    color: var(--ink);
    box-shadow: 0 24px 80px rgba(0, 0, 0, .25)
}

dialog::backdrop {
    background: rgba(15, 30, 24, .5);
    backdrop-filter: blur(3px)
}

dialog form {
    padding: 19px;
    overflow: auto
}

.dialog-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 15px
}

.dialog-head h2 {
    margin-bottom: 0
}

.field {
    display: block;
    margin-bottom: 13px
}

.field>span {
    display: block;
    margin-bottom: 5px;
    font-size: 12px;
    font-weight: 750
}

.field input,
.field select,
.field textarea {
    width: 100%;
    min-height: 44px;
    padding: 10px 11px;
    border: 1px solid var(--line);
    border-radius: 11px;
    background: var(--cream);
    color: var(--ink)
}

.field textarea {
    resize: vertical
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 11px
}

.check-row {
    display: flex;
    align-items: center;
    gap: 9px;
    margin: 4px 0 18px
}

.check-row input {
    width: 20px;
    height: 20px;
    accent-color: var(--green)
}

.dialog-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 9px
}

.toast {
    position: fixed;
    z-index: 100;
    left: 50%;
    bottom: calc(var(--nav-height) + 20px);
    padding: 11px 16px;
    border-radius: 12px;
    background: #17362a;
    color: #fff;
    box-shadow: var(--shadow);
    opacity: 0;
    transform: translate(-50%, 15px);
    pointer-events: none;
    transition: .2s;
    white-space: nowrap
}

.toast.show {
    opacity: 1;
    transform: translate(-50%, 0)
}

body.dark {
    --cream: #101713;
    --card: #18221d;
    --ink: #eaf1ed;
    --muted: #9eaaa4;
    --line: #2c3932;
    --green: #66aa82;
    --green-dark: #376f51;
    --green-soft: #20382a;
    --shadow: 0 8px 30px rgba(0, 0, 0, .2);
    color-scheme: dark
}

.dark .app-header {
    background: rgba(16, 23, 19, .94)
}

.dark .quick-list-button {
    border-color: rgba(102, 170, 130, .24);
    background: var(--green-soft);
    box-shadow: 0 6px 16px rgba(0, 0, 0, .16)
}

.dark .quick-list-button:hover {
    background: #254230
}

.dark .quick-list-badge {
    border-color: var(--cream)
}

.dark .bottom-nav {
    background: rgba(24, 34, 29, .96)
}

.dark .need-toggle,
.dark .bought-toggle {
    background: var(--card)
}

.dark .need-toggle.checked,
.dark .bought-toggle.checked {
    background: var(--green-dark)
}

.dark .couldnt-get {
    background: #32211f;
    border-color: #67423e
}

.dark .sticky-toolbar,
.dark .floating-action-wrap {
    background: var(--cream)
}

@media(min-width:650px) {
    .app-header {
        padding-left: max(24px, calc((100vw - 760px)/2));
        padding-right: max(24px, calc((100vw - 760px)/2))
    }

    main {
        padding-left: 24px;
        padding-right: 24px
    }

    .form-grid {
        grid-template-columns: 1fr 1fr
    }

    .bottom-nav {
        left: 50%;
        right: auto;
        width: min(650px, 100%);
        transform: translateX(-50%);
        border: 1px solid var(--line);
        border-bottom: 0;
        border-radius: 20px 20px 0 0
    }
}

@media(max-width:390px) {
    .form-grid {
        grid-template-columns: 1fr
    }

    .item-row {
        gap: 8px
    }

    .quantity-stepper button {
        width: 28px
    }

    .couldnt-get {
        padding: 7px 5px;
        font-size: 11px
    }
}
