/* ============================================
   Recipe Cost Manager - Design System
   Inspirado en apps de cocina premium
   Tema oscuro con acentos naranja/coral
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* === CSS Variables === */
:root {
    /* Colores Base */
    --bg-primary: #0D0D0D;
    --bg-secondary: #1A1A1A;
    --bg-card: #1E1E1E;
    --bg-card-hover: #262626;
    --bg-input: #2A2A2A;
    --bg-modal: rgba(0, 0, 0, 0.85);

    /* Acentos */
    --accent: #FF6B35;
    --accent-hover: #FF8C5A;
    --accent-light: rgba(255, 107, 53, 0.15);
    --accent-glow: rgba(255, 107, 53, 0.3);

    /* Precios */
    --color-coste: #4ADE80;
    --color-pvp: #FF6B6B;
    --color-margen: #FBBF24;

    /* Semáforo Food Cost */
    --fc-excelente: #22C55E;
    --fc-aceptable: #FBBF24;
    --fc-revisar: #EF4444;

    /* Texto */
    --text-primary: #FFFFFF;
    --text-secondary: #9CA3AF;
    --text-muted: #6B7280;
    --text-accent: #FF6B35;

    /* Bordes */
    --border-color: #2A2A2A;
    --border-accent: rgba(255, 107, 53, 0.3);
    --color-danger: #EF4444;

    /* Sombras */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 20px rgba(255, 107, 53, 0.2);

    /* Espaciado */
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 32px;
    --space-2xl: 48px;

    /* Radios */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-full: 50%;

    /* Transiciones */
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-fast: all 0.15s ease;

    /* Bottom nav height */
    --nav-height: 72px;
    --header-height: 64px;

    /* Elevations */
    --elevation-1: 0 2px 4px rgba(0, 0, 0, 0.3);
    --elevation-2: 0 4px 8px rgba(0, 0, 0, 0.4);
    --elevation-3: 0 8px 16px rgba(0, 0, 0, 0.5);
    --elevation-4: 0 12px 24px rgba(0, 0, 0, 0.6);

    /* Gradients */
    --gradient-hot: linear-gradient(135deg, #ff6f3c 0%, #ff5252 100%);
    --gradient-fresh: linear-gradient(135deg, #4caf50 0%, #26c6da 100%);
    --gradient-gold: linear-gradient(135deg, #ffc93c 0%, #ff6f3c 100%);
    --gradient-premium: linear-gradient(135deg, #ba68c8 0%, #42a5f5 100%);
}

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

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.5;
    overflow-x: hidden;
    min-height: 100vh;
    min-height: 100dvh;
}

a {
    color: var(--accent);
    text-decoration: none;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

button {
    cursor: pointer;
    font-family: inherit;
}

input,
select,
textarea {
    font-family: inherit;
}

/* === App Container === */
#app {
    max-width: 600px;
    margin: 0 auto;
    min-height: 100vh;
    min-height: 100dvh;
    position: relative;
    background: var(--bg-primary);
}

@media (min-width: 768px) {
    #app {
        max-width: 100%;
    }
}

/* === App Bar - Material Design === */
.app-bar {
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    padding: 0 16px;
    height: var(--header-height);
    background: var(--bg-secondary);
    box-shadow: var(--elevation-2);
}

.app-bar-title {
    font-size: 20px;
    font-weight: 500;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 12px;
}

.app-bar-logo {
    width: 40px;
    height: 40px;
    background: var(--gradient-hot);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.spacer {
    flex: 1;
}

.app-bar-actions {
    display: flex;
    gap: 4px;
}

.icon-button {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    font-size: 20px;
}

.icon-button:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
}

.icon-button:active {
    transform: scale(0.9);
}

/* Keep legacy class for backward compat */
.header-btn {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    border: none;
    background: transparent;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    transition: var(--transition);
    cursor: pointer;
}

.header-btn:hover,
.header-btn:active {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
}

/* === Search Bar - Always Visible Pill === */
.search-section {
    padding: 8px 16px 12px;
}

.search-container {
    padding: 8px 16px 12px;
}

.search-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--bg-input);
    border-radius: 28px;
    padding: 12px 20px;
    box-shadow: var(--elevation-1);
    transition: all 0.3s;
    border: none;
}

.search-bar:focus-within {
    background: var(--bg-card);
    box-shadow: var(--elevation-3);
}

.search-bar .search-icon {
    color: var(--text-secondary);
    font-size: 18px;
    flex-shrink: 0;
}

.search-bar input {
    flex: 1;
    border: none;
    background: none;
    color: var(--text-primary);
    font-size: 15px;
    outline: none;
    padding: 0;
}

.search-bar input::placeholder {
    color: var(--text-muted);
}

.search-filters {
    margin-top: 12px;
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.filter-select {
    flex: 1;
    min-width: 200px;
    padding: 10px 16px;
    background: var(--bg-input);
    color: var(--text-primary);
    border: 1px solid var(--bg-card);
    border-radius: 12px;
    font-size: 14px;
    outline: none;
    cursor: pointer;
    transition: all 0.2s;
}

.filter-select:hover {
    background: var(--bg-card);
    border-color: var(--primary);
}

.filter-select:focus {
    background: var(--bg-card);
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.1);
}

/* === Main Content === */
.main-content {
    padding: 0 var(--space-md);
    padding-bottom: calc(var(--nav-height) + var(--space-xl) + 60px);
    min-height: calc(100vh - var(--header-height));
}

/* === Cards Grid === */
.cards-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}

@media (min-width: 768px) {
    .cards-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1024px) {
    .cards-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* === Provider Card - Material === */
.provider-card {
    background: var(--bg-secondary);
    border-radius: 16px;
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: var(--elevation-1);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    border-left: 4px solid transparent;
}

.provider-card:hover {
    box-shadow: var(--elevation-3);
    transform: translateX(4px);
    border-left-color: var(--accent);
}

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

.provider-avatar {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 22px;
    font-weight: 700;
    color: white;
}

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

.provider-name {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.provider-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 13px;
    color: var(--text-secondary);
}

.provider-stats {
    color: var(--accent);
    font-weight: 500;
}

.card {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    padding: var(--space-md);
    border: 1px solid var(--border-color);
    transition: var(--transition);
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--accent), transparent);
    opacity: 0;
    transition: var(--transition);
}

.card:hover,
.card:active {
    background: var(--bg-card-hover);
    border-color: var(--border-accent);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.card:hover::before,
.card:active::before {
    opacity: 1;
}

.card-logo {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-sm);
    object-fit: cover;
    margin-bottom: var(--space-sm);
    background: var(--bg-input);
}

.card-logo-placeholder {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-sm);
    background: linear-gradient(135deg, var(--accent), var(--accent-hover));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    font-weight: 700;
    color: white;
    margin-bottom: var(--space-sm);
}

.card-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--space-xs);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card-subtitle {
    font-size: 0.7rem;
    color: var(--text-muted);
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* === Product Card === */
/* === Product Card - Material === */
.product-card {
    background: var(--bg-card);
    border-radius: 20px;
    overflow: hidden;
    box-shadow: var(--elevation-1);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    position: relative;
    border: none;
    display: flex;
    flex-direction: column;
}

.product-card:hover {
    box-shadow: var(--elevation-4);
    transform: translateY(-4px);
}

.product-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--gradient-hot);
    opacity: 0;
    transition: opacity 0.3s;
}

.product-card:hover::before {
    opacity: 1;
}

.product-image-container {
    position: relative;
    height: 140px;
    background: linear-gradient(135deg, #2a2a2a 0%, #1e1e1e 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.product-image-icon {
    font-size: 56px;
    opacity: 0.9;
    transition: transform 0.3s;
}

.product-card:hover .product-image-icon {
    transform: scale(1.1);
}

.product-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    backdrop-filter: blur(8px);
    z-index: 10;
}

.badge-high {
    background: rgba(76, 175, 80, 0.9);
    color: white;
}

.badge-medium {
    background: rgba(255, 201, 60, 0.9);
    color: #1e1e1e;
}

.badge-low {
    background: rgba(255, 82, 82, 0.9);
    color: white;
}

.product-content {
    padding: 16px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.product-category {
    font-size: 11px;
    color: var(--accent);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

.product-card-name {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 12px;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-pricing {
    margin-top: auto;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
}

.price-main {
    font-size: 20px;
    font-weight: 800;
    background: var(--gradient-gold);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.price-details {
    text-align: right;
}

.cost-info {
    font-size: 11px;
    color: var(--text-secondary);
}

.profit-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 6px;
    border-radius: 6px;
    font-weight: 600;
    margin-top: 2px;
}

/* === Recipe Card - Hero Style === */
.recipe-card {
    background: var(--bg-card);
    border-radius: 24px;
    overflow: hidden;
    min-width: 0;
    box-shadow: var(--elevation-2);
    margin-bottom: 20px;
    border: none;
    transition: var(--transition);
}

.recipe-card:hover {
    box-shadow: var(--elevation-4);
    transform: translateY(-2px);
}

.recipe-header {
    background: var(--gradient-hot);
    padding: 24px;
    text-align: center;
    position: relative;
    border-radius: 24px 24px 0 0;
}

.recipe-title {
    font-size: 20px;
    font-weight: 700;
    color: white;
    margin-bottom: 16px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.recipe-metrics {
    display: flex;
    justify-content: center;
    gap: 24px;
}

.metric {
    text-align: center;
}

.metric-value {
    font-size: 24px;
    font-weight: 700;
    color: white;
}

.metric-label {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.8);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-top: 4px;
}

.recipe-breakdown {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    background: var(--bg-card-hover);
    margin: -12px 20px 0;
    border-radius: 16px;
    padding: 16px;
    gap: 16px;
    position: relative;
    z-index: 1;
    box-shadow: var(--elevation-1);
}

.breakdown-item {
    text-align: center;
}

.breakdown-value {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 4px;
}

.breakdown-value.cost {
    color: var(--text-secondary);
}

.breakdown-value.price {
    color: var(--accent);
}

.breakdown-value.margin {
    color: var(--color-coste);
}

.breakdown-label {
    font-size: 10px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.recipe-ingredients-preview {
    padding: 20px 24px;
}

.section-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 12px;
}

.ingredient-preview-item {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    padding: 4px 0;
    border-bottom: 1px solid var(--border-color);
}

.ingredient-preview-item:last-child {
    border-bottom: none;
}

.recipe-actions {
    padding: 16px 20px 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.recipe-icon-actions {
    display: flex;
    justify-content: center;
    gap: 8px;
}

.btn-icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-secondary);
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
}

.btn-icon:active {
    transform: scale(0.92);
    background: rgba(255, 255, 255, 0.1);
}

.btn-group {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    width: 100%;
}

.btn-block {
    flex: 1;
    justify-content: center;
}

.product-card .product-actions {
    position: absolute;
    top: var(--space-sm);
    right: var(--space-sm);
}

.product-card .product-actions button {
    width: 28px;
    height: 28px;
    border-radius: var(--radius-full);
    border: none;
    background: rgba(0, 0, 0, 0.6);
    color: var(--text-secondary);
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
}

/* === Recipe Detail Hero Style === */
.detail-hero-section {
    background: var(--bg-primary);
    min-height: 100vh;
    padding-bottom: 80px;
}

.detail-header-hero {
    background: var(--gradient-hot);
    /* Default, overridden via JS */
    padding: 2px 24px 48px;
    /* Extra padding bottom for overlap */
    text-align: center;
    border-bottom-left-radius: 32px;
    border-bottom-right-radius: 32px;
    box-shadow: var(--elevation-3);
    position: relative;
    z-index: 1;
}

.detail-title-hero {
    font-size: 28px;
    font-weight: 800;
    color: white;
    margin: 16px 0 8px;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    line-height: 1.2;
}

.detail-profit-hero {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    font-size: 18px;
    color: #ccff90;
    /* Light green accent */
    font-weight: 700;
    margin-bottom: 16px;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}

.detail-fc-pill {
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(8px);
    border-radius: 20px;
    padding: 6px 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    border: 1px solid rgba(255, 255, 255, 0.1);
    width: 100%;
    box-sizing: border-box;
}

/* Contenedor que apila las dos pills siempre en 2 filas */
.detail-info-rows {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 0 16px;
    margin: 12px 0 4px;
}

.detail-meta-info {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.95);
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(8px);
    border-radius: 30px;
    padding: 8px 24px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    width: 100%;
    box-sizing: border-box;
}


.detail-stats-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    padding: 0 20px;
    margin-top: -36px;
    margin-bottom: 16px;
    /* Overlap header */
    position: relative;
    z-index: 10;
}


.stat-card-hero {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 16px 8px;
    text-align: center;
    box-shadow: var(--elevation-2);
    border: 1px solid var(--border-color);
}

.stat-card-hero .value {
    font-size: 18px;
    font-weight: 800;
    margin-bottom: 4px;
}

.stat-card-hero .label {
    font-size: 10px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}



.detail-actions-hero {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    padding: 0 20px 24px;
}

/* Ingredients List styling */
.ingredient-list-hero {
    padding: 0 20px;
}

.ingredient-item-card {
    background: var(--bg-card);
    /* Lighter than bg-primary */
    border-radius: 12px;
    padding: 12px 16px;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border: 1px solid var(--border-color);
    box-shadow: var(--elevation-1);
}

.ingredient-info-col {
    display: flex;
    flex-direction: column;
}

.ing-name {
    font-size: 14px;
    font-weight: 600;
    color: #FBBF24;
    margin-bottom: 2px;
}

.ing-meta {
    font-size: 12px;
    color: var(--text-muted);
}

.ing-cost-col {
    text-align: right;
    font-weight: 600;
    color: #4CAF50;
    font-size: 14px;
    min-width: 60px;
}

.ing-actions-col {
    display: flex;
    gap: 12px;
    margin-left: 12px;
    opacity: 0.6;
}

.list-header-row {
    display: flex;
    justify-content: space-between;
    padding: 0 36px 8px 16px;
    /* Align with content */
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 600;
    text-transform: uppercase;
}

/* === Escandallo Tabs === */
.escandallo-tabs {
    display: flex;
    gap: 0;
    margin-bottom: var(--space-md);
    background: var(--bg-card);
    border-radius: var(--radius-md);
    padding: 4px;
    border: 1px solid var(--border-color);
}

.escandallo-tab {
    flex: 1;
    padding: 10px var(--space-md);
    border: none;
    background: none;
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

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

.escandallo-tab.active {
    background: var(--accent);
    color: white;
    box-shadow: var(--shadow-sm);
}

/* === Escandallo (Recetas lista) === */
.section-group {
    margin-bottom: var(--space-lg);
}

.section-title {
    font-size: 0.8rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-secondary);
    padding: var(--space-sm) 0;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: var(--space-sm);
}

.plato-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-md) 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    cursor: pointer;
    transition: var(--transition-fast);
}

.plato-item:hover {
    background: var(--bg-card);
    margin: 0 calc(-1 * var(--space-md));
    padding: var(--space-md);
    border-radius: var(--radius-sm);
}

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

.plato-name {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 2px;
}

.plato-coste {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--color-coste);
}

.plato-coste::before {
    content: '👍 ';
    font-size: 0.75rem;
}

.plato-pvp {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--color-pvp);
    text-align: right;
}

.plato-actions {
    display: flex;
    gap: var(--space-xs);
    margin-left: var(--space-md);
}

.plato-actions button {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    border: none;
    background: var(--bg-input);
    color: var(--text-secondary);
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-fast);
}

.plato-actions button:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
}

/* === Detail View === */
.detail-view {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 200;
    background: var(--bg-primary);
    overflow-y: auto;
    transform: translateX(100%);
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.detail-view.active {
    transform: translateX(0);
}

.detail-header {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: 14px var(--space-md);
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    backdrop-filter: blur(12px);
}

/* Padding bottom so FAB doesn't cover last content */
#detail-content {
    padding-bottom: 100px;
}

.detail-header h2 {
    flex: 1;
    font-size: 1rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}


.detail-back {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    border: none;
    background: rgba(255, 111, 60, 0.15);
    color: var(--accent);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}

.detail-back:hover {
    background: rgba(255, 111, 60, 0.28);
    transform: translateX(-2px);
}

.detail-back-arrow {
    font-size: 1.1rem;
    line-height: 1;
}

.detail-back-label {
    font-size: 0.9rem;
}

/* Floating back button at bottom */
.detail-back-fab {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 210;
    display: none;
    align-items: center;
    gap: 8px;
    padding: 14px 32px;
    border-radius: 50px;
    border: none;
    background: linear-gradient(135deg, var(--accent), #FF8C5A);
    color: white;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(255, 111, 60, 0.5);
    transition: var(--transition);
}



.detail-back-fab:hover {
    transform: translateX(-50%) translateY(-2px);
    box-shadow: 0 6px 28px rgba(255, 111, 60, 0.65);
}

.detail-hero {
    text-align: center;
    padding: var(--space-xl) var(--space-md);
}

.detail-pvp {
    font-size: 3rem;
    font-weight: 800;
    color: var(--color-pvp);
    line-height: 1;
}

.detail-name {
    font-size: 1.4rem;
    font-weight: 700;
    margin: var(--space-md) 0 var(--space-sm);
}

.detail-coste {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--color-coste);
}

.detail-coste::before {
    content: '👍 ';
}

/* Food Cost Badge */
.food-cost-badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    padding: var(--space-xs) var(--space-md);
    border-radius: var(--radius-xl);
    font-size: 0.8rem;
    font-weight: 600;
    margin-top: var(--space-md);
}

.food-cost-badge.excelente {
    background: rgba(34, 197, 94, 0.15);
    color: var(--fc-excelente);
}

.food-cost-badge.aceptable {
    background: rgba(251, 191, 36, 0.15);
    color: var(--fc-aceptable);
}

.food-cost-badge.revisar {
    background: rgba(239, 68, 68, 0.15);
    color: var(--fc-revisar);
}

/* Stats Row */
.stats-row {
    display: flex;
    justify-content: center;
    gap: var(--space-lg);
    padding: var(--space-md);
    margin: var(--space-md);
    background: var(--bg-card);
    border-radius: var(--radius-md);
}

.stat-item {
    text-align: center;
}

.stat-value {
    font-size: 1.2rem;
    font-weight: 700;
}

.stat-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Ingredients Table */
.ingredients-section {
    padding: 0 var(--space-md);
    padding-bottom: var(--space-xl);
}

.ingredients-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-md);
}

.ingredients-header h3 {
    font-size: 1rem;
    font-weight: 600;
}

.ingredient-row {
    display: flex;
    align-items: center;
    padding: var(--space-md);
    background: var(--bg-card);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-sm);
    border: 1px solid var(--border-color);
    transition: var(--transition-fast);
}

.ingredient-row:hover {
    border-color: var(--border-accent);
}

.ingredient-name {
    flex: 1;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--color-margen);
}

.ingredient-cost {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--color-coste);
    min-width: 60px;
    text-align: center;
}

.ingredient-qty {
    font-size: 0.85rem;
    color: var(--text-secondary);
    min-width: 60px;
    text-align: center;
}

.ingredient-unit-price {
    font-size: 0.85rem;
    color: var(--text-secondary);
    min-width: 70px;
    text-align: right;
}

.ingredient-arrow {
    color: var(--text-muted);
    margin-left: var(--space-sm);
    min-width: 60px;
    text-align: right;
}

/* === Bottom Navigation === */
/* === Bottom Navigation - Material === */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 600px;
    background: var(--bg-secondary);
    display: flex;
    justify-content: space-around;
    padding: 8px 0 max(8px, env(safe-area-inset-bottom));
    box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.4);
    z-index: 150;
}

@media (min-width: 768px) {
    .bottom-nav {
        max-width: 100%;
    }
}

.nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 6px 8px;
    border: none;
    background: none;
    color: var(--text-secondary);
    cursor: pointer;
    position: relative;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 64px;
    height: 32px;
    background: transparent;
    border-radius: 16px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-item.active {
    color: var(--text-primary);
}

.nav-item.active::before {
    background: rgba(255, 111, 60, 0.12);
}

.nav-icon {
    font-size: 22px;
    position: relative;
    z-index: 1;
    transition: var(--transition);
}

.nav-item.active .nav-icon {
    filter: drop-shadow(0 0 8px rgba(255, 111, 60, 0.6));
}

.nav-label {
    font-size: 11px;
    font-weight: 500;
    position: relative;
    z-index: 1;
}

.nav-item:hover {
    color: var(--text-primary);
}

/* === FAB Button === */
.fab {
    position: fixed;
    bottom: calc(var(--nav-height) + var(--space-md) + env(safe-area-inset-bottom, 0));
    right: var(--space-md);
    border: none;
    background: linear-gradient(135deg, var(--accent), #FF8C5A);
    color: white;
    box-shadow: var(--shadow-glow), var(--shadow-lg);
    z-index: 140;
    cursor: pointer;
}

@media (min-width: 768px) {
    .fab {
        right: var(--space-lg);
    }
}

/* === Modal === */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-modal);
    z-index: 300;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    width: 100%;
    max-width: 480px;
    max-height: 90vh;
    background: var(--bg-secondary);
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    padding: var(--space-lg);
    overflow-y: auto;
    transform: translateY(100%);
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

@media (min-width: 768px) {
    .modal {
        max-width: 600px;
        border-radius: var(--radius-xl);
        margin-bottom: var(--space-xl);
    }
}

.modal-overlay.active .modal {
    transform: translateY(0);
}

.modal-handle {
    width: 40px;
    height: 4px;
    border-radius: 2px;
    background: var(--text-muted);
    margin: 0 auto var(--space-lg);
}

.modal-title {
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: var(--space-lg);
}

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

.form-label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: var(--space-xs);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-input,
.form-select {
    width: 100%;
    padding: var(--space-sm) var(--space-md);
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.95rem;
    outline: none;
    transition: var(--transition);
}

.form-input:focus,
.form-select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-light);
}

.form-input::placeholder {
    color: var(--text-muted);
}

/* === Quill Editor Dark Theme Override === */
.quill-wrapper {
    margin-top: 6px;
    border-radius: var(--radius-sm);
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.quill-wrapper .ql-toolbar.ql-snow {
    background: var(--bg-input);
    border: none;
    border-bottom: 1px solid var(--border-color);
    padding: 6px 8px;
}

.quill-wrapper .ql-container.ql-snow {
    background: var(--bg-input);
    border: none;
    min-height: 100px;
    font-size: 0.95rem;
}

.quill-wrapper .ql-editor {
    color: var(--text-primary);
    min-height: 100px;
    padding: 10px 14px;
}

.quill-wrapper .ql-editor.ql-blank::before {
    color: var(--text-muted);
    font-style: normal;
}

.quill-wrapper .ql-snow .ql-stroke {
    stroke: var(--text-secondary);
}

.quill-wrapper .ql-snow .ql-fill {
    fill: var(--text-secondary);
}

.quill-wrapper .ql-snow .ql-picker {
    color: var(--text-secondary);
}

.quill-wrapper .ql-snow .ql-picker-options {
    background: var(--bg-card);
    border-color: var(--border-color);
}

.quill-wrapper .ql-snow button:hover .ql-stroke,
.quill-wrapper .ql-snow .ql-picker-label:hover .ql-stroke {
    stroke: var(--primary);
}

.quill-wrapper .ql-snow button:hover .ql-fill,
.quill-wrapper .ql-snow .ql-picker-label:hover .ql-fill {
    fill: var(--primary);
}

.quill-wrapper .ql-snow button.ql-active .ql-stroke {
    stroke: var(--primary);
}

.quill-wrapper .ql-snow button.ql-active .ql-fill {
    fill: var(--primary);
}

/* Descripcion rendered in detail view */
/* === Image Upload Area === */
.image-upload-area {
    width: 100%;
    height: 180px;
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-md);
    cursor: pointer;
    overflow: hidden;
    transition: var(--transition);
    position: relative;
    margin-top: 6px;
}

.image-upload-area:hover {
    border-color: var(--primary);
    background: rgba(255, 107, 53, 0.05);
}

.image-upload-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    gap: 4px;
    position: relative;
}

.image-upload-placeholder p {
    margin: 0;
    font-size: 0.85rem;
}

.image-upload-placeholder img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.remove-image-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
    transition: var(--transition);
}

.remove-image-btn:hover {
    background: var(--danger);
    transform: scale(1.1);
}

/* Detail view plato image */
.plato-detail-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
    border-radius: var(--radius-md);
    margin: 12px 0;
}

/* Descripcion rendered in detail view */
.descripcion-content {
    color: var(--text-secondary);
    line-height: 1.6;
    margin: 8px 0 0 0;
}

.descripcion-content p {
    margin: 4px 0;
}

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

.descripcion-content em {
    font-style: italic;
}

.descripcion-content ul,
.descripcion-content ol {
    padding-left: 20px;
    margin: 4px 0;
}

.form-select {
    -webkit-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%239CA3AF' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-md);
}

/* === Buttons === */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-lg);
    border-radius: var(--radius-sm);
    border: none;
    font-size: 0.9rem;
    font-weight: 600;
    transition: var(--transition);
    cursor: pointer;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent), var(--accent-hover));
    color: white;
    width: 100%;
    padding: var(--space-md);
}

.btn-primary:hover {
    box-shadow: var(--shadow-glow);
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--bg-input);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-danger {
    background: rgba(239, 68, 68, 0.15);
    color: var(--fc-revisar);
}

.btn-sm {
    padding: var(--space-xs) var(--space-md);
    font-size: 0.8rem;
}

/* === Loading === */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-2xl);
}

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

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

/* === Toast Notifications === */
.toast-container {
    position: fixed;
    top: var(--space-md);
    left: 50%;
    transform: translateX(-50%);
    z-index: 400;
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    width: calc(100% - var(--space-lg));
    max-width: 420px;
}

.toast {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: var(--space-md);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    box-shadow: var(--shadow-lg);
    animation: slideDown 0.3s ease, fadeOut 0.3s ease 2.7s forwards;
    font-size: 0.9rem;
}

.toast.success {
    border-left: 3px solid var(--fc-excelente);
}

.toast.error {
    border-left: 3px solid var(--fc-revisar);
}

.toast.warning {
    border-left: 3px solid var(--fc-aceptable);
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeOut {
    to {
        opacity: 0;
        transform: translateY(-20px);
    }
}

/* === Empty State === */
.empty-state {
    text-align: center;
    padding: var(--space-2xl);
}

.empty-state .empty-icon {
    font-size: 3rem;
    margin-bottom: var(--space-md);
    opacity: 0.5;
}

.empty-state p {
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* === Proveedor Badge Count === */
.badge-count {
    background: var(--accent);
    color: white;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 10px;
    margin-left: var(--space-xs);
}

/* === Animations === */
.fade-in {
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.slide-up {
    animation: slideUp 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* === Scrollbar === */
::-webkit-scrollbar {
    width: 4px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: var(--bg-card-hover);
    border-radius: 2px;
}

/* === View containers === */
.view {
    display: none;
}

.view.active {
    display: block;
}

/* Provider detail in modal */
.provider-products-list {
    margin-top: var(--space-md);
}

.provider-product-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-sm) 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    font-size: 0.85rem;
}

.provider-product-name {
    color: var(--text-secondary);
    flex: 1;
}

.provider-product-price {
    color: var(--color-coste);
    font-weight: 600;
}

/* Provider products accordion */
.accordion-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    padding: 12px 0;
    user-select: none;
    transition: opacity 0.2s;
}

.accordion-header:hover {
    opacity: 0.8;
}

.accordion-chevron {
    font-size: 0.75rem;
    color: var(--text-secondary);
    transition: transform 0.3s ease;
}

.accordion-body {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease;
}

.accordion-open .accordion-chevron {
    transform: rotate(90deg);
}

.accordion-open .accordion-body {
    max-height: 5000px;
}

/* Contact cards */
.contact-card {
    background: var(--bg-input);
    border-radius: var(--radius-sm);
    padding: var(--space-md);
    margin-bottom: var(--space-sm);
}

.contact-name {
    font-weight: 600;
    margin-bottom: var(--space-xs);
}

.contact-info {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.contact-info span {
    display: block;
}

/* Editable contact rows (edit modal) */
.edit-section-divider {
    margin: 20px 0 12px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.edit-section-divider h3 {
    font-size: 1rem;
    font-weight: 600;
    margin: 0;
}

.contacto-edit-row {
    background: var(--bg-input);
    border-radius: var(--radius-sm);
    padding: 12px;
    margin-bottom: 10px;
    border: 1px solid var(--border);
    transition: border-color 0.2s;
}

.contacto-edit-row:hover {
    border-color: var(--accent);
}

.contacto-edit-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.contacto-edit-num {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-icon-danger {
    background: none;
    border: none;
    color: var(--color-danger);
    cursor: pointer;
    font-size: 1.1rem;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    transition: background 0.2s;
}

.btn-icon-danger:hover {
    background: rgba(239, 68, 68, 0.15);
}

.btn-outline {
    background: transparent;
    border: 1px dashed var(--border);
    color: var(--text-secondary);
    transition: all 0.2s;
}

.btn-outline:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: rgba(46, 117, 182, 0.08);
}

/* === Desktop layout === */
@media (min-width: 768px) {
    .cards-grid {
        gap: var(--space-lg);
    }

    .card {
        padding: var(--space-lg);
    }

    .product-card .product-image,
    .product-card .product-image-placeholder {
        height: 140px;
    }

    .detail-view {
        left: 0;
        right: 0;
        transform: translateX(100%);
    }

    .detail-view.active {
        transform: translateX(0);
    }
}

/* === Proveedor info pill in product card === */
.product-provider {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: var(--space-xs);
    display: flex;
    align-items: center;
    gap: 4px;
}

/* === Alérgenos === */
.alergenos-section {
    padding: 0 var(--space-md);
    margin-bottom: var(--space-lg);
}

.alergenos-section h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: var(--space-md);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.alergenos-grid {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-sm);
}

.alergeno-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: var(--radius-xl);
    font-size: 0.75rem;
    font-weight: 600;
    background: rgba(239, 68, 68, 0.12);
    color: #FF6B6B;
    border: 1px solid rgba(239, 68, 68, 0.25);
    white-space: nowrap;
}

.alergeno-badge .alergeno-icon {
    font-size: 0.9rem;
}

/* Alérgenos en formulario (checkboxes) */
.alergenos-form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-sm);
}

@media (min-width: 480px) {
    .alergenos-form-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

.alergeno-check {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    background: var(--bg-input);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition-fast);
    border: 1px solid transparent;
    font-size: 0.75rem;
}

.alergeno-check:hover {
    background: var(--bg-card-hover);
}

.alergeno-check.checked {
    background: rgba(239, 68, 68, 0.12);
    border-color: rgba(239, 68, 68, 0.3);
    color: #FF6B6B;
}

.alergeno-check input[type="checkbox"] {
    accent-color: var(--accent);
    width: 16px;
    height: 16px;
}

.alergeno-check .alg-icon {
    font-size: 1rem;
}

.alergeno-check .alg-label {
    font-size: 0.7rem;
    font-weight: 500;
}

/* Food cost dot indicador en listado platos */
.plato-fc-dot {
    width: 8px;
    height: 8px;
    border-radius: var(--radius-full);
    display: inline-block;
    margin-right: var(--space-xs);
    flex-shrink: 0;
}

.plato-fc-dot.excelente {
    background: var(--fc-excelente);
    box-shadow: 0 0 6px rgba(34, 197, 94, 0.5);
}

.plato-fc-dot.aceptable {
    background: var(--fc-aceptable);
    box-shadow: 0 0 6px rgba(251, 191, 36, 0.5);
}

.plato-fc-dot.revisar {
    background: var(--fc-revisar);
    box-shadow: 0 0 6px rgba(239, 68, 68, 0.5);
}

/* Food cost en listado */
.plato-fc-text {
    font-size: 0.7rem;
    font-weight: 600;
    margin-left: var(--space-xs);
}

.plato-fc-text.excelente {
    color: var(--fc-excelente);
}

.plato-fc-text.aceptable {
    color: var(--fc-aceptable);
}

.plato-fc-text.revisar {
    color: var(--fc-revisar);
}

/* Merma input */
.merma-group {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.merma-group .form-input {
    width: 80px;
    text-align: center;
}

.merma-group .merma-suffix {
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* ============================================
   DASHBOARD
   ============================================ */

/* KPI Cards Grid */
.dash-kpis {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-md);
    margin-bottom: var(--space-lg);
}

.dash-kpi-card {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    padding: var(--space-lg) var(--space-md);
    border: 1px solid var(--border-color);
    text-align: center;
    position: relative;
    overflow: hidden;
    transition: var(--transition);
}

.dash-kpi-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    border-radius: 0 0 4px 4px;
}

.dash-kpi-card.kpi-fc::before {
    background: linear-gradient(90deg, var(--fc-excelente), var(--fc-aceptable));
}

.dash-kpi-card.kpi-margen::before {
    background: linear-gradient(90deg, var(--color-margen), #F59E0B);
}

.dash-kpi-card.kpi-recetas::before {
    background: linear-gradient(90deg, var(--accent), var(--accent-hover));
}

.dash-kpi-card.kpi-alertas::before {
    background: linear-gradient(90deg, var(--fc-revisar), #DC2626);
}

.dash-kpi-card:hover {
    border-color: var(--border-accent);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.kpi-icon {
    font-size: 1.8rem;
    margin-bottom: var(--space-sm);
}

.kpi-value {
    font-size: 2rem;
    font-weight: 800;
    line-height: 1.1;
    margin-bottom: var(--space-xs);
}

.kpi-value.excelente {
    color: var(--fc-excelente);
}

.kpi-value.aceptable {
    color: var(--fc-aceptable);
}

.kpi-value.revisar {
    color: var(--fc-revisar);
}

.kpi-label {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Counters Row */
.dash-counters {
    display: flex;
    justify-content: space-around;
    background: var(--bg-card);
    border-radius: var(--radius-md);
    padding: var(--space-md);
    margin-bottom: var(--space-lg);
    border: 1px solid var(--border-color);
}

.counter-item {
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.counter-val {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text-primary);
}

.counter-lbl {
    font-size: 0.65rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Dashboard Sections */
.dash-section {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    padding: var(--space-lg);
    margin-bottom: var(--space-lg);
    border: 1px solid var(--border-color);
}

.dash-section-title {
    font-size: 0.95rem;
    font-weight: 700;
    margin-bottom: var(--space-md);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

/* Dashboard Accordion */
.dash-accordion {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-md);
    border: 1px solid var(--border-color);
    overflow: hidden;
}

.dash-accordion-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px var(--space-lg);
    cursor: pointer;
    transition: var(--transition);
    user-select: none;
    -webkit-user-select: none;
}

.dash-accordion-header:hover {
    background: var(--bg-card-hover);
}

.dash-accordion-header.open {
    border-bottom: 1px solid var(--border-color);
}

.dash-accordion-title {
    font-size: 0.9rem;
    font-weight: 700;
    margin: 0;
    color: var(--text-primary);
}

.dash-accordion-arrow {
    font-size: 0.7rem;
    color: var(--text-muted);
    transition: var(--transition);
}

.dash-accordion-body {
    padding: var(--space-lg);
}

/* Chart containers */
.dash-chart-container {
    height: 200px;
    position: relative;
    margin-bottom: var(--space-md);
}

.dash-chart-bar {
    height: 260px;
}

/* FC Legend */
.dash-fc-legend {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.fc-legend-item {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.fc-legend-dot {
    width: 10px;
    height: 10px;
    border-radius: var(--radius-full);
    flex-shrink: 0;
}

/* Rankings */
.dash-ranking {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.rank-item {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-sm);
    transition: var(--transition-fast);
    border: 1px solid transparent;
}

.rank-item:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-accent);
}

.rank-pos {
    width: 24px;
    height: 24px;
    border-radius: var(--radius-full);
    background: var(--bg-input);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--text-muted);
    flex-shrink: 0;
}

.rank-item:nth-child(1) .rank-pos {
    background: linear-gradient(135deg, #FFD700, #FFA000);
    color: #1A1A1A;
}

.rank-item:nth-child(2) .rank-pos {
    background: linear-gradient(135deg, #C0C0C0, #9E9E9E);
    color: #1A1A1A;
}

.rank-item:nth-child(3) .rank-pos {
    background: linear-gradient(135deg, #CD7F32, #A0522D);
    color: white;
}

.rank-name {
    flex: 1;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-primary);
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.rank-fc {
    font-size: 0.75rem;
    font-weight: 700;
    min-width: 40px;
    text-align: right;
}

.rank-fc.excelente {
    color: var(--fc-excelente);
}

.rank-fc.aceptable {
    color: var(--fc-aceptable);
}

.rank-fc.revisar {
    color: var(--fc-revisar);
}

.rank-margen {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--color-coste);
    min-width: 55px;
    text-align: right;
}

/* Desktop responsive */
@media (min-width: 768px) {
    .dash-kpis {
        grid-template-columns: repeat(4, 1fr);
    }

    .dash-chart-container {
        height: 280px;
    }

    .dash-chart-bar {
        height: 320px;
    }
}

/* ============================================
   LOGIN & AUTH
   ============================================ */

/* Profile Screen */
#profile-modal {
    max-height: 75vh;
}

.profile-screen {
    padding: 8px 0 24px;
}

.profile-title {
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 20px;
}

.profile-header-info {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 28px;
}

.profile-avatar {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.profile-avatar span {
    font-size: 1.5rem;
    font-weight: 800;
    color: white;
}

.profile-name-block {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.profile-display-name {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
}

.profile-label {
    display: block;
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 6px;
    margin-top: 16px;
}

.profile-input {
    width: 100%;
    padding: 12px 14px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.95rem;
    outline: none;
    transition: var(--transition);
    box-sizing: border-box;
}

.profile-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(255, 107, 53, 0.15);
}

.profile-divider {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 24px;
    margin-bottom: 4px;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
}

.profile-buttons {
    display: flex;
    gap: 12px;
    margin-top: 28px;
}

.profile-btn-save {
    flex: 1;
    padding: 14px;
    background: linear-gradient(135deg, var(--accent), #f59e0b);
    border: none;
    border-radius: var(--radius-md);
    color: white;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.profile-btn-save:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.profile-btn-save:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.profile-btn-logout {
    flex: 1;
    padding: 14px;
    background: transparent;
    border: 2px solid var(--accent);
    border-radius: var(--radius-md);
    color: var(--accent);
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
}

.profile-btn-logout:hover {
    background: rgba(255, 107, 53, 0.1);
}

/* Login Screen */
.login-screen {
    position: fixed;
    inset: 0;
    z-index: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-primary);
    background-image:
        radial-gradient(ellipse at 20% 50%, rgba(255, 107, 53, 0.08) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 20%, rgba(255, 107, 53, 0.05) 0%, transparent 50%);
    padding: var(--space-lg);
}

.login-card {
    width: 100%;
    max-width: 380px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: var(--space-2xl) var(--space-xl);
    text-align: center;
    position: relative;
    overflow: hidden;
}

.login-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--accent), var(--accent-hover), #FF6B6B);
}

.login-logo {
    font-size: 3.5rem;
    margin-bottom: var(--space-md);
    filter: drop-shadow(0 4px 12px rgba(255, 107, 53, 0.3));
}

.login-title {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: var(--space-xs);
}

.login-subtitle {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: var(--space-xl);
}

.login-input {
    font-size: 1rem !important;
    padding: var(--space-md) !important;
}

.login-btn {
    margin-top: var(--space-md);
    font-size: 1rem;
    padding: var(--space-md) !important;
    position: relative;
}

.login-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

/* Password toggle */
.password-wrapper {
    position: relative;
}

.password-wrapper .form-input {
    padding-right: 44px !important;
}

.password-toggle {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    padding: 4px;
    line-height: 1;
}

/* Spinner in button */
.btn-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    margin-left: var(--space-sm);
    vertical-align: middle;
}

/* User avatar in header */
.user-avatar-btn {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-full);
    overflow: hidden;
    padding: 0 !important;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--accent) !important;
    background: var(--bg-input) !important;
    transition: var(--transition-fast);
}

.user-avatar-btn:hover {
    box-shadow: 0 0 0 3px var(--accent-light);
    transform: scale(1.1);
}

.user-avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.user-avatar-letter {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--accent);
}

/* Profile modal */
.profile-header {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    margin-bottom: var(--space-lg);
    padding-bottom: var(--space-md);
    border-bottom: 1px solid var(--border-color);
}

.profile-avatar-large {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-full);
    background: linear-gradient(135deg, var(--accent), var(--accent-hover));
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
}

.profile-avatar-large img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.profile-avatar-large span {
    font-size: 1.4rem;
    font-weight: 800;
    color: white;
}

.profile-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.profile-name {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
}

.profile-role {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.profile-role.role-admin {
    color: var(--accent);
}

.profile-role.role-empleado {
    color: var(--text-muted);
}

/* === Fase 4A: Historial de Precios === */
.historial-section {
    margin-top: var(--space-md);
}

.historial-section h3 {
    font-size: 1rem;
    font-weight: 600;
}

.historial-chart-container {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    padding: var(--space-md) !important;
    border: 1px solid var(--border-color);
    height: 220px;
    position: relative;
}

.historial-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-sm) var(--space-md);
    background: var(--bg-card);
    border-radius: var(--radius-sm);
    margin-bottom: var(--space-xs);
    border: 1px solid var(--border-color);
    font-size: 0.8rem;
    transition: var(--transition-fast);
}

.historial-item:hover {
    border-color: var(--border-accent);
}

.historial-item.historial-alerta {
    border-color: var(--fc-revisar);
    background: rgba(239, 68, 68, 0.05);
}

.historial-fecha {
    color: var(--text-muted);
    min-width: 80px;
    font-size: 0.75rem;
}

.historial-precios {
    color: var(--text-secondary);
    flex: 1;
    text-align: center;
    font-weight: 500;
}

.historial-variacion {
    min-width: 70px;
    text-align: right;
    font-weight: 600;
    font-size: 0.8rem;
}

.historial-variacion.precio-sube {
    color: var(--fc-revisar);
}

.historial-variacion.precio-baja {
    color: var(--fc-excelente);
}

/* === Fase 4A: Subrecetas === */
.subreceta-badge {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 2px 8px;
    background: rgba(37, 99, 235, 0.15);
    color: #60A5FA;
    border-radius: var(--radius-sm);
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin-right: var(--space-xs);
}

.subreceta-row {
    border-color: rgba(37, 99, 235, 0.2) !important;
}

.subreceta-row:hover {
    border-color: rgba(37, 99, 235, 0.5) !important;
}

/* Toggle Producto / Subreceta */
.tipo-toggle {
    display: flex;
    gap: 0;
    margin-bottom: var(--space-md);
    background: var(--bg-input);
    border-radius: var(--radius-md);
    padding: 3px;
    border: 1px solid var(--border-color);
}

.tipo-btn {
    flex: 1;
    padding: var(--space-sm) var(--space-md);
    border: none;
    background: none;
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 600;
    border-radius: calc(var(--radius-md) - 2px);
    transition: var(--transition-fast);
    cursor: pointer;
}

.tipo-btn.active {
    background: var(--accent);
    color: white;
    box-shadow: var(--shadow-sm);
}

.tipo-btn:hover:not(.active) {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

/* Buscador Autocompletado en Modal Ingredientes */
.search-autocomplete {
    position: relative;
}

.search-ac-input {
    padding-left: 12px !important;
}

.search-ac-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-card);
    border: 1px solid var(--border-accent);
    border-top: none;
    border-radius: 0 0 var(--radius-md) var(--radius-md);
    max-height: 220px;
    overflow-y: auto;
    z-index: 1200;
    box-shadow: var(--shadow-lg);
}

.search-ac-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    cursor: pointer;
    border-bottom: 1px solid var(--border-color);
    transition: var(--transition-fast);
}

.search-ac-item:last-child {
    border-bottom: none;
}

.search-ac-item:hover {
    background: rgba(255, 255, 255, 0.06);
}

.search-ac-name {
    font-size: 0.85rem;
    color: var(--text-primary);
    font-weight: 500;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-right: 8px;
}

.search-ac-detail {
    font-size: 0.75rem;
    color: var(--accent);
    font-weight: 600;
    white-space: nowrap;
}

.search-ac-empty {
    padding: 14px;
    color: var(--text-muted);
    font-size: 0.8rem;
    text-align: center;
}

/* Chip de selección */
.search-selected {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    background: var(--bg-input);
    border: 1px solid var(--accent);
    border-radius: var(--radius-md);
    gap: 8px;
}

.search-sel-text {
    font-size: 0.85rem;
    color: var(--text-primary);
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
}

.search-sel-clear {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
    transition: var(--transition-fast);
}

/* Simulador de Escenarios */
.modal-xl {
    max-width: 900px !important;
}

.sim-tabs {
    display: flex;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: var(--space-md);
}

.sim-tab {
    padding: var(--space-sm) var(--space-md);
    cursor: pointer;
    font-weight: 600;
    color: var(--text-muted);
    border-bottom: 2px solid transparent;
    transition: var(--transition-fast);
}

.sim-tab:hover {
    color: var(--text-primary);
}

.sim-tab.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

.sim-content {
    display: none;
    padding: var(--space-sm) 0;
}

.sim-content.active {
    display: block;
}

.sim-range-container {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    margin: var(--space-md) 0;
    padding: var(--space-md);
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
}

.sim-range {
    flex: 1;
    cursor: pointer;
}

.sim-value {
    font-weight: 700;
    font-size: 1.2rem;
    min-width: 60px;
    text-align: right;
    color: var(--accent);
}

.sim-table-container {
    margin-top: var(--space-md);
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
}

.sim-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.sim-table th,
.sim-table td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.sim-table th {
    background: var(--bg-card);
    position: sticky;
    top: 0;
    font-weight: 600;
    z-index: 10;
}

.sim-diff-pos {
    color: var(--fc-revisar);
    font-weight: 600;
}

.sim-diff-neg {
    color: var(--fc-excelente);
    font-weight: 600;
}

.sim-cost-old {
    text-decoration: line-through;
    color: var(--text-muted);
    font-size: 0.8em;
    margin-right: 4px;
}

.sim-cost-new {
    font-weight: 600;
}

.sim-row-critic {
    background: rgba(239, 68, 68, 0.1);
}

/* Margen bajo */
.sim-row-warning {
    background: rgba(245, 158, 11, 0.05);
}

/* ============================================
   Login Screen
   ============================================ */
#login-screen {
    background: var(--bg-primary);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 500;
}

.login-card {
    width: 100%;
    max-width: 380px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: var(--space-xl) var(--space-lg);
    box-shadow: var(--shadow-lg);
    animation: loginFadeIn 0.5s ease;
}

@keyframes loginFadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.login-header {
    text-align: center;
    margin-bottom: var(--space-xl);
}

.login-icon {
    font-size: 3rem;
    display: block;
    margin-bottom: var(--space-sm);
}

.login-title {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: var(--space-xs);
}

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

.login-field {
    margin-bottom: var(--space-md);
}

.login-field label {
    display: block;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: var(--space-xs);
}

.login-field label i {
    margin-right: 4px;
    color: var(--text-muted);
}

.login-field input {
    width: 100%;
    padding: 12px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.95rem;
    outline: none;
    transition: var(--transition);
}

.login-field input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-light);
}

.login-field input::placeholder {
    color: var(--text-muted);
}

.password-wrapper {
    position: relative;
}

.password-wrapper input {
    padding-right: 44px;
}

.toggle-password {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 32px;
    height: 32px;
    border: none;
    background: none;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition-fast);
}

.toggle-password:hover {
    color: var(--text-primary);
}

.login-error {
    background: rgba(239, 68, 68, 0.15);
    color: var(--fc-revisar);
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    margin-bottom: var(--space-md);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.login-btn {
    width: 100%;
    padding: 14px;
    border: none;
    border-radius: var(--radius-sm);
    background: linear-gradient(135deg, var(--accent), #FF8C5A);
    color: white;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: var(--space-md);
}

.login-btn:hover {
    box-shadow: var(--shadow-glow);
    transform: translateY(-1px);
}

.login-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.login-btn-loader {
    display: inline-flex;
    align-items: center;
}

.spinner-small {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

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

/* Accordion */
.recipe-accordion-body {
    display: none !important;
}

.recipe-accordion-body.open {
    display: grid !important;
    grid-template-columns: 1fr;
    gap: 12px;
    align-items: start;
    animation: slideDown 0.3s ease;
}

@media (min-width: 768px) {
    .recipe-accordion-body.open {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 12px;
    }
}

@media (min-width: 900px) {
    .recipe-accordion-body.open {
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 16px;
    }
}

@media (min-width: 1200px) {
    .recipe-accordion-body.open {
        grid-template-columns: repeat(4, 1fr) !important;
    }
}

@media (min-width: 1600px) {
    .recipe-accordion-body.open {
        grid-template-columns: repeat(5, 1fr) !important;
    }
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.accordion-icon {
    display: inline-block;
    transition: transform 0.3s ease;
}

.recipe-accordion-header.open .accordion-icon {
    transform: rotate(180deg);
}

/* ============================================
   CARTA ADMIN - Configurator Styles
   ============================================ */
.carta-admin-tabs {
    display: flex;
    border-bottom: 2px solid var(--border-color);
    background: var(--bg-secondary);
    position: sticky;
    top: 56px;
    z-index: 10;
}

.carta-tab {
    flex: 1;
    padding: 12px 8px;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 0.82rem;
    cursor: pointer;
    transition: all 0.3s;
    border-bottom: 2px solid transparent;
    font-family: inherit;
}

.carta-tab:hover {
    color: var(--text-primary);
    background: var(--bg-card);
}

.carta-tab.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

/* Category Row */
.cat-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
    background: var(--bg-card);
    border-radius: 10px;
    margin-bottom: 8px;
    border: 1px solid var(--border-color);
    transition: all 0.2s;
}

.cat-row:hover {
    border-color: var(--accent);
}

.cat-drag-handle {
    color: var(--text-muted);
    cursor: grab;
    font-size: 1.2rem;
    user-select: none;
    flex-shrink: 0;
    padding: 0 4px;
}

.cat-drag-handle:active {
    cursor: grabbing;
}

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

.cat-row-name {
    display: block;
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.9rem;
}

.cat-row-count {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.cat-row-mode {
    background: var(--bg-input);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 4px 6px;
    font-size: 0.75rem;
    cursor: pointer;
    font-family: inherit;
}

/* Small Toggle Switch */
.switch-small {
    position: relative;
    display: inline-block;
    width: 36px;
    height: 20px;
    flex-shrink: 0;
}

.switch-small input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider-small {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: var(--bg-input);
    border-radius: 20px;
    transition: 0.3s;
}

.slider-small::before {
    content: '';
    position: absolute;
    height: 14px;
    width: 14px;
    left: 3px;
    bottom: 3px;
    background: white;
    border-radius: 50%;
    transition: 0.3s;
}

.switch-small input:checked+.slider-small {
    background: var(--accent);
}

.switch-small input:checked+.slider-small::before {
    transform: translateX(16px);
}

/* Small Icon Button */
.btn-icon-sm {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.85rem;
    padding: 4px;
    opacity: 0.5;
    transition: 0.2s;
}

.btn-icon-sm:hover {
    opacity: 1;
    transform: scale(1.2);
}

/* Platos Reorder Panel */
.platos-orden-panel {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 0 0 10px 10px;
    margin-top: -4px;
    margin-bottom: 8px;
    padding: 10px;
}

.platos-orden-toolbar {
    display: flex;
    gap: 8px;
    margin-bottom: 10px;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.78rem;
    border-radius: 6px;
}

.plato-orden-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-bottom: 4px;
    transition: all 0.15s;
}

.plato-orden-row:hover {
    border-color: var(--accent);
}

.plato-orden-handle {
    color: var(--text-muted);
    cursor: grab;
    font-size: 1rem;
    user-select: none;
    flex-shrink: 0;
}

.plato-orden-handle:active {
    cursor: grabbing;
}

.plato-orden-pos {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--accent-light);
    color: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
    flex-shrink: 0;
}

.plato-orden-name {
    flex: 1;
    font-size: 0.85rem;
    color: var(--text-primary);
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.plato-orden-margen {
    font-size: 0.78rem;
    color: var(--fc-excelente);
    font-weight: 600;
    flex-shrink: 0;
}

.plato-orden-pvp {
    font-size: 0.72rem;
    color: var(--text-muted);
    flex-shrink: 0;
}

.plato-orden-arrows {
    display: flex;
    gap: 2px;
    flex-shrink: 0;
}

.btn-icon-xs {
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.75rem;
    padding: 2px 6px;
    color: var(--text-secondary);
    transition: 0.2s;
}

.btn-icon-xs:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-light);
}

/* Franja Card */
.franja-card {
    background: var(--bg-card);
    border-radius: 10px;
    padding: 14px;
    margin-bottom: 10px;
    border: 1px solid var(--border-color);
}

.franja-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.franja-header strong {
    color: var(--text-primary);
    font-size: 0.95rem;
}

.franja-badge {
    display: inline-block;
    margin-left: 8px;
    padding: 2px 8px;
    border-radius: 12px;
    background: var(--accent-light);
    color: var(--accent);
    font-size: 0.75rem;
    font-weight: 600;
}

.franja-dias {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.franja-platos {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 4px;
}

/* Days Grid */
.dias-grid {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.dia-check {
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
}

.dia-check input {
    display: none;
}

.dia-check span {
    padding: 6px 10px;
    border-radius: 8px;
    background: var(--bg-input);
    color: var(--text-secondary);
    font-size: 0.78rem;
    font-weight: 500;
    transition: 0.2s;
    border: 1px solid var(--border-color);
}

.dia-check input:checked+span {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
}

.dia-check:hover span {
    border-color: var(--accent);
}

/* Form Row (2 col) */
.form-row {
    display: flex;
    gap: 12px;
}

.form-row .form-group {
    flex: 1;
}

/* Bottom Nav 5 items */
@media (max-width: 768px) {
    .bottom-nav {
        padding-bottom: env(safe-area-inset-bottom, 0);
    }

    .nav-item {
        min-width: 0;
    }

    .nav-label {
        font-size: 0.65rem;
    }
}

/* ============================================
   ANALYTICS DASHBOARD
   ============================================ */
.analytics-period {
    display: flex;
    gap: 6px;
    margin-bottom: 16px;
}

.period-pill {
    padding: 6px 14px;
    border-radius: 20px;
    background: var(--bg-input);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    font-size: 0.8rem;
    cursor: pointer;
    transition: 0.2s;
    font-family: inherit;
}

.period-pill:hover {
    border-color: var(--accent);
    color: var(--text-primary);
}

.period-pill.active {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
}

/* KPI Cards */
.analytics-kpis {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 20px;
}

.kpi-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 14px 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 4px;
}

.kpi-icon {
    font-size: 1.4rem;
}

.kpi-value {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--text-primary);
}

.kpi-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Analytics Section */
.analytics-section {
    margin-bottom: 20px;
}

.analytics-section-title {
    color: var(--text-primary);
    font-size: 0.9rem;
    margin-bottom: 10px;
    font-weight: 600;
}

/* Chart Containers */
.chart-container {
    background: var(--bg-card);
    border-radius: 10px;
    padding: 14px;
    height: 200px;
    border: 1px solid var(--border-color);
}

.chart-container-small {
    background: var(--bg-card);
    border-radius: 10px;
    padding: 14px;
    height: 200px;
    max-width: 300px;
    margin: 0 auto;
    border: 1px solid var(--border-color);
}

/* Ranking Rows */
.ranking-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-color);
}

.ranking-row:last-child {
    border-bottom: none;
}

.ranking-pos {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--accent-light);
    color: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
    flex-shrink: 0;
}

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

.ranking-name {
    display: block;
    font-size: 0.85rem;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ranking-bar {
    height: 4px;
    background: var(--bg-input);
    border-radius: 4px;
    margin-top: 4px;
    overflow: hidden;
}

.ranking-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), var(--accent-hover));
    border-radius: 4px;
    transition: width 0.5s ease;
}

.ranking-count {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 600;
    flex-shrink: 0;
}

/* Search Tags */
.search-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.search-tag {
    padding: 4px 10px;
    border-radius: 16px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-size: 0.78rem;
}

.search-tag em {
    color: var(--accent);
    font-style: normal;
    font-weight: 600;
}

/* Share Section */
.share-block {
    margin-bottom: 20px;
}

/* QR Container */
.qr-container {
    display: flex;
    justify-content: center;
    padding: 20px;
    background: var(--bg-card);
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

.qr-container canvas,
.qr-container img {
    border-radius: 8px;
}

/* Iframe Preview */
.iframe-preview {
    background: var(--bg-card);
    border-radius: 10px;
    padding: 8px;
    border: 1px solid var(--border-color);
    overflow: hidden;
}

.iframe-preview iframe {
    border-radius: 6px;
}

/* Responsive Grid for Products */
.responsive-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    align-items: start;
}

@media (min-width: 600px) {
    .responsive-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 16px;
    }
}

@media (min-width: 900px) {
    .responsive-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (min-width: 1200px) {
    .responsive-grid {
        grid-template-columns: repeat(5, 1fr);
    }
}

/* === Custom Confirm Dialog === */
.confirm-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}

.confirm-overlay.active {
    opacity: 1;
    visibility: visible;
}

.confirm-dialog {
    background: var(--bg-secondary);
    border-radius: 20px;
    padding: 32px 28px 24px;
    width: 90%;
    max-width: 360px;
    text-align: center;
    transform: scale(0.9) translateY(20px);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    border: 1px solid var(--border-color);
}

.confirm-overlay.active .confirm-dialog {
    transform: scale(1) translateY(0);
}

.confirm-icon {
    font-size: 48px;
    margin-bottom: 16px;
    line-height: 1;
}

.confirm-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.confirm-message {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 24px;
    line-height: 1.4;
}

.confirm-actions {
    display: flex;
    gap: 12px;
}

.confirm-cancel {
    flex: 1;
    padding: 12px 16px !important;
    border-radius: 12px !important;
    font-weight: 600 !important;
    font-size: 0.95rem !important;
}

.confirm-accept {
    flex: 1;
    padding: 12px 16px !important;
    border-radius: 12px !important;
    font-weight: 600 !important;
    font-size: 0.95rem !important;
    background: #EF4444 !important;
    border: none !important;
    color: white !important;
}

.confirm-accept:active {
    background: #DC2626 !important;
    transform: scale(0.97);
}

/* === FAB with Label === */
.fab {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-width: 56px;
    height: 56px;
    padding: 0 20px;
    border-radius: 28px;
    white-space: nowrap;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.fab-icon {
    font-size: 1.5rem;
    line-height: 1;
    flex-shrink: 0;
}

.fab-label {
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.3px;
    max-width: 0;
    opacity: 0;
    overflow: hidden;
    transition: max-width 0.3s ease, opacity 0.2s ease;
}

.fab.fab-expanded .fab-label {
    max-width: 120px;
    opacity: 1;
}

.fab.fab-expanded {
    padding: 0 20px;
}

.fab:hover,
.fab:active {
    transform: scale(1.05);
    box-shadow: 0 0 30px rgba(255, 107, 53, 0.4), var(--shadow-lg);
}

/* ============================================
   PEDIDOS MODULE
   ============================================ */

/* Pedido Filters */
.pedido-filters {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.pedido-filters .filter-select {
    flex: 1;
    min-width: 140px;
}

/* Pedido Cards */
.pedido-card {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    padding: 16px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    border-left: 4px solid var(--text-muted);
}

.pedido-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--elevation-3);
    border-color: var(--accent);
}

.pedido-card.estado-borrador {
    border-left-color: #6B7280;
}

.pedido-card.estado-enviado {
    border-left-color: #3B82F6;
}

.pedido-card.estado-confirmado {
    border-left-color: #22C55E;
}

.pedido-card.estado-recibido {
    border-left-color: #A855F7;
}

.pedido-card.estado-cancelado {
    border-left-color: #EF4444;
}

.pedido-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 10px;
}

.pedido-card-proveedor {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 65%;
}

.pedido-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
    flex-shrink: 0;
}

.pedido-badge.badge-borrador {
    background: rgba(107, 114, 128, 0.2);
    color: #9CA3AF;
}

.pedido-badge.badge-enviado {
    background: rgba(59, 130, 246, 0.15);
    color: #60A5FA;
}

.pedido-badge.badge-confirmado {
    background: rgba(34, 197, 94, 0.15);
    color: #4ADE80;
}

.pedido-badge.badge-recibido {
    background: rgba(168, 85, 247, 0.15);
    color: #C084FC;
}

.pedido-badge.badge-cancelado {
    background: rgba(239, 68, 68, 0.15);
    color: #F87171;
}

.pedido-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    font-size: 0.82rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.pedido-card-meta span {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.pedido-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--border-color);
}

.pedido-total {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--accent);
}

.pedido-items-count {
    font-size: 0.78rem;
    color: var(--text-muted);
    background: var(--bg-input);
    padding: 2px 10px;
    border-radius: 12px;
}

/* Pedido Stepper (crear pedido) */
.pedido-stepper {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    margin-bottom: 20px;
    padding: 0 12px;
}

.stepper-step {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.78rem;
    color: var(--text-muted);
    font-weight: 500;
}

.stepper-step.active {
    color: var(--accent);
}

.stepper-step.done {
    color: #22C55E;
}

.stepper-circle {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--bg-input);
    border: 2px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.78rem;
    transition: all 0.3s;
    flex-shrink: 0;
}

.stepper-step.active .stepper-circle {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
    box-shadow: 0 0 12px rgba(255, 107, 53, 0.4);
}

.stepper-step.done .stepper-circle {
    background: #22C55E;
    border-color: #22C55E;
    color: white;
}

.stepper-line {
    width: 30px;
    height: 2px;
    background: var(--border-color);
    margin: 0 6px;
    flex-shrink: 0;
}

.stepper-line.done {
    background: #22C55E;
}

/* Proveedor Selector (paso 1) */
.prov-select-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: 6px;
}

.prov-select-card:hover {
    border-color: var(--accent);
    background: var(--bg-card-hover);
}

.prov-select-card.selected {
    border-color: var(--accent);
    background: rgba(255, 107, 53, 0.08);
}

.prov-select-avatar {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: white;
    font-size: 14px;
    flex-shrink: 0;
}

/* Cart Items (paso 2) */
.cart-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    margin-bottom: 6px;
    transition: all 0.2s;
}

.cart-item:hover {
    border-color: var(--accent);
}

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

.cart-item-name {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cart-item-price {
    font-size: 0.78rem;
    color: var(--text-secondary);
}

.cart-item-qty {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.cart-item-qty input {
    width: 56px;
    text-align: center;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    padding: 6px 4px;
    font-size: 0.88rem;
    font-family: inherit;
}

.cart-item-qty input:focus {
    outline: none;
    border-color: var(--accent);
}

.cart-item-remove {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1rem;
    padding: 4px;
    transition: 0.2s;
}

.cart-item-remove:hover {
    color: #EF4444;
    transform: scale(1.2);
}

.cart-subtotal {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--accent);
    min-width: 55px;
    text-align: right;
    flex-shrink: 0;
}

/* Pedido Detail - Status Timeline */
.pedido-timeline {
    padding: 16px;
}

.timeline-item {
    display: flex;
    gap: 12px;
    padding-bottom: 16px;
    position: relative;
}

.timeline-item:not(:last-child)::before {
    content: '';
    position: absolute;
    left: 15px;
    top: 32px;
    bottom: 0;
    width: 2px;
    background: var(--border-color);
}

.timeline-item.done:not(:last-child)::before {
    background: #22C55E;
}

.timeline-dot {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--bg-input);
    border: 2px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
}

.timeline-item.done .timeline-dot {
    background: rgba(34, 197, 94, 0.15);
    border-color: #22C55E;
}

.timeline-item.current .timeline-dot {
    background: rgba(59, 130, 246, 0.15);
    border-color: #3B82F6;
    box-shadow: 0 0 8px rgba(59, 130, 246, 0.3);
}

.timeline-info {
    flex: 1;
}

.timeline-label {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-primary);
}

.timeline-date {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 2px;
}

/* Bottom Nav - 6 items adaptation */
@media (max-width: 480px) {
    .nav-item {
        padding: 6px 2px;
    }

    .nav-label {
        font-size: 0.58rem;
    }

    .nav-icon {
        font-size: 20px;
    }

    .nav-item::before {
        width: 48px;
    }
}

/* Pedido Summary Card */
.pedido-summary {
    background: var(--bg-card);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    padding: 16px;
    margin-bottom: 12px;
}

.pedido-summary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
}

.pedido-summary-row:not(:last-child) {
    border-bottom: 1px solid var(--border-color);
}

.pedido-summary-row .label {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.pedido-summary-row .value {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
}

.pedido-summary-total {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--accent);
}

/* Pedido Action Buttons */
.pedido-actions {
    display: flex;
    gap: 8px;
    padding: 16px;
    flex-wrap: wrap;
}

.pedido-actions .btn {
    flex: 1;
    min-width: 120px;
}

/* ====================================
   Product list in order creation (Step 2)
   ==================================== */
.pedido-prod-list {
    max-height: 42vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.pedido-prod-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-bottom: 1px solid var(--border-color);
    transition: background 0.2s;
}

.pedido-prod-row.pedido-prod-active {
    background: rgba(255, 107, 53, 0.08);
    border-left: 3px solid var(--accent);
}

.pedido-prod-img {
    width: 50px;
    height: 50px;
    border-radius: 8px;
    overflow: hidden;
    flex-shrink: 0;
    background: var(--bg-tertiary);
    display: flex;
    align-items: center;
    justify-content: center;
}

.pedido-prod-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.pedido-prod-img-placeholder {
    font-size: 1.5rem;
    color: var(--text-muted);
}

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

.pedido-prod-name {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}

.pedido-prod-price {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--accent);
    margin-top: 2px;
}

.pedido-prod-unit {
    font-weight: 400;
    color: var(--text-muted);
    font-size: 0.78rem;
}

/* Quantity controls (+/−) */
.pedido-prod-qty-controls {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

.pedido-qty-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}

.pedido-qty-minus {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
}

.pedido-qty-minus:hover {
    background: #ff4444;
    color: white;
}

.pedido-qty-plus {
    background: var(--accent);
    color: white;
}

.pedido-qty-plus:hover {
    background: #e55a2a;
}

.pedido-qty-value {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--text-primary);
    min-width: 40px;
    text-align: center;
    white-space: nowrap;
}

/* Add button (when not in cart) */
.pedido-add-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px solid var(--accent);
    background: transparent;
    color: var(--accent);
    font-size: 1.2rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.2s;
}

.pedido-add-btn:hover {
    background: var(--accent);
    color: white;
    transform: scale(1.1);
}

.pedido-add-icon {
    line-height: 1;
}

/* Cart bar button (Step 2) */
.pedido-cart-bar {
    display: none;
    position: sticky;
    bottom: 0;
    margin-top: 16px;
    padding: 8px 0 0;
    background: var(--bg-secondary);
}

.pedido-cart-bar-btn {
    width: 100%;
    padding: 14px 20px;
    border: none;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--accent), #FF8C5A);
    color: white;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    transition: transform 0.15s, box-shadow 0.15s;
    box-shadow: 0 4px 16px rgba(255, 107, 53, 0.35);
}

.pedido-cart-bar-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(255, 107, 53, 0.45);
}

/* Cart rows in Step 3 */
.pedido-cart-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-color);
}

.pedido-cart-row-info {
    flex: 1;
    min-width: 0;
}

.pedido-cart-row-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pedido-cart-row-price {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.pedido-cart-row-controls {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

.pedido-cart-row-subtotal {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--accent);
    min-width: 50px;
    text-align: right;
    flex-shrink: 0;
}

.pedido-cart-row-del {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 68, 68, 0.15);
    color: #ff4444;
    font-size: 0.8rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.15s;
}

.pedido-cart-row-del:hover {
    background: #ff4444;
    color: white;
}

/* Delivery method options */
.pedido-envio-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.pedido-envio-opt {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-radius: 10px;
    background: var(--bg-primary);
    border: 2px solid transparent;
    cursor: pointer;
    transition: all 0.15s;
}

.pedido-envio-opt:has(input:checked) {
    border-color: var(--accent);
    background: rgba(255, 107, 53, 0.08);
}

.pedido-envio-opt input[type="radio"] {
    accent-color: var(--accent);
    margin: 0;
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.pedido-envio-label {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-primary);
    white-space: nowrap;
}

.pedido-envio-dest {
    font-size: 0.8rem;
    color: var(--text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ============================================
   DIGITAL SIGNAGE MODULE
   ============================================ */
.signage-tabs {
    display: flex;
    gap: 4px;
    padding: 0 0 16px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.signage-tab {
    padding: 10px 20px;
    background: var(--bg-secondary);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}

.signage-tab.active {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
    box-shadow: 0 4px 12px rgba(255, 107, 53, 0.3);
}

.signage-tab:hover:not(.active) {
    background: var(--bg-card-hover);
    color: var(--text-primary);
}

.signage-cards-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
}

@media (min-width: 768px) {
    .signage-cards-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1200px) {
    .signage-cards-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

.signage-card {
    background: var(--bg-card);
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid var(--border-color);
    transition: var(--transition);
}

.signage-card:hover {
    border-color: var(--border-accent);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.signage-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
}

.signage-card-status {
    font-size: 0.78rem;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 8px;
}

.signage-card-status.active {
    background: rgba(34, 197, 94, 0.15);
    color: #4ade80;
}

.signage-card-status.inactive {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
}

.signage-card-actions {
    display: flex;
    gap: 4px;
}

.signage-card-body {
    padding: 16px;
}

.signage-card-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.signage-card-subtitle {
    font-size: 0.82rem;
    color: var(--text-secondary);
    margin-bottom: 12px;
    line-height: 1.4;
}

.signage-card-info {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.signage-info-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.82rem;
    padding: 4px 0;
}

.signage-info-row .label {
    color: var(--text-secondary);
}

.signage-info-row .value {
    color: var(--text-primary);
    font-weight: 500;
}

.signage-card-footer {
    display: flex;
    gap: 8px;
    padding: 12px 16px;
    border-top: 1px solid var(--border-color);
}

.signage-card-footer .btn {
    flex: 1;
    justify-content: center;
}

.signage-type-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px 12px;
    background: var(--bg-secondary);
    border: 2px solid var(--border-color);
    border-radius: 14px;
    color: var(--text-primary);
    cursor: pointer;
    transition: var(--transition);
    text-align: center;
    gap: 6px;
    line-height: 1.4;
}

.signage-type-btn:hover {
    background: var(--bg-card-hover);
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.signage-type-btn small {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.signage-type-btn strong {
    font-size: 0.9rem;
}

/* Drag & Drop Ghost for Slides */
.signage-slide-row.sortable-ghost {
    opacity: 0.4;
    background: rgba(255, 107, 53, 0.08);
    border-radius: 8px;
}

.signage-drag-handle:hover {
    color: var(--accent) !important;
}

/* ============================================
   Asistente Virtual — Panel Admin de Franjas
   ============================================ */
.assistant-config-modal {
    max-width: 600px;
    margin: 0 auto;
}

.assistant-config-header h2 {
    font-size: 1.3rem;
    margin-bottom: 4px;
}

.assistant-config-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin: 16px 0;
    max-height: 50vh;
    overflow-y: auto;
    padding-right: 4px;
}

.franja-card {
    background: var(--bg-card);
    border-radius: 14px;
    padding: 14px 16px;
    border-left: 4px solid var(--accent);
    transition: var(--transition);
}

.franja-card:hover {
    background: var(--bg-card-hover);
}

.franja-inactiva {
    border-left-color: var(--text-muted);
    opacity: 0.5;
}

.franja-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 8px;
}

.franja-card-title {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.franja-card-title strong {
    font-size: 1rem;
}

.franja-horario {
    font-size: 0.8rem;
    color: var(--accent);
    font-weight: 600;
}

.franja-card-actions {
    display: flex;
    gap: 4px;
}

.franja-saludo {
    font-size: 0.82rem;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.franja-cats {
    font-size: 0.78rem;
    color: var(--color-margen);
    margin-bottom: 4px;
}

.franja-instruccion {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-style: italic;
}

.assistant-config-footer {
    display: flex;
    justify-content: center;
    padding-top: 8px;
}

/* Formulario de edición de franja */
.franja-edit-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.franja-edit-form .form-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.franja-edit-form label {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.franja-edit-form input[type="text"],
.franja-edit-form input[type="time"],
.franja-edit-form textarea {
    padding: 10px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    color: var(--text-primary);
    font-size: 0.9rem;
    outline: none;
    transition: var(--transition-fast);
}

.franja-edit-form input:focus,
.franja-edit-form textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.1);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.cats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
}

.cat-checkbox {
    font-size: 0.82rem;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    background: var(--bg-input);
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition-fast);
}

.cat-checkbox:hover {
    background: var(--bg-card-hover);
}

.cat-checkbox input[type="checkbox"] {
    accent-color: var(--accent);
}

.form-actions {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-top: 8px;
}

.btn-secondary {
    padding: 10px 20px;
    background: var(--bg-input);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-fast);
}

.btn-secondary:hover {
    background: var(--bg-card-hover);
}

/* ============================================
   Chatbot Instrucciones IA
   ============================================ */
.chatbot-container {
    display: flex;
    flex-direction: column;
    height: 65vh;
    max-height: 600px;
    margin: -16px;
    margin-top: -8px;
}

.chatbot-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    border-radius: 12px 12px 0 0;
}

.chatbot-header-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.chatbot-header-icon {
    font-size: 1.8rem;
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent-light);
    border-radius: 12px;
}

.chatbot-header-title {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-primary);
}

.chatbot-header-subtitle {
    font-size: 0.78rem;
    color: var(--text-secondary);
}

.chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: var(--bg-primary);
    scroll-behavior: smooth;
}

.chat-bubble {
    max-width: 85%;
    animation: chatBubbleIn 0.3s ease;
}

.chat-bubble-user {
    align-self: flex-end;
}

.chat-bubble-bot {
    align-self: flex-start;
}

.chat-bubble-content {
    padding: 10px 14px;
    border-radius: 16px;
    font-size: 0.88rem;
    line-height: 1.5;
    word-wrap: break-word;
}

.chat-bubble-user .chat-bubble-content {
    background: var(--accent);
    color: white;
    border-bottom-right-radius: 4px;
}

.chat-bubble-bot .chat-bubble-content {
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-bottom-left-radius: 4px;
}

.chat-bubble-bot .chat-bubble-content strong {
    color: var(--accent);
}

@keyframes chatBubbleIn {
    from {
        opacity: 0;
        transform: translateY(10px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Typing indicator */
.chat-typing {
    display: flex;
    gap: 4px;
    padding: 4px 0;
}

.chat-typing span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-muted);
    animation: chatTypingBounce 1.4s infinite both;
}

.chat-typing span:nth-child(2) {
    animation-delay: 0.2s;
}

.chat-typing span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes chatTypingBounce {
    0%, 80%, 100% {
        transform: scale(0.6);
        opacity: 0.4;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Input area */
.chatbot-input-area {
    display: flex;
    gap: 8px;
    padding: 12px 16px;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
}

.chatbot-input {
    flex: 1;
    padding: 10px 16px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    color: var(--text-primary);
    font-size: 0.88rem;
    outline: none;
    transition: border-color 0.2s;
}

.chatbot-input:focus {
    border-color: var(--accent);
}

.chatbot-input::placeholder {
    color: var(--text-muted);
}

.chatbot-input:disabled {
    opacity: 0.5;
}

.chatbot-send-btn {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: none;
    background: var(--accent);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
    font-size: 1rem;
}

.chatbot-send-btn:hover {
    background: var(--accent-hover);
    transform: scale(1.05);
}

.chatbot-send-btn:active {
    transform: scale(0.95);
}

/* Instrucciones preview panel */
.chatbot-instrucciones-preview {
    padding: 12px 16px;
    background: var(--bg-card);
    border-top: 1px solid var(--border-color);
    max-height: 150px;
    overflow-y: auto;
    transition: all 0.3s ease;
}

.chatbot-instrucciones-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.chatbot-instrucciones-text {
    font-size: 0.78rem;
    color: var(--text-primary);
    background: var(--bg-input);
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    white-space: pre-wrap;
    word-wrap: break-word;
    max-height: 80px;
    overflow-y: auto;
    margin: 0;
    font-family: 'Inter', sans-serif;
    line-height: 1.5;
}

.chatbot-instrucciones-highlight {
    animation: instruccionesHighlight 2s ease;
}

@keyframes instruccionesHighlight {
    0% { border-color: var(--accent); box-shadow: 0 0 12px var(--accent-glow); }
    100% { border-color: var(--border-color); box-shadow: none; }
}