:root {
    --primary: #FF5A5F;
    --primary-light: #FF8A8D;
    --primary-gradient: linear-gradient(135deg, #FF5A5F 0%, #FF7E82 100%);
    --secondary: #00A699;
    --secondary-light: #E6F6F5;
    --accent-blue: #3B82F6;
    --accent-blue-light: #EFF6FF;
    --accent-amber: #F59E0B;
    --accent-amber-light: #FEF3C7;
    --accent-red: #EF4444;
    --accent-red-light: #FEE2E2;
    --bg-color: #F8F9FA;
    --card-bg: #FFFFFF;
    --text-main: #1E293B;
    --text-muted: #64748B;
    --border: #E2E8F0;
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.04);
    --shadow: 0 6px 16px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.12);
    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --font-family: 'Outfit', sans-serif;
    --transition: all 0.25s ease;
}

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

body {
    font-family: var(--font-family);
    background-color: var(--bg-color);
    color: var(--text-main);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
    padding-bottom: 90px;
}

/* Header */
.app-header {
    background: var(--card-bg);
    padding: 0.9rem 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.header-btn {
    background: none;
    border: none;
    font-size: 1.15rem;
    color: var(--text-main);
    cursor: pointer;
    width: 2.4rem;
    height: 2.4rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    transition: var(--transition);
}

.header-btn:hover {
    background-color: #F1F5F9;
}

.app-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.app-title i {
    color: var(--secondary);
}

/* Nav Tabs */
.nav-tabs {
    display: flex;
    background: #E2E8F0;
    border-radius: var(--radius-md);
    padding: 4px;
    margin: 1rem 1.25rem 0.5rem 1.25rem;
    max-width: 600px;
}

@media (min-width: 640px) {
    .nav-tabs {
        margin-left: auto;
        margin-right: auto;
    }
}

.nav-tab {
    flex: 1;
    border: none;
    background: transparent;
    padding: 0.6rem 1rem;
    font-size: 0.95rem;
    font-weight: 600;
    font-family: inherit;
    color: var(--text-muted);
    border-radius: 10px;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.nav-tab.active {
    background: var(--card-bg);
    color: var(--text-main);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

/* Container */
.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 1rem 1.25rem;
}

.hidden {
    display: none !important;
}

/* SCANNER VIEW */
.scanner-section {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow);
    margin-bottom: 1.5rem;
}

.scanner-title-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.scanner-title-row h2 {
    font-size: 1.15rem;
    font-weight: 600;
}

.scanner-modes {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}

.mode-card {
    border: 2px dashed var(--border);
    border-radius: var(--radius-md);
    padding: 1.25rem 0.75rem;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    background: #FAFBFD;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.mode-card:hover, .mode-card.active {
    border-color: var(--primary);
    background: #FFF5F5;
}

.mode-card i {
    font-size: 1.6rem;
    color: var(--primary);
}

.mode-card span {
    font-size: 0.85rem;
    font-weight: 600;
}

/* Live Camera Viewport */
#camera-viewport-wrapper {
    position: relative;
    border-radius: var(--radius-md);
    overflow: hidden;
    background: #000;
    margin-bottom: 1rem;
    min-height: 260px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#reader {
    width: 100% !important;
    border: none !important;
}

#reader video {
    width: 100% !important;
    border-radius: var(--radius-md);
    object-fit: cover;
}

.scanner-laser {
    position: absolute;
    width: 80%;
    left: 10%;
    height: 3px;
    background: linear-gradient(90deg, transparent, #FF5A5F, #FF1744, transparent);
    box-shadow: 0 0 10px #FF5A5F;
    animation: scanAnim 2s infinite ease-in-out;
    pointer-events: none;
    z-index: 5;
}

@keyframes scanAnim {
    0% { top: 20%; opacity: 0.8; }
    50% { top: 80%; opacity: 1; }
    100% { top: 20%; opacity: 0.8; }
}

.scanner-controls {
    display: flex;
    justify-content: center;
    gap: 0.75rem;
    margin-top: 0.75rem;
}

/* Image Upload Area */
.file-upload-box {
    border: 2px dashed #CBD5E1;
    border-radius: var(--radius-md);
    padding: 2rem 1rem;
    text-align: center;
    background: #F8FAFC;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
}

.file-upload-box:hover {
    border-color: var(--secondary);
    background: var(--secondary-light);
}

.file-upload-box i {
    font-size: 2.2rem;
    color: var(--secondary);
    margin-bottom: 0.5rem;
}

.file-upload-box p {
    font-size: 0.95rem;
    color: var(--text-main);
    font-weight: 500;
}

.file-upload-box small {
    color: var(--text-muted);
    font-size: 0.8rem;
    display: block;
    margin-top: 0.25rem;
}

.hidden-file-input {
    display: none;
}

/* Manual Barcode Input */
.manual-input-box {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
}

.manual-input-box input {
    flex: 1;
    padding: 0.65rem 0.9rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-family: inherit;
    outline: none;
}

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

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.65rem 1.25rem;
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-weight: 600;
    font-family: inherit;
    border: none;
    cursor: pointer;
    transition: var(--transition);
}

.btn-primary {
    background: var(--primary-gradient);
    color: white;
}

.btn-primary:hover {
    opacity: 0.92;
    transform: translateY(-1px);
}

.btn-secondary {
    background: #E2E8F0;
    color: var(--text-main);
}

.btn-secondary:hover {
    background: #CBD5E1;
}

.btn-success {
    background: var(--secondary);
    color: white;
}

.btn-danger-outline {
    background: transparent;
    color: var(--accent-red);
    border: 1px solid var(--accent-red-light);
}

.btn-danger-outline:hover {
    background: var(--accent-red-light);
}

/* Recognition Preview Banner */
.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.25rem 0.6rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.pill-local {
    background: var(--secondary-light);
    color: var(--secondary);
}

.pill-off {
    background: var(--accent-blue-light);
    color: var(--accent-blue);
}

.pill-new {
    background: var(--accent-amber-light);
    color: var(--accent-amber);
}

/* Product Card Result */
.product-preview-card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
    margin-top: 1.5rem;
    animation: slideUp 0.3s ease;
}

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

.product-preview-header {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
    margin-bottom: 1.25rem;
}

.product-preview-img {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: var(--radius-md);
    background: #F1F5F9;
    border: 1px solid var(--border);
}

.product-preview-info {
    flex: 1;
}

.product-preview-info h3 {
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.product-brand {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 0.35rem;
}

.product-barcode-tag {
    display: inline-block;
    font-family: monospace;
    font-size: 0.8rem;
    background: #F1F5F9;
    padding: 0.15rem 0.45rem;
    border-radius: 4px;
    color: #475569;
}

/* Product Form Grid */
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.9rem;
    margin-bottom: 1.25rem;
}

.form-group-full {
    grid-column: span 2;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 0.3rem;
    color: var(--text-main);
}

.form-group input, .form-group select, .form-group textarea {
    width: 100%;
    padding: 0.65rem 0.8rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-family: inherit;
    outline: none;
    background: white;
}

.form-group input:focus, .form-group select:focus {
    border-color: var(--secondary);
}

/* Multipack & Packaging Suggestion Box */
.multipack-box {
    background: #F0FDF4;
    border: 1.5px solid #86EFAC;
    border-radius: var(--radius-md);
    padding: 0.85rem 1rem;
    margin-bottom: 0.5rem;
    animation: fadeInToast 0.25s ease;
}

.multipack-title {
    font-size: 0.88rem;
    color: #166534;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.65rem;
}

.multipack-title strong {
    color: #14532D;
    background: #DCFCE7;
    padding: 0.15rem 0.45rem;
    border-radius: 6px;
}

.multipack-options {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.btn-pack-opt {
    background: white;
    border: 1.5px solid #86EFAC;
    border-radius: 20px;
    padding: 0.45rem 0.85rem;
    font-size: 0.82rem;
    font-family: inherit;
    color: #166534;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
}

.btn-pack-opt:hover {
    background: #DCFCE7;
    border-color: #22C55E;
    transform: translateY(-1px);
}

.btn-pack-opt.active {
    background: #16A34A;
    color: white;
    border-color: #15803D;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(22, 163, 74, 0.35);
}

.btn-pack-opt.active small {
    color: #F0FDF4;
    opacity: 0.9;
}

.btn-pack-opt small {
    color: #64748B;
    font-size: 0.75rem;
}

/* Product Type Selector Radios */
.type-radios {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

.type-radio-label {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.55rem 0.35rem;
    text-align: center;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.2rem;
    background: var(--card-bg);
}

.type-radios input {
    display: none;
}

.type-radios input[value="ingredient"]:checked + .type-radio-label {
    border-color: #10B981;
    background: #ECFDF5;
    color: #065F46;
    font-weight: 700;
    box-shadow: 0 0 0 1px #10B981;
}

.type-radios input[value="plat"]:checked + .type-radio-label {
    border-color: #F97316;
    background: #FFF7ED;
    color: #9A3412;
    font-weight: 700;
    box-shadow: 0 0 0 1px #F97316;
}

/* Location Selector Radios */
.location-radios {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

.location-radio-label {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.5rem 0.25rem;
    text-align: center;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.2rem;
}

.location-radios input {
    display: none;
}

.location-radios input:checked + .location-radio-label {
    border-color: var(--secondary);
    background: var(--secondary-light);
    color: var(--secondary);
    font-weight: 700;
}

/* STOCK INVENTORY VIEW */
.stock-filter-bar {
    display: flex;
    gap: 0.5rem;
    overflow-x: auto;
    padding-bottom: 0.5rem;
    margin-bottom: 1rem;
    scrollbar-width: none;
}

.stock-filter-bar::-webkit-scrollbar {
    display: none;
}

.filter-chip {
    white-space: nowrap;
    border: 1px solid var(--border);
    background: var(--card-bg);
    border-radius: 30px;
    padding: 0.4rem 0.9rem;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.filter-chip.active {
    background: var(--text-main);
    color: white;
    border-color: var(--text-main);
}

.stock-filters-wrapper {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.filter-bar-label {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 0.04em;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    white-space: nowrap;
    padding-right: 0.25rem;
}

.type-filter-chip {
    white-space: nowrap;
    border: 1px solid var(--border);
    background: var(--card-bg);
    border-radius: 30px;
    padding: 0.35rem 0.85rem;
    font-size: 0.82rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 0.35rem;
    color: var(--text-main);
}

.type-filter-chip:hover {
    border-color: #CBD5E1;
    background: #F8FAFC;
}

.type-filter-chip.active {
    background: #475569;
    color: white;
    border-color: #475569;
    box-shadow: 0 1px 3px rgba(0,0,0,0.12);
}

.type-filter-chip[data-type-filter="ingredient"].active {
    background: #059669;
    border-color: #059669;
    color: white;
}

.type-filter-chip[data-type-filter="plat"].active {
    background: #EA580C;
    border-color: #EA580C;
    color: white;
}

.stock-search-row {
    position: relative;
    margin-bottom: 1rem;
}

.stock-search-row input {
    width: 100%;
    padding: 0.75rem 1rem 0.75rem 2.4rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--card-bg);
    font-size: 0.95rem;
    font-family: inherit;
    outline: none;
    box-shadow: var(--shadow-sm);
}

.stock-search-row i {
    position: absolute;
    left: 0.9rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

/* Stock List Grid */
.stock-grid {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.stock-card {
    background: var(--card-bg);
    border-radius: var(--radius-md);
    padding: 1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    transition: var(--transition);
}

.stock-card:hover {
    box-shadow: var(--shadow);
}

.stock-card-img {
    width: 60px;
    height: 60px;
    border-radius: var(--radius-sm);
    object-fit: cover;
    background: #F1F5F9;
    flex-shrink: 0;
}

.stock-card-content {
    flex: 1;
    min-width: 0;
}

.stock-card-title {
    font-size: 1rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 0.2rem;
}

.stock-card-sub {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 0.35rem;
    flex-wrap: wrap;
}

.loc-tag {
    padding: 0.15rem 0.45rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
}

.loc-congelateur { background: #E0F2FE; color: #0369A1; }
.loc-cave { background: #FEF3C7; color: #92400E; }

.type-tag {
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.type-tag.type-plat {
    background: #FFF7ED;
    color: #C2410C;
    border: 1px solid #FFEDD5;
}

.type-tag.type-ingredient {
    background: #F0FDF4;
    color: #15803D;
    border: 1px solid #DCFCE7;
}

.expiry-badge {
    padding: 0.15rem 0.45rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}

.expiry-expired { background: var(--accent-red-light); color: var(--accent-red); }
.expiry-soon { background: var(--accent-amber-light); color: var(--accent-amber); }
.expiry-ok { background: var(--secondary-light); color: var(--secondary); }

/* Quantity Stepper in Card */
.stock-stepper {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    background: #F8FAFC;
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 0.2rem 0.4rem;
}

.step-btn {
    background: white;
    border: 1px solid var(--border);
    width: 26px;
    height: 26px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    color: var(--text-main);
}

.step-btn:hover {
    background: var(--text-main);
    color: white;
}

.step-val {
    font-size: 0.9rem;
    font-weight: 700;
    min-width: 28px;
    text-align: center;
}

.stock-card-actions {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.5rem;
}

.card-btn-row {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.btn-card-edit {
    background: none;
    border: none;
    color: #94A3B8;
    cursor: pointer;
    padding: 0.25rem 0.35rem;
    font-size: 0.9rem;
    border-radius: 4px;
    transition: var(--transition);
}

.btn-card-edit:hover {
    color: var(--secondary);
    background: var(--secondary-light);
}

.btn-card-del {
    background: none;
    border: none;
    color: #94A3B8;
    cursor: pointer;
    padding: 0.25rem 0.35rem;
    font-size: 0.9rem;
    border-radius: 4px;
    transition: var(--transition);
}

.btn-card-del:hover {
    color: var(--accent-red);
    background: var(--accent-red-light);
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 3rem 1.5rem;
    color: var(--text-muted);
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: 1rem;
    color: #CBD5E1;
}

.empty-state h3 {
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 0.5rem;
}

/* Toast */
#toast-container {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    pointer-events: none;
}

.toast {
    background: rgba(30, 41, 59, 0.95);
    color: white;
    padding: 0.75rem 1.25rem;
    border-radius: 30px;
    font-size: 0.9rem;
    font-weight: 500;
    box-shadow: var(--shadow-lg);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    gap: 0.6rem;
    animation: fadeInToast 0.25s ease;
}

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

/* ====================================================
   CHEF IA (GEMMA 4) STYLING
   ==================================================== */

.nav-tab-ai {
    color: #6366F1 !important;
}

.nav-tab-ai.active {
    color: #4F46E5 !important;
    background: white;
}

/* Hero Banner */
.ai-hero-card {
    background: linear-gradient(135deg, #4F46E5 0%, #7C3AED 50%, #EC4899 100%);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    color: white;
    display: flex;
    align-items: center;
    gap: 1.25rem;
    box-shadow: 0 10px 25px -5px rgba(99, 102, 241, 0.4);
    margin-bottom: 1.25rem;
}

.ai-hero-icon {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.ai-hero-text h2 {
    font-size: 1.3rem;
    font-weight: 700;
    color: white;
    margin-bottom: 0.25rem;
}

.ai-hero-text p {
    font-size: 0.88rem;
    opacity: 0.92;
    line-height: 1.4;
}

/* Sections */
.ai-section-box {
    background: var(--card-bg);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    margin-bottom: 1.25rem;
}

.ai-box-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.9rem;
}

.ai-box-header h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-text {
    background: none;
    border: none;
    color: #4F46E5;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
}

.btn-text:hover {
    text-decoration: underline;
}

/* Checklist of stock ingredients */
.ai-ingredients-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    max-height: 220px;
    overflow-y: auto;
    padding: 2px;
}

.ai-ing-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.45rem 0.75rem;
    border: 1.5px solid var(--border);
    border-radius: 20px;
    font-size: 0.85rem;
    background: #F8FAFC;
    cursor: pointer;
    transition: var(--transition);
    user-select: none;
}

.ai-ing-chip.selected {
    background: #EEF2FF;
    border-color: #6366F1;
    color: #3730A3;
    font-weight: 600;
}

.ai-ing-chip input[type="checkbox"] {
    accent-color: #4F46E5;
    cursor: pointer;
}

/* Style filter chips */
.ai-styles-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
}

.ai-style-chip {
    border: 1px solid var(--border);
    background: #F8FAFC;
    border-radius: 20px;
    padding: 0.4rem 0.85rem;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    font-family: inherit;
    transition: var(--transition);
}

.ai-style-chip.active {
    background: #4F46E5;
    color: white;
    border-color: #4F46E5;
    box-shadow: 0 2px 6px rgba(79, 70, 229, 0.3);
}

/* Generate Button */
.btn-ai-generate {
    width: 100%;
    background: linear-gradient(135deg, #4F46E5 0%, #7C3AED 100%);
    color: white;
    font-size: 1.05rem;
    font-weight: 700;
    padding: 0.95rem 1.5rem;
    border-radius: var(--radius-md);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.btn-ai-generate:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(99, 102, 241, 0.45);
}

/* Loading Box */
.ai-loading-box {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: 2.5rem 1.5rem;
    text-align: center;
    border: 1px dashed #6366F1;
    margin-bottom: 1.5rem;
    animation: pulseBorder 2s infinite ease-in-out;
}

@keyframes pulseBorder {
    0%, 100% { border-color: #6366F1; box-shadow: 0 0 0 rgba(99, 102, 241, 0); }
    50% { border-color: #EC4899; box-shadow: 0 0 16px rgba(236, 72, 153, 0.2); }
}

.ai-spinner-container {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: #EEF2FF;
    color: #4F46E5;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem auto;
    font-size: 1.75rem;
}

.ai-loading-box h3 {
    font-size: 1.15rem;
    font-weight: 700;
    margin-bottom: 0.35rem;
}

.ai-loading-box p {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 0.75rem;
}

.ai-loading-box small {
    display: inline-block;
    background: #F1F5F9;
    padding: 0.25rem 0.65rem;
    border-radius: 12px;
    font-size: 0.75rem;
    color: #475569;
}

/* Error Banner */
.ai-error-banner {
    background: #FEF2F2;
    border: 1px solid #FCA5A5;
    border-radius: var(--radius-md);
    padding: 1rem 1.25rem;
    color: #991B1B;
    display: flex;
    gap: 1rem;
    align-items: flex-start;
    margin-bottom: 1.5rem;
}

.ai-error-banner h4 {
    font-size: 0.95rem;
    font-weight: 700;
    margin-bottom: 0.2rem;
}

.ai-error-banner p {
    font-size: 0.85rem;
    line-height: 1.4;
}

/* Results Grid */
.ai-results-grid {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.ai-recipe-card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    animation: slideUp 0.3s ease;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.ai-recipe-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.75rem;
    border-bottom: 1px solid var(--border);
    padding-bottom: 0.85rem;
}

.ai-recipe-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-main);
    line-height: 1.3;
}

.ai-recipe-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-top: 0.5rem;
}

.ai-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.2rem 0.5rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    background: #F1F5F9;
    color: #475569;
}

.ai-recipe-desc {
    font-size: 0.92rem;
    color: #475569;
    font-style: italic;
    line-height: 1.45;
}

/* Ingredients in Card */
.ai-card-section-title {
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin-bottom: 0.4rem;
}

.ai-recipe-ingredients {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.ai-ing-tag {
    font-size: 0.8rem;
    padding: 0.25rem 0.55rem;
    border-radius: 6px;
    font-weight: 500;
}

.ai-ing-stock {
    background: #DCFCE7;
    color: #15803D;
    border: 1px solid #BBF7D0;
}

.ai-ing-pantry {
    background: #F8FAFC;
    color: #64748B;
    border: 1px solid var(--border);
}

/* Steps list */
.ai-recipe-steps {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    counter-reset: step-counter;
}

.ai-recipe-steps li {
    counter-increment: step-counter;
    position: relative;
    padding-left: 2rem;
    font-size: 0.9rem;
    line-height: 1.45;
    color: var(--text-main);
}

.ai-recipe-steps li::before {
    content: counter(step-counter);
    position: absolute;
    left: 0;
    top: 2px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #EEF2FF;
    color: #4F46E5;
    font-size: 0.75rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ai-reheating-tip {
    background: #FFFBEB;
    border-left: 3px solid #F59E0B;
    padding: 0.6rem 0.85rem;
    border-radius: 0 8px 8px 0;
    font-size: 0.85rem;
    color: #92400E;
}

.ai-card-footer {
    display: flex;
    justify-content: flex-end;
    border-top: 1px solid var(--border);
    padding-top: 0.85rem;
}

.btn-add-carnet {
    background: #00A699;
    color: white;
    padding: 0.55rem 1rem;
    border-radius: var(--radius-sm);
    font-size: 0.88rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    transition: var(--transition);
}

.btn-add-carnet:hover {
    background: #008f84;
    transform: translateY(-1px);
}

.btn-add-carnet.added {
    background: #10B981;
    cursor: default;
}

/* ====================================================
   MODALE D'ÉDITION DE PRODUIT
   ==================================================== */
.stock-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 1rem;
}

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

.stock-modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    animation: fadeInBackdrop 0.2s ease-out;
}

@keyframes fadeInBackdrop {
    from { opacity: 0; }
    to { opacity: 1; }
}

.stock-modal-content {
    position: relative;
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 560px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 45px rgba(0, 0, 0, 0.18);
    border: 1px solid rgba(226, 232, 240, 0.9);
    overflow: hidden;
    animation: slideUpModal 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 10;
}

@keyframes slideUpModal {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.97);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.stock-modal-header {
    padding: 1.1rem 1.4rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #FAFBFD;
}

.stock-modal-header-info {
    display: flex;
    align-items: center;
    gap: 0.85rem;
}

.stock-modal-img {
    width: 48px;
    height: 48px;
    object-fit: cover;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: #F1F5F9;
}

.stock-modal-header h2 {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.stock-modal-header h2 i {
    color: var(--secondary);
}

.stock-modal-subtitle {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.15rem;
}

.stock-modal-close {
    background: none;
    border: none;
    font-size: 1.15rem;
    cursor: pointer;
    color: #94A3B8;
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.stock-modal-close:hover {
    background: #F1F5F9;
    color: var(--text-main);
}

.stock-modal-body {
    padding: 1.25rem 1.4rem;
    overflow-y: auto;
    flex: 1;
}

.stock-modal-footer {
    padding: 0.9rem 1.4rem;
    border-top: 1px solid var(--border);
    background: #FAFBFD;
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
}

/* Animation de flash après mise à jour d'une carte */
@keyframes itemUpdatedFlash {
    0% {
        background-color: #ECFDF5;
        border-color: #10B981;
        transform: scale(1.02);
    }
    100% {
        background-color: var(--card-bg);
        border-color: var(--border);
        transform: scale(1);
    }
}

.card-updated-flash {
    animation: itemUpdatedFlash 1.4s ease-out;
}

/* ====================================================
   SCAN CONTINU / À LA VOLÉE
   ==================================================== */
.continuous-scan-bar {
    background: #FFFBEB;
    border: 1px solid #FDE68A;
    border-radius: var(--radius-md);
    padding: 0.75rem 1rem;
    margin-bottom: 1.25rem;
    box-shadow: var(--shadow-sm);
}

.continuous-switch {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    cursor: pointer;
    user-select: none;
    width: 100%;
}

.continuous-switch input {
    display: none;
}

.continuous-switch-slider {
    position: relative;
    width: 44px;
    height: 24px;
    background-color: #CBD5E1;
    border-radius: 20px;
    transition: var(--transition);
    flex-shrink: 0;
}

.continuous-switch-slider::before {
    content: "";
    position: absolute;
    width: 18px;
    height: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    border-radius: 50%;
    transition: var(--transition);
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.continuous-switch input:checked + .continuous-switch-slider {
    background-color: #F59E0B;
}

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

.continuous-switch-label {
    display: flex;
    flex-direction: column;
}

.continuous-switch-label .switch-title {
    font-size: 0.92rem;
    font-weight: 700;
    color: #92400E;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.continuous-switch-label .switch-desc {
    font-size: 0.78rem;
    color: #B45309;
}

/* HUD Toast sur la caméra */
.scan-hud-toast {
    position: absolute;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(15, 23, 42, 0.9);
    backdrop-filter: blur(6px);
    color: white;
    padding: 0.55rem 1.1rem;
    border-radius: 30px;
    font-size: 0.85rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.55rem;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
    z-index: 10;
    pointer-events: none;
    animation: popHudToast 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    white-space: nowrap;
    max-width: 90%;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

@keyframes popHudToast {
    from { opacity: 0; transform: translate(-50%, 15px) scale(0.9); }
    to { opacity: 1; transform: translate(-50%, 0) scale(1); }
}

.cam-flash-success {
    box-shadow: 0 0 0 4px #10B981 !important;
}

/* Feed des articles scannés à la volée */
.continuous-session-card {
    margin-top: 1.25rem;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    animation: fadeIn 0.3s ease;
}

.continuous-session-header {
    padding: 0.85rem 1rem;
    background: #FAFBFD;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.continuous-session-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 0.45rem;
}

.continuous-session-title i {
    color: var(--secondary);
}

.btn-link-inventory {
    background: none;
    border: none;
    color: var(--secondary);
    font-weight: 600;
    font-size: 0.82rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.35rem;
    transition: var(--transition);
}

.btn-link-inventory:hover {
    color: #008f84;
    text-decoration: underline;
}

.continuous-items-list {
    max-height: 290px;
    overflow-y: auto;
    padding: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.continuous-item-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: #F8FAFC;
    border: 1px solid #E2E8F0;
    border-radius: var(--radius-sm);
    padding: 0.55rem 0.75rem;
    animation: slideDownRow 0.25s ease-out;
}

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

.continuous-item-img {
    width: 38px;
    height: 38px;
    border-radius: 6px;
    object-fit: cover;
    background: #FFF;
    border: 1px solid #CBD5E1;
    flex-shrink: 0;
}

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

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

.continuous-item-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin-top: 0.15rem;
}

.continuous-item-stepper {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    background: white;
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 2px 6px;
}

.continuous-step-btn {
    background: none;
    border: none;
    font-weight: 700;
    cursor: pointer;
    color: var(--text-main);
    padding: 0 4px;
    font-size: 0.85rem;
    transition: var(--transition);
}

.continuous-step-btn:hover {
    color: var(--primary);
}

.continuous-step-val {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--text-main);
    min-width: 18px;
    text-align: center;
}

.continuous-session-footer {
    padding: 0.75rem 1rem;
    border-top: 1px solid var(--border);
    background: #FAFBFD;
}



