/* ==========================================
   Design Tokens
   ========================================== */
:root {
    --primary: #5c4ce5;
    --primary-hover: #4f3ed4;
    --primary-light: #ecebfe;
    
    --bg: #f8fafc;
    --surface: #ffffff;
    --text: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --border: #e2e8f0;
    --border-light: #f1f5f9;
    
    --green: #059669;
    --green-bg: #ecfdf5;
    --amber: #d97706;
    --amber-bg: #fefce8;
    --red: #dc2626;
    --red-bg: #fef2f2;
    
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --radius-2xl: 24px;
    --radius-full: 9999px;
    
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
    --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -2px rgba(0,0,0,0.05);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.08), 0 4px 6px -4px rgba(0,0,0,0.05);
}

/* ==========================================
   Reset & Base
   ========================================== */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

.app-container {
    min-height: 100vh;
    min-height: 100dvh;
    position: relative;
}

/* ==========================================
   View System
   ========================================== */
.view {
    display: none;
    min-height: 100vh;
    min-height: 100dvh;
}

.view.active {
    display: flex;
    flex-direction: column;
}

#settings-view {
    background: var(--bg);
}

/* ==========================================
   Buttons
   ========================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    border: none;
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    width: 100%;
    white-space: nowrap;
}

.primary-btn {
    background: var(--primary);
    color: white;
    box-shadow: var(--shadow-sm);
}
.primary-btn:hover { background: var(--primary-hover); transform: translateY(-1px); box-shadow: var(--shadow-md); }
.primary-btn:active { transform: translateY(0); }
.primary-btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.outline-btn {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text);
}
.outline-btn:hover { background: var(--bg); }

.text-btn {
    background: transparent;
    color: var(--primary);
    padding: 0.5rem;
}
.text-btn:hover { text-decoration: underline; }

.consumed-btn {
    background: var(--green);
    color: white;
}
.consumed-btn:hover { background: #047857; }

.danger-btn {
    background: var(--red);
    color: white;
}
.danger-btn:hover { background: #b91c1c; }

.google-btn {
    background: white;
    color: #3C4043;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
}
.google-btn:hover { background: #f8f9fa; }
.google-icon { width: 18px; height: 18px; }

.btn-compact { width: auto; padding: 0.625rem 1.25rem; }
.btn-large { padding: 1rem; font-size: 1rem; border-radius: var(--radius-lg); }

.icon-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: var(--bg);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
}
.icon-btn:hover { background: var(--border); }

.icon-btn-light {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: var(--border-light);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.15s;
    flex-shrink: 0;
}
.icon-btn-light:active { transform: scale(0.95); }

.icon-btn-dark {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: rgba(255,255,255,0.12);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.15s;
    flex-shrink: 0;
}
.icon-btn-dark:hover { background: rgba(255,255,255,0.2); }

/* ==========================================
   Spinner
   ========================================== */
.spinner {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    display: inline-block;
}
.spinner-large {
    width: 32px;
    height: 32px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ==========================================
   Forms
   ========================================== */
.input-group {
    margin-bottom: 1.25rem;
}

.input-group label,
.form-group label {
    display: block;
    font-size: 0.8125rem;
    font-weight: 600;
    margin-bottom: 0.375rem;
    color: var(--text);
}

.input-group input,
.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 0.9375rem;
    font-family: inherit;
    color: var(--text);
    background: var(--surface);
    transition: all 0.15s;
    -webkit-appearance: none;
    appearance: none;
}

.form-group select {
    background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%2394a3b8' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    padding-right: 2.5rem;
}

.input-group input:focus,
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(92, 76, 229, 0.1);
}

textarea {
    resize: vertical;
    min-height: 64px;
}

.form-group {
    margin-bottom: 1rem;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

.item-form {
    padding: 0 1.25rem 2rem;
}

/* ==========================================
   Login View
   ========================================== */
#login-view {
    justify-content: center;
    align-items: center;
    padding: 1.25rem;
    background: linear-gradient(135deg, #EEF2FF 0%, #E0E7FF 50%, #C7D2FE 100%);
}

.login-card {
    background: var(--surface);
    padding: 2.5rem 2rem;
    border-radius: var(--radius-2xl);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 400px;
    animation: slideUp 0.5s ease-out;
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(24px); }
    to { opacity: 1; transform: translateY(0); }
}

.logo-container {
    text-align: center;
    margin-bottom: 2rem;
}
.logo-icon { font-size: 3rem; margin-bottom: 0.5rem; }
.logo-container h1 { font-size: 1.5rem; font-weight: 800; color: var(--text); }
.subtitle { font-size: 0.875rem; color: var(--text-muted); margin-top: 0.25rem; }

.divider {
    display: flex;
    align-items: center;
    margin: 1.5rem 0;
    color: var(--text-muted);
    font-size: 0.75rem;
    text-transform: uppercase;
}
.divider::before, .divider::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid var(--border);
}
.divider span { padding: 0 0.75rem; }

.error-text {
    color: var(--red);
    font-size: 0.8125rem;
    text-align: center;
    margin-top: 0.75rem;
}

.hidden { display: none !important; }

/* ==========================================
   Dashboard View
   ========================================== */
.dash-header {
    background: var(--surface);
    border-bottom: 1px solid var(--border-light);
    position: sticky;
    top: 0;
    z-index: 10;
}

.dash-header-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 1.5rem 1.25rem 0.75rem;
}

.dash-title {
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--text);
    letter-spacing: -0.02em;
}

.dash-subtitle {
    color: var(--text-muted);
    font-size: 0.875rem;
    margin-top: 0.125rem;
}

.header-actions {
    display: flex;
    gap: 0.5rem;
}

/* Stats */
.stats-container {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.625rem;
    padding: 0.75rem 1.25rem 1rem;
}

.stat-card {
    padding: 0.875rem 0.5rem;
    border-radius: var(--radius-lg);
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.125rem;
}

.stat-icon-wrap {
    margin-bottom: 0.25rem;
    opacity: 0.7;
}

.stat-number {
    font-size: 1.5rem;
    font-weight: 800;
    line-height: 1.2;
}

.stat-label {
    font-size: 0.6875rem;
    font-weight: 500;
}

.stat-total { background: var(--bg); color: var(--text); }
.stat-expiring { background: var(--amber-bg); color: var(--amber); }
.stat-expired { background: var(--red-bg); color: var(--red); }

/* Filters */
.filters-bar {
    display: flex;
    gap: 0.5rem;
    padding: 0.5rem 1.25rem 0.75rem;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}
.filters-bar::-webkit-scrollbar { display: none; }

.filter-chip {
    flex-shrink: 0;
    padding: 0.375rem 0.875rem;
    border-radius: var(--radius-full);
    border: 1.5px solid var(--border);
    background: var(--surface);
    color: var(--text-secondary);
    font-size: 0.8125rem;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
}
.filter-chip:hover { border-color: var(--primary); color: var(--primary); }
.filter-chip.active {
    background: var(--text);
    color: white;
    border-color: var(--text);
}

.filter-divider {
    width: 1px;
    background: var(--border);
    margin: 0.25rem 0;
    flex-shrink: 0;
}

/* Food List */
.food-list {
    padding: 0.5rem 1.25rem 7rem;
    flex: 1;
}

/* Food Card */
.food-card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 0.875rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.875rem;
    box-shadow: var(--shadow);
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: 0.625rem;
    animation: fadeUp 0.3s ease-out both;
    border: 1px solid var(--border-light);
}
.food-card:hover { box-shadow: var(--shadow-md); }
.food-card:active { transform: scale(0.985); }

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

.food-card-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.375rem;
    flex-shrink: 0;
}

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

.food-card-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.5rem;
}

.food-card-name-group {
    min-width: 0;
}

.food-card-name {
    font-weight: 600;
    font-size: 0.9375rem;
    color: var(--text);
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.food-card-meta {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    margin-top: 0.25rem;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.location-pill {
    font-weight: 500;
}

.meta-dot {
    opacity: 0.4;
}

.food-card-qty {
    font-size: 0.6875rem;
    color: var(--text-muted);
    margin-top: 0.375rem;
    padding-top: 0.375rem;
    border-top: 1px solid var(--border-light);
}

.food-card-chevron {
    color: var(--text-muted);
    opacity: 0.35;
    flex-shrink: 0;
}

/* Status Badges */
.status-badge {
    padding: 0.1875rem 0.5rem;
    border-radius: var(--radius-full);
    font-size: 0.6875rem;
    font-weight: 600;
    white-space: nowrap;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}
.status-badge::before {
    content: '';
    width: 5px;
    height: 5px;
    border-radius: 50%;
    display: inline-block;
}
.status-good { background: var(--green-bg); color: var(--green); }
.status-good::before { background: var(--green); }
.status-soon { background: var(--amber-bg); color: var(--amber); }
.status-soon::before { background: var(--amber); }
.status-expired { background: var(--red-bg); color: var(--red); }
.status-expired::before { background: var(--red); }

/* Empty State */
.empty-state {
    text-align: center;
    padding: 3rem 1.5rem;
    color: var(--text-muted);
}
.empty-icon-large {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}
.empty-state h3 {
    color: var(--text);
    font-size: 1rem;
    margin-bottom: 0.375rem;
}
.empty-state p {
    font-size: 0.875rem;
    margin-bottom: 1.25rem;
}

/* ==========================================
   Bottom Navigation
   ========================================== */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--surface);
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: 0.375rem 1rem calc(0.375rem + env(safe-area-inset-bottom, 0.5rem));
    border-top-left-radius: var(--radius-xl);
    border-top-right-radius: var(--radius-xl);
    box-shadow: 0 -2px 10px rgba(0,0,0,0.06);
    z-index: 50;
}

.nav-btn {
    background: none;
    border: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.125rem;
    color: var(--text-muted);
    font-size: 0.6875rem;
    font-weight: 500;
    padding: 0.5rem 1.5rem;
    cursor: pointer;
    font-family: inherit;
    transition: color 0.2s;
}
.nav-btn.active { color: var(--primary); }
.nav-btn span { margin-top: 2px; }

.nav-scan-wrap {
    position: relative;
    top: -16px;
}

.scan-fab {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--text);
    border: 4px solid var(--bg);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-md);
    cursor: pointer;
    transition: transform 0.15s;
}
.scan-fab:active { transform: scale(0.93); }

/* ==========================================
   Scanner View
   ========================================== */
.scanner-screen {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #0f172a;
    min-height: 100vh;
    min-height: 100dvh;
}

.scanner-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    z-index: 10;
}
.scanner-header h2 {
    color: white;
    font-size: 1rem;
    font-weight: 600;
}

.scanner-area {
    flex: 1;
    position: relative;
    overflow: hidden;
    background: #000;
}

.scanner-camera {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

/* Make html5-qrcode fill the container */
#qr-reader {
    border: none !important;
    width: 100% !important;
    height: 100%;
}
#qr-reader video {
    object-fit: cover !important;
    border-radius: var(--radius-lg);
}
#qr-reader__scan_region > img {
    display: none !important;
}
#qr-reader__dashboard {
    display: none !important;
}
#qr-reader__dashboard_section,
#qr-reader__dashboard_section_csr,
#qr-reader__dashboard_section_swaplink,
#qr-reader__status_span,
#qr-reader__header_message {
    display: none !important;
}

.scan-frame {
    position: absolute;
    z-index: 5;
    width: 240px;
    height: 240px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
}

.frame-corner {
    position: absolute;
    width: 40px;
    height: 40px;
    border-color: white;
    border-style: solid;
    border-width: 0;
}
.frame-corner.tl { top: 0; left: 0; border-top-width: 3px; border-left-width: 3px; border-top-left-radius: 16px; }
.frame-corner.tr { top: 0; right: 0; border-top-width: 3px; border-right-width: 3px; border-top-right-radius: 16px; }
.frame-corner.bl { bottom: 0; left: 0; border-bottom-width: 3px; border-left-width: 3px; border-bottom-left-radius: 16px; }
.frame-corner.br { bottom: 0; right: 0; border-bottom-width: 3px; border-right-width: 3px; border-bottom-right-radius: 16px; }

.scan-line {
    position: absolute;
    left: 8px;
    right: 8px;
    height: 2px;
    background: linear-gradient(90deg, transparent, #34d399, transparent);
    animation: scanLine 2s linear infinite;
    border-radius: 1px;
}
@keyframes scanLine {
    0% { top: 10%; }
    50% { top: 85%; }
    100% { top: 10%; }
}

.scan-result-overlay {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.92);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 20;
    animation: fadeIn 0.3s ease;
}
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.scan-result-content {
    text-align: center;
    animation: popIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes popIn {
    from { opacity: 0; transform: scale(0.8); }
    to { opacity: 1; transform: scale(1); }
}

.scan-result-icon {
    font-size: 3.5rem;
    margin-bottom: 1rem;
}

.scan-result-content h3 {
    color: white;
    font-size: 1.375rem;
    font-weight: 700;
    margin-bottom: 0.375rem;
}

.scan-result-content p {
    color: rgba(255,255,255,0.6);
    font-size: 0.875rem;
}

.scanner-footer {
    padding: 1rem 1.25rem 2rem;
    z-index: 10;
}

.mode-toggle {
    background: rgba(255,255,255,0.1);
    border-radius: var(--radius-full);
    padding: 4px;
    display: flex;
}

.mode-btn {
    flex: 1;
    padding: 0.75rem;
    border: none;
    border-radius: var(--radius-full);
    background: transparent;
    color: rgba(255,255,255,0.5);
    font-family: inherit;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all 0.2s;
}
.mode-btn.active {
    background: white;
    color: var(--text);
}

.manual-entry {
    margin-top: 1.5rem;
    animation: fadeUp 0.3s ease;
}

.manual-entry-card {
    background: rgba(255,255,255,0.08);
    border-radius: var(--radius-xl);
    padding: 2rem 1.5rem;
    text-align: center;
}

.manual-icon {
    color: rgba(255,255,255,0.5);
    margin-bottom: 1rem;
}

.manual-entry-card h3 {
    color: white;
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 0.375rem;
}

.manual-entry-card p {
    color: rgba(255,255,255,0.5);
    font-size: 0.875rem;
    margin-bottom: 1.5rem;
}

.manual-input {
    width: 100%;
    padding: 0.875rem 1rem;
    border: 1.5px solid rgba(255,255,255,0.15);
    border-radius: var(--radius-md);
    background: rgba(255,255,255,0.08);
    color: white;
    font-size: 1.125rem;
    font-family: inherit;
    text-align: center;
    margin-bottom: 1rem;
    transition: all 0.15s;
}
.manual-input::placeholder { color: rgba(255,255,255,0.3); }
.manual-input:focus {
    outline: none;
    border-color: rgba(255,255,255,0.4);
    background: rgba(255,255,255,0.12);
}

#manual-form .primary-btn {
    border-radius: var(--radius-md);
}

/* ==========================================
   Create Item & Page Screen
   ========================================== */
.page-screen {
    background: var(--bg);
    min-height: 100vh;
    min-height: 100dvh;
    padding-bottom: 2rem;
}

.page-header {
    background: var(--surface);
    border-bottom: 1px solid var(--border-light);
    padding: 1rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    position: sticky;
    top: 0;
    z-index: 10;
}

.page-title {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--text);
}

.page-subtitle {
    font-size: 0.8125rem;
    color: var(--text-muted);
}

.qr-info-badge {
    margin: 1.25rem 1.25rem 0;
    background: var(--text);
    border-radius: var(--radius-lg);
    padding: 1rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    animation: fadeUp 0.3s ease;
}

.qr-info-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    background: rgba(255,255,255,0.1);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.qr-info-label {
    display: block;
    font-size: 0.75rem;
    color: rgba(255,255,255,0.5);
}

.qr-info-code {
    display: block;
    color: white;
    font-weight: 600;
    font-size: 0.9375rem;
}

/* ==========================================
   Item Detail View
   ========================================== */
.detail-header {
    background: var(--surface);
    border-bottom: 1px solid var(--border-light);
    padding: 1rem 1.25rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 10;
}

.detail-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4rem;
}

.detail-main-card,
.detail-info-card,
.detail-qr-card {
    margin: 1rem 1.25rem 0;
    background: var(--surface);
    border-radius: var(--radius-xl);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-light);
    animation: fadeUp 0.3s ease both;
}

.detail-info-card { animation-delay: 0.1s; }
.detail-qr-card { animation-delay: 0.2s; }

.detail-top {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1rem;
}

.detail-cat-icon {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.detail-name {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text);
    letter-spacing: -0.02em;
    line-height: 1.2;
}

.detail-cat-label {
    color: var(--text-muted);
    font-size: 0.875rem;
}

.detail-badges {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
}

.location-badge {
    padding: 0.25rem 0.625rem;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.expiration-card {
    border-radius: var(--radius-lg);
    padding: 1rem;
    display: flex;
    align-items: center;
    gap: 0.875rem;
}

.expiration-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.expiration-label {
    display: block;
    font-size: 0.8125rem;
    font-weight: 500;
}

.expiration-value {
    display: block;
    font-size: 1.25rem;
    font-weight: 800;
}

/* Detail Info */
.detail-section-title {
    font-size: 0.9375rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 1rem;
}

.detail-row {
    display: flex;
    align-items: flex-start;
    gap: 0.875rem;
    padding: 0.75rem 0;
}
.detail-row + .detail-row {
    border-top: 1px solid var(--border-light);
}

.detail-row-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-md);
    background: var(--bg);
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.detail-row-label {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.detail-row-value {
    display: block;
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--text);
}

.detail-row-muted {
    font-weight: 400;
    color: var(--text-muted);
    font-size: 0.8125rem;
}

.detail-notes {
    padding-top: 1rem;
    margin-top: 0.5rem;
    border-top: 1px solid var(--border-light);
}

.detail-notes-text {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-top: 0.25rem;
    line-height: 1.6;
}

/* QR Detail */
.qr-detail-row {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.qr-detail-label {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}

.qr-detail-code {
    font-family: 'SF Mono', SFMono-Regular, Consolas, monospace;
    font-weight: 700;
    font-size: 1rem;
    color: var(--text);
    display: block;
}

.qr-detail-name {
    font-size: 0.8125rem;
    color: var(--text-muted);
    margin-top: 0.125rem;
    display: block;
}

.qr-image-container {
    margin-top: 1rem;
    background: var(--bg);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    text-align: center;
}

.qr-image {
    width: 160px;
    height: 160px;
    border-radius: var(--radius-md);
    margin: 0 auto;
    display: block;
}

.qr-image-caption {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.75rem;
}

/* Consumed Button */
#btn-mark-consumed {
    margin: 1.5rem 1.25rem 0;
    width: calc(100% - 2.5rem);
}

/* ==========================================
   Dropdown Menu
   ========================================== */
.dropdown-menu {
    position: absolute;
    top: 60px;
    right: 1.25rem;
    background: var(--surface);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
    z-index: 100;
    min-width: 180px;
    overflow: hidden;
    animation: dropIn 0.15s ease;
}

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

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.75rem 1rem;
    border: none;
    background: none;
    color: var(--text);
    font-size: 0.875rem;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.1s;
}
.dropdown-item:hover { background: var(--bg); }
.dropdown-danger { color: var(--red); }
.dropdown-danger:hover { background: var(--red-bg); }
.dropdown-divider { height: 1px; background: var(--border-light); }

/* ==========================================
   Confirm Dialog
   ========================================== */
.dialog-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
    padding: 1.25rem;
    animation: fadeIn 0.2s ease;
}

.dialog-card {
    background: var(--surface);
    border-radius: var(--radius-xl);
    padding: 1.5rem;
    width: 100%;
    max-width: 360px;
    box-shadow: var(--shadow-lg);
    animation: popIn 0.25s ease;
}

.dialog-card h3 {
    font-size: 1.125rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.dialog-card p {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-bottom: 1.5rem;
    line-height: 1.5;
}

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

.dialog-actions .btn {
    flex: 1;
    border-radius: var(--radius-md);
}

/* ==========================================
   Toast
   ========================================== */
.toast {
    position: fixed;
    bottom: 5.5rem;
    left: 50%;
    transform: translateX(-50%);
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-full);
    font-size: 0.875rem;
    font-weight: 500;
    z-index: 300;
    animation: toastIn 0.3s ease;
    white-space: nowrap;
    box-shadow: var(--shadow-lg);
}

.toast-success {
    background: var(--text);
    color: white;
}

.toast-error {
    background: var(--red);
    color: white;
}

.toast-hide {
    animation: toastOut 0.3s ease forwards;
}

@keyframes toastIn {
    from { opacity: 0; transform: translateX(-50%) translateY(16px); }
    to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

@keyframes toastOut {
    from { opacity: 1; transform: translateX(-50%) translateY(0); }
    to { opacity: 0; transform: translateX(-50%) translateY(16px); }
}

/* ==========================================
   Responsive
   ========================================== */
@media (min-width: 640px) {
    .dash-header-top,
    .stats-container,
    .filters-bar,
    .food-list {
        max-width: 480px;
        margin-left: auto;
        margin-right: auto;
    }
    
    .page-screen {
        max-width: 480px;
        margin: 0 auto;
    }
}

/* ==========================================
   Type Selector Cards
   ========================================== */
.type-option-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.25rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
    width: 100%;
}

.type-option-card:hover {
    border-color: var(--primary);
    box-shadow: 0 4px 12px rgba(92, 76, 229, 0.1);
    transform: translateY(-2px);
}

.type-option-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    flex-shrink: 0;
}

.type-option-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.type-option-title {
    font-weight: 600;
    font-size: 1rem;
    color: var(--text);
}

.type-option-desc {
    font-size: 0.8rem;
    color: var(--text-muted);
    line-height: 1.3;
}

/* ==========================================
   WhatsApp Button
   ========================================== */
.btn-whatsapp {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.875rem 1.5rem;
    background: #25D366;
    color: white;
    border: none;
    border-radius: var(--radius-lg);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    width: 100%;
    text-decoration: none;
}

.btn-whatsapp:hover {
    background: #1da851;
    transform: translateY(-1px);
}

.btn-whatsapp svg {
    flex-shrink: 0;
}
