/* ==========================================
   FOODSILO — styles.css
   ========================================== */

/* Base */
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif; background: #f0f2f5; color: #333; min-height: 100vh; }
input, select, textarea, button { font-family: inherit; }
a { color: #2980b9; }

/* ==========================================
   LOADING SCREEN
   ========================================== */
#loading-screen { position: fixed; inset: 0; background: #2980b9; display: flex; align-items: center; justify-content: center; z-index: 9999; }
.loading-content { text-align: center; color: white; }
.loading-logo { font-size: 4rem; margin-bottom: 10px; }
.loading-content h2 { font-size: 2rem; margin-bottom: 20px; }
.loading-spinner { width: 40px; height: 40px; border: 4px solid rgba(255,255,255,0.3); border-top-color: white; border-radius: 50%; animation: spin 0.8s linear infinite; margin: 0 auto 15px; }
.loading-content p { opacity: 0.8; font-size: 0.95rem; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ==========================================
   AUTH SCREEN
   ========================================== */
#auth-screen { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #2980b9, #1a5276); padding: 20px; }
.auth-card { background: white; border-radius: 20px; padding: 36px 28px; width: 100%; max-width: 380px; box-shadow: 0 20px 60px rgba(0,0,0,0.2); text-align: center; }
.auth-logo { font-size: 3.5rem; margin-bottom: 8px; }
.auth-card h1 { font-size: 2rem; color: #2980b9; margin-bottom: 4px; }
.auth-tagline { color: #7f8c8d; font-size: 0.9rem; margin-bottom: 24px; }
.auth-card input { width: 100%; padding: 12px 16px; border: 2px solid #e8eaed; border-radius: 10px; font-size: 1rem; margin-bottom: 10px; transition: border-color 0.2s; }
.auth-card input:focus { outline: none; border-color: #2980b9; }
.auth-error { color: #e74c3c; font-size: 0.85rem; min-height: 20px; margin-bottom: 8px; }
.auth-btn { width: 100%; padding: 13px; margin-bottom: 10px; border: none; border-radius: 10px; font-size: 1rem; font-weight: 600; cursor: pointer; }
.auth-divider { color: #bdc3c7; font-size: 0.85rem; margin: 4px 0 12px; }
.google-btn { width: 100%; padding: 12px; background: white; border: 2px solid #e0e0e0; border-radius: 10px; font-size: 0.95rem; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 10px; font-weight: 600; color: #444; transition: background 0.2s; }
.google-btn:hover { background: #f8f8f8; }
.google-icon { font-weight: 900; color: #4285F4; font-size: 1.1rem; }
.auth-legal { font-size: 0.75rem; color: #bdc3c7; margin-top: 16px; }

/* ==========================================
   ONBOARDING MODAL
   ========================================== */
.onboarding-box { max-width: 500px; max-height: 90vh; overflow-y: auto; }
.onboarding-header { text-align: center; padding-bottom: 16px; border-bottom: 2px solid #ecf0f1; margin-bottom: 20px; }
.onboarding-logo { font-size: 2.5rem; }
.onboarding-header h2 { color: #2980b9; margin: 6px 0 4px; }
.onboarding-progress { color: #95a5a6; font-size: 0.85rem; }
.onboarding-icon { font-size: 3rem; text-align: center; margin-bottom: 10px; }
.onboarding-step h3 { text-align: center; color: #2c3e50; margin-bottom: 8px; font-size: 1.2rem; }
.onboarding-step p { color: #555; text-align: center; margin-bottom: 14px; font-size: 0.95rem; line-height: 1.5; }
.ob-field { margin-bottom: 12px; }
.ob-field label { display: block; font-weight: 600; font-size: 0.9rem; color: #555; margin-bottom: 4px; }
.ob-field input, .ob-field select { width: 100%; padding: 10px 12px; border: 2px solid #dde; border-radius: 8px; font-size: 1rem; }
.ob-field small { display: block; color: #95a5a6; font-size: 0.78rem; margin-top: 3px; }
.ob-two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 14px; }
.ob-col-label { font-weight: 700; color: #2980b9; font-size: 0.9rem; margin-bottom: 8px; }
.ob-section-label { font-weight: 700; color: #555; font-size: 0.9rem; margin: 14px 0 8px; }
.ob-macro-toggles { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.ob-macro-toggle { display: flex; align-items: center; gap: 8px; background: #f8f9fa; border: 2px solid #e0e0e0; border-radius: 8px; padding: 10px 12px; cursor: pointer; font-size: 0.9rem; font-weight: 600; transition: border-color 0.2s; }
.ob-macro-toggle:has(input:checked) { border-color: #2980b9; background: #f0f7ff; }
.onboarding-footer { display: flex; align-items: center; justify-content: space-between; margin-top: 24px; padding-top: 16px; border-top: 2px solid #ecf0f1; }
.btn-text-link { background: none; border: none; color: #95a5a6; font-size: 0.85rem; cursor: pointer; text-decoration: underline; padding: 8px; }

/* ==========================================
   APP HEADER
   ========================================== */
.app-header { background: #2980b9; color: white; padding: 10px 14px; display: flex; align-items: center; justify-content: space-between; position: relative; z-index: 1; box-shadow: 0 2px 8px rgba(0,0,0,0.15); }
.header-left { display: flex; align-items: center; gap: 8px; }
.header-logo { font-size: 1.4rem; }
.header-icon-img { width: 30px; height: 30px; display: block; object-fit: contain; }
.header-title { font-size: 1.2rem; font-weight: 700; letter-spacing: 0.5px; }
.header-right { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }

/* ==========================================
   STREAK BADGE
   ========================================== */
.streak-badge { display: flex; align-items: center; gap: 4px; background: #2980b9; color: white; border-radius: 20px; padding: 4px 10px; font-size: 0.82rem; font-weight: 700; border: 2px solid rgba(255,255,255,0.4); transition: background 0.3s; }

/* ==========================================
   TAB BAR
   ========================================== */
.tab-bar { display: flex; background: #1a6fa0; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; position: relative; }
.tab-bar::-webkit-scrollbar { display: none; }
.tab-btn { flex: 1; min-width: 70px; padding: 10px 6px; background: none; border: none; color: rgba(255,255,255,0.65); font-size: 0.78rem; cursor: pointer; white-space: nowrap; transition: color 0.2s, border-bottom 0.2s; border-bottom: 3px solid transparent; font-weight: 600; }
.tab-btn.active { color: white; border-bottom-color: white; }
.sub-tab-bar { display: flex; background: #ecf0f1; border-bottom: 2px solid #ddd; }
.sub-tab-btn { flex: 1; padding: 10px; background: none; border: none; color: #7f8c8d; font-size: 0.9rem; cursor: pointer; font-weight: 600; border-bottom: 3px solid transparent; transition: all 0.2s; }
.sub-tab-btn.active { color: #2980b9; border-bottom-color: #2980b9; background: white; }
.badge { background: #e74c3c; color: white; border-radius: 10px; padding: 1px 6px; font-size: 0.75rem; margin-left: 4px; }

/* ==========================================
   TAB CONTENT
   ========================================== */
.tab-container { padding: 0; }
.tab-content { display: none; padding: 12px; }
.tab-content.active { display: block; }

/* ==========================================
   CARDS
   ========================================== */
.card { background: white; border-radius: 14px; box-shadow: 0 2px 8px rgba(0,0,0,0.07); padding: 16px; margin-bottom: 12px; }
.card h2 { font-size: 1.1rem; color: #2c3e50; margin-bottom: 12px; }
.card h3 { font-size: 1rem; color: #2c3e50; margin-bottom: 10px; }
.card-header-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; flex-wrap: wrap; gap: 6px; }
.card-header-row h3 { margin-bottom: 0; }
.card-collapse-header { display: flex; align-items: center; justify-content: space-between; cursor: pointer; padding: 4px 0; }
.toggle-icon { color: #95a5a6; font-size: 0.85rem; margin-left: 6px; }
.btn-icon { background: none; border: none; color: #95a5a6; font-size: 0.75rem; cursor: pointer; padding: 0; }

/* ==========================================
   BUTTONS
   ========================================== */
.btn { padding: 10px 16px; border: none; border-radius: 10px; font-size: 0.9rem; font-weight: 600; cursor: pointer; transition: opacity 0.15s, transform 0.1s; }
.btn:active { transform: scale(0.97); }
.btn-add { background: #27ae60; color: white; }
.btn-save { background: #2980b9; color: white; }
.btn-reset { background: #e74c3c; color: white; }
.btn-pack { background: #8e44ad; color: white; }
.btn-scan { background: #e67e22; color: white; }
.btn-small { padding: 7px 12px; font-size: 0.82rem; border-radius: 8px; }
.btn-tiny { padding: 4px 8px; font-size: 0.75rem; border-radius: 6px; }
.add-item-fab { width: 100%; margin-top: 10px; padding: 12px; border-radius: 12px; font-size: 1rem; }

/* ==========================================
   SETUP BANNER
   ========================================== */
.setup-banner { background: #fef9e7; border: 2px solid #f1c40f; border-radius: 10px; padding: 12px 16px; margin-bottom: 12px; font-size: 0.9rem; color: #7f6000; }

/* ==========================================
   MODE TOGGLE
   ========================================== */
.mode-toggle-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.mode-label { color: #7f8c8d; font-size: 0.9rem; }
.mode-btn { padding: 8px 16px; border: 2px solid #ddd; border-radius: 20px; background: #f8f8f8; color: #555; font-size: 0.88rem; font-weight: 600; cursor: pointer; transition: all 0.2s; }
.mode-btn.active { background: #2980b9; border-color: #2980b9; color: white; }
.tracker-meta-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; font-size: 0.82rem; color: #7f8c8d; }

/* ==========================================
   MACRO PROGRESS BARS
   ========================================== */
.macro-row { margin-bottom: 14px; }
.macro-label-row { display: flex; justify-content: space-between; align-items: center; font-size: 0.9rem; margin-bottom: 5px; }
.progress-track { background: #ecf0f1; border-radius: 8px; height: 14px; overflow: hidden; }
.progress-bar { height: 100%; border-radius: 8px; transition: width 0.4s ease; min-width: 0; }
.protein-bar  { background: linear-gradient(90deg, #27ae60, #2ecc71); }
.calorie-bar  { background: linear-gradient(90deg, #e67e22, #f39c12); }
.fat-bar      { background: linear-gradient(90deg, #9b59b6, #8e44ad); }
.carbs-bar    { background: linear-gradient(90deg, #e74c3c, #c0392b); }
.fiber-bar    { background: linear-gradient(90deg, #1abc9c, #16a085); }
.sodium-bar   { background: linear-gradient(90deg, #3498db, #2980b9); }
.weight-bar   { background: linear-gradient(90deg, #2980b9, #27ae60); }
.water-bar    { background: linear-gradient(90deg, #3498db, #74b9ff); }
.steps-bar    { background: linear-gradient(90deg, #8e44ad, #9b59b6); }

/* ==========================================
   WATER TRACKING
   ========================================== */
.water-btns { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.water-btns .btn { flex: 1; min-width: 80px; }

/* ==========================================
   LOG FOOD FORM
   ========================================== */
.log-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 10px 0; }
.log-form-row { display: flex; flex-direction: column; gap: 4px; }
.log-form-row label { font-size: 0.8rem; color: #7f8c8d; font-weight: 600; }
.log-form-row input { padding: 9px; border: 2px solid #e0e0e0; border-radius: 8px; font-size: 0.95rem; width: 100%; }
.log-form-row input:focus { outline: none; border-color: #2980b9; }
.log-action-row { display: flex; gap: 8px; flex-wrap: wrap; }
.log-action-row .btn-add { flex: 1; }

/* ==========================================
   CONSUMED LIST
   ========================================== */
.consumed-item { display: flex; justify-content: space-between; align-items: flex-start; padding: 10px 0; border-bottom: 1px solid #f0f0f0; }
.consumed-item:last-child { border-bottom: none; }
.consumed-time { color: #95a5a6; margin-left: 6px; font-size: 0.78rem; }

/* ==========================================
   SAVED MEALS
   ========================================== */
.saved-meal-item { display: flex; justify-content: space-between; align-items: center; padding: 10px 0; border-bottom: 1px solid #f0f0f0; gap: 10px; }
.saved-meal-item:last-child { border-bottom: none; }
.saved-meal-info { flex: 1; }
.saved-meal-info strong { display: block; font-size: 0.95rem; color: #2c3e50; }
.saved-meal-info small { color: #7f8c8d; font-size: 0.8rem; }
.saved-meal-btns { display: flex; gap: 6px; align-items: center; }
.save-meal-preview { font-size: 0.82rem; color: #7f8c8d; background: #f8f9fa; border-radius: 8px; padding: 8px 12px; margin-bottom: 12px; line-height: 1.5; }

/* ==========================================
   WEEKLY SUMMARY
   ========================================== */
.weekly-summary-card { border-left: 4px solid #2980b9; }
.weekly-stat-row { display: flex; justify-content: space-between; align-items: center; padding: 7px 0; border-bottom: 1px solid #f0f0f0; font-size: 0.9rem; }
.weekly-stat-row:last-child { border-bottom: none; }
.weekly-stat-row span { color: #555; }
.weekly-stat-row strong { font-weight: 700; }
.protein-value { color: #27ae60; }
.calorie-value { color: #e67e22; }
.weight-value  { color: #2980b9; }

/* ==========================================
   HISTORY
   ========================================== */
.history-actions { margin-bottom: 10px; }
.history-card { background: white; border-radius: 12px; padding: 14px; margin-bottom: 10px; box-shadow: 0 2px 6px rgba(0,0,0,0.06); cursor: pointer; transition: box-shadow 0.2s; }
.history-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,0.1); }
.history-card-header { display: flex; align-items: flex-start; gap: 10px; }
.history-card-right { display: flex; align-items: center; gap: 10px; }
.history-details { display: none; margin-top: 10px; border-top: 1px solid #ecf0f1; padding-top: 10px; }
.history-card.expanded .history-details { display: block; }
.history-detail-item { display: flex; align-items: center; gap: 8px; padding: 5px 0; font-size: 0.85rem; color: #555; }
.history-burn-row { display: flex; flex-wrap: wrap; gap: 12px; font-size: 0.82rem; padding: 8px 0; margin-top: 6px; border-top: 1px solid #ecf0f1; }
.weight-history-card { cursor: default; }
.weight-log-right { display: flex; align-items: center; gap: 10px; }

/* ==========================================
   WEIGHT
   ========================================== */
.weight-journey-display { display: flex; justify-content: space-around; margin-bottom: 10px; text-align: center; }
.weight-stat { font-size: 0.85rem; color: #7f8c8d; }
.weight-stat.current strong { color: #2980b9; font-size: 1.1rem; }
.log-weight-row { display: flex; gap: 8px; margin-top: 12px; }
.log-weight-row input { flex: 1; padding: 10px; border: 2px solid #e0e0e0; border-radius: 10px; font-size: 1rem; }

/* ==========================================
   PANTRY / INVENTORY
   ========================================== */
.pantry-toolbar { display: flex; gap: 8px; padding: 10px 0 6px; align-items: center; }
.pantry-sort-bar { display: flex; gap: 6px; align-items: center; padding-bottom: 8px; flex-wrap: wrap; }
.filter-input { flex: 1; min-width: 100px; padding: 8px 10px; border: 2px solid #e0e0e0; border-radius: 8px; font-size: 0.88rem; }
.sort-select { padding: 7px 8px; border: 2px solid #e0e0e0; border-radius: 8px; font-size: 0.82rem; background: white; }
.pantry-list { list-style: none; padding: 0; }
.pantry-item { background: white; border-radius: 12px; padding: 12px; margin-bottom: 8px; box-shadow: 0 2px 6px rgba(0,0,0,0.06); }
.pantry-item.low-stock-alert { border-left: 4px solid #f1c40f; }
.pantry-item-header { display: flex; align-items: flex-start; gap: 10px; }
.item-photo-placeholder { width: 38px; height: 38px; border-radius: 8px; background: #f0f4ff; display: flex; align-items: center; justify-content: center; font-size: 1.3rem; flex-shrink: 0; }
.pantry-item-info { flex: 1; min-width: 0; }
.pantry-item-name-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 2px; }
.item-name-link { cursor: pointer; color: #2c3e50; font-size: 0.95rem; }
.item-name-link:hover { color: #2980b9; }
.item-macros { color: #7f8c8d; font-size: 0.8rem; }
.item-meta { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.item-meta-tag { background: #eaf4fb; color: #2980b9; border-radius: 6px; padding: 2px 7px; font-size: 0.72rem; }
.exp-tag { border-radius: 6px; padding: 2px 7px; font-size: 0.72rem; }
.exp-ok       { background: #eafaf1; color: #1e8449; }
.exp-soon     { background: #fef9e7; color: #7f6000; }
.exp-expired  { background: #fdf0f0; color: #c0392b; }
.store-tag { background: #f3e9ff; color: #6c3483; border-radius: 6px; padding: 2px 7px; font-size: 0.72rem; }
.star-btn { cursor: pointer; font-size: 1rem; line-height: 1; }
.pantry-item-footer { display: flex; justify-content: space-between; align-items: center; margin-top: 10px; padding-top: 10px; border-top: 1px solid #f0f0f0; gap: 6px; flex-wrap: nowrap; overflow-x: auto; }
.qty-controls { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }
.btn-qty { width: 28px; height: 28px; border: 2px solid #e0e0e0; border-radius: 8px; background: white; font-size: 1rem; cursor: pointer; display: flex; align-items: center; justify-content: center; font-weight: 700; color: #555; flex-shrink: 0; }
.qty-display { font-size: 0.85rem; color: #555; white-space: nowrap; }
.pantry-action-btns { display: flex; gap: 4px; flex-shrink: 0; flex-wrap: nowrap; }
.shopping-item { border-left: 4px solid #3498db; }
.shopping-item-footer { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; padding-top: 8px; border-top: 1px solid #f0f0f0; flex-wrap: wrap; gap: 8px; }
.restock-controls { display: flex; gap: 6px; align-items: center; }
.restock-qty-input { width: 60px; padding: 6px 8px; border: 2px solid #e0e0e0; border-radius: 8px; font-size: 0.9rem; }
.store-input-inline { padding: 5px 8px; border: 1.5px solid #e0e0e0; border-radius: 6px; font-size: 0.8rem; width: 130px; }

/* ==========================================
   LUNCHBOX
   ========================================== */
.macro-summary-tag { background: #f0f4ff; color: #2980b9; border-radius: 8px; padding: 4px 10px; font-size: 0.82rem; font-weight: 600; }
.lunchbox-item { display: flex; justify-content: space-between; align-items: center; padding: 10px 0; border-bottom: 1px solid #f0f0f0; gap: 10px; }
.lunchbox-item:last-child { border-bottom: none; }
.lunchbox-item-info { flex: 1; font-size: 0.9rem; }
.lunchbox-item-btns { display: flex; gap: 5px; flex-wrap: wrap; }
.qty-highlight { color: #8e44ad; font-weight: 700; }
.per-one-label { color: #95a5a6; font-size: 0.75rem; }

/* ==========================================
   SEARCH / SUGGESTIONS
   ========================================== */
.search-wrapper { position: relative; }
.search-wrapper input { width: 100%; padding: 10px 12px; border: 2px solid #e0e0e0; border-radius: 10px; font-size: 0.95rem; }
.search-wrapper input:focus { outline: none; border-color: #2980b9; }
.suggestions-box { position: absolute; top: calc(100% + 4px); left: 0; right: 0; background: white; border: 2px solid #e0e0e0; border-radius: 10px; z-index: 200; max-height: 220px; overflow-y: auto; box-shadow: 0 4px 12px rgba(0,0,0,0.12); }
.suggestion-item { padding: 10px 12px; cursor: pointer; border-bottom: 1px solid #f0f0f0; transition: background 0.15s; }
.suggestion-item:last-child { border-bottom: none; }
.suggestion-item:hover { background: #f0f7ff; }
.suggestion-name { display: block; font-size: 0.88rem; color: #2c3e50; font-weight: 600; }
.suggestion-macros { display: block; font-size: 0.77rem; color: #95a5a6; margin-top: 2px; }
.search-status-msg { padding: 10px 12px; color: #7f8c8d; font-size: 0.85rem; }
.search-error { color: #e74c3c; }

/* ==========================================
   MODALS
   ========================================== */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 1000; display: flex; align-items: flex-end; justify-content: center; padding: 0; }
@media (min-width: 500px) { .modal-overlay { align-items: center; padding: 20px; } }
.modal-box { background: white; border-radius: 20px 20px 0 0; width: 100%; max-width: 520px; max-height: 90vh; overflow-y: auto; padding: 20px; }
@media (min-width: 500px) { .modal-box { border-radius: 16px; } }
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.modal-header h2 { font-size: 1.1rem; color: #2c3e50; }
.modal-close { background: #ecf0f1; border: none; border-radius: 50%; width: 32px; height: 32px; font-size: 1rem; cursor: pointer; color: #555; display: flex; align-items: center; justify-content: center; }
.modal-form { display: flex; flex-direction: column; gap: 10px; }
.modal-form input, .modal-form select { padding: 11px 12px; border: 2px solid #e0e0e0; border-radius: 10px; font-size: 0.95rem; width: 100%; }
.modal-form input:focus, .modal-form select:focus { outline: none; border-color: #2980b9; }
.modal-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.modal-form-grid label { display: block; font-size: 0.78rem; color: #7f8c8d; font-weight: 600; margin-bottom: 4px; }
.modal-form-grid input { padding: 8px 10px; }

/* ==========================================
   SETTINGS MODAL
   ========================================== */
.settings-modal-box { border-radius: 20px 20px 0 0; max-width: 560px; }
@media (min-width: 500px) { .settings-modal-box { border-radius: 16px; } }
.settings-section { border-top: 2px solid #ecf0f1; padding-top: 16px; margin-top: 16px; }
.settings-section h3 { color: #2c3e50; font-size: 1rem; margin-bottom: 12px; }
.settings-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.settings-row label { font-size: 0.88rem; color: #555; font-weight: 600; min-width: 140px; }
.settings-row input, .settings-row select { flex: 1; min-width: 100px; padding: 8px 10px; border: 2px solid #e0e0e0; border-radius: 8px; font-size: 0.9rem; }
.settings-day-row { display: flex; justify-content: space-between; align-items: center; padding: 6px 0; font-size: 0.88rem; }
.settings-day-row select { padding: 5px 8px; border: 2px solid #e0e0e0; border-radius: 8px; font-size: 0.85rem; }
.macro-toggle-row { margin-bottom: 4px; }
.macro-toggle-label { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 0.9rem; color: #2c3e50; cursor: pointer; padding: 6px 0; }
.macro-goal-row { background: #f8f9fa; border-radius: 8px; padding: 10px; margin-bottom: 8px; display: flex; flex-direction: column; gap: 6px; }
.settings-footer { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 20px; padding-top: 16px; border-top: 2px solid #ecf0f1; }
.settings-footer .btn { flex: 1; min-width: 100px; text-align: center; }

/* Sync cards */
.sync-card { background: #f8f9fa; border-radius: 12px; padding: 14px; }
.sync-card-header { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 12px; }
.sync-card-icon { font-size: 1.8rem; }
.sync-card-header strong { display: block; font-size: 0.95rem; color: #2c3e50; }
.sync-card-header small { color: #7f8c8d; font-size: 0.8rem; }
.sync-status { font-size: 0.82rem; margin-top: 6px; }
.toggle-label { display: flex; align-items: center; gap: 8px; font-size: 0.88rem; color: #555; padding: 4px 0; cursor: pointer; }
.csv-status { border-radius: 8px; padding: 10px 12px; font-size: 0.85rem; margin-top: 8px; }

/* Meal Builder Modal */
.meal-builder-box { max-height: 90vh; overflow-y: auto; }
.meal-builder-items { max-height: 220px; overflow-y: auto; border: 1.5px solid #e0e7ef; border-radius: 8px; padding: 4px 8px; margin: 8px 0; }
.meal-builder-item-row { display: flex; align-items: center; justify-content: space-between; padding: 7px 0; border-bottom: 1px solid #f0f4f8; gap: 8px; }
.meal-builder-item-row:last-child { border-bottom: none; }
.mb-item-name { flex: 1; font-size: 0.88rem; font-weight: 600; }
.mb-item-controls { display: flex; align-items: center; gap: 5px; flex-shrink: 0; }
.mb-qty { min-width: 24px; text-align: center; font-weight: 700; font-size: 0.85rem; }
.mb-macros { font-size: 0.75rem; color: #7f8c8d; min-width: 70px; text-align: right; }
.meal-builder-totals { display: flex; gap: 12px; justify-content: center; background: #f0f4ff; border-radius: 8px; padding: 8px; margin: 6px 0; font-weight: 700; font-size: 0.9rem; }
.meal-builder-actions { display: flex; gap: 8px; margin-top: 12px; }
.meal-builder-actions .btn { flex: 1; font-size: 0.82rem; }

/* Saved meal ingredients list */
.saved-meal-expanded { display: none; padding: 6px 0; }
.saved-meal-item:hover .saved-meal-expanded { display: block; }
.saved-meal-ingredient { font-size: 0.8rem; color: #555; padding: 2px 0; }

/* Add to List button */
.btn-list { background: #8e44ad; color: white; border: none; }
.btn-list:hover { background: #7d3c98; }

/* Dark mode meal builder */
body.dark-mode .meal-builder-items { border-color: #374151; }
body.dark-mode .meal-builder-item-row { border-bottom-color: #374151; }
body.dark-mode .meal-builder-totals { background: #1d3553; }
body.dark-mode .saved-meal-ingredient { color: #8899b0; }
.gfit-reconnect-banner { background: #2980b9; color: white; padding: 10px 14px; display: flex; align-items: center; gap: 10px; font-size: 0.88rem; font-weight: 600; border-radius: 10px; margin-bottom: 10px; }
.gfit-reconnect-banner span { flex: 1; }
.btn-dismiss { background: none; border: none; color: rgba(255,255,255,0.7); font-size: 1rem; cursor: pointer; padding: 2px 6px; line-height: 1; }
.btn-dismiss:hover { color: white; }
body.dark-mode .gfit-reconnect-banner { background: #1a5080; }

/* Google Fit weight notice */
.google-fit-weight-status { background: #eafaf1; border: 1.5px solid #27ae60; border-radius: 8px; padding: 8px 12px; font-size: 0.85rem; color: #1e8449; margin-bottom: 12px; }

/* ==========================================
   REMOVE BUTTON
   ========================================== */
.remove { color: #e74c3c; cursor: pointer; font-size: 0.9rem; padding: 2px 6px; border-radius: 6px; flex-shrink: 0; }
.remove:hover { background: #fdf0f0; }

/* ==========================================
   NOTE / HELP
   ========================================== */
.note { color: #7f8c8d; font-size: 0.83rem; line-height: 1.5; }
.help-steps { padding-left: 20px; }
.help-steps li { margin-bottom: 10px; line-height: 1.5; font-size: 0.9rem; }
.help-steps li strong { color: #2c3e50; }

/* ==========================================
   RESPONSIVE
   ========================================== */
@media (max-width: 360px) {
    .tab-btn { font-size: 0.7rem; padding: 8px 4px; }
    .ob-two-col { grid-template-columns: 1fr; }
    .log-form-grid { grid-template-columns: 1fr; }
    .modal-form-grid { grid-template-columns: 1fr; }
}
@media (min-width: 600px) {
    .tab-container { max-width: 680px; margin: 0 auto; }
    .app-header { max-width: 100%; }
}

/* ==========================================
   EMPTY STATES
   ========================================== */
.empty-state { text-align: center; padding: 32px 16px 24px; }
.empty-state-emoji { font-size: 3rem; margin-bottom: 10px; line-height: 1; }
.empty-state-title { font-size: 1rem; font-weight: 700; color: #444; margin-bottom: 6px; }
.empty-state-sub { font-size: 0.85rem; color: #95a5a6; line-height: 1.6; max-width: 240px; margin: 0 auto; }

/* ==========================================
   DARK MODE TOGGLE BUTTON
   ========================================== */
.dark-mode-btn { background: rgba(255,255,255,0.15); border: 1.5px solid rgba(255,255,255,0.3); color: white; border-radius: 8px; padding: 5px 9px; font-size: 1rem; cursor: pointer; line-height: 1; transition: background 0.2s; }
.dark-mode-btn:hover { background: rgba(255,255,255,0.25); }

/* ==========================================
   DARK MODE
   ========================================== */
body.dark-mode { background: #111827; color: #e1e7ef; }

/* Cards + raised surfaces */
body.dark-mode .card,
body.dark-mode .history-card,
body.dark-mode .pantry-item { background: #1f2937; box-shadow: 0 2px 8px rgba(0,0,0,0.4); }

body.dark-mode .card h2,
body.dark-mode .card h3,
body.dark-mode .card-collapse-header { color: #e1e7ef; }

/* Header stays blue but slightly darker */
body.dark-mode .app-header { background: #1a5080; }
body.dark-mode .tab-bar { background: #163d5e; }

/* Sub tabs */
body.dark-mode .sub-tab-bar { background: #1f2937; border-bottom-color: #374151; }
body.dark-mode .sub-tab-btn { color: #8899b0; }
body.dark-mode .sub-tab-btn.active { background: #1f2937; color: #60a5fa; border-bottom-color: #60a5fa; }

/* Modals */
body.dark-mode .modal-box { background: #1f2937; }
body.dark-mode .modal-overlay { background: rgba(0,0,0,0.75); }
body.dark-mode .modal-header h2 { color: #e1e7ef; }
body.dark-mode .modal-close { background: #374151; color: #c0cce0; }

/* Inputs / selects */
body.dark-mode input,
body.dark-mode select,
body.dark-mode textarea { background: #253044; border-color: #374151 !important; color: #e1e7ef; }
body.dark-mode input::placeholder { color: #5a6880; }
body.dark-mode input:focus,
body.dark-mode select:focus { border-color: #60a5fa !important; }
body.dark-mode .store-input-inline { background: #253044; color: #e1e7ef; }

/* Progress bars */
body.dark-mode .progress-track { background: #374151; }

/* Mode buttons */
body.dark-mode .mode-btn { background: #253044; border-color: #374151; color: #8899b0; }
body.dark-mode .mode-btn.active { background: #2980b9; border-color: #2980b9; color: white; }
body.dark-mode .mode-label { color: #8899b0; }

/* Qty controls */
body.dark-mode .btn-qty { background: #253044; border-color: #374151; color: #e1e7ef; }

/* Pantry items */
body.dark-mode .pantry-item-footer,
body.dark-mode .shopping-item-footer { border-top-color: #374151; }
body.dark-mode .item-macros { color: #6b7a8e; }
body.dark-mode .item-name-link { color: #e1e7ef; }
body.dark-mode .item-name-link:hover { color: #60a5fa; }
body.dark-mode .item-meta-tag { background: #1d3553; color: #60a5fa; }

/* Sort/filter */
body.dark-mode .filter-input,
body.dark-mode .sort-select { background: #253044; border-color: #374151; color: #e1e7ef; }
body.dark-mode .pantry-sort-bar { color: #e1e7ef; }

/* Search suggestions */
body.dark-mode .suggestions-box { background: #1f2937; border-color: #374151; box-shadow: 0 4px 12px rgba(0,0,0,0.4); }
body.dark-mode .suggestion-item { border-bottom-color: #374151; }
body.dark-mode .suggestion-item:hover { background: #253044; }
body.dark-mode .suggestion-name { color: #e1e7ef; }
body.dark-mode .suggestion-macros { color: #6b7a8e; }
body.dark-mode .search-status-msg { color: #6b7a8e; }

/* Lists */
body.dark-mode .consumed-item,
body.dark-mode .lunchbox-item,
body.dark-mode .saved-meal-item { border-bottom-color: #374151; }
body.dark-mode .saved-meal-info strong,
body.dark-mode .lunchbox-item-info { color: #e1e7ef; }
body.dark-mode .macro-summary-tag { background: #1d3553; color: #60a5fa; }
body.dark-mode .save-meal-preview { background: #253044; color: #8899b0; }

/* History */
body.dark-mode .history-details { border-top-color: #374151; }
body.dark-mode .history-burn-row { border-top-color: #374151; }
body.dark-mode .history-detail-item { color: #c0cce0; }

/* Weight */
body.dark-mode .weight-stat { color: #8899b0; }
body.dark-mode .log-weight-row input { background: #253044; }

/* Settings modal */
body.dark-mode .settings-section { border-top-color: #374151; }
body.dark-mode .settings-section h3 { color: #e1e7ef; }
body.dark-mode .settings-row label { color: #b0bac8; }
body.dark-mode .settings-day-row { color: #b0bac8; }
body.dark-mode .macro-goal-row { background: #253044; }
body.dark-mode .macro-toggle-label { color: #e1e7ef; }
body.dark-mode .settings-footer { border-top-color: #374151; }
body.dark-mode .toggle-label { color: #b0bac8; }
body.dark-mode .sync-card { background: #253044; }
body.dark-mode .sync-card-header strong { color: #e1e7ef; }
body.dark-mode .google-fit-weight-status { background: #0d2b1a; border-color: #27ae60; color: #2ecc71; }

/* Setup banner */
body.dark-mode .setup-banner { background: #3a2d00; border-color: #7a5d00; color: #ffc107; }

/* Notes */
body.dark-mode .note { color: #6b7a8e; }
body.dark-mode .empty-state-title { color: #b0bac8; }

/* Remove button */
body.dark-mode .remove:hover { background: #3d1515; }

/* Weekly summary */
body.dark-mode .weekly-stat-row { border-bottom-color: #374151; }
body.dark-mode .weekly-stat-row span { color: #8899b0; }
body.dark-mode .weekly-summary-card { border-left-color: #60a5fa; }

/* Onboarding */
body.dark-mode .onboarding-box { background: #1f2937; }
body.dark-mode .onboarding-header { border-bottom-color: #374151; }
body.dark-mode .onboarding-header h2 { color: #60a5fa; }
body.dark-mode .onboarding-step h3 { color: #e1e7ef; }
body.dark-mode .onboarding-step p { color: #b0bac8; }
body.dark-mode .onboarding-progress { color: #6b7a8e; }
body.dark-mode .ob-field label,
body.dark-mode .ob-section-label,
body.dark-mode .ob-col-label { color: #8899b0; }
body.dark-mode .ob-macro-toggle { background: #253044; border-color: #374151; color: #e1e7ef; }
body.dark-mode .ob-macro-toggle:has(input:checked) { border-color: #60a5fa; background: #1a3050; }
body.dark-mode .onboarding-footer { border-top-color: #374151; }
body.dark-mode .btn-text-link { color: #6b7a8e; }

/* Auth screen (edge case dark mode visit) */
body.dark-mode .auth-card { background: #1f2937; }
body.dark-mode .auth-card h1 { color: #60a5fa; }
body.dark-mode .auth-tagline { color: #8899b0; }
body.dark-mode .auth-legal { color: #6b7a8e; }
body.dark-mode .auth-divider { color: #6b7a8e; }
body.dark-mode .google-btn { background: #253044; border-color: #374151; color: #e1e7ef; }
body.dark-mode .google-btn:hover { background: #2d3a50; }

/* Help steps */
body.dark-mode .help-steps li strong { color: #e1e7ef; }
body.dark-mode .help-steps li { color: #b0bac8; }

/* ==========================================
   CONSUMED ITEM EDIT BUTTON
   ========================================== */
.consumed-item { display: flex; justify-content: space-between; align-items: center; padding: 8px 0; border-bottom: 1px solid #f0f4f8; }
.consumed-item-info { flex: 1; }
.consumed-item-btns { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }

/* ==========================================
   STREAK BADGES MODAL
   ========================================== */
.streak-badge-row { display: flex; align-items: center; gap: 14px; padding: 10px 0; border-bottom: 1px solid #f0f4f8; }
.streak-badge-row:last-child { border-bottom: none; }
.streak-badge-row div { flex: 1; }
body.dark-mode .streak-badge-row { border-bottom-color: #374151; }
#streakDisplay { cursor: pointer; }
#streakDisplay:hover { opacity: 0.85; }

/* ==========================================
   INFO BUTTON
   ========================================== */
.info-btn { background: #3498db; color: white; border: none; border-radius: 50%; width: 20px; height: 20px; font-size: 0.75rem; font-weight: 700; cursor: pointer; line-height: 1; margin-left: 6px; vertical-align: middle; }
.info-btn:hover { background: #2980b9; }

/* ==========================================
   MEAL BUILDER MANUAL FORM
   ========================================== */
.mb-manual-form { background: #f0f4ff; border-radius: 10px; padding: 12px; margin-bottom: 8px; }
body.dark-mode .mb-manual-form { background: #1d3553; }

/* ==========================================
   REMAINING PANTRY TAG
   ========================================== */
.remaining-tag { background: #eafaf1; color: #1e8449; }
body.dark-mode .remaining-tag { background: #0d2b1a; color: #2ecc71; }

/* ==========================================
   PREFERRED FOOD STAR
   ========================================== */
.pref-star { margin-left: 4px; font-size: 0.75rem; }

/* ==========================================
   LIFETIME STATS
   ========================================== */
.weekly-stat-row { display: flex; justify-content: space-between; align-items: center; padding: 7px 0; border-bottom: 1px solid #f0f4f8; font-size: 0.88rem; }
.weekly-stat-row:last-child { border-bottom: none; }
body.dark-mode .weekly-stat-row { border-bottom-color: #374151; }
body.dark-mode .weekly-stat-row span { color: #8899b0; }

/* ==========================================
   MEAL GROUP CARD IN PACKED & READY
   ========================================== */
.lunchbox-meal-group { background: #f8faff; border: 1.5px solid #d0e4f7; border-radius: 12px; margin-bottom: 10px; overflow: hidden; }
.lunchbox-meal-header { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; cursor: pointer; gap: 10px; }
.lunchbox-meal-header:hover { background: #eef4fb; }
.lunchbox-meal-title { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.lunchbox-meal-title strong { font-size: 0.95rem; }
.lunchbox-meal-title small { color: #7f8c8d; font-size: 0.78rem; }
.meal-expand-icon { margin-right: 6px; color: #2980b9; font-size: 0.85rem; }
.lunchbox-meal-items { border-top: 1px solid #d0e4f7; padding: 6px 10px; }
.lunchbox-sub-item { display: flex; align-items: center; justify-content: space-between; padding: 7px 4px; border-bottom: 1px solid #eef4fb; gap: 8px; }
.lunchbox-sub-item:last-child { border-bottom: none; }
.lunchbox-sub-info { flex: 1; font-size: 0.85rem; }

body.dark-mode .lunchbox-meal-group { background: #1a2535; border-color: #2d4a6b; }
body.dark-mode .lunchbox-meal-header:hover { background: #1d3553; }
body.dark-mode .lunchbox-meal-items { border-top-color: #2d4a6b; }
body.dark-mode .lunchbox-sub-item { border-bottom-color: #253044; }

/* ==========================================
   PHOTO FEATURE
   ========================================== */
.photo-upload-section { margin: 10px 0; }
.photo-preview-area { width: 100%; height: 130px; border: 2px dashed #c0cfe0; border-radius: 10px; display: flex; align-items: center; justify-content: center; cursor: pointer; overflow: hidden; position: relative; background: #f8faff; transition: border-color 0.2s; }
.photo-preview-area:hover { border-color: #2980b9; }
.photo-preview-placeholder { display: flex; flex-direction: column; align-items: center; gap: 6px; color: #95a5a6; font-size: 0.85rem; }
.photo-preview-placeholder span:first-child { font-size: 2rem; }
.photo-preview-img { width: 100%; height: 100%; object-fit: cover; border-radius: 8px; }
.photo-btn-row { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.photo-upload-status { font-size: 0.8rem; padding: 4px 8px; border-radius: 6px; margin-top: 6px; }
.photo-status-info { background: #eaf4ff; color: #2980b9; }
.photo-status-success { background: #eafaf1; color: #27ae60; }
.photo-status-error { background: #fdf0f0; color: #e74c3c; }

/* Photo thumbnail in pantry list */
.item-photo-thumb { width: 38px; height: 38px; object-fit: cover; border-radius: 8px; display: block; }
.item-photo-placeholder { width: 38px; height: 38px; border-radius: 8px; background: #f0f4ff; display: flex; align-items: center; justify-content: center; font-size: 1.3rem; flex-shrink: 0; overflow: hidden; }

/* Dark mode photo */
body.dark-mode .photo-preview-area { background: #1d3553; border-color: #374151; }
body.dark-mode .photo-preview-placeholder { color: #5a6880; }
body.dark-mode .photo-status-info { background: #1d3553; }
body.dark-mode .photo-status-success { background: #0d2b1a; color: #2ecc71; }
body.dark-mode .photo-status-error { background: #2b0d0d; color: #e74c3c; }

/* ==========================================
   STREAK BADGE GRID
   ========================================== */
.badge-grid { display: flex; flex-wrap: wrap; gap: 14px; justify-content: center; margin-bottom: 8px; }
.badge-grid-item { display: flex; flex-direction: column; align-items: center; gap: 5px; width: 80px; }
.badge-img { width: 72px; height: 72px; object-fit: contain; }
.badge-locked { opacity: 0.35; filter: grayscale(80%); }
.badge-grid-label { font-size: 0.72rem; font-weight: 700; text-align: center; color: #555; line-height: 1.3; }
.badge-grid-sub { font-size: 0.68rem; color: #95a5a6; text-align: center; }
.badge-grid-item.earned .badge-img { filter: drop-shadow(0 0 6px rgba(255,200,50,0.5)); }
body.dark-mode .badge-grid-label { color: #b0bac8; }

/* ==========================================
   LABEL SCAN STATUS
   ========================================== */
.label-scan-status { display: flex; align-items: center; gap: 8px; background: #eaf4ff; border-radius: 8px; padding: 8px 12px; margin-top: 8px; font-size: 0.85rem; color: #2980b9; font-weight: 600; }
.label-scan-spinner { font-size: 1.1rem; animation: spin 1.5s linear infinite; }
@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
body.dark-mode .label-scan-status { background: #1d3553; color: #60a5fa; }

/* ==========================================
   STICKY TOP WRAPPER
   ========================================== */
.sticky-top-wrapper { position: sticky; top: 0; z-index: 101; display: flex; flex-direction: column; }
body.dark-mode .sticky-top-wrapper { background: #1a5080; }

/* Search disclaimer */
.search-disclaimer { font-size: 0.75rem; color: #e67e22; background: #fef9f0; border-top: 1px solid #f0e0c0; padding: 7px 12px; border-radius: 0 0 10px 10px; line-height: 1.4; }
body.dark-mode .search-disclaimer { background: #2d2000; color: #f0a030; border-top-color: #4a3800; }

/* Password toggle */
.password-input-wrapper { position: relative; width: 100%; }
.password-input-wrapper input { width: 100%; padding-right: 44px; box-sizing: border-box; }
.password-toggle { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); background: none; border: none; cursor: pointer; font-size: 1.1rem; padding: 4px; line-height: 1; color: #95a5a6; }
.password-toggle:hover { color: #555; }
body.dark-mode .password-toggle { color: #5a6880; }
body.dark-mode .password-toggle:hover { color: #b0bac8; }

/* Danger zone */
.danger-zone { border-top: 2px solid #e74c3c !important; }
.btn-danger { background: #e74c3c; color: white; border: none; padding: 10px 20px; border-radius: 8px; cursor: pointer; font-size: 0.9rem; font-weight: 600; }
.btn-danger:hover { background: #c0392b; }
body.dark-mode .danger-zone { border-top-color: #c0392b !important; }