/* ── Auth screen ── */
.pin-screen {
    position: fixed;
    inset: 0;
    background: var(--bg);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.pin-box {
    background: var(--surface);
    border-radius: 20px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    padding: 2.5rem 2rem;
    text-align: center;
    width: 100%;
    max-width: 320px;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    align-items: center;
}

.pin-icon {
    font-size: 2.5rem;
}

.pin-box h2 {
    font-size: 1.5rem;
    color: var(--primary);
}

.pin-box p {
    color: var(--text-light);
    font-size: 0.9rem;
}

.btn-google {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.85rem 1.5rem;
    background: var(--surface);
    color: var(--text);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    width: 100%;
    justify-content: center;
}

.btn-google:hover {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(8, 145, 178, 0.15);
}

.btn-clear-cache {
    background: none;
    border: none;
    color: var(--text-light);
    font-size: 0.78rem;
    cursor: pointer;
    text-decoration: underline;
    padding: 0;
    margin-top: -0.25rem;
}

.btn-clear-cache:hover {
    color: var(--primary);
}

.invite-input {
    width: 100%;
    padding: 0.65rem 0.9rem;
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 1rem;
    background: var(--bg);
    color: var(--text);
    text-align: center;
    letter-spacing: 0.05em;
    outline: none;
    box-sizing: border-box;
}

.invite-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(8, 145, 178, 0.15);
}

.pin-error {
    color: var(--danger);
    font-size: 0.85rem;
    min-height: 1rem;
}

/* ── Sign out button in header ── */

.btn-lock {
    background: none;
    border: 1px solid var(--border);
    border-radius: 50%;
    width: 36px;
    height: 36px;
    font-size: 1.1rem;
    cursor: pointer;
    opacity: 0.5;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-lock:hover {
    opacity: 1;
    background: var(--border);
}

/* ── Install PWA button ── */
.btn-install {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    background: var(--primary);
    color: white;
    border: none;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    padding: 0.35rem 0.7rem;
    border-radius: 8px;
    transition: var(--transition);
    animation: pulse 2s ease-in-out 3;
    flex-shrink: 0;
}

.btn-install:hover {
    background: var(--primary-dk);
    transform: scale(1.05);
}

@keyframes pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(8, 145, 178, 0.4); }
    50% { box-shadow: 0 0 0 8px rgba(8, 145, 178, 0); }
}

/* ── Reset ── */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* ── Variables ── */
:root {
    --primary:    #0891b2;
    --primary-dk: #0e7490;
    --success:    #10b981;
    --danger:     #ef4444;
    --bg:         #f0fdfa;
    --surface:    #ffffff;
    --text:       #1f2937;
    --text-light: #6b7280;
    --border:     #e5e7eb;
    --radius:     12px;
    --shadow:     0 2px 8px rgba(0,0,0,0.08);
    --transition: all 0.2s ease;
    --danger-bg:  #fee2e2;
}

/* ── Dark theme ── */
[data-theme="dark"] {
    --bg:         #0f172a;
    --surface:    #1e293b;
    --text:       #f1f5f9;
    --text-light: #94a3b8;
    --border:     #334155;
    --shadow:     0 2px 8px rgba(0,0,0,0.3);
    --primary:    #22d3ee;
    --primary-dk: #06b6d4;
    --success:    #34d399;
    --danger:     #f87171;
    --danger-bg:  rgba(248, 113, 113, 0.15);
}

/* ── Body ── */
body {
    font-family: 'Segoe UI', system-ui, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 2rem 1rem;
}

/* ── App container ── */
.app {
    width: 100%;
    max-width: 1200px;
}

/* ── Header ── */
.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    gap: 0.5rem;
}

.header-title {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.1rem;
}

.app-header h1 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary);
    text-align: center;
}

.list-label {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-secondary);
    letter-spacing: 0.03em;
    opacity: 0.8;
}

.list-switcher-btn {
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.2rem;
    font-size: 0.72rem;
    color: var(--text-secondary);
}

.header-title {
    position: relative;
}

.list-switcher-menu {
    position: absolute;
    top: 100%;
    left: 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: var(--shadow);
    z-index: 100;
    min-width: 160px;
    overflow: hidden;
}

.list-switcher-item {
    display: block;
    width: 100%;
    padding: 0.65rem 1rem;
    background: none;
    border: none;
    text-align: left;
    font-size: 0.9rem;
    color: var(--text);
    cursor: pointer;
}

.list-switcher-item:hover {
    background: var(--bg);
}

.list-switcher-item.active {
    color: var(--primary);
    font-weight: 600;
}

.header-actions {
    display: flex;
    gap: 0.4rem;
    align-items: center;
}

/* ── Theme toggle ── */
.btn-theme {
    background: none;
    border: 1px solid var(--border);
    border-radius: 50%;
    width: 36px;
    height: 36px;
    font-size: 1.1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.btn-theme:hover {
    border-color: var(--primary);
    background: rgba(8, 145, 178, 0.08);
}

.btn-invite {
    background: none;
    border: 1px solid var(--border);
    border-radius: 50%;
    width: 36px;
    height: 36px;
    font-size: 1.1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.btn-invite:hover {
    border-color: var(--primary);
    background: rgba(8, 145, 178, 0.08);
}

/* ── Invite modal ── */
.invite-modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.invite-modal-box {
    background: var(--surface);
    border-radius: 16px;
    padding: 1.75rem 1.5rem;
    width: 100%;
    max-width: 320px;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    text-align: center;
    box-shadow: var(--shadow);
}

.invite-modal-box h3 {
    font-size: 1.1rem;
    color: var(--primary);
    margin: 0;
}

.invite-modal-box p {
    font-size: 0.85rem;
    color: var(--text-light);
    margin: 0;
}

.invite-modal-code {
    font-size: 1.8rem;
    font-weight: 700;
    letter-spacing: 0.15em;
    color: var(--text);
    background: var(--bg);
    border: 2px dashed var(--border);
    border-radius: 10px;
    padding: 0.75rem;
}

.invite-modal-actions {
    display: flex;
    gap: 0.75rem;
}

.invite-modal-actions button {
    flex: 1;
}

.btn-whatsapp {
    background: #25D366 !important;
    border-color: #25D366 !important;
    color: #fff !important;
}

.btn-whatsapp:hover {
    background: #1ebe5d !important;
}

/* ── Add form ── */
.add-form {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    max-width: 600px;
}

.add-form input {
    flex: 1;
    min-width: 140px;
    padding: 0.8rem 1rem;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    font-size: 1rem;
    outline: none;
    transition: var(--transition);
    background: var(--surface);
}

.add-form input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(8, 145, 178, 0.15);
}

.add-form select {
    padding: 0.8rem 0.75rem;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.9rem;
    outline: none;
    background: var(--surface);
    cursor: pointer;
    transition: var(--transition);
    color: var(--text);
}

.add-form select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(8, 145, 178, 0.15);
}

.add-form button {
    padding: 0.8rem 1.4rem;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}

.add-form button:hover {
    background: var(--primary-dk);
    transform: translateY(-1px);
}

/* ── Category groups ── */
.category-group {
    margin-bottom: 1.5rem;
}

.category-heading {
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--primary);
    margin-bottom: 0.5rem;
    padding: 0.25rem 0.5rem;
    border-left: 3px solid var(--primary);
    background: rgba(8, 145, 178, 0.05);
    border-radius: 0 6px 6px 0;
    cursor: pointer;
    user-select: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: var(--transition);
}

.category-heading:hover {
    background: rgba(8, 145, 178, 0.1);
}

.category-heading::after {
    content: "▾";
    font-size: 0.7rem;
    transition: transform 0.2s ease;
}

.category-group.collapsed .category-heading::after {
    transform: rotate(-90deg);
}

.category-group.collapsed .category-items {
    display: none;
}

.category-items {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    overflow: hidden;
}

/* ── Auto-category hint ── */
.auto-cat-hint {
    width: 100%;
    font-size: 0.75rem;
    color: var(--primary);
    opacity: 0.8;
    min-height: 1.1em;
    transition: var(--transition);
}

/* ── Controls bar ── */
.list-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    align-items: center;
    margin-bottom: 0.75rem;
    min-height: 28px;
    justify-content: flex-start;
}

.item-count {
    font-size: 0.875rem;
    color: var(--text-light);
}

/* ── Shopping list ── */
.shopping-list {
    list-style: none;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
}

/* ── Empty state ── */
.empty-state {
    text-align: center;
    color: var(--text-light);
    padding: 2rem;
    font-size: 0.95rem;
    grid-column: 1 / -1;
}

/* ── Swipe container ── */
.swipe-container {
    position: relative;
    border-radius: var(--radius);
    overflow: hidden;
}

.swipe-bg {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 100%;
    display: flex;
    align-items: center;
    font-size: 0.85rem;
    font-weight: 700;
    color: white;
    opacity: 0;
    transition: opacity 0.15s ease;
    pointer-events: none;
    padding: 0 1.2rem;
    letter-spacing: 0.02em;
}

.swipe-bg-left {
    background: linear-gradient(90deg, #dc2626 0%, #ef4444 100%);
    justify-content: flex-end;
}

.swipe-bg-right {
    background: linear-gradient(90deg, #059669 0%, #10b981 100%);
    justify-content: flex-start;
}

.swipe-bg.ready {
    font-size: 0.95rem;
}

[data-theme="dark"] .swipe-bg-left {
    background: linear-gradient(90deg, #991b1b 0%, #dc2626 100%);
}

[data-theme="dark"] .swipe-bg-right {
    background: linear-gradient(90deg, #065f46 0%, #059669 100%);
}

/* ── List item ── */
.list-item {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: var(--surface);
    padding: 0.9rem 1rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    transition: var(--transition);
    animation: slideIn 0.2s ease;
}

.list-item:hover {
    box-shadow: 0 4px 16px rgba(0,0,0,0.1);
}

@keyframes slideIn {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── Checkbox ── */
.list-item input[type="checkbox"] {
    width: 20px;
    height: 20px;
    accent-color: var(--success);
    cursor: pointer;
    flex-shrink: 0;
}

/* ── Item label ── */
.item-label {
    flex: 1;
    font-size: 1rem;
    cursor: pointer;
    transition: var(--transition);
    word-break: break-word;
}

.list-item.checked .item-label {
    text-decoration: line-through;
    color: var(--text-light);
}

.list-item.checked {
    opacity: 0.6;
}

/* ── Text wrapper (label + date) ── */
.item-text-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    min-width: 0;
}

.item-text-wrapper .item-label {
    flex: initial;
}

.item-checked-date {
    font-size: 0.7rem;
    color: var(--success);
    opacity: 0.8;
}

/* ── Item note ── */
.item-note-row {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    min-height: 1.2rem;
}

.btn-note {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.75rem;
    padding: 0;
    line-height: 1;
    opacity: 0.35;
    transition: opacity 0.2s;
    flex-shrink: 0;
}

.list-item:hover .btn-note,
.btn-note:focus {
    opacity: 0.7;
}

.btn-note.has-note {
    opacity: 0.8;
}

.item-note-text {
    font-size: 0.78rem;
    color: var(--text-light);
    font-style: italic;
    line-height: 1.2;
    word-break: break-word;
}

.item-note-input {
    flex: 1;
    font-size: 0.78rem;
    padding: 0.25rem 0.4rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    outline: none;
    background: var(--surface);
    color: var(--text);
    font-style: italic;
    min-width: 0;
}

.item-note-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(8, 145, 178, 0.12);
}

/* ── Edit name inline ── */
.edit-name-input {
    flex: 1;
    font-size: 1rem;
    padding: 0.2rem 0.4rem;
    border: 2px solid var(--primary);
    border-radius: 6px;
    outline: none;
    background: var(--surface);
    color: var(--text);
    min-width: 0;
    width: 100%;
}

/* ── Delete button ── */
.btn-delete {
    background: none;
    border: none;
    color: var(--text-light);
    font-size: 1.1rem;
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 6px;
    line-height: 1;
    transition: var(--transition);
    flex-shrink: 0;
}

.btn-delete:hover {
    color: var(--danger);
    background: var(--danger-bg);
}

/* ── Sync indicator ── */
.sync-dot {
    position: fixed;
    bottom: 1rem;
    right: 1rem;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--success);
    box-shadow: 0 0 6px var(--success);
}

.sync-dot.offline {
    background: var(--danger);
    box-shadow: 0 0 6px var(--danger);
}

/* ── Filter button ── */
.btn-filter {
    font-size: 0.8rem;
    color: var(--text-light);
    background: none;
    border: 1px solid var(--border);
    cursor: pointer;
    font-weight: 600;
    padding: 0.25rem 0.6rem;
    border-radius: 6px;
    transition: var(--transition);
}

.btn-filter:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.btn-filter.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* ── Frequent products button ── */
.btn-frequent {
    font-size: 0.8rem;
    color: #d97706;
    background: none;
    border: 1px solid #d97706;
    cursor: pointer;
    font-weight: 600;
    padding: 0.25rem 0.6rem;
    border-radius: 6px;
    transition: var(--transition);
}

.btn-frequent:hover {
    background: #d97706;
    color: white;
}

.btn-frequent.active {
    background: #d97706;
    color: white;
}

/* ── Frequent panel ── */
.frequent-panel {
    margin-bottom: 1rem;
    padding: 0.75rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    animation: slideIn 0.2s ease;
}

.frequent-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.frequent-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.35rem 0.65rem;
    font-size: 0.82rem;
    border: 1px solid var(--border);
    border-radius: 20px;
    background: var(--bg);
    color: var(--text);
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.frequent-chip:hover {
    border-color: var(--primary);
    background: rgba(8, 145, 178, 0.08);
    transform: translateY(-1px);
}

.frequent-chip:disabled {
    opacity: 0.4;
    cursor: default;
    transform: none;
}

.frequent-chip.just-added {
    background: rgba(22, 163, 74, 0.15);
    border-color: var(--success);
}

.frequent-chip-all {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    font-weight: 700;
}

.frequent-chip-all:hover {
    background: var(--primary-dk);
    border-color: var(--primary-dk);
}

.frequent-count {
    font-size: 0.7rem;
    color: var(--text-light);
    font-weight: 600;
}

.frequent-detail {
    font-size: 0.68rem;
    color: var(--text-light);
    font-weight: 400;
    opacity: 0.8;
}

.frequent-panel-title {
    width: 100%;
    font-size: 0.82rem;
    color: var(--text-light);
    margin-bottom: 0.3rem;
    font-style: italic;
}

.frequent-empty {
    font-size: 0.85rem;
    color: var(--text-light);
    font-style: italic;
    padding: 0.5rem 0;
}

/* ── Scan ticket button ── */
.btn-scan {
    font-size: 0.8rem;
    color: var(--primary);
    background: none;
    border: 1px solid var(--primary);
    cursor: pointer;
    font-weight: 600;
    padding: 0.25rem 0.6rem;
    border-radius: 6px;
    transition: var(--transition);
}

.btn-scan:hover {
    background: var(--primary);
    color: white;
}

/* ── Scan modal ── */
.scan-modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    padding: 1rem;
}

.scan-box {
    background: var(--surface);
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.2);
    width: 100%;
    max-width: 420px;
    max-height: 90vh;
    overflow-y: auto;
}

.scan-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
}

.scan-header h3 {
    font-size: 1.1rem;
    color: var(--primary);
}

.scan-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-light);
    line-height: 1;
}

.scan-body {
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.scan-upload-options {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.scan-upload-label {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 1.5rem;
    border: 2px dashed var(--primary);
    border-radius: var(--radius);
    cursor: pointer;
    font-weight: 600;
    color: var(--primary);
    transition: var(--transition);
    text-align: center;
    background: rgba(8, 145, 178, 0.03);
    font-size: 1rem;
}

.scan-upload-label:hover {
    border-color: var(--primary-dk);
    background: rgba(8, 145, 178, 0.08);
}

.scan-upload-gallery {
    padding: 1rem;
    border-style: solid;
    border-width: 1px;
    border-color: var(--border);
    color: var(--text-light);
    font-size: 0.9rem;
    background: none;
}

.scan-upload-gallery:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: rgba(8, 145, 178, 0.05);
}

.btn-scan-retry {
    background: none;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.5rem 0.75rem;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-light);
    cursor: pointer;
    transition: var(--transition);
    align-self: center;
}

.btn-scan-retry:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.scan-preview {
    width: 100%;
    max-height: 200px;
    object-fit: contain;
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

.scan-progress {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    align-items: center;
}

.scan-progress-bar {
    width: 100%;
    height: 6px;
    background: var(--border);
    border-radius: 3px;
    overflow: hidden;
    position: relative;
}

.scan-progress-bar::after {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: var(--progress, 0%);
    background: var(--primary);
    border-radius: 3px;
    transition: width 0.3s ease;
}

.scan-progress span {
    font-size: 0.8rem;
    color: var(--text-light);
}

.scan-results-title {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text);
}

.scan-results-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    max-height: 250px;
    overflow-y: auto;
}

.scan-result-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.6rem;
    background: var(--bg);
    border-radius: 8px;
    font-size: 0.9rem;
}

.scan-result-item input[type="checkbox"] {
    accent-color: var(--primary);
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.scan-result-item .scan-item-name {
    flex: 1;
    word-break: break-word;
}

.scan-result-item .scan-item-name-input {
    flex: 1;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.35rem 0.5rem;
    font-size: 0.85rem;
    outline: none;
    background: var(--surface);
    color: var(--text);
    transition: var(--transition);
    min-width: 0;
}

.scan-result-item .scan-item-name-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(8, 145, 178, 0.15);
}

.scan-result-item .scan-item-remove {
    background: none;
    border: none;
    color: var(--text-light);
    cursor: pointer;
    font-size: 1rem;
    padding: 0 0.25rem;
}

.scan-result-item .scan-item-remove:hover {
    color: var(--danger);
}

.scan-results-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.btn-scan-add {
    flex: 1;
    padding: 0.7rem;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.btn-scan-add:hover {
    background: var(--primary-dk);
}

.btn-scan-cancel {
    padding: 0.7rem 1rem;
    background: none;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    color: var(--text-light);
    transition: var(--transition);
}

.btn-scan-cancel:hover {
    border-color: var(--danger);
    color: var(--danger);
}

/* ── Suggestions dropdown ── */
.input-wrapper {
    position: relative;
    flex: 1;
    min-width: 140px;
}

.input-wrapper input {
    width: 100%;
}

.suggestions-list {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 100;
    list-style: none;
    margin: 0;
    padding: 0;
    background: var(--surface);
    border: 2px solid var(--primary);
    border-top: none;
    border-radius: 0 0 var(--radius) var(--radius);
    max-height: 220px;
    overflow-y: auto;
    box-shadow: 0 8px 20px rgba(0,0,0,0.12);
}

.suggestion-item {
    padding: 0.65rem 1rem;
    cursor: pointer;
    font-size: 0.95rem;
    color: var(--text);
    transition: background 0.15s;
    border-bottom: 1px solid var(--border);
}

.suggestion-item:last-child {
    border-bottom: none;
}

.suggestion-item:hover,
.suggestion-item.active {
    background: rgba(8, 145, 178, 0.1);
}

.suggestion-item strong {
    color: var(--primary);
    font-weight: 700;
}

/* ── Scan summary (review before adding) ── */
.scan-summary {
    margin-top: 0.75rem;
    max-height: 260px;
    overflow-y: auto;
}

.scan-summary-title {
    font-weight: 700;
    font-size: 0.9rem;
    margin: 0.6rem 0 0.3rem;
}

.scan-summary-title.new {
    color: #16a34a;
}

.scan-summary-title.match {
    color: var(--primary);
}

.scan-summary-title.dup {
    color: #d97706;
}

.scan-summary-list {
    list-style: none;
    padding: 0;
    margin: 0 0 0.5rem;
}

.scan-summary-list li {
    padding: 0.35rem 0.6rem;
    font-size: 0.88rem;
    border-radius: 4px;
    margin-bottom: 2px;
}

.scan-summary-list.new li {
    background: rgba(22, 163, 74, 0.08);
    color: var(--text);
}

.scan-summary-list.match li {
    background: rgba(8, 145, 178, 0.08);
    color: var(--text);
}

.scan-summary-list.dup li {
    background: rgba(217, 119, 6, 0.08);
    color: var(--text-light);
    text-decoration: line-through;
}

.scan-summary-cat {
    font-size: 0.78rem;
    color: var(--text-light);
    margin-left: 0.3rem;
}

.scan-summary-empty {
    text-align: center;
    color: var(--text-light);
    font-style: italic;
    padding: 1rem 0;
}

/* ── Responsive ── */
@media (max-width: 1024px) {
    .shopping-list {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 600px) {
    body {
        padding: 1rem 0.75rem;
    }

    .app-header h1 {
        font-size: 1.6rem;
    }

    .shopping-list {
        grid-template-columns: 1fr;
    }
}
