/* ---------- Bas ---------- */
:root {
    --bg: #121011;
    --surface: #1c1819;
    --surface-raised: #241f20;
    --border: #2c2627;
    --text: #f2edea;
    --text-muted: #9c9391;
    --accent: #f8072c;
    --accent-ink: #ffffff;
    --accent-text: #ffffff; /* text som annars vore i accentfärg: bara vit */
    --soon: #f5c542;    /* går ut snart */
    --expired: #ff5b4d; /* gick ut */
    --radius: 14px;
    --maxw: 560px;
    color-scheme: dark; /* mörka datumväljare och listrutor */
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--text);
    font-family: 'Inter', system-ui, sans-serif;
    -webkit-font-smoothing: antialiased;
    -webkit-tap-highlight-color: transparent;
}

.page {
    max-width: var(--maxw);
    margin: 0 auto;
    padding: calc(24px + env(safe-area-inset-top)) 20px calc(120px + env(safe-area-inset-bottom)); /* plats för knapparna */
    min-height: 100vh;
}

button { font: inherit; color: inherit; }
a { color: var(--accent-text); }

[hidden] { display: none !important; }

/* Kvar i DOM:en men osynlig (filväljaren i en <label> måste gå att öppna på iOS). */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- Sidhuvud ---------- */
.top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.title {
    margin: 0;
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: 30px;
    letter-spacing: -0.01em;
}

.subtitle { margin: 4px 0 0; color: var(--text-muted); font-size: 14px; }

.icon-btn,
.close-btn {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text-muted);
}

.icon-btn svg { width: 20px; height: 20px; }
.close-btn svg { width: 18px; height: 18px; }
.icon-btn:active, .close-btn:active { color: var(--text); background: var(--surface-raised); }

/* ---------- Verktygsrad ---------- */
.toolbar { margin-top: 22px; }

.search { padding-top: 12px; padding-bottom: 12px; }


/* ---------- Listor ---------- */
.group { margin-top: 26px; }

.group-title {
    margin: 0 0 10px;
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 500;
    font-size: 13px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.group-title .count { margin-left: 4px; opacity: 0.6; }

.item-list,
.expiring-list,
.barcode-list,
.option-list,
.pick-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.item {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 64px;
    padding: 8px 8px 8px 16px;
    border-radius: var(--radius);
    background: var(--surface);
    border: 1px solid var(--border);
    transition: opacity 0.15s ease;
}

.item-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 6px 0;
    color: var(--text);
    text-decoration: none;
}

.item-name {
    font-size: 16px;
    font-weight: 500;
    overflow-wrap: anywhere;
}

.item-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 10px;
    font-size: 13px;
    color: var(--text-muted);
}

.item.is-out .item-name { color: var(--text-muted); }
.item.is-out .item-qty { color: var(--expired); }
.item.is-saving { opacity: 0.75; }

.expiry-ok { color: var(--text-muted); }
.expiry-soon { color: var(--soon); }
.expiry-expired { color: var(--expired); }

.stepper {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 2px;
}

.item-qty {
    min-width: 64px;
    text-align: center;
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: 15px;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.is-bumped { animation: bump 0.25s ease; }
@keyframes bump { 50% { transform: scale(1.18); color: var(--accent-text); } }

.step-btn {
    appearance: none;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: var(--surface-raised);
    color: var(--text);
    cursor: pointer;
    touch-action: manipulation; /* inget dubbeltryckszoom vid snabba tryck */
}

.step-btn svg { width: 18px; height: 18px; }
.step-btn:active { background: var(--border); }
.step-btn:disabled { opacity: 0.3; cursor: default; }

.expiring-list a {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 16px;
    border-radius: var(--radius);
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text);
    text-decoration: none;
    font-size: 15px;
}

.expiring-list .expiry { font-size: 13px; white-space: nowrap; }

.empty {
    margin: 36px 0 0;
    padding: 28px 20px;
    text-align: center;
    border-radius: var(--radius);
    border: 1px dashed var(--border);
    color: var(--text-muted);
    font-size: 15px;
}

/* ---------- Knappar längst ner ---------- */
.action-bar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10;
    display: grid;
    grid-template-columns: 1fr 1.4fr;
    gap: 10px;
    max-width: var(--maxw);
    margin: 0 auto;
    padding: 24px 20px calc(16px + env(safe-area-inset-bottom));
    background: linear-gradient(to bottom, rgba(18, 16, 17, 0), var(--bg) 40%);
}

.action-btn {
    appearance: none;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 56px;
    padding: 0 16px;
    border-radius: 16px;
    border: 1px solid var(--border);
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: 16px;
    text-decoration: none;
    cursor: pointer;
    transition: transform 0.12s ease;
}

.action-btn svg { width: 22px; height: 22px; flex-shrink: 0; }
.action-btn:active { transform: scale(0.97); }
.action-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.action-secondary { background: var(--surface-raised); color: var(--text); }

.toast {
    position: fixed;
    left: 50%;
    bottom: calc(100px + env(safe-area-inset-bottom));
    z-index: 40;
    transform: translateX(-50%);
    width: max-content;
    max-width: calc(100% - 40px);
    margin: 0;
    padding: 12px 18px;
    border-radius: 999px;
    background: var(--surface-raised);
    border: 1px solid var(--border);
    color: var(--text);
    font-size: 14px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

/* ---------- Formulär ---------- */
.page-form { padding-bottom: calc(24px + env(safe-area-inset-bottom)); }

.form-top {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 26px;
}

.form-title {
    margin: 0;
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: 24px;
}

/* "Lägg till i matlistan" på varusidan, och "På matlistan" när den redan står där. */
.grocery-bar { margin: -8px 0 26px; }
.grocery-add-form { margin: 0; }

.grocery-btn {
    appearance: none;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    height: 50px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--surface-raised);
    color: var(--text);
    font: inherit;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
}

.grocery-btn svg { width: 20px; height: 20px; }
.grocery-btn:active { border-color: var(--text-muted); }
.grocery-btn:disabled { opacity: 0.6; cursor: default; }
.grocery-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.grocery-on {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 50px;
    margin: 0;
    padding: 0 16px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--surface);
    font-size: 15px;
}

.grocery-on svg { flex-shrink: 0; width: 18px; height: 18px; }
.grocery-on .grocery-on-amount { color: var(--text-muted); }
.grocery-on a { margin-left: auto; color: var(--text-muted); font-size: 14px; }

.field { margin-bottom: 24px; min-width: 0; }

.field-label {
    display: block;
    margin: 0 0 10px;
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 500;
    font-size: 13px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.field-hint { margin: 8px 2px 0; font-size: 13px; color: var(--text-muted); line-height: 1.45; }


.text-input {
    width: 100%;
    min-width: 0;
    padding: 15px 16px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    font: inherit;
    font-size: 17px; /* 16px+ hindrar iOS från att zooma in */
    font-weight: 500;
}

.text-input:focus { outline: none; border-color: var(--accent); }
textarea.text-input { resize: vertical; min-height: 56px; }
select.text-input { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--text-muted) 50%), linear-gradient(135deg, var(--text-muted) 50%, transparent 50%); background-position: calc(100% - 20px) 50%, calc(100% - 15px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 34px; }
input[type="date"].text-input { min-height: 56px; }

.amount-row { display: grid; grid-template-columns: 1fr 110px; gap: 10px; }

.suffix-input { position: relative; }
.suffix-input .text-input { padding-right: 60px; }
.suffix {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
}

.date-row { display: flex; gap: 10px; align-items: center; }
.date-row .text-input { flex: 1; }

.chip-btn {
    appearance: none;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    height: 44px;
    padding: 0 16px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--surface-raised);
    color: var(--text);
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
}

.barcode-list { margin-bottom: 10px; }

.barcode-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 12px;
    padding: 12px 16px;
    border-radius: var(--radius);
    background: var(--surface);
    border: 1px solid var(--border);
    cursor: pointer;
}

.barcode-row input { position: absolute; opacity: 0; pointer-events: none; }
.barcode-code { font-variant-numeric: tabular-nums; font-weight: 500; letter-spacing: 0.02em; }
.barcode-name { flex-basis: 100%; order: 3; font-size: 13px; color: var(--text-muted); }
.barcode-remove { margin-left: auto; font-size: 13px; color: var(--text-muted); }
.barcode-row:has(input:checked) { border-color: var(--expired); }
.barcode-row:has(input:checked) .barcode-code { text-decoration: line-through; color: var(--text-muted); }
.barcode-row:has(input:checked) .barcode-remove { color: var(--expired); }
.barcode-row:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }

.form-actions {
    position: sticky;
    bottom: 0;
    margin: 0 -20px;
    padding: 24px 20px calc(16px + env(safe-area-inset-bottom));
    background: linear-gradient(to bottom, rgba(18, 16, 17, 0), var(--bg) 40%);
}

.form-error {
    margin: 0 0 10px;
    padding: 10px 14px;
    border-radius: 12px;
    background: rgba(255, 91, 77, 0.12);
    border: 1px solid var(--expired);
    color: var(--text);
    font-size: 14px;
}

.submit-btn {
    appearance: none;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 56px;
    border: 0;
    border-radius: 16px;
    background: var(--accent);
    color: var(--accent-ink);
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: 17px;
    text-decoration: none;
    cursor: pointer;
    transition: transform 0.12s ease;
}

.submit-btn:active { transform: scale(0.985); }
.submit-small { height: 48px; font-size: 15px; margin-top: 12px; }

.ghost-btn {
    appearance: none;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 50px;
    border-radius: 16px;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text);
    font-size: 15px;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
}

.delete-form { margin-top: 8px; text-align: center; }

.delete-btn {
    appearance: none;
    padding: 12px 18px;
    border: 0;
    background: none;
    color: var(--expired);
    font-size: 15px;
    cursor: pointer;
}

/* Platser */
.list-form { margin-bottom: 36px; }
.option-row { display: flex; align-items: center; gap: 10px; }
.option-row .text-input { padding-top: 12px; padding-bottom: 12px; }
.option-remove { flex-shrink: 0; display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-muted); }
.option-remove input { width: 18px; height: 18px; accent-color: var(--expired); }
.option-row:has(.option-remove input:checked) .text-input { text-decoration: line-through; color: var(--text-muted); }

/* ---------- Skanning ---------- */
.page-scan { padding: 0; max-width: none; }

.scanner {
    position: fixed;
    inset: 0;
    overflow: hidden;
    background: #000;
}

.scan-video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Siktet: bara visuellt, hela bilden avkodas. */
.scan-frame {
    position: absolute;
    left: 50%;
    top: 44%;
    width: min(78vw, 360px);
    height: min(42vw, 190px);
    transform: translate(-50%, -50%);
    border-radius: 18px;
    box-shadow: 0 0 0 100vmax rgba(0, 0, 0, 0.45);
    border: 2px solid rgba(255, 255, 255, 0.85);
    transition: border-color 0.15s ease;
}

.scan-line {
    position: absolute;
    left: 8%;
    right: 8%;
    top: 50%;
    height: 2px;
    border-radius: 2px;
    background: var(--accent);
    box-shadow: 0 0 12px var(--accent);
    animation: sweep 1.8s ease-in-out infinite alternate;
}

@keyframes sweep { from { transform: translateY(-60px); } to { transform: translateY(60px); } }

.scan-frame.is-hit { border-color: var(--accent); }
.scan-frame.is-hit .scan-line { animation: none; opacity: 0; }

.scan-top {
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    display: flex;
    justify-content: space-between;
    padding: calc(16px + env(safe-area-inset-top)) 16px 16px;
}

.scan-top .close-btn,
.tool-btn {
    background: rgba(18, 16, 17, 0.7);
    border-color: rgba(255, 255, 255, 0.12);
    color: var(--text);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

.scan-tools { display: flex; gap: 8px; }

.tool-btn {
    appearance: none;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    height: 44px;
    padding: 0 10px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: 15px;
    cursor: pointer;
}

.tool-btn svg { width: 20px; height: 20px; }
.tool-btn[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }

.scan-status {
    position: absolute;
    left: 20px;
    right: 20px;
    top: calc(44% + min(21vw, 95px) + 22px);
    margin: 0;
    text-align: center;
    font-size: 15px;
    line-height: 1.45;
    color: var(--text);
    text-shadow: 0 1px 6px rgba(0, 0, 0, 0.8);
}

.scan-status.is-error {
    padding: 12px 16px;
    border-radius: var(--radius);
    background: rgba(18, 16, 17, 0.88);
    border: 1px solid var(--expired);
    text-shadow: none;
}

.scan-bottom {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    max-width: var(--maxw);
    margin: 0 auto;
    padding: 16px 20px calc(20px + env(safe-area-inset-bottom));
}

.scan-bottom .action-secondary {
    background: rgba(18, 16, 17, 0.75);
    border-color: rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

.sheet-backdrop {
    position: fixed;
    inset: 0;
    z-index: 20;
    background: rgba(8, 6, 7, 0.45);
}

.sheet {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 30;
    max-width: var(--maxw);
    max-height: 85vh;
    overflow-y: auto;
    margin: 0 auto;
    padding: 22px 20px calc(20px + env(safe-area-inset-bottom));
    border-radius: 22px 22px 0 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-bottom: 0;
    box-shadow: 0 -16px 50px rgba(0, 0, 0, 0.5);
    animation: sheet-in 0.2s ease-out;
}

@keyframes sheet-in { from { transform: translateY(30px); opacity: 0; } }

.sheet-kicker {
    margin: 0 0 4px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--accent-text);
}

.sheet-title {
    display: block;
    margin: 0 0 6px;
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: 22px;
    overflow-wrap: anywhere;
}

.sheet-code { margin: 0 0 14px; color: var(--text-muted); font-size: 14px; font-variant-numeric: tabular-nums; }
.sheet-text { margin: 0 0 14px; color: var(--text-muted); font-size: 14px; line-height: 1.45; }

.sheet-qty {
    display: inline-block;
    margin: 4px 0 18px;
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: 30px;
}

.sheet-steppers { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }

.big-step {
    appearance: none;
    min-height: 64px;
    padding: 8px 10px;
    border-radius: 16px;
    border: 1px solid var(--border);
    background: var(--surface-raised);
    color: var(--text);
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: 16px;
    cursor: pointer;
    touch-action: manipulation;
}

.big-step-plus { border-color: var(--accent); color: var(--accent-text); }
.big-step:active { transform: scale(0.97); }
.big-step:disabled { opacity: 0.6; }

.sheet-actions { display: flex; flex-direction: column; gap: 10px; margin-top: 4px; }
.manual-form .text-input { margin: 6px 0 14px; letter-spacing: 0.04em; }

#pick-search { margin-bottom: 10px; }
.pick-list { max-height: 40vh; overflow-y: auto; margin-bottom: 14px; gap: 6px; }

.pick-list button {
    appearance: none;
    width: 100%;
    padding: 14px 16px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--surface-raised);
    color: var(--text);
    text-align: left;
    font-size: 16px;
    cursor: pointer;
}

.page-scan .toast { bottom: calc(96px + env(safe-area-inset-bottom)); }

/* ---------- Flyttläge (startsidan) ---------- */
.icon-btn[aria-pressed="true"] { color: var(--accent-ink); background: var(--accent); border-color: var(--accent); }

.move-banner {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 12px;
    padding: 10px 10px 10px 16px;
    border-radius: var(--radius);
    border: 1px solid var(--accent);
    background: color-mix(in srgb, var(--accent) 12%, var(--surface));
    font-size: 14px;
    line-height: 1.35;
}

.move-banner span { flex: 1; }
.move-banner .chip-btn { height: 38px; }

/* Raderna blir "flyttbara": streckad ram, och +/− tonas ned så man inte råkar ändra mängden. */
.is-moving .item { border-style: dashed; border-color: color-mix(in srgb, var(--accent) 55%, var(--border)); }
.is-moving .item .stepper { opacity: 0.3; pointer-events: none; }
.is-moving .item-main { cursor: pointer; }

.move-list button {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.move-list button.is-current { border-color: var(--accent); }
.move-list button svg { flex-shrink: 0; width: 18px; height: 18px; }
.move-list button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.item.is-moved { animation: moved 0.9s ease; }
@keyframes moved { 0% { background: color-mix(in srgb, var(--accent) 22%, var(--surface)); } }

/* ---------- Matlistan ---------- */
.top-actions { display: flex; gap: 8px; }
.icon-btn { position: relative; }

.badge {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 20px;
    height: 20px;
    padding: 0 5px;
    border-radius: 999px;
    background: var(--accent);
    color: var(--accent-ink);
    font-size: 11px;
    font-weight: 600;
    line-height: 20px;
    text-align: center;
}

.page-groceries { padding-bottom: calc(40px + env(safe-area-inset-bottom)); }

.notice {
    margin: 0 0 18px;
    padding: 10px 14px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-muted);
    font-size: 14px;
}

.autocomplete { position: relative; }

.suggestions {
    position: absolute;
    left: 0;
    right: 0;
    top: calc(100% + 6px);
    z-index: 20;
    list-style: none;
    margin: 0;
    padding: 6px;
    border-radius: var(--radius);
    background: var(--surface-raised);
    border: 1px solid var(--border);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.55);
}

.suggestions button {
    appearance: none;
    display: flex;
    justify-content: space-between;
    gap: 12px;
    width: 100%;
    padding: 12px;
    border: 0;
    border-radius: 10px;
    background: none;
    color: var(--text);
    text-align: left;
    font-size: 16px;
    cursor: pointer;
}

.suggestions button span { color: var(--text-muted); font-size: 13px; }
.suggestions button:active { background: var(--border); }

.grocery-add-row {
    display: grid;
    grid-template-columns: 1fr 90px auto;
    gap: 10px;
    margin-top: 10px;
}

.grocery-add-row .text-input { padding-top: 12px; padding-bottom: 12px; }
.grocery-add-row .chip-btn { height: auto; border-radius: var(--radius); }

.chip-accent { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.chip-btn:disabled { opacity: 0.4; cursor: default; }

.text-link {
    display: block;
    margin: 16px 2px 0;
    color: var(--text-muted);
    font-size: 14px;
    text-decoration: none;
}

.grocery { padding: 6px 6px 6px 14px; }

.grocery-main {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 8px 0;
    cursor: pointer;
}

.grocery-check {
    appearance: none;
    flex-shrink: 0;
    display: grid;
    place-content: center;
    width: 26px;
    height: 26px;
    margin: 0;
    border-radius: 50%;
    border: 2px solid var(--text-muted);
    background: transparent;
    cursor: pointer;
}

.grocery-check::after {
    content: '';
    width: 10px;
    height: 6px;
    margin-top: -3px;
    border-left: 2px solid var(--accent-ink);
    border-bottom: 2px solid var(--accent-ink);
    transform: rotate(-45deg);
    opacity: 0;
}

.grocery-check:checked { background: var(--accent); border-color: var(--accent); }
.grocery-check:checked::after { opacity: 1; }

.grocery-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }

.grocery { flex-wrap: wrap; }

.grocery-amount {
    appearance: none;
    flex-shrink: 0;
    min-height: 36px;
    padding: 0 12px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface-raised);
    color: var(--text);
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: 15px;
    white-space: nowrap;
    cursor: pointer;
    touch-action: manipulation;
}

.grocery-amount.is-empty { color: var(--text-muted); font-weight: 500; font-size: 13px; }
.grocery-amount[aria-expanded="true"] { border-color: var(--accent); }

.amount-editor {
    flex-basis: 100%;
    display: grid;
    grid-template-columns: 40px 1fr 40px 76px auto;
    align-items: center;
    gap: 8px;
    margin: 4px 0 6px;
}

.amount-editor .text-input { padding: 10px 12px; text-align: center; }
.amount-editor select.text-input { padding-right: 28px; text-align: left; }
.amount-editor .chip-btn { height: 44px; }

.grocery.is-checked .item-name,
.grocery.is-checked .grocery-amount { text-decoration: line-through; color: var(--text-muted); }
.grocery.is-checked { opacity: 0.7; }

.grocery-remove {
    appearance: none;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: none;
    color: var(--text-muted);
    cursor: pointer;
}

.grocery-remove svg { width: 18px; height: 18px; }
.grocery-remove:active { background: var(--surface-raised); }

.grocery-low .group-title { color: var(--soon); }

.grocery-actions { display: flex; justify-content: center; gap: 10px; margin-top: 28px; }
.grocery-actions form { margin: 0; }
.grocery-hint { margin: 10px 0 0; text-align: center; font-size: 13px; color: var(--text-muted); }

@media (hover: hover) {
    .item-main:hover .item-name { text-decoration: underline; text-decoration-color: var(--text-muted); }
    .step-btn:hover:not(:disabled) { background: var(--border); }
    .icon-btn:hover, .close-btn:hover { color: var(--text); }
    .pick-list button:hover, .ghost-btn:hover, .chip-btn:hover { border-color: var(--text-muted); }
}

@media (max-width: 380px) {
    .item { padding-left: 12px; }
    .item-qty { min-width: 52px; font-size: 14px; }
    .step-btn { width: 36px; height: 36px; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; }
}
