/* Filters */
.filter-bar {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    margin-bottom: var(--space-md);
}

.search-row {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.search-input {
    flex: 1;
    min-width: 0;
    min-height: var(--touch-min);
    padding: 0 var(--space-md);
    background: var(--color-surface-2);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
}

.search-add-btn {
    width: var(--touch-min);
    height: var(--touch-min);
    border-radius: var(--radius);
    background: var(--color-primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: var(--shadow-fab);
    transition:
        transform var(--duration-press) var(--ease-master),
        box-shadow 0.25s var(--ease-master);
}

.search-add-btn .material-symbols-outlined {
    font-size: 1.5rem;
}

.search-add-btn:hover,
.search-add-btn:focus-visible {
    box-shadow: var(--shadow-btn-hover);
}

.search-add-btn:active {
    transform: scale(0.96);
}

.chip-row {
    display: flex;
    gap: var(--space-sm);
    overflow-x: auto;
    padding-bottom: var(--space-xs);
    -webkit-overflow-scrolling: touch;
}

.chip {
    flex-shrink: 0;
    min-height: 40px;
    padding: 0 var(--space-md);
    border-radius: 20px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
    box-shadow: var(--shadow-card);
    transition:
        transform var(--duration-press) var(--ease-master),
        background 0.2s var(--ease-master),
        border-color 0.2s var(--ease-master);
}

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

.chip:active {
    transform: scale(0.96);
}

.chip-zone {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-xs);
    padding: var(--space-sm);
    min-height: auto;
    white-space: normal;
    width: auto;
    min-width: 72px;
    max-width: 120px;
}

.chip-zone-thumb {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-sm);
    object-fit: cover;
    background: var(--color-surface-2);
    flex-shrink: 0;
}

.chip-zone.active .chip-zone-thumb.item-thumb-placeholder {
    color: white;
}

.chip-zone-name {
    font-size: 0.75rem;
    font-weight: 600;
    text-align: center;
    line-height: 1.2;
    max-width: 100%;
    white-space: normal;
    overflow-wrap: anywhere;
}

.filter-row {
    display: flex;
    gap: var(--space-sm);
}

.filter-select {
    flex: 1;
    min-height: var(--touch-min);
    padding: 0 var(--space-sm);
    background: var(--color-surface-2);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
}

.filter-select-sort {
    width: 100%;
}

/* Item cards */
.item-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.item-card {
    display: flex;
    align-items: flex-start;
    gap: var(--space-md);
    padding: var(--space-md);
    background: var(--color-surface);
    border: none;
    border-radius: var(--radius);
    border-left: 4px solid transparent;
    box-shadow: var(--shadow-card);
}

.item-card-thumb {
    flex-shrink: 0;
}

.item-card-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.item-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-sm);
}

.item-card-actions {
    display: flex;
    gap: var(--space-xs);
    flex-shrink: 0;
}

.item-card.expiry-expired {
    border-left-color: var(--expiry-expired);
}
.item-card.expiry-critical {
    border-left-color: var(--expiry-critical);
}
.item-card.expiry-warning {
    border-left-color: var(--expiry-warning);
}
.item-card.expiry-ok {
    border-left-color: var(--expiry-ok);
}
.item-card.expiry-none {
    border-left-color: var(--expiry-none);
}

.item-thumb {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-sm);
    object-fit: cover;
    background: var(--color-surface-2);
    flex-shrink: 0;
}

.item-thumb-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-text-muted);
}

.item-thumb-placeholder .material-symbols-outlined {
    font-size: 1.5rem;
}

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

.item-name {
    font-weight: 700;
    font-size: 1rem;
    line-height: 1.35;
    white-space: normal;
    overflow-wrap: anywhere;
}

.item-meta {
    font-size: 0.8rem;
    color: var(--color-text-muted);
    margin-top: 2px;
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.expiry-pill {
    display: inline-block;
    margin-top: var(--space-xs);
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.75rem;
    font-weight: 700;
}

.expiry-pill.expiry-expired {
    background: var(--expiry-expired);
    color: #fff;
}
.expiry-pill.expiry-critical {
    background: var(--expiry-critical);
    color: #fff;
}
.expiry-pill.expiry-warning {
    background: var(--expiry-warning);
    color: #fff;
}
.expiry-pill.expiry-ok {
    background: var(--expiry-ok);
    color: #fff;
}
.expiry-pill.expiry-none {
    background: var(--color-surface-2);
    color: var(--color-text-muted);
}

.qty-badge {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 8px;
    border-radius: 18px;
    background: var(--color-surface-2);
    font-weight: 700;
    font-size: 0.9rem;
    flex-shrink: 0;
}

.qty-badge--empty {
    color: var(--color-text-muted);
    border: 1px dashed var(--color-border);
    background: transparent;
}

.item-card--out-of-stock .item-name {
    color: var(--color-text-muted);
}

.item-card-tap {
    cursor: pointer;
    transition: transform var(--duration-press) var(--ease-master);
}

.item-card-tap:active {
    transform: scale(0.98);
}

.btn-item-action,
.btn-decrement {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    background: var(--color-surface-2);
    border: 1px solid var(--color-border);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-text);
    transition: transform var(--duration-press) var(--ease-master);
}

.btn-item-action .material-symbols-outlined,
.btn-decrement .material-symbols-outlined {
    font-size: 1.25rem;
}

.btn-decrement-trash {
    color: var(--color-clay);
    border-color: var(--color-clay);
    background: var(--color-danger-bg);
}

.btn-decrement-trash:active {
    transform: scale(0.96);
    background: rgba(184, 92, 56, 0.22);
}

.btn-item-action:active,
.btn-decrement:active {
    transform: scale(0.96);
}

/* Buttons */
.btn {
    min-height: var(--touch-min);
    padding: 0 var(--space-lg);
    border-radius: var(--radius);
    font-weight: 700;
    font-size: 1rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    transition:
        transform var(--duration-press) var(--ease-master),
        box-shadow 0.25s var(--ease-master),
        background 0.2s var(--ease-master);
}

.btn:active {
    transform: scale(0.96);
}

.btn-primary {
    background: var(--color-primary);
    color: white;
    box-shadow: var(--shadow-fab);
}

.btn-primary:hover,
.btn-primary:focus-visible {
    box-shadow: var(--shadow-btn-hover);
}

.btn-secondary {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    box-shadow: var(--shadow-card);
}

.btn-danger {
    background: var(--color-clay);
    color: white;
}

.btn-block {
    width: 100%;
}

.btn-lg {
    min-height: var(--touch-lg);
    font-size: 1.1rem;
}

/* Forms */
.form-group {
    margin-bottom: var(--space-md);
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--color-text-muted);
    margin-bottom: var(--space-xs);
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    min-height: var(--touch-min);
    padding: var(--space-sm) var(--space-md);
    background: var(--color-surface-2);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
}

.form-textarea {
    min-height: 80px;
    resize: vertical;
}

.photo-picker-preview {
    width: 100%;
    aspect-ratio: 4 / 3;
    max-height: 200px;
    margin-bottom: var(--space-sm);
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--color-surface-2);
    border: 1px solid var(--color-border);
}

.photo-picker-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.photo-picker-img.hidden,
.photo-picker-placeholder.hidden {
    display: none;
}

.photo-picker-placeholder {
    width: 100%;
    height: 100%;
}

.photo-picker-actions {
    display: flex;
    gap: var(--space-sm);
}

.photo-picker-actions .btn {
    flex: 1;
    font-size: 0.9rem;
    padding: 0 var(--space-sm);
}

.location-picker {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(88px, 1fr));
    gap: var(--space-sm);
}

.location-picker-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-xs);
    padding: var(--space-sm);
    background: var(--color-surface-2);
    border: 2px solid var(--color-border);
    border-radius: var(--radius);
    min-height: var(--touch-min);
}

.location-picker-option.active {
    border-color: var(--color-primary);
    background: var(--color-surface);
}

.location-picker-thumb {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-sm);
    object-fit: cover;
    background: var(--color-surface-2);
    flex-shrink: 0;
}

.location-picker-name {
    font-size: 0.75rem;
    font-weight: 600;
    text-align: center;
    line-height: 1.2;
    white-space: normal;
    overflow-wrap: anywhere;
}

.qty-stepper {
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.qty-stepper button {
    width: var(--touch-lg);
    height: var(--touch-lg);
    border-radius: var(--radius);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-text);
    box-shadow: var(--shadow-card);
    transition: transform var(--duration-press) var(--ease-master);
}

.qty-stepper button:active {
    transform: scale(0.96);
}

.qty-stepper button .material-symbols-outlined {
    font-size: 1.5rem;
}

.qty-stepper span {
    font-size: 1.5rem;
    font-weight: 700;
    min-width: 48px;
    text-align: center;
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: var(--space-xl) var(--space-md);
    color: var(--color-text-muted);
}

.empty-state p {
    margin-bottom: var(--space-md);
    font-size: 1rem;
}

/* Confirm card */
.confirm-card {
    background: var(--color-surface);
    border: none;
    border-radius: var(--radius);
    padding: var(--space-md);
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
    box-shadow: var(--shadow-card);
}

.confirm-preview {
    display: flex;
    gap: var(--space-md);
    align-items: center;
}

.confirm-preview img {
    width: 72px;
    height: 72px;
    object-fit: cover;
    border-radius: var(--radius-sm);
    background: var(--color-surface-2);
}

.confirm-actions {
    display: flex;
    gap: var(--space-sm);
}

.confirm-actions .btn {
    flex: 1;
}

.add-form-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-lg);
    padding-bottom: var(--space-md);
    border-bottom: 1px solid var(--color-border);
}

.add-form-header h1,
.add-form-header .font-display {
    font-family: var(--font-display);
    font-weight: 700;
}

.add-form-dismiss {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    background: var(--color-surface-2);
    border: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-text);
    flex-shrink: 0;
    transition: transform var(--duration-press) var(--ease-master);
}

.add-form-dismiss:active {
    transform: scale(0.96);
}

.add-form-dismiss .material-symbols-outlined {
    font-size: 1.25rem;
}

.add-form-scan {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    background: var(--color-primary);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    flex-shrink: 0;
    box-shadow: var(--shadow-fab);
    transition:
        transform var(--duration-press) var(--ease-master),
        box-shadow 0.25s var(--ease-master);
}

.add-form-scan .material-symbols-outlined {
    font-size: 1.25rem;
}

.add-form-scan:active {
    transform: scale(0.96);
}

.add-form-header-text {
    margin: 0;
    font-size: 0.95rem;
    color: var(--color-text-muted);
    line-height: 1.3;
}

.item-edit-properties {
    margin-bottom: var(--space-lg);
    padding-bottom: var(--space-md);
    border-bottom: 1px solid var(--color-border);
}

.item-edit-property {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-md);
}

.item-edit-property-label {
    font-size: 0.9rem;
    font-weight: 700;
    flex-shrink: 0;
}

.item-edit-property-input {
    width: auto;
    min-width: 9.5rem;
    flex-shrink: 0;
}

.item-edit-property-display {
    margin: var(--space-xs) 0 0;
    font-size: 0.85rem;
    color: var(--color-text-muted);
    text-align: right;
}

/* Grocery link prompt */
.grocery-link-prompt-message {
    margin: 0 0 16px;
    line-height: 1.5;
    color: var(--color-text);
}

.grocery-link-prompt-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Modal / sheet */
.modal-backdrop,
.sheet-overlay {
    position: fixed;
    inset: 0;
    z-index: 300;
    background: rgba(44, 42, 41, 0.4);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    opacity: 0;
    transition: opacity var(--duration-backdrop) var(--ease-master);
}

.modal-backdrop.is-open,
.sheet-overlay.is-open {
    opacity: 1;
}

.modal-backdrop.is-closing,
.sheet-overlay.is-closing {
    opacity: 0;
}

.modal-sheet,
.recipe-sheet {
    width: 100%;
    max-height: calc(100dvh - var(--bottom-nav-offset) - var(--space-md));
    max-height: calc(100vh - var(--bottom-nav-offset) - var(--space-md));
    overflow-y: auto;
    background: var(--color-surface);
    border-radius: var(--radius) var(--radius) 0 0;
    padding: var(--space-lg) var(--space-md);
    padding-bottom: calc(var(--bottom-nav-offset) + var(--space-lg));
    box-shadow: var(--shadow-card);
    transform: translateY(100%);
    transition: transform var(--duration-sheet) var(--ease-master);
}

.modal-backdrop.is-open .modal-sheet,
.sheet-overlay.is-open .recipe-sheet {
    transform: translateY(0);
}

.modal-backdrop.is-closing .modal-sheet,
.sheet-overlay.is-closing .recipe-sheet {
    transform: translateY(100%);
}

.modal-sheet h2 {
    margin-bottom: var(--space-md);
    font-size: 1.2rem;
    font-family: var(--font-display);
    font-weight: 700;
}

.sheet-header {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    margin-bottom: var(--space-md);
}

.sheet-header .sheet-title {
    margin: 0;
    font-size: 1.2rem;
    font-family: var(--font-display);
    font-weight: 700;
}

.sheet-dismiss,
.btn-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    background: var(--color-surface-2);
    border: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-text);
    flex-shrink: 0;
    transition: transform var(--duration-press) var(--ease-master);
}

.sheet-dismiss:active,
.btn-icon:active {
    transform: scale(0.96);
}

.sheet-dismiss .material-symbols-outlined {
    font-size: 1.25rem;
}

.picker-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.picker-item {
    min-height: var(--touch-lg);
    padding: var(--space-md);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    text-align: left;
    font-weight: 600;
    box-shadow: var(--shadow-card);
    transition:
        transform var(--duration-press) var(--ease-master),
        border-color 0.2s var(--ease-master);
}

.picker-item:active {
    transform: scale(0.98);
    border-color: var(--color-primary);
}

/* Toast */
.toast {
    position: relative;
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-md);
    padding-bottom: calc(var(--space-md) + 3px);
    overflow: hidden;
    background: var(--color-surface);
    border: none;
    border-radius: var(--radius);
    box-shadow: var(--shadow-index-card);
    opacity: 0;
    transform: translateY(14px);
    transition:
        transform 0.44s var(--ease-master),
        opacity 0.44s var(--ease-master),
        box-shadow 0.44s var(--ease-master);
    will-change: transform, opacity;
}

.toast--visible {
    opacity: 1;
    transform: translateY(0);
}

.toast--exiting {
    opacity: 0;
    transform: translateY(8px);
    transition-duration: 0.3s;
    pointer-events: none;
}

.toast--notice {
    padding-bottom: var(--space-md);
}

.toast-message {
    flex: 1;
    font-weight: 600;
    line-height: 1.35;
}

.toast .btn-undo {
    min-height: var(--touch-min);
    padding: 0 var(--space-lg);
    border-radius: var(--radius);
    background: var(--color-primary);
    color: white;
    font-weight: 700;
    flex-shrink: 0;
    box-shadow: var(--shadow-fab);
    transition: transform var(--duration-press) var(--ease-master);
}

.toast .btn-undo:active {
    transform: scale(0.96);
}

.toast-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: var(--color-primary);
    border-radius: 0 0 var(--radius) var(--radius);
    transform: scaleX(1);
    transform-origin: left center;
    transition: transform linear;
    pointer-events: none;
}

/* Page actions */
.page-actions {
    margin-bottom: var(--space-md);
}

.loading {
    text-align: center;
    padding: var(--space-xl);
    color: var(--color-text-muted);
}

/* Auth login */
.auth-login {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: calc(100dvh - var(--space-xl));
    padding: var(--space-lg);
}

.auth-login-card {
    width: min(100%, 24rem);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    padding: var(--space-xl);
}

.auth-login-title {
    font-family: var(--font-display);
    font-size: 1.75rem;
    margin: 0 0 var(--space-sm);
    text-align: center;
}

.auth-login-hint {
    margin: 0 0 var(--space-lg);
    color: var(--color-text-muted);
    font-size: 0.9rem;
    line-height: 1.45;
    text-align: center;
}

.auth-login-form {
    margin-top: var(--space-md);
}

.auth-login-error {
    margin: 0 0 var(--space-md);
    color: var(--color-clay);
    font-size: 0.9rem;
    font-weight: 600;
    text-align: center;
}
