:root {
    --primary: #4d7a5f;
    --primary-hover: #3d6a4f;
    --primary-light: #e8f0eb;
    --accent: #b35c24;
    --bg: #f7f7f5;
    --card-bg: #ffffff;
    --text: #2c2c2c;
    --text-muted: #636363;
    --border: #e2e0db;
    --radius: 14px;
    --shadow: 0 2px 16px rgba(0,0,0,0.06);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100dvh;
    line-height: 1.6;
}

.container {
    max-width: 720px;
    margin: 0 auto;
    padding: 1rem 1rem;
}

header {
    text-align: center;
    margin-bottom: 1rem;
}

.logo {
    max-width: 500px;
    width: 100%;
    height: auto;
}


.tagline {
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 400;
    letter-spacing: 0.3px;
    margin-top: 0.25rem;
}

.section { margin-bottom: 2rem; }
.hidden { display: none !important; }

/* Landing Page */
.landing-hero {
    text-align: center;
    padding: 2rem 0 2.5rem;
}

.landing-hero h2 {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text);
    line-height: 1.3;
    margin-bottom: 1rem;
}

.landing-hero p {
    color: var(--text-muted);
    font-size: 1.05rem;
    line-height: 1.7;
    max-width: 540px;
    margin: 0 auto 1.5rem;
}

.landing-hero .btn-primary {
    width: auto;
    padding: 0.85rem 2.5rem;
    font-size: 1.1rem;
}

.landing-steps,
.landing-features,
.landing-pricing,
.landing-final {
    padding: 2rem 0;
}

.landing-steps h3,
.landing-features h3,
.landing-pricing h3,
.landing-final h3 {
    text-align: center;
    font-size: 1.4rem;
    color: var(--text);
    margin-bottom: 1.5rem;
}

/* Steps */
.steps-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}

.step-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 1.5rem;
    text-align: center;
    box-shadow: var(--shadow);
}

.step-icon {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    font-weight: 700;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 0.75rem;
}

.step-card h4 {
    font-size: 1.1rem;
    margin-bottom: 0.4rem;
    color: var(--text);
}

.step-card p {
    font-size: 0.9rem;
    color: var(--text-muted);
    line-height: 1.5;
}

/* Features */
.features-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.feature-item {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 1.25rem;
    box-shadow: var(--shadow);
}

.feature-item strong {
    display: block;
    font-size: 1rem;
    color: var(--primary);
    margin-bottom: 0.3rem;
}

.feature-item p {
    font-size: 0.9rem;
    color: var(--text-muted);
    line-height: 1.5;
    margin: 0;
}

/* Pricing */
.pricing-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    align-items: stretch;
}

.pricing-card {
    background: var(--card-bg);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    text-align: center;
    position: relative;
    display: flex;
    flex-direction: column;
}

.pricing-card-featured {
    border-color: var(--primary);
}

.pricing-badge {
    position: absolute;
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--primary);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.2rem 0.75rem;
    border-radius: 20px;
    white-space: nowrap;
}

.pricing-card h4 {
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
    color: var(--text);
}

.pricing-amount {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 1rem;
}

.pricing-amount span {
    font-size: 0.9rem;
    font-weight: 400;
    color: var(--text-muted);
}

.pricing-card ul {
    list-style: none;
    padding: 0;
    margin-bottom: 1.25rem;
    text-align: left;
    flex: 1;
}

.pricing-card li {
    padding: 0.3rem 0;
    font-size: 0.85rem;
    color: var(--text);
}

.pricing-card li::before {
    content: '\2713 ';
    color: var(--primary);
    font-weight: 600;
    margin-right: 0.4rem;
}

.pricing-card .btn-primary {
    width: 100%;
    font-size: 0.9rem;
    padding: 0.65rem 1rem;
    margin-top: auto;
}

.pricing-note {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-top: 1rem;
}

/* Final CTA */
.landing-final {
    text-align: center;
    background: var(--primary-light);
    border-radius: var(--radius);
    padding: 2.5rem 1.5rem;
    margin-top: 1rem;
}

.landing-final h3 {
    margin-bottom: 0.5rem;
}

.landing-final p {
    color: var(--text-muted);
    margin-bottom: 1.25rem;
}

.landing-final .btn-primary {
    width: auto;
    padding: 0.85rem 2.5rem;
    font-size: 1.05rem;
}

/* Language switcher */
.lang-switcher {
    display: flex;
    gap: 0.25rem;
    justify-content: center;
    margin-top: 0.5rem;
}

.lang-btn {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-muted);
    padding: 0.2rem 0.5rem;
    font-size: 0.7rem;
    border-radius: 4px;
    cursor: pointer;
    font-family: inherit;
}

.lang-btn.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

.ai-disclaimer {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-align: center;
    margin-top: 1rem;
    font-style: italic;
}

.btn-danger {
    background: transparent;
    color: #c0392b;
    border: 1px solid #c0392b;
    margin-top: 1rem;
}

.btn-danger:hover {
    background: #c0392b;
    color: #fff;
}

/* Upload Options */
.upload-options {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
}

.upload-option-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 2rem 1rem;
    font-size: 1rem;
    border-radius: var(--radius);
    cursor: pointer;
}

.upload-option-btn svg {
    opacity: 0.8;
}

.drop-zone-compact {
    padding: 1.5rem 1rem;
}

@media (max-width: 768px) {
    .drop-zone-compact,
    .desktop-only {
        display: none !important;
    }
}

/* Drop Zone */
.drop-zone {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 3rem 2rem;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
    background: var(--card-bg);
}

.drop-zone:hover,
.drop-zone.dragover {
    border-color: var(--primary);
    background: var(--primary-light);
}

.drop-zone-icon {
    width: 64px;
    height: 64px;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

.drop-zone-text {
    font-size: 1.1rem;
    font-weight: 500;
    margin-bottom: 0.25rem;
}

.drop-zone-hint {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* Preview */
.preview-wrapper {
    text-align: center;
    margin-bottom: 1.5rem;
}

.preview-wrapper img {
    max-width: 100%;
    max-height: 400px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    object-fit: contain;
}

.preview-small img {
    max-height: 200px;
}

#change-photo {
    margin-top: 0.75rem;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.75rem 2rem;
    border: none;
    border-radius: var(--radius);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
}

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

.btn-primary {
    background: var(--accent);
    color: #fff;
    width: 100%;
}

.btn-primary:hover { background: #9a4f1e; }

.btn-secondary {
    background: transparent;
    color: var(--text-muted);
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
}

.btn-secondary:hover { color: var(--text); }

/* Loading */
.loading {
    text-align: center;
    padding: 2rem 0;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 1rem;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading p {
    color: var(--text-muted);
    font-size: 1rem;
}

/* Results */
.results-content {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
    margin-bottom: 1.5rem;
    line-height: 1.7;
}

.results-content h2 {
    font-size: 1.3rem;
    margin: 1.5rem 0 0.75rem;
    color: var(--primary);
}

.results-content h2:first-child {
    margin-top: 0;
}

.results-content h3 {
    font-size: 1.1rem;
    margin: 1rem 0 0.5rem;
}

.results-content ul,
.results-content ol {
    padding-left: 1.5rem;
    margin-bottom: 0.75rem;
}

.results-content li {
    margin-bottom: 0.3rem;
}

.results-content p {
    margin-bottom: 0.75rem;
}

.results-content strong {
    color: var(--text);
}

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

.results-actions {
    flex-wrap: wrap;
}

.results-actions .btn-save {
    width: 100%;
    background: var(--card-bg);
    color: var(--primary);
    border: 2px solid var(--primary);
    margin-bottom: 0.25rem;
}

.results-actions .btn-save:hover {
    background: var(--primary-light);
}

.results-actions .btn-save:disabled {
    opacity: 0.6;
    cursor: default;
}

.results-actions .btn-primary {
    flex: 2;
}

.results-actions .btn-secondary {
    flex: 1;
    text-align: center;
}

/* Streaming cursor */
.results-content.streaming::after {
    content: '|';
    animation: blink 0.7s step-end infinite;
    color: var(--primary);
    font-weight: bold;
}

@keyframes blink {
    50% { opacity: 0; }
}

/* Error */
.error-box {
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: var(--radius);
    padding: 1.5rem;
    text-align: center;
    margin-bottom: 1.5rem;
    color: #991b1b;
}

/* User Bar */
.user-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    margin-top: 0.75rem;
    padding: 0.5rem 0;
}

.user-bar span {
    font-weight: 600;
    color: var(--text);
}

.btn-sm {
    padding: 0.35rem 0.75rem;
    font-size: 0.8rem;
}

/* Auth */
.auth-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 2rem;
    max-width: 400px;
    margin: 0 auto;
}

.auth-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 1.5rem;
    border-bottom: 2px solid var(--border);
}

.auth-tab {
    flex: 1;
    padding: 0.75rem;
    background: none;
    border: none;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: color 0.2s, border-color 0.2s;
}

.auth-tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.auth-form input {
    padding: 0.75rem 1rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 1rem;
    outline: none;
    transition: border-color 0.2s;
}

.auth-form input:focus {
    border-color: var(--primary);
}

/* OAuth */
.oauth-buttons {
    margin-bottom: 1rem;
}

.btn-google {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    width: 100%;
    padding: 0.7rem 1rem;
    background: #fff;
    color: #3c4043;
    border: 1px solid #dadce0;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.2s, box-shadow 0.2s;
}

.btn-google:hover {
    background: #f5f5f3;
    box-shadow: 0 1px 4px rgba(0,0,0,0.1);
}

.google-icon {
    flex-shrink: 0;
}

.auth-divider {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

.auth-error {
    color: #991b1b;
    font-size: 0.9rem;
    text-align: center;
    margin: 0;
}

/* History */
.history-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.history-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 0.75rem;
    cursor: pointer;
    transition: transform 0.1s, box-shadow 0.2s;
}

.history-card:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
}

.history-thumb {
    width: 72px;
    height: 72px;
    border-radius: 8px;
    object-fit: cover;
    flex-shrink: 0;
}

.history-thumb-placeholder {
    width: 72px;
    height: 72px;
    border-radius: 8px;
    background: var(--border);
    flex-shrink: 0;
}

.history-info h3 {
    font-size: 1rem;
    margin-bottom: 0.2rem;
}

.history-meta {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.loading-text,
.empty-text {
    text-align: center;
    color: var(--text-muted);
    padding: 2rem 0;
}

.error-text {
    text-align: center;
    color: #991b1b;
    padding: 2rem 0;
}

/* Ingredients Edit */
.ingredients-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.ingredients-card h2 {
    font-size: 1.3rem;
    color: var(--primary);
    margin-bottom: 0.25rem;
}

.ingredients-hint {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

.ingredients-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.ingredient-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.ingredient-input {
    flex: 1;
    padding: 0.6rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.2s;
}

.ingredient-input:focus {
    border-color: var(--primary);
}

.ingredient-remove {
    width: 36px;
    height: 36px;
    border: none;
    background: #fef2f2;
    color: #991b1b;
    border-radius: 8px;
    font-size: 1.2rem;
    cursor: pointer;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.ingredient-remove:hover {
    background: #fecaca;
}

.ingredients-add {
    display: flex;
    gap: 0.5rem;
}

.ingredients-add .ingredient-input {
    flex: 1;
}

.ingredients-add .btn {
    flex-shrink: 0;
}

#rescan-btn {
    width: 100%;
    margin-top: 0.5rem;
}

/* Scan Counter */
.scan-counter {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Upgrade Button */
.btn-upgrade {
    background: var(--accent);
    color: #fff;
    font-weight: 600;
}

.btn-upgrade:hover {
    background: #9a4f1e;
}

/* Upgrade Section */
.upgrade-card {
    text-align: center;
}

.upgrade-card h2 {
    color: var(--primary);
    margin-bottom: 0.5rem;
}

.upgrade-reason {
    color: var(--text-muted);
    margin-bottom: 1.5rem;
}

.tier-options {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.billing-toggle {
    display: flex;
    justify-content: center;
    gap: 0;
    margin-bottom: 1.5rem;
    background: var(--border);
    border-radius: 8px;
    padding: 3px;
    max-width: 320px;
    margin-left: auto;
    margin-right: auto;
}

.billing-tab {
    flex: 1;
    padding: 0.5rem 1rem;
    border: none;
    background: none;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    color: var(--text-muted);
    font-family: inherit;
    transition: background 0.2s, color 0.2s;
}

.billing-tab.active {
    background: var(--card-bg);
    color: var(--text);
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.save-badge {
    font-size: 0.7rem;
    background: var(--accent);
    color: #fff;
    padding: 0.1rem 0.4rem;
    border-radius: 4px;
    margin-left: 0.25rem;
}

.tier-card {
    flex: 1;
    background: var(--card-bg);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    text-align: center;
    transition: border-color 0.2s;
}

.tier-card-featured {
    border-color: var(--primary);
    position: relative;
}

.tier-card h3 {
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
}

.tier-price {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 1rem;
}

.tier-price span {
    font-size: 0.9rem;
    font-weight: 400;
    color: var(--text-muted);
}

.tier-card ul {
    list-style: none;
    padding: 0;
    margin-bottom: 1.25rem;
    text-align: left;
}

.tier-card li {
    padding: 0.3rem 0;
    font-size: 0.9rem;
    color: var(--text);
}

.tier-card li::before {
    content: '\2713 ';
    color: var(--primary);
    font-weight: 600;
    margin-right: 0.4rem;
}

.tier-card .btn-primary {
    width: 100%;
}

/* Save Counter */
.save-counter {
    text-align: center;
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

/* Toast */
.toast {
    position: fixed;
    top: 1rem;
    left: 50%;
    transform: translateX(-50%);
    background: var(--primary);
    color: #fff;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius);
    font-size: 0.95rem;
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 1000;
    transition: opacity 0.3s;
}

.toast.hidden {
    display: block !important;
    opacity: 0;
    pointer-events: none;
}

/* Disabled button */
.btn:disabled,
.btn[disabled] {
    opacity: 0.5;
    cursor: default;
}

#history-section h2 {
    color: var(--primary);
    margin-bottom: 1rem;
}

/* Profile */
.profile-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 2rem;
    max-width: 480px;
    margin: 0 auto;
}

.profile-card h2 {
    color: var(--primary);
    margin-bottom: 1.25rem;
}

.profile-info {
    margin-bottom: 1.5rem;
}

.profile-row {
    display: flex;
    justify-content: space-between;
    padding: 0.6rem 0;
    border-bottom: 1px solid var(--border);
}

.profile-label {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.profile-value {
    font-weight: 600;
    font-size: 0.9rem;
}

.profile-tier-badge {
    display: inline-block;
    padding: 0.15rem 0.6rem;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
}

.tier-free { background: var(--border); color: var(--text-muted); }
.tier-pro { background: var(--primary-light); color: var(--primary); }
.tier-pro-plus { background: var(--accent); color: #fff; }

.profile-features {
    margin-bottom: 1.5rem;
}

.profile-features h3 {
    font-size: 1rem;
    color: var(--text);
    margin-bottom: 0.75rem;
}

.profile-features ul {
    list-style: none;
    padding: 0;
}

.profile-features li {
    padding: 0.3rem 0;
    font-size: 0.9rem;
}

.profile-features li.feature-on::before {
    content: '\2713 ';
    color: var(--primary);
    font-weight: 600;
    margin-right: 0.4rem;
}

.profile-features li.feature-off::before {
    content: '\2717 ';
    color: var(--text-muted);
    margin-right: 0.4rem;
}

.profile-features li.feature-off {
    color: var(--text-muted);
}

.profile-actions {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

/* Meal Plan */
.meal-plan-scan-options {
    display: flex;
    gap: 0.5rem;
    margin: 1rem 0;
}

.meal-plan-scan-options .btn {
    flex: 1;
    text-align: center;
}

.meal-plan-days {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.meal-plan-days label {
    font-weight: 500;
    color: var(--text);
}

.meal-plan-days select {
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
    background: var(--card-bg);
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    padding: 1rem;
}

.modal.hidden {
    display: none !important;
}

.modal-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 2rem;
    max-width: 480px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 8px 32px rgba(0,0,0,0.2);
}

.modal-card h2 {
    color: var(--primary);
    margin-bottom: 1.25rem;
}

.modal-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

.modal-actions .btn-primary {
    flex: 1;
}

.modal-actions .btn-secondary {
    flex: 0;
}

/* Preference Chips */
.prefs-group {
    margin-bottom: 1.25rem;
}

.prefs-group h4 {
    font-size: 0.95rem;
    color: var(--text);
    margin-bottom: 0.5rem;
}

.prefs-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.chip {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.4rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 20px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
    user-select: none;
}

.chip:has(input:checked) {
    background: var(--primary-light);
    border-color: var(--primary);
    color: var(--primary);
}

.chip input {
    display: none;
}

/* Receipt Upload */
.receipt-upload {
    text-align: center;
    margin-top: 1rem;
}

.receipt-upload .btn {
    width: 100%;
}

/* Shopping List */
.shopping-list-wrapper {
    background: var(--primary-light);
    border-radius: var(--radius);
    padding: 1.25rem;
    margin-bottom: 1rem;
}

.shopping-list-wrapper h3 {
    color: var(--primary);
    font-size: 1.1rem;
    margin-bottom: 0.25rem;
}

.shopping-hint {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-bottom: 0.75rem;
}

.shopping-list-wrapper ul {
    padding-left: 1.25rem;
}

.shopping-list-wrapper li {
    padding: 0.2rem 0;
    font-size: 0.95rem;
}

/* Legal Pages */
.legal-content {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 2rem;
    margin-bottom: 2rem;
}

.legal-content h1 {
    color: var(--primary);
    font-size: 1.6rem;
    margin-bottom: 0.25rem;
}

.legal-date {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-bottom: 2rem;
}

.legal-content h2 {
    font-size: 1.1rem;
    color: var(--text);
    margin: 1.5rem 0 0.75rem;
}

.legal-content p,
.legal-content li {
    font-size: 0.9rem;
    line-height: 1.7;
    color: var(--text);
    margin-bottom: 0.5rem;
}

.legal-content ul {
    padding-left: 1.5rem;
    margin-bottom: 1rem;
}

.legal-content a {
    color: var(--primary);
}

/* Pricing Page */
.pricing-page h1 {
    text-align: center;
    color: var(--text);
    font-size: 1.6rem;
    margin-bottom: 0.5rem;
}

.pricing-intro {
    text-align: center;
    color: var(--text-muted);
    margin-bottom: 2rem;
}

.pricing-yearly {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: -0.75rem;
    margin-bottom: 1rem;
}

/* FAQ */
.faq-section {
    margin-top: 2.5rem;
}

.faq-section h2 {
    text-align: center;
    color: var(--primary);
    margin-bottom: 1.5rem;
}

.faq-item {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 1.25rem;
    margin-bottom: 0.75rem;
    box-shadow: var(--shadow);
}

.faq-item h3 {
    font-size: 1rem;
    color: var(--text);
    margin-bottom: 0.4rem;
}

.faq-item p {
    font-size: 0.9rem;
    color: var(--text-muted);
    line-height: 1.6;
    margin: 0;
}

.faq-item a {
    color: var(--primary);
}

/* Footer */
.site-footer {
    text-align: center;
    padding: 2rem 1rem;
    color: var(--text-muted);
    font-size: 0.8rem;
    margin-top: 2rem;
    border-top: 1px solid var(--border);
}

.site-footer a {
    color: var(--primary);
    text-decoration: none;
}

.site-footer a:hover {
    text-decoration: underline;
}

/* Cookie Banner */
.cookie-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--text);
    color: #fff;
    padding: 1rem 1.5rem;
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    box-shadow: 0 -4px 12px rgba(0,0,0,0.15);
}

.cookie-banner.hidden {
    display: none !important;
}

.cookie-banner p {
    font-size: 0.85rem;
    margin: 0;
    line-height: 1.5;
    flex: 1;
}

.cookie-banner a {
    color: #e8934f;
    text-decoration: underline;
}

.cookie-actions {
    display: flex;
    gap: 0.5rem;
    flex-shrink: 0;
}

.cookie-actions .btn-primary {
    width: auto;
    background: var(--accent);
}

.cookie-actions .btn-secondary {
    color: #ccc;
}

@media (max-width: 480px) {
    .cookie-banner {
        flex-direction: column;
        text-align: center;
        padding: 1rem;
    }

    .cookie-banner p {
        font-size: 0.8rem;
    }
}

/* Ads */
.ad-slot {
    margin: 1rem 0;
    text-align: center;
    min-height: 50px;
}

.ad-slot-landing {
    margin-top: 2rem;
    overflow: hidden;
    max-width: 100%;
}

/* Sidebar ads — desktop only */
.ad-sidebar {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    width: 160px;
    z-index: 10;
}

.ad-sidebar-left {
    left: 10px;
}

.ad-sidebar-right {
    right: 10px;
}

/* Hide sidebars when viewport is too narrow for them + content */
@media (max-width: 1100px) {
    .ad-sidebar {
        display: none !important;
    }
}

/* Responsive — Tablet */
@media (max-width: 768px) {
    .container {
        padding: 1.5rem 1rem;
    }


    .tagline {
        font-size: 1rem;
    }

    .preview-wrapper img {
        max-height: 300px;
    }

    .results-content {
        padding: 1.25rem;
    }
}

/* Responsive — Mobile */
@media (max-width: 480px) {
    .container {
        padding: 1rem 0.75rem;
    }

    header {
        margin-bottom: 1.25rem;
    }


    .tagline {
        font-size: 0.9rem;
    }

    /* User bar stacks on small screens */
    .user-bar {
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .user-bar span {
        width: 100%;
        text-align: center;
        font-size: 0.9rem;
    }

    .user-bar .btn-sm {
        padding: 0.25rem 0.5rem;
        font-size: 0.7rem;
    }

    /* Drop zone */
    .drop-zone {
        padding: 2rem 1rem;
    }

    .drop-zone-icon {
        width: 48px;
        height: 48px;
    }

    .drop-zone-text {
        font-size: 1rem;
    }

    .drop-zone-hint {
        font-size: 0.8rem;
    }

    /* Preview */
    .preview-wrapper img {
        max-height: 250px;
    }

    .preview-small img {
        max-height: 150px;
    }

    /* Buttons */
    .btn {
        padding: 0.7rem 1.5rem;
        font-size: 0.95rem;
    }

    .btn-sm {
        padding: 0.3rem 0.6rem;
        font-size: 0.75rem;
    }

    /* Auth */
    .auth-card {
        padding: 1.5rem 1rem;
        box-shadow: none;
        border: 1px solid var(--border);
    }

    .auth-tab {
        font-size: 0.9rem;
        padding: 0.6rem;
    }

    .auth-form input {
        padding: 0.7rem 0.85rem;
        font-size: 0.95rem;
    }

    /* Results */
    .results-content {
        padding: 1rem;
        border-radius: 8px;
    }

    .results-content h2 {
        font-size: 1.15rem;
        margin: 1.25rem 0 0.5rem;
    }

    .results-content h3 {
        font-size: 1rem;
    }

    .results-content ul,
    .results-content ol {
        padding-left: 1.25rem;
    }

    /* History */
    .history-card {
        gap: 0.75rem;
        padding: 0.6rem;
    }

    .history-thumb,
    .history-thumb-placeholder {
        width: 56px;
        height: 56px;
    }

    .history-info h3 {
        font-size: 0.9rem;
    }

    .history-meta {
        font-size: 0.8rem;
    }

    /* Error */
    .error-box {
        padding: 1rem;
    }

    /* Landing */
    .landing-hero h2 {
        font-size: 1.4rem;
    }

    .landing-hero p {
        font-size: 0.95rem;
    }

    .steps-grid {
        grid-template-columns: 1fr;
    }

    .features-grid {
        grid-template-columns: 1fr;
    }

    .pricing-grid {
        grid-template-columns: 1fr;
    }

    .landing-final {
        padding: 2rem 1rem;
    }

    /* Profile */
    .profile-card {
        padding: 1.25rem;
    }

    .profile-row {
        flex-direction: column;
        gap: 0.2rem;
    }

    /* Meal Plan */
    .meal-plan-scan-options {
        flex-direction: column;
    }

    /* Modal */
    .modal-card {
        padding: 1.25rem;
    }

    .prefs-chips {
        gap: 0.4rem;
    }

    .chip {
        font-size: 0.8rem;
        padding: 0.35rem 0.6rem;
    }

    /* Tiers */
    .tier-options {
        flex-direction: column;
    }

    .tier-card {
        padding: 1.25rem;
    }

    .tier-price {
        font-size: 1.6rem;
    }

    /* Ingredients */
    .ingredients-card {
        padding: 1rem;
    }

    .ingredient-input {
        padding: 0.55rem 0.65rem;
        font-size: 0.9rem;
    }

    /* Results actions wrap */
    .results-actions {
        flex-wrap: wrap;
    }

    .results-actions .btn-save {
        width: 100%;
    }

    .results-actions .btn-primary,
    .results-actions .btn-secondary {
        flex: 1;
    }

    /* Shopping list */
    .shopping-list-wrapper {
        padding: 1rem;
    }

    .shopping-list-wrapper h3 {
        font-size: 1rem;
    }

    /* Receipt upload */
    .receipt-upload .btn {
        font-size: 0.9rem;
    }

    /* Scan counter */
    .scan-counter {
        width: 100%;
        text-align: center;
        font-size: 0.75rem;
    }

    /* Upgrade cards */
    .upgrade-card {
        padding: 0;
    }

    .upgrade-card h2 {
        font-size: 1.2rem;
    }

    .upgrade-reason {
        font-size: 0.9rem;
    }

    /* Meal plan page */
    .meal-plan-days {
        margin-bottom: 0.75rem;
    }

    .meal-plan-days select {
        flex: 1;
    }

    /* Profile features */
    .profile-features li {
        font-size: 0.85rem;
    }
}

/* Responsive — Very small screens */
@media (max-width: 360px) {
    .container {
        padding: 0.75rem 0.5rem;
    }


    .drop-zone {
        padding: 1.5rem 0.75rem;
    }

    .drop-zone-icon {
        width: 40px;
        height: 40px;
    }

    .auth-card {
        padding: 1.25rem 0.75rem;
    }

    .btn {
        padding: 0.65rem 1rem;
        font-size: 0.9rem;
    }

    .preview-wrapper img {
        max-height: 200px;
    }

    .history-thumb,
    .history-thumb-placeholder {
        width: 48px;
        height: 48px;
        border-radius: 6px;
    }

    .profile-card {
        padding: 1rem 0.75rem;
    }

    .modal-card {
        padding: 1rem 0.75rem;
    }

    .meal-plan-scan-options .btn {
        font-size: 0.8rem;
        padding: 0.6rem 0.5rem;
    }

    .landing-hero .btn-primary,
    .landing-final .btn-primary {
        padding: 0.7rem 1.5rem;
        font-size: 0.95rem;
    }
}

/* Touch-friendly tap targets */
@media (pointer: coarse) {
    .btn {
        min-height: 44px;
    }

    .btn-sm {
        min-height: 36px;
        padding: 0.4rem 0.75rem;
    }

    .auth-form input {
        min-height: 44px;
    }

    .auth-tab {
        min-height: 44px;
    }

    .history-card {
        min-height: 60px;
    }

    .drop-zone {
        min-height: 180px;
    }

    .ingredient-remove {
        width: 44px;
        height: 44px;
    }

    .ingredient-input {
        min-height: 44px;
    }

    .chip {
        min-height: 36px;
    }

    .meal-plan-days select {
        min-height: 44px;
    }
}
