/* ===========================
   CSS Variables & Light Theme
   Redesign: Gestalt + Marketing Psychology
   Target: Deal-seekers from Instagram (mobile-first)
   =========================== */
:root {
    /* Primary - Savings Green */
    --primary: #059669;
    --primary-light: #10b981;
    --primary-dark: #047857;
    --primary-50: #ecfdf5;
    --primary-100: #d1fae5;

    /* Accent - Action Orange */
    --accent: #f97316;
    --accent-light: #fdba74;
    --accent-dark: #ea580c;
    --accent-50: #fff7ed;

    /* Semantic */
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --danger-50: #fef2f2;

    /* Supermarket Colors */
    --california: #dc2626;
    --yaguar: #0d9488;
    --hiperlibertad: #ca8a04;
    --multiexpress: #1e40af;
    --changomas: #ea580c;
    --hiperdelpollo: #7c3aed;
    --maxiconsumo: #0891b2;
    --vital: #16a34a;

    /* Neutrals */
    --bg: #f5f7fa;
    --bg-white: #ffffff;
    --bg-card: #ffffff;
    --bg-muted: #f1f5f9;
    --bg-dark: #0f172a;
    --text: #1e293b;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --border: #e2e8f0;
    --border-hover: #cbd5e1;

    /* Shadows */
    --shadow-xs: 0 1px 2px rgba(0,0,0,0.04);
    --shadow-sm: 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 -1px rgba(0,0,0,0.04);
    --shadow-lg: 0 10px 25px -5px rgba(0,0,0,0.08), 0 8px 10px -6px rgba(0,0,0,0.04);
    --shadow-xl: 0 20px 40px -10px rgba(0,0,0,0.12);
    --shadow-green: 0 4px 14px rgba(5, 150, 105, 0.3);
    --shadow-orange: 0 4px 14px rgba(249, 115, 22, 0.3);

    /* Spacing */
    --space-xs: 0.25rem;
    --space-sm: 0.5rem;
    --space-md: 1rem;
    --space-lg: 1.5rem;
    --space-xl: 2rem;
    --space-2xl: 3rem;
    --space-3xl: 4rem;

    /* Typography */
    --text-xs: 0.75rem;
    --text-sm: 0.8125rem;
    --text-base: 0.9375rem;
    --text-lg: 1.125rem;
    --text-xl: 1.25rem;
    --text-2xl: 1.5rem;
    --text-3xl: 2rem;

    /* Border Radius */
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    --radius-2xl: 1.25rem;
    --radius-full: 9999px;

    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-normal: 200ms ease;
    --transition-slow: 300ms ease;
    --transition-bounce: 300ms cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

/* ===========================
   Reset & Base
   =========================== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    min-height: 100dvh;
    line-height: 1.6;
    font-size: var(--text-base);
    -webkit-font-smoothing: antialiased;
}

.container { max-width: 1200px; margin: 0 auto; padding: 0 var(--space-lg); }

/* Skip link */
.skip-link {
    position: absolute; left: -9999px; top: auto; z-index: 999;
    padding: var(--space-sm) var(--space-md);
    background: var(--primary); color: white; border-radius: var(--radius-md);
    font-size: var(--text-sm); text-decoration: none;
}
.skip-link:focus { left: var(--space-md); top: var(--space-md); }

/* ===========================
   Header
   =========================== */
.header {
    background: var(--bg-white);
    box-shadow: var(--shadow-sm);
    position: sticky; top: 0; z-index: 100;
}

.header-inner {
    display: flex; align-items: center; justify-content: space-between;
    padding: var(--space-md) var(--space-lg); gap: var(--space-lg);
}

.logo { display: flex; align-items: center; gap: var(--space-sm); text-decoration: none; }
.logo-icon { width: 36px; height: 36px; display: block; flex-shrink: 0; border-radius: 9px; box-shadow: 0 2px 6px -2px rgba(5, 150, 105, 0.35); }
.logo-text { font-size: var(--text-xl); font-weight: 800; letter-spacing: -0.03em; color: var(--text); }
.logo-accent { color: var(--primary); }

.nav { display: flex; gap: var(--space-xs); }

.nav-btn {
    display: flex; align-items: center; gap: 6px;
    padding: var(--space-sm) var(--space-md);
    background: transparent; border: none;
    border-radius: var(--radius-full);
    color: var(--text-muted); font-size: var(--text-sm); font-weight: 500;
    cursor: pointer; transition: all var(--transition-normal);
}
.nav-btn:hover { background: var(--bg-muted); color: var(--text); }
.nav-btn:active { transform: scale(0.96); }
.nav-btn.active {
    background: var(--primary-50);
    color: var(--primary);
    font-weight: 600;
}
.nav-icon { width: 18px; height: 18px; display: block; flex-shrink: 0; }
.nav-label { white-space: nowrap; }

/* ===========================
   Main Content
   =========================== */
.main { padding: var(--space-xl) 0 var(--space-2xl); min-height: calc(100vh - 200px); }
.view { display: none; }
.view.active { display: block; animation: fadeIn 0.3s ease; }
.view-title { font-size: var(--text-2xl); font-weight: 700; margin-bottom: var(--space-xl); color: var(--text); }

@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* ===========================
   Hero Section
   =========================== */
.hero {
    text-align: center;
    margin-bottom: var(--space-xl);
    padding: var(--space-lg) 0 var(--space-md);
}

.hero-title {
    font-size: clamp(1.75rem, 5vw, var(--text-3xl));
    font-weight: 800; margin-bottom: var(--space-sm);
    color: var(--text);
    line-height: 1.2;
}

.gradient-text {
    color: var(--primary);
    position: relative;
}

.hero-subtitle {
    color: var(--text-secondary);
    font-size: var(--text-lg);
    margin-bottom: var(--space-lg);
}

/* Hero Stats */
.hero-stats {
    display: flex; justify-content: center; gap: var(--space-xl);
    flex-wrap: wrap; margin-top: var(--space-md);
}

.stat-item {
    text-align: center; min-width: 80px;
    padding: var(--space-sm) var(--space-md);
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xs);
}

.stat-number {
    display: block; font-size: var(--text-2xl); font-weight: 800;
    color: var(--primary); line-height: 1.2;
}
.stat-number small { font-size: 0.6em; }
.stat-label {
    font-size: var(--text-xs); color: var(--text-muted);
    text-transform: uppercase; letter-spacing: 0.05em; font-weight: 500;
}

/* ===========================
   Search Container
   =========================== */
.search-container {
    max-width: 680px; margin: 0 auto var(--space-lg); position: relative;
}

.search-form { margin-bottom: var(--space-md); }

.search-input-wrapper {
    display: flex; align-items: center;
    background: var(--bg-white);
    border: 2px solid var(--border);
    border-radius: var(--radius-2xl);
    padding: var(--space-xs) var(--space-xs) var(--space-xs) var(--space-sm);
    transition: all var(--transition-normal);
    box-shadow: var(--shadow-md);
}
.search-input-wrapper:focus-within {
    border-color: var(--primary);
    box-shadow: var(--shadow-lg), 0 0 0 4px var(--primary-50);
}

.search-icon { padding: 0 var(--space-sm); color: var(--text-muted); display: flex; align-items: center; }
.search-icon svg { display: block; }

#search-input {
    flex: 1; background: transparent; border: none;
    color: var(--text); font-size: var(--text-base);
    padding: var(--space-md) var(--space-sm); outline: none; font-family: inherit;
}
#search-input::placeholder { color: var(--text-muted); }

.search-inline-actions {
    display: flex;
    align-items: center;
    gap: 2px;
    flex-shrink: 0;
}

.search-btn {
    background: var(--primary);
    border: none; border-radius: var(--radius-xl);
    color: white; font-size: 1.2rem;
    width: 44px; height: 44px;
    cursor: pointer; transition: all var(--transition-normal);
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.search-btn:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: var(--shadow-green);
}
.search-btn:active { transform: scale(0.97); }
.search-btn.loading { opacity: 0.7; pointer-events: none; }

/* Search Suggestions */
.search-suggestions {
    position: absolute; top: calc(100% - var(--space-xs)); left: 0; right: 0;
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    max-height: 320px; overflow-y: auto; z-index: 50;
}
.suggestion-header {
    padding: var(--space-sm) var(--space-md);
    color: var(--text-muted); font-size: var(--text-xs);
    text-transform: uppercase; letter-spacing: 0.05em;
    background: var(--bg-muted);
    font-weight: 600;
}
.suggestion-item {
    padding: var(--space-sm) var(--space-md); cursor: pointer;
    display: flex; align-items: center; gap: var(--space-sm);
    transition: background var(--transition-fast);
    font-size: var(--text-sm); color: var(--text);
}
.suggestion-item:hover, .suggestion-item.active { background: var(--primary-50); }
.suggestion-icon { display: inline-flex; align-items: center; color: var(--text-muted); }
.suggestion-icon svg { width: 14px; height: 14px; }
.suggestion-icon.hot { color: #fb7185; }

/* ===========================
   Filter Chips
   =========================== */
.filter-chips {
    display: flex; flex-wrap: wrap; gap: var(--space-sm);
    margin-bottom: var(--space-xl); justify-content: center;
}

.chip {
    display: inline-flex; align-items: center; gap: 6px;
    padding: var(--space-sm) var(--space-md);
    background: var(--bg-white);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-full);
    color: var(--text-secondary); font-size: var(--text-sm);
    cursor: pointer; transition: all var(--transition-fast);
    white-space: nowrap; font-family: inherit; font-weight: 500;
    box-shadow: var(--shadow-xs);
}
.chip:hover {
    border-color: var(--primary-light);
    color: var(--primary);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}
.chip:active { transform: scale(0.96); }
.chip.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
    box-shadow: var(--shadow-green);
}
.chip.active[data-supermarket="california"] { background: var(--california); border-color: var(--california); }
.chip.active[data-supermarket="yaguar"] { background: var(--yaguar); border-color: var(--yaguar); }
.chip.active[data-supermarket="hiperlibertad"] { background: var(--hiperlibertad); border-color: var(--hiperlibertad); }
.chip.active[data-supermarket="multiexpress"] { background: var(--multiexpress); border-color: var(--multiexpress); }
.chip.active[data-supermarket="changomas"] { background: var(--changomas); border-color: var(--changomas); }
.chip.active[data-supermarket="hiperdelpollo"] { background: var(--hiperdelpollo); border-color: var(--hiperdelpollo); }
.chip.active[data-supermarket="maxiconsumo"] { background: var(--maxiconsumo); border-color: var(--maxiconsumo); }
.chip.active[data-supermarket="vital"] { background: var(--vital); border-color: var(--vital); }
.chip.active .store-dot { background: white; }

.store-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.store-dot.california { background: var(--california); }
.store-dot.yaguar { background: var(--yaguar); }
.store-dot.hiperlibertad { background: var(--hiperlibertad); }
.store-dot.multiexpress { background: var(--multiexpress); }
.store-dot.changomas { background: var(--changomas); }
.store-dot.hiperdelpollo { background: var(--hiperdelpollo); }
.store-dot.maxiconsumo { background: var(--maxiconsumo); }
.store-dot.vital { background: var(--vital); }

.chip-suggestion {
    background: var(--primary-50);
    border-color: var(--primary-100);
    color: var(--primary);
}
.chip-suggestion:hover {
    background: var(--primary);
    color: white;
}

/* ===========================
   Section Header
   =========================== */
.section-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: var(--space-lg); gap: var(--space-md);
}
.section-title { font-size: var(--text-xl); font-weight: 700; color: var(--text); }
.section-header-actions { display: flex; align-items: center; gap: var(--space-sm); }

.cache-indicator { font-size: var(--text-xs); color: var(--text-muted); }
.refresh-btn {
    background: var(--bg-white); border: 1px solid var(--border);
    border-radius: var(--radius-full); width: 36px; height: 36px;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; transition: all var(--transition-normal);
    font-size: 1rem; color: var(--text-muted);
}
.refresh-btn:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-50); }
.refresh-btn:active { transform: scale(0.9); }
.refresh-btn.spinning { animation: spin 0.8s linear infinite; }

@keyframes spin { to { transform: rotate(360deg); } }

/* ===========================
   Deals Section (horizontal scroll)
   =========================== */
.deals-section { margin-bottom: var(--space-2xl); }

.deals-scroll {
    display: flex; gap: var(--space-md);
    overflow-x: auto; scroll-snap-type: x mandatory;
    padding-bottom: var(--space-sm);
    scrollbar-width: none; -ms-overflow-style: none;
    -webkit-overflow-scrolling: touch;
}
.deals-scroll::-webkit-scrollbar { display: none; }

.deal-card {
    min-width: 200px; max-width: 240px;
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl); overflow: hidden;
    scroll-snap-align: start; flex-shrink: 0;
    cursor: pointer; transition: all var(--transition-normal);
    box-shadow: var(--shadow-sm);
}
.deal-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--danger);
}

.deal-card-image {
    height: 130px; background: var(--bg-muted);
    display: flex; align-items: center; justify-content: center;
    overflow: hidden; position: relative;
}
.deal-card-image img { max-width: 90%; max-height: 90%; object-fit: contain; }
.deal-store-tag {
    position: absolute; top: 0; left: 0; z-index: 2;
    color: white; font-size: 0.65rem; font-weight: 700;
    padding: 3px 10px;
    border-radius: 0 0 var(--radius-md) 0;
    line-height: 1.3;
}
.deal-store-tag.california { background: #e53e3e; }
.deal-store-tag.yaguar { background: #38a169; }
.deal-store-tag.hiperlibertad { background: #d69e2e; }
.deal-store-tag.multiexpress { background: #3182ce; }
.deal-store-tag.changomas { background: #dd6b20; }
.deal-store-tag.hiperdelpollo { background: #805ad5; }
.deal-store-tag.maxiconsumo { background: #0694a2; }
.deal-discount-badge {
    position: absolute; top: var(--space-sm); right: var(--space-sm);
    background: var(--danger); color: white;
    padding: 3px 10px; border-radius: var(--radius-full);
    font-size: var(--text-xs); font-weight: 700;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.3);
}

.deal-card-info { padding: var(--space-md); }
.deal-card-name {
    font-size: var(--text-sm); font-weight: 600; line-height: 1.3;
    margin-bottom: var(--space-sm); color: var(--text);
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.deal-card-prices { display: flex; align-items: baseline; gap: var(--space-sm); }
.deal-price-current { font-size: var(--text-lg); font-weight: 800; color: var(--primary); }
.deal-price-original { font-size: var(--text-xs); color: var(--danger); text-decoration: line-through; }

/* ===========================
   Results Grid
   =========================== */
.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: var(--space-lg);
}

/* ===========================
   Tier dividers (relevance buckets)
   Backend asigna A/B/C en cada producto (tier-classifier.js). Cuando el
   ordenamiento en la grilla cruza un cambio de tier, insertamos uno de
   estos para que el usuario entienda por qué pasamos de "leche" a
   "alfajor de leche" en vez de pensar que el buscador está roto.
   =========================== */
.tier-divider {
    grid-column: 1 / -1;
    display: flex;
    align-items: baseline;
    gap: var(--space-md);
    padding: var(--space-sm) var(--space-md);
    margin: var(--space-md) 0 calc(var(--space-sm) * -1) 0;
    border-left: 4px solid var(--primary, #2563eb);
    background: linear-gradient(90deg, rgba(37,99,235,0.06), transparent);
    border-radius: 4px;
}
.tier-divider.tier-1 {
    border-left-color: #f59e0b;
    background: linear-gradient(90deg, rgba(245,158,11,0.06), transparent);
}
.tier-divider.tier-2 {
    border-left-color: #94a3b8;
    background: linear-gradient(90deg, rgba(148,163,184,0.06), transparent);
}
.tier-divider-label {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text, #0f172a);
}
.tier-divider-sub {
    font-size: 0.8rem;
    color: var(--text-muted, #64748b);
}
@media (max-width: 520px) {
    .tier-divider { flex-direction: column; align-items: flex-start; gap: 2px; }
}

/* ===========================
   Product Card
   =========================== */
.product-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-2xl);
    overflow: hidden; transition: all var(--transition-normal);
    position: relative;
    box-shadow: var(--shadow-sm);
}
.product-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--border-hover);
}
.product-card.cheapest {
    border-color: var(--primary-light);
    box-shadow: 0 0 0 1px var(--primary-light), var(--shadow-md);
}

/* Card animation */
@keyframes cardFadeIn {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: translateY(0); }
}
.product-card.animate-in { opacity: 0; animation: cardFadeIn 0.4s ease forwards; }

.product-image-wrapper {
    position: relative; height: 180px;
    background: var(--bg-muted); display: flex;
    align-items: center; justify-content: center; overflow: hidden;
}
.product-image-wrapper.image-fallback::after {
    content: 'Sin imagen'; position: absolute; bottom: var(--space-sm);
    left: 50%; transform: translateX(-50%);
    font-size: var(--text-xs); color: var(--text-muted); opacity: 0.6;
}

.product-image {
    max-width: 90%; max-height: 90%; object-fit: contain;
    transition: transform var(--transition-slow);
}
.product-card:hover .product-image { transform: scale(1.05); }

.product-badges {
    position: absolute; top: var(--space-sm); left: var(--space-sm);
    display: flex; flex-direction: column; gap: var(--space-xs);
}

.badge {
    padding: 3px 10px; border-radius: var(--radius-full);
    font-size: var(--text-xs); font-weight: 700;
    box-shadow: var(--shadow-sm);
}
.badge-cheapest { background: var(--primary); color: white; }
.badge-offer { background: var(--danger); color: white; }
.badge-savings { background: var(--warning); color: white; }
.badge-stores { background: var(--primary); color: white; }

.supermarket-tag {
    position: absolute; top: var(--space-sm); right: var(--space-sm);
    padding: 4px var(--space-sm); border-radius: var(--radius-sm);
    font-size: 0.7rem; font-weight: 700; color: white;
    box-shadow: var(--shadow-sm);
}
.supermarket-tag.california { background: var(--california); }
.supermarket-tag.yaguar { background: var(--yaguar); }
.supermarket-tag.hiperlibertad { background: var(--hiperlibertad); }
.supermarket-tag.multiexpress { background: var(--multiexpress); }
.supermarket-tag.changomas { background: var(--changomas); }
.supermarket-tag.hiperdelpollo { background: var(--hiperdelpollo); }
.supermarket-tag.maxiconsumo { background: var(--maxiconsumo); }

.product-info { padding: var(--space-md); }

.product-name {
    font-size: var(--text-base); font-weight: 600; line-height: 1.4;
    margin-bottom: var(--space-sm); color: var(--text);
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}

.product-prices {
    display: flex; align-items: baseline; gap: var(--space-sm);
    margin-bottom: var(--space-md);
}
.price-current { font-size: var(--text-2xl); font-weight: 800; color: var(--primary); }
.price-original { font-size: var(--text-sm); color: var(--danger); text-decoration: line-through; }

.product-actions { display: flex; gap: var(--space-sm); }

.action-btn {
    flex: 1; display: flex; align-items: center; justify-content: center; gap: 4px;
    padding: var(--space-sm);
    border: 1px solid var(--border);
    border-radius: var(--radius-md); background: var(--bg-white);
    color: var(--text-secondary); font-size: var(--text-sm);
    cursor: pointer; transition: all var(--transition-fast); font-family: inherit;
}
.action-btn:hover { background: var(--bg-muted); color: var(--text); border-color: var(--border-hover); }
.action-btn:active { transform: scale(0.96); }
.action-btn.favorite.active {
    background: var(--danger-50);
    border-color: var(--danger);
    color: var(--danger);
}
@keyframes heartPulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.25); } }
.action-btn.favorite.pulse { animation: heartPulse 0.3s ease; }
.action-btn.view-link { color: var(--primary); text-decoration: none; font-weight: 500; }
.action-btn.view-link:hover { background: var(--primary-50); border-color: var(--primary-light); }

/* ===========================
   Inline Price History Chart
   =========================== */
.product-card.chart-expanded {
    border-color: var(--primary-light);
    box-shadow: 0 0 0 1px var(--primary-light), var(--shadow-lg);
}

.inline-chart-section {
    border-top: 1px solid var(--border);
    animation: fadeIn 0.3s ease;
}
.inline-chart-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: var(--space-sm) var(--space-md);
    background: var(--bg-muted);
}
.inline-chart-title {
    font-size: var(--text-xs); font-weight: 700;
    color: var(--text-secondary); text-transform: uppercase;
    letter-spacing: 0.05em;
}
.inline-chart-body {
    padding: var(--space-sm) var(--space-md) var(--space-md);
    min-height: 100px;
}
.inline-chart-body canvas { max-height: 200px; }
.inline-chart-loading {
    display: flex; flex-direction: column; align-items: center;
    justify-content: center; padding: var(--space-lg) 0;
}
.inline-chart-empty {
    text-align: center; color: var(--text-muted);
    font-size: var(--text-sm); padding: var(--space-lg) 0;
}
.inline-chart-legend {
    text-align: center; color: var(--text-muted);
    font-size: var(--text-xs); margin-top: var(--space-sm);
}

/* ===========================
   Vote Button
   =========================== */
.action-btn.vote-btn {
    gap: 4px; font-weight: 600;
}
.action-btn.vote-btn .vote-icon { font-size: 0.9rem; }
.action-btn.vote-btn .vote-count {
    font-size: var(--text-xs); color: var(--text-muted);
    min-width: 12px; text-align: center;
}
.action-btn.vote-btn.voted {
    background: var(--primary-50);
    border-color: var(--primary-light);
    color: var(--primary);
}
.action-btn.vote-btn.voted .vote-count { color: var(--primary); font-weight: 700; }
.action-btn.vote-btn:hover { background: var(--primary-50); border-color: var(--primary-light); color: var(--primary); }

/* ===========================
   Offers Section
   =========================== */
.offers-section { margin-bottom: var(--space-2xl); }

.offer-tabs { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: var(--space-sm); }

.offer-tab {
    padding: 4px var(--space-sm); border: none;
    border-radius: var(--radius-sm); color: white;
    font-size: 0.7rem; font-weight: 700; font-family: inherit;
    cursor: pointer; opacity: 0.5; transition: all var(--transition-fast);
}
.offer-tab.active { opacity: 1; transform: scale(1.05); box-shadow: var(--shadow-sm); }
.offer-tab:hover { opacity: 0.8; }

.offer-price-display {
    display: flex; align-items: center; gap: var(--space-sm);
    margin-bottom: var(--space-sm);
}

/* Price Bars */
.price-bars { margin-bottom: var(--space-sm); }
.price-bar-row {
    display: flex; align-items: center; gap: var(--space-sm);
    margin-bottom: 5px; font-size: var(--text-xs);
}
.price-bar-label {
    width: 75px; text-align: right; color: var(--text-secondary);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex-shrink: 0;
    font-weight: 500;
}
.price-bar-track {
    flex: 1; height: 8px; background: var(--bg-muted);
    border-radius: 4px; overflow: hidden;
}
.price-bar-fill {
    height: 100%; border-radius: 4px;
    transition: width 0.6s ease;
}
.price-bar-fill.cheapest { background: var(--primary) !important; }
.price-bar-value {
    width: 70px; color: var(--text-secondary);
    font-weight: 700; font-size: var(--text-xs);
}

/* Savings Indicator */
.savings-indicator {
    display: flex; align-items: center; gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    background: var(--primary-50);
    border: 1px solid var(--primary-100);
    border-radius: var(--radius-md); margin-top: var(--space-sm);
    font-size: var(--text-sm); color: var(--primary-dark);
}
.savings-indicator strong { font-weight: 800; }

.offer-store-info { display: flex; align-items: center; gap: var(--space-sm); }

.supermarket-tag-inline {
    padding: 3px var(--space-sm); border-radius: var(--radius-sm);
    font-size: 0.7rem; font-weight: 700; color: white;
}
.supermarket-tag-inline.california { background: var(--california); }
.supermarket-tag-inline.yaguar { background: var(--yaguar); }
.supermarket-tag-inline.hiperlibertad { background: var(--hiperlibertad); }
.supermarket-tag-inline.multiexpress { background: var(--multiexpress); }
.supermarket-tag-inline.changomas { background: var(--changomas); }
.supermarket-tag-inline.hiperdelpollo { background: var(--hiperdelpollo); }
.supermarket-tag-inline.maxiconsumo { background: var(--maxiconsumo); }

.offer-cheapest-label { font-size: var(--text-xs); font-weight: 700; color: var(--primary); }

/* ===========================
   Results Info & Sort
   =========================== */
.results-info {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: var(--space-lg); flex-wrap: wrap; gap: var(--space-md);
    padding: var(--space-md);
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xs);
}
#results-count { color: var(--text-secondary); font-size: var(--text-base); }

.sort-select {
    background: var(--bg-muted); border: 1px solid var(--border);
    border-radius: var(--radius-md); color: var(--text);
    padding: var(--space-sm) var(--space-md);
    font-size: var(--text-sm); cursor: pointer; font-family: inherit;
}

/* ===========================
   Skeleton Loading
   =========================== */
@keyframes shimmer {
    0% { background-position: -400px 0; }
    100% { background-position: 400px 0; }
}

.skeleton-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: var(--space-lg);
}

.skeleton-card {
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: var(--radius-2xl); overflow: hidden;
    box-shadow: var(--shadow-sm);
}
.skeleton-image {
    height: 180px;
    background: linear-gradient(90deg, var(--bg-muted) 25%, #e8edf2 50%, var(--bg-muted) 75%);
    background-size: 800px 100%; animation: shimmer 1.5s infinite;
}
.skeleton-body { padding: var(--space-md); }
.skeleton-text {
    height: 14px; border-radius: 4px; margin-bottom: var(--space-sm);
    background: linear-gradient(90deg, var(--bg-muted) 25%, #e8edf2 50%, var(--bg-muted) 75%);
    background-size: 800px 100%; animation: shimmer 1.5s infinite;
}
.skeleton-text.short { width: 60%; }
.skeleton-price {
    height: 28px; width: 100px; border-radius: 4px; margin-top: var(--space-md);
    background: linear-gradient(90deg, var(--bg-muted) 25%, #e8edf2 50%, var(--bg-muted) 75%);
    background-size: 800px 100%; animation: shimmer 1.5s infinite;
}

/* ===========================
   Pagination
   =========================== */
.pagination {
    display: flex; align-items: center; justify-content: center;
    gap: var(--space-sm); margin-top: var(--space-xl); flex-wrap: wrap;
}
.pagination-btn {
    padding: var(--space-sm) var(--space-md);
    background: var(--bg-white); border: 1px solid var(--border);
    border-radius: var(--radius-md); color: var(--text);
    cursor: pointer; transition: all var(--transition-fast);
    font-size: var(--text-sm); font-family: inherit;
    box-shadow: var(--shadow-xs);
}
.pagination-btn:hover {
    border-color: var(--primary); color: var(--primary);
    background: var(--primary-50);
}
.pagination-btn:active { transform: scale(0.96); }
.pagination-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
    box-shadow: var(--shadow-green);
}

/* ===========================
   Price History Modal
   =========================== */
.price-history-modal { padding: var(--space-xl); }
.modal-title {
    font-size: var(--text-lg); font-weight: 700;
    margin-bottom: var(--space-lg); padding-right: var(--space-2xl);
    line-height: 1.4; color: var(--text);
}
.chart-container { position: relative; height: 350px; width: 100%; }
.chart-legend-info {
    text-align: center; margin-top: var(--space-md);
    color: var(--text-muted); font-size: var(--text-xs);
}

/* ===========================
   Empty State
   =========================== */
.empty-state {
    text-align: center; padding: var(--space-3xl) var(--space-md);
}
.empty-icon { display: inline-flex; align-items: center; justify-content: center; color: var(--primary); margin-bottom: var(--space-md); }
.empty-icon svg { width: 48px; height: 48px; }
.empty-illustration { width: 200px; height: 200px; max-width: 60vw; max-height: 60vw; display: block; margin: 0 auto var(--space-lg); border-radius: 24px; }
.empty-state h3 { font-size: var(--text-xl); margin-bottom: var(--space-sm); color: var(--text); }
.empty-state p { color: var(--text-muted); font-size: var(--text-sm); margin-bottom: var(--space-md); }
.empty-suggestions { display: flex; flex-wrap: wrap; gap: var(--space-sm); justify-content: center; }

/* Error State */
.error-state { text-align: center; padding: var(--space-2xl); }
.error-state .error-icon { display: inline-flex; color: var(--danger); margin-bottom: var(--space-md); }
.error-state .error-icon svg { width: 40px; height: 40px; }
.error-state h3 { color: var(--accent-dark); margin-bottom: var(--space-sm); }
.error-state p { color: var(--text-muted); margin-bottom: var(--space-md); }
.retry-btn {
    background: var(--primary); border: none; border-radius: var(--radius-lg);
    color: white; font-size: var(--text-sm); font-weight: 600;
    padding: var(--space-sm) var(--space-xl); cursor: pointer;
    transition: all var(--transition-normal); font-family: inherit;
}
.retry-btn:hover { background: var(--primary-dark); transform: translateY(-1px); box-shadow: var(--shadow-green); }

/* ===========================
   History
   =========================== */
.history-list { display: flex; flex-direction: column; gap: var(--space-sm); }

.history-item {
    display: flex; align-items: center; justify-content: space-between;
    padding: var(--space-md) var(--space-lg);
    background: var(--bg-white); border: 1px solid var(--border);
    border-radius: var(--radius-lg); cursor: pointer;
    transition: all var(--transition-fast);
    box-shadow: var(--shadow-xs);
}
.history-item:hover { border-color: var(--primary-light); background: var(--primary-50); box-shadow: var(--shadow-sm); }
.history-item:active { transform: scale(0.99); }
.history-query { font-weight: 600; color: var(--text); }
.history-meta {
    display: flex; align-items: center; gap: var(--space-lg);
    color: var(--text-muted); font-size: var(--text-sm);
}

/* ===========================
   Modal
   =========================== */
.modal {
    position: fixed; inset: 0; z-index: 200;
    display: flex; align-items: center; justify-content: center;
    padding: var(--space-lg);
}
.modal-backdrop {
    position: absolute; inset: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
}
.modal-content {
    position: relative;
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: var(--radius-2xl);
    max-width: 700px; width: 100%;
    max-height: 85vh; overflow-y: auto;
    animation: modalSlideUp 0.3s ease;
    box-shadow: var(--shadow-xl);
}

@keyframes modalSlideUp {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}

.modal-close {
    position: absolute; top: var(--space-md); right: var(--space-md);
    width: 36px; height: 36px;
    display: flex; align-items: center; justify-content: center;
    background: var(--bg-muted); border: 1px solid var(--border);
    border-radius: 50%; color: var(--text-secondary); font-size: var(--text-xl);
    cursor: pointer; transition: all var(--transition-fast); z-index: 1;
}
.modal-close:hover { background: var(--danger); color: white; border-color: var(--danger); }

/* Keyboard shortcuts modal */
.shortcuts-modal { padding: var(--space-xl); }
.shortcuts-modal h3 { margin-bottom: var(--space-lg); color: var(--text); }
.shortcut-row {
    display: flex; align-items: center; justify-content: space-between;
    padding: var(--space-sm) 0; border-bottom: 1px solid var(--border);
    color: var(--text-secondary);
}
.shortcut-row:last-child { border-bottom: none; }
kbd {
    display: inline-block; padding: 3px 8px;
    background: var(--bg-muted); border: 1px solid var(--border);
    border-radius: var(--radius-sm); font-size: var(--text-xs);
    font-family: monospace; color: var(--text-secondary);
    min-width: 24px; text-align: center;
}

/* ===========================
   Toast
   =========================== */
.toast-container {
    position: fixed; bottom: var(--space-xl); left: 50%;
    transform: translateX(-50%); z-index: 300;
    display: flex; flex-direction: column; gap: var(--space-sm);
    pointer-events: none;
}

.toast {
    padding: var(--space-md) var(--space-xl);
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    display: flex; align-items: center; gap: var(--space-sm);
    font-size: var(--text-sm); pointer-events: auto;
    animation: toastIn 0.3s ease;
    border-left: 3px solid var(--primary);
    color: var(--text);
}
.toast.toast-success { border-left-color: var(--success); }
.toast.toast-success .toast-icon { color: var(--success); }
.toast.toast-error { border-left-color: var(--danger); }
.toast.toast-error .toast-icon { color: var(--danger); }
.toast.toast-info { border-left-color: var(--primary); }
.toast.toast-info .toast-icon { color: var(--primary); }
.toast .toast-icon { display: inline-flex; flex-shrink: 0; }
.toast .toast-icon svg { width: 18px; height: 18px; }
.toast.toast-out { animation: toastOut 0.2s ease forwards; }

@keyframes toastIn { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }
@keyframes toastOut { from { opacity: 1; transform: translateY(0); } to { opacity: 0; transform: translateY(16px); } }

/* ===========================
   SEO Pages
   =========================== */
.seo-content {
    background: var(--bg-muted); padding: var(--space-xl) 0;
    margin-top: var(--space-3xl); border-top: 1px solid var(--border);
}
.seo-content h2 { font-size: var(--text-lg); margin-bottom: var(--space-md); color: var(--text); }
.seo-content h3 { font-size: var(--text-base); margin: var(--space-lg) 0 var(--space-sm); color: var(--text-secondary); }
.seo-content p { font-size: var(--text-sm); color: var(--text-secondary); line-height: 1.7; margin-bottom: var(--space-sm); }
.seo-links { display: flex; flex-wrap: wrap; gap: var(--space-xs); }
.seo-links a { color: var(--primary); text-decoration: none; font-size: var(--text-sm); }
.seo-links a:hover { text-decoration: underline; }

.breadcrumb { font-size: var(--text-sm); color: var(--text-muted); margin-bottom: var(--space-lg); }
.breadcrumb a { color: var(--primary); text-decoration: none; }
.breadcrumb a:hover { text-decoration: underline; }

.seo-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: var(--space-md); margin-top: var(--space-lg);
}
.seo-card {
    background: var(--bg-white); border: 1px solid var(--border);
    border-radius: var(--radius-xl); padding: var(--space-md); overflow: hidden;
    transition: box-shadow 0.2s;
}
.seo-card:hover { box-shadow: var(--shadow-lg); }
.seo-card img { width: 100%; height: 120px; object-fit: contain; margin-bottom: var(--space-sm); }
.seo-card h3 { font-size: var(--text-sm); line-height: 1.3; margin-bottom: var(--space-xs); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.seo-card a { color: var(--primary); font-size: var(--text-xs); text-decoration: none; }

.seo-product-header { display: flex; gap: var(--space-xl); align-items: flex-start; margin-bottom: var(--space-xl); }
.seo-product-image { width: 200px; height: 200px; object-fit: contain; border-radius: var(--radius-xl); background: var(--bg-muted); padding: var(--space-md); flex-shrink: 0; }
.seo-product-meta { color: var(--text-secondary); font-size: var(--text-sm); margin-top: var(--space-sm); }
.seo-savings { color: var(--success); font-size: var(--text-base); margin-top: var(--space-sm); }

.seo-price-table { margin-top: var(--space-lg); }
.seo-price-table h2 { font-size: var(--text-lg); margin-bottom: var(--space-md); }
.seo-product-row {
    display: flex; align-items: center; gap: var(--space-md);
    padding: var(--space-md); border: 1px solid var(--border);
    border-radius: var(--radius-lg); margin-bottom: var(--space-sm);
    background: var(--bg-white);
}
.seo-product-row.cheapest { border-color: var(--success); background: rgba(5, 150, 105, 0.05); }
.seo-product-store { min-width: 120px; }
.seo-product-store .supermarket-tag { position: static; }
.seo-product-price { flex: 1; display: flex; align-items: baseline; gap: var(--space-sm); }

@media (max-width: 640px) {
    .seo-product-header { flex-direction: column; align-items: center; text-align: center; }
    .seo-product-image { width: 150px; height: 150px; }
    .seo-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ===========================
   Comparison Cards
   =========================== */
.comparison-card { border-color: var(--primary-light); border-width: 2px; }
.comp-store-tabs {
    display: flex; flex-wrap: wrap; gap: 4px;
    margin: var(--space-sm) 0;
}
.comp-store-tab {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 3px 8px; font-size: 0.68rem; font-weight: 600;
    border: 1.5px solid var(--border); border-radius: var(--radius-full);
    background: var(--bg-white); color: var(--text-secondary);
    cursor: pointer; transition: all 0.15s; font-family: inherit;
}
.comp-store-tab:hover { border-color: var(--primary-light); color: var(--primary); }
.comp-store-tab.active {
    background: var(--primary); border-color: var(--primary);
    color: white;
}
.comp-store-tab.active .store-dot { border: 1.5px solid white; }
.comp-pct-tag {
    font-size: 0.7rem; font-weight: 700; padding: 2px 6px;
    border-radius: var(--radius-full); display: inline-block;
}
.cheapest-pct { color: var(--success); background: rgba(5,150,105,0.1); }
.expensive-pct { color: var(--danger); background: rgba(239,68,68,0.1); }
.comparison-bars {
    display: flex; flex-direction: column; gap: 4px;
    margin: var(--space-sm) 0;
}
.comparison-bar-row {
    display: flex; align-items: center; gap: 6px;
}
.comparison-bar-store {
    font-size: 0.65rem; font-weight: 600; min-width: 72px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.comparison-bar-track {
    flex: 1; height: 10px; background: var(--bg-muted);
    border-radius: var(--radius-full); overflow: hidden;
}
.comparison-bar-fill {
    height: 100%; border-radius: var(--radius-full);
    transition: width 0.4s ease;
}
.comparison-bar-price {
    font-size: 0.7rem; font-weight: 600; min-width: 65px;
    text-align: right; color: var(--text);
}
.comparison-bar-price.cheapest-price { color: var(--success); font-weight: 800; }
.comparison-bar-link {
    font-size: 0.65rem; text-decoration: none; opacity: 0.5;
    transition: opacity 0.2s;
}
.comparison-bar-link:hover { opacity: 1; }

/* ===========================
   Favorites Total & Checkbox
   =========================== */
.favorites-total {
    position: sticky; bottom: 0;
    background: var(--bg-white);
    border-top: 2px solid var(--primary);
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    padding: var(--space-md) var(--space-lg);
    box-shadow: 0 -4px 20px rgba(0,0,0,0.1);
    z-index: 50;
    margin-top: var(--space-lg);
}
.favorites-total-inner {
    display: flex; justify-content: space-between; align-items: center;
}
.favorites-total-label {
    font-weight: 600; color: var(--text-secondary); font-size: var(--text-base);
}
.favorites-total-amount {
    font-weight: 800; font-size: var(--text-2xl); color: var(--primary);
}
.fav-checkbox-wrapper {
    position: absolute; top: 8px; left: 8px; z-index: 5;
}
.fav-checkbox {
    width: 22px; height: 22px; cursor: pointer;
    accent-color: var(--primary);
    border-radius: 4px;
}
.product-card.fav-excluded {
    opacity: 0.45;
}
.product-card .fav-price {
    font-size: var(--text-lg); font-weight: 700; color: var(--primary);
    margin-bottom: var(--space-xs);
}

/* ===========================
   Footer
   =========================== */
.footer {
    border-top: 1px solid var(--border);
    padding: var(--space-xl) 0;
    margin-top: var(--space-3xl);
    background: var(--bg-white);
}
.footer-inner { text-align: center; }
.footer-text { font-size: var(--text-sm); color: var(--text-secondary); margin-bottom: var(--space-xs); }
.footer-meta { font-size: var(--text-xs); color: var(--text-muted); }

/* ===========================
   Promo bar (dark strip)
   =========================== */
.promo-bar {
    background: var(--bg-dark);
    color: #94a3b8;
    padding: var(--space-md) 0;
    /* Cuando hay bottom-nav móvil, dejamos espacio para que no quede tapado */
}
.promo-bar-inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-md);
}
.promo-apps {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.6rem;
    font-size: var(--text-sm);
}
.promo-label { color: #94a3b8; }
.promo-arrow { color: #64748b; }
.promo-dot { color: #475569; }
.promo-link {
    color: var(--primary-light);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.15s ease;
}
.promo-link:hover { color: #34d399; text-decoration: underline; }

.promo-credit {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    text-decoration: none;
    font-size: var(--text-sm);
    color: #94a3b8;
    transition: color 0.15s ease;
}
.promo-credit:hover { color: #e2e8f0; }
.promo-credit-label { color: inherit; }
.promo-credit-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.3rem 0.65rem;
    border-radius: var(--radius-full);
    background: rgba(16, 185, 129, 0.08);
    border: 1px solid rgba(16, 185, 129, 0.18);
    color: #e2e8f0;
    transition: background 0.15s ease, border-color 0.15s ease;
}
.promo-credit:hover .promo-credit-badge {
    background: rgba(16, 185, 129, 0.15);
    border-color: rgba(16, 185, 129, 0.35);
}
.promo-snowflake {
    width: 18px;
    height: 18px;
    color: var(--primary-light);
    flex-shrink: 0;
}
.promo-credit-brand {
    font-weight: 600;
    letter-spacing: 0.01em;
}

/* Móvil: apilar y centrar */
@media (max-width: 640px) {
    .promo-bar-inner {
        flex-direction: column;
        text-align: center;
    }
    .promo-apps { justify-content: center; }
}

/* ===========================
   Utilities
   =========================== */
.hidden { display: none !important; }

/* ===========================
   Responsive - Tablet & Mobile
   =========================== */
@media (max-width: 768px) {
    .header-inner { padding: var(--space-sm) var(--space-md); }
    .logo-text { font-size: var(--text-lg); }

    /* Bottom navigation on mobile */
    .nav {
        position: fixed; bottom: 0; left: 0; right: 0;
        background: var(--bg-white);
        box-shadow: 0 -2px 10px rgba(0,0,0,0.08);
        border-top: 1px solid var(--border);
        z-index: 200;
        padding: var(--space-xs) 0 env(safe-area-inset-bottom, var(--space-xs));
        padding-bottom: max(env(safe-area-inset-bottom, 4px), 4px);
        justify-content: space-around;
        /* Prevent iOS Safari address bar from pushing nav up */
        -webkit-transform: translateZ(0);
        transform: translateZ(0);
    }
    .nav-btn {
        flex-direction: column; gap: 2px; padding: var(--space-sm);
        min-height: 48px; min-width: 48px;
        border-radius: var(--radius-lg);
    }
    .nav-btn.active {
        background: var(--primary-50);
        color: var(--primary);
    }
    .nav-icon { font-size: 1.2rem; }
    .nav-label { font-size: 0.625rem; display: block !important; font-weight: 600; }

    body { padding-bottom: calc(70px + env(safe-area-inset-bottom, 0px)); }

    /* Search — mobile: input on top row, actions inline */
    .search-input-wrapper {
        padding: var(--space-sm);
        gap: 4px;
        border-radius: var(--radius-xl);
    }
    .search-icon { display: none; }
    #search-input {
        flex: 1; min-width: 0;
        padding: var(--space-sm) var(--space-md);
        font-size: var(--text-base);
    }
    .search-btn {
        width: 40px; height: 40px;
        border-radius: var(--radius-lg);
        font-size: 1.1rem;
    }
    .search-action-btn { min-width: 40px; min-height: 40px; font-size: 1rem; }

    /* Filter chips 4x2 grid on mobile */
    .filter-chips {
        display: grid;
        grid-template-columns: repeat(4, 1fr);
        gap: 6px;
    }
    .chip {
        padding: 6px 4px; font-size: 0.7rem; min-height: 32px;
        justify-content: center;
    }
    .chip .store-dot { width: 6px; height: 6px; }

    .results-info {
        flex-direction: column; align-items: flex-start;
        padding: var(--space-sm) var(--space-md);
    }

    .results-grid, .skeleton-grid { grid-template-columns: 1fr; }

    .chart-container { height: 250px; }
    .inline-chart-body canvas { max-height: 180px; }

    .history-item {
        flex-direction: column; align-items: flex-start;
        gap: var(--space-sm);
    }

    .hero { padding: var(--space-md) 0 var(--space-sm); }
    .hero-title { font-size: var(--text-2xl); }
    .hero-subtitle { font-size: var(--text-base); }
    .hero-stats { gap: var(--space-sm); }
    .stat-item { padding: var(--space-xs) var(--space-sm); }
    .stat-number { font-size: var(--text-xl); }
    .stat-label { font-size: 0.625rem; }

    .modal-content {
        max-height: 90vh;
        border-radius: var(--radius-xl) var(--radius-xl) 0 0;
        margin-top: auto;
    }

    /* Touch targets */
    .action-btn { min-height: 44px; min-width: 44px; }
    .pagination-btn { min-height: 44px; min-width: 44px; }

    .toast-container { bottom: calc(80px + env(safe-area-inset-bottom, 0px)); width: 90%; }

    /* Bottom nav móvil (70px) ahora tapa la promo-bar, no el footer */
    .footer { margin-bottom: 0; }
    .promo-bar { padding-bottom: calc(var(--space-md) + 70px + env(safe-area-inset-bottom, 0px)); }

    .favorites-total {
        position: sticky;
        bottom: calc(65px + env(safe-area-inset-bottom, 0px));
    }

    .section-title { font-size: var(--text-lg); }
}

/* ===========================
   Responsive - Small Mobile
   =========================== */
@media (max-width: 480px) {
    .container { padding: 0 var(--space-md); }
    .hero-title { font-size: 1.4rem; }
    .product-card { border-radius: var(--radius-xl); }
    .hero-stats { gap: var(--space-xs); }
    .stat-item { min-width: 55px; flex: 1; }
    .stat-number { font-size: var(--text-lg); }
    .stat-label { font-size: 0.6rem; }

    .deal-card { min-width: 170px; max-width: 200px; }
    .deal-card-image { height: 110px; }
    .deal-card-name { font-size: var(--text-xs); }
}

/* ===========================
   Responsive - 2 columns for tablets
   =========================== */
@media (min-width: 481px) and (max-width: 768px) {
    .results-grid, .skeleton-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ===========================
   Search Action Buttons (Mic & Camera)
   =========================== */
.search-action-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 6px;
    border-radius: var(--radius-full);
    transition: all var(--transition-normal);
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    min-height: 36px;
}
.search-action-btn svg {
    display: block;
}
.search-action-btn:hover {
    background: var(--bg-muted);
    color: var(--text);
}
.search-action-btn:active {
    transform: scale(0.9);
}

/* Mic recording state */
.mic-btn.recording {
    color: var(--danger);
    background: rgba(239, 68, 68, 0.1);
    animation: mic-pulse 1s ease-in-out infinite;
}
@keyframes mic-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
    50% { box-shadow: 0 0 0 10px rgba(239, 68, 68, 0); }
}

/* Image mode selector */
.image-mode-selector {
    display: flex;
    gap: var(--space-sm);
    justify-content: center;
    margin-top: var(--space-sm);
    animation: fadeSlideUp 0.2s ease;
}
.image-mode-btn {
    background: var(--bg-white);
    border: 2px solid var(--border);
    border-radius: var(--radius-xl);
    padding: var(--space-sm) var(--space-lg);
    cursor: pointer;
    font-size: var(--text-sm);
    font-family: inherit;
    transition: all var(--transition-normal);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}
.image-mode-btn:hover {
    border-color: var(--primary);
    background: var(--primary-50);
}

/* Image search loading overlay */
.image-search-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Barcode scanner web overlay */
.scan-overlay {
    position: fixed; inset: 0;
    background: #000;
    z-index: 9999;
    display: flex; align-items: center; justify-content: center;
}
.scan-overlay video {
    width: 100%; height: 100%; object-fit: cover;
}
.scan-overlay .scan-frame {
    position: absolute;
    width: min(78vw, 360px); height: 200px;
    border: 2px solid #10b981;
    border-radius: 16px;
    box-shadow: 0 0 0 9999px rgba(0,0,0,0.55);
    pointer-events: none;
}
.scan-overlay .scan-frame::before,
.scan-overlay .scan-frame::after {
    content: ''; position: absolute; left: 50%; width: 80%;
    height: 2px; background: #fbbf24; transform: translateX(-50%);
    animation: scanline 1.8s ease-in-out infinite;
}
.scan-overlay .scan-frame::after { top: auto; bottom: 0; animation-delay: 0.9s; }
.scan-overlay .scan-frame::before { top: 0; }
@keyframes scanline { 0%,100% { opacity: 0.2; } 50% { opacity: 1; } }
.scan-overlay .scan-close {
    position: absolute; top: 20px; right: 20px;
    width: 44px; height: 44px;
    background: rgba(255,255,255,0.18);
    color: #fff; font-size: 28px; border: 0; border-radius: 50%;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
}
.scan-overlay .scan-hint {
    position: absolute; bottom: 60px; left: 0; right: 0; text-align: center;
    color: #fff; font-size: 14px; font-weight: 500;
    text-shadow: 0 2px 4px rgba(0,0,0,0.6);
}

/* Scan button (matches mic/cam buttons) */
.search-action-btn.scan-btn {
    color: var(--text-secondary);
}
.search-action-btn.scan-btn:hover { color: var(--primary); }

/* Google Play CTA — minimal text link (hero) */
.gplay-cta {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 14px auto 0;
    padding: 7px 14px;
    background: transparent;
    color: var(--primary);
    border: 1px solid rgba(5, 150, 105, 0.25);
    border-radius: 999px;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: -0.1px;
    text-decoration: none;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.15s ease;
}
.gplay-cta:hover {
    background: rgba(5, 150, 105, 0.08);
    border-color: rgba(5, 150, 105, 0.45);
    color: var(--primary-dark, var(--primary));
    transform: translateY(-1px);
}
.gplay-cta:active { transform: translateY(0); }
.gplay-cta.hidden { display: none; }
.gplay-arrow { flex-shrink: 0; transition: transform 0.18s ease; }
.gplay-cta:hover .gplay-arrow { transform: translateX(2px); }

/* Native-app body tweaks (no scrollbars en WebView, safe areas) */
.native-app { padding-top: env(safe-area-inset-top); padding-bottom: env(safe-area-inset-bottom); }

.image-search-loading {
    background: var(--bg-white);
    border-radius: var(--radius-xl);
    padding: var(--space-2xl);
    text-align: center;
    box-shadow: var(--shadow-xl);
    max-width: 300px;
}
.image-search-loading p {
    margin-top: var(--space-md);
    color: var(--text-secondary);
    font-size: var(--text-sm);
}
.image-search-spinner {
    width: 48px; height: 48px;
    border: 4px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto;
}
@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Voice feedback text */
.voice-feedback {
    text-align: center;
    color: var(--text-muted);
    font-size: var(--text-sm);
    margin-top: var(--space-xs);
    min-height: 1.4em;
}

/* Multi-search query tags */
.multi-query-tags {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-xs);
    margin-bottom: var(--space-sm);
}
.multi-query-tag {
    background: var(--primary-50);
    color: var(--primary-dark);
    border: 1px solid var(--primary-100);
    padding: 2px 10px;
    border-radius: var(--radius-full);
    font-size: var(--text-xs);
    font-weight: 500;
}

/* ===========================
   Shopping List (Lista) View
   =========================== */
.saved-lists-bar {
    display: flex;
    gap: var(--space-sm);
    align-items: center;
    margin-bottom: var(--space-md);
}
.saved-lists-select {
    flex: 1;
    padding: var(--space-sm) var(--space-md);
    border: 2px solid var(--border);
    border-radius: var(--radius-lg);
    font-size: var(--text-sm);
    font-family: inherit;
    background: var(--bg-white);
    color: var(--text);
    cursor: pointer;
}
.delete-list-btn {
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-sm);
    cursor: pointer;
    font-size: 1rem;
    transition: all var(--transition-normal);
}
.delete-list-btn:hover {
    background: var(--danger-50);
    border-color: var(--danger);
}

.lista-input-area {
    background: var(--bg-white);
    border-radius: var(--radius-xl);
    padding: var(--space-lg);
    box-shadow: var(--shadow-sm);
    margin-bottom: var(--space-lg);
}
.lista-name-input {
    width: 100%;
    padding: var(--space-sm) var(--space-md);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    font-size: var(--text-sm);
    font-family: inherit;
    color: var(--text);
    margin-bottom: var(--space-sm);
}
.lista-textarea {
    width: 100%;
    padding: var(--space-md);
    border: 2px solid var(--border);
    border-radius: var(--radius-lg);
    font-size: var(--text-base);
    font-family: inherit;
    color: var(--text);
    resize: vertical;
    min-height: 120px;
    line-height: 1.8;
    transition: border-color var(--transition-normal);
}
.lista-textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-50);
}
.lista-textarea::placeholder {
    color: var(--text-muted);
}
.lista-hint {
    color: var(--text-muted);
    font-size: var(--text-xs);
    margin-top: var(--space-sm);
}
.lista-actions {
    display: flex;
    gap: var(--space-sm);
    margin-top: var(--space-md);
}
.lista-match-btn {
    flex: 2;
    padding: var(--space-md) var(--space-xl);
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius-xl);
    font-size: var(--text-base);
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: all var(--transition-normal);
}
.lista-match-btn:hover {
    background: var(--primary-dark);
    box-shadow: var(--shadow-green);
}
.lista-match-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}
.lista-save-btn {
    flex: 1;
    padding: var(--space-md);
    background: var(--bg-muted);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    font-size: var(--text-base);
    font-weight: 500;
    cursor: pointer;
    font-family: inherit;
    transition: all var(--transition-normal);
}
.lista-save-btn:hover {
    background: var(--border);
}

/* Lista results */
.lista-results {
    animation: fadeSlideUp 0.3s ease;
}
.lista-summary {
    background: var(--bg-white);
    border-radius: var(--radius-xl);
    padding: var(--space-lg);
    margin-bottom: var(--space-lg);
    box-shadow: var(--shadow-sm);
}
.lista-summary-title {
    font-size: var(--text-lg);
    font-weight: 700;
    margin-bottom: var(--space-md);
    color: var(--text);
}
.lista-summary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-sm) 0;
    border-bottom: 1px solid var(--bg-muted);
}
.lista-summary-row:last-child {
    border-bottom: none;
}
.lista-summary-row.cheapest {
    background: var(--primary-50);
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-lg);
    margin: var(--space-sm) 0;
    border-bottom: none;
    font-weight: 700;
}
.lista-summary-store {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-size: var(--text-sm);
}
.lista-summary-price {
    font-weight: 700;
    font-size: var(--text-base);
}
.lista-summary-missing {
    font-size: var(--text-xs);
    color: var(--text-muted);
}

.lista-chips {
    margin-bottom: var(--space-md);
}

/* Individual list items */
.lista-items {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}
.lista-item {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    padding: var(--space-md);
    box-shadow: var(--shadow-xs);
    display: flex;
    gap: var(--space-md);
    align-items: flex-start;
    animation: fadeSlideUp 0.3s ease;
}
.lista-item.not-found {
    border-left: 3px solid var(--danger);
    opacity: 0.7;
}
.lista-item.found {
    border-left: 3px solid var(--success);
}
.lista-item-image {
    width: 50px;
    height: 50px;
    border-radius: var(--radius-md);
    object-fit: cover;
    flex-shrink: 0;
}
.lista-item-info {
    flex: 1;
    min-width: 0;
}
.lista-item-query {
    font-size: var(--text-xs);
    color: var(--text-muted);
    margin-bottom: 2px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
}
.lista-item-qty-badge {
    background: var(--primary-soft, rgba(34, 139, 230, 0.12));
    color: var(--primary);
    font-weight: 600;
    padding: 1px 8px;
    border-radius: var(--radius-full);
    font-size: 11px;
    white-space: nowrap;
}
.lista-item-multiplier {
    color: var(--text-muted);
    font-weight: 500;
    font-size: var(--text-sm);
    margin-left: 4px;
}
.lista-item-multiplier strong {
    color: var(--primary);
    font-weight: 700;
}
.lista-item-name {
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.lista-item-price {
    font-size: var(--text-base);
    font-weight: 700;
    color: var(--primary);
}
.lista-item-super {
    font-size: var(--text-xs);
    padding: 1px 6px;
    border-radius: var(--radius-full);
    color: white;
    display: inline-block;
    margin-top: 2px;
}
.lista-item-alts {
    font-size: var(--text-xs);
    color: var(--text-muted);
    margin-top: 2px;
}
.lista-item-not-found {
    color: var(--danger);
    font-size: var(--text-sm);
    font-weight: 500;
}
.lista-item-warning {
    color: var(--warning);
    font-size: var(--text-xs);
    font-weight: 500;
    margin-bottom: 2px;
}
.lista-item.not-in-super {
    border-left-color: var(--warning);
    opacity: 0.85;
}
.lista-item-price-row {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    margin-top: 2px;
}
.lista-item-actions {
    display: flex;
    gap: var(--space-xs);
    margin-top: var(--space-sm);
    flex-wrap: wrap;
}
.lista-item-actions .action-btn {
    font-size: var(--text-xs);
    padding: 4px 8px;
    min-height: 32px;
    min-width: 32px;
}
.lista-item-actions .view-link {
    font-size: var(--text-xs);
    padding: 4px 8px;
}

/* Summary header with toggle */
.lista-summary-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    padding-bottom: var(--space-sm);
    border-bottom: 1px solid var(--border);
    margin-bottom: var(--space-sm);
}
.lista-summary-toggle {
    font-size: var(--text-sm);
    color: var(--text-muted);
    transition: transform var(--transition-normal);
}
.lista-summary-row.selected {
    background: var(--primary-50);
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-lg);
    border-bottom: none;
    font-weight: 600;
}
.lista-summary-row.super-cheapest .lista-summary-store {
    font-weight: 600;
}
.lista-cheapest-badge {
    display: inline-block;
    background: var(--primary);
    color: white;
    font-size: 0.6rem;
    padding: 1px 6px;
    border-radius: var(--radius-full);
    margin-left: 4px;
    font-weight: 600;
    vertical-align: middle;
}

/* ===========================
   Footer Contact Form
   =========================== */
.footer-contact {
    padding: var(--space-lg) 0 var(--space-sm);
}
.contact-details {
    max-width: 500px;
    margin: 0 auto;
}
.contact-summary {
    text-align: center;
    color: var(--text-muted);
    font-size: var(--text-sm);
    cursor: pointer;
    padding: var(--space-sm);
    list-style: none;
    transition: color var(--transition-normal);
}
.contact-summary::-webkit-details-marker { display: none; }
.contact-summary::marker { content: ''; }
.contact-summary:hover { color: var(--primary); }
.contact-form {
    margin-top: var(--space-md);
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}
.contact-row {
    display: flex;
    gap: var(--space-sm);
}
.contact-row .contact-field { flex: 1; }
.contact-field input,
.contact-field textarea {
    width: 100%;
    padding: var(--space-sm) var(--space-md);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    font-size: var(--text-sm);
    font-family: inherit;
    color: var(--text);
    background: var(--bg-white);
    transition: border-color var(--transition-normal);
}
.contact-field input:focus,
.contact-field textarea:focus {
    outline: none;
    border-color: var(--primary);
}
.contact-field textarea {
    resize: vertical;
    min-height: 60px;
    line-height: 1.5;
}
.contact-submit-btn {
    padding: var(--space-sm) var(--space-lg);
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius-lg);
    font-size: var(--text-sm);
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: all var(--transition-normal);
    align-self: flex-end;
}
.contact-submit-btn:hover { background: var(--primary-dark); }
.contact-submit-btn:disabled { opacity: 0.6; cursor: not-allowed; }
.contact-success {
    text-align: center;
    padding: var(--space-md);
    color: var(--primary);
    font-size: var(--text-sm);
}
.contact-success p { margin-bottom: var(--space-sm); }
.contact-another-btn {
    padding: 4px 12px;
    background: var(--bg-muted);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    font-size: var(--text-xs);
    cursor: pointer;
    font-family: inherit;
}
.contact-another-btn:hover { background: var(--border); }
@media (max-width: 480px) {
    .contact-row { flex-direction: column; }
}

@keyframes fadeSlideUp {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ===========================
   Icons (rebrand)
   =========================== */
.section-title { display: inline-flex; align-items: center; gap: 8px; }
.section-title-icon { flex-shrink: 0; vertical-align: -3px; }
.section-title-icon path[fill="#fb7185"] { fill: #fb7185; }

.refresh-btn { display: inline-flex; align-items: center; justify-content: center; }
.refresh-btn svg { width: 18px; height: 18px; }

/* Action buttons containing inline svg labels (e.g. View, Search, Quitar) */
.action-btn span svg,
.lista-match-btn svg,
.lista-save-btn svg,
.delete-list-btn svg,
.image-mode-btn svg,
.comparison-bar-link svg { vertical-align: -3px; }

.image-mode-btn { display: inline-flex; align-items: center; gap: 6px; }

.action-btn .vote-icon svg { display: block; }
.action-btn .vote-icon { display: inline-flex; align-items: center; }

/* Heart toggle: outline → filled smooth */
.fav-btn span,
.fav-btn-large span { display: inline-flex; align-items: center; justify-content: center; transition: transform 0.18s ease; }
.fav-btn.is-fav span,
.fav-btn-large.is-fav span { color: #ef4444; }

/* Comparison external link */
.comparison-bar-link { display: inline-flex; align-items: center; justify-content: center; }
.comparison-bar-link svg { width: 12px; height: 12px; }

/* Savings indicator tag icon color */
.savings-indicator span svg { color: var(--primary); vertical-align: -3px; }

/* List summary tag icon */
.lista-summary-store svg { vertical-align: -3px; color: var(--primary); margin-right: 4px; }

/* Multi-query camera icon */
.multi-query-label svg { vertical-align: -3px; color: var(--primary); margin-right: 4px; }

/* Trending up empty icon */
.empty-icon svg { color: var(--primary); }

/* ============================================================
   AUTH — modal, botón header, banner sync
   ============================================================ */

/* Botón "Mi cuenta" / avatar en header (después del nav) */
.auth-header-btn {
    display: inline-flex; align-items: center; gap: var(--space-sm);
    background: var(--bg-white); border: 1px solid var(--border);
    padding: 0.4rem 0.75rem; border-radius: var(--radius-lg);
    cursor: pointer; font-size: var(--text-sm); font-weight: 600;
    color: var(--text-secondary); transition: all 0.15s;
    margin-left: var(--space-md);
}
.auth-header-btn:hover { border-color: var(--primary); color: var(--primary); }
.auth-header-btn .auth-avatar {
    width: 24px; height: 24px; border-radius: 50%; background: var(--primary-50);
    color: var(--primary); display: inline-flex; align-items: center; justify-content: center;
    font-size: 0.75rem; font-weight: 700; overflow: hidden;
}
.auth-header-btn .auth-avatar img { width: 100%; height: 100%; object-fit: cover; }
.auth-header-btn .auth-name { max-width: 90px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 600px) {
    .auth-header-btn .auth-name { display: none; }
}

/* Dropdown del usuario logueado */
.auth-menu-wrap { position: relative; }
.auth-menu {
    position: absolute; right: 0; top: calc(100% + 6px);
    background: var(--bg-white); border: 1px solid var(--border);
    border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
    min-width: 220px; padding: var(--space-sm); z-index: 1000;
}
.auth-menu.hidden { display: none; }
.auth-menu-header {
    padding: var(--space-sm) var(--space-md);
    border-bottom: 1px solid var(--border); margin-bottom: var(--space-xs);
}
.auth-menu-header .auth-menu-name { font-weight: 600; font-size: var(--text-sm); color: var(--text-primary); }
.auth-menu-header .auth-menu-email { font-size: var(--text-xs); color: var(--text-muted); }
.auth-menu button {
    width: 100%; text-align: left; background: none; border: none;
    padding: var(--space-sm) var(--space-md); cursor: pointer;
    border-radius: var(--radius-md); font-size: var(--text-sm);
    color: var(--text-secondary); display: flex; align-items: center; gap: var(--space-sm);
}
.auth-menu button:hover { background: var(--primary-50); color: var(--primary); }

/* Modal */
.auth-modal { position: fixed; inset: 0; z-index: 9999; display: flex; align-items: center; justify-content: center; }
.auth-modal.hidden { display: none; }
.auth-modal-backdrop { position: absolute; inset: 0; background: rgba(15, 23, 42, 0.5); backdrop-filter: blur(4px); }
.auth-modal-card {
    position: relative; background: var(--bg-white); border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl); padding: var(--space-xl);
    width: min(420px, calc(100vw - 32px)); max-height: calc(100vh - 32px); overflow-y: auto;
    animation: authModalIn 0.18s ease-out;
}
@keyframes authModalIn { from { opacity: 0; transform: translateY(8px) scale(0.98); } to { opacity: 1; transform: none; } }
.auth-modal-close {
    position: absolute; top: 12px; right: 12px; background: none; border: none;
    font-size: 1.75rem; line-height: 1; cursor: pointer; color: var(--text-muted);
    width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
}
.auth-modal-close:hover { background: var(--bg); color: var(--text-primary); }
.auth-modal-title { font-size: var(--text-xl); margin: 0 0 var(--space-xs); color: var(--text-primary); }
.auth-modal-sub { font-size: var(--text-sm); color: var(--text-muted); margin: 0 0 var(--space-lg); }

.auth-google { display: flex; justify-content: center; min-height: 44px; margin-bottom: var(--space-md); }
.auth-google-disabled { font-size: var(--text-sm); color: var(--text-muted); padding: var(--space-sm) 0; }

.auth-divider {
    text-align: center; font-size: var(--text-xs); color: var(--text-muted);
    margin: var(--space-md) 0; position: relative;
}
.auth-divider::before, .auth-divider::after {
    content: ''; position: absolute; top: 50%; width: calc(50% - 50px); height: 1px; background: var(--border);
}
.auth-divider::before { left: 0; }
.auth-divider::after { right: 0; }
.auth-divider span { background: var(--bg-white); padding: 0 var(--space-sm); }

.auth-tabs { display: flex; gap: var(--space-xs); margin-bottom: var(--space-md); border-bottom: 1px solid var(--border); }
.auth-tab {
    flex: 1; background: none; border: none; padding: var(--space-sm); cursor: pointer;
    font-size: var(--text-sm); color: var(--text-muted); border-bottom: 2px solid transparent;
    transition: all 0.15s;
}
.auth-tab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }

.auth-form { display: flex; flex-direction: column; gap: var(--space-md); }
.auth-field { display: flex; flex-direction: column; gap: 4px; }
.auth-field > span { font-size: var(--text-xs); color: var(--text-secondary); font-weight: 500; }
.auth-field input {
    padding: 0.6rem 0.75rem; border: 1px solid var(--border); border-radius: var(--radius-md);
    font-size: var(--text-base); transition: border 0.15s;
}
.auth-field input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-50); }

.auth-error {
    background: var(--danger-50); color: var(--danger); padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-md); font-size: var(--text-sm);
}
.auth-submit {
    background: var(--primary); color: white; border: none; padding: 0.7rem;
    border-radius: var(--radius-md); font-size: var(--text-base); font-weight: 600;
    cursor: pointer; transition: background 0.15s;
}
.auth-submit:hover:not(:disabled) { background: var(--primary-dark); }
.auth-submit:disabled { opacity: 0.6; cursor: not-allowed; }

/* Banner "iniciá sesión para sincronizar" */
.auth-sync-banner {
    background: var(--primary-50); border: 1px solid var(--primary-100);
    border-radius: var(--radius-lg); padding: var(--space-md) var(--space-lg);
    margin: 0 0 var(--space-md); display: flex; align-items: center; gap: var(--space-md);
    flex-wrap: wrap;
}
.auth-sync-banner .auth-sync-text {
    flex: 1; min-width: 200px; font-size: var(--text-sm); color: var(--text-primary);
}
.auth-sync-banner .auth-sync-text strong { color: var(--primary-dark); }
.auth-sync-banner button {
    background: var(--primary); color: white; border: none; padding: 0.5rem var(--space-md);
    border-radius: var(--radius-md); font-size: var(--text-sm); font-weight: 600; cursor: pointer;
}
.auth-sync-banner button:hover { background: var(--primary-dark); }
.auth-sync-banner .auth-sync-dismiss {
    background: transparent; color: var(--text-muted); padding: 0.5rem;
}
.auth-sync-banner .auth-sync-dismiss:hover { background: var(--bg); color: var(--text-primary); }

/* Modal de "importar favoritos locales" */
.auth-import-modal {
    position: fixed; inset: 0; z-index: 9998; display: flex; align-items: center; justify-content: center;
}
.auth-import-modal.hidden { display: none; }

/* ── Profile view ──────────────────────────────────────────────────── */
.profile-content { padding: 0; }
.profile-anon {
    display: flex; flex-direction: column; align-items: center; gap: 1rem;
    padding: 3rem 1rem; text-align: center; color: var(--text-muted);
}
.profile-grid {
    display: grid; grid-template-columns: 1fr; gap: 1rem; margin-top: 1rem;
}
@media (min-width: 768px) {
    .profile-grid { grid-template-columns: 1fr 1fr; }
    .profile-grid .profile-card:nth-child(3),
    .profile-grid .profile-card:nth-child(4) { grid-column: 1 / -1; }
}
.profile-card {
    background: var(--bg-white); border: 1px solid var(--border);
    border-radius: var(--radius-lg); padding: 1.25rem;
}
.profile-card-head {
    display: flex; align-items: center; justify-content: space-between; margin-bottom: 1rem;
}
.profile-card-head h3 {
    margin: 0; font-size: 1rem; font-weight: 700; color: var(--text-primary);
}
.profile-count {
    font-size: 0.85rem; color: var(--text-muted); background: var(--bg);
    padding: 0.15rem 0.5rem; border-radius: 999px;
}

/* Identidad */
.profile-id {
    display: flex; gap: 1rem; align-items: center; margin-bottom: 1rem;
}
.profile-avatar {
    width: 56px; height: 56px; border-radius: 50%; background: var(--primary);
    color: #fff; font-weight: 700; font-size: 1.25rem;
    display: flex; align-items: center; justify-content: center;
    overflow: hidden; flex-shrink: 0;
}
.profile-avatar img { width: 100%; height: 100%; object-fit: cover; }
.profile-id-meta { min-width: 0; flex: 1; }
.profile-id-name { font-weight: 600; color: var(--text-primary); margin-bottom: 2px; }
.profile-id-email { color: var(--text-muted); font-size: 0.9rem; word-break: break-all; }
.profile-id-meta-row {
    display: flex; gap: 0.5rem; align-items: center; margin-top: 0.35rem;
    flex-wrap: wrap; font-size: 0.8rem;
}
.profile-badge {
    background: rgba(5, 150, 105, 0.1); color: var(--primary);
    padding: 0.15rem 0.5rem; border-radius: 999px; font-weight: 600;
}
.profile-joined { color: var(--text-muted); }

/* Formularios */
.profile-form { display: flex; flex-direction: column; gap: 0.5rem; }
.profile-form label {
    font-size: 0.85rem; font-weight: 600; color: var(--text-secondary); margin-top: 0.25rem;
}
.profile-form input[type="text"],
.profile-form input[type="password"] {
    padding: 0.65rem 0.85rem; border: 1px solid var(--border);
    border-radius: var(--radius); background: var(--bg-white);
    font-size: 0.95rem; color: var(--text-primary); width: 100%; box-sizing: border-box;
}
.profile-form input:focus {
    outline: none; border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.15);
}
.profile-row { display: flex; gap: 0.5rem; align-items: center; }
.profile-row.end { justify-content: flex-end; }
.profile-row input { flex: 1; }

.profile-btn {
    border: 1px solid var(--border); background: var(--bg-white);
    color: var(--text-primary); padding: 0.6rem 1rem; border-radius: var(--radius);
    font-weight: 600; cursor: pointer; transition: background 0.15s;
    white-space: nowrap;
}
.profile-btn:hover { background: var(--bg); }
.profile-btn.primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.profile-btn.primary:hover { background: var(--primary-dark); }

.profile-msg { font-size: 0.85rem; min-height: 1.2em; margin-top: 0.25rem; }
.profile-msg.err { color: var(--danger, #dc2626); }
.profile-msg.ok { color: var(--primary); }

/* Listas (votos / historial) */
.profile-list {
    display: flex; flex-direction: column;
    max-height: 420px; overflow-y: auto;
    margin: -0.25rem;
}
.profile-list-row {
    display: flex; gap: 0.75rem; align-items: center; justify-content: space-between;
    padding: 0.65rem 0.5rem; border-bottom: 1px solid var(--border);
}
.profile-list-row:last-child { border-bottom: none; }
.profile-list-main { min-width: 0; flex: 1; }
.profile-list-title {
    font-weight: 600; color: var(--text-primary); font-size: 0.92rem;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.profile-list-title.link { color: var(--primary); text-decoration: none; }
.profile-list-title.link:hover { text-decoration: underline; }
.profile-list-sub { color: var(--text-muted); font-size: 0.82rem; margin-top: 2px; display: flex; align-items: center; gap: 0.35rem; }
.profile-list-side { color: var(--text-muted); font-size: 0.78rem; white-space: nowrap; }
.profile-loading, .profile-empty {
    color: var(--text-muted); text-align: center; padding: 1.5rem 0.5rem; font-size: 0.9rem;
}

